@useinsider/guido 3.19.0-beta.f02eaa1 → 3.19.0-beta.f884c35
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/Guido.vue.js +1 -1
- package/dist/components/Guido.vue2.js +59 -53
- package/dist/components/organisms/base/Toaster.vue2.js +13 -12
- package/dist/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue.js +9 -7
- package/dist/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue2.js +69 -52
- package/dist/components/organisms/extensions/recommendation/RemoveStrategyModal.vue2.js +28 -44
- package/dist/components/organisms/header/EditorActions.vue.js +4 -4
- package/dist/components/organisms/header/EditorActions.vue2.js +23 -25
- package/dist/components/organisms/onboarding/RecommendationStrategyOnboarding.vue.js +3 -3
- package/dist/components/organisms/onboarding/RecommendationStrategyOnboarding.vue2.js +21 -20
- package/dist/composables/useActionsApi.js +52 -47
- package/dist/composables/useCodeEditorApi.js +23 -9
- package/dist/composables/useCortexBlueprintBridge.js +122 -54
- package/dist/composables/useCustomInterfaceAppearance.js +61 -51
- package/dist/composables/useEmailTemplateApplier.js +106 -50
- package/dist/composables/useHtmlValidator.js +87 -82
- package/dist/composables/useRecommendation.js +40 -35
- package/dist/composables/useStripo.js +30 -30
- package/dist/composables/useToaster.js +14 -20
- package/dist/composables/useTranslations.js +3 -2
- package/dist/composables/useVersionHistoryApi.js +33 -24
- package/dist/enums/extensions/recommendationBlock.js +32 -25
- package/dist/extensions/Blocks/Recommendation/block.js +61 -42
- package/dist/extensions/Blocks/Recommendation/constants/defaultConfig.js +21 -20
- package/dist/extensions/Blocks/Recommendation/controls/main/index.js +63 -58
- package/dist/extensions/Blocks/Recommendation/controls/main/strategy.js +109 -78
- package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +96 -97
- package/dist/extensions/Blocks/Recommendation/store/recommendation.js +209 -92
- package/dist/extensions/Blocks/Recommendation/utils/legacyStrategyMigration.js +1 -1
- package/dist/extensions/Blocks/Recommendation/utils/nodeConfigWriter.js +26 -16
- package/dist/extensions/Blocks/Recommendation/utils/strategyCommit.js +24 -0
- package/dist/extensions/Blocks/Recommendation/validation/requiredFields.js +21 -12
- package/dist/guido.css +1 -1
- package/dist/src/composables/useCortexBlueprintBridge.d.ts +2 -3
- package/dist/src/composables/useEmailTemplateApplier.d.ts +18 -5
- package/dist/src/enums/extensions/recommendationBlock.d.ts +2 -0
- package/dist/src/extensions/Blocks/Recommendation/block.d.ts +10 -0
- package/dist/src/extensions/Blocks/Recommendation/constants/defaultConfig.d.ts +1 -0
- package/dist/src/extensions/Blocks/Recommendation/constants/index.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +2 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/main/strategy.d.ts +8 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/main/utils.d.ts +7 -6
- package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +92 -0
- package/dist/src/extensions/Blocks/Recommendation/utils/legacyStrategyMigration.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/utils/strategyCommit.d.ts +14 -0
- package/dist/src/extensions/Blocks/Recommendation/validation/requiredFields.d.ts +4 -0
- package/dist/src/stores/guido-email-editor.d.ts +20 -10
- package/dist/src/utils/stripoEditorApi.d.ts +4 -0
- package/dist/static/styles/components/recommendation-strategy.css.js +34 -4
- package/dist/static/styles/components/skeleton.css.js +23 -0
- package/dist/stores/guido-email-editor.js +3 -1
- package/dist/stores/unsubscribe.js +3 -3
- package/dist/utils/stripoEditorApi.js +11 -0
- package/dist/utils/templatePreparation.js +55 -55
- package/package.json +2 -1
|
@@ -1,49 +1,64 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { useLegacyStrategyConversion as
|
|
5
|
-
import { ACADEMY_LINKS as
|
|
6
|
-
import { useOnboardingStore as
|
|
7
|
-
import { CommonControl as
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
var C = Object.defineProperty;
|
|
2
|
+
var $ = (c, n, t) => n in c ? C(c, n, { enumerable: !0, configurable: !0, writable: !0, value: t }) : c[n] = t;
|
|
3
|
+
var i = (c, n, t) => $(c, typeof n != "symbol" ? n + "" : n, t);
|
|
4
|
+
import { useLegacyStrategyConversion as k } from "../../../../../composables/useLegacyStrategyConversion.js";
|
|
5
|
+
import { ACADEMY_LINKS as L } from "../../../../../enums/academy.js";
|
|
6
|
+
import { useOnboardingStore as w } from "../../../../../stores/onboarding.js";
|
|
7
|
+
import { CommonControl as A } from "../../../common-control.js";
|
|
8
|
+
import { RRS_CONFIG_VERSION as N } from "../../constants/defaultConfig.js";
|
|
9
|
+
import { RecommendationConfigService as b } from "../../services/configService.js";
|
|
10
|
+
import { useRecommendationExtensionStore as R } from "../../store/recommendation.js";
|
|
11
|
+
const E = "recommendation-strategy-control";
|
|
12
|
+
class M extends A {
|
|
11
13
|
constructor() {
|
|
12
14
|
super(...arguments);
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
i(this, "store", R());
|
|
16
|
+
i(this, "onboardingStore", w());
|
|
17
|
+
i(this, "legacyConversion", k());
|
|
18
|
+
i(this, "storeUnsubscription", () => {
|
|
17
19
|
});
|
|
18
|
-
|
|
19
|
-
|
|
20
|
+
i(this, "listeners", []);
|
|
21
|
+
i(this, "lastPaintedState", null);
|
|
20
22
|
}
|
|
21
23
|
getId() {
|
|
22
|
-
return
|
|
24
|
+
return E;
|
|
23
25
|
}
|
|
24
26
|
getTemplate() {
|
|
25
27
|
const t = this.api.translate(
|
|
26
28
|
"You can assign a recommendation strategy by selecting an existing one or creating a new one to show specific content."
|
|
27
|
-
), e = this.api.translate("For more information, you can"),
|
|
29
|
+
), e = this.api.translate("For more information, you can"), s = this.api.translate("visit Academy"), o = this.api.translate("Legacy Strategy"), a = this.api.translate(
|
|
28
30
|
"Note that this is an older version of the Recommendation Strategy. We recommend you update it to the new Recommendation Strategy for an improved experience."
|
|
29
31
|
);
|
|
30
32
|
return `
|
|
31
33
|
<div class="strategy-control-container">
|
|
32
|
-
<div
|
|
33
|
-
<
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
<
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
</p>
|
|
34
|
+
<div data-strategy-loading-state>
|
|
35
|
+
<div class="strategy-control-header">
|
|
36
|
+
<span class="guido-skeleton guido-skeleton--strategy-title"></span>
|
|
37
|
+
</div>
|
|
38
|
+
<div class="strategy-control-description-row">
|
|
39
|
+
<span class="guido-skeleton guido-skeleton--strategy-description"></span>
|
|
40
|
+
</div>
|
|
41
|
+
<div class="strategy-control-skeleton-row">
|
|
42
|
+
<span class="guido-skeleton guido-skeleton--strategy-cta"></span>
|
|
43
|
+
<span class="guido-skeleton guido-skeleton--strategy-cta"></span>
|
|
44
|
+
</div>
|
|
44
45
|
</div>
|
|
45
|
-
<div data-strategy-
|
|
46
|
-
|
|
46
|
+
<div data-strategy-content style="display: none;">
|
|
47
|
+
<div class="strategy-control-header">
|
|
48
|
+
<h3 class="strategy-control-title">${this.api.translate("Recommendation Strategy")}</h3>
|
|
49
|
+
</div>
|
|
50
|
+
<div class="strategy-control-description-row">
|
|
51
|
+
<p class="strategy-control-description">
|
|
52
|
+
${t}
|
|
53
|
+
${e}
|
|
54
|
+
<a
|
|
55
|
+
href="${L.EMAIL_RECOMMENDATION_BLOCK}"
|
|
56
|
+
target="_blank"
|
|
57
|
+
rel="noopener noreferrer">${s}</a>.
|
|
58
|
+
</p>
|
|
59
|
+
</div>
|
|
60
|
+
<div data-strategy-empty-state style="display: none;">
|
|
61
|
+
${this._GuTwoColumns([
|
|
47
62
|
this._GuButton({
|
|
48
63
|
name: "assignStrategy",
|
|
49
64
|
label: this.api.translate("Assign Strategy"),
|
|
@@ -54,115 +69,131 @@ class N extends f {
|
|
|
54
69
|
name: "createStrategy",
|
|
55
70
|
label: this.api.translate("Create New Strategy"),
|
|
56
71
|
id: "guido__btn-create-strategy",
|
|
57
|
-
className: "strategy-control-cta primary"
|
|
58
|
-
disabled: !0
|
|
72
|
+
className: "strategy-control-cta primary"
|
|
59
73
|
})
|
|
60
74
|
], "strategy-control-cta-row")}
|
|
61
|
-
</div>
|
|
62
|
-
<div data-strategy-legacy-state style="display: none;">
|
|
63
|
-
<div class="strategy-control-notice-row">
|
|
64
|
-
<div class="strategy-control-notice">
|
|
65
|
-
<p class="strategy-control-notice-text">${n}</p>
|
|
66
|
-
</div>
|
|
67
75
|
</div>
|
|
68
|
-
<div
|
|
69
|
-
<
|
|
70
|
-
|
|
76
|
+
<div data-strategy-legacy-state style="display: none;">
|
|
77
|
+
<div class="strategy-control-notice-row">
|
|
78
|
+
<div class="strategy-control-notice">
|
|
79
|
+
<p class="strategy-control-notice-text">${a}</p>
|
|
80
|
+
</div>
|
|
81
|
+
</div>
|
|
82
|
+
<div class="strategy-control-name-band">
|
|
83
|
+
<span class="strategy-control-name">${o}</span>
|
|
84
|
+
${this._strategyAction({
|
|
71
85
|
id: "guido__btn-update-legacy-strategy",
|
|
72
86
|
label: this.api.translate("Update"),
|
|
73
87
|
modifier: "update"
|
|
74
88
|
})}
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
89
|
+
</div>
|
|
90
|
+
<div class="strategy-control-actions">
|
|
91
|
+
${this._strategyAction({
|
|
78
92
|
id: "guido__btn-change-legacy-strategy",
|
|
79
93
|
label: this.api.translate("Change"),
|
|
80
94
|
modifier: "change"
|
|
81
95
|
})}
|
|
82
|
-
|
|
96
|
+
${this._strategyAction({
|
|
83
97
|
id: "guido__btn-remove-legacy-strategy",
|
|
84
98
|
label: this.api.translate("Remove"),
|
|
85
99
|
modifier: "remove"
|
|
86
100
|
})}
|
|
101
|
+
</div>
|
|
87
102
|
</div>
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
103
|
+
<div data-strategy-assigned-state style="display: none;">
|
|
104
|
+
<div class="strategy-control-name-band">
|
|
105
|
+
<span class="strategy-control-name" data-strategy-name></span>
|
|
106
|
+
<span
|
|
107
|
+
class="guido-skeleton guido-skeleton--strategy-name" data-strategy-name-skeleton></span>
|
|
108
|
+
</div>
|
|
109
|
+
<div class="strategy-control-actions">
|
|
110
|
+
${this._strategyAction({
|
|
95
111
|
id: "guido__btn-change-strategy",
|
|
96
112
|
label: this.api.translate("Change"),
|
|
97
113
|
modifier: "change"
|
|
98
114
|
})}
|
|
99
|
-
|
|
115
|
+
${this._strategyAction({
|
|
100
116
|
id: "guido__btn-remove-strategy",
|
|
101
117
|
label: this.api.translate("Remove"),
|
|
102
118
|
modifier: "remove"
|
|
103
119
|
})}
|
|
120
|
+
</div>
|
|
104
121
|
</div>
|
|
105
122
|
</div>
|
|
106
123
|
</div>
|
|
107
124
|
`;
|
|
108
125
|
}
|
|
109
|
-
_strategyAction({ id: t, label: e, modifier:
|
|
126
|
+
_strategyAction({ id: t, label: e, modifier: s }) {
|
|
110
127
|
return `
|
|
111
128
|
<button
|
|
112
129
|
id="${t}"
|
|
113
130
|
type="button"
|
|
114
|
-
class="strategy-control-action strategy-control-action--${
|
|
131
|
+
class="strategy-control-action strategy-control-action--${s}">
|
|
115
132
|
<span>${e}</span>
|
|
116
133
|
</button>
|
|
117
134
|
`;
|
|
118
135
|
}
|
|
119
136
|
onRender() {
|
|
120
|
-
this._teardown(), this._setupButtonListeners(), this._renderState(), this.storeUnsubscription = this.store.$subscribe(() => {
|
|
137
|
+
this._teardown(), this.store.strategyPanelOpen = !0, this._setupButtonListeners(), this._renderState(), this.storeUnsubscription = this.store.$subscribe(() => {
|
|
121
138
|
this._renderState();
|
|
122
|
-
}), this.store.recommendationConfigs.strategyId && !this.store.
|
|
139
|
+
}), this.store.recommendationConfigs.strategyId && !this.store.strategiesFetched && this.store.fetchStrategies().catch(() => {
|
|
123
140
|
});
|
|
124
|
-
|
|
125
|
-
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Whether the document itself says this block has no strategy.
|
|
144
|
+
*
|
|
145
|
+
* Read the node, not the store: when the main control cannot resolve the block id off the
|
|
146
|
+
* node it never syncs the persisted config, so the store still holds defaults (empty
|
|
147
|
+
* strategyId) for an assigned block.
|
|
148
|
+
*/
|
|
149
|
+
_isNodeUnassigned() {
|
|
150
|
+
if (!b.hasConfig(this.currentNode))
|
|
151
|
+
return !1;
|
|
152
|
+
const t = b.getConfig(this.currentNode);
|
|
153
|
+
return !t.strategyId && (t.configVersion ?? 0) >= N;
|
|
126
154
|
}
|
|
127
155
|
onDestroy() {
|
|
128
156
|
this._teardown();
|
|
129
157
|
}
|
|
130
158
|
_teardown() {
|
|
131
|
-
this.storeUnsubscription(), this.storeUnsubscription = () => {
|
|
159
|
+
this.store.strategyPanelOpen = !1, this.storeUnsubscription(), this.storeUnsubscription = () => {
|
|
132
160
|
}, this.lastPaintedState = null, this.listeners.forEach(({ element: t, handler: e }) => t.removeEventListener("click", e)), this.listeners = [];
|
|
133
161
|
}
|
|
134
162
|
_setupButtonListeners() {
|
|
135
163
|
const t = this.getContainer();
|
|
136
164
|
if (!t)
|
|
137
165
|
return;
|
|
138
|
-
const e = (
|
|
139
|
-
const
|
|
140
|
-
|
|
166
|
+
const e = (s, o) => {
|
|
167
|
+
const a = t.querySelector(s);
|
|
168
|
+
a && (a.addEventListener("click", o), this.listeners.push({ element: a, handler: o }));
|
|
141
169
|
};
|
|
142
|
-
e("#guido__btn-assign-strategy", () => this.store.openAssignStrategyDrawer()), e("#guido__btn-change-strategy", () => this.store.openAssignStrategyDrawer()), e("#guido__btn-change-legacy-strategy", () => this.store.openAssignStrategyDrawer()), e("#guido__btn-remove-strategy", () => this.store.openRemoveStrategyModal()), e("#guido__btn-remove-legacy-strategy", () => this.store.openRemoveStrategyModal()), e("#guido__btn-update-legacy-strategy", () => {
|
|
170
|
+
e("#guido__btn-assign-strategy", () => this.store.openAssignStrategyDrawer()), e("#guido__btn-create-strategy", () => this.store.openStrategyCreation()), e("#guido__btn-change-strategy", () => this.store.openAssignStrategyDrawer()), e("#guido__btn-change-legacy-strategy", () => this.store.openAssignStrategyDrawer()), e("#guido__btn-remove-strategy", () => this.store.openRemoveStrategyModal()), e("#guido__btn-remove-legacy-strategy", () => this.store.openRemoveStrategyModal()), e("#guido__btn-update-legacy-strategy", () => {
|
|
143
171
|
this.legacyConversion.convertLegacyStrategy();
|
|
144
172
|
});
|
|
145
173
|
}
|
|
146
174
|
_renderState() {
|
|
147
|
-
var
|
|
148
|
-
const { strategyId: t } = this.store.recommendationConfigs, e = t ? ((
|
|
149
|
-
if (
|
|
175
|
+
var _;
|
|
176
|
+
const { strategyId: t } = this.store.recommendationConfigs, e = t ? ((_ = this.store.assignedStrategy) == null ? void 0 : _.name) ?? "" : "", s = !!t && !e && (this.store.strategiesLoading || !this.store.strategiesSettled), o = this.store.legacyConversionLoading, a = this.store.isLegacyStrategyBlock, h = `${t}\0${e}\0${s}\0${o}\0${a}`;
|
|
177
|
+
if (h === this.lastPaintedState)
|
|
150
178
|
return;
|
|
151
|
-
const
|
|
152
|
-
if (!
|
|
179
|
+
const r = this.getContainer();
|
|
180
|
+
if (!r)
|
|
153
181
|
return;
|
|
154
|
-
const d =
|
|
182
|
+
const d = r.querySelector("[data-strategy-empty-state]"), y = r.querySelector("[data-strategy-assigned-state]"), g = r.querySelector("[data-strategy-legacy-state]"), p = r.querySelector("[data-strategy-loading-state]"), u = r.querySelector("[data-strategy-content]"), m = r.querySelector("[data-strategy-name]"), v = r.querySelector("[data-strategy-name-skeleton]");
|
|
155
183
|
if (!d || !y || !g)
|
|
156
184
|
return;
|
|
157
|
-
|
|
185
|
+
p && (p.style.display = "none"), u && (u.style.display = "");
|
|
186
|
+
const f = t ? y : a ? g : d;
|
|
158
187
|
[d, y, g].forEach((l) => {
|
|
159
|
-
l.style.display = l ===
|
|
188
|
+
l.style.display = l === f ? "" : "none";
|
|
160
189
|
}), g.querySelectorAll("button").forEach((l) => {
|
|
161
|
-
l.disabled =
|
|
162
|
-
}), g.classList.toggle("is-converting",
|
|
190
|
+
l.disabled = o;
|
|
191
|
+
}), g.classList.toggle("is-converting", o), !t && this._isNodeUnassigned() && this.onboardingStore.startOnboarding("recommendationStrategyOnboarding");
|
|
192
|
+
const S = this.store.currentRecommendationId;
|
|
193
|
+
a && S !== null && this.store.blockStates[S] && this.onboardingStore.startOnboarding("recommendationLegacyStrategyOnboarding"), m && (m.style.display = s ? "none" : "", t && !s && (m.textContent = e || `#${t}`)), v && (v.style.display = s ? "block" : "none"), this.lastPaintedState = h;
|
|
163
194
|
}
|
|
164
195
|
}
|
|
165
196
|
export {
|
|
166
|
-
|
|
167
|
-
|
|
197
|
+
E as STRATEGY_CONTROL_ID,
|
|
198
|
+
M as StrategyControl
|
|
168
199
|
};
|
|
@@ -87,21 +87,21 @@ function j(e, t = {}) {
|
|
|
87
87
|
documentModifier: o,
|
|
88
88
|
products: r,
|
|
89
89
|
layout: s,
|
|
90
|
-
composition:
|
|
90
|
+
composition: l
|
|
91
91
|
} = e;
|
|
92
92
|
if (!n || !("querySelector" in n))
|
|
93
93
|
return !1;
|
|
94
|
-
const u = s ?? P(n),
|
|
95
|
-
if (u === "list" || !
|
|
94
|
+
const u = s ?? P(n), i = y.getConfig(n);
|
|
95
|
+
if (u === "list" || !i.mobileLayoutEnabled)
|
|
96
96
|
return te({ currentNode: n, documentModifier: o });
|
|
97
|
-
const c = A(),
|
|
98
|
-
productsPerRow:
|
|
99
|
-
composition:
|
|
97
|
+
const c = A(), a = $(r, c.recommendationProducts), f = l ?? U(n, c.filterList), p = `<td><table class="ins-recommendation-product-container ins-recommendation-mobile-container" width="100%" cellpadding="0" cellspacing="0" border="0">${k(a, u, {
|
|
98
|
+
productsPerRow: i.mobileCardsInRow,
|
|
99
|
+
composition: f,
|
|
100
100
|
filterList: c.filterList,
|
|
101
|
-
priceInline: !
|
|
101
|
+
priceInline: !i.priceMovedToNextLine,
|
|
102
102
|
// Match the initial render's gutter so a regeneration never changes block height (SD-143023, #386).
|
|
103
|
-
cellPadding: v(
|
|
104
|
-
rowSpacingPx:
|
|
103
|
+
cellPadding: v(i.mobileColumnSpacing),
|
|
104
|
+
rowSpacingPx: i.mobileRowSpacing,
|
|
105
105
|
...t
|
|
106
106
|
})}</table></td>`, E = n.querySelector(w);
|
|
107
107
|
return E ? (o.modifyHtml(E).setInnerHtml(p), !0) : (re(n, o, p), !1);
|
|
@@ -115,17 +115,17 @@ function ie(e, t = {}) {
|
|
|
115
115
|
documentModifier: o,
|
|
116
116
|
products: r,
|
|
117
117
|
layout: s,
|
|
118
|
-
composition:
|
|
118
|
+
composition: l
|
|
119
119
|
} = e;
|
|
120
120
|
if (!n || !("querySelector" in n))
|
|
121
121
|
return !1;
|
|
122
122
|
const u = n.querySelector(L) ?? n.querySelector(W);
|
|
123
123
|
if (!u)
|
|
124
124
|
return !1;
|
|
125
|
-
const
|
|
126
|
-
productsPerRow:
|
|
127
|
-
composition:
|
|
128
|
-
filterList:
|
|
125
|
+
const i = A(), c = $(r, i.recommendationProducts), { cardsInRow: a } = y.getConfig(n), f = l ?? U(n, i.filterList), d = s ?? P(n), p = y.getConfig(n), E = k(c, d, {
|
|
126
|
+
productsPerRow: a,
|
|
127
|
+
composition: f,
|
|
128
|
+
filterList: i.filterList,
|
|
129
129
|
priceInline: !p.priceMovedToNextLine,
|
|
130
130
|
// Match the initial render's gutter so a regeneration never changes block height (SD-143023, #386).
|
|
131
131
|
cellPadding: v(p.columnSpacing),
|
|
@@ -151,14 +151,14 @@ function ce(e, t, n) {
|
|
|
151
151
|
const r = o.getAttribute(R);
|
|
152
152
|
if (!r)
|
|
153
153
|
return !1;
|
|
154
|
-
const s = A(),
|
|
155
|
-
c &&
|
|
156
|
-
const
|
|
154
|
+
const s = A(), l = r.split(",").filter(Boolean), u = D(l, o, s.filterList), i = [], c = u.join(",") !== l.join(",");
|
|
155
|
+
c && i.push([R, u.join(",")]);
|
|
156
|
+
const a = le(
|
|
157
157
|
o.getAttribute(q)
|
|
158
|
-
),
|
|
159
|
-
if (
|
|
158
|
+
), f = a && z(a, o, s.filterList);
|
|
159
|
+
if (a && f && f.join(",") !== a.join(",") && i.push([q, JSON.stringify(f)]), i.length === 0)
|
|
160
160
|
return !1;
|
|
161
|
-
if (
|
|
161
|
+
if (i.forEach(([d, p]) => {
|
|
162
162
|
t.modifyHtml(o).setAttribute(d, p);
|
|
163
163
|
}), c && y.hasConfig(e)) {
|
|
164
164
|
const d = {
|
|
@@ -176,21 +176,20 @@ function Te(e) {
|
|
|
176
176
|
afterRegenerate: o,
|
|
177
177
|
products: r,
|
|
178
178
|
layout: s,
|
|
179
|
-
composition:
|
|
180
|
-
skipStylePreservation: u
|
|
181
|
-
forceApply: l = !1
|
|
179
|
+
composition: l,
|
|
180
|
+
skipStylePreservation: u
|
|
182
181
|
} = e;
|
|
183
182
|
if (!t)
|
|
184
|
-
return;
|
|
185
|
-
const
|
|
183
|
+
return !1;
|
|
184
|
+
const i = u ? {} : x(t), c = {
|
|
186
185
|
currentNode: t,
|
|
187
186
|
documentModifier: n,
|
|
188
187
|
products: r,
|
|
189
188
|
layout: s,
|
|
190
|
-
composition:
|
|
189
|
+
composition: l
|
|
191
190
|
};
|
|
192
|
-
let a = ie(
|
|
193
|
-
a = j(
|
|
191
|
+
let a = ie(c, i);
|
|
192
|
+
return a = j(c, i) || a, a && (ce(t, n, l), n.apply(new S("Regenerate products with styles"))), o == null || o(), a;
|
|
194
193
|
}
|
|
195
194
|
function Re(e, t) {
|
|
196
195
|
return e.length === t ? e : e.length > t ? e.slice(0, t) : [...e, ...H(t - e.length)];
|
|
@@ -214,28 +213,28 @@ function T(e, t = "price") {
|
|
|
214
213
|
});
|
|
215
214
|
}
|
|
216
215
|
function ue(e) {
|
|
217
|
-
var s,
|
|
218
|
-
const t = F(), n = ((s = e.original_price) == null ? void 0 : s[t.code]) ?? Object.values(e.original_price ?? {})[0] ?? 0, o = ((
|
|
216
|
+
var s, l;
|
|
217
|
+
const t = F(), n = ((s = e.original_price) == null ? void 0 : s[t.code]) ?? Object.values(e.original_price ?? {})[0] ?? 0, o = ((l = e.price) == null ? void 0 : l[t.code]) ?? Object.values(e.price ?? {})[0] ?? 0, r = n > 0 ? Math.round((n - o) / n * 100) : 0;
|
|
219
218
|
return r > 0 ? `-${r}%` : "0%";
|
|
220
219
|
}
|
|
221
220
|
function K(e) {
|
|
222
|
-
const { documentModifier: t, product: n, priceEl: o, oldPriceEl: r, omnibusPriceEl: s, omnibusDiscountEl:
|
|
221
|
+
const { documentModifier: t, product: n, priceEl: o, oldPriceEl: r, omnibusPriceEl: s, omnibusDiscountEl: l } = e;
|
|
223
222
|
let u = !1;
|
|
224
223
|
if (o && "querySelector" in o) {
|
|
225
|
-
const
|
|
226
|
-
b(t,
|
|
224
|
+
const i = o.querySelector("strong") ?? o.querySelector("p"), c = T(n, "price");
|
|
225
|
+
b(t, i ?? null, c) && (u = !0);
|
|
227
226
|
}
|
|
228
227
|
if (r && "querySelector" in r) {
|
|
229
|
-
const
|
|
230
|
-
b(t,
|
|
228
|
+
const i = r.querySelector("strong") ?? r.querySelector("p"), c = T(n, "original_price");
|
|
229
|
+
b(t, i ?? null, c) && (u = !0), t.modifyHtml(r).setAttribute("data-same-price", String(Q(n))), u = !0;
|
|
231
230
|
}
|
|
232
231
|
if (s && "querySelector" in s) {
|
|
233
|
-
const
|
|
234
|
-
b(t,
|
|
232
|
+
const i = s.querySelector(".omnibus-price-value") ?? null, c = T(n, "original_price");
|
|
233
|
+
b(t, i, c) && (u = !0);
|
|
235
234
|
}
|
|
236
|
-
if (
|
|
237
|
-
const
|
|
238
|
-
b(t,
|
|
235
|
+
if (l && "querySelector" in l) {
|
|
236
|
+
const i = l.querySelector(".omnibus-discount-value") ?? null, c = ue(n);
|
|
237
|
+
b(t, i, c) && (u = !0);
|
|
239
238
|
}
|
|
240
239
|
return u;
|
|
241
240
|
}
|
|
@@ -246,34 +245,34 @@ function se(e) {
|
|
|
246
245
|
imageEl: o,
|
|
247
246
|
nameEl: r,
|
|
248
247
|
priceEl: s,
|
|
249
|
-
oldPriceEl:
|
|
248
|
+
oldPriceEl: l,
|
|
250
249
|
omnibusPriceEl: u,
|
|
251
|
-
omnibusDiscountEl:
|
|
250
|
+
omnibusDiscountEl: i,
|
|
252
251
|
buttonEl: c
|
|
253
252
|
} = e;
|
|
254
|
-
let
|
|
253
|
+
let a = !1;
|
|
255
254
|
if (o && "querySelector" in o) {
|
|
256
|
-
const
|
|
257
|
-
|
|
255
|
+
const f = o.querySelector("img");
|
|
256
|
+
f && (t.modifyHtml(f).setAttribute("src", X(n.image_url)).setAttribute("alt", n.name), a = !0);
|
|
258
257
|
const d = o.querySelector("a");
|
|
259
|
-
d && (t.modifyHtml(d).setAttribute("href", n.url),
|
|
258
|
+
d && (t.modifyHtml(d).setAttribute("href", n.url), a = !0);
|
|
260
259
|
}
|
|
261
260
|
if (r && "querySelector" in r) {
|
|
262
|
-
const
|
|
263
|
-
b(t,
|
|
261
|
+
const f = r.querySelector("strong") ?? r.querySelector("p");
|
|
262
|
+
b(t, f ?? null, n.name) && (a = !0);
|
|
264
263
|
}
|
|
265
264
|
if (K({
|
|
266
265
|
documentModifier: t,
|
|
267
266
|
product: n,
|
|
268
267
|
priceEl: s,
|
|
269
|
-
oldPriceEl:
|
|
268
|
+
oldPriceEl: l,
|
|
270
269
|
omnibusPriceEl: u,
|
|
271
|
-
omnibusDiscountEl:
|
|
272
|
-
}) && (
|
|
273
|
-
const
|
|
274
|
-
|
|
270
|
+
omnibusDiscountEl: i
|
|
271
|
+
}) && (a = !0), c && "querySelector" in c) {
|
|
272
|
+
const f = c.querySelector("a.es-button") || c.querySelector("a");
|
|
273
|
+
f && (t.modifyHtml(f).setAttribute("href", n.url), a = !0);
|
|
275
274
|
}
|
|
276
|
-
return
|
|
275
|
+
return a;
|
|
277
276
|
}
|
|
278
277
|
function V(e) {
|
|
279
278
|
return "querySelector" in e ? e.querySelector(L) ?? e : e;
|
|
@@ -297,26 +296,26 @@ function fe(e, t, n) {
|
|
|
297
296
|
if (o.length === 0)
|
|
298
297
|
return !1;
|
|
299
298
|
const r = /* @__PURE__ */ new Map();
|
|
300
|
-
o.forEach((
|
|
301
|
-
if (!("getAttribute" in
|
|
299
|
+
o.forEach((l) => {
|
|
300
|
+
if (!("getAttribute" in l))
|
|
302
301
|
return;
|
|
303
|
-
const u =
|
|
302
|
+
const u = l.getAttribute(Y);
|
|
304
303
|
if (!u)
|
|
305
304
|
return;
|
|
306
|
-
const
|
|
307
|
-
|
|
305
|
+
const i = r.get(u) ?? [];
|
|
306
|
+
i.push(l), r.set(u, i);
|
|
308
307
|
});
|
|
309
308
|
let s = !1;
|
|
310
|
-
return r.forEach((
|
|
311
|
-
const
|
|
312
|
-
|
|
309
|
+
return r.forEach((l, u) => {
|
|
310
|
+
const i = Math.min(l.length, n.length);
|
|
311
|
+
l.slice(0, i).forEach((c, a) => {
|
|
313
312
|
if (!("querySelector" in c))
|
|
314
313
|
return;
|
|
315
|
-
const
|
|
316
|
-
if (
|
|
314
|
+
const f = ae(u, n[a]);
|
|
315
|
+
if (f === null)
|
|
317
316
|
return;
|
|
318
317
|
const d = c.querySelector("p") ?? null;
|
|
319
|
-
b(t, d,
|
|
318
|
+
b(t, d, f) && (s = !0);
|
|
320
319
|
});
|
|
321
320
|
}), s;
|
|
322
321
|
}
|
|
@@ -329,34 +328,34 @@ function O(e, t, n) {
|
|
|
329
328
|
`[esd-extension-block-id="${m.NAME}"]`
|
|
330
329
|
), s = e.querySelectorAll(
|
|
331
330
|
`[esd-extension-block-id="${m.PRICE}"]`
|
|
332
|
-
),
|
|
331
|
+
), l = e.querySelectorAll(
|
|
333
332
|
`[esd-extension-block-id="${m.OLD_PRICE}"]`
|
|
334
333
|
), u = e.querySelectorAll(
|
|
335
334
|
`[esd-extension-block-id="${m.OMNIBUS_PRICE}"]`
|
|
336
|
-
),
|
|
335
|
+
), i = e.querySelectorAll(
|
|
337
336
|
`[esd-extension-block-id="${m.OMNIBUS_DISCOUNT}"]`
|
|
338
337
|
), c = e.querySelectorAll(
|
|
339
338
|
`[esd-extension-block-id="${m.BUTTON}"]`
|
|
340
|
-
),
|
|
341
|
-
let
|
|
342
|
-
for (let d = 0; d <
|
|
339
|
+
), a = Math.min(o.length, n.length);
|
|
340
|
+
let f = !1;
|
|
341
|
+
for (let d = 0; d < a; d++) {
|
|
343
342
|
const p = se({
|
|
344
343
|
documentModifier: t,
|
|
345
344
|
product: n[d],
|
|
346
345
|
imageEl: o[d] ?? null,
|
|
347
346
|
nameEl: r[d] ?? null,
|
|
348
347
|
priceEl: s[d] ?? null,
|
|
349
|
-
oldPriceEl:
|
|
348
|
+
oldPriceEl: l[d] ?? null,
|
|
350
349
|
omnibusPriceEl: u[d] ?? null,
|
|
351
|
-
omnibusDiscountEl:
|
|
350
|
+
omnibusDiscountEl: i[d] ?? null,
|
|
352
351
|
buttonEl: c[d] ?? null
|
|
353
352
|
});
|
|
354
|
-
|
|
353
|
+
f = f || p;
|
|
355
354
|
}
|
|
356
|
-
return fe(e, t, n) && (
|
|
355
|
+
return fe(e, t, n) && (f = !0), f;
|
|
357
356
|
}
|
|
358
357
|
function qe(e) {
|
|
359
|
-
const { currentNode: t, documentModifier: n, products: o,
|
|
358
|
+
const { currentNode: t, documentModifier: n, products: o, onApplied: r } = e;
|
|
360
359
|
if (!t || !("querySelectorAll" in t))
|
|
361
360
|
return !1;
|
|
362
361
|
const s = V(t);
|
|
@@ -365,19 +364,19 @@ function qe(e) {
|
|
|
365
364
|
).length !== o.length)
|
|
366
365
|
return !1;
|
|
367
366
|
let u = O(s, n, o);
|
|
368
|
-
const
|
|
369
|
-
if (
|
|
370
|
-
const
|
|
371
|
-
if (
|
|
372
|
-
const
|
|
373
|
-
|
|
367
|
+
const i = P(t), c = y.getConfig(t);
|
|
368
|
+
if (i !== "list" && c.mobileLayoutEnabled && "querySelector" in t) {
|
|
369
|
+
const a = t.querySelector(N);
|
|
370
|
+
if (a) {
|
|
371
|
+
const f = O(
|
|
372
|
+
a,
|
|
374
373
|
n,
|
|
375
374
|
o
|
|
376
375
|
);
|
|
377
|
-
u = u ||
|
|
376
|
+
u = u || f;
|
|
378
377
|
}
|
|
379
378
|
}
|
|
380
|
-
return
|
|
379
|
+
return u && (n.apply(new S("Updated product content in-place")), r == null || r()), !0;
|
|
381
380
|
}
|
|
382
381
|
function _(e, t, n) {
|
|
383
382
|
if (!("querySelectorAll" in e))
|
|
@@ -388,10 +387,10 @@ function _(e, t, n) {
|
|
|
388
387
|
`[esd-extension-block-id="${m.OLD_PRICE}"]`
|
|
389
388
|
), s = e.querySelectorAll(
|
|
390
389
|
`[esd-extension-block-id="${m.OMNIBUS_PRICE}"]`
|
|
391
|
-
),
|
|
390
|
+
), l = e.querySelectorAll(
|
|
392
391
|
`[esd-extension-block-id="${m.OMNIBUS_DISCOUNT}"]`
|
|
393
392
|
), u = Math.min(o.length, n.length);
|
|
394
|
-
let
|
|
393
|
+
let i = !1;
|
|
395
394
|
for (let c = 0; c < u; c++)
|
|
396
395
|
K({
|
|
397
396
|
documentModifier: t,
|
|
@@ -399,9 +398,9 @@ function _(e, t, n) {
|
|
|
399
398
|
priceEl: o[c] ?? null,
|
|
400
399
|
oldPriceEl: r[c] ?? null,
|
|
401
400
|
omnibusPriceEl: s[c] ?? null,
|
|
402
|
-
omnibusDiscountEl:
|
|
403
|
-
}) && (
|
|
404
|
-
return
|
|
401
|
+
omnibusDiscountEl: l[c] ?? null
|
|
402
|
+
}) && (i = !0);
|
|
403
|
+
return i;
|
|
405
404
|
}
|
|
406
405
|
function Me(e) {
|
|
407
406
|
const { currentNode: t, documentModifier: n } = e;
|
|
@@ -413,25 +412,25 @@ function Me(e) {
|
|
|
413
412
|
if (r.length === 0)
|
|
414
413
|
return !1;
|
|
415
414
|
const s = V(t);
|
|
416
|
-
let
|
|
417
|
-
const u = P(t),
|
|
418
|
-
if (u !== "list" &&
|
|
415
|
+
let l = _(s, n, r);
|
|
416
|
+
const u = P(t), i = y.getConfig(t);
|
|
417
|
+
if (u !== "list" && i.mobileLayoutEnabled && "querySelector" in t) {
|
|
419
418
|
const c = t.querySelector(N);
|
|
420
419
|
if (c) {
|
|
421
|
-
const
|
|
422
|
-
|
|
420
|
+
const a = _(c, n, r);
|
|
421
|
+
l = l || a;
|
|
423
422
|
}
|
|
424
423
|
}
|
|
425
|
-
return
|
|
424
|
+
return l && n.apply(new S("Updated price formatting in-place")), l;
|
|
426
425
|
}
|
|
427
426
|
function he(e) {
|
|
428
427
|
const { currentNode: t, documentModifier: n, currency: o } = e, r = C(t);
|
|
429
428
|
if (!r)
|
|
430
429
|
return;
|
|
431
|
-
const s = o.alignment === "before" ? "0" : "1",
|
|
432
|
-
n.modifyHtml(r).setAttribute(u,
|
|
430
|
+
const s = o.alignment === "before" ? "0" : "1", l = (u, i) => {
|
|
431
|
+
n.modifyHtml(r).setAttribute(u, i);
|
|
433
432
|
};
|
|
434
|
-
|
|
433
|
+
l(g.CURRENCY, o.code), l(g.SYMBOL, o.symbol), l(g.ALIGNMENT, s), l(g.THOUSAND_SEPARATOR, o.thousandSeparator), l(g.DECIMAL_SEPARATOR, o.decimalSeparator), l(g.DECIMAL_COUNT, o.decimalCount.toString()), n.apply(new S("Update currency attributes"));
|
|
435
434
|
}
|
|
436
435
|
export {
|
|
437
436
|
Re as adjustProductsToSize,
|