@useinsider/guido 1.0.0-beta.a09b7c4 → 1.0.0-beta.a19efaa
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +265 -12
- package/dist/@types/generic.d.ts +14 -0
- package/dist/App.vue.d.ts +1 -1
- package/dist/_virtual/AddCustomFont.js +4 -0
- package/dist/_virtual/AiAssistantValueType.js +4 -0
- package/dist/_virtual/BackgroundColorBuiltInControl.js +4 -0
- package/dist/_virtual/BackgroundImageBuiltInControl.js +4 -0
- package/dist/_virtual/Block.js +4 -0
- package/dist/_virtual/BlockAttributes.js +4 -0
- package/dist/_virtual/BlockCompositionType.js +4 -0
- package/dist/_virtual/BlockPaddingsBuiltInControl.js +4 -0
- package/dist/_virtual/BlockRenderer.js +4 -0
- package/dist/_virtual/BlockType.js +4 -0
- package/dist/_virtual/BlocksPanel.js +4 -0
- package/dist/_virtual/BuiltInControl.js +4 -0
- package/dist/_virtual/BuiltInControlTypes.js +4 -0
- package/dist/_virtual/ButtonBorderBuiltInControl.js +4 -0
- package/dist/_virtual/ButtonColorBuiltInControl.js +4 -0
- package/dist/_virtual/ButtonFontColorBuiltInControl.js +4 -0
- package/dist/_virtual/ButtonInternalIndentsBuiltInControl.js +4 -0
- package/dist/_virtual/ButtonTextBuiltInControl.js +4 -0
- package/dist/_virtual/ContextAction.js +4 -0
- package/dist/_virtual/ContextActionType.js +4 -0
- package/dist/_virtual/Control.js +4 -0
- package/dist/_virtual/EditorStatePropertyType.js +4 -0
- package/dist/_virtual/Extension.js +4 -0
- package/dist/_virtual/ExtensionBuilder.js +4 -0
- package/dist/_virtual/FontFamilyBuiltInControl.js +4 -0
- package/dist/_virtual/LinkColorBuiltInControl.js +4 -0
- package/dist/_virtual/ModificationDescription.js +4 -0
- package/dist/_virtual/PanelPosition.js +4 -0
- package/dist/_virtual/PreviewDeviceMode.js +4 -0
- package/dist/_virtual/SettingsPanelRegistry.js +4 -0
- package/dist/_virtual/SettingsPanelTab.js +4 -0
- package/dist/_virtual/SettingsTab.js +4 -0
- package/dist/_virtual/StructureBorderBuiltInControl.js +4 -0
- package/dist/_virtual/StructurePaddingsBuiltInControl.js +4 -0
- package/dist/_virtual/TextColorBuiltInControl.js +4 -0
- package/dist/_virtual/TextLineSpacingBuiltInControl.js +4 -0
- package/dist/_virtual/TextSizeBuiltInControl.js +4 -0
- package/dist/_virtual/TextStyleBuiltInControl.js +4 -0
- package/dist/_virtual/UIElement.js +4 -0
- package/dist/_virtual/UIElementTagRegistry.js +4 -0
- package/dist/_virtual/UIElementType.js +4 -0
- package/dist/_virtual/UIElementsAttributes.js +4 -0
- package/dist/_virtual/index.js +5 -0
- package/dist/_virtual/index2.js +4 -0
- package/dist/components/Guido.vue.d.ts +9 -2
- package/dist/components/Guido.vue.js +8 -8
- package/dist/components/Guido.vue2.js +38 -27
- package/dist/components/organisms/header/LeftSlot.vue.d.ts +1 -1
- package/dist/components/organisms/header/LeftSlot.vue.js +8 -8
- package/dist/components/organisms/header/LeftSlot.vue2.js +5 -3
- package/dist/components/organisms/header/MiddleSlot.vue.js +8 -8
- package/dist/components/organisms/header/MiddleSlot.vue2.js +15 -15
- package/dist/components/organisms/header/RightSlot.vue.d.ts +1 -1
- package/dist/components/organisms/header/RightSlot.vue.js +7 -7
- package/dist/components/organisms/header/RightSlot.vue2.js +16 -14
- package/dist/components/organisms/header/ViewOptions.vue.d.ts +1 -1
- package/dist/components/organisms/header/ViewOptions.vue.js +18 -0
- package/dist/components/organisms/header/ViewOptions.vue2.js +15 -0
- package/dist/components/organisms/header/version-history/RestoreButton.vue.d.ts +2 -0
- package/dist/components/organisms/header/version-history/RestoreButton.vue.js +19 -0
- package/dist/components/organisms/header/version-history/RestoreButton.vue2.js +14 -0
- package/dist/components/organisms/header/version-history/VersionHistory.vue.d.ts +13 -1
- package/dist/components/organisms/header/version-history/VersionHistory.vue.js +7 -7
- package/dist/components/organisms/header/version-history/VersionHistory.vue2.js +13 -10
- package/dist/components/organisms/header/version-history/VersionHistoryItem.vue.d.ts +1 -1
- package/dist/components/organisms/header/version-history/VersionHistoryItem.vue.js +1 -1
- package/dist/components/organisms/header/version-history/ViewOptions.vue.d.ts +1 -1
- package/dist/components/organisms/header/version-history/ViewOptions.vue.js +18 -0
- package/dist/components/organisms/header/version-history/ViewOptions.vue2.js +23 -0
- package/dist/composables/useActionsApi.d.ts +1 -0
- package/dist/composables/useActionsApi.js +14 -12
- package/dist/composables/useCustomInterfaceAppearance.js +45 -9
- package/dist/composables/useExport.d.ts +1 -1
- package/dist/composables/useExport.js +35 -20
- package/dist/composables/useHtmlCompiler.d.ts +4 -0
- package/dist/composables/useHtmlCompiler.js +16 -0
- package/dist/composables/useStripo.js +44 -28
- package/dist/config/compiler/htmlCompilerRules.d.ts +2 -0
- package/dist/config/compiler/htmlCompilerRules.js +145 -0
- package/dist/config/compiler/outlookCompilerRules.d.ts +0 -0
- package/dist/enums/displayConditions.d.ts +2 -0
- package/dist/enums/displayConditions.js +80 -0
- package/dist/extensions/DynamicContent/dynamic-content-modal.d.ts +6 -0
- package/dist/extensions/DynamicContent/dynamic-content-modal.js +27 -0
- package/dist/extensions/DynamicContent/dynamic-content.css.js +24 -0
- package/dist/extensions/DynamicContent/dynamic-content.d.ts +16 -0
- package/dist/extensions/DynamicContent/dynamic-content.js +63 -0
- package/dist/extensions/DynamicContent/extension.d.ts +2 -0
- package/dist/extensions/DynamicContent/extension.js +11 -0
- package/dist/guido.css +1 -1
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/Extension.js +51 -0
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/ExtensionBuilder.js +52 -0
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/blocks/Block.js +41 -0
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/blocks/BlockRenderer.js +18 -0
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/blocks/BlocksPanel.js +32 -0
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/blocks/ContextAction.js +18 -0
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/constants/AddCustomFont.js +8 -0
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/constants/AiAssistantValueType.js +13 -0
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/constants/BlockAttributes.js +34 -0
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/constants/BlockCompositionType.js +13 -0
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/constants/BlockType.js +13 -0
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/constants/BuiltInControlTypes.js +104 -0
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/constants/ContextActionType.js +13 -0
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/constants/EditorStatePropertyType.js +13 -0
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/constants/PanelPosition.js +13 -0
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/constants/PreviewDeviceMode.js +13 -0
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/constants/SettingsTab.js +13 -0
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/constants/UIElementType.js +13 -0
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/constants/UIElementsAttributes.js +45 -0
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/controls/BackgroundColorBuiltInControl.js +43 -0
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/controls/BackgroundImageBuiltInControl.js +46 -0
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/controls/BlockPaddingsBuiltInControl.js +44 -0
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/controls/BuiltInControl.js +22 -0
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/controls/ButtonBorderBuiltInControl.js +46 -0
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/controls/ButtonColorBuiltInControl.js +46 -0
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/controls/ButtonFontColorBuiltInControl.js +45 -0
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/controls/ButtonInternalIndentsBuiltInControl.js +45 -0
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/controls/ButtonTextBuiltInControl.js +45 -0
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/controls/Control.js +20 -0
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/controls/FontFamilyBuiltInControl.js +43 -0
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/controls/LinkColorBuiltInControl.js +45 -0
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/controls/SettingsPanelRegistry.js +18 -0
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/controls/SettingsPanelTab.js +32 -0
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/controls/StructureBorderBuiltInControl.js +46 -0
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/controls/StructurePaddingsBuiltInControl.js +44 -0
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/controls/TextColorBuiltInControl.js +43 -0
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/controls/TextLineSpacingBuiltInControl.js +43 -0
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/controls/TextSizeBuiltInControl.js +45 -0
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/controls/TextStyleBuiltInControl.js +43 -0
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/index.js +266 -0
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/modifications/ModificationDescription.js +26 -0
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/ui-elements/UIElement.js +22 -0
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/ui-elements/UIElementTagRegistry.js +18 -0
- package/dist/static/styles/base.css.js +11 -0
- package/dist/static/styles/components/alert-message.css.js +39 -0
- package/dist/static/styles/components/amp-block.css.js +18 -0
- package/dist/static/styles/components/base-input.css.js +47 -0
- package/dist/static/styles/components/button-group.css.js +54 -0
- package/dist/static/styles/components/button.css.js +106 -0
- package/dist/static/styles/components/combobox.css.js +49 -0
- package/dist/static/styles/components/counter.css.js +42 -0
- package/dist/static/styles/components/dropdown-menu.css.js +52 -0
- package/dist/static/styles/components/narrow-panel.css.js +38 -0
- package/dist/static/styles/components/switcher.css.js +11 -0
- package/dist/static/styles/components/tabs.css.js +97 -0
- package/dist/static/styles/components/tools.css.js +23 -0
- package/dist/static/styles/components/version-history.css.js +30 -0
- package/dist/static/styles/components/wide-panel.css.js +135 -0
- package/dist/static/styles/variables.css.js +23 -0
- package/dist/stores/editor.d.ts +1 -1
- package/dist/stores/editor.js +4 -4
- package/dist/utils/htmlCompiler.d.ts +12 -0
- package/dist/utils/htmlCompiler.js +70 -0
- package/dist/utils/tooltipUtils.d.ts +2 -0
- package/dist/utils/tooltipUtils.js +9 -0
- package/package.json +6 -5
- package/dist/components/organisms/base/ModalWrapper.vue.d.ts +0 -72
- package/dist/components/organisms/base/ModalWrapper.vue.js +0 -19
- package/dist/components/organisms/base/ModalWrapper.vue2.js +0 -43
- package/dist/components/organisms/save-template/SaveTemplateModal.vue.d.ts +0 -16
- package/dist/components/organisms/save-template/SaveTemplateModal.vue.js +0 -22
- package/dist/components/organisms/save-template/SaveTemplateModal.vue2.js +0 -86
- package/dist/composables/useSaveAsTemplate.d.ts +0 -17
- package/dist/composables/useSaveAsTemplate.js +0 -44
- package/dist/composables/useTemplateCategories.d.ts +0 -35
- package/dist/composables/useTemplateCategories.js +0 -78
- package/dist/composables/useTemplateNameValidation.d.ts +0 -13
- package/dist/composables/useTemplateNameValidation.js +0 -57
- package/dist/mock/api/template-library.d.ts +0 -2
- package/dist/static/editor.css.js +0 -232
- package/dist/utils/base64.d.ts +0 -1
- package/dist/utils/base64.js +0 -14
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
var y = Object.defineProperty;
|
|
2
|
+
var g = (p, e, r) => e in p ? y(p, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : p[e] = r;
|
|
3
|
+
var u = (p, e, r) => g(p, typeof e != "symbol" ? e + "" : e, r);
|
|
4
|
+
import { useToaster as m } from "../composables/useToaster.js";
|
|
5
|
+
class d {
|
|
6
|
+
constructor(e = []) {
|
|
7
|
+
u(this, "rules");
|
|
8
|
+
this.rules = e;
|
|
9
|
+
}
|
|
10
|
+
compile(e, r) {
|
|
11
|
+
const l = performance.now(), t = e, o = e.length;
|
|
12
|
+
let s = e;
|
|
13
|
+
const a = [];
|
|
14
|
+
(r || this.rules).sort((n, c) => n.priority - c.priority).forEach((n) => {
|
|
15
|
+
const c = s.length;
|
|
16
|
+
s = this.applyRule(s, n), s.length !== c && a.push(n.id);
|
|
17
|
+
});
|
|
18
|
+
const i = s.length, R = o > 0 ? (o - i) / o * 100 : 0;
|
|
19
|
+
return {
|
|
20
|
+
originalHtml: t,
|
|
21
|
+
compiledHtml: s,
|
|
22
|
+
appliedRules: a,
|
|
23
|
+
// TODO: We can use stats for monitoring in the future
|
|
24
|
+
stats: {
|
|
25
|
+
originalSize: o,
|
|
26
|
+
compiledSize: i,
|
|
27
|
+
reductionPercentage: R,
|
|
28
|
+
executionTime: performance.now() - l
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
applyRule(e, r) {
|
|
33
|
+
try {
|
|
34
|
+
switch (r.type) {
|
|
35
|
+
case "replace":
|
|
36
|
+
return this.applyReplaceRule(e, r);
|
|
37
|
+
case "regex":
|
|
38
|
+
return this.applyRegexRule(e, r);
|
|
39
|
+
case "remove":
|
|
40
|
+
return this.applyRemoveRule(e, r);
|
|
41
|
+
case "custom":
|
|
42
|
+
return this.applyCustomRule(e, r);
|
|
43
|
+
default:
|
|
44
|
+
return e;
|
|
45
|
+
}
|
|
46
|
+
} catch (l) {
|
|
47
|
+
const { handleError: t } = m();
|
|
48
|
+
return t(l, `Failed to apply rule ${r.id}:`), e;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
applyReplaceRule(e, r) {
|
|
52
|
+
const { search: l, replacement: t, replaceAll: o = !0 } = r;
|
|
53
|
+
return o ? e.replaceAll(l, t) : e.replace(l, t);
|
|
54
|
+
}
|
|
55
|
+
applyRegexRule(e, r) {
|
|
56
|
+
const { pattern: l, replacement: t, flags: o = "g" } = r, s = new RegExp(l, o);
|
|
57
|
+
return e.replace(s, t);
|
|
58
|
+
}
|
|
59
|
+
applyRemoveRule(e, r) {
|
|
60
|
+
return r.targets.reduce((l, t) => t instanceof RegExp ? l.replace(t, "") : l.replaceAll(t, ""), e);
|
|
61
|
+
}
|
|
62
|
+
applyCustomRule(e, r) {
|
|
63
|
+
return r.processor(e);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
const A = (p = []) => new d(p);
|
|
67
|
+
export {
|
|
68
|
+
d as HtmlCompilerEngine,
|
|
69
|
+
A as createHtmlCompiler
|
|
70
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@useinsider/guido",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.a19efaa",
|
|
4
4
|
"description": "Guido is a Vue + TypeScript wrapper for Email Plugin. Easily embed the email editor in your Vue applications.",
|
|
5
5
|
"main": "./dist/guido.umd.cjs",
|
|
6
6
|
"module": "./dist/library.js",
|
|
@@ -10,9 +10,9 @@
|
|
|
10
10
|
],
|
|
11
11
|
"exports": {
|
|
12
12
|
".": {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
"import": "./dist/library.js",
|
|
14
|
+
"types": "./dist/components/Guido.vue.d.ts",
|
|
15
|
+
"require": "./dist/components/Guido.vue.js"
|
|
16
16
|
},
|
|
17
17
|
"./style": "./dist/guido.css"
|
|
18
18
|
},
|
|
@@ -21,7 +21,6 @@
|
|
|
21
21
|
"start": "vite",
|
|
22
22
|
"build": "vite build && vue-tsc --declaration --emitDeclarationOnly --project tsconfig.app.json",
|
|
23
23
|
"preview": "vite preview",
|
|
24
|
-
"test": "echo \"Error: no test specified\" && exit 1",
|
|
25
24
|
"lint": "NODE_OPTIONS=--max-old-space-size=2048 eslint ./ && bun run type-check",
|
|
26
25
|
"lint:fix": "NODE_OPTIONS=--max-old-space-size=2048 eslint --fix ./",
|
|
27
26
|
"type-check": "vue-tsc --noEmit --project tsconfig.config.json && vue-tsc --noEmit --project tsconfig.app.json"
|
|
@@ -30,6 +29,7 @@
|
|
|
30
29
|
"author": "",
|
|
31
30
|
"license": "ISC",
|
|
32
31
|
"dependencies": {
|
|
32
|
+
"@stripoinc/ui-editor-extensions": "^1.0.6",
|
|
33
33
|
"@useinsider/design-system-vue": "0.14.8",
|
|
34
34
|
"@vuelidate/core": "2.0.3",
|
|
35
35
|
"@vuelidate/validators": "2.0.4",
|
|
@@ -42,6 +42,7 @@
|
|
|
42
42
|
"@cspell/eslint-plugin": "8.17.5",
|
|
43
43
|
"@eslint/eslintrc": "3.3.0",
|
|
44
44
|
"@eslint/js": "8.57.1",
|
|
45
|
+
"@playwright/test": "^1.54.2",
|
|
45
46
|
"@stylistic/eslint-plugin": "3.1.0",
|
|
46
47
|
"@stylistic/eslint-plugin-migrate": "3.1.0",
|
|
47
48
|
"@types/eslint": "8.56.12",
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
interface ModalWrapperProps {
|
|
2
|
-
isOpen: boolean;
|
|
3
|
-
title: string;
|
|
4
|
-
description?: string;
|
|
5
|
-
size?: 'small' | 'medium' | 'large';
|
|
6
|
-
primaryButtonText?: string;
|
|
7
|
-
primaryButtonDisabled?: boolean;
|
|
8
|
-
primaryButtonLoading?: boolean;
|
|
9
|
-
cancelButtonText?: string;
|
|
10
|
-
showCancelButton?: boolean;
|
|
11
|
-
className?: string;
|
|
12
|
-
}
|
|
13
|
-
declare var __VLS_12: {};
|
|
14
|
-
type __VLS_Slots = {} & {
|
|
15
|
-
default?: (props: typeof __VLS_12) => any;
|
|
16
|
-
};
|
|
17
|
-
declare const __VLS_component: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToOption<ModalWrapperProps>, {
|
|
18
|
-
description: string;
|
|
19
|
-
size: string;
|
|
20
|
-
primaryButtonText: string;
|
|
21
|
-
primaryButtonDisabled: boolean;
|
|
22
|
-
primaryButtonLoading: boolean;
|
|
23
|
-
cancelButtonText: string;
|
|
24
|
-
showCancelButton: boolean;
|
|
25
|
-
className: string;
|
|
26
|
-
}>, {}, {}, {}, {}, import("vue/types/v3-component-options").ComponentOptionsMixin, import("vue/types/v3-component-options").ComponentOptionsMixin, {
|
|
27
|
-
close: () => void;
|
|
28
|
-
save: () => void;
|
|
29
|
-
cancel: () => void;
|
|
30
|
-
}, string, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToOption<ModalWrapperProps>, {
|
|
31
|
-
description: string;
|
|
32
|
-
size: string;
|
|
33
|
-
primaryButtonText: string;
|
|
34
|
-
primaryButtonDisabled: boolean;
|
|
35
|
-
primaryButtonLoading: boolean;
|
|
36
|
-
cancelButtonText: string;
|
|
37
|
-
showCancelButton: boolean;
|
|
38
|
-
className: string;
|
|
39
|
-
}>>>, {
|
|
40
|
-
className: string;
|
|
41
|
-
size: "small" | "medium" | "large";
|
|
42
|
-
description: string;
|
|
43
|
-
primaryButtonText: string;
|
|
44
|
-
primaryButtonDisabled: boolean;
|
|
45
|
-
primaryButtonLoading: boolean;
|
|
46
|
-
cancelButtonText: string;
|
|
47
|
-
showCancelButton: boolean;
|
|
48
|
-
}>;
|
|
49
|
-
declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
|
|
50
|
-
export default _default;
|
|
51
|
-
type __VLS_WithDefaults<P, D> = {
|
|
52
|
-
[K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_PrettifyLocal<P[K] & {
|
|
53
|
-
default: D[K];
|
|
54
|
-
}> : P[K];
|
|
55
|
-
};
|
|
56
|
-
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
57
|
-
type __VLS_TypePropsToOption<T> = {
|
|
58
|
-
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
59
|
-
type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
|
|
60
|
-
} : {
|
|
61
|
-
type: import('vue').PropType<T[K]>;
|
|
62
|
-
required: true;
|
|
63
|
-
};
|
|
64
|
-
};
|
|
65
|
-
type __VLS_WithSlots<T, S> = T & {
|
|
66
|
-
new (): {
|
|
67
|
-
$scopedSlots: S;
|
|
68
|
-
};
|
|
69
|
-
};
|
|
70
|
-
type __VLS_PrettifyLocal<T> = {
|
|
71
|
-
[K in keyof T]: T[K];
|
|
72
|
-
} & {};
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import r from "./ModalWrapper.vue2.js";
|
|
2
|
-
import o from "../../../_virtual/_plugin-vue2_normalizer.js";
|
|
3
|
-
var s = function() {
|
|
4
|
-
var t = this, n = t._self._c, e = t._self._setupProxy;
|
|
5
|
-
return n(e.InDrawer, { attrs: { id: "modal-wrapper", "description-text": t.description, "footer-button-group-options": e.drawerFooterOptions, size: t.size, status: t.isOpen, "title-text": t.title }, on: { cancelOrBackButtonEvent: e.handleCancel, onCloseEvent: e.handleClose, primaryButtonEvent: e.handleSave }, scopedSlots: t._u([{ key: "contentSlot", fn: function() {
|
|
6
|
-
return [n("div", { staticClass: "modal-content-wrapper", class: t.className }, [t._t("default")], 2)];
|
|
7
|
-
}, proxy: !0 }], null, !0) });
|
|
8
|
-
}, a = [], l = /* @__PURE__ */ o(
|
|
9
|
-
r,
|
|
10
|
-
s,
|
|
11
|
-
a,
|
|
12
|
-
!1,
|
|
13
|
-
null,
|
|
14
|
-
null
|
|
15
|
-
);
|
|
16
|
-
const u = l.exports;
|
|
17
|
-
export {
|
|
18
|
-
u as default
|
|
19
|
-
};
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { defineComponent as o, computed as l } from "vue";
|
|
2
|
-
import { InDrawer as s } from "@useinsider/design-system-vue";
|
|
3
|
-
const i = /* @__PURE__ */ o({
|
|
4
|
-
__name: "ModalWrapper",
|
|
5
|
-
props: {
|
|
6
|
-
isOpen: { type: Boolean },
|
|
7
|
-
title: null,
|
|
8
|
-
description: { default: "" },
|
|
9
|
-
size: { default: "small" },
|
|
10
|
-
primaryButtonText: { default: "" },
|
|
11
|
-
primaryButtonDisabled: { type: Boolean, default: !1 },
|
|
12
|
-
primaryButtonLoading: { type: Boolean, default: !1 },
|
|
13
|
-
cancelButtonText: { default: "" },
|
|
14
|
-
showCancelButton: { type: Boolean, default: !0 },
|
|
15
|
-
className: { default: "" }
|
|
16
|
-
},
|
|
17
|
-
emits: ["close", "save", "cancel"],
|
|
18
|
-
setup(a, { emit: t }) {
|
|
19
|
-
const e = a, n = l(() => ({
|
|
20
|
-
primaryButton: {
|
|
21
|
-
styling: "solid",
|
|
22
|
-
type: "primary",
|
|
23
|
-
labelText: e.primaryButtonText,
|
|
24
|
-
disabled: e.primaryButtonDisabled || e.primaryButtonLoading
|
|
25
|
-
},
|
|
26
|
-
cancelOrBackButton: e.showCancelButton ? {
|
|
27
|
-
type: "secondary",
|
|
28
|
-
styling: "ghost",
|
|
29
|
-
labelText: e.cancelButtonText
|
|
30
|
-
} : void 0
|
|
31
|
-
}));
|
|
32
|
-
return { __sfc: !0, props: e, emit: t, drawerFooterOptions: n, handleClose: () => {
|
|
33
|
-
t("close");
|
|
34
|
-
}, handleSave: () => {
|
|
35
|
-
t("save");
|
|
36
|
-
}, handleCancel: () => {
|
|
37
|
-
t("cancel");
|
|
38
|
-
}, InDrawer: s };
|
|
39
|
-
}
|
|
40
|
-
});
|
|
41
|
-
export {
|
|
42
|
-
i as default
|
|
43
|
-
};
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
interface TemplateModalProps {
|
|
2
|
-
isOpen: boolean;
|
|
3
|
-
}
|
|
4
|
-
declare const _default: import("vue").DefineComponent<__VLS_TypePropsToOption<TemplateModalProps>, {}, {}, {}, {}, import("vue/types/v3-component-options").ComponentOptionsMixin, import("vue/types/v3-component-options").ComponentOptionsMixin, {
|
|
5
|
-
close: () => void;
|
|
6
|
-
}, string, Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToOption<TemplateModalProps>>>, {}>;
|
|
7
|
-
export default _default;
|
|
8
|
-
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
9
|
-
type __VLS_TypePropsToOption<T> = {
|
|
10
|
-
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
11
|
-
type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
|
|
12
|
-
} : {
|
|
13
|
-
type: import('vue').PropType<T[K]>;
|
|
14
|
-
required: true;
|
|
15
|
-
};
|
|
16
|
-
};
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import s from "./SaveTemplateModal.vue2.js";
|
|
2
|
-
import l from "../../../_virtual/_plugin-vue2_normalizer.js";
|
|
3
|
-
var n = function() {
|
|
4
|
-
var r = this, e = r._self._c, t = r._self._setupProxy;
|
|
5
|
-
return e(t.ModalWrapper, { attrs: { "cancel-button-text": t.trans("products.cancel"), description: t.trans("newsletter.save-template-description"), "is-open": t.props.isOpen, "primary-button-loading": t.saveState.saving || t.isLoadingHtml, "primary-button-text": t.trans("products.save"), title: t.trans("products.save-template") }, on: { cancel: t.closeModal, close: t.closeModal, save: t.saveTemplate } }, [e(t.InTextInput, { staticClass: "mb-5 w-1", attrs: { id: "template-name-input", "with-label": "", name: "templateName", invalid: !!t.validationError, "invalid-message": t.validationError, label: t.trans("products.template-name"), placeholder: t.trans("newsletter.enter-template-name") }, model: { value: t.templateNameInput, callback: function(a) {
|
|
6
|
-
t.templateNameInput = typeof a == "string" ? a.trim() : a;
|
|
7
|
-
}, expression: "templateNameInput" } }), e(t.InMultiSelect, { staticClass: "template-category-dropdown mb-5 w-1", attrs: { "create-option-status": "", "search-status": "", "button-status": !1, "character-limit-validation-text": t.trans("validation-v2.duration-value", {
|
|
8
|
-
min: 1,
|
|
9
|
-
max: t.templateCategorySearchInputLimit
|
|
10
|
-
}), "create-button-label": t.trans("products.create-new-category"), "label-text": t.trans("products.template-category"), "loading-state": t.categoriesData.loading || t.categoriesData.loadingCreate, "max-character-limit": t.templateCategorySearchInputLimit, options: t.categoriesData.mappedCategories, "placeholder-text": t.trans("products.select-template-category"), value: t.categoriesData.selectedCategories }, on: { addOption: t.addOption, change: t.setSelectedCategories, resetAllOptions: t.setSelectedCategories, selectAllOptions: t.setSelectedCategories } })], 1);
|
|
11
|
-
}, o = [], i = /* @__PURE__ */ l(
|
|
12
|
-
s,
|
|
13
|
-
n,
|
|
14
|
-
o,
|
|
15
|
-
!1,
|
|
16
|
-
null,
|
|
17
|
-
null
|
|
18
|
-
);
|
|
19
|
-
const d = i.exports;
|
|
20
|
-
export {
|
|
21
|
-
d as default
|
|
22
|
-
};
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
import { defineComponent as N, ref as o, watch as C } from "vue";
|
|
2
|
-
import { useActionsApi as O } from "../../../composables/useActionsApi.js";
|
|
3
|
-
import { useTemplateCategories as j } from "../../../composables/useTemplateCategories.js";
|
|
4
|
-
import { useToaster as x } from "../../../composables/useToaster.js";
|
|
5
|
-
import { useTranslations as E } from "../../../composables/useTranslations.js";
|
|
6
|
-
import H from "../base/ModalWrapper.vue.js";
|
|
7
|
-
import { InMultiSelect as R, InTextInput as V } from "@useinsider/design-system-vue";
|
|
8
|
-
import { useSaveAsTemplate as B } from "../../../composables/useSaveAsTemplate.js";
|
|
9
|
-
import { useTemplateNameValidation as P } from "../../../composables/useTemplateNameValidation.js";
|
|
10
|
-
const X = /* @__PURE__ */ N({
|
|
11
|
-
__name: "SaveTemplateModal",
|
|
12
|
-
props: {
|
|
13
|
-
isOpen: { type: Boolean }
|
|
14
|
-
},
|
|
15
|
-
emits: ["close"],
|
|
16
|
-
setup(I, { emit: u }) {
|
|
17
|
-
const p = I, l = E(), { showToaster: r } = x(), { getCompiledEmail: v } = O(), {
|
|
18
|
-
data: w,
|
|
19
|
-
fetchCategories: f,
|
|
20
|
-
createCategory: d,
|
|
21
|
-
setSelectedCategories: _,
|
|
22
|
-
resetSelection: y,
|
|
23
|
-
getSelectedCategoryIds: g
|
|
24
|
-
} = j(), {
|
|
25
|
-
state: M,
|
|
26
|
-
saveTemplate: T
|
|
27
|
-
} = B(), {
|
|
28
|
-
validationError: b,
|
|
29
|
-
validateTemplateName: n,
|
|
30
|
-
clearValidation: i
|
|
31
|
-
} = P(), t = o(""), a = o(!1), c = o(!1), s = o(""), A = 40, m = () => {
|
|
32
|
-
t.value = "", s.value = "", y(), i();
|
|
33
|
-
}, h = () => {
|
|
34
|
-
m(), u("close");
|
|
35
|
-
}, D = async () => {
|
|
36
|
-
a.value = !0;
|
|
37
|
-
try {
|
|
38
|
-
if (!(await n(t.value)).isValid) {
|
|
39
|
-
a.value = !1;
|
|
40
|
-
return;
|
|
41
|
-
}
|
|
42
|
-
await T({
|
|
43
|
-
name: t.value,
|
|
44
|
-
htmlContent: s.value,
|
|
45
|
-
categoryIds: g.value
|
|
46
|
-
}) && (r({
|
|
47
|
-
message: l(
|
|
48
|
-
"journey-builder.template-saved-successfully",
|
|
49
|
-
{ name: t.value }
|
|
50
|
-
),
|
|
51
|
-
type: "success"
|
|
52
|
-
}), h(), a.value = !1);
|
|
53
|
-
} catch {
|
|
54
|
-
r({
|
|
55
|
-
message: l("journey-builder.template-save-error", { name: t.value }),
|
|
56
|
-
type: "error"
|
|
57
|
-
}), a.value = !1;
|
|
58
|
-
}
|
|
59
|
-
};
|
|
60
|
-
C(t, (e) => {
|
|
61
|
-
e.trim() ? n(e) : i();
|
|
62
|
-
});
|
|
63
|
-
const S = async () => {
|
|
64
|
-
c.value = !0;
|
|
65
|
-
try {
|
|
66
|
-
const { html: e } = await v();
|
|
67
|
-
s.value = e || "";
|
|
68
|
-
} catch {
|
|
69
|
-
s.value = "";
|
|
70
|
-
} finally {
|
|
71
|
-
c.value = !1;
|
|
72
|
-
}
|
|
73
|
-
}, L = async (e) => {
|
|
74
|
-
await d(e);
|
|
75
|
-
};
|
|
76
|
-
return C(() => p.isOpen, async (e) => {
|
|
77
|
-
e ? await Promise.all([
|
|
78
|
-
S(),
|
|
79
|
-
f()
|
|
80
|
-
]) : m();
|
|
81
|
-
}), { __sfc: !0, props: p, emit: u, trans: l, showToaster: r, getCompiledEmail: v, categoriesData: w, fetchCategories: f, createCategory: d, setSelectedCategories: _, resetSelection: y, getSelectedCategoryIds: g, saveState: M, saveTemplateToLibrary: T, validationError: b, validateTemplateName: n, clearValidation: i, templateNameInput: t, isSaving: a, isLoadingHtml: c, htmlData: s, templateCategorySearchInputLimit: A, resetModalState: m, closeModal: h, saveTemplate: D, fetchHtmlData: S, addOption: L, ModalWrapper: H, InTextInput: V, InMultiSelect: R };
|
|
82
|
-
}
|
|
83
|
-
});
|
|
84
|
-
export {
|
|
85
|
-
X as default
|
|
86
|
-
};
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import type { StripoConfig, RecommendationConfig, RecommendationCampaignUrls } from '@@/Types/template-save';
|
|
2
|
-
interface SaveTemplateData {
|
|
3
|
-
name: string;
|
|
4
|
-
htmlContent: string;
|
|
5
|
-
categoryIds: number[];
|
|
6
|
-
css?: string;
|
|
7
|
-
stripoConfig?: StripoConfig;
|
|
8
|
-
recommendationConfigs?: RecommendationConfig;
|
|
9
|
-
recommendationCampaignUrls?: RecommendationCampaignUrls;
|
|
10
|
-
}
|
|
11
|
-
export declare const useSaveAsTemplate: () => {
|
|
12
|
-
state: {
|
|
13
|
-
saving: boolean;
|
|
14
|
-
};
|
|
15
|
-
saveTemplate: (data: SaveTemplateData) => Promise<boolean>;
|
|
16
|
-
};
|
|
17
|
-
export {};
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { useHttp as o } from "./useHttp.js";
|
|
2
|
-
import { base64EncodeWithSpecialChars as n } from "../utils/base64.js";
|
|
3
|
-
import { reactive as a } from "vue";
|
|
4
|
-
const l = () => {
|
|
5
|
-
const { post: i } = o(), s = a({
|
|
6
|
-
saving: !1
|
|
7
|
-
});
|
|
8
|
-
return {
|
|
9
|
-
state: s,
|
|
10
|
-
saveTemplate: async (e) => {
|
|
11
|
-
s.saving = !0;
|
|
12
|
-
try {
|
|
13
|
-
const t = {
|
|
14
|
-
name: e.name,
|
|
15
|
-
categories: e.categoryIds,
|
|
16
|
-
productId: 60,
|
|
17
|
-
editorType: 2,
|
|
18
|
-
content: n(e.htmlContent),
|
|
19
|
-
unsubscriptionPreferencePages: [],
|
|
20
|
-
unsubscriptionPreferencePageStatus: !1
|
|
21
|
-
};
|
|
22
|
-
e.css && (t.css = n(e.css)), e.stripoConfig && (t.stripoConfig = n(
|
|
23
|
-
JSON.stringify(e.stripoConfig)
|
|
24
|
-
)), e.recommendationConfigs && (t.recommendationConfigs = n(
|
|
25
|
-
JSON.stringify(e.recommendationConfigs)
|
|
26
|
-
)), e.recommendationCampaignUrls && (t.recommendationCampaignUrls = n(
|
|
27
|
-
JSON.stringify(e.recommendationCampaignUrls)
|
|
28
|
-
));
|
|
29
|
-
const r = await i(
|
|
30
|
-
"/newsletter/template-library/create-template",
|
|
31
|
-
t
|
|
32
|
-
);
|
|
33
|
-
return !(!r.data || r.data.type === "error");
|
|
34
|
-
} catch {
|
|
35
|
-
return !1;
|
|
36
|
-
} finally {
|
|
37
|
-
s.saving = !1;
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
};
|
|
41
|
-
};
|
|
42
|
-
export {
|
|
43
|
-
l as useSaveAsTemplate
|
|
44
|
-
};
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
interface MappedCategory {
|
|
2
|
-
value: string;
|
|
3
|
-
text: string;
|
|
4
|
-
}
|
|
5
|
-
interface GetDataProps {
|
|
6
|
-
getInitialData?: boolean;
|
|
7
|
-
}
|
|
8
|
-
export declare const useTemplateCategories: ({ getInitialData }?: GetDataProps) => {
|
|
9
|
-
data: {
|
|
10
|
-
loading: boolean;
|
|
11
|
-
loadingCreate: boolean;
|
|
12
|
-
categories: {
|
|
13
|
-
id: number;
|
|
14
|
-
name: string;
|
|
15
|
-
partnerId: number;
|
|
16
|
-
isStripo: boolean;
|
|
17
|
-
templatesCount: number;
|
|
18
|
-
}[];
|
|
19
|
-
mappedCategories: {
|
|
20
|
-
value: string;
|
|
21
|
-
text: string;
|
|
22
|
-
}[];
|
|
23
|
-
selectedCategories: {
|
|
24
|
-
value: string;
|
|
25
|
-
text: string;
|
|
26
|
-
}[];
|
|
27
|
-
};
|
|
28
|
-
fetchCategories: () => Promise<void>;
|
|
29
|
-
createCategory: (name: string) => Promise<void>;
|
|
30
|
-
selectCategory: (category: MappedCategory) => void;
|
|
31
|
-
setSelectedCategories: (categories: MappedCategory[]) => void;
|
|
32
|
-
resetSelection: () => void;
|
|
33
|
-
getSelectedCategoryIds: import("vue").ComputedRef<number[]>;
|
|
34
|
-
};
|
|
35
|
-
export {};
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
import { useHttp as h } from "./useHttp.js";
|
|
2
|
-
import { useToaster as x } from "./useToaster.js";
|
|
3
|
-
import { reactive as w, computed as v } from "vue";
|
|
4
|
-
const b = ({ getInitialData: g = !1 } = {}) => {
|
|
5
|
-
const { get: c, post: d } = h(), { handleError: o, showToaster: n } = x(), e = w({
|
|
6
|
-
loading: !1,
|
|
7
|
-
loadingCreate: !1,
|
|
8
|
-
categories: [],
|
|
9
|
-
mappedCategories: [],
|
|
10
|
-
selectedCategories: []
|
|
11
|
-
}), i = async () => {
|
|
12
|
-
e.loading = !0;
|
|
13
|
-
try {
|
|
14
|
-
const s = (await c("/newsletter/template-library/get-template-categories")).data || [];
|
|
15
|
-
e.categories = s, e.mappedCategories = s.map((a) => ({
|
|
16
|
-
value: a.id.toString(),
|
|
17
|
-
text: a.name
|
|
18
|
-
}));
|
|
19
|
-
} catch (t) {
|
|
20
|
-
o(t, "Error fetching template categories:"), e.categories = [], e.mappedCategories = [];
|
|
21
|
-
} finally {
|
|
22
|
-
e.loading = !1;
|
|
23
|
-
}
|
|
24
|
-
}, p = async (t) => {
|
|
25
|
-
try {
|
|
26
|
-
const a = `/newsletter/template-library/category-name-exists?name=${encodeURIComponent(t)}`;
|
|
27
|
-
return (await c(a)).data.status;
|
|
28
|
-
} catch (s) {
|
|
29
|
-
return o(s, "Error checking category name:"), !1;
|
|
30
|
-
}
|
|
31
|
-
}, m = async (t) => {
|
|
32
|
-
e.loadingCreate = !0;
|
|
33
|
-
try {
|
|
34
|
-
if (await p(t)) {
|
|
35
|
-
n({
|
|
36
|
-
type: "error",
|
|
37
|
-
message: "Category name already exists"
|
|
38
|
-
});
|
|
39
|
-
return;
|
|
40
|
-
}
|
|
41
|
-
const r = (await d("/newsletter/template-library/create-category", { name: t })).data;
|
|
42
|
-
if (r) {
|
|
43
|
-
e.categories.push(r);
|
|
44
|
-
const l = {
|
|
45
|
-
value: r.id.toString(),
|
|
46
|
-
text: r.name
|
|
47
|
-
};
|
|
48
|
-
e.mappedCategories.push(l), e.selectedCategories.push(l), n({
|
|
49
|
-
type: "success",
|
|
50
|
-
message: "Category created successfully"
|
|
51
|
-
});
|
|
52
|
-
}
|
|
53
|
-
} catch (s) {
|
|
54
|
-
o(s, "Error creating category:");
|
|
55
|
-
} finally {
|
|
56
|
-
e.loadingCreate = !1;
|
|
57
|
-
}
|
|
58
|
-
}, C = (t) => {
|
|
59
|
-
const s = e.selectedCategories.findIndex((a) => a.value === t.value);
|
|
60
|
-
s === -1 ? e.selectedCategories.push(t) : e.selectedCategories.splice(s, 1);
|
|
61
|
-
}, y = (t) => {
|
|
62
|
-
e.selectedCategories = [...t];
|
|
63
|
-
}, u = () => {
|
|
64
|
-
e.selectedCategories = [];
|
|
65
|
-
}, f = v(() => e.selectedCategories.map((t) => parseInt(t.value)));
|
|
66
|
-
return g && i(), {
|
|
67
|
-
data: e,
|
|
68
|
-
fetchCategories: i,
|
|
69
|
-
createCategory: m,
|
|
70
|
-
selectCategory: C,
|
|
71
|
-
setSelectedCategories: y,
|
|
72
|
-
resetSelection: u,
|
|
73
|
-
getSelectedCategoryIds: f
|
|
74
|
-
};
|
|
75
|
-
};
|
|
76
|
-
export {
|
|
77
|
-
b as useTemplateCategories
|
|
78
|
-
};
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
export interface ValidationResult {
|
|
2
|
-
isValid: boolean;
|
|
3
|
-
message: string;
|
|
4
|
-
}
|
|
5
|
-
export declare const useTemplateNameValidation: () => {
|
|
6
|
-
validationError: import("vue").Ref<string>;
|
|
7
|
-
isValidating: import("vue").Ref<boolean>;
|
|
8
|
-
validateTemplateName: (name: string) => Promise<ValidationResult>;
|
|
9
|
-
clearValidation: () => void;
|
|
10
|
-
VALIDATION_RULES: {
|
|
11
|
-
DEBOUNCE_TIME: number;
|
|
12
|
-
};
|
|
13
|
-
};
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import { useHttp as v } from "./useHttp.js";
|
|
2
|
-
import { useToaster as T } from "./useToaster.js";
|
|
3
|
-
import { useTranslations as E } from "./useTranslations.js";
|
|
4
|
-
import { ref as m } from "vue";
|
|
5
|
-
const c = {
|
|
6
|
-
DEBOUNCE_TIME: 500
|
|
7
|
-
}, x = () => {
|
|
8
|
-
const { get: u } = v(), { handleError: d } = T(), l = E(), s = m(""), o = m(!1), r = m(null), p = (a) => a.trim() ? {
|
|
9
|
-
isValid: !0,
|
|
10
|
-
message: ""
|
|
11
|
-
} : {
|
|
12
|
-
isValid: !1,
|
|
13
|
-
message: l("validation.required-product-name-to-continue", { product: "template" })
|
|
14
|
-
}, f = async (a) => {
|
|
15
|
-
try {
|
|
16
|
-
const i = `/template-library/template-name-exists?name=${encodeURIComponent(a)}`;
|
|
17
|
-
return (await u(i)).data.status;
|
|
18
|
-
} catch (e) {
|
|
19
|
-
return d(e, "Error checking template name:"), !1;
|
|
20
|
-
}
|
|
21
|
-
};
|
|
22
|
-
return {
|
|
23
|
-
validationError: s,
|
|
24
|
-
isValidating: o,
|
|
25
|
-
validateTemplateName: (a) => (r.value && clearTimeout(r.value), new Promise((e) => {
|
|
26
|
-
const i = p(a);
|
|
27
|
-
if (!i.isValid) {
|
|
28
|
-
s.value = i.message, e(i);
|
|
29
|
-
return;
|
|
30
|
-
}
|
|
31
|
-
o.value = !0, r.value = setTimeout(async () => {
|
|
32
|
-
try {
|
|
33
|
-
const t = await f(a.trim()), n = {
|
|
34
|
-
isValid: !t,
|
|
35
|
-
message: t ? l("whatsapp-business.template-name-exists") : ""
|
|
36
|
-
};
|
|
37
|
-
s.value = n.message, e(n);
|
|
38
|
-
} catch (t) {
|
|
39
|
-
const n = {
|
|
40
|
-
isValid: !1,
|
|
41
|
-
message: t instanceof Error ? t.message : l("validation.unknown-error")
|
|
42
|
-
};
|
|
43
|
-
s.value = n.message, e(n);
|
|
44
|
-
} finally {
|
|
45
|
-
o.value = !1;
|
|
46
|
-
}
|
|
47
|
-
}, c.DEBOUNCE_TIME);
|
|
48
|
-
})),
|
|
49
|
-
clearValidation: () => {
|
|
50
|
-
s.value = "", o.value = !1, r.value && clearTimeout(r.value);
|
|
51
|
-
},
|
|
52
|
-
VALIDATION_RULES: c
|
|
53
|
-
};
|
|
54
|
-
};
|
|
55
|
-
export {
|
|
56
|
-
x as useTemplateNameValidation
|
|
57
|
-
};
|