@useinsider/guido 3.21.2-beta.cfc5be2 → 3.21.2-beta.d9d48aa

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 (69) hide show
  1. package/README.md +9 -1
  2. package/dist/@types/config/schemas.js +19 -19
  3. package/dist/components/Guido.vue.js +8 -8
  4. package/dist/components/Guido.vue2.js +76 -74
  5. package/dist/components/organisms/unsubscribe/LegacyUnsubscribeConvertedModal.vue.js +17 -0
  6. package/dist/components/organisms/unsubscribe/LegacyUnsubscribeConvertedModal.vue2.js +30 -0
  7. package/dist/composables/useBlocksConfig.js +24 -32
  8. package/dist/composables/useModuleRepair.js +32 -23
  9. package/dist/config/migrator/index.js +10 -9
  10. package/dist/config/migrator/legacyUnsubscribeTextMigrator.js +16 -0
  11. package/dist/enums/academy.js +2 -2
  12. package/dist/guido.css +1 -1
  13. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js +92 -93
  14. package/dist/node_modules/valibot/dist/index.js +261 -297
  15. package/dist/src/@types/config/schemas.d.ts +4 -4
  16. package/dist/src/composables/useConfig.d.ts +2 -2
  17. package/dist/src/composables/useModuleRepair.d.ts +2 -11
  18. package/dist/src/config/migrator/legacyUnsubscribeTextMigrator.d.ts +1 -0
  19. package/dist/src/enums/academy.d.ts +1 -1
  20. package/dist/src/stores/config.d.ts +20 -166
  21. package/dist/src/stores/editor.d.ts +25 -0
  22. package/dist/src/utils/legacyUnsubscribeConversion.d.ts +10 -0
  23. package/dist/stores/config.js +6 -13
  24. package/dist/stores/editor.js +15 -14
  25. package/dist/utils/legacyUnsubscribeConversion.js +49 -0
  26. package/dist/utils/pairProductVariables.js +14 -15
  27. package/package.json +1 -1
  28. package/dist/@types/display-condition.js +0 -25
  29. package/dist/components/organisms/display-conditions/CodeEditorField.vue.js +0 -20
  30. package/dist/components/organisms/display-conditions/CodeEditorField.vue2.js +0 -30
  31. package/dist/components/organisms/display-conditions/DisplayConditionCreateDrawer.vue.js +0 -30
  32. package/dist/components/organisms/display-conditions/DisplayConditionCreateDrawer.vue2.js +0 -71
  33. package/dist/components/organisms/display-conditions/DisplayConditionSelectDrawer.vue.js +0 -34
  34. package/dist/components/organisms/display-conditions/DisplayConditionSelectDrawer.vue2.js +0 -57
  35. package/dist/components/organisms/display-conditions/DisplayConditionsHost.vue.js +0 -17
  36. package/dist/components/organisms/display-conditions/DisplayConditionsHost.vue2.js +0 -22
  37. package/dist/composables/useDisplayConditions.js +0 -102
  38. package/dist/enums/display-condition.js +0 -12
  39. package/dist/extensions/DisplayConditions/bridge.js +0 -17
  40. package/dist/extensions/DisplayConditions/constants.js +0 -17
  41. package/dist/extensions/DisplayConditions/control.js +0 -178
  42. package/dist/extensions/DisplayConditions/display-conditions.css.js +0 -201
  43. package/dist/extensions/DisplayConditions/extension.js +0 -28
  44. package/dist/extensions/DisplayConditions/iconsRegistry.js +0 -20
  45. package/dist/extensions/DisplayConditions/library.js +0 -27
  46. package/dist/extensions/DisplayConditions/settingsPanel.js +0 -17
  47. package/dist/services/displayConditionApi.js +0 -39
  48. package/dist/src/@types/display-condition.d.ts +0 -59
  49. package/dist/src/components/organisms/display-conditions/CodeEditorField.vue.d.ts +0 -43
  50. package/dist/src/components/organisms/display-conditions/DisplayConditionSelectDrawer.vue.d.ts +0 -2
  51. package/dist/src/components/organisms/display-conditions/DisplayConditionsHost.vue.d.ts +0 -2
  52. package/dist/src/composables/useDisplayConditions.d.ts +0 -16
  53. package/dist/src/enums/display-condition.d.ts +0 -15
  54. package/dist/src/extensions/DisplayConditions/bridge.d.ts +0 -6
  55. package/dist/src/extensions/DisplayConditions/constants.d.ts +0 -14
  56. package/dist/src/extensions/DisplayConditions/control.d.ts +0 -23
  57. package/dist/src/extensions/DisplayConditions/extension.d.ts +0 -2
  58. package/dist/src/extensions/DisplayConditions/iconsRegistry.d.ts +0 -4
  59. package/dist/src/extensions/DisplayConditions/library.d.ts +0 -8
  60. package/dist/src/extensions/DisplayConditions/settingsPanel.d.ts +0 -5
  61. package/dist/src/mock/api/display-conditions.d.ts +0 -2
  62. package/dist/src/services/displayConditionApi.d.ts +0 -8
  63. package/dist/src/stores/display-condition.d.ts +0 -81
  64. package/dist/src/utils/displayCondition.d.ts +0 -10
  65. package/dist/src/utils/protectTableText.d.ts +0 -2
  66. package/dist/stores/display-condition.js +0 -28
  67. package/dist/utils/displayCondition.js +0 -26
  68. package/dist/utils/protectTableText.js +0 -22
  69. /package/dist/src/components/organisms/{display-conditions/DisplayConditionCreateDrawer.vue.d.ts → unsubscribe/LegacyUnsubscribeConvertedModal.vue.d.ts} +0 -0
@@ -8,6 +8,7 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
8
8
  hasChanges: boolean;
9
9
  changeSeq: number;
10
10
  isStripoInitialized: boolean;
11
+ isLegacyUnsubscribeModalRequested: boolean;
11
12
  templateId: string;
12
13
  syncModulesEnabled: boolean;
13
14
  trackIdSessionFloor: number;
@@ -22,6 +23,7 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
22
23
  hasChanges: boolean;
23
24
  changeSeq: number;
24
25
  isStripoInitialized: boolean;
26
+ isLegacyUnsubscribeModalRequested: boolean;
25
27
  templateId: string;
26
28
  syncModulesEnabled: boolean;
27
29
  trackIdSessionFloor: number;
@@ -35,6 +37,7 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
35
37
  hasChanges: boolean;
36
38
  changeSeq: number;
37
39
  isStripoInitialized: boolean;
40
+ isLegacyUnsubscribeModalRequested: boolean;
38
41
  templateId: string;
39
42
  syncModulesEnabled: boolean;
40
43
  trackIdSessionFloor: number;
@@ -49,6 +52,7 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
49
52
  hasChanges: boolean;
50
53
  changeSeq: number;
51
54
  isStripoInitialized: boolean;
55
+ isLegacyUnsubscribeModalRequested: boolean;
52
56
  templateId: string;
53
57
  syncModulesEnabled: boolean;
54
58
  trackIdSessionFloor: number;
@@ -62,6 +66,7 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
62
66
  hasChanges: boolean;
63
67
  changeSeq: number;
64
68
  isStripoInitialized: boolean;
69
+ isLegacyUnsubscribeModalRequested: boolean;
65
70
  templateId: string;
66
71
  syncModulesEnabled: boolean;
67
72
  trackIdSessionFloor: number;
@@ -76,6 +81,7 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
76
81
  hasChanges: boolean;
77
82
  changeSeq: number;
78
83
  isStripoInitialized: boolean;
84
+ isLegacyUnsubscribeModalRequested: boolean;
79
85
  templateId: string;
80
86
  syncModulesEnabled: boolean;
81
87
  trackIdSessionFloor: number;
@@ -89,6 +95,7 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
89
95
  hasChanges: boolean;
90
96
  changeSeq: number;
91
97
  isStripoInitialized: boolean;
98
+ isLegacyUnsubscribeModalRequested: boolean;
92
99
  templateId: string;
93
100
  syncModulesEnabled: boolean;
94
101
  trackIdSessionFloor: number;
@@ -103,6 +110,7 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
103
110
  hasChanges: boolean;
104
111
  changeSeq: number;
105
112
  isStripoInitialized: boolean;
113
+ isLegacyUnsubscribeModalRequested: boolean;
106
114
  templateId: string;
107
115
  syncModulesEnabled: boolean;
108
116
  trackIdSessionFloor: number;
@@ -116,6 +124,7 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
116
124
  hasChanges: boolean;
117
125
  changeSeq: number;
118
126
  isStripoInitialized: boolean;
127
+ isLegacyUnsubscribeModalRequested: boolean;
119
128
  templateId: string;
120
129
  syncModulesEnabled: boolean;
121
130
  trackIdSessionFloor: number;
@@ -130,6 +139,7 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
130
139
  hasChanges: boolean;
131
140
  changeSeq: number;
132
141
  isStripoInitialized: boolean;
142
+ isLegacyUnsubscribeModalRequested: boolean;
133
143
  templateId: string;
134
144
  syncModulesEnabled: boolean;
135
145
  trackIdSessionFloor: number;
@@ -143,6 +153,7 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
143
153
  hasChanges: boolean;
144
154
  changeSeq: number;
145
155
  isStripoInitialized: boolean;
156
+ isLegacyUnsubscribeModalRequested: boolean;
146
157
  templateId: string;
147
158
  syncModulesEnabled: boolean;
148
159
  trackIdSessionFloor: number;
@@ -157,6 +168,7 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
157
168
  hasChanges: boolean;
158
169
  changeSeq: number;
159
170
  isStripoInitialized: boolean;
171
+ isLegacyUnsubscribeModalRequested: boolean;
160
172
  templateId: string;
161
173
  syncModulesEnabled: boolean;
162
174
  trackIdSessionFloor: number;
@@ -170,6 +182,7 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
170
182
  hasChanges: boolean;
171
183
  changeSeq: number;
172
184
  isStripoInitialized: boolean;
185
+ isLegacyUnsubscribeModalRequested: boolean;
173
186
  templateId: string;
174
187
  syncModulesEnabled: boolean;
175
188
  trackIdSessionFloor: number;
@@ -184,6 +197,7 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
184
197
  hasChanges: boolean;
185
198
  changeSeq: number;
186
199
  isStripoInitialized: boolean;
200
+ isLegacyUnsubscribeModalRequested: boolean;
187
201
  templateId: string;
188
202
  syncModulesEnabled: boolean;
189
203
  trackIdSessionFloor: number;
@@ -197,6 +211,7 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
197
211
  hasChanges: boolean;
198
212
  changeSeq: number;
199
213
  isStripoInitialized: boolean;
214
+ isLegacyUnsubscribeModalRequested: boolean;
200
215
  templateId: string;
201
216
  syncModulesEnabled: boolean;
202
217
  trackIdSessionFloor: number;
@@ -211,6 +226,7 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
211
226
  hasChanges: boolean;
212
227
  changeSeq: number;
213
228
  isStripoInitialized: boolean;
229
+ isLegacyUnsubscribeModalRequested: boolean;
214
230
  templateId: string;
215
231
  syncModulesEnabled: boolean;
216
232
  trackIdSessionFloor: number;
@@ -224,6 +240,7 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
224
240
  hasChanges: boolean;
225
241
  changeSeq: number;
226
242
  isStripoInitialized: boolean;
243
+ isLegacyUnsubscribeModalRequested: boolean;
227
244
  templateId: string;
228
245
  syncModulesEnabled: boolean;
229
246
  trackIdSessionFloor: number;
@@ -238,6 +255,7 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
238
255
  hasChanges: boolean;
239
256
  changeSeq: number;
240
257
  isStripoInitialized: boolean;
258
+ isLegacyUnsubscribeModalRequested: boolean;
241
259
  templateId: string;
242
260
  syncModulesEnabled: boolean;
243
261
  trackIdSessionFloor: number;
@@ -251,6 +269,7 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
251
269
  hasChanges: boolean;
252
270
  changeSeq: number;
253
271
  isStripoInitialized: boolean;
272
+ isLegacyUnsubscribeModalRequested: boolean;
254
273
  templateId: string;
255
274
  syncModulesEnabled: boolean;
256
275
  trackIdSessionFloor: number;
@@ -265,6 +284,7 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
265
284
  hasChanges: boolean;
266
285
  changeSeq: number;
267
286
  isStripoInitialized: boolean;
287
+ isLegacyUnsubscribeModalRequested: boolean;
268
288
  templateId: string;
269
289
  syncModulesEnabled: boolean;
270
290
  trackIdSessionFloor: number;
@@ -278,6 +298,7 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
278
298
  hasChanges: boolean;
279
299
  changeSeq: number;
280
300
  isStripoInitialized: boolean;
301
+ isLegacyUnsubscribeModalRequested: boolean;
281
302
  templateId: string;
282
303
  syncModulesEnabled: boolean;
283
304
  trackIdSessionFloor: number;
@@ -292,6 +313,7 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
292
313
  hasChanges: boolean;
293
314
  changeSeq: number;
294
315
  isStripoInitialized: boolean;
316
+ isLegacyUnsubscribeModalRequested: boolean;
295
317
  templateId: string;
296
318
  syncModulesEnabled: boolean;
297
319
  trackIdSessionFloor: number;
@@ -305,6 +327,7 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
305
327
  hasChanges: boolean;
306
328
  changeSeq: number;
307
329
  isStripoInitialized: boolean;
330
+ isLegacyUnsubscribeModalRequested: boolean;
308
331
  templateId: string;
309
332
  syncModulesEnabled: boolean;
310
333
  trackIdSessionFloor: number;
@@ -319,6 +342,7 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
319
342
  hasChanges: boolean;
320
343
  changeSeq: number;
321
344
  isStripoInitialized: boolean;
345
+ isLegacyUnsubscribeModalRequested: boolean;
322
346
  templateId: string;
323
347
  syncModulesEnabled: boolean;
324
348
  trackIdSessionFloor: number;
@@ -332,6 +356,7 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
332
356
  hasChanges: boolean;
333
357
  changeSeq: number;
334
358
  isStripoInitialized: boolean;
359
+ isLegacyUnsubscribeModalRequested: boolean;
335
360
  templateId: string;
336
361
  syncModulesEnabled: boolean;
337
362
  trackIdSessionFloor: number;
@@ -0,0 +1,10 @@
1
+ export declare const LEGACY_UNSUBSCRIBE_SELECTOR = "td.unsubscribe-block";
2
+ export declare const LEGACY_UNSUBSCRIBE_LINK_SELECTORS: readonly ["a.unsubscribe-link", "a[href*=\"unsubscribe\"]"];
3
+ export interface LegacyUnsubscribeConversionResult {
4
+ html: string;
5
+ converted: boolean;
6
+ }
7
+ export declare const hasLegacyUnsubscribeClass: (html: string) => boolean;
8
+ export declare const convertLinklessLegacyUnsubscribeBlocks: (root: ParentNode) => number;
9
+ export declare const convertLegacyUnsubscribeInModuleHtml: (html: string) => LegacyUnsubscribeConversionResult;
10
+ export declare const convertLegacyUnsubscribeInDocumentHtml: (html: string) => LegacyUnsubscribeConversionResult;
@@ -1,8 +1,8 @@
1
- import { MessageType as a } from "../@types/config/schemas.js";
1
+ import { MessageType as r } from "../@types/config/schemas.js";
2
2
  import "../@types/config/defaults.js";
3
- import { parseConfig as o } from "../@types/config/validator.js";
4
- import { defineStore as l } from "pinia";
5
- const g = l("guido-config", {
3
+ import { parseConfig as a } from "../@types/config/validator.js";
4
+ import { defineStore as o } from "pinia";
5
+ const g = o("guido-config", {
6
6
  state: () => ({
7
7
  initialized: !1,
8
8
  config: null
@@ -132,7 +132,7 @@ const g = l("guido-config", {
132
132
  * consumers stay safe in setup where a raw config read snapshots null (SD-147945).
133
133
  */
134
134
  isTransactional() {
135
- return this.messageType === a.TRANSACTIONAL;
135
+ return this.messageType === r.TRANSACTIONAL;
136
136
  },
137
137
  /**
138
138
  * Soft-save policy: may the editor persist a template with validation errors?
@@ -158,13 +158,6 @@ const g = l("guido-config", {
158
158
  var e, t;
159
159
  return ((t = (e = i.config) == null ? void 0 : e.ui) == null ? void 0 : t.showHeader) ?? !0;
160
160
  },
161
- /**
162
- * Check if the Insider display-condition UI replaces Stripo's
163
- */
164
- externalDisplayConditions: (i) => {
165
- var e, t, n, r;
166
- return (((t = (e = i.config) == null ? void 0 : e.ui) == null ? void 0 : t.externalDisplayConditions) ?? !1) && (((r = (n = i.config) == null ? void 0 : n.features) == null ? void 0 : r.displayConditions) ?? !0);
167
- },
168
161
  /**
169
162
  * Check if a specific feature is enabled.
170
163
  * Returns false before init (config null) so header controls don't
@@ -181,7 +174,7 @@ const g = l("guido-config", {
181
174
  * Initialize the config store with validated configuration
182
175
  */
183
176
  init(i) {
184
- const e = o(i);
177
+ const e = a(i);
185
178
  this.config = e, this.initialized = !0;
186
179
  },
187
180
  /**
@@ -1,5 +1,5 @@
1
- import { defineStore as e } from "pinia";
2
- const o = e("guidoEditor", {
1
+ import { defineStore as i } from "pinia";
2
+ const o = i("guidoEditor", {
3
3
  state: () => ({
4
4
  loadingStatus: !0,
5
5
  isCodeEditorOpen: !1,
@@ -13,6 +13,7 @@ const o = e("guidoEditor", {
13
13
  // that need every change (the outbound state bridge) watch this instead.
14
14
  changeSeq: 0,
15
15
  isStripoInitialized: !1,
16
+ isLegacyUnsubscribeModalRequested: !1,
16
17
  templateId: "",
17
18
  syncModulesEnabled: !1,
18
19
  // In-session id high-water mark; floors tracking-id minting so ids
@@ -21,20 +22,20 @@ const o = e("guidoEditor", {
21
22
  }),
22
23
  getters: {
23
24
  // Middle Slot
24
- isEditorToolbarVisible: (i) => !i.isVersionHistoryOpen && !i.isPreviewModeOpen,
25
- isUndoButtonDisabled: (i) => i.loadingStatus || i.isPreviewModeOpen,
26
- isRedoButtonDisabled: (i) => i.loadingStatus || i.isPreviewModeOpen,
27
- isCodeEditorButtonDisabled: (i) => i.loadingStatus || i.isPreviewModeOpen,
28
- isPreviewButtonDisabled: (i) => i.loadingStatus,
29
- isViewOptionsDisabled: (i) => i.loadingStatus || i.isPreviewModeOpen,
25
+ isEditorToolbarVisible: (e) => !e.isVersionHistoryOpen && !e.isPreviewModeOpen,
26
+ isUndoButtonDisabled: (e) => e.loadingStatus || e.isPreviewModeOpen,
27
+ isRedoButtonDisabled: (e) => e.loadingStatus || e.isPreviewModeOpen,
28
+ isCodeEditorButtonDisabled: (e) => e.loadingStatus || e.isPreviewModeOpen,
29
+ isPreviewButtonDisabled: (e) => e.loadingStatus,
30
+ isViewOptionsDisabled: (e) => e.loadingStatus || e.isPreviewModeOpen,
30
31
  // Right Slot
31
- isVersionHistoryButtonDisabled: (i) => i.loadingStatus || i.isPreviewModeOpen,
32
- isExportButtonDisabled: (i) => i.loadingStatus || i.isVersionHistoryOpen,
33
- isSaveAsButtonDisabled: (i) => i.loadingStatus || i.isVersionHistoryOpen,
34
- isTestButtonDisabled: (i) => i.loadingStatus || i.isVersionHistoryOpen,
35
- isSaveButtonDisabled: (i) => i.loadingStatus || i.isVersionHistoryOpen || i.isPreviewModeOpen,
32
+ isVersionHistoryButtonDisabled: (e) => e.loadingStatus || e.isPreviewModeOpen,
33
+ isExportButtonDisabled: (e) => e.loadingStatus || e.isVersionHistoryOpen,
34
+ isSaveAsButtonDisabled: (e) => e.loadingStatus || e.isVersionHistoryOpen,
35
+ isTestButtonDisabled: (e) => e.loadingStatus || e.isVersionHistoryOpen,
36
+ isSaveButtonDisabled: (e) => e.loadingStatus || e.isVersionHistoryOpen || e.isPreviewModeOpen,
36
37
  // Autosave
37
- isInSaveableState: (i) => !i.loadingStatus && !i.isVersionHistoryOpen && !i.isPreviewModeOpen && !i.isCodeEditorOpen
38
+ isInSaveableState: (e) => !e.loadingStatus && !e.isVersionHistoryOpen && !e.isPreviewModeOpen && !e.isCodeEditorOpen
38
39
  }
39
40
  });
40
41
  export {
@@ -0,0 +1,49 @@
1
+ import { protectLiquid as a, restoreLiquid as u } from "./liquidProtection.js";
2
+ const b = "td.unsubscribe-block", l = ["a.unsubscribe-link", 'a[href*="unsubscribe"]'], d = "esd-block-text", m = [
3
+ "unsubscribe-block",
4
+ "esd-extension",
5
+ "esd-extension-block",
6
+ "esd-unsubscribe-block",
7
+ "esd-block-unsubscribe"
8
+ ], L = "esd-extension-block-id", S = "data-unsubscribe-", E = "address,article,aside,blockquote,center,details,dialog,dir,div,dd,dl,dt,fieldset,figcaption,figure,footer,form,h1,h2,h3,h4,h5,h6,header,hgroup,hr,li,listing,main,menu,nav,ol,p,plaintext,pre,search,section,summary,table,ul,xmp", f = new RegExp(`class\\s*=\\s*(?:["'][^"']*)?(?<![\\w-])unsubscribe-block(?![\\w-])`, "i"), p = (e) => typeof e == "string" && f.test(e), y = (e) => l.some((t) => e.querySelector(t) !== null), g = (e) => {
9
+ e.classList.remove(...m), e.classList.add(d), e.removeAttribute(L), Array.from(e.attributes).filter(({ name: t }) => t.startsWith(S)).forEach(({ name: t }) => e.removeAttribute(t)), e.querySelector(E) || (e.innerHTML = `<p path="1">${e.innerHTML}</p>`);
10
+ }, h = (e) => {
11
+ const t = Array.from(e.querySelectorAll(b)).filter((r) => !y(r));
12
+ return t.forEach(g), t.length;
13
+ }, v = (e) => {
14
+ const t = e.trimStart(), r = new DOMParser();
15
+ return /^<t[dh][\s>]/i.test(t) ? r.parseFromString(`<table><tbody><tr>${e}</tr></tbody></table>`, "text/html").querySelector("tr") : /^<tr[\s>]/i.test(t) ? r.parseFromString(`<table><tbody>${e}</tbody></table>`, "text/html").querySelector("tbody") : /^<table[\s>]/i.test(t) ? r.parseFromString(e, "text/html").body : (console.debug("[LegacyUnsubscribeConversion] Skipped module with a non-table root"), null);
16
+ }, c = (e) => {
17
+ const t = e.search(/<html[\s>]/i), r = [...e.matchAll(/<\/html\s*>/gi)].at(-1), s = (r == null ? void 0 : r.index) === void 0 ? -1 : r.index + r[0].length;
18
+ return t < 0 || s <= t ? { head: "", root: e, tail: "" } : { head: e.slice(0, t), root: e.slice(t, s), tail: e.slice(s) };
19
+ }, i = (e, t, r, s) => {
20
+ if (!p(e))
21
+ return { html: e, converted: !1 };
22
+ try {
23
+ const o = a(e), n = t(o);
24
+ return !n || h(n) === 0 ? { html: e, converted: !1 } : { html: u(r(n, o)), converted: !0 };
25
+ } catch (o) {
26
+ return console.error(`Failed to convert legacy unsubscribe blocks in ${s}:`, o), { html: e, converted: !1 };
27
+ }
28
+ }, C = (e) => i(
29
+ e,
30
+ v,
31
+ (t) => t.innerHTML,
32
+ "module"
33
+ ), _ = (e) => i(
34
+ e,
35
+ (t) => new DOMParser().parseFromString(c(t).root, "text/html"),
36
+ (t, r) => {
37
+ const { head: s, tail: o } = c(r);
38
+ return `${s}${t.documentElement.outerHTML}${o}`;
39
+ },
40
+ "document"
41
+ );
42
+ export {
43
+ l as LEGACY_UNSUBSCRIBE_LINK_SELECTORS,
44
+ b as LEGACY_UNSUBSCRIBE_SELECTOR,
45
+ _ as convertLegacyUnsubscribeInDocumentHtml,
46
+ C as convertLegacyUnsubscribeInModuleHtml,
47
+ h as convertLinklessLegacyUnsubscribeBlocks,
48
+ p as hasLegacyUnsubscribeClass
49
+ };
@@ -1,29 +1,28 @@
1
- import { ITEMS_CURRENCY_ATTR as N, isCustomCurrencySymbol as Y } from "../extensions/Blocks/Items/constants/currency.js";
1
+ import { ITEMS_CURRENCY_ATTR as x, isCustomCurrencySymbol as Y } from "../extensions/Blocks/Items/constants/currency.js";
2
2
  import { productPairs as w } from "../extensions/Blocks/Items/enums/productEnums.js";
3
3
  import { escapeReplacement as X } from "../extensions/Blocks/Items/utils/nodeConfigUtils.js";
4
4
  import { preserveTextStyles as P } from "./preserveTextStyles.js";
5
- import { protectTableText as v, restoreTableText as B } from "./protectTableText.js";
6
- import { unwrapProductNameLinks as j } from "./unwrapProductNameLink.js";
5
+ import { unwrapProductNameLinks as v } from "./unwrapProductNameLink.js";
7
6
  const O = {
8
7
  CART_ITEMS: "ins_apr",
9
8
  BROWSED_ITEMS: "browsed_item",
10
9
  PURCHASED_ITEMS: "purchased_item"
11
10
  }, q = (S) => S.replaceAll("{%", "<!--{%").replaceAll("%}", "%}-->");
12
- function Q(S, y, b) {
11
+ function B(S, y, b) {
13
12
  let h = y;
14
13
  for (; h > 0 && /\s/.test(S[h - 1]); )
15
14
  h -= 1;
16
15
  return b.some((I) => S.endsWith(I, h));
17
16
  }
18
- function rt(S) {
19
- const y = q(v(S)), b = new DOMParser().parseFromString(y, "text/html");
20
- j(b);
17
+ function Z(S) {
18
+ const y = q(S), b = new DOMParser().parseFromString(y, "text/html");
19
+ v(b);
21
20
  const h = w.PAIRS_FOR_EXTENSION;
22
21
  Object.entries(h).forEach(([n, d]) => {
23
22
  b.querySelectorAll(".ins-product-td").forEach((r) => {
24
23
  const E = r.getAttribute("data-number") || "1", m = r.getAttribute("data-type") || "CART_ITEMS";
25
24
  r.querySelectorAll(`[product-attr="${n}"]`).forEach((t) => {
26
- var $, F, x, D;
25
+ var $, F, D, N;
27
26
  const g = t.getAttribute("data-type") || m, o = t.getAttribute("data-number") || E, f = d[g];
28
27
  if (f)
29
28
  switch (n) {
@@ -41,7 +40,7 @@ function rt(S) {
41
40
  }
42
41
  const i = (F = ($ = h.name) == null ? void 0 : $[g]) == null ? void 0 : F.ATTR;
43
42
  if (i && e.setAttribute("alt", `{{${i}_${o}}}`), a) {
44
- const s = (x = h.itemLink) == null ? void 0 : x[g];
43
+ const s = (D = h.itemLink) == null ? void 0 : D[g];
45
44
  if (s) {
46
45
  const _ = s.HREF, R = s.DEFAULT_HREF || "#!", u = a.href;
47
46
  (u === "#" || u === "" || u.endsWith("#!") || u.endsWith(R) || u === `${window.location.href}${R}` || !u || u === window.location.href) && (a.href = `{{${_}_${o}}}`);
@@ -61,18 +60,18 @@ function rt(S) {
61
60
  }
62
61
  case "price":
63
62
  case "originalPrice": {
64
- const e = f, a = t.getAttribute("data-formated"), l = t.getAttribute("data-single_price"), c = a === "true", i = l === "true", s = t.getAttribute(N.POSITION) || "before";
63
+ const e = f, a = t.getAttribute("data-formated"), l = t.getAttribute("data-single_price"), c = a === "true", i = l === "true", s = t.getAttribute(x.POSITION) || "before";
65
64
  let _;
66
65
  i ? _ = c ? e.SINGLE_PRICE_FORMATTED : e.SINGLE_PRICE : _ = c ? e.PRICE_FORMATTED : e.PRICE;
67
66
  const R = e.CURRENCY;
68
67
  let u = `{{${_}_${o}}}`;
69
- const H = (t.getAttribute(N.SYMBOL) || "").trim(), G = Y(H);
68
+ const H = (t.getAttribute(x.SYMBOL) || "").trim(), G = Y(H);
70
69
  let C = "";
71
70
  G ? C = H : R && (C = `{{${R}_${o}}}`), C && (u = s === "after" ? `${u} ${C}` : `${C} ${u}`), t.innerHTML = P(t, u);
72
71
  break;
73
72
  }
74
73
  case "quantity": {
75
- const e = f, a = e.ATTR, l = [e.DEFAULT, ...e.LEGACY_DEFAULTS], c = (D = t.textContent) == null ? void 0 : D.trim();
74
+ const e = f, a = e.ATTR, l = [e.DEFAULT, ...e.LEGACY_DEFAULTS], c = (N = t.textContent) == null ? void 0 : N.trim();
76
75
  c && l.includes(c) && (t.innerHTML = P(t, `{{${a}_${o}}}`));
77
76
  break;
78
77
  }
@@ -140,12 +139,12 @@ function rt(S) {
140
139
  const E = w.PAIRS_FOR_EXTENSION.price[d].PRICE, m = w.PAIRS_FOR_EXTENSION.originalPrice[d].PRICE, T = `{% if ${E}_${n} != ${m}_${n} %}`, t = [T, q(T)];
141
140
  let g = "", o = 0, f = 0, $ = A.indexOf(r);
142
141
  for (; $ !== -1; ) {
143
- const F = p[f] === !0 && !Q(A, $, t);
142
+ const F = p[f] === !0 && !B(A, $, t);
144
143
  g += A.slice(o, $) + (F ? `${T}${r}{% endif %}` : r), o = $ + r.length, f += 1, $ = A.indexOf(r, o);
145
144
  }
146
145
  A = g + A.slice(o);
147
- }), B(A.replaceAll("<!--{%", "{%").replaceAll("%}-->", "%}").replaceAll("&lt;!--{%", "{%").replaceAll("%}--&gt;", "%}"));
146
+ }), A.replaceAll("<!--{%", "{%").replaceAll("%}-->", "%}").replaceAll("&lt;!--{%", "{%").replaceAll("%}--&gt;", "%}");
148
147
  }
149
148
  export {
150
- rt as pairProductVariables
149
+ Z as pairProductVariables
151
150
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@useinsider/guido",
3
- "version": "3.21.2-beta.cfc5be2",
3
+ "version": "3.21.2-beta.d9d48aa",
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,25 +0,0 @@
1
- import { object as e, optional as a, string as o, nullish as i, number as t, picklist as n, array as c } from "../node_modules/valibot/dist/index.js";
2
- const s = n(["liquid", "pongo"]), d = n(["codeOnly", "logicBuilder"]), r = e({
3
- id: t(),
4
- name: o(),
5
- description: i(o(), ""),
6
- syntax: s,
7
- method: d,
8
- codeBefore: o(),
9
- codeAfter: i(o(), ""),
10
- createdAt: a(o())
11
- }), p = e({
12
- data: c(r),
13
- meta: e({
14
- totalCount: t(),
15
- perPage: t(),
16
- currentPage: t(),
17
- lastPage: t()
18
- })
19
- });
20
- export {
21
- p as DisplayConditionListResponseSchema,
22
- d as DisplayConditionMethodSchema,
23
- s as DisplayConditionSyntaxSchema,
24
- r as SavedDisplayConditionSchema
25
- };
@@ -1,20 +0,0 @@
1
- import i from "./CodeEditorField.vue2.js";
2
- /* empty css */
3
- import s from "../../../_virtual/_plugin-vue2_normalizer.js";
4
- var a = function() {
5
- var e = this, r = e._self._c, o = e._self._setupProxy;
6
- return r("div", { staticClass: "guido-code-editor-field", attrs: { id: e.id } }, [r("p", { staticClass: "guido-code-editor-field__label" }, [e._v(" " + e._s(e.label) + " ")]), r(o.InCodeSnippet, { attrs: { code: e.value, disable: e.disabled, "focus-editor": !1, invalid: !!e.error, "invalid-message": e.error, options: o.options, size: { height: e.error ? 196 : 216 }, "syntax-check": !1 }, on: { input: function(t) {
7
- return o.emit("input", t);
8
- }, ready: o.onReady } })], 1);
9
- }, n = [], d = /* @__PURE__ */ s(
10
- i,
11
- a,
12
- n,
13
- !1,
14
- null,
15
- "e96c7aa3"
16
- );
17
- const p = d.exports;
18
- export {
19
- p as default
20
- };
@@ -1,30 +0,0 @@
1
- import { defineComponent as s, computed as u } from "vue";
2
- import { InCodeSnippet as i } from "@useinsider/design-system-vue";
3
- const m = /* @__PURE__ */ s({
4
- __name: "CodeEditorField",
5
- props: {
6
- id: null,
7
- label: null,
8
- value: null,
9
- placeholder: { default: "" },
10
- error: { default: "" },
11
- disabled: { type: Boolean, default: !1 }
12
- },
13
- emits: ["input"],
14
- setup(t, { expose: n, emit: d }) {
15
- const l = t;
16
- let e = null;
17
- const a = u(() => ({
18
- mode: "liquid",
19
- lint: !1,
20
- foldGutter: !1,
21
- placeholder: l.placeholder
22
- })), r = (p) => {
23
- e = p;
24
- }, o = () => (e == null ? void 0 : e.state.doc.toString()) ?? l.value;
25
- return n({ read: o }), { __sfc: !0, props: l, emit: d, view: e, options: a, onReady: r, read: o, InCodeSnippet: i };
26
- }
27
- });
28
- export {
29
- m as default
30
- };
@@ -1,30 +0,0 @@
1
- import a from "./DisplayConditionCreateDrawer.vue2.js";
2
- /* empty css */
3
- import r from "../../../_virtual/_plugin-vue2_normalizer.js";
4
- var n = function() {
5
- var i = this, t = i._self._c, e = i._self._setupProxy;
6
- return t(e.WpDrawer, { attrs: { id: "guido__display-condition-create-drawer", "description-status": "", "class-name": "guido-display-condition-create-drawer", size: "large", "close-on-outside-click": !1, "description-text": e.descriptionText, "footer-button-group-options": e.footerButtonGroupOptions, status: e.store.isCreateOpen, "title-text": e.trans(`${e.KEY}.create-title`) }, on: { cancelOrBackButtonEvent: e.close, onCloseEvent: e.close, primaryButtonEvent: function(o) {
7
- return e.submit("inline");
8
- }, secondaryButtonEvent: function(o) {
9
- return e.submit("save");
10
- } } }, [t("div", { staticClass: "guido-display-condition-create" }, [t(e.InBasicTextInput, { staticClass: "mb-4 w-1", attrs: { id: "guido__display-condition-name-input", name: "displayConditionName", "character-counter-status": !1, "disabled-status": e.isSaving, "label-text": e.trans(`${e.KEY}.condition-name`), "max-character-length": e.DISPLAY_CONDITION_LIMITS.NAME_MAX, "placeholder-text": e.trans(`${e.KEY}.condition-name-placeholder`), "state-message": e.errors.name || "", states: e.errors.name ? "error" : "default", "tooltip-status": !1, value: e.draft.name }, on: { input: function(o) {
11
- return e.updateField("name", o);
12
- } } }), t(e.InBasicTextInput, { staticClass: "mb-4 w-1", attrs: { id: "guido__display-condition-description-input", name: "displayConditionDescription", "character-counter-status": !1, "disabled-status": e.isSaving, "label-text": e.descriptionLabel, "max-character-length": e.DISPLAY_CONDITION_LIMITS.DESCRIPTION_MAX, "placeholder-text": e.trans(`${e.KEY}.condition-description-placeholder`), "state-message": e.errors.description || "", states: e.errors.description ? "error" : "default", "tooltip-status": !1, value: e.draft.description }, on: { input: function(o) {
13
- return e.updateField("description", o);
14
- } } }), t("div", { staticClass: "guido-display-condition-create__separator" }), t("p", { staticClass: "guido-display-condition-create__method-title" }, [i._v(" " + i._s(e.trans(`${e.KEY}.select-method`)) + " ")]), t("div", { staticClass: "guido-display-condition-create__methods" }, [t(e.InRadioButton, { attrs: { id: "guido__display-condition-method-logic-builder", disable: "", disabled: "", name: "displayConditionMethod", selected: "codeOnly", value: "logicBuilder", label: e.trans(`${e.KEY}.logic-builder`) } }), t(e.InRadioButton, { attrs: { id: "guido__display-condition-method-code-only", name: "displayConditionMethod", selected: "codeOnly", value: "codeOnly", label: e.trans(`${e.KEY}.code-only`) } })], 1), t(e.CodeEditorField, { ref: "codeBeforeRef", staticClass: "mb-3", attrs: { id: "guido__display-condition-code-before", disabled: e.isSaving, error: e.errors.codeBefore, label: e.trans(`${e.KEY}.code-before`), placeholder: e.trans(`${e.KEY}.code-placeholder`), value: e.draft.codeBefore }, on: { input: function(o) {
15
- return e.updateField("codeBefore", o);
16
- } } }), t(e.CodeEditorField, { ref: "codeAfterRef", attrs: { id: "guido__display-condition-code-after", disabled: e.isSaving, error: e.errors.codeAfter, label: e.trans(`${e.KEY}.code-after`), placeholder: e.trans(`${e.KEY}.code-placeholder`), value: e.draft.codeAfter }, on: { input: function(o) {
17
- return e.updateField("codeAfter", o);
18
- } } })], 1)]);
19
- }, s = [], d = /* @__PURE__ */ r(
20
- a,
21
- n,
22
- s,
23
- !1,
24
- null,
25
- "a4b2ccb9"
26
- );
27
- const f = d.exports;
28
- export {
29
- f as default
30
- };
@@ -1,71 +0,0 @@
1
- import { defineComponent as D, reactive as $, ref as s, watch as C, computed as u } from "vue";
2
- import O from "../../wrappers/WpDrawer.vue.js";
3
- import { useDisplayConditions as T } from "../../../composables/useDisplayConditions.js";
4
- import { useTranslations as L } from "../../../composables/useTranslations.js";
5
- import { ACADEMY_LINKS as x } from "../../../enums/academy.js";
6
- import { DISPLAY_CONDITION_LIMITS as h } from "../../../enums/display-condition.js";
7
- import { useDisplayConditionStore as k } from "../../../stores/display-condition.js";
8
- import { InRadioButton as N, InBasicTextInput as w } from "@useinsider/design-system-vue";
9
- import E from "./CodeEditorField.vue.js";
10
- const J = /* @__PURE__ */ D({
11
- __name: "DisplayConditionCreateDrawer",
12
- setup(Y) {
13
- const r = "email-editor.display-conditions", i = L(), c = k(), { validate: p, notifyInvalid: l, createInline: f, createAndSave: m, cancel: y } = T(), d = () => ({ name: "", description: "", codeBefore: "", codeAfter: "" }), e = $(d()), o = s({}), a = s(!1), v = s(), _ = s();
14
- C(() => c.isCreateOpen, (n) => {
15
- if (!n)
16
- return;
17
- const { editing: t } = c;
18
- Object.assign(e, t ? {
19
- name: t.name,
20
- description: t.description,
21
- codeBefore: t.beforeScript,
22
- codeAfter: t.afterScript
23
- } : d()), o.value = {}, a.value = !1;
24
- }, { immediate: !0 });
25
- const g = u(() => i(`${r}.create-description`, {
26
- academyLink: `<a href="${x.EMAIL_DISPLAY_CONDITIONS}" class="guido-display-condition-academy" target="_blank">${i(`${r}.academy`)}</a>`
27
- })), S = u(() => ({
28
- cancelOrBackButton: {
29
- styling: "ghost",
30
- type: "secondary",
31
- labelText: i(`${r}.cancel`),
32
- disabledStatus: a.value
33
- },
34
- secondaryButton: {
35
- styling: "solid",
36
- type: "subtle-primary",
37
- labelText: i(`${r}.create-and-save`),
38
- loadingStatus: a.value
39
- },
40
- primaryButton: {
41
- styling: "solid",
42
- type: "primary",
43
- labelText: i(`${r}.create`),
44
- disabledStatus: a.value
45
- }
46
- })), B = (n, t) => {
47
- t !== e[n] && (e[n] = t, o.value[n] && (o.value = { ...o.value, [n]: void 0 }));
48
- }, A = u(() => `${i(`${r}.condition-description`)} <span class="guido-display-condition-create__optional">(${i(`${r}.optional`)})</span>`);
49
- return { __sfc: !0, KEY: r, trans: i, store: c, validate: p, notifyInvalid: l, createInline: f, createAndSave: m, cancel: y, emptyDraft: d, draft: e, errors: o, isSaving: a, codeBeforeRef: v, codeAfterRef: _, descriptionText: g, footerButtonGroupOptions: S, updateField: B, descriptionLabel: A, submit: async (n) => {
50
- var I, b;
51
- if (a.value)
52
- return;
53
- if (e.codeBefore = ((I = v.value) == null ? void 0 : I.read()) ?? e.codeBefore, e.codeAfter = ((b = _.value) == null ? void 0 : b.read()) ?? e.codeAfter, o.value = p(e), Object.keys(o.value).length) {
54
- l();
55
- return;
56
- }
57
- if (n === "inline") {
58
- f({ ...e });
59
- return;
60
- }
61
- a.value = !0;
62
- const t = await m({ ...e });
63
- a.value = !1, o.value = t ?? {}, Object.keys(o.value).length && l();
64
- }, close: () => {
65
- a.value || y();
66
- }, WpDrawer: O, DISPLAY_CONDITION_LIMITS: h, InBasicTextInput: w, InRadioButton: N, CodeEditorField: E };
67
- }
68
- });
69
- export {
70
- J as default
71
- };