@useinsider/guido 3.18.1-beta.c5d7fb4 → 3.18.1-beta.d56e3d5
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/@types/config/schemas.js +1 -3
- package/dist/components/Guido.vue.js +4 -4
- package/dist/components/Guido.vue2.js +53 -55
- package/dist/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue.js +7 -7
- package/dist/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue2.js +57 -82
- package/dist/components/organisms/extensions/recommendation/RemoveStrategyModal.vue2.js +22 -24
- package/dist/components/organisms/onboarding/OnboardingWrapper.vue2.js +24 -28
- package/dist/composables/useCustomInterfaceAppearance.js +42 -46
- package/dist/composables/usePreviewMode.js +21 -18
- package/dist/config/compiler/htmlCompilerRules.js +14 -6
- package/dist/enums/extensions/recommendationBlock.js +1 -2
- package/dist/extensions/Blocks/Recommendation/controls/main/index.js +69 -70
- package/dist/extensions/Blocks/Recommendation/controls/main/strategy.js +28 -72
- package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +44 -45
- package/dist/extensions/Blocks/Recommendation/store/recommendation.js +58 -104
- package/dist/extensions/Blocks/Recommendation/utils/nodeConfigWriter.js +7 -7
- package/dist/guido.css +1 -1
- package/dist/services/recommendationApi.js +52 -61
- package/dist/src/@types/config/schemas.d.ts +0 -4
- package/dist/src/composables/useConfig.d.ts +0 -2
- package/dist/src/enums/extensions/recommendationBlock.d.ts +0 -1
- package/dist/src/extensions/Blocks/Recommendation/controls/main/strategy.d.ts +0 -2
- package/dist/src/extensions/Blocks/Recommendation/controls/main/utils.d.ts +0 -4
- package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +1 -54
- package/dist/src/services/recommendationApi.d.ts +1 -2
- package/dist/src/stores/config.d.ts +0 -160
- package/dist/src/stores/onboarding.d.ts +10 -808
- package/dist/src/utils/fixMobileNonResponsiveLayout.d.ts +23 -0
- package/dist/static/styles/components/recommendation-strategy.css.js +5 -70
- package/dist/static/styles/customEditorStyle.css.js +17 -2
- package/dist/stores/config.js +59 -66
- package/dist/stores/onboarding.js +36 -46
- package/dist/utils/fixMobileNonResponsiveLayout.js +54 -0
- package/package.json +1 -1
- package/dist/components/organisms/extensions/recommendation/LegacyStrategyUpdatedModal.vue.js +0 -18
- package/dist/components/organisms/extensions/recommendation/LegacyStrategyUpdatedModal.vue2.js +0 -25
- package/dist/components/organisms/onboarding/RecommendationLegacyStrategyOnboarding.vue.js +0 -21
- package/dist/components/organisms/onboarding/RecommendationLegacyStrategyOnboarding.vue2.js +0 -46
- package/dist/components/organisms/onboarding/RecommendationStrategyOnboarding.vue.js +0 -21
- package/dist/components/organisms/onboarding/RecommendationStrategyOnboarding.vue2.js +0 -46
- package/dist/composables/useLegacyStrategyConversion.js +0 -54
- package/dist/extensions/Blocks/Recommendation/utils/legacyStrategyMigration.js +0 -58
- package/dist/src/components/organisms/extensions/recommendation/LegacyStrategyUpdatedModal.vue.d.ts +0 -2
- package/dist/src/components/organisms/onboarding/RecommendationLegacyStrategyOnboarding.vue.d.ts +0 -2
- package/dist/src/components/organisms/onboarding/RecommendationStrategyOnboarding.vue.d.ts +0 -2
- package/dist/src/composables/useLegacyStrategyConversion.d.ts +0 -3
- package/dist/src/extensions/Blocks/Recommendation/utils/legacyStrategyMigration.d.ts +0 -39
- package/dist/static/assets/icons/filled-arrow-rising.svg.js +0 -5
- package/dist/static/assets/icons/line-info.svg.js +0 -5
|
@@ -1,32 +1,26 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
const C = "recommendation-strategy-control";
|
|
10
|
-
class N extends f {
|
|
1
|
+
var d = Object.defineProperty;
|
|
2
|
+
var y = (r, s, t) => s in r ? d(r, s, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[s] = t;
|
|
3
|
+
var o = (r, s, t) => y(r, typeof s != "symbol" ? s + "" : s, t);
|
|
4
|
+
import { ACADEMY_LINKS as m } from "../../../../../enums/academy.js";
|
|
5
|
+
import { CommonControl as h } from "../../../common-control.js";
|
|
6
|
+
import { useRecommendationExtensionStore as u } from "../../store/recommendation.js";
|
|
7
|
+
const p = "recommendation-strategy-control";
|
|
8
|
+
class f extends h {
|
|
11
9
|
constructor() {
|
|
12
10
|
super(...arguments);
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
r(this, "legacyConversion", _());
|
|
16
|
-
r(this, "storeUnsubscription", () => {
|
|
11
|
+
o(this, "store", u());
|
|
12
|
+
o(this, "storeUnsubscription", () => {
|
|
17
13
|
});
|
|
18
|
-
|
|
19
|
-
|
|
14
|
+
o(this, "listeners", []);
|
|
15
|
+
o(this, "lastPaintedState", null);
|
|
20
16
|
}
|
|
21
17
|
getId() {
|
|
22
|
-
return
|
|
18
|
+
return p;
|
|
23
19
|
}
|
|
24
20
|
getTemplate() {
|
|
25
21
|
const t = this.api.translate(
|
|
26
22
|
"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"), a = this.api.translate("visit Academy")
|
|
28
|
-
"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
|
-
);
|
|
23
|
+
), e = this.api.translate("For more information, you can"), a = this.api.translate("visit Academy");
|
|
30
24
|
return `
|
|
31
25
|
<div class="strategy-control-container">
|
|
32
26
|
<div class="strategy-control-header">
|
|
@@ -37,7 +31,7 @@ class N extends f {
|
|
|
37
31
|
${t}
|
|
38
32
|
${e}
|
|
39
33
|
<a
|
|
40
|
-
href="${
|
|
34
|
+
href="${m.EMAIL_RECOMMENDATION_BLOCK}"
|
|
41
35
|
target="_blank"
|
|
42
36
|
rel="noopener noreferrer">${a}</a>.
|
|
43
37
|
</p>
|
|
@@ -59,33 +53,6 @@ class N extends f {
|
|
|
59
53
|
})
|
|
60
54
|
], "strategy-control-cta-row")}
|
|
61
55
|
</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
|
-
</div>
|
|
68
|
-
<div class="strategy-control-name-band">
|
|
69
|
-
<span class="strategy-control-name">${o}</span>
|
|
70
|
-
${this._strategyAction({
|
|
71
|
-
id: "guido__btn-update-legacy-strategy",
|
|
72
|
-
label: this.api.translate("Update"),
|
|
73
|
-
modifier: "update"
|
|
74
|
-
})}
|
|
75
|
-
</div>
|
|
76
|
-
<div class="strategy-control-actions">
|
|
77
|
-
${this._strategyAction({
|
|
78
|
-
id: "guido__btn-change-legacy-strategy",
|
|
79
|
-
label: this.api.translate("Change"),
|
|
80
|
-
modifier: "change"
|
|
81
|
-
})}
|
|
82
|
-
${this._strategyAction({
|
|
83
|
-
id: "guido__btn-remove-legacy-strategy",
|
|
84
|
-
label: this.api.translate("Remove"),
|
|
85
|
-
modifier: "remove"
|
|
86
|
-
})}
|
|
87
|
-
</div>
|
|
88
|
-
</div>
|
|
89
56
|
<div data-strategy-assigned-state style="display: none;">
|
|
90
57
|
<div class="strategy-control-name-band">
|
|
91
58
|
<span class="strategy-control-name" data-strategy-name></span>
|
|
@@ -121,8 +88,6 @@ class N extends f {
|
|
|
121
88
|
this._renderState();
|
|
122
89
|
}), this.store.recommendationConfigs.strategyId && !this.store.strategies.length && this.store.fetchStrategies().catch(() => {
|
|
123
90
|
});
|
|
124
|
-
const t = this.store.currentRecommendationId, e = t !== null && !!this.store.blockStates[t], a = this.store.isLegacyStrategyBlock;
|
|
125
|
-
e && !this.store.recommendationConfigs.strategyId && !a && this.onboardingStore.startOnboarding("recommendationStrategyOnboarding"), e && a && this.onboardingStore.startOnboarding("recommendationLegacyStrategyOnboarding");
|
|
126
91
|
}
|
|
127
92
|
onDestroy() {
|
|
128
93
|
this._teardown();
|
|
@@ -135,34 +100,25 @@ class N extends f {
|
|
|
135
100
|
const t = this.getContainer();
|
|
136
101
|
if (!t)
|
|
137
102
|
return;
|
|
138
|
-
const e = (a,
|
|
139
|
-
const
|
|
140
|
-
|
|
103
|
+
const e = (a, n) => {
|
|
104
|
+
const i = t.querySelector(a);
|
|
105
|
+
i && (i.addEventListener("click", n), this.listeners.push({ element: i, handler: n }));
|
|
141
106
|
};
|
|
142
|
-
e("#guido__btn-assign-strategy", () => this.store.openAssignStrategyDrawer()), e("#guido__btn-change-strategy", () => this.store.openAssignStrategyDrawer()), e("#guido__btn-
|
|
143
|
-
this.legacyConversion.convertLegacyStrategy();
|
|
144
|
-
});
|
|
107
|
+
e("#guido__btn-assign-strategy", () => this.store.openAssignStrategyDrawer()), e("#guido__btn-change-strategy", () => this.store.openAssignStrategyDrawer()), e("#guido__btn-remove-strategy", () => this.store.openRemoveStrategyModal());
|
|
145
108
|
}
|
|
146
109
|
_renderState() {
|
|
147
|
-
var
|
|
148
|
-
const { strategyId: t } = this.store.recommendationConfigs, e = t ? ((
|
|
149
|
-
if (
|
|
150
|
-
return;
|
|
151
|
-
const c = this.getContainer();
|
|
152
|
-
if (!c)
|
|
110
|
+
var l;
|
|
111
|
+
const { strategyId: t } = this.store.recommendationConfigs, e = t ? ((l = this.store.assignedStrategy) == null ? void 0 : l.name) ?? "" : "", a = `${t}\0${e}`;
|
|
112
|
+
if (a === this.lastPaintedState)
|
|
153
113
|
return;
|
|
154
|
-
const
|
|
155
|
-
if (!
|
|
114
|
+
const n = this.getContainer();
|
|
115
|
+
if (!n)
|
|
156
116
|
return;
|
|
157
|
-
const
|
|
158
|
-
|
|
159
|
-
l.style.display = l === u ? "" : "none";
|
|
160
|
-
}), g.querySelectorAll("button").forEach((l) => {
|
|
161
|
-
l.disabled = a;
|
|
162
|
-
}), g.classList.toggle("is-converting", a), m && t && (m.textContent = e || `#${t}`), this.lastPaintedState = n;
|
|
117
|
+
const i = n.querySelector("[data-strategy-empty-state]"), c = n.querySelector("[data-strategy-assigned-state]"), g = n.querySelector("[data-strategy-name]");
|
|
118
|
+
!i || !c || (i.style.display = t ? "none" : "", c.style.display = t ? "" : "none", g && t && (g.textContent = e || `#${t}`), this.lastPaintedState = a);
|
|
163
119
|
}
|
|
164
120
|
}
|
|
165
121
|
export {
|
|
166
|
-
|
|
167
|
-
|
|
122
|
+
p as STRATEGY_CONTROL_ID,
|
|
123
|
+
f as StrategyControl
|
|
168
124
|
};
|
|
@@ -94,9 +94,9 @@ function j(e, t = {}) {
|
|
|
94
94
|
const u = s ?? P(n), l = y.getConfig(n);
|
|
95
95
|
if (u === "list" || !l.mobileLayoutEnabled)
|
|
96
96
|
return te({ currentNode: n, documentModifier: o });
|
|
97
|
-
const c = A(),
|
|
97
|
+
const c = A(), a = $(r, c.recommendationProducts), f = i ?? 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
98
|
productsPerRow: l.mobileCardsInRow,
|
|
99
|
-
composition:
|
|
99
|
+
composition: f,
|
|
100
100
|
filterList: c.filterList,
|
|
101
101
|
priceInline: !l.priceMovedToNextLine,
|
|
102
102
|
// Match the initial render's gutter so a regeneration never changes block height (SD-143023, #386).
|
|
@@ -122,9 +122,9 @@ function ie(e, t = {}) {
|
|
|
122
122
|
const u = n.querySelector(L) ?? n.querySelector(W);
|
|
123
123
|
if (!u)
|
|
124
124
|
return !1;
|
|
125
|
-
const l = A(), c = $(r, l.recommendationProducts), { cardsInRow:
|
|
126
|
-
productsPerRow:
|
|
127
|
-
composition:
|
|
125
|
+
const l = A(), c = $(r, l.recommendationProducts), { cardsInRow: a } = y.getConfig(n), f = i ?? U(n, l.filterList), d = s ?? P(n), p = y.getConfig(n), E = k(c, d, {
|
|
126
|
+
productsPerRow: a,
|
|
127
|
+
composition: f,
|
|
128
128
|
filterList: l.filterList,
|
|
129
129
|
priceInline: !p.priceMovedToNextLine,
|
|
130
130
|
// Match the initial render's gutter so a regeneration never changes block height (SD-143023, #386).
|
|
@@ -153,10 +153,10 @@ function ce(e, t, n) {
|
|
|
153
153
|
return !1;
|
|
154
154
|
const s = A(), i = r.split(",").filter(Boolean), u = D(i, o, s.filterList), l = [], c = u.join(",") !== i.join(",");
|
|
155
155
|
c && l.push([R, u.join(",")]);
|
|
156
|
-
const
|
|
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(",") && l.push([q, JSON.stringify(f)]), l.length === 0)
|
|
160
160
|
return !1;
|
|
161
161
|
if (l.forEach(([d, p]) => {
|
|
162
162
|
t.modifyHtml(o).setAttribute(d, p);
|
|
@@ -177,20 +177,19 @@ function Te(e) {
|
|
|
177
177
|
products: r,
|
|
178
178
|
layout: s,
|
|
179
179
|
composition: i,
|
|
180
|
-
skipStylePreservation: u
|
|
181
|
-
forceApply: l = !1
|
|
180
|
+
skipStylePreservation: u
|
|
182
181
|
} = e;
|
|
183
182
|
if (!t)
|
|
184
183
|
return;
|
|
185
|
-
const
|
|
184
|
+
const l = u ? {} : x(t), c = {
|
|
186
185
|
currentNode: t,
|
|
187
186
|
documentModifier: n,
|
|
188
187
|
products: r,
|
|
189
188
|
layout: s,
|
|
190
189
|
composition: i
|
|
191
190
|
};
|
|
192
|
-
let a = ie(
|
|
193
|
-
a = j(
|
|
191
|
+
let a = ie(c, l);
|
|
192
|
+
a = j(c, l) || a, a && (ce(t, n, i), n.apply(new S("Regenerate products with styles"))), o == null || o();
|
|
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)];
|
|
@@ -251,16 +250,16 @@ function se(e) {
|
|
|
251
250
|
omnibusDiscountEl: l,
|
|
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,
|
|
@@ -269,11 +268,11 @@ function se(e) {
|
|
|
269
268
|
oldPriceEl: i,
|
|
270
269
|
omnibusPriceEl: u,
|
|
271
270
|
omnibusDiscountEl: l
|
|
272
|
-
}) && (
|
|
273
|
-
const
|
|
274
|
-
|
|
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;
|
|
@@ -309,14 +308,14 @@ function fe(e, t, n) {
|
|
|
309
308
|
let s = !1;
|
|
310
309
|
return r.forEach((i, u) => {
|
|
311
310
|
const l = Math.min(i.length, n.length);
|
|
312
|
-
i.slice(0, l).forEach((c,
|
|
311
|
+
i.slice(0, l).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
|
}
|
|
@@ -337,9 +336,9 @@ function O(e, t, n) {
|
|
|
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],
|
|
@@ -351,33 +350,33 @@ function O(e, t, n) {
|
|
|
351
350
|
omnibusDiscountEl: l[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 } = e;
|
|
360
359
|
if (!t || !("querySelectorAll" in t))
|
|
361
360
|
return !1;
|
|
362
|
-
const
|
|
363
|
-
if (!("querySelectorAll" in
|
|
361
|
+
const r = V(t);
|
|
362
|
+
if (!("querySelectorAll" in r) || r.querySelectorAll(
|
|
364
363
|
`[esd-extension-block-id="${m.IMAGE}"]`
|
|
365
364
|
).length !== o.length)
|
|
366
365
|
return !1;
|
|
367
|
-
let
|
|
368
|
-
const
|
|
369
|
-
if (
|
|
370
|
-
const
|
|
371
|
-
if (
|
|
366
|
+
let i = O(r, n, o);
|
|
367
|
+
const u = P(t), l = y.getConfig(t);
|
|
368
|
+
if (u !== "list" && l.mobileLayoutEnabled && "querySelector" in t) {
|
|
369
|
+
const c = t.querySelector(N);
|
|
370
|
+
if (c) {
|
|
372
371
|
const a = O(
|
|
373
|
-
|
|
372
|
+
c,
|
|
374
373
|
n,
|
|
375
374
|
o
|
|
376
375
|
);
|
|
377
|
-
|
|
376
|
+
i = i || a;
|
|
378
377
|
}
|
|
379
378
|
}
|
|
380
|
-
return
|
|
379
|
+
return i && n.apply(new S("Updated product content in-place")), !0;
|
|
381
380
|
}
|
|
382
381
|
function _(e, t, n) {
|
|
383
382
|
if (!("querySelectorAll" in e))
|
|
@@ -418,8 +417,8 @@ function Me(e) {
|
|
|
418
417
|
if (u !== "list" && l.mobileLayoutEnabled && "querySelector" in t) {
|
|
419
418
|
const c = t.querySelector(N);
|
|
420
419
|
if (c) {
|
|
421
|
-
const
|
|
422
|
-
i = i ||
|
|
420
|
+
const a = _(c, n, r);
|
|
421
|
+
i = i || a;
|
|
423
422
|
}
|
|
424
423
|
}
|
|
425
424
|
return i && n.apply(new S("Updated price formatting in-place")), i;
|