@useinsider/guido 3.25.0-beta.2954d1a → 3.25.0-beta.32ce2bd
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 +9 -0
- package/dist/@types/config/schemas.js +17 -15
- package/dist/components/Guido.vue.js +4 -4
- package/dist/components/Guido.vue2.js +94 -90
- package/dist/components/organisms/unsubscribe/LegacyUnsubscribeConvertedModal.vue.js +17 -0
- package/dist/components/organisms/unsubscribe/LegacyUnsubscribeConvertedModal.vue2.js +30 -0
- package/dist/composables/useModuleRepair.js +33 -24
- package/dist/config/migrator/index.js +8 -7
- package/dist/config/migrator/legacyUnsubscribeTextMigrator.js +16 -0
- package/dist/config/migrator/recommendationMigrator.js +64 -78
- package/dist/enums/academy.js +2 -1
- package/dist/guido.css +1 -1
- package/dist/package.json.js +2 -2
- package/dist/src/@types/config/schemas.d.ts +4 -0
- package/dist/src/components/organisms/unsubscribe/LegacyUnsubscribeConvertedModal.vue.d.ts +2 -0
- package/dist/src/composables/useConfig.d.ts +2 -0
- package/dist/src/composables/useModuleRepair.d.ts +2 -11
- package/dist/src/config/migrator/legacyUnsubscribeTextMigrator.d.ts +1 -0
- package/dist/src/config/migrator/recommendation/parseLegacyConfig.d.ts +1 -1
- package/dist/src/config/migrator/recommendationMigrator.d.ts +5 -1
- package/dist/src/enums/academy.d.ts +1 -0
- package/dist/src/stores/config.d.ts +20 -0
- package/dist/src/stores/editor.d.ts +27 -0
- package/dist/src/utils/legacyUnsubscribeConversion.d.ts +10 -0
- package/dist/stores/editor.js +1 -0
- package/dist/utils/legacyUnsubscribeConversion.js +49 -0
- package/package.json +1 -1
- package/dist/config/migrator/recommendation/inferLegacyConfig.js +0 -133
- package/dist/src/config/migrator/recommendation/inferLegacyConfig.d.ts +0 -6
|
@@ -12,6 +12,7 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
|
|
|
12
12
|
hasChanges: boolean;
|
|
13
13
|
changeSeq: number;
|
|
14
14
|
isStripoInitialized: boolean;
|
|
15
|
+
isLegacyUnsubscribeModalRequested: boolean;
|
|
15
16
|
templateId: string;
|
|
16
17
|
syncModulesEnabled: boolean;
|
|
17
18
|
trackIdSessionFloor: number;
|
|
@@ -29,6 +30,7 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
|
|
|
29
30
|
hasChanges: boolean;
|
|
30
31
|
changeSeq: number;
|
|
31
32
|
isStripoInitialized: boolean;
|
|
33
|
+
isLegacyUnsubscribeModalRequested: boolean;
|
|
32
34
|
templateId: string;
|
|
33
35
|
syncModulesEnabled: boolean;
|
|
34
36
|
trackIdSessionFloor: number;
|
|
@@ -45,6 +47,7 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
|
|
|
45
47
|
hasChanges: boolean;
|
|
46
48
|
changeSeq: number;
|
|
47
49
|
isStripoInitialized: boolean;
|
|
50
|
+
isLegacyUnsubscribeModalRequested: boolean;
|
|
48
51
|
templateId: string;
|
|
49
52
|
syncModulesEnabled: boolean;
|
|
50
53
|
trackIdSessionFloor: number;
|
|
@@ -62,6 +65,7 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
|
|
|
62
65
|
hasChanges: boolean;
|
|
63
66
|
changeSeq: number;
|
|
64
67
|
isStripoInitialized: boolean;
|
|
68
|
+
isLegacyUnsubscribeModalRequested: boolean;
|
|
65
69
|
templateId: string;
|
|
66
70
|
syncModulesEnabled: boolean;
|
|
67
71
|
trackIdSessionFloor: number;
|
|
@@ -78,6 +82,7 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
|
|
|
78
82
|
hasChanges: boolean;
|
|
79
83
|
changeSeq: number;
|
|
80
84
|
isStripoInitialized: boolean;
|
|
85
|
+
isLegacyUnsubscribeModalRequested: boolean;
|
|
81
86
|
templateId: string;
|
|
82
87
|
syncModulesEnabled: boolean;
|
|
83
88
|
trackIdSessionFloor: number;
|
|
@@ -95,6 +100,7 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
|
|
|
95
100
|
hasChanges: boolean;
|
|
96
101
|
changeSeq: number;
|
|
97
102
|
isStripoInitialized: boolean;
|
|
103
|
+
isLegacyUnsubscribeModalRequested: boolean;
|
|
98
104
|
templateId: string;
|
|
99
105
|
syncModulesEnabled: boolean;
|
|
100
106
|
trackIdSessionFloor: number;
|
|
@@ -111,6 +117,7 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
|
|
|
111
117
|
hasChanges: boolean;
|
|
112
118
|
changeSeq: number;
|
|
113
119
|
isStripoInitialized: boolean;
|
|
120
|
+
isLegacyUnsubscribeModalRequested: boolean;
|
|
114
121
|
templateId: string;
|
|
115
122
|
syncModulesEnabled: boolean;
|
|
116
123
|
trackIdSessionFloor: number;
|
|
@@ -128,6 +135,7 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
|
|
|
128
135
|
hasChanges: boolean;
|
|
129
136
|
changeSeq: number;
|
|
130
137
|
isStripoInitialized: boolean;
|
|
138
|
+
isLegacyUnsubscribeModalRequested: boolean;
|
|
131
139
|
templateId: string;
|
|
132
140
|
syncModulesEnabled: boolean;
|
|
133
141
|
trackIdSessionFloor: number;
|
|
@@ -144,6 +152,7 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
|
|
|
144
152
|
hasChanges: boolean;
|
|
145
153
|
changeSeq: number;
|
|
146
154
|
isStripoInitialized: boolean;
|
|
155
|
+
isLegacyUnsubscribeModalRequested: boolean;
|
|
147
156
|
templateId: string;
|
|
148
157
|
syncModulesEnabled: boolean;
|
|
149
158
|
trackIdSessionFloor: number;
|
|
@@ -161,6 +170,7 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
|
|
|
161
170
|
hasChanges: boolean;
|
|
162
171
|
changeSeq: number;
|
|
163
172
|
isStripoInitialized: boolean;
|
|
173
|
+
isLegacyUnsubscribeModalRequested: boolean;
|
|
164
174
|
templateId: string;
|
|
165
175
|
syncModulesEnabled: boolean;
|
|
166
176
|
trackIdSessionFloor: number;
|
|
@@ -177,6 +187,7 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
|
|
|
177
187
|
hasChanges: boolean;
|
|
178
188
|
changeSeq: number;
|
|
179
189
|
isStripoInitialized: boolean;
|
|
190
|
+
isLegacyUnsubscribeModalRequested: boolean;
|
|
180
191
|
templateId: string;
|
|
181
192
|
syncModulesEnabled: boolean;
|
|
182
193
|
trackIdSessionFloor: number;
|
|
@@ -194,6 +205,7 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
|
|
|
194
205
|
hasChanges: boolean;
|
|
195
206
|
changeSeq: number;
|
|
196
207
|
isStripoInitialized: boolean;
|
|
208
|
+
isLegacyUnsubscribeModalRequested: boolean;
|
|
197
209
|
templateId: string;
|
|
198
210
|
syncModulesEnabled: boolean;
|
|
199
211
|
trackIdSessionFloor: number;
|
|
@@ -210,6 +222,7 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
|
|
|
210
222
|
hasChanges: boolean;
|
|
211
223
|
changeSeq: number;
|
|
212
224
|
isStripoInitialized: boolean;
|
|
225
|
+
isLegacyUnsubscribeModalRequested: boolean;
|
|
213
226
|
templateId: string;
|
|
214
227
|
syncModulesEnabled: boolean;
|
|
215
228
|
trackIdSessionFloor: number;
|
|
@@ -227,6 +240,7 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
|
|
|
227
240
|
hasChanges: boolean;
|
|
228
241
|
changeSeq: number;
|
|
229
242
|
isStripoInitialized: boolean;
|
|
243
|
+
isLegacyUnsubscribeModalRequested: boolean;
|
|
230
244
|
templateId: string;
|
|
231
245
|
syncModulesEnabled: boolean;
|
|
232
246
|
trackIdSessionFloor: number;
|
|
@@ -243,6 +257,7 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
|
|
|
243
257
|
hasChanges: boolean;
|
|
244
258
|
changeSeq: number;
|
|
245
259
|
isStripoInitialized: boolean;
|
|
260
|
+
isLegacyUnsubscribeModalRequested: boolean;
|
|
246
261
|
templateId: string;
|
|
247
262
|
syncModulesEnabled: boolean;
|
|
248
263
|
trackIdSessionFloor: number;
|
|
@@ -260,6 +275,7 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
|
|
|
260
275
|
hasChanges: boolean;
|
|
261
276
|
changeSeq: number;
|
|
262
277
|
isStripoInitialized: boolean;
|
|
278
|
+
isLegacyUnsubscribeModalRequested: boolean;
|
|
263
279
|
templateId: string;
|
|
264
280
|
syncModulesEnabled: boolean;
|
|
265
281
|
trackIdSessionFloor: number;
|
|
@@ -276,6 +292,7 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
|
|
|
276
292
|
hasChanges: boolean;
|
|
277
293
|
changeSeq: number;
|
|
278
294
|
isStripoInitialized: boolean;
|
|
295
|
+
isLegacyUnsubscribeModalRequested: boolean;
|
|
279
296
|
templateId: string;
|
|
280
297
|
syncModulesEnabled: boolean;
|
|
281
298
|
trackIdSessionFloor: number;
|
|
@@ -293,6 +310,7 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
|
|
|
293
310
|
hasChanges: boolean;
|
|
294
311
|
changeSeq: number;
|
|
295
312
|
isStripoInitialized: boolean;
|
|
313
|
+
isLegacyUnsubscribeModalRequested: boolean;
|
|
296
314
|
templateId: string;
|
|
297
315
|
syncModulesEnabled: boolean;
|
|
298
316
|
trackIdSessionFloor: number;
|
|
@@ -309,6 +327,7 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
|
|
|
309
327
|
hasChanges: boolean;
|
|
310
328
|
changeSeq: number;
|
|
311
329
|
isStripoInitialized: boolean;
|
|
330
|
+
isLegacyUnsubscribeModalRequested: boolean;
|
|
312
331
|
templateId: string;
|
|
313
332
|
syncModulesEnabled: boolean;
|
|
314
333
|
trackIdSessionFloor: number;
|
|
@@ -326,6 +345,7 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
|
|
|
326
345
|
hasChanges: boolean;
|
|
327
346
|
changeSeq: number;
|
|
328
347
|
isStripoInitialized: boolean;
|
|
348
|
+
isLegacyUnsubscribeModalRequested: boolean;
|
|
329
349
|
templateId: string;
|
|
330
350
|
syncModulesEnabled: boolean;
|
|
331
351
|
trackIdSessionFloor: number;
|
|
@@ -342,6 +362,7 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
|
|
|
342
362
|
hasChanges: boolean;
|
|
343
363
|
changeSeq: number;
|
|
344
364
|
isStripoInitialized: boolean;
|
|
365
|
+
isLegacyUnsubscribeModalRequested: boolean;
|
|
345
366
|
templateId: string;
|
|
346
367
|
syncModulesEnabled: boolean;
|
|
347
368
|
trackIdSessionFloor: number;
|
|
@@ -359,6 +380,7 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
|
|
|
359
380
|
hasChanges: boolean;
|
|
360
381
|
changeSeq: number;
|
|
361
382
|
isStripoInitialized: boolean;
|
|
383
|
+
isLegacyUnsubscribeModalRequested: boolean;
|
|
362
384
|
templateId: string;
|
|
363
385
|
syncModulesEnabled: boolean;
|
|
364
386
|
trackIdSessionFloor: number;
|
|
@@ -375,6 +397,7 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
|
|
|
375
397
|
hasChanges: boolean;
|
|
376
398
|
changeSeq: number;
|
|
377
399
|
isStripoInitialized: boolean;
|
|
400
|
+
isLegacyUnsubscribeModalRequested: boolean;
|
|
378
401
|
templateId: string;
|
|
379
402
|
syncModulesEnabled: boolean;
|
|
380
403
|
trackIdSessionFloor: number;
|
|
@@ -392,6 +415,7 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
|
|
|
392
415
|
hasChanges: boolean;
|
|
393
416
|
changeSeq: number;
|
|
394
417
|
isStripoInitialized: boolean;
|
|
418
|
+
isLegacyUnsubscribeModalRequested: boolean;
|
|
395
419
|
templateId: string;
|
|
396
420
|
syncModulesEnabled: boolean;
|
|
397
421
|
trackIdSessionFloor: number;
|
|
@@ -408,6 +432,7 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
|
|
|
408
432
|
hasChanges: boolean;
|
|
409
433
|
changeSeq: number;
|
|
410
434
|
isStripoInitialized: boolean;
|
|
435
|
+
isLegacyUnsubscribeModalRequested: boolean;
|
|
411
436
|
templateId: string;
|
|
412
437
|
syncModulesEnabled: boolean;
|
|
413
438
|
trackIdSessionFloor: number;
|
|
@@ -425,6 +450,7 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
|
|
|
425
450
|
hasChanges: boolean;
|
|
426
451
|
changeSeq: number;
|
|
427
452
|
isStripoInitialized: boolean;
|
|
453
|
+
isLegacyUnsubscribeModalRequested: boolean;
|
|
428
454
|
templateId: string;
|
|
429
455
|
syncModulesEnabled: boolean;
|
|
430
456
|
trackIdSessionFloor: number;
|
|
@@ -441,6 +467,7 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
|
|
|
441
467
|
hasChanges: boolean;
|
|
442
468
|
changeSeq: number;
|
|
443
469
|
isStripoInitialized: boolean;
|
|
470
|
+
isLegacyUnsubscribeModalRequested: boolean;
|
|
444
471
|
templateId: string;
|
|
445
472
|
syncModulesEnabled: boolean;
|
|
446
473
|
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;
|
package/dist/stores/editor.js
CHANGED
|
@@ -16,6 +16,7 @@ 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,
|
|
19
20
|
templateId: "",
|
|
20
21
|
syncModulesEnabled: !1,
|
|
21
22
|
// In-session id high-water mark; floors tracking-id minting so ids
|
|
@@ -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
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@useinsider/guido",
|
|
3
|
-
"version": "3.25.0-beta.
|
|
3
|
+
"version": "3.25.0-beta.32ce2bd",
|
|
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,133 +0,0 @@
|
|
|
1
|
-
import { MAX_PRODUCTS_PER_ROW as _ } from "../../../extensions/Blocks/Recommendation/constants/layout.js";
|
|
2
|
-
const T = "td.product-card", x = '[class*="ext-product-"]', d = ".ext-ins-attr p[product-attr]", y = ".ext-ins-attr", S = ["font-family", "font-size", "font-weight", "font-style"], a = [
|
|
3
|
-
["p_image", ".ext-product-image"],
|
|
4
|
-
["p_name", ".ext-product-name"],
|
|
5
|
-
["p_price", ".ext-product-price"],
|
|
6
|
-
["p_original_price", ".ext-product-original-price"],
|
|
7
|
-
["p_omnibus_price", ".ext-product-omnibus-price", !0],
|
|
8
|
-
["p_omnibus_discount", ".ext-product-omnibus-discount", !0],
|
|
9
|
-
["p_button", ".ext-product-button"]
|
|
10
|
-
], l = a.map(([, t]) => t).join(", ");
|
|
11
|
-
function s(t, e) {
|
|
12
|
-
const n = new RegExp(`(?:^|;)\\s*${e}\\s*:\\s*([^;]+)`, "i"), r = ((t == null ? void 0 : t.getAttribute("style")) ?? "").match(n);
|
|
13
|
-
return (r == null ? void 0 : r[1].trim()) || void 0;
|
|
14
|
-
}
|
|
15
|
-
function p(t) {
|
|
16
|
-
return /^none\b/.test(s(t, "display") ?? "");
|
|
17
|
-
}
|
|
18
|
-
function h(t) {
|
|
19
|
-
return p(t) || p(t.closest("tr"));
|
|
20
|
-
}
|
|
21
|
-
function f(t) {
|
|
22
|
-
const e = {};
|
|
23
|
-
return S.forEach((n) => {
|
|
24
|
-
const r = s(t, n);
|
|
25
|
-
r && (e[n] = r);
|
|
26
|
-
}), Object.keys(e).length > 0 ? e : void 0;
|
|
27
|
-
}
|
|
28
|
-
function g(t) {
|
|
29
|
-
return Object.keys(t).length > 0 ? t : void 0;
|
|
30
|
-
}
|
|
31
|
-
function m(t) {
|
|
32
|
-
const e = t.querySelector("p") ?? t, n = f(e), r = s(e, "color"), i = t.getAttribute("align") ?? s(e, "text-align"), o = s(e, "line-height");
|
|
33
|
-
return g({
|
|
34
|
-
...n ? { textStyle: n } : {},
|
|
35
|
-
...r ? { textColor: { color: r } } : {},
|
|
36
|
-
...i ? { textAlign: { align: i } } : {},
|
|
37
|
-
...o ? { textLineSpacing: { lineSpacing: o } } : {}
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
function A(t) {
|
|
41
|
-
var u;
|
|
42
|
-
const e = t.querySelector("a") ?? t, n = (u = e.textContent) == null ? void 0 : u.trim(), r = s(e, "background-color") ?? s(e, "background"), i = s(e, "color"), o = f(e), c = t.getAttribute("align");
|
|
43
|
-
return g({
|
|
44
|
-
...n ? { buttonText: { text: n } } : {},
|
|
45
|
-
...r ? { buttonColor: { color: r } } : {},
|
|
46
|
-
...i ? { textButtonColor: { color: i } } : {},
|
|
47
|
-
...o ? { buttonStyle: o } : {},
|
|
48
|
-
...c ? { buttonAlign: { align: c } } : {}
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
|
-
function C(t) {
|
|
52
|
-
const e = t.querySelector("img"), n = Number(e == null ? void 0 : e.getAttribute("width")), r = Number(e == null ? void 0 : e.getAttribute("height")), i = { ...n > 0 ? { width: n } : {}, ...r > 0 ? { height: r } : {} };
|
|
53
|
-
return Object.keys(i).length > 0 ? { imageSize: i } : void 0;
|
|
54
|
-
}
|
|
55
|
-
function R(t, e) {
|
|
56
|
-
switch (t) {
|
|
57
|
-
case "p_image":
|
|
58
|
-
return C(e);
|
|
59
|
-
case "p_button":
|
|
60
|
-
return A(e);
|
|
61
|
-
default:
|
|
62
|
-
return m(e);
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
function L(t, e) {
|
|
66
|
-
const n = Array.from(t.querySelectorAll(`[class*="show-recommendation-${e}-"]`));
|
|
67
|
-
return n.length > 0 ? n : Array.from(t.querySelectorAll(T));
|
|
68
|
-
}
|
|
69
|
-
function w(t, e) {
|
|
70
|
-
const n = (o) => e.filter((c) => o.contains(c)).length;
|
|
71
|
-
let r = e[0].parentElement;
|
|
72
|
-
for (; r && r !== t && n(r) < 2; )
|
|
73
|
-
r = r.parentElement;
|
|
74
|
-
if (!r || r === t)
|
|
75
|
-
return e.length === 1 ? 1 : void 0;
|
|
76
|
-
const i = r.tagName === "TBODY" || r.tagName === "TABLE" ? 1 : n(r);
|
|
77
|
-
return Math.min(i, _);
|
|
78
|
-
}
|
|
79
|
-
function v(t) {
|
|
80
|
-
const e = Array.from(t.querySelectorAll(x)).filter((n) => !n.matches(l) && !n.querySelector(l)).flatMap((n) => Array.from(n.classList).filter((r) => r.startsWith("ext-product-")));
|
|
81
|
-
return [...new Set(e)];
|
|
82
|
-
}
|
|
83
|
-
function O(t, e, n) {
|
|
84
|
-
const r = t.closest(y) ?? t, i = m(r);
|
|
85
|
-
return {
|
|
86
|
-
variable: `p_attribute_${e}`,
|
|
87
|
-
variableType: "p_attribute",
|
|
88
|
-
value: t.getAttribute("product-attr") ?? "",
|
|
89
|
-
positionIdx: n,
|
|
90
|
-
hidden: h(r),
|
|
91
|
-
...i ? { theme: i } : {}
|
|
92
|
-
};
|
|
93
|
-
}
|
|
94
|
-
function N(t) {
|
|
95
|
-
const e = /* @__PURE__ */ new Set(), n = [];
|
|
96
|
-
let r = 0;
|
|
97
|
-
t.querySelectorAll(`${l}, ${d}`).forEach((o) => {
|
|
98
|
-
if (o.matches(d)) {
|
|
99
|
-
n.push(O(o, r, n.length)), r += 1;
|
|
100
|
-
return;
|
|
101
|
-
}
|
|
102
|
-
const c = a.find(
|
|
103
|
-
([b, E]) => !e.has(b) && o.matches(E)
|
|
104
|
-
);
|
|
105
|
-
if (!c)
|
|
106
|
-
return;
|
|
107
|
-
const u = R(c[0], o);
|
|
108
|
-
e.add(c[0]), n.push({
|
|
109
|
-
variable: c[0],
|
|
110
|
-
positionIdx: n.length,
|
|
111
|
-
hidden: h(o),
|
|
112
|
-
...u ? { theme: u } : {}
|
|
113
|
-
});
|
|
114
|
-
});
|
|
115
|
-
const i = a.filter(([o, , c]) => !c && !e.has(o)).map(([o]) => ({ variable: o, hidden: !0 }));
|
|
116
|
-
return [...n, ...i];
|
|
117
|
-
}
|
|
118
|
-
function q(t, e) {
|
|
119
|
-
const n = L(t, e);
|
|
120
|
-
if (n.length === 0)
|
|
121
|
-
return null;
|
|
122
|
-
const r = v(n[0]);
|
|
123
|
-
return r.length > 0 ? (console.warn(
|
|
124
|
-
`[RecommendationMigrator] Block id=${e} — legacy card cells the rebuild cannot map: ${r.join(", ")}`
|
|
125
|
-
), null) : {
|
|
126
|
-
totalCount: n.length,
|
|
127
|
-
rowCount: w(t, n),
|
|
128
|
-
composition: { variables: N(n[0]) }
|
|
129
|
-
};
|
|
130
|
-
}
|
|
131
|
-
export {
|
|
132
|
-
q as inferLegacyConfig
|
|
133
|
-
};
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import type { LegacyProductConfig } from './types';
|
|
2
|
-
/**
|
|
3
|
-
* Rebuilds the `esd-dev-product-config` a pre-Guido block never carried from what it rendered.
|
|
4
|
-
* Null when no product card renders or a card cell cannot be mapped (the rebuild would lose it); other fields default.
|
|
5
|
-
*/
|
|
6
|
-
export declare function inferLegacyConfig(block: Element, id: number): LegacyProductConfig | null;
|