@useinsider/guido 3.17.0-beta.db80c84 → 3.17.0-beta.ddd4dde
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 +5 -5
- package/dist/composables/useStripo.js +14 -14
- package/dist/config/migrator/index.js +8 -9
- package/dist/config/migrator/recommendation/compositionMapper.js +20 -20
- package/dist/config/migrator/recommendation/extractors.js +24 -29
- package/dist/config/migrator/recommendation/htmlBuilder.js +130 -116
- package/dist/config/migrator/recommendationMigrator.js +15 -18
- package/dist/extensions/Blocks/Items/block.js +98 -49
- package/dist/extensions/Blocks/Items/constants/currency.js +11 -0
- package/dist/extensions/Blocks/Items/controls/price/currencyLocation.js +25 -24
- package/dist/extensions/Blocks/Items/controls/price/currencySymbol.js +12 -11
- package/dist/extensions/Blocks/Items/template.js +153 -152
- package/dist/extensions/Blocks/Recommendation/constants/blockIds.js +1 -1
- package/dist/extensions/Blocks/Recommendation/constants/controlIds.js +1 -1
- package/dist/extensions/Blocks/Recommendation/constants/defaultConfig.js +22 -23
- package/dist/extensions/Blocks/Recommendation/constants/selectors.js +28 -34
- package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +238 -306
- package/dist/extensions/Blocks/Recommendation/controls/main/index.js +8 -9
- package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +0 -1
- package/dist/extensions/Blocks/Recommendation/extension.js +29 -31
- package/dist/extensions/Blocks/Recommendation/settingsPanel.js +4 -23
- package/dist/extensions/Blocks/Recommendation/templates/grid/template.js +3 -3
- package/dist/extensions/Blocks/Recommendation/templates/utils.js +107 -85
- package/dist/src/config/migrator/recommendation/extractors.d.ts +0 -8
- package/dist/src/extensions/Blocks/Items/block.d.ts +21 -0
- package/dist/src/extensions/Blocks/Items/constants/currency.d.ts +19 -0
- package/dist/src/extensions/Blocks/Recommendation/constants/blockIds.d.ts +1 -2
- package/dist/src/extensions/Blocks/Recommendation/constants/controlIds.d.ts +0 -7
- 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/constants/selectors.d.ts +0 -10
- package/dist/src/extensions/Blocks/Recommendation/controls/cardComposition/index.d.ts +0 -10
- package/dist/src/extensions/Blocks/Recommendation/controls/index.d.ts +0 -1
- package/dist/src/extensions/Blocks/Recommendation/controls/main/utils.d.ts +0 -1
- package/dist/static/styles/customEditorStyle.css.js +1 -3
- package/dist/utils/pairProductVariables.js +60 -59
- package/package.json +2 -2
- package/dist/config/migrator/recommendationTitleMigrator.js +0 -119
- package/dist/extensions/Blocks/Recommendation/controls/title/index.js +0 -44
- package/dist/extensions/Blocks/Recommendation/templates/titleRows.js +0 -33
- package/dist/src/config/migrator/recommendationTitleMigrator.d.ts +0 -5
- package/dist/src/extensions/Blocks/Recommendation/controls/title/index.d.ts +0 -86
- package/dist/src/extensions/Blocks/Recommendation/templates/titleRows.d.ts +0 -13
|
@@ -11,9 +11,9 @@ import { CurrencyControl as R } from "./currency.js";
|
|
|
11
11
|
import { CURRENCY_CONTROL_ID as ot } from "./currency.js";
|
|
12
12
|
import { FiltersControl as I } from "./filters.js";
|
|
13
13
|
import { FILTERS_CONTROL_ID as nt } from "./filters.js";
|
|
14
|
-
import { LayoutOrientationControl as
|
|
14
|
+
import { LayoutOrientationControl as _ } from "./layoutOrientation.js";
|
|
15
15
|
import { LAYOUT_ORIENTATION_CONTROL_ID as st } from "./layoutOrientation.js";
|
|
16
|
-
import { LocaleControl as
|
|
16
|
+
import { LocaleControl as b } from "./locale.js";
|
|
17
17
|
import { LOCALE_CONTROL_ID as lt } from "./locale.js";
|
|
18
18
|
import { PricePlacementControl as T } from "./pricePlacement.js";
|
|
19
19
|
import { PRICE_PLACEMENT_CONTROL_ID as ut } from "./pricePlacement.js";
|
|
@@ -24,7 +24,7 @@ import { PRODUCT_LAYOUT_CONTROL_ID as Ct } from "./productLayout.js";
|
|
|
24
24
|
import { ShuffleControl as S } from "./shuffle.js";
|
|
25
25
|
import { SHUFFLE_CONTROL_ID as pt } from "./shuffle.js";
|
|
26
26
|
import { setCurrencyAttributes as L, getBlockElement as k, isPartnerManagedBlock as D, updateProductContentInPlace as E, regenerateProductRowsWithStyles as A } from "./utils.js";
|
|
27
|
-
import { adjustProductsToSize as yt, formatProductPrice as Nt, getCardComposition as Rt, getCurrentLayout as It,
|
|
27
|
+
import { adjustProductsToSize as yt, formatProductPrice as Nt, getCardComposition as Rt, getCurrentLayout as It, regenerateMobileProductRows as _t, updatePricesInPlace as bt, updateSingleProductContent as Tt } from "./utils.js";
|
|
28
28
|
import { useDebounceFn as m } from "../../../../../node_modules/@vueuse/shared/index.js";
|
|
29
29
|
const v = "recommendation-id", w = "ui-elements-recommendation-block";
|
|
30
30
|
class Q extends g {
|
|
@@ -81,7 +81,7 @@ class Q extends g {
|
|
|
81
81
|
return w;
|
|
82
82
|
}
|
|
83
83
|
getTemplate() {
|
|
84
|
-
return this.algorithmControl = new N(), this.localeControl = new
|
|
84
|
+
return this.algorithmControl = new N(), this.localeControl = new b(), this.currencyControl = new R(), this.productCountControl = new O(), this.productLayoutControl = new P(), this.filtersControl = new I(), this.shuffleControl = new S(), this.pricePlacementControl = new T(), this.layoutOrientationControl = new _(), [
|
|
85
85
|
this.algorithmControl,
|
|
86
86
|
this.localeControl,
|
|
87
87
|
this.currencyControl,
|
|
@@ -365,8 +365,8 @@ export {
|
|
|
365
365
|
I as FiltersControl,
|
|
366
366
|
st as LAYOUT_ORIENTATION_CONTROL_ID,
|
|
367
367
|
lt as LOCALE_CONTROL_ID,
|
|
368
|
-
|
|
369
|
-
|
|
368
|
+
_ as LayoutOrientationControl,
|
|
369
|
+
b as LocaleControl,
|
|
370
370
|
ut as PRICE_PLACEMENT_CONTROL_ID,
|
|
371
371
|
ht as PRODUCT_COUNT_CONTROL_ID,
|
|
372
372
|
Ct as PRODUCT_LAYOUT_CONTROL_ID,
|
|
@@ -381,12 +381,11 @@ export {
|
|
|
381
381
|
k as getBlockElement,
|
|
382
382
|
Rt as getCardComposition,
|
|
383
383
|
It as getCurrentLayout,
|
|
384
|
-
bt as getMainContainerTbody,
|
|
385
384
|
D as isPartnerManagedBlock,
|
|
386
385
|
_t as regenerateMobileProductRows,
|
|
387
386
|
A as regenerateProductRowsWithStyles,
|
|
388
387
|
L as setCurrencyAttributes,
|
|
389
|
-
|
|
388
|
+
bt as updatePricesInPlace,
|
|
390
389
|
E as updateProductContentInPlace,
|
|
391
|
-
|
|
390
|
+
Tt as updateSingleProductContent
|
|
392
391
|
};
|
|
@@ -5,24 +5,23 @@ import { RecommendationBlockControl as i } from "./controls/main/index.js";
|
|
|
5
5
|
import "./constants/selectors.js";
|
|
6
6
|
import "./store/recommendation.js";
|
|
7
7
|
import "./utils/captureStyleTemplates.js";
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import
|
|
23
|
-
import S from "./
|
|
24
|
-
|
|
25
|
-
const w = [
|
|
8
|
+
import { NameControls as e } from "./controls/name/index.js";
|
|
9
|
+
import { PriceControls as l } from "./controls/price/index.js";
|
|
10
|
+
import { OldPriceControls as s } from "./controls/oldPrice/index.js";
|
|
11
|
+
import { OmnibusPriceControls as p } from "./controls/omnibusPrice/index.js";
|
|
12
|
+
import { OmnibusDiscountControls as a } from "./controls/omnibusDiscount/index.js";
|
|
13
|
+
import { ButtonControls as c } from "./controls/button/index.js";
|
|
14
|
+
import { ImageControls as C } from "./controls/image/index.js";
|
|
15
|
+
import { CustomAttributeControls as f } from "./controls/customAttribute/index.js";
|
|
16
|
+
import { SpacingControl as d } from "./controls/spacing/index.js";
|
|
17
|
+
import { BlockBackgroundColorControl as u } from "./controls/blockBackground/index.js";
|
|
18
|
+
import { CardBackgroundColorControl as g } from "./controls/cardBackground/index.js";
|
|
19
|
+
import { RecommendationCardCompositionControl as y } from "./controls/cardComposition/index.js";
|
|
20
|
+
import { SyncInfoMessageControl as B } from "./controls/syncInfoMessage.js";
|
|
21
|
+
import { RecommendationIconsRegistry as P } from "./iconsRegistry.js";
|
|
22
|
+
import R from "./recommendation.css.js";
|
|
23
|
+
import { SettingsPanel as S } from "./settingsPanel.js";
|
|
24
|
+
const k = [
|
|
26
25
|
e,
|
|
27
26
|
l,
|
|
28
27
|
s,
|
|
@@ -30,22 +29,21 @@ const w = [
|
|
|
30
29
|
a,
|
|
31
30
|
c,
|
|
32
31
|
C,
|
|
33
|
-
f
|
|
34
|
-
|
|
35
|
-
], b = [
|
|
32
|
+
f
|
|
33
|
+
], w = [
|
|
36
34
|
i,
|
|
35
|
+
u,
|
|
37
36
|
g,
|
|
37
|
+
d,
|
|
38
38
|
y,
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
...w.flatMap((o) => Object.values(o))
|
|
45
|
-
], Y = v.reduce(
|
|
39
|
+
B
|
|
40
|
+
], b = [
|
|
41
|
+
...w,
|
|
42
|
+
...k.flatMap((o) => Object.values(o))
|
|
43
|
+
], W = b.reduce(
|
|
46
44
|
(o, r) => o.addControl(r),
|
|
47
|
-
new t().addBlock(m).withSettingsPanelRegistry(
|
|
48
|
-
).addStyles(
|
|
45
|
+
new t().addBlock(m).withSettingsPanelRegistry(S)
|
|
46
|
+
).addStyles(R).withPreviewStyles(n).withIconsRegistry(P).build();
|
|
49
47
|
export {
|
|
50
|
-
|
|
48
|
+
W as default
|
|
51
49
|
};
|
|
@@ -3,10 +3,9 @@ import { BLOCK_ID as R } from "./block.js";
|
|
|
3
3
|
import { RecommendationBlockId as S } from "./constants/blockIds.js";
|
|
4
4
|
import { RecommendationControlId as T } from "./constants/controlIds.js";
|
|
5
5
|
import "./constants/selectors.js";
|
|
6
|
-
import { CONTROL_BLOCK_ID as
|
|
6
|
+
import { CONTROL_BLOCK_ID as U } from "./controls/main/index.js";
|
|
7
7
|
import "./store/recommendation.js";
|
|
8
8
|
import "./utils/captureStyleTemplates.js";
|
|
9
|
-
import "./controls/title/index.js";
|
|
10
9
|
import "./controls/name/index.js";
|
|
11
10
|
import "./controls/price/index.js";
|
|
12
11
|
import "./controls/oldPrice/index.js";
|
|
@@ -16,7 +15,7 @@ import "./controls/button/index.js";
|
|
|
16
15
|
import "./controls/image/index.js";
|
|
17
16
|
import { SPACING_CONTROL_ID as A } from "./controls/spacing/index.js";
|
|
18
17
|
import "./controls/blockBackground/index.js";
|
|
19
|
-
import { CARD_BACKGROUND_COLOR_CONTROL_ID as
|
|
18
|
+
import { CARD_BACKGROUND_COLOR_CONTROL_ID as L } from "./controls/cardBackground/index.js";
|
|
20
19
|
import { COMPOSITION_CONTROL_BLOCK_ID as D } from "./controls/cardComposition/index.js";
|
|
21
20
|
import { SYNC_INFO_MESSAGE_CONTROL_ID as N } from "./controls/syncInfoMessage.js";
|
|
22
21
|
class s extends E {
|
|
@@ -25,7 +24,7 @@ class s extends E {
|
|
|
25
24
|
new _(
|
|
26
25
|
I.SETTINGS,
|
|
27
26
|
[
|
|
28
|
-
|
|
27
|
+
U,
|
|
29
28
|
C.EXTERNAL_INDENTS
|
|
30
29
|
]
|
|
31
30
|
),
|
|
@@ -33,7 +32,7 @@ class s extends E {
|
|
|
33
32
|
I.STYLES,
|
|
34
33
|
[
|
|
35
34
|
T.BLOCK_BACKGROUND,
|
|
36
|
-
|
|
35
|
+
L,
|
|
37
36
|
A
|
|
38
37
|
]
|
|
39
38
|
),
|
|
@@ -43,24 +42,6 @@ class s extends E {
|
|
|
43
42
|
D
|
|
44
43
|
]
|
|
45
44
|
).withLabel(this.api.translate("Card Composition"))
|
|
46
|
-
], O[S.TITLE] = [
|
|
47
|
-
new _(
|
|
48
|
-
I.SETTINGS,
|
|
49
|
-
[
|
|
50
|
-
T.TITLE_STYLE,
|
|
51
|
-
T.TITLE_ALIGN,
|
|
52
|
-
T.TITLE_PADDINGS
|
|
53
|
-
]
|
|
54
|
-
),
|
|
55
|
-
new _(
|
|
56
|
-
I.STYLES,
|
|
57
|
-
[
|
|
58
|
-
T.TITLE_BACKGROUND,
|
|
59
|
-
T.TITLE_FONT_FAMILY,
|
|
60
|
-
T.TITLE_SIZE,
|
|
61
|
-
T.TITLE_COLOR
|
|
62
|
-
]
|
|
63
|
-
)
|
|
64
45
|
], O[S.NAME] = [
|
|
65
46
|
new _(
|
|
66
47
|
I.SETTINGS,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ATTR_PRODUCT_PRICE as f, ATTR_PRODUCT_OLD_PRICE as O } from "../../constants/selectors.js";
|
|
2
2
|
import { DEFAULT_PRODUCTS_PER_ROW as w } from "../../constants/layout.js";
|
|
3
|
-
import {
|
|
3
|
+
import { getDefaultProducts as A, DEFAULTS as g, createBlockTemplate as U, buildSpacer as h, DEFAULT_CARD_COMPOSITION as Y, buildElementRenderer as B, resolveInlinePriceOrder as F, buildCellOptions as I, DEFAULT_CARD_VISIBILITY as W } from "../utils.js";
|
|
4
4
|
import { DEFAULT_CELL_PADDING as k, renderInlineGridPriceCell as H, buildFillerCell as x, gridElementRenderer as y } from "./elementRenderer.js";
|
|
5
5
|
const G = `
|
|
6
6
|
<tr class="recommendation-product-row">
|
|
@@ -69,8 +69,8 @@ function M(t, r, o, e = {}, c = {}) {
|
|
|
69
69
|
);
|
|
70
70
|
}
|
|
71
71
|
function Q(t) {
|
|
72
|
-
const r = t ? `ins-recommendation-v3-block-${t}` : void 0, o =
|
|
73
|
-
return o.replace("{-{-TITLE-}-}",
|
|
72
|
+
const r = t ? `ins-recommendation-v3-block-${t}` : void 0, o = U("grid", r), e = A(), c = M(e, w);
|
|
73
|
+
return o.replace("{-{-TITLE-}-}", g.TITLE).replace("{-{-PRODUCT_ROWS-}-}", c).replace("{-{-MOBILE_PRODUCT_ROWS-}-}", "");
|
|
74
74
|
}
|
|
75
75
|
export {
|
|
76
76
|
Q as getDefaultTemplate,
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { ATTR_PRODUCT_PRICE as l, ATTR_PRODUCT_OLD_PRICE as a, ATTR_CUSTOM_PREFIX as T, ATTR_PRODUCT_IMAGE as
|
|
1
|
+
import { ATTR_PRODUCT_PRICE as l, ATTR_PRODUCT_OLD_PRICE as a, ATTR_CUSTOM_PREFIX as T, ATTR_PRODUCT_IMAGE as m, ATTR_PRODUCT_NAME as C, ATTR_PRODUCT_OMNIBUS_PRICE as _, ATTR_PRODUCT_OMNIBUS_DISCOUNT as p, ATTR_PRODUCT_BUTTON as y, PRODUCT_ATTRIBUTE_PREFIX as I } from "../constants/selectors.js";
|
|
2
2
|
import { useRecommendationExtensionStore as L } from "../store/recommendation.js";
|
|
3
|
-
import { compositionKeyToProductAttr as
|
|
3
|
+
import { compositionKeyToProductAttr as A, isDefaultProductAttr as b, bareAttributeName as S, findFilterByBareName as $, productAttrToCompositionKey as h } from "../utils/compositionKeys.js";
|
|
4
4
|
import { formatPrice as B } from "../utils/priceFormatter.js";
|
|
5
|
-
|
|
6
|
-
function x() {
|
|
5
|
+
function k() {
|
|
7
6
|
const t = L(), { currencySettings: e } = t.recommendationConfigs;
|
|
8
7
|
return {
|
|
9
8
|
code: e.value,
|
|
@@ -14,17 +13,17 @@ function x() {
|
|
|
14
13
|
thousandSeparator: e.thousandSeparator
|
|
15
14
|
};
|
|
16
15
|
}
|
|
17
|
-
function
|
|
18
|
-
const o =
|
|
16
|
+
function f(t, e = "price") {
|
|
17
|
+
const o = k(), n = t[e], c = (n == null ? void 0 : n[o.code]) ?? Object.values(n ?? {})[0] ?? 0;
|
|
19
18
|
return B({
|
|
20
19
|
price: c,
|
|
21
20
|
currency: o
|
|
22
21
|
});
|
|
23
22
|
}
|
|
24
23
|
function q(t) {
|
|
25
|
-
return
|
|
24
|
+
return f(t, "price") === f(t, "original_price");
|
|
26
25
|
}
|
|
27
|
-
function
|
|
26
|
+
function x(t) {
|
|
28
27
|
return t.replace(/_/g, " ").replace(/\b\w/g, (e) => e.toUpperCase());
|
|
29
28
|
}
|
|
30
29
|
function J(t) {
|
|
@@ -35,114 +34,115 @@ function J(t) {
|
|
|
35
34
|
skip: n ? l : a
|
|
36
35
|
};
|
|
37
36
|
}
|
|
38
|
-
function
|
|
37
|
+
function N(t) {
|
|
39
38
|
const e = Array.isArray(t) ? t[t.length - 1] : t;
|
|
40
39
|
if (typeof e == "string")
|
|
41
40
|
return e;
|
|
42
41
|
if (typeof e == "number")
|
|
43
42
|
return String(e);
|
|
44
43
|
}
|
|
45
|
-
function
|
|
44
|
+
function w(t, e) {
|
|
46
45
|
var o;
|
|
47
46
|
return ((o = $(t, e)) == null ? void 0 : o.type) === "defaultAttribute";
|
|
48
47
|
}
|
|
49
|
-
function
|
|
50
|
-
return
|
|
48
|
+
function F(t, e) {
|
|
49
|
+
return w(t, e) ? t : `${I}${t}`;
|
|
51
50
|
}
|
|
52
51
|
function Q(t) {
|
|
53
|
-
return
|
|
52
|
+
return h(t);
|
|
54
53
|
}
|
|
55
|
-
const
|
|
54
|
+
const v = Symbol("customCellHtml");
|
|
56
55
|
function Z(t, e, o = {}) {
|
|
57
|
-
const n = t[
|
|
56
|
+
const n = t[v];
|
|
58
57
|
if (!n)
|
|
59
58
|
return { ...t };
|
|
60
59
|
const c = { ...t };
|
|
61
|
-
return e.filter((
|
|
62
|
-
const
|
|
63
|
-
c[
|
|
60
|
+
return e.filter((s) => s.startsWith(T) && !c[s]).forEach((s) => {
|
|
61
|
+
const i = A(s), r = b(i) ? F(i, o) : i, u = S(r), R = x(u), D = b(r);
|
|
62
|
+
c[s] = (d, U) => {
|
|
64
63
|
var g;
|
|
65
|
-
const
|
|
66
|
-
return n(r,
|
|
64
|
+
const E = D ? d[u] : (g = d.product_attributes) == null ? void 0 : g[u], O = N(E) ?? R;
|
|
65
|
+
return n(r, O, U);
|
|
67
66
|
};
|
|
68
67
|
}), c;
|
|
69
68
|
}
|
|
70
69
|
function tt(t, e, o = []) {
|
|
71
|
-
const n = t.startsWith(T) ?
|
|
70
|
+
const n = t.startsWith(T) ? h(S(A(t))) : t, s = n !== t && !o.includes(n) ? n : t, i = (r) => (r == null ? void 0 : r[t]) ?? (r == null ? void 0 : r[s]);
|
|
72
71
|
return {
|
|
73
72
|
cellPadding: e.cellPadding,
|
|
74
73
|
cardBackgroundColor: e.cardBackgroundColor,
|
|
75
|
-
cellBackgroundColor:
|
|
76
|
-
cellAlignment:
|
|
77
|
-
cellClasses:
|
|
78
|
-
omnibusText:
|
|
79
|
-
styleTemplate:
|
|
74
|
+
cellBackgroundColor: i(e.cellBackgroundColors),
|
|
75
|
+
cellAlignment: i(e.cellAlignments),
|
|
76
|
+
cellClasses: i(e.cellClasses),
|
|
77
|
+
omnibusText: i(e.omnibusTexts),
|
|
78
|
+
styleTemplate: i(e.styleTemplates)
|
|
80
79
|
};
|
|
81
80
|
}
|
|
82
81
|
const et = {
|
|
83
82
|
TITLE: "You May Also Like!"
|
|
84
83
|
}, ot = [
|
|
85
|
-
|
|
86
|
-
|
|
84
|
+
m,
|
|
85
|
+
C,
|
|
87
86
|
a,
|
|
88
87
|
l,
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
88
|
+
_,
|
|
89
|
+
p,
|
|
90
|
+
y
|
|
92
91
|
], nt = {
|
|
93
|
-
[
|
|
94
|
-
[
|
|
92
|
+
[m]: !0,
|
|
93
|
+
[C]: !0,
|
|
95
94
|
[l]: !0,
|
|
96
95
|
[a]: !0,
|
|
97
|
-
[
|
|
98
|
-
[
|
|
99
|
-
[
|
|
100
|
-
},
|
|
101
|
-
function
|
|
96
|
+
[_]: !1,
|
|
97
|
+
[p]: !1,
|
|
98
|
+
[y]: !0
|
|
99
|
+
}, M = 10;
|
|
100
|
+
function W(t = M) {
|
|
102
101
|
return `
|
|
103
102
|
<tr>
|
|
104
103
|
<td class="spacer" style="height: ${t}px;"></td>
|
|
105
104
|
</tr>
|
|
106
105
|
`;
|
|
107
106
|
}
|
|
108
|
-
|
|
107
|
+
const H = W();
|
|
108
|
+
function V(t, e) {
|
|
109
109
|
return e ? e.pStyle ?? "" : t;
|
|
110
110
|
}
|
|
111
|
-
function
|
|
112
|
-
const n =
|
|
113
|
-
return `<p contenteditable="false" style="${n}">${c}${t}${
|
|
111
|
+
function rt(t, e, o) {
|
|
112
|
+
const n = V(e.pStyle, o), c = o ? o.openTags ?? "" : e.openTags, s = o ? o.closeTags ?? "" : e.closeTags;
|
|
113
|
+
return `<p contenteditable="false" style="${n}">${c}${t}${s}</p>`;
|
|
114
114
|
}
|
|
115
115
|
function st(t, e) {
|
|
116
116
|
const o = [];
|
|
117
117
|
return t && o.push(t), e && o.push(`background-color: ${e};`), o.join(" ");
|
|
118
118
|
}
|
|
119
|
-
function
|
|
119
|
+
function Y(t) {
|
|
120
120
|
return t ? ` background-color: ${t};` : "";
|
|
121
121
|
}
|
|
122
|
-
function
|
|
123
|
-
const e =
|
|
122
|
+
function it(t) {
|
|
123
|
+
const e = Y(t);
|
|
124
124
|
return e ? ` style="${e.trim()}"` : "";
|
|
125
125
|
}
|
|
126
|
-
function
|
|
126
|
+
function ct(t, e = "") {
|
|
127
127
|
return {
|
|
128
128
|
before: (t == null ? void 0 : t.before) ?? e,
|
|
129
129
|
after: (t == null ? void 0 : t.after) ?? ""
|
|
130
130
|
};
|
|
131
131
|
}
|
|
132
|
-
function
|
|
132
|
+
function lt(t, e) {
|
|
133
133
|
return `${(e == null ? void 0 : e.openTags) ?? ""}${t}${(e == null ? void 0 : e.closeTags) ?? ""}`;
|
|
134
134
|
}
|
|
135
|
-
function
|
|
135
|
+
function at(t) {
|
|
136
136
|
return t != null && t.buttonFitToContainer ? "es-button-border es-fw" : "es-button-border";
|
|
137
137
|
}
|
|
138
|
-
const
|
|
139
|
-
function
|
|
140
|
-
return !t || typeof t != "string" || t.trim() === "" ?
|
|
138
|
+
const ut = "display: block; max-width: 100%; height: auto;", dt = "border-width: 1px; background: rgb(217, 234, 211); border-color: rgb(106, 168, 79);", gt = "color: rgb(56, 118, 29); background: rgb(217, 234, 211); font-family: arial, 'helvetica neue', helvetica, sans-serif; font-size: 16px; font-weight: normal; line-height: 120%; mso-border-alt: 10px solid rgb(217, 234, 211); mso-padding-alt: 0;", P = "https://email-static.useinsider.com/stripo/modules/email-recommendation-v3/assets/images/image-placeholder.png";
|
|
139
|
+
function bt(t) {
|
|
140
|
+
return !t || typeof t != "string" || t.trim() === "" ? P : t.startsWith("http://") ? t.replace("http://", "https://") : t;
|
|
141
141
|
}
|
|
142
|
-
function
|
|
142
|
+
function G(t) {
|
|
143
143
|
return {
|
|
144
144
|
name: "Product Name",
|
|
145
|
-
image_url:
|
|
145
|
+
image_url: P,
|
|
146
146
|
price: { USD: 18 },
|
|
147
147
|
original_price: { USD: 20 },
|
|
148
148
|
discount: { USD: 2 },
|
|
@@ -154,20 +154,19 @@ function Y(t) {
|
|
|
154
154
|
category: []
|
|
155
155
|
};
|
|
156
156
|
}
|
|
157
|
-
function
|
|
157
|
+
function ft(t = 6) {
|
|
158
158
|
return Array.from(
|
|
159
159
|
{ length: t },
|
|
160
|
-
(e, o) =>
|
|
160
|
+
(e, o) => G(String(o + 1))
|
|
161
161
|
);
|
|
162
162
|
}
|
|
163
|
-
function
|
|
163
|
+
function Tt(t = "grid", e) {
|
|
164
164
|
const o = t === "list" ? `
|
|
165
|
-
data-layout="list"` : "", n = e ? ` ${e}` : ""
|
|
166
|
-
{-{-MOBILE_PRODUCT_ROWS-}-}`, r = t === "list" ? ' style="display: none;"' : "";
|
|
165
|
+
data-layout="list"` : "", n = e ? ` ${e}` : "";
|
|
167
166
|
return `
|
|
168
167
|
<td
|
|
169
168
|
align="left"
|
|
170
|
-
class="${
|
|
169
|
+
class="${`recommendation-block-v2 esd-block-recommendation-v3-block es-p20${t === "list" ? " es-m-p0 ins-recommendation-list-layout" : ""}${n}`}"${o}>
|
|
171
170
|
<table width="100%" cellpadding="0" cellspacing="0" border="0">
|
|
172
171
|
<tr>
|
|
173
172
|
<td align="center">
|
|
@@ -178,7 +177,28 @@ function bt(t = "grid", e) {
|
|
|
178
177
|
cellspacing="0"
|
|
179
178
|
border="0">
|
|
180
179
|
<tbody>
|
|
181
|
-
|
|
180
|
+
<tr>
|
|
181
|
+
<td>
|
|
182
|
+
<table
|
|
183
|
+
width="100%"
|
|
184
|
+
cellpadding="0"
|
|
185
|
+
cellspacing="0"
|
|
186
|
+
border="0">
|
|
187
|
+
<tbody>
|
|
188
|
+
<tr>
|
|
189
|
+
<td
|
|
190
|
+
class="esd-block-text es-p10t es-p10b es-p20l es-p20r"
|
|
191
|
+
align="center">
|
|
192
|
+
<p style="font-size: 28px; color: #333333;">
|
|
193
|
+
<strong>{-{-TITLE-}-}</strong>
|
|
194
|
+
</p>
|
|
195
|
+
</td>
|
|
196
|
+
</tr>
|
|
197
|
+
</tbody>
|
|
198
|
+
</table>
|
|
199
|
+
</td>
|
|
200
|
+
</tr>
|
|
201
|
+
${H}
|
|
182
202
|
<tr>
|
|
183
203
|
<td>
|
|
184
204
|
<table
|
|
@@ -193,7 +213,7 @@ function bt(t = "grid", e) {
|
|
|
193
213
|
</table>
|
|
194
214
|
</td>
|
|
195
215
|
</tr>
|
|
196
|
-
<tr class="ins-recommendation-mobile-row"${
|
|
216
|
+
<tr class="ins-recommendation-mobile-row"${t === "list" ? ' style="display: none;"' : ""}>
|
|
197
217
|
<td>
|
|
198
218
|
<table
|
|
199
219
|
class="ins-recommendation-product-container
|
|
@@ -203,7 +223,8 @@ function bt(t = "grid", e) {
|
|
|
203
223
|
cellspacing="0"
|
|
204
224
|
border="0"
|
|
205
225
|
style="display: none;"
|
|
206
|
-
>${
|
|
226
|
+
>${t === "list" ? "" : `
|
|
227
|
+
{-{-MOBILE_PRODUCT_ROWS-}-}`}
|
|
207
228
|
</table>
|
|
208
229
|
</td>
|
|
209
230
|
</tr>
|
|
@@ -216,36 +237,37 @@ function bt(t = "grid", e) {
|
|
|
216
237
|
`;
|
|
217
238
|
}
|
|
218
239
|
export {
|
|
219
|
-
|
|
240
|
+
v as CUSTOM_CELL_HTML,
|
|
220
241
|
et as DEFAULTS,
|
|
221
|
-
|
|
222
|
-
|
|
242
|
+
gt as DEFAULT_BUTTON_ANCHOR_STYLE,
|
|
243
|
+
dt as DEFAULT_BUTTON_BORDER_STYLE,
|
|
223
244
|
ot as DEFAULT_CARD_COMPOSITION,
|
|
224
245
|
nt as DEFAULT_CARD_VISIBILITY,
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
246
|
+
ut as DEFAULT_IMG_STYLE,
|
|
247
|
+
M as DEFAULT_ROW_SPACING_PX,
|
|
248
|
+
P as PLACEHOLDER_IMAGE,
|
|
249
|
+
Y as bgColorFragment,
|
|
229
250
|
tt as buildCellOptions,
|
|
230
251
|
Z as buildElementRenderer,
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
252
|
+
W as buildSpacer,
|
|
253
|
+
it as cellBgStyleAttr,
|
|
254
|
+
Tt as createBlockTemplate,
|
|
255
|
+
f as formatProductPrice,
|
|
256
|
+
k as getCurrentCurrencyConfig,
|
|
257
|
+
ft as getDefaultProducts,
|
|
258
|
+
w as isDefaultAttribute,
|
|
238
259
|
q as isSamePrice,
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
260
|
+
lt as renderButtonLabel,
|
|
261
|
+
rt as renderStyledParagraph,
|
|
262
|
+
at as resolveButtonBorderClass,
|
|
242
263
|
J as resolveInlinePriceOrder,
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
264
|
+
ct as resolveOmnibusText,
|
|
265
|
+
V as resolvePStyle,
|
|
266
|
+
F as resolveProductAttrValue,
|
|
246
267
|
st as resolveSegmentBgStyle,
|
|
247
|
-
|
|
268
|
+
bt as sanitizeImageUrl,
|
|
269
|
+
H as spacer,
|
|
248
270
|
Q as toCustomCompositionKey,
|
|
249
|
-
|
|
250
|
-
|
|
271
|
+
x as toDisplayName,
|
|
272
|
+
N as toDisplayableAttributeValue
|
|
251
273
|
};
|
|
@@ -1,12 +1,4 @@
|
|
|
1
1
|
export declare function extractTitleText(block: Element): string;
|
|
2
|
-
/**
|
|
3
|
-
* Fallback for legacy configs that carry no `p_recommendation_title` variable:
|
|
4
|
-
* the rendered HTML decides. A missing or `display: none` title container means
|
|
5
|
-
* the user never saw a title, so the migrated block keeps it toggled off.
|
|
6
|
-
* @param block - The legacy recommendation block element
|
|
7
|
-
* @returns True when the legacy block renders a visible title
|
|
8
|
-
*/
|
|
9
|
-
export declare function hasVisibleTitle(block: Element): boolean;
|
|
10
2
|
/**
|
|
11
3
|
* Card background lives on either the block (`bgcolor`/`style`) or per-card
|
|
12
4
|
* cells (`.product-card`). Returns empty string when no background is set —
|
|
@@ -16,6 +16,8 @@ export declare const BLOCK_ID: BlockId;
|
|
|
16
16
|
* - Onboarding support
|
|
17
17
|
*/
|
|
18
18
|
export declare class ItemsBlock extends Block {
|
|
19
|
+
/** Block instances whose currency attrs were already self-healed this session (SD-147588 — undo-safe). */
|
|
20
|
+
private _currencyHealed;
|
|
19
21
|
getId(): string;
|
|
20
22
|
getIcon(): string;
|
|
21
23
|
getBlockCompositionType(): BlockCompositionType;
|
|
@@ -42,4 +44,23 @@ export declare class ItemsBlock extends Block {
|
|
|
42
44
|
* relies on this td-level fallback in pairProductVariables.
|
|
43
45
|
*/
|
|
44
46
|
private _stampProductTdDomAttributes;
|
|
47
|
+
/**
|
|
48
|
+
* Whether the currency self-heal should run for this block. Two guards (SD-147588):
|
|
49
|
+
* 1. Config is only authoritative when the symbol was actually customized — a symbol still at
|
|
50
|
+
* the 'USD' sentinel may be a migrator default, so we trust the DOM's real value over a
|
|
51
|
+
* defaulted config and never overwrite it.
|
|
52
|
+
* 2. Heal each instance at most once per session, so the auto-fix can't fight undo (undo
|
|
53
|
+
* re-drifts the attr, which would otherwise re-trigger the heal forever).
|
|
54
|
+
*/
|
|
55
|
+
private _shouldReconcileCurrency;
|
|
56
|
+
/** Marks a block instance's currency as reconciled so it is not healed again (undo-safe). */
|
|
57
|
+
private _markCurrencyHealed;
|
|
58
|
+
/**
|
|
59
|
+
* Stamps the export-read currency attrs onto every price `<p>` from config, so a template whose
|
|
60
|
+
* attrs drifted (e.g. a location toggle before the sync fix) self-heals to match the editor.
|
|
61
|
+
* Config is the source of truth — never derive from visible text. Callers gate this with
|
|
62
|
+
* `_shouldReconcileCurrency`. Returns true only when an attr actually changed, so the caller can
|
|
63
|
+
* skip an empty apply that would otherwise re-trigger onDocumentChanged and loop (SD-147588).
|
|
64
|
+
*/
|
|
65
|
+
private _reconcileCurrencyDomAttributes;
|
|
45
66
|
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Single owner for the Items price currency export contract (SD-147588).
|
|
3
|
+
*
|
|
4
|
+
* `data-curency` is deliberately misspelled (one `r`) — it is the attribute the
|
|
5
|
+
* server-side export transform (pairProductVariables) actually reads, so every
|
|
6
|
+
* layer that writes it and the live reader (template, controls, block self-heal,
|
|
7
|
+
* pairProductVariables) MUST go through these constants. A typo fix or mapping change
|
|
8
|
+
* in one of them would otherwise silently break sync with the others and ship the wrong
|
|
9
|
+
* currency position/token to the inbox. Mirrors the Recommendation block's `CURRENCY_ATTR`.
|
|
10
|
+
*
|
|
11
|
+
* Exception: the legacy migrator reads the raw misspelled string on purpose — it parses
|
|
12
|
+
* old templates frozen with that exact attr name, so it must NOT follow a future rename here.
|
|
13
|
+
*/
|
|
14
|
+
export declare const ITEMS_CURRENCY_ATTR: {
|
|
15
|
+
readonly POSITION: "data-curency";
|
|
16
|
+
readonly SYMBOL: "data-currency_symbol";
|
|
17
|
+
};
|
|
18
|
+
/** Currency location select value `'1'` = after (price then symbol), anything else = before. */
|
|
19
|
+
export declare function currencyPositionFromLocation(location: string | undefined): 'after' | 'before';
|
|
@@ -10,6 +10,5 @@ export declare enum RecommendationBlockId {
|
|
|
10
10
|
OMNIBUS_PRICE = "recommendation-block-omnibus-price",
|
|
11
11
|
OMNIBUS_DISCOUNT = "recommendation-block-omnibus-discount",
|
|
12
12
|
IMAGE = "recommendation-block-image",
|
|
13
|
-
CUSTOM_ATTRIBUTE = "recommendation-block-custom-attribute"
|
|
14
|
-
TITLE = "recommendation-block-title"
|
|
13
|
+
CUSTOM_ATTRIBUTE = "recommendation-block-custom-attribute"
|
|
15
14
|
}
|
|
@@ -65,12 +65,5 @@ export declare enum RecommendationControlId {
|
|
|
65
65
|
CUSTOM_ATTR_SIZE = "recommendation-block-custom-attr-size-control",
|
|
66
66
|
CUSTOM_ATTR_STYLE = "recommendation-block-custom-attr-style-control",
|
|
67
67
|
CUSTOM_ATTR_TEXT_TRIM = "recommendation-block-custom-attr-text-trim-control",
|
|
68
|
-
TITLE_ALIGN = "recommendation-block-title-align-control",
|
|
69
|
-
TITLE_BACKGROUND = "recommendation-block-title-background-control",
|
|
70
|
-
TITLE_COLOR = "recommendation-block-title-color-control",
|
|
71
|
-
TITLE_FONT_FAMILY = "recommendation-block-title-font-family-control",
|
|
72
|
-
TITLE_PADDINGS = "recommendation-block-title-paddings-control",
|
|
73
|
-
TITLE_SIZE = "recommendation-block-title-size-control",
|
|
74
|
-
TITLE_STYLE = "recommendation-block-title-style-control",
|
|
75
68
|
SYNC_INFO_MESSAGE = "recommendation-block-sync-info-message"
|
|
76
69
|
}
|