@useinsider/guido 3.17.0-beta.e6704da → 3.17.0-beta.ea65303

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 (75) hide show
  1. package/README.md +1 -1
  2. package/dist/@types/config/schemas.js +31 -35
  3. package/dist/components/Guido.vue.js +5 -5
  4. package/dist/components/Guido.vue2.js +77 -77
  5. package/dist/components/organisms/AutoSaveController.vue2.js +9 -8
  6. package/dist/components/organisms/header/EditorActions.vue.js +2 -2
  7. package/dist/components/organisms/header/EditorActions.vue2.js +74 -43
  8. package/dist/components/organisms/header/LeftSlot.vue.js +5 -5
  9. package/dist/components/organisms/header/LeftSlot.vue2.js +16 -12
  10. package/dist/components/organisms/validation/ValidationErrorDrawer.vue.js +20 -0
  11. package/dist/components/organisms/validation/ValidationErrorDrawer.vue2.js +48 -0
  12. package/dist/components/wrappers/WpDrawer.vue.js +9 -7
  13. package/dist/components/wrappers/WpDrawer.vue2.js +1 -1
  14. package/dist/composables/useCustomInterfaceAppearance.js +16 -19
  15. package/dist/composables/useHtmlCompiler.js +37 -26
  16. package/dist/composables/useHtmlValidator.js +2 -0
  17. package/dist/composables/useRecommendation.js +34 -41
  18. package/dist/composables/useSave.js +84 -41
  19. package/dist/composables/useSaveValidation.js +279 -0
  20. package/dist/composables/useSaveValidationRollout.js +9 -0
  21. package/dist/composables/validators/useCouponBlockValidator.js +24 -21
  22. package/dist/composables/validators/useUnsubscribeBlockValidator.js +34 -27
  23. package/dist/config/migrator/recommendationMigrator.js +4 -6
  24. package/dist/enums/academy.js +1 -2
  25. package/dist/enums/date.js +3 -4
  26. package/dist/enums/extensions/recommendationBlock.js +23 -25
  27. package/dist/enums/save-validation.js +4 -0
  28. package/dist/extensions/Blocks/Recommendation/constants/defaultConfig.js +11 -13
  29. package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +95 -96
  30. package/dist/extensions/Blocks/Recommendation/controls/main/index.js +154 -156
  31. package/dist/extensions/Blocks/Recommendation/store/recommendation.js +82 -223
  32. package/dist/extensions/Blocks/common-control.js +19 -22
  33. package/dist/guido.css +1 -1
  34. package/dist/services/recommendationApi.js +29 -78
  35. package/dist/src/@types/config/schemas.d.ts +4 -12
  36. package/dist/src/@types/save-validation.d.ts +19 -0
  37. package/dist/src/components/Guido.vue.d.ts +17 -1
  38. package/dist/src/components/organisms/header/EditorActions.vue.d.ts +17 -1
  39. package/dist/src/components/organisms/header/HeaderWrapper.vue.d.ts +17 -1
  40. package/dist/src/components/organisms/header/RightSlot.vue.d.ts +17 -1
  41. package/dist/src/components/organisms/{extensions/recommendation/AssignStrategyDrawer.vue.d.ts → validation/ValidationErrorDrawer.vue.d.ts} +0 -1
  42. package/dist/src/components/wrappers/WpDrawer.vue.d.ts +4 -3
  43. package/dist/src/composables/useConfig.d.ts +2 -2
  44. package/dist/src/composables/useHtmlValidator.d.ts +21 -0
  45. package/dist/src/composables/useRecommendation.d.ts +0 -1
  46. package/dist/src/composables/useSave.d.ts +6 -1
  47. package/dist/src/composables/useSaveValidation.d.ts +6 -0
  48. package/dist/src/composables/useSaveValidationRollout.d.ts +3 -0
  49. package/dist/src/composables/validators/useCouponBlockValidator.d.ts +3 -0
  50. package/dist/src/composables/validators/useUnsubscribeBlockValidator.d.ts +10 -0
  51. package/dist/src/enums/academy.d.ts +0 -1
  52. package/dist/src/enums/extensions/recommendationBlock.d.ts +0 -2
  53. package/dist/src/enums/save-validation.d.ts +27 -0
  54. package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +3 -14
  55. package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +15 -214
  56. package/dist/src/extensions/Blocks/Recommendation/types/nodeConfig.d.ts +0 -6
  57. package/dist/src/extensions/Blocks/common-control.d.ts +1 -4
  58. package/dist/src/services/recommendationApi.d.ts +1 -4
  59. package/dist/src/stores/config.d.ts +30 -18
  60. package/dist/src/stores/save-validation.d.ts +22 -0
  61. package/dist/src/utils/templatePreparation.d.ts +30 -0
  62. package/dist/stores/config.js +39 -22
  63. package/dist/stores/save-validation.js +30 -0
  64. package/dist/utils/dateUtil.js +10 -23
  65. package/dist/utils/templatePreparation.js +50 -50
  66. package/package.json +1 -2
  67. package/dist/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue.js +0 -18
  68. package/dist/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue2.js +0 -70
  69. package/dist/components/organisms/extensions/recommendation/StrategyInfoBox.vue.js +0 -20
  70. package/dist/components/organisms/extensions/recommendation/StrategyInfoBox.vue2.js +0 -55
  71. package/dist/extensions/Blocks/Recommendation/controls/main/strategy.js +0 -141
  72. package/dist/src/components/organisms/extensions/recommendation/StrategyInfoBox.vue.d.ts +0 -24
  73. package/dist/src/extensions/Blocks/Recommendation/controls/main/strategy.d.ts +0 -29
  74. package/dist/src/mock/api/recommendation-strategies.d.ts +0 -43
  75. package/dist/static/styles/components/recommendation-strategy.css.js +0 -171
@@ -15,6 +15,36 @@ import type { SavedTemplateDetails } from '@@/Types/stripo';
15
15
  * same source), so it is reliably present regardless of how the block was added.
16
16
  */
17
17
  export declare function getHtmlReferencedUnsubscribePages(html: string): number[];
18
+ /**
19
+ * Hydrates the recommendation extension store from the persisted `esd-ext-config`
20
+ * JSON blob on each `.recommendation-block-v2` element in the raw editor HTML.
21
+ *
22
+ * Why this runs before `compileHtml`:
23
+ * The HTML compiler's `prepareRecommendationBlocks` rule asks
24
+ * `useRecommendation.buildCampaignUrl(id)` to assemble each block's API URL
25
+ * from `blockStates[id].recommendationConfigs`. That Pinia entry is normally
26
+ * populated by `RecommendationBlockControl._syncNodeConfigToStore`, which
27
+ * only fires when the user *selects* the block. Saving without ever
28
+ * selecting a migrated block would otherwise build the URL from empty/
29
+ * default state and the campaign URL would not be saved.
30
+ *
31
+ * Why we read raw HTML, not compiled HTML:
32
+ * Stripo's `compileEmail()` strips editor-only attributes (`esd-*`) from the
33
+ * compiled output, so `esd-ext-config` is gone by the time the compiler
34
+ * pipeline sees the HTML. The raw HTML from `getTemplateData()` preserves
35
+ * the attribute as the migrator wrote it.
36
+ *
37
+ * Reference data pre-load:
38
+ * When the template has recommendation blocks, this also pre-loads the
39
+ * shared reference data (languages / currency list) so the save-time
40
+ * required-fields validator can check each block's locale and currency
41
+ * against the partner's real options. Best-effort — on a fetch failure the
42
+ * validator degrades to its empty-list guard (`requiredFields.ts`) instead
43
+ * of blocking the save or stranding the Save button.
44
+ */
45
+ declare function hydrateRecommendationStoreFromRawHtml(rawHtml: string): Promise<void>;
18
46
  export declare const useTemplatePreparation: () => {
19
47
  prepareTemplateDetails: () => Promise<Omit<SavedTemplateDetails, "metadata">>;
48
+ hydrateRecommendationStore: typeof hydrateRecommendationStoreFromRawHtml;
20
49
  };
50
+ export {};
@@ -1,8 +1,8 @@
1
- import "../@types/config/schemas.js";
1
+ import { MessageType as r } from "../@types/config/schemas.js";
2
2
  import "../@types/config/defaults.js";
3
3
  import { parseConfig as o } from "../@types/config/validator.js";
4
- import { defineStore as r } from "pinia";
5
- const f = r("guido-config", {
4
+ import { defineStore as a } from "pinia";
5
+ const u = a("guido-config", {
6
6
  state: () => ({
7
7
  initialized: !1,
8
8
  config: null
@@ -75,57 +75,74 @@ const f = r("guido-config", {
75
75
  * Get the template ID
76
76
  */
77
77
  templateId: (i) => {
78
- var e, n;
79
- return ((n = (e = i.config) == null ? void 0 : e.identity) == null ? void 0 : n.templateId) ?? "";
78
+ var e, t;
79
+ return ((t = (e = i.config) == null ? void 0 : e.identity) == null ? void 0 : t.templateId) ?? "";
80
80
  },
81
81
  /**
82
82
  * Get the user ID
83
83
  */
84
84
  userId: (i) => {
85
- var e, n;
86
- return ((n = (e = i.config) == null ? void 0 : e.identity) == null ? void 0 : n.userId) ?? "";
85
+ var e, t;
86
+ return ((t = (e = i.config) == null ? void 0 : e.identity) == null ? void 0 : t.userId) ?? "";
87
87
  },
88
88
  /**
89
89
  * Get the variation ID
90
90
  */
91
91
  variationId: (i) => {
92
- var e, n;
93
- return ((n = (e = i.config) == null ? void 0 : e.identity) == null ? void 0 : n.variationId) ?? "";
92
+ var e, t;
93
+ return ((t = (e = i.config) == null ? void 0 : e.identity) == null ? void 0 : t.variationId) ?? "";
94
94
  },
95
95
  /**
96
96
  * Get the partner name
97
97
  */
98
98
  partnerName: (i) => {
99
- var e, n;
100
- return ((n = (e = i.config) == null ? void 0 : e.partner) == null ? void 0 : n.name) ?? "";
99
+ var e, t;
100
+ return ((t = (e = i.config) == null ? void 0 : e.partner) == null ? void 0 : t.name) ?? "";
101
101
  },
102
102
  /**
103
103
  * Get the product type
104
104
  */
105
105
  productType: (i) => {
106
- var e, n;
107
- return ((n = (e = i.config) == null ? void 0 : e.partner) == null ? void 0 : n.productType) ?? 60;
106
+ var e, t;
107
+ return ((t = (e = i.config) == null ? void 0 : e.partner) == null ? void 0 : t.productType) ?? 60;
108
108
  },
109
109
  /**
110
110
  * Get the message type
111
111
  */
112
112
  messageType: (i) => {
113
- var e, n;
114
- return ((n = (e = i.config) == null ? void 0 : e.partner) == null ? void 0 : n.messageType) ?? 1;
113
+ var e, t;
114
+ return ((t = (e = i.config) == null ? void 0 : e.partner) == null ? void 0 : t.messageType) ?? 1;
115
+ },
116
+ /**
117
+ * Transactional campaigns keep the hard save block. Reactive getter, so
118
+ * consumers stay safe in setup where a raw config read snapshots null (SD-147945).
119
+ */
120
+ isTransactional() {
121
+ return this.messageType === r.TRANSACTIONAL;
122
+ },
123
+ /**
124
+ * Soft-save policy: may the editor persist a template with validation errors?
125
+ * Default true (host sets features.allowSaveWithErrors=false for transactional +
126
+ * unsub). Reactive getter defaulting true — reading via isFeatureEnabled would
127
+ * floor to false pre-init and momentarily hide the soft-save option (SD-147430).
128
+ */
129
+ allowSaveWithErrors() {
130
+ var i;
131
+ return ((i = this.features) == null ? void 0 : i.allowSaveWithErrors) ?? !0;
115
132
  },
116
133
  /**
117
134
  * Get the username
118
135
  */
119
136
  username: (i) => {
120
- var e, n;
121
- return ((n = (e = i.config) == null ? void 0 : e.partner) == null ? void 0 : n.username) ?? "Guido User";
137
+ var e, t;
138
+ return ((t = (e = i.config) == null ? void 0 : e.partner) == null ? void 0 : t.username) ?? "Guido User";
122
139
  },
123
140
  /**
124
141
  * Check if header should be shown
125
142
  */
126
143
  showHeader: (i) => {
127
- var e, n;
128
- return ((n = (e = i.config) == null ? void 0 : e.ui) == null ? void 0 : n.showHeader) ?? !0;
144
+ var e, t;
145
+ return ((t = (e = i.config) == null ? void 0 : e.ui) == null ? void 0 : t.showHeader) ?? !0;
129
146
  },
130
147
  /**
131
148
  * Check if a specific feature is enabled.
@@ -134,8 +151,8 @@ const f = r("guido-config", {
134
151
  */
135
152
  // eslint-disable-next-line @stylistic/max-len
136
153
  isFeatureEnabled: (i) => (e) => {
137
- var n, t;
138
- return ((t = (n = i.config) == null ? void 0 : n.features) == null ? void 0 : t[e]) ?? !1;
154
+ var t, n;
155
+ return ((n = (t = i.config) == null ? void 0 : t.features) == null ? void 0 : n[e]) ?? !1;
139
156
  }
140
157
  },
141
158
  actions: {
@@ -155,5 +172,5 @@ const f = r("guido-config", {
155
172
  }
156
173
  });
157
174
  export {
158
- f as useConfigStore
175
+ u as useConfigStore
159
176
  };
@@ -0,0 +1,30 @@
1
+ import { defineStore as n } from "pinia";
2
+ function i(e) {
3
+ const t = /* @__PURE__ */ new Set();
4
+ return e.filter((r) => {
5
+ const s = JSON.stringify([r.rule, r.message, r.detail ?? ""]);
6
+ return t.has(s) ? !1 : (t.add(s), !0);
7
+ });
8
+ }
9
+ const o = n("guidoSaveValidation", {
10
+ state: () => ({
11
+ errors: [],
12
+ isDrawerOpen: !1,
13
+ intent: null
14
+ }),
15
+ getters: {
16
+ errorCount: (e) => e.errors.length
17
+ },
18
+ actions: {
19
+ open(e, t) {
20
+ this.errors = i(e), this.intent = t, this.isDrawerOpen = !0;
21
+ },
22
+ // Errors are retained so rows don't blank during the ~300ms close animation.
23
+ close() {
24
+ this.isDrawerOpen = !1;
25
+ }
26
+ }
27
+ });
28
+ export {
29
+ o as useSaveValidationStore
30
+ };
@@ -1,19 +1,10 @@
1
- import { DEFAULT_LOCALE as n, DEFAULT as a, DEFAULT_TZ as c } from "../enums/date.js";
2
- const m = (t) => t ? t instanceof Date ? t : typeof t == "string" ? t.length === 10 && !Number.isNaN(Number(t)) ? new Date(Number(t) * 1e3) : new Date(t) : typeof t == "number" ? t.toString().length === 10 ? new Date(t * 1e3) : new Date(t) : /* @__PURE__ */ new Date() : /* @__PURE__ */ new Date(), s = () => {
1
+ import { DEFAULT_LOCALE as r, DEFAULT as o } from "../enums/date.js";
2
+ const c = () => {
3
3
  const t = window.l10n;
4
- return (t == null ? void 0 : t.locale) === a ? n : (t == null ? void 0 : t.locale) || n;
5
- }, u = new Intl.DateTimeFormat().resolvedOptions().timeZone, f = () => {
6
- const t = window.l10n;
7
- return (t == null ? void 0 : t.timezone) || u || c;
8
- }, D = (t, e = s(), r = f()) => {
9
- const o = {
10
- year: "numeric",
11
- month: "2-digit",
12
- day: "2-digit",
13
- timeZone: r
14
- }, i = m(t);
15
- return new Intl.DateTimeFormat(e, o).format(i);
16
- }, T = (t) => {
4
+ return (t == null ? void 0 : t.locale) === o ? r : (t == null ? void 0 : t.locale) || r;
5
+ };
6
+ new Intl.DateTimeFormat().resolvedOptions().timeZone;
7
+ const i = (t) => {
17
8
  if (!t)
18
9
  return "";
19
10
  const e = new Date(t);
@@ -25,13 +16,9 @@ const m = (t) => t ? t instanceof Date ? t : typeof t == "string" ? t.length ===
25
16
  second: "2-digit",
26
17
  hour12: !1
27
18
  }).format(e);
28
- }, h = (t) => t ? Math.floor(Date.now() / 1e3) >= t : !1;
19
+ }, m = (t) => t ? Math.floor(Date.now() / 1e3) >= t : !1;
29
20
  export {
30
- m as convertToDateObject,
31
- T as formatPatchDate,
32
- D as formatShortDate,
33
- h as isAfterDate,
34
- u as localTz,
35
- s as locale,
36
- f as timezone
21
+ i as formatPatchDate,
22
+ m as isAfterDate,
23
+ c as locale
37
24
  };
@@ -1,30 +1,30 @@
1
- import { useActionsApi as k } from "../composables/useActionsApi.js";
1
+ import { useActionsApi as R } from "../composables/useActionsApi.js";
2
2
  import { useConfig as U } from "../composables/useConfig.js";
3
3
  import { useHtmlCompiler as x } from "../composables/useHtmlCompiler.js";
4
- import { DEFAULT_CURRENCY as d, DEFAULT_NODE_CONFIG as a } from "../extensions/Blocks/Recommendation/constants/defaultConfig.js";
5
- import { useRecommendationExtensionStore as C } from "../extensions/Blocks/Recommendation/store/recommendation.js";
4
+ import { DEFAULT_CURRENCY as d, DEFAULT_NODE_CONFIG as s } from "../extensions/Blocks/Recommendation/constants/defaultConfig.js";
5
+ import { useRecommendationExtensionStore as T } from "../extensions/Blocks/Recommendation/store/recommendation.js";
6
6
  import { mapLegacyStrategy as L } from "../extensions/Blocks/Recommendation/utils/legacyStrategyMap.js";
7
7
  import { DATA_ATTRIBUTES as A } from "../extensions/Blocks/Unsubscribe/utils/constants.js";
8
- import { parsePageList as R } from "../extensions/Blocks/Unsubscribe/utils/utils.js";
9
- import { useDynamicContentStore as N } from "../stores/dynamic-content.js";
10
- import { useEditorStore as z } from "../stores/editor.js";
11
- import { useUnsubscribeStore as _ } from "../stores/unsubscribe.js";
12
- import { assignTrackingIds as v } from "./linkTrackingIds.js";
13
- function O(m) {
14
- const i = new DOMParser().parseFromString(m, "text/html").querySelectorAll(`[${A.PAGE_LIST}]`), t = [];
15
- return i.forEach((s) => {
16
- const o = s.getAttribute(A.PAGE_LIST);
17
- o && t.push(...R(o));
8
+ import { parsePageList as N } from "../extensions/Blocks/Unsubscribe/utils/utils.js";
9
+ import { useDynamicContentStore as z } from "../stores/dynamic-content.js";
10
+ import { useEditorStore as _ } from "../stores/editor.js";
11
+ import { useUnsubscribeStore as v } from "../stores/unsubscribe.js";
12
+ import { assignTrackingIds as O } from "./linkTrackingIds.js";
13
+ function M(m) {
14
+ const n = new DOMParser().parseFromString(m, "text/html").querySelectorAll(`[${A.PAGE_LIST}]`), t = [];
15
+ return n.forEach((i) => {
16
+ const o = i.getAttribute(A.PAGE_LIST);
17
+ o && t.push(...N(o));
18
18
  }), [...new Set(t)];
19
19
  }
20
- async function M(m) {
21
- const n = new DOMParser().parseFromString(m, "text/html").querySelectorAll(".recommendation-block-v2");
22
- if (n.length === 0)
20
+ async function C(m) {
21
+ const a = new DOMParser().parseFromString(m, "text/html").querySelectorAll(".recommendation-block-v2");
22
+ if (a.length === 0)
23
23
  return;
24
- const i = C();
25
- n.forEach((t) => {
24
+ const n = T();
25
+ a.forEach((t) => {
26
26
  var r, l, g, f, c;
27
- const s = t.getAttribute("recommendation-id"), o = s ? Number(s) : NaN;
27
+ const i = t.getAttribute("recommendation-id"), o = i ? Number(i) : NaN;
28
28
  if (!Number.isFinite(o))
29
29
  return;
30
30
  const p = t.getAttribute("esd-ext-config");
@@ -42,27 +42,24 @@ async function M(m) {
42
42
  // Normalize legacy strategy keys (e.g. `mostViewed` → `mostPopular`) so
43
43
  // already-saved blocks that never re-run the migrator don't emit a
44
44
  // strategy-less campaign URL. `||` also catches '' / undefined (SD-144882).
45
- strategy: L(e.strategy) || a.strategy,
46
- // esd-ext-config is the source of truth for the assigned RRS —
47
- // a strategy-backed block must survive save/reopen from it alone.
48
- strategyId: e.strategyId ?? a.strategyId,
49
- language: e.language ?? a.language,
50
- size: e.size ?? a.size,
45
+ strategy: L(e.strategy) || s.strategy,
46
+ language: e.language ?? s.language,
47
+ size: e.size ?? s.size,
51
48
  // Spread the default arrays so each block gets a fresh reference
52
49
  // instead of sharing the singleton in DEFAULT_NODE_CONFIG.
53
- productIds: e.productIds ?? [...a.productIds],
54
- filters: e.filters ?? [...a.filters],
55
- shuffleProducts: e.shuffleProducts ?? a.shuffleProducts,
50
+ productIds: e.productIds ?? [...s.productIds],
51
+ filters: e.filters ?? [...s.filters],
52
+ shuffleProducts: e.shuffleProducts ?? s.shuffleProducts,
56
53
  currencyCode: ((r = e.currency) == null ? void 0 : r.code) ?? d.code,
57
54
  currencyAlignment: ((l = e.currency) == null ? void 0 : l.alignment) ?? d.alignment,
58
55
  currencyDecimalCount: ((g = e.currency) == null ? void 0 : g.decimalCount) ?? d.decimalCount,
59
56
  currencyDecimalSeparator: ((f = e.currency) == null ? void 0 : f.decimalSeparator) ?? d.decimalSeparator,
60
57
  currencyThousandSeparator: ((c = e.currency) == null ? void 0 : c.thousandSeparator) ?? d.thousandSeparator
61
58
  };
62
- i.seedBlockUrlConfig(o, h);
59
+ n.seedBlockUrlConfig(o, h);
63
60
  });
64
61
  try {
65
- await i.fetchRecommendationCreateData();
62
+ await n.fetchRecommendationCreateData();
66
63
  } catch (t) {
67
64
  console.warn(
68
65
  "Recommendation reference data pre-load failed; validator will skip the availability check.",
@@ -71,39 +68,39 @@ async function M(m) {
71
68
  }
72
69
  }
73
70
  const Z = () => {
74
- const m = N(), u = z(), n = _(), { getCompiledEmail: i, getTemplateData: t, updateHtmlAndCss: s } = k(), { compileHtml: o, compileAmpHtml: p } = x(), { isFeatureEnabled: e } = U();
71
+ const m = z(), u = _(), a = v(), { getCompiledEmail: n, getTemplateData: t, updateHtmlAndCss: i } = R(), { compileHtml: o, compileAmpHtml: p } = x(), { isFeatureEnabled: e } = U();
75
72
  return {
76
73
  prepareTemplateDetails: async () => {
77
74
  let { html: r, css: l, syncModulesIds: g = [] } = await t();
78
75
  if (e("linkTrackingIds"))
79
76
  try {
80
- const { html: S, changed: F, nextSeq: H } = v(r, u.trackIdSessionFloor);
81
- u.trackIdSessionFloor = H, F && (r = S, await s(S, l));
82
- } catch (S) {
83
- console.error("Tracking-id step failed, saving anyway:", S);
77
+ const { html: y, changed: I, nextSeq: k } = O(r, u.trackIdSessionFloor);
78
+ u.trackIdSessionFloor = k, I && (r = y, await i(y, l));
79
+ } catch (y) {
80
+ console.error("Tracking-id step failed, saving anyway:", y);
84
81
  }
85
- const { html: f, ampHtml: c = "", ampErrors: T = [] } = await i({
82
+ const { html: f, ampHtml: c = "", ampErrors: w = [] } = await n({
86
83
  minimize: !0,
87
84
  resetDataSavedFlag: !1
88
85
  });
89
- n.selectedUnsubscribePages.length && await n.fetchTemplates(), await M(r);
90
- const { compiledHtml: I, stats: y, appliedRules: w } = o(f), D = c && p(c).compiledHtml, E = m.getSelectedDynamicContentList, P = C(), b = O(r);
86
+ a.selectedUnsubscribePages.length && await a.fetchTemplates(), await C(r);
87
+ const { compiledHtml: D, stats: S, appliedRules: E } = o(f), P = c && p(c).compiledHtml, F = m.getSelectedDynamicContentList, H = T(), b = M(r);
91
88
  return console.debug("HTML Compilation Stats:", {
92
- originalSize: y.originalSize,
93
- compiledSize: y.compiledSize,
94
- reduction: `${y.reductionPercentage.toFixed(2)}%`,
95
- appliedRules: w,
96
- executionTime: `${y.executionTime.toFixed(2)}ms`
89
+ originalSize: S.originalSize,
90
+ compiledSize: S.compiledSize,
91
+ reduction: `${S.reductionPercentage.toFixed(2)}%`,
92
+ appliedRules: E,
93
+ executionTime: `${S.executionTime.toFixed(2)}ms`
97
94
  }), {
98
- dynamicContentList: E,
99
- compiledHtml: I,
95
+ dynamicContentList: F,
96
+ compiledHtml: D,
100
97
  rawHtml: r,
101
98
  css: l,
102
- ampHtml: D,
103
- ampErrors: T,
99
+ ampHtml: P,
100
+ ampErrors: w,
104
101
  modules: g.map(Number),
105
102
  recommendation: {
106
- campaignUrls: P.recommendationCampaignUrls,
103
+ campaignUrls: H.recommendationCampaignUrls,
107
104
  configs: {}
108
105
  },
109
106
  unsubscribe: {
@@ -111,10 +108,13 @@ const Z = () => {
111
108
  config: b
112
109
  }
113
110
  };
114
- }
111
+ },
112
+ // Exposed so the back/test validate-only path can seed the reco store the
113
+ // same way a full save does (required-field findings depend on it).
114
+ hydrateRecommendationStore: C
115
115
  };
116
116
  };
117
117
  export {
118
- O as getHtmlReferencedUnsubscribePages,
118
+ M as getHtmlReferencedUnsubscribePages,
119
119
  Z as useTemplatePreparation
120
120
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@useinsider/guido",
3
- "version": "3.17.0-beta.e6704da",
3
+ "version": "3.17.0-beta.ea65303",
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",
@@ -48,7 +48,6 @@
48
48
  "license": "ISC",
49
49
  "dependencies": {
50
50
  "@stripoinc/ui-editor-extensions": "3.9.0",
51
- "@useinsider/design-system-organisms": "0.0.3-beta.fc2c160",
52
51
  "@useinsider/design-system-vue": "1.5.0",
53
52
  "@vueuse/core": "11.3.0",
54
53
  "lodash-es": "4.17.21",
@@ -1,18 +0,0 @@
1
- import a from "./AssignStrategyDrawer.vue2.js";
2
- /* empty css */
3
- import r from "../../../../_virtual/_plugin-vue2_normalizer.js";
4
- var n = function() {
5
- var s = this, e = s._self._c, t = s._self._setupProxy;
6
- return e(t.WpDrawer, { attrs: { id: "assign-strategy-drawer", "description-status": "", size: "medium", "description-text": t.drawerDescription, "footer-button-group-options": t.footerButtonGroupOptions, status: t.store.assignStrategyDrawerStatus, "title-text": t.trans("gpt-app-builder.assign-recommendation-strategy") }, on: { cancelOrBackButtonEvent: t.closeDrawer, onCloseEvent: t.closeDrawer, primaryButtonEvent: t.assignStrategy } }, [t.store.assignStrategyDrawerStatus ? e("div", { staticClass: "assign-strategy-drawer-content" }, [e(t.InSelect, { staticClass: "assign-strategy-select", attrs: { id: "assign-strategy-select", "search-status": "", "static-child-position": "bottom right", "button-status": !1, "dynamic-child-position": !1, "label-text": t.trans("ds-steps.recommendation-strategy"), options: t.strategyOptions, "placeholder-text": t.trans("ds-steps.select-strategy"), "skeleton-sizing": { width: 240, height: 42 }, "skeleton-status": t.store.strategiesLoading, value: t.selectValue }, on: { select: t.onSelect } }), t.selectedStrategy ? e("div", { key: String(t.selectedStrategy.strategy_id), staticClass: "assign-strategy-detail" }, [e(t.OrgStrategyDetailModal, { attrs: { show: "", "campaign-details-tab-status": t.campaignTabSupported, "footer-status": !1, strategy: t.selectedStrategy } })], 1) : s._e()], 1) : s._e()]);
7
- }, o = [], i = /* @__PURE__ */ r(
8
- a,
9
- n,
10
- o,
11
- !1,
12
- null,
13
- "710137fe"
14
- );
15
- const p = i.exports;
16
- export {
17
- p as default
18
- };
@@ -1,70 +0,0 @@
1
- import { defineComponent as v, ref as c, computed as o, watch as _ } from "vue";
2
- import "@useinsider/design-system-organisms/style";
3
- import w from "../../../wrappers/WpDrawer.vue.js";
4
- import { useToaster as D } from "../../../../composables/useToaster.js";
5
- import { useTranslations as T } from "../../../../composables/useTranslations.js";
6
- import { ToasterTypeOptions as m } from "../../../../enums/toaster.js";
7
- import { useRecommendationExtensionStore as b } from "../../../../extensions/Blocks/Recommendation/store/recommendation.js";
8
- import { OrgStrategyDetailModal as h } from "@useinsider/design-system-organisms";
9
- import { InSelect as x } from "@useinsider/design-system-vue";
10
- import B from "./StrategyInfoBox.vue.js";
11
- const W = /* @__PURE__ */ v({
12
- __name: "AssignStrategyDrawer",
13
- setup(A) {
14
- const g = "/discovery/recommendation-strategies", s = T(), e = b(), { showToaster: n } = D(), r = c(null), a = c(!1), u = c(!1), p = o(() => e.assignStrategyDrawerStatus ? s("email-editor.assign-strategy-description", { url: g }) : "");
15
- _(() => e.assignStrategyDrawerStatus, (t) => {
16
- if (!t)
17
- return;
18
- const { strategyId: l } = e.recommendationConfigs;
19
- r.value = l || null, u.value = !!window.l10n, e.fetchStrategies().catch((S) => {
20
- console.error("fetchStrategies error:", S), n({
21
- type: m.Error,
22
- message: s("discovery-strategy.error-description")
23
- });
24
- });
25
- });
26
- const d = o(() => e.strategies.map((t) => ({
27
- text: t.name,
28
- value: t.strategy_id,
29
- infoBoxProps: {
30
- id: `strategy-info-${t.strategy_id}`,
31
- theme: "light",
32
- variant: "information",
33
- className: "assign-strategy-info-box",
34
- slot: B,
35
- slotProps: { strategy: t }
36
- }
37
- }))), y = o(() => [{ value: r.value }]), i = o(() => {
38
- const t = e.strategies.find((l) => String(l.strategy_id) === String(r.value ?? ""));
39
- return t ? { ...t, fallback_config: null } : null;
40
- }), f = o(() => ({
41
- primaryButton: {
42
- styling: "solid",
43
- type: "primary",
44
- labelText: s("products.assign-btn"),
45
- loadingStatus: a.value,
46
- disabledStatus: !i.value
47
- },
48
- cancelOrBackButton: {
49
- styling: "ghost",
50
- type: "secondary",
51
- labelText: s("products.cancel"),
52
- disabledStatus: a.value
53
- }
54
- }));
55
- return { __sfc: !0, RRS_PANEL_PATH: g, trans: s, store: e, showToaster: n, selectedStrategyId: r, isAssigning: a, campaignTabSupported: u, drawerDescription: p, strategyOptions: d, selectValue: y, selectedStrategy: i, footerButtonGroupOptions: f, closeDrawer: () => {
56
- e.closeAssignStrategyDrawer();
57
- }, assignStrategy: () => {
58
- const t = i.value;
59
- t && (a.value = !0, e.assignStrategy(t), n({
60
- type: m.Success,
61
- message: s("email-editor.strategy-assigned-success", { strategyName: t.name })
62
- }), e.closeAssignStrategyDrawer(), a.value = !1);
63
- }, onSelect: (t) => {
64
- r.value = t.value;
65
- }, WpDrawer: w, OrgStrategyDetailModal: h, InSelect: x };
66
- }
67
- });
68
- export {
69
- W as default
70
- };
@@ -1,20 +0,0 @@
1
- import _ from "./StrategyInfoBox.vue2.js";
2
- /* empty css */
3
- import o from "../../../../_virtual/_plugin-vue2_normalizer.js";
4
- var r = function() {
5
- var t = this, s = t._self._c, a = t._self._setupProxy;
6
- return s("div", { staticClass: "strategy-info-box" }, [s("div", { staticClass: "strategy-info-box__name" }, [t._v(" " + t._s(t.strategy.name) + " ")]), a.lastUpdated ? s("div", { staticClass: "strategy-info-box__updated" }, [t._v(" " + t._s(a.lastUpdated) + " ")]) : t._e(), s("div", { staticClass: "strategy-info-box__rows" }, t._l(a.rows, function(e) {
7
- return s("div", { key: e.label, staticClass: "strategy-info-box__row" }, [s("div", { staticClass: "strategy-info-box__label" }, [t._v(" " + t._s(e.label) + " ")]), s("div", { staticClass: "strategy-info-box__value" }, [t._v(" " + t._s(e.value) + " ")])]);
8
- }), 0)]);
9
- }, i = [], n = /* @__PURE__ */ o(
10
- _,
11
- r,
12
- i,
13
- !1,
14
- null,
15
- "fe4491e6"
16
- );
17
- const d = n.exports;
18
- export {
19
- d as default
20
- };
@@ -1,55 +0,0 @@
1
- import { defineComponent as v, computed as s } from "vue";
2
- import { useTranslations as h } from "../../../../composables/useTranslations.js";
3
- import { formatShortDate as f } from "../../../../utils/dateUtil.js";
4
- const A = /* @__PURE__ */ v({
5
- __name: "StrategyInfoBox",
6
- props: {
7
- strategy: null
8
- },
9
- setup(g) {
10
- const t = g, r = h(), n = (e) => e == null ? "" : String(e), y = s(() => {
11
- const e = n(t.strategy.updated_at || t.strategy.created_at);
12
- return e ? r("recommendation-strategy.last-updated-on", { value: f(e) }) : "";
13
- }), c = s(() => {
14
- const e = n(t.strategy.algorithm) === "MIXED" ? r("discovery-strategy.mixed-algorithm") : r("discovery-strategy.single-algorithm"), a = n(t.strategy.algorithm_used).split(",").map((o) => o.trim()).filter(Boolean).map((o) => r(`recommendation-algorithm-names.${o.replaceAll("_", "-").toLowerCase()}`));
15
- return a.length ? `${e} · ${a.join(", ")}` : e;
16
- }), u = s(() => [
17
- [t.strategy.exclude_view, "discovery-strategy.exclude-recently-view-items"],
18
- [t.strategy.exclude_purchase, "discovery-strategy.exclude-recently-purchased-items"],
19
- [t.strategy.exclude_cart, "discovery-strategy.exclude-recently-added-cart-items"]
20
- ].filter(([a]) => Number(a) === 1).map(([, a]) => r(a)).join(", ")), d = s(() => n(
21
- t.strategy.manual_merchandising || t.strategy.manual_merchandising_products
22
- ).trim()), i = s(() => {
23
- const e = t.strategy.filters;
24
- if (!e)
25
- return 0;
26
- try {
27
- const a = typeof e == "string" ? JSON.parse(e) : e;
28
- return Array.isArray(a) ? a.reduce((o, m) => o + (Array.isArray(m) ? m.length : 1), 0) : 0;
29
- } catch {
30
- return 0;
31
- }
32
- }), l = s(() => r("recommendation-strategy.none")), p = s(() => [
33
- {
34
- label: r("gpt-app-builder.algorithms-and-method"),
35
- value: c.value
36
- },
37
- {
38
- label: r("gpt-app-builder.exclusions"),
39
- value: u.value || l.value
40
- },
41
- {
42
- label: r("discovery-strategy.filters"),
43
- value: i.value ? String(i.value) : l.value
44
- },
45
- {
46
- label: r("action-builder.manual-merchandising"),
47
- value: d.value || l.value
48
- }
49
- ]);
50
- return { __sfc: !0, props: t, trans: r, asText: n, lastUpdated: y, algorithmsAndMethod: c, exclusions: u, manualMerchandising: d, filterCount: i, none: l, rows: p };
51
- }
52
- });
53
- export {
54
- A as default
55
- };