@useinsider/guido 3.1.1 → 3.2.0-beta.080341b
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 +117 -0
- package/dist/@types/config/schemas.js +166 -96
- package/dist/components/Guido.vue.js +4 -4
- package/dist/components/Guido.vue2.js +92 -80
- package/dist/components/organisms/AutoSaveController.vue.js +17 -0
- package/dist/components/organisms/AutoSaveController.vue2.js +13 -0
- package/dist/components/organisms/email-preview/desktop-preview/EmailSizeIndicator.vue.js +7 -7
- package/dist/components/organisms/email-preview/desktop-preview/EmailSizeIndicator.vue2.js +12 -20
- package/dist/components/organisms/header/AutoSaveToggle.vue.js +22 -0
- package/dist/components/organisms/header/AutoSaveToggle.vue2.js +19 -0
- package/dist/components/organisms/header/EditorActions.vue.js +2 -2
- package/dist/components/organisms/header/EditorActions.vue2.js +51 -36
- package/dist/components/organisms/header/RightSlot.vue.js +11 -11
- package/dist/components/organisms/header/RightSlot.vue2.js +17 -13
- package/dist/components/organisms/onboarding/AMPOnboarding.vue2.js +51 -31
- package/dist/components/organisms/onboarding/GenericOnboarding.vue.js +1 -1
- package/dist/components/organisms/onboarding/GenericOnboarding.vue2.js +23 -22
- package/dist/components/organisms/onboarding/ItemsOnboarding.vue.js +1 -1
- package/dist/components/organisms/onboarding/ItemsOnboarding.vue2.js +37 -39
- package/dist/components/organisms/onboarding/TextBlockOnboarding.vue.js +3 -3
- package/dist/components/organisms/onboarding/TextBlockOnboarding.vue2.js +30 -41
- package/dist/components/organisms/onboarding/VersionHistoryOnboarding.vue2.js +15 -14
- package/dist/components/organisms/save-as-template/SaveAsTemplateDrawer.vue2.js +18 -17
- package/dist/composables/useActionsApi.js +4 -4
- package/dist/composables/useAutoSave.js +71 -0
- package/dist/composables/useFullStoryBridge.js +14 -0
- package/dist/composables/useHtmlCompiler.js +23 -21
- package/dist/composables/useHtmlValidator.js +40 -38
- package/dist/composables/usePreviewMode.js +20 -16
- package/dist/composables/useRecommendation.js +46 -26
- package/dist/composables/useRibbonOffset.js +21 -0
- package/dist/composables/useSave.js +26 -15
- package/dist/composables/useStripo.js +48 -45
- package/dist/composables/validators/useCouponBlockValidator.js +24 -0
- package/dist/composables/validators/useLiquidValidator.js +42 -0
- package/dist/config/compiler/liquidCompilerRules.js +15 -0
- package/dist/config/compiler/recommendationCompilerRules.js +162 -43
- package/dist/config/compiler/unsubscribeCompilerRules.js +48 -45
- package/dist/config/compiler/utils/recommendationCompilerUtils.js +110 -71
- package/dist/config/i18n/en/tooltips.json.js +2 -1
- package/dist/config/migrator/checkboxMigrator.js +5 -3
- package/dist/config/migrator/index.js +9 -9
- package/dist/config/migrator/radioButtonMigrator.js +66 -44
- package/dist/config/migrator/recommendation/compositionMapper.js +98 -0
- package/dist/config/migrator/recommendation/extractors.js +27 -0
- package/dist/config/migrator/recommendation/htmlBuilder.js +496 -0
- package/dist/config/migrator/recommendation/parseLegacyConfig.js +33 -0
- package/dist/config/migrator/recommendation/settingsMapper.js +70 -0
- package/dist/config/migrator/recommendation/themeMapper.js +93 -0
- package/dist/config/migrator/recommendationMigrator.js +74 -290
- package/dist/enums/extensions/recommendationBlock.js +16 -12
- package/dist/enums/onboarding.js +7 -2
- package/dist/enums/recommendation.js +2 -2
- package/dist/enums/unsubscribe.js +34 -27
- package/dist/extensions/Blocks/CouponBlock/template.js +24 -13
- package/dist/extensions/Blocks/Items/controls/price/singlePrice.js +38 -38
- package/dist/extensions/Blocks/Items/enums/productEnums.js +19 -7
- package/dist/extensions/Blocks/RadioButton/template.js +1 -1
- package/dist/extensions/Blocks/Recommendation/block.js +60 -50
- package/dist/extensions/Blocks/Recommendation/constants/controlIds.js +1 -1
- package/dist/extensions/Blocks/Recommendation/constants/defaultConfig.js +5 -5
- package/dist/extensions/Blocks/Recommendation/constants/selectors.js +27 -11
- package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +185 -172
- package/dist/extensions/Blocks/Recommendation/controls/customAttribute/index.js +21 -18
- package/dist/extensions/Blocks/Recommendation/controls/customAttribute/textTrim.js +99 -0
- package/dist/extensions/Blocks/Recommendation/controls/main/algorithm.js +27 -26
- package/dist/extensions/Blocks/Recommendation/controls/main/index.js +3 -1
- package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +211 -162
- package/dist/extensions/Blocks/Recommendation/controls/name/textTrim.js +27 -57
- package/dist/extensions/Blocks/Recommendation/controls/shared/textTrimCssRules.js +14 -0
- package/dist/extensions/Blocks/Recommendation/controls/spacing/index.js +75 -73
- package/dist/extensions/Blocks/Recommendation/services/configService.js +76 -33
- package/dist/extensions/Blocks/Recommendation/settingsPanel.js +18 -17
- package/dist/extensions/Blocks/Recommendation/store/recommendation.js +123 -79
- package/dist/extensions/Blocks/Recommendation/templates/grid/elementRenderer.js +24 -13
- package/dist/extensions/Blocks/Recommendation/templates/grid/template.js +30 -29
- package/dist/extensions/Blocks/Recommendation/templates/index.js +7 -7
- package/dist/extensions/Blocks/Recommendation/templates/list/elementRenderer.js +27 -15
- package/dist/extensions/Blocks/Recommendation/templates/list/template.js +21 -21
- package/dist/extensions/Blocks/Recommendation/templates/utils.js +57 -50
- package/dist/extensions/Blocks/Recommendation/utils/filterUtil.js +17 -14
- package/dist/extensions/Blocks/Recommendation/utils/legacyStrategyMap.js +21 -0
- package/dist/extensions/Blocks/Recommendation/utils/preserveTextStyles.js +13 -22
- package/dist/extensions/Blocks/Recommendation/utils/tagName.js +6 -6
- package/dist/extensions/Blocks/Unsubscribe/block.js +11 -11
- package/dist/extensions/Blocks/Unsubscribe/settingsPanel.js +16 -17
- package/dist/extensions/DynamicContent/dynamic-content.js +17 -12
- package/dist/guido.css +1 -1
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js +393 -264
- package/dist/node_modules/valibot/dist/index.js +450 -235
- package/dist/package.json.js +1 -1
- package/dist/services/recommendationApi.js +15 -15
- package/dist/services/stripoApi.js +9 -9
- package/dist/services/templateLibraryApi.js +49 -46
- package/dist/src/@types/config/defaults.d.ts +5 -1
- package/dist/src/@types/config/index.d.ts +3 -3
- package/dist/src/@types/config/schemas.d.ts +245 -0
- package/dist/src/@types/config/types.d.ts +11 -1
- package/dist/src/@types/generic.d.ts +0 -1
- package/dist/src/@types/save-as-template.d.ts +1 -0
- package/dist/src/components/Guido.vue.d.ts +1 -1
- package/dist/src/components/organisms/AutoSaveController.vue.d.ts +2 -0
- package/dist/src/components/organisms/header/AutoSaveToggle.vue.d.ts +2 -0
- package/dist/src/components/organisms/header/EditorActions.vue.d.ts +1 -1
- package/dist/src/components/organisms/header/HeaderWrapper.vue.d.ts +1 -1
- package/dist/src/components/organisms/header/RightSlot.vue.d.ts +1 -1
- package/dist/src/components/wrappers/WpModal.vue.d.ts +1 -1
- package/dist/src/composables/useActionsApi.d.ts +1 -1
- package/dist/src/composables/useAutoSave.d.ts +3 -0
- package/dist/src/composables/useConfig.d.ts +70 -0
- package/dist/src/composables/useFullStoryBridge.d.ts +11 -0
- package/dist/src/composables/useRecommendation.d.ts +10 -1
- package/dist/src/composables/useRecommendation.test.d.ts +1 -0
- package/dist/src/composables/useRibbonOffset.d.ts +4 -0
- package/dist/src/composables/useSave.d.ts +1 -1
- package/dist/src/composables/validators/useCouponBlockValidator.d.ts +3 -0
- package/dist/src/composables/validators/useLiquidValidator.d.ts +3 -0
- package/dist/src/config/compiler/liquidCompilerRules.d.ts +2 -0
- package/dist/src/config/compiler/utils/recommendationCompilerUtils.d.ts +1 -1
- package/dist/src/config/migrator/index.d.ts +2 -1
- package/dist/src/config/migrator/recommendation/compositionMapper.d.ts +2 -0
- package/dist/src/config/migrator/recommendation/compositionMapper.test.d.ts +1 -0
- package/dist/src/config/migrator/recommendation/extractors.d.ts +7 -0
- package/dist/src/config/migrator/recommendation/extractors.test.d.ts +1 -0
- package/dist/src/config/migrator/recommendation/htmlBuilder.d.ts +11 -0
- package/dist/src/config/migrator/recommendation/parseLegacyConfig.d.ts +15 -0
- package/dist/src/config/migrator/recommendation/parseLegacyConfig.test.d.ts +1 -0
- package/dist/src/config/migrator/recommendation/settingsMapper.d.ts +7 -0
- package/dist/src/config/migrator/recommendation/settingsMapper.test.d.ts +1 -0
- package/dist/src/config/migrator/recommendation/themeMapper.d.ts +5 -0
- package/dist/src/config/migrator/recommendation/themeMapper.test.d.ts +1 -0
- package/dist/src/config/migrator/recommendation/types.d.ts +205 -0
- package/dist/src/config/migrator/recommendationMigrator.d.ts +13 -1
- package/dist/src/config/migrator/recommendationMigrator.test.d.ts +1 -0
- package/dist/src/enums/extensions/recommendationBlock.d.ts +3 -0
- package/dist/src/enums/onboarding.d.ts +6 -0
- package/dist/src/enums/unsubscribe.d.ts +5 -0
- package/dist/src/extensions/Blocks/CouponBlock/template.d.ts +2 -0
- package/dist/src/extensions/Blocks/RadioButton/template.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/constants/controlIds.d.ts +1 -0
- package/dist/src/extensions/Blocks/Recommendation/constants/index.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/constants/selectors.d.ts +5 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/cardComposition/index.d.ts +5 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/customAttribute/index.d.ts +3 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/customAttribute/textTrim.d.ts +35 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/main/utils.test.d.ts +1 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/name/textTrim.d.ts +3 -20
- package/dist/src/extensions/Blocks/Recommendation/controls/shared/textTrimCssRules.d.ts +29 -0
- package/dist/src/extensions/Blocks/Recommendation/services/configService.d.ts +21 -3
- package/dist/src/extensions/Blocks/Recommendation/services/configService.test.d.ts +1 -0
- package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +34 -0
- package/dist/src/extensions/Blocks/Recommendation/templates/grid/template.d.ts +4 -4
- package/dist/src/extensions/Blocks/Recommendation/templates/list/template.d.ts +3 -3
- package/dist/src/extensions/Blocks/Recommendation/templates/utils.d.ts +20 -3
- package/dist/src/extensions/Blocks/Recommendation/types/nodeConfig.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/utils/legacyStrategyMap.d.ts +21 -0
- package/dist/src/extensions/Blocks/Recommendation/utils/legacyStrategyMap.test.d.ts +1 -0
- package/dist/src/extensions/Blocks/Recommendation/utils/preserveTextStyles.d.ts +0 -3
- package/dist/src/library.d.ts +1 -1
- package/dist/src/services/templateLibraryApi.d.ts +1 -1
- package/dist/src/stores/autosave.d.ts +12 -0
- package/dist/src/stores/config.d.ts +630 -0
- package/dist/src/stores/editor.d.ts +23 -0
- package/dist/src/stores/onboarding.d.ts +4 -0
- package/dist/src/stores/preview.d.ts +3 -0
- package/dist/src/utils/genericUtil.d.ts +1 -1
- package/dist/src/utils/htmlCompiler.d.ts +2 -1
- package/dist/src/utils/htmlEscape.d.ts +5 -0
- package/dist/src/utils/htmlEscape.test.d.ts +1 -0
- package/dist/src/utils/timeUtil.d.ts +8 -0
- package/dist/static/styles/base.css.js +7 -2
- package/dist/static/styles/components/button.css.js +16 -9
- package/dist/static/styles/components/loader.css.js +4 -0
- package/dist/static/styles/components/narrow-panel.css.js +52 -0
- package/dist/stores/autosave.js +17 -0
- package/dist/stores/editor.js +3 -1
- package/dist/stores/onboarding.js +4 -0
- package/dist/stores/preview.js +4 -3
- package/dist/utils/genericUtil.js +42 -20
- package/dist/utils/htmlCompiler.js +48 -41
- package/dist/utils/htmlEscape.js +13 -0
- package/dist/utils/pairProductVariables.js +89 -88
- package/dist/utils/templatePreparation.js +75 -24
- package/dist/utils/timeUtil.js +19 -0
- package/dist/utils/tooltipUtils.js +4 -5
- package/package.json +8 -4
- package/dist/enums/displayConditions.js +0 -80
- package/dist/extensions/Blocks/Recommendation/templates/grid/migration.js +0 -251
- package/dist/src/enums/displayConditions.d.ts +0 -2
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { DEFAULT_PRODUCTS_PER_ROW as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
const
|
|
1
|
+
import { DEFAULT_PRODUCTS_PER_ROW as L } from "../../constants/layout.js";
|
|
2
|
+
import { getDefaultProducts as E, createBlockTemplate as I, DEFAULTS as _, DEFAULT_CARD_COMPOSITION as S, spacer as b, buildElementRenderer as A, DEFAULT_CARD_VISIBILITY as f } from "../utils.js";
|
|
3
|
+
import { ATTRIBUTE_CELL_CLASS as w, DEFAULT_CELL_PADDING as D, gridElementRenderer as C } from "./elementRenderer.js";
|
|
4
|
+
const O = `
|
|
5
5
|
<tr class="recommendation-product-row">
|
|
6
6
|
<td>
|
|
7
7
|
<table
|
|
@@ -18,7 +18,7 @@ const C = `
|
|
|
18
18
|
</table>
|
|
19
19
|
</td>
|
|
20
20
|
</tr>
|
|
21
|
-
`,
|
|
21
|
+
`, g = `
|
|
22
22
|
<tr
|
|
23
23
|
class="recommendation-attribute-row"
|
|
24
24
|
data-attribute-type="{-{-ATTR_TYPE-}-}"
|
|
@@ -27,37 +27,38 @@ const C = `
|
|
|
27
27
|
{-{-CELLS-}-}
|
|
28
28
|
</tr>
|
|
29
29
|
`;
|
|
30
|
-
function
|
|
31
|
-
const
|
|
32
|
-
return
|
|
33
|
-
const
|
|
34
|
-
return
|
|
30
|
+
function P(t, e, o, r = S, n = {}) {
|
|
31
|
+
const c = (100 / e).toFixed(2), i = e - t.length, l = `<td class="${w}" style="padding: ${D};" width="${c}%"></td>`, d = i > 0 ? l.repeat(i) : "", a = A(o, r, n);
|
|
32
|
+
return r.filter((s) => a[s]).map((s) => {
|
|
33
|
+
const T = f[s] ?? !0, u = T ? "" : 'style="display: none;"', R = t.map((m) => a[s](m).replace("<td", `<td width="${c}%"`)).join("");
|
|
34
|
+
return g.replace("{-{-ATTR_TYPE-}-}", s).replace("{-{-VISIBILITY-}-}", T ? "1" : "0").replace("{-{-DISPLAY_STYLE-}-}", u).replace("{-{-CELLS-}-}", R + d);
|
|
35
35
|
}).join("");
|
|
36
36
|
}
|
|
37
|
-
function
|
|
38
|
-
const
|
|
39
|
-
for (let
|
|
40
|
-
|
|
41
|
-
return
|
|
42
|
-
const
|
|
43
|
-
r,
|
|
44
|
-
e,
|
|
37
|
+
function U(t, e, o, r, n = {}) {
|
|
38
|
+
const c = [];
|
|
39
|
+
for (let l = 0; l < t.length; l += e)
|
|
40
|
+
c.push(t.slice(l, l + e));
|
|
41
|
+
return c.map((l, d) => {
|
|
42
|
+
const a = P(
|
|
45
43
|
l,
|
|
44
|
+
e,
|
|
45
|
+
o,
|
|
46
|
+
r,
|
|
46
47
|
n
|
|
47
|
-
),
|
|
48
|
-
return
|
|
48
|
+
), p = O.replace("{-{-ATTRIBUTE_ROWS-}-}", a);
|
|
49
|
+
return d > 0 ? b + p : p;
|
|
49
50
|
}).join("");
|
|
50
51
|
}
|
|
51
|
-
function
|
|
52
|
-
return
|
|
52
|
+
function h(t, e, o, r = {}) {
|
|
53
|
+
return U(t, e, C, o, r);
|
|
53
54
|
}
|
|
54
|
-
function
|
|
55
|
-
const e = t ? `ins-recommendation-v3-block-${t}` : void 0,
|
|
56
|
-
return
|
|
55
|
+
function F(t) {
|
|
56
|
+
const e = t ? `ins-recommendation-v3-block-${t}` : void 0, o = I("grid", e), r = E(), n = h(r, L);
|
|
57
|
+
return o.replace("{-{-TITLE-}-}", _.TITLE).replace("{-{-PRODUCT_ROWS-}-}", n).replace("{-{-MOBILE_PRODUCT_ROWS-}-}", "");
|
|
57
58
|
}
|
|
58
59
|
export {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
60
|
+
F as getDefaultTemplate,
|
|
61
|
+
P as prepareGridAttributeRows,
|
|
62
|
+
U as prepareGridProductRows,
|
|
63
|
+
h as prepareProductRows
|
|
63
64
|
};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { DEFAULT_PRODUCTS_PER_ROW as s } from "../constants/layout.js";
|
|
2
2
|
import { prepareProductRows as c } from "./grid/template.js";
|
|
3
|
-
import { prepareProductRows as
|
|
4
|
-
function
|
|
5
|
-
if (
|
|
6
|
-
return
|
|
7
|
-
const { productsPerRow:
|
|
8
|
-
return c(
|
|
3
|
+
import { prepareProductRows as R } from "./list/template.js";
|
|
4
|
+
function a(o, t, r = {}) {
|
|
5
|
+
if (t === "list")
|
|
6
|
+
return R(o, r.composition, r.filterList);
|
|
7
|
+
const { productsPerRow: e = s, composition: p, filterList: i } = r;
|
|
8
|
+
return c(o, e, p, i);
|
|
9
9
|
}
|
|
10
10
|
export {
|
|
11
|
-
|
|
11
|
+
a as prepareProductRows
|
|
12
12
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { RecommendationBlockId as o } from "../../constants/blockIds.js";
|
|
2
|
-
import { ATTR_PRODUCT_ATTR as
|
|
2
|
+
import { ATTR_PRODUCT_ATTR as m, ATTR_PRODUCT_BUTTON as c, ATTR_PRODUCT_IMAGE as d, ATTR_PRODUCT_OMNIBUS_DISCOUNT as u, ATTR_PRODUCT_OMNIBUS_PRICE as g, ATTR_PRODUCT_OLD_PRICE as f, ATTR_PRODUCT_PRICE as T, ATTR_PRODUCT_NAME as x } from "../../constants/selectors.js";
|
|
3
3
|
import { useRecommendationExtensionStore as _ } from "../../store/recommendation.js";
|
|
4
4
|
import { formatPrice as R } from "../../utils/priceFormatter.js";
|
|
5
|
-
import { sanitizeImageUrl as
|
|
5
|
+
import { sanitizeImageUrl as y, CUSTOM_CELL_HTML as C } from "../utils.js";
|
|
6
6
|
function p() {
|
|
7
7
|
const t = _(), { currencySettings: e } = t.recommendationConfigs;
|
|
8
8
|
return {
|
|
@@ -15,13 +15,13 @@ function p() {
|
|
|
15
15
|
};
|
|
16
16
|
}
|
|
17
17
|
function s(t, e = "price") {
|
|
18
|
-
const n = p(),
|
|
18
|
+
const n = p(), a = t[e], r = (a == null ? void 0 : a[n.code]) ?? Object.values(a ?? {})[0] ?? 0;
|
|
19
19
|
return R({
|
|
20
|
-
price:
|
|
20
|
+
price: r,
|
|
21
21
|
currency: n
|
|
22
22
|
});
|
|
23
23
|
}
|
|
24
|
-
const
|
|
24
|
+
const U = {
|
|
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
|
|
@@ -37,7 +37,7 @@ const I = {
|
|
|
37
37
|
valign="middle">
|
|
38
38
|
<a target="_blank" href="${t.url}">
|
|
39
39
|
<img
|
|
40
|
-
src="${
|
|
40
|
+
src="${y(t.image_url)}"
|
|
41
41
|
alt="${t.name}"
|
|
42
42
|
style="display: block; max-width: 100%; height: auto;"
|
|
43
43
|
class="adapt-img product-image">
|
|
@@ -113,9 +113,9 @@ const I = {
|
|
|
113
113
|
/**
|
|
114
114
|
* Omnibus discount element - row for info cell table
|
|
115
115
|
*/
|
|
116
|
-
[
|
|
117
|
-
var i,
|
|
118
|
-
const e = p(), n = ((i = t.original_price) == null ? void 0 : i[e.code]) ?? Object.values(t.original_price ?? {})[0] ?? 0,
|
|
116
|
+
[u]: (t) => {
|
|
117
|
+
var i, l;
|
|
118
|
+
const e = p(), n = ((i = t.original_price) == null ? void 0 : i[e.code]) ?? Object.values(t.original_price ?? {})[0] ?? 0, a = ((l = t.price) == null ? void 0 : l[e.code]) ?? Object.values(t.price ?? {})[0] ?? 0, r = n > 0 ? Math.round((n - a) / n * 100) : 0, b = r > 0 ? `-${r}%` : "0%";
|
|
119
119
|
return `
|
|
120
120
|
<tr>
|
|
121
121
|
<td
|
|
@@ -137,12 +137,12 @@ const I = {
|
|
|
137
137
|
* Button cell - right column (100px fixed width)
|
|
138
138
|
* Has recommendation-attribute-row class and data attributes for Card Composition control
|
|
139
139
|
*/
|
|
140
|
-
[
|
|
140
|
+
[c]: (t) => `
|
|
141
141
|
<td
|
|
142
142
|
width="100"
|
|
143
143
|
class="esd-block-button button-cell recommendation-attribute-row product-button es-p5l es-p5r"
|
|
144
144
|
esd-extension-block-id="${o.BUTTON}"
|
|
145
|
-
data-attribute-type="${
|
|
145
|
+
data-attribute-type="${c}"
|
|
146
146
|
data-visibility="1"
|
|
147
147
|
align="center"
|
|
148
148
|
valign="middle">
|
|
@@ -157,7 +157,17 @@ const I = {
|
|
|
157
157
|
href="${t.url}"
|
|
158
158
|
target="_blank"
|
|
159
159
|
class="es-button buy-button"
|
|
160
|
-
style="
|
|
160
|
+
style="
|
|
161
|
+
color: rgb(56, 118, 29);
|
|
162
|
+
background: rgb(217, 234, 211);
|
|
163
|
+
font-family: arial, 'helvetica neue', helvetica, sans-serif;
|
|
164
|
+
font-size: 16px;
|
|
165
|
+
font-weight: normal;
|
|
166
|
+
line-height: 120%;
|
|
167
|
+
padding: 5px 30px;
|
|
168
|
+
mso-border-alt: 10px solid rgb(217, 234, 211);
|
|
169
|
+
mso-padding-alt: 0;
|
|
170
|
+
">
|
|
161
171
|
Buy
|
|
162
172
|
</a>
|
|
163
173
|
</span>
|
|
@@ -166,11 +176,13 @@ const I = {
|
|
|
166
176
|
/**
|
|
167
177
|
* Custom attribute row template — same tr-td structure as Name, Price, etc.
|
|
168
178
|
* Used by `buildElementRenderer` for `customAttr:*` composition entries.
|
|
179
|
+
* @param productAttrValue - Resolved product-attr value (e.g., "brand" for default, "product_attribute.rating_star" for custom)
|
|
180
|
+
* @param content - Display content for the cell
|
|
169
181
|
*/
|
|
170
|
-
[
|
|
182
|
+
[C]: (t, e) => `
|
|
171
183
|
<tr>
|
|
172
184
|
<td
|
|
173
|
-
${
|
|
185
|
+
${m}="${t}"
|
|
174
186
|
class="esd-block-text product-custom-attribute"
|
|
175
187
|
esd-extension-block-id="${o.CUSTOM_ATTRIBUTE}"
|
|
176
188
|
align="left">
|
|
@@ -180,5 +192,5 @@ const I = {
|
|
|
180
192
|
`
|
|
181
193
|
};
|
|
182
194
|
export {
|
|
183
|
-
|
|
195
|
+
U as listElementRenderer
|
|
184
196
|
};
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { ATTR_PRODUCT_IMAGE as
|
|
2
|
-
import { DEFAULT_CARD_COMPOSITION as
|
|
3
|
-
import { listElementRenderer as
|
|
4
|
-
function R(r, n,
|
|
5
|
-
const
|
|
1
|
+
import { ATTR_PRODUCT_IMAGE as a, ATTR_PRODUCT_BUTTON as d } from "../../constants/selectors.js";
|
|
2
|
+
import { DEFAULT_CARD_COMPOSITION as b, spacer as m, buildElementRenderer as C, DEFAULT_CARD_VISIBILITY as T } from "../utils.js";
|
|
3
|
+
import { listElementRenderer as f } from "./elementRenderer.js";
|
|
4
|
+
function R(r, n, l) {
|
|
5
|
+
const t = l ? "" : ' style="display: none;"', o = r.replace(/<tr>/, "").replace(/<\/tr>/, "");
|
|
6
6
|
return `<tr
|
|
7
7
|
class="recommendation-attribute-row"
|
|
8
8
|
data-attribute-type="${n}"
|
|
9
|
-
data-visibility="${
|
|
9
|
+
data-visibility="${l ? "1" : "0"}"${t}>${o}</tr>`;
|
|
10
10
|
}
|
|
11
|
-
const
|
|
11
|
+
const y = `
|
|
12
12
|
<tr class="recommendation-product-row">
|
|
13
13
|
<td style="padding: 0 5px;">
|
|
14
14
|
<table
|
|
@@ -26,29 +26,29 @@ const f = `
|
|
|
26
26
|
</td>
|
|
27
27
|
</tr>
|
|
28
28
|
`;
|
|
29
|
-
function
|
|
30
|
-
const t = C(
|
|
29
|
+
function O(r, n = b, l = {}) {
|
|
30
|
+
const t = C(f, n, l), o = t[a](r), c = `
|
|
31
31
|
<td class="product-info-cell" valign="middle" style="padding: 15px;">
|
|
32
|
-
<table cellpadding="0" cellspacing="0" role="presentation" width="100%">
|
|
32
|
+
<table cellpadding="0" cellspacing="0" role="presentation" width="100%" style="table-layout: fixed;">
|
|
33
33
|
<tbody>
|
|
34
|
-
${n.filter((e) => e !==
|
|
35
|
-
const
|
|
36
|
-
return R(t[e](r), e,
|
|
34
|
+
${n.filter((e) => e !== a && e !== d).filter((e) => t[e]).map((e) => {
|
|
35
|
+
const u = T[e] ?? !0;
|
|
36
|
+
return R(t[e](r), e, u);
|
|
37
37
|
}).join(`
|
|
38
38
|
`)}
|
|
39
39
|
</tbody>
|
|
40
40
|
</table>
|
|
41
41
|
</td>
|
|
42
|
-
`,
|
|
43
|
-
return
|
|
42
|
+
`, s = t[d](r), p = o + c + s;
|
|
43
|
+
return y.replace("{-{-PRODUCT_CONTENT-}-}", p);
|
|
44
44
|
}
|
|
45
|
-
function
|
|
46
|
-
return r.map((t,
|
|
47
|
-
const
|
|
48
|
-
return
|
|
45
|
+
function D(r, n, l = {}) {
|
|
46
|
+
return r.map((t, o) => {
|
|
47
|
+
const i = O(t, n, l);
|
|
48
|
+
return o > 0 ? m + i : i;
|
|
49
49
|
}).join("");
|
|
50
50
|
}
|
|
51
51
|
export {
|
|
52
|
-
|
|
53
|
-
|
|
52
|
+
O as getListProductCard,
|
|
53
|
+
D as prepareProductRows
|
|
54
54
|
};
|
|
@@ -1,55 +1,60 @@
|
|
|
1
|
-
import { ATTR_PRODUCT_IMAGE as m, ATTR_PRODUCT_NAME as
|
|
2
|
-
function
|
|
1
|
+
import { ATTR_CUSTOM_PREFIX as u, ATTR_PRODUCT_IMAGE as m, ATTR_PRODUCT_NAME as b, ATTR_PRODUCT_OLD_PRICE as T, ATTR_PRODUCT_PRICE as _, ATTR_PRODUCT_OMNIBUS_PRICE as g, ATTR_PRODUCT_OMNIBUS_DISCOUNT as C, ATTR_PRODUCT_BUTTON as f } from "../constants/selectors.js";
|
|
2
|
+
function U(t) {
|
|
3
3
|
return t.replace(/_/g, " ").replace(/\b\w/g, (e) => e.toUpperCase());
|
|
4
4
|
}
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
function R(t, e) {
|
|
6
|
+
const n = Object.values(e).find((r) => r.attributeName === t);
|
|
7
|
+
return (n == null ? void 0 : n.type) === "defaultAttribute";
|
|
8
|
+
}
|
|
9
|
+
function y(t, e) {
|
|
10
|
+
return R(t, e) ? t : `product_attribute.${t}`;
|
|
11
|
+
}
|
|
12
|
+
const P = Symbol("customCellHtml");
|
|
13
|
+
function S(t, e, n = {}) {
|
|
14
|
+
const r = t[P];
|
|
15
|
+
if (!r)
|
|
9
16
|
return { ...t };
|
|
10
|
-
const
|
|
11
|
-
return e.filter((o) => o.startsWith(
|
|
12
|
-
const s = o.substring(
|
|
13
|
-
|
|
14
|
-
var
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
c != null ? String(c) : l
|
|
19
|
-
);
|
|
17
|
+
const l = { ...t };
|
|
18
|
+
return e.filter((o) => o.startsWith(u) && !l[o]).forEach((o) => {
|
|
19
|
+
const s = o.substring(u.length), a = U(s), D = y(s, n), O = R(s, n);
|
|
20
|
+
l[o] = (d) => {
|
|
21
|
+
var p;
|
|
22
|
+
const i = O ? d[s] : (p = d.product_attributes) == null ? void 0 : p[s];
|
|
23
|
+
let c = a;
|
|
24
|
+
return typeof i == "string" ? c = i : typeof i == "number" && (c = String(i)), r(D, c);
|
|
20
25
|
};
|
|
21
|
-
}),
|
|
26
|
+
}), l;
|
|
22
27
|
}
|
|
23
|
-
const
|
|
28
|
+
const L = {
|
|
24
29
|
TITLE: "You May Also Like!"
|
|
25
|
-
},
|
|
30
|
+
}, M = [
|
|
26
31
|
m,
|
|
27
|
-
|
|
32
|
+
b,
|
|
28
33
|
T,
|
|
29
|
-
u,
|
|
30
34
|
_,
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
35
|
+
g,
|
|
36
|
+
C,
|
|
37
|
+
f
|
|
38
|
+
], $ = {
|
|
34
39
|
[m]: !0,
|
|
35
|
-
[
|
|
36
|
-
[
|
|
40
|
+
[b]: !0,
|
|
41
|
+
[_]: !0,
|
|
37
42
|
[T]: !0,
|
|
38
|
-
[
|
|
39
|
-
[
|
|
40
|
-
[
|
|
41
|
-
},
|
|
43
|
+
[g]: !1,
|
|
44
|
+
[C]: !1,
|
|
45
|
+
[f]: !0
|
|
46
|
+
}, h = `
|
|
42
47
|
<tr>
|
|
43
48
|
<td class="spacer" style="height: 10px;"></td>
|
|
44
49
|
</tr>
|
|
45
|
-
`,
|
|
46
|
-
function
|
|
47
|
-
return !t || typeof t != "string" || t.trim() === "" ?
|
|
50
|
+
`, A = "https://email-static.useinsider.com/stripo/modules/email-recommendation-v3/assets/images/image-placeholder.png";
|
|
51
|
+
function w(t) {
|
|
52
|
+
return !t || typeof t != "string" || t.trim() === "" ? A : t.startsWith("http://") ? t.replace("http://", "https://") : t;
|
|
48
53
|
}
|
|
49
|
-
function
|
|
54
|
+
function I(t) {
|
|
50
55
|
return {
|
|
51
56
|
name: "Product Name",
|
|
52
|
-
image_url:
|
|
57
|
+
image_url: A,
|
|
53
58
|
price: { USD: 18 },
|
|
54
59
|
original_price: { USD: 20 },
|
|
55
60
|
discount: { USD: 2 },
|
|
@@ -61,13 +66,13 @@ function D(t) {
|
|
|
61
66
|
category: []
|
|
62
67
|
};
|
|
63
68
|
}
|
|
64
|
-
function
|
|
69
|
+
function N(t = 6) {
|
|
65
70
|
return Array.from(
|
|
66
71
|
{ length: t },
|
|
67
|
-
(e, n) =>
|
|
72
|
+
(e, n) => I(String(n + 1))
|
|
68
73
|
);
|
|
69
74
|
}
|
|
70
|
-
function
|
|
75
|
+
function k(t = "grid", e) {
|
|
71
76
|
const n = t === "list" ? `
|
|
72
77
|
data-layout="list"` : "", r = e ? ` ${e}` : "";
|
|
73
78
|
return `
|
|
@@ -105,7 +110,7 @@ function y(t = "grid", e) {
|
|
|
105
110
|
</table>
|
|
106
111
|
</td>
|
|
107
112
|
</tr>
|
|
108
|
-
${
|
|
113
|
+
${h}
|
|
109
114
|
<tr>
|
|
110
115
|
<td>
|
|
111
116
|
<table
|
|
@@ -144,15 +149,17 @@ function y(t = "grid", e) {
|
|
|
144
149
|
`;
|
|
145
150
|
}
|
|
146
151
|
export {
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
152
|
+
P as CUSTOM_CELL_HTML,
|
|
153
|
+
L as DEFAULTS,
|
|
154
|
+
M as DEFAULT_CARD_COMPOSITION,
|
|
155
|
+
$ as DEFAULT_CARD_VISIBILITY,
|
|
156
|
+
A as PLACEHOLDER_IMAGE,
|
|
157
|
+
S as buildElementRenderer,
|
|
158
|
+
k as createBlockTemplate,
|
|
159
|
+
N as getDefaultProducts,
|
|
160
|
+
R as isDefaultAttribute,
|
|
161
|
+
y as resolveProductAttrValue,
|
|
162
|
+
w as sanitizeImageUrl,
|
|
163
|
+
h as spacer,
|
|
164
|
+
U as toDisplayName
|
|
158
165
|
};
|
|
@@ -1,28 +1,31 @@
|
|
|
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),
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
const o = t.sort((r, e) => r.filterNumber - e.filterNumber), u = o.map((r) => {
|
|
5
|
+
const e = r.operator === "||", a = e ? "=" : r.operator, c = e ? decodeURIComponent(r.value).split(",").join("||") : r.value;
|
|
6
|
+
return `[${r.attribute}][${a}][${c}]`;
|
|
7
|
+
}), [s, ...p] = u;
|
|
8
|
+
let n = s;
|
|
9
|
+
for (let r = 0; r < p.length; r++) {
|
|
7
10
|
const e = o[r].innerGroupOperator;
|
|
8
|
-
|
|
11
|
+
n += `${e}${p[r]}`;
|
|
9
12
|
}
|
|
10
|
-
return `(${
|
|
13
|
+
return `(${n})`;
|
|
11
14
|
}
|
|
12
|
-
function
|
|
15
|
+
function G(t) {
|
|
13
16
|
if (!t || t.length === 0)
|
|
14
17
|
return "";
|
|
15
|
-
const o = t.reduce((r, e) => (r[e.filterGroup] || (r[e.filterGroup] = []), r[e.filterGroup].push(e), r), {}),
|
|
18
|
+
const o = t.reduce((r, e) => (r[e.filterGroup] || (r[e.filterGroup] = []), r[e.filterGroup].push(e), r), {}), u = Object.keys(o).map(Number).sort((r, e) => r - e), s = u.map((r) => {
|
|
16
19
|
const e = o[r];
|
|
17
20
|
return l(e);
|
|
18
|
-
}), [
|
|
19
|
-
let
|
|
20
|
-
for (let r = 0; r <
|
|
21
|
-
const e =
|
|
22
|
-
|
|
21
|
+
}), [p, ...n] = s;
|
|
22
|
+
let i = p;
|
|
23
|
+
for (let r = 0; r < n.length; r++) {
|
|
24
|
+
const e = u[r + 1], c = o[e][0].outerGroupOperator;
|
|
25
|
+
i += `${c}${n[r]}`;
|
|
23
26
|
}
|
|
24
|
-
return
|
|
27
|
+
return i.trim();
|
|
25
28
|
}
|
|
26
29
|
export {
|
|
27
|
-
|
|
30
|
+
G as generateCompleteFilterQuery
|
|
28
31
|
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
function r(e) {
|
|
2
|
+
if (!e)
|
|
3
|
+
return e;
|
|
4
|
+
switch (e) {
|
|
5
|
+
case "viewedTogether":
|
|
6
|
+
return "similarViewed";
|
|
7
|
+
case "purchasedTogether":
|
|
8
|
+
return "similarBought";
|
|
9
|
+
case "trending":
|
|
10
|
+
return "trendingProducts";
|
|
11
|
+
case "mostValuable":
|
|
12
|
+
return "mostValuableOfPartner";
|
|
13
|
+
case "topSellers":
|
|
14
|
+
return "mostPurchased";
|
|
15
|
+
default:
|
|
16
|
+
return e;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
export {
|
|
20
|
+
r as mapLegacyStrategy
|
|
21
|
+
};
|
|
@@ -1,36 +1,27 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
"&": "&",
|
|
4
|
-
"<": "<",
|
|
5
|
-
">": ">",
|
|
6
|
-
'"': """,
|
|
7
|
-
"'": "'"
|
|
8
|
-
};
|
|
9
|
-
return t.replace(/[&<>"']/g, (n) => e[n]);
|
|
10
|
-
}
|
|
11
|
-
function p(t) {
|
|
1
|
+
import { escapeHtml as m } from "../../../../utils/htmlEscape.js";
|
|
2
|
+
function T(t) {
|
|
12
3
|
return "getInnerHTML" in t && typeof t.getInnerHTML == "function" ? t.getInnerHTML().trim() : "innerHTML" in t ? t.innerHTML : "";
|
|
13
4
|
}
|
|
14
|
-
function
|
|
15
|
-
const n = m(
|
|
5
|
+
function H(t, f) {
|
|
6
|
+
const n = m(f);
|
|
16
7
|
if (!t)
|
|
17
8
|
return n;
|
|
18
|
-
const r =
|
|
9
|
+
const r = T(t);
|
|
19
10
|
if (!r || r.trim() === "" || !/<(strong|em|u|s|b|i)\b/i.test(r))
|
|
20
11
|
return n;
|
|
21
|
-
const
|
|
22
|
-
let
|
|
12
|
+
const e = [], s = [];
|
|
13
|
+
let o = r.trim();
|
|
23
14
|
for (; ; ) {
|
|
24
|
-
const u =
|
|
15
|
+
const u = o.match(/^<(strong|em|u|s|b|i)(\s[^>]*)?>(.*)$/is);
|
|
25
16
|
if (!u)
|
|
26
17
|
break;
|
|
27
|
-
const [,
|
|
28
|
-
if (!
|
|
18
|
+
const [, i, a = "", c] = u, g = new RegExp(`</${i}>$`, "i");
|
|
19
|
+
if (!g.test(c))
|
|
29
20
|
break;
|
|
30
|
-
|
|
21
|
+
e.push(`<${i}${a}>`), s.unshift(`</${i}>`), o = c.replace(g, "").trim();
|
|
31
22
|
}
|
|
32
|
-
return
|
|
23
|
+
return e.length > 0 ? e.join("") + n + s.join("") : n;
|
|
33
24
|
}
|
|
34
25
|
export {
|
|
35
|
-
|
|
26
|
+
H as preserveTextStyles
|
|
36
27
|
};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
function a(t) {
|
|
2
2
|
return typeof t == "object" && t !== null && "tagName" in t && typeof t.tagName == "string";
|
|
3
3
|
}
|
|
4
|
-
function
|
|
4
|
+
function n(t) {
|
|
5
5
|
return typeof t == "object" && t !== null && "getTagName" in t && typeof t.getTagName == "function";
|
|
6
6
|
}
|
|
7
|
-
function
|
|
7
|
+
function r(t) {
|
|
8
8
|
return typeof t == "object" && t !== null && "getStyle" in t && typeof t.getStyle == "function";
|
|
9
9
|
}
|
|
10
10
|
function u(t) {
|
|
@@ -14,13 +14,13 @@ function g(t) {
|
|
|
14
14
|
return typeof t == "object" && t !== null && "tagName" in t && t.tagName === "TD";
|
|
15
15
|
}
|
|
16
16
|
function p(t, e) {
|
|
17
|
-
return !t || !
|
|
17
|
+
return !t || !r(t) ? null : t.getStyle(e);
|
|
18
18
|
}
|
|
19
19
|
function N(t) {
|
|
20
|
-
return !t || !u(t) ? null : t.parent();
|
|
20
|
+
return !t || !u(t) ? null : t.parent() ?? null;
|
|
21
21
|
}
|
|
22
22
|
function l(t, e = "UNKNOWN") {
|
|
23
|
-
return t ? a(t) ? t.tagName.toUpperCase() :
|
|
23
|
+
return t ? a(t) ? t.tagName.toUpperCase() : n(t) ? t.getTagName().toUpperCase() : e : e;
|
|
24
24
|
}
|
|
25
25
|
const f = /* @__PURE__ */ new Set(["TD", "BLOCK_IMAGE", "BLOCK_BUTTON"]);
|
|
26
26
|
function i(t) {
|
|
@@ -36,7 +36,7 @@ function s(t) {
|
|
|
36
36
|
export {
|
|
37
37
|
s as getTableDisplayValue,
|
|
38
38
|
l as getTagName,
|
|
39
|
-
|
|
39
|
+
r as hasGetStyle,
|
|
40
40
|
u as hasParent,
|
|
41
41
|
c as isTableCellNode,
|
|
42
42
|
i as isTableCellTag,
|