@useinsider/guido 3.18.2-beta.3e1d9ab → 3.18.2-beta.6cafced
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/Guido.vue.js +3 -3
- package/dist/components/Guido.vue2.js +30 -30
- package/dist/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue.js +13 -11
- package/dist/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue2.js +70 -51
- package/dist/components/organisms/extensions/recommendation/RemoveStrategyModal.vue2.js +23 -37
- package/dist/components/organisms/onboarding/OnboardingWrapper.vue2.js +20 -18
- package/dist/components/organisms/onboarding/RecommendationStrategyOnboarding.vue.js +21 -0
- package/dist/components/organisms/onboarding/RecommendationStrategyOnboarding.vue2.js +47 -0
- package/dist/components/organisms/save-as-template/SaveAsTemplateDrawer.vue2.js +34 -34
- package/dist/composables/useCustomInterfaceAppearance.js +56 -46
- package/dist/composables/useHtmlValidator.js +84 -79
- package/dist/composables/useHttp.js +22 -24
- package/dist/composables/useRecommendation.js +40 -35
- package/dist/composables/useStripo.js +30 -30
- package/dist/enums/extensions/recommendationBlock.js +38 -31
- package/dist/extensions/Blocks/Recommendation/block.js +43 -39
- package/dist/extensions/Blocks/Recommendation/constants/defaultConfig.js +21 -20
- package/dist/extensions/Blocks/Recommendation/controls/main/index.js +40 -35
- package/dist/extensions/Blocks/Recommendation/controls/main/strategy.js +84 -52
- package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +74 -74
- package/dist/extensions/Blocks/Recommendation/store/recommendation.js +189 -90
- package/dist/extensions/Blocks/Recommendation/utils/nodeConfigWriter.js +26 -16
- package/dist/extensions/Blocks/Recommendation/utils/strategyCommit.js +24 -0
- package/dist/extensions/Blocks/Recommendation/validation/requiredFields.js +21 -12
- package/dist/guido.css +1 -1
- package/dist/services/templateLibraryApi.js +14 -17
- package/dist/src/components/organisms/onboarding/RecommendationStrategyOnboarding.vue.d.ts +2 -0
- package/dist/src/enums/extensions/recommendationBlock.d.ts +2 -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 +9 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/main/utils.d.ts +7 -2
- package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +75 -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/stores/onboarding.d.ts +377 -0
- package/dist/src/utils/genericUtil.d.ts +0 -6
- package/dist/static/styles/components/recommendation-strategy.css.js +34 -4
- package/dist/static/styles/components/skeleton.css.js +23 -0
- package/dist/stores/onboarding.js +41 -36
- package/dist/utils/genericUtil.js +54 -63
- package/dist/utils/templatePreparation.js +59 -60
- package/package.json +1 -1
- package/dist/src/utils/liquidDynamicContent.d.ts +0 -20
- package/dist/utils/liquidDynamicContent.js +0 -15
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { useOnboardingApi as
|
|
2
|
-
import { defineStore as
|
|
1
|
+
import { useOnboardingApi as e } from "../services/onboardingApi.js";
|
|
2
|
+
import { defineStore as s } from "pinia";
|
|
3
3
|
const t = () => ({
|
|
4
4
|
cardIndex: 0,
|
|
5
5
|
isActive: !1,
|
|
@@ -11,49 +11,54 @@ const t = () => ({
|
|
|
11
11
|
textBlockOnboarding: t(),
|
|
12
12
|
versionHistoryOnboarding: t(),
|
|
13
13
|
ampOnboarding: t(),
|
|
14
|
-
itemsOnboarding: t()
|
|
14
|
+
itemsOnboarding: t(),
|
|
15
|
+
recommendationStrategyOnboarding: t()
|
|
15
16
|
},
|
|
16
17
|
userModalState: {},
|
|
17
18
|
isFetched: !1
|
|
18
|
-
}), c =
|
|
19
|
+
}), c = s("guidoOnboarding", {
|
|
19
20
|
state: () => a(),
|
|
20
21
|
getters: {
|
|
21
|
-
getOnboarding: (n) => (
|
|
22
|
-
isActive: (n) => (
|
|
23
|
-
getCurrentCard: (n) => (
|
|
24
|
-
const
|
|
25
|
-
return
|
|
22
|
+
getOnboarding: (n) => (o) => n.onboardings[o],
|
|
23
|
+
isActive: (n) => (o) => n.onboardings[o].isActive,
|
|
24
|
+
getCurrentCard: (n) => (o) => {
|
|
25
|
+
const i = n.onboardings[o];
|
|
26
|
+
return i.config[i.cardIndex];
|
|
26
27
|
},
|
|
27
28
|
getGenericCurrentCard: (n) => {
|
|
28
|
-
const { genericOnboarding:
|
|
29
|
-
return
|
|
29
|
+
const { genericOnboarding: o } = n.onboardings;
|
|
30
|
+
return o.config[o.cardIndex];
|
|
30
31
|
},
|
|
31
32
|
getTextBlockCurrentCard: (n) => {
|
|
32
|
-
const { textBlockOnboarding:
|
|
33
|
-
return
|
|
33
|
+
const { textBlockOnboarding: o } = n.onboardings;
|
|
34
|
+
return o.config[o.cardIndex];
|
|
34
35
|
},
|
|
35
36
|
getVersionHistoryCurrentCard: (n) => {
|
|
36
|
-
const { versionHistoryOnboarding:
|
|
37
|
-
return
|
|
37
|
+
const { versionHistoryOnboarding: o } = n.onboardings;
|
|
38
|
+
return o.config[o.cardIndex];
|
|
38
39
|
},
|
|
39
40
|
getAmpCurrentCard: (n) => {
|
|
40
|
-
const { ampOnboarding:
|
|
41
|
-
return
|
|
41
|
+
const { ampOnboarding: o } = n.onboardings;
|
|
42
|
+
return o.config[o.cardIndex];
|
|
42
43
|
},
|
|
43
44
|
getItemsCurrentCard: (n) => {
|
|
44
|
-
const { itemsOnboarding:
|
|
45
|
-
return
|
|
45
|
+
const { itemsOnboarding: o } = n.onboardings;
|
|
46
|
+
return o.config[o.cardIndex];
|
|
47
|
+
},
|
|
48
|
+
getRecommendationStrategyCurrentCard: (n) => {
|
|
49
|
+
const { recommendationStrategyOnboarding: o } = n.onboardings;
|
|
50
|
+
return o.config[o.cardIndex];
|
|
46
51
|
},
|
|
47
|
-
shouldShowOnboarding: (n) => (
|
|
48
|
-
const
|
|
49
|
-
return
|
|
52
|
+
shouldShowOnboarding: (n) => (o) => {
|
|
53
|
+
const i = n.userModalState.Guido;
|
|
54
|
+
return o === "newVersionPopup" && (i != null && i.genericOnboarding) ? !1 : i ? !i[o] : !0;
|
|
50
55
|
}
|
|
51
56
|
},
|
|
52
57
|
actions: {
|
|
53
58
|
closeOtherOnboardings(n) {
|
|
54
|
-
Object.keys(this.onboardings).forEach((
|
|
55
|
-
const
|
|
56
|
-
|
|
59
|
+
Object.keys(this.onboardings).forEach((o) => {
|
|
60
|
+
const i = o;
|
|
61
|
+
i !== n && this.onboardings[i].isActive && (this.onboardings[i].isActive = !1, this.onboardings[i].cardIndex = 0, this.onboardings[i].config = []);
|
|
57
62
|
});
|
|
58
63
|
},
|
|
59
64
|
start(n) {
|
|
@@ -71,12 +76,12 @@ const t = () => ({
|
|
|
71
76
|
previous(n) {
|
|
72
77
|
this.onboardings[n].cardIndex > 0 && this.onboardings[n].cardIndex--;
|
|
73
78
|
},
|
|
74
|
-
updateCardPosition(n,
|
|
75
|
-
const r = this.onboardings[n].config[
|
|
76
|
-
r && (r.top =
|
|
79
|
+
updateCardPosition(n, o, i) {
|
|
80
|
+
const r = this.onboardings[n].config[o];
|
|
81
|
+
r && (r.top = i.top, r.position = i.position);
|
|
77
82
|
},
|
|
78
|
-
setConfig(n,
|
|
79
|
-
this.onboardings[n].config =
|
|
83
|
+
setConfig(n, o) {
|
|
84
|
+
this.onboardings[n].config = o ?? [], this.onboardings[n].cardIndex >= this.onboardings[n].config.length && (this.onboardings[n].cardIndex = 0);
|
|
80
85
|
},
|
|
81
86
|
async onDiscoverNowClicked() {
|
|
82
87
|
await this.setUserModalState("newVersionPopup", "true", "Guido"), await this.setUserModalState("genericOnboarding", "true", "Guido"), this.start("genericOnboarding");
|
|
@@ -93,16 +98,16 @@ const t = () => ({
|
|
|
93
98
|
async fetchUserModalState() {
|
|
94
99
|
if (this.isFetched)
|
|
95
100
|
return;
|
|
96
|
-
const { fetchUserModalState: n } =
|
|
101
|
+
const { fetchUserModalState: n } = e();
|
|
97
102
|
try {
|
|
98
|
-
const
|
|
99
|
-
this.userModalState =
|
|
103
|
+
const o = await n();
|
|
104
|
+
this.userModalState = o, this.isFetched = !0;
|
|
100
105
|
} catch {
|
|
101
106
|
}
|
|
102
107
|
},
|
|
103
|
-
async setUserModalState(n,
|
|
104
|
-
const { setUserModalState: r } =
|
|
105
|
-
await r(n,
|
|
108
|
+
async setUserModalState(n, o, i) {
|
|
109
|
+
const { setUserModalState: r } = e();
|
|
110
|
+
await r(n, o, i), this.isFetched = !1, await this.fetchUserModalState();
|
|
106
111
|
}
|
|
107
112
|
}
|
|
108
113
|
});
|
|
@@ -1,78 +1,69 @@
|
|
|
1
|
-
|
|
2
|
-
const
|
|
3
|
-
if (!t.includes("="))
|
|
4
|
-
return null;
|
|
5
|
-
const [r, e] = t.split("=");
|
|
6
|
-
return { key: r.trim(), value: e.trim() };
|
|
7
|
-
}, c = "default:", f = (t) => {
|
|
8
|
-
if (!t.startsWith(c))
|
|
9
|
-
return t;
|
|
10
|
-
const r = t.slice(c.length).trim(), e = (l) => r.length >= 2 && r.startsWith(l) && r.endsWith(l);
|
|
11
|
-
return e('"') || e("'") ? r.slice(1, -1) : r;
|
|
12
|
-
}, k = (t) => {
|
|
13
|
-
const e = t.value.match(/\{\{([^}]+)\}\}/)[1].split("|").map((a) => a.trim()), [l] = e, s = {
|
|
1
|
+
const o = (t) => {
|
|
2
|
+
const a = t.value.match(/\{\{([^}]+)\}\}/)[1].split("|").map((l) => l.trim()), [s] = a, r = {
|
|
14
3
|
text: t.label,
|
|
15
|
-
value:
|
|
4
|
+
value: s || ""
|
|
16
5
|
};
|
|
17
|
-
if (
|
|
18
|
-
const [,
|
|
19
|
-
if (
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
6
|
+
if (a.length >= 2) {
|
|
7
|
+
const [, l, e] = a;
|
|
8
|
+
if (l.startsWith("default:")) {
|
|
9
|
+
let n = l.slice(8).trim();
|
|
10
|
+
n.startsWith('"') && n.endsWith('"') && (n = n.slice(1, -1)), r.fallback = n;
|
|
11
|
+
} else {
|
|
12
|
+
const n = l.includes("=") ? { key: l.split("=")[0].trim(), value: l.split("=")[1].trim() } : null;
|
|
13
|
+
n ? r.format = n : e || (r.fallback = l), e && (r.fallback = e);
|
|
24
14
|
}
|
|
25
15
|
}
|
|
26
|
-
return
|
|
27
|
-
},
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
}
|
|
31
|
-
|
|
16
|
+
return r;
|
|
17
|
+
}, f = (t, c = !1) => t.map((a) => {
|
|
18
|
+
if (a.format)
|
|
19
|
+
return {
|
|
20
|
+
label: `${a.text} | ${a.format.key}=${a.format.value}`,
|
|
21
|
+
value: `{{${a.value}|${a.format.key}=${a.format.value}}}`
|
|
22
|
+
};
|
|
23
|
+
if (c) {
|
|
24
|
+
if (!a.fallback)
|
|
25
|
+
return {
|
|
26
|
+
label: a.text,
|
|
27
|
+
value: `{{ ${a.value} }}`
|
|
28
|
+
};
|
|
29
|
+
const r = !Number.isNaN(Number(a.fallback)) && a.fallback.trim() !== "" ? a.fallback : `"${a.fallback}"`;
|
|
30
|
+
return {
|
|
31
|
+
label: `${a.text} | ${a.fallback}`,
|
|
32
|
+
value: `{{ ${a.value} | default: ${r} }}`
|
|
33
|
+
};
|
|
34
|
+
}
|
|
32
35
|
return {
|
|
33
|
-
label:
|
|
34
|
-
value: `{{
|
|
36
|
+
label: a.fallback ? `${a.text} | ${a.fallback}` : a.text,
|
|
37
|
+
value: a.fallback ? `{{${a.value}|${a.fallback}}}` : `{{${a.value}}}`
|
|
35
38
|
};
|
|
36
|
-
},
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
}), $ = (t) => {
|
|
43
|
-
const r = [], e = /* @__PURE__ */ new Set(), l = (a) => {
|
|
44
|
-
Array.isArray(a) && a.forEach((n) => {
|
|
45
|
-
const o = [...n.children ?? [], ...n.select_items ?? []];
|
|
46
|
-
if (o.length > 0) {
|
|
47
|
-
l(o);
|
|
39
|
+
}), b = (t) => {
|
|
40
|
+
const c = [], a = /* @__PURE__ */ new Set(), s = (l) => {
|
|
41
|
+
Array.isArray(l) && l.forEach((e) => {
|
|
42
|
+
const n = [...e.children ?? [], ...e.select_items ?? []];
|
|
43
|
+
if (n.length > 0) {
|
|
44
|
+
s(n);
|
|
48
45
|
return;
|
|
49
46
|
}
|
|
50
|
-
const u =
|
|
51
|
-
u &&
|
|
47
|
+
const u = e.text || e.tag_text;
|
|
48
|
+
u && e.value && !a.has(e.value) && (a.add(e.value), c.push({ text: u, value: e.value }));
|
|
52
49
|
});
|
|
53
|
-
}, [
|
|
54
|
-
return
|
|
55
|
-
},
|
|
56
|
-
const
|
|
50
|
+
}, [r] = Object.values(t ?? {});
|
|
51
|
+
return s(r), c;
|
|
52
|
+
}, i = (t, c, a = !1) => {
|
|
53
|
+
const s = new Set(t.map((l) => l.value)), r = c.filter((l) => s.has(l.value) ? !1 : (s.add(l.value), !0));
|
|
57
54
|
return [
|
|
58
|
-
...
|
|
59
|
-
...
|
|
55
|
+
...f(t, a),
|
|
56
|
+
...f(r, a)
|
|
60
57
|
];
|
|
61
|
-
},
|
|
58
|
+
}, v = () => {
|
|
62
59
|
var t;
|
|
63
60
|
return ((t = document.head.querySelector('meta[name="csrf-token"]')) == null ? void 0 : t.getAttribute("content")) ?? "";
|
|
64
|
-
},
|
|
65
|
-
if (t === null || typeof t != "object" || Array.isArray(t))
|
|
66
|
-
return !1;
|
|
67
|
-
const r = Object.getPrototypeOf(t);
|
|
68
|
-
return r === Object.prototype || r === null;
|
|
69
|
-
};
|
|
61
|
+
}, k = (t) => typeof t == "string" ? t : typeof t == "number" ? String(t) : "";
|
|
70
62
|
export {
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
k as mergeTagToDynamicContent
|
|
63
|
+
k as asText,
|
|
64
|
+
i as buildMergeTagEntries,
|
|
65
|
+
f as dynamicContentToMergeTags,
|
|
66
|
+
b as flattenDynamicContentList,
|
|
67
|
+
v as getCsrfToken,
|
|
68
|
+
o as mergeTagToDynamicContent
|
|
78
69
|
};
|
|
@@ -1,32 +1,31 @@
|
|
|
1
|
-
import { useActionsApi as
|
|
2
|
-
import { useConfig as
|
|
3
|
-
import { useHtmlCompiler as
|
|
4
|
-
import { DEFAULT_CURRENCY as m, DEFAULT_NODE_CONFIG as
|
|
5
|
-
import { useRecommendationExtensionStore as
|
|
6
|
-
import { mapLegacyStrategy as
|
|
1
|
+
import { useActionsApi as R } from "../composables/useActionsApi.js";
|
|
2
|
+
import { useConfig as k } from "../composables/useConfig.js";
|
|
3
|
+
import { useHtmlCompiler as N } from "../composables/useHtmlCompiler.js";
|
|
4
|
+
import { RRS_CONFIG_VERSION as U, DEFAULT_CURRENCY as m, DEFAULT_NODE_CONFIG as a } from "../extensions/Blocks/Recommendation/constants/defaultConfig.js";
|
|
5
|
+
import { useRecommendationExtensionStore as I } from "../extensions/Blocks/Recommendation/store/recommendation.js";
|
|
6
|
+
import { mapLegacyStrategy as x } from "../extensions/Blocks/Recommendation/utils/legacyStrategyMap.js";
|
|
7
7
|
import { DATA_ATTRIBUTES as T } from "../extensions/Blocks/Unsubscribe/utils/constants.js";
|
|
8
|
-
import { parsePageList as
|
|
9
|
-
import { useDynamicContentStore as
|
|
10
|
-
import { useEditorStore as
|
|
8
|
+
import { parsePageList as L } from "../extensions/Blocks/Unsubscribe/utils/utils.js";
|
|
9
|
+
import { useDynamicContentStore as z } from "../stores/dynamic-content.js";
|
|
10
|
+
import { useEditorStore as _ } from "../stores/editor.js";
|
|
11
11
|
import { useUnsubscribeStore as O } from "../stores/unsubscribe.js";
|
|
12
|
-
import { isPlainObject as _ } from "./genericUtil.js";
|
|
13
12
|
import { assignTrackingIds as v } from "./linkTrackingIds.js";
|
|
14
|
-
function
|
|
15
|
-
const
|
|
16
|
-
return
|
|
17
|
-
const
|
|
18
|
-
|
|
13
|
+
function B(l) {
|
|
14
|
+
const s = new DOMParser().parseFromString(l, "text/html").querySelectorAll(`[${T.PAGE_LIST}]`), t = [];
|
|
15
|
+
return s.forEach((c) => {
|
|
16
|
+
const r = c.getAttribute(T.PAGE_LIST);
|
|
17
|
+
r && t.push(...L(r));
|
|
19
18
|
}), [...new Set(t)];
|
|
20
19
|
}
|
|
21
|
-
async function
|
|
22
|
-
const
|
|
23
|
-
if (
|
|
20
|
+
async function G(l) {
|
|
21
|
+
const n = new DOMParser().parseFromString(l, "text/html").querySelectorAll(".recommendation-block-v2");
|
|
22
|
+
if (n.length === 0)
|
|
24
23
|
return;
|
|
25
|
-
const
|
|
26
|
-
|
|
27
|
-
var
|
|
28
|
-
const c = t.getAttribute("recommendation-id"),
|
|
29
|
-
if (!Number.isFinite(
|
|
24
|
+
const s = I();
|
|
25
|
+
n.forEach((t) => {
|
|
26
|
+
var d, g, f, i, y, S;
|
|
27
|
+
const c = t.getAttribute("recommendation-id"), r = c ? Number(c) : NaN;
|
|
28
|
+
if (!Number.isFinite(r))
|
|
30
29
|
return;
|
|
31
30
|
const p = t.getAttribute("esd-ext-config");
|
|
32
31
|
if (!p)
|
|
@@ -37,32 +36,32 @@ async function q(l) {
|
|
|
37
36
|
} catch {
|
|
38
37
|
return;
|
|
39
38
|
}
|
|
40
|
-
if (!
|
|
39
|
+
if (!e || typeof e != "object" || Array.isArray(e))
|
|
41
40
|
return;
|
|
42
|
-
const
|
|
41
|
+
const A = !!e.strategyId || (e.configVersion ?? 0) >= U, o = {
|
|
43
42
|
// Normalize legacy strategy keys (e.g. `mostViewed` → `mostPopular`) so
|
|
44
43
|
// already-saved blocks that never re-run the migrator don't emit a
|
|
45
44
|
// strategy-less campaign URL. `||` also catches '' / undefined (SD-144882).
|
|
46
|
-
strategy:
|
|
47
|
-
strategyId: e.strategyId ??
|
|
48
|
-
language: e.language ??
|
|
49
|
-
size: e.size ??
|
|
45
|
+
strategy: x(e.strategy) || (A ? "" : a.strategy),
|
|
46
|
+
strategyId: e.strategyId ?? a.strategyId,
|
|
47
|
+
language: e.language ?? a.language,
|
|
48
|
+
size: e.size ?? a.size,
|
|
50
49
|
// Spread the default arrays so each block gets a fresh reference
|
|
51
50
|
// instead of sharing the singleton in DEFAULT_NODE_CONFIG.
|
|
52
|
-
productIds: e.productIds ?? [...
|
|
53
|
-
filters: e.filters ?? [...
|
|
54
|
-
shuffleProducts: e.shuffleProducts ??
|
|
55
|
-
currencyCode: ((
|
|
56
|
-
currencySymbol: ((
|
|
57
|
-
currencyAlignment: ((
|
|
58
|
-
currencyDecimalCount: ((
|
|
59
|
-
currencyDecimalSeparator: ((
|
|
60
|
-
currencyThousandSeparator: ((
|
|
51
|
+
productIds: e.productIds ?? [...a.productIds],
|
|
52
|
+
filters: e.filters ?? [...a.filters],
|
|
53
|
+
shuffleProducts: e.shuffleProducts ?? a.shuffleProducts,
|
|
54
|
+
currencyCode: ((d = e.currency) == null ? void 0 : d.code) ?? m.code,
|
|
55
|
+
currencySymbol: ((g = e.currency) == null ? void 0 : g.symbol) ?? m.symbol,
|
|
56
|
+
currencyAlignment: ((f = e.currency) == null ? void 0 : f.alignment) ?? m.alignment,
|
|
57
|
+
currencyDecimalCount: ((i = e.currency) == null ? void 0 : i.decimalCount) ?? m.decimalCount,
|
|
58
|
+
currencyDecimalSeparator: ((y = e.currency) == null ? void 0 : y.decimalSeparator) ?? m.decimalSeparator,
|
|
59
|
+
currencyThousandSeparator: ((S = e.currency) == null ? void 0 : S.thousandSeparator) ?? m.thousandSeparator
|
|
61
60
|
};
|
|
62
|
-
|
|
61
|
+
s.seedBlockUrlConfig(r, o);
|
|
63
62
|
});
|
|
64
63
|
try {
|
|
65
|
-
await
|
|
64
|
+
await s.fetchRecommendationCreateData();
|
|
66
65
|
} catch (t) {
|
|
67
66
|
console.warn(
|
|
68
67
|
"Recommendation reference data pre-load failed; validator will skip the availability check.",
|
|
@@ -70,40 +69,40 @@ async function q(l) {
|
|
|
70
69
|
);
|
|
71
70
|
}
|
|
72
71
|
}
|
|
73
|
-
const
|
|
74
|
-
const l =
|
|
72
|
+
const ee = () => {
|
|
73
|
+
const l = z(), u = _(), n = O(), { getCompiledEmail: s, getTemplateData: t, updateHtmlAndCss: c } = R(), { compileHtml: r, compileAmpHtml: p } = N(), { isFeatureEnabled: e } = k();
|
|
75
74
|
return {
|
|
76
75
|
prepareTemplateDetails: async () => {
|
|
77
|
-
let { html:
|
|
76
|
+
let { html: o, css: d, syncModulesIds: g = [] } = await t();
|
|
78
77
|
if (e("linkTrackingIds"))
|
|
79
78
|
try {
|
|
80
|
-
const { html:
|
|
81
|
-
u.trackIdSessionFloor = H,
|
|
82
|
-
} catch (
|
|
83
|
-
console.error("Tracking-id step failed, saving anyway:",
|
|
79
|
+
const { html: b, changed: P, nextSeq: H } = v(o, u.trackIdSessionFloor);
|
|
80
|
+
u.trackIdSessionFloor = H, P && (o = b, await c(b, d));
|
|
81
|
+
} catch (b) {
|
|
82
|
+
console.error("Tracking-id step failed, saving anyway:", b);
|
|
84
83
|
}
|
|
85
|
-
const { html: f, ampHtml:
|
|
84
|
+
const { html: f, ampHtml: i = "", ampErrors: y = [] } = await s({
|
|
86
85
|
minimize: !0,
|
|
87
86
|
resetDataSavedFlag: !1
|
|
88
87
|
});
|
|
89
|
-
|
|
90
|
-
const { compiledHtml:
|
|
88
|
+
n.selectedUnsubscribePages.length && await n.fetchTemplates(), await G(o);
|
|
89
|
+
const { compiledHtml: S, stats: h, appliedRules: w } = r(f), D = i && p(i).compiledHtml, E = l.getSelectedDynamicContentList, F = I(), C = B(o);
|
|
91
90
|
return console.debug("HTML Compilation Stats:", {
|
|
92
|
-
originalSize:
|
|
93
|
-
compiledSize:
|
|
94
|
-
reduction: `${
|
|
91
|
+
originalSize: h.originalSize,
|
|
92
|
+
compiledSize: h.compiledSize,
|
|
93
|
+
reduction: `${h.reductionPercentage.toFixed(2)}%`,
|
|
95
94
|
appliedRules: w,
|
|
96
|
-
executionTime: `${
|
|
95
|
+
executionTime: `${h.executionTime.toFixed(2)}ms`
|
|
97
96
|
}), {
|
|
98
|
-
dynamicContentList:
|
|
99
|
-
compiledHtml:
|
|
100
|
-
rawHtml:
|
|
97
|
+
dynamicContentList: E,
|
|
98
|
+
compiledHtml: S,
|
|
99
|
+
rawHtml: o,
|
|
101
100
|
css: d,
|
|
102
101
|
ampHtml: D,
|
|
103
102
|
ampErrors: y,
|
|
104
103
|
modules: g.map(Number),
|
|
105
104
|
recommendation: {
|
|
106
|
-
campaignUrls:
|
|
105
|
+
campaignUrls: F.recommendationCampaignUrls,
|
|
107
106
|
configs: {}
|
|
108
107
|
},
|
|
109
108
|
unsubscribe: {
|
|
@@ -115,6 +114,6 @@ const te = () => {
|
|
|
115
114
|
};
|
|
116
115
|
};
|
|
117
116
|
export {
|
|
118
|
-
|
|
119
|
-
|
|
117
|
+
B as getHtmlReferencedUnsubscribePages,
|
|
118
|
+
ee as useTemplatePreparation
|
|
120
119
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@useinsider/guido",
|
|
3
|
-
"version": "3.18.2-beta.
|
|
3
|
+
"version": "3.18.2-beta.6cafced",
|
|
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",
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import type { BaseDynamicContent } from '@@/Types/generic';
|
|
2
|
-
export type DynamicContentFormat = NonNullable<BaseDynamicContent['format']>;
|
|
3
|
-
/** Format key the dynamic-content picker sends for a custom date/time format. */
|
|
4
|
-
export declare const TIME_FORMAT_KEY = "time-format";
|
|
5
|
-
/** Wraps a Liquid filter argument in whichever quote style the value itself does not use. */
|
|
6
|
-
export declare const quoteArgument: (value: string) => string | null;
|
|
7
|
-
/**
|
|
8
|
-
* `{ key: 'time-format', value: '%Y-%m-%d' }` -> `date: "%Y-%m-%d"`.
|
|
9
|
-
*
|
|
10
|
-
* Only a custom date/time strftime pattern has a Liquid equivalent. Anything else returns null so
|
|
11
|
-
* the caller emits a plain tag rather than one that silently lost — or literally printed — its
|
|
12
|
-
* format.
|
|
13
|
-
* @example formatToLiquidFilter({ key: 'time-format', value: '%b %-d, %Y' }) -> date: "%b %-d, %Y"
|
|
14
|
-
*/
|
|
15
|
-
export declare const formatToLiquidFilter: (format: DynamicContentFormat) => string | null;
|
|
16
|
-
/**
|
|
17
|
-
* Inverse of `formatToLiquidFilter` — reads the picker format back out of one filter segment, so a
|
|
18
|
-
* reopened tag restores its selection in the host's format dropdown.
|
|
19
|
-
*/
|
|
20
|
-
export declare const liquidFilterToFormat: (segment: string) => DynamicContentFormat | null;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
const E = "time-format", r = "date", u = new RegExp(`^${r}\\s*:\\s*(?:"([^"]*)"|'([^']*)')$`), s = /%[-_0^#]?\d*[a-zA-Z%]/, c = new RegExp(s, "g"), l = /\b(?:Y{2,4}|M{2,4}|D{1,4}|d{3,4}|H{2}|h{2}|m{2}|s{2}|S{1,3}|A|a)\b/, T = (t) => t.includes('"') ? t.includes("'") ? null : `'${t}'` : `"${t}"`, i = (t) => s.test(t) && !l.test(t.replace(c, "")), R = (t) => {
|
|
2
|
-
if (t.key !== E || !i(t.value ?? ""))
|
|
3
|
-
return null;
|
|
4
|
-
const n = T(t.value);
|
|
5
|
-
return n === null ? null : `${r}: ${n}`;
|
|
6
|
-
}, _ = (t) => {
|
|
7
|
-
const [, n, o] = t.match(u) ?? [], e = n ?? o;
|
|
8
|
-
return e ? { key: E, value: e } : null;
|
|
9
|
-
};
|
|
10
|
-
export {
|
|
11
|
-
E as TIME_FORMAT_KEY,
|
|
12
|
-
R as formatToLiquidFilter,
|
|
13
|
-
_ as liquidFilterToFormat,
|
|
14
|
-
T as quoteArgument
|
|
15
|
-
};
|