@useinsider/guido 3.18.2-beta.3eec9b0 → 3.18.2-beta.4d2b065
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 +21 -23
- package/dist/@types/config/schemas.js +59 -51
- package/dist/components/Guido.vue.js +4 -4
- package/dist/components/Guido.vue2.js +55 -53
- package/dist/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue.js +7 -7
- package/dist/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue2.js +53 -49
- package/dist/components/organisms/extensions/recommendation/LegacyStrategyUpdatedModal.vue.js +18 -0
- package/dist/components/organisms/extensions/recommendation/LegacyStrategyUpdatedModal.vue2.js +25 -0
- package/dist/components/organisms/extensions/recommendation/RemoveStrategyModal.vue2.js +24 -22
- package/dist/components/organisms/onboarding/OnboardingWrapper.vue2.js +28 -24
- package/dist/components/organisms/onboarding/RecommendationLegacyStrategyOnboarding.vue.js +21 -0
- package/dist/components/organisms/onboarding/RecommendationLegacyStrategyOnboarding.vue2.js +46 -0
- package/dist/components/organisms/onboarding/RecommendationStrategyOnboarding.vue.js +21 -0
- package/dist/components/organisms/onboarding/RecommendationStrategyOnboarding.vue2.js +46 -0
- package/dist/composables/useCustomInterfaceAppearance.js +46 -42
- package/dist/composables/useGuidoStateBridge.js +24 -29
- package/dist/composables/useLegacyStrategyConversion.js +61 -0
- package/dist/composables/useStripo.js +7 -7
- package/dist/enums/extensions/recommendationBlock.js +40 -31
- package/dist/extensions/Blocks/Recommendation/controls/main/index.js +77 -76
- package/dist/extensions/Blocks/Recommendation/controls/main/strategy.js +72 -28
- package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +45 -44
- package/dist/extensions/Blocks/Recommendation/store/recommendation.js +110 -46
- package/dist/extensions/Blocks/Recommendation/utils/legacyStrategyMigration.js +42 -0
- package/dist/extensions/Blocks/Recommendation/utils/nodeConfigWriter.js +7 -7
- package/dist/guido.css +1 -1
- package/dist/library.js +13 -15
- package/dist/services/recommendationApi.js +46 -37
- package/dist/src/@types/config/schemas.d.ts +16 -0
- package/dist/src/components/organisms/extensions/recommendation/LegacyStrategyUpdatedModal.vue.d.ts +2 -0
- package/dist/src/components/organisms/onboarding/RecommendationLegacyStrategyOnboarding.vue.d.ts +2 -0
- package/dist/src/components/organisms/onboarding/RecommendationStrategyOnboarding.vue.d.ts +2 -0
- package/dist/src/composables/useConfig.d.ts +4 -0
- package/dist/src/composables/useGuidoStateBridge.d.ts +7 -11
- package/dist/src/composables/useLegacyStrategyConversion.d.ts +3 -0
- package/dist/src/enums/extensions/recommendationBlock.d.ts +5 -1
- package/dist/src/extensions/Blocks/Recommendation/controls/main/strategy.d.ts +2 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/main/utils.d.ts +4 -0
- package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +70 -1
- package/dist/src/extensions/Blocks/Recommendation/utils/legacyStrategyMigration.d.ts +32 -0
- package/dist/src/library.d.ts +0 -2
- package/dist/src/public/trackingIds.d.ts +2 -6
- package/dist/src/services/recommendationApi.d.ts +2 -1
- package/dist/src/stores/config.d.ts +322 -0
- package/dist/src/stores/editor.d.ts +0 -25
- package/dist/src/stores/guido-email-editor.d.ts +27 -27
- package/dist/src/stores/onboarding.d.ts +808 -10
- package/dist/static/assets/icons/filled-arrow-rising.svg.js +5 -0
- package/dist/static/assets/icons/line-info.svg.js +5 -0
- package/dist/static/styles/components/recommendation-strategy.css.js +70 -5
- package/dist/stores/config.js +74 -60
- package/dist/stores/editor.js +0 -4
- package/dist/stores/guido-email-editor.js +4 -0
- package/dist/stores/onboarding.js +46 -36
- package/package.json +1 -5
- package/dist/public/editorState.js +0 -4
- package/dist/src/public/editorState.d.ts +0 -14
|
@@ -1,26 +1,32 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
var p = Object.defineProperty;
|
|
2
|
+
var v = (i, s, t) => s in i ? p(i, s, { enumerable: !0, configurable: !0, writable: !0, value: t }) : i[s] = t;
|
|
3
|
+
var r = (i, s, t) => v(i, typeof s != "symbol" ? s + "" : s, t);
|
|
4
|
+
import { useLegacyStrategyConversion as _ } from "../../../../../composables/useLegacyStrategyConversion.js";
|
|
5
|
+
import { ACADEMY_LINKS as b } from "../../../../../enums/academy.js";
|
|
6
|
+
import { useOnboardingStore as S } from "../../../../../stores/onboarding.js";
|
|
7
|
+
import { CommonControl as f } from "../../../common-control.js";
|
|
8
|
+
import { useRecommendationExtensionStore as $ } from "../../store/recommendation.js";
|
|
9
|
+
const C = "recommendation-strategy-control";
|
|
10
|
+
class N extends f {
|
|
9
11
|
constructor() {
|
|
10
12
|
super(...arguments);
|
|
11
|
-
|
|
12
|
-
|
|
13
|
+
r(this, "store", $());
|
|
14
|
+
r(this, "onboardingStore", S());
|
|
15
|
+
r(this, "legacyConversion", _());
|
|
16
|
+
r(this, "storeUnsubscription", () => {
|
|
13
17
|
});
|
|
14
|
-
|
|
15
|
-
|
|
18
|
+
r(this, "listeners", []);
|
|
19
|
+
r(this, "lastPaintedState", null);
|
|
16
20
|
}
|
|
17
21
|
getId() {
|
|
18
|
-
return
|
|
22
|
+
return C;
|
|
19
23
|
}
|
|
20
24
|
getTemplate() {
|
|
21
25
|
const t = this.api.translate(
|
|
22
26
|
"You can assign a recommendation strategy by selecting an existing one or creating a new one to show specific content."
|
|
23
|
-
), e = this.api.translate("For more information, you can"), a = this.api.translate("visit Academy")
|
|
27
|
+
), e = this.api.translate("For more information, you can"), a = this.api.translate("visit Academy"), o = this.api.translate("Legacy Strategy"), n = this.api.translate(
|
|
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
|
+
);
|
|
24
30
|
return `
|
|
25
31
|
<div class="strategy-control-container">
|
|
26
32
|
<div class="strategy-control-header">
|
|
@@ -31,7 +37,7 @@ class f extends h {
|
|
|
31
37
|
${t}
|
|
32
38
|
${e}
|
|
33
39
|
<a
|
|
34
|
-
href="${
|
|
40
|
+
href="${b.EMAIL_RECOMMENDATION_BLOCK}"
|
|
35
41
|
target="_blank"
|
|
36
42
|
rel="noopener noreferrer">${a}</a>.
|
|
37
43
|
</p>
|
|
@@ -53,6 +59,33 @@ class f extends h {
|
|
|
53
59
|
})
|
|
54
60
|
], "strategy-control-cta-row")}
|
|
55
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
|
+
</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>
|
|
56
89
|
<div data-strategy-assigned-state style="display: none;">
|
|
57
90
|
<div class="strategy-control-name-band">
|
|
58
91
|
<span class="strategy-control-name" data-strategy-name></span>
|
|
@@ -88,6 +121,8 @@ class f extends h {
|
|
|
88
121
|
this._renderState();
|
|
89
122
|
}), this.store.recommendationConfigs.strategyId && !this.store.strategies.length && this.store.fetchStrategies().catch(() => {
|
|
90
123
|
});
|
|
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");
|
|
91
126
|
}
|
|
92
127
|
onDestroy() {
|
|
93
128
|
this._teardown();
|
|
@@ -100,25 +135,34 @@ class f extends h {
|
|
|
100
135
|
const t = this.getContainer();
|
|
101
136
|
if (!t)
|
|
102
137
|
return;
|
|
103
|
-
const e = (a,
|
|
104
|
-
const
|
|
105
|
-
|
|
138
|
+
const e = (a, o) => {
|
|
139
|
+
const n = t.querySelector(a);
|
|
140
|
+
n && (n.addEventListener("click", o), this.listeners.push({ element: n, handler: o }));
|
|
106
141
|
};
|
|
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())
|
|
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", () => {
|
|
143
|
+
this.legacyConversion.convertLegacyStrategy();
|
|
144
|
+
});
|
|
108
145
|
}
|
|
109
146
|
_renderState() {
|
|
110
|
-
var
|
|
111
|
-
const { strategyId: t } = this.store.recommendationConfigs, e = t ? ((
|
|
112
|
-
if (
|
|
147
|
+
var h;
|
|
148
|
+
const { strategyId: t } = this.store.recommendationConfigs, e = t ? ((h = this.store.assignedStrategy) == null ? void 0 : h.name) ?? "" : "", a = this.store.legacyConversionLoading, o = this.store.isLegacyStrategyBlock, n = `${t}\0${e}\0${a}\0${o}`;
|
|
149
|
+
if (n === this.lastPaintedState)
|
|
150
|
+
return;
|
|
151
|
+
const c = this.getContainer();
|
|
152
|
+
if (!c)
|
|
113
153
|
return;
|
|
114
|
-
const
|
|
115
|
-
if (!
|
|
154
|
+
const d = c.querySelector("[data-strategy-empty-state]"), y = c.querySelector("[data-strategy-assigned-state]"), g = c.querySelector("[data-strategy-legacy-state]"), m = c.querySelector("[data-strategy-name]");
|
|
155
|
+
if (!d || !y || !g)
|
|
116
156
|
return;
|
|
117
|
-
const
|
|
118
|
-
|
|
157
|
+
const u = t ? y : o ? g : d;
|
|
158
|
+
[d, y, g].forEach((l) => {
|
|
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;
|
|
119
163
|
}
|
|
120
164
|
}
|
|
121
165
|
export {
|
|
122
|
-
|
|
123
|
-
|
|
166
|
+
C as STRATEGY_CONTROL_ID,
|
|
167
|
+
N as StrategyControl
|
|
124
168
|
};
|
|
@@ -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(), f = $(r, c.recommendationProducts), a = 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(f, u, {
|
|
98
98
|
productsPerRow: l.mobileCardsInRow,
|
|
99
|
-
composition:
|
|
99
|
+
composition: a,
|
|
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: f } = y.getConfig(n), a = i ?? U(n, l.filterList), d = s ?? P(n), p = y.getConfig(n), E = k(c, d, {
|
|
126
|
+
productsPerRow: f,
|
|
127
|
+
composition: a,
|
|
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 f = le(
|
|
157
157
|
o.getAttribute(q)
|
|
158
|
-
),
|
|
159
|
-
if (
|
|
158
|
+
), a = f && z(f, o, s.filterList);
|
|
159
|
+
if (f && a && a.join(",") !== f.join(",") && l.push([q, JSON.stringify(a)]), l.length === 0)
|
|
160
160
|
return !1;
|
|
161
161
|
if (l.forEach(([d, p]) => {
|
|
162
162
|
t.modifyHtml(o).setAttribute(d, p);
|
|
@@ -177,19 +177,20 @@ function Te(e) {
|
|
|
177
177
|
products: r,
|
|
178
178
|
layout: s,
|
|
179
179
|
composition: i,
|
|
180
|
-
skipStylePreservation: u
|
|
180
|
+
skipStylePreservation: u,
|
|
181
|
+
forceApply: l = !1
|
|
181
182
|
} = e;
|
|
182
183
|
if (!t)
|
|
183
184
|
return;
|
|
184
|
-
const
|
|
185
|
+
const c = u ? {} : x(t), f = {
|
|
185
186
|
currentNode: t,
|
|
186
187
|
documentModifier: n,
|
|
187
188
|
products: r,
|
|
188
189
|
layout: s,
|
|
189
190
|
composition: i
|
|
190
191
|
};
|
|
191
|
-
let a = ie(
|
|
192
|
-
a = j(
|
|
192
|
+
let a = ie(f, c);
|
|
193
|
+
a = j(f, c) || a, a && ce(t, n, i), (a || l) && n.apply(new S("Regenerate products with styles")), o == null || o();
|
|
193
194
|
}
|
|
194
195
|
function Re(e, t) {
|
|
195
196
|
return e.length === t ? e : e.length > t ? e.slice(0, t) : [...e, ...H(t - e.length)];
|
|
@@ -250,16 +251,16 @@ function se(e) {
|
|
|
250
251
|
omnibusDiscountEl: l,
|
|
251
252
|
buttonEl: c
|
|
252
253
|
} = e;
|
|
253
|
-
let
|
|
254
|
+
let f = !1;
|
|
254
255
|
if (o && "querySelector" in o) {
|
|
255
|
-
const
|
|
256
|
-
|
|
256
|
+
const a = o.querySelector("img");
|
|
257
|
+
a && (t.modifyHtml(a).setAttribute("src", X(n.image_url)).setAttribute("alt", n.name), f = !0);
|
|
257
258
|
const d = o.querySelector("a");
|
|
258
|
-
d && (t.modifyHtml(d).setAttribute("href", n.url),
|
|
259
|
+
d && (t.modifyHtml(d).setAttribute("href", n.url), f = !0);
|
|
259
260
|
}
|
|
260
261
|
if (r && "querySelector" in r) {
|
|
261
|
-
const
|
|
262
|
-
b(t,
|
|
262
|
+
const a = r.querySelector("strong") ?? r.querySelector("p");
|
|
263
|
+
b(t, a ?? null, n.name) && (f = !0);
|
|
263
264
|
}
|
|
264
265
|
if (K({
|
|
265
266
|
documentModifier: t,
|
|
@@ -268,11 +269,11 @@ function se(e) {
|
|
|
268
269
|
oldPriceEl: i,
|
|
269
270
|
omnibusPriceEl: u,
|
|
270
271
|
omnibusDiscountEl: l
|
|
271
|
-
}) && (
|
|
272
|
-
const
|
|
273
|
-
|
|
272
|
+
}) && (f = !0), c && "querySelector" in c) {
|
|
273
|
+
const a = c.querySelector("a.es-button") || c.querySelector("a");
|
|
274
|
+
a && (t.modifyHtml(a).setAttribute("href", n.url), f = !0);
|
|
274
275
|
}
|
|
275
|
-
return
|
|
276
|
+
return f;
|
|
276
277
|
}
|
|
277
278
|
function V(e) {
|
|
278
279
|
return "querySelector" in e ? e.querySelector(L) ?? e : e;
|
|
@@ -308,14 +309,14 @@ function fe(e, t, n) {
|
|
|
308
309
|
let s = !1;
|
|
309
310
|
return r.forEach((i, u) => {
|
|
310
311
|
const l = Math.min(i.length, n.length);
|
|
311
|
-
i.slice(0, l).forEach((c,
|
|
312
|
+
i.slice(0, l).forEach((c, f) => {
|
|
312
313
|
if (!("querySelector" in c))
|
|
313
314
|
return;
|
|
314
|
-
const
|
|
315
|
-
if (
|
|
315
|
+
const a = ae(u, n[f]);
|
|
316
|
+
if (a === null)
|
|
316
317
|
return;
|
|
317
318
|
const d = c.querySelector("p") ?? null;
|
|
318
|
-
b(t, d,
|
|
319
|
+
b(t, d, a) && (s = !0);
|
|
319
320
|
});
|
|
320
321
|
}), s;
|
|
321
322
|
}
|
|
@@ -336,9 +337,9 @@ function O(e, t, n) {
|
|
|
336
337
|
`[esd-extension-block-id="${m.OMNIBUS_DISCOUNT}"]`
|
|
337
338
|
), c = e.querySelectorAll(
|
|
338
339
|
`[esd-extension-block-id="${m.BUTTON}"]`
|
|
339
|
-
),
|
|
340
|
-
let
|
|
341
|
-
for (let d = 0; d <
|
|
340
|
+
), f = Math.min(o.length, n.length);
|
|
341
|
+
let a = !1;
|
|
342
|
+
for (let d = 0; d < f; d++) {
|
|
342
343
|
const p = se({
|
|
343
344
|
documentModifier: t,
|
|
344
345
|
product: n[d],
|
|
@@ -350,33 +351,33 @@ function O(e, t, n) {
|
|
|
350
351
|
omnibusDiscountEl: l[d] ?? null,
|
|
351
352
|
buttonEl: c[d] ?? null
|
|
352
353
|
});
|
|
353
|
-
|
|
354
|
+
a = a || p;
|
|
354
355
|
}
|
|
355
|
-
return fe(e, t, n) && (
|
|
356
|
+
return fe(e, t, n) && (a = !0), a;
|
|
356
357
|
}
|
|
357
358
|
function qe(e) {
|
|
358
|
-
const { currentNode: t, documentModifier: n, products: o } = e;
|
|
359
|
+
const { currentNode: t, documentModifier: n, products: o, forceApply: r = !1 } = e;
|
|
359
360
|
if (!t || !("querySelectorAll" in t))
|
|
360
361
|
return !1;
|
|
361
|
-
const
|
|
362
|
-
if (!("querySelectorAll" in
|
|
362
|
+
const s = V(t);
|
|
363
|
+
if (!("querySelectorAll" in s) || s.querySelectorAll(
|
|
363
364
|
`[esd-extension-block-id="${m.IMAGE}"]`
|
|
364
365
|
).length !== o.length)
|
|
365
366
|
return !1;
|
|
366
|
-
let
|
|
367
|
-
const
|
|
368
|
-
if (
|
|
369
|
-
const
|
|
370
|
-
if (
|
|
367
|
+
let u = O(s, n, o);
|
|
368
|
+
const l = P(t), c = y.getConfig(t);
|
|
369
|
+
if (l !== "list" && c.mobileLayoutEnabled && "querySelector" in t) {
|
|
370
|
+
const f = t.querySelector(N);
|
|
371
|
+
if (f) {
|
|
371
372
|
const a = O(
|
|
372
|
-
|
|
373
|
+
f,
|
|
373
374
|
n,
|
|
374
375
|
o
|
|
375
376
|
);
|
|
376
|
-
|
|
377
|
+
u = u || a;
|
|
377
378
|
}
|
|
378
379
|
}
|
|
379
|
-
return
|
|
380
|
+
return (u || r) && n.apply(new S("Updated product content in-place")), !0;
|
|
380
381
|
}
|
|
381
382
|
function _(e, t, n) {
|
|
382
383
|
if (!("querySelectorAll" in e))
|
|
@@ -417,8 +418,8 @@ function Me(e) {
|
|
|
417
418
|
if (u !== "list" && l.mobileLayoutEnabled && "querySelector" in t) {
|
|
418
419
|
const c = t.querySelector(N);
|
|
419
420
|
if (c) {
|
|
420
|
-
const
|
|
421
|
-
i = i ||
|
|
421
|
+
const f = _(c, n, r);
|
|
422
|
+
i = i || f;
|
|
422
423
|
}
|
|
423
424
|
}
|
|
424
425
|
return i && n.apply(new S("Updated price formatting in-place")), i;
|