@useinsider/guido 3.19.0 → 3.20.0-beta.0849ec7
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 +22 -3
- package/dist/@types/config/schemas.js +76 -53
- package/dist/components/Guido.vue.js +4 -4
- package/dist/components/Guido.vue2.js +102 -86
- package/dist/components/organisms/AutoSaveController.vue2.js +9 -8
- package/dist/components/organisms/base/AuthErrorModal.vue.js +18 -0
- package/dist/components/organisms/base/AuthErrorModal.vue2.js +42 -0
- package/dist/components/organisms/base/Toaster.vue2.js +13 -12
- package/dist/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue.js +13 -11
- package/dist/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue2.js +78 -57
- 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 +28 -42
- package/dist/components/organisms/header/EditorActions.vue.js +5 -5
- package/dist/components/organisms/header/EditorActions.vue2.js +90 -57
- package/dist/components/organisms/header/LeftSlot.vue.js +5 -5
- package/dist/components/organisms/header/LeftSlot.vue2.js +16 -12
- 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 +47 -0
- package/dist/components/organisms/validation/ValidationErrorDrawer.vue.js +20 -0
- package/dist/components/organisms/validation/ValidationErrorDrawer.vue2.js +49 -0
- package/dist/components/wrappers/WpDrawer.vue.js +9 -7
- package/dist/components/wrappers/WpDrawer.vue2.js +1 -1
- package/dist/components/wrappers/WpModal.vue.js +1 -1
- package/dist/components/wrappers/WpModal.vue2.js +4 -3
- package/dist/composables/useActionsApi.js +52 -47
- package/dist/composables/useAuthError.js +52 -0
- package/dist/composables/useAutoSave.js +11 -11
- package/dist/composables/useCodeEditorApi.js +23 -9
- package/dist/composables/useCortexBlueprintBridge.js +122 -54
- package/dist/composables/useCustomInterfaceAppearance.js +65 -51
- package/dist/composables/useEmailTemplateApplier.js +111 -50
- package/dist/composables/useHtmlCompiler.js +37 -26
- package/dist/composables/useHtmlValidator.js +89 -82
- package/dist/composables/useHttp.js +64 -54
- package/dist/composables/useLegacyStrategyConversion.js +65 -0
- package/dist/composables/useRecommendation.js +40 -35
- package/dist/composables/useSave.js +90 -45
- package/dist/composables/useSaveValidation.js +282 -0
- package/dist/composables/useSaveValidationRollout.js +9 -0
- package/dist/composables/useStripo.js +43 -39
- package/dist/composables/useToaster.js +18 -22
- package/dist/composables/useTranslations.js +3 -2
- package/dist/composables/useVersionHistoryApi.js +33 -24
- package/dist/composables/validators/useCouponBlockValidator.js +24 -21
- package/dist/composables/validators/useLiquidValidator.js +15 -15
- package/dist/composables/validators/useUnsubscribeBlockValidator.js +34 -27
- package/dist/config/migrator/index.js +14 -13
- package/dist/config/migrator/itemsBlockMigrator.js +236 -248
- package/dist/config/migrator/recommendationMigrator.js +28 -21
- package/dist/config/migrator/recommendationPartnerMigrator.js +56 -0
- package/dist/enums/extensions/recommendationBlock.js +51 -34
- package/dist/enums/save-validation.js +4 -0
- package/dist/extensions/Blocks/Items/constants/cardLayout.js +20 -0
- package/dist/extensions/Blocks/Items/controls/name/trimming.js +18 -17
- package/dist/extensions/Blocks/Items/controls/settingsControl.js +114 -105
- package/dist/extensions/Blocks/Items/enums/productEnums.js +14 -9
- package/dist/extensions/Blocks/Items/layouts/horizontal.html.js +11 -9
- package/dist/extensions/Blocks/Items/template.js +219 -204
- package/dist/extensions/Blocks/Recommendation/block.js +65 -45
- package/dist/extensions/Blocks/Recommendation/constants/defaultConfig.js +21 -20
- package/dist/extensions/Blocks/Recommendation/controls/main/index.js +103 -90
- package/dist/extensions/Blocks/Recommendation/controls/main/strategy.js +150 -52
- package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +74 -74
- package/dist/extensions/Blocks/Recommendation/store/recommendation.js +274 -92
- package/dist/extensions/Blocks/Recommendation/utils/legacyStrategyMigration.js +42 -0
- package/dist/extensions/Blocks/Recommendation/utils/nodeConfigWriter.js +26 -16
- package/dist/extensions/Blocks/Recommendation/utils/partnerCustomizations.js +3 -1
- package/dist/extensions/Blocks/Recommendation/utils/partnerScope.js +25 -0
- package/dist/extensions/Blocks/Recommendation/utils/productIds.js +5 -3
- 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/services/recommendationApi.js +46 -37
- package/dist/src/@types/config/schemas.d.ts +36 -0
- package/dist/src/@types/save-validation.d.ts +19 -0
- package/dist/src/components/Guido.vue.d.ts +17 -1
- package/dist/src/components/organisms/base/AuthErrorModal.vue.d.ts +2 -0
- package/dist/src/components/organisms/extensions/recommendation/LegacyStrategyUpdatedModal.vue.d.ts +2 -0
- package/dist/src/components/organisms/header/EditorActions.vue.d.ts +17 -1
- package/dist/src/components/organisms/header/HeaderWrapper.vue.d.ts +17 -1
- package/dist/src/components/organisms/header/RightSlot.vue.d.ts +17 -1
- 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/components/organisms/validation/ValidationErrorDrawer.vue.d.ts +2 -0
- package/dist/src/components/wrappers/WpDrawer.vue.d.ts +4 -3
- package/dist/src/components/wrappers/WpModal.vue.d.ts +5 -1
- package/dist/src/composables/useAuthError.d.ts +12 -0
- package/dist/src/composables/useConfig.d.ts +8 -0
- package/dist/src/composables/useCortexBlueprintBridge.d.ts +2 -3
- package/dist/src/composables/useEmailTemplateApplier.d.ts +18 -5
- package/dist/src/composables/useGuidoActions.d.ts +2 -0
- package/dist/src/composables/useHtmlValidator.d.ts +21 -0
- package/dist/src/composables/useHttp.d.ts +2 -0
- package/dist/src/composables/useLegacyStrategyConversion.d.ts +3 -0
- package/dist/src/composables/useSave.d.ts +6 -1
- package/dist/src/composables/useSaveValidation.d.ts +6 -0
- package/dist/src/composables/useSaveValidationRollout.d.ts +3 -0
- package/dist/src/composables/validators/useCouponBlockValidator.d.ts +3 -0
- package/dist/src/composables/validators/useUnsubscribeBlockValidator.d.ts +10 -0
- package/dist/src/config/migrator/index.d.ts +2 -1
- package/dist/src/config/migrator/recommendationPartnerMigrator.d.ts +19 -0
- package/dist/src/enums/extensions/recommendationBlock.d.ts +7 -1
- package/dist/src/enums/save-validation.d.ts +27 -0
- package/dist/src/extensions/Blocks/Items/constants/cardLayout.d.ts +44 -0
- package/dist/src/extensions/Blocks/Items/enums/productEnums.d.ts +3 -0
- package/dist/src/extensions/Blocks/Items/template.d.ts +19 -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 +10 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/main/utils.d.ts +7 -2
- package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +162 -1
- package/dist/src/extensions/Blocks/Recommendation/types/nodeConfig.d.ts +6 -0
- package/dist/src/extensions/Blocks/Recommendation/utils/legacyStrategyMigration.d.ts +32 -0
- package/dist/src/extensions/Blocks/Recommendation/utils/partnerScope.d.ts +33 -0
- package/dist/src/extensions/Blocks/Recommendation/utils/productIds.d.ts +2 -0
- 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/mock/cortexChatStore.d.ts +12 -0
- package/dist/src/services/recommendationApi.d.ts +2 -1
- package/dist/src/stores/config.d.ts +374 -0
- package/dist/src/stores/guido-email-editor.d.ts +20 -10
- package/dist/src/stores/onboarding.d.ts +812 -10
- package/dist/src/stores/recommendation.d.ts +5 -0
- package/dist/src/stores/save-validation.d.ts +22 -0
- package/dist/src/utils/dateUtil.d.ts +10 -0
- package/dist/src/utils/genericUtil.d.ts +3 -0
- package/dist/src/utils/stripoEditorApi.d.ts +4 -0
- package/dist/src/utils/templatePreparation.d.ts +30 -0
- 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 +113 -9
- package/dist/static/styles/components/skeleton.css.js +23 -0
- package/dist/static/styles/components/version-history.css.js +2 -6
- package/dist/stores/config.js +55 -24
- package/dist/stores/guido-email-editor.js +3 -1
- package/dist/stores/onboarding.js +50 -36
- package/dist/stores/save-validation.js +30 -0
- package/dist/stores/unsubscribe.js +3 -3
- package/dist/utils/pairProductVariables.js +71 -71
- package/dist/utils/stripoEditorApi.js +11 -0
- package/dist/utils/templatePreparation.js +54 -51
- package/package.json +2 -1
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { defineStore as n } from "pinia";
|
|
2
|
+
function i(e) {
|
|
3
|
+
const t = /* @__PURE__ */ new Set();
|
|
4
|
+
return e.filter((r) => {
|
|
5
|
+
const s = JSON.stringify([r.rule, r.message, r.detail ?? ""]);
|
|
6
|
+
return t.has(s) ? !1 : (t.add(s), !0);
|
|
7
|
+
});
|
|
8
|
+
}
|
|
9
|
+
const o = n("guidoSaveValidation", {
|
|
10
|
+
state: () => ({
|
|
11
|
+
errors: [],
|
|
12
|
+
isDrawerOpen: !1,
|
|
13
|
+
intent: null
|
|
14
|
+
}),
|
|
15
|
+
getters: {
|
|
16
|
+
errorCount: (e) => e.errors.length
|
|
17
|
+
},
|
|
18
|
+
actions: {
|
|
19
|
+
open(e, t) {
|
|
20
|
+
this.errors = i(e), this.intent = t, this.isDrawerOpen = !0;
|
|
21
|
+
},
|
|
22
|
+
// Errors are retained so rows don't blank during the ~300ms close animation.
|
|
23
|
+
close() {
|
|
24
|
+
this.isDrawerOpen = !1;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
export {
|
|
29
|
+
o as useSaveValidationStore
|
|
30
|
+
};
|
|
@@ -39,16 +39,16 @@ const r = () => ({
|
|
|
39
39
|
});
|
|
40
40
|
},
|
|
41
41
|
isActiveTypeFirstInCollection: (e) => {
|
|
42
|
-
const t = i[e.selectedCollectionType];
|
|
42
|
+
const t = i[e.selectedCollectionType] ?? [];
|
|
43
43
|
return e.activeType === t[0];
|
|
44
44
|
},
|
|
45
45
|
isActiveTypeLastInCollection: (e) => {
|
|
46
|
-
const t = i[e.selectedCollectionType];
|
|
46
|
+
const t = i[e.selectedCollectionType] ?? [];
|
|
47
47
|
return e.activeType === t[t.length - 1];
|
|
48
48
|
},
|
|
49
49
|
hasTemplatesByCollectionType: (e) => {
|
|
50
50
|
const t = {};
|
|
51
|
-
return i[e.selectedCollectionType].forEach((s) => {
|
|
51
|
+
return (i[e.selectedCollectionType] ?? []).forEach((s) => {
|
|
52
52
|
t[s] = e.templates.some((c) => c.type === s);
|
|
53
53
|
}), t;
|
|
54
54
|
},
|
|
@@ -1,100 +1,100 @@
|
|
|
1
|
-
import { ITEMS_CURRENCY_ATTR as
|
|
2
|
-
import { productPairs as
|
|
1
|
+
import { ITEMS_CURRENCY_ATTR as x, isCustomCurrencySymbol as Y } from "../extensions/Blocks/Items/constants/currency.js";
|
|
2
|
+
import { productPairs as w } from "../extensions/Blocks/Items/enums/productEnums.js";
|
|
3
3
|
import { escapeReplacement as X } from "../extensions/Blocks/Items/utils/nodeConfigUtils.js";
|
|
4
|
-
import { preserveTextStyles as
|
|
5
|
-
import { unwrapProductNameLinks as
|
|
6
|
-
const
|
|
4
|
+
import { preserveTextStyles as P } from "./preserveTextStyles.js";
|
|
5
|
+
import { unwrapProductNameLinks as v } from "./unwrapProductNameLink.js";
|
|
6
|
+
const O = {
|
|
7
7
|
CART_ITEMS: "ins_apr",
|
|
8
8
|
BROWSED_ITEMS: "browsed_item",
|
|
9
9
|
PURCHASED_ITEMS: "purchased_item"
|
|
10
|
-
},
|
|
11
|
-
function
|
|
10
|
+
}, q = (S) => S.replaceAll("{%", "<!--{%").replaceAll("%}", "%}-->");
|
|
11
|
+
function B(S, y, b) {
|
|
12
12
|
let h = y;
|
|
13
13
|
for (; h > 0 && /\s/.test(S[h - 1]); )
|
|
14
14
|
h -= 1;
|
|
15
15
|
return b.some((I) => S.endsWith(I, h));
|
|
16
16
|
}
|
|
17
|
-
function
|
|
18
|
-
const y =
|
|
19
|
-
|
|
20
|
-
const h =
|
|
17
|
+
function Z(S) {
|
|
18
|
+
const y = q(S), b = new DOMParser().parseFromString(y, "text/html");
|
|
19
|
+
v(b);
|
|
20
|
+
const h = w.PAIRS_FOR_EXTENSION;
|
|
21
21
|
Object.entries(h).forEach(([n, d]) => {
|
|
22
22
|
b.querySelectorAll(".ins-product-td").forEach((r) => {
|
|
23
23
|
const E = r.getAttribute("data-number") || "1", m = r.getAttribute("data-type") || "CART_ITEMS";
|
|
24
24
|
r.querySelectorAll(`[product-attr="${n}"]`).forEach((t) => {
|
|
25
|
-
var $,
|
|
26
|
-
const g = t.getAttribute("data-type") || m, o = t.getAttribute("data-number") || E,
|
|
27
|
-
if (
|
|
25
|
+
var $, F, D, N;
|
|
26
|
+
const g = t.getAttribute("data-type") || m, o = t.getAttribute("data-number") || E, f = d[g];
|
|
27
|
+
if (f)
|
|
28
28
|
switch (n) {
|
|
29
29
|
case "imageSrc": {
|
|
30
|
-
let e = null,
|
|
31
|
-
if (t.tagName === "IMG" ? (e = t,
|
|
30
|
+
let e = null, a = null;
|
|
31
|
+
if (t.tagName === "IMG" ? (e = t, a = e.closest("a")) : (e = t.querySelector("img"), a = t.querySelector("a") || t.closest("a")), !e)
|
|
32
32
|
break;
|
|
33
|
-
const
|
|
34
|
-
if (
|
|
35
|
-
const
|
|
36
|
-
|
|
37
|
-
const
|
|
38
|
-
return
|
|
39
|
-
}) && (e.src = `{{${
|
|
33
|
+
const l = f.DEFAULT, c = f.ATTR;
|
|
34
|
+
if (l && e.src) {
|
|
35
|
+
const s = e.src;
|
|
36
|
+
l.some((R) => {
|
|
37
|
+
const u = R.split("/").pop() || "", H = s.split("/").pop() || "";
|
|
38
|
+
return s.includes(R) || s.includes(u) || H === u;
|
|
39
|
+
}) && (e.src = `{{${c}_${o}}}`);
|
|
40
40
|
}
|
|
41
|
-
const
|
|
42
|
-
if (
|
|
43
|
-
const
|
|
44
|
-
if (
|
|
45
|
-
const
|
|
46
|
-
(
|
|
41
|
+
const i = (F = ($ = h.name) == null ? void 0 : $[g]) == null ? void 0 : F.ATTR;
|
|
42
|
+
if (i && e.setAttribute("alt", `{{${i}_${o}}}`), a) {
|
|
43
|
+
const s = (D = h.itemLink) == null ? void 0 : D[g];
|
|
44
|
+
if (s) {
|
|
45
|
+
const _ = s.HREF, R = s.DEFAULT_HREF || "#!", u = a.href;
|
|
46
|
+
(u === "#" || u === "" || u.endsWith("#!") || u.endsWith(R) || u === `${window.location.href}${R}` || !u || u === window.location.href) && (a.href = `{{${_}_${o}}}`);
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
49
|
break;
|
|
50
50
|
}
|
|
51
51
|
case "name": {
|
|
52
|
-
const e =
|
|
53
|
-
t.textContent && (t.innerHTML =
|
|
54
|
-
const
|
|
55
|
-
if (
|
|
56
|
-
const
|
|
57
|
-
(
|
|
52
|
+
const e = f, a = e.ATTR, l = e.DEFAULT_HREF || "#!", c = e.HREF;
|
|
53
|
+
t.textContent && (t.innerHTML = P(t, `{{${a}_${o}}}`));
|
|
54
|
+
const i = t.closest("a") || (t.tagName === "A" ? t : null);
|
|
55
|
+
if (i && c) {
|
|
56
|
+
const s = i.href, _ = `${window.location.href}${l}`;
|
|
57
|
+
(s === _ || s.endsWith(l)) && (i.href = `{{${c}_${o}}}`);
|
|
58
58
|
}
|
|
59
59
|
break;
|
|
60
60
|
}
|
|
61
61
|
case "price":
|
|
62
62
|
case "originalPrice": {
|
|
63
|
-
const e =
|
|
64
|
-
let
|
|
65
|
-
|
|
66
|
-
const
|
|
67
|
-
let
|
|
68
|
-
const
|
|
63
|
+
const e = f, a = t.getAttribute("data-formated"), l = t.getAttribute("data-single_price"), c = a === "true", i = l === "true", s = t.getAttribute(x.POSITION) || "before";
|
|
64
|
+
let _;
|
|
65
|
+
i ? _ = c ? e.SINGLE_PRICE_FORMATTED : e.SINGLE_PRICE : _ = c ? e.PRICE_FORMATTED : e.PRICE;
|
|
66
|
+
const R = e.CURRENCY;
|
|
67
|
+
let u = `{{${_}_${o}}}`;
|
|
68
|
+
const H = (t.getAttribute(x.SYMBOL) || "").trim(), G = Y(H);
|
|
69
69
|
let C = "";
|
|
70
|
-
|
|
70
|
+
G ? C = H : R && (C = `{{${R}_${o}}}`), C && (u = s === "after" ? `${u} ${C}` : `${C} ${u}`), t.innerHTML = P(t, u);
|
|
71
71
|
break;
|
|
72
72
|
}
|
|
73
73
|
case "quantity": {
|
|
74
|
-
const e =
|
|
75
|
-
|
|
74
|
+
const e = f, a = e.ATTR, l = [e.DEFAULT, ...e.LEGACY_DEFAULTS], c = (N = t.textContent) == null ? void 0 : N.trim();
|
|
75
|
+
c && l.includes(c) && (t.innerHTML = P(t, `{{${a}_${o}}}`));
|
|
76
76
|
break;
|
|
77
77
|
}
|
|
78
78
|
case "button": {
|
|
79
|
-
const e =
|
|
80
|
-
if (
|
|
81
|
-
const
|
|
82
|
-
(
|
|
79
|
+
const e = f, a = e.HREF, l = e.DEFAULT_HREF || "#!", c = t.tagName === "A" ? t : t.querySelector("a");
|
|
80
|
+
if (c) {
|
|
81
|
+
const i = c.href || "", s = `${window.location.href}${l}`;
|
|
82
|
+
(i === "" || i === "#" || i === s || i.endsWith(l) || i.endsWith("#!") || i === window.location.href) && (c.href = `{{${a}_${o}}}`);
|
|
83
83
|
}
|
|
84
84
|
break;
|
|
85
85
|
}
|
|
86
86
|
case "itemLink": {
|
|
87
|
-
const e =
|
|
88
|
-
if (
|
|
89
|
-
const
|
|
90
|
-
(
|
|
87
|
+
const e = f, a = e.HREF, l = e.DEFAULT_HREF || "#!", c = t;
|
|
88
|
+
if (c.href) {
|
|
89
|
+
const i = c.href, s = `${window.location.href}${l}`;
|
|
90
|
+
(i === s || i.endsWith(l)) && (c.href = `{{${a}_${o}}}`);
|
|
91
91
|
}
|
|
92
92
|
break;
|
|
93
93
|
}
|
|
94
94
|
default: {
|
|
95
|
-
if ("ATTR" in
|
|
96
|
-
const e =
|
|
97
|
-
t.textContent && (t.innerHTML =
|
|
95
|
+
if ("ATTR" in f) {
|
|
96
|
+
const e = f.ATTR;
|
|
97
|
+
t.textContent && (t.innerHTML = P(t, `{{${e}_${o}}}`));
|
|
98
98
|
}
|
|
99
99
|
break;
|
|
100
100
|
}
|
|
@@ -102,9 +102,9 @@ function K(S) {
|
|
|
102
102
|
});
|
|
103
103
|
});
|
|
104
104
|
});
|
|
105
|
-
const I = y.match(/<!DOCTYPE[^>]*>/i),
|
|
106
|
-
` : "",
|
|
107
|
-
|
|
105
|
+
const I = y.match(/<!DOCTYPE[^>]*>/i), U = I ? `${I[0]}
|
|
106
|
+
` : "", W = b.querySelectorAll(".ins-product-td"), M = [];
|
|
107
|
+
W.forEach((n) => {
|
|
108
108
|
const d = n.getAttribute("data-type") || "CART_ITEMS", p = n.getAttribute("data-number") || "1", r = n.outerHTML;
|
|
109
109
|
M.push({
|
|
110
110
|
element: n,
|
|
@@ -113,38 +113,38 @@ function K(S) {
|
|
|
113
113
|
number: p
|
|
114
114
|
});
|
|
115
115
|
});
|
|
116
|
-
let A =
|
|
116
|
+
let A = U + b.documentElement.outerHTML;
|
|
117
117
|
M.reverse().forEach(({ outerHtml: n, type: d, number: p }) => {
|
|
118
|
-
const r =
|
|
118
|
+
const r = O[d], E = r ? `${r}_total_product_kind` : "";
|
|
119
119
|
if (E) {
|
|
120
120
|
const T = parseInt(p) - 1, o = `${`{% if ${E} > ${T} %}`}${n}{% endif %}`;
|
|
121
121
|
A = A.replace(n, X(o));
|
|
122
122
|
}
|
|
123
123
|
});
|
|
124
|
-
const
|
|
125
|
-
return
|
|
124
|
+
const V = b.querySelectorAll('[product-attr="originalPrice"][data-type]'), L = /* @__PURE__ */ new Map(), k = /* @__PURE__ */ new Set();
|
|
125
|
+
return V.forEach((n) => {
|
|
126
126
|
var t;
|
|
127
127
|
const d = n.getAttribute("data-number"), p = n.getAttribute("data-type");
|
|
128
|
-
if (!d || !
|
|
128
|
+
if (!d || !O[p])
|
|
129
129
|
return;
|
|
130
130
|
const r = n.closest(".product-original-price-class");
|
|
131
131
|
if (!r || k.has(r))
|
|
132
132
|
return;
|
|
133
133
|
k.add(r);
|
|
134
|
-
const E = r.outerHTML, m = (t = n.closest(".ins-product-td")) == null ? void 0 : t.getAttribute("data-nodup"), T =
|
|
135
|
-
T.wrap.push(m !== "false"),
|
|
136
|
-
}),
|
|
134
|
+
const E = r.outerHTML, m = (t = n.closest(".ins-product-td")) == null ? void 0 : t.getAttribute("data-nodup"), T = L.get(E) ?? { number: d, type: p, wrap: [] };
|
|
135
|
+
T.wrap.push(m !== "false"), L.set(E, T);
|
|
136
|
+
}), L.forEach(({ number: n, type: d, wrap: p }, r) => {
|
|
137
137
|
if (r.includes("{% if") || !p.some(Boolean))
|
|
138
138
|
return;
|
|
139
|
-
const E =
|
|
140
|
-
let g = "", o = 0,
|
|
139
|
+
const E = w.PAIRS_FOR_EXTENSION.price[d].PRICE, m = w.PAIRS_FOR_EXTENSION.originalPrice[d].PRICE, T = `{% if ${E}_${n} != ${m}_${n} %}`, t = [T, q(T)];
|
|
140
|
+
let g = "", o = 0, f = 0, $ = A.indexOf(r);
|
|
141
141
|
for (; $ !== -1; ) {
|
|
142
|
-
const
|
|
143
|
-
g += A.slice(o, $) + (
|
|
142
|
+
const F = p[f] === !0 && !B(A, $, t);
|
|
143
|
+
g += A.slice(o, $) + (F ? `${T}${r}{% endif %}` : r), o = $ + r.length, f += 1, $ = A.indexOf(r, o);
|
|
144
144
|
}
|
|
145
145
|
A = g + A.slice(o);
|
|
146
146
|
}), A.replaceAll("<!--{%", "{%").replaceAll("%}-->", "%}").replaceAll("<!--{%", "{%").replaceAll("%}-->", "%}");
|
|
147
147
|
}
|
|
148
148
|
export {
|
|
149
|
-
|
|
149
|
+
Z as pairProductVariables
|
|
150
150
|
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
const o = "The editor is not ready yet. Please wait for it to load and try again.", i = () => window.StripoEditorApi, r = () => {
|
|
2
|
+
const t = i();
|
|
3
|
+
if (!t)
|
|
4
|
+
throw new Error(o);
|
|
5
|
+
return t;
|
|
6
|
+
};
|
|
7
|
+
export {
|
|
8
|
+
o as EDITOR_NOT_READY_MESSAGE,
|
|
9
|
+
i as findEditorApi,
|
|
10
|
+
r as getEditorApi
|
|
11
|
+
};
|
|
@@ -1,32 +1,32 @@
|
|
|
1
1
|
import { useActionsApi as k } from "../composables/useActionsApi.js";
|
|
2
|
-
import { useConfig as
|
|
3
|
-
import { useHtmlCompiler as
|
|
4
|
-
import { DEFAULT_CURRENCY as m, DEFAULT_NODE_CONFIG as n } from "../extensions/Blocks/Recommendation/constants/defaultConfig.js";
|
|
5
|
-
import { useRecommendationExtensionStore as
|
|
2
|
+
import { useConfig as N } from "../composables/useConfig.js";
|
|
3
|
+
import { useHtmlCompiler as U } from "../composables/useHtmlCompiler.js";
|
|
4
|
+
import { RRS_CONFIG_VERSION as x, DEFAULT_CURRENCY as m, DEFAULT_NODE_CONFIG as n } from "../extensions/Blocks/Recommendation/constants/defaultConfig.js";
|
|
5
|
+
import { useRecommendationExtensionStore as w } from "../extensions/Blocks/Recommendation/store/recommendation.js";
|
|
6
6
|
import { mapLegacyStrategy as L } from "../extensions/Blocks/Recommendation/utils/legacyStrategyMap.js";
|
|
7
|
-
import { DATA_ATTRIBUTES as
|
|
8
|
-
import { parsePageList as
|
|
9
|
-
import { useDynamicContentStore as
|
|
10
|
-
import { useEditorStore as
|
|
11
|
-
import { useUnsubscribeStore as
|
|
12
|
-
import { isPlainObject as
|
|
13
|
-
import { assignTrackingIds as
|
|
7
|
+
import { DATA_ATTRIBUTES as A } from "../extensions/Blocks/Unsubscribe/utils/constants.js";
|
|
8
|
+
import { parsePageList as z } from "../extensions/Blocks/Unsubscribe/utils/utils.js";
|
|
9
|
+
import { useDynamicContentStore as O } from "../stores/dynamic-content.js";
|
|
10
|
+
import { useEditorStore as _ } from "../stores/editor.js";
|
|
11
|
+
import { useUnsubscribeStore as v } from "../stores/unsubscribe.js";
|
|
12
|
+
import { isPlainObject as B } from "./genericUtil.js";
|
|
13
|
+
import { assignTrackingIds as G } from "./linkTrackingIds.js";
|
|
14
14
|
function M(l) {
|
|
15
|
-
const i = new DOMParser().parseFromString(l, "text/html").querySelectorAll(`[${
|
|
15
|
+
const i = new DOMParser().parseFromString(l, "text/html").querySelectorAll(`[${A.PAGE_LIST}]`), t = [];
|
|
16
16
|
return i.forEach((c) => {
|
|
17
|
-
const
|
|
18
|
-
|
|
17
|
+
const r = c.getAttribute(A.PAGE_LIST);
|
|
18
|
+
r && t.push(...z(r));
|
|
19
19
|
}), [...new Set(t)];
|
|
20
20
|
}
|
|
21
|
-
async function
|
|
21
|
+
async function I(l) {
|
|
22
22
|
const a = new DOMParser().parseFromString(l, "text/html").querySelectorAll(".recommendation-block-v2");
|
|
23
23
|
if (a.length === 0)
|
|
24
24
|
return;
|
|
25
|
-
const i =
|
|
25
|
+
const i = w();
|
|
26
26
|
a.forEach((t) => {
|
|
27
|
-
var
|
|
28
|
-
const c = t.getAttribute("recommendation-id"),
|
|
29
|
-
if (!Number.isFinite(
|
|
27
|
+
var d, g, f, s, y, S;
|
|
28
|
+
const c = t.getAttribute("recommendation-id"), r = c ? Number(c) : NaN;
|
|
29
|
+
if (!Number.isFinite(r))
|
|
30
30
|
return;
|
|
31
31
|
const p = t.getAttribute("esd-ext-config");
|
|
32
32
|
if (!p)
|
|
@@ -37,13 +37,13 @@ async function q(l) {
|
|
|
37
37
|
} catch {
|
|
38
38
|
return;
|
|
39
39
|
}
|
|
40
|
-
if (!
|
|
40
|
+
if (!B(e))
|
|
41
41
|
return;
|
|
42
|
-
const
|
|
42
|
+
const C = !!e.strategyId || (e.configVersion ?? 0) >= x, o = {
|
|
43
43
|
// Normalize legacy strategy keys (e.g. `mostViewed` → `mostPopular`) so
|
|
44
44
|
// already-saved blocks that never re-run the migrator don't emit a
|
|
45
45
|
// strategy-less campaign URL. `||` also catches '' / undefined (SD-144882).
|
|
46
|
-
strategy: L(e.strategy) || n.strategy,
|
|
46
|
+
strategy: L(e.strategy) || (C ? "" : n.strategy),
|
|
47
47
|
strategyId: e.strategyId ?? n.strategyId,
|
|
48
48
|
language: e.language ?? n.language,
|
|
49
49
|
size: e.size ?? n.size,
|
|
@@ -52,14 +52,14 @@ async function q(l) {
|
|
|
52
52
|
productIds: e.productIds ?? [...n.productIds],
|
|
53
53
|
filters: e.filters ?? [...n.filters],
|
|
54
54
|
shuffleProducts: e.shuffleProducts ?? n.shuffleProducts,
|
|
55
|
-
currencyCode: ((
|
|
56
|
-
currencySymbol: ((
|
|
57
|
-
currencyAlignment: ((
|
|
58
|
-
currencyDecimalCount: ((
|
|
59
|
-
currencyDecimalSeparator: ((
|
|
60
|
-
currencyThousandSeparator: ((
|
|
55
|
+
currencyCode: ((d = e.currency) == null ? void 0 : d.code) ?? m.code,
|
|
56
|
+
currencySymbol: ((g = e.currency) == null ? void 0 : g.symbol) ?? m.symbol,
|
|
57
|
+
currencyAlignment: ((f = e.currency) == null ? void 0 : f.alignment) ?? m.alignment,
|
|
58
|
+
currencyDecimalCount: ((s = e.currency) == null ? void 0 : s.decimalCount) ?? m.decimalCount,
|
|
59
|
+
currencyDecimalSeparator: ((y = e.currency) == null ? void 0 : y.decimalSeparator) ?? m.decimalSeparator,
|
|
60
|
+
currencyThousandSeparator: ((S = e.currency) == null ? void 0 : S.thousandSeparator) ?? m.thousandSeparator
|
|
61
61
|
};
|
|
62
|
-
i.seedBlockUrlConfig(
|
|
62
|
+
i.seedBlockUrlConfig(r, o);
|
|
63
63
|
});
|
|
64
64
|
try {
|
|
65
65
|
await i.fetchRecommendationCreateData();
|
|
@@ -70,51 +70,54 @@ async function q(l) {
|
|
|
70
70
|
);
|
|
71
71
|
}
|
|
72
72
|
}
|
|
73
|
-
const
|
|
74
|
-
const l =
|
|
73
|
+
const re = () => {
|
|
74
|
+
const l = O(), u = _(), a = v(), { getCompiledEmail: i, getTemplateData: t, updateHtmlAndCss: c } = k(), { compileHtml: r, compileAmpHtml: p } = U(), { isFeatureEnabled: e } = N();
|
|
75
75
|
return {
|
|
76
76
|
prepareTemplateDetails: async () => {
|
|
77
|
-
let { html:
|
|
77
|
+
let { html: o, css: d, syncModulesIds: g = [] } = await t();
|
|
78
78
|
if (e("linkTrackingIds"))
|
|
79
79
|
try {
|
|
80
|
-
const { html:
|
|
81
|
-
u.trackIdSessionFloor = H,
|
|
82
|
-
} catch (
|
|
83
|
-
console.error("Tracking-id step failed, saving anyway:",
|
|
80
|
+
const { html: b, changed: R, nextSeq: H } = G(o, u.trackIdSessionFloor);
|
|
81
|
+
u.trackIdSessionFloor = H, R && (o = b, await c(b, d));
|
|
82
|
+
} catch (b) {
|
|
83
|
+
console.error("Tracking-id step failed, saving anyway:", b);
|
|
84
84
|
}
|
|
85
85
|
const { html: f, ampHtml: s = "", ampErrors: y = [] } = await i({
|
|
86
86
|
minimize: !0,
|
|
87
87
|
resetDataSavedFlag: !1
|
|
88
88
|
});
|
|
89
|
-
a.selectedUnsubscribePages.length && await a.fetchTemplates(), await
|
|
90
|
-
const { compiledHtml:
|
|
89
|
+
a.selectedUnsubscribePages.length && await a.fetchTemplates(), await I(o);
|
|
90
|
+
const { compiledHtml: S, stats: h, appliedRules: D } = r(f), E = s && p(s).compiledHtml, P = l.getSelectedDynamicContentList, F = w(), T = M(o);
|
|
91
91
|
return console.debug("HTML Compilation Stats:", {
|
|
92
|
-
originalSize:
|
|
93
|
-
compiledSize:
|
|
94
|
-
reduction: `${
|
|
95
|
-
appliedRules:
|
|
96
|
-
executionTime: `${
|
|
92
|
+
originalSize: h.originalSize,
|
|
93
|
+
compiledSize: h.compiledSize,
|
|
94
|
+
reduction: `${h.reductionPercentage.toFixed(2)}%`,
|
|
95
|
+
appliedRules: D,
|
|
96
|
+
executionTime: `${h.executionTime.toFixed(2)}ms`
|
|
97
97
|
}), {
|
|
98
98
|
dynamicContentList: P,
|
|
99
|
-
compiledHtml:
|
|
100
|
-
rawHtml:
|
|
99
|
+
compiledHtml: S,
|
|
100
|
+
rawHtml: o,
|
|
101
101
|
css: d,
|
|
102
|
-
ampHtml:
|
|
102
|
+
ampHtml: E,
|
|
103
103
|
ampErrors: y,
|
|
104
104
|
modules: g.map(Number),
|
|
105
105
|
recommendation: {
|
|
106
|
-
campaignUrls:
|
|
106
|
+
campaignUrls: F.recommendationCampaignUrls,
|
|
107
107
|
configs: {}
|
|
108
108
|
},
|
|
109
109
|
unsubscribe: {
|
|
110
|
-
status:
|
|
111
|
-
config:
|
|
110
|
+
status: T.length > 0,
|
|
111
|
+
config: T
|
|
112
112
|
}
|
|
113
113
|
};
|
|
114
|
-
}
|
|
114
|
+
},
|
|
115
|
+
// Exposed so the back/test validate-only path can seed the reco store the
|
|
116
|
+
// same way a full save does (required-field findings depend on it).
|
|
117
|
+
hydrateRecommendationStore: I
|
|
115
118
|
};
|
|
116
119
|
};
|
|
117
120
|
export {
|
|
118
121
|
M as getHtmlReferencedUnsubscribePages,
|
|
119
|
-
|
|
122
|
+
re as useTemplatePreparation
|
|
120
123
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@useinsider/guido",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.20.0-beta.0849ec7",
|
|
4
4
|
"description": "Guido is a Vue + TypeScript wrapper for Email Plugin. Easily embed the email editor in your Vue applications.",
|
|
5
5
|
"main": "./dist/guido.umd.cjs",
|
|
6
6
|
"module": "./dist/library.js",
|
|
@@ -38,6 +38,7 @@
|
|
|
38
38
|
"test:e2e-mutation": "node scripts/e2e-mutation-check.mjs",
|
|
39
39
|
"type-check": "vue-tsc --noEmit --project tsconfig.config.json && vue-tsc --noEmit --project tsconfig.app.json",
|
|
40
40
|
"test": "vitest run --coverage",
|
|
41
|
+
"test:run": "vitest run",
|
|
41
42
|
"test:watch": "vitest",
|
|
42
43
|
"test:visual-update": "npx playwright test --update-snapshots --reporter html",
|
|
43
44
|
"test:e2e:coverage": "E2E_COVERAGE=true playwright test",
|