@useinsider/guido 3.16.0-beta.9e5f533 → 3.16.0-beta.cbe0707

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.
Files changed (71) hide show
  1. package/dist/components/Guido.vue.js +8 -8
  2. package/dist/components/Guido.vue2.js +78 -76
  3. package/dist/components/organisms/AutoSaveController.vue2.js +9 -8
  4. package/dist/components/organisms/header/EditorActions.vue.js +2 -2
  5. package/dist/components/organisms/header/EditorActions.vue2.js +74 -43
  6. package/dist/components/organisms/header/LeftSlot.vue.js +5 -5
  7. package/dist/components/organisms/header/LeftSlot.vue2.js +45 -23
  8. package/dist/components/organisms/validation/ValidationErrorDrawer.vue.js +20 -0
  9. package/dist/components/organisms/validation/ValidationErrorDrawer.vue2.js +61 -0
  10. package/dist/components/wrappers/WpDrawer.vue.js +9 -7
  11. package/dist/components/wrappers/WpDrawer.vue2.js +1 -1
  12. package/dist/composables/useHtmlValidator.js +1 -0
  13. package/dist/composables/useSave.js +84 -41
  14. package/dist/composables/useSaveValidation.js +276 -0
  15. package/dist/composables/useSaveValidationRollout.js +9 -0
  16. package/dist/composables/validators/useCouponBlockValidator.js +24 -21
  17. package/dist/composables/validators/useUnsubscribeBlockValidator.js +34 -27
  18. package/dist/config/migrator/index.js +8 -9
  19. package/dist/config/migrator/recommendation/compositionMapper.js +20 -20
  20. package/dist/config/migrator/recommendation/extractors.js +24 -29
  21. package/dist/config/migrator/recommendation/htmlBuilder.js +130 -116
  22. package/dist/config/migrator/recommendationMigrator.js +15 -18
  23. package/dist/enums/save-validation.js +4 -0
  24. package/dist/extensions/Blocks/Recommendation/constants/blockIds.js +1 -1
  25. package/dist/extensions/Blocks/Recommendation/constants/controlIds.js +1 -1
  26. package/dist/extensions/Blocks/Recommendation/constants/defaultConfig.js +22 -23
  27. package/dist/extensions/Blocks/Recommendation/constants/selectors.js +26 -29
  28. package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +152 -203
  29. package/dist/extensions/Blocks/Recommendation/extension.js +29 -31
  30. package/dist/extensions/Blocks/Recommendation/settingsPanel.js +4 -23
  31. package/dist/extensions/Blocks/Recommendation/store/recommendation.js +31 -24
  32. package/dist/extensions/Blocks/Recommendation/templates/grid/template.js +3 -3
  33. package/dist/extensions/Blocks/Recommendation/templates/utils.js +107 -85
  34. package/dist/guido.css +1 -1
  35. package/dist/src/@types/save-validation.d.ts +19 -0
  36. package/dist/src/components/Guido.vue.d.ts +17 -1
  37. package/dist/src/components/organisms/header/EditorActions.vue.d.ts +17 -1
  38. package/dist/src/components/organisms/header/HeaderWrapper.vue.d.ts +17 -1
  39. package/dist/src/components/organisms/header/RightSlot.vue.d.ts +17 -1
  40. package/dist/src/components/organisms/validation/ValidationErrorDrawer.vue.d.ts +2 -0
  41. package/dist/src/components/wrappers/WpDrawer.vue.d.ts +4 -3
  42. package/dist/src/composables/useHtmlValidator.d.ts +14 -0
  43. package/dist/src/composables/useSave.d.ts +6 -1
  44. package/dist/src/composables/useSaveValidation.d.ts +6 -0
  45. package/dist/src/composables/useSaveValidationRollout.d.ts +3 -0
  46. package/dist/src/composables/validators/useCouponBlockValidator.d.ts +3 -0
  47. package/dist/src/composables/validators/useUnsubscribeBlockValidator.d.ts +10 -0
  48. package/dist/src/config/migrator/recommendation/extractors.d.ts +0 -8
  49. package/dist/src/enums/save-validation.d.ts +27 -0
  50. package/dist/src/extensions/Blocks/Recommendation/constants/blockIds.d.ts +1 -2
  51. package/dist/src/extensions/Blocks/Recommendation/constants/controlIds.d.ts +0 -7
  52. package/dist/src/extensions/Blocks/Recommendation/constants/defaultConfig.d.ts +0 -1
  53. package/dist/src/extensions/Blocks/Recommendation/constants/index.d.ts +1 -1
  54. package/dist/src/extensions/Blocks/Recommendation/constants/selectors.d.ts +0 -4
  55. package/dist/src/extensions/Blocks/Recommendation/controls/cardComposition/index.d.ts +0 -7
  56. package/dist/src/extensions/Blocks/Recommendation/controls/index.d.ts +0 -1
  57. package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +5 -0
  58. package/dist/src/stores/config.d.ts +5 -0
  59. package/dist/src/stores/save-validation.d.ts +22 -0
  60. package/dist/src/utils/templatePreparation.d.ts +30 -0
  61. package/dist/static/styles/customEditorStyle.css.js +1 -3
  62. package/dist/stores/config.js +13 -6
  63. package/dist/stores/save-validation.js +30 -0
  64. package/dist/utils/templatePreparation.js +28 -25
  65. package/package.json +1 -1
  66. package/dist/config/migrator/recommendationTitleMigrator.js +0 -112
  67. package/dist/extensions/Blocks/Recommendation/controls/title/index.js +0 -44
  68. package/dist/extensions/Blocks/Recommendation/templates/titleRows.js +0 -33
  69. package/dist/src/config/migrator/recommendationTitleMigrator.d.ts +0 -1
  70. package/dist/src/extensions/Blocks/Recommendation/controls/title/index.d.ts +0 -86
  71. package/dist/src/extensions/Blocks/Recommendation/templates/titleRows.d.ts +0 -13
@@ -5,24 +5,23 @@ import { RecommendationBlockControl as i } from "./controls/main/index.js";
5
5
  import "./constants/selectors.js";
6
6
  import "./store/recommendation.js";
7
7
  import "./utils/captureStyleTemplates.js";
8
- import { TitleControls as e } from "./controls/title/index.js";
9
- import { NameControls as l } from "./controls/name/index.js";
10
- import { PriceControls as s } from "./controls/price/index.js";
11
- import { OldPriceControls as p } from "./controls/oldPrice/index.js";
12
- import { OmnibusPriceControls as a } from "./controls/omnibusPrice/index.js";
13
- import { OmnibusDiscountControls as c } from "./controls/omnibusDiscount/index.js";
14
- import { ButtonControls as C } from "./controls/button/index.js";
15
- import { ImageControls as f } from "./controls/image/index.js";
16
- import { CustomAttributeControls as d } from "./controls/customAttribute/index.js";
17
- import { SpacingControl as u } from "./controls/spacing/index.js";
18
- import { BlockBackgroundColorControl as g } from "./controls/blockBackground/index.js";
19
- import { CardBackgroundColorControl as y } from "./controls/cardBackground/index.js";
20
- import { RecommendationCardCompositionControl as B } from "./controls/cardComposition/index.js";
21
- import { SyncInfoMessageControl as P } from "./controls/syncInfoMessage.js";
22
- import { RecommendationIconsRegistry as R } from "./iconsRegistry.js";
23
- import S from "./recommendation.css.js";
24
- import { SettingsPanel as k } from "./settingsPanel.js";
25
- const w = [
8
+ import { NameControls as e } from "./controls/name/index.js";
9
+ import { PriceControls as l } from "./controls/price/index.js";
10
+ import { OldPriceControls as s } from "./controls/oldPrice/index.js";
11
+ import { OmnibusPriceControls as p } from "./controls/omnibusPrice/index.js";
12
+ import { OmnibusDiscountControls as a } from "./controls/omnibusDiscount/index.js";
13
+ import { ButtonControls as c } from "./controls/button/index.js";
14
+ import { ImageControls as C } from "./controls/image/index.js";
15
+ import { CustomAttributeControls as f } from "./controls/customAttribute/index.js";
16
+ import { SpacingControl as d } from "./controls/spacing/index.js";
17
+ import { BlockBackgroundColorControl as u } from "./controls/blockBackground/index.js";
18
+ import { CardBackgroundColorControl as g } from "./controls/cardBackground/index.js";
19
+ import { RecommendationCardCompositionControl as y } from "./controls/cardComposition/index.js";
20
+ import { SyncInfoMessageControl as B } from "./controls/syncInfoMessage.js";
21
+ import { RecommendationIconsRegistry as P } from "./iconsRegistry.js";
22
+ import R from "./recommendation.css.js";
23
+ import { SettingsPanel as S } from "./settingsPanel.js";
24
+ const k = [
26
25
  e,
27
26
  l,
28
27
  s,
@@ -30,22 +29,21 @@ const w = [
30
29
  a,
31
30
  c,
32
31
  C,
33
- f,
34
- d
35
- ], b = [
32
+ f
33
+ ], w = [
36
34
  i,
35
+ u,
37
36
  g,
37
+ d,
38
38
  y,
39
- u,
40
- B,
41
- P
42
- ], v = [
43
- ...b,
44
- ...w.flatMap((o) => Object.values(o))
45
- ], Y = v.reduce(
39
+ B
40
+ ], b = [
41
+ ...w,
42
+ ...k.flatMap((o) => Object.values(o))
43
+ ], W = b.reduce(
46
44
  (o, r) => o.addControl(r),
47
- new t().addBlock(m).withSettingsPanelRegistry(k)
48
- ).addStyles(S).withPreviewStyles(n).withIconsRegistry(R).build();
45
+ new t().addBlock(m).withSettingsPanelRegistry(S)
46
+ ).addStyles(R).withPreviewStyles(n).withIconsRegistry(P).build();
49
47
  export {
50
- Y as default
48
+ W as default
51
49
  };
@@ -3,10 +3,9 @@ import { BLOCK_ID as R } from "./block.js";
3
3
  import { RecommendationBlockId as S } from "./constants/blockIds.js";
4
4
  import { RecommendationControlId as T } from "./constants/controlIds.js";
5
5
  import "./constants/selectors.js";
6
- import { CONTROL_BLOCK_ID as L } from "./controls/main/index.js";
6
+ import { CONTROL_BLOCK_ID as U } from "./controls/main/index.js";
7
7
  import "./store/recommendation.js";
8
8
  import "./utils/captureStyleTemplates.js";
9
- import "./controls/title/index.js";
10
9
  import "./controls/name/index.js";
11
10
  import "./controls/price/index.js";
12
11
  import "./controls/oldPrice/index.js";
@@ -16,7 +15,7 @@ import "./controls/button/index.js";
16
15
  import "./controls/image/index.js";
17
16
  import { SPACING_CONTROL_ID as A } from "./controls/spacing/index.js";
18
17
  import "./controls/blockBackground/index.js";
19
- import { CARD_BACKGROUND_COLOR_CONTROL_ID as U } from "./controls/cardBackground/index.js";
18
+ import { CARD_BACKGROUND_COLOR_CONTROL_ID as L } from "./controls/cardBackground/index.js";
20
19
  import { COMPOSITION_CONTROL_BLOCK_ID as D } from "./controls/cardComposition/index.js";
21
20
  import { SYNC_INFO_MESSAGE_CONTROL_ID as N } from "./controls/syncInfoMessage.js";
22
21
  class s extends E {
@@ -25,7 +24,7 @@ class s extends E {
25
24
  new _(
26
25
  I.SETTINGS,
27
26
  [
28
- L,
27
+ U,
29
28
  C.EXTERNAL_INDENTS
30
29
  ]
31
30
  ),
@@ -33,7 +32,7 @@ class s extends E {
33
32
  I.STYLES,
34
33
  [
35
34
  T.BLOCK_BACKGROUND,
36
- U,
35
+ L,
37
36
  A
38
37
  ]
39
38
  ),
@@ -43,24 +42,6 @@ class s extends E {
43
42
  D
44
43
  ]
45
44
  ).withLabel(this.api.translate("Card Composition"))
46
- ], O[S.TITLE] = [
47
- new _(
48
- I.SETTINGS,
49
- [
50
- T.TITLE_STYLE,
51
- T.TITLE_ALIGN,
52
- T.TITLE_PADDINGS
53
- ]
54
- ),
55
- new _(
56
- I.STYLES,
57
- [
58
- T.TITLE_BACKGROUND,
59
- T.TITLE_FONT_FAMILY,
60
- T.TITLE_SIZE,
61
- T.TITLE_COLOR
62
- ]
63
- )
64
45
  ], O[S.NAME] = [
65
46
  new _(
66
47
  I.SETTINGS,
@@ -1,20 +1,20 @@
1
- import { getRecommendationFeedSourceMaps as g, getOperatorOptions as R, PriceAttributes as C } from "../../../../enums/extensions/recommendationBlock.js";
2
- import { useRecommendationApi as y } from "../../../../services/recommendationApi.js";
3
- import { useConfigStore as G } from "../../../../stores/config.js";
4
- import { defineStore as F } from "pinia";
1
+ import { getRecommendationFeedSourceMaps as g, getOperatorOptions as C, PriceAttributes as y } from "../../../../enums/extensions/recommendationBlock.js";
2
+ import { useRecommendationApi as G } from "../../../../services/recommendationApi.js";
3
+ import { useConfigStore as F } from "../../../../stores/config.js";
4
+ import { defineStore as P } from "pinia";
5
5
  import "../constants/selectors.js";
6
- import { DEFAULT_MOBILE_CARDS_IN_ROW as P, DEFAULT_CARDS_IN_ROW as D } from "../constants/layout.js";
6
+ import { DEFAULT_MOBILE_CARDS_IN_ROW as D, DEFAULT_CARDS_IN_ROW as v } from "../constants/layout.js";
7
7
  import { EXCLUDED_ALGORITHM_IDS as w } from "../constants/defaultConfig.js";
8
8
  import { getDefaultProducts as S } from "../templates/utils.js";
9
9
  import { generateCompleteFilterQuery as b } from "../utils/filterUtil.js";
10
- import { getPartnerRecommendationParams as v } from "../utils/partnerCustomizations.js";
11
- import { isFilterValid as N } from "../validation/filterSchema.js";
12
- import { isConfigValid as x } from "../validation/requiredFields.js";
13
- const h = y();
10
+ import { getPartnerRecommendationParams as N } from "../utils/partnerCustomizations.js";
11
+ import { isFilterValid as x } from "../validation/filterSchema.js";
12
+ import { isConfigValid as I } from "../validation/requiredFields.js";
13
+ const h = G();
14
14
  let m = null, u = null, d = null;
15
- function k() {
15
+ function R() {
16
16
  return {
17
- cardsInRow: D,
17
+ cardsInRow: v,
18
18
  currencySettings: {
19
19
  name: "USD",
20
20
  value: "USD",
@@ -28,7 +28,7 @@ function k() {
28
28
  productIds: [],
29
29
  id: 1,
30
30
  language: "en_US",
31
- mobileCardsInRow: P,
31
+ mobileCardsInRow: D,
32
32
  mobileLayoutEnabled: !1,
33
33
  orientation: "grid",
34
34
  recommendedProducts: [],
@@ -43,9 +43,9 @@ function k() {
43
43
  priceHideIfSameAsDiscounted: !1
44
44
  };
45
45
  }
46
- function I() {
46
+ function k() {
47
47
  return {
48
- recommendationConfigs: k(),
48
+ recommendationConfigs: R(),
49
49
  recommendationProducts: [],
50
50
  filterStatus: !1,
51
51
  filterSelectionDrawerStatus: !1,
@@ -63,7 +63,7 @@ const L = () => ({
63
63
  blockStates: {},
64
64
  currentRecommendationId: null,
65
65
  configVersion: 0
66
- }), $ = F("guidoRecommendationExtension", {
66
+ }), $ = P("guidoRecommendationExtension", {
67
67
  state: () => L(),
68
68
  getters: {
69
69
  // ====================================================================
@@ -74,7 +74,7 @@ const L = () => ({
74
74
  * This allows all existing code that reads `store.recommendationConfigs` to work unchanged.
75
75
  */
76
76
  recommendationConfigs(t) {
77
- return t.currentRecommendationId !== null && t.blockStates[t.currentRecommendationId] ? t.blockStates[t.currentRecommendationId].recommendationConfigs : k();
77
+ return t.currentRecommendationId !== null && t.blockStates[t.currentRecommendationId] ? t.blockStates[t.currentRecommendationId].recommendationConfigs : R();
78
78
  },
79
79
  /**
80
80
  * Proxy getter: delegates to blockStates[currentRecommendationId].recommendationProducts
@@ -138,7 +138,7 @@ const L = () => ({
138
138
  getFilterList() {
139
139
  return Object.values(this.filterList).filter((t) => t.isFilterable !== 0 && t.isFilterable !== !1).map((t) => {
140
140
  let e;
141
- return t.type === "productAttribute" ? e = `product_attributes.${t.attributeName}` : C.includes(t.attributeName) ? e = `${t.attributeName}.${this.recommendationConfigs.currencySettings.value}` : e = t.attributeName, {
141
+ return t.type === "productAttribute" ? e = `product_attributes.${t.attributeName}` : y.includes(t.attributeName) ? e = `${t.attributeName}.${this.recommendationConfigs.currencySettings.value}` : e = t.attributeName, {
142
142
  text: t.displayName,
143
143
  value: e,
144
144
  type: t.attributeType
@@ -160,7 +160,7 @@ const L = () => ({
160
160
  setCurrentBlock(t) {
161
161
  this.blockStates[t] || (this.blockStates = {
162
162
  ...this.blockStates,
163
- [t]: I()
163
+ [t]: k()
164
164
  }), this.currentRecommendationId = t;
165
165
  },
166
166
  /**
@@ -228,7 +228,7 @@ const L = () => ({
228
228
  decimalCount: String(e.currencyDecimalCount),
229
229
  decimalSeparator: r(e.currencyDecimalSeparator, ","),
230
230
  thousandSeparator: r(e.currencyThousandSeparator, ".")
231
- }, c = !this.blockStates[t], i = c ? I() : this.blockStates[t];
231
+ }, c = !this.blockStates[t], i = c ? k() : this.blockStates[t];
232
232
  i.recommendationConfigs = {
233
233
  ...i.recommendationConfigs,
234
234
  strategy: e.strategy,
@@ -266,7 +266,7 @@ const L = () => ({
266
266
  * Creates a filter with the first available attribute and operator pre-selected.
267
267
  */
268
268
  createDefaultFilter(t, e) {
269
- const [r] = this.getFilterList, [n] = R(r == null ? void 0 : r.type);
269
+ const [r] = this.getFilterList, [n] = C(r == null ? void 0 : r.type);
270
270
  return {
271
271
  type: "standardFilter",
272
272
  attribute: (r == null ? void 0 : r.value) ?? "",
@@ -383,7 +383,7 @@ const L = () => ({
383
383
  const n = [...e.recommendationConfigs.filters];
384
384
  n[r] = {
385
385
  ...t,
386
- isValid: N(t)
386
+ isValid: x(t)
387
387
  }, e.recommendationConfigs.filters = n;
388
388
  }
389
389
  },
@@ -429,7 +429,14 @@ const L = () => ({
429
429
  * every block's recommendationConfigs across user edits.
430
430
  */
431
431
  hasInvalidBlock() {
432
- return Object.values(this.blockStates).some((t) => !x(t.recommendationConfigs, this));
432
+ return Object.values(this.blockStates).some((t) => !I(t.recommendationConfigs, this));
433
+ },
434
+ /**
435
+ * Per-instance counterpart to `hasInvalidBlock`: the ids of every block
436
+ * that fails required-field validation, one drawer row each (SD-147430).
437
+ */
438
+ invalidBlockIds() {
439
+ return Object.entries(this.blockStates).filter(([, t]) => !I(t.recommendationConfigs, this)).map(([t]) => t);
433
440
  },
434
441
  // ====================================================================
435
442
  // Per-Block Product Fetching
@@ -450,7 +457,7 @@ const L = () => ({
450
457
  },
451
458
  async _doFetchProducts() {
452
459
  var p;
453
- const t = this.currentRecommendationId, e = this.blockStates[t], { recommendationConfigs: r } = e, n = r.filters.filter((l) => l.isValid), c = b(n), i = ((p = g().find((l) => l.key === r.strategy)) == null ? void 0 : p.path) || "", o = G(), s = parseInt(r.size) || 6, a = {
460
+ const t = this.currentRecommendationId, e = this.blockStates[t], { recommendationConfigs: r } = e, n = r.filters.filter((l) => l.isValid), c = b(n), i = ((p = g().find((l) => l.key === r.strategy)) == null ? void 0 : p.path) || "", o = F(), s = parseInt(r.size) || 6, a = {
454
461
  locale: r.language,
455
462
  currency: r.currencySettings.value,
456
463
  partnerName: o.partnerName,
@@ -460,7 +467,7 @@ const L = () => ({
460
467
  };
461
468
  r.strategy === "manualMerchandising" ? a.productId = r.productIds.join(",") : r.strategy === "similarViewed" && (a.productId = "{itemId}"), r.strategy === "userBased" && (a.userId = "{user_id}"), c && (a.filter = c), r.shuffleProducts && (a.shuffle = !0), Object.assign(
462
469
  a,
463
- v(o.partnerName, r.strategy)
470
+ N(o.partnerName, r.strategy)
464
471
  );
465
472
  let f;
466
473
  try {
@@ -1,6 +1,6 @@
1
1
  import { ATTR_PRODUCT_PRICE as f, ATTR_PRODUCT_OLD_PRICE as O } from "../../constants/selectors.js";
2
2
  import { DEFAULT_PRODUCTS_PER_ROW as w } from "../../constants/layout.js";
3
- import { createBlockTemplate as A, getDefaultProducts as g, DEFAULTS as U, buildSpacer as h, DEFAULT_CARD_COMPOSITION as Y, buildElementRenderer as B, resolveInlinePriceOrder as F, buildCellOptions as I, DEFAULT_CARD_VISIBILITY as W } from "../utils.js";
3
+ import { getDefaultProducts as A, DEFAULTS as g, createBlockTemplate as U, buildSpacer as h, DEFAULT_CARD_COMPOSITION as Y, buildElementRenderer as B, resolveInlinePriceOrder as F, buildCellOptions as I, DEFAULT_CARD_VISIBILITY as W } from "../utils.js";
4
4
  import { DEFAULT_CELL_PADDING as k, renderInlineGridPriceCell as H, buildFillerCell as x, gridElementRenderer as y } from "./elementRenderer.js";
5
5
  const G = `
6
6
  <tr class="recommendation-product-row">
@@ -69,8 +69,8 @@ function M(t, r, o, e = {}, c = {}) {
69
69
  );
70
70
  }
71
71
  function Q(t) {
72
- const r = t ? `ins-recommendation-v3-block-${t}` : void 0, o = A("grid", r), e = g(), c = M(e, w);
73
- return o.replace("{-{-TITLE-}-}", U.TITLE).replace("{-{-PRODUCT_ROWS-}-}", c).replace("{-{-MOBILE_PRODUCT_ROWS-}-}", "");
72
+ const r = t ? `ins-recommendation-v3-block-${t}` : void 0, o = U("grid", r), e = A(), c = M(e, w);
73
+ return o.replace("{-{-TITLE-}-}", g.TITLE).replace("{-{-PRODUCT_ROWS-}-}", c).replace("{-{-MOBILE_PRODUCT_ROWS-}-}", "");
74
74
  }
75
75
  export {
76
76
  Q as getDefaultTemplate,
@@ -1,9 +1,8 @@
1
- import { ATTR_PRODUCT_PRICE as l, ATTR_PRODUCT_OLD_PRICE as a, ATTR_CUSTOM_PREFIX as T, ATTR_PRODUCT_IMAGE as b, ATTR_PRODUCT_NAME as _, ATTR_PRODUCT_OMNIBUS_PRICE as C, ATTR_PRODUCT_OMNIBUS_DISCOUNT as A, ATTR_PRODUCT_BUTTON as p, PRODUCT_ATTRIBUTE_PREFIX as I } from "../constants/selectors.js";
1
+ import { ATTR_PRODUCT_PRICE as l, ATTR_PRODUCT_OLD_PRICE as a, ATTR_CUSTOM_PREFIX as T, ATTR_PRODUCT_IMAGE as m, ATTR_PRODUCT_NAME as C, ATTR_PRODUCT_OMNIBUS_PRICE as _, ATTR_PRODUCT_OMNIBUS_DISCOUNT as p, ATTR_PRODUCT_BUTTON as y, PRODUCT_ATTRIBUTE_PREFIX as I } from "../constants/selectors.js";
2
2
  import { useRecommendationExtensionStore as L } from "../store/recommendation.js";
3
- import { compositionKeyToProductAttr as y, isDefaultProductAttr as f, bareAttributeName as S, findFilterByBareName as $, productAttrToCompositionKey as P } from "../utils/compositionKeys.js";
3
+ import { compositionKeyToProductAttr as A, isDefaultProductAttr as b, bareAttributeName as S, findFilterByBareName as $, productAttrToCompositionKey as h } from "../utils/compositionKeys.js";
4
4
  import { formatPrice as B } from "../utils/priceFormatter.js";
5
- import { buildTitleRows as k } from "./titleRows.js";
6
- function x() {
5
+ function k() {
7
6
  const t = L(), { currencySettings: e } = t.recommendationConfigs;
8
7
  return {
9
8
  code: e.value,
@@ -14,17 +13,17 @@ function x() {
14
13
  thousandSeparator: e.thousandSeparator
15
14
  };
16
15
  }
17
- function m(t, e = "price") {
18
- const o = x(), n = t[e], c = (n == null ? void 0 : n[o.code]) ?? Object.values(n ?? {})[0] ?? 0;
16
+ function f(t, e = "price") {
17
+ const o = k(), n = t[e], c = (n == null ? void 0 : n[o.code]) ?? Object.values(n ?? {})[0] ?? 0;
19
18
  return B({
20
19
  price: c,
21
20
  currency: o
22
21
  });
23
22
  }
24
23
  function q(t) {
25
- return m(t, "price") === m(t, "original_price");
24
+ return f(t, "price") === f(t, "original_price");
26
25
  }
27
- function N(t) {
26
+ function x(t) {
28
27
  return t.replace(/_/g, " ").replace(/\b\w/g, (e) => e.toUpperCase());
29
28
  }
30
29
  function J(t) {
@@ -35,114 +34,115 @@ function J(t) {
35
34
  skip: n ? l : a
36
35
  };
37
36
  }
38
- function F(t) {
37
+ function N(t) {
39
38
  const e = Array.isArray(t) ? t[t.length - 1] : t;
40
39
  if (typeof e == "string")
41
40
  return e;
42
41
  if (typeof e == "number")
43
42
  return String(e);
44
43
  }
45
- function v(t, e) {
44
+ function w(t, e) {
46
45
  var o;
47
46
  return ((o = $(t, e)) == null ? void 0 : o.type) === "defaultAttribute";
48
47
  }
49
- function w(t, e) {
50
- return v(t, e) ? t : `${I}${t}`;
48
+ function F(t, e) {
49
+ return w(t, e) ? t : `${I}${t}`;
51
50
  }
52
51
  function Q(t) {
53
- return P(t);
52
+ return h(t);
54
53
  }
55
- const M = Symbol("customCellHtml");
54
+ const v = Symbol("customCellHtml");
56
55
  function Z(t, e, o = {}) {
57
- const n = t[M];
56
+ const n = t[v];
58
57
  if (!n)
59
58
  return { ...t };
60
59
  const c = { ...t };
61
- return e.filter((i) => i.startsWith(T) && !c[i]).forEach((i) => {
62
- const s = y(i), r = f(s) ? w(s, o) : s, u = S(r), h = N(u), D = f(r);
63
- c[i] = (d, U) => {
60
+ return e.filter((s) => s.startsWith(T) && !c[s]).forEach((s) => {
61
+ const i = A(s), r = b(i) ? F(i, o) : i, u = S(r), R = x(u), D = b(r);
62
+ c[s] = (d, U) => {
64
63
  var g;
65
- const O = D ? d[u] : (g = d.product_attributes) == null ? void 0 : g[u], E = F(O) ?? h;
66
- return n(r, E, U);
64
+ const E = D ? d[u] : (g = d.product_attributes) == null ? void 0 : g[u], O = N(E) ?? R;
65
+ return n(r, O, U);
67
66
  };
68
67
  }), c;
69
68
  }
70
69
  function tt(t, e, o = []) {
71
- const n = t.startsWith(T) ? P(S(y(t))) : t, i = n !== t && !o.includes(n) ? n : t, s = (r) => (r == null ? void 0 : r[t]) ?? (r == null ? void 0 : r[i]);
70
+ const n = t.startsWith(T) ? h(S(A(t))) : t, s = n !== t && !o.includes(n) ? n : t, i = (r) => (r == null ? void 0 : r[t]) ?? (r == null ? void 0 : r[s]);
72
71
  return {
73
72
  cellPadding: e.cellPadding,
74
73
  cardBackgroundColor: e.cardBackgroundColor,
75
- cellBackgroundColor: s(e.cellBackgroundColors),
76
- cellAlignment: s(e.cellAlignments),
77
- cellClasses: s(e.cellClasses),
78
- omnibusText: s(e.omnibusTexts),
79
- styleTemplate: s(e.styleTemplates)
74
+ cellBackgroundColor: i(e.cellBackgroundColors),
75
+ cellAlignment: i(e.cellAlignments),
76
+ cellClasses: i(e.cellClasses),
77
+ omnibusText: i(e.omnibusTexts),
78
+ styleTemplate: i(e.styleTemplates)
80
79
  };
81
80
  }
82
81
  const et = {
83
82
  TITLE: "You May Also Like!"
84
83
  }, ot = [
85
- b,
86
- _,
84
+ m,
85
+ C,
87
86
  a,
88
87
  l,
89
- C,
90
- A,
91
- p
88
+ _,
89
+ p,
90
+ y
92
91
  ], nt = {
93
- [b]: !0,
94
- [_]: !0,
92
+ [m]: !0,
93
+ [C]: !0,
95
94
  [l]: !0,
96
95
  [a]: !0,
97
- [C]: !1,
98
- [A]: !1,
99
- [p]: !0
100
- }, W = 10;
101
- function rt(t = W) {
96
+ [_]: !1,
97
+ [p]: !1,
98
+ [y]: !0
99
+ }, M = 10;
100
+ function W(t = M) {
102
101
  return `
103
102
  <tr>
104
103
  <td class="spacer" style="height: ${t}px;"></td>
105
104
  </tr>
106
105
  `;
107
106
  }
108
- function H(t, e) {
107
+ const H = W();
108
+ function V(t, e) {
109
109
  return e ? e.pStyle ?? "" : t;
110
110
  }
111
- function it(t, e, o) {
112
- const n = H(e.pStyle, o), c = o ? o.openTags ?? "" : e.openTags, i = o ? o.closeTags ?? "" : e.closeTags;
113
- return `<p contenteditable="false" style="${n}">${c}${t}${i}</p>`;
111
+ function rt(t, e, o) {
112
+ const n = V(e.pStyle, o), c = o ? o.openTags ?? "" : e.openTags, s = o ? o.closeTags ?? "" : e.closeTags;
113
+ return `<p contenteditable="false" style="${n}">${c}${t}${s}</p>`;
114
114
  }
115
115
  function st(t, e) {
116
116
  const o = [];
117
117
  return t && o.push(t), e && o.push(`background-color: ${e};`), o.join(" ");
118
118
  }
119
- function V(t) {
119
+ function Y(t) {
120
120
  return t ? ` background-color: ${t};` : "";
121
121
  }
122
- function ct(t) {
123
- const e = V(t);
122
+ function it(t) {
123
+ const e = Y(t);
124
124
  return e ? ` style="${e.trim()}"` : "";
125
125
  }
126
- function lt(t, e = "") {
126
+ function ct(t, e = "") {
127
127
  return {
128
128
  before: (t == null ? void 0 : t.before) ?? e,
129
129
  after: (t == null ? void 0 : t.after) ?? ""
130
130
  };
131
131
  }
132
- function at(t, e) {
132
+ function lt(t, e) {
133
133
  return `${(e == null ? void 0 : e.openTags) ?? ""}${t}${(e == null ? void 0 : e.closeTags) ?? ""}`;
134
134
  }
135
- function ut(t) {
135
+ function at(t) {
136
136
  return t != null && t.buttonFitToContainer ? "es-button-border es-fw" : "es-button-border";
137
137
  }
138
- const dt = "display: block; max-width: 100%; height: auto;", gt = "border-width: 1px; background: rgb(217, 234, 211); border-color: rgb(106, 168, 79);", ft = "color: rgb(56, 118, 29); background: rgb(217, 234, 211); font-family: arial, 'helvetica neue', helvetica, sans-serif; font-size: 16px; font-weight: normal; line-height: 120%; mso-border-alt: 10px solid rgb(217, 234, 211); mso-padding-alt: 0;", R = "https://email-static.useinsider.com/stripo/modules/email-recommendation-v3/assets/images/image-placeholder.png";
139
- function mt(t) {
140
- return !t || typeof t != "string" || t.trim() === "" ? R : t.startsWith("http://") ? t.replace("http://", "https://") : t;
138
+ const ut = "display: block; max-width: 100%; height: auto;", dt = "border-width: 1px; background: rgb(217, 234, 211); border-color: rgb(106, 168, 79);", gt = "color: rgb(56, 118, 29); background: rgb(217, 234, 211); font-family: arial, 'helvetica neue', helvetica, sans-serif; font-size: 16px; font-weight: normal; line-height: 120%; mso-border-alt: 10px solid rgb(217, 234, 211); mso-padding-alt: 0;", P = "https://email-static.useinsider.com/stripo/modules/email-recommendation-v3/assets/images/image-placeholder.png";
139
+ function bt(t) {
140
+ return !t || typeof t != "string" || t.trim() === "" ? P : t.startsWith("http://") ? t.replace("http://", "https://") : t;
141
141
  }
142
- function Y(t) {
142
+ function G(t) {
143
143
  return {
144
144
  name: "Product Name",
145
- image_url: R,
145
+ image_url: P,
146
146
  price: { USD: 18 },
147
147
  original_price: { USD: 20 },
148
148
  discount: { USD: 2 },
@@ -154,20 +154,19 @@ function Y(t) {
154
154
  category: []
155
155
  };
156
156
  }
157
- function Tt(t = 6) {
157
+ function ft(t = 6) {
158
158
  return Array.from(
159
159
  { length: t },
160
- (e, o) => Y(String(o + 1))
160
+ (e, o) => G(String(o + 1))
161
161
  );
162
162
  }
163
- function bt(t = "grid", e) {
163
+ function Tt(t = "grid", e) {
164
164
  const o = t === "list" ? `
165
- data-layout="list"` : "", n = e ? ` ${e}` : "", i = `recommendation-block-v2 esd-block-recommendation-v3-block es-p20${t === "list" ? " es-m-p0 ins-recommendation-list-layout" : ""}${n}`, s = t === "list" ? "" : `
166
- {-{-MOBILE_PRODUCT_ROWS-}-}`, r = t === "list" ? ' style="display: none;"' : "";
165
+ data-layout="list"` : "", n = e ? ` ${e}` : "";
167
166
  return `
168
167
  <td
169
168
  align="left"
170
- class="${i}"${o}>
169
+ class="${`recommendation-block-v2 esd-block-recommendation-v3-block es-p20${t === "list" ? " es-m-p0 ins-recommendation-list-layout" : ""}${n}`}"${o}>
171
170
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
172
171
  <tr>
173
172
  <td align="center">
@@ -178,7 +177,28 @@ function bt(t = "grid", e) {
178
177
  cellspacing="0"
179
178
  border="0">
180
179
  <tbody>
181
- ${k()}
180
+ <tr>
181
+ <td>
182
+ <table
183
+ width="100%"
184
+ cellpadding="0"
185
+ cellspacing="0"
186
+ border="0">
187
+ <tbody>
188
+ <tr>
189
+ <td
190
+ class="esd-block-text es-p10t es-p10b es-p20l es-p20r"
191
+ align="center">
192
+ <p style="font-size: 28px; color: #333333;">
193
+ <strong>{-{-TITLE-}-}</strong>
194
+ </p>
195
+ </td>
196
+ </tr>
197
+ </tbody>
198
+ </table>
199
+ </td>
200
+ </tr>
201
+ ${H}
182
202
  <tr>
183
203
  <td>
184
204
  <table
@@ -193,7 +213,7 @@ function bt(t = "grid", e) {
193
213
  </table>
194
214
  </td>
195
215
  </tr>
196
- <tr class="ins-recommendation-mobile-row"${r}>
216
+ <tr class="ins-recommendation-mobile-row"${t === "list" ? ' style="display: none;"' : ""}>
197
217
  <td>
198
218
  <table
199
219
  class="ins-recommendation-product-container
@@ -203,7 +223,8 @@ function bt(t = "grid", e) {
203
223
  cellspacing="0"
204
224
  border="0"
205
225
  style="display: none;"
206
- >${s}
226
+ >${t === "list" ? "" : `
227
+ {-{-MOBILE_PRODUCT_ROWS-}-}`}
207
228
  </table>
208
229
  </td>
209
230
  </tr>
@@ -216,36 +237,37 @@ function bt(t = "grid", e) {
216
237
  `;
217
238
  }
218
239
  export {
219
- M as CUSTOM_CELL_HTML,
240
+ v as CUSTOM_CELL_HTML,
220
241
  et as DEFAULTS,
221
- ft as DEFAULT_BUTTON_ANCHOR_STYLE,
222
- gt as DEFAULT_BUTTON_BORDER_STYLE,
242
+ gt as DEFAULT_BUTTON_ANCHOR_STYLE,
243
+ dt as DEFAULT_BUTTON_BORDER_STYLE,
223
244
  ot as DEFAULT_CARD_COMPOSITION,
224
245
  nt as DEFAULT_CARD_VISIBILITY,
225
- dt as DEFAULT_IMG_STYLE,
226
- W as DEFAULT_ROW_SPACING_PX,
227
- R as PLACEHOLDER_IMAGE,
228
- V as bgColorFragment,
246
+ ut as DEFAULT_IMG_STYLE,
247
+ M as DEFAULT_ROW_SPACING_PX,
248
+ P as PLACEHOLDER_IMAGE,
249
+ Y as bgColorFragment,
229
250
  tt as buildCellOptions,
230
251
  Z as buildElementRenderer,
231
- rt as buildSpacer,
232
- ct as cellBgStyleAttr,
233
- bt as createBlockTemplate,
234
- m as formatProductPrice,
235
- x as getCurrentCurrencyConfig,
236
- Tt as getDefaultProducts,
237
- v as isDefaultAttribute,
252
+ W as buildSpacer,
253
+ it as cellBgStyleAttr,
254
+ Tt as createBlockTemplate,
255
+ f as formatProductPrice,
256
+ k as getCurrentCurrencyConfig,
257
+ ft as getDefaultProducts,
258
+ w as isDefaultAttribute,
238
259
  q as isSamePrice,
239
- at as renderButtonLabel,
240
- it as renderStyledParagraph,
241
- ut as resolveButtonBorderClass,
260
+ lt as renderButtonLabel,
261
+ rt as renderStyledParagraph,
262
+ at as resolveButtonBorderClass,
242
263
  J as resolveInlinePriceOrder,
243
- lt as resolveOmnibusText,
244
- H as resolvePStyle,
245
- w as resolveProductAttrValue,
264
+ ct as resolveOmnibusText,
265
+ V as resolvePStyle,
266
+ F as resolveProductAttrValue,
246
267
  st as resolveSegmentBgStyle,
247
- mt as sanitizeImageUrl,
268
+ bt as sanitizeImageUrl,
269
+ H as spacer,
248
270
  Q as toCustomCompositionKey,
249
- N as toDisplayName,
250
- F as toDisplayableAttributeValue
271
+ x as toDisplayName,
272
+ N as toDisplayableAttributeValue
251
273
  };