@useinsider/guido 3.23.0-beta.9f6bfbf → 3.23.0-beta.a35efcf

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 (55) hide show
  1. package/README.md +9 -1
  2. package/dist/@types/config/schemas.js +26 -26
  3. package/dist/components/Guido.vue.js +5 -5
  4. package/dist/components/Guido.vue2.js +88 -86
  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/useModuleRepair.js +30 -23
  8. package/dist/config/migrator/index.js +16 -16
  9. package/dist/config/migrator/legacyUnsubscribeTextMigrator.js +16 -0
  10. package/dist/enums/academy.js +2 -1
  11. package/dist/extensions/Blocks/Items/block.js +77 -115
  12. package/dist/extensions/Blocks/Items/constants/currency.js +14 -59
  13. package/dist/extensions/Blocks/Items/controls/price/currencyLocation.js +22 -33
  14. package/dist/extensions/Blocks/Items/controls/price/currencySymbol.js +51 -62
  15. package/dist/extensions/Blocks/Items/controls/price/formattedPrice.js +17 -18
  16. package/dist/extensions/Blocks/Items/controls/price/singlePrice.js +31 -42
  17. package/dist/extensions/Blocks/Items/controls/settingsControl.js +120 -141
  18. package/dist/extensions/Blocks/Items/enums/controlEnums.js +1 -1
  19. package/dist/extensions/Blocks/Items/extension.js +8 -9
  20. package/dist/extensions/Blocks/Items/items.css.js +0 -19
  21. package/dist/extensions/Blocks/Items/settingsPanel.js +25 -34
  22. package/dist/extensions/Blocks/Items/template.js +212 -250
  23. package/dist/extensions/Blocks/Recommendation/utils/priceFormatter.js +0 -1
  24. package/dist/guido.css +1 -1
  25. package/dist/package.json.js +2 -2
  26. package/dist/src/@types/config/schemas.d.ts +4 -4
  27. package/dist/src/components/organisms/unsubscribe/LegacyUnsubscribeConvertedModal.vue.d.ts +2 -0
  28. package/dist/src/composables/useConfig.d.ts +2 -2
  29. package/dist/src/composables/useModuleRepair.d.ts +2 -11
  30. package/dist/src/config/migrator/index.d.ts +1 -4
  31. package/dist/src/config/migrator/legacyUnsubscribeTextMigrator.d.ts +1 -0
  32. package/dist/src/enums/academy.d.ts +1 -0
  33. package/dist/src/extensions/Blocks/Items/block.d.ts +9 -6
  34. package/dist/src/extensions/Blocks/Items/constants/currency.d.ts +0 -32
  35. package/dist/src/extensions/Blocks/Items/controls/settingsControl.d.ts +0 -1
  36. package/dist/src/extensions/Blocks/Items/enums/controlEnums.d.ts +0 -1
  37. package/dist/src/extensions/Blocks/Items/template.d.ts +1 -4
  38. package/dist/src/extensions/Blocks/Items/utils/nodeConfigUtils.d.ts +0 -3
  39. package/dist/src/extensions/Blocks/Recommendation/utils/priceFormatter.d.ts +0 -12
  40. package/dist/src/stores/config.d.ts +20 -20
  41. package/dist/src/stores/editor.d.ts +25 -0
  42. package/dist/src/utils/itemsCurrencyRepair.d.ts +1 -5
  43. package/dist/src/utils/legacyUnsubscribeConversion.d.ts +10 -0
  44. package/dist/static/stripo-runtime-manifest.json.js +1 -1
  45. package/dist/stores/editor.js +15 -14
  46. package/dist/utils/itemsCurrencyRepair.js +24 -29
  47. package/dist/utils/legacyUnsubscribeConversion.js +49 -0
  48. package/dist/utils/pairProductVariables.js +99 -119
  49. package/package.json +2 -2
  50. package/dist/config/migrator/itemsPriceFormatMigrator.js +0 -20
  51. package/dist/extensions/Blocks/Items/controls/priceFormat.js +0 -145
  52. package/dist/extensions/Blocks/Items/utils/priceFormatOps.js +0 -185
  53. package/dist/src/config/migrator/itemsPriceFormatMigrator.d.ts +0 -1
  54. package/dist/src/extensions/Blocks/Items/controls/priceFormat.d.ts +0 -23
  55. package/dist/src/extensions/Blocks/Items/utils/priceFormatOps.d.ts +0 -61
@@ -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;
@@ -1,7 +1,3 @@
1
- export interface ItemsCurrencyRepairOptions {
2
- /** Convert legacy-model blocks to the root price-format contract (itemsPriceFormatting). */
3
- convertToPriceFormat?: boolean;
4
- }
5
1
  /**
6
2
  * Heals stale price currency attributes on every v2 Items block inside a dropped
7
3
  * saved module, driving `data-curency` / `data-currency_symbol` from each block's
@@ -18,4 +14,4 @@ export interface ItemsCurrencyRepairOptions {
18
14
  * recommendationMigrator wraps). If the wrap fails to capture the blocks (non-`<td>`
19
15
  * root foster-parented out), it bails to the original string.
20
16
  */
21
- export declare function repairItemsCurrencyAttributes(html: string, { convertToPriceFormat }?: ItemsCurrencyRepairOptions): string;
17
+ export declare function repairItemsCurrencyAttributes(html: string): string;
@@ -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,4 +1,4 @@
1
- const s = "2.81.1", n = ["UIEditor.js", "zone.js", "styles-BWH3PMR4.css", "polyfills-FF3RLU5F.js", "main-5LCHF56A.js", "chunk-2HYLRI4G.js", "chunk-4SN7BSQN.js", "chunk-5IY7ZG3R.js", "chunk-62K3AMOD.js", "chunk-GK543IRH.js", "chunk-L2EPGQ76.js", "chunk-LXS5IGCQ.js", "chunk-PNWIGF4L.js", "chunk-S2TYCIH3.js", "chunk-S5UZ4LUK.js", "chunk-V2AGQPVL.js", "chunk-XZ6MUAN5.js", "chunk-ZPL4VL4O.js", "assets/css/uiEditor.css", "assets/i18n/en.json", "assets/icons/ui-editor-icons.sprite.svg", "assets/icons/ui-editor-icons.map.json", "assets/imageeditor/scripts.min.js", "assets/imageeditor/assets/icons/merged.svg"], i = {
1
+ const s = "2.83.1", n = ["UIEditor.js", "zone.js", "styles-BWH3PMR4.css", "polyfills-FF3RLU5F.js", "main-OTN2PYRT.js", "chunk-62K3AMOD.js", "chunk-6RGJBGUG.js", "chunk-6W43DTQG.js", "chunk-EC4WGEOZ.js", "chunk-GLBBUJ54.js", "chunk-GPJLJCMF.js", "chunk-MDCDEJUH.js", "chunk-P7HQTFJV.js", "chunk-PA4WGBC4.js", "chunk-QMDAV6OU.js", "chunk-R2F3ADM2.js", "chunk-YSKQ2TWF.js", "chunk-ZU5ASRKR.js", "assets/css/uiEditor.css", "assets/i18n/en.json", "assets/icons/ui-editor-icons.sprite.svg", "assets/icons/ui-editor-icons.map.json", "assets/imageeditor/scripts.min.js", "assets/imageeditor/assets/icons/merged.svg"], i = {
2
2
  version: s,
3
3
  files: n
4
4
  };
@@ -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 {
@@ -1,44 +1,39 @@
1
- import { isNewPriceFormatRoot as a, currencyAttrTargets as f, ITEMS_CURRENCY_ATTR as c } from "../extensions/Blocks/Items/constants/currency.js";
2
- import { ItemsBlockId as p } from "../extensions/Blocks/Items/enums/controlEnums.js";
3
- import { snapshotPriceFormatFromElement as m, planPriceFormatOps as y, applyPriceFormatOpsToElement as d } from "../extensions/Blocks/Items/utils/priceFormatOps.js";
4
- const u = "items-block-v2";
5
- function S(e, i) {
6
- if (i || a(e)) {
7
- const t = m(e), l = y(t, { convertLegacy: i });
8
- return d(e, l);
9
- }
10
- const n = e.getAttribute("esd-ext-config");
11
- if (!n)
1
+ import { currencyAttrTargets as u, ITEMS_CURRENCY_ATTR as c } from "../extensions/Blocks/Items/constants/currency.js";
2
+ import { ItemsBlockId as l } from "../extensions/Blocks/Items/enums/controlEnums.js";
3
+ const s = "items-block-v2";
4
+ function f(e) {
5
+ const i = e.getAttribute("esd-ext-config");
6
+ if (!i)
12
7
  return !1;
13
- let r, o;
8
+ let t, r;
14
9
  try {
15
- ({ position: r, symbol: o } = f(JSON.parse(n)));
10
+ ({ position: t, symbol: r } = u(JSON.parse(i)));
16
11
  } catch {
17
12
  return !1;
18
13
  }
19
- let s = !1;
20
- return e.querySelectorAll(`.${p.PRICE} p`).forEach((t) => {
21
- r !== void 0 && t.getAttribute(c.POSITION) !== r && (t.setAttribute(c.POSITION, r), s = !0), o !== void 0 && t.getAttribute(c.SYMBOL) !== o && (t.setAttribute(c.SYMBOL, o), s = !0);
22
- }), s;
14
+ let o = !1;
15
+ return e.querySelectorAll(`.${l.PRICE} p`).forEach((n) => {
16
+ t !== void 0 && n.getAttribute(c.POSITION) !== t && (n.setAttribute(c.POSITION, t), o = !0), r !== void 0 && n.getAttribute(c.SYMBOL) !== r && (n.setAttribute(c.SYMBOL, r), o = !0);
17
+ }), o;
23
18
  }
24
- function I(e, { convertToPriceFormat: i = !1 } = {}) {
25
- if (typeof e != "string" || !e.includes(u))
19
+ function S(e) {
20
+ if (typeof e != "string" || !e.includes(s))
26
21
  return e;
27
22
  try {
28
- const r = new DOMParser().parseFromString(
23
+ const t = new DOMParser().parseFromString(
29
24
  `<table><tbody><tr>${e}</tr></tbody></table>`,
30
25
  "text/html"
31
- ).querySelector("tr"), o = r.querySelectorAll(`.${u}`);
32
- if (o.length === 0)
26
+ ).querySelector("tr"), r = t.querySelectorAll(`.${s}`);
27
+ if (r.length === 0)
33
28
  return e;
34
- let s = !1;
35
- return o.forEach((t) => {
36
- S(t, i) && (s = !0);
37
- }), s ? r.innerHTML : e;
38
- } catch (n) {
39
- return console.error("Failed to repair items currency on module add:", n), e;
29
+ let o = !1;
30
+ return r.forEach((n) => {
31
+ f(n) && (o = !0);
32
+ }), o ? t.innerHTML : e;
33
+ } catch (i) {
34
+ return console.error("Failed to repair items currency on module add:", i), e;
40
35
  }
41
36
  }
42
37
  export {
43
- I as repairItemsCurrencyAttributes
38
+ S as repairItemsCurrencyAttributes
44
39
  };
@@ -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
+ };