@useinsider/guido 3.1.1 → 3.2.0-beta.14f0290
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 +1 -0
- package/dist/@types/config/schemas.js +66 -54
- package/dist/components/Guido.vue.js +4 -4
- package/dist/components/Guido.vue2.js +91 -81
- 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/EditorActions.vue.js +2 -2
- package/dist/components/organisms/header/EditorActions.vue2.js +51 -36
- package/dist/components/organisms/header/RightSlot.vue.js +10 -10
- package/dist/components/organisms/header/RightSlot.vue2.js +16 -13
- package/dist/components/organisms/save-as-template/SaveAsTemplateDrawer.vue2.js +18 -17
- package/dist/composables/useActionsApi.js +4 -4
- 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/useSave.js +23 -15
- package/dist/composables/useStripo.js +52 -47
- 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 +52 -46
- package/dist/config/i18n/en/tooltips.json.js +2 -1
- package/dist/config/migrator/checkboxMigrator.js +5 -3
- package/dist/config/migrator/radioButtonMigrator.js +14 -12
- package/dist/config/migrator/recommendationMigrator.js +1 -1
- package/dist/enums/extensions/recommendationBlock.js +14 -11
- 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/Recommendation/block.js +1 -1
- package/dist/extensions/Blocks/Recommendation/constants/controlIds.js +1 -1
- 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 +6 -6
- package/dist/extensions/Blocks/Recommendation/controls/main/index.js +3 -1
- package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +95 -93
- 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/settingsPanel.js +18 -17
- package/dist/extensions/Blocks/Recommendation/store/recommendation.js +29 -25
- package/dist/extensions/Blocks/Recommendation/templates/grid/elementRenderer.js +7 -5
- 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 +3 -1
- 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/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/package.json.js +1 -1
- package/dist/services/recommendationApi.js +15 -15
- package/dist/services/stripoApi.js +9 -9
- package/dist/services/templateLibraryApi.js +48 -46
- package/dist/src/@types/config/index.d.ts +1 -1
- package/dist/src/@types/config/schemas.d.ts +28 -0
- package/dist/src/@types/config/types.d.ts +3 -1
- package/dist/src/@types/generic.d.ts +0 -1
- package/dist/src/@types/save-as-template.d.ts +1 -0
- package/dist/src/composables/useActionsApi.d.ts +1 -1
- package/dist/src/composables/useConfig.d.ts +12 -0
- package/dist/src/composables/useFullStoryBridge.d.ts +11 -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/enums/extensions/recommendationBlock.d.ts +3 -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/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/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/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/services/templateLibraryApi.d.ts +1 -1
- package/dist/src/stores/config.d.ts +108 -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/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/preview.js +4 -3
- package/dist/utils/genericUtil.js +42 -20
- package/dist/utils/htmlCompiler.js +48 -41
- package/dist/utils/templatePreparation.js +36 -25
- package/dist/utils/tooltipUtils.js +4 -5
- package/package.json +4 -4
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { RecommendationFeedSourceMaps as g, getOperatorOptions as R, PriceAttributes as k } from "../../../../enums/extensions/recommendationBlock.js";
|
|
2
|
-
import { useRecommendationApi as
|
|
3
|
-
import { useConfigStore as
|
|
2
|
+
import { useRecommendationApi as C } from "../../../../services/recommendationApi.js";
|
|
3
|
+
import { useConfigStore as y } from "../../../../stores/config.js";
|
|
4
4
|
import { defineStore as G } from "pinia";
|
|
5
5
|
import { DEFAULT_CARDS_IN_ROW as F } from "../constants/layout.js";
|
|
6
6
|
import { EXCLUDED_ALGORITHM_IDS as w } from "../constants/defaultConfig.js";
|
|
7
7
|
import { getDefaultProducts as S } from "../templates/utils.js";
|
|
8
8
|
import { generateCompleteFilterQuery as b } from "../utils/filterUtil.js";
|
|
9
9
|
import { isFilterValid as D } from "../validation/filterSchema.js";
|
|
10
|
-
const h =
|
|
11
|
-
let
|
|
10
|
+
const h = C();
|
|
11
|
+
let m = null, u = null, d = null;
|
|
12
12
|
function I() {
|
|
13
13
|
return {
|
|
14
14
|
cardsInRow: F,
|
|
@@ -57,7 +57,7 @@ const v = () => ({
|
|
|
57
57
|
blockStates: {},
|
|
58
58
|
currentRecommendationId: null,
|
|
59
59
|
configVersion: 0
|
|
60
|
-
}),
|
|
60
|
+
}), z = G("guidoRecommendationExtension", {
|
|
61
61
|
state: () => v(),
|
|
62
62
|
getters: {
|
|
63
63
|
// ====================================================================
|
|
@@ -131,11 +131,10 @@ const v = () => ({
|
|
|
131
131
|
})),
|
|
132
132
|
getFilterList() {
|
|
133
133
|
return Object.values(this.filterList).map((t) => {
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
return n = e ? `${n}.${this.recommendationConfigs.currencySettings.value}` : n, {
|
|
134
|
+
let r;
|
|
135
|
+
return t.type === "productAttribute" ? r = `product_attributes.${t.attributeName}` : k.includes(t.attributeName) ? r = `${t.attributeName}.${this.recommendationConfigs.currencySettings.value}` : r = t.attributeName, {
|
|
137
136
|
text: t.displayName,
|
|
138
|
-
value:
|
|
137
|
+
value: r,
|
|
139
138
|
type: t.attributeType
|
|
140
139
|
};
|
|
141
140
|
});
|
|
@@ -163,10 +162,15 @@ const v = () => ({
|
|
|
163
162
|
* Resets currentRecommendationId if it was the deleted block.
|
|
164
163
|
*/
|
|
165
164
|
removeBlockState(t) {
|
|
166
|
-
const r =
|
|
167
|
-
if (
|
|
168
|
-
const
|
|
169
|
-
this.
|
|
165
|
+
const r = t.toString();
|
|
166
|
+
if (this.recommendationCampaignUrls[r]) {
|
|
167
|
+
const n = { ...this.recommendationCampaignUrls };
|
|
168
|
+
delete n[r], this.recommendationCampaignUrls = n;
|
|
169
|
+
}
|
|
170
|
+
const e = { ...this.blockStates };
|
|
171
|
+
if (delete e[t], this.blockStates = e, this.currentRecommendationId === t) {
|
|
172
|
+
const n = Object.keys(this.blockStates).map(Number);
|
|
173
|
+
this.currentRecommendationId = n.length > 0 ? n[0] : null;
|
|
170
174
|
}
|
|
171
175
|
},
|
|
172
176
|
/**
|
|
@@ -251,11 +255,11 @@ const v = () => ({
|
|
|
251
255
|
// ====================================================================
|
|
252
256
|
async fetchRecommendationCreateData() {
|
|
253
257
|
if (!this.activePredictiveAlgorithms.length) {
|
|
254
|
-
if (
|
|
255
|
-
await
|
|
258
|
+
if (m) {
|
|
259
|
+
await m;
|
|
256
260
|
return;
|
|
257
261
|
}
|
|
258
|
-
|
|
262
|
+
m = (async () => {
|
|
259
263
|
const {
|
|
260
264
|
activePredictiveAlgorithms: t,
|
|
261
265
|
languages: r,
|
|
@@ -268,26 +272,26 @@ const v = () => ({
|
|
|
268
272
|
this.currencyList = e;
|
|
269
273
|
})();
|
|
270
274
|
try {
|
|
271
|
-
await
|
|
275
|
+
await m;
|
|
272
276
|
} finally {
|
|
273
|
-
|
|
277
|
+
m = null;
|
|
274
278
|
}
|
|
275
279
|
}
|
|
276
280
|
},
|
|
277
281
|
async fetchRecommendationFilters() {
|
|
278
282
|
if (!Object.keys(this.filterList).length) {
|
|
279
|
-
if (
|
|
280
|
-
await
|
|
283
|
+
if (u) {
|
|
284
|
+
await u;
|
|
281
285
|
return;
|
|
282
286
|
}
|
|
283
|
-
|
|
287
|
+
u = (async () => {
|
|
284
288
|
const t = await h.fetchRecommendationFilters();
|
|
285
289
|
this.filterList = t;
|
|
286
290
|
})();
|
|
287
291
|
try {
|
|
288
|
-
await
|
|
292
|
+
await u;
|
|
289
293
|
} finally {
|
|
290
|
-
|
|
294
|
+
u = null;
|
|
291
295
|
}
|
|
292
296
|
}
|
|
293
297
|
},
|
|
@@ -375,7 +379,7 @@ const v = () => ({
|
|
|
375
379
|
},
|
|
376
380
|
async _doFetchProducts() {
|
|
377
381
|
var p;
|
|
378
|
-
const t = this.currentRecommendationId, r = this.blockStates[t], { recommendationConfigs: e } = r, n = e.filters.filter((a) => a.isValid), c = b(n), i = ((p = g.find((a) => a.key === e.strategy)) == null ? void 0 : p.path) || "", o =
|
|
382
|
+
const t = this.currentRecommendationId, r = this.blockStates[t], { recommendationConfigs: e } = r, n = e.filters.filter((a) => a.isValid), c = b(n), i = ((p = g.find((a) => a.key === e.strategy)) == null ? void 0 : p.path) || "", o = y(), s = {
|
|
379
383
|
locale: e.language,
|
|
380
384
|
currency: e.currencySettings.value,
|
|
381
385
|
partnerName: o.partnerName,
|
|
@@ -399,5 +403,5 @@ const v = () => ({
|
|
|
399
403
|
}
|
|
400
404
|
});
|
|
401
405
|
export {
|
|
402
|
-
|
|
406
|
+
z as useRecommendationExtensionStore
|
|
403
407
|
};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { RecommendationBlockId as s } from "../../constants/blockIds.js";
|
|
2
|
-
import { ATTR_PRODUCT_ATTR as g, ATTR_PRODUCT_BUTTON as u, ATTR_PRODUCT_OMNIBUS_DISCOUNT as m, ATTR_PRODUCT_OMNIBUS_PRICE as h, ATTR_PRODUCT_OLD_PRICE as y, ATTR_PRODUCT_PRICE as T, ATTR_PRODUCT_NAME as f, ATTR_PRODUCT_IMAGE as
|
|
3
|
-
import { useRecommendationExtensionStore as
|
|
2
|
+
import { ATTR_PRODUCT_ATTR as g, ATTR_PRODUCT_BUTTON as u, ATTR_PRODUCT_OMNIBUS_DISCOUNT as m, ATTR_PRODUCT_OMNIBUS_PRICE as h, ATTR_PRODUCT_OLD_PRICE as y, ATTR_PRODUCT_PRICE as T, ATTR_PRODUCT_NAME as f, ATTR_PRODUCT_IMAGE as x } from "../../constants/selectors.js";
|
|
3
|
+
import { useRecommendationExtensionStore as _ } from "../../store/recommendation.js";
|
|
4
4
|
import { formatPrice as $ } from "../../utils/priceFormatter.js";
|
|
5
5
|
import { sanitizeImageUrl as C, CUSTOM_CELL_HTML as R } from "../utils.js";
|
|
6
6
|
const a = "0 5px", l = "attribute-cell";
|
|
7
7
|
function p() {
|
|
8
|
-
const t =
|
|
8
|
+
const t = _(), { currencySettings: e } = t.recommendationConfigs;
|
|
9
9
|
return {
|
|
10
10
|
code: e.value,
|
|
11
11
|
symbol: e.symbol,
|
|
@@ -23,7 +23,7 @@ function r(t, e = "price") {
|
|
|
23
23
|
});
|
|
24
24
|
}
|
|
25
25
|
const I = {
|
|
26
|
-
[
|
|
26
|
+
[x]: (t) => `
|
|
27
27
|
<td class="${l}" style="padding: ${a}; height: 100%;" valign="top">
|
|
28
28
|
<table
|
|
29
29
|
class="product-card-segment"
|
|
@@ -224,6 +224,8 @@ const I = {
|
|
|
224
224
|
* Custom attribute cell template — same structure as built-in entries
|
|
225
225
|
* (outer td → inner product-card-segment table).
|
|
226
226
|
* Used by `buildElementRenderer` for `customAttr:*` composition entries.
|
|
227
|
+
* @param productAttrValue - Resolved product-attr value (e.g., "brand" for default, "product_attribute.rating_star" for custom)
|
|
228
|
+
* @param content - Display content for the cell
|
|
227
229
|
*/
|
|
228
230
|
[R]: (t, e) => `
|
|
229
231
|
<td class="${l}" style="padding: ${a}; height: 100%;" valign="middle">
|
|
@@ -238,7 +240,7 @@ const I = {
|
|
|
238
240
|
<tbody>
|
|
239
241
|
<tr valign="top">
|
|
240
242
|
<td
|
|
241
|
-
${g}="
|
|
243
|
+
${g}="${t}"
|
|
242
244
|
class="esd-block-text product-custom-attribute es-p0t es-p0b es-p15l es-p15r"
|
|
243
245
|
align="center"
|
|
244
246
|
esd-extension-block-id="${s.CUSTOM_ATTRIBUTE}">
|
|
@@ -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 L } from "../../constants/layout.js";
|
|
2
|
+
import { DEFAULT_CARD_COMPOSITION as E, spacer as I, getDefaultProducts as _, createBlockTemplate as S, DEFAULTS as b, buildElementRenderer as A, DEFAULT_CARD_VISIBILITY as f } from "../utils.js";
|
|
3
|
+
import { gridElementRenderer as w, ATTRIBUTE_CELL_CLASS as D, DEFAULT_CELL_PADDING 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 = E, n = {}) {
|
|
31
|
+
const c = (100 / e).toFixed(2), i = e - t.length, l = `<td class="${D}" style="padding: ${C};" 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 ? I + p : p;
|
|
49
50
|
}).join("");
|
|
50
51
|
}
|
|
51
|
-
function
|
|
52
|
-
return
|
|
52
|
+
function h(t, e, o, r = {}) {
|
|
53
|
+
return U(t, e, w, 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 = S("grid", e), r = _(), n = h(r, L);
|
|
57
|
+
return o.replace("{-{-TITLE-}-}", b.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
|
};
|
|
@@ -166,11 +166,13 @@ const I = {
|
|
|
166
166
|
/**
|
|
167
167
|
* Custom attribute row template — same tr-td structure as Name, Price, etc.
|
|
168
168
|
* Used by `buildElementRenderer` for `customAttr:*` composition entries.
|
|
169
|
+
* @param productAttrValue - Resolved product-attr value (e.g., "brand" for default, "product_attribute.rating_star" for custom)
|
|
170
|
+
* @param content - Display content for the cell
|
|
169
171
|
*/
|
|
170
172
|
[y]: (t, e) => `
|
|
171
173
|
<tr>
|
|
172
174
|
<td
|
|
173
|
-
${u}="
|
|
175
|
+
${u}="${t}"
|
|
174
176
|
class="esd-block-text product-custom-attribute"
|
|
175
177
|
esd-extension-block-id="${o.CUSTOM_ATTRIBUTE}"
|
|
176
178
|
align="left">
|
|
@@ -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_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, ATTR_CUSTOM_PREFIX as u } 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
|
};
|
|
@@ -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,
|