@useinsider/guido 3.18.2-beta.eedafd2 → 3.18.2-beta.f42547e
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 +0 -1
- package/dist/@types/config/schemas.js +26 -28
- package/dist/components/Guido.vue.js +6 -6
- package/dist/components/Guido.vue2.js +70 -72
- package/dist/components/organisms/AutoSaveController.vue2.js +8 -9
- 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/header/EditorActions.vue.js +2 -2
- package/dist/components/organisms/header/EditorActions.vue2.js +56 -86
- package/dist/components/organisms/header/LeftSlot.vue.js +5 -5
- package/dist/components/organisms/header/LeftSlot.vue2.js +12 -16
- 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/wrappers/WpDrawer.vue.js +7 -9
- package/dist/components/wrappers/WpDrawer.vue2.js +1 -1
- package/dist/composables/useCustomInterfaceAppearance.js +56 -46
- package/dist/composables/useHtmlCompiler.js +26 -37
- package/dist/composables/useHtmlValidator.js +84 -81
- package/dist/composables/useRecommendation.js +40 -35
- package/dist/composables/useSave.js +45 -90
- package/dist/composables/useStripo.js +30 -30
- package/dist/composables/validators/useCouponBlockValidator.js +21 -24
- package/dist/composables/validators/useUnsubscribeBlockValidator.js +27 -34
- 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 +181 -89
- 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/src/@types/config/schemas.d.ts +0 -4
- package/dist/src/components/Guido.vue.d.ts +1 -17
- 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 +0 -2
- package/dist/src/composables/useHtmlValidator.d.ts +0 -21
- 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/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 +73 -3
- 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/config.d.ts +0 -30
- package/dist/src/stores/onboarding.d.ts +377 -0
- package/dist/src/utils/templatePreparation.d.ts +0 -30
- package/dist/static/styles/components/recommendation-strategy.css.js +34 -4
- package/dist/static/styles/components/skeleton.css.js +23 -0
- package/dist/stores/config.js +22 -39
- package/dist/stores/onboarding.js +41 -36
- package/dist/utils/genericUtil.js +61 -64
- package/dist/utils/templatePreparation.js +49 -52
- package/package.json +1 -1
- 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/src/utils/liquidDynamicContent.d.ts +0 -20
- package/dist/stores/save-validation.js +0 -30
- package/dist/utils/liquidDynamicContent.js +0 -15
- /package/dist/src/components/organisms/{validation/ValidationErrorDrawer.vue.d.ts → onboarding/RecommendationStrategyOnboarding.vue.d.ts} +0 -0
|
@@ -49,11 +49,8 @@ const n = `.strategy-control-header {
|
|
|
49
49
|
white-space: nowrap;
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
-
.strategy-control-cta.primary > .button
|
|
53
|
-
.strategy-control-cta.primary > .button.disabled {
|
|
54
|
-
opacity: 1;
|
|
52
|
+
.strategy-control-cta.primary > .button {
|
|
55
53
|
color: var(--guido-color-gray-800);
|
|
56
|
-
cursor: default;
|
|
57
54
|
}
|
|
58
55
|
|
|
59
56
|
.strategy-control-name-band {
|
|
@@ -71,6 +68,39 @@ const n = `.strategy-control-header {
|
|
|
71
68
|
line-height: 24px;
|
|
72
69
|
}
|
|
73
70
|
|
|
71
|
+
/* Each skeleton mirrors the footprint of the element it stands in for, so retiring
|
|
72
|
+
the loading state does not shift the panel. */
|
|
73
|
+
.guido-skeleton--strategy-title {
|
|
74
|
+
width: 366px;
|
|
75
|
+
height: 38px;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.guido-skeleton--strategy-description {
|
|
79
|
+
width: 366px;
|
|
80
|
+
height: 48px;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.guido-skeleton--strategy-cta {
|
|
84
|
+
width: 175px;
|
|
85
|
+
height: 40px;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.guido-skeleton--strategy-name {
|
|
89
|
+
width: 398px;
|
|
90
|
+
height: 48px;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.strategy-control-skeleton-row {
|
|
94
|
+
display: flex;
|
|
95
|
+
gap: 16px;
|
|
96
|
+
padding: 0 16px 16px;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
[data-strategy-loading-state] .guido-skeleton {
|
|
100
|
+
display: block;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
|
|
74
104
|
.strategy-control-actions {
|
|
75
105
|
display: flex;
|
|
76
106
|
align-items: center;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
const e = `/*
|
|
2
|
+
* Mirrors the design system's InSkeleton 1:1 (gradient stops, 200% size, 1.6s linear).
|
|
3
|
+
* The Stripo panel lives in the editor's shadow root and is built from raw HTML strings,
|
|
4
|
+
* so the Vue component cannot be used there. Hex values are literal in the DS too.
|
|
5
|
+
*
|
|
6
|
+
* Base only: each panel sizes its own \`.guido-skeleton--*\` modifier to the footprint of
|
|
7
|
+
* the element it stands in for.
|
|
8
|
+
*/
|
|
9
|
+
.guido-skeleton {
|
|
10
|
+
display: none;
|
|
11
|
+
border-radius: 4px;
|
|
12
|
+
background: linear-gradient(90deg, #f0f0f0 39.5%, #e1e1e1 66.02%, #f0f0f0 89.42%);
|
|
13
|
+
background-size: 200% 100%;
|
|
14
|
+
animation: guido-skeleton-shine 1.6s linear infinite;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
@keyframes guido-skeleton-shine {
|
|
18
|
+
to { background-position-x: -200%; }
|
|
19
|
+
}
|
|
20
|
+
`;
|
|
21
|
+
export {
|
|
22
|
+
e as default
|
|
23
|
+
};
|
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
3
|
import { parseConfig as o } from "../@types/config/validator.js";
|
|
4
|
-
import { defineStore as
|
|
5
|
-
const
|
|
4
|
+
import { defineStore as r } from "pinia";
|
|
5
|
+
const f = r("guido-config", {
|
|
6
6
|
state: () => ({
|
|
7
7
|
initialized: !1,
|
|
8
8
|
config: null
|
|
@@ -75,74 +75,57 @@ const u = a("guido-config", {
|
|
|
75
75
|
* Get the template ID
|
|
76
76
|
*/
|
|
77
77
|
templateId: (i) => {
|
|
78
|
-
var e,
|
|
79
|
-
return ((
|
|
78
|
+
var e, n;
|
|
79
|
+
return ((n = (e = i.config) == null ? void 0 : e.identity) == null ? void 0 : n.templateId) ?? "";
|
|
80
80
|
},
|
|
81
81
|
/**
|
|
82
82
|
* Get the user ID
|
|
83
83
|
*/
|
|
84
84
|
userId: (i) => {
|
|
85
|
-
var e,
|
|
86
|
-
return ((
|
|
85
|
+
var e, n;
|
|
86
|
+
return ((n = (e = i.config) == null ? void 0 : e.identity) == null ? void 0 : n.userId) ?? "";
|
|
87
87
|
},
|
|
88
88
|
/**
|
|
89
89
|
* Get the variation ID
|
|
90
90
|
*/
|
|
91
91
|
variationId: (i) => {
|
|
92
|
-
var e,
|
|
93
|
-
return ((
|
|
92
|
+
var e, n;
|
|
93
|
+
return ((n = (e = i.config) == null ? void 0 : e.identity) == null ? void 0 : n.variationId) ?? "";
|
|
94
94
|
},
|
|
95
95
|
/**
|
|
96
96
|
* Get the partner name
|
|
97
97
|
*/
|
|
98
98
|
partnerName: (i) => {
|
|
99
|
-
var e,
|
|
100
|
-
return ((
|
|
99
|
+
var e, n;
|
|
100
|
+
return ((n = (e = i.config) == null ? void 0 : e.partner) == null ? void 0 : n.name) ?? "";
|
|
101
101
|
},
|
|
102
102
|
/**
|
|
103
103
|
* Get the product type
|
|
104
104
|
*/
|
|
105
105
|
productType: (i) => {
|
|
106
|
-
var e,
|
|
107
|
-
return ((
|
|
106
|
+
var e, n;
|
|
107
|
+
return ((n = (e = i.config) == null ? void 0 : e.partner) == null ? void 0 : n.productType) ?? 60;
|
|
108
108
|
},
|
|
109
109
|
/**
|
|
110
110
|
* Get the message type
|
|
111
111
|
*/
|
|
112
112
|
messageType: (i) => {
|
|
113
|
-
var e,
|
|
114
|
-
return ((
|
|
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 === r.TRANSACTIONAL;
|
|
122
|
-
},
|
|
123
|
-
/**
|
|
124
|
-
* Soft-save policy: may the editor persist a template with validation errors?
|
|
125
|
-
* Default true (host sets features.allowSaveWithErrors=false for transactional +
|
|
126
|
-
* unsub). Reactive getter defaulting true — reading via isFeatureEnabled would
|
|
127
|
-
* floor to false pre-init and momentarily hide the soft-save option (SD-147430).
|
|
128
|
-
*/
|
|
129
|
-
allowSaveWithErrors() {
|
|
130
|
-
var i;
|
|
131
|
-
return ((i = this.features) == null ? void 0 : i.allowSaveWithErrors) ?? !0;
|
|
113
|
+
var e, n;
|
|
114
|
+
return ((n = (e = i.config) == null ? void 0 : e.partner) == null ? void 0 : n.messageType) ?? 1;
|
|
132
115
|
},
|
|
133
116
|
/**
|
|
134
117
|
* Get the username
|
|
135
118
|
*/
|
|
136
119
|
username: (i) => {
|
|
137
|
-
var e,
|
|
138
|
-
return ((
|
|
120
|
+
var e, n;
|
|
121
|
+
return ((n = (e = i.config) == null ? void 0 : e.partner) == null ? void 0 : n.username) ?? "Guido User";
|
|
139
122
|
},
|
|
140
123
|
/**
|
|
141
124
|
* Check if header should be shown
|
|
142
125
|
*/
|
|
143
126
|
showHeader: (i) => {
|
|
144
|
-
var e,
|
|
145
|
-
return ((
|
|
127
|
+
var e, n;
|
|
128
|
+
return ((n = (e = i.config) == null ? void 0 : e.ui) == null ? void 0 : n.showHeader) ?? !0;
|
|
146
129
|
},
|
|
147
130
|
/**
|
|
148
131
|
* Check if a specific feature is enabled.
|
|
@@ -151,8 +134,8 @@ const u = a("guido-config", {
|
|
|
151
134
|
*/
|
|
152
135
|
// eslint-disable-next-line @stylistic/max-len
|
|
153
136
|
isFeatureEnabled: (i) => (e) => {
|
|
154
|
-
var
|
|
155
|
-
return ((
|
|
137
|
+
var n, t;
|
|
138
|
+
return ((t = (n = i.config) == null ? void 0 : n.features) == null ? void 0 : t[e]) ?? !1;
|
|
156
139
|
}
|
|
157
140
|
},
|
|
158
141
|
actions: {
|
|
@@ -172,5 +155,5 @@ const u = a("guido-config", {
|
|
|
172
155
|
}
|
|
173
156
|
});
|
|
174
157
|
export {
|
|
175
|
-
|
|
158
|
+
f as useConfigStore
|
|
176
159
|
};
|
|
@@ -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,75 @@
|
|
|
1
|
-
|
|
2
|
-
const
|
|
3
|
-
|
|
4
|
-
|
|
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 = {
|
|
14
|
-
text: t.label,
|
|
15
|
-
value: l || ""
|
|
1
|
+
const o = (a) => {
|
|
2
|
+
const t = a.value.match(/\{\{([^}]+)\}\}/)[1].split("|").map((e) => e.trim()), [s] = t, r = {
|
|
3
|
+
text: a.label,
|
|
4
|
+
value: s || ""
|
|
16
5
|
};
|
|
17
|
-
if (
|
|
18
|
-
const [,
|
|
19
|
-
if (
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
6
|
+
if (t.length >= 2) {
|
|
7
|
+
const [, e, l] = t;
|
|
8
|
+
if (e.startsWith("default:")) {
|
|
9
|
+
let n = e.slice(8).trim();
|
|
10
|
+
n.startsWith('"') && n.endsWith('"') && (n = n.slice(1, -1)), r.fallback = n;
|
|
11
|
+
} else {
|
|
12
|
+
const n = e.includes("=") ? { key: e.split("=")[0].trim(), value: e.split("=")[1].trim() } : null;
|
|
13
|
+
n ? r.format = n : l || (r.fallback = e), l && (r.fallback = l);
|
|
24
14
|
}
|
|
25
15
|
}
|
|
26
|
-
return
|
|
27
|
-
},
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
16
|
+
return r;
|
|
17
|
+
}, u = (a, c = !1) => a.map((t) => {
|
|
18
|
+
if (t.format)
|
|
19
|
+
return {
|
|
20
|
+
label: `${t.text} | ${t.format.key}=${t.format.value}`,
|
|
21
|
+
value: `{{${t.value}|${t.format.key}=${t.format.value}}}`
|
|
22
|
+
};
|
|
23
|
+
if (c) {
|
|
24
|
+
if (!t.fallback)
|
|
25
|
+
return {
|
|
26
|
+
label: t.text,
|
|
27
|
+
value: `{{ ${t.value} }}`
|
|
28
|
+
};
|
|
29
|
+
const r = !Number.isNaN(Number(t.fallback)) && t.fallback.trim() !== "" ? t.fallback : `"${t.fallback}"`;
|
|
30
|
+
return {
|
|
31
|
+
label: `${t.text} | ${t.fallback}`,
|
|
32
|
+
value: `{{ ${t.value} | default: ${r} }}`
|
|
33
|
+
};
|
|
34
|
+
}
|
|
32
35
|
return {
|
|
33
|
-
label:
|
|
34
|
-
value: `{{
|
|
36
|
+
label: t.fallback ? `${t.text} | ${t.fallback}` : t.text,
|
|
37
|
+
value: t.fallback ? `{{${t.value}|${t.fallback}}}` : `{{${t.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 = (a) => {
|
|
40
|
+
const c = [], t = /* @__PURE__ */ new Set(), s = (e) => {
|
|
41
|
+
Array.isArray(e) && e.forEach((l) => {
|
|
42
|
+
const n = [...l.children ?? [], ...l.select_items ?? []];
|
|
43
|
+
if (n.length > 0) {
|
|
44
|
+
s(n);
|
|
48
45
|
return;
|
|
49
46
|
}
|
|
50
|
-
const
|
|
51
|
-
|
|
47
|
+
const f = l.text || l.tag_text;
|
|
48
|
+
f && l.value && !t.has(l.value) && (t.add(l.value), c.push({ text: f, value: l.value }));
|
|
52
49
|
});
|
|
53
|
-
}, [
|
|
54
|
-
return
|
|
55
|
-
},
|
|
56
|
-
const
|
|
50
|
+
}, [r] = Object.values(a ?? {});
|
|
51
|
+
return s(r), c;
|
|
52
|
+
}, i = (a, c, t = !1) => {
|
|
53
|
+
const s = new Set(a.map((e) => e.value)), r = c.filter((e) => s.has(e.value) ? !1 : (s.add(e.value), !0));
|
|
57
54
|
return [
|
|
58
|
-
...
|
|
59
|
-
...
|
|
55
|
+
...u(a, t),
|
|
56
|
+
...u(r, t)
|
|
60
57
|
];
|
|
61
|
-
},
|
|
62
|
-
var
|
|
63
|
-
return ((
|
|
64
|
-
},
|
|
65
|
-
if (
|
|
58
|
+
}, k = () => {
|
|
59
|
+
var a;
|
|
60
|
+
return ((a = document.head.querySelector('meta[name="csrf-token"]')) == null ? void 0 : a.getAttribute("content")) ?? "";
|
|
61
|
+
}, v = (a) => typeof a == "string" ? a : typeof a == "number" ? String(a) : "", y = (a) => {
|
|
62
|
+
if (a === null || typeof a != "object" || Array.isArray(a))
|
|
66
63
|
return !1;
|
|
67
|
-
const
|
|
68
|
-
return
|
|
64
|
+
const c = Object.getPrototypeOf(a);
|
|
65
|
+
return c === Object.prototype || c === null;
|
|
69
66
|
};
|
|
70
67
|
export {
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
68
|
+
v as asText,
|
|
69
|
+
i as buildMergeTagEntries,
|
|
70
|
+
u as dynamicContentToMergeTags,
|
|
71
|
+
b as flattenDynamicContentList,
|
|
72
|
+
k as getCsrfToken,
|
|
73
|
+
y as isPlainObject,
|
|
74
|
+
o as mergeTagToDynamicContent
|
|
78
75
|
};
|
|
@@ -1,32 +1,32 @@
|
|
|
1
1
|
import { useActionsApi as R } 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";
|
|
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 n } from "../extensions/Blocks/Recommendation/constants/defaultConfig.js";
|
|
5
5
|
import { useRecommendationExtensionStore as I } from "../extensions/Blocks/Recommendation/store/recommendation.js";
|
|
6
|
-
import { mapLegacyStrategy as
|
|
7
|
-
import { DATA_ATTRIBUTES as
|
|
8
|
-
import { parsePageList as
|
|
6
|
+
import { mapLegacyStrategy as x } from "../extensions/Blocks/Recommendation/utils/legacyStrategyMap.js";
|
|
7
|
+
import { DATA_ATTRIBUTES as A } from "../extensions/Blocks/Unsubscribe/utils/constants.js";
|
|
8
|
+
import { parsePageList as L } from "../extensions/Blocks/Unsubscribe/utils/utils.js";
|
|
9
9
|
import { useDynamicContentStore as z } from "../stores/dynamic-content.js";
|
|
10
10
|
import { useEditorStore as O } from "../stores/editor.js";
|
|
11
11
|
import { useUnsubscribeStore as _ } from "../stores/unsubscribe.js";
|
|
12
12
|
import { isPlainObject as v } from "./genericUtil.js";
|
|
13
|
-
import { assignTrackingIds as
|
|
14
|
-
function
|
|
15
|
-
const i = new DOMParser().parseFromString(l, "text/html").querySelectorAll(`[${
|
|
16
|
-
return i.forEach((
|
|
17
|
-
const
|
|
18
|
-
|
|
13
|
+
import { assignTrackingIds as B } from "./linkTrackingIds.js";
|
|
14
|
+
function G(l) {
|
|
15
|
+
const i = new DOMParser().parseFromString(l, "text/html").querySelectorAll(`[${A.PAGE_LIST}]`), t = [];
|
|
16
|
+
return i.forEach((s) => {
|
|
17
|
+
const r = s.getAttribute(A.PAGE_LIST);
|
|
18
|
+
r && t.push(...L(r));
|
|
19
19
|
}), [...new Set(t)];
|
|
20
20
|
}
|
|
21
|
-
async function
|
|
21
|
+
async function M(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
25
|
const i = I();
|
|
26
26
|
a.forEach((t) => {
|
|
27
|
-
var
|
|
28
|
-
const
|
|
29
|
-
if (!Number.isFinite(
|
|
27
|
+
var d, g, f, c, y, S;
|
|
28
|
+
const s = t.getAttribute("recommendation-id"), r = s ? Number(s) : NaN;
|
|
29
|
+
if (!Number.isFinite(r))
|
|
30
30
|
return;
|
|
31
31
|
const p = t.getAttribute("esd-ext-config");
|
|
32
32
|
if (!p)
|
|
@@ -39,11 +39,11 @@ async function A(l) {
|
|
|
39
39
|
}
|
|
40
40
|
if (!v(e))
|
|
41
41
|
return;
|
|
42
|
-
const
|
|
42
|
+
const C = !!e.strategyId || (e.configVersion ?? 0) >= U, 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:
|
|
46
|
+
strategy: x(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 A(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: ((c = e.currency) == null ? void 0 : c.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,54 +70,51 @@ async function A(l) {
|
|
|
70
70
|
);
|
|
71
71
|
}
|
|
72
72
|
}
|
|
73
|
-
const
|
|
74
|
-
const l = z(), u = O(), a = _(), { getCompiledEmail: i, getTemplateData: t, updateHtmlAndCss:
|
|
73
|
+
const re = () => {
|
|
74
|
+
const l = z(), u = O(), a = _(), { getCompiledEmail: i, getTemplateData: t, updateHtmlAndCss: s } = R(), { compileHtml: r, compileAmpHtml: p } = N(), { isFeatureEnabled: e } = k();
|
|
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 =
|
|
82
|
-
} catch (
|
|
83
|
-
console.error("Tracking-id step failed, saving anyway:",
|
|
80
|
+
const { html: b, changed: F, nextSeq: H } = B(o, u.trackIdSessionFloor);
|
|
81
|
+
u.trackIdSessionFloor = H, F && (o = b, await s(b, d));
|
|
82
|
+
} catch (b) {
|
|
83
|
+
console.error("Tracking-id step failed, saving anyway:", b);
|
|
84
84
|
}
|
|
85
|
-
const { html: f, ampHtml:
|
|
85
|
+
const { html: f, ampHtml: c = "", 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 M(o);
|
|
90
|
+
const { compiledHtml: S, stats: h, appliedRules: w } = r(f), D = c && p(c).compiledHtml, E = l.getSelectedDynamicContentList, P = I(), T = G(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: w,
|
|
96
|
+
executionTime: `${h.executionTime.toFixed(2)}ms`
|
|
97
97
|
}), {
|
|
98
98
|
dynamicContentList: E,
|
|
99
|
-
compiledHtml:
|
|
100
|
-
rawHtml:
|
|
99
|
+
compiledHtml: S,
|
|
100
|
+
rawHtml: o,
|
|
101
101
|
css: d,
|
|
102
|
-
ampHtml:
|
|
102
|
+
ampHtml: D,
|
|
103
103
|
ampErrors: y,
|
|
104
104
|
modules: g.map(Number),
|
|
105
105
|
recommendation: {
|
|
106
|
-
campaignUrls:
|
|
106
|
+
campaignUrls: P.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
|
-
}
|
|
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: A
|
|
114
|
+
}
|
|
118
115
|
};
|
|
119
116
|
};
|
|
120
117
|
export {
|
|
121
|
-
|
|
122
|
-
|
|
118
|
+
G as getHtmlReferencedUnsubscribePages,
|
|
119
|
+
re as useTemplatePreparation
|
|
123
120
|
};
|
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.f42547e",
|
|
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",
|