@useinsider/guido 2.1.0-beta.e13d291 → 2.1.0-beta.e2153c2
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/extensions/recommendation/FilterSelectionDrawer.vue2.js +15 -14
- 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/useActionsApi.js +15 -13
- package/dist/composables/useBlocksConfig.js +26 -16
- package/dist/composables/useHtmlValidator.js +114 -104
- package/dist/composables/useRecommendation.js +54 -21
- package/dist/composables/useStripo.js +25 -23
- package/dist/composables/useVersionHistoryApi.js +1 -1
- package/dist/config/compiler/recommendationCompilerRules.js +45 -39
- package/dist/config/compiler/utils/recommendationCompilerUtils.js +121 -0
- 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 +142 -120
- package/dist/enums/defaults.js +8 -4
- package/dist/enums/extensions/recommendationBlock.js +1 -1
- package/dist/enums/recommendation.js +16 -15
- package/dist/extensions/Blocks/Items/block.js +19 -28
- package/dist/extensions/Blocks/Items/controls/button/link.js +19 -31
- package/dist/extensions/Blocks/Items/controls/cardComposition.js +124 -85
- package/dist/extensions/Blocks/Items/controls/image/link.js +19 -31
- package/dist/extensions/Blocks/Items/controls/name/trimming.js +28 -40
- package/dist/extensions/Blocks/Items/controls/price/currencyLocation.js +35 -47
- package/dist/extensions/Blocks/Items/controls/price/currencySymbol.js +49 -54
- package/dist/extensions/Blocks/Items/controls/price/formattedPrice.js +42 -51
- package/dist/extensions/Blocks/Items/controls/price/hideDiscount.js +23 -36
- package/dist/extensions/Blocks/Items/controls/price/priceOrientation.js +45 -57
- package/dist/extensions/Blocks/Items/controls/price/singlePrice.js +42 -60
- package/dist/extensions/Blocks/Items/controls/settingsControl.js +189 -196
- package/dist/extensions/Blocks/Items/enums/settingsEnums.js +0 -2
- package/dist/extensions/Blocks/Items/extension.js +8 -9
- package/dist/extensions/Blocks/Items/settingsPanel.js +10 -15
- package/dist/extensions/Blocks/Items/template.js +181 -175
- package/dist/extensions/Blocks/Items/utils/nodeConfigUtils.js +65 -65
- package/dist/extensions/Blocks/Recommendation/block.js +117 -27
- package/dist/extensions/Blocks/Recommendation/constants/defaultConfig.js +33 -31
- package/dist/extensions/Blocks/Recommendation/constants/layout.js +6 -4
- package/dist/extensions/Blocks/Recommendation/constants/selectors.js +12 -10
- package/dist/extensions/Blocks/Recommendation/controls/layout/index.js +10 -14
- package/dist/extensions/Blocks/Recommendation/controls/main/algorithm.js +19 -27
- package/dist/extensions/Blocks/Recommendation/controls/main/currency.js +49 -44
- package/dist/extensions/Blocks/Recommendation/controls/main/filters.js +1 -3
- package/dist/extensions/Blocks/Recommendation/controls/main/index.js +147 -102
- package/dist/extensions/Blocks/Recommendation/controls/main/locale.js +1 -5
- package/dist/extensions/Blocks/Recommendation/controls/main/productLayout.js +85 -43
- package/dist/extensions/Blocks/Recommendation/controls/main/shuffle.js +9 -13
- package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +138 -117
- package/dist/extensions/Blocks/Recommendation/controls/mobileLayout/cssRules.js +21 -0
- package/dist/extensions/Blocks/Recommendation/controls/name/textTrim.js +66 -34
- package/dist/extensions/Blocks/Recommendation/controls/spacing/index.js +2 -2
- package/dist/extensions/Blocks/Recommendation/services/configService.js +2 -1
- package/dist/extensions/Blocks/Recommendation/store/recommendation.js +248 -206
- package/dist/extensions/Blocks/Recommendation/templates/grid/elementRenderer.js +26 -31
- package/dist/extensions/Blocks/Recommendation/templates/grid/migration.js +1 -1
- package/dist/extensions/Blocks/Recommendation/templates/grid/template.js +31 -34
- package/dist/extensions/Blocks/Recommendation/templates/list/elementRenderer.js +20 -25
- package/dist/extensions/Blocks/Recommendation/templates/list/template.js +22 -22
- package/dist/extensions/Blocks/Recommendation/templates/utils.js +52 -39
- package/dist/extensions/Blocks/Recommendation/utils/preserveTextStyles.js +10 -10
- 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/Blocks/common-control.js +91 -92
- 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/package.json.js +1 -1
- package/dist/services/recommendationApi.js +11 -9
- package/dist/services/stripoApi.js +20 -17
- package/dist/services/templateLibraryApi.js +16 -13
- package/dist/src/@types/config/schemas.d.ts +8 -0
- package/dist/src/composables/useConfig.d.ts +4 -0
- package/dist/src/composables/useRecommendation.d.ts +1 -0
- package/dist/src/config/compiler/utils/recommendationCompilerUtils.d.ts +17 -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/Items/block.d.ts +0 -1
- package/dist/src/extensions/Blocks/Items/controls/button/link.d.ts +0 -1
- package/dist/src/extensions/Blocks/Items/controls/cardComposition.d.ts +5 -5
- package/dist/src/extensions/Blocks/Items/controls/image/link.d.ts +0 -1
- package/dist/src/extensions/Blocks/Items/controls/name/trimming.d.ts +0 -1
- package/dist/src/extensions/Blocks/Items/controls/price/currencyLocation.d.ts +0 -1
- package/dist/src/extensions/Blocks/Items/controls/price/currencySymbol.d.ts +0 -1
- package/dist/src/extensions/Blocks/Items/controls/price/formattedPrice.d.ts +0 -1
- package/dist/src/extensions/Blocks/Items/controls/price/hideDiscount.d.ts +0 -1
- package/dist/src/extensions/Blocks/Items/controls/price/priceOrientation.d.ts +0 -1
- package/dist/src/extensions/Blocks/Items/controls/price/singlePrice.d.ts +0 -5
- package/dist/src/extensions/Blocks/Items/controls/settingsControl.d.ts +10 -12
- package/dist/src/extensions/Blocks/Items/utils/nodeConfigUtils.d.ts +2 -1
- package/dist/src/extensions/Blocks/Recommendation/block.d.ts +44 -11
- package/dist/src/extensions/Blocks/Recommendation/constants/index.d.ts +2 -2
- package/dist/src/extensions/Blocks/Recommendation/constants/layout.d.ts +6 -0
- package/dist/src/extensions/Blocks/Recommendation/constants/selectors.d.ts +4 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/main/currency.d.ts +8 -1
- package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +27 -5
- package/dist/src/extensions/Blocks/Recommendation/controls/main/productLayout.d.ts +22 -4
- package/dist/src/extensions/Blocks/Recommendation/controls/main/utils.d.ts +9 -2
- package/dist/src/extensions/Blocks/Recommendation/controls/mobileLayout/cssRules.d.ts +29 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/name/textTrim.d.ts +19 -1
- package/dist/src/extensions/Blocks/Recommendation/controls/spacing/index.d.ts +2 -2
- package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +138 -469
- package/dist/src/extensions/Blocks/Recommendation/templates/grid/elementRenderer.d.ts +2 -2
- package/dist/src/extensions/Blocks/Recommendation/templates/grid/template.d.ts +4 -4
- package/dist/src/extensions/Blocks/Recommendation/templates/index.d.ts +2 -0
- package/dist/src/extensions/Blocks/Recommendation/templates/list/elementRenderer.d.ts +2 -2
- package/dist/src/extensions/Blocks/Recommendation/templates/list/template.d.ts +2 -2
- package/dist/src/extensions/Blocks/Recommendation/templates/utils.d.ts +16 -4
- package/dist/src/extensions/Blocks/Recommendation/types/nodeConfig.d.ts +14 -2
- package/dist/src/extensions/Blocks/Recommendation/utils/stylePreserver.d.ts +1 -1
- package/dist/src/extensions/Blocks/Unsubscribe/control.d.ts +1 -0
- package/dist/src/extensions/Blocks/common-control.d.ts +4 -5
- 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 +10 -9
- 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/dist/utils/pairProductVariables.js +57 -56
- package/dist/utils/templatePreparation.js +15 -14
- package/package.json +2 -2
- package/dist/extensions/Blocks/Items/store/items-block.js +0 -79
- package/dist/src/extensions/Blocks/Items/store/items-block.d.ts +0 -45
- package/dist/src/extensions/Blocks/Recommendation/controls/nameTextTrimControl.d.ts +0 -16
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ATTR_PRODUCT_BUTTON as s, ATTR_PRODUCT_OMNIBUS_DISCOUNT as d, ATTR_PRODUCT_OMNIBUS_PRICE as c, ATTR_PRODUCT_OLD_PRICE as o, ATTR_PRODUCT_PRICE as i, ATTR_PRODUCT_NAME as r, ATTR_PRODUCT_IMAGE as p } from "../../constants/selectors.js";
|
|
2
|
-
import {
|
|
2
|
+
import { prepareGridProductRows as b } from "./template.js";
|
|
3
3
|
const u = `
|
|
4
4
|
<td
|
|
5
5
|
align="left"
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { DEFAULT_PRODUCTS_PER_ROW as
|
|
2
|
-
import { DEFAULT_CARD_COMPOSITION as
|
|
3
|
-
import {
|
|
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 E = `
|
|
|
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 E = `
|
|
|
27
27
|
{-{-CELLS-}-}
|
|
28
28
|
</tr>
|
|
29
29
|
`;
|
|
30
|
-
function
|
|
31
|
-
const c = (100 / e).toFixed(2);
|
|
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
|
|
40
|
+
function P(t, e, r, n) {
|
|
41
41
|
const c = [];
|
|
42
|
-
for (let
|
|
43
|
-
c.push(
|
|
44
|
-
return c.map((
|
|
45
|
-
const
|
|
46
|
-
t,
|
|
47
|
-
e,
|
|
42
|
+
for (let o = 0; o < t.length; o += e)
|
|
43
|
+
c.push(t.slice(o, o + e));
|
|
44
|
+
return c.map((o, i) => {
|
|
45
|
+
const a = g(
|
|
48
46
|
o,
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
47
|
+
e,
|
|
48
|
+
r,
|
|
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
|
|
54
|
+
function d(t, e, r) {
|
|
55
|
+
return P(t, e, w, r);
|
|
56
56
|
}
|
|
57
|
-
function
|
|
58
|
-
const r =
|
|
59
|
-
|
|
60
|
-
T
|
|
61
|
-
);
|
|
62
|
-
return r.replace("{-{-TITLE-}-}", I.TITLE).replace("{-{-PRODUCT_ROWS-}-}", e);
|
|
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
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
62
|
+
W as getDefaultTemplate,
|
|
63
|
+
g as prepareGridAttributeRows,
|
|
64
|
+
P as prepareGridProductRows,
|
|
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"
|
|
@@ -109,7 +104,7 @@ const P = {
|
|
|
109
104
|
align="left">
|
|
110
105
|
<p 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
|
|
@@ -170,5 +165,5 @@ const P = {
|
|
|
170
165
|
`
|
|
171
166
|
};
|
|
172
167
|
export {
|
|
173
|
-
|
|
168
|
+
$ as listElementRenderer
|
|
174
169
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ATTR_PRODUCT_IMAGE as E, ATTR_PRODUCT_NAME as
|
|
2
|
-
import { spacer as $, DEFAULT_CARD_VISIBILITY as
|
|
3
|
-
import {
|
|
1
|
+
import { ATTR_PRODUCT_IMAGE as E, ATTR_PRODUCT_NAME as l, ATTR_PRODUCT_OLD_PRICE as c, ATTR_PRODUCT_PRICE as a, ATTR_PRODUCT_OMNIBUS_PRICE as d, ATTR_PRODUCT_OMNIBUS_DISCOUNT as T, ATTR_PRODUCT_BUTTON as N } from "../../constants/selectors.js";
|
|
2
|
+
import { spacer as $, DEFAULT_CARD_VISIBILITY as o } from "../utils.js";
|
|
3
|
+
import { listElementRenderer as e } from "./elementRenderer.js";
|
|
4
4
|
const f = `
|
|
5
5
|
<tr class="recommendation-product-row">
|
|
6
6
|
<td style="padding: 0 5px;">
|
|
@@ -20,30 +20,30 @@ const f = `
|
|
|
20
20
|
</tr>
|
|
21
21
|
`;
|
|
22
22
|
function V(t) {
|
|
23
|
-
const
|
|
23
|
+
const r = e[E](t), s = o[l], i = o[c], R = o[a], C = o[d], b = o[T], n = (w, A, p) => {
|
|
24
24
|
const I = p ? "" : ' style="display: none;"', g = w.replace(/<tr>/, "").replace(/<\/tr>/, "");
|
|
25
25
|
return `<tr
|
|
26
26
|
class="recommendation-attribute-row"
|
|
27
27
|
data-attribute-type="${A}"
|
|
28
28
|
data-visibility="${p ? "1" : "0"}"${I}>${g}</tr>`;
|
|
29
|
-
}, m =
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
), _ =
|
|
34
|
-
|
|
29
|
+
}, m = n(
|
|
30
|
+
e[l](t),
|
|
31
|
+
l,
|
|
32
|
+
s
|
|
33
|
+
), _ = n(
|
|
34
|
+
e[c](t),
|
|
35
35
|
c,
|
|
36
|
-
|
|
37
|
-
), O =
|
|
38
|
-
|
|
36
|
+
i
|
|
37
|
+
), O = n(
|
|
38
|
+
e[a](t),
|
|
39
39
|
a,
|
|
40
40
|
R
|
|
41
|
-
), P =
|
|
42
|
-
|
|
41
|
+
), P = n(
|
|
42
|
+
e[d](t),
|
|
43
43
|
d,
|
|
44
44
|
C
|
|
45
|
-
), u =
|
|
46
|
-
|
|
45
|
+
), u = n(
|
|
46
|
+
e[T](t),
|
|
47
47
|
T,
|
|
48
48
|
b
|
|
49
49
|
), D = `
|
|
@@ -58,16 +58,16 @@ function V(t) {
|
|
|
58
58
|
</tbody>
|
|
59
59
|
</table>
|
|
60
60
|
</td>
|
|
61
|
-
`, U =
|
|
61
|
+
`, U = e[N](t), y = r + D + U;
|
|
62
62
|
return f.replace("{-{-PRODUCT_CONTENT-}-}", y);
|
|
63
63
|
}
|
|
64
64
|
function M(t) {
|
|
65
|
-
return t.map((
|
|
66
|
-
const
|
|
67
|
-
return
|
|
65
|
+
return t.map((r, s) => {
|
|
66
|
+
const i = V(r);
|
|
67
|
+
return s > 0 ? $ + i : i;
|
|
68
68
|
}).join("");
|
|
69
69
|
}
|
|
70
70
|
export {
|
|
71
|
-
V as
|
|
71
|
+
V as getListProductCard,
|
|
72
72
|
M as prepareProductRows
|
|
73
73
|
};
|
|
@@ -1,34 +1,34 @@
|
|
|
1
|
-
import { ATTR_PRODUCT_IMAGE as
|
|
2
|
-
const
|
|
1
|
+
import { ATTR_PRODUCT_IMAGE as n, ATTR_PRODUCT_NAME as o, ATTR_PRODUCT_OLD_PRICE as a, ATTR_PRODUCT_PRICE as c, ATTR_PRODUCT_OMNIBUS_PRICE as l, ATTR_PRODUCT_OMNIBUS_DISCOUNT as i, ATTR_PRODUCT_BUTTON as s } from "../constants/selectors.js";
|
|
2
|
+
const g = {
|
|
3
3
|
TITLE: "You May Also Like!"
|
|
4
4
|
}, u = [
|
|
5
|
-
|
|
6
|
-
a,
|
|
5
|
+
n,
|
|
7
6
|
o,
|
|
7
|
+
a,
|
|
8
8
|
c,
|
|
9
9
|
l,
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
],
|
|
13
|
-
[
|
|
14
|
-
[a]: !0,
|
|
15
|
-
[c]: !0,
|
|
10
|
+
i,
|
|
11
|
+
s
|
|
12
|
+
], b = {
|
|
13
|
+
[n]: !0,
|
|
16
14
|
[o]: !0,
|
|
15
|
+
[c]: !0,
|
|
16
|
+
[a]: !0,
|
|
17
17
|
[l]: !1,
|
|
18
|
-
[
|
|
19
|
-
[
|
|
20
|
-
},
|
|
18
|
+
[i]: !1,
|
|
19
|
+
[s]: !0
|
|
20
|
+
}, p = `
|
|
21
21
|
<tr>
|
|
22
22
|
<td class="spacer" style="height: 10px;"></td>
|
|
23
23
|
</tr>
|
|
24
|
-
`,
|
|
25
|
-
function
|
|
26
|
-
return !t || typeof t != "string" || t.trim() === "" ?
|
|
24
|
+
`, d = "https://email-static.useinsider.com/stripo/modules/email-recommendation-v3/assets/images/image-placeholder.png";
|
|
25
|
+
function R(t) {
|
|
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
|
-
image_url:
|
|
31
|
+
image_url: d,
|
|
32
32
|
price: { USD: 18 },
|
|
33
33
|
original_price: { USD: 20 },
|
|
34
34
|
discount: { USD: 2 },
|
|
@@ -40,22 +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 D(t = 6) {
|
|
44
|
+
return Array.from(
|
|
45
|
+
{ length: t },
|
|
46
|
+
(e, r) => T(String(r + 1))
|
|
47
|
+
);
|
|
52
48
|
}
|
|
53
|
-
function
|
|
49
|
+
function O(t = "grid", e) {
|
|
50
|
+
const r = t === "list" ? `
|
|
51
|
+
data-layout="list"` : "";
|
|
54
52
|
return `
|
|
55
53
|
<td
|
|
56
54
|
align="left"
|
|
57
|
-
class="ins-recommendation-v3-block-v2 esd-block-recommendation-v3-block es-p20
|
|
58
|
-
data-layout="list"` : ""}>
|
|
55
|
+
class="ins-recommendation-v3-block-v2 esd-block-recommendation-v3-block es-p20${e ? ` ${e}` : ""}"${r}>
|
|
59
56
|
<table width="100%" cellpadding="0" cellspacing="0" border="0">
|
|
60
57
|
<tr>
|
|
61
58
|
<td align="center">
|
|
@@ -87,11 +84,12 @@ function R(t = "grid") {
|
|
|
87
84
|
</table>
|
|
88
85
|
</td>
|
|
89
86
|
</tr>
|
|
90
|
-
${
|
|
87
|
+
${p}
|
|
91
88
|
<tr>
|
|
92
89
|
<td>
|
|
93
90
|
<table
|
|
94
|
-
class="ins-recommendation-product-container
|
|
91
|
+
class="ins-recommendation-product-container
|
|
92
|
+
ins-recommendation-desktop-container"
|
|
95
93
|
width="100%"
|
|
96
94
|
cellpadding="0"
|
|
97
95
|
cellspacing="0"
|
|
@@ -101,6 +99,21 @@ function R(t = "grid") {
|
|
|
101
99
|
</table>
|
|
102
100
|
</td>
|
|
103
101
|
</tr>
|
|
102
|
+
<tr>
|
|
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
|
+
>
|
|
113
|
+
{-{-MOBILE_PRODUCT_ROWS-}-}
|
|
114
|
+
</table>
|
|
115
|
+
</td>
|
|
116
|
+
</tr>
|
|
104
117
|
</tbody>
|
|
105
118
|
</table>
|
|
106
119
|
</td>
|
|
@@ -110,12 +123,12 @@ function R(t = "grid") {
|
|
|
110
123
|
`;
|
|
111
124
|
}
|
|
112
125
|
export {
|
|
113
|
-
|
|
126
|
+
g as DEFAULTS,
|
|
114
127
|
u as DEFAULT_CARD_COMPOSITION,
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
128
|
+
b as DEFAULT_CARD_VISIBILITY,
|
|
129
|
+
d as PLACEHOLDER_IMAGE,
|
|
130
|
+
O as createBlockTemplate,
|
|
131
|
+
D as getDefaultProducts,
|
|
132
|
+
R as sanitizeImageUrl,
|
|
133
|
+
p as spacer
|
|
121
134
|
};
|
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
function
|
|
2
|
-
const
|
|
1
|
+
function m(t) {
|
|
2
|
+
const e = {
|
|
3
3
|
"&": "&",
|
|
4
4
|
"<": "<",
|
|
5
5
|
">": ">",
|
|
6
6
|
'"': """,
|
|
7
7
|
"'": "'"
|
|
8
8
|
};
|
|
9
|
-
return t.replace(/[&<>"']/g, (n) =>
|
|
9
|
+
return t.replace(/[&<>"']/g, (n) => e[n]);
|
|
10
10
|
}
|
|
11
|
-
function
|
|
12
|
-
return "getInnerHTML" in t && typeof t.getInnerHTML == "function" ? t.getInnerHTML() : "innerHTML" in t ? t.innerHTML : "";
|
|
11
|
+
function p(t) {
|
|
12
|
+
return "getInnerHTML" in t && typeof t.getInnerHTML == "function" ? t.getInnerHTML().trim() : "innerHTML" in t ? t.innerHTML : "";
|
|
13
13
|
}
|
|
14
|
-
function T(t,
|
|
15
|
-
const n =
|
|
14
|
+
function T(t, e) {
|
|
15
|
+
const n = m(e);
|
|
16
16
|
if (!t)
|
|
17
17
|
return n;
|
|
18
|
-
const
|
|
19
|
-
if (!
|
|
18
|
+
const r = p(t);
|
|
19
|
+
if (!r || r.trim() === "" || !/<(strong|em|u|s|b|i)\b/i.test(r))
|
|
20
20
|
return n;
|
|
21
21
|
const i = [], o = [];
|
|
22
|
-
let c =
|
|
22
|
+
let c = r.trim();
|
|
23
23
|
for (; ; ) {
|
|
24
24
|
const u = c.match(/^<(strong|em|u|s|b|i)(\s[^>]*)?>(.*)$/is);
|
|
25
25
|
if (!u)
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
var d = Object.defineProperty;
|
|
2
|
-
var
|
|
3
|
-
var u = (n, i, e) =>
|
|
2
|
+
var h = (n, i, e) => i in n ? d(n, i, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[i] = e;
|
|
3
|
+
var u = (n, i, e) => h(n, typeof i != "symbol" ? i + "" : i, e);
|
|
4
4
|
import { PAGE_TYPES as E } from "../../../enums/unsubscribe.js";
|
|
5
5
|
import { useUnsubscribeStore as c } from "../../../stores/unsubscribe.js";
|
|
6
|
-
import { Block as
|
|
6
|
+
import { Block as _, BlockCompositionType as S, ModificationDescription as b } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
7
7
|
import { getDefaultTemplate as L } from "./template.js";
|
|
8
8
|
import { UNSUBSCRIBE_EVENTS as a, DATA_ATTRIBUTES as o } from "./utils/constants.js";
|
|
9
9
|
import { parsePageList as p } from "./utils/utils.js";
|
|
10
|
-
const
|
|
10
|
+
const v = "unsubscribe-block", g = 'a[data-unsubscribe-link="true"]', f = ".unsubscribe-block-v2", T = "{{ins-unsubscribe-link}}", B = {
|
|
11
11
|
[E.GLOBAL_UNSUBSCRIBE]: "{{ins-global-unsubscribe-link}}",
|
|
12
12
|
[E.SUBSCRIPTION_PREFERENCE_CENTER]: "{{ins-preferences-unsubscribe-link}}"
|
|
13
13
|
};
|
|
14
|
-
class R extends
|
|
14
|
+
class R extends _ {
|
|
15
15
|
constructor() {
|
|
16
16
|
super();
|
|
17
17
|
u(this, "selectEventListener", null);
|
|
@@ -19,7 +19,7 @@ class R extends h {
|
|
|
19
19
|
u(this, "currentNode");
|
|
20
20
|
}
|
|
21
21
|
getId() {
|
|
22
|
-
return
|
|
22
|
+
return v;
|
|
23
23
|
}
|
|
24
24
|
getIcon() {
|
|
25
25
|
return "unsubscribe-icon";
|
|
@@ -47,8 +47,8 @@ class R extends h {
|
|
|
47
47
|
}
|
|
48
48
|
_setupSelectEventListener() {
|
|
49
49
|
this._removeSelectEventListener(), this.selectEventListener = (e) => {
|
|
50
|
-
const
|
|
51
|
-
this._updateBlock(
|
|
50
|
+
const r = e, { collectionType: s, selectedPages: t } = r.detail;
|
|
51
|
+
this._updateBlock(s, t.join(","));
|
|
52
52
|
}, document.addEventListener(a.SELECT, this.selectEventListener);
|
|
53
53
|
}
|
|
54
54
|
_removeSelectEventListener() {
|
|
@@ -74,17 +74,17 @@ class R extends h {
|
|
|
74
74
|
_removeEventListeners() {
|
|
75
75
|
this._removeSelectEventListener(), this._removeCancelEventListener();
|
|
76
76
|
}
|
|
77
|
-
_updateBlock(e,
|
|
77
|
+
_updateBlock(e, r) {
|
|
78
78
|
if (!this.currentNode || !("querySelector" in this.currentNode))
|
|
79
79
|
return;
|
|
80
|
-
const
|
|
81
|
-
if (!
|
|
80
|
+
const s = this.currentNode.querySelector(g);
|
|
81
|
+
if (!s)
|
|
82
82
|
return;
|
|
83
|
-
const
|
|
84
|
-
this.api.getDocumentModifier().modifyHtml(
|
|
83
|
+
const t = this._getMergeTag(e);
|
|
84
|
+
this.api.getDocumentModifier().modifyHtml(s).setAttribute("href", t).apply(new b(`Updated unsubscribe link to ${t}`)), this.api.getDocumentModifier().modifyHtml(this.currentNode).setAttribute(o.PAGE_TYPE, e.toString()).setAttribute(o.PAGE_LIST, r).apply(new b("Updated unsubscribe block metadata"));
|
|
85
85
|
}
|
|
86
86
|
_getMergeTag(e) {
|
|
87
|
-
return
|
|
87
|
+
return B[e] ?? T;
|
|
88
88
|
}
|
|
89
89
|
_openDrawer() {
|
|
90
90
|
if (!(this.currentNode && this.currentNode.getAttribute("data-unsubscribe-page-type")))
|
|
@@ -97,24 +97,24 @@ class R extends h {
|
|
|
97
97
|
}
|
|
98
98
|
_checkExistingBlocks() {
|
|
99
99
|
const e = c();
|
|
100
|
-
e.isGlobalUnsubscribeDisabled = !1, e.isSubscriptionPreferencesCenterDisabled = !1, this.api.getDocumentRoot().querySelectorAll(f).forEach((
|
|
101
|
-
if ("getAttribute" in
|
|
102
|
-
const
|
|
103
|
-
if (
|
|
104
|
-
const l = Number(
|
|
100
|
+
e.isGlobalUnsubscribeDisabled = !1, e.isSubscriptionPreferencesCenterDisabled = !1, this.api.getDocumentRoot().querySelectorAll(f).forEach((s) => {
|
|
101
|
+
if ("getAttribute" in s) {
|
|
102
|
+
const t = s.getAttribute(o.PAGE_TYPE);
|
|
103
|
+
if (t) {
|
|
104
|
+
const l = Number(t);
|
|
105
105
|
l === E.GLOBAL_UNSUBSCRIBE ? e.isGlobalUnsubscribeDisabled = !0 : l === E.SUBSCRIPTION_PREFERENCE_CENTER && (e.isSubscriptionPreferencesCenterDisabled = !0);
|
|
106
106
|
}
|
|
107
107
|
}
|
|
108
108
|
});
|
|
109
109
|
}
|
|
110
|
-
_loadBlockState(e) {
|
|
110
|
+
async _loadBlockState(e) {
|
|
111
111
|
if (!("getAttribute" in e))
|
|
112
112
|
return;
|
|
113
|
-
const
|
|
114
|
-
if (!
|
|
113
|
+
const r = e.getAttribute(o.PAGE_TYPE), s = e.getAttribute(o.PAGE_LIST);
|
|
114
|
+
if (!r || !s)
|
|
115
115
|
return;
|
|
116
|
-
const
|
|
117
|
-
|
|
116
|
+
const t = c(), l = Number(r), m = p(s);
|
|
117
|
+
await t.fetchTemplates(), t.setCollectionWithoutAutoSelection(l), t.loadSelectedTemplates(m);
|
|
118
118
|
}
|
|
119
119
|
_resetStoreState() {
|
|
120
120
|
c().$reset();
|
|
@@ -122,14 +122,14 @@ class R extends h {
|
|
|
122
122
|
_removeBlockTemplatesFromStore(e) {
|
|
123
123
|
if (!("getAttribute" in e))
|
|
124
124
|
return;
|
|
125
|
-
const
|
|
126
|
-
if (!
|
|
125
|
+
const r = e.getAttribute(o.PAGE_LIST);
|
|
126
|
+
if (!r)
|
|
127
127
|
return;
|
|
128
|
-
const
|
|
129
|
-
|
|
128
|
+
const s = c(), t = p(r);
|
|
129
|
+
s.removeUnsubscribePages(t);
|
|
130
130
|
}
|
|
131
131
|
}
|
|
132
132
|
export {
|
|
133
|
-
|
|
133
|
+
v as UNSUBSCRIBE_BLOCK_ID,
|
|
134
134
|
R as UnsubscribeBlock
|
|
135
135
|
};
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var u = (a, s, e) =>
|
|
1
|
+
var d = Object.defineProperty;
|
|
2
|
+
var h = (a, s, e) => s in a ? d(a, s, { enumerable: !0, configurable: !0, writable: !0, value: e }) : a[s] = e;
|
|
3
|
+
var u = (a, s, e) => h(a, typeof s != "symbol" ? s + "" : s, e);
|
|
4
4
|
import { useUnsubscribeStore as l } from "../../../stores/unsubscribe.js";
|
|
5
5
|
import { Control as T, UEAttr as i, UIElementType as n } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
6
6
|
import { DATA_ATTRIBUTES as p } from "./utils/constants.js";
|
|
7
7
|
import { parsePageList as _ } from "./utils/utils.js";
|
|
8
|
-
const
|
|
8
|
+
const v = "ui-elements-unsubscribe", r = {
|
|
9
9
|
SELECT_BUTTON: "selectTemplateButton",
|
|
10
10
|
PREV_BUTTON: "prevButton",
|
|
11
11
|
NEXT_BUTTON: "nextButton",
|
|
12
12
|
COUNTER_TEXT: "counterText",
|
|
13
13
|
PREVIEW_IMAGE: "previewImage"
|
|
14
14
|
};
|
|
15
|
-
class
|
|
15
|
+
class B extends T {
|
|
16
16
|
constructor() {
|
|
17
17
|
super(...arguments);
|
|
18
18
|
u(this, "currentPreviewIndex", 0);
|
|
@@ -22,7 +22,7 @@ class N extends T {
|
|
|
22
22
|
u(this, "lastParsedAttribute");
|
|
23
23
|
}
|
|
24
24
|
getId() {
|
|
25
|
-
return
|
|
25
|
+
return v;
|
|
26
26
|
}
|
|
27
27
|
getTemplate() {
|
|
28
28
|
return `
|
|
@@ -35,7 +35,7 @@ class N extends T {
|
|
|
35
35
|
onTemplateNodeUpdated(e) {
|
|
36
36
|
if (this.currentNode = e, "getAttribute" in this.currentNode) {
|
|
37
37
|
const t = this.currentNode.getAttribute(p.PAGE_LIST);
|
|
38
|
-
t && (t !== this.lastParsedAttribute && (this.currentPages = _(t), this.lastParsedAttribute = t, this.currentPreviewIndex = 0), this.
|
|
38
|
+
t && (t !== this.lastParsedAttribute && (this.currentPages = _(t), this.lastParsedAttribute = t, this.currentPreviewIndex = 0), this._updateCounter(), this._loadAndUpdatePreview());
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
41
|
onRender() {
|
|
@@ -73,6 +73,9 @@ class N extends T {
|
|
|
73
73
|
_onNextClick() {
|
|
74
74
|
this.currentPreviewIndex < this.totalTemplates - 1 && (this.currentPreviewIndex++, this._updatePreview(), this._updateCounter());
|
|
75
75
|
}
|
|
76
|
+
async _loadAndUpdatePreview() {
|
|
77
|
+
await l().fetchTemplates(), this._updatePreview(), this._updateCounter();
|
|
78
|
+
}
|
|
76
79
|
_updatePreview() {
|
|
77
80
|
var e;
|
|
78
81
|
if ((e = this.currentPages) != null && e.length)
|
|
@@ -162,6 +165,6 @@ class N extends T {
|
|
|
162
165
|
}
|
|
163
166
|
}
|
|
164
167
|
export {
|
|
165
|
-
|
|
166
|
-
|
|
168
|
+
v as UNSUBSCRIBE_CONTROL_ID,
|
|
169
|
+
B as UnsubscribeControl
|
|
167
170
|
};
|