@useinsider/guido 3.18.1-beta.8d3bf29 → 3.18.1-beta.b5c3493
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/@types/config/schemas.js +57 -51
- package/dist/components/organisms/extensions/recommendation/RemoveStrategyModal.vue2.js +24 -22
- package/dist/composables/useLegacyStrategyConversion.js +34 -31
- package/dist/enums/extensions/recommendationBlock.js +16 -14
- package/dist/extensions/Blocks/Recommendation/controls/main/strategy.js +21 -16
- package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +45 -44
- package/dist/extensions/Blocks/Recommendation/store/recommendation.js +38 -34
- package/dist/extensions/Blocks/Recommendation/utils/legacyStrategyMigration.js +41 -29
- package/dist/extensions/Blocks/Recommendation/utils/nodeConfigWriter.js +7 -7
- package/dist/services/recommendationApi.js +84 -84
- package/dist/src/@types/config/schemas.d.ts +12 -0
- package/dist/src/composables/useConfig.d.ts +2 -0
- package/dist/src/enums/extensions/recommendationBlock.d.ts +2 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/main/utils.d.ts +4 -0
- package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +2 -2
- package/dist/src/extensions/Blocks/Recommendation/utils/legacyStrategyMigration.d.ts +5 -1
- package/dist/src/services/recommendationApi.d.ts +2 -2
- package/dist/src/stores/config.d.ts +162 -0
- package/dist/stores/config.js +27 -20
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ModuleFolderDefaults as f } from "../../enums/defaults.js";
|
|
2
|
-
import { object as
|
|
2
|
+
import { object as o, number as n, optional as e, string as t, picklist as i, pipe as m, minLength as b, custom as h, boolean as a, array as c, transform as C, record as k, fallback as R, literal as u, looseObject as g, variant as I, union as y, unknown as r, lazy as T } from "../../node_modules/valibot/dist/index.js";
|
|
3
3
|
const p = {
|
|
4
4
|
/** Promotional/marketing emails */
|
|
5
5
|
PROMOTIONAL: 1,
|
|
@@ -12,7 +12,7 @@ const p = {
|
|
|
12
12
|
ARCHITECT: 49,
|
|
13
13
|
/** Unsubscribe page builder */
|
|
14
14
|
UNSUBSCRIBE_PAGES: 97
|
|
15
|
-
}, A =
|
|
15
|
+
}, A = o({
|
|
16
16
|
/** Unique identifier for the template being edited */
|
|
17
17
|
templateId: m(
|
|
18
18
|
t(),
|
|
@@ -26,13 +26,19 @@ const p = {
|
|
|
26
26
|
/** Optional variation ID for A/B testing */
|
|
27
27
|
variationId: e(t()),
|
|
28
28
|
/** Optional numeric campaign ID of the host campaign; absent for templates and modules */
|
|
29
|
-
campaignId: e(t())
|
|
30
|
-
|
|
29
|
+
campaignId: e(t()),
|
|
30
|
+
/**
|
|
31
|
+
* Optional numeric template-library id of the host template; absent for campaigns and
|
|
32
|
+
* modules. Distinct from `templateId`, which is the editor's document identity (a uuid /
|
|
33
|
+
* Stripo doc id) and is never an endpoint id.
|
|
34
|
+
*/
|
|
35
|
+
templateLibraryId: e(t())
|
|
36
|
+
}), L = o({
|
|
31
37
|
/** Fallback font name (e.g., "Georgia") */
|
|
32
38
|
name: t(),
|
|
33
39
|
/** Fallback font family (e.g., "serif" or "sans-serif") */
|
|
34
40
|
family: t()
|
|
35
|
-
}), M =
|
|
41
|
+
}), M = o({
|
|
36
42
|
/** Partner/organization name (required) */
|
|
37
43
|
name: m(
|
|
38
44
|
t(),
|
|
@@ -56,7 +62,7 @@ const p = {
|
|
|
56
62
|
username: e(t(), "Guido User"),
|
|
57
63
|
/** Fallback font settings from partner settings — used to match backend size calculation */
|
|
58
64
|
fallbackFont: e(L)
|
|
59
|
-
}), E =
|
|
65
|
+
}), E = o({
|
|
60
66
|
/** Display text for the dynamic content */
|
|
61
67
|
text: t(),
|
|
62
68
|
/** Template variable value (e.g., {{username}}) */
|
|
@@ -65,12 +71,12 @@ const p = {
|
|
|
65
71
|
fallback: e(t()),
|
|
66
72
|
/** Optional formatting options */
|
|
67
73
|
format: e(
|
|
68
|
-
|
|
74
|
+
o({
|
|
69
75
|
key: t(),
|
|
70
76
|
value: t()
|
|
71
77
|
})
|
|
72
78
|
)
|
|
73
|
-
}), S =
|
|
79
|
+
}), S = T(() => g({
|
|
74
80
|
text: e(t()),
|
|
75
81
|
// eslint-disable-next-line camelcase -- backend field name
|
|
76
82
|
tag_text: e(t()),
|
|
@@ -85,13 +91,13 @@ const p = {
|
|
|
85
91
|
/** Block ID (matches the dictionary key and the legacy HTML element id) */
|
|
86
92
|
id: e(n()),
|
|
87
93
|
/** Decimal places for price display (legacy data may use string or number) */
|
|
88
|
-
decimalCount: e(
|
|
94
|
+
decimalCount: e(y([t(), n()])),
|
|
89
95
|
/** Pinned product IDs (empty array when filter-driven) */
|
|
90
96
|
productIds: e(c(r())),
|
|
91
97
|
/** Whether the block requested live products at send time */
|
|
92
|
-
sendProductRequestFlag: e(
|
|
98
|
+
sendProductRequestFlag: e(a()),
|
|
93
99
|
/** Whether to randomize product order */
|
|
94
|
-
shuffleProducts: e(
|
|
100
|
+
shuffleProducts: e(a()),
|
|
95
101
|
/** Filter rules driving product selection */
|
|
96
102
|
filters: e(c(r())),
|
|
97
103
|
/** Currency code (e.g. 'EUR') — sometimes absent in legacy data */
|
|
@@ -111,22 +117,22 @@ const p = {
|
|
|
111
117
|
/** Mobile-only padding (left) */
|
|
112
118
|
mobileLeftPadding: e(n()),
|
|
113
119
|
/** Disable responsive scaling */
|
|
114
|
-
unresponsive: e(
|
|
120
|
+
unresponsive: e(a()),
|
|
115
121
|
/** Layout orientation ('vertical' | 'horizontal') */
|
|
116
122
|
orientation: e(t()),
|
|
117
123
|
/** Whether long text is trimmed */
|
|
118
|
-
textTrimming: e(
|
|
124
|
+
textTrimming: e(a()),
|
|
119
125
|
/** Block type marker used by some legacy variants */
|
|
120
126
|
blockType: e(t()),
|
|
121
127
|
/** Size variant marker (legacy data may use string or number) */
|
|
122
|
-
size: e(
|
|
128
|
+
size: e(y([t(), n()])),
|
|
123
129
|
/** Vertical responsiveness flag (legacy size=1 variants) */
|
|
124
|
-
verticalResponsiveness: e(
|
|
130
|
+
verticalResponsiveness: e(a()),
|
|
125
131
|
/** Legacy "Move to next line" price placement toggle (cardPricePlacement.js) */
|
|
126
|
-
isPriceMovedToNextLine: e(
|
|
132
|
+
isPriceMovedToNextLine: e(a()),
|
|
127
133
|
/** Legacy "Hide if same as discounted" / delete-price-for-zero-sale toggle */
|
|
128
|
-
isPriceDeletedForZeroSale: e(
|
|
129
|
-
}), v =
|
|
134
|
+
isPriceDeletedForZeroSale: e(a())
|
|
135
|
+
}), v = o({
|
|
130
136
|
/**
|
|
131
137
|
* Legacy recommendation block configs keyed by block ID.
|
|
132
138
|
* Pass this when loading a template authored with the v1
|
|
@@ -137,7 +143,7 @@ const p = {
|
|
|
137
143
|
k(t(), P),
|
|
138
144
|
{}
|
|
139
145
|
)
|
|
140
|
-
}), x =
|
|
146
|
+
}), x = o({
|
|
141
147
|
/** Initial HTML content */
|
|
142
148
|
html: e(t(), ""),
|
|
143
149
|
/** Initial CSS content */
|
|
@@ -159,7 +165,7 @@ const p = {
|
|
|
159
165
|
/** Selected unsubscribe page IDs */
|
|
160
166
|
selectedUnsubscribePages: e(c(n()), []),
|
|
161
167
|
/** Force recreate template in Stripo storage (use true when updating externally modified templates) */
|
|
162
|
-
forceRecreate: e(
|
|
168
|
+
forceRecreate: e(a(), !1),
|
|
163
169
|
/**
|
|
164
170
|
* Consumer-persisted tracking-id high-water mark (SD-141414). Used as the id floor
|
|
165
171
|
* during migration so a rolled-back document never re-mints retired tracking ids.
|
|
@@ -176,12 +182,12 @@ const p = {
|
|
|
176
182
|
),
|
|
177
183
|
/** Migration-only inputs (legacy block configs) */
|
|
178
184
|
migration: e(v, {})
|
|
179
|
-
}), D =
|
|
185
|
+
}), D = o({
|
|
180
186
|
/** Sender display name */
|
|
181
187
|
senderName: e(t(), ""),
|
|
182
188
|
/** Email subject line */
|
|
183
189
|
subject: e(t(), "")
|
|
184
|
-
}), O =
|
|
190
|
+
}), O = o({
|
|
185
191
|
/** Locale for the editor UI */
|
|
186
192
|
locale: e(t(), "en"),
|
|
187
193
|
/** Path to translations object */
|
|
@@ -194,35 +200,35 @@ const p = {
|
|
|
194
200
|
savedModulesFolderName: e(t(), f.SAVED_MODULES),
|
|
195
201
|
/** Folder name for default/prebuilt modules (used by Stripo plugin panel for path construction) */
|
|
196
202
|
defaultModulesFolderName: e(t(), f.DEFAULT_MODULES)
|
|
197
|
-
}), F =
|
|
203
|
+
}), F = o({
|
|
198
204
|
/** Whether to show the header bar */
|
|
199
|
-
showHeader: e(
|
|
205
|
+
showHeader: e(a(), !0),
|
|
200
206
|
/** Custom label for back button (if shown) */
|
|
201
207
|
backButtonLabel: e(t())
|
|
202
|
-
}), U =
|
|
208
|
+
}), U = o({
|
|
203
209
|
/** Enable dynamic content insertion */
|
|
204
|
-
dynamicContent: e(
|
|
210
|
+
dynamicContent: e(a(), !0),
|
|
205
211
|
/** Enable save as template functionality */
|
|
206
|
-
saveAsTemplate: e(
|
|
212
|
+
saveAsTemplate: e(a(), !0),
|
|
207
213
|
/** Enable version history */
|
|
208
|
-
versionHistory: e(
|
|
214
|
+
versionHistory: e(a(), !0),
|
|
209
215
|
/** Enable test message sending */
|
|
210
|
-
testMessage: e(
|
|
216
|
+
testMessage: e(a(), !0),
|
|
211
217
|
/** Enable display conditions */
|
|
212
|
-
displayConditions: e(
|
|
218
|
+
displayConditions: e(a(), !0),
|
|
213
219
|
/** Enable unsubscribe block */
|
|
214
|
-
unsubscribe: e(
|
|
220
|
+
unsubscribe: e(a(), !0),
|
|
215
221
|
/** Disable modules panel in the editor */
|
|
216
|
-
modulesDisabled: e(
|
|
222
|
+
modulesDisabled: e(a(), !1),
|
|
217
223
|
/** Enable Liquid template syntax */
|
|
218
|
-
liquidSyntax: e(
|
|
224
|
+
liquidSyntax: e(a(), !1),
|
|
219
225
|
/** Enable autosave (3-min interval + tab-hide). User toggles on/off from the header. */
|
|
220
|
-
autosave: e(
|
|
226
|
+
autosave: e(a(), !1),
|
|
221
227
|
/** Enable pre-save domain-allowlist validation (opt-in; Guido self-serves the block toaster) */
|
|
222
|
-
allowlistEnabled: e(
|
|
228
|
+
allowlistEnabled: e(a(), !1),
|
|
223
229
|
/** Enable persistent link tracking-id assignment for the click heatmap (opt-in) */
|
|
224
|
-
linkTrackingIds: e(
|
|
225
|
-
reusableRecommendationStrategy: e(
|
|
230
|
+
linkTrackingIds: e(a(), !1),
|
|
231
|
+
reusableRecommendationStrategy: e(a(), !1)
|
|
226
232
|
}), B = i([
|
|
227
233
|
"amp-accordion",
|
|
228
234
|
"amp-carousel",
|
|
@@ -245,7 +251,7 @@ const p = {
|
|
|
245
251
|
"unsubscribe-block",
|
|
246
252
|
"coupon-block",
|
|
247
253
|
"items-block"
|
|
248
|
-
]), H =
|
|
254
|
+
]), H = o({
|
|
249
255
|
/** Default blocks to exclude from the editor */
|
|
250
256
|
excludeDefaults: e(
|
|
251
257
|
c(B),
|
|
@@ -256,14 +262,14 @@ const p = {
|
|
|
256
262
|
c(w),
|
|
257
263
|
[]
|
|
258
264
|
)
|
|
259
|
-
}), d =
|
|
265
|
+
}), d = o({
|
|
260
266
|
/** Unique identifier for the rule */
|
|
261
267
|
id: t(),
|
|
262
268
|
/** Human-readable description */
|
|
263
269
|
description: e(t()),
|
|
264
270
|
/** Priority for rule ordering (lower = earlier) */
|
|
265
271
|
priority: n()
|
|
266
|
-
}), _ =
|
|
272
|
+
}), _ = o({
|
|
267
273
|
...d.entries,
|
|
268
274
|
type: u("replace"),
|
|
269
275
|
/** String to search for */
|
|
@@ -271,8 +277,8 @@ const p = {
|
|
|
271
277
|
/** Replacement string */
|
|
272
278
|
replacement: t(),
|
|
273
279
|
/** Replace all occurrences (default: false) */
|
|
274
|
-
replaceAll: e(
|
|
275
|
-
}), j =
|
|
280
|
+
replaceAll: e(a())
|
|
281
|
+
}), j = o({
|
|
276
282
|
...d.entries,
|
|
277
283
|
type: u("regex"),
|
|
278
284
|
/** Regex pattern string */
|
|
@@ -281,41 +287,41 @@ const p = {
|
|
|
281
287
|
replacement: t(),
|
|
282
288
|
/** Regex flags (e.g., 'gi') */
|
|
283
289
|
flags: e(t())
|
|
284
|
-
}), q =
|
|
290
|
+
}), q = o({
|
|
285
291
|
...d.entries,
|
|
286
292
|
type: u("remove"),
|
|
287
293
|
/** Strings or patterns to remove */
|
|
288
294
|
targets: c(t())
|
|
289
|
-
}), G =
|
|
295
|
+
}), G = o({
|
|
290
296
|
...d.entries,
|
|
291
297
|
type: u("custom"),
|
|
292
298
|
/** Custom processor function */
|
|
293
|
-
processor:
|
|
299
|
+
processor: h(
|
|
294
300
|
(s) => typeof s == "function",
|
|
295
301
|
"processor must be a function"
|
|
296
302
|
)
|
|
297
|
-
}), V =
|
|
303
|
+
}), V = I("type", [
|
|
298
304
|
_,
|
|
299
305
|
j,
|
|
300
306
|
q,
|
|
301
307
|
G
|
|
302
|
-
]), z =
|
|
308
|
+
]), z = o({
|
|
303
309
|
/** Custom compiler rules to apply */
|
|
304
310
|
customRules: e(c(V), []),
|
|
305
311
|
/** Skip default compiler rules */
|
|
306
|
-
ignoreDefaultRules: e(
|
|
307
|
-
}), Z =
|
|
312
|
+
ignoreDefaultRules: e(a(), !1)
|
|
313
|
+
}), Z = o({
|
|
308
314
|
/**
|
|
309
315
|
* External validation handler called before save completes.
|
|
310
316
|
* Return false to cancel the save operation.
|
|
311
317
|
*/
|
|
312
318
|
externalValidation: e(
|
|
313
|
-
|
|
319
|
+
h(
|
|
314
320
|
(s) => typeof s == "function",
|
|
315
321
|
"externalValidation must be a function"
|
|
316
322
|
)
|
|
317
323
|
)
|
|
318
|
-
}), Q =
|
|
324
|
+
}), Q = o({
|
|
319
325
|
// Required sections
|
|
320
326
|
/** Identity configuration (required) */
|
|
321
327
|
identity: A,
|
|
@@ -1,15 +1,17 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import
|
|
3
|
-
import { useToaster as
|
|
1
|
+
import { defineComponent as y, computed as n } from "vue";
|
|
2
|
+
import f from "../../../wrappers/WpModal.vue.js";
|
|
3
|
+
import { useToaster as u } from "../../../../composables/useToaster.js";
|
|
4
4
|
import { useTranslations as _ } from "../../../../composables/useTranslations.js";
|
|
5
|
-
import { ToasterTypeOptions as
|
|
6
|
-
import
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
|
|
5
|
+
import { ToasterTypeOptions as R } from "../../../../enums/toaster.js";
|
|
6
|
+
import "../../../../extensions/Blocks/Recommendation/constants/selectors.js";
|
|
7
|
+
import { CURRENT_CONFIG_VERSION as T } from "../../../../extensions/Blocks/Recommendation/constants/defaultConfig.js";
|
|
8
|
+
import { useRecommendationExtensionStore as v } from "../../../../extensions/Blocks/Recommendation/store/recommendation.js";
|
|
9
|
+
import { commitBlockChangeOutsidePanel as N } from "../../../../extensions/Blocks/Recommendation/utils/nodeConfigWriter.js";
|
|
10
|
+
import { escapeHtml as S } from "../../../../utils/htmlEscape.js";
|
|
11
|
+
const w = /* @__PURE__ */ y({
|
|
10
12
|
__name: "RemoveStrategyModal",
|
|
11
|
-
setup(
|
|
12
|
-
const t = _(), e =
|
|
13
|
+
setup(h) {
|
|
14
|
+
const t = _(), e = v(), { showToaster: a } = u(), i = n(() => ({
|
|
13
15
|
cancelOrBackButton: {
|
|
14
16
|
type: "secondary",
|
|
15
17
|
labelText: t("products.cancel"),
|
|
@@ -20,38 +22,38 @@ const P = /* @__PURE__ */ u({
|
|
|
20
22
|
labelText: t("discovery-strategy.remove")
|
|
21
23
|
}
|
|
22
24
|
})), m = n(() => {
|
|
23
|
-
var
|
|
24
|
-
const { strategyId:
|
|
25
|
-
return ((
|
|
25
|
+
var r;
|
|
26
|
+
const { strategyId: o } = e.recommendationConfigs;
|
|
27
|
+
return o ? ((r = e.assignedStrategy) == null ? void 0 : r.name) || `#${o}` : t("ds-steps.legacy-strategy");
|
|
26
28
|
}), s = "__STRATEGY_NAME__", d = n(() => t("email-editor.remove-strategy-confirm-message", { strategyName: s }).split(s)), c = () => {
|
|
27
29
|
e.closeRemoveStrategyModal();
|
|
28
30
|
};
|
|
29
31
|
return { __sfc: !0, trans: t, store: e, showToaster: a, footerButtonOptions: i, strategyName: m, NAME_TOKEN: s, messageParts: d, close: c, handleConfirm: async () => {
|
|
30
|
-
const
|
|
32
|
+
const o = m.value, r = e.currentRecommendationId;
|
|
31
33
|
e.removeStrategy(), c();
|
|
32
34
|
const { strategyId: l, size: g } = e.recommendationConfigs;
|
|
33
35
|
if (a({
|
|
34
|
-
type:
|
|
36
|
+
type: R.Success,
|
|
35
37
|
// The toast renders through a sanitizing v-html, so the name is escaped first.
|
|
36
38
|
message: t("email-editor.strategy-removed-success", {
|
|
37
|
-
strategyName: `<b>${
|
|
39
|
+
strategyName: `<b>${S(o)}</b>`
|
|
38
40
|
})
|
|
39
|
-
}),
|
|
41
|
+
}), r !== null) {
|
|
40
42
|
try {
|
|
41
43
|
await e.fetchRecommendationProducts();
|
|
42
44
|
} catch (p) {
|
|
43
45
|
console.error("[RemoveStrategyModal] product refetch failed", p);
|
|
44
46
|
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
{ strategyId: l, size: g },
|
|
47
|
+
N(
|
|
48
|
+
r,
|
|
49
|
+
{ strategyId: l, size: g, configVersion: T },
|
|
48
50
|
e.recommendationProducts,
|
|
49
51
|
"Removed recommendation strategy"
|
|
50
52
|
);
|
|
51
53
|
}
|
|
52
|
-
}, WpModal:
|
|
54
|
+
}, WpModal: f };
|
|
53
55
|
}
|
|
54
56
|
});
|
|
55
57
|
export {
|
|
56
|
-
|
|
58
|
+
w as default
|
|
57
59
|
};
|
|
@@ -1,54 +1,57 @@
|
|
|
1
1
|
import { useRecommendation as f } from "./useRecommendation.js";
|
|
2
|
-
import { useToaster as
|
|
3
|
-
import { useTranslations as
|
|
2
|
+
import { useToaster as S } from "./useToaster.js";
|
|
3
|
+
import { useTranslations as I } from "./useTranslations.js";
|
|
4
4
|
import { ToasterTypeOptions as C } from "../enums/toaster.js";
|
|
5
5
|
import "../extensions/Blocks/Recommendation/constants/selectors.js";
|
|
6
|
-
import { CURRENT_CONFIG_VERSION as
|
|
7
|
-
import { useRecommendationExtensionStore as
|
|
8
|
-
import { buildLegacyMigrationPayload as
|
|
9
|
-
import { commitBlockChangeOutsidePanel as
|
|
10
|
-
import { useConfigStore as
|
|
11
|
-
const
|
|
12
|
-
const t =
|
|
6
|
+
import { CURRENT_CONFIG_VERSION as L } from "../extensions/Blocks/Recommendation/constants/defaultConfig.js";
|
|
7
|
+
import { useRecommendationExtensionStore as v } from "../extensions/Blocks/Recommendation/store/recommendation.js";
|
|
8
|
+
import { buildLegacyMigrationPayload as b, resolveMigrationTarget as R } from "../extensions/Blocks/Recommendation/utils/legacyStrategyMigration.js";
|
|
9
|
+
import { commitBlockChangeOutsidePanel as T } from "../extensions/Blocks/Recommendation/utils/nodeConfigWriter.js";
|
|
10
|
+
import { useConfigStore as h } from "../stores/config.js";
|
|
11
|
+
const V = () => {
|
|
12
|
+
const t = v(), o = h(), { buildCampaignUrl: c } = f(), { showToaster: s } = S(), m = I();
|
|
13
13
|
return { convertLegacyStrategy: async () => {
|
|
14
|
-
const
|
|
15
|
-
if (
|
|
14
|
+
const e = t.currentRecommendationId;
|
|
15
|
+
if (e === null || !t.isLegacyStrategyBlock || t.legacyConversionLoading)
|
|
16
16
|
return "";
|
|
17
|
-
const { strategy: g, productIds: d, filters:
|
|
18
|
-
blockId:
|
|
19
|
-
url: c(String(
|
|
20
|
-
campaignId:
|
|
21
|
-
variationId:
|
|
17
|
+
const { strategy: g, productIds: d, filters: l } = t.recommendationConfigs, y = b({
|
|
18
|
+
blockId: e,
|
|
19
|
+
url: c(String(e)),
|
|
20
|
+
campaignId: o.campaignId,
|
|
21
|
+
variationId: o.variationId,
|
|
22
22
|
strategy: g,
|
|
23
23
|
productIds: d,
|
|
24
|
-
filters:
|
|
24
|
+
filters: l,
|
|
25
25
|
attributes: t.getFilterList
|
|
26
|
+
}), p = R({
|
|
27
|
+
campaignId: o.campaignId,
|
|
28
|
+
templateLibraryId: o.templateLibraryId
|
|
26
29
|
});
|
|
27
|
-
let
|
|
30
|
+
let r;
|
|
28
31
|
try {
|
|
29
|
-
|
|
30
|
-
} catch (
|
|
31
|
-
return console.error("[useLegacyStrategyConversion] migration failed",
|
|
32
|
+
r = await t.convertLegacyStrategy(y, p);
|
|
33
|
+
} catch (a) {
|
|
34
|
+
return console.error("[useLegacyStrategyConversion] migration failed", a), s({
|
|
32
35
|
type: C.Error,
|
|
33
36
|
message: m("email-editor.legacy-strategy-update-failed")
|
|
34
37
|
}), "";
|
|
35
38
|
}
|
|
36
|
-
const
|
|
37
|
-
if (
|
|
39
|
+
const n = t.currentRecommendationId === e;
|
|
40
|
+
if (n)
|
|
38
41
|
try {
|
|
39
42
|
await t.fetchRecommendationProducts();
|
|
40
|
-
} catch (
|
|
41
|
-
console.error("[useLegacyStrategyConversion] product refetch failed",
|
|
43
|
+
} catch (a) {
|
|
44
|
+
console.error("[useLegacyStrategyConversion] product refetch failed", a);
|
|
42
45
|
}
|
|
43
|
-
const i = t.blockStates[
|
|
44
|
-
return
|
|
45
|
-
|
|
46
|
-
{ strategyId:
|
|
46
|
+
const i = t.blockStates[e], { size: u } = i.recommendationConfigs;
|
|
47
|
+
return T(
|
|
48
|
+
e,
|
|
49
|
+
{ strategyId: r, size: u, configVersion: L },
|
|
47
50
|
i.recommendationProducts,
|
|
48
51
|
"Converted legacy recommendation strategy"
|
|
49
|
-
),
|
|
52
|
+
), n && t.openLegacyStrategyUpdatedModal(), r;
|
|
50
53
|
} };
|
|
51
54
|
};
|
|
52
55
|
export {
|
|
53
|
-
|
|
56
|
+
V as useLegacyStrategyConversion
|
|
54
57
|
};
|
|
@@ -5,10 +5,11 @@ const l = {
|
|
|
5
5
|
PRODUCT_ATTRIBUTES_PATH: "/product-attributes/get-attributes",
|
|
6
6
|
RECOMMENDATION_STRATEGIES_PATH: "/api/recommendation-strategies",
|
|
7
7
|
RECOMMENDATION_STRATEGIES_PANEL_PATH: "/discovery/recommendation-strategies",
|
|
8
|
-
NEWSLETTER_RECOMMENDATIONS_PATH: "/newsletter/recommendations"
|
|
9
|
-
|
|
8
|
+
NEWSLETTER_RECOMMENDATIONS_PATH: "/newsletter/recommendations",
|
|
9
|
+
NEWSLETTER_TEMPLATE_LIBRARY_PATH: "/newsletter/template-library"
|
|
10
|
+
}, c = "migrate-strategies", d = {
|
|
10
11
|
CLIENT_ID: "clientId"
|
|
11
|
-
},
|
|
12
|
+
}, m = () => {
|
|
12
13
|
const e = r();
|
|
13
14
|
return [
|
|
14
15
|
{
|
|
@@ -72,14 +73,14 @@ const l = {
|
|
|
72
73
|
path: "top-sellers"
|
|
73
74
|
}
|
|
74
75
|
];
|
|
75
|
-
},
|
|
76
|
+
}, p = ["discount", "omnibus_price", "omnibus_discount", "price", "original_price"], v = [
|
|
76
77
|
{ text: "before the amount", value: "0" },
|
|
77
78
|
{ text: "after the amount", value: "1" }
|
|
78
|
-
],
|
|
79
|
+
], h = [
|
|
79
80
|
{ text: "dot(.)", value: "." },
|
|
80
81
|
{ text: "comma(,)", value: "," },
|
|
81
82
|
{ text: "space( )", value: " " }
|
|
82
|
-
],
|
|
83
|
+
], x = [
|
|
83
84
|
{ text: "0", value: "0" },
|
|
84
85
|
{ text: "1", value: "1" },
|
|
85
86
|
{ text: "2", value: "2" },
|
|
@@ -108,7 +109,7 @@ const l = {
|
|
|
108
109
|
], i = [
|
|
109
110
|
{ text: "true", value: "==" },
|
|
110
111
|
{ text: "false", value: "!=" }
|
|
111
|
-
],
|
|
112
|
+
], T = (e) => {
|
|
112
113
|
if (!e)
|
|
113
114
|
return t;
|
|
114
115
|
switch (e) {
|
|
@@ -128,14 +129,15 @@ const l = {
|
|
|
128
129
|
};
|
|
129
130
|
export {
|
|
130
131
|
a as OP_ANY_OF,
|
|
131
|
-
|
|
132
|
-
|
|
132
|
+
p as PriceAttributes,
|
|
133
|
+
d as QUERY_PARAMS,
|
|
134
|
+
c as TEMPLATE_LIBRARY_MIGRATION_SEGMENT,
|
|
133
135
|
l as URLS,
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
136
|
+
x as currencyDecimalCounts,
|
|
137
|
+
v as currencyLocationMaps,
|
|
138
|
+
h as currencyOperators,
|
|
139
|
+
T as getOperatorOptions,
|
|
140
|
+
m as getRecommendationFeedSourceMaps,
|
|
139
141
|
n as operatorOptionsForArrayOfStrings,
|
|
140
142
|
i as operatorOptionsForBooleans,
|
|
141
143
|
s as operatorOptionsForDates,
|
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
var p = Object.defineProperty;
|
|
2
|
-
var
|
|
3
|
-
var r = (i, s, t) =>
|
|
4
|
-
import { useLegacyStrategyConversion as
|
|
2
|
+
var v = (i, s, t) => s in i ? p(i, s, { enumerable: !0, configurable: !0, writable: !0, value: t }) : i[s] = t;
|
|
3
|
+
var r = (i, s, t) => v(i, typeof s != "symbol" ? s + "" : s, t);
|
|
4
|
+
import { useLegacyStrategyConversion as _ } from "../../../../../composables/useLegacyStrategyConversion.js";
|
|
5
5
|
import { ACADEMY_LINKS as b } from "../../../../../enums/academy.js";
|
|
6
|
-
import { useOnboardingStore as
|
|
6
|
+
import { useOnboardingStore as S } from "../../../../../stores/onboarding.js";
|
|
7
7
|
import { CommonControl as f } from "../../../common-control.js";
|
|
8
|
-
import { useRecommendationExtensionStore as
|
|
9
|
-
const
|
|
8
|
+
import { useRecommendationExtensionStore as $ } from "../../store/recommendation.js";
|
|
9
|
+
const C = "recommendation-strategy-control";
|
|
10
10
|
class N extends f {
|
|
11
11
|
constructor() {
|
|
12
12
|
super(...arguments);
|
|
13
|
-
r(this, "store",
|
|
14
|
-
r(this, "onboardingStore",
|
|
15
|
-
r(this, "legacyConversion",
|
|
13
|
+
r(this, "store", $());
|
|
14
|
+
r(this, "onboardingStore", S());
|
|
15
|
+
r(this, "legacyConversion", _());
|
|
16
16
|
r(this, "storeUnsubscription", () => {
|
|
17
17
|
});
|
|
18
18
|
r(this, "listeners", []);
|
|
19
19
|
r(this, "lastPaintedState", null);
|
|
20
20
|
}
|
|
21
21
|
getId() {
|
|
22
|
-
return
|
|
22
|
+
return C;
|
|
23
23
|
}
|
|
24
24
|
getTemplate() {
|
|
25
25
|
const t = this.api.translate(
|
|
@@ -78,6 +78,11 @@ class N extends f {
|
|
|
78
78
|
id: "guido__btn-change-legacy-strategy",
|
|
79
79
|
label: this.api.translate("Change"),
|
|
80
80
|
modifier: "change"
|
|
81
|
+
})}
|
|
82
|
+
${this._strategyAction({
|
|
83
|
+
id: "guido__btn-remove-legacy-strategy",
|
|
84
|
+
label: this.api.translate("Remove"),
|
|
85
|
+
modifier: "remove"
|
|
81
86
|
})}
|
|
82
87
|
</div>
|
|
83
88
|
</div>
|
|
@@ -134,19 +139,19 @@ class N extends f {
|
|
|
134
139
|
const n = t.querySelector(a);
|
|
135
140
|
n && (n.addEventListener("click", o), this.listeners.push({ element: n, handler: o }));
|
|
136
141
|
};
|
|
137
|
-
e("#guido__btn-assign-strategy", () => this.store.openAssignStrategyDrawer()), e("#guido__btn-change-strategy", () => this.store.openAssignStrategyDrawer()), e("#guido__btn-change-legacy-strategy", () => this.store.openAssignStrategyDrawer()), e("#guido__btn-remove-strategy", () => this.store.openRemoveStrategyModal()), e("#guido__btn-update-legacy-strategy", () => {
|
|
142
|
+
e("#guido__btn-assign-strategy", () => this.store.openAssignStrategyDrawer()), e("#guido__btn-change-strategy", () => this.store.openAssignStrategyDrawer()), e("#guido__btn-change-legacy-strategy", () => this.store.openAssignStrategyDrawer()), e("#guido__btn-remove-strategy", () => this.store.openRemoveStrategyModal()), e("#guido__btn-remove-legacy-strategy", () => this.store.openRemoveStrategyModal()), e("#guido__btn-update-legacy-strategy", () => {
|
|
138
143
|
this.legacyConversion.convertLegacyStrategy();
|
|
139
144
|
});
|
|
140
145
|
}
|
|
141
146
|
_renderState() {
|
|
142
|
-
var
|
|
143
|
-
const { strategyId: t } = this.store.recommendationConfigs, e = t ? ((
|
|
147
|
+
var h;
|
|
148
|
+
const { strategyId: t } = this.store.recommendationConfigs, e = t ? ((h = this.store.assignedStrategy) == null ? void 0 : h.name) ?? "" : "", a = this.store.legacyConversionLoading, o = this.store.isLegacyStrategyBlock, n = `${t}\0${e}\0${a}\0${o}`;
|
|
144
149
|
if (n === this.lastPaintedState)
|
|
145
150
|
return;
|
|
146
151
|
const c = this.getContainer();
|
|
147
152
|
if (!c)
|
|
148
153
|
return;
|
|
149
|
-
const d = c.querySelector("[data-strategy-empty-state]"), y = c.querySelector("[data-strategy-assigned-state]"), g = c.querySelector("[data-strategy-legacy-state]"),
|
|
154
|
+
const d = c.querySelector("[data-strategy-empty-state]"), y = c.querySelector("[data-strategy-assigned-state]"), g = c.querySelector("[data-strategy-legacy-state]"), m = c.querySelector("[data-strategy-name]");
|
|
150
155
|
if (!d || !y || !g)
|
|
151
156
|
return;
|
|
152
157
|
const u = t ? y : o ? g : d;
|
|
@@ -154,10 +159,10 @@ class N extends f {
|
|
|
154
159
|
l.style.display = l === u ? "" : "none";
|
|
155
160
|
}), g.querySelectorAll("button").forEach((l) => {
|
|
156
161
|
l.disabled = a;
|
|
157
|
-
}), g.classList.toggle("is-converting", a),
|
|
162
|
+
}), g.classList.toggle("is-converting", a), m && t && (m.textContent = e || `#${t}`), this.lastPaintedState = n;
|
|
158
163
|
}
|
|
159
164
|
}
|
|
160
165
|
export {
|
|
161
|
-
|
|
166
|
+
C as STRATEGY_CONTROL_ID,
|
|
162
167
|
N as StrategyControl
|
|
163
168
|
};
|