@useinsider/guido 3.2.0-beta.ccaf9f5 → 3.2.0-beta.d3ae6f8

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.
Files changed (104) hide show
  1. package/README.md +117 -1
  2. package/dist/@types/config/schemas.js +153 -95
  3. package/dist/components/Guido.vue.js +4 -4
  4. package/dist/components/Guido.vue2.js +85 -84
  5. package/dist/components/organisms/AutoSaveController.vue.js +17 -0
  6. package/dist/components/organisms/AutoSaveController.vue2.js +13 -0
  7. package/dist/components/organisms/header/AutoSaveToggle.vue.js +22 -0
  8. package/dist/components/organisms/header/AutoSaveToggle.vue2.js +19 -0
  9. package/dist/components/organisms/header/RightSlot.vue.js +8 -8
  10. package/dist/components/organisms/header/RightSlot.vue2.js +9 -8
  11. package/dist/composables/useAutoSave.js +71 -0
  12. package/dist/composables/useRecommendation.js +46 -26
  13. package/dist/composables/useResponsivePreview.js +1 -1
  14. package/dist/composables/useSave.js +19 -16
  15. package/dist/composables/useStripo.js +14 -16
  16. package/dist/composables/validators/useCouponBlockValidator.js +24 -0
  17. package/dist/config/compiler/recommendationCompilerRules.js +25 -25
  18. package/dist/config/compiler/utils/recommendationCompilerUtils.js +104 -71
  19. package/dist/config/migrator/index.js +9 -9
  20. package/dist/config/migrator/radioButtonMigrator.js +64 -44
  21. package/dist/config/migrator/recommendation/compositionMapper.js +98 -0
  22. package/dist/config/migrator/recommendation/extractors.js +27 -0
  23. package/dist/config/migrator/recommendation/htmlBuilder.js +496 -0
  24. package/dist/config/migrator/recommendation/parseLegacyConfig.js +33 -0
  25. package/dist/config/migrator/recommendation/settingsMapper.js +70 -0
  26. package/dist/config/migrator/recommendation/themeMapper.js +93 -0
  27. package/dist/config/migrator/recommendationMigrator.js +74 -290
  28. package/dist/enums/extensions/recommendationBlock.js +2 -1
  29. package/dist/extensions/Blocks/RadioButton/template.js +1 -1
  30. package/dist/extensions/Blocks/Recommendation/block.js +35 -32
  31. package/dist/extensions/Blocks/Recommendation/constants/defaultConfig.js +5 -5
  32. package/dist/extensions/Blocks/Recommendation/controls/main/algorithm.js +25 -24
  33. package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +228 -181
  34. package/dist/extensions/Blocks/Recommendation/services/configService.js +65 -29
  35. package/dist/extensions/Blocks/Recommendation/store/recommendation.js +130 -90
  36. package/dist/extensions/Blocks/Recommendation/templates/grid/elementRenderer.js +22 -13
  37. package/dist/extensions/Blocks/Recommendation/templates/grid/template.js +8 -8
  38. package/dist/extensions/Blocks/Recommendation/templates/list/elementRenderer.js +23 -13
  39. package/dist/extensions/Blocks/Recommendation/templates/utils.js +1 -1
  40. package/dist/extensions/Blocks/Recommendation/utils/legacyStrategyMap.js +21 -0
  41. package/dist/extensions/Blocks/Recommendation/utils/preserveTextStyles.js +13 -22
  42. package/dist/guido.css +1 -1
  43. package/dist/node_modules/valibot/dist/index.js +404 -266
  44. package/dist/src/@types/config/defaults.d.ts +5 -1
  45. package/dist/src/@types/config/index.d.ts +3 -3
  46. package/dist/src/@types/config/schemas.d.ts +217 -0
  47. package/dist/src/@types/config/types.d.ts +9 -1
  48. package/dist/src/components/Guido.vue.d.ts +1 -1
  49. package/dist/src/components/organisms/AutoSaveController.vue.d.ts +2 -0
  50. package/dist/src/components/organisms/header/AutoSaveToggle.vue.d.ts +2 -0
  51. package/dist/src/components/organisms/header/EditorActions.vue.d.ts +1 -1
  52. package/dist/src/components/organisms/header/HeaderWrapper.vue.d.ts +1 -1
  53. package/dist/src/components/organisms/header/RightSlot.vue.d.ts +1 -1
  54. package/dist/src/components/wrappers/WpModal.vue.d.ts +1 -1
  55. package/dist/src/composables/useAutoSave.d.ts +3 -0
  56. package/dist/src/composables/useConfig.d.ts +58 -0
  57. package/dist/src/composables/useRecommendation.d.ts +10 -1
  58. package/dist/src/composables/useRecommendation.test.d.ts +1 -0
  59. package/dist/src/composables/useSave.d.ts +1 -1
  60. package/dist/src/composables/validators/useCouponBlockValidator.d.ts +3 -0
  61. package/dist/src/config/migrator/index.d.ts +2 -1
  62. package/dist/src/config/migrator/recommendation/compositionMapper.d.ts +2 -0
  63. package/dist/src/config/migrator/recommendation/compositionMapper.test.d.ts +1 -0
  64. package/dist/src/config/migrator/recommendation/extractors.d.ts +7 -0
  65. package/dist/src/config/migrator/recommendation/extractors.test.d.ts +1 -0
  66. package/dist/src/config/migrator/recommendation/htmlBuilder.d.ts +11 -0
  67. package/dist/src/config/migrator/recommendation/parseLegacyConfig.d.ts +15 -0
  68. package/dist/src/config/migrator/recommendation/parseLegacyConfig.test.d.ts +1 -0
  69. package/dist/src/config/migrator/recommendation/settingsMapper.d.ts +7 -0
  70. package/dist/src/config/migrator/recommendation/settingsMapper.test.d.ts +1 -0
  71. package/dist/src/config/migrator/recommendation/themeMapper.d.ts +5 -0
  72. package/dist/src/config/migrator/recommendation/themeMapper.test.d.ts +1 -0
  73. package/dist/src/config/migrator/recommendation/types.d.ts +205 -0
  74. package/dist/src/config/migrator/recommendationMigrator.d.ts +13 -1
  75. package/dist/src/config/migrator/recommendationMigrator.test.d.ts +1 -0
  76. package/dist/src/extensions/Blocks/RadioButton/template.d.ts +1 -1
  77. package/dist/src/extensions/Blocks/Recommendation/controls/main/utils.test.d.ts +1 -0
  78. package/dist/src/extensions/Blocks/Recommendation/services/configService.d.ts +10 -0
  79. package/dist/src/extensions/Blocks/Recommendation/services/configService.test.d.ts +1 -0
  80. package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +34 -0
  81. package/dist/src/extensions/Blocks/Recommendation/types/nodeConfig.d.ts +1 -1
  82. package/dist/src/extensions/Blocks/Recommendation/utils/legacyStrategyMap.d.ts +21 -0
  83. package/dist/src/extensions/Blocks/Recommendation/utils/legacyStrategyMap.test.d.ts +1 -0
  84. package/dist/src/extensions/Blocks/Recommendation/utils/preserveTextStyles.d.ts +0 -3
  85. package/dist/src/library.d.ts +1 -1
  86. package/dist/src/stores/autosave.d.ts +12 -0
  87. package/dist/src/stores/config.d.ts +522 -0
  88. package/dist/src/stores/editor.d.ts +23 -0
  89. package/dist/src/utils/htmlEscape.d.ts +5 -0
  90. package/dist/src/utils/htmlEscape.test.d.ts +1 -0
  91. package/dist/src/utils/timeUtil.d.ts +8 -0
  92. package/dist/stores/autosave.js +17 -0
  93. package/dist/stores/editor.js +3 -1
  94. package/dist/utils/htmlEscape.js +13 -0
  95. package/dist/utils/templatePreparation.js +72 -32
  96. package/dist/utils/timeUtil.js +19 -0
  97. package/package.json +34 -3
  98. package/dist/composables/useCortexBlueprintBridge.js +0 -38
  99. package/dist/composables/useEmailTemplateApplier.js +0 -41
  100. package/dist/enums/displayConditions.js +0 -80
  101. package/dist/extensions/Blocks/Recommendation/templates/grid/migration.js +0 -251
  102. package/dist/src/composables/useCortexBlueprintBridge.d.ts +0 -17
  103. package/dist/src/composables/useEmailTemplateApplier.d.ts +0 -21
  104. package/dist/src/enums/displayConditions.d.ts +0 -2
@@ -263,4 +263,27 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
263
263
  templateId: string;
264
264
  syncModulesEnabled: boolean;
265
265
  }>) => boolean;
266
+ isInSaveableState: (state: {
267
+ loadingStatus: boolean;
268
+ isCodeEditorOpen: boolean;
269
+ isSaveAsTemplateDrawerOpen: boolean;
270
+ isVersionHistoryOpen: boolean;
271
+ isPreviewModeOpen: boolean;
272
+ editorVisualMode: string;
273
+ hasChanges: boolean;
274
+ isStripoInitialized: boolean;
275
+ templateId: string;
276
+ syncModulesEnabled: boolean;
277
+ } & import("pinia").PiniaCustomStateProperties<{
278
+ loadingStatus: boolean;
279
+ isCodeEditorOpen: boolean;
280
+ isSaveAsTemplateDrawerOpen: boolean;
281
+ isVersionHistoryOpen: boolean;
282
+ isPreviewModeOpen: boolean;
283
+ editorVisualMode: string;
284
+ hasChanges: boolean;
285
+ isStripoInitialized: boolean;
286
+ templateId: string;
287
+ syncModulesEnabled: boolean;
288
+ }>) => boolean;
266
289
  }, {}>;
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Escape HTML special characters for safe inclusion in attribute values
3
+ * or text content. Use for any string that may contain untrusted input.
4
+ */
5
+ export declare function escapeHtml(text: string): string;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Formats a Date as local time in 24-hour format.
3
+ * Pass `useTimezone = true` to append the UTC offset and city name — useful when the
4
+ * timestamp must clearly communicate the client's timezone.
5
+ * @example formatLocalTime(date) -> 12:20:02
6
+ * @example formatLocalTime(date, true) -> 12:20:02 (UTC+3 Istanbul)
7
+ */
8
+ export declare const formatLocalTime: (date: Date, useTimezone?: boolean) => string;
@@ -0,0 +1,17 @@
1
+ import { defineStore as e } from "pinia";
2
+ const t = {
3
+ IDLE: "idle",
4
+ SAVING: "saving",
5
+ SAVED: "saved",
6
+ ERROR: "error"
7
+ }, o = e("guidoAutosave", {
8
+ state: () => ({
9
+ isOn: !1,
10
+ lastSavedAt: null,
11
+ status: t.IDLE
12
+ })
13
+ });
14
+ export {
15
+ t as AUTOSAVE_STATUS,
16
+ o as useAutosaveStore
17
+ };
@@ -25,7 +25,9 @@ const o = e("guidoEditor", {
25
25
  isExportButtonDisabled: (i) => i.loadingStatus || i.isVersionHistoryOpen,
26
26
  isSaveAsButtonDisabled: (i) => i.loadingStatus || i.isVersionHistoryOpen,
27
27
  isTestButtonDisabled: (i) => i.loadingStatus || i.isVersionHistoryOpen,
28
- isSaveButtonDisabled: (i) => i.loadingStatus || i.isVersionHistoryOpen || i.isPreviewModeOpen
28
+ isSaveButtonDisabled: (i) => i.loadingStatus || i.isVersionHistoryOpen || i.isPreviewModeOpen,
29
+ // Autosave
30
+ isInSaveableState: (i) => !i.loadingStatus && !i.isVersionHistoryOpen && !i.isPreviewModeOpen && !i.isCodeEditorOpen
29
31
  }
30
32
  });
31
33
  export {
@@ -0,0 +1,13 @@
1
+ const c = {
2
+ "&": "&amp;",
3
+ "<": "&lt;",
4
+ ">": "&gt;",
5
+ '"': "&quot;",
6
+ "'": "&#x27;"
7
+ };
8
+ function n(t) {
9
+ return t.replace(/[&<>"']/g, (e) => c[e]);
10
+ }
11
+ export {
12
+ n as escapeHtml
13
+ };
@@ -1,53 +1,93 @@
1
1
  import { useActionsApi as T } from "../composables/useActionsApi.js";
2
- import { useHtmlCompiler as P } from "../composables/useHtmlCompiler.js";
3
- import { useRecommendationExtensionStore as A } from "../extensions/Blocks/Recommendation/store/recommendation.js";
4
- import { DATA_ATTRIBUTES as l } from "../extensions/Blocks/Unsubscribe/utils/constants.js";
5
- import { parsePageList as h } from "../extensions/Blocks/Unsubscribe/utils/utils.js";
6
- import { useDynamicContentStore as C } from "../stores/dynamic-content.js";
7
- import { useUnsubscribeStore as D } from "../stores/unsubscribe.js";
8
- function x(i, e) {
9
- const r = new DOMParser().parseFromString(i, "text/html").querySelectorAll(`[${l.PAGE_LIST}]`), n = [];
10
- return r.forEach((t) => {
11
- const o = t.getAttribute(l.PAGE_LIST);
12
- o && n.push(...h(o));
13
- }), e.filter((t) => n.includes(t));
2
+ import { useHtmlCompiler as C } from "../composables/useHtmlCompiler.js";
3
+ import { DEFAULT_CURRENCY as l, DEFAULT_NODE_CONFIG as a } from "../extensions/Blocks/Recommendation/constants/defaultConfig.js";
4
+ import { useRecommendationExtensionStore as b } from "../extensions/Blocks/Recommendation/store/recommendation.js";
5
+ import { DATA_ATTRIBUTES as y } from "../extensions/Blocks/Unsubscribe/utils/constants.js";
6
+ import { parsePageList as P } from "../extensions/Blocks/Unsubscribe/utils/utils.js";
7
+ import { useDynamicContentStore as D } from "../stores/dynamic-content.js";
8
+ import { useUnsubscribeStore as E } from "../stores/unsubscribe.js";
9
+ function U(i, r) {
10
+ const s = new DOMParser().parseFromString(i, "text/html").querySelectorAll(`[${y.PAGE_LIST}]`), c = [];
11
+ return s.forEach((t) => {
12
+ const o = t.getAttribute(y.PAGE_LIST);
13
+ o && c.push(...P(o));
14
+ }), r.filter((t) => c.includes(t));
14
15
  }
15
- const I = () => {
16
- const i = C(), e = D(), { getCompiledEmail: a, getTemplateData: m } = T(), { compileHtml: r } = P();
16
+ function F(i) {
17
+ const m = new DOMParser().parseFromString(i, "text/html").querySelectorAll(".recommendation-block-v2");
18
+ if (m.length === 0)
19
+ return;
20
+ const d = b();
21
+ m.forEach((s) => {
22
+ var g, f, u, n, S;
23
+ const c = s.getAttribute("recommendation-id"), t = c ? Number(c) : NaN;
24
+ if (!Number.isFinite(t))
25
+ return;
26
+ const o = s.getAttribute("esd-ext-config");
27
+ if (!o)
28
+ return;
29
+ let e;
30
+ try {
31
+ e = JSON.parse(o);
32
+ } catch {
33
+ return;
34
+ }
35
+ if (!e || typeof e != "object" || Array.isArray(e))
36
+ return;
37
+ const p = {
38
+ strategy: e.strategy ?? a.strategy,
39
+ language: e.language ?? a.language,
40
+ size: e.size ?? a.size,
41
+ // Spread the default arrays so each block gets a fresh reference
42
+ // instead of sharing the singleton in DEFAULT_NODE_CONFIG.
43
+ productIds: e.productIds ?? [...a.productIds],
44
+ filters: e.filters ?? [...a.filters],
45
+ shuffleProducts: e.shuffleProducts ?? a.shuffleProducts,
46
+ currencyCode: ((g = e.currency) == null ? void 0 : g.code) ?? l.code,
47
+ currencyAlignment: ((f = e.currency) == null ? void 0 : f.alignment) ?? l.alignment,
48
+ currencyDecimalCount: ((u = e.currency) == null ? void 0 : u.decimalCount) ?? l.decimalCount,
49
+ currencyDecimalSeparator: ((n = e.currency) == null ? void 0 : n.decimalSeparator) ?? l.decimalSeparator,
50
+ currencyThousandSeparator: ((S = e.currency) == null ? void 0 : S.thousandSeparator) ?? l.thousandSeparator
51
+ };
52
+ d.seedBlockUrlConfig(t, p);
53
+ });
54
+ }
55
+ const _ = () => {
56
+ const i = D(), r = E(), { getCompiledEmail: m, getTemplateData: d } = T(), { compileHtml: s } = C();
17
57
  return {
18
58
  prepareTemplateDetails: async () => {
19
- const { html: t, ampHtml: o = "", ampErrors: p = [] } = await a({
59
+ const { html: t, ampHtml: o = "", ampErrors: e = [] } = await m({
20
60
  minimize: !0,
21
61
  resetDataSavedFlag: !1
22
- }), { html: u, css: d, syncModulesIds: g = [] } = await m();
23
- e.selectedUnsubscribePages.length && await e.fetchTemplates();
24
- const { compiledHtml: c, stats: s, appliedRules: S } = r(t), b = i.getSelectedDynamicContentList, f = A();
62
+ }), { html: p, css: g, syncModulesIds: f = [] } = await d();
63
+ r.selectedUnsubscribePages.length && await r.fetchTemplates(), F(p);
64
+ const { compiledHtml: u, stats: n, appliedRules: S } = s(t), h = i.getSelectedDynamicContentList, A = b();
25
65
  return console.debug("HTML Compilation Stats:", {
26
- originalSize: s.originalSize,
27
- compiledSize: s.compiledSize,
28
- reduction: `${s.reductionPercentage.toFixed(2)}%`,
66
+ originalSize: n.originalSize,
67
+ compiledSize: n.compiledSize,
68
+ reduction: `${n.reductionPercentage.toFixed(2)}%`,
29
69
  appliedRules: S,
30
- executionTime: `${s.executionTime.toFixed(2)}ms`
70
+ executionTime: `${n.executionTime.toFixed(2)}ms`
31
71
  }), {
32
- dynamicContentList: b,
33
- compiledHtml: c,
34
- rawHtml: u,
35
- css: d,
72
+ dynamicContentList: h,
73
+ compiledHtml: u,
74
+ rawHtml: p,
75
+ css: g,
36
76
  ampHtml: o,
37
- ampErrors: p,
38
- modules: g.map(Number),
77
+ ampErrors: e,
78
+ modules: f.map(Number),
39
79
  recommendation: {
40
- campaignUrls: f.recommendationCampaignUrls,
80
+ campaignUrls: A.recommendationCampaignUrls,
41
81
  configs: {}
42
82
  },
43
83
  unsubscribe: {
44
- status: e.unsubscribePagesStatus,
45
- config: x(c, e.selectedUnsubscribePages)
84
+ status: r.unsubscribePagesStatus,
85
+ config: U(u, r.selectedUnsubscribePages)
46
86
  }
47
87
  };
48
88
  }
49
89
  };
50
90
  };
51
91
  export {
52
- I as useTemplatePreparation
92
+ _ as useTemplatePreparation
53
93
  };
@@ -0,0 +1,19 @@
1
+ const r = (t) => {
2
+ const e = -t.getTimezoneOffset(), o = e >= 0 ? "+" : "-", n = Math.abs(e), s = Math.floor(n / 60), i = n % 60;
3
+ return i === 0 ? `UTC${o}${s}` : `UTC${o}${s}:${String(i).padStart(2, "0")}`;
4
+ }, a = () => {
5
+ var e;
6
+ const { timeZone: t } = new Intl.DateTimeFormat().resolvedOptions();
7
+ return ((e = t.split("/").pop()) == null ? void 0 : e.replace(/_/g, " ")) ?? t;
8
+ }, c = (t, e = !1) => {
9
+ const o = t.toLocaleTimeString([], {
10
+ hour: "2-digit",
11
+ hour12: !1,
12
+ minute: "2-digit",
13
+ second: "2-digit"
14
+ });
15
+ return e ? `${o} (${r(t)} ${a()})` : o;
16
+ };
17
+ export {
18
+ c as formatLocalTime
19
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@useinsider/guido",
3
- "version": "3.2.0-beta.ccaf9f5",
3
+ "version": "3.2.0-beta.d3ae6f8",
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",
@@ -24,6 +24,8 @@
24
24
  "lint": "NODE_OPTIONS=--max-old-space-size=2048 eslint ./ && bun run type-check",
25
25
  "lint:fix": "NODE_OPTIONS=--max-old-space-size=2048 eslint --fix ./",
26
26
  "type-check": "vue-tsc --noEmit --project tsconfig.config.json && vue-tsc --noEmit --project tsconfig.app.json",
27
+ "test": "vitest run",
28
+ "test:watch": "vitest",
27
29
  "test:visual-update": "npx playwright test --update-snapshots --reporter html",
28
30
  "prepare": "husky",
29
31
  "preinstall": "rm -rf ./node_modules/.vite"
@@ -37,7 +39,7 @@
37
39
  "@vueuse/core": "11.3.0",
38
40
  "lodash-es": "4.17.21",
39
41
  "pinia": "2.3.1",
40
- "valibot": "1.1.0",
42
+ "valibot": "1.2.0",
41
43
  "vite": "6.3.5",
42
44
  "vue": "2.7.14"
43
45
  },
@@ -69,17 +71,46 @@
69
71
  "eslint-plugin-vue": "10.1.0",
70
72
  "eslint-plugin-vue-scoped-css": "2.6.1",
71
73
  "globals": "16.0.0",
74
+ "happy-dom": "15.11.7",
72
75
  "husky": "9.1.7",
73
76
  "msw": "2.10.3",
74
77
  "sass": "1.69.7",
75
78
  "typescript": "5.5.4",
76
79
  "typescript-eslint": "8.26.0",
77
80
  "vite-plugin-dts": "4.5.4",
81
+ "vitest": "2.1.9",
78
82
  "vue-tsc": "2.2.10"
79
83
  },
80
84
  "overrides": {
85
+ "@isaacs/brace-expansion": "^5.0.1",
86
+ "axios": "^1.8.2",
87
+ "follow-redirects": "^1.14.7",
88
+ "flatted": "^3.4.0",
89
+ "immutable": "^4.3.8",
81
90
  "micromatch": "4.0.8",
82
- "path-to-regexp": "6.3.0"
91
+ "minimatch": "^3.1.3",
92
+ "@microsoft/api-extractor": {
93
+ "minimatch": "^10.2.1"
94
+ },
95
+ "@typescript-eslint/typescript-estree": {
96
+ "minimatch": "^9.0.6"
97
+ },
98
+ "@vue/language-core": {
99
+ "minimatch": "^9.0.6"
100
+ },
101
+ "path-to-regexp": "6.3.0",
102
+ "picomatch": "^2.3.2",
103
+ "@rollup/pluginutils": {
104
+ "picomatch": "^4.0.4"
105
+ },
106
+ "@stylistic/eslint-plugin": {
107
+ "picomatch": "^4.0.4"
108
+ },
109
+ "fdir": {
110
+ "picomatch": "^4.0.4"
111
+ },
112
+ "ag-grid-community": "^31.3.4",
113
+ "ag-grid-enterprise": "^31.3.4"
83
114
  },
84
115
  "msw": {
85
116
  "workerDirectory": "public"
@@ -1,38 +0,0 @@
1
- import { useEmailTemplateApplier as T, resetEmailTemplateApplier as E } from "./useEmailTemplateApplier.js";
2
- import { getActivePinia as h } from "pinia";
3
- import { watch as d, onUnmounted as y } from "vue";
4
- const _ = "email_template", b = "chat", B = () => {
5
- const l = h();
6
- if (!l)
7
- return;
8
- const p = l._s, c = p == null ? void 0 : p.get(b);
9
- if (!c)
10
- return;
11
- const { applyTemplate: m, applyTemplateDebounced: f } = T(), e = /* @__PURE__ */ new Map(), A = d(
12
- () => c.messages,
13
- (a) => {
14
- Array.isArray(a) && a.forEach((n) => {
15
- const u = n == null ? void 0 : n.segments;
16
- Array.isArray(u) && u.forEach((i) => {
17
- if ((i == null ? void 0 : i.type) !== "blueprint")
18
- return;
19
- const o = i;
20
- if (o.blueprintType !== _)
21
- return;
22
- const r = o.blueprintId, t = o.blueprintData;
23
- if (!r || !(t != null && t.html))
24
- return;
25
- const s = e.get(r);
26
- s === void 0 ? (e.set(r, t.html), m(r, t)) : s !== t.html && (e.set(r, t.html), f(r, t));
27
- });
28
- });
29
- },
30
- { deep: !0, immediate: !0 }
31
- );
32
- y(() => {
33
- A(), e.clear(), E();
34
- });
35
- };
36
- export {
37
- B as useCortexBlueprintBridge
38
- };
@@ -1,41 +0,0 @@
1
- import { useActionsApi as u } from "./useActionsApi.js";
2
- import { useToaster as T } from "./useToaster.js";
3
- import { useTranslations as f } from "./useTranslations.js";
4
- import { ToasterTypeOptions as n } from "../enums/toaster.js";
5
- import { ref as y } from "vue";
6
- const h = 250, s = y({}), o = {}, j = () => {
7
- const { updateHtmlAndCss: l } = u(), { showToaster: r } = T(), i = f(), c = (e, t, p) => {
8
- s.value = { ...s.value, [e]: "applying" };
9
- try {
10
- l(t, p), s.value = { ...s.value, [e]: "applied" }, r({
11
- type: n.Success,
12
- message: i("newsletter.ai-template-applied")
13
- });
14
- } catch (a) {
15
- s.value = { ...s.value, [e]: "failed" }, r({
16
- type: n.Alert,
17
- message: a instanceof Error ? a.message : "Failed to apply template"
18
- });
19
- }
20
- }, m = (e) => {
21
- const t = o[e];
22
- t && (clearTimeout(t), delete o[e]);
23
- };
24
- return { applyStatus: s, applyTemplate: (e, t) => {
25
- t.html && (m(e), c(e, t.html, t.css ?? ""));
26
- }, applyTemplateDebounced: (e, t) => {
27
- if (!t.html)
28
- return;
29
- m(e);
30
- const { html: p } = t, a = t.css ?? "";
31
- o[e] = setTimeout(() => {
32
- delete o[e], c(e, p, a);
33
- }, h);
34
- } };
35
- }, w = () => {
36
- Object.values(o).forEach(clearTimeout), Object.keys(o).forEach((l) => delete o[l]), s.value = {};
37
- };
38
- export {
39
- w as resetEmailTemplateApplier,
40
- j as useEmailTemplateApplier
41
- };
@@ -1,80 +0,0 @@
1
- const e = [
2
- {
3
- category: "Demographics",
4
- conditions: [
5
- {
6
- id: 1,
7
- name: "Language",
8
- description: "Users who are in the English will see the banner",
9
- beforeScript: '{% if language == "en_US" %}',
10
- afterScript: "{% endif %}"
11
- },
12
- {
13
- id: 2,
14
- name: "Country",
15
- description: "Only people who live in Australia will see the banner",
16
- beforeScript: '{% if country == "Australia" %}',
17
- afterScript: "{% endif %}"
18
- },
19
- {
20
- id: 3,
21
- name: "Country & City",
22
- description: "Only people who are located in that country and city",
23
- beforeScript: '{% if country == "United Kingdom" and city == "London" %}',
24
- afterScript: "{% endif %}"
25
- },
26
- {
27
- id: 4,
28
- name: "Age (Less than operator)",
29
- description: "Users whose age is less than 18",
30
- beforeScript: "{% if age < 18 %}",
31
- afterScript: "{% endif %}"
32
- },
33
- {
34
- id: 5,
35
- name: "Age (Equal and greater than operator)",
36
- description: "Users whose age is equal or greater than 25",
37
- beforeScript: "{% if age >= 25 %}",
38
- afterScript: "{% endif %}"
39
- },
40
- {
41
- id: 6,
42
- name: "Age (Greater than & less than operators)",
43
- description: "Users whose age is between 18 and 25",
44
- beforeScript: "{% if age > 18 and age < 25 %}",
45
- afterScript: "{% endif %}"
46
- },
47
- {
48
- id: 7,
49
- name: "Gender",
50
- description: "Users whose gender is Female",
51
- beforeScript: '{% if gender == "Female" %}',
52
- afterScript: "{% endif %}"
53
- },
54
- {
55
- id: 8,
56
- name: "State",
57
- description: "Users whose state is one of the followings. c_state is a custom attribute. Use this condition if you have the attribute with the same naming. ",
58
- beforeScript: '{% if c_state == "VIC" or c_state == "NSW" or c_state == "QLD" %}',
59
- afterScript: "{% endif %}"
60
- },
61
- {
62
- id: 9,
63
- name: "VIP User",
64
- description: "Users who are VIP users for that brand. c_is_vip_user = true. c_is_vip_user is a custom attribute. Use this condition if you have the attribute with the same naming.",
65
- beforeScript: "{% if c_is_vip_user %}",
66
- afterScript: "{% endif %}"
67
- },
68
- {
69
- id: 10,
70
- name: "Membership Type",
71
- description: "Users who belong to gold or silver membership type. c_is_gold_member = true, c_is_silver_member = true. These are custom attributes. Use this condition if you have the attribute with the same naming.",
72
- beforeScript: "{% if c_is_gold_member or c_is_silver_member %}",
73
- afterScript: "{% endif %}"
74
- }
75
- ]
76
- }
77
- ];
78
- export {
79
- e as displayConditions
80
- };