@useinsider/guido 3.19.0-beta.892c3ca → 3.19.0-beta.9fe04f1

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 (78) hide show
  1. package/README.md +0 -1
  2. package/dist/@types/config/schemas.js +118 -107
  3. package/dist/components/Guido.vue.js +9 -9
  4. package/dist/components/Guido.vue2.js +77 -69
  5. package/dist/components/organisms/AutoSaveController.vue2.js +8 -9
  6. package/dist/components/organisms/base/AuthErrorModal.vue.js +18 -0
  7. package/dist/components/organisms/base/AuthErrorModal.vue2.js +42 -0
  8. package/dist/components/organisms/header/EditorActions.vue.js +2 -2
  9. package/dist/components/organisms/header/EditorActions.vue2.js +55 -90
  10. package/dist/components/organisms/header/LeftSlot.vue.js +5 -5
  11. package/dist/components/organisms/header/LeftSlot.vue2.js +12 -16
  12. package/dist/components/wrappers/WpDrawer.vue.js +7 -9
  13. package/dist/components/wrappers/WpDrawer.vue2.js +1 -1
  14. package/dist/components/wrappers/WpModal.vue.js +1 -1
  15. package/dist/components/wrappers/WpModal.vue2.js +4 -3
  16. package/dist/composables/useAuthError.js +52 -0
  17. package/dist/composables/useCortexBlueprintBridge.js +122 -54
  18. package/dist/composables/useEmailTemplateApplier.js +106 -50
  19. package/dist/composables/useHtmlCompiler.js +26 -37
  20. package/dist/composables/useHtmlValidator.js +0 -2
  21. package/dist/composables/useHttp.js +64 -54
  22. package/dist/composables/useLegacyStrategyConversion.js +23 -19
  23. package/dist/composables/useSave.js +45 -90
  24. package/dist/composables/useStripo.js +24 -20
  25. package/dist/composables/useToaster.js +17 -15
  26. package/dist/composables/validators/useCouponBlockValidator.js +21 -24
  27. package/dist/composables/validators/useLiquidValidator.js +15 -15
  28. package/dist/composables/validators/useUnsubscribeBlockValidator.js +27 -34
  29. package/dist/config/migrator/index.js +14 -13
  30. package/dist/config/migrator/recommendationPartnerMigrator.js +50 -0
  31. package/dist/enums/extensions/recommendationBlock.js +30 -29
  32. package/dist/extensions/Blocks/Recommendation/block.js +15 -14
  33. package/dist/extensions/Blocks/Recommendation/controls/main/index.js +45 -38
  34. package/dist/extensions/Blocks/Recommendation/controls/main/strategy.js +72 -49
  35. package/dist/extensions/Blocks/Recommendation/store/recommendation.js +30 -29
  36. package/dist/extensions/Blocks/Recommendation/utils/partnerScope.js +25 -0
  37. package/dist/guido.css +1 -1
  38. package/dist/src/@types/config/schemas.d.ts +16 -4
  39. package/dist/src/components/Guido.vue.d.ts +1 -17
  40. package/dist/src/components/organisms/header/EditorActions.vue.d.ts +1 -17
  41. package/dist/src/components/organisms/header/HeaderWrapper.vue.d.ts +1 -17
  42. package/dist/src/components/organisms/header/RightSlot.vue.d.ts +1 -17
  43. package/dist/src/components/wrappers/WpDrawer.vue.d.ts +3 -4
  44. package/dist/src/components/wrappers/WpModal.vue.d.ts +5 -1
  45. package/dist/src/composables/useAuthError.d.ts +12 -0
  46. package/dist/src/composables/useConfig.d.ts +2 -2
  47. package/dist/src/composables/useCortexBlueprintBridge.d.ts +2 -3
  48. package/dist/src/composables/useEmailTemplateApplier.d.ts +18 -5
  49. package/dist/src/composables/useHtmlValidator.d.ts +0 -21
  50. package/dist/src/composables/useHttp.d.ts +2 -0
  51. package/dist/src/composables/useSave.d.ts +1 -6
  52. package/dist/src/composables/validators/useCouponBlockValidator.d.ts +0 -3
  53. package/dist/src/composables/validators/useUnsubscribeBlockValidator.d.ts +0 -10
  54. package/dist/src/config/migrator/index.d.ts +2 -1
  55. package/dist/src/config/migrator/recommendationPartnerMigrator.d.ts +19 -0
  56. package/dist/src/enums/extensions/recommendationBlock.d.ts +1 -1
  57. package/dist/src/extensions/Blocks/Recommendation/types/nodeConfig.d.ts +6 -0
  58. package/dist/src/extensions/Blocks/Recommendation/utils/partnerScope.d.ts +33 -0
  59. package/dist/src/stores/config.d.ts +20 -32
  60. package/dist/src/stores/guido-email-editor.d.ts +20 -10
  61. package/dist/src/utils/templatePreparation.d.ts +0 -30
  62. package/dist/static/styles/components/recommendation-strategy.css.js +9 -0
  63. package/dist/stores/config.js +67 -84
  64. package/dist/stores/guido-email-editor.js +3 -1
  65. package/dist/utils/templatePreparation.js +36 -39
  66. package/package.json +1 -1
  67. package/dist/components/organisms/validation/ValidationErrorDrawer.vue.js +0 -20
  68. package/dist/components/organisms/validation/ValidationErrorDrawer.vue2.js +0 -49
  69. package/dist/composables/useSaveValidation.js +0 -282
  70. package/dist/composables/useSaveValidationRollout.js +0 -9
  71. package/dist/enums/save-validation.js +0 -4
  72. package/dist/src/@types/save-validation.d.ts +0 -19
  73. package/dist/src/composables/useSaveValidation.d.ts +0 -6
  74. package/dist/src/composables/useSaveValidationRollout.d.ts +0 -3
  75. package/dist/src/enums/save-validation.d.ts +0 -27
  76. package/dist/src/stores/save-validation.d.ts +0 -22
  77. package/dist/stores/save-validation.js +0 -30
  78. /package/dist/src/components/organisms/{validation/ValidationErrorDrawer.vue.d.ts → base/AuthErrorModal.vue.d.ts} +0 -0
@@ -1,3 +1,13 @@
1
+ /** Terminal outcome of an editor write, keyed by `${blueprintId}:${version}`. */
2
+ export interface ApplyAck {
3
+ status: 'applied' | 'failed';
4
+ /** The `applyRequestedAt` of the click this ack answers — lets cortex drop stale acks. */
5
+ requestedAt: number;
6
+ /** Strictly increasing per key, so two acks in the same millisecond still order. */
7
+ ackAt: number;
8
+ /** Stringified — cortex JSON-clones store-derived payloads, an Error would not survive. */
9
+ error?: string;
10
+ }
1
11
  /** The published editor snapshot — the shape a consumer reads off the shared store. */
2
12
  export interface GuidoEmailEditorState {
3
13
  /** Current Stripo HTML — stripe tables only, no DOCTYPE/wrapper. */
@@ -8,6 +18,10 @@ export interface GuidoEmailEditorState {
8
18
  lastUpdatedAt: number;
9
19
  /** Template id from the editor config, so a consumer can scope per-template. */
10
20
  templateId: string;
21
+ /** True while a mounted Guido bridge is consuming the chat store. Gates cortex's Apply button. */
22
+ bridgeActive: boolean;
23
+ /** `${blueprintId}:${version}` → terminal outcome of the editor write, written only after it settles. */
24
+ applyAcks: Record<string, ApplyAck>;
11
25
  }
12
26
  /**
13
27
  * Outbound contract Guido publishes to the host's shared Pinia singleton so a
@@ -18,17 +32,11 @@ export interface GuidoEmailEditorState {
18
32
  * Published as `@useinsider/guido/editor-state` and from the root barrel, so a
19
33
  * consumer imports this store instead of re-declaring one under the same id.
20
34
  *
21
- * State + getters only, no actions. `useGuidoStateBridge` is the only intended
22
- * writer, but that is Guido's own convention rather than something the store
23
- * enforces: publishing the definition hands a consumer `$patch` as well, exactly
24
- * as the runtime `pinia._s` probe always did.
35
+ * State-only by contract: cortex-fe reads `pinia.state.value['guidoEmailEditor']`, which misses
36
+ * actions and getters. Intended writers: `useGuidoStateBridge` and `useCortexBlueprintBridge`.
25
37
  *
26
- * Store id `guidoEmailEditor` is cross-MFE: cortex-fe reads it via
27
- * `pinia._s.get('guidoEmailEditor')` at runtime rather than importing it, so the
28
- * id stays part of the contract. The internal Guido editor store keeps id
29
- * `guidoEditor` — these are intentionally separate. The internal store carries
30
- * UI state a consumer should not see; this public store carries the contract
31
- * Guido is willing to share.
38
+ * The id `guidoEmailEditor` is part of the cross-MFE contract; the internal
39
+ * store `guidoEditor` is intentionally separate.
32
40
  */
33
41
  export declare const useGuidoEmailEditorStore: import("pinia").StoreDefinition<"guidoEmailEditor", GuidoEmailEditorState, {
34
42
  /** True once the bridge has published at least one snapshot. */
@@ -37,5 +45,7 @@ export declare const useGuidoEmailEditorStore: import("pinia").StoreDefinition<"
37
45
  css: string;
38
46
  lastUpdatedAt: number;
39
47
  templateId: string;
48
+ bridgeActive: boolean;
49
+ applyAcks: Record<string, ApplyAck>;
40
50
  } & import("pinia").PiniaCustomStateProperties<GuidoEmailEditorState>) => boolean;
41
51
  }, {}>;
@@ -15,36 +15,6 @@ 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>;
46
18
  export declare const useTemplatePreparation: () => {
47
19
  prepareTemplateDetails: () => Promise<Omit<SavedTemplateDetails, "metadata">>;
48
- hydrateRecommendationStore: typeof hydrateRecommendationStoreFromRawHtml;
49
20
  };
50
- export {};
@@ -52,6 +52,15 @@ const n = `.strategy-control-header {
52
52
  mask-size: 24px 24px;
53
53
  }
54
54
 
55
+ .strategy-control-notice--error {
56
+ border-color: var(--guido-color-border-onpage-message-error);
57
+ background-color: var(--guido-color-background-onpage-message-error);
58
+ }
59
+
60
+ .strategy-control-notice--error::before {
61
+ background-color: var(--guido-color-border-onpage-message-error);
62
+ }
63
+
55
64
  .strategy-control-notice-text {
56
65
  margin: 0;
57
66
  padding: 4px 0;
@@ -1,8 +1,8 @@
1
- import { MessageType as r } from "../@types/config/schemas.js";
1
+ import "../@types/config/schemas.js";
2
2
  import "../@types/config/defaults.js";
3
- import { parseConfig as a } from "../@types/config/validator.js";
4
- import { defineStore as o } from "pinia";
5
- const g = o("guido-config", {
3
+ import { parseConfig as o } from "../@types/config/validator.js";
4
+ import { defineStore as a } from "pinia";
5
+ const s = a("guido-config", {
6
6
  state: () => ({
7
7
  initialized: !1,
8
8
  config: null
@@ -11,152 +11,135 @@ const g = o("guido-config", {
11
11
  /**
12
12
  * Get the identity configuration
13
13
  */
14
- identity: (i) => {
15
- var e;
16
- return ((e = i.config) == null ? void 0 : e.identity) ?? null;
14
+ identity: (e) => {
15
+ var i;
16
+ return ((i = e.config) == null ? void 0 : i.identity) ?? null;
17
17
  },
18
18
  /**
19
19
  * Get the partner configuration
20
20
  */
21
- partner: (i) => {
22
- var e;
23
- return ((e = i.config) == null ? void 0 : e.partner) ?? null;
21
+ partner: (e) => {
22
+ var i;
23
+ return ((i = e.config) == null ? void 0 : i.partner) ?? null;
24
24
  },
25
25
  /**
26
26
  * Get the template configuration
27
27
  */
28
- template: (i) => {
29
- var e;
30
- return ((e = i.config) == null ? void 0 : e.template) ?? null;
28
+ template: (e) => {
29
+ var i;
30
+ return ((i = e.config) == null ? void 0 : i.template) ?? null;
31
31
  },
32
32
  /**
33
33
  * Get the editor configuration
34
34
  */
35
- editor: (i) => {
36
- var e;
37
- return ((e = i.config) == null ? void 0 : e.editor) ?? null;
35
+ editor: (e) => {
36
+ var i;
37
+ return ((i = e.config) == null ? void 0 : i.editor) ?? null;
38
38
  },
39
39
  /**
40
40
  * Get the UI configuration
41
41
  */
42
- ui: (i) => {
43
- var e;
44
- return ((e = i.config) == null ? void 0 : e.ui) ?? null;
42
+ ui: (e) => {
43
+ var i;
44
+ return ((i = e.config) == null ? void 0 : i.ui) ?? null;
45
45
  },
46
46
  /**
47
47
  * Get the features configuration
48
48
  */
49
- features: (i) => {
50
- var e;
51
- return ((e = i.config) == null ? void 0 : e.features) ?? null;
49
+ features: (e) => {
50
+ var i;
51
+ return ((i = e.config) == null ? void 0 : i.features) ?? null;
52
52
  },
53
53
  /**
54
54
  * Get the blocks configuration
55
55
  */
56
- blocks: (i) => {
57
- var e;
58
- return ((e = i.config) == null ? void 0 : e.blocks) ?? null;
56
+ blocks: (e) => {
57
+ var i;
58
+ return ((i = e.config) == null ? void 0 : i.blocks) ?? null;
59
59
  },
60
60
  /**
61
61
  * Get the compiler configuration
62
62
  */
63
- compiler: (i) => {
64
- var e;
65
- return ((e = i.config) == null ? void 0 : e.compiler) ?? null;
63
+ compiler: (e) => {
64
+ var i;
65
+ return ((i = e.config) == null ? void 0 : i.compiler) ?? null;
66
66
  },
67
67
  /**
68
68
  * Get the callbacks configuration
69
69
  */
70
- callbacks: (i) => {
71
- var e;
72
- return ((e = i.config) == null ? void 0 : e.callbacks) ?? null;
70
+ callbacks: (e) => {
71
+ var i;
72
+ return ((i = e.config) == null ? void 0 : i.callbacks) ?? null;
73
73
  },
74
74
  /**
75
75
  * Get the template ID
76
76
  */
77
- templateId: (i) => {
78
- var e, t;
79
- return ((t = (e = i.config) == null ? void 0 : e.identity) == null ? void 0 : t.templateId) ?? "";
77
+ templateId: (e) => {
78
+ var i, t;
79
+ return ((t = (i = e.config) == null ? void 0 : i.identity) == null ? void 0 : t.templateId) ?? "";
80
80
  },
81
81
  /**
82
82
  * Get the user ID
83
83
  */
84
- userId: (i) => {
85
- var e, t;
86
- return ((t = (e = i.config) == null ? void 0 : e.identity) == null ? void 0 : t.userId) ?? "";
84
+ userId: (e) => {
85
+ var i, t;
86
+ return ((t = (i = e.config) == null ? void 0 : i.identity) == null ? void 0 : t.userId) ?? "";
87
87
  },
88
88
  /**
89
89
  * Get the variation ID
90
90
  */
91
- variationId: (i) => {
92
- var e, t;
93
- return ((t = (e = i.config) == null ? void 0 : e.identity) == null ? void 0 : t.variationId) ?? "";
91
+ variationId: (e) => {
92
+ var i, t;
93
+ return ((t = (i = e.config) == null ? void 0 : i.identity) == null ? void 0 : t.variationId) ?? "";
94
94
  },
95
95
  /**
96
96
  * Get the campaign ID
97
97
  */
98
- campaignId: (i) => {
99
- var e, t;
100
- return ((t = (e = i.config) == null ? void 0 : e.identity) == null ? void 0 : t.campaignId) ?? "";
98
+ campaignId: (e) => {
99
+ var i, t;
100
+ return ((t = (i = e.config) == null ? void 0 : i.identity) == null ? void 0 : t.campaignId) ?? "";
101
101
  },
102
102
  /**
103
103
  * Get the template-library ID of the host template
104
104
  */
105
- templateLibraryId: (i) => {
106
- var e, t;
107
- return ((t = (e = i.config) == null ? void 0 : e.identity) == null ? void 0 : t.templateLibraryId) ?? "";
105
+ templateLibraryId: (e) => {
106
+ var i, t;
107
+ return ((t = (i = e.config) == null ? void 0 : i.identity) == null ? void 0 : t.templateLibraryId) ?? "";
108
108
  },
109
109
  /**
110
110
  * Get the partner name
111
111
  */
112
- partnerName: (i) => {
113
- var e, t;
114
- return ((t = (e = i.config) == null ? void 0 : e.partner) == null ? void 0 : t.name) ?? "";
112
+ partnerName: (e) => {
113
+ var i, t;
114
+ return ((t = (i = e.config) == null ? void 0 : i.partner) == null ? void 0 : t.name) ?? "";
115
115
  },
116
116
  /**
117
117
  * Get the product type
118
118
  */
119
- productType: (i) => {
120
- var e, t;
121
- return ((t = (e = i.config) == null ? void 0 : e.partner) == null ? void 0 : t.productType) ?? 60;
119
+ productType: (e) => {
120
+ var i, t;
121
+ return ((t = (i = e.config) == null ? void 0 : i.partner) == null ? void 0 : t.productType) ?? 60;
122
122
  },
123
123
  /**
124
124
  * Get the message type
125
125
  */
126
- messageType: (i) => {
127
- var e, t;
128
- return ((t = (e = i.config) == null ? void 0 : e.partner) == null ? void 0 : t.messageType) ?? 1;
129
- },
130
- /**
131
- * Transactional campaigns keep the hard save block. Reactive getter, so
132
- * consumers stay safe in setup where a raw config read snapshots null (SD-147945).
133
- */
134
- isTransactional() {
135
- return this.messageType === r.TRANSACTIONAL;
136
- },
137
- /**
138
- * Soft-save policy: may the editor persist a template with validation errors?
139
- * Default true (host sets features.allowSaveWithErrors=false for transactional +
140
- * unsub). Reactive getter defaulting true — reading via isFeatureEnabled would
141
- * floor to false pre-init and momentarily hide the soft-save option (SD-147430).
142
- */
143
- allowSaveWithErrors() {
144
- var i;
145
- return ((i = this.features) == null ? void 0 : i.allowSaveWithErrors) ?? !0;
126
+ messageType: (e) => {
127
+ var i, t;
128
+ return ((t = (i = e.config) == null ? void 0 : i.partner) == null ? void 0 : t.messageType) ?? 1;
146
129
  },
147
130
  /**
148
131
  * Get the username
149
132
  */
150
- username: (i) => {
151
- var e, t;
152
- return ((t = (e = i.config) == null ? void 0 : e.partner) == null ? void 0 : t.username) ?? "Guido User";
133
+ username: (e) => {
134
+ var i, t;
135
+ return ((t = (i = e.config) == null ? void 0 : i.partner) == null ? void 0 : t.username) ?? "Guido User";
153
136
  },
154
137
  /**
155
138
  * Check if header should be shown
156
139
  */
157
- showHeader: (i) => {
158
- var e, t;
159
- return ((t = (e = i.config) == null ? void 0 : e.ui) == null ? void 0 : t.showHeader) ?? !0;
140
+ showHeader: (e) => {
141
+ var i, t;
142
+ return ((t = (i = e.config) == null ? void 0 : i.ui) == null ? void 0 : t.showHeader) ?? !0;
160
143
  },
161
144
  /**
162
145
  * Check if a specific feature is enabled.
@@ -164,18 +147,18 @@ const g = o("guido-config", {
164
147
  * flash on during loading, then disappear once config resolves.
165
148
  */
166
149
  // eslint-disable-next-line @stylistic/max-len
167
- isFeatureEnabled: (i) => (e) => {
150
+ isFeatureEnabled: (e) => (i) => {
168
151
  var t, n;
169
- return ((n = (t = i.config) == null ? void 0 : t.features) == null ? void 0 : n[e]) ?? !1;
152
+ return ((n = (t = e.config) == null ? void 0 : t.features) == null ? void 0 : n[i]) ?? !1;
170
153
  }
171
154
  },
172
155
  actions: {
173
156
  /**
174
157
  * Initialize the config store with validated configuration
175
158
  */
176
- init(i) {
177
- const e = a(i);
178
- this.config = e, this.initialized = !0;
159
+ init(e) {
160
+ const i = o(e);
161
+ this.config = i, this.initialized = !0;
179
162
  },
180
163
  /**
181
164
  * Reset the config store
@@ -186,5 +169,5 @@ const g = o("guido-config", {
186
169
  }
187
170
  });
188
171
  export {
189
- g as useConfigStore
172
+ s as useConfigStore
190
173
  };
@@ -4,7 +4,9 @@ const d = e("guidoEmailEditor", {
4
4
  html: "",
5
5
  css: "",
6
6
  lastUpdatedAt: 0,
7
- templateId: ""
7
+ templateId: "",
8
+ bridgeActive: !1,
9
+ applyAcks: {}
8
10
  }),
9
11
  getters: {
10
12
  /** True once the bridge has published at least one snapshot. */
@@ -1,31 +1,31 @@
1
- import { useActionsApi as k } from "../composables/useActionsApi.js";
2
- import { useConfig as N } from "../composables/useConfig.js";
3
- import { useHtmlCompiler as U } from "../composables/useHtmlCompiler.js";
4
- import { RRS_CONFIG_VERSION as x, DEFAULT_CURRENCY as m, DEFAULT_NODE_CONFIG as n } from "../extensions/Blocks/Recommendation/constants/defaultConfig.js";
5
- import { useRecommendationExtensionStore as w } from "../extensions/Blocks/Recommendation/store/recommendation.js";
6
- import { mapLegacyStrategy as L } from "../extensions/Blocks/Recommendation/utils/legacyStrategyMap.js";
1
+ import { useActionsApi as R } from "../composables/useActionsApi.js";
2
+ import { useConfig as k } from "../composables/useConfig.js";
3
+ import { useHtmlCompiler as N } from "../composables/useHtmlCompiler.js";
4
+ import { RRS_CONFIG_VERSION as U, DEFAULT_CURRENCY as m, DEFAULT_NODE_CONFIG as n } from "../extensions/Blocks/Recommendation/constants/defaultConfig.js";
5
+ import { useRecommendationExtensionStore as I } from "../extensions/Blocks/Recommendation/store/recommendation.js";
6
+ import { mapLegacyStrategy as x } 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 z } from "../extensions/Blocks/Unsubscribe/utils/utils.js";
9
- import { useDynamicContentStore as O } from "../stores/dynamic-content.js";
10
- import { useEditorStore as _ } from "../stores/editor.js";
11
- import { useUnsubscribeStore as v } from "../stores/unsubscribe.js";
12
- import { isPlainObject as B } from "./genericUtil.js";
13
- import { assignTrackingIds as G } from "./linkTrackingIds.js";
14
- function M(l) {
8
+ import { parsePageList as L } from "../extensions/Blocks/Unsubscribe/utils/utils.js";
9
+ import { useDynamicContentStore as z } from "../stores/dynamic-content.js";
10
+ import { useEditorStore as O } from "../stores/editor.js";
11
+ import { useUnsubscribeStore as _ } from "../stores/unsubscribe.js";
12
+ import { isPlainObject as v } from "./genericUtil.js";
13
+ import { assignTrackingIds as B } from "./linkTrackingIds.js";
14
+ function G(l) {
15
15
  const i = new DOMParser().parseFromString(l, "text/html").querySelectorAll(`[${A.PAGE_LIST}]`), t = [];
16
- return i.forEach((c) => {
17
- const r = c.getAttribute(A.PAGE_LIST);
18
- r && t.push(...z(r));
16
+ return i.forEach((s) => {
17
+ const r = s.getAttribute(A.PAGE_LIST);
18
+ r && t.push(...L(r));
19
19
  }), [...new Set(t)];
20
20
  }
21
- async function I(l) {
21
+ async function M(l) {
22
22
  const a = new DOMParser().parseFromString(l, "text/html").querySelectorAll(".recommendation-block-v2");
23
23
  if (a.length === 0)
24
24
  return;
25
- const i = w();
25
+ const i = I();
26
26
  a.forEach((t) => {
27
- var d, g, f, s, y, S;
28
- const c = t.getAttribute("recommendation-id"), r = c ? Number(c) : NaN;
27
+ var d, g, f, c, y, S;
28
+ const s = t.getAttribute("recommendation-id"), r = s ? Number(s) : NaN;
29
29
  if (!Number.isFinite(r))
30
30
  return;
31
31
  const p = t.getAttribute("esd-ext-config");
@@ -37,13 +37,13 @@ async function I(l) {
37
37
  } catch {
38
38
  return;
39
39
  }
40
- if (!B(e))
40
+ if (!v(e))
41
41
  return;
42
- const C = !!e.strategyId || (e.configVersion ?? 0) >= x, o = {
42
+ const C = !!e.strategyId || (e.configVersion ?? 0) >= U, o = {
43
43
  // Normalize legacy strategy keys (e.g. `mostViewed` → `mostPopular`) so
44
44
  // already-saved blocks that never re-run the migrator don't emit a
45
45
  // strategy-less campaign URL. `||` also catches '' / undefined (SD-144882).
46
- strategy: L(e.strategy) || (C ? "" : n.strategy),
46
+ strategy: x(e.strategy) || (C ? "" : n.strategy),
47
47
  strategyId: e.strategyId ?? n.strategyId,
48
48
  language: e.language ?? n.language,
49
49
  size: e.size ?? n.size,
@@ -55,7 +55,7 @@ async function I(l) {
55
55
  currencyCode: ((d = e.currency) == null ? void 0 : d.code) ?? m.code,
56
56
  currencySymbol: ((g = e.currency) == null ? void 0 : g.symbol) ?? m.symbol,
57
57
  currencyAlignment: ((f = e.currency) == null ? void 0 : f.alignment) ?? m.alignment,
58
- currencyDecimalCount: ((s = e.currency) == null ? void 0 : s.decimalCount) ?? m.decimalCount,
58
+ currencyDecimalCount: ((c = e.currency) == null ? void 0 : c.decimalCount) ?? m.decimalCount,
59
59
  currencyDecimalSeparator: ((y = e.currency) == null ? void 0 : y.decimalSeparator) ?? m.decimalSeparator,
60
60
  currencyThousandSeparator: ((S = e.currency) == null ? void 0 : S.thousandSeparator) ?? m.thousandSeparator
61
61
  };
@@ -71,39 +71,39 @@ async function I(l) {
71
71
  }
72
72
  }
73
73
  const re = () => {
74
- const l = O(), u = _(), a = v(), { getCompiledEmail: i, getTemplateData: t, updateHtmlAndCss: c } = k(), { compileHtml: r, compileAmpHtml: p } = U(), { isFeatureEnabled: e } = N();
74
+ const l = z(), u = O(), a = _(), { getCompiledEmail: i, getTemplateData: t, updateHtmlAndCss: s } = R(), { compileHtml: r, compileAmpHtml: p } = N(), { isFeatureEnabled: e } = k();
75
75
  return {
76
76
  prepareTemplateDetails: async () => {
77
77
  let { html: o, css: d, syncModulesIds: g = [] } = await t();
78
78
  if (e("linkTrackingIds"))
79
79
  try {
80
- const { html: b, changed: R, nextSeq: H } = G(o, u.trackIdSessionFloor);
81
- u.trackIdSessionFloor = H, R && (o = b, await c(b, d));
80
+ const { html: b, changed: F, nextSeq: H } = B(o, u.trackIdSessionFloor);
81
+ u.trackIdSessionFloor = H, F && (o = b, await s(b, d));
82
82
  } catch (b) {
83
83
  console.error("Tracking-id step failed, saving anyway:", b);
84
84
  }
85
- const { html: f, ampHtml: s = "", ampErrors: y = [] } = await i({
85
+ const { html: f, ampHtml: c = "", ampErrors: y = [] } = await i({
86
86
  minimize: !0,
87
87
  resetDataSavedFlag: !1
88
88
  });
89
- a.selectedUnsubscribePages.length && await a.fetchTemplates(), await I(o);
90
- const { compiledHtml: S, stats: h, appliedRules: D } = r(f), E = s && p(s).compiledHtml, P = l.getSelectedDynamicContentList, F = w(), T = M(o);
89
+ a.selectedUnsubscribePages.length && await a.fetchTemplates(), await M(o);
90
+ const { compiledHtml: S, stats: h, appliedRules: w } = r(f), D = c && p(c).compiledHtml, E = l.getSelectedDynamicContentList, P = I(), T = G(o);
91
91
  return console.debug("HTML Compilation Stats:", {
92
92
  originalSize: h.originalSize,
93
93
  compiledSize: h.compiledSize,
94
94
  reduction: `${h.reductionPercentage.toFixed(2)}%`,
95
- appliedRules: D,
95
+ appliedRules: w,
96
96
  executionTime: `${h.executionTime.toFixed(2)}ms`
97
97
  }), {
98
- dynamicContentList: P,
98
+ dynamicContentList: E,
99
99
  compiledHtml: S,
100
100
  rawHtml: o,
101
101
  css: d,
102
- ampHtml: E,
102
+ ampHtml: D,
103
103
  ampErrors: y,
104
104
  modules: g.map(Number),
105
105
  recommendation: {
106
- campaignUrls: F.recommendationCampaignUrls,
106
+ campaignUrls: P.recommendationCampaignUrls,
107
107
  configs: {}
108
108
  },
109
109
  unsubscribe: {
@@ -111,13 +111,10 @@ const re = () => {
111
111
  config: T
112
112
  }
113
113
  };
114
- },
115
- // Exposed so the back/test validate-only path can seed the reco store the
116
- // same way a full save does (required-field findings depend on it).
117
- hydrateRecommendationStore: I
114
+ }
118
115
  };
119
116
  };
120
117
  export {
121
- M as getHtmlReferencedUnsubscribePages,
118
+ G as getHtmlReferencedUnsubscribePages,
122
119
  re as useTemplatePreparation
123
120
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@useinsider/guido",
3
- "version": "3.19.0-beta.892c3ca",
3
+ "version": "3.19.0-beta.9fe04f1",
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",
@@ -1,20 +0,0 @@
1
- import a from "./ValidationErrorDrawer.vue2.js";
2
- /* empty css */
3
- import s from "../../../_virtual/_plugin-vue2_normalizer.js";
4
- var i = function() {
5
- var o = this, r = o._self._c, t = o._self._setupProxy;
6
- return r(t.WpDrawer, { attrs: { id: "guido__validation-error-drawer", size: "small", "footer-button-group-options": t.footerButtonGroupOptions, status: t.store.isDrawerOpen, "title-text": t.titleText }, on: { onCloseEvent: t.handleClose, primaryButtonEvent: t.handleClose, secondaryButtonEvent: t.handleSaveAndContinue } }, [r("div", { staticClass: "d-f f-d-c validation-error-list" }, o._l(t.rows, function(e, n) {
7
- return r("div", { key: n, staticClass: "d-f a-i-c validation-error-row" }, [r(t.InIcons, { staticClass: "validation-error-row__icon i-c-12", attrs: { name: "filled-caution-triangle" } }), r("span", { staticClass: "validation-error-row__text", domProps: { innerHTML: o._s(e) } })], 1);
8
- }), 0)]);
9
- }, l = [], d = /* @__PURE__ */ s(
10
- a,
11
- i,
12
- l,
13
- !1,
14
- null,
15
- "c5ff3804"
16
- );
17
- const u = d.exports;
18
- export {
19
- u as default
20
- };
@@ -1,49 +0,0 @@
1
- import { defineComponent as p, ref as c, computed as a } from "vue";
2
- import f from "../../wrappers/WpDrawer.vue.js";
3
- import { useSave as S } from "../../../composables/useSave.js";
4
- import { useTranslations as v } from "../../../composables/useTranslations.js";
5
- import { useConfigStore as g } from "../../../stores/config.js";
6
- import { useEditorStore as y } from "../../../stores/editor.js";
7
- import { useSaveValidationStore as h } from "../../../stores/save-validation.js";
8
- import { escapeHtml as w } from "../../../utils/htmlEscape.js";
9
- import { InIcons as _ } from "@useinsider/design-system-vue";
10
- const V = /* @__PURE__ */ p({
11
- __name: "ValidationErrorDrawer",
12
- setup(C) {
13
- const r = v(), e = h(), n = y(), s = g(), { saveWithErrors: i } = S(), o = c(!1), l = a(() => `${r("email-editor.validation-errors")} (${e.errorCount})`), u = a(() => {
14
- const t = {
15
- primaryButton: {
16
- styling: "solid",
17
- type: "primary",
18
- labelText: r("email-editor.update-design")
19
- }
20
- };
21
- return s.allowSaveWithErrors && e.intent !== "test" && (t.secondaryButton = {
22
- styling: "solid",
23
- type: "subtle-primary",
24
- labelText: r("email-editor.save-and-continue"),
25
- loadingStatus: o.value
26
- }), t;
27
- }), d = a(() => e.errors.map((t) => {
28
- const m = t.detail ? ` (${w(t.detail)})` : "";
29
- return `${t.message}${m}`;
30
- }));
31
- return { __sfc: !0, trans: r, store: e, editorStore: n, configStore: s, saveWithErrors: i, isSaving: o, titleText: l, footerButtonGroupOptions: u, rows: d, handleClose: () => {
32
- e.isDrawerOpen && e.close();
33
- }, handleSaveAndContinue: async () => {
34
- if (!o.value) {
35
- o.value = !0, n.loadingStatus = !0;
36
- try {
37
- await i() ? e.close() : n.loadingStatus = !1;
38
- } catch (t) {
39
- console.warn("Soft-save failed; keeping the drawer open.", t), n.loadingStatus = !1;
40
- } finally {
41
- o.value = !1;
42
- }
43
- }
44
- }, WpDrawer: f, InIcons: _ };
45
- }
46
- });
47
- export {
48
- V as default
49
- };