@useinsider/guido 3.24.0-beta.82c2d5e → 3.24.0-beta.8779b29
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.
- package/README.md +1 -9
- package/dist/@types/config/schemas.js +14 -14
- package/dist/components/Guido.vue.js +4 -4
- package/dist/components/Guido.vue2.js +88 -90
- package/dist/composables/useModuleRepair.js +23 -30
- package/dist/config/migrator/index.js +16 -16
- package/dist/config/migrator/itemsPriceFormatMigrator.js +20 -0
- package/dist/enums/academy.js +1 -2
- package/dist/extensions/Blocks/Items/block.js +115 -77
- package/dist/extensions/Blocks/Items/constants/currency.js +59 -14
- package/dist/extensions/Blocks/Items/controls/blockBackground/index.js +11 -0
- package/dist/extensions/Blocks/Items/controls/price/currencyLocation.js +34 -23
- package/dist/extensions/Blocks/Items/controls/price/currencySymbol.js +62 -51
- package/dist/extensions/Blocks/Items/controls/price/formattedPrice.js +18 -17
- package/dist/extensions/Blocks/Items/controls/price/singlePrice.js +42 -31
- package/dist/extensions/Blocks/Items/controls/priceFormat.js +135 -0
- package/dist/extensions/Blocks/Items/controls/settingsControl.js +141 -120
- package/dist/extensions/Blocks/Items/enums/controlEnums.js +2 -2
- package/dist/extensions/Blocks/Items/extension.js +15 -13
- package/dist/extensions/Blocks/Items/items.css.js +19 -0
- package/dist/extensions/Blocks/Items/settingsPanel.js +38 -25
- package/dist/extensions/Blocks/Items/template.js +250 -212
- package/dist/extensions/Blocks/Items/utils/priceFormatOps.js +185 -0
- package/dist/extensions/Blocks/Recommendation/utils/priceFormatter.js +1 -0
- package/dist/extensions/Blocks/controlFactories.js +104 -104
- package/dist/guido.css +1 -1
- package/dist/package.json.js +2 -2
- package/dist/src/@types/config/schemas.d.ts +4 -4
- package/dist/src/composables/useConfig.d.ts +2 -2
- package/dist/src/composables/useModuleRepair.d.ts +11 -2
- package/dist/src/config/migrator/index.d.ts +4 -1
- package/dist/src/config/migrator/itemsPriceFormatMigrator.d.ts +1 -0
- package/dist/src/enums/academy.d.ts +0 -1
- package/dist/src/extensions/Blocks/Items/block.d.ts +6 -9
- package/dist/src/extensions/Blocks/Items/constants/currency.d.ts +32 -0
- package/dist/src/extensions/Blocks/Items/controls/blockBackground/index.d.ts +15 -0
- package/dist/src/extensions/Blocks/Items/controls/priceFormat.d.ts +24 -0
- package/dist/src/extensions/Blocks/Items/controls/settingsControl.d.ts +1 -0
- package/dist/src/extensions/Blocks/Items/enums/controlEnums.d.ts +2 -0
- package/dist/src/extensions/Blocks/Items/template.d.ts +4 -1
- package/dist/src/extensions/Blocks/Items/utils/nodeConfigUtils.d.ts +3 -0
- package/dist/src/extensions/Blocks/Items/utils/priceFormatOps.d.ts +66 -0
- package/dist/src/extensions/Blocks/Recommendation/utils/priceFormatter.d.ts +12 -0
- package/dist/src/extensions/Blocks/controlFactories.d.ts +1 -1
- package/dist/src/stores/config.d.ts +20 -20
- package/dist/src/stores/editor.d.ts +0 -27
- package/dist/src/utils/itemsCurrencyRepair.d.ts +5 -1
- package/dist/stores/editor.js +0 -1
- package/dist/utils/itemsCurrencyRepair.js +29 -24
- package/dist/utils/pairProductVariables.js +119 -99
- package/package.json +1 -1
- package/dist/components/organisms/unsubscribe/LegacyUnsubscribeConvertedModal.vue.js +0 -17
- package/dist/components/organisms/unsubscribe/LegacyUnsubscribeConvertedModal.vue2.js +0 -30
- package/dist/config/migrator/legacyUnsubscribeTextMigrator.js +0 -16
- package/dist/src/components/organisms/unsubscribe/LegacyUnsubscribeConvertedModal.vue.d.ts +0 -2
- package/dist/src/config/migrator/legacyUnsubscribeTextMigrator.d.ts +0 -1
- package/dist/src/utils/legacyUnsubscribeConversion.d.ts +0 -10
- package/dist/utils/legacyUnsubscribeConversion.js +0 -49
|
@@ -12,7 +12,6 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
|
|
|
12
12
|
hasChanges: boolean;
|
|
13
13
|
changeSeq: number;
|
|
14
14
|
isStripoInitialized: boolean;
|
|
15
|
-
isLegacyUnsubscribeModalRequested: boolean;
|
|
16
15
|
templateId: string;
|
|
17
16
|
syncModulesEnabled: boolean;
|
|
18
17
|
trackIdSessionFloor: number;
|
|
@@ -30,7 +29,6 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
|
|
|
30
29
|
hasChanges: boolean;
|
|
31
30
|
changeSeq: number;
|
|
32
31
|
isStripoInitialized: boolean;
|
|
33
|
-
isLegacyUnsubscribeModalRequested: boolean;
|
|
34
32
|
templateId: string;
|
|
35
33
|
syncModulesEnabled: boolean;
|
|
36
34
|
trackIdSessionFloor: number;
|
|
@@ -47,7 +45,6 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
|
|
|
47
45
|
hasChanges: boolean;
|
|
48
46
|
changeSeq: number;
|
|
49
47
|
isStripoInitialized: boolean;
|
|
50
|
-
isLegacyUnsubscribeModalRequested: boolean;
|
|
51
48
|
templateId: string;
|
|
52
49
|
syncModulesEnabled: boolean;
|
|
53
50
|
trackIdSessionFloor: number;
|
|
@@ -65,7 +62,6 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
|
|
|
65
62
|
hasChanges: boolean;
|
|
66
63
|
changeSeq: number;
|
|
67
64
|
isStripoInitialized: boolean;
|
|
68
|
-
isLegacyUnsubscribeModalRequested: boolean;
|
|
69
65
|
templateId: string;
|
|
70
66
|
syncModulesEnabled: boolean;
|
|
71
67
|
trackIdSessionFloor: number;
|
|
@@ -82,7 +78,6 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
|
|
|
82
78
|
hasChanges: boolean;
|
|
83
79
|
changeSeq: number;
|
|
84
80
|
isStripoInitialized: boolean;
|
|
85
|
-
isLegacyUnsubscribeModalRequested: boolean;
|
|
86
81
|
templateId: string;
|
|
87
82
|
syncModulesEnabled: boolean;
|
|
88
83
|
trackIdSessionFloor: number;
|
|
@@ -100,7 +95,6 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
|
|
|
100
95
|
hasChanges: boolean;
|
|
101
96
|
changeSeq: number;
|
|
102
97
|
isStripoInitialized: boolean;
|
|
103
|
-
isLegacyUnsubscribeModalRequested: boolean;
|
|
104
98
|
templateId: string;
|
|
105
99
|
syncModulesEnabled: boolean;
|
|
106
100
|
trackIdSessionFloor: number;
|
|
@@ -117,7 +111,6 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
|
|
|
117
111
|
hasChanges: boolean;
|
|
118
112
|
changeSeq: number;
|
|
119
113
|
isStripoInitialized: boolean;
|
|
120
|
-
isLegacyUnsubscribeModalRequested: boolean;
|
|
121
114
|
templateId: string;
|
|
122
115
|
syncModulesEnabled: boolean;
|
|
123
116
|
trackIdSessionFloor: number;
|
|
@@ -135,7 +128,6 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
|
|
|
135
128
|
hasChanges: boolean;
|
|
136
129
|
changeSeq: number;
|
|
137
130
|
isStripoInitialized: boolean;
|
|
138
|
-
isLegacyUnsubscribeModalRequested: boolean;
|
|
139
131
|
templateId: string;
|
|
140
132
|
syncModulesEnabled: boolean;
|
|
141
133
|
trackIdSessionFloor: number;
|
|
@@ -152,7 +144,6 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
|
|
|
152
144
|
hasChanges: boolean;
|
|
153
145
|
changeSeq: number;
|
|
154
146
|
isStripoInitialized: boolean;
|
|
155
|
-
isLegacyUnsubscribeModalRequested: boolean;
|
|
156
147
|
templateId: string;
|
|
157
148
|
syncModulesEnabled: boolean;
|
|
158
149
|
trackIdSessionFloor: number;
|
|
@@ -170,7 +161,6 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
|
|
|
170
161
|
hasChanges: boolean;
|
|
171
162
|
changeSeq: number;
|
|
172
163
|
isStripoInitialized: boolean;
|
|
173
|
-
isLegacyUnsubscribeModalRequested: boolean;
|
|
174
164
|
templateId: string;
|
|
175
165
|
syncModulesEnabled: boolean;
|
|
176
166
|
trackIdSessionFloor: number;
|
|
@@ -187,7 +177,6 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
|
|
|
187
177
|
hasChanges: boolean;
|
|
188
178
|
changeSeq: number;
|
|
189
179
|
isStripoInitialized: boolean;
|
|
190
|
-
isLegacyUnsubscribeModalRequested: boolean;
|
|
191
180
|
templateId: string;
|
|
192
181
|
syncModulesEnabled: boolean;
|
|
193
182
|
trackIdSessionFloor: number;
|
|
@@ -205,7 +194,6 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
|
|
|
205
194
|
hasChanges: boolean;
|
|
206
195
|
changeSeq: number;
|
|
207
196
|
isStripoInitialized: boolean;
|
|
208
|
-
isLegacyUnsubscribeModalRequested: boolean;
|
|
209
197
|
templateId: string;
|
|
210
198
|
syncModulesEnabled: boolean;
|
|
211
199
|
trackIdSessionFloor: number;
|
|
@@ -222,7 +210,6 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
|
|
|
222
210
|
hasChanges: boolean;
|
|
223
211
|
changeSeq: number;
|
|
224
212
|
isStripoInitialized: boolean;
|
|
225
|
-
isLegacyUnsubscribeModalRequested: boolean;
|
|
226
213
|
templateId: string;
|
|
227
214
|
syncModulesEnabled: boolean;
|
|
228
215
|
trackIdSessionFloor: number;
|
|
@@ -240,7 +227,6 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
|
|
|
240
227
|
hasChanges: boolean;
|
|
241
228
|
changeSeq: number;
|
|
242
229
|
isStripoInitialized: boolean;
|
|
243
|
-
isLegacyUnsubscribeModalRequested: boolean;
|
|
244
230
|
templateId: string;
|
|
245
231
|
syncModulesEnabled: boolean;
|
|
246
232
|
trackIdSessionFloor: number;
|
|
@@ -257,7 +243,6 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
|
|
|
257
243
|
hasChanges: boolean;
|
|
258
244
|
changeSeq: number;
|
|
259
245
|
isStripoInitialized: boolean;
|
|
260
|
-
isLegacyUnsubscribeModalRequested: boolean;
|
|
261
246
|
templateId: string;
|
|
262
247
|
syncModulesEnabled: boolean;
|
|
263
248
|
trackIdSessionFloor: number;
|
|
@@ -275,7 +260,6 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
|
|
|
275
260
|
hasChanges: boolean;
|
|
276
261
|
changeSeq: number;
|
|
277
262
|
isStripoInitialized: boolean;
|
|
278
|
-
isLegacyUnsubscribeModalRequested: boolean;
|
|
279
263
|
templateId: string;
|
|
280
264
|
syncModulesEnabled: boolean;
|
|
281
265
|
trackIdSessionFloor: number;
|
|
@@ -292,7 +276,6 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
|
|
|
292
276
|
hasChanges: boolean;
|
|
293
277
|
changeSeq: number;
|
|
294
278
|
isStripoInitialized: boolean;
|
|
295
|
-
isLegacyUnsubscribeModalRequested: boolean;
|
|
296
279
|
templateId: string;
|
|
297
280
|
syncModulesEnabled: boolean;
|
|
298
281
|
trackIdSessionFloor: number;
|
|
@@ -310,7 +293,6 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
|
|
|
310
293
|
hasChanges: boolean;
|
|
311
294
|
changeSeq: number;
|
|
312
295
|
isStripoInitialized: boolean;
|
|
313
|
-
isLegacyUnsubscribeModalRequested: boolean;
|
|
314
296
|
templateId: string;
|
|
315
297
|
syncModulesEnabled: boolean;
|
|
316
298
|
trackIdSessionFloor: number;
|
|
@@ -327,7 +309,6 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
|
|
|
327
309
|
hasChanges: boolean;
|
|
328
310
|
changeSeq: number;
|
|
329
311
|
isStripoInitialized: boolean;
|
|
330
|
-
isLegacyUnsubscribeModalRequested: boolean;
|
|
331
312
|
templateId: string;
|
|
332
313
|
syncModulesEnabled: boolean;
|
|
333
314
|
trackIdSessionFloor: number;
|
|
@@ -345,7 +326,6 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
|
|
|
345
326
|
hasChanges: boolean;
|
|
346
327
|
changeSeq: number;
|
|
347
328
|
isStripoInitialized: boolean;
|
|
348
|
-
isLegacyUnsubscribeModalRequested: boolean;
|
|
349
329
|
templateId: string;
|
|
350
330
|
syncModulesEnabled: boolean;
|
|
351
331
|
trackIdSessionFloor: number;
|
|
@@ -362,7 +342,6 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
|
|
|
362
342
|
hasChanges: boolean;
|
|
363
343
|
changeSeq: number;
|
|
364
344
|
isStripoInitialized: boolean;
|
|
365
|
-
isLegacyUnsubscribeModalRequested: boolean;
|
|
366
345
|
templateId: string;
|
|
367
346
|
syncModulesEnabled: boolean;
|
|
368
347
|
trackIdSessionFloor: number;
|
|
@@ -380,7 +359,6 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
|
|
|
380
359
|
hasChanges: boolean;
|
|
381
360
|
changeSeq: number;
|
|
382
361
|
isStripoInitialized: boolean;
|
|
383
|
-
isLegacyUnsubscribeModalRequested: boolean;
|
|
384
362
|
templateId: string;
|
|
385
363
|
syncModulesEnabled: boolean;
|
|
386
364
|
trackIdSessionFloor: number;
|
|
@@ -397,7 +375,6 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
|
|
|
397
375
|
hasChanges: boolean;
|
|
398
376
|
changeSeq: number;
|
|
399
377
|
isStripoInitialized: boolean;
|
|
400
|
-
isLegacyUnsubscribeModalRequested: boolean;
|
|
401
378
|
templateId: string;
|
|
402
379
|
syncModulesEnabled: boolean;
|
|
403
380
|
trackIdSessionFloor: number;
|
|
@@ -415,7 +392,6 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
|
|
|
415
392
|
hasChanges: boolean;
|
|
416
393
|
changeSeq: number;
|
|
417
394
|
isStripoInitialized: boolean;
|
|
418
|
-
isLegacyUnsubscribeModalRequested: boolean;
|
|
419
395
|
templateId: string;
|
|
420
396
|
syncModulesEnabled: boolean;
|
|
421
397
|
trackIdSessionFloor: number;
|
|
@@ -432,7 +408,6 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
|
|
|
432
408
|
hasChanges: boolean;
|
|
433
409
|
changeSeq: number;
|
|
434
410
|
isStripoInitialized: boolean;
|
|
435
|
-
isLegacyUnsubscribeModalRequested: boolean;
|
|
436
411
|
templateId: string;
|
|
437
412
|
syncModulesEnabled: boolean;
|
|
438
413
|
trackIdSessionFloor: number;
|
|
@@ -450,7 +425,6 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
|
|
|
450
425
|
hasChanges: boolean;
|
|
451
426
|
changeSeq: number;
|
|
452
427
|
isStripoInitialized: boolean;
|
|
453
|
-
isLegacyUnsubscribeModalRequested: boolean;
|
|
454
428
|
templateId: string;
|
|
455
429
|
syncModulesEnabled: boolean;
|
|
456
430
|
trackIdSessionFloor: number;
|
|
@@ -467,7 +441,6 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
|
|
|
467
441
|
hasChanges: boolean;
|
|
468
442
|
changeSeq: number;
|
|
469
443
|
isStripoInitialized: boolean;
|
|
470
|
-
isLegacyUnsubscribeModalRequested: boolean;
|
|
471
444
|
templateId: string;
|
|
472
445
|
syncModulesEnabled: boolean;
|
|
473
446
|
trackIdSessionFloor: number;
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
export interface ItemsCurrencyRepairOptions {
|
|
2
|
+
/** Convert legacy-model blocks to the root price-format contract (itemsPriceFormatting). */
|
|
3
|
+
convertToPriceFormat?: boolean;
|
|
4
|
+
}
|
|
1
5
|
/**
|
|
2
6
|
* Heals stale price currency attributes on every v2 Items block inside a dropped
|
|
3
7
|
* saved module, driving `data-curency` / `data-currency_symbol` from each block's
|
|
@@ -14,4 +18,4 @@
|
|
|
14
18
|
* recommendationMigrator wraps). If the wrap fails to capture the blocks (non-`<td>`
|
|
15
19
|
* root foster-parented out), it bails to the original string.
|
|
16
20
|
*/
|
|
17
|
-
export declare function repairItemsCurrencyAttributes(html: string): string;
|
|
21
|
+
export declare function repairItemsCurrencyAttributes(html: string, { convertToPriceFormat }?: ItemsCurrencyRepairOptions): string;
|
package/dist/stores/editor.js
CHANGED
|
@@ -16,7 +16,6 @@ const o = e("guidoEditor", {
|
|
|
16
16
|
// that need every change (the outbound state bridge) watch this instead.
|
|
17
17
|
changeSeq: 0,
|
|
18
18
|
isStripoInitialized: !1,
|
|
19
|
-
isLegacyUnsubscribeModalRequested: !1,
|
|
20
19
|
templateId: "",
|
|
21
20
|
syncModulesEnabled: !1,
|
|
22
21
|
// In-session id high-water mark; floors tracking-id minting so ids
|
|
@@ -1,39 +1,44 @@
|
|
|
1
|
-
import { currencyAttrTargets as
|
|
2
|
-
import { ItemsBlockId as
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
if (
|
|
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)
|
|
7
12
|
return !1;
|
|
8
|
-
let
|
|
13
|
+
let r, o;
|
|
9
14
|
try {
|
|
10
|
-
({ position:
|
|
15
|
+
({ position: r, symbol: o } = f(JSON.parse(n)));
|
|
11
16
|
} catch {
|
|
12
17
|
return !1;
|
|
13
18
|
}
|
|
14
|
-
let
|
|
15
|
-
return e.querySelectorAll(`.${
|
|
16
|
-
|
|
17
|
-
}),
|
|
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;
|
|
18
23
|
}
|
|
19
|
-
function
|
|
20
|
-
if (typeof e != "string" || !e.includes(
|
|
24
|
+
function I(e, { convertToPriceFormat: i = !1 } = {}) {
|
|
25
|
+
if (typeof e != "string" || !e.includes(u))
|
|
21
26
|
return e;
|
|
22
27
|
try {
|
|
23
|
-
const
|
|
28
|
+
const r = new DOMParser().parseFromString(
|
|
24
29
|
`<table><tbody><tr>${e}</tr></tbody></table>`,
|
|
25
30
|
"text/html"
|
|
26
|
-
).querySelector("tr"),
|
|
27
|
-
if (
|
|
31
|
+
).querySelector("tr"), o = r.querySelectorAll(`.${u}`);
|
|
32
|
+
if (o.length === 0)
|
|
28
33
|
return e;
|
|
29
|
-
let
|
|
30
|
-
return
|
|
31
|
-
|
|
32
|
-
}),
|
|
33
|
-
} catch (
|
|
34
|
-
return console.error("Failed to repair items currency on module add:",
|
|
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;
|
|
35
40
|
}
|
|
36
41
|
}
|
|
37
42
|
export {
|
|
38
|
-
|
|
43
|
+
I as repairItemsCurrencyAttributes
|
|
39
44
|
};
|
|
@@ -1,108 +1,128 @@
|
|
|
1
|
-
import { ITEMS_CURRENCY_ATTR as U, isCustomCurrencySymbol as
|
|
2
|
-
import { productPairs as
|
|
3
|
-
import { escapeReplacement as
|
|
4
|
-
import { preserveTextStyles as
|
|
1
|
+
import { isNewPriceFormatRoot as G, ITEMS_PRICE_FORMAT_ATTR as N, currencyPositionFromLocation as Y, ITEMS_CURRENCY_ATTR as U, isCustomCurrencySymbol as B } from "../extensions/Blocks/Items/constants/currency.js";
|
|
2
|
+
import { productPairs as k } from "../extensions/Blocks/Items/enums/productEnums.js";
|
|
3
|
+
import { escapeReplacement as v } from "../extensions/Blocks/Items/utils/nodeConfigUtils.js";
|
|
4
|
+
import { preserveTextStyles as w } from "./preserveTextStyles.js";
|
|
5
5
|
import { unwrapProductNameLinks as X } from "./unwrapProductNameLink.js";
|
|
6
6
|
const q = {
|
|
7
7
|
CART_ITEMS: "ins_apr",
|
|
8
8
|
BROWSED_ITEMS: "browsed_item",
|
|
9
9
|
PURCHASED_ITEMS: "purchased_item"
|
|
10
|
-
}, W = (
|
|
11
|
-
function
|
|
12
|
-
let
|
|
13
|
-
for (;
|
|
14
|
-
|
|
15
|
-
return
|
|
10
|
+
}, W = (r) => r.replaceAll("{%", "<!--{%").replaceAll("%}", "%}-->");
|
|
11
|
+
function j(r, h, p) {
|
|
12
|
+
let u = h;
|
|
13
|
+
for (; u > 0 && /\s/.test(r[u - 1]); )
|
|
14
|
+
u -= 1;
|
|
15
|
+
return p.some((A) => r.endsWith(A, u));
|
|
16
16
|
}
|
|
17
|
-
const
|
|
18
|
-
function
|
|
19
|
-
var
|
|
20
|
-
const
|
|
21
|
-
for (let
|
|
22
|
-
(
|
|
17
|
+
const Q = /(\s)href=(["'])(?:[^"']*#!|#)?\2/gi;
|
|
18
|
+
function z(r, h) {
|
|
19
|
+
var u;
|
|
20
|
+
const p = r.ownerDocument.createTreeWalker(r, NodeFilter.SHOW_COMMENT);
|
|
21
|
+
for (let A = p.nextNode(); A; A = p.nextNode())
|
|
22
|
+
(u = A.nodeValue) != null && u.includes("[if mso]") && (A.nodeValue = A.nodeValue.replace(Q, (L, P) => `${P}href="${h}"`));
|
|
23
23
|
}
|
|
24
|
-
function
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
24
|
+
function J(r) {
|
|
25
|
+
return {
|
|
26
|
+
isFormatted: r.getAttribute("data-formated") === "true",
|
|
27
|
+
isSinglePrice: r.getAttribute("data-single_price") === "true",
|
|
28
|
+
currencyPosition: r.getAttribute(U.POSITION) || "before",
|
|
29
|
+
configuredSymbol: (r.getAttribute(U.SYMBOL) || "").trim()
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
function K(r) {
|
|
33
|
+
return {
|
|
34
|
+
isFormatted: !1,
|
|
35
|
+
isSinglePrice: r.getAttribute(N.SINGLE_PRICE) === "true",
|
|
36
|
+
currencyPosition: Y(
|
|
37
|
+
r.getAttribute(N.ALIGNMENT) ?? void 0
|
|
38
|
+
),
|
|
39
|
+
configuredSymbol: (r.getAttribute(N.SYMBOL) || "").trim()
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
function Z(r, h, p) {
|
|
43
|
+
const { isFormatted: u, isSinglePrice: A, currencyPosition: L, configuredSymbol: P } = p;
|
|
44
|
+
let y;
|
|
45
|
+
A ? y = u ? r.SINGLE_PRICE_FORMATTED : r.SINGLE_PRICE : y = u ? r.PRICE_FORMATTED : r.PRICE;
|
|
46
|
+
const E = r.CURRENCY;
|
|
47
|
+
let F = `{{${y}_${h}}}`, R = "";
|
|
48
|
+
return B(P) ? R = P : E && (R = `{{${E}_${h}}}`), R && (F = L === "after" ? `${F} ${R}` : `${R} ${F}`), F;
|
|
49
|
+
}
|
|
50
|
+
function ct(r) {
|
|
51
|
+
const h = W(r), p = new DOMParser().parseFromString(h, "text/html");
|
|
52
|
+
X(p);
|
|
53
|
+
const u = k.PAIRS_FOR_EXTENSION;
|
|
54
|
+
Object.entries(u).forEach(([o, T]) => {
|
|
55
|
+
p.querySelectorAll(".ins-product-td").forEach((n) => {
|
|
56
|
+
const S = n.getAttribute("data-number") || "1", I = n.getAttribute("data-type") || "CART_ITEMS";
|
|
57
|
+
n.querySelectorAll(`[product-attr="${o}"]`).forEach((t) => {
|
|
58
|
+
var b, M, D, x;
|
|
59
|
+
const m = t.getAttribute("data-type") || I, c = t.getAttribute("data-number") || S, f = T[m];
|
|
34
60
|
if (f)
|
|
35
61
|
switch (o) {
|
|
36
62
|
case "imageSrc": {
|
|
37
|
-
let e = null,
|
|
38
|
-
if (t.tagName === "IMG" ? (e = t,
|
|
63
|
+
let e = null, i = null;
|
|
64
|
+
if (t.tagName === "IMG" ? (e = t, i = e.closest("a")) : (e = t.querySelector("img"), i = t.querySelector("a") || t.closest("a")), !e)
|
|
39
65
|
break;
|
|
40
|
-
const
|
|
41
|
-
if (
|
|
42
|
-
const
|
|
43
|
-
|
|
44
|
-
const
|
|
45
|
-
return
|
|
46
|
-
}) && (e.src = `{{${
|
|
66
|
+
const d = f.DEFAULT, a = f.ATTR;
|
|
67
|
+
if (d && e.src) {
|
|
68
|
+
const l = e.src;
|
|
69
|
+
d.some((C) => {
|
|
70
|
+
const $ = C.split("/").pop() || "", V = l.split("/").pop() || "";
|
|
71
|
+
return l.includes(C) || l.includes($) || V === $;
|
|
72
|
+
}) && (e.src = `{{${a}_${c}}}`);
|
|
47
73
|
}
|
|
48
|
-
const
|
|
49
|
-
if (
|
|
50
|
-
const
|
|
51
|
-
if (
|
|
52
|
-
const
|
|
53
|
-
(
|
|
74
|
+
const s = (M = (b = u.name) == null ? void 0 : b[m]) == null ? void 0 : M.ATTR;
|
|
75
|
+
if (s && e.setAttribute("alt", `{{${s}_${c}}}`), i) {
|
|
76
|
+
const l = (D = u.itemLink) == null ? void 0 : D[m];
|
|
77
|
+
if (l) {
|
|
78
|
+
const H = l.HREF, C = l.DEFAULT_HREF || "#!", $ = i.href;
|
|
79
|
+
($ === "#" || $ === "" || $.endsWith("#!") || $.endsWith(C) || $ === `${window.location.href}${C}` || !$ || $ === window.location.href) && (i.href = `{{${H}_${c}}}`);
|
|
54
80
|
}
|
|
55
81
|
}
|
|
56
82
|
break;
|
|
57
83
|
}
|
|
58
84
|
case "name": {
|
|
59
|
-
const e = f,
|
|
60
|
-
t.textContent && (t.innerHTML =
|
|
61
|
-
const
|
|
62
|
-
if (
|
|
63
|
-
const
|
|
64
|
-
(
|
|
85
|
+
const e = f, i = e.ATTR, d = e.DEFAULT_HREF || "#!", a = e.HREF;
|
|
86
|
+
t.textContent && (t.innerHTML = w(t, `{{${i}_${c}}}`));
|
|
87
|
+
const s = t.closest("a") || (t.tagName === "A" ? t : null);
|
|
88
|
+
if (s && a) {
|
|
89
|
+
const l = s.href, H = `${window.location.href}${d}`;
|
|
90
|
+
(l === H || l.endsWith(d)) && (s.href = `{{${a}_${c}}}`);
|
|
65
91
|
}
|
|
66
92
|
break;
|
|
67
93
|
}
|
|
68
94
|
case "price":
|
|
69
95
|
case "originalPrice": {
|
|
70
|
-
const e = f,
|
|
71
|
-
|
|
72
|
-
i ? b = c ? e.SINGLE_PRICE_FORMATTED : e.SINGLE_PRICE : b = c ? e.PRICE_FORMATTED : e.PRICE;
|
|
73
|
-
const g = e.CURRENCY;
|
|
74
|
-
let u = `{{${b}_${n}}}`;
|
|
75
|
-
const H = (t.getAttribute(U.SYMBOL) || "").trim(), G = Y(H);
|
|
76
|
-
let F = "";
|
|
77
|
-
G ? F = H : g && (F = `{{${g}_${n}}}`), F && (u = a === "after" ? `${u} ${F}` : `${F} ${u}`), t.innerHTML = L(t, u);
|
|
96
|
+
const e = f, i = G(n) ? K(n) : J(t);
|
|
97
|
+
t.innerHTML = w(t, Z(e, c, i));
|
|
78
98
|
break;
|
|
79
99
|
}
|
|
80
100
|
case "quantity": {
|
|
81
|
-
const e = f,
|
|
82
|
-
|
|
101
|
+
const e = f, i = e.ATTR, d = [e.DEFAULT, ...e.LEGACY_DEFAULTS], a = (x = t.textContent) == null ? void 0 : x.trim();
|
|
102
|
+
a && d.includes(a) && (t.innerHTML = w(t, `{{${i}_${c}}}`));
|
|
83
103
|
break;
|
|
84
104
|
}
|
|
85
105
|
case "button": {
|
|
86
|
-
const e = f,
|
|
87
|
-
if (
|
|
88
|
-
const
|
|
89
|
-
(
|
|
106
|
+
const e = f, i = e.HREF, d = e.DEFAULT_HREF || "#!", a = t.tagName === "A" ? t : t.querySelector("a");
|
|
107
|
+
if (a) {
|
|
108
|
+
const s = a.href || "", l = `${window.location.href}${d}`;
|
|
109
|
+
(s === "" || s === "#" || s === l || s.endsWith(d) || s.endsWith("#!") || s === window.location.href) && (a.href = `{{${i}_${c}}}`);
|
|
90
110
|
}
|
|
91
|
-
|
|
111
|
+
z(t, `{{${i}_${c}}}`);
|
|
92
112
|
break;
|
|
93
113
|
}
|
|
94
114
|
case "itemLink": {
|
|
95
|
-
const e = f,
|
|
96
|
-
if (
|
|
97
|
-
const
|
|
98
|
-
(
|
|
115
|
+
const e = f, i = e.HREF, d = e.DEFAULT_HREF || "#!", a = t;
|
|
116
|
+
if (a.href) {
|
|
117
|
+
const s = a.href, l = `${window.location.href}${d}`;
|
|
118
|
+
(s === l || s.endsWith(d)) && (a.href = `{{${i}_${c}}}`);
|
|
99
119
|
}
|
|
100
120
|
break;
|
|
101
121
|
}
|
|
102
122
|
default: {
|
|
103
123
|
if ("ATTR" in f) {
|
|
104
124
|
const e = f.ATTR;
|
|
105
|
-
t.textContent && (t.innerHTML =
|
|
125
|
+
t.textContent && (t.innerHTML = w(t, `{{${e}_${c}}}`));
|
|
106
126
|
}
|
|
107
127
|
break;
|
|
108
128
|
}
|
|
@@ -110,49 +130,49 @@ function et($) {
|
|
|
110
130
|
});
|
|
111
131
|
});
|
|
112
132
|
});
|
|
113
|
-
const
|
|
114
|
-
` : "", P =
|
|
133
|
+
const A = h.match(/<!DOCTYPE[^>]*>/i), L = A ? `${A[0]}
|
|
134
|
+
` : "", P = p.querySelectorAll(".ins-product-td"), y = [];
|
|
115
135
|
P.forEach((o) => {
|
|
116
|
-
const
|
|
117
|
-
|
|
136
|
+
const T = o.getAttribute("data-type") || "CART_ITEMS", _ = o.getAttribute("data-number") || "1", n = o.outerHTML;
|
|
137
|
+
y.push({
|
|
118
138
|
element: o,
|
|
119
|
-
outerHtml:
|
|
120
|
-
type:
|
|
121
|
-
number:
|
|
139
|
+
outerHtml: n,
|
|
140
|
+
type: T,
|
|
141
|
+
number: _
|
|
122
142
|
});
|
|
123
143
|
});
|
|
124
|
-
let
|
|
125
|
-
|
|
126
|
-
const
|
|
127
|
-
if (
|
|
128
|
-
const
|
|
129
|
-
|
|
144
|
+
let E = L + p.documentElement.outerHTML;
|
|
145
|
+
y.reverse().forEach(({ outerHtml: o, type: T, number: _ }) => {
|
|
146
|
+
const n = q[T], S = n ? `${n}_total_product_kind` : "";
|
|
147
|
+
if (S) {
|
|
148
|
+
const g = parseInt(_) - 1, c = `${`{% if ${S} > ${g} %}`}${o}{% endif %}`;
|
|
149
|
+
E = E.replace(o, v(c));
|
|
130
150
|
}
|
|
131
151
|
});
|
|
132
|
-
const
|
|
133
|
-
return
|
|
152
|
+
const F = p.querySelectorAll('[product-attr="originalPrice"][data-type]'), R = /* @__PURE__ */ new Map(), O = /* @__PURE__ */ new Set();
|
|
153
|
+
return F.forEach((o) => {
|
|
134
154
|
var t;
|
|
135
|
-
const
|
|
136
|
-
if (!
|
|
155
|
+
const T = o.getAttribute("data-number"), _ = o.getAttribute("data-type");
|
|
156
|
+
if (!T || !q[_])
|
|
137
157
|
return;
|
|
138
|
-
const
|
|
139
|
-
if (!
|
|
158
|
+
const n = o.closest(".product-original-price-class");
|
|
159
|
+
if (!n || O.has(n))
|
|
140
160
|
return;
|
|
141
|
-
|
|
142
|
-
const
|
|
143
|
-
|
|
144
|
-
}),
|
|
145
|
-
if (
|
|
161
|
+
O.add(n);
|
|
162
|
+
const S = n.outerHTML, I = (t = o.closest(".ins-product-td")) == null ? void 0 : t.getAttribute("data-nodup"), g = R.get(S) ?? { number: T, type: _, wrap: [] };
|
|
163
|
+
g.wrap.push(I !== "false"), R.set(S, g);
|
|
164
|
+
}), R.forEach(({ number: o, type: T, wrap: _ }, n) => {
|
|
165
|
+
if (n.includes("{% if") || !_.some(Boolean))
|
|
146
166
|
return;
|
|
147
|
-
const
|
|
148
|
-
let m = "",
|
|
149
|
-
for (;
|
|
150
|
-
const
|
|
151
|
-
m +=
|
|
167
|
+
const S = k.PAIRS_FOR_EXTENSION.price[T].PRICE, I = k.PAIRS_FOR_EXTENSION.originalPrice[T].PRICE, g = `{% if ${S}_${o} != ${I}_${o} %}`, t = [g, W(g)];
|
|
168
|
+
let m = "", c = 0, f = 0, b = E.indexOf(n);
|
|
169
|
+
for (; b !== -1; ) {
|
|
170
|
+
const M = _[f] === !0 && !j(E, b, t);
|
|
171
|
+
m += E.slice(c, b) + (M ? `${g}${n}{% endif %}` : n), c = b + n.length, f += 1, b = E.indexOf(n, c);
|
|
152
172
|
}
|
|
153
|
-
|
|
154
|
-
}),
|
|
173
|
+
E = m + E.slice(c);
|
|
174
|
+
}), E.replaceAll("<!--{%", "{%").replaceAll("%}-->", "%}").replaceAll("<!--{%", "{%").replaceAll("%}-->", "%}");
|
|
155
175
|
}
|
|
156
176
|
export {
|
|
157
|
-
|
|
177
|
+
ct as pairProductVariables
|
|
158
178
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@useinsider/guido",
|
|
3
|
-
"version": "3.24.0-beta.
|
|
3
|
+
"version": "3.24.0-beta.8779b29",
|
|
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,17 +0,0 @@
|
|
|
1
|
-
import s from "./LegacyUnsubscribeConvertedModal.vue2.js";
|
|
2
|
-
import r from "../../../_virtual/_plugin-vue2_normalizer.js";
|
|
3
|
-
var n = function() {
|
|
4
|
-
var o = this, t = o._self._c, e = o._self._setupProxy;
|
|
5
|
-
return e.isVisible ? t(e.WpModal, { attrs: { id: "guido__legacy-unsubscribe-converted-modal", "close-on-outside-click": !1, "footer-button-options": e.footerButtonOptions, title: e.trans("email-editor.legacy-unsubscribe-converted-modal-title") }, on: { close: e.close, "primary-action": e.close, "secondary-action": e.openAcademy } }, [t("p", [o._v(o._s(e.trans("email-editor.legacy-unsubscribe-converted-modal-message")))])]) : o._e();
|
|
6
|
-
}, a = [], c = /* @__PURE__ */ r(
|
|
7
|
-
s,
|
|
8
|
-
n,
|
|
9
|
-
a,
|
|
10
|
-
!1,
|
|
11
|
-
null,
|
|
12
|
-
null
|
|
13
|
-
);
|
|
14
|
-
const d = c.exports;
|
|
15
|
-
export {
|
|
16
|
-
d as default
|
|
17
|
-
};
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { defineComponent as n, computed as t } from "vue";
|
|
2
|
-
import i from "../../wrappers/WpModal.vue.js";
|
|
3
|
-
import { useTranslations as a } from "../../../composables/useTranslations.js";
|
|
4
|
-
import { ACADEMY_LINKS as c } from "../../../enums/academy.js";
|
|
5
|
-
import { useEditorStore as p } from "../../../stores/editor.js";
|
|
6
|
-
const L = /* @__PURE__ */ n({
|
|
7
|
-
__name: "LegacyUnsubscribeConvertedModal",
|
|
8
|
-
setup(d) {
|
|
9
|
-
const o = a(), e = p(), r = t(
|
|
10
|
-
() => e.isLegacyUnsubscribeModalRequested && e.isStripoInitialized
|
|
11
|
-
), s = t(() => ({
|
|
12
|
-
secondaryButton: {
|
|
13
|
-
type: "subtle-primary",
|
|
14
|
-
labelText: o("email-editor.legacy-unsubscribe-converted-modal-visit-academy")
|
|
15
|
-
},
|
|
16
|
-
primaryButton: {
|
|
17
|
-
type: "primary",
|
|
18
|
-
labelText: o("action-builder.ok")
|
|
19
|
-
}
|
|
20
|
-
}));
|
|
21
|
-
return { __sfc: !0, trans: o, editorStore: e, isVisible: r, footerButtonOptions: s, close: () => {
|
|
22
|
-
e.isLegacyUnsubscribeModalRequested = !1;
|
|
23
|
-
}, openAcademy: () => {
|
|
24
|
-
window.open(c.LEGACY_UNSUBSCRIBE_MODULE, "_blank", "noopener,noreferrer");
|
|
25
|
-
}, WpModal: i };
|
|
26
|
-
}
|
|
27
|
-
});
|
|
28
|
-
export {
|
|
29
|
-
L as default
|
|
30
|
-
};
|