@useinsider/guido 3.19.0-beta.6f88fb4 → 3.19.0-beta.80b64cf
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 +78 -57
- package/dist/components/Guido.vue.js +4 -4
- package/dist/components/Guido.vue2.js +81 -85
- package/dist/components/organisms/base/Toaster.vue2.js +13 -12
- package/dist/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue.js +13 -11
- package/dist/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue2.js +78 -57
- 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 +28 -42
- package/dist/components/organisms/header/EditorActions.vue.js +4 -4
- package/dist/components/organisms/header/EditorActions.vue2.js +23 -25
- package/dist/components/organisms/onboarding/OnboardingWrapper.vue2.js +28 -24
- 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 +21 -0
- package/dist/components/organisms/onboarding/RecommendationStrategyOnboarding.vue2.js +47 -0
- package/dist/composables/useActionsApi.js +44 -43
- package/dist/composables/useCodeEditorApi.js +23 -9
- package/dist/composables/useCortexBlueprintBridge.js +54 -122
- package/dist/composables/useCustomInterfaceAppearance.js +65 -51
- package/dist/composables/useEmailTemplateApplier.js +52 -108
- package/dist/composables/useHtmlValidator.js +87 -82
- package/dist/composables/useLegacyStrategyConversion.js +61 -0
- package/dist/composables/useRecommendation.js +40 -35
- package/dist/composables/useStripo.js +30 -30
- package/dist/composables/useToaster.js +14 -20
- package/dist/composables/useTranslations.js +3 -2
- package/dist/composables/useVersionHistoryApi.js +33 -24
- package/dist/enums/extensions/recommendationBlock.js +49 -33
- package/dist/extensions/Blocks/Recommendation/block.js +109 -55
- package/dist/extensions/Blocks/Recommendation/constants/defaultConfig.js +21 -20
- package/dist/extensions/Blocks/Recommendation/controls/main/index.js +103 -90
- package/dist/extensions/Blocks/Recommendation/controls/main/strategy.js +150 -52
- package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +74 -74
- package/dist/extensions/Blocks/Recommendation/store/recommendation.js +293 -92
- package/dist/extensions/Blocks/Recommendation/utils/legacyStrategyMigration.js +42 -0
- package/dist/extensions/Blocks/Recommendation/utils/nodeConfigWriter.js +26 -16
- package/dist/extensions/Blocks/Recommendation/utils/partnerScope.js +26 -0
- package/dist/extensions/Blocks/Recommendation/utils/strategyCommit.js +24 -0
- package/dist/extensions/Blocks/Recommendation/validation/requiredFields.js +21 -12
- package/dist/guido.css +1 -1
- package/dist/services/recommendationApi.js +46 -37
- package/dist/src/@types/config/schemas.d.ts +32 -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/components/organisms/onboarding/RecommendationStrategyOnboarding.vue.d.ts +2 -0
- package/dist/src/composables/useConfig.d.ts +6 -0
- package/dist/src/composables/useCortexBlueprintBridge.d.ts +3 -2
- package/dist/src/composables/useEmailTemplateApplier.d.ts +5 -18
- package/dist/src/composables/useLegacyStrategyConversion.d.ts +3 -0
- package/dist/src/enums/extensions/recommendationBlock.d.ts +7 -1
- package/dist/src/extensions/Blocks/Recommendation/block.d.ts +16 -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 +10 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/main/utils.d.ts +7 -2
- package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +167 -1
- package/dist/src/extensions/Blocks/Recommendation/types/nodeConfig.d.ts +6 -0
- package/dist/src/extensions/Blocks/Recommendation/utils/legacyStrategyMigration.d.ts +32 -0
- package/dist/src/extensions/Blocks/Recommendation/utils/partnerScope.d.ts +27 -0
- package/dist/src/extensions/Blocks/Recommendation/utils/strategyCommit.d.ts +14 -0
- package/dist/src/extensions/Blocks/Recommendation/validation/requiredFields.d.ts +4 -0
- package/dist/src/services/recommendationApi.d.ts +2 -1
- package/dist/src/stores/config.d.ts +342 -0
- package/dist/src/stores/guido-email-editor.d.ts +10 -20
- package/dist/src/stores/onboarding.d.ts +808 -10
- package/dist/src/utils/stripoEditorApi.d.ts +4 -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 +113 -9
- package/dist/static/styles/components/skeleton.css.js +23 -0
- package/dist/stores/config.js +74 -60
- package/dist/stores/guido-email-editor.js +1 -3
- package/dist/stores/onboarding.js +46 -36
- package/dist/stores/unsubscribe.js +3 -3
- package/dist/utils/stripoEditorApi.js +11 -0
- package/dist/utils/templatePreparation.js +55 -55
- package/package.json +1 -1
|
@@ -1,37 +1,41 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { useConfig as
|
|
5
|
-
import { BlockId as
|
|
6
|
-
import { getMigrationBannerHtml as
|
|
7
|
-
import { Block as
|
|
8
|
-
import { CURRENT_CONFIG_VERSION as
|
|
9
|
-
import { RECOMMENDATION_ID_ATTR as
|
|
10
|
-
import { regenerateMobileProductRows as
|
|
11
|
-
import { ensureMobileCssRulesExist as
|
|
1
|
+
var D = Object.defineProperty;
|
|
2
|
+
var S = (m, c, t) => c in m ? D(m, c, { enumerable: !0, configurable: !0, writable: !0, value: t }) : m[c] = t;
|
|
3
|
+
var _ = (m, c, t) => S(m, typeof c != "symbol" ? c + "" : c, t);
|
|
4
|
+
import { useConfig as g } from "../../../composables/useConfig.js";
|
|
5
|
+
import { BlockId as T } from "../../../enums/block.js";
|
|
6
|
+
import { getMigrationBannerHtml as N } from "../../../utils/migrationBannerHtml.js";
|
|
7
|
+
import { Block as O, BlockCompositionType as M, ModificationDescription as h } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
8
|
+
import { CURRENT_CONFIG_VERSION as w, PRE_RRS_CONFIG_VERSION as v } from "./constants/defaultConfig.js";
|
|
9
|
+
import { RECOMMENDATION_ID_ATTR as d, SELECTOR_ATTRIBUTE_ROW as F, ATTR_CUSTOM_PREFIX as H, ATTR_DATA_CARD_COMPOSITION as P, ATTR_DATA_CUSTOM_ATTRIBUTES as x } from "./constants/selectors.js";
|
|
10
|
+
import { regenerateMobileProductRows as $ } from "./controls/main/utils.js";
|
|
11
|
+
import { ensureMobileCssRulesExist as C, setMobileLayoutOptOut as b, hasMobileLayoutOptOut as L } from "./controls/mobileLayout/cssRules.js";
|
|
12
12
|
import { RecommendationConfigService as s } from "./services/configService.js";
|
|
13
|
-
import { useRecommendationExtensionStore as
|
|
14
|
-
import { getDefaultTemplate as
|
|
15
|
-
import { useRecommendationBlockWarning as
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
13
|
+
import { useRecommendationExtensionStore as p } from "./store/recommendation.js";
|
|
14
|
+
import { getDefaultTemplate as q } from "./templates/grid/template.js";
|
|
15
|
+
import { useRecommendationBlockWarning as U } from "./useRecommendationBlockWarning.js";
|
|
16
|
+
import { resolveRowCompositionKey as V } from "./utils/compositionKeys.js";
|
|
17
|
+
import { carriesForeignPartnerConfig as W, loadedRecommendationIds as K, withoutCustomAttributes as z } from "./utils/partnerScope.js";
|
|
18
|
+
const y = T.Recommendation, f = "recommendation-block-v2", B = "hide-price";
|
|
19
|
+
let E = !1;
|
|
20
|
+
class at extends O {
|
|
19
21
|
constructor() {
|
|
20
22
|
super();
|
|
21
23
|
/**
|
|
22
24
|
* Stores the ID generated in getTemplate() so onCreated() can reuse it.
|
|
23
25
|
* This avoids generating a new (different) ID in onCreated().
|
|
24
26
|
*/
|
|
25
|
-
|
|
27
|
+
_(this, "_pendingBlockId", null);
|
|
28
|
+
/** Ids already reset under their new name, so the deferred pass skips their stale snapshot. */
|
|
29
|
+
_(this, "_resetSourceIds", /* @__PURE__ */ new Set());
|
|
26
30
|
}
|
|
27
31
|
getId() {
|
|
28
|
-
return
|
|
32
|
+
return y;
|
|
29
33
|
}
|
|
30
34
|
getIcon() {
|
|
31
35
|
return "recommendation-icon";
|
|
32
36
|
}
|
|
33
37
|
getBlockCompositionType() {
|
|
34
|
-
return
|
|
38
|
+
return M.CONTAINER;
|
|
35
39
|
}
|
|
36
40
|
getName() {
|
|
37
41
|
return this.api.translate("Recommendation Block");
|
|
@@ -42,8 +46,8 @@ class W extends b {
|
|
|
42
46
|
);
|
|
43
47
|
}
|
|
44
48
|
getSettingsPanelTitleHtml() {
|
|
45
|
-
return
|
|
46
|
-
|
|
49
|
+
return N(
|
|
50
|
+
y,
|
|
47
51
|
this.api.translate("Recommendation Block"),
|
|
48
52
|
this.api.translate("This block is switched from the Old Version to the New Version. We recommend you check the Recommendation block and test your message to ensure it works properly.")
|
|
49
53
|
);
|
|
@@ -66,7 +70,7 @@ class W extends b {
|
|
|
66
70
|
*/
|
|
67
71
|
getTemplate() {
|
|
68
72
|
const t = this._generateNextId();
|
|
69
|
-
return this._pendingBlockId = t,
|
|
73
|
+
return this._pendingBlockId = t, q(t);
|
|
70
74
|
}
|
|
71
75
|
/**
|
|
72
76
|
* Called when a new block is dropped into the template
|
|
@@ -79,33 +83,38 @@ class W extends b {
|
|
|
79
83
|
const e = this._getRecommendationId(t);
|
|
80
84
|
if (e !== null && e > 0) {
|
|
81
85
|
if (this._detectDuplicate(e)) {
|
|
82
|
-
this._handleDuplicate(t, e);
|
|
86
|
+
this._handleDuplicate(t, e), this._scheduleArrivalReset(t);
|
|
83
87
|
return;
|
|
84
88
|
}
|
|
85
89
|
this._pendingBlockId === null && setTimeout(() => {
|
|
86
90
|
this._getBlockElement(t) && this._detectDuplicate(e) && this._handleDuplicate(t, e);
|
|
87
|
-
}, 0);
|
|
91
|
+
}, 0), this._scheduleArrivalReset(t);
|
|
88
92
|
return;
|
|
89
93
|
}
|
|
90
94
|
const i = this._pendingBlockId ?? this._generateNextId();
|
|
91
95
|
this._pendingBlockId = null, this._assignRecommendationId(t, i);
|
|
92
|
-
const { config:
|
|
96
|
+
const n = g().isFeatureEnabled("reusableRecommendationStrategy"), o = n && !s.hasConfig(t), { config: r, wasFreshDrop: a } = s.initializeConfig(
|
|
93
97
|
this.api,
|
|
94
98
|
t,
|
|
95
99
|
{
|
|
96
100
|
recommendationId: i,
|
|
97
|
-
configVersion:
|
|
101
|
+
configVersion: n ? w : v,
|
|
102
|
+
...o ? { partnerName: g().partnerName.value } : {},
|
|
103
|
+
// An RRS block picks a strategy, not an algorithm, and its algorithm control is
|
|
104
|
+
// hidden. Keeping the `mostPopular` default would bake a most-popular feed URL
|
|
105
|
+
// at save for a block the user never configured.
|
|
106
|
+
...o ? { strategy: "" } : {}
|
|
98
107
|
}
|
|
99
|
-
),
|
|
100
|
-
if (
|
|
101
|
-
|
|
108
|
+
), u = p();
|
|
109
|
+
if (u.setCurrentBlock(i), this._stampHidePrice(t, r.priceHideIfSameAsDiscounted), a) {
|
|
110
|
+
C(this.api);
|
|
102
111
|
const l = this._getBlockElement(t);
|
|
103
|
-
l && (
|
|
112
|
+
l && (b(this.api, l, !0), $({
|
|
104
113
|
currentNode: t,
|
|
105
114
|
documentModifier: this.api.getDocumentModifier()
|
|
106
115
|
}));
|
|
107
116
|
}
|
|
108
|
-
|
|
117
|
+
u.patchCurrentBlockConfig({ language: r.language }, { triggerRefetch: !1 }), this._warnIfMultipleBlocks();
|
|
109
118
|
}
|
|
110
119
|
/**
|
|
111
120
|
* Called when the document changes or template is loaded
|
|
@@ -125,13 +134,13 @@ class W extends b {
|
|
|
125
134
|
"Assign recommendation ID to legacy block"
|
|
126
135
|
);
|
|
127
136
|
}
|
|
128
|
-
this._healLingeringDuplicate(t), s.needsMigration(t) && this._migrateFromLegacy(t), this._healHidePriceAttr(t);
|
|
137
|
+
this._healLingeringDuplicate(t), s.needsMigration(t) && this._migrateFromLegacy(t), this._healHidePriceAttr(t), this._resetForeignPartnerConfig(t);
|
|
129
138
|
try {
|
|
130
|
-
|
|
139
|
+
E || (C(this.api), E = !0);
|
|
131
140
|
const e = s.getConfig(t), i = this._getBlockElement(t);
|
|
132
141
|
if (i) {
|
|
133
142
|
const n = !e.mobileLayoutEnabled;
|
|
134
|
-
|
|
143
|
+
L(i) !== n && b(this.api, i, n);
|
|
135
144
|
}
|
|
136
145
|
} catch {
|
|
137
146
|
}
|
|
@@ -145,7 +154,7 @@ class W extends b {
|
|
|
145
154
|
*/
|
|
146
155
|
onDelete(t) {
|
|
147
156
|
const e = this._getRecommendationId(t);
|
|
148
|
-
e &&
|
|
157
|
+
e && p().removeBlockState(e);
|
|
149
158
|
}
|
|
150
159
|
/**
|
|
151
160
|
* Warns (dark advisory toaster) when the design holds more than one live
|
|
@@ -161,7 +170,7 @@ class W extends b {
|
|
|
161
170
|
*/
|
|
162
171
|
_warnIfMultipleBlocks() {
|
|
163
172
|
try {
|
|
164
|
-
|
|
173
|
+
U().warnIfMultipleBlocks(this.api.getDocumentRootHtmlNode());
|
|
165
174
|
} catch {
|
|
166
175
|
}
|
|
167
176
|
}
|
|
@@ -173,9 +182,9 @@ class W extends b {
|
|
|
173
182
|
let t = 0;
|
|
174
183
|
try {
|
|
175
184
|
const e = this.api.getDocumentRoot();
|
|
176
|
-
e && "querySelectorAll" in e && e.querySelectorAll(`.${
|
|
185
|
+
e && "querySelectorAll" in e && e.querySelectorAll(`.${f}`).forEach((n) => {
|
|
177
186
|
if ("getAttribute" in n) {
|
|
178
|
-
const o = n.getAttribute(
|
|
187
|
+
const o = n.getAttribute(d), r = o ? parseInt(o) : 0;
|
|
179
188
|
r > t && (t = r);
|
|
180
189
|
}
|
|
181
190
|
});
|
|
@@ -183,6 +192,19 @@ class W extends b {
|
|
|
183
192
|
}
|
|
184
193
|
return t + 1;
|
|
185
194
|
}
|
|
195
|
+
/**
|
|
196
|
+
* Drops the "already fetched" claims of a block that arrived holding a baked id
|
|
197
|
+
* (saved module, paste, duplicate), so the settings panel reads its strategy again.
|
|
198
|
+
*
|
|
199
|
+
* Deferred a tick: the collision handlers rename a sibling first, and either sibling can be
|
|
200
|
+
* the renamed one depending on where the module was dropped (SD-149916).
|
|
201
|
+
*/
|
|
202
|
+
_scheduleArrivalReset(t) {
|
|
203
|
+
g().isFeatureEnabled("reusableRecommendationStrategy") && setTimeout(() => {
|
|
204
|
+
const e = this._getRecommendationId(t);
|
|
205
|
+
e !== null && e > 0 && !this._resetSourceIds.delete(e) && p().resetArrivedBlock(e);
|
|
206
|
+
}, 0);
|
|
207
|
+
}
|
|
186
208
|
/**
|
|
187
209
|
* Heals a duplicate that slipped past the create-time `_detectDuplicate`
|
|
188
210
|
* scan (or that was persisted by an older template before SD-142352).
|
|
@@ -203,7 +225,7 @@ class W extends b {
|
|
|
203
225
|
if (!i || !("querySelectorAll" in i))
|
|
204
226
|
return;
|
|
205
227
|
const n = i.querySelectorAll(
|
|
206
|
-
`.${
|
|
228
|
+
`.${f}[${d}="${e}"]`
|
|
207
229
|
);
|
|
208
230
|
if (n.length <= 1)
|
|
209
231
|
return;
|
|
@@ -211,9 +233,9 @@ class W extends b {
|
|
|
211
233
|
if (!o)
|
|
212
234
|
return;
|
|
213
235
|
let r = -1;
|
|
214
|
-
for (let
|
|
215
|
-
if (n[
|
|
216
|
-
r =
|
|
236
|
+
for (let a = 0; a < n.length; a++)
|
|
237
|
+
if (n[a] === o) {
|
|
238
|
+
r = a;
|
|
217
239
|
break;
|
|
218
240
|
}
|
|
219
241
|
if (r <= 0)
|
|
@@ -228,7 +250,7 @@ class W extends b {
|
|
|
228
250
|
const e = this.api.getDocumentRoot();
|
|
229
251
|
if (e && "querySelectorAll" in e)
|
|
230
252
|
return e.querySelectorAll(
|
|
231
|
-
`.${
|
|
253
|
+
`.${f}[${d}="${t}"]`
|
|
232
254
|
).length > 1;
|
|
233
255
|
} catch {
|
|
234
256
|
}
|
|
@@ -236,8 +258,8 @@ class W extends b {
|
|
|
236
258
|
}
|
|
237
259
|
/** Assigns a fresh id to a duplicated block and syncs DOM, node config and store. */
|
|
238
260
|
_handleDuplicate(t, e) {
|
|
239
|
-
const i = this._reassignDuplicateId(t, e), n =
|
|
240
|
-
n.cloneBlockState(e, i), n.setCurrentBlock(i), this._warnIfMultipleBlocks();
|
|
261
|
+
const i = this._reassignDuplicateId(t, e), n = p();
|
|
262
|
+
n.cloneBlockState(e, i), n.setCurrentBlock(i), g().isFeatureEnabled("reusableRecommendationStrategy") && (this._resetSourceIds.add(e), n.resetArrivedBlock(i)), this._warnIfMultipleBlocks();
|
|
241
263
|
}
|
|
242
264
|
/**
|
|
243
265
|
* Core id-reassignment for a duplicated block: rewrites the DOM
|
|
@@ -270,7 +292,7 @@ class W extends b {
|
|
|
270
292
|
if (!("getAttribute" in t))
|
|
271
293
|
return;
|
|
272
294
|
const n = `ins-recommendation-v3-block-${e}`, o = `ins-recommendation-v3-block-${i}`, r = this.api.getDocumentModifier();
|
|
273
|
-
r.modifyHtml(t).removeClass(n).setClass(o), r.apply(new
|
|
295
|
+
r.modifyHtml(t).removeClass(n).setClass(o), r.apply(new h(
|
|
274
296
|
`Reassign recommendation instance class ${n} -> ${o}`
|
|
275
297
|
));
|
|
276
298
|
}
|
|
@@ -285,7 +307,7 @@ class W extends b {
|
|
|
285
307
|
if (!i)
|
|
286
308
|
return;
|
|
287
309
|
const n = this.api.getDocumentModifier();
|
|
288
|
-
n.modifyHtml(i).setAttribute(
|
|
310
|
+
n.modifyHtml(i).setAttribute(d, e.toString()), n.apply(new h(`Assign recommendation ID ${e}`));
|
|
289
311
|
}
|
|
290
312
|
/**
|
|
291
313
|
* Stamps the `hide-price` attribute (read by email-service at send time) on
|
|
@@ -293,7 +315,7 @@ class W extends b {
|
|
|
293
315
|
*/
|
|
294
316
|
_stampHidePrice(t, e) {
|
|
295
317
|
const i = this._getBlockElement(t);
|
|
296
|
-
i && this.api.getDocumentModifier().modifyHtml(i).setAttribute(
|
|
318
|
+
i && this.api.getDocumentModifier().modifyHtml(i).setAttribute(B, String(e)).apply(new h("Stamp hide-price"));
|
|
297
319
|
}
|
|
298
320
|
/**
|
|
299
321
|
* Stamps `hide-price` from config only when the block lacks the attribute —
|
|
@@ -301,11 +323,43 @@ class W extends b {
|
|
|
301
323
|
*/
|
|
302
324
|
_healHidePriceAttr(t) {
|
|
303
325
|
const e = this._getBlockElement(t);
|
|
304
|
-
if (!e || !("getAttribute" in e) || e.getAttribute(
|
|
326
|
+
if (!e || !("getAttribute" in e) || e.getAttribute(B) !== null)
|
|
305
327
|
return;
|
|
306
328
|
const { priceHideIfSameAsDiscounted: i } = s.getConfig(t);
|
|
307
329
|
this._stampHidePrice(t, i);
|
|
308
330
|
}
|
|
331
|
+
/**
|
|
332
|
+
* Empties a block copied in from another account: its strategy and attribute types
|
|
333
|
+
* are account-scoped and would not resolve here (SD-151945). Layout, locale and
|
|
334
|
+
* currency stay. The write stamps the current account, so the next pass is a no-op.
|
|
335
|
+
*/
|
|
336
|
+
_resetForeignPartnerConfig(t) {
|
|
337
|
+
var I, R;
|
|
338
|
+
const e = this._getRecommendationId(t), i = this._getBlockElement(t);
|
|
339
|
+
if (e === null || !i || !s.hasConfig(t))
|
|
340
|
+
return;
|
|
341
|
+
const { partnerName: n, template: o } = g(), r = s.getConfig(t);
|
|
342
|
+
if (!W({
|
|
343
|
+
config: r,
|
|
344
|
+
blockId: e,
|
|
345
|
+
partnerName: n.value,
|
|
346
|
+
campaignUrls: (I = o.value) == null ? void 0 : I.recommendationCampaignUrls,
|
|
347
|
+
loadedIds: K(((R = o.value) == null ? void 0 : R.html) ?? "")
|
|
348
|
+
}))
|
|
349
|
+
return;
|
|
350
|
+
const u = z(r.composition), l = this.api.getDocumentModifier();
|
|
351
|
+
i.querySelectorAll(F).forEach((k) => {
|
|
352
|
+
var A;
|
|
353
|
+
(A = V(k)) != null && A.startsWith(H) && l.modifyHtml(k).delete();
|
|
354
|
+
}), l.modifyHtml(i).setAttribute(P, u.join(",")).setAttribute(x, "[]"), s.stageConfig(l, t, {
|
|
355
|
+
strategyId: "",
|
|
356
|
+
strategy: "",
|
|
357
|
+
filters: [],
|
|
358
|
+
productIds: [],
|
|
359
|
+
composition: u,
|
|
360
|
+
partnerName: n.value
|
|
361
|
+
}), l.apply(new h("Reset recommendation block copied from another account")), p().resetPartnerScopedConfig(e);
|
|
362
|
+
}
|
|
309
363
|
/**
|
|
310
364
|
* Gets the recommendation-id from a block node
|
|
311
365
|
*/
|
|
@@ -313,7 +367,7 @@ class W extends b {
|
|
|
313
367
|
const e = this._getBlockElement(t);
|
|
314
368
|
if (!e || !("getAttribute" in e))
|
|
315
369
|
return null;
|
|
316
|
-
const i = e.getAttribute(
|
|
370
|
+
const i = e.getAttribute(d);
|
|
317
371
|
if (!i)
|
|
318
372
|
return null;
|
|
319
373
|
const n = parseInt(i);
|
|
@@ -325,10 +379,10 @@ class W extends b {
|
|
|
325
379
|
_getBlockElement(t) {
|
|
326
380
|
if ("getAttribute" in t) {
|
|
327
381
|
const e = t.getAttribute("class");
|
|
328
|
-
if (e && e.includes(
|
|
382
|
+
if (e && e.includes(f))
|
|
329
383
|
return t;
|
|
330
384
|
}
|
|
331
|
-
return "querySelector" in t ? t.querySelector(`.${
|
|
385
|
+
return "querySelector" in t ? t.querySelector(`.${f}`) ?? null : null;
|
|
332
386
|
}
|
|
333
387
|
/**
|
|
334
388
|
* Migrate configuration from legacy format
|
|
@@ -338,6 +392,6 @@ class W extends b {
|
|
|
338
392
|
}
|
|
339
393
|
}
|
|
340
394
|
export {
|
|
341
|
-
|
|
342
|
-
|
|
395
|
+
y as BLOCK_ID,
|
|
396
|
+
at as RecommendationBlock
|
|
343
397
|
};
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { DEFAULT_COLUMN_SPACING as
|
|
2
|
-
import { ATTR_PRODUCT_IMAGE as o, ATTR_PRODUCT_NAME as t, ATTR_PRODUCT_OLD_PRICE as _, ATTR_PRODUCT_PRICE as T, ATTR_PRODUCT_OMNIBUS_PRICE as
|
|
3
|
-
const
|
|
1
|
+
import { DEFAULT_COLUMN_SPACING as i, DEFAULT_ROW_SPACING as s, DEFAULT_MOBILE_ROW_SPACING as n, DEFAULT_MOBILE_COLUMN_SPACING as O, DEFAULT_MOBILE_CARDS_IN_ROW as e, DEFAULT_CARDS_IN_ROW as C } from "./layout.js";
|
|
2
|
+
import { ATTR_PRODUCT_IMAGE as o, ATTR_PRODUCT_NAME as t, ATTR_PRODUCT_OLD_PRICE as _, ATTR_PRODUCT_PRICE as T, ATTR_PRODUCT_OMNIBUS_PRICE as I, ATTR_PRODUCT_OMNIBUS_DISCOUNT as R, ATTR_PRODUCT_BUTTON as r, ATTR_RECOMMENDATION_TITLE as E } from "./selectors.js";
|
|
3
|
+
const U = 1, u = 2, m = 2, A = {
|
|
4
4
|
code: "USD",
|
|
5
5
|
symbol: "USD",
|
|
6
6
|
alignment: "after",
|
|
7
7
|
decimalCount: 2,
|
|
8
8
|
decimalSeparator: ".",
|
|
9
9
|
thousandSeparator: ","
|
|
10
|
-
},
|
|
10
|
+
}, D = {
|
|
11
11
|
textBefore: "",
|
|
12
12
|
textAfter: ""
|
|
13
13
|
}, a = {
|
|
@@ -18,26 +18,26 @@ const A = 1, u = 2, D = {
|
|
|
18
18
|
t,
|
|
19
19
|
_,
|
|
20
20
|
T,
|
|
21
|
-
r,
|
|
22
21
|
I,
|
|
23
|
-
|
|
22
|
+
R,
|
|
23
|
+
r
|
|
24
24
|
], N = {
|
|
25
|
-
[
|
|
25
|
+
[E]: !0,
|
|
26
26
|
[o]: !0,
|
|
27
27
|
[t]: !0,
|
|
28
28
|
[T]: !0,
|
|
29
29
|
[_]: !0,
|
|
30
|
-
[r]: !1,
|
|
31
30
|
[I]: !1,
|
|
32
|
-
[
|
|
33
|
-
|
|
31
|
+
[R]: !1,
|
|
32
|
+
[r]: !0
|
|
33
|
+
}, L = {
|
|
34
34
|
// Settings
|
|
35
35
|
strategy: "mostPopular",
|
|
36
36
|
productIds: [],
|
|
37
37
|
size: "6",
|
|
38
38
|
shuffleProducts: !1,
|
|
39
39
|
language: "en_US",
|
|
40
|
-
currency:
|
|
40
|
+
currency: A,
|
|
41
41
|
filters: [],
|
|
42
42
|
strategyId: "",
|
|
43
43
|
// Layout
|
|
@@ -46,7 +46,7 @@ const A = 1, u = 2, D = {
|
|
|
46
46
|
mobileCardsInRow: e,
|
|
47
47
|
mobileLayoutEnabled: !1,
|
|
48
48
|
previousMobileCardsInRow: e,
|
|
49
|
-
columnSpacing:
|
|
49
|
+
columnSpacing: i,
|
|
50
50
|
rowSpacing: s,
|
|
51
51
|
mobileColumnSpacing: O,
|
|
52
52
|
mobileRowSpacing: n,
|
|
@@ -55,7 +55,7 @@ const A = 1, u = 2, D = {
|
|
|
55
55
|
visibility: N,
|
|
56
56
|
previousTitleHtml: "",
|
|
57
57
|
// Element settings
|
|
58
|
-
omnibusPrice:
|
|
58
|
+
omnibusPrice: D,
|
|
59
59
|
omnibusDiscount: a,
|
|
60
60
|
textTrimming: !1,
|
|
61
61
|
// Price placement (block-level, affects all cards)
|
|
@@ -66,17 +66,18 @@ const A = 1, u = 2, D = {
|
|
|
66
66
|
// of "false" (the actual hiding happens server-side at send).
|
|
67
67
|
priceHideIfSameAsDiscounted: !1,
|
|
68
68
|
// Meta
|
|
69
|
-
configVersion:
|
|
69
|
+
configVersion: U,
|
|
70
70
|
recommendationId: 0
|
|
71
|
-
},
|
|
71
|
+
}, P = [11, 12];
|
|
72
72
|
export {
|
|
73
73
|
u as CURRENT_CONFIG_VERSION,
|
|
74
74
|
c as DEFAULT_COMPOSITION,
|
|
75
|
-
|
|
76
|
-
|
|
75
|
+
A as DEFAULT_CURRENCY,
|
|
76
|
+
L as DEFAULT_NODE_CONFIG,
|
|
77
77
|
a as DEFAULT_OMNIBUS_DISCOUNT,
|
|
78
|
-
|
|
78
|
+
D as DEFAULT_OMNIBUS_PRICE,
|
|
79
79
|
N as DEFAULT_VISIBILITY,
|
|
80
|
-
|
|
81
|
-
|
|
80
|
+
P as EXCLUDED_ALGORITHM_IDS,
|
|
81
|
+
U as PRE_RRS_CONFIG_VERSION,
|
|
82
|
+
m as RRS_CONFIG_VERSION
|
|
82
83
|
};
|