feat(editor): Use website as the main templates repository (#8591)
This commit is contained in:
committed by
GitHub
parent
5ab34fe335
commit
79b09fdf84
@@ -1,5 +1,5 @@
|
||||
import { defineStore } from 'pinia';
|
||||
import { STORES } from '@/constants';
|
||||
import { STORES, TEMPLATES_URLS } from '@/constants';
|
||||
import type {
|
||||
INodeUi,
|
||||
ITemplatesCategory,
|
||||
@@ -109,6 +109,38 @@ export const useTemplatesStore = defineStore(STORES.TEMPLATES, {
|
||||
);
|
||||
};
|
||||
},
|
||||
hasCustomTemplatesHost(): boolean {
|
||||
const settingsStore = useSettingsStore();
|
||||
return settingsStore.templatesHost !== TEMPLATES_URLS.DEFAULT_API_HOST;
|
||||
},
|
||||
/**
|
||||
* Construct the URL for the template repository on the website
|
||||
* @returns {string}
|
||||
*/
|
||||
getWebsiteTemplateRepositoryURL(): string {
|
||||
return `${TEMPLATES_URLS.BASE_WEBSITE_URL}?${TEMPLATES_URLS.UTM_QUERY}&utm_instance=${this.getCurrentN8nPath}`;
|
||||
},
|
||||
/**
|
||||
* Construct the URL for the template page on the website for a given template id
|
||||
* @returns {function(string): string}
|
||||
*/
|
||||
getWebsiteTemplatePageURL() {
|
||||
return (id: string) => {
|
||||
return `${TEMPLATES_URLS.BASE_WEBSITE_URL}/${id}?${TEMPLATES_URLS.UTM_QUERY}&utm_instance=${this.getCurrentN8nPath}`;
|
||||
};
|
||||
},
|
||||
/**
|
||||
* Construct the URL for the template category page on the website for a given category id
|
||||
* @returns {function(string): string}
|
||||
*/
|
||||
getWebsiteCategoryURL() {
|
||||
return (id: string) => {
|
||||
return `${TEMPLATES_URLS.BASE_WEBSITE_URL}/?categories=${id}&${TEMPLATES_URLS.UTM_QUERY}&utm_instance=${this.getCurrentN8nPath}`;
|
||||
};
|
||||
},
|
||||
getCurrentN8nPath(): string {
|
||||
return `${window.location.host}${window.BASE_PATH}`;
|
||||
},
|
||||
},
|
||||
actions: {
|
||||
addCategories(categories: ITemplatesCategory[]): void {
|
||||
|
||||
Reference in New Issue
Block a user