@useinsider/guido 2.1.0-beta.42f5dfa → 2.1.0-beta.486ee9c
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 +36 -0
- package/dist/@types/config/schemas.js +70 -65
- package/dist/components/Guido.vue.js +1 -1
- package/dist/components/Guido.vue2.js +69 -58
- package/dist/components/organisms/base/Toaster.vue.js +4 -4
- package/dist/components/organisms/base/Toaster.vue2.js +12 -9
- package/dist/components/organisms/email-preview/desktop-preview/EmailSizeIndicator.vue.js +5 -5
- package/dist/components/organisms/email-preview/desktop-preview/EmailSizeIndicator.vue2.js +2 -2
- package/dist/components/organisms/extensions/recommendation/FilterItem.vue.js +11 -13
- package/dist/components/organisms/extensions/recommendation/FilterItem.vue2.js +54 -23
- package/dist/components/organisms/extensions/recommendation/FilterSelectionDrawer.vue.js +7 -5
- package/dist/components/organisms/extensions/recommendation/FilterSelectionDrawer.vue2.js +34 -21
- package/dist/components/organisms/extensions/recommendation/Filters.vue.js +11 -11
- package/dist/components/organisms/extensions/recommendation/Filters.vue2.js +48 -36
- package/dist/components/organisms/extensions/recommendation/LogicAdapter.vue2.js +11 -9
- package/dist/components/organisms/header/HeaderWrapper.vue.js +9 -9
- package/dist/components/organisms/unsubscribe/UnsubscribePageSelection.vue.js +1 -1
- package/dist/components/organisms/unsubscribe/UnsubscribePageSelection.vue2.js +19 -19
- package/dist/composables/useBlocksConfig.js +26 -16
- package/dist/composables/useHtmlValidator.js +107 -119
- package/dist/composables/useRecommendation.js +9 -9
- package/dist/composables/useStripo.js +25 -23
- package/dist/composables/useVersionHistoryApi.js +1 -1
- package/dist/config/compiler/utils/recommendationCompilerUtils.js +28 -23
- package/dist/config/i18n/en/index.js +11 -0
- package/dist/config/i18n/en/labels.json.js +7 -0
- package/dist/config/i18n/en/toasters.json.js +56 -0
- package/dist/config/i18n/en/tooltips.json.js +82 -0
- package/dist/config/i18n/index.js +7 -0
- package/dist/config/migrator/itemsBlockMigrator.js +127 -122
- package/dist/config/migrator/recommendationMigrator.js +1 -1
- package/dist/enums/defaults.js +8 -4
- package/dist/extensions/Blocks/Recommendation/block.js +26 -23
- package/dist/extensions/Blocks/Recommendation/constants/defaultConfig.js +37 -33
- package/dist/extensions/Blocks/Recommendation/constants/layout.js +16 -12
- package/dist/extensions/Blocks/Recommendation/constants/selectors.js +15 -11
- package/dist/extensions/Blocks/Recommendation/controls/button/index.js +9 -9
- package/dist/extensions/Blocks/Recommendation/controls/image/index.js +1 -1
- package/dist/extensions/Blocks/Recommendation/controls/layout/index.js +41 -29
- package/dist/extensions/Blocks/Recommendation/controls/main/algorithm.js +16 -16
- package/dist/extensions/Blocks/Recommendation/controls/main/currency.js +30 -32
- package/dist/extensions/Blocks/Recommendation/controls/main/index.js +217 -94
- package/dist/extensions/Blocks/Recommendation/controls/main/locale.js +9 -9
- package/dist/extensions/Blocks/Recommendation/controls/main/productLayout.js +97 -39
- package/dist/extensions/Blocks/Recommendation/controls/main/shuffle.js +16 -16
- package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +304 -209
- package/dist/extensions/Blocks/Recommendation/controls/mobileLayout/cssRules.js +21 -0
- package/dist/extensions/Blocks/Recommendation/controls/name/index.js +10 -10
- package/dist/extensions/Blocks/Recommendation/controls/name/textTrim.js +5 -5
- package/dist/extensions/Blocks/Recommendation/controls/oldPrice/index.js +14 -14
- package/dist/extensions/Blocks/Recommendation/controls/omnibusDiscount/index.js +9 -9
- package/dist/extensions/Blocks/Recommendation/controls/omnibusDiscount/textAfter.js +3 -3
- package/dist/extensions/Blocks/Recommendation/controls/omnibusDiscount/textBefore.js +1 -1
- package/dist/extensions/Blocks/Recommendation/controls/omnibusPrice/index.js +9 -9
- package/dist/extensions/Blocks/Recommendation/controls/omnibusPrice/textAfter.js +3 -3
- package/dist/extensions/Blocks/Recommendation/controls/omnibusPrice/textBefore.js +13 -13
- package/dist/extensions/Blocks/Recommendation/controls/price/index.js +3 -3
- package/dist/extensions/Blocks/Recommendation/controls/spacing/index.js +223 -99
- package/dist/extensions/Blocks/Recommendation/store/recommendation.js +237 -140
- package/dist/extensions/Blocks/Recommendation/templates/grid/elementRenderer.js +27 -32
- package/dist/extensions/Blocks/Recommendation/templates/grid/migration.js +1 -1
- package/dist/extensions/Blocks/Recommendation/templates/grid/template.js +27 -30
- package/dist/extensions/Blocks/Recommendation/templates/list/elementRenderer.js +22 -27
- package/dist/extensions/Blocks/Recommendation/templates/utils.js +50 -38
- package/dist/extensions/Blocks/Recommendation/utils/filterUtil.js +8 -8
- package/dist/extensions/Blocks/Recommendation/validation/filterSchema.js +29 -0
- package/dist/extensions/Blocks/Unsubscribe/block.js +29 -29
- package/dist/extensions/Blocks/Unsubscribe/control.js +12 -9
- package/dist/extensions/Blocks/Unsubscribe/elements/preview.js +13 -11
- package/dist/extensions/Blocks/Unsubscribe/styles.css.js +31 -1
- package/dist/extensions/ModulesTabIcons/extension.js +17 -0
- package/dist/guido.css +1 -1
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js +257 -187
- package/dist/services/recommendationApi.js +11 -9
- package/dist/services/stripoApi.js +20 -17
- package/dist/src/@types/config/schemas.d.ts +8 -0
- package/dist/src/components/organisms/extensions/recommendation/FilterItem.vue.d.ts +1 -0
- package/dist/src/components/organisms/extensions/recommendation/Filters.vue.d.ts +17 -1
- package/dist/src/composables/useConfig.d.ts +4 -0
- package/dist/src/config/i18n/en/index.d.ts +1 -0
- package/dist/src/config/i18n/index.d.ts +16 -0
- package/dist/src/enums/defaults.d.ts +4 -0
- package/dist/src/extensions/Blocks/Recommendation/constants/defaultConfig.d.ts +6 -0
- package/dist/src/extensions/Blocks/Recommendation/constants/index.d.ts +3 -3
- package/dist/src/extensions/Blocks/Recommendation/constants/layout.d.ts +12 -2
- package/dist/src/extensions/Blocks/Recommendation/constants/selectors.d.ts +12 -1
- package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +50 -11
- package/dist/src/extensions/Blocks/Recommendation/controls/main/productLayout.d.ts +22 -4
- package/dist/src/extensions/Blocks/Recommendation/controls/main/utils.d.ts +36 -16
- package/dist/src/extensions/Blocks/Recommendation/controls/mobileLayout/cssRules.d.ts +29 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/spacing/index.d.ts +50 -17
- package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +26 -2
- package/dist/src/extensions/Blocks/Recommendation/templates/grid/migration.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/templates/grid/template.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/templates/index.d.ts +4 -0
- package/dist/src/extensions/Blocks/Recommendation/templates/list/migration.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/templates/utils.d.ts +12 -3
- package/dist/src/extensions/Blocks/Recommendation/types/nodeConfig.d.ts +14 -0
- package/dist/src/extensions/Blocks/Recommendation/validation/filterSchema.d.ts +15 -0
- package/dist/src/extensions/Blocks/Unsubscribe/control.d.ts +1 -0
- package/dist/src/extensions/ModulesTabIcons/extension.d.ts +2 -0
- package/dist/src/stores/config.d.ts +36 -0
- package/dist/static/styles/components/notification.css.js +19 -0
- package/dist/static/styles/components/tools.css.js +6 -2
- package/dist/static/styles/components/version-history.css.js +10 -2
- package/dist/static/styles/components/wide-panel.css.js +18 -2
- package/dist/static/styles/customEditorStyle.css.js +59 -31
- package/dist/static/styles/variables.css.js +2 -0
- package/dist/static/templates/empty/index.html.js +74 -0
- package/dist/static/templates/empty/style.css.js +779 -0
- package/dist/stores/unsubscribe.js +37 -34
- package/package.json +2 -2
|
@@ -3,7 +3,7 @@ import { ATTR_PRODUCT_BUTTON as b, ATTR_PRODUCT_OMNIBUS_DISCOUNT as u, ATTR_PROD
|
|
|
3
3
|
import { useRecommendationExtensionStore as T } from "../../store/recommendation.js";
|
|
4
4
|
import { formatPrice as _ } from "../../utils/priceFormatter.js";
|
|
5
5
|
import { sanitizeImageUrl as $ } from "../utils.js";
|
|
6
|
-
const
|
|
6
|
+
const a = "0 5px", o = "attribute-cell";
|
|
7
7
|
function p() {
|
|
8
8
|
const t = T(), { currencySettings: e } = t.recommendationConfigs;
|
|
9
9
|
return {
|
|
@@ -15,16 +15,16 @@ function p() {
|
|
|
15
15
|
thousandSeparator: e.thousandSeparator
|
|
16
16
|
};
|
|
17
17
|
}
|
|
18
|
-
function
|
|
19
|
-
const n = p(), l = t[e],
|
|
18
|
+
function c(t, e = "price") {
|
|
19
|
+
const n = p(), l = t[e], r = (l == null ? void 0 : l[n.code]) ?? Object.values(l ?? {})[0] ?? 0;
|
|
20
20
|
return _({
|
|
21
|
-
price:
|
|
21
|
+
price: r,
|
|
22
22
|
currency: n
|
|
23
23
|
});
|
|
24
24
|
}
|
|
25
25
|
const P = {
|
|
26
26
|
[x]: (t) => `
|
|
27
|
-
<td class="${
|
|
27
|
+
<td class="${o}" style="padding: ${a}; height: 100%;" valign="top">
|
|
28
28
|
<table
|
|
29
29
|
class="product-card-segment"
|
|
30
30
|
width="100%"
|
|
@@ -38,18 +38,13 @@ const P = {
|
|
|
38
38
|
class="esd-block-image product-image"
|
|
39
39
|
align="center"
|
|
40
40
|
esd-extension-block-id="${s.IMAGE}">
|
|
41
|
-
<
|
|
42
|
-
<
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
style="
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
alt="${t.name}"
|
|
49
|
-
style="max-width: 100%; max-height: 100%; object-fit: contain; display: block;"
|
|
50
|
-
class="adapt-img">
|
|
51
|
-
</a>
|
|
52
|
-
</div>
|
|
41
|
+
<a target="_blank" href="${t.url}">
|
|
42
|
+
<img
|
|
43
|
+
src="${$(t.image_url)}"
|
|
44
|
+
alt="${t.name}"
|
|
45
|
+
style="display: block; max-width: 100%; height: auto;"
|
|
46
|
+
class="adapt-img">
|
|
47
|
+
</a>
|
|
53
48
|
</td>
|
|
54
49
|
</tr>
|
|
55
50
|
</tbody>
|
|
@@ -57,7 +52,7 @@ const P = {
|
|
|
57
52
|
</td>
|
|
58
53
|
`,
|
|
59
54
|
[f]: (t) => `
|
|
60
|
-
<td class="${
|
|
55
|
+
<td class="${o}" style="padding: ${a}; height: 100%;" valign="middle">
|
|
61
56
|
<table
|
|
62
57
|
class="product-card-segment"
|
|
63
58
|
width="100%"
|
|
@@ -82,7 +77,7 @@ const P = {
|
|
|
82
77
|
</td>
|
|
83
78
|
`,
|
|
84
79
|
[y]: (t) => `
|
|
85
|
-
<td class="${
|
|
80
|
+
<td class="${o}" style="padding: ${a}; height: 100%;" valign="top">
|
|
86
81
|
<table
|
|
87
82
|
class="product-card-segment"
|
|
88
83
|
width="100%"
|
|
@@ -97,7 +92,7 @@ const P = {
|
|
|
97
92
|
align="center"
|
|
98
93
|
esd-extension-block-id="${s.PRICE}">
|
|
99
94
|
<p contenteditable="false" style="font-size: 16px; color: #333333;">
|
|
100
|
-
<strong>${
|
|
95
|
+
<strong>${c(t, "price")}</strong>
|
|
101
96
|
</p>
|
|
102
97
|
</td>
|
|
103
98
|
</tr>
|
|
@@ -106,7 +101,7 @@ const P = {
|
|
|
106
101
|
</td>
|
|
107
102
|
`,
|
|
108
103
|
[h]: (t) => `
|
|
109
|
-
<td class="${
|
|
104
|
+
<td class="${o}" style="padding: ${a}; height: 100%;" valign="top">
|
|
110
105
|
<table
|
|
111
106
|
class="product-card-segment"
|
|
112
107
|
width="100%"
|
|
@@ -121,7 +116,7 @@ const P = {
|
|
|
121
116
|
align="center"
|
|
122
117
|
esd-extension-block-id="${s.OLD_PRICE}">
|
|
123
118
|
<p contenteditable="false" style="font-size: 14px; color: #999999;">
|
|
124
|
-
<strong>${
|
|
119
|
+
<strong>${c(t, "original_price")}</strong>
|
|
125
120
|
</p>
|
|
126
121
|
</td>
|
|
127
122
|
</tr>
|
|
@@ -130,7 +125,7 @@ const P = {
|
|
|
130
125
|
</td>
|
|
131
126
|
`,
|
|
132
127
|
[m]: (t) => `
|
|
133
|
-
<td class="${
|
|
128
|
+
<td class="${o}" style="padding: ${a}; height: 100%;" valign="top">
|
|
134
129
|
<table
|
|
135
130
|
class="product-card-segment"
|
|
136
131
|
width="100%"
|
|
@@ -146,9 +141,9 @@ const P = {
|
|
|
146
141
|
data-text-before="Lowest 30-day price: "
|
|
147
142
|
data-text-after=""
|
|
148
143
|
esd-extension-block-id="${s.OMNIBUS_PRICE}">
|
|
149
|
-
<p style="font-size: 12px; color: #666666;">
|
|
144
|
+
<p contenteditable="false" style="font-size: 12px; color: #666666;">
|
|
150
145
|
<span class="omnibus-text-before">Lowest 30-day price: </span>
|
|
151
|
-
<span class="omnibus-price-value">${
|
|
146
|
+
<span class="omnibus-price-value">${c(t, "original_price")}</span>
|
|
152
147
|
<span class="omnibus-text-after"></span>
|
|
153
148
|
</p>
|
|
154
149
|
</td>
|
|
@@ -158,10 +153,10 @@ const P = {
|
|
|
158
153
|
</td>
|
|
159
154
|
`,
|
|
160
155
|
[u]: (t) => {
|
|
161
|
-
var d,
|
|
162
|
-
const e = p(), n = ((d = t.original_price) == null ? void 0 : d[e.code]) ?? Object.values(t.original_price ?? {})[0] ?? 0, l = ((
|
|
156
|
+
var d, i;
|
|
157
|
+
const e = p(), n = ((d = t.original_price) == null ? void 0 : d[e.code]) ?? Object.values(t.original_price ?? {})[0] ?? 0, l = ((i = t.price) == null ? void 0 : i[e.code]) ?? Object.values(t.price ?? {})[0] ?? 0, r = n > 0 ? Math.round((n - l) / n * 100) : 0, g = r > 0 ? `-${r}%` : "0%";
|
|
163
158
|
return `
|
|
164
|
-
<td class="${
|
|
159
|
+
<td class="${o}" style="padding: ${a}; height: 100%;" valign="top">
|
|
165
160
|
<table
|
|
166
161
|
class="product-card-segment"
|
|
167
162
|
width="100%"
|
|
@@ -177,7 +172,7 @@ const P = {
|
|
|
177
172
|
data-text-before=""
|
|
178
173
|
data-text-after=""
|
|
179
174
|
esd-extension-block-id="${s.OMNIBUS_DISCOUNT}">
|
|
180
|
-
<p style="font-size: 12px; color: #666666;">
|
|
175
|
+
<p contenteditable="false" style="font-size: 12px; color: #666666;">
|
|
181
176
|
<span class="omnibus-text-before"></span>
|
|
182
177
|
<span class="omnibus-discount-value">${g}</span>
|
|
183
178
|
<span class="omnibus-text-after"></span>
|
|
@@ -190,7 +185,7 @@ const P = {
|
|
|
190
185
|
`;
|
|
191
186
|
},
|
|
192
187
|
[b]: () => `
|
|
193
|
-
<td class="${
|
|
188
|
+
<td class="${o}" style="padding: ${a}; height: 100%;" valign="top">
|
|
194
189
|
<table
|
|
195
190
|
class="product-card-segment"
|
|
196
191
|
width="100%"
|
|
@@ -227,7 +222,7 @@ const P = {
|
|
|
227
222
|
`
|
|
228
223
|
};
|
|
229
224
|
export {
|
|
230
|
-
|
|
231
|
-
|
|
225
|
+
o as ATTRIBUTE_CELL_CLASS,
|
|
226
|
+
a as DEFAULT_CELL_PADDING,
|
|
232
227
|
P as gridElementRenderer
|
|
233
228
|
};
|
|
@@ -5,7 +5,7 @@ const u = `
|
|
|
5
5
|
align="left"
|
|
6
6
|
esd-extension-block-id="recommendation-block"
|
|
7
7
|
esd-handler-name="esd-extension-RecommendationBlock"
|
|
8
|
-
class="
|
|
8
|
+
class="recommendation-block-v2 esd-block-recommendation-v3-block esd-extension-block es-p20"
|
|
9
9
|
>
|
|
10
10
|
<table width="100%" cellpadding="0" cellspacing="0" border="0">
|
|
11
11
|
<tr>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { DEFAULT_PRODUCTS_PER_ROW as
|
|
2
|
-
import { DEFAULT_CARD_COMPOSITION as
|
|
3
|
-
import { gridElementRenderer as
|
|
4
|
-
const
|
|
1
|
+
import { DEFAULT_PRODUCTS_PER_ROW as m, DEFAULT_MOBILE_CARDS_IN_ROW as I } from "../../constants/layout.js";
|
|
2
|
+
import { DEFAULT_CARD_COMPOSITION as _, spacer as E, getDefaultProducts as S, createBlockTemplate as A, DEFAULTS as b, DEFAULT_CARD_VISIBILITY as D } from "../utils.js";
|
|
3
|
+
import { gridElementRenderer as w, ATTRIBUTE_CELL_CLASS as C, DEFAULT_CELL_PADDING as f } from "./elementRenderer.js";
|
|
4
|
+
const O = `
|
|
5
5
|
<tr class="recommendation-product-row">
|
|
6
6
|
<td>
|
|
7
7
|
<table
|
|
@@ -18,7 +18,7 @@ const D = `
|
|
|
18
18
|
</table>
|
|
19
19
|
</td>
|
|
20
20
|
</tr>
|
|
21
|
-
`,
|
|
21
|
+
`, U = `
|
|
22
22
|
<tr
|
|
23
23
|
class="recommendation-attribute-row"
|
|
24
24
|
data-attribute-type="{-{-ATTR_TYPE-}-}"
|
|
@@ -27,43 +27,40 @@ const D = `
|
|
|
27
27
|
{-{-CELLS-}-}
|
|
28
28
|
</tr>
|
|
29
29
|
`;
|
|
30
|
-
function g(t, e, r,
|
|
31
|
-
const
|
|
32
|
-
return
|
|
33
|
-
const
|
|
34
|
-
const
|
|
35
|
-
return
|
|
30
|
+
function g(t, e, r, n = _) {
|
|
31
|
+
const c = (100 / e).toFixed(2), s = e - t.length, o = `<td class="${C}" style="padding: ${f};" width="${c}%"></td>`, i = s > 0 ? o.repeat(s) : "";
|
|
32
|
+
return n.filter((l) => r[l]).map((l) => {
|
|
33
|
+
const p = D[l] ?? !0, T = p ? "" : 'style="display: none;"', u = t.map((R) => {
|
|
34
|
+
const L = r[l];
|
|
35
|
+
return L(R).replace("<td", `<td width="${c}%"`);
|
|
36
36
|
}).join("");
|
|
37
|
-
return
|
|
37
|
+
return U.replace("{-{-ATTR_TYPE-}-}", l).replace("{-{-VISIBILITY-}-}", p ? "1" : "0").replace("{-{-DISPLAY_STYLE-}-}", T).replace("{-{-CELLS-}-}", u + i);
|
|
38
38
|
}).join("");
|
|
39
39
|
}
|
|
40
|
-
function P(t, e, r,
|
|
41
|
-
const
|
|
40
|
+
function P(t, e, r, n) {
|
|
41
|
+
const c = [];
|
|
42
42
|
for (let o = 0; o < t.length; o += e)
|
|
43
|
-
|
|
44
|
-
return
|
|
45
|
-
const
|
|
43
|
+
c.push(t.slice(o, o + e));
|
|
44
|
+
return c.map((o, i) => {
|
|
45
|
+
const a = g(
|
|
46
46
|
o,
|
|
47
47
|
e,
|
|
48
48
|
r,
|
|
49
|
-
|
|
50
|
-
), l =
|
|
51
|
-
return
|
|
49
|
+
n
|
|
50
|
+
), l = O.replace("{-{-ATTRIBUTE_ROWS-}-}", a);
|
|
51
|
+
return i > 0 ? E + l : l;
|
|
52
52
|
}).join("");
|
|
53
53
|
}
|
|
54
|
-
function
|
|
55
|
-
return P(t, e,
|
|
54
|
+
function d(t, e, r) {
|
|
55
|
+
return P(t, e, w, r);
|
|
56
56
|
}
|
|
57
|
-
function
|
|
58
|
-
const e = t ? `ins-recommendation-v3-block-${t}` : void 0, r =
|
|
59
|
-
|
|
60
|
-
L
|
|
61
|
-
);
|
|
62
|
-
return r.replace("{-{-TITLE-}-}", S.TITLE).replace("{-{-PRODUCT_ROWS-}-}", c);
|
|
57
|
+
function W(t) {
|
|
58
|
+
const e = t ? `ins-recommendation-v3-block-${t}` : void 0, r = A("grid", e), n = S(), c = d(n, m), s = d(n, I);
|
|
59
|
+
return r.replace("{-{-TITLE-}-}", b.TITLE).replace("{-{-PRODUCT_ROWS-}-}", c).replace("{-{-MOBILE_PRODUCT_ROWS-}-}", s);
|
|
63
60
|
}
|
|
64
61
|
export {
|
|
65
|
-
|
|
62
|
+
W as getDefaultTemplate,
|
|
66
63
|
g as prepareGridAttributeRows,
|
|
67
64
|
P as prepareGridProductRows,
|
|
68
|
-
|
|
65
|
+
d as prepareProductRows
|
|
69
66
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { RecommendationBlockId as o } from "../../constants/blockIds.js";
|
|
2
|
-
import { ATTR_PRODUCT_BUTTON as l, ATTR_PRODUCT_IMAGE as d, ATTR_PRODUCT_OMNIBUS_DISCOUNT as
|
|
2
|
+
import { ATTR_PRODUCT_BUTTON as l, ATTR_PRODUCT_IMAGE as d, ATTR_PRODUCT_OMNIBUS_DISCOUNT as u, ATTR_PRODUCT_OMNIBUS_PRICE as m, ATTR_PRODUCT_OLD_PRICE as g, ATTR_PRODUCT_PRICE as f, ATTR_PRODUCT_NAME as x } from "../../constants/selectors.js";
|
|
3
3
|
import { useRecommendationExtensionStore as T } from "../../store/recommendation.js";
|
|
4
4
|
import { formatPrice as _ } from "../../utils/priceFormatter.js";
|
|
5
5
|
import { sanitizeImageUrl as y } from "../utils.js";
|
|
@@ -14,14 +14,14 @@ function p() {
|
|
|
14
14
|
thousandSeparator: e.thousandSeparator
|
|
15
15
|
};
|
|
16
16
|
}
|
|
17
|
-
function
|
|
18
|
-
const n = p(), r = t[e],
|
|
17
|
+
function s(t, e = "price") {
|
|
18
|
+
const n = p(), r = t[e], a = (r == null ? void 0 : r[n.code]) ?? Object.values(r ?? {})[0] ?? 0;
|
|
19
19
|
return _({
|
|
20
|
-
price:
|
|
20
|
+
price: a,
|
|
21
21
|
currency: n
|
|
22
22
|
});
|
|
23
23
|
}
|
|
24
|
-
const
|
|
24
|
+
const $ = {
|
|
25
25
|
/**
|
|
26
26
|
* Image cell - left column (120px fixed width)
|
|
27
27
|
* Has recommendation-attribute-row class and data attributes for Card Composition control
|
|
@@ -35,18 +35,13 @@ const P = {
|
|
|
35
35
|
data-visibility="1"
|
|
36
36
|
align="center"
|
|
37
37
|
valign="middle">
|
|
38
|
-
<
|
|
39
|
-
<
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
style="
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
alt="${t.name}"
|
|
46
|
-
style="max-width: 100%; max-height: 100%; object-fit: contain; display: block;"
|
|
47
|
-
class="adapt-img product-image">
|
|
48
|
-
</a>
|
|
49
|
-
</div>
|
|
38
|
+
<a target="_blank" href="${t.url}">
|
|
39
|
+
<img
|
|
40
|
+
src="${y(t.image_url)}"
|
|
41
|
+
alt="${t.name}"
|
|
42
|
+
style="display: block; max-width: 100%; height: auto;"
|
|
43
|
+
class="adapt-img product-image">
|
|
44
|
+
</a>
|
|
50
45
|
</td>
|
|
51
46
|
`,
|
|
52
47
|
/**
|
|
@@ -74,7 +69,7 @@ const P = {
|
|
|
74
69
|
esd-extension-block-id="${o.PRICE}"
|
|
75
70
|
align="left">
|
|
76
71
|
<p contenteditable="false" style="font-size: 16px; color: #333333; font-weight: bold; margin: 0;">
|
|
77
|
-
<strong>${
|
|
72
|
+
<strong>${s(t, "price")}</strong>
|
|
78
73
|
</p>
|
|
79
74
|
</td>
|
|
80
75
|
</tr>
|
|
@@ -91,7 +86,7 @@ const P = {
|
|
|
91
86
|
<p
|
|
92
87
|
contenteditable="false"
|
|
93
88
|
style="font-size: 14px; color: #999999; text-decoration: line-through; margin: 0;">
|
|
94
|
-
<strong>${
|
|
89
|
+
<strong>${s(t, "original_price")}</strong>
|
|
95
90
|
</p>
|
|
96
91
|
</td>
|
|
97
92
|
</tr>
|
|
@@ -99,7 +94,7 @@ const P = {
|
|
|
99
94
|
/**
|
|
100
95
|
* Omnibus price element - row for info cell table
|
|
101
96
|
*/
|
|
102
|
-
[
|
|
97
|
+
[m]: (t) => `
|
|
103
98
|
<tr>
|
|
104
99
|
<td
|
|
105
100
|
class="esd-block-text product-omnibus-price"
|
|
@@ -107,9 +102,9 @@ const P = {
|
|
|
107
102
|
data-text-after=""
|
|
108
103
|
esd-extension-block-id="${o.OMNIBUS_PRICE}"
|
|
109
104
|
align="left">
|
|
110
|
-
<p style="font-size: 12px; color: #666666; margin: 0;">
|
|
105
|
+
<p contenteditable="false" style="font-size: 12px; color: #666666; margin: 0;">
|
|
111
106
|
<span class="omnibus-text-before">Lowest 30-day price: </span>
|
|
112
|
-
<span class="omnibus-price-value">${
|
|
107
|
+
<span class="omnibus-price-value">${s(t, "original_price")}</span>
|
|
113
108
|
<span class="omnibus-text-after"></span>
|
|
114
109
|
</p>
|
|
115
110
|
</td>
|
|
@@ -118,9 +113,9 @@ const P = {
|
|
|
118
113
|
/**
|
|
119
114
|
* Omnibus discount element - row for info cell table
|
|
120
115
|
*/
|
|
121
|
-
[
|
|
122
|
-
var
|
|
123
|
-
const e = p(), n = ((
|
|
116
|
+
[u]: (t) => {
|
|
117
|
+
var i, c;
|
|
118
|
+
const e = p(), n = ((i = t.original_price) == null ? void 0 : i[e.code]) ?? Object.values(t.original_price ?? {})[0] ?? 0, r = ((c = t.price) == null ? void 0 : c[e.code]) ?? Object.values(t.price ?? {})[0] ?? 0, a = n > 0 ? Math.round((n - r) / n * 100) : 0, b = a > 0 ? `-${a}%` : "0%";
|
|
124
119
|
return `
|
|
125
120
|
<tr>
|
|
126
121
|
<td
|
|
@@ -129,7 +124,7 @@ const P = {
|
|
|
129
124
|
data-text-after=""
|
|
130
125
|
esd-extension-block-id="${o.OMNIBUS_DISCOUNT}"
|
|
131
126
|
align="left">
|
|
132
|
-
<p style="font-size: 12px; color: #666666; margin: 0;">
|
|
127
|
+
<p contenteditable="false" style="font-size: 12px; color: #666666; margin: 0;">
|
|
133
128
|
<span class="omnibus-text-before"></span>
|
|
134
129
|
<span class="omnibus-discount-value">${b}</span>
|
|
135
130
|
<span class="omnibus-text-after"></span>
|
|
@@ -170,5 +165,5 @@ const P = {
|
|
|
170
165
|
`
|
|
171
166
|
};
|
|
172
167
|
export {
|
|
173
|
-
|
|
168
|
+
$ as listElementRenderer
|
|
174
169
|
};
|
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
import { ATTR_PRODUCT_IMAGE as
|
|
2
|
-
const
|
|
1
|
+
import { ATTR_PRODUCT_IMAGE as o, ATTR_PRODUCT_NAME as s, ATTR_PRODUCT_OLD_PRICE as r, ATTR_PRODUCT_PRICE as l, ATTR_PRODUCT_OMNIBUS_PRICE as i, ATTR_PRODUCT_OMNIBUS_DISCOUNT as a, ATTR_PRODUCT_BUTTON as c } from "../constants/selectors.js";
|
|
2
|
+
const C = {
|
|
3
3
|
TITLE: "You May Also Like!"
|
|
4
|
-
},
|
|
5
|
-
a,
|
|
4
|
+
}, D = [
|
|
6
5
|
o,
|
|
7
|
-
c,
|
|
8
6
|
s,
|
|
7
|
+
r,
|
|
9
8
|
l,
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
9
|
+
i,
|
|
10
|
+
a,
|
|
11
|
+
c
|
|
12
|
+
], O = {
|
|
14
13
|
[o]: !0,
|
|
15
14
|
[s]: !0,
|
|
16
|
-
[
|
|
17
|
-
[
|
|
18
|
-
[
|
|
19
|
-
[
|
|
20
|
-
|
|
15
|
+
[l]: !0,
|
|
16
|
+
[r]: !0,
|
|
17
|
+
[i]: !1,
|
|
18
|
+
[a]: !1,
|
|
19
|
+
[c]: !0
|
|
20
|
+
}, m = `
|
|
21
21
|
<tr>
|
|
22
22
|
<td class="spacer" style="height: 10px;"></td>
|
|
23
23
|
</tr>
|
|
24
24
|
`, d = "https://email-static.useinsider.com/stripo/modules/email-recommendation-v3/assets/images/image-placeholder.png";
|
|
25
|
-
function
|
|
25
|
+
function U(t) {
|
|
26
26
|
return !t || typeof t != "string" || t.trim() === "" ? d : t.startsWith("http://") ? t.replace("http://", "https://") : t;
|
|
27
27
|
}
|
|
28
|
-
function
|
|
28
|
+
function T(t) {
|
|
29
29
|
return {
|
|
30
30
|
name: "Product Name",
|
|
31
31
|
image_url: d,
|
|
@@ -40,23 +40,19 @@ function e(t) {
|
|
|
40
40
|
category: []
|
|
41
41
|
};
|
|
42
42
|
}
|
|
43
|
-
function
|
|
44
|
-
return
|
|
45
|
-
|
|
46
|
-
e(
|
|
47
|
-
|
|
48
|
-
e("4"),
|
|
49
|
-
e("5"),
|
|
50
|
-
e("6")
|
|
51
|
-
];
|
|
43
|
+
function A(t = 6) {
|
|
44
|
+
return Array.from(
|
|
45
|
+
{ length: t },
|
|
46
|
+
(e, n) => T(String(n + 1))
|
|
47
|
+
);
|
|
52
48
|
}
|
|
53
|
-
function
|
|
54
|
-
const
|
|
55
|
-
data-layout="list"` : "";
|
|
49
|
+
function I(t = "grid", e) {
|
|
50
|
+
const n = t === "list" ? `
|
|
51
|
+
data-layout="list"` : "", p = e ? ` ${e}` : "";
|
|
56
52
|
return `
|
|
57
53
|
<td
|
|
58
54
|
align="left"
|
|
59
|
-
class="
|
|
55
|
+
class="${`recommendation-block-v2 esd-block-recommendation-v3-block es-p20${t === "list" ? " es-m-p0 ins-recommendation-list-layout" : ""}${p}`}"${n}>
|
|
60
56
|
<table width="100%" cellpadding="0" cellspacing="0" border="0">
|
|
61
57
|
<tr>
|
|
62
58
|
<td align="center">
|
|
@@ -88,11 +84,12 @@ function U(t = "grid", r) {
|
|
|
88
84
|
</table>
|
|
89
85
|
</td>
|
|
90
86
|
</tr>
|
|
91
|
-
${
|
|
87
|
+
${m}
|
|
92
88
|
<tr>
|
|
93
89
|
<td>
|
|
94
90
|
<table
|
|
95
|
-
class="ins-recommendation-product-container
|
|
91
|
+
class="ins-recommendation-product-container
|
|
92
|
+
ins-recommendation-desktop-container"
|
|
96
93
|
width="100%"
|
|
97
94
|
cellpadding="0"
|
|
98
95
|
cellspacing="0"
|
|
@@ -102,6 +99,21 @@ function U(t = "grid", r) {
|
|
|
102
99
|
</table>
|
|
103
100
|
</td>
|
|
104
101
|
</tr>
|
|
102
|
+
<tr class="ins-recommendation-mobile-row"${t === "list" ? ' style="display: none;"' : ""}>
|
|
103
|
+
<td>
|
|
104
|
+
<table
|
|
105
|
+
class="ins-recommendation-product-container
|
|
106
|
+
ins-recommendation-mobile-container"
|
|
107
|
+
width="100%"
|
|
108
|
+
cellpadding="0"
|
|
109
|
+
cellspacing="0"
|
|
110
|
+
border="0"
|
|
111
|
+
style="display: none;"
|
|
112
|
+
>${t === "list" ? "" : `
|
|
113
|
+
{-{-MOBILE_PRODUCT_ROWS-}-}`}
|
|
114
|
+
</table>
|
|
115
|
+
</td>
|
|
116
|
+
</tr>
|
|
105
117
|
</tbody>
|
|
106
118
|
</table>
|
|
107
119
|
</td>
|
|
@@ -111,12 +123,12 @@ function U(t = "grid", r) {
|
|
|
111
123
|
`;
|
|
112
124
|
}
|
|
113
125
|
export {
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
126
|
+
C as DEFAULTS,
|
|
127
|
+
D as DEFAULT_CARD_COMPOSITION,
|
|
128
|
+
O as DEFAULT_CARD_VISIBILITY,
|
|
117
129
|
d as PLACEHOLDER_IMAGE,
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
130
|
+
I as createBlockTemplate,
|
|
131
|
+
A as getDefaultProducts,
|
|
132
|
+
U as sanitizeImageUrl,
|
|
133
|
+
m as spacer
|
|
122
134
|
};
|
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
function l(t) {
|
|
2
2
|
if (t.length === 0)
|
|
3
3
|
return "";
|
|
4
|
-
const o = t.sort((r, e) => r.filterNumber - e.filterNumber), n = o.map((r) => `[${r.attribute}][${r.
|
|
5
|
-
let u =
|
|
6
|
-
for (let r = 0; r <
|
|
7
|
-
const e = o[r
|
|
8
|
-
u += `${e}${
|
|
4
|
+
const o = t.sort((r, e) => r.filterNumber - e.filterNumber), n = o.map((r) => `[${r.attribute}][${r.operator}][${r.value}]`), [p, ...i] = n;
|
|
5
|
+
let u = p;
|
|
6
|
+
for (let r = 0; r < i.length; r++) {
|
|
7
|
+
const e = o[r].innerGroupOperator;
|
|
8
|
+
u += `${e}${i[r]}`;
|
|
9
9
|
}
|
|
10
10
|
return `(${u})`;
|
|
11
11
|
}
|
|
12
12
|
function f(t) {
|
|
13
13
|
if (!t || t.length === 0)
|
|
14
14
|
return "";
|
|
15
|
-
const o = t.reduce((r, e) => (r[e.filterGroup] || (r[e.filterGroup] = []), r[e.filterGroup].push(e), r), {}), n = Object.keys(o).map(Number).sort((r, e) => r - e),
|
|
15
|
+
const o = t.reduce((r, e) => (r[e.filterGroup] || (r[e.filterGroup] = []), r[e.filterGroup].push(e), r), {}), n = Object.keys(o).map(Number).sort((r, e) => r - e), p = n.map((r) => {
|
|
16
16
|
const e = o[r];
|
|
17
17
|
return l(e);
|
|
18
|
-
}), [
|
|
19
|
-
let s =
|
|
18
|
+
}), [i, ...u] = p;
|
|
19
|
+
let s = i;
|
|
20
20
|
for (let r = 0; r < u.length; r++) {
|
|
21
21
|
const e = n[r + 1], c = o[e][0].outerGroupOperator;
|
|
22
22
|
s += `${c}${u[r]}`;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { safeParse as o, object as p, boolean as l, number as i, pipe as c, minLength as f, string as m } from "../../../../node_modules/valibot/dist/index.js";
|
|
2
|
+
const e = c(m(), f(1)), s = p({
|
|
3
|
+
type: e,
|
|
4
|
+
attribute: e,
|
|
5
|
+
operator: e,
|
|
6
|
+
innerGroupOperator: e,
|
|
7
|
+
outerGroupOperator: e,
|
|
8
|
+
value: e,
|
|
9
|
+
filterGroup: i(),
|
|
10
|
+
filterNumber: i(),
|
|
11
|
+
isValid: l()
|
|
12
|
+
});
|
|
13
|
+
function g(t) {
|
|
14
|
+
return o(s, t).success;
|
|
15
|
+
}
|
|
16
|
+
function S(t) {
|
|
17
|
+
const r = o(s, t);
|
|
18
|
+
return r.success ? /* @__PURE__ */ new Set() : new Set(
|
|
19
|
+
r.issues.flatMap((u) => {
|
|
20
|
+
var n;
|
|
21
|
+
return ((n = u.path) == null ? void 0 : n.map((a) => String(a.key))) ?? [];
|
|
22
|
+
})
|
|
23
|
+
);
|
|
24
|
+
}
|
|
25
|
+
export {
|
|
26
|
+
s as FilterSchema,
|
|
27
|
+
S as getInvalidFilterFields,
|
|
28
|
+
g as isFilterValid
|
|
29
|
+
};
|