@useinsider/guido 3.8.1 → 3.8.2-beta.61c2971
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/dist/components/organisms/email-preview/desktop-preview/DesktopPreview.vue.js +8 -8
- package/dist/components/organisms/email-preview/desktop-preview/DesktopPreview.vue2.js +15 -12
- package/dist/components/organisms/email-preview/mobile-preview/ContentView.vue.js +5 -5
- package/dist/components/organisms/email-preview/mobile-preview/ContentView.vue2.js +16 -15
- package/dist/components/organisms/unsubscribe/UnsubscribePageSelection.vue.js +5 -5
- package/dist/components/organisms/unsubscribe/UnsubscribePageSelection.vue2.js +42 -37
- package/dist/components/organisms/unsubscribe/UnsubscribeTypeSelection.vue.js +3 -3
- package/dist/components/organisms/unsubscribe/UnsubscribeTypeSelection.vue2.js +40 -37
- package/dist/composables/useHtmlCompiler.js +13 -10
- package/dist/composables/useHtmlValidator.js +180 -133
- package/dist/composables/usePreviewInteractionGuard.js +17 -0
- package/dist/composables/useSave.js +14 -14
- package/dist/composables/validators/useUnsubscribeBlockValidator.js +26 -17
- package/dist/config/compiler/htmlCompilerRules.js +38 -10
- package/dist/config/compiler/recommendationCompilerRules.js +83 -108
- package/dist/config/compiler/utils/recommendationCompilerUtils.js +58 -57
- package/dist/config/compiler/utils/recommendationIgnoreUtils.js +15 -0
- package/dist/config/migrator/recommendation/extractors.js +44 -22
- package/dist/config/migrator/recommendation/htmlBuilder.js +175 -169
- package/dist/config/migrator/recommendationMigrator.js +30 -31
- package/dist/extensions/Blocks/Recommendation/block.js +4 -1
- package/dist/extensions/Blocks/Recommendation/constants/selectors.js +26 -20
- package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +176 -145
- package/dist/extensions/Blocks/Recommendation/controls/main/index.js +58 -57
- package/dist/extensions/Blocks/Recommendation/controls/main/layoutOrientation.js +43 -31
- package/dist/extensions/Blocks/Recommendation/controls/main/productCount.js +3 -2
- package/dist/extensions/Blocks/Recommendation/controls/main/productLayout.js +55 -45
- package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +60 -53
- package/dist/extensions/Blocks/Recommendation/controls/syncInfoMessage.js +7 -6
- package/dist/extensions/Blocks/Recommendation/extension.js +3 -2
- package/dist/extensions/Blocks/Recommendation/settingsPanel.js +3 -2
- package/dist/extensions/Blocks/Recommendation/store/recommendation.js +3 -2
- package/dist/extensions/Blocks/Recommendation/templates/grid/template.js +13 -12
- package/dist/extensions/Blocks/Recommendation/templates/index.js +7 -6
- package/dist/extensions/Blocks/Recommendation/templates/utils.js +1 -1
- package/dist/extensions/Blocks/Unsubscribe/block.js +40 -37
- package/dist/extensions/Blocks/Unsubscribe/control.js +19 -16
- package/dist/extensions/Blocks/controlFactories.js +76 -57
- package/dist/guido.css +1 -1
- package/dist/src/composables/useHtmlValidator.d.ts +27 -0
- package/dist/src/composables/useHtmlValidator.test.d.ts +1 -0
- package/dist/src/composables/usePreviewInteractionGuard.d.ts +3 -0
- package/dist/src/composables/validators/useUnsubscribeBlockValidator.d.ts +1 -0
- package/dist/src/config/compiler/utils/recommendationIgnoreUtils.d.ts +17 -0
- package/dist/src/config/compiler/utils/recommendationIgnoreUtils.test.d.ts +1 -0
- package/dist/src/config/migrator/recommendation/extractors.d.ts +15 -0
- package/dist/src/config/migrator/recommendation/htmlBuilder.d.ts +8 -0
- package/dist/src/extensions/Blocks/CouponBlock/controls/index.d.ts +1 -1
- package/dist/src/extensions/Blocks/Items/controls/index.d.ts +3 -3
- package/dist/src/extensions/Blocks/Recommendation/constants/index.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/constants/selectors.d.ts +21 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/cardComposition/index.d.ts +7 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/main/layoutOrientation.d.ts +5 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/main/productLayout.d.ts +6 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/main/utils.d.ts +9 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/name/index.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/controls/oldPrice/index.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/controls/omnibusDiscount/index.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/controls/omnibusPrice/index.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/controls/price/index.d.ts +1 -1
- package/dist/src/extensions/Blocks/controlFactories.d.ts +10 -1
- package/dist/src/stores/unsubscribe.d.ts +11 -1
- package/dist/src/utils/ampErrorFilter.d.ts +1 -0
- package/dist/stores/unsubscribe.js +8 -7
- package/dist/utils/ampErrorFilter.js +6 -5
- package/package.json +1 -1
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { BlockId as f } from "../../enums/block.js";
|
|
2
|
-
import { useTemplateStore as
|
|
3
|
-
import { mapComposition as
|
|
4
|
-
import { extractTitleText as
|
|
5
|
-
import { buildBlockHtml as
|
|
6
|
-
import { parseRecommendationId as
|
|
7
|
-
import { mapSettings as
|
|
2
|
+
import { useTemplateStore as b } from "../../stores/template.js";
|
|
3
|
+
import { mapComposition as y } from "./recommendation/compositionMapper.js";
|
|
4
|
+
import { extractCurrencyFromBlock as v, extractTitleText as C, extractCardBgColor as M, isPartnerManagedBlock as S } from "./recommendation/extractors.js";
|
|
5
|
+
import { buildBlockHtml as w } from "./recommendation/htmlBuilder.js";
|
|
6
|
+
import { parseRecommendationId as x, parseLegacyConfig as R } from "./recommendation/parseLegacyConfig.js";
|
|
7
|
+
import { mapSettings as T } from "./recommendation/settingsMapper.js";
|
|
8
8
|
const h = 'td[esd-dev-product-config][class*="ins-recommendation-v3-block-"]:not(.recommendation-block-v2), td.product-block[esd-handler-name*="EmailRecommendationV3"][esd-dev-product-config]:not(.recommendation-block-v2)';
|
|
9
|
-
function
|
|
10
|
-
var
|
|
11
|
-
const o =
|
|
9
|
+
function B(i, t, a) {
|
|
10
|
+
var d;
|
|
11
|
+
const o = x(t);
|
|
12
12
|
if (o === null)
|
|
13
13
|
return console.warn(
|
|
14
14
|
"[RecommendationMigrator] Skipping block — missing/invalid `ins-recommendation-v3-campaign-id`"
|
|
@@ -18,30 +18,29 @@ function x(i, t, c) {
|
|
|
18
18
|
return console.warn(
|
|
19
19
|
`[RecommendationMigrator] Aborting block id=${o} — \`esd-dev-product-config\` missing or unable to be parsed`
|
|
20
20
|
), !1;
|
|
21
|
-
const n =
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
), !1;
|
|
26
|
-
const a = S(n, r, o), e = b((s = r.composition) == null ? void 0 : s.variables), d = y(t), l = C(t), g = {
|
|
27
|
-
...a,
|
|
21
|
+
const n = a[String(o)] ?? {
|
|
22
|
+
currencySettings: v(t)
|
|
23
|
+
}, c = T(n, r, o), e = y((d = r.composition) == null ? void 0 : d.variables), l = C(t), g = M(t), p = {
|
|
24
|
+
...c,
|
|
28
25
|
composition: e.composition,
|
|
29
26
|
visibility: e.visibility,
|
|
30
27
|
textTrimming: e.anyTextTrimming
|
|
31
|
-
},
|
|
28
|
+
}, m = S(t), u = `
|
|
32
29
|
<table>
|
|
33
30
|
<tbody>
|
|
34
31
|
<tr>
|
|
35
32
|
<td class="esd-structure" align="left">
|
|
36
33
|
<table width="100%" cellpadding="0" cellspacing="0">
|
|
37
34
|
<tbody>
|
|
38
|
-
<tr>${
|
|
39
|
-
nodeConfig:
|
|
35
|
+
<tr>${w({
|
|
36
|
+
nodeConfig: p,
|
|
40
37
|
composition: e,
|
|
41
|
-
cardBg:
|
|
42
|
-
titleText:
|
|
38
|
+
cardBg: g,
|
|
39
|
+
titleText: l,
|
|
43
40
|
legacyId: t.getAttribute("id") ?? void 0,
|
|
44
|
-
legacyBgColor: t.getAttribute("bgcolor") ?? void 0
|
|
41
|
+
legacyBgColor: t.getAttribute("bgcolor") ?? void 0,
|
|
42
|
+
preserveInnerHtml: m ? t.innerHTML : void 0,
|
|
43
|
+
skipCompile: m
|
|
45
44
|
})}</tr>
|
|
46
45
|
</tbody>
|
|
47
46
|
</table>
|
|
@@ -49,15 +48,15 @@ function x(i, t, c) {
|
|
|
49
48
|
</tr>
|
|
50
49
|
</tbody>
|
|
51
50
|
</table>
|
|
52
|
-
`,
|
|
53
|
-
return !
|
|
51
|
+
`, s = i.parseFromString(u, "text/html").querySelector("td.esd-structure");
|
|
52
|
+
return !s || !t.parentNode ? (console.warn(
|
|
54
53
|
`[RecommendationMigrator] Aborting block id=${o} — failed to construct new HTML element`
|
|
55
|
-
), !1) : (t.parentNode.replaceChild(
|
|
54
|
+
), !1) : (t.parentNode.replaceChild(s, t), !0);
|
|
56
55
|
}
|
|
57
|
-
function
|
|
58
|
-
const
|
|
56
|
+
function q(i, t = {}) {
|
|
57
|
+
const a = new DOMParser(), o = a.parseFromString(i, "text/html"), r = Array.from(o.querySelectorAll(h));
|
|
59
58
|
try {
|
|
60
|
-
|
|
59
|
+
b().$patch((e) => {
|
|
61
60
|
e.migrations = {
|
|
62
61
|
...e.migrations,
|
|
63
62
|
[f.Recommendation]: r.length
|
|
@@ -68,14 +67,14 @@ function I(i, t = {}) {
|
|
|
68
67
|
if (r.length === 0)
|
|
69
68
|
return i;
|
|
70
69
|
let n = 0;
|
|
71
|
-
return r.forEach((
|
|
70
|
+
return r.forEach((c) => {
|
|
72
71
|
try {
|
|
73
|
-
|
|
72
|
+
B(a, c, t) && (n += 1);
|
|
74
73
|
} catch (e) {
|
|
75
74
|
console.error("[RecommendationMigrator] Unexpected error migrating block:", e);
|
|
76
75
|
}
|
|
77
76
|
}), n > 0 && console.info(`[RecommendationMigrator] Migrated ${n} legacy Recommendation block(s)`), o.documentElement.outerHTML;
|
|
78
77
|
}
|
|
79
78
|
export {
|
|
80
|
-
|
|
79
|
+
q as migrateRecommendation
|
|
81
80
|
};
|
|
@@ -48,8 +48,11 @@ class H extends D {
|
|
|
48
48
|
allowInnerBlocksDND() {
|
|
49
49
|
return !1;
|
|
50
50
|
}
|
|
51
|
+
// A saved module carries its config in the esd-config blob, restored on
|
|
52
|
+
// re-drop by migrateFromDataAttributes; per-element styles ride the
|
|
53
|
+
// preserved inner HTML. (onCreated early-returns for re-drops, never clobbers.)
|
|
51
54
|
canBeSavedAsModule() {
|
|
52
|
-
return !
|
|
55
|
+
return !0;
|
|
53
56
|
}
|
|
54
57
|
/**
|
|
55
58
|
* Returns the template HTML for a new recommendation block.
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
const
|
|
1
|
+
const c = ".recommendation-block-v2", t = ".ins-recommendation-product-container", o = ".ins-recommendation-desktop-container", n = ".ins-recommendation-mobile-container", _ = ".ins-recommendation-mobile-row", r = "reco-v3-button", R = "ins-skip-compile", e = {
|
|
2
2
|
CURRENCY: "currency",
|
|
3
3
|
SYMBOL: "currency-symbol",
|
|
4
4
|
ALIGNMENT: "currency-alignment",
|
|
5
5
|
THOUSAND_SEPARATOR: "currency-thousand-separator",
|
|
6
6
|
DECIMAL_SEPARATOR: "currency-decimal-separator",
|
|
7
7
|
DECIMAL_COUNT: "currency-decimal-count"
|
|
8
|
-
},
|
|
8
|
+
}, O = "productImage", s = "productName", E = "productPrice", i = "productOldPrice", A = "productOmnibusPrice", C = "productOmnibusDiscount", u = "productButton", I = "customAttr:", S = "data-custom-attributes", m = "product-attr", U = "product_attribute.", T = /* @__PURE__ */ new Set([
|
|
9
9
|
"name",
|
|
10
10
|
// productName
|
|
11
11
|
"price",
|
|
@@ -20,25 +20,31 @@ const T = ".recommendation-block-v2", c = ".ins-recommendation-product-container
|
|
|
20
20
|
// productOmnibusPrice
|
|
21
21
|
"omnibus_discount"
|
|
22
22
|
// productOmnibusDiscount
|
|
23
|
+
]), a = /* @__PURE__ */ new Set([
|
|
24
|
+
...T,
|
|
25
|
+
"currency",
|
|
26
|
+
"discount"
|
|
23
27
|
]);
|
|
24
28
|
export {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
29
|
+
I as ATTR_CUSTOM_PREFIX,
|
|
30
|
+
S as ATTR_DATA_CUSTOM_ATTRIBUTES,
|
|
31
|
+
m as ATTR_PRODUCT_ATTR,
|
|
32
|
+
u as ATTR_PRODUCT_BUTTON,
|
|
33
|
+
O as ATTR_PRODUCT_IMAGE,
|
|
34
|
+
s as ATTR_PRODUCT_NAME,
|
|
35
|
+
i as ATTR_PRODUCT_OLD_PRICE,
|
|
36
|
+
C as ATTR_PRODUCT_OMNIBUS_DISCOUNT,
|
|
37
|
+
A as ATTR_PRODUCT_OMNIBUS_PRICE,
|
|
38
|
+
E as ATTR_PRODUCT_PRICE,
|
|
39
|
+
c as BLOCK_ROOT_SELECTOR,
|
|
40
|
+
T as BUILT_IN_DEFAULT_ATTRIBUTES,
|
|
41
|
+
t as CONTAINER_SELECTOR,
|
|
38
42
|
r as CSS_CLASS_RECO_BUTTON,
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
o as
|
|
42
|
-
n as
|
|
43
|
-
|
|
43
|
+
R as CSS_CLASS_SKIP_COMPILE,
|
|
44
|
+
e as CURRENCY_ATTR,
|
|
45
|
+
o as DESKTOP_CONTAINER_SELECTOR,
|
|
46
|
+
n as MOBILE_CONTAINER_SELECTOR,
|
|
47
|
+
_ as MOBILE_ROW_SELECTOR,
|
|
48
|
+
U as PRODUCT_ATTRIBUTE_PREFIX,
|
|
49
|
+
a as RECOMMENDATION_VARIABLE_BUILTIN_ATTRIBUTES
|
|
44
50
|
};
|