@useinsider/guido 3.26.0-beta.19d84af → 3.26.0-beta.511b49f
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 +10 -0
- package/dist/@types/config/schemas.js +98 -94
- package/dist/@types/display-condition.js +25 -0
- package/dist/components/Guido.vue.js +7 -7
- package/dist/components/Guido.vue2.js +105 -95
- package/dist/components/organisms/display-conditions/CodeEditorField.vue.js +17 -0
- package/dist/components/organisms/display-conditions/CodeEditorField.vue2.js +41 -0
- package/dist/components/organisms/display-conditions/DisplayConditionCreateDrawer.vue.js +30 -0
- package/dist/components/organisms/display-conditions/DisplayConditionCreateDrawer.vue2.js +81 -0
- package/dist/components/organisms/display-conditions/DisplayConditionListState.vue.js +17 -0
- package/dist/components/organisms/display-conditions/DisplayConditionListState.vue2.js +45 -0
- package/dist/components/organisms/display-conditions/DisplayConditionSelectDrawer.vue.js +36 -0
- package/dist/components/organisms/display-conditions/DisplayConditionSelectDrawer.vue2.js +63 -0
- package/dist/components/organisms/display-conditions/DisplayConditionsHost.vue.js +17 -0
- package/dist/components/organisms/display-conditions/DisplayConditionsHost.vue2.js +22 -0
- package/dist/components/organisms/onboarding/GenericOnboarding.vue.js +5 -5
- package/dist/components/organisms/onboarding/GenericOnboarding.vue2.js +15 -15
- package/dist/components/organisms/onboarding/ItemsOnboarding.vue.js +6 -6
- package/dist/components/organisms/onboarding/ItemsOnboarding.vue2.js +28 -27
- package/dist/components/organisms/onboarding/RecommendationLegacyStrategyOnboarding.vue.js +3 -3
- package/dist/components/organisms/onboarding/RecommendationLegacyStrategyOnboarding.vue2.js +42 -27
- package/dist/components/organisms/unsubscribe/LegacyUnsubscribeConvertedModal.vue.js +17 -0
- package/dist/components/organisms/unsubscribe/LegacyUnsubscribeConvertedModal.vue2.js +30 -0
- package/dist/composables/useBlocksConfig.js +29 -20
- package/dist/composables/useCustomInterfaceAppearance.js +50 -50
- package/dist/composables/useDisplayConditions.js +116 -0
- package/dist/composables/useFullStoryBridge.js +10 -9
- package/dist/composables/useModuleRepair.js +33 -24
- package/dist/composables/useTranslations.js +2 -1
- package/dist/config/compiler/utils/itemsCompilerUtils.js +43 -42
- package/dist/config/compiler/utils/recommendationCompilerUtils.js +67 -64
- package/dist/config/migrator/index.js +8 -7
- package/dist/config/migrator/legacyUnsubscribeTextMigrator.js +16 -0
- package/dist/enums/academy.js +3 -1
- package/dist/enums/display-condition.js +12 -0
- package/dist/extensions/Blocks/Recommendation/controls/main/strategy.js +52 -40
- package/dist/extensions/Blocks/common-control.js +19 -19
- package/dist/extensions/DisplayConditions/bridge.js +25 -0
- package/dist/extensions/DisplayConditions/constants.js +26 -0
- package/dist/extensions/DisplayConditions/control.js +215 -0
- package/dist/extensions/DisplayConditions/display-conditions.css.js +226 -0
- package/dist/extensions/DisplayConditions/extension.js +28 -0
- package/dist/extensions/DisplayConditions/iconsRegistry.js +20 -0
- package/dist/extensions/DisplayConditions/library.js +30 -0
- package/dist/extensions/DisplayConditions/settingsPanel.js +17 -0
- package/dist/extensions/DynamicContent/dynamic-content.js +15 -17
- package/dist/guido.css +1 -1
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js +93 -92
- package/dist/node_modules/valibot/dist/index.js +297 -261
- package/dist/package.json.js +1 -1
- package/dist/services/displayConditionApi.js +39 -0
- package/dist/src/@types/config/schemas.d.ts +8 -0
- package/dist/src/@types/display-condition.d.ts +61 -0
- package/dist/src/components/organisms/display-conditions/CodeEditorField.vue.d.ts +43 -0
- package/dist/src/components/organisms/display-conditions/DisplayConditionCreateDrawer.vue.d.ts +2 -0
- package/dist/src/components/organisms/display-conditions/DisplayConditionListState.vue.d.ts +18 -0
- package/dist/src/components/organisms/display-conditions/DisplayConditionSelectDrawer.vue.d.ts +2 -0
- package/dist/src/components/organisms/display-conditions/DisplayConditionsHost.vue.d.ts +2 -0
- package/dist/src/components/organisms/unsubscribe/LegacyUnsubscribeConvertedModal.vue.d.ts +2 -0
- package/dist/src/composables/useConfig.d.ts +4 -0
- package/dist/src/composables/useDisplayConditions.d.ts +18 -0
- package/dist/src/composables/useModuleRepair.d.ts +2 -11
- package/dist/src/config/migrator/legacyUnsubscribeTextMigrator.d.ts +1 -0
- package/dist/src/enums/academy.d.ts +2 -0
- package/dist/src/enums/display-condition.d.ts +15 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/main/strategy.d.ts +2 -0
- package/dist/src/extensions/DisplayConditions/bridge.d.ts +7 -0
- package/dist/src/extensions/DisplayConditions/constants.d.ts +23 -0
- package/dist/src/extensions/DisplayConditions/control.d.ts +25 -0
- package/dist/src/extensions/DisplayConditions/extension.d.ts +2 -0
- package/dist/src/extensions/DisplayConditions/iconsRegistry.d.ts +4 -0
- package/dist/src/extensions/DisplayConditions/library.d.ts +8 -0
- package/dist/src/extensions/DisplayConditions/settingsPanel.d.ts +5 -0
- package/dist/src/mock/api/display-conditions.d.ts +2 -0
- package/dist/src/services/displayConditionApi.d.ts +8 -0
- package/dist/src/stores/config.d.ts +190 -0
- package/dist/src/stores/display-condition.d.ts +86 -0
- package/dist/src/stores/editor.d.ts +27 -0
- package/dist/src/stores/onboarding.d.ts +1 -0
- package/dist/src/utils/displayCondition.d.ts +11 -0
- package/dist/src/utils/editorShadowRoot.d.ts +1 -0
- package/dist/src/utils/legacyUnsubscribeConversion.d.ts +10 -0
- package/dist/src/utils/protectTableText.d.ts +2 -0
- package/dist/static/styles/variables.css.js +1 -0
- package/dist/stores/config.js +13 -6
- package/dist/stores/display-condition.js +29 -0
- package/dist/stores/editor.js +1 -0
- package/dist/stores/onboarding.js +4 -1
- package/dist/utils/displayCondition.js +29 -0
- package/dist/utils/editorShadowRoot.js +8 -0
- package/dist/utils/legacyUnsubscribeConversion.js +49 -0
- package/dist/utils/pairProductVariables.js +29 -28
- package/dist/utils/protectTableText.js +22 -0
- package/package.json +1 -1
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { useConfig as C } from "../../../composables/useConfig.js";
|
|
2
2
|
import { useRecommendation as O } from "../../../composables/useRecommendation.js";
|
|
3
|
-
import { MOBILE_ROW_SELECTOR as q, MOBILE_CONTAINER_SELECTOR as M, CSS_CLASS_RECO_BUTTON as
|
|
4
|
-
import { useRecommendationExtensionStore as
|
|
5
|
-
import {
|
|
6
|
-
|
|
3
|
+
import { MOBILE_ROW_SELECTOR as q, MOBILE_CONTAINER_SELECTOR as M, CSS_CLASS_RECO_BUTTON as T } from "../../../extensions/Blocks/Recommendation/constants/selectors.js";
|
|
4
|
+
import { useRecommendationExtensionStore as B } from "../../../extensions/Blocks/Recommendation/store/recommendation.js";
|
|
5
|
+
import { protectTableText as N, restoreTableText as L } from "../../../utils/protectTableText.js";
|
|
6
|
+
import { isIgnoredRecommendationBlock as P } from "./recommendationIgnoreUtils.js";
|
|
7
|
+
function R(t, r, e, o, c = "") {
|
|
7
8
|
const i = `{{${c}${t}_${r}_${e}}}`, n = `{{${c}${t}_${r}_currency}}`;
|
|
8
9
|
return o === "before" ? `${n} ${i}` : `${i} ${n}`;
|
|
9
10
|
}
|
|
10
|
-
function
|
|
11
|
+
function b(t) {
|
|
11
12
|
let r = t;
|
|
12
13
|
for (; r.children.length === 1; )
|
|
13
14
|
[r] = r.children;
|
|
@@ -19,12 +20,12 @@ function _(t, r, e, o, c, i) {
|
|
|
19
20
|
const n = t.querySelector("img");
|
|
20
21
|
n && (n.setAttribute("src", `{{${i}${e}_${o}_image_url}}`), n.setAttribute("alt", `{{${i}${e}_${o}_name}}`));
|
|
21
22
|
const s = t.querySelector("a");
|
|
22
|
-
s && (s.setAttribute("href", `{{${i}${e}_${o}_url}}`), s.classList.add(
|
|
23
|
+
s && (s.setAttribute("href", `{{${i}${e}_${o}_url}}`), s.classList.add(T));
|
|
23
24
|
break;
|
|
24
25
|
}
|
|
25
26
|
case "productName": {
|
|
26
27
|
const n = t.querySelector("p");
|
|
27
|
-
n && (
|
|
28
|
+
n && (b(n).textContent = `{{${i}${e}_${o}_name}}`);
|
|
28
29
|
break;
|
|
29
30
|
}
|
|
30
31
|
// Inline mode ("Move to next line" OFF) merges BOTH prices into one row
|
|
@@ -32,16 +33,16 @@ function _(t, r, e, o, c, i) {
|
|
|
32
33
|
// substitute by cell content, not by the row's anchor (SD-145161).
|
|
33
34
|
case "productPrice":
|
|
34
35
|
case "productOldPrice": {
|
|
35
|
-
const n = (
|
|
36
|
-
|
|
36
|
+
const n = (l, d) => {
|
|
37
|
+
l && (b(l).textContent = R(
|
|
37
38
|
e,
|
|
38
39
|
o,
|
|
39
|
-
|
|
40
|
+
d,
|
|
40
41
|
c,
|
|
41
42
|
i
|
|
42
43
|
));
|
|
43
|
-
}, s = t.querySelector(".product-price p"),
|
|
44
|
-
n(s ?? (r === "productPrice" ? u : null), "price"), n(
|
|
44
|
+
}, s = t.querySelector(".product-price p"), a = t.querySelector(".product-old-price p"), u = !s && !a ? t.querySelector("p") : null;
|
|
45
|
+
n(s ?? (r === "productPrice" ? u : null), "price"), n(a ?? (r === "productOldPrice" ? u : null), "original_price");
|
|
45
46
|
break;
|
|
46
47
|
}
|
|
47
48
|
case "productButton": {
|
|
@@ -70,72 +71,72 @@ function _(t, r, e, o, c, i) {
|
|
|
70
71
|
default: {
|
|
71
72
|
const n = t.getAttribute("product-attr") ? t : t.querySelector("[product-attr]");
|
|
72
73
|
if (n) {
|
|
73
|
-
const s = n.getAttribute("product-attr"),
|
|
74
|
-
|
|
74
|
+
const s = n.getAttribute("product-attr"), a = n.querySelector("p");
|
|
75
|
+
a && (b(a).textContent = `{{${i}${e}_${o}_${s}}}`);
|
|
75
76
|
}
|
|
76
77
|
break;
|
|
77
78
|
}
|
|
78
79
|
}
|
|
79
80
|
}
|
|
80
|
-
const
|
|
81
|
+
const w = "name";
|
|
81
82
|
function y(t, r, e, o) {
|
|
82
|
-
const c = `${o}${r}_${e}_${
|
|
83
|
+
const c = `${o}${r}_${e}_${w}`;
|
|
83
84
|
return {
|
|
84
85
|
open: t.createComment(`{% if ${c} and ${c} != "" %}`),
|
|
85
86
|
close: t.createComment("{% endif %}")
|
|
86
87
|
};
|
|
87
88
|
}
|
|
88
|
-
function
|
|
89
|
+
function D(t, r, e) {
|
|
89
90
|
return y(t, r, 0, e);
|
|
90
91
|
}
|
|
91
|
-
function
|
|
92
|
+
function v(t, r, e, o) {
|
|
92
93
|
if (!t.innerHTML.includes("{{"))
|
|
93
94
|
return;
|
|
94
95
|
const { open: c, close: i } = y(t.ownerDocument, r, e, o);
|
|
95
96
|
t.insertBefore(c, t.firstChild), t.appendChild(i);
|
|
96
97
|
}
|
|
97
|
-
function
|
|
98
|
+
function W(t, r, e, o) {
|
|
98
99
|
var n, s;
|
|
99
100
|
if (!t.innerHTML.includes("{{"))
|
|
100
101
|
return;
|
|
101
102
|
const { open: c, close: i } = y(t.ownerDocument, r, e, o);
|
|
102
103
|
(n = t.parentNode) == null || n.insertBefore(c, t), (s = t.parentNode) == null || s.insertBefore(i, t.nextSibling);
|
|
103
104
|
}
|
|
104
|
-
function
|
|
105
|
+
function H(t, r, e, o) {
|
|
105
106
|
t.querySelectorAll(".recommendation-product-row").forEach((i, n) => {
|
|
106
|
-
i.querySelectorAll("[data-attribute-type]").forEach((
|
|
107
|
-
const u =
|
|
108
|
-
|
|
109
|
-
_(
|
|
110
|
-
}) : _(
|
|
111
|
-
}),
|
|
107
|
+
i.querySelectorAll("[data-attribute-type]").forEach((a) => {
|
|
108
|
+
const u = a.getAttribute("data-attribute-type") || "", l = a.querySelectorAll(".attribute-cell");
|
|
109
|
+
l.length > 0 ? l.forEach((d) => {
|
|
110
|
+
_(d, u, r, n, e, o);
|
|
111
|
+
}) : _(a, u, r, n, e, o);
|
|
112
|
+
}), W(i, r, n, o);
|
|
112
113
|
});
|
|
113
114
|
}
|
|
114
|
-
function
|
|
115
|
+
function x(t, r, e, o) {
|
|
115
116
|
const c = t.querySelectorAll(".recommendation-product-row");
|
|
116
117
|
if (!c.length)
|
|
117
118
|
return;
|
|
118
119
|
const [i] = c, n = i.querySelector("[data-attribute-type]"), s = n ? n.querySelectorAll(".attribute-cell").length : 1;
|
|
119
|
-
c.forEach((
|
|
120
|
-
|
|
121
|
-
const p =
|
|
122
|
-
|
|
120
|
+
c.forEach((a, u) => {
|
|
121
|
+
a.querySelectorAll("[data-attribute-type]").forEach((d) => {
|
|
122
|
+
const p = d.getAttribute("data-attribute-type") || "";
|
|
123
|
+
d.querySelectorAll(".attribute-cell").forEach((m, h) => {
|
|
123
124
|
const S = u * s + h;
|
|
124
|
-
_(m, p, r, S, e, o),
|
|
125
|
+
_(m, p, r, S, e, o), v(m, r, S, o);
|
|
125
126
|
});
|
|
126
127
|
});
|
|
127
128
|
});
|
|
128
129
|
}
|
|
129
|
-
function
|
|
130
|
+
function F(t, r, e, o) {
|
|
130
131
|
t.querySelectorAll(".ins-recommendation-product-container").forEach((i) => {
|
|
131
|
-
|
|
132
|
+
x(i, r, e, o);
|
|
132
133
|
});
|
|
133
134
|
}
|
|
134
|
-
function
|
|
135
|
+
function G(t, r, e) {
|
|
135
136
|
const o = t.getAttribute("data-layout") || "grid", c = t.getAttribute("currency-alignment"), i = c === "0" || c === "before" ? "before" : "after";
|
|
136
|
-
o === "list" ?
|
|
137
|
+
o === "list" ? H(t, r, i, e) : F(t, r, i, e);
|
|
137
138
|
}
|
|
138
|
-
function
|
|
139
|
+
function A(t, r, e) {
|
|
139
140
|
const o = new RegExp(`${r}\\s*:\\s*(\\d+)\\s*px`, "i"), c = t.match(o);
|
|
140
141
|
return c ? parseInt(c[1]) : e;
|
|
141
142
|
}
|
|
@@ -150,7 +151,7 @@ function g(t) {
|
|
|
150
151
|
const e = (t.getAttribute("style") || "").match(/(?:^|[;\s])width\s*:\s*(\d+(?:\.\d+)?(?:px|%))/i);
|
|
151
152
|
return e && $(e[1]) ? e[1] : null;
|
|
152
153
|
}
|
|
153
|
-
function
|
|
154
|
+
function V(t, r) {
|
|
154
155
|
let e = t.parentElement;
|
|
155
156
|
for (; e && e !== r; ) {
|
|
156
157
|
if (e.tagName === "TD" && g(e))
|
|
@@ -159,62 +160,64 @@ function x(t, r) {
|
|
|
159
160
|
}
|
|
160
161
|
return null;
|
|
161
162
|
}
|
|
162
|
-
function
|
|
163
|
-
const r = t.getAttribute("style") || "", e =
|
|
163
|
+
function U(t) {
|
|
164
|
+
const r = t.getAttribute("style") || "", e = A(r, "width", 600), o = A(r, "padding", 0) * 2, c = Math.max(0, e - o);
|
|
164
165
|
c !== 0 && t.querySelectorAll("img.adapt-img").forEach((i) => {
|
|
165
166
|
if (i.hasAttribute("width"))
|
|
166
167
|
return;
|
|
167
|
-
const n =
|
|
168
|
+
const n = V(i, t);
|
|
168
169
|
if (!n)
|
|
169
170
|
return;
|
|
170
|
-
const s = g(n),
|
|
171
|
+
const s = g(n), a = A(n.getAttribute("style") || "", "padding", 0) * 2, u = s.endsWith("%") ? Math.floor(c * parseFloat(s) / 100) : parseInt(s), l = Math.max(1, u - a), d = i.getAttribute("style") || "", p = /(?:^|[;\s])max-height\s*:\s*(\d+(?:\.\d+)?)px/i.exec(d);
|
|
171
172
|
if (p) {
|
|
172
|
-
i.setAttribute("width", String(Math.max(1, Math.min(
|
|
173
|
+
i.setAttribute("width", String(Math.max(1, Math.min(l, Math.floor(parseFloat(p[1])))))), i.removeAttribute("height");
|
|
173
174
|
return;
|
|
174
175
|
}
|
|
175
|
-
if (i.setAttribute("width", String(
|
|
176
|
-
const f =
|
|
177
|
-
i.setAttribute("style", `${
|
|
176
|
+
if (i.setAttribute("width", String(l)), !/\bwidth\s*:\s*\d/i.test(d)) {
|
|
177
|
+
const f = d && !d.trim().endsWith(";") ? "; " : "";
|
|
178
|
+
i.setAttribute("style", `${d}${f}width: ${l}px`);
|
|
178
179
|
}
|
|
179
180
|
});
|
|
180
181
|
}
|
|
181
|
-
const E = "MSO_MOBILE_HIDE_START",
|
|
182
|
-
function
|
|
182
|
+
const E = "MSO_MOBILE_HIDE_START", X = "MSO_MOBILE_HIDE_END";
|
|
183
|
+
function j(t, r) {
|
|
183
184
|
t.querySelectorAll(q).forEach((e) => {
|
|
184
185
|
var i, n;
|
|
185
186
|
const o = e.querySelector(M);
|
|
186
187
|
if (!o || o.children.length === 0)
|
|
187
188
|
return;
|
|
188
189
|
const c = e.previousSibling;
|
|
189
|
-
(c == null ? void 0 : c.nodeType) === Node.COMMENT_NODE && c.data === E || ((i = e.parentNode) == null || i.insertBefore(r.createComment(E), e), (n = e.parentNode) == null || n.insertBefore(r.createComment(
|
|
190
|
+
(c == null ? void 0 : c.nodeType) === Node.COMMENT_NODE && c.data === E || ((i = e.parentNode) == null || i.insertBefore(r.createComment(E), e), (n = e.parentNode) == null || n.insertBefore(r.createComment(X), e.nextSibling));
|
|
190
191
|
});
|
|
191
192
|
}
|
|
192
|
-
function
|
|
193
|
+
function Y(t, r) {
|
|
193
194
|
const e = t.match(/<!DOCTYPE[^>]*>/i);
|
|
194
195
|
return (e ? `${e[0]}
|
|
195
196
|
` : "") + r.documentElement.outerHTML;
|
|
196
197
|
}
|
|
197
|
-
function
|
|
198
|
-
const r = t.replaceAll("{%", "<!--{%").replaceAll("%}", "%}-->"), e = new DOMParser().parseFromString(r, "text/html"), o = e.querySelectorAll(".recommendation-block-v2");
|
|
198
|
+
function I(t) {
|
|
199
|
+
const r = N(t).replaceAll("{%", "<!--{%").replaceAll("%}", "%}-->"), e = new DOMParser().parseFromString(r, "text/html"), o = e.querySelectorAll(".recommendation-block-v2");
|
|
199
200
|
if (!o.length)
|
|
200
201
|
return t;
|
|
201
|
-
const { buildCampaignUrl: c } = O(), i =
|
|
202
|
+
const { buildCampaignUrl: c } = O(), i = B();
|
|
202
203
|
i.recommendationCampaignUrls = {};
|
|
203
204
|
const { isFeatureEnabled: n } = C(), s = n("liquidSyntax") ? "reco_" : "";
|
|
204
|
-
|
|
205
|
-
var
|
|
206
|
-
const
|
|
207
|
-
if (
|
|
208
|
-
if ((
|
|
209
|
-
|
|
210
|
-
const { open: h, close: S } =
|
|
205
|
+
o.forEach((u) => {
|
|
206
|
+
var d, p, f, m;
|
|
207
|
+
const l = u.getAttribute("recommendation-id");
|
|
208
|
+
if (l) {
|
|
209
|
+
if ((d = u.parentNode) == null || d.insertBefore(e.createComment("REC_START"), u), (p = u.parentNode) == null || p.insertBefore(e.createComment("REC_END"), u.nextSibling), u.querySelectorAll('[data-visibility="0"]').forEach((h) => h.remove()), c(l), j(u, e), !P(u)) {
|
|
210
|
+
G(u, l, s);
|
|
211
|
+
const { open: h, close: S } = D(e, l, s);
|
|
211
212
|
(f = u.parentNode) == null || f.insertBefore(h, u), (m = u.parentNode) == null || m.insertBefore(S, u.nextSibling);
|
|
212
213
|
}
|
|
213
|
-
|
|
214
|
+
U(u);
|
|
214
215
|
}
|
|
215
|
-
})
|
|
216
|
+
});
|
|
217
|
+
const a = Y(r, e);
|
|
218
|
+
return L(a.replaceAll("<!--{%", "{%").replaceAll("%}-->", "%}").replaceAll("<!--{%", "{%").replaceAll("%}-->", "%}"));
|
|
216
219
|
}
|
|
217
220
|
export {
|
|
218
|
-
|
|
219
|
-
|
|
221
|
+
R as formatPriceVariable,
|
|
222
|
+
I as prepareRecommendationBlocks
|
|
220
223
|
};
|
|
@@ -3,17 +3,18 @@ import { migrateCouponBlock as a } from "./couponBlockMigrator.js";
|
|
|
3
3
|
import { migrateFullStoryScripts as c } from "./fullStoryScriptMigrator.js";
|
|
4
4
|
import { migrateItemsBlock as g } from "./itemsBlockMigrator.js";
|
|
5
5
|
import { migrateItemsPriceFormat as n } from "./itemsPriceFormatMigrator.js";
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
6
|
+
import { migrateLegacyUnsubscribeText as p } from "./legacyUnsubscribeTextMigrator.js";
|
|
7
|
+
import { migrateProductNameLink as f } from "./productNameLinkMigrator.js";
|
|
8
|
+
import { migrateRadioButton as l } from "./radioButtonMigrator.js";
|
|
9
|
+
import { migrateRecommendation as s } from "./recommendationMigrator.js";
|
|
9
10
|
import { migrateRecommendationPartnerScope as d } from "./recommendationPartnerMigrator.js";
|
|
10
|
-
import { migrateRecommendationTitle as
|
|
11
|
+
import { migrateRecommendationTitle as b } from "./recommendationTitleMigrator.js";
|
|
11
12
|
import { migrateSocialIcons as k } from "./socialIconMigrator.js";
|
|
12
13
|
import { migrateUnsubscribe as P } from "./unsubscribeMigrator.js";
|
|
13
|
-
const
|
|
14
|
+
const w = async (t, i = {}, o, r) => {
|
|
14
15
|
let m = t;
|
|
15
|
-
return m = e(m), m =
|
|
16
|
+
return m = e(m), m = l(m), m = p(m), m = await P(m), m = a(m), m = s(m, i), o && (m = d(m, o)), m = b(m), m = g(m), r != null && r.itemsPriceFormatting && (m = n(m)), m = f(m), m = k(m), m = c(m), m;
|
|
16
17
|
};
|
|
17
18
|
export {
|
|
18
|
-
|
|
19
|
+
w as migrate
|
|
19
20
|
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { useConfigStore as o } from "../../stores/config.js";
|
|
2
|
+
import { useEditorStore as s } from "../../stores/editor.js";
|
|
3
|
+
import { hasLegacyUnsubscribeClass as c, convertLegacyUnsubscribeInDocumentHtml as i } from "../../utils/legacyUnsubscribeConversion.js";
|
|
4
|
+
const b = (e) => {
|
|
5
|
+
try {
|
|
6
|
+
if (!c(e) || !o().isFeatureEnabled("legacyUnsubscribeConversion"))
|
|
7
|
+
return e;
|
|
8
|
+
const { html: r, converted: t } = i(e);
|
|
9
|
+
return t && (s().isLegacyUnsubscribeModalRequested = !0), r;
|
|
10
|
+
} catch (r) {
|
|
11
|
+
return console.error("LegacyUnsubscribeTextMigrator failed:", r), e;
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
export {
|
|
15
|
+
b as migrateLegacyUnsubscribeText
|
|
16
|
+
};
|
package/dist/enums/academy.js
CHANGED
|
@@ -2,7 +2,9 @@ const e = "https://academy.insiderone.com", o = {
|
|
|
2
2
|
EMAIL_EDITOR: `${e}/docs/email-drag-and-drop-editor`,
|
|
3
3
|
GLOBAL_UNSUBSCRIBE: `${e}/docs/global-unsubscribe-preference-center`,
|
|
4
4
|
AMP_FOR_EMAILS: `${e}/docs/amp-for-emails`,
|
|
5
|
-
|
|
5
|
+
EMAIL_DISPLAY_CONDITIONS: `${e}/docs/new-editor-add-display-conditions-to-an-email`,
|
|
6
|
+
EMAIL_RECOMMENDATION_BLOCK: `${e}/docs/new-editor-email-recommendation-block`,
|
|
7
|
+
LEGACY_UNSUBSCRIBE_MODULE: `${e}/docs/new-editor-add-unsubscribe-pages-into-emails`
|
|
6
8
|
};
|
|
7
9
|
export {
|
|
8
10
|
o as ACADEMY_LINKS
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
var N = /* @__PURE__ */ ((I) => (I.OPEN = "display-condition:open", I.APPLY = "display-condition:apply", I.CANCEL = "display-condition:cancel", I))(N || {}), A = /* @__PURE__ */ ((I) => (I.INLINE = "inline", I.SAVED = "saved", I))(A || {});
|
|
2
|
+
const M = {
|
|
3
|
+
NAME_MIN: 2,
|
|
4
|
+
NAME_MAX: 40,
|
|
5
|
+
DESCRIPTION_MAX: 200,
|
|
6
|
+
CODE_MAX: 65535
|
|
7
|
+
};
|
|
8
|
+
export {
|
|
9
|
+
M as DISPLAY_CONDITION_LIMITS,
|
|
10
|
+
N as DisplayConditionEvent,
|
|
11
|
+
A as DisplayConditionSourceType
|
|
12
|
+
};
|
|
@@ -1,34 +1,34 @@
|
|
|
1
|
-
var
|
|
2
|
-
var N = (
|
|
3
|
-
var
|
|
4
|
-
import { useLegacyStrategyConversion as
|
|
5
|
-
import { ACADEMY_LINKS as
|
|
6
|
-
import { useOnboardingStore as
|
|
1
|
+
var A = Object.defineProperty;
|
|
2
|
+
var N = (g, o, t) => o in g ? A(g, o, { enumerable: !0, configurable: !0, writable: !0, value: t }) : g[o] = t;
|
|
3
|
+
var r = (g, o, t) => N(g, typeof o != "symbol" ? o + "" : o, t);
|
|
4
|
+
import { useLegacyStrategyConversion as O } from "../../../../../composables/useLegacyStrategyConversion.js";
|
|
5
|
+
import { ACADEMY_LINKS as w } from "../../../../../enums/academy.js";
|
|
6
|
+
import { useOnboardingStore as $ } from "../../../../../stores/onboarding.js";
|
|
7
7
|
import { CommonControl as R } from "../../../common-control.js";
|
|
8
8
|
import { RRS_CONFIG_VERSION as E } from "../../constants/defaultConfig.js";
|
|
9
|
-
import { RecommendationConfigService as
|
|
10
|
-
import { useRecommendationExtensionStore as
|
|
11
|
-
const
|
|
12
|
-
class
|
|
9
|
+
import { RecommendationConfigService as k } from "../../services/configService.js";
|
|
10
|
+
import { useRecommendationExtensionStore as I } from "../../store/recommendation.js";
|
|
11
|
+
const q = "recommendation-strategy-control", y = "recommendationLegacyStrategyOnboarding";
|
|
12
|
+
class Y extends R {
|
|
13
13
|
constructor() {
|
|
14
14
|
super(...arguments);
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
15
|
+
r(this, "store", I());
|
|
16
|
+
r(this, "onboardingStore", $());
|
|
17
|
+
r(this, "legacyConversion", O());
|
|
18
|
+
r(this, "storeUnsubscription", () => {
|
|
19
19
|
});
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
r(this, "listeners", []);
|
|
21
|
+
r(this, "lastPaintedState", null);
|
|
22
22
|
}
|
|
23
23
|
getId() {
|
|
24
|
-
return
|
|
24
|
+
return q;
|
|
25
25
|
}
|
|
26
26
|
getTemplate() {
|
|
27
27
|
const t = this.api.translate(
|
|
28
28
|
"You can assign a recommendation strategy by selecting an existing one or creating a new one to show specific content."
|
|
29
|
-
), e = this.api.translate("For more information, you can"), a = this.api.translate("visit Academy"),
|
|
29
|
+
), e = this.api.translate("For more information, you can"), a = this.api.translate("visit Academy"), i = this.api.translate("Legacy Strategy"), s = this.api.translate(
|
|
30
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."
|
|
31
|
-
),
|
|
31
|
+
), l = this.api.translate(
|
|
32
32
|
"The recommendation strategy used in the recommendation block is no longer available. You can assign a different strategy to it."
|
|
33
33
|
);
|
|
34
34
|
return `
|
|
@@ -54,7 +54,7 @@ class P extends R {
|
|
|
54
54
|
${t}
|
|
55
55
|
${e}
|
|
56
56
|
<a
|
|
57
|
-
href="${
|
|
57
|
+
href="${w.EMAIL_RECOMMENDATION_BLOCK}"
|
|
58
58
|
target="_blank"
|
|
59
59
|
rel="noopener noreferrer">${a}</a>.
|
|
60
60
|
</p>
|
|
@@ -78,7 +78,7 @@ class P extends R {
|
|
|
78
78
|
<div data-strategy-unavailable-state style="display: none;">
|
|
79
79
|
<div class="strategy-control-notice-row">
|
|
80
80
|
<div class="strategy-control-notice strategy-control-notice--error" role="alert">
|
|
81
|
-
<p class="strategy-control-notice-text">${
|
|
81
|
+
<p class="strategy-control-notice-text">${l}</p>
|
|
82
82
|
</div>
|
|
83
83
|
</div>
|
|
84
84
|
${this._GuTwoColumns([
|
|
@@ -103,7 +103,7 @@ class P extends R {
|
|
|
103
103
|
</div>
|
|
104
104
|
</div>
|
|
105
105
|
<div class="strategy-control-name-band">
|
|
106
|
-
<span class="strategy-control-name">${
|
|
106
|
+
<span class="strategy-control-name">${i}</span>
|
|
107
107
|
${this._strategyAction({
|
|
108
108
|
id: "guido__btn-update-legacy-strategy",
|
|
109
109
|
label: this.api.translate("Update"),
|
|
@@ -170,13 +170,15 @@ class P extends R {
|
|
|
170
170
|
* strategyId) for an assigned block.
|
|
171
171
|
*/
|
|
172
172
|
_isNodeUnassigned() {
|
|
173
|
-
if (!
|
|
173
|
+
if (!k.hasConfig(this.currentNode))
|
|
174
174
|
return !1;
|
|
175
|
-
const t =
|
|
175
|
+
const t = k.getConfig(this.currentNode);
|
|
176
176
|
return !t.strategyId && (t.configVersion ?? 0) >= E;
|
|
177
177
|
}
|
|
178
178
|
onDestroy() {
|
|
179
|
-
this._teardown()
|
|
179
|
+
this._teardown(), requestAnimationFrame(() => {
|
|
180
|
+
this.store.strategyPanelOpen || this._closeLegacyOnboarding();
|
|
181
|
+
});
|
|
180
182
|
}
|
|
181
183
|
_teardown() {
|
|
182
184
|
this.store.strategyPanelOpen = !1, this.storeUnsubscription(), this.storeUnsubscription = () => {
|
|
@@ -186,37 +188,47 @@ class P extends R {
|
|
|
186
188
|
const t = this.getContainer();
|
|
187
189
|
if (!t)
|
|
188
190
|
return;
|
|
189
|
-
const e = (a,
|
|
191
|
+
const e = (a, i) => {
|
|
190
192
|
const s = t.querySelector(a);
|
|
191
|
-
s && (s.addEventListener("click",
|
|
193
|
+
s && (s.addEventListener("click", i), this.listeners.push({ element: s, handler: i }));
|
|
192
194
|
};
|
|
193
195
|
e("#guido__btn-assign-strategy", () => this.store.openAssignStrategyDrawer()), e("#guido__btn-create-strategy", () => this.store.openStrategyCreation()), e("#guido__btn-assign-unavailable-strategy", () => this.store.openAssignStrategyDrawer()), e("#guido__btn-create-unavailable-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", () => {
|
|
194
196
|
this.legacyConversion.convertLegacyStrategy();
|
|
195
197
|
});
|
|
196
198
|
}
|
|
199
|
+
_closeLegacyOnboarding() {
|
|
200
|
+
this.onboardingStore.isActive(y) && this.onboardingStore.resetOnboarding(y);
|
|
201
|
+
}
|
|
202
|
+
_syncLegacyOnboarding(t) {
|
|
203
|
+
if (!t) {
|
|
204
|
+
this._closeLegacyOnboarding();
|
|
205
|
+
return;
|
|
206
|
+
}
|
|
207
|
+
this.onboardingStore.closedThisSession.includes(y) || this.onboardingStore.startOnboarding(y);
|
|
208
|
+
}
|
|
197
209
|
_renderState() {
|
|
198
|
-
var
|
|
199
|
-
const { strategyId: t } = this.store.recommendationConfigs, e = t ? ((
|
|
200
|
-
if (
|
|
210
|
+
var L;
|
|
211
|
+
const { strategyId: t } = this.store.recommendationConfigs, e = t ? ((L = this.store.assignedStrategy) == null ? void 0 : L.name) ?? "" : "", a = !!t && !e && (this.store.strategiesLoading || !this.store.strategiesSettled), i = !!t && !e && !a && this.store.strategiesFetched, s = this.store.legacyConversionLoading, l = this.store.isLegacyStrategyBlock, v = [t, e, a, i, s, l].join("\0");
|
|
212
|
+
if (v === this.lastPaintedState)
|
|
201
213
|
return;
|
|
202
214
|
const n = this.getContainer();
|
|
203
215
|
if (!n)
|
|
204
216
|
return;
|
|
205
|
-
const
|
|
206
|
-
if (!
|
|
217
|
+
const h = n.querySelector("[data-strategy-empty-state]"), u = n.querySelector("[data-strategy-assigned-state]"), c = n.querySelector("[data-strategy-legacy-state]"), m = n.querySelector("[data-strategy-unavailable-state]"), b = n.querySelector("[data-strategy-loading-state]"), _ = n.querySelector("[data-strategy-content]"), p = n.querySelector("[data-strategy-name]"), S = n.querySelector("[data-strategy-name-skeleton]");
|
|
218
|
+
if (!h || !u || !c || !m)
|
|
207
219
|
return;
|
|
208
|
-
|
|
209
|
-
const
|
|
210
|
-
[
|
|
211
|
-
d.style.display = d ===
|
|
220
|
+
b && (b.style.display = "none"), _ && (_.style.display = "");
|
|
221
|
+
const f = t ? i ? m : u : l ? c : h;
|
|
222
|
+
[h, u, c, m].forEach((d) => {
|
|
223
|
+
d.style.display = d === f ? "" : "none";
|
|
212
224
|
}), c.querySelectorAll("button").forEach((d) => {
|
|
213
225
|
d.disabled = s;
|
|
214
226
|
}), c.classList.toggle("is-converting", s), !t && this._isNodeUnassigned() && this.onboardingStore.startOnboarding("recommendationStrategyOnboarding");
|
|
215
|
-
const
|
|
216
|
-
|
|
227
|
+
const C = this.store.currentRecommendationId;
|
|
228
|
+
C !== null && this.store.blockStates[C] && this._syncLegacyOnboarding(f === c), p && (p.style.display = a ? "none" : "", t && !a && (p.textContent = e || `#${t}`)), S && (S.style.display = a ? "block" : "none"), this.lastPaintedState = v;
|
|
217
229
|
}
|
|
218
230
|
}
|
|
219
231
|
export {
|
|
220
|
-
|
|
221
|
-
|
|
232
|
+
q as STRATEGY_CONTROL_ID,
|
|
233
|
+
Y as StrategyControl
|
|
222
234
|
};
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
var u = Object.defineProperty;
|
|
2
|
-
var c = (l,
|
|
3
|
-
var i = (l,
|
|
4
|
-
import {
|
|
5
|
-
|
|
2
|
+
var c = (l, r, e) => r in l ? u(l, r, { enumerable: !0, configurable: !0, writable: !0, value: e }) : l[r] = e;
|
|
3
|
+
var i = (l, r, e) => c(l, typeof r != "symbol" ? r + "" : r, e);
|
|
4
|
+
import { findEditorShadowRoot as I } from "../../utils/editorShadowRoot.js";
|
|
5
|
+
import { Control as O, UIElementType as n, UEAttr as $ } from "../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
6
|
+
class R extends O {
|
|
6
7
|
constructor() {
|
|
7
8
|
super(...arguments);
|
|
8
9
|
i(this, "currentNode");
|
|
@@ -11,8 +12,7 @@ class _ extends I {
|
|
|
11
12
|
i(this, "isAwaitingPanelNode", !1);
|
|
12
13
|
}
|
|
13
14
|
getContainer() {
|
|
14
|
-
|
|
15
|
-
return (e = document.querySelector("ui-editor")) == null ? void 0 : e.shadowRoot;
|
|
15
|
+
return I();
|
|
16
16
|
}
|
|
17
17
|
onTemplateNodeUpdated(e) {
|
|
18
18
|
this.currentNode = e;
|
|
@@ -98,13 +98,13 @@ class _ extends I {
|
|
|
98
98
|
* and combines it with the text in Stripo's alert-message layout.
|
|
99
99
|
*/
|
|
100
100
|
_setInfoMessageValue(e, t) {
|
|
101
|
-
const o = this.getContainer(), a = o.querySelector(`[data-icon-key="${e}"]`),
|
|
101
|
+
const o = this.getContainer(), a = o.querySelector(`[data-icon-key="${e}"]`), E = a == null ? void 0 : a.querySelector("ue-icon-component"), s = (E == null ? void 0 : E.outerHTML) ?? "";
|
|
102
102
|
this.api.setUIEAttribute(
|
|
103
103
|
e,
|
|
104
104
|
"value",
|
|
105
105
|
`
|
|
106
106
|
<div class="service-element alert-message-main" style="align-items: start;">
|
|
107
|
-
${
|
|
107
|
+
${s}
|
|
108
108
|
<div class="service-element alert-message-text">
|
|
109
109
|
${t}
|
|
110
110
|
</div>
|
|
@@ -133,15 +133,15 @@ class _ extends I {
|
|
|
133
133
|
placeholder: t,
|
|
134
134
|
options: o,
|
|
135
135
|
className: a = "es-180w",
|
|
136
|
-
searchable:
|
|
136
|
+
searchable: E = !1
|
|
137
137
|
}) {
|
|
138
138
|
return `
|
|
139
139
|
<${n.SELECTPICKER}
|
|
140
140
|
class="${a}"
|
|
141
141
|
${$.SELECTPICKER.name}="${e}"
|
|
142
|
-
${
|
|
142
|
+
${E ? `${$.SELECTPICKER.searchable}="true"` : ""}
|
|
143
143
|
${$.SELECTPICKER.placeholder}="${t}">
|
|
144
|
-
${o.map((
|
|
144
|
+
${o.map((s) => this._GuSelectItem(s)).join("")}
|
|
145
145
|
</${n.SELECTPICKER}>
|
|
146
146
|
`;
|
|
147
147
|
}
|
|
@@ -183,14 +183,14 @@ class _ extends I {
|
|
|
183
183
|
</${n.RADIO_BUTTONS}>
|
|
184
184
|
`;
|
|
185
185
|
}
|
|
186
|
-
_GuButton({ name: e, label: t, id: o = "", className: a = "", icon:
|
|
186
|
+
_GuButton({ name: e, label: t, id: o = "", className: a = "", icon: E = "", disabled: s = !1 }) {
|
|
187
187
|
return `
|
|
188
188
|
<${n.BUTTON}
|
|
189
189
|
${$.BUTTON.name}="${e}"
|
|
190
190
|
${o ? `id="${o}"` : ""}
|
|
191
191
|
${a ? `class="${a}"` : ""}
|
|
192
|
-
${
|
|
193
|
-
${
|
|
192
|
+
${E ? `${$.BUTTON.icon}="${E}"` : ""}
|
|
193
|
+
${s ? `${$.BUTTON.disabled}="true"` : ""}
|
|
194
194
|
${$.BUTTON.caption}="${t}">
|
|
195
195
|
</${n.BUTTON}>
|
|
196
196
|
`;
|
|
@@ -240,11 +240,11 @@ class _ extends I {
|
|
|
240
240
|
*/
|
|
241
241
|
_GuOrderable(e, t) {
|
|
242
242
|
let o = "";
|
|
243
|
-
t.forEach((
|
|
244
|
-
const
|
|
243
|
+
t.forEach((E) => {
|
|
244
|
+
const s = $.ORDERABLE_ITEM && "name" in $.ORDERABLE_ITEM ? $.ORDERABLE_ITEM.name : "name";
|
|
245
245
|
o += `
|
|
246
|
-
<${n.ORDERABLE_ITEM} ${
|
|
247
|
-
${
|
|
246
|
+
<${n.ORDERABLE_ITEM} ${s}="${E.key}">
|
|
247
|
+
${E.content}
|
|
248
248
|
</${n.ORDERABLE_ITEM}>
|
|
249
249
|
`;
|
|
250
250
|
});
|
|
@@ -315,5 +315,5 @@ class _ extends I {
|
|
|
315
315
|
}
|
|
316
316
|
}
|
|
317
317
|
export {
|
|
318
|
-
|
|
318
|
+
R as CommonControl
|
|
319
319
|
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { DisplayConditionEvent as i } from "../../enums/display-condition.js";
|
|
2
|
+
let n = null;
|
|
3
|
+
const d = () => {
|
|
4
|
+
n == null || n.detach();
|
|
5
|
+
}, L = (p, e) => {
|
|
6
|
+
var C;
|
|
7
|
+
const t = n;
|
|
8
|
+
t == null || t.detach(), (C = t == null ? void 0 : t.onCancel) == null || C.call(t);
|
|
9
|
+
let o = () => {
|
|
10
|
+
};
|
|
11
|
+
const l = (c) => {
|
|
12
|
+
const m = c.detail;
|
|
13
|
+
o(), m.applied = e.onApply(m.condition);
|
|
14
|
+
}, a = () => {
|
|
15
|
+
var c;
|
|
16
|
+
o(), (c = e.onCancel) == null || c.call(e);
|
|
17
|
+
};
|
|
18
|
+
return o = () => {
|
|
19
|
+
document.removeEventListener(i.APPLY, l), document.removeEventListener(i.CANCEL, a), (n == null ? void 0 : n.detach) === o && (n = null);
|
|
20
|
+
}, document.addEventListener(i.APPLY, l), document.addEventListener(i.CANCEL, a), n = { detach: o, onCancel: e.onCancel }, document.dispatchEvent(new CustomEvent(i.OPEN, { detail: p })), o;
|
|
21
|
+
};
|
|
22
|
+
export {
|
|
23
|
+
d as disposeDisplayConditionRequest,
|
|
24
|
+
L as requestDisplayCondition
|
|
25
|
+
};
|