@useinsider/guido 3.18.2-beta.45f708c → 3.18.2-beta.4d2b065
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 +21 -3
- package/dist/@types/config/schemas.js +59 -51
- package/dist/components/Guido.vue.js +4 -4
- package/dist/components/Guido.vue2.js +72 -70
- package/dist/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue.js +7 -9
- package/dist/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue2.js +51 -66
- 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 +40 -24
- package/dist/components/organisms/onboarding/OnboardingWrapper.vue2.js +28 -26
- 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 +3 -3
- package/dist/components/organisms/onboarding/RecommendationStrategyOnboarding.vue2.js +20 -21
- package/dist/composables/useCustomInterfaceAppearance.js +47 -53
- package/dist/composables/useHtmlValidator.js +79 -84
- package/dist/composables/useLegacyStrategyConversion.js +61 -0
- package/dist/composables/useRecommendation.js +35 -40
- package/dist/composables/useStripo.js +30 -30
- package/dist/enums/extensions/recommendationBlock.js +41 -39
- package/dist/extensions/Blocks/Recommendation/block.js +39 -43
- package/dist/extensions/Blocks/Recommendation/constants/defaultConfig.js +20 -21
- package/dist/extensions/Blocks/Recommendation/controls/main/index.js +80 -84
- package/dist/extensions/Blocks/Recommendation/controls/main/strategy.js +94 -82
- package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +97 -96
- package/dist/extensions/Blocks/Recommendation/store/recommendation.js +144 -179
- package/dist/extensions/Blocks/Recommendation/utils/legacyStrategyMigration.js +42 -0
- package/dist/extensions/Blocks/Recommendation/utils/nodeConfigWriter.js +16 -26
- package/dist/extensions/Blocks/Recommendation/validation/requiredFields.js +12 -21
- package/dist/guido.css +1 -1
- package/dist/services/recommendationApi.js +46 -37
- package/dist/src/@types/config/schemas.d.ts +16 -0
- package/dist/src/components/organisms/extensions/recommendation/LegacyStrategyUpdatedModal.vue.d.ts +2 -0
- package/dist/src/components/organisms/onboarding/RecommendationLegacyStrategyOnboarding.vue.d.ts +2 -0
- package/dist/src/composables/useConfig.d.ts +4 -0
- package/dist/src/composables/useLegacyStrategyConversion.d.ts +3 -0
- package/dist/src/enums/extensions/recommendationBlock.d.ts +5 -3
- package/dist/src/extensions/Blocks/Recommendation/constants/defaultConfig.d.ts +0 -1
- package/dist/src/extensions/Blocks/Recommendation/constants/index.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +0 -2
- package/dist/src/extensions/Blocks/Recommendation/controls/main/strategy.d.ts +1 -8
- package/dist/src/extensions/Blocks/Recommendation/controls/main/utils.d.ts +6 -7
- package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +70 -76
- package/dist/src/extensions/Blocks/Recommendation/utils/legacyStrategyMigration.d.ts +32 -0
- package/dist/src/extensions/Blocks/Recommendation/validation/requiredFields.d.ts +0 -4
- package/dist/src/services/recommendationApi.d.ts +2 -1
- package/dist/src/stores/config.d.ts +322 -0
- package/dist/src/stores/onboarding.d.ts +421 -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 +74 -39
- package/dist/stores/config.js +74 -60
- package/dist/stores/onboarding.js +6 -1
- package/dist/utils/templatePreparation.js +55 -55
- package/package.json +5 -5
- package/dist/extensions/Blocks/Recommendation/utils/strategyCommit.js +0 -24
- package/dist/src/extensions/Blocks/Recommendation/utils/strategyCommit.d.ts +0 -14
- package/dist/static/styles/components/skeleton.css.js +0 -23
|
@@ -26,6 +26,40 @@ const n = `.strategy-control-header {
|
|
|
26
26
|
text-decoration: underline;
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
+
.strategy-control-notice-row {
|
|
30
|
+
padding: 0 16px 16px;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.strategy-control-notice {
|
|
34
|
+
display: flex;
|
|
35
|
+
gap: 8px;
|
|
36
|
+
align-items: center;
|
|
37
|
+
padding: 12px;
|
|
38
|
+
border: 1px solid var(--guido-color-border-onpage-message-info);
|
|
39
|
+
border-radius: 4px;
|
|
40
|
+
background-color: var(--guido-color-background-onpage-message-info);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.strategy-control-notice::before {
|
|
44
|
+
content: '';
|
|
45
|
+
flex: none;
|
|
46
|
+
width: 24px;
|
|
47
|
+
height: 24px;
|
|
48
|
+
background-color: var(--guido-color-border-onpage-message-info);
|
|
49
|
+
mask-image: var(--guido-icon-line-info);
|
|
50
|
+
mask-repeat: no-repeat;
|
|
51
|
+
mask-position: center;
|
|
52
|
+
mask-size: 24px 24px;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.strategy-control-notice-text {
|
|
56
|
+
margin: 0;
|
|
57
|
+
padding: 4px 0;
|
|
58
|
+
color: var(--guido-color-neutral-700);
|
|
59
|
+
font-size: 13px;
|
|
60
|
+
line-height: 16px;
|
|
61
|
+
}
|
|
62
|
+
|
|
29
63
|
.recommendation-controls-container .container.strategy-control-cta-row {
|
|
30
64
|
grid-template-columns: repeat(2, minmax(0, 180px));
|
|
31
65
|
justify-content: start;
|
|
@@ -49,8 +83,11 @@ const n = `.strategy-control-header {
|
|
|
49
83
|
white-space: nowrap;
|
|
50
84
|
}
|
|
51
85
|
|
|
52
|
-
.strategy-control-cta.primary > .button
|
|
86
|
+
.strategy-control-cta.primary > .button:disabled,
|
|
87
|
+
.strategy-control-cta.primary > .button.disabled {
|
|
88
|
+
opacity: 1;
|
|
53
89
|
color: var(--guido-color-gray-800);
|
|
90
|
+
cursor: default;
|
|
54
91
|
}
|
|
55
92
|
|
|
56
93
|
.strategy-control-name-band {
|
|
@@ -61,6 +98,14 @@ const n = `.strategy-control-header {
|
|
|
61
98
|
background-color: var(--guido-color-gray-0);
|
|
62
99
|
}
|
|
63
100
|
|
|
101
|
+
/* Figma gives the legacy band a 59px row: 17.5px above and below its 24px content. */
|
|
102
|
+
[data-strategy-legacy-state] .strategy-control-name-band {
|
|
103
|
+
gap: 8px;
|
|
104
|
+
justify-content: space-between;
|
|
105
|
+
min-height: auto;
|
|
106
|
+
padding: 17.5px 16px;
|
|
107
|
+
}
|
|
108
|
+
|
|
64
109
|
.strategy-control-name {
|
|
65
110
|
color: var(--guido-color-gray-800);
|
|
66
111
|
font-size: 15px;
|
|
@@ -68,39 +113,6 @@ const n = `.strategy-control-header {
|
|
|
68
113
|
line-height: 24px;
|
|
69
114
|
}
|
|
70
115
|
|
|
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
|
-
|
|
104
116
|
.strategy-control-actions {
|
|
105
117
|
display: flex;
|
|
106
118
|
align-items: center;
|
|
@@ -147,6 +159,15 @@ const n = `.strategy-control-header {
|
|
|
147
159
|
mask-image: var(--guido-icon-line-plus);
|
|
148
160
|
}
|
|
149
161
|
|
|
162
|
+
.strategy-control-action--update::before {
|
|
163
|
+
mask-image: var(--guido-icon-filled-arrow-rising);
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
.strategy-control-name-band .strategy-control-action > span {
|
|
167
|
+
padding: 0 0 0 8px;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
.strategy-control-action--update,
|
|
150
171
|
.strategy-control-action--change {
|
|
151
172
|
color: var(--guido-color-primary-500);
|
|
152
173
|
}
|
|
@@ -159,24 +180,38 @@ const n = `.strategy-control-header {
|
|
|
159
180
|
text-decoration: underline;
|
|
160
181
|
}
|
|
161
182
|
|
|
162
|
-
.
|
|
183
|
+
.strategy-control-action:disabled,
|
|
184
|
+
.strategy-control-action:disabled:hover {
|
|
185
|
+
color: var(--guido-color-gray-700);
|
|
186
|
+
text-decoration: none;
|
|
187
|
+
cursor: default;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
.recommendation-controls-container:not(.strategy-block):not(.legacy-strategy-block) .strategy-control-container,
|
|
163
191
|
.recommendation-controls-container.strategy-block .product-count-control-container,
|
|
164
192
|
.recommendation-controls-container.strategy-block .algorithm-control-container,
|
|
165
193
|
.recommendation-controls-container.strategy-block .filters-control-container,
|
|
166
|
-
.recommendation-controls-container.strategy-block .shuffle-control-container
|
|
194
|
+
.recommendation-controls-container.strategy-block .shuffle-control-container,
|
|
195
|
+
.recommendation-controls-container.legacy-strategy-block .product-count-control-container,
|
|
196
|
+
.recommendation-controls-container.legacy-strategy-block .algorithm-control-container,
|
|
197
|
+
.recommendation-controls-container.legacy-strategy-block .filters-control-container,
|
|
198
|
+
.recommendation-controls-container.legacy-strategy-block .shuffle-control-container {
|
|
167
199
|
display: none;
|
|
168
200
|
}
|
|
169
201
|
|
|
170
|
-
.recommendation-controls-container.strategy-block
|
|
202
|
+
.recommendation-controls-container.strategy-block,
|
|
203
|
+
.recommendation-controls-container.legacy-strategy-block {
|
|
171
204
|
display: flex;
|
|
172
205
|
flex-direction: column;
|
|
173
206
|
}
|
|
174
207
|
|
|
175
|
-
.recommendation-controls-container.strategy-block .price-placement-control-container
|
|
208
|
+
.recommendation-controls-container.strategy-block .price-placement-control-container,
|
|
209
|
+
.recommendation-controls-container.legacy-strategy-block .price-placement-control-container {
|
|
176
210
|
order: 1;
|
|
177
211
|
}
|
|
178
212
|
|
|
179
|
-
.recommendation-controls-container.strategy-block .product-layout-control-container
|
|
213
|
+
.recommendation-controls-container.strategy-block .product-layout-control-container,
|
|
214
|
+
.recommendation-controls-container.legacy-strategy-block .product-layout-control-container {
|
|
180
215
|
order: 2;
|
|
181
216
|
}
|
|
182
217
|
`;
|
package/dist/stores/config.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
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 a } from "pinia";
|
|
5
|
+
const s = a("guido-config", {
|
|
6
6
|
state: () => ({
|
|
7
7
|
initialized: !1,
|
|
8
8
|
config: null
|
|
@@ -11,121 +11,135 @@ const f = r("guido-config", {
|
|
|
11
11
|
/**
|
|
12
12
|
* Get the identity configuration
|
|
13
13
|
*/
|
|
14
|
-
identity: (
|
|
15
|
-
var
|
|
16
|
-
return ((
|
|
14
|
+
identity: (e) => {
|
|
15
|
+
var i;
|
|
16
|
+
return ((i = e.config) == null ? void 0 : i.identity) ?? null;
|
|
17
17
|
},
|
|
18
18
|
/**
|
|
19
19
|
* Get the partner configuration
|
|
20
20
|
*/
|
|
21
|
-
partner: (
|
|
22
|
-
var
|
|
23
|
-
return ((
|
|
21
|
+
partner: (e) => {
|
|
22
|
+
var i;
|
|
23
|
+
return ((i = e.config) == null ? void 0 : i.partner) ?? null;
|
|
24
24
|
},
|
|
25
25
|
/**
|
|
26
26
|
* Get the template configuration
|
|
27
27
|
*/
|
|
28
|
-
template: (
|
|
29
|
-
var
|
|
30
|
-
return ((
|
|
28
|
+
template: (e) => {
|
|
29
|
+
var i;
|
|
30
|
+
return ((i = e.config) == null ? void 0 : i.template) ?? null;
|
|
31
31
|
},
|
|
32
32
|
/**
|
|
33
33
|
* Get the editor configuration
|
|
34
34
|
*/
|
|
35
|
-
editor: (
|
|
36
|
-
var
|
|
37
|
-
return ((
|
|
35
|
+
editor: (e) => {
|
|
36
|
+
var i;
|
|
37
|
+
return ((i = e.config) == null ? void 0 : i.editor) ?? null;
|
|
38
38
|
},
|
|
39
39
|
/**
|
|
40
40
|
* Get the UI configuration
|
|
41
41
|
*/
|
|
42
|
-
ui: (
|
|
43
|
-
var
|
|
44
|
-
return ((
|
|
42
|
+
ui: (e) => {
|
|
43
|
+
var i;
|
|
44
|
+
return ((i = e.config) == null ? void 0 : i.ui) ?? null;
|
|
45
45
|
},
|
|
46
46
|
/**
|
|
47
47
|
* Get the features configuration
|
|
48
48
|
*/
|
|
49
|
-
features: (
|
|
50
|
-
var
|
|
51
|
-
return ((
|
|
49
|
+
features: (e) => {
|
|
50
|
+
var i;
|
|
51
|
+
return ((i = e.config) == null ? void 0 : i.features) ?? null;
|
|
52
52
|
},
|
|
53
53
|
/**
|
|
54
54
|
* Get the blocks configuration
|
|
55
55
|
*/
|
|
56
|
-
blocks: (
|
|
57
|
-
var
|
|
58
|
-
return ((
|
|
56
|
+
blocks: (e) => {
|
|
57
|
+
var i;
|
|
58
|
+
return ((i = e.config) == null ? void 0 : i.blocks) ?? null;
|
|
59
59
|
},
|
|
60
60
|
/**
|
|
61
61
|
* Get the compiler configuration
|
|
62
62
|
*/
|
|
63
|
-
compiler: (
|
|
64
|
-
var
|
|
65
|
-
return ((
|
|
63
|
+
compiler: (e) => {
|
|
64
|
+
var i;
|
|
65
|
+
return ((i = e.config) == null ? void 0 : i.compiler) ?? null;
|
|
66
66
|
},
|
|
67
67
|
/**
|
|
68
68
|
* Get the callbacks configuration
|
|
69
69
|
*/
|
|
70
|
-
callbacks: (
|
|
71
|
-
var
|
|
72
|
-
return ((
|
|
70
|
+
callbacks: (e) => {
|
|
71
|
+
var i;
|
|
72
|
+
return ((i = e.config) == null ? void 0 : i.callbacks) ?? null;
|
|
73
73
|
},
|
|
74
74
|
/**
|
|
75
75
|
* Get the template ID
|
|
76
76
|
*/
|
|
77
|
-
templateId: (
|
|
78
|
-
var
|
|
79
|
-
return ((
|
|
77
|
+
templateId: (e) => {
|
|
78
|
+
var i, t;
|
|
79
|
+
return ((t = (i = e.config) == null ? void 0 : i.identity) == null ? void 0 : t.templateId) ?? "";
|
|
80
80
|
},
|
|
81
81
|
/**
|
|
82
82
|
* Get the user ID
|
|
83
83
|
*/
|
|
84
|
-
userId: (
|
|
85
|
-
var
|
|
86
|
-
return ((
|
|
84
|
+
userId: (e) => {
|
|
85
|
+
var i, t;
|
|
86
|
+
return ((t = (i = e.config) == null ? void 0 : i.identity) == null ? void 0 : t.userId) ?? "";
|
|
87
87
|
},
|
|
88
88
|
/**
|
|
89
89
|
* Get the variation ID
|
|
90
90
|
*/
|
|
91
|
-
variationId: (
|
|
92
|
-
var
|
|
93
|
-
return ((
|
|
91
|
+
variationId: (e) => {
|
|
92
|
+
var i, t;
|
|
93
|
+
return ((t = (i = e.config) == null ? void 0 : i.identity) == null ? void 0 : t.variationId) ?? "";
|
|
94
|
+
},
|
|
95
|
+
/**
|
|
96
|
+
* Get the campaign ID
|
|
97
|
+
*/
|
|
98
|
+
campaignId: (e) => {
|
|
99
|
+
var i, t;
|
|
100
|
+
return ((t = (i = e.config) == null ? void 0 : i.identity) == null ? void 0 : t.campaignId) ?? "";
|
|
101
|
+
},
|
|
102
|
+
/**
|
|
103
|
+
* Get the template-library ID of the host template
|
|
104
|
+
*/
|
|
105
|
+
templateLibraryId: (e) => {
|
|
106
|
+
var i, t;
|
|
107
|
+
return ((t = (i = e.config) == null ? void 0 : i.identity) == null ? void 0 : t.templateLibraryId) ?? "";
|
|
94
108
|
},
|
|
95
109
|
/**
|
|
96
110
|
* Get the partner name
|
|
97
111
|
*/
|
|
98
|
-
partnerName: (
|
|
99
|
-
var
|
|
100
|
-
return ((
|
|
112
|
+
partnerName: (e) => {
|
|
113
|
+
var i, t;
|
|
114
|
+
return ((t = (i = e.config) == null ? void 0 : i.partner) == null ? void 0 : t.name) ?? "";
|
|
101
115
|
},
|
|
102
116
|
/**
|
|
103
117
|
* Get the product type
|
|
104
118
|
*/
|
|
105
|
-
productType: (
|
|
106
|
-
var
|
|
107
|
-
return ((
|
|
119
|
+
productType: (e) => {
|
|
120
|
+
var i, t;
|
|
121
|
+
return ((t = (i = e.config) == null ? void 0 : i.partner) == null ? void 0 : t.productType) ?? 60;
|
|
108
122
|
},
|
|
109
123
|
/**
|
|
110
124
|
* Get the message type
|
|
111
125
|
*/
|
|
112
|
-
messageType: (
|
|
113
|
-
var
|
|
114
|
-
return ((
|
|
126
|
+
messageType: (e) => {
|
|
127
|
+
var i, t;
|
|
128
|
+
return ((t = (i = e.config) == null ? void 0 : i.partner) == null ? void 0 : t.messageType) ?? 1;
|
|
115
129
|
},
|
|
116
130
|
/**
|
|
117
131
|
* Get the username
|
|
118
132
|
*/
|
|
119
|
-
username: (
|
|
120
|
-
var
|
|
121
|
-
return ((
|
|
133
|
+
username: (e) => {
|
|
134
|
+
var i, t;
|
|
135
|
+
return ((t = (i = e.config) == null ? void 0 : i.partner) == null ? void 0 : t.username) ?? "Guido User";
|
|
122
136
|
},
|
|
123
137
|
/**
|
|
124
138
|
* Check if header should be shown
|
|
125
139
|
*/
|
|
126
|
-
showHeader: (
|
|
127
|
-
var
|
|
128
|
-
return ((
|
|
140
|
+
showHeader: (e) => {
|
|
141
|
+
var i, t;
|
|
142
|
+
return ((t = (i = e.config) == null ? void 0 : i.ui) == null ? void 0 : t.showHeader) ?? !0;
|
|
129
143
|
},
|
|
130
144
|
/**
|
|
131
145
|
* Check if a specific feature is enabled.
|
|
@@ -133,18 +147,18 @@ const f = r("guido-config", {
|
|
|
133
147
|
* flash on during loading, then disappear once config resolves.
|
|
134
148
|
*/
|
|
135
149
|
// eslint-disable-next-line @stylistic/max-len
|
|
136
|
-
isFeatureEnabled: (
|
|
137
|
-
var
|
|
138
|
-
return ((
|
|
150
|
+
isFeatureEnabled: (e) => (i) => {
|
|
151
|
+
var t, n;
|
|
152
|
+
return ((n = (t = e.config) == null ? void 0 : t.features) == null ? void 0 : n[i]) ?? !1;
|
|
139
153
|
}
|
|
140
154
|
},
|
|
141
155
|
actions: {
|
|
142
156
|
/**
|
|
143
157
|
* Initialize the config store with validated configuration
|
|
144
158
|
*/
|
|
145
|
-
init(
|
|
146
|
-
const
|
|
147
|
-
this.config =
|
|
159
|
+
init(e) {
|
|
160
|
+
const i = o(e);
|
|
161
|
+
this.config = i, this.initialized = !0;
|
|
148
162
|
},
|
|
149
163
|
/**
|
|
150
164
|
* Reset the config store
|
|
@@ -155,5 +169,5 @@ const f = r("guido-config", {
|
|
|
155
169
|
}
|
|
156
170
|
});
|
|
157
171
|
export {
|
|
158
|
-
|
|
172
|
+
s as useConfigStore
|
|
159
173
|
};
|
|
@@ -12,7 +12,8 @@ const t = () => ({
|
|
|
12
12
|
versionHistoryOnboarding: t(),
|
|
13
13
|
ampOnboarding: t(),
|
|
14
14
|
itemsOnboarding: t(),
|
|
15
|
-
recommendationStrategyOnboarding: t()
|
|
15
|
+
recommendationStrategyOnboarding: t(),
|
|
16
|
+
recommendationLegacyStrategyOnboarding: t()
|
|
16
17
|
},
|
|
17
18
|
userModalState: {},
|
|
18
19
|
isFetched: !1
|
|
@@ -49,6 +50,10 @@ const t = () => ({
|
|
|
49
50
|
const { recommendationStrategyOnboarding: o } = n.onboardings;
|
|
50
51
|
return o.config[o.cardIndex];
|
|
51
52
|
},
|
|
53
|
+
getRecommendationLegacyStrategyCurrentCard: (n) => {
|
|
54
|
+
const { recommendationLegacyStrategyOnboarding: o } = n.onboardings;
|
|
55
|
+
return o.config[o.cardIndex];
|
|
56
|
+
},
|
|
52
57
|
shouldShowOnboarding: (n) => (o) => {
|
|
53
58
|
const i = n.userModalState.Guido;
|
|
54
59
|
return o === "newVersionPopup" && (i != null && i.genericOnboarding) ? !1 : i ? !i[o] : !0;
|
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
import { useActionsApi as
|
|
2
|
-
import { useConfig as
|
|
3
|
-
import { useHtmlCompiler as
|
|
4
|
-
import {
|
|
5
|
-
import { useRecommendationExtensionStore as
|
|
6
|
-
import { mapLegacyStrategy as
|
|
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
|
|
14
|
-
function
|
|
15
|
-
const i = new DOMParser().parseFromString(l, "text/html").querySelectorAll(`[${
|
|
16
|
-
return i.forEach((
|
|
17
|
-
const
|
|
18
|
-
|
|
1
|
+
import { useActionsApi as k } from "../composables/useActionsApi.js";
|
|
2
|
+
import { useConfig as U } from "../composables/useConfig.js";
|
|
3
|
+
import { useHtmlCompiler as x } from "../composables/useHtmlCompiler.js";
|
|
4
|
+
import { DEFAULT_CURRENCY as m, DEFAULT_NODE_CONFIG as n } from "../extensions/Blocks/Recommendation/constants/defaultConfig.js";
|
|
5
|
+
import { useRecommendationExtensionStore as A } from "../extensions/Blocks/Recommendation/store/recommendation.js";
|
|
6
|
+
import { mapLegacyStrategy as L } from "../extensions/Blocks/Recommendation/utils/legacyStrategyMap.js";
|
|
7
|
+
import { DATA_ATTRIBUTES as T } from "../extensions/Blocks/Unsubscribe/utils/constants.js";
|
|
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 O } from "../stores/unsubscribe.js";
|
|
12
|
+
import { isPlainObject as _ } from "./genericUtil.js";
|
|
13
|
+
import { assignTrackingIds as v } from "./linkTrackingIds.js";
|
|
14
|
+
function M(l) {
|
|
15
|
+
const i = new DOMParser().parseFromString(l, "text/html").querySelectorAll(`[${T.PAGE_LIST}]`), t = [];
|
|
16
|
+
return i.forEach((c) => {
|
|
17
|
+
const o = c.getAttribute(T.PAGE_LIST);
|
|
18
|
+
o && t.push(...R(o));
|
|
19
19
|
}), [...new Set(t)];
|
|
20
20
|
}
|
|
21
|
-
async function
|
|
21
|
+
async function q(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 = A();
|
|
26
26
|
a.forEach((t) => {
|
|
27
|
-
var d, g, f,
|
|
28
|
-
const
|
|
29
|
-
if (!Number.isFinite(
|
|
27
|
+
var r, d, g, f, s, y;
|
|
28
|
+
const c = t.getAttribute("recommendation-id"), o = c ? Number(c) : NaN;
|
|
29
|
+
if (!Number.isFinite(o))
|
|
30
30
|
return;
|
|
31
31
|
const p = t.getAttribute("esd-ext-config");
|
|
32
32
|
if (!p)
|
|
@@ -37,13 +37,13 @@ async function M(l) {
|
|
|
37
37
|
} catch {
|
|
38
38
|
return;
|
|
39
39
|
}
|
|
40
|
-
if (!
|
|
40
|
+
if (!_(e))
|
|
41
41
|
return;
|
|
42
|
-
const
|
|
42
|
+
const b = {
|
|
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: L(e.strategy) || 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 M(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: ((r = e.currency) == null ? void 0 : r.code) ?? m.code,
|
|
56
|
+
currencySymbol: ((d = e.currency) == null ? void 0 : d.symbol) ?? m.symbol,
|
|
57
|
+
currencyAlignment: ((g = e.currency) == null ? void 0 : g.alignment) ?? m.alignment,
|
|
58
|
+
currencyDecimalCount: ((f = e.currency) == null ? void 0 : f.decimalCount) ?? m.decimalCount,
|
|
59
|
+
currencyDecimalSeparator: ((s = e.currency) == null ? void 0 : s.decimalSeparator) ?? m.decimalSeparator,
|
|
60
|
+
currencyThousandSeparator: ((y = e.currency) == null ? void 0 : y.thousandSeparator) ?? m.thousandSeparator
|
|
61
61
|
};
|
|
62
|
-
i.seedBlockUrlConfig(
|
|
62
|
+
i.seedBlockUrlConfig(o, b);
|
|
63
63
|
});
|
|
64
64
|
try {
|
|
65
65
|
await i.fetchRecommendationCreateData();
|
|
@@ -70,51 +70,51 @@ async function M(l) {
|
|
|
70
70
|
);
|
|
71
71
|
}
|
|
72
72
|
}
|
|
73
|
-
const
|
|
74
|
-
const l =
|
|
73
|
+
const te = () => {
|
|
74
|
+
const l = N(), u = z(), a = O(), { getCompiledEmail: i, getTemplateData: t, updateHtmlAndCss: c } = k(), { compileHtml: o, compileAmpHtml: p } = x(), { isFeatureEnabled: e } = U();
|
|
75
75
|
return {
|
|
76
76
|
prepareTemplateDetails: async () => {
|
|
77
|
-
let { html:
|
|
77
|
+
let { html: r, css: d, syncModulesIds: g = [] } = await t();
|
|
78
78
|
if (e("linkTrackingIds"))
|
|
79
79
|
try {
|
|
80
|
-
const { html:
|
|
81
|
-
u.trackIdSessionFloor = H, F && (
|
|
82
|
-
} catch (
|
|
83
|
-
console.error("Tracking-id step failed, saving anyway:",
|
|
80
|
+
const { html: h, changed: F, nextSeq: H } = v(r, u.trackIdSessionFloor);
|
|
81
|
+
u.trackIdSessionFloor = H, F && (r = h, await c(h, d));
|
|
82
|
+
} catch (h) {
|
|
83
|
+
console.error("Tracking-id step failed, saving anyway:", h);
|
|
84
84
|
}
|
|
85
|
-
const { html: f, ampHtml:
|
|
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 q(r);
|
|
90
|
+
const { compiledHtml: I, stats: S, appliedRules: w } = o(f), D = s && p(s).compiledHtml, P = l.getSelectedDynamicContentList, E = A(), C = M(r);
|
|
91
91
|
return console.debug("HTML Compilation Stats:", {
|
|
92
|
-
originalSize:
|
|
93
|
-
compiledSize:
|
|
94
|
-
reduction: `${
|
|
92
|
+
originalSize: S.originalSize,
|
|
93
|
+
compiledSize: S.compiledSize,
|
|
94
|
+
reduction: `${S.reductionPercentage.toFixed(2)}%`,
|
|
95
95
|
appliedRules: w,
|
|
96
|
-
executionTime: `${
|
|
96
|
+
executionTime: `${S.executionTime.toFixed(2)}ms`
|
|
97
97
|
}), {
|
|
98
|
-
dynamicContentList:
|
|
99
|
-
compiledHtml:
|
|
100
|
-
rawHtml:
|
|
98
|
+
dynamicContentList: P,
|
|
99
|
+
compiledHtml: I,
|
|
100
|
+
rawHtml: r,
|
|
101
101
|
css: d,
|
|
102
102
|
ampHtml: D,
|
|
103
103
|
ampErrors: y,
|
|
104
104
|
modules: g.map(Number),
|
|
105
105
|
recommendation: {
|
|
106
|
-
campaignUrls:
|
|
106
|
+
campaignUrls: E.recommendationCampaignUrls,
|
|
107
107
|
configs: {}
|
|
108
108
|
},
|
|
109
109
|
unsubscribe: {
|
|
110
|
-
status:
|
|
111
|
-
config:
|
|
110
|
+
status: C.length > 0,
|
|
111
|
+
config: C
|
|
112
112
|
}
|
|
113
113
|
};
|
|
114
114
|
}
|
|
115
115
|
};
|
|
116
116
|
};
|
|
117
117
|
export {
|
|
118
|
-
|
|
119
|
-
|
|
118
|
+
M as getHtmlReferencedUnsubscribePages,
|
|
119
|
+
te as useTemplatePreparation
|
|
120
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.4d2b065",
|
|
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",
|
|
@@ -77,7 +77,7 @@
|
|
|
77
77
|
"@typescript-eslint/parser": "7.18.0",
|
|
78
78
|
"@useinsider/eslint-config": "1.5.3",
|
|
79
79
|
"@vitejs/plugin-vue2": "2.3.1",
|
|
80
|
-
"@vitest/coverage-v8": "
|
|
80
|
+
"@vitest/coverage-v8": "4.1.11",
|
|
81
81
|
"eslint": "8.57.1",
|
|
82
82
|
"eslint-config-airbnb-base": "15.0.0",
|
|
83
83
|
"eslint-config-airbnb-typescript": "18.0.0",
|
|
@@ -90,17 +90,17 @@
|
|
|
90
90
|
"happy-dom": "15.11.7",
|
|
91
91
|
"husky": "9.1.7",
|
|
92
92
|
"msw": "2.10.3",
|
|
93
|
-
"nyc": "
|
|
93
|
+
"nyc": "18.0.0",
|
|
94
94
|
"sass": "1.69.7",
|
|
95
95
|
"typescript": "5.5.4",
|
|
96
96
|
"typescript-eslint": "8.26.0",
|
|
97
97
|
"vite-plugin-dts": "4.5.4",
|
|
98
98
|
"vite-plugin-istanbul": "7.0.0",
|
|
99
|
-
"vitest": "
|
|
99
|
+
"vitest": "4.1.11",
|
|
100
100
|
"vue-tsc": "2.2.10"
|
|
101
101
|
},
|
|
102
102
|
"overrides": {
|
|
103
|
-
"axios": "1.
|
|
103
|
+
"axios": "1.20.0",
|
|
104
104
|
"flatted": "3.4.2",
|
|
105
105
|
"micromatch": "4.0.8",
|
|
106
106
|
"path-to-regexp": "6.3.0"
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { useRecommendationExtensionStore as s } from "../store/recommendation.js";
|
|
2
|
-
import { commitBlockChangeOutsidePanel as d } from "./nodeConfigWriter.js";
|
|
3
|
-
async function u(e, n) {
|
|
4
|
-
const t = s(), o = t.blockStates[e];
|
|
5
|
-
if (!o)
|
|
6
|
-
return !1;
|
|
7
|
-
const { strategyId: a, strategy: c, size: i } = o.recommendationConfigs;
|
|
8
|
-
if (t.currentRecommendationId === e)
|
|
9
|
-
try {
|
|
10
|
-
await t.fetchRecommendationProducts();
|
|
11
|
-
} catch (m) {
|
|
12
|
-
console.error("[recommendation] product refetch after a strategy change failed", m);
|
|
13
|
-
}
|
|
14
|
-
const r = d(
|
|
15
|
-
e,
|
|
16
|
-
{ strategyId: a, strategy: c, size: i },
|
|
17
|
-
o.recommendationProducts,
|
|
18
|
-
n
|
|
19
|
-
);
|
|
20
|
-
return r || console.error("[recommendation] strategy change did not reach a node", { blockId: e }), r;
|
|
21
|
-
}
|
|
22
|
-
export {
|
|
23
|
-
u as commitStrategyChange
|
|
24
|
-
};
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Writes a strategy change and its products straight to the document, without the settings panel.
|
|
3
|
-
*
|
|
4
|
-
* Every entry point is host-rendered UI outside `ui-editor`, and none of them can rely on the
|
|
5
|
-
* panel control: opening the strategy page deselects the block, so by the time the user comes back
|
|
6
|
-
* and presses Assign the control — and with it the subscription that does the node write, the
|
|
7
|
-
* product fetch and the repaint — is gone. The assignment then reaches Pinia and nothing else
|
|
8
|
-
* (SD-149916).
|
|
9
|
-
*
|
|
10
|
-
* Call AFTER the store change (`assignStrategy` / `removeStrategy`).
|
|
11
|
-
* @param description - labels the undo entry
|
|
12
|
-
* @returns whether the write reached a node
|
|
13
|
-
*/
|
|
14
|
-
export declare function commitStrategyChange(blockId: number, description: string): Promise<boolean>;
|