@useinsider/guido 3.6.0-beta.3eeb930 → 3.6.0-beta.859e737
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/composables/useRecommendation.js +33 -34
- package/dist/extensions/Blocks/Recommendation/controls/main/index.js +51 -47
- package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +1 -1
- package/dist/extensions/Blocks/Recommendation/store/recommendation.js +9 -13
- package/dist/src/utils/templatePreparation.d.ts +16 -0
- package/dist/src/utils/templatePreparation.test.d.ts +1 -0
- package/dist/utils/templatePreparation.js +58 -57
- package/package.json +1 -1
- package/dist/extensions/Blocks/Recommendation/utils/partnerCustomizations.js +0 -21
- package/dist/src/extensions/Blocks/Recommendation/utils/partnerCustomizations.d.ts +0 -7
|
@@ -1,22 +1,21 @@
|
|
|
1
|
-
import { getRecommendationFeedSourceMaps as I, URLS as
|
|
2
|
-
import { MinDeviceViewport as
|
|
3
|
-
import { useRecommendationExtensionStore as
|
|
1
|
+
import { getRecommendationFeedSourceMaps as I, URLS as C } from "../enums/extensions/recommendationBlock.js";
|
|
2
|
+
import { MinDeviceViewport as R, DefaultPadding as b } from "../enums/recommendation.js";
|
|
3
|
+
import { useRecommendationExtensionStore as m } from "../extensions/Blocks/Recommendation/store/recommendation.js";
|
|
4
4
|
import { generateCompleteFilterQuery as h } from "../extensions/Blocks/Recommendation/utils/filterUtil.js";
|
|
5
|
-
import { getPartnerRecommendationParams as y } from "../extensions/Blocks/Recommendation/utils/partnerCustomizations.js";
|
|
6
5
|
import { useConfigStore as x } from "../stores/config.js";
|
|
7
|
-
const
|
|
6
|
+
const w = () => ({
|
|
8
7
|
calculateCardWidth: ({
|
|
9
|
-
mobileLeftPadding:
|
|
8
|
+
mobileLeftPadding: o,
|
|
10
9
|
mobileRightPadding: s,
|
|
11
|
-
cardsInRow:
|
|
12
|
-
unresponsive:
|
|
10
|
+
cardsInRow: a,
|
|
11
|
+
unresponsive: n
|
|
13
12
|
}) => {
|
|
14
|
-
const r =
|
|
15
|
-
return (
|
|
13
|
+
const r = n ? a : 1, e = o + s + (r - 1) * b;
|
|
14
|
+
return (R - e) / r;
|
|
16
15
|
},
|
|
17
|
-
getRecommendationCampaignData: (
|
|
18
|
-
const s =
|
|
19
|
-
if (!
|
|
16
|
+
getRecommendationCampaignData: (o) => {
|
|
17
|
+
const s = m(), a = Number(o), n = s.blockStates[a];
|
|
18
|
+
if (!n)
|
|
20
19
|
return {
|
|
21
20
|
textTrimming: !1,
|
|
22
21
|
orientation: "vertical",
|
|
@@ -29,7 +28,7 @@ const k = () => ({
|
|
|
29
28
|
discountBeforeTextValue: "",
|
|
30
29
|
discountAfterTextValue: ""
|
|
31
30
|
};
|
|
32
|
-
const { recommendationConfigs: r } =
|
|
31
|
+
const { recommendationConfigs: r } = n, e = r.orientation === "grid" ? "vertical" : "horizontal";
|
|
33
32
|
return {
|
|
34
33
|
textTrimming: r.textTrimming,
|
|
35
34
|
orientation: e,
|
|
@@ -43,35 +42,35 @@ const k = () => ({
|
|
|
43
42
|
discountAfterTextValue: ""
|
|
44
43
|
};
|
|
45
44
|
},
|
|
46
|
-
buildCampaignUrl: (
|
|
47
|
-
var
|
|
48
|
-
const
|
|
45
|
+
buildCampaignUrl: (o, s) => {
|
|
46
|
+
var l;
|
|
47
|
+
const a = m(), n = x(), r = Number(o);
|
|
49
48
|
let e;
|
|
50
49
|
if (s)
|
|
51
50
|
e = s;
|
|
52
51
|
else {
|
|
53
|
-
const
|
|
54
|
-
if (!
|
|
52
|
+
const c = a.blockStates[r];
|
|
53
|
+
if (!c)
|
|
55
54
|
return "";
|
|
56
|
-
const { recommendationConfigs:
|
|
55
|
+
const { recommendationConfigs: i } = c;
|
|
57
56
|
e = {
|
|
58
|
-
strategy:
|
|
59
|
-
language:
|
|
60
|
-
currencyCode:
|
|
61
|
-
size:
|
|
62
|
-
productIds:
|
|
63
|
-
filters:
|
|
64
|
-
shuffleProducts:
|
|
57
|
+
strategy: i.strategy,
|
|
58
|
+
language: i.language,
|
|
59
|
+
currencyCode: i.currencySettings.value,
|
|
60
|
+
size: i.size,
|
|
61
|
+
productIds: i.productIds,
|
|
62
|
+
filters: i.filters,
|
|
63
|
+
shuffleProducts: i.shuffleProducts
|
|
65
64
|
};
|
|
66
65
|
}
|
|
67
|
-
const f = ((
|
|
68
|
-
t.set("locale", e.language), t.set("currency", e.currencyCode), t.set("partnerName",
|
|
69
|
-
const g = e.filters.filter((
|
|
70
|
-
d && t.set("filter", d), e.shuffleProducts && t.set("shuffle", "true")
|
|
71
|
-
const p = decodeURIComponent(t.toString()), u = `${
|
|
72
|
-
return
|
|
66
|
+
const f = ((l = I().find((c) => c.key === e.strategy)) == null ? void 0 : l.path) || "", t = new URLSearchParams();
|
|
67
|
+
t.set("locale", e.language), t.set("currency", e.currencyCode), t.set("partnerName", n.partnerName), t.set("size", e.size), t.set("details", "true"), t.set("campaignId", n.variationId), e.strategy === "manualMerchandising" ? t.set("productId", e.productIds.join(",")) : e.strategy === "similarViewed" && t.set("productId", "{itemId}"), e.strategy === "userBased" && t.set("userId", "{user_id}");
|
|
68
|
+
const g = e.filters.filter((c) => c.isValid), d = h(g);
|
|
69
|
+
d && t.set("filter", d), e.shuffleProducts && t.set("shuffle", "true");
|
|
70
|
+
const p = decodeURIComponent(t.toString()), u = `${C.RECOMMENDATION_API_URL}/v2/${f}?${p}`;
|
|
71
|
+
return a.recommendationCampaignUrls[o] = u, u;
|
|
73
72
|
}
|
|
74
73
|
});
|
|
75
74
|
export {
|
|
76
|
-
|
|
75
|
+
w as useRecommendation
|
|
77
76
|
};
|
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
var
|
|
2
|
-
var p = (d,
|
|
3
|
-
var s = (d,
|
|
1
|
+
var C = Object.defineProperty;
|
|
2
|
+
var p = (d, c, t) => c in d ? C(d, c, { enumerable: !0, configurable: !0, writable: !0, value: t }) : d[c] = t;
|
|
3
|
+
var s = (d, c, t) => p(d, typeof c != "symbol" ? c + "" : c, t);
|
|
4
4
|
import { CommonControl as g } from "../../../common-control.js";
|
|
5
5
|
import { DEFAULT_NODE_CONFIG as a } from "../../constants/defaultConfig.js";
|
|
6
6
|
import { RecommendationConfigService as h } from "../../services/configService.js";
|
|
7
7
|
import { useRecommendationExtensionStore as y } from "../../store/recommendation.js";
|
|
8
|
-
import { AlgorithmControl as
|
|
9
|
-
import { ALGORITHM_CONTROL_ID as
|
|
10
|
-
import { CurrencyControl as
|
|
11
|
-
import { CURRENCY_CONTROL_ID as
|
|
8
|
+
import { AlgorithmControl as N } from "./algorithm.js";
|
|
9
|
+
import { ALGORITHM_CONTROL_ID as Q } from "./algorithm.js";
|
|
10
|
+
import { CurrencyControl as R } from "./currency.js";
|
|
11
|
+
import { CURRENCY_CONTROL_ID as Z } from "./currency.js";
|
|
12
12
|
import { FiltersControl as _ } from "./filters.js";
|
|
13
|
-
import { FILTERS_CONTROL_ID as
|
|
13
|
+
import { FILTERS_CONTROL_ID as et } from "./filters.js";
|
|
14
14
|
import { LayoutOrientationControl as b } from "./layoutOrientation.js";
|
|
15
|
-
import { LAYOUT_ORIENTATION_CONTROL_ID as
|
|
15
|
+
import { LAYOUT_ORIENTATION_CONTROL_ID as rt } from "./layoutOrientation.js";
|
|
16
16
|
import { LocaleControl as O } from "./locale.js";
|
|
17
|
-
import { LOCALE_CONTROL_ID as
|
|
17
|
+
import { LOCALE_CONTROL_ID as it } from "./locale.js";
|
|
18
18
|
import { ProductCountControl as I } from "./productCount.js";
|
|
19
|
-
import { PRODUCT_COUNT_CONTROL_ID as
|
|
19
|
+
import { PRODUCT_COUNT_CONTROL_ID as at } from "./productCount.js";
|
|
20
20
|
import { ProductLayoutControl as T } from "./productLayout.js";
|
|
21
21
|
import { PRODUCT_LAYOUT_CONTROL_ID as lt } from "./productLayout.js";
|
|
22
22
|
import { ShuffleControl as S } from "./shuffle.js";
|
|
23
|
-
import { SHUFFLE_CONTROL_ID as
|
|
24
|
-
import {
|
|
25
|
-
import { adjustProductsToSize as
|
|
23
|
+
import { SHUFFLE_CONTROL_ID as dt } from "./shuffle.js";
|
|
24
|
+
import { setCurrencyAttributes as L, getBlockElement as P, updateProductContentInPlace as D, regenerateProductRowsWithStyles as k } from "./utils.js";
|
|
25
|
+
import { adjustProductsToSize as mt, formatProductPrice as ft, getCardComposition as Ct, getCurrentLayout as pt, reapplySpacing as gt, regenerateMobileProductRows as yt, regenerateProductRows as Nt, updatePricesInPlace as Rt, updateSingleProductContent as _t } from "./utils.js";
|
|
26
26
|
import { useDebounceFn as m } from "../../../../../node_modules/@vueuse/shared/index.js";
|
|
27
|
-
const
|
|
28
|
-
class
|
|
27
|
+
const E = "recommendation-id", v = "ui-elements-recommendation-block";
|
|
28
|
+
class K extends g {
|
|
29
29
|
constructor() {
|
|
30
30
|
super(...arguments);
|
|
31
31
|
s(this, "store", y());
|
|
@@ -62,11 +62,11 @@ class H extends g {
|
|
|
62
62
|
if (!this.currentNode || !this.api)
|
|
63
63
|
return;
|
|
64
64
|
const e = this.api.getDocumentModifier();
|
|
65
|
-
|
|
65
|
+
D({
|
|
66
66
|
currentNode: this.currentNode,
|
|
67
67
|
documentModifier: e,
|
|
68
68
|
products: t
|
|
69
|
-
}) ||
|
|
69
|
+
}) || k({
|
|
70
70
|
currentNode: this.currentNode,
|
|
71
71
|
documentModifier: e,
|
|
72
72
|
products: t
|
|
@@ -74,10 +74,10 @@ class H extends g {
|
|
|
74
74
|
}, 100));
|
|
75
75
|
}
|
|
76
76
|
getId() {
|
|
77
|
-
return
|
|
77
|
+
return v;
|
|
78
78
|
}
|
|
79
79
|
getTemplate() {
|
|
80
|
-
return this.algorithmControl = new
|
|
80
|
+
return this.algorithmControl = new N(), this.localeControl = new O(), this.currencyControl = new R(), this.productCountControl = new I(), this.productLayoutControl = new T(), this.filtersControl = new _(), this.shuffleControl = new S(), this.layoutOrientationControl = new b(), [
|
|
81
81
|
this.algorithmControl,
|
|
82
82
|
this.localeControl,
|
|
83
83
|
this.currencyControl,
|
|
@@ -263,7 +263,11 @@ class H extends g {
|
|
|
263
263
|
this.currentNode,
|
|
264
264
|
e,
|
|
265
265
|
"Applied smart defaults"
|
|
266
|
-
),
|
|
266
|
+
), o && e.currency && L({
|
|
267
|
+
currentNode: this.currentNode,
|
|
268
|
+
documentModifier: this.api.getDocumentModifier(),
|
|
269
|
+
currency: e.currency
|
|
270
|
+
}), this.store.patchCurrentBlockConfig({
|
|
267
271
|
...o ? {
|
|
268
272
|
currencySettings: {
|
|
269
273
|
name: o,
|
|
@@ -283,10 +287,10 @@ class H extends g {
|
|
|
283
287
|
* Reads the recommendation-id attribute from the block element within the node
|
|
284
288
|
*/
|
|
285
289
|
_getRecommendationIdFromNode(t) {
|
|
286
|
-
const e =
|
|
290
|
+
const e = P(t);
|
|
287
291
|
if (!e || !("getAttribute" in e))
|
|
288
292
|
return null;
|
|
289
|
-
const o = e.getAttribute(
|
|
293
|
+
const o = e.getAttribute(E);
|
|
290
294
|
if (!o)
|
|
291
295
|
return null;
|
|
292
296
|
const r = parseInt(o);
|
|
@@ -316,8 +320,8 @@ class H extends g {
|
|
|
316
320
|
}
|
|
317
321
|
const i = t.$state.configVersion;
|
|
318
322
|
i !== o && (o = i, this._persistFiltersToNodeConfig(), this._debouncedFetchProducts());
|
|
319
|
-
const
|
|
320
|
-
u &&
|
|
323
|
+
const l = t.recommendationProducts, u = l !== e, f = Array.isArray(l) && l.length > 0;
|
|
324
|
+
u && f && (e = l, this._debouncedRegenerateWithProducts());
|
|
321
325
|
});
|
|
322
326
|
}
|
|
323
327
|
/**
|
|
@@ -337,35 +341,35 @@ class H extends g {
|
|
|
337
341
|
}
|
|
338
342
|
}
|
|
339
343
|
export {
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
344
|
+
Q as ALGORITHM_CONTROL_ID,
|
|
345
|
+
N as AlgorithmControl,
|
|
346
|
+
v as CONTROL_BLOCK_ID,
|
|
347
|
+
Z as CURRENCY_CONTROL_ID,
|
|
348
|
+
R as CurrencyControl,
|
|
349
|
+
et as FILTERS_CONTROL_ID,
|
|
346
350
|
_ as FiltersControl,
|
|
347
|
-
|
|
348
|
-
|
|
351
|
+
rt as LAYOUT_ORIENTATION_CONTROL_ID,
|
|
352
|
+
it as LOCALE_CONTROL_ID,
|
|
349
353
|
b as LayoutOrientationControl,
|
|
350
354
|
O as LocaleControl,
|
|
351
|
-
|
|
355
|
+
at as PRODUCT_COUNT_CONTROL_ID,
|
|
352
356
|
lt as PRODUCT_LAYOUT_CONTROL_ID,
|
|
353
357
|
I as ProductCountControl,
|
|
354
358
|
T as ProductLayoutControl,
|
|
355
|
-
|
|
356
|
-
|
|
359
|
+
K as RecommendationBlockControl,
|
|
360
|
+
dt as SHUFFLE_CONTROL_ID,
|
|
357
361
|
S as ShuffleControl,
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
362
|
+
mt as adjustProductsToSize,
|
|
363
|
+
ft as formatProductPrice,
|
|
364
|
+
P as getBlockElement,
|
|
361
365
|
Ct as getCardComposition,
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
366
|
+
pt as getCurrentLayout,
|
|
367
|
+
gt as reapplySpacing,
|
|
368
|
+
yt as regenerateMobileProductRows,
|
|
369
|
+
Nt as regenerateProductRows,
|
|
370
|
+
k as regenerateProductRowsWithStyles,
|
|
371
|
+
L as setCurrencyAttributes,
|
|
372
|
+
Rt as updatePricesInPlace,
|
|
373
|
+
D as updateProductContentInPlace,
|
|
370
374
|
_t as updateSingleProductContent
|
|
371
375
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ModificationDescription as p } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
2
2
|
import { RecommendationBlockId as m } from "../../constants/blockIds.js";
|
|
3
|
-
import {
|
|
3
|
+
import { CURRENCY_ATTR as y, MOBILE_CONTAINER_SELECTOR as q, MOBILE_ROW_SELECTOR as k, DESKTOP_CONTAINER_SELECTOR as P, CONTAINER_SELECTOR as v, ATTR_PRODUCT_ATTR as W } from "../../constants/selectors.js";
|
|
4
4
|
import { RecommendationConfigService as E } from "../../services/configService.js";
|
|
5
5
|
import { useRecommendationExtensionStore as C } from "../../store/recommendation.js";
|
|
6
6
|
import { prepareProductRows as _ } from "../../templates/index.js";
|
|
@@ -6,9 +6,8 @@ import { DEFAULT_CARDS_IN_ROW as F } from "../constants/layout.js";
|
|
|
6
6
|
import { EXCLUDED_ALGORITHM_IDS as D } from "../constants/defaultConfig.js";
|
|
7
7
|
import { getDefaultProducts as S } from "../templates/utils.js";
|
|
8
8
|
import { generateCompleteFilterQuery as b } from "../utils/filterUtil.js";
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import { isConfigValid as N } from "../validation/requiredFields.js";
|
|
9
|
+
import { isFilterValid as v } from "../validation/filterSchema.js";
|
|
10
|
+
import { isConfigValid as w } from "../validation/requiredFields.js";
|
|
12
11
|
const h = y();
|
|
13
12
|
let m = null, u = null, d = null;
|
|
14
13
|
function I() {
|
|
@@ -50,7 +49,7 @@ function k() {
|
|
|
50
49
|
filterSnapshot: null
|
|
51
50
|
};
|
|
52
51
|
}
|
|
53
|
-
const
|
|
52
|
+
const N = () => ({
|
|
54
53
|
recommendationCampaignUrls: {},
|
|
55
54
|
activePredictiveAlgorithms: [],
|
|
56
55
|
languages: {},
|
|
@@ -59,8 +58,8 @@ const x = () => ({
|
|
|
59
58
|
blockStates: {},
|
|
60
59
|
currentRecommendationId: null,
|
|
61
60
|
configVersion: 0
|
|
62
|
-
}),
|
|
63
|
-
state: () =>
|
|
61
|
+
}), M = P("guidoRecommendationExtension", {
|
|
62
|
+
state: () => N(),
|
|
64
63
|
getters: {
|
|
65
64
|
// ====================================================================
|
|
66
65
|
// Proxy Getters — Backward Compatible Access to Current Block State
|
|
@@ -379,7 +378,7 @@ const x = () => ({
|
|
|
379
378
|
const n = [...e.recommendationConfigs.filters];
|
|
380
379
|
n[r] = {
|
|
381
380
|
...t,
|
|
382
|
-
isValid:
|
|
381
|
+
isValid: v(t)
|
|
383
382
|
}, e.recommendationConfigs.filters = n;
|
|
384
383
|
}
|
|
385
384
|
},
|
|
@@ -425,7 +424,7 @@ const x = () => ({
|
|
|
425
424
|
* every block's recommendationConfigs across user edits.
|
|
426
425
|
*/
|
|
427
426
|
hasInvalidBlock() {
|
|
428
|
-
return Object.values(this.blockStates).some((t) => !
|
|
427
|
+
return Object.values(this.blockStates).some((t) => !w(t.recommendationConfigs, this));
|
|
429
428
|
},
|
|
430
429
|
// ====================================================================
|
|
431
430
|
// Per-Block Product Fetching
|
|
@@ -454,10 +453,7 @@ const x = () => ({
|
|
|
454
453
|
details: !0,
|
|
455
454
|
campaignId: o.variationId
|
|
456
455
|
};
|
|
457
|
-
r.strategy === "manualMerchandising" ? a.productId = r.productIds.join(",") : r.strategy === "similarViewed" && (a.productId = "{itemId}"), r.strategy === "userBased" && (a.userId = "{user_id}"), c && (a.filter = c), r.shuffleProducts && (a.shuffle = !0)
|
|
458
|
-
a,
|
|
459
|
-
v(o.partnerName, r.strategy)
|
|
460
|
-
);
|
|
456
|
+
r.strategy === "manualMerchandising" ? a.productId = r.productIds.join(",") : r.strategy === "similarViewed" && (a.productId = "{itemId}"), r.strategy === "userBased" && (a.userId = "{user_id}"), c && (a.filter = c), r.shuffleProducts && (a.shuffle = !0);
|
|
461
457
|
let f;
|
|
462
458
|
try {
|
|
463
459
|
f = await h.fetchRecommendationProducts(i, a);
|
|
@@ -475,5 +471,5 @@ const x = () => ({
|
|
|
475
471
|
}
|
|
476
472
|
});
|
|
477
473
|
export {
|
|
478
|
-
|
|
474
|
+
M as useRecommendationExtensionStore
|
|
479
475
|
};
|
|
@@ -1,4 +1,20 @@
|
|
|
1
1
|
import type { SavedTemplateDetails } from '@@/Types/stripo';
|
|
2
|
+
/**
|
|
3
|
+
* Collects every unsubscribe page id referenced by the unsubscribe blocks
|
|
4
|
+
* present in the email HTML, deduped.
|
|
5
|
+
*
|
|
6
|
+
* The email's unsubscribe link is variation-scoped on the backend, which
|
|
7
|
+
* resolves the page to render from the page ids the FE persists for that
|
|
8
|
+
* variation. Those ids must reflect the blocks actually in the email — not a
|
|
9
|
+
* UI-only selection store — otherwise a block that entered the editor by any
|
|
10
|
+
* path other than the page-selection UI (e.g. a dropped saved module) sends an
|
|
11
|
+
* empty association and the backend falls back to the default page.
|
|
12
|
+
*
|
|
13
|
+
* Read from raw editor HTML: the `data-unsubscribe-page-list` attribute lives
|
|
14
|
+
* on the block node there (the save-time sync-module extractor relies on the
|
|
15
|
+
* same source), so it is reliably present regardless of how the block was added.
|
|
16
|
+
*/
|
|
17
|
+
export declare function getHtmlReferencedUnsubscribePages(html: string): number[];
|
|
2
18
|
export declare const useTemplatePreparation: () => {
|
|
3
19
|
prepareTemplateDetails: () => Promise<Omit<SavedTemplateDetails, "metadata">>;
|
|
4
20
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,58 +1,58 @@
|
|
|
1
|
-
import { useActionsApi as
|
|
2
|
-
import { useHtmlCompiler as
|
|
3
|
-
import { DEFAULT_CURRENCY as
|
|
1
|
+
import { useActionsApi as T } from "../composables/useActionsApi.js";
|
|
2
|
+
import { useHtmlCompiler as D } from "../composables/useHtmlCompiler.js";
|
|
3
|
+
import { DEFAULT_CURRENCY as l, DEFAULT_NODE_CONFIG as a } from "../extensions/Blocks/Recommendation/constants/defaultConfig.js";
|
|
4
4
|
import { useRecommendationExtensionStore as b } from "../extensions/Blocks/Recommendation/store/recommendation.js";
|
|
5
|
-
import { DATA_ATTRIBUTES as
|
|
6
|
-
import { parsePageList as
|
|
7
|
-
import { useDynamicContentStore as
|
|
8
|
-
import { useUnsubscribeStore as
|
|
9
|
-
function
|
|
10
|
-
const
|
|
11
|
-
return
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
}),
|
|
5
|
+
import { DATA_ATTRIBUTES as h } from "../extensions/Blocks/Unsubscribe/utils/constants.js";
|
|
6
|
+
import { parsePageList as P } from "../extensions/Blocks/Unsubscribe/utils/utils.js";
|
|
7
|
+
import { useDynamicContentStore as w } from "../stores/dynamic-content.js";
|
|
8
|
+
import { useUnsubscribeStore as E } from "../stores/unsubscribe.js";
|
|
9
|
+
function U(c) {
|
|
10
|
+
const n = new DOMParser().parseFromString(c, "text/html").querySelectorAll(`[${h.PAGE_LIST}]`), t = [];
|
|
11
|
+
return n.forEach((s) => {
|
|
12
|
+
const r = s.getAttribute(h.PAGE_LIST);
|
|
13
|
+
r && t.push(...P(r));
|
|
14
|
+
}), [...new Set(t)];
|
|
15
15
|
}
|
|
16
|
-
async function
|
|
17
|
-
const
|
|
18
|
-
if (
|
|
16
|
+
async function F(c) {
|
|
17
|
+
const i = new DOMParser().parseFromString(c, "text/html").querySelectorAll(".recommendation-block-v2");
|
|
18
|
+
if (i.length === 0)
|
|
19
19
|
return;
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
var g, f,
|
|
23
|
-
const
|
|
20
|
+
const n = b();
|
|
21
|
+
i.forEach((t) => {
|
|
22
|
+
var p, g, f, o, y;
|
|
23
|
+
const s = t.getAttribute("recommendation-id"), r = s ? Number(s) : NaN;
|
|
24
24
|
if (!Number.isFinite(r))
|
|
25
25
|
return;
|
|
26
|
-
const
|
|
27
|
-
if (!
|
|
26
|
+
const d = t.getAttribute("esd-ext-config");
|
|
27
|
+
if (!d)
|
|
28
28
|
return;
|
|
29
29
|
let e;
|
|
30
30
|
try {
|
|
31
|
-
e = JSON.parse(
|
|
31
|
+
e = JSON.parse(d);
|
|
32
32
|
} catch {
|
|
33
33
|
return;
|
|
34
34
|
}
|
|
35
35
|
if (!e || typeof e != "object" || Array.isArray(e))
|
|
36
36
|
return;
|
|
37
|
-
const
|
|
38
|
-
strategy: e.strategy ??
|
|
39
|
-
language: e.language ??
|
|
40
|
-
size: e.size ??
|
|
37
|
+
const m = {
|
|
38
|
+
strategy: e.strategy ?? a.strategy,
|
|
39
|
+
language: e.language ?? a.language,
|
|
40
|
+
size: e.size ?? a.size,
|
|
41
41
|
// Spread the default arrays so each block gets a fresh reference
|
|
42
42
|
// instead of sharing the singleton in DEFAULT_NODE_CONFIG.
|
|
43
|
-
productIds: e.productIds ?? [...
|
|
44
|
-
filters: e.filters ?? [...
|
|
45
|
-
shuffleProducts: e.shuffleProducts ??
|
|
46
|
-
currencyCode: ((
|
|
47
|
-
currencyAlignment: ((
|
|
48
|
-
currencyDecimalCount: ((
|
|
49
|
-
currencyDecimalSeparator: ((
|
|
50
|
-
currencyThousandSeparator: ((y = e.currency) == null ? void 0 : y.thousandSeparator) ??
|
|
43
|
+
productIds: e.productIds ?? [...a.productIds],
|
|
44
|
+
filters: e.filters ?? [...a.filters],
|
|
45
|
+
shuffleProducts: e.shuffleProducts ?? a.shuffleProducts,
|
|
46
|
+
currencyCode: ((p = e.currency) == null ? void 0 : p.code) ?? l.code,
|
|
47
|
+
currencyAlignment: ((g = e.currency) == null ? void 0 : g.alignment) ?? l.alignment,
|
|
48
|
+
currencyDecimalCount: ((f = e.currency) == null ? void 0 : f.decimalCount) ?? l.decimalCount,
|
|
49
|
+
currencyDecimalSeparator: ((o = e.currency) == null ? void 0 : o.decimalSeparator) ?? l.decimalSeparator,
|
|
50
|
+
currencyThousandSeparator: ((y = e.currency) == null ? void 0 : y.thousandSeparator) ?? l.thousandSeparator
|
|
51
51
|
};
|
|
52
|
-
|
|
52
|
+
n.seedBlockUrlConfig(r, m);
|
|
53
53
|
});
|
|
54
54
|
try {
|
|
55
|
-
await
|
|
55
|
+
await n.fetchRecommendationCreateData();
|
|
56
56
|
} catch (t) {
|
|
57
57
|
console.warn(
|
|
58
58
|
"Recommendation reference data pre-load failed; validator will skip the availability check.",
|
|
@@ -60,42 +60,43 @@ async function U(i) {
|
|
|
60
60
|
);
|
|
61
61
|
}
|
|
62
62
|
}
|
|
63
|
-
const
|
|
64
|
-
const
|
|
63
|
+
const k = () => {
|
|
64
|
+
const c = w(), u = E(), { getCompiledEmail: i, getTemplateData: n } = T(), { compileHtml: t } = D();
|
|
65
65
|
return {
|
|
66
66
|
prepareTemplateDetails: async () => {
|
|
67
|
-
const { html: r, ampHtml:
|
|
67
|
+
const { html: r, ampHtml: d = "", ampErrors: e = [] } = await i({
|
|
68
68
|
minimize: !0,
|
|
69
69
|
resetDataSavedFlag: !1
|
|
70
|
-
}), { html:
|
|
71
|
-
|
|
72
|
-
const { compiledHtml:
|
|
70
|
+
}), { html: m, css: p, syncModulesIds: g = [] } = await n();
|
|
71
|
+
u.selectedUnsubscribePages.length && await u.fetchTemplates(), await F(m);
|
|
72
|
+
const { compiledHtml: f, stats: o, appliedRules: y } = t(r), A = c.getSelectedDynamicContentList, C = b(), S = U(m);
|
|
73
73
|
return console.debug("HTML Compilation Stats:", {
|
|
74
|
-
originalSize:
|
|
75
|
-
compiledSize:
|
|
76
|
-
reduction: `${
|
|
74
|
+
originalSize: o.originalSize,
|
|
75
|
+
compiledSize: o.compiledSize,
|
|
76
|
+
reduction: `${o.reductionPercentage.toFixed(2)}%`,
|
|
77
77
|
appliedRules: y,
|
|
78
|
-
executionTime: `${
|
|
78
|
+
executionTime: `${o.executionTime.toFixed(2)}ms`
|
|
79
79
|
}), {
|
|
80
|
-
dynamicContentList:
|
|
81
|
-
compiledHtml:
|
|
82
|
-
rawHtml:
|
|
83
|
-
css:
|
|
84
|
-
ampHtml:
|
|
80
|
+
dynamicContentList: A,
|
|
81
|
+
compiledHtml: f,
|
|
82
|
+
rawHtml: m,
|
|
83
|
+
css: p,
|
|
84
|
+
ampHtml: d,
|
|
85
85
|
ampErrors: e,
|
|
86
|
-
modules:
|
|
86
|
+
modules: g.map(Number),
|
|
87
87
|
recommendation: {
|
|
88
|
-
campaignUrls:
|
|
88
|
+
campaignUrls: C.recommendationCampaignUrls,
|
|
89
89
|
configs: {}
|
|
90
90
|
},
|
|
91
91
|
unsubscribe: {
|
|
92
|
-
status:
|
|
93
|
-
config:
|
|
92
|
+
status: S.length > 0,
|
|
93
|
+
config: S
|
|
94
94
|
}
|
|
95
95
|
};
|
|
96
96
|
}
|
|
97
97
|
};
|
|
98
98
|
};
|
|
99
99
|
export {
|
|
100
|
-
|
|
100
|
+
U as getHtmlReferencedUnsubscribePages,
|
|
101
|
+
k as useTemplatePreparation
|
|
101
102
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@useinsider/guido",
|
|
3
|
-
"version": "3.6.0-beta.
|
|
3
|
+
"version": "3.6.0-beta.859e737",
|
|
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",
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
const i = [
|
|
2
|
-
"ozonebg",
|
|
3
|
-
"ozonehr",
|
|
4
|
-
"ozonero",
|
|
5
|
-
"ozoneinfo",
|
|
6
|
-
"babybg",
|
|
7
|
-
"ozongr",
|
|
8
|
-
"iboodat",
|
|
9
|
-
"iboodbe",
|
|
10
|
-
"iboodde",
|
|
11
|
-
"iboodfr",
|
|
12
|
-
"iboodnl",
|
|
13
|
-
"iboodpl"
|
|
14
|
-
], r = ["interencheres", "interencherespreprod"], d = ["lodenfrey", "lodenfreyuat"], c = "manualMerchandising";
|
|
15
|
-
function s(e, n) {
|
|
16
|
-
const o = {};
|
|
17
|
-
return i.includes(e) && (o.excludePurchaseDay = "30", o.userId = "{user_id}"), r.includes(e) && (o.hp = "1"), d.includes(e) && n === c && (o.includeOutOfStockItems = "true"), o;
|
|
18
|
-
}
|
|
19
|
-
export {
|
|
20
|
-
s as getPartnerRecommendationParams
|
|
21
|
-
};
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Returns the extra recommendation feed query params for an account, if any.
|
|
3
|
-
* Accounts without customizations get an empty object.
|
|
4
|
-
* @param partnerName Account subdomain (`config.partner.name`)
|
|
5
|
-
* @param strategy Recommendation strategy key of the block
|
|
6
|
-
*/
|
|
7
|
-
export declare function getPartnerRecommendationParams(partnerName: string, strategy: string): Record<string, string>;
|