@useinsider/guido 3.2.0 → 3.3.0
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 +117 -1
- package/dist/@types/config/schemas.js +153 -95
- package/dist/components/Guido.vue.js +4 -4
- package/dist/components/Guido.vue2.js +90 -88
- package/dist/components/organisms/AutoSaveController.vue.js +17 -0
- package/dist/components/organisms/AutoSaveController.vue2.js +13 -0
- package/dist/components/organisms/header/AutoSaveToggle.vue.js +22 -0
- package/dist/components/organisms/header/AutoSaveToggle.vue2.js +19 -0
- package/dist/components/organisms/header/RightSlot.vue.js +8 -8
- package/dist/components/organisms/header/RightSlot.vue2.js +9 -8
- package/dist/components/organisms/onboarding/AMPOnboarding.vue2.js +51 -31
- package/dist/components/organisms/onboarding/GenericOnboarding.vue.js +1 -1
- package/dist/components/organisms/onboarding/GenericOnboarding.vue2.js +23 -22
- package/dist/components/organisms/onboarding/ItemsOnboarding.vue.js +1 -1
- package/dist/components/organisms/onboarding/ItemsOnboarding.vue2.js +37 -39
- package/dist/components/organisms/onboarding/TextBlockOnboarding.vue.js +3 -3
- package/dist/components/organisms/onboarding/TextBlockOnboarding.vue2.js +30 -41
- package/dist/components/organisms/onboarding/VersionHistoryOnboarding.vue2.js +15 -14
- package/dist/composables/useActionsApi.js +4 -4
- package/dist/composables/useAutoSave.js +71 -0
- package/dist/composables/useFullStoryBridge.js +14 -0
- package/dist/composables/useRecommendation.js +46 -26
- package/dist/composables/useRibbonOffset.js +21 -0
- package/dist/composables/useSave.js +19 -16
- package/dist/composables/useStripo.js +40 -40
- package/dist/composables/validators/useCouponBlockValidator.js +24 -0
- package/dist/config/compiler/recommendationCompilerRules.js +79 -74
- package/dist/config/compiler/unsubscribeCompilerRules.js +40 -37
- package/dist/config/compiler/utils/recommendationCompilerUtils.js +107 -71
- package/dist/config/migrator/index.js +9 -9
- package/dist/config/migrator/radioButtonMigrator.js +64 -44
- package/dist/config/migrator/recommendation/compositionMapper.js +98 -0
- package/dist/config/migrator/recommendation/extractors.js +27 -0
- package/dist/config/migrator/recommendation/htmlBuilder.js +496 -0
- package/dist/config/migrator/recommendation/parseLegacyConfig.js +33 -0
- package/dist/config/migrator/recommendation/settingsMapper.js +70 -0
- package/dist/config/migrator/recommendation/themeMapper.js +93 -0
- package/dist/config/migrator/recommendationMigrator.js +74 -290
- package/dist/enums/extensions/recommendationBlock.js +2 -1
- package/dist/enums/onboarding.js +7 -2
- package/dist/enums/unsubscribe.js +34 -27
- package/dist/extensions/Blocks/Items/controls/price/singlePrice.js +38 -38
- package/dist/extensions/Blocks/Items/enums/productEnums.js +19 -7
- package/dist/extensions/Blocks/RadioButton/template.js +1 -1
- package/dist/extensions/Blocks/Recommendation/block.js +35 -32
- package/dist/extensions/Blocks/Recommendation/constants/controlIds.js +1 -1
- package/dist/extensions/Blocks/Recommendation/constants/defaultConfig.js +5 -5
- package/dist/extensions/Blocks/Recommendation/controls/customAttribute/index.js +21 -18
- package/dist/extensions/Blocks/Recommendation/controls/customAttribute/textTrim.js +99 -0
- package/dist/extensions/Blocks/Recommendation/controls/main/algorithm.js +27 -26
- package/dist/extensions/Blocks/Recommendation/controls/main/index.js +3 -1
- package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +228 -181
- package/dist/extensions/Blocks/Recommendation/controls/name/textTrim.js +27 -57
- package/dist/extensions/Blocks/Recommendation/controls/shared/textTrimCssRules.js +14 -0
- package/dist/extensions/Blocks/Recommendation/services/configService.js +65 -29
- package/dist/extensions/Blocks/Recommendation/settingsPanel.js +18 -17
- package/dist/extensions/Blocks/Recommendation/store/recommendation.js +123 -79
- package/dist/extensions/Blocks/Recommendation/templates/grid/elementRenderer.js +19 -10
- package/dist/extensions/Blocks/Recommendation/templates/grid/template.js +8 -8
- package/dist/extensions/Blocks/Recommendation/templates/list/elementRenderer.js +25 -15
- package/dist/extensions/Blocks/Recommendation/templates/list/template.js +11 -11
- package/dist/extensions/Blocks/Recommendation/templates/utils.js +1 -1
- package/dist/extensions/Blocks/Recommendation/utils/filterUtil.js +17 -14
- package/dist/extensions/Blocks/Recommendation/utils/legacyStrategyMap.js +21 -0
- package/dist/extensions/Blocks/Recommendation/utils/preserveTextStyles.js +13 -22
- package/dist/extensions/Blocks/Unsubscribe/block.js +11 -11
- package/dist/guido.css +1 -1
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js +393 -264
- package/dist/node_modules/valibot/dist/index.js +450 -235
- package/dist/package.json.js +1 -1
- package/dist/services/templateLibraryApi.js +5 -4
- package/dist/src/@types/config/defaults.d.ts +5 -1
- package/dist/src/@types/config/index.d.ts +3 -3
- package/dist/src/@types/config/schemas.d.ts +217 -0
- package/dist/src/@types/config/types.d.ts +9 -1
- package/dist/src/components/Guido.vue.d.ts +1 -1
- package/dist/src/components/organisms/AutoSaveController.vue.d.ts +2 -0
- package/dist/src/components/organisms/header/AutoSaveToggle.vue.d.ts +2 -0
- package/dist/src/components/organisms/header/EditorActions.vue.d.ts +1 -1
- package/dist/src/components/organisms/header/HeaderWrapper.vue.d.ts +1 -1
- package/dist/src/components/organisms/header/RightSlot.vue.d.ts +1 -1
- package/dist/src/components/wrappers/WpModal.vue.d.ts +1 -1
- package/dist/src/composables/useActionsApi.d.ts +1 -1
- package/dist/src/composables/useAutoSave.d.ts +3 -0
- package/dist/src/composables/useConfig.d.ts +58 -0
- package/dist/src/composables/useFullStoryBridge.d.ts +11 -0
- package/dist/src/composables/useRecommendation.d.ts +10 -1
- package/dist/src/composables/useRecommendation.test.d.ts +1 -0
- package/dist/src/composables/useRibbonOffset.d.ts +4 -0
- package/dist/src/composables/useSave.d.ts +1 -1
- package/dist/src/composables/validators/useCouponBlockValidator.d.ts +3 -0
- package/dist/src/config/migrator/index.d.ts +2 -1
- package/dist/src/config/migrator/recommendation/compositionMapper.d.ts +2 -0
- package/dist/src/config/migrator/recommendation/compositionMapper.test.d.ts +1 -0
- package/dist/src/config/migrator/recommendation/extractors.d.ts +7 -0
- package/dist/src/config/migrator/recommendation/extractors.test.d.ts +1 -0
- package/dist/src/config/migrator/recommendation/htmlBuilder.d.ts +11 -0
- package/dist/src/config/migrator/recommendation/parseLegacyConfig.d.ts +15 -0
- package/dist/src/config/migrator/recommendation/parseLegacyConfig.test.d.ts +1 -0
- package/dist/src/config/migrator/recommendation/settingsMapper.d.ts +7 -0
- package/dist/src/config/migrator/recommendation/settingsMapper.test.d.ts +1 -0
- package/dist/src/config/migrator/recommendation/themeMapper.d.ts +5 -0
- package/dist/src/config/migrator/recommendation/themeMapper.test.d.ts +1 -0
- package/dist/src/config/migrator/recommendation/types.d.ts +205 -0
- package/dist/src/config/migrator/recommendationMigrator.d.ts +13 -1
- package/dist/src/config/migrator/recommendationMigrator.test.d.ts +1 -0
- package/dist/src/enums/onboarding.d.ts +6 -0
- package/dist/src/enums/unsubscribe.d.ts +5 -0
- package/dist/src/extensions/Blocks/RadioButton/template.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/constants/controlIds.d.ts +1 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/customAttribute/index.d.ts +3 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/customAttribute/textTrim.d.ts +35 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/main/utils.test.d.ts +1 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/name/textTrim.d.ts +3 -20
- package/dist/src/extensions/Blocks/Recommendation/controls/shared/textTrimCssRules.d.ts +29 -0
- package/dist/src/extensions/Blocks/Recommendation/services/configService.d.ts +10 -0
- package/dist/src/extensions/Blocks/Recommendation/services/configService.test.d.ts +1 -0
- package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +34 -0
- package/dist/src/extensions/Blocks/Recommendation/types/nodeConfig.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/utils/legacyStrategyMap.d.ts +21 -0
- package/dist/src/extensions/Blocks/Recommendation/utils/legacyStrategyMap.test.d.ts +1 -0
- package/dist/src/extensions/Blocks/Recommendation/utils/preserveTextStyles.d.ts +0 -3
- package/dist/src/library.d.ts +1 -1
- package/dist/src/stores/autosave.d.ts +12 -0
- package/dist/src/stores/config.d.ts +522 -0
- package/dist/src/stores/editor.d.ts +23 -0
- package/dist/src/stores/onboarding.d.ts +4 -0
- package/dist/src/utils/htmlEscape.d.ts +5 -0
- package/dist/src/utils/htmlEscape.test.d.ts +1 -0
- package/dist/src/utils/timeUtil.d.ts +8 -0
- package/dist/static/styles/components/button.css.js +16 -9
- package/dist/static/styles/components/loader.css.js +4 -0
- package/dist/static/styles/components/narrow-panel.css.js +52 -0
- package/dist/stores/autosave.js +17 -0
- package/dist/stores/editor.js +3 -1
- package/dist/stores/onboarding.js +4 -0
- package/dist/utils/htmlEscape.js +13 -0
- package/dist/utils/pairProductVariables.js +89 -88
- package/dist/utils/templatePreparation.js +72 -32
- package/dist/utils/timeUtil.js +19 -0
- package/package.json +7 -3
- package/dist/enums/displayConditions.js +0 -80
- package/dist/extensions/Blocks/Recommendation/templates/grid/migration.js +0 -251
- package/dist/src/enums/displayConditions.d.ts +0 -2
|
@@ -1,180 +1,184 @@
|
|
|
1
1
|
import { ModificationDescription as p } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
2
2
|
import { RecommendationBlockId as m } from "../../constants/blockIds.js";
|
|
3
|
-
import { MOBILE_CONTAINER_SELECTOR as
|
|
3
|
+
import { MOBILE_CONTAINER_SELECTOR as q, MOBILE_ROW_SELECTOR as k, CURRENCY_ATTR as y, DESKTOP_CONTAINER_SELECTOR as P, CONTAINER_SELECTOR as v, ATTR_PRODUCT_ATTR as W } from "../../constants/selectors.js";
|
|
4
4
|
import { RecommendationConfigService as E } from "../../services/configService.js";
|
|
5
5
|
import { useRecommendationExtensionStore as C } from "../../store/recommendation.js";
|
|
6
|
-
import { prepareProductRows as
|
|
7
|
-
import { formatPrice as
|
|
8
|
-
import { isTdNode as
|
|
9
|
-
import { getDefaultProducts as L, DEFAULT_CARD_COMPOSITION as R, sanitizeImageUrl as
|
|
10
|
-
const
|
|
11
|
-
function
|
|
6
|
+
import { prepareProductRows as _ } from "../../templates/index.js";
|
|
7
|
+
import { formatPrice as j } from "../../utils/priceFormatter.js";
|
|
8
|
+
import { isTdNode as F } from "../../utils/tagName.js";
|
|
9
|
+
import { getDefaultProducts as L, DEFAULT_CARD_COMPOSITION as R, sanitizeImageUrl as V } from "../../templates/utils.js";
|
|
10
|
+
const M = "recommendation-block-v2";
|
|
11
|
+
function h(t) {
|
|
12
12
|
if (!t)
|
|
13
13
|
return null;
|
|
14
14
|
if ("getAttribute" in t) {
|
|
15
15
|
const e = t.getAttribute("class");
|
|
16
|
-
if (e && e.includes(
|
|
16
|
+
if (e && e.includes(M))
|
|
17
17
|
return t;
|
|
18
18
|
}
|
|
19
|
-
return "querySelector" in t ? t.querySelector(`.${
|
|
19
|
+
return "querySelector" in t ? t.querySelector(`.${M}`) ?? null : null;
|
|
20
20
|
}
|
|
21
|
-
function
|
|
22
|
-
const e =
|
|
21
|
+
function b(t) {
|
|
22
|
+
const e = h(t);
|
|
23
23
|
if (!e || !("getAttribute" in e))
|
|
24
24
|
return "grid";
|
|
25
25
|
const o = e.getAttribute("data-layout");
|
|
26
26
|
return o === "list" || o === "horizontal" ? "list" : "grid";
|
|
27
27
|
}
|
|
28
|
-
function
|
|
29
|
-
const e =
|
|
28
|
+
function x(t) {
|
|
29
|
+
const e = h(t);
|
|
30
30
|
if (!e || !("getAttribute" in e))
|
|
31
31
|
return R;
|
|
32
32
|
const o = e.getAttribute("data-card-composition");
|
|
33
33
|
return o ? o.split(",").filter(Boolean) : R;
|
|
34
34
|
}
|
|
35
|
-
function
|
|
36
|
-
if (!
|
|
37
|
-
return
|
|
38
|
-
const
|
|
39
|
-
(
|
|
35
|
+
function D(t) {
|
|
36
|
+
if (!t || !("childNodes" in t))
|
|
37
|
+
return null;
|
|
38
|
+
const e = t.childNodes(), o = e.find(
|
|
39
|
+
(n) => "getType" in n && n.getType() === "text"
|
|
40
40
|
);
|
|
41
|
-
return
|
|
41
|
+
return o || e.reduce((n, i) => n || !("getType" in i) || i.getType() === "text" ? n : D(i), null);
|
|
42
|
+
}
|
|
43
|
+
function S(t, e, o) {
|
|
44
|
+
const n = D(e);
|
|
45
|
+
return n ? (t.modifyHtml(n).setText(o), !0) : !1;
|
|
42
46
|
}
|
|
43
|
-
function
|
|
47
|
+
function U(t, e) {
|
|
44
48
|
return t && t.length > 0 ? t : e.length > 0 ? e : L();
|
|
45
49
|
}
|
|
46
|
-
function
|
|
50
|
+
function G(t) {
|
|
47
51
|
const { currentNode: e, documentModifier: o } = t;
|
|
48
52
|
if (!e || !("querySelector" in e))
|
|
49
53
|
return;
|
|
50
54
|
const n = e.querySelector(k);
|
|
51
55
|
n && (o.modifyHtml(n).setInnerHtml(""), o.apply(new p("Cleared mobile row content")));
|
|
52
56
|
}
|
|
53
|
-
function
|
|
57
|
+
function Y(t) {
|
|
54
58
|
const {
|
|
55
59
|
currentNode: e,
|
|
56
60
|
documentModifier: o,
|
|
57
61
|
products: n,
|
|
58
62
|
layout: i,
|
|
59
|
-
composition:
|
|
63
|
+
composition: c
|
|
60
64
|
} = t;
|
|
61
65
|
if (!e || !("querySelector" in e))
|
|
62
66
|
return;
|
|
63
|
-
const r = i ??
|
|
64
|
-
if (r === "list" || !
|
|
65
|
-
|
|
67
|
+
const r = i ?? b(e), s = E.getConfig(e);
|
|
68
|
+
if (r === "list" || !s.mobileLayoutEnabled) {
|
|
69
|
+
G({ currentNode: e, documentModifier: o });
|
|
66
70
|
return;
|
|
67
71
|
}
|
|
68
|
-
const
|
|
69
|
-
if (!
|
|
72
|
+
const u = e.querySelector(k);
|
|
73
|
+
if (!u)
|
|
70
74
|
return;
|
|
71
|
-
const
|
|
72
|
-
productsPerRow:
|
|
73
|
-
composition:
|
|
74
|
-
filterList:
|
|
75
|
+
const l = C(), d = U(n, l.recommendationProducts), a = c ?? x(e), g = `<td><table class="ins-recommendation-product-container ins-recommendation-mobile-container" width="100%" cellpadding="0" cellspacing="0" border="0">${_(d, r, {
|
|
76
|
+
productsPerRow: s.mobileCardsInRow,
|
|
77
|
+
composition: a,
|
|
78
|
+
filterList: l.filterList
|
|
75
79
|
})}</table></td>`;
|
|
76
|
-
o.modifyHtml(
|
|
80
|
+
o.modifyHtml(u).setInnerHtml(g), o.apply(new p("Updated mobile product rows"));
|
|
77
81
|
}
|
|
78
|
-
function
|
|
82
|
+
function K(t) {
|
|
79
83
|
const {
|
|
80
84
|
currentNode: e,
|
|
81
85
|
documentModifier: o,
|
|
82
86
|
afterRegenerate: n,
|
|
83
87
|
products: i,
|
|
84
|
-
layout:
|
|
88
|
+
layout: c,
|
|
85
89
|
composition: r
|
|
86
90
|
} = t;
|
|
87
91
|
if (!e || !("querySelector" in e))
|
|
88
92
|
return;
|
|
89
|
-
const
|
|
90
|
-
if (!
|
|
93
|
+
const s = e.querySelector(P) ?? e.querySelector(v);
|
|
94
|
+
if (!s)
|
|
91
95
|
return;
|
|
92
|
-
const
|
|
93
|
-
productsPerRow:
|
|
94
|
-
composition:
|
|
95
|
-
filterList:
|
|
96
|
+
const u = C(), l = U(i, u.recommendationProducts), { cardsInRow: d } = u.recommendationConfigs, a = r ?? x(e), f = c ?? b(e), g = _(l, f, {
|
|
97
|
+
productsPerRow: d,
|
|
98
|
+
composition: a,
|
|
99
|
+
filterList: u.filterList
|
|
96
100
|
});
|
|
97
|
-
o.modifyHtml(
|
|
101
|
+
o.modifyHtml(s).setInnerHtml(g).apply(new p("Updated product")), Y(t), n == null || n();
|
|
98
102
|
}
|
|
99
|
-
function
|
|
100
|
-
const
|
|
103
|
+
function T(t, e, o, n) {
|
|
104
|
+
const c = `0 ${Math.floor(o / 2)}px`;
|
|
101
105
|
let r = !1;
|
|
102
106
|
return n === "grid" ? Array.from(
|
|
103
107
|
t.querySelectorAll(".attribute-cell")
|
|
104
|
-
).forEach((
|
|
105
|
-
e.modifyHtml(
|
|
108
|
+
).forEach((u) => {
|
|
109
|
+
e.modifyHtml(u).setStyle("padding", c), r = !0;
|
|
106
110
|
}) : Array.from(
|
|
107
111
|
t.querySelectorAll(".product-card-wrapper")
|
|
108
|
-
).forEach((
|
|
109
|
-
const
|
|
110
|
-
|
|
112
|
+
).forEach((u) => {
|
|
113
|
+
const l = "parentNode" in u ? u.parentNode : null;
|
|
114
|
+
l && F(l) && (e.modifyHtml(l).setStyle("padding", c), r = !0);
|
|
111
115
|
}), r;
|
|
112
116
|
}
|
|
113
|
-
function
|
|
117
|
+
function I(t, e, o) {
|
|
114
118
|
const n = `${o}px`, i = Array.from(t.querySelectorAll(".spacer"));
|
|
115
|
-
let
|
|
119
|
+
let c = !1;
|
|
116
120
|
return i.forEach((r) => {
|
|
117
|
-
e.modifyHtml(r).setStyle("height", n),
|
|
118
|
-
}),
|
|
121
|
+
e.modifyHtml(r).setStyle("height", n), c = !0;
|
|
122
|
+
}), c;
|
|
119
123
|
}
|
|
120
|
-
function
|
|
124
|
+
function X(t) {
|
|
121
125
|
const { currentNode: e, documentModifier: o } = t;
|
|
122
126
|
if (!e)
|
|
123
127
|
return;
|
|
124
|
-
const n = E.getConfig(e), i =
|
|
125
|
-
let
|
|
126
|
-
const r = e.querySelector(
|
|
128
|
+
const n = E.getConfig(e), i = b(e);
|
|
129
|
+
let c = !1;
|
|
130
|
+
const r = e.querySelector(P);
|
|
127
131
|
if (r) {
|
|
128
|
-
|
|
132
|
+
c = T(
|
|
129
133
|
r,
|
|
130
134
|
o,
|
|
131
135
|
n.columnSpacing,
|
|
132
136
|
i
|
|
133
137
|
);
|
|
134
|
-
const
|
|
138
|
+
const l = I(
|
|
135
139
|
r,
|
|
136
140
|
o,
|
|
137
141
|
n.rowSpacing
|
|
138
142
|
);
|
|
139
|
-
|
|
143
|
+
c = c || l;
|
|
140
144
|
}
|
|
141
|
-
const
|
|
142
|
-
if (
|
|
143
|
-
const
|
|
144
|
-
|
|
145
|
+
const s = e.querySelector(q);
|
|
146
|
+
if (s) {
|
|
147
|
+
const u = T(
|
|
148
|
+
s,
|
|
145
149
|
o,
|
|
146
150
|
n.mobileColumnSpacing,
|
|
147
151
|
i
|
|
148
152
|
);
|
|
149
|
-
|
|
150
|
-
const
|
|
151
|
-
|
|
153
|
+
c = c || u;
|
|
154
|
+
const l = I(
|
|
155
|
+
s,
|
|
152
156
|
o,
|
|
153
157
|
n.mobileRowSpacing
|
|
154
158
|
);
|
|
155
|
-
|
|
159
|
+
c = c || l;
|
|
156
160
|
}
|
|
157
|
-
|
|
161
|
+
c && o.apply(new p("Reapply spacing after regeneration"));
|
|
158
162
|
}
|
|
159
|
-
function
|
|
160
|
-
const { currentNode: e, documentModifier: o, afterRegenerate: n, products: i, layout:
|
|
161
|
-
e &&
|
|
163
|
+
function se(t) {
|
|
164
|
+
const { currentNode: e, documentModifier: o, afterRegenerate: n, products: i, layout: c, composition: r } = t;
|
|
165
|
+
e && K({
|
|
162
166
|
currentNode: e,
|
|
163
167
|
documentModifier: o,
|
|
164
168
|
products: i,
|
|
165
|
-
layout:
|
|
169
|
+
layout: c,
|
|
166
170
|
composition: r,
|
|
167
171
|
afterRegenerate: () => {
|
|
168
172
|
setTimeout(() => {
|
|
169
|
-
|
|
173
|
+
X({ currentNode: e, documentModifier: o });
|
|
170
174
|
}, 0), n == null || n();
|
|
171
175
|
}
|
|
172
176
|
});
|
|
173
177
|
}
|
|
174
|
-
function
|
|
178
|
+
function ae(t, e) {
|
|
175
179
|
return t.length === e ? t : t.length > e ? t.slice(0, e) : [...t, ...L(e - t.length)];
|
|
176
180
|
}
|
|
177
|
-
function
|
|
181
|
+
function H() {
|
|
178
182
|
const t = C(), { currencySettings: e } = t.recommendationConfigs, o = parseInt(e.decimalCount);
|
|
179
183
|
return {
|
|
180
184
|
code: e.value,
|
|
@@ -186,76 +190,119 @@ function D() {
|
|
|
186
190
|
};
|
|
187
191
|
}
|
|
188
192
|
function A(t, e = "price") {
|
|
189
|
-
const o =
|
|
190
|
-
return
|
|
193
|
+
const o = H(), n = t[e], i = (n == null ? void 0 : n[o.code]) ?? Object.values(n ?? {})[0] ?? 0;
|
|
194
|
+
return j({
|
|
191
195
|
price: i,
|
|
192
196
|
currency: o
|
|
193
197
|
});
|
|
194
198
|
}
|
|
195
|
-
function
|
|
196
|
-
var
|
|
197
|
-
const e =
|
|
199
|
+
function z(t) {
|
|
200
|
+
var c, r;
|
|
201
|
+
const e = H(), o = ((c = t.original_price) == null ? void 0 : c[e.code]) ?? Object.values(t.original_price ?? {})[0] ?? 0, n = ((r = t.price) == null ? void 0 : r[e.code]) ?? Object.values(t.price ?? {})[0] ?? 0, i = o > 0 ? Math.round((o - n) / o * 100) : 0;
|
|
198
202
|
return i > 0 ? `-${i}%` : "0%";
|
|
199
203
|
}
|
|
200
|
-
function
|
|
201
|
-
const { documentModifier: e, product: o, priceEl: n, oldPriceEl: i, omnibusPriceEl:
|
|
202
|
-
let
|
|
204
|
+
function $(t) {
|
|
205
|
+
const { documentModifier: e, product: o, priceEl: n, oldPriceEl: i, omnibusPriceEl: c, omnibusDiscountEl: r } = t;
|
|
206
|
+
let s = !1;
|
|
203
207
|
if (n && "querySelector" in n) {
|
|
204
|
-
const
|
|
205
|
-
|
|
208
|
+
const u = n.querySelector("strong") ?? n.querySelector("p"), l = A(o, "price");
|
|
209
|
+
S(e, u ?? null, l) && (s = !0);
|
|
206
210
|
}
|
|
207
211
|
if (i && "querySelector" in i) {
|
|
208
|
-
const
|
|
209
|
-
|
|
212
|
+
const u = i.querySelector("strong") ?? i.querySelector("p"), l = A(o, "original_price");
|
|
213
|
+
S(e, u ?? null, l) && (s = !0);
|
|
210
214
|
}
|
|
211
|
-
if (
|
|
212
|
-
const
|
|
213
|
-
|
|
215
|
+
if (c && "querySelector" in c) {
|
|
216
|
+
const u = c.querySelector(".omnibus-price-value") ?? null, l = A(o, "original_price");
|
|
217
|
+
S(e, u, l) && (s = !0);
|
|
214
218
|
}
|
|
215
219
|
if (r && "querySelector" in r) {
|
|
216
|
-
const
|
|
217
|
-
|
|
220
|
+
const u = r.querySelector(".omnibus-discount-value") ?? null, l = z(o);
|
|
221
|
+
S(e, u, l) && (s = !0);
|
|
218
222
|
}
|
|
219
|
-
return
|
|
223
|
+
return s;
|
|
220
224
|
}
|
|
221
|
-
function
|
|
225
|
+
function J(t) {
|
|
222
226
|
const {
|
|
223
227
|
documentModifier: e,
|
|
224
228
|
product: o,
|
|
225
229
|
imageEl: n,
|
|
226
230
|
nameEl: i,
|
|
227
|
-
priceEl:
|
|
231
|
+
priceEl: c,
|
|
228
232
|
oldPriceEl: r,
|
|
229
|
-
omnibusPriceEl:
|
|
230
|
-
omnibusDiscountEl:
|
|
231
|
-
buttonEl:
|
|
233
|
+
omnibusPriceEl: s,
|
|
234
|
+
omnibusDiscountEl: u,
|
|
235
|
+
buttonEl: l
|
|
232
236
|
} = t;
|
|
233
|
-
let
|
|
237
|
+
let d = !1;
|
|
234
238
|
if (n && "querySelector" in n) {
|
|
235
|
-
const
|
|
236
|
-
|
|
237
|
-
const
|
|
238
|
-
|
|
239
|
+
const a = n.querySelector("img");
|
|
240
|
+
a && (e.modifyHtml(a).setAttribute("src", V(o.image_url)).setAttribute("alt", o.name), d = !0);
|
|
241
|
+
const f = n.querySelector("a");
|
|
242
|
+
f && (e.modifyHtml(f).setAttribute("href", o.url), d = !0);
|
|
239
243
|
}
|
|
240
244
|
if (i && "querySelector" in i) {
|
|
241
|
-
const
|
|
242
|
-
|
|
245
|
+
const a = i.querySelector("strong") ?? i.querySelector("p");
|
|
246
|
+
S(e, a ?? null, o.name) && (d = !0);
|
|
243
247
|
}
|
|
244
|
-
if (
|
|
248
|
+
if ($({
|
|
245
249
|
documentModifier: e,
|
|
246
250
|
product: o,
|
|
247
|
-
priceEl:
|
|
251
|
+
priceEl: c,
|
|
248
252
|
oldPriceEl: r,
|
|
249
|
-
omnibusPriceEl:
|
|
250
|
-
omnibusDiscountEl:
|
|
251
|
-
}) && (
|
|
252
|
-
const
|
|
253
|
-
|
|
253
|
+
omnibusPriceEl: s,
|
|
254
|
+
omnibusDiscountEl: u
|
|
255
|
+
}) && (d = !0), l && "querySelector" in l) {
|
|
256
|
+
const a = l.querySelector("a.es-button") || l.querySelector("a");
|
|
257
|
+
a && (e.modifyHtml(a).setAttribute("href", o.url), d = !0);
|
|
254
258
|
}
|
|
255
|
-
return
|
|
259
|
+
return d;
|
|
260
|
+
}
|
|
261
|
+
function B(t) {
|
|
262
|
+
return "querySelector" in t ? t.querySelector(P) ?? t : t;
|
|
256
263
|
}
|
|
257
|
-
|
|
258
|
-
|
|
264
|
+
const O = "product_attribute.";
|
|
265
|
+
function Q(t, e) {
|
|
266
|
+
var n;
|
|
267
|
+
let o;
|
|
268
|
+
if (t.startsWith(O)) {
|
|
269
|
+
const i = t.slice(O.length);
|
|
270
|
+
o = (n = e.product_attributes) == null ? void 0 : n[i];
|
|
271
|
+
} else
|
|
272
|
+
o = e[t];
|
|
273
|
+
return typeof o == "string" && o.length > 0 ? o : typeof o == "number" ? String(o) : null;
|
|
274
|
+
}
|
|
275
|
+
function Z(t, e, o) {
|
|
276
|
+
if (!("querySelectorAll" in t))
|
|
277
|
+
return !1;
|
|
278
|
+
const n = t.querySelectorAll(
|
|
279
|
+
`[esd-extension-block-id="${m.CUSTOM_ATTRIBUTE}"]`
|
|
280
|
+
);
|
|
281
|
+
if (n.length === 0)
|
|
282
|
+
return !1;
|
|
283
|
+
const i = /* @__PURE__ */ new Map();
|
|
284
|
+
n.forEach((r) => {
|
|
285
|
+
if (!("getAttribute" in r))
|
|
286
|
+
return;
|
|
287
|
+
const s = r.getAttribute(W);
|
|
288
|
+
if (!s)
|
|
289
|
+
return;
|
|
290
|
+
const u = i.get(s) ?? [];
|
|
291
|
+
u.push(r), i.set(s, u);
|
|
292
|
+
});
|
|
293
|
+
let c = !1;
|
|
294
|
+
return i.forEach((r, s) => {
|
|
295
|
+
const u = Math.min(r.length, o.length);
|
|
296
|
+
r.slice(0, u).forEach((l, d) => {
|
|
297
|
+
if (!("querySelector" in l))
|
|
298
|
+
return;
|
|
299
|
+
const a = Q(s, o[d]);
|
|
300
|
+
if (a === null)
|
|
301
|
+
return;
|
|
302
|
+
const f = l.querySelector("p") ?? null;
|
|
303
|
+
S(e, f, a) && (c = !0);
|
|
304
|
+
});
|
|
305
|
+
}), c;
|
|
259
306
|
}
|
|
260
307
|
function w(t, e, o) {
|
|
261
308
|
if (!("querySelectorAll" in t))
|
|
@@ -264,54 +311,54 @@ function w(t, e, o) {
|
|
|
264
311
|
`[esd-extension-block-id="${m.IMAGE}"]`
|
|
265
312
|
), i = t.querySelectorAll(
|
|
266
313
|
`[esd-extension-block-id="${m.NAME}"]`
|
|
267
|
-
),
|
|
314
|
+
), c = t.querySelectorAll(
|
|
268
315
|
`[esd-extension-block-id="${m.PRICE}"]`
|
|
269
316
|
), r = t.querySelectorAll(
|
|
270
317
|
`[esd-extension-block-id="${m.OLD_PRICE}"]`
|
|
271
|
-
), u = t.querySelectorAll(
|
|
272
|
-
`[esd-extension-block-id="${m.OMNIBUS_PRICE}"]`
|
|
273
318
|
), s = t.querySelectorAll(
|
|
319
|
+
`[esd-extension-block-id="${m.OMNIBUS_PRICE}"]`
|
|
320
|
+
), u = t.querySelectorAll(
|
|
274
321
|
`[esd-extension-block-id="${m.OMNIBUS_DISCOUNT}"]`
|
|
275
|
-
),
|
|
322
|
+
), l = t.querySelectorAll(
|
|
276
323
|
`[esd-extension-block-id="${m.BUTTON}"]`
|
|
277
|
-
),
|
|
278
|
-
let
|
|
279
|
-
for (let
|
|
280
|
-
const
|
|
324
|
+
), d = Math.min(n.length, o.length);
|
|
325
|
+
let a = !1;
|
|
326
|
+
for (let f = 0; f < d; f++) {
|
|
327
|
+
const g = J({
|
|
281
328
|
documentModifier: e,
|
|
282
|
-
product: o[
|
|
283
|
-
imageEl: n[
|
|
284
|
-
nameEl: i[
|
|
285
|
-
priceEl:
|
|
286
|
-
oldPriceEl: r[
|
|
287
|
-
omnibusPriceEl:
|
|
288
|
-
omnibusDiscountEl:
|
|
289
|
-
buttonEl:
|
|
329
|
+
product: o[f],
|
|
330
|
+
imageEl: n[f] ?? null,
|
|
331
|
+
nameEl: i[f] ?? null,
|
|
332
|
+
priceEl: c[f] ?? null,
|
|
333
|
+
oldPriceEl: r[f] ?? null,
|
|
334
|
+
omnibusPriceEl: s[f] ?? null,
|
|
335
|
+
omnibusDiscountEl: u[f] ?? null,
|
|
336
|
+
buttonEl: l[f] ?? null
|
|
290
337
|
});
|
|
291
|
-
|
|
338
|
+
a = a || g;
|
|
292
339
|
}
|
|
293
|
-
return
|
|
340
|
+
return Z(t, e, o) && (a = !0), a;
|
|
294
341
|
}
|
|
295
|
-
function
|
|
342
|
+
function de(t) {
|
|
296
343
|
const { currentNode: e, documentModifier: o, products: n } = t;
|
|
297
344
|
if (!e || !("querySelectorAll" in e))
|
|
298
345
|
return !1;
|
|
299
|
-
const i =
|
|
346
|
+
const i = B(e);
|
|
300
347
|
if (!("querySelectorAll" in i) || i.querySelectorAll(
|
|
301
348
|
`[esd-extension-block-id="${m.IMAGE}"]`
|
|
302
349
|
).length !== n.length)
|
|
303
350
|
return !1;
|
|
304
351
|
let r = w(i, o, n);
|
|
305
|
-
const
|
|
306
|
-
if (
|
|
307
|
-
const
|
|
308
|
-
if (
|
|
309
|
-
const
|
|
310
|
-
|
|
352
|
+
const s = b(e), u = E.getConfig(e);
|
|
353
|
+
if (s !== "list" && u.mobileLayoutEnabled && "querySelector" in e) {
|
|
354
|
+
const l = e.querySelector(q);
|
|
355
|
+
if (l) {
|
|
356
|
+
const d = w(
|
|
357
|
+
l,
|
|
311
358
|
o,
|
|
312
359
|
n
|
|
313
360
|
);
|
|
314
|
-
r = r ||
|
|
361
|
+
r = r || d;
|
|
315
362
|
}
|
|
316
363
|
}
|
|
317
364
|
return r && o.apply(new p("Updated product content in-place")), !0;
|
|
@@ -323,63 +370,63 @@ function N(t, e, o) {
|
|
|
323
370
|
`[esd-extension-block-id="${m.PRICE}"]`
|
|
324
371
|
), i = t.querySelectorAll(
|
|
325
372
|
`[esd-extension-block-id="${m.OLD_PRICE}"]`
|
|
326
|
-
),
|
|
373
|
+
), c = t.querySelectorAll(
|
|
327
374
|
`[esd-extension-block-id="${m.OMNIBUS_PRICE}"]`
|
|
328
375
|
), r = t.querySelectorAll(
|
|
329
376
|
`[esd-extension-block-id="${m.OMNIBUS_DISCOUNT}"]`
|
|
330
|
-
),
|
|
331
|
-
let
|
|
332
|
-
for (let
|
|
333
|
-
|
|
377
|
+
), s = Math.min(n.length, o.length);
|
|
378
|
+
let u = !1;
|
|
379
|
+
for (let l = 0; l < s; l++)
|
|
380
|
+
$({
|
|
334
381
|
documentModifier: e,
|
|
335
|
-
product: o[
|
|
336
|
-
priceEl: n[
|
|
337
|
-
oldPriceEl: i[
|
|
338
|
-
omnibusPriceEl: l
|
|
339
|
-
omnibusDiscountEl: r[
|
|
340
|
-
}) && (
|
|
341
|
-
return
|
|
382
|
+
product: o[l],
|
|
383
|
+
priceEl: n[l] ?? null,
|
|
384
|
+
oldPriceEl: i[l] ?? null,
|
|
385
|
+
omnibusPriceEl: c[l] ?? null,
|
|
386
|
+
omnibusDiscountEl: r[l] ?? null
|
|
387
|
+
}) && (u = !0);
|
|
388
|
+
return u;
|
|
342
389
|
}
|
|
343
|
-
function
|
|
390
|
+
function fe(t) {
|
|
344
391
|
const { currentNode: e, documentModifier: o } = t;
|
|
345
392
|
if (!e || !("querySelectorAll" in e))
|
|
346
393
|
return !1;
|
|
347
394
|
const i = C().recommendationProducts;
|
|
348
395
|
if (i.length === 0)
|
|
349
396
|
return !1;
|
|
350
|
-
const
|
|
351
|
-
let r = N(
|
|
352
|
-
const
|
|
353
|
-
if (
|
|
354
|
-
const
|
|
355
|
-
if (
|
|
356
|
-
const
|
|
357
|
-
r = r ||
|
|
397
|
+
const c = B(e);
|
|
398
|
+
let r = N(c, o, i);
|
|
399
|
+
const s = b(e), u = E.getConfig(e);
|
|
400
|
+
if (s !== "list" && u.mobileLayoutEnabled && "querySelector" in e) {
|
|
401
|
+
const l = e.querySelector(q);
|
|
402
|
+
if (l) {
|
|
403
|
+
const d = N(l, o, i);
|
|
404
|
+
r = r || d;
|
|
358
405
|
}
|
|
359
406
|
}
|
|
360
407
|
return r && o.apply(new p("Updated price formatting in-place")), r;
|
|
361
408
|
}
|
|
362
|
-
function
|
|
363
|
-
const { currentNode: e, documentModifier: o, currency: n } = t, i =
|
|
409
|
+
function me(t) {
|
|
410
|
+
const { currentNode: e, documentModifier: o, currency: n } = t, i = h(e);
|
|
364
411
|
if (!i)
|
|
365
412
|
return;
|
|
366
|
-
const
|
|
367
|
-
o.modifyHtml(i).setAttribute(
|
|
413
|
+
const c = n.alignment === "before" ? "0" : "1", r = (s, u) => {
|
|
414
|
+
o.modifyHtml(i).setAttribute(s, u);
|
|
368
415
|
};
|
|
369
|
-
r(y.CURRENCY, n.code), r(y.SYMBOL, n.symbol), r(y.ALIGNMENT,
|
|
416
|
+
r(y.CURRENCY, n.code), r(y.SYMBOL, n.symbol), r(y.ALIGNMENT, c), r(y.THOUSAND_SEPARATOR, n.thousandSeparator), r(y.DECIMAL_SEPARATOR, n.decimalSeparator), r(y.DECIMAL_COUNT, n.decimalCount.toString()), o.apply(new p("Update currency attributes"));
|
|
370
417
|
}
|
|
371
418
|
export {
|
|
372
|
-
|
|
419
|
+
ae as adjustProductsToSize,
|
|
373
420
|
A as formatProductPrice,
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
421
|
+
h as getBlockElement,
|
|
422
|
+
x as getCardComposition,
|
|
423
|
+
b as getCurrentLayout,
|
|
424
|
+
X as reapplySpacing,
|
|
425
|
+
Y as regenerateMobileProductRows,
|
|
426
|
+
K as regenerateProductRows,
|
|
427
|
+
se as regenerateProductRowsWithStyles,
|
|
428
|
+
me as setCurrencyAttributes,
|
|
429
|
+
fe as updatePricesInPlace,
|
|
430
|
+
de as updateProductContentInPlace,
|
|
431
|
+
J as updateSingleProductContent
|
|
385
432
|
};
|