@useinsider/guido 3.17.0-beta.dc7f4d2 → 3.17.0-beta.e23d5cd
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 +6 -5
- package/dist/@types/config/schemas.js +7 -6
- package/dist/components/Guido.vue.js +6 -6
- package/dist/components/Guido.vue2.js +96 -94
- package/dist/components/organisms/AutoSaveController.vue2.js +8 -9
- package/dist/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue.js +21 -0
- package/dist/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue2.js +106 -0
- package/dist/components/organisms/extensions/recommendation/StrategyInfoBoxContent.vue.js +19 -0
- package/dist/components/organisms/extensions/recommendation/StrategyInfoBoxContent.vue2.js +63 -0
- package/dist/components/organisms/header/EditorActions.vue.js +2 -2
- package/dist/components/organisms/header/EditorActions.vue2.js +43 -74
- package/dist/components/organisms/header/LeftSlot.vue.js +5 -5
- package/dist/components/organisms/header/LeftSlot.vue2.js +23 -46
- package/dist/components/wrappers/WpDrawer.vue.js +7 -9
- package/dist/components/wrappers/WpDrawer.vue2.js +1 -1
- package/dist/composables/useCustomInterfaceAppearance.js +52 -38
- package/dist/composables/useHtmlCompiler.js +26 -37
- package/dist/composables/useHtmlValidator.js +0 -2
- package/dist/composables/useRecommendation.js +41 -34
- package/dist/composables/useSave.js +41 -84
- package/dist/composables/validators/useCouponBlockValidator.js +21 -24
- package/dist/composables/validators/useUnsubscribeBlockValidator.js +27 -34
- package/dist/config/migrator/recommendation/settingsMapper.js +17 -17
- package/dist/config/migrator/recommendationMigrator.js +5 -4
- package/dist/enums/academy.js +2 -1
- package/dist/enums/date.js +5 -3
- package/dist/enums/extensions/recommendationBlock.js +3 -1
- package/dist/extensions/Blocks/Recommendation/block.js +26 -21
- package/dist/extensions/Blocks/Recommendation/constants/defaultConfig.js +34 -34
- package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +96 -95
- package/dist/extensions/Blocks/Recommendation/controls/main/index.js +238 -185
- package/dist/extensions/Blocks/Recommendation/controls/main/strategy.js +124 -0
- package/dist/extensions/Blocks/Recommendation/services/configService.js +54 -36
- package/dist/extensions/Blocks/Recommendation/store/recommendation.js +165 -86
- package/dist/extensions/Blocks/common-control.js +22 -19
- package/dist/guido.css +1 -1
- package/dist/services/recommendationApi.js +69 -30
- package/dist/src/@types/config/schemas.d.ts +2 -0
- package/dist/src/components/Guido.vue.d.ts +1 -17
- package/dist/src/components/organisms/{validation/ValidationErrorDrawer.vue.d.ts → extensions/recommendation/AssignStrategyDrawer.vue.d.ts} +1 -0
- package/dist/src/components/organisms/extensions/recommendation/StrategyInfoBoxContent.vue.d.ts +15 -0
- package/dist/src/components/organisms/header/EditorActions.vue.d.ts +1 -17
- package/dist/src/components/organisms/header/HeaderWrapper.vue.d.ts +1 -17
- package/dist/src/components/organisms/header/RightSlot.vue.d.ts +1 -17
- package/dist/src/components/wrappers/WpDrawer.vue.d.ts +3 -4
- package/dist/src/composables/useConfig.d.ts +2 -0
- package/dist/src/composables/useHtmlValidator.d.ts +0 -21
- package/dist/src/composables/useRecommendation.d.ts +1 -0
- package/dist/src/composables/useSave.d.ts +1 -6
- package/dist/src/composables/validators/useCouponBlockValidator.d.ts +0 -3
- package/dist/src/composables/validators/useUnsubscribeBlockValidator.d.ts +0 -10
- package/dist/src/enums/academy.d.ts +1 -0
- package/dist/src/enums/date.d.ts +1 -0
- package/dist/src/enums/extensions/recommendationBlock.d.ts +2 -0
- package/dist/src/extensions/Blocks/Recommendation/constants/defaultConfig.d.ts +2 -6
- package/dist/src/extensions/Blocks/Recommendation/constants/index.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +44 -8
- package/dist/src/extensions/Blocks/Recommendation/controls/main/strategy.d.ts +16 -0
- package/dist/src/extensions/Blocks/Recommendation/services/configService.d.ts +12 -1
- package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +150 -15
- package/dist/src/extensions/Blocks/Recommendation/types/nodeConfig.d.ts +1 -0
- package/dist/src/extensions/Blocks/common-control.d.ts +4 -1
- package/dist/src/mock/api/recommendation-strategies.d.ts +2 -0
- package/dist/src/services/recommendationApi.d.ts +4 -1
- package/dist/src/stores/config.d.ts +18 -5
- package/dist/src/stores/save-as-template.d.ts +4 -3
- package/dist/src/utils/genericUtil.d.ts +5 -0
- package/dist/src/utils/templatePreparation.d.ts +0 -30
- package/dist/static/assets/icons/line-change.svg.js +5 -0
- package/dist/static/assets/icons/line-delete.svg.js +5 -0
- package/dist/static/assets/icons/line-plus.svg.js +5 -0
- package/dist/static/styles/components/recommendation-strategy.css.js +155 -0
- package/dist/stores/config.js +6 -13
- package/dist/utils/dateUtil.js +23 -10
- package/dist/utils/genericUtil.js +28 -27
- package/dist/utils/templatePreparation.js +48 -50
- package/package.json +3 -2
- package/dist/components/organisms/validation/ValidationErrorDrawer.vue.js +0 -20
- package/dist/components/organisms/validation/ValidationErrorDrawer.vue2.js +0 -48
- package/dist/composables/useSaveValidation.js +0 -279
- package/dist/composables/useSaveValidationRollout.js +0 -9
- package/dist/enums/save-validation.js +0 -4
- package/dist/src/@types/save-validation.d.ts +0 -19
- package/dist/src/composables/useSaveValidation.d.ts +0 -6
- package/dist/src/composables/useSaveValidationRollout.d.ts +0 -3
- package/dist/src/enums/save-validation.d.ts +0 -27
- package/dist/src/stores/save-validation.d.ts +0 -22
- package/dist/stores/save-validation.js +0 -30
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
const n = `.strategy-control-header {
|
|
2
|
+
padding: 16px 16px 0;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
.strategy-control-title {
|
|
6
|
+
margin: 0;
|
|
7
|
+
color: var(--guido-color-gray-800);
|
|
8
|
+
font-size: 16px;
|
|
9
|
+
font-weight: 600;
|
|
10
|
+
line-height: 24px;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.strategy-control-description-row {
|
|
14
|
+
padding: 8px 16px 16px;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.strategy-control-description {
|
|
18
|
+
margin: 0;
|
|
19
|
+
color: var(--guido-color-gray-600);
|
|
20
|
+
font-size: 13px;
|
|
21
|
+
line-height: 16px;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.strategy-control-description a {
|
|
25
|
+
color: var(--guido-color-primary-500);
|
|
26
|
+
text-decoration: underline;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.recommendation-controls-container .container.strategy-control-cta-row {
|
|
30
|
+
grid-template-columns: repeat(2, minmax(0, 180px));
|
|
31
|
+
justify-content: start;
|
|
32
|
+
gap: 16px;
|
|
33
|
+
padding: 0 16px 16px;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.strategy-control-cta {
|
|
37
|
+
width: 100%;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.strategy-control-cta > .button {
|
|
41
|
+
display: flex;
|
|
42
|
+
gap: 8px;
|
|
43
|
+
justify-content: center;
|
|
44
|
+
width: 100%;
|
|
45
|
+
border: none;
|
|
46
|
+
font-size: 15px;
|
|
47
|
+
font-weight: 400;
|
|
48
|
+
line-height: 24px;
|
|
49
|
+
white-space: nowrap;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.strategy-control-cta.primary > .button:disabled,
|
|
53
|
+
.strategy-control-cta.primary > .button.disabled {
|
|
54
|
+
opacity: 1;
|
|
55
|
+
color: var(--guido-color-gray-800);
|
|
56
|
+
cursor: default;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.strategy-control-name-band {
|
|
60
|
+
display: flex;
|
|
61
|
+
align-items: center;
|
|
62
|
+
min-height: 48px;
|
|
63
|
+
padding: 0 16px;
|
|
64
|
+
background-color: var(--guido-color-gray-0);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.strategy-control-name {
|
|
68
|
+
color: var(--guido-color-gray-800);
|
|
69
|
+
font-size: 15px;
|
|
70
|
+
font-weight: 600;
|
|
71
|
+
line-height: 24px;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.strategy-control-actions {
|
|
75
|
+
display: flex;
|
|
76
|
+
align-items: center;
|
|
77
|
+
padding: 16px;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.strategy-control-action {
|
|
81
|
+
display: inline-flex;
|
|
82
|
+
align-items: center;
|
|
83
|
+
padding: 0;
|
|
84
|
+
border: none;
|
|
85
|
+
background: none;
|
|
86
|
+
font-size: 15px;
|
|
87
|
+
font-weight: 400;
|
|
88
|
+
line-height: 24px;
|
|
89
|
+
cursor: pointer;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
.strategy-control-action > span {
|
|
93
|
+
padding: 0 8px;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
.strategy-control-action::before,
|
|
97
|
+
.strategy-control-cta.on > .button::before {
|
|
98
|
+
content: '';
|
|
99
|
+
flex: none;
|
|
100
|
+
width: 24px;
|
|
101
|
+
height: 24px;
|
|
102
|
+
background-color: currentcolor;
|
|
103
|
+
mask-repeat: no-repeat;
|
|
104
|
+
mask-position: center;
|
|
105
|
+
mask-size: 24px 24px;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
.strategy-control-action--change::before {
|
|
109
|
+
mask-image: var(--guido-icon-line-change);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
.strategy-control-action--remove::before {
|
|
113
|
+
mask-image: var(--guido-icon-line-delete);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
.strategy-control-cta.on > .button::before {
|
|
117
|
+
mask-image: var(--guido-icon-line-plus);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
.strategy-control-action--change {
|
|
121
|
+
color: var(--guido-color-primary-500);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
.strategy-control-action--remove {
|
|
125
|
+
color: var(--guido-color-danger-500);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
.strategy-control-action:hover {
|
|
129
|
+
text-decoration: underline;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
.recommendation-controls-container:not(.strategy-block) .strategy-control-container,
|
|
133
|
+
.recommendation-controls-container.strategy-block .product-count-control-container,
|
|
134
|
+
.recommendation-controls-container.strategy-block .algorithm-control-container,
|
|
135
|
+
.recommendation-controls-container.strategy-block .filters-control-container,
|
|
136
|
+
.recommendation-controls-container.strategy-block .shuffle-control-container {
|
|
137
|
+
display: none;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
.recommendation-controls-container.strategy-block {
|
|
141
|
+
display: flex;
|
|
142
|
+
flex-direction: column;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
.recommendation-controls-container.strategy-block .price-placement-control-container {
|
|
146
|
+
order: 1;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
.recommendation-controls-container.strategy-block .product-layout-control-container {
|
|
150
|
+
order: 2;
|
|
151
|
+
}
|
|
152
|
+
`;
|
|
153
|
+
export {
|
|
154
|
+
n as default
|
|
155
|
+
};
|
package/dist/stores/config.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import
|
|
1
|
+
import "../@types/config/schemas.js";
|
|
2
2
|
import "../@types/config/defaults.js";
|
|
3
|
-
import { parseConfig as
|
|
4
|
-
import { defineStore as
|
|
5
|
-
const
|
|
3
|
+
import { parseConfig as o } from "../@types/config/validator.js";
|
|
4
|
+
import { defineStore as r } from "pinia";
|
|
5
|
+
const f = r("guido-config", {
|
|
6
6
|
state: () => ({
|
|
7
7
|
initialized: !1,
|
|
8
8
|
config: null
|
|
@@ -113,13 +113,6 @@ const g = a("guido-config", {
|
|
|
113
113
|
var e, n;
|
|
114
114
|
return ((n = (e = i.config) == null ? void 0 : e.partner) == null ? void 0 : n.messageType) ?? 1;
|
|
115
115
|
},
|
|
116
|
-
/**
|
|
117
|
-
* Transactional campaigns keep the hard save block. Reactive getter, so
|
|
118
|
-
* consumers stay safe in setup where a raw config read snapshots null (SD-147945).
|
|
119
|
-
*/
|
|
120
|
-
isTransactional() {
|
|
121
|
-
return this.messageType === o.TRANSACTIONAL;
|
|
122
|
-
},
|
|
123
116
|
/**
|
|
124
117
|
* Get the username
|
|
125
118
|
*/
|
|
@@ -150,7 +143,7 @@ const g = a("guido-config", {
|
|
|
150
143
|
* Initialize the config store with validated configuration
|
|
151
144
|
*/
|
|
152
145
|
init(i) {
|
|
153
|
-
const e =
|
|
146
|
+
const e = o(i);
|
|
154
147
|
this.config = e, this.initialized = !0;
|
|
155
148
|
},
|
|
156
149
|
/**
|
|
@@ -162,5 +155,5 @@ const g = a("guido-config", {
|
|
|
162
155
|
}
|
|
163
156
|
});
|
|
164
157
|
export {
|
|
165
|
-
|
|
158
|
+
f as useConfigStore
|
|
166
159
|
};
|
package/dist/utils/dateUtil.js
CHANGED
|
@@ -1,10 +1,19 @@
|
|
|
1
|
-
import { DEFAULT_LOCALE as
|
|
2
|
-
const
|
|
1
|
+
import { DEFAULT_LOCALE as n, DEFAULT as a, DEFAULT_TZ as c } from "../enums/date.js";
|
|
2
|
+
const m = (t) => t ? t instanceof Date ? t : typeof t == "string" ? t.length === 10 && !Number.isNaN(Number(t)) ? new Date(Number(t) * 1e3) : new Date(t) : typeof t == "number" ? t.toString().length === 10 ? new Date(t * 1e3) : new Date(t) : /* @__PURE__ */ new Date() : /* @__PURE__ */ new Date(), s = () => {
|
|
3
3
|
const t = window.l10n;
|
|
4
|
-
return (t == null ? void 0 : t.locale) ===
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
return (t == null ? void 0 : t.locale) === a ? n : (t == null ? void 0 : t.locale) || n;
|
|
5
|
+
}, u = new Intl.DateTimeFormat().resolvedOptions().timeZone, f = () => {
|
|
6
|
+
const t = window.l10n;
|
|
7
|
+
return (t == null ? void 0 : t.timezone) || u || c;
|
|
8
|
+
}, D = (t, e = s(), r = f()) => {
|
|
9
|
+
const o = {
|
|
10
|
+
year: "numeric",
|
|
11
|
+
month: "2-digit",
|
|
12
|
+
day: "2-digit",
|
|
13
|
+
timeZone: r
|
|
14
|
+
}, i = m(t);
|
|
15
|
+
return new Intl.DateTimeFormat(e, o).format(i);
|
|
16
|
+
}, T = (t) => {
|
|
8
17
|
if (!t)
|
|
9
18
|
return "";
|
|
10
19
|
const e = new Date(t);
|
|
@@ -16,9 +25,13 @@ const i = (t) => {
|
|
|
16
25
|
second: "2-digit",
|
|
17
26
|
hour12: !1
|
|
18
27
|
}).format(e);
|
|
19
|
-
},
|
|
28
|
+
}, h = (t) => t ? Math.floor(Date.now() / 1e3) >= t : !1;
|
|
20
29
|
export {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
30
|
+
m as convertToDateObject,
|
|
31
|
+
T as formatPatchDate,
|
|
32
|
+
D as formatShortDate,
|
|
33
|
+
h as isAfterDate,
|
|
34
|
+
u as localTz,
|
|
35
|
+
s as locale,
|
|
36
|
+
f as timezone
|
|
24
37
|
};
|
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
const o = (
|
|
2
|
-
const a =
|
|
3
|
-
text:
|
|
4
|
-
value:
|
|
1
|
+
const o = (t) => {
|
|
2
|
+
const a = t.value.match(/\{\{([^}]+)\}\}/)[1].split("|").map((l) => l.trim()), [s] = a, r = {
|
|
3
|
+
text: t.label,
|
|
4
|
+
value: s || ""
|
|
5
5
|
};
|
|
6
6
|
if (a.length >= 2) {
|
|
7
|
-
const [,
|
|
8
|
-
if (
|
|
9
|
-
let n =
|
|
7
|
+
const [, l, e] = a;
|
|
8
|
+
if (l.startsWith("default:")) {
|
|
9
|
+
let n = l.slice(8).trim();
|
|
10
10
|
n.startsWith('"') && n.endsWith('"') && (n = n.slice(1, -1)), r.fallback = n;
|
|
11
11
|
} else {
|
|
12
|
-
const n =
|
|
13
|
-
n ? r.format = n : e || (r.fallback =
|
|
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);
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
16
|
return r;
|
|
17
|
-
}, f = (
|
|
17
|
+
}, f = (t, c = !1) => t.map((a) => {
|
|
18
18
|
if (a.format)
|
|
19
19
|
return {
|
|
20
20
|
label: `${a.text} | ${a.format.key}=${a.format.value}`,
|
|
21
21
|
value: `{{${a.value}|${a.format.key}=${a.format.value}}}`
|
|
22
22
|
};
|
|
23
|
-
if (
|
|
23
|
+
if (c) {
|
|
24
24
|
if (!a.fallback)
|
|
25
25
|
return {
|
|
26
26
|
label: a.text,
|
|
@@ -36,33 +36,34 @@ const o = (l) => {
|
|
|
36
36
|
label: a.fallback ? `${a.text} | ${a.fallback}` : a.text,
|
|
37
37
|
value: a.fallback ? `{{${a.value}|${a.fallback}}}` : `{{${a.value}}}`
|
|
38
38
|
};
|
|
39
|
-
}), b = (
|
|
40
|
-
const
|
|
41
|
-
Array.isArray(
|
|
39
|
+
}), b = (t) => {
|
|
40
|
+
const c = [], a = /* @__PURE__ */ new Set(), s = (l) => {
|
|
41
|
+
Array.isArray(l) && l.forEach((e) => {
|
|
42
42
|
const n = [...e.children ?? [], ...e.select_items ?? []];
|
|
43
43
|
if (n.length > 0) {
|
|
44
|
-
|
|
44
|
+
s(n);
|
|
45
45
|
return;
|
|
46
46
|
}
|
|
47
47
|
const u = e.text || e.tag_text;
|
|
48
|
-
u && e.value && !a.has(e.value) && (a.add(e.value),
|
|
48
|
+
u && e.value && !a.has(e.value) && (a.add(e.value), c.push({ text: u, value: e.value }));
|
|
49
49
|
});
|
|
50
|
-
}, [r] = Object.values(
|
|
51
|
-
return
|
|
52
|
-
},
|
|
53
|
-
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));
|
|
54
54
|
return [
|
|
55
|
-
...f(
|
|
55
|
+
...f(t, a),
|
|
56
56
|
...f(r, a)
|
|
57
57
|
];
|
|
58
|
-
},
|
|
59
|
-
var
|
|
60
|
-
return ((
|
|
61
|
-
};
|
|
58
|
+
}, v = () => {
|
|
59
|
+
var t;
|
|
60
|
+
return ((t = document.head.querySelector('meta[name="csrf-token"]')) == null ? void 0 : t.getAttribute("content")) ?? "";
|
|
61
|
+
}, k = (t) => typeof t == "string" ? t : typeof t == "number" ? String(t) : "";
|
|
62
62
|
export {
|
|
63
|
-
|
|
63
|
+
k as asText,
|
|
64
|
+
i as buildMergeTagEntries,
|
|
64
65
|
f as dynamicContentToMergeTags,
|
|
65
66
|
b as flattenDynamicContentList,
|
|
66
|
-
|
|
67
|
+
v as getCsrfToken,
|
|
67
68
|
o as mergeTagToDynamicContent
|
|
68
69
|
};
|
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
import { useActionsApi as
|
|
1
|
+
import { useActionsApi as k } from "../composables/useActionsApi.js";
|
|
2
2
|
import { useConfig as U } from "../composables/useConfig.js";
|
|
3
3
|
import { useHtmlCompiler as x } from "../composables/useHtmlCompiler.js";
|
|
4
|
-
import { DEFAULT_CURRENCY as d, DEFAULT_NODE_CONFIG as
|
|
5
|
-
import { useRecommendationExtensionStore as
|
|
4
|
+
import { DEFAULT_CURRENCY as d, DEFAULT_NODE_CONFIG as a } from "../extensions/Blocks/Recommendation/constants/defaultConfig.js";
|
|
5
|
+
import { useRecommendationExtensionStore as C } from "../extensions/Blocks/Recommendation/store/recommendation.js";
|
|
6
6
|
import { mapLegacyStrategy as L } from "../extensions/Blocks/Recommendation/utils/legacyStrategyMap.js";
|
|
7
7
|
import { DATA_ATTRIBUTES as A } from "../extensions/Blocks/Unsubscribe/utils/constants.js";
|
|
8
|
-
import { parsePageList as
|
|
9
|
-
import { useDynamicContentStore as
|
|
10
|
-
import { useEditorStore as
|
|
11
|
-
import { useUnsubscribeStore as
|
|
12
|
-
import { assignTrackingIds as
|
|
13
|
-
function
|
|
14
|
-
const
|
|
15
|
-
return
|
|
16
|
-
const o =
|
|
17
|
-
o && t.push(...
|
|
8
|
+
import { parsePageList as R } from "../extensions/Blocks/Unsubscribe/utils/utils.js";
|
|
9
|
+
import { useDynamicContentStore as N } from "../stores/dynamic-content.js";
|
|
10
|
+
import { useEditorStore as z } from "../stores/editor.js";
|
|
11
|
+
import { useUnsubscribeStore as _ } from "../stores/unsubscribe.js";
|
|
12
|
+
import { assignTrackingIds as v } from "./linkTrackingIds.js";
|
|
13
|
+
function O(m) {
|
|
14
|
+
const i = new DOMParser().parseFromString(m, "text/html").querySelectorAll(`[${A.PAGE_LIST}]`), t = [];
|
|
15
|
+
return i.forEach((s) => {
|
|
16
|
+
const o = s.getAttribute(A.PAGE_LIST);
|
|
17
|
+
o && t.push(...R(o));
|
|
18
18
|
}), [...new Set(t)];
|
|
19
19
|
}
|
|
20
|
-
async function
|
|
21
|
-
const
|
|
22
|
-
if (
|
|
20
|
+
async function M(m) {
|
|
21
|
+
const n = new DOMParser().parseFromString(m, "text/html").querySelectorAll(".recommendation-block-v2");
|
|
22
|
+
if (n.length === 0)
|
|
23
23
|
return;
|
|
24
|
-
const
|
|
25
|
-
|
|
24
|
+
const i = C();
|
|
25
|
+
n.forEach((t) => {
|
|
26
26
|
var r, l, g, f, c;
|
|
27
|
-
const
|
|
27
|
+
const s = t.getAttribute("recommendation-id"), o = s ? Number(s) : NaN;
|
|
28
28
|
if (!Number.isFinite(o))
|
|
29
29
|
return;
|
|
30
30
|
const p = t.getAttribute("esd-ext-config");
|
|
@@ -42,24 +42,25 @@ async function C(m) {
|
|
|
42
42
|
// Normalize legacy strategy keys (e.g. `mostViewed` → `mostPopular`) so
|
|
43
43
|
// already-saved blocks that never re-run the migrator don't emit a
|
|
44
44
|
// strategy-less campaign URL. `||` also catches '' / undefined (SD-144882).
|
|
45
|
-
strategy: L(e.strategy) ||
|
|
46
|
-
|
|
47
|
-
|
|
45
|
+
strategy: L(e.strategy) || a.strategy,
|
|
46
|
+
strategyId: e.strategyId ?? a.strategyId,
|
|
47
|
+
language: e.language ?? a.language,
|
|
48
|
+
size: e.size ?? a.size,
|
|
48
49
|
// Spread the default arrays so each block gets a fresh reference
|
|
49
50
|
// instead of sharing the singleton in DEFAULT_NODE_CONFIG.
|
|
50
|
-
productIds: e.productIds ?? [...
|
|
51
|
-
filters: e.filters ?? [...
|
|
52
|
-
shuffleProducts: e.shuffleProducts ??
|
|
51
|
+
productIds: e.productIds ?? [...a.productIds],
|
|
52
|
+
filters: e.filters ?? [...a.filters],
|
|
53
|
+
shuffleProducts: e.shuffleProducts ?? a.shuffleProducts,
|
|
53
54
|
currencyCode: ((r = e.currency) == null ? void 0 : r.code) ?? d.code,
|
|
54
55
|
currencyAlignment: ((l = e.currency) == null ? void 0 : l.alignment) ?? d.alignment,
|
|
55
56
|
currencyDecimalCount: ((g = e.currency) == null ? void 0 : g.decimalCount) ?? d.decimalCount,
|
|
56
57
|
currencyDecimalSeparator: ((f = e.currency) == null ? void 0 : f.decimalSeparator) ?? d.decimalSeparator,
|
|
57
58
|
currencyThousandSeparator: ((c = e.currency) == null ? void 0 : c.thousandSeparator) ?? d.thousandSeparator
|
|
58
59
|
};
|
|
59
|
-
|
|
60
|
+
i.seedBlockUrlConfig(o, h);
|
|
60
61
|
});
|
|
61
62
|
try {
|
|
62
|
-
await
|
|
63
|
+
await i.fetchRecommendationCreateData();
|
|
63
64
|
} catch (t) {
|
|
64
65
|
console.warn(
|
|
65
66
|
"Recommendation reference data pre-load failed; validator will skip the availability check.",
|
|
@@ -68,39 +69,39 @@ async function C(m) {
|
|
|
68
69
|
}
|
|
69
70
|
}
|
|
70
71
|
const Z = () => {
|
|
71
|
-
const m =
|
|
72
|
+
const m = N(), u = z(), n = _(), { getCompiledEmail: i, getTemplateData: t, updateHtmlAndCss: s } = k(), { compileHtml: o, compileAmpHtml: p } = x(), { isFeatureEnabled: e } = U();
|
|
72
73
|
return {
|
|
73
74
|
prepareTemplateDetails: async () => {
|
|
74
75
|
let { html: r, css: l, syncModulesIds: g = [] } = await t();
|
|
75
76
|
if (e("linkTrackingIds"))
|
|
76
77
|
try {
|
|
77
|
-
const { html:
|
|
78
|
-
u.trackIdSessionFloor =
|
|
79
|
-
} catch (
|
|
80
|
-
console.error("Tracking-id step failed, saving anyway:",
|
|
78
|
+
const { html: S, changed: F, nextSeq: H } = v(r, u.trackIdSessionFloor);
|
|
79
|
+
u.trackIdSessionFloor = H, F && (r = S, await s(S, l));
|
|
80
|
+
} catch (S) {
|
|
81
|
+
console.error("Tracking-id step failed, saving anyway:", S);
|
|
81
82
|
}
|
|
82
|
-
const { html: f, ampHtml: c = "", ampErrors:
|
|
83
|
+
const { html: f, ampHtml: c = "", ampErrors: T = [] } = await i({
|
|
83
84
|
minimize: !0,
|
|
84
85
|
resetDataSavedFlag: !1
|
|
85
86
|
});
|
|
86
|
-
|
|
87
|
-
const { compiledHtml:
|
|
87
|
+
n.selectedUnsubscribePages.length && await n.fetchTemplates(), await M(r);
|
|
88
|
+
const { compiledHtml: I, stats: y, appliedRules: w } = o(f), D = c && p(c).compiledHtml, E = m.getSelectedDynamicContentList, P = C(), b = O(r);
|
|
88
89
|
return console.debug("HTML Compilation Stats:", {
|
|
89
|
-
originalSize:
|
|
90
|
-
compiledSize:
|
|
91
|
-
reduction: `${
|
|
92
|
-
appliedRules:
|
|
93
|
-
executionTime: `${
|
|
90
|
+
originalSize: y.originalSize,
|
|
91
|
+
compiledSize: y.compiledSize,
|
|
92
|
+
reduction: `${y.reductionPercentage.toFixed(2)}%`,
|
|
93
|
+
appliedRules: w,
|
|
94
|
+
executionTime: `${y.executionTime.toFixed(2)}ms`
|
|
94
95
|
}), {
|
|
95
|
-
dynamicContentList:
|
|
96
|
-
compiledHtml:
|
|
96
|
+
dynamicContentList: E,
|
|
97
|
+
compiledHtml: I,
|
|
97
98
|
rawHtml: r,
|
|
98
99
|
css: l,
|
|
99
|
-
ampHtml:
|
|
100
|
-
ampErrors:
|
|
100
|
+
ampHtml: D,
|
|
101
|
+
ampErrors: T,
|
|
101
102
|
modules: g.map(Number),
|
|
102
103
|
recommendation: {
|
|
103
|
-
campaignUrls:
|
|
104
|
+
campaignUrls: P.recommendationCampaignUrls,
|
|
104
105
|
configs: {}
|
|
105
106
|
},
|
|
106
107
|
unsubscribe: {
|
|
@@ -108,13 +109,10 @@ const Z = () => {
|
|
|
108
109
|
config: b
|
|
109
110
|
}
|
|
110
111
|
};
|
|
111
|
-
}
|
|
112
|
-
// Exposed so the back/test validate-only path can seed the reco store the
|
|
113
|
-
// same way a full save does (required-field findings depend on it).
|
|
114
|
-
hydrateRecommendationStore: C
|
|
112
|
+
}
|
|
115
113
|
};
|
|
116
114
|
};
|
|
117
115
|
export {
|
|
118
|
-
|
|
116
|
+
O as getHtmlReferencedUnsubscribePages,
|
|
119
117
|
Z as useTemplatePreparation
|
|
120
118
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@useinsider/guido",
|
|
3
|
-
"version": "3.17.0-beta.
|
|
3
|
+
"version": "3.17.0-beta.e23d5cd",
|
|
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",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"start": "vite",
|
|
26
26
|
"build": "vite build && vue-tsc --declaration --emitDeclarationOnly --project tsconfig.app.json",
|
|
27
27
|
"preview": "vite preview",
|
|
28
|
-
"lint": "NODE_OPTIONS=--max-old-space-size=2048 eslint ./ &&
|
|
28
|
+
"lint": "NODE_OPTIONS=--max-old-space-size=2048 eslint ./ && npm run type-check",
|
|
29
29
|
"lint:fix": "NODE_OPTIONS=--max-old-space-size=2048 eslint --fix ./",
|
|
30
30
|
"lint:e2e-quality": "node scripts/lint-e2e-quality.mjs",
|
|
31
31
|
"lint:e2e-quality:ci": "node scripts/lint-e2e-quality.mjs --ci",
|
|
@@ -48,6 +48,7 @@
|
|
|
48
48
|
"license": "ISC",
|
|
49
49
|
"dependencies": {
|
|
50
50
|
"@stripoinc/ui-editor-extensions": "3.9.0",
|
|
51
|
+
"@useinsider/design-system-organisms": "0.0.3-beta.d816f06",
|
|
51
52
|
"@useinsider/design-system-vue": "1.5.0",
|
|
52
53
|
"@vueuse/core": "11.3.0",
|
|
53
54
|
"lodash-es": "4.17.21",
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import n from "./ValidationErrorDrawer.vue2.js";
|
|
2
|
-
/* empty css */
|
|
3
|
-
import s from "../../../_virtual/_plugin-vue2_normalizer.js";
|
|
4
|
-
var i = function() {
|
|
5
|
-
var r = this, o = r._self._c, t = r._self._setupProxy;
|
|
6
|
-
return o(t.WpDrawer, { attrs: { id: "guido__validation-error-drawer", size: "small", "footer-button-group-options": t.footerButtonGroupOptions, status: t.store.isDrawerOpen, "title-text": t.titleText }, on: { onCloseEvent: t.handleClose, primaryButtonEvent: t.handleClose, secondaryButtonEvent: t.handleSaveAndContinue } }, [o("div", { staticClass: "d-f f-d-c validation-error-list" }, r._l(t.rows, function(e, a) {
|
|
7
|
-
return o("div", { key: a, staticClass: "d-f a-i-c validation-error-row" }, [o(t.InIcons, { staticClass: "validation-error-row__icon i-c-12", attrs: { name: "filled-caution-triangle" } }), o("span", { staticClass: "validation-error-row__text" }, [r._v(r._s(e))])], 1);
|
|
8
|
-
}), 0)]);
|
|
9
|
-
}, l = [], _ = /* @__PURE__ */ s(
|
|
10
|
-
n,
|
|
11
|
-
i,
|
|
12
|
-
l,
|
|
13
|
-
!1,
|
|
14
|
-
null,
|
|
15
|
-
"856367aa"
|
|
16
|
-
);
|
|
17
|
-
const p = _.exports;
|
|
18
|
-
export {
|
|
19
|
-
p as default
|
|
20
|
-
};
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { defineComponent as m, ref as p, computed as a } from "vue";
|
|
2
|
-
import f from "../../wrappers/WpDrawer.vue.js";
|
|
3
|
-
import { useSave as S } from "../../../composables/useSave.js";
|
|
4
|
-
import { useTranslations as v } from "../../../composables/useTranslations.js";
|
|
5
|
-
import { useConfigStore as g } from "../../../stores/config.js";
|
|
6
|
-
import { useEditorStore as y } from "../../../stores/editor.js";
|
|
7
|
-
import { useSaveValidationStore as _ } from "../../../stores/save-validation.js";
|
|
8
|
-
import { InIcons as h } from "@useinsider/design-system-vue";
|
|
9
|
-
const O = /* @__PURE__ */ m({
|
|
10
|
-
__name: "ValidationErrorDrawer",
|
|
11
|
-
setup(w) {
|
|
12
|
-
const r = v(), e = _(), n = y(), s = g(), { saveWithErrors: i } = S(), o = p(!1), l = a(() => `${r("email-editor.validation-errors")} (${e.errorCount})`), u = a(() => {
|
|
13
|
-
const t = {
|
|
14
|
-
primaryButton: {
|
|
15
|
-
styling: "solid",
|
|
16
|
-
type: "primary",
|
|
17
|
-
labelText: r("email-editor.update-design")
|
|
18
|
-
}
|
|
19
|
-
};
|
|
20
|
-
return !s.isTransactional && e.intent !== "test" && (t.secondaryButton = {
|
|
21
|
-
styling: "solid",
|
|
22
|
-
type: "subtle-primary",
|
|
23
|
-
labelText: r("email-editor.save-and-continue"),
|
|
24
|
-
loadingStatus: o.value
|
|
25
|
-
}), t;
|
|
26
|
-
}), d = a(() => e.errors.map((t) => {
|
|
27
|
-
const c = t.detail ? ` (${t.detail})` : "";
|
|
28
|
-
return `${t.message}${c}`;
|
|
29
|
-
}));
|
|
30
|
-
return { __sfc: !0, trans: r, store: e, editorStore: n, configStore: s, saveWithErrors: i, isSaving: o, titleText: l, footerButtonGroupOptions: u, rows: d, handleClose: () => {
|
|
31
|
-
e.isDrawerOpen && e.close();
|
|
32
|
-
}, handleSaveAndContinue: async () => {
|
|
33
|
-
if (!o.value) {
|
|
34
|
-
o.value = !0, n.loadingStatus = !0;
|
|
35
|
-
try {
|
|
36
|
-
await i() ? e.close() : n.loadingStatus = !1;
|
|
37
|
-
} catch (t) {
|
|
38
|
-
console.warn("Soft-save failed; keeping the drawer open.", t), n.loadingStatus = !1;
|
|
39
|
-
} finally {
|
|
40
|
-
o.value = !1;
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
}, WpDrawer: f, InIcons: h };
|
|
44
|
-
}
|
|
45
|
-
});
|
|
46
|
-
export {
|
|
47
|
-
O as default
|
|
48
|
-
};
|