@useinsider/guido 2.1.0-beta.e2153c2 → 2.1.0-beta.e4c3fa1

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 (41) hide show
  1. package/dist/components/organisms/base/Toaster.vue.js +4 -4
  2. package/dist/components/organisms/base/Toaster.vue2.js +12 -9
  3. package/dist/components/organisms/email-preview/desktop-preview/EmailSizeIndicator.vue.js +5 -5
  4. package/dist/components/organisms/email-preview/desktop-preview/EmailSizeIndicator.vue2.js +2 -2
  5. package/dist/composables/useRecommendation.js +9 -9
  6. package/dist/extensions/Blocks/Recommendation/constants/defaultConfig.js +36 -33
  7. package/dist/extensions/Blocks/Recommendation/constants/layout.js +16 -14
  8. package/dist/extensions/Blocks/Recommendation/constants/selectors.js +13 -12
  9. package/dist/extensions/Blocks/Recommendation/controls/button/index.js +9 -9
  10. package/dist/extensions/Blocks/Recommendation/controls/image/index.js +1 -1
  11. package/dist/extensions/Blocks/Recommendation/controls/layout/index.js +37 -27
  12. package/dist/extensions/Blocks/Recommendation/controls/main/algorithm.js +16 -16
  13. package/dist/extensions/Blocks/Recommendation/controls/main/currency.js +30 -32
  14. package/dist/extensions/Blocks/Recommendation/controls/main/index.js +173 -102
  15. package/dist/extensions/Blocks/Recommendation/controls/main/locale.js +9 -9
  16. package/dist/extensions/Blocks/Recommendation/controls/main/productLayout.js +46 -38
  17. package/dist/extensions/Blocks/Recommendation/controls/main/shuffle.js +16 -16
  18. package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +269 -215
  19. package/dist/extensions/Blocks/Recommendation/controls/name/index.js +10 -10
  20. package/dist/extensions/Blocks/Recommendation/controls/name/textTrim.js +5 -5
  21. package/dist/extensions/Blocks/Recommendation/controls/oldPrice/index.js +14 -14
  22. package/dist/extensions/Blocks/Recommendation/controls/omnibusDiscount/index.js +9 -9
  23. package/dist/extensions/Blocks/Recommendation/controls/omnibusDiscount/textAfter.js +3 -3
  24. package/dist/extensions/Blocks/Recommendation/controls/omnibusDiscount/textBefore.js +1 -1
  25. package/dist/extensions/Blocks/Recommendation/controls/omnibusPrice/index.js +9 -9
  26. package/dist/extensions/Blocks/Recommendation/controls/omnibusPrice/textAfter.js +3 -3
  27. package/dist/extensions/Blocks/Recommendation/controls/omnibusPrice/textBefore.js +3 -3
  28. package/dist/extensions/Blocks/Recommendation/controls/price/index.js +3 -3
  29. package/dist/extensions/Blocks/Recommendation/controls/spacing/index.js +225 -102
  30. package/dist/extensions/Blocks/Recommendation/store/recommendation.js +94 -53
  31. package/dist/guido.css +1 -1
  32. package/dist/src/extensions/Blocks/Recommendation/constants/defaultConfig.d.ts +6 -0
  33. package/dist/src/extensions/Blocks/Recommendation/constants/index.d.ts +3 -3
  34. package/dist/src/extensions/Blocks/Recommendation/constants/layout.d.ts +6 -2
  35. package/dist/src/extensions/Blocks/Recommendation/constants/selectors.d.ts +6 -1
  36. package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +33 -10
  37. package/dist/src/extensions/Blocks/Recommendation/controls/main/utils.d.ts +24 -14
  38. package/dist/src/extensions/Blocks/Recommendation/controls/spacing/index.d.ts +49 -17
  39. package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +1 -0
  40. package/dist/src/extensions/Blocks/Recommendation/types/nodeConfig.d.ts +8 -0
  41. package/package.json +1 -1
@@ -1,10 +1,10 @@
1
- import e from "./Toaster.vue2.js";
1
+ import n from "./Toaster.vue2.js";
2
2
  import s from "../../../_virtual/_plugin-vue2_normalizer.js";
3
3
  var r = function() {
4
- var o = this, n = o._self._c, t = o._self._setupProxy;
5
- return n(t.InToasts, { attrs: { "action-buttons-config": t.actionButtonsConfig, status: t.store.status, text: t.store.text, type: t.store.type }, on: { actionButtonClick0: t.handleActionClick } });
4
+ var o = this, e = o._self._c, t = o._self._setupProxy;
5
+ return e(t.InToasts, { ref: "toastRef", attrs: { "action-buttons-config": t.actionButtonsConfig, status: t.store.status, text: t.store.text, type: t.store.type }, on: { actionButtonClick0: t.handleActionClick } });
6
6
  }, a = [], _ = /* @__PURE__ */ s(
7
- e,
7
+ n,
8
8
  r,
9
9
  a,
10
10
  !1,
@@ -1,15 +1,18 @@
1
- import { defineComponent as n, computed as e } from "vue";
2
- import { useToasterStore as i } from "../../../stores/toaster.js";
3
- import { InToasts as c } from "@useinsider/design-system-vue";
4
- const f = /* @__PURE__ */ n({
1
+ import { defineComponent as a, ref as c, computed as i, onBeforeUnmount as u } from "vue";
2
+ import { useToasterStore as f } from "../../../stores/toaster.js";
3
+ import { InToasts as m } from "@useinsider/design-system-vue";
4
+ const d = /* @__PURE__ */ a({
5
5
  __name: "Toaster",
6
- setup(s) {
7
- const t = i(), o = e(() => t.actionButton ? [{ text: t.actionButton.text }] : []);
8
- return { __sfc: !0, store: t, actionButtonsConfig: o, handleActionClick: () => {
6
+ setup(p) {
7
+ const t = f(), o = c(null), r = i(() => t.actionButton ? [{ text: t.actionButton.text }] : []), s = () => {
9
8
  t.actionButton && t.actionButton.onClick(), t.hideToaster();
10
- }, InToasts: c };
9
+ };
10
+ return u(() => {
11
+ var e, n;
12
+ t.$reset(), (n = (e = o.value) == null ? void 0 : e.$el) == null || n.remove();
13
+ }), { __sfc: !0, store: t, toastRef: o, actionButtonsConfig: r, handleActionClick: s, InToasts: m };
11
14
  }
12
15
  });
13
16
  export {
14
- f as default
17
+ d as default
15
18
  };
@@ -1,16 +1,16 @@
1
- import i from "./EmailSizeIndicator.vue2.js";
1
+ import s from "./EmailSizeIndicator.vue2.js";
2
2
  /* empty css */
3
3
  import r from "../../../../_virtual/_plugin-vue2_normalizer.js";
4
4
  var o = function() {
5
- var t = this, s = t._self._c, e = t._self._setupProxy;
6
- return e.previewStore.previewHtml ? s("div", { staticClass: "d-f a-i-c j-c-c" }, [s(e.InProgress, { staticClass: "min-w-15-s", attrs: { id: "email-size-progress", "description-status": "", "description-position": "left", description: e.htmlSize, "max-value": e.MAX_EMAIL_SIZE_IN_KB, type: e.progress.type, value: e.progress.value } }), s(e.InTooltip, { staticClass: "d-f ml-1", attrs: { id: "email-size-tooltip", align: "center", position: "bottom", text: e.trans("email-editor.preview-design-size-tooltip") } })], 1) : t._e();
5
+ var e = this, i = e._self._c, t = e._self._setupProxy;
6
+ return t.previewStore.previewHtml ? i("div", { staticClass: "d-f a-i-c j-c-c" }, [i(t.InProgress, { staticClass: "min-w-15-s", attrs: { id: "email-size-progress", "description-status": "", "description-position": "left", description: t.htmlSize, "max-value": t.MAX_EMAIL_SIZE_IN_KB, type: t.progress.type, value: t.progress.value } }), i(t.InTooltipV2, { attrs: { id: "email-size-tooltip", "icon-status": "", "static-position": "bottom center", "dynamic-position": !1, text: t.trans("email-editor.preview-design-size-tooltip") } })], 1) : e._e();
7
7
  }, a = [], n = /* @__PURE__ */ r(
8
- i,
8
+ s,
9
9
  o,
10
10
  a,
11
11
  !1,
12
12
  null,
13
- "913a3417"
13
+ "079d2bf7"
14
14
  );
15
15
  const m = n.exports;
16
16
  export {
@@ -1,7 +1,7 @@
1
1
  import { defineComponent as c, ref as n, computed as l, watch as u } from "vue";
2
2
  import { useTranslations as p } from "../../../../composables/useTranslations.js";
3
3
  import { usePreviewStore as _ } from "../../../../stores/preview.js";
4
- import { InTooltip as v, InProgress as f } from "@useinsider/design-system-vue";
4
+ import { InTooltipV2 as v, InProgress as f } from "@useinsider/design-system-vue";
5
5
  const S = /* @__PURE__ */ c({
6
6
  __name: "EmailSizeIndicator",
7
7
  setup(w) {
@@ -17,7 +17,7 @@ const S = /* @__PURE__ */ c({
17
17
  }, i = p();
18
18
  return u(() => t.previewHtml, () => {
19
19
  r();
20
- }, { immediate: !0 }), { __sfc: !0, previewStore: t, MAX_EMAIL_SIZE_IN_KB: o, htmlKB: e, progress: s, htmlSize: a, calculateProgress: r, trans: i, InProgress: f, InTooltip: v };
20
+ }, { immediate: !0 }), { __sfc: !0, previewStore: t, MAX_EMAIL_SIZE_IN_KB: o, htmlKB: e, progress: s, htmlSize: a, calculateProgress: r, trans: i, InProgress: f, InTooltipV2: v };
21
21
  }
22
22
  });
23
23
  export {
@@ -1,8 +1,8 @@
1
1
  import { RecommendationFeedSourceMaps as g, URLS as p } from "../enums/extensions/recommendationBlock.js";
2
2
  import { MinDeviceViewport as R, DefaultPadding as b } from "../enums/recommendation.js";
3
- import { useRecommendationExtensionStore as l } from "../extensions/Blocks/Recommendation/store/recommendation.js";
3
+ import { useRecommendationExtensionStore as u } from "../extensions/Blocks/Recommendation/store/recommendation.js";
4
4
  import { generateCompleteFilterQuery as x } from "../extensions/Blocks/Recommendation/utils/filterUtil.js";
5
- import { useConfigStore as C } from "../stores/config.js";
5
+ import { useConfigStore as I } from "../stores/config.js";
6
6
  const N = () => ({
7
7
  calculateCardWidth: ({
8
8
  mobileLeftPadding: i,
@@ -14,7 +14,7 @@ const N = () => ({
14
14
  return (R - e) / r;
15
15
  },
16
16
  getRecommendationCampaignData: (i) => {
17
- const n = l(), o = Number(i), a = n.blockStates[o];
17
+ const n = u(), o = Number(i), a = n.blockStates[o];
18
18
  if (!a)
19
19
  return {
20
20
  textTrimming: !1,
@@ -43,16 +43,16 @@ const N = () => ({
43
43
  };
44
44
  },
45
45
  buildCampaignUrl: (i) => {
46
- var d;
47
- const n = l(), o = C(), a = Number(i), r = n.blockStates[a];
46
+ var m;
47
+ const n = u(), o = I(), a = Number(i), r = n.blockStates[a];
48
48
  if (!r)
49
49
  return "";
50
- const { recommendationConfigs: e } = r, u = ((d = g.find((s) => s.key === e.strategy)) == null ? void 0 : d.path) || "", t = new URLSearchParams();
51
- t.set("locale", e.language), t.set("currency", e.currencySettings.value), t.set("partnerName", o.partnerName), t.set("size", e.size), t.set("details", "true"), t.set("campaignId", o.variationId), e.strategy === "manualMerchandising" ? t.set("productId", e.productIds.join(",")) : e.strategy === "similarViewed" && t.set("productId", "{itemId}");
50
+ const { recommendationConfigs: e } = r, l = ((m = g.find((s) => s.key === e.strategy)) == null ? void 0 : m.path) || "", t = new URLSearchParams();
51
+ t.set("locale", e.language), t.set("currency", e.currencySettings.value), t.set("partnerName", o.partnerName), t.set("size", e.size), t.set("details", "true"), t.set("campaignId", o.variationId), e.strategy === "manualMerchandising" ? t.set("productId", e.productIds.join(",")) : e.strategy === "similarViewed" && t.set("productId", "{itemId}"), e.strategy === "userBased" && t.set("userId", "{user_id}");
52
52
  const f = e.filters.filter((s) => s.isValid), c = x(f);
53
53
  c && t.set("filter", c), e.shuffleProducts && t.set("shuffle", "true");
54
- const m = `${p.RECOMMENDATION_API_URL}/v2/${u}?${t.toString()}`;
55
- return n.recommendationCampaignUrls[i] = m, m;
54
+ const d = `${p.RECOMMENDATION_API_URL}/v2/${l}?${t.toString()}`;
55
+ return n.recommendationCampaignUrls[i] = d, d;
56
56
  }
57
57
  });
58
58
  export {
@@ -1,66 +1,69 @@
1
- import { DEFAULT_ROW_SPACING as U, DEFAULT_COLUMN_SPACING as I, DEFAULT_MOBILE_CARDS_IN_ROW as n, DEFAULT_CARDS_IN_ROW as s } from "./layout.js";
2
- import { ATTR_PRODUCT_IMAGE as t, ATTR_PRODUCT_NAME as e, ATTR_PRODUCT_OLD_PRICE as o, ATTR_PRODUCT_PRICE as _, ATTR_PRODUCT_OMNIBUS_PRICE as T, ATTR_PRODUCT_OMNIBUS_DISCOUNT as r, ATTR_PRODUCT_BUTTON as R } from "./selectors.js";
3
- const O = {
1
+ import { DEFAULT_MOBILE_ROW_SPACING as U, DEFAULT_MOBILE_COLUMN_SPACING as R, DEFAULT_ROW_SPACING as n, DEFAULT_COLUMN_SPACING as O, DEFAULT_MOBILE_CARDS_IN_ROW as C, DEFAULT_CARDS_IN_ROW as D } from "./layout.js";
2
+ import { ATTR_PRODUCT_IMAGE as _, ATTR_PRODUCT_NAME as o, ATTR_PRODUCT_OLD_PRICE as t, ATTR_PRODUCT_PRICE as e, ATTR_PRODUCT_OMNIBUS_PRICE as T, ATTR_PRODUCT_OMNIBUS_DISCOUNT as I, ATTR_PRODUCT_BUTTON as r } from "./selectors.js";
3
+ const i = {
4
4
  code: "USD",
5
5
  symbol: "USD",
6
6
  alignment: "after",
7
7
  decimalCount: 2,
8
8
  decimalSeparator: ".",
9
9
  thousandSeparator: ","
10
- }, i = {
10
+ }, A = {
11
11
  textBefore: "",
12
12
  textAfter: ""
13
- }, C = {
13
+ }, s = {
14
14
  textBefore: "",
15
15
  textAfter: ""
16
- }, D = [
16
+ }, E = [
17
+ _,
18
+ o,
17
19
  t,
18
20
  e,
19
- o,
20
- _,
21
21
  T,
22
- r,
23
- R
24
- ], A = {
25
- [t]: !0,
26
- [e]: !0,
22
+ I,
23
+ r
24
+ ], c = {
27
25
  [_]: !0,
28
26
  [o]: !0,
27
+ [e]: !0,
28
+ [t]: !0,
29
29
  [T]: !1,
30
- [r]: !1,
31
- [R]: !0
32
- }, E = {
30
+ [I]: !1,
31
+ [r]: !0
32
+ }, N = {
33
33
  // Settings
34
34
  strategy: "mostPopular",
35
35
  productIds: [],
36
36
  size: "6",
37
37
  shuffleProducts: !1,
38
38
  language: "en_US",
39
- currency: O,
39
+ currency: i,
40
40
  filters: [],
41
41
  // Layout
42
42
  layout: "grid",
43
- cardsInRow: s,
44
- mobileCardsInRow: n,
45
- columnSpacing: I,
46
- rowSpacing: U,
43
+ cardsInRow: D,
44
+ mobileCardsInRow: C,
45
+ columnSpacing: O,
46
+ rowSpacing: n,
47
+ mobileColumnSpacing: R,
48
+ mobileRowSpacing: U,
47
49
  // Composition
48
- composition: D,
49
- visibility: A,
50
+ composition: E,
51
+ visibility: c,
50
52
  // Element settings
51
- omnibusPrice: i,
52
- omnibusDiscount: C,
53
+ omnibusPrice: A,
54
+ omnibusDiscount: s,
53
55
  textTrimming: !1,
54
56
  // Meta
55
57
  configVersion: 1,
56
58
  recommendationId: 0
57
- }, N = 1;
59
+ }, m = [11, 12], L = 1;
58
60
  export {
59
- N as CURRENT_CONFIG_VERSION,
60
- D as DEFAULT_COMPOSITION,
61
- O as DEFAULT_CURRENCY,
62
- E as DEFAULT_NODE_CONFIG,
63
- C as DEFAULT_OMNIBUS_DISCOUNT,
64
- i as DEFAULT_OMNIBUS_PRICE,
65
- A as DEFAULT_VISIBILITY
61
+ L as CURRENT_CONFIG_VERSION,
62
+ E as DEFAULT_COMPOSITION,
63
+ i as DEFAULT_CURRENCY,
64
+ N as DEFAULT_NODE_CONFIG,
65
+ s as DEFAULT_OMNIBUS_DISCOUNT,
66
+ A as DEFAULT_OMNIBUS_PRICE,
67
+ c as DEFAULT_VISIBILITY,
68
+ m as EXCLUDED_ALGORITHM_IDS
66
69
  };
@@ -1,22 +1,24 @@
1
1
  const _ = {
2
2
  GRID: "grid",
3
3
  LIST: "list"
4
- }, o = [
4
+ }, A = [
5
5
  { icon: "grid-orientation", value: _.GRID },
6
6
  { icon: "list-orientation", value: _.LIST }
7
- ], t = 3, n = 3, A = 9, O = 4, R = 1, T = 2, c = 10, s = 20, I = 0, S = 50, P = 5;
7
+ ], o = 3, t = 3, O = 9, n = 4, I = 1, L = 2, R = 10, T = 10, c = 10, s = 10, S = 0, U = 50, C = 5;
8
8
  export {
9
- n as DEFAULT_CARDS_IN_ROW,
10
- c as DEFAULT_COLUMN_SPACING,
11
- R as DEFAULT_MOBILE_CARDS_IN_ROW,
12
- t as DEFAULT_PRODUCTS_PER_ROW,
13
- s as DEFAULT_ROW_SPACING,
14
- o as LAYOUT_OPTIONS,
9
+ t as DEFAULT_CARDS_IN_ROW,
10
+ R as DEFAULT_COLUMN_SPACING,
11
+ I as DEFAULT_MOBILE_CARDS_IN_ROW,
12
+ c as DEFAULT_MOBILE_COLUMN_SPACING,
13
+ s as DEFAULT_MOBILE_ROW_SPACING,
14
+ o as DEFAULT_PRODUCTS_PER_ROW,
15
+ T as DEFAULT_ROW_SPACING,
16
+ A as LAYOUT_OPTIONS,
15
17
  _ as LAYOUT_VALUES,
16
- T as MAX_MOBILE_PRODUCTS_PER_ROW,
17
- O as MAX_PRODUCTS_PER_ROW,
18
- A as MAX_PRODUCT_COUNT,
19
- S as MAX_SPACING,
20
- I as MIN_SPACING,
21
- P as SPACING_STEP
18
+ L as MAX_MOBILE_PRODUCTS_PER_ROW,
19
+ n as MAX_PRODUCTS_PER_ROW,
20
+ O as MAX_PRODUCT_COUNT,
21
+ U as MAX_SPACING,
22
+ S as MIN_SPACING,
23
+ C as SPACING_STEP
22
24
  };
@@ -1,21 +1,22 @@
1
- const c = ".ins-recommendation-product-container", n = ".ins-recommendation-desktop-container", o = ".ins-recommendation-mobile-container", T = {
1
+ const c = ".ins-recommendation-v3-block-v2", n = ".ins-recommendation-product-container", o = ".ins-recommendation-desktop-container", T = ".ins-recommendation-mobile-container", t = {
2
2
  CURRENCY: "currency",
3
3
  SYMBOL: "currency-symbol",
4
4
  ALIGNMENT: "currency-alignment",
5
5
  THOUSAND_SEPARATOR: "currency-thousand-separator",
6
6
  DECIMAL_SEPARATOR: "currency-decimal-separator",
7
7
  DECIMAL_COUNT: "currency-decimal-count"
8
- }, t = "productImage", r = "productName", R = "productPrice", e = "productOldPrice", O = "productOmnibusPrice", _ = "productOmnibusDiscount", C = "productButton";
8
+ }, r = "productImage", R = "productName", O = "productPrice", e = "productOldPrice", _ = "productOmnibusPrice", C = "productOmnibusDiscount", E = "productButton";
9
9
  export {
10
- C as ATTR_PRODUCT_BUTTON,
11
- t as ATTR_PRODUCT_IMAGE,
12
- r as ATTR_PRODUCT_NAME,
10
+ E as ATTR_PRODUCT_BUTTON,
11
+ r as ATTR_PRODUCT_IMAGE,
12
+ R as ATTR_PRODUCT_NAME,
13
13
  e as ATTR_PRODUCT_OLD_PRICE,
14
- _ as ATTR_PRODUCT_OMNIBUS_DISCOUNT,
15
- O as ATTR_PRODUCT_OMNIBUS_PRICE,
16
- R as ATTR_PRODUCT_PRICE,
17
- c as CONTAINER_SELECTOR,
18
- T as CURRENCY_ATTR,
19
- n as DESKTOP_CONTAINER_SELECTOR,
20
- o as MOBILE_CONTAINER_SELECTOR
14
+ C as ATTR_PRODUCT_OMNIBUS_DISCOUNT,
15
+ _ as ATTR_PRODUCT_OMNIBUS_PRICE,
16
+ O as ATTR_PRODUCT_PRICE,
17
+ c as BLOCK_ROOT_SELECTOR,
18
+ n as CONTAINER_SELECTOR,
19
+ t as CURRENCY_ATTR,
20
+ o as DESKTOP_CONTAINER_SELECTOR,
21
+ T as MOBILE_CONTAINER_SELECTOR
21
22
  };
@@ -1,7 +1,7 @@
1
1
  import { createButtonFitToContainerControl as T, createButtonTextStyleAndFontColorControl as r, createButtonTextSizeControl as e, createButtonTextControl as B, createButtonPaddingsControl as l, createButtonMarginsControl as C, createButtonFontFamilyControl as O, createButtonColorControl as N, createButtonBorderRadiusControl as i, createButtonBorderControl as a, createButtonAlignControl as c } from "../../../controlFactories.js";
2
2
  import { RecommendationBlockId as o } from "../../constants/blockIds.js";
3
3
  import { RecommendationControlId as t } from "../../constants/controlIds.js";
4
- import { CONTAINER_SELECTOR as n } from "../../constants/selectors.js";
4
+ import { BLOCK_ROOT_SELECTOR as n } from "../../constants/selectors.js";
5
5
  const U = c(
6
6
  t.BUTTON_ALIGN,
7
7
  o.BUTTON,
@@ -34,19 +34,19 @@ const U = c(
34
34
  t.BUTTON_TEXT,
35
35
  o.BUTTON,
36
36
  n
37
- ), A = e(
37
+ ), S = e(
38
38
  t.BUTTON_TEXT_SIZE,
39
39
  o.BUTTON,
40
40
  n
41
- ), S = r(
41
+ ), A = r(
42
42
  t.BUTTON_TEXT_STYLE_AND_FONT_COLOR,
43
43
  o.BUTTON,
44
44
  n
45
- ), E = T(
45
+ ), x = T(
46
46
  t.BUTTON_FIT_TO_CONTENT,
47
47
  o.BUTTON,
48
48
  n
49
- ), p = {
49
+ ), f = {
50
50
  align: U,
51
51
  border: d,
52
52
  borderRadius: s,
@@ -55,10 +55,10 @@ const U = c(
55
55
  margins: u,
56
56
  paddings: R,
57
57
  text: F,
58
- textSize: A,
59
- textStyleAndFontColor: S,
60
- fitToContent: E
58
+ textSize: S,
59
+ textStyleAndFontColor: A,
60
+ fitToContent: x
61
61
  };
62
62
  export {
63
- p as ButtonControls
63
+ f as ButtonControls
64
64
  };
@@ -1,7 +1,7 @@
1
1
  import { createImageMarginsControl as m, createImageSizeControl as n } from "../../../controlFactories.js";
2
2
  import { RecommendationBlockId as o } from "../../constants/blockIds.js";
3
3
  import { RecommendationControlId as r } from "../../constants/controlIds.js";
4
- import { CONTAINER_SELECTOR as t } from "../../constants/selectors.js";
4
+ import { BLOCK_ROOT_SELECTOR as t } from "../../constants/selectors.js";
5
5
  const e = n(
6
6
  r.IMAGE_SIZE,
7
7
  o.IMAGE,
@@ -1,25 +1,29 @@
1
- var c = Object.defineProperty;
2
- var d = (o, e, t) => e in o ? c(o, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[e] = t;
3
- var n = (o, e, t) => d(o, typeof e != "symbol" ? e + "" : e, t);
4
- import { ModificationDescription as m } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
1
+ var C = Object.defineProperty;
2
+ var L = (o, e, t) => e in o ? C(o, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[e] = t;
3
+ var i = (o, e, t) => L(o, typeof e != "symbol" ? e + "" : e, t);
4
+ import { ModificationDescription as _ } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
5
5
  import { CommonControl as h } from "../../../common-control.js";
6
- import { LAYOUT_OPTIONS as g } from "../../constants/layout.js";
6
+ import { LAYOUT_OPTIONS as p, DEFAULT_MOBILE_ROW_SPACING as c, DEFAULT_MOBILE_COLUMN_SPACING as d, DEFAULT_ROW_SPACING as m, DEFAULT_COLUMN_SPACING as g } from "../../constants/layout.js";
7
7
  import { RecommendationConfigService as r } from "../../services/configService.js";
8
- import { useRecommendationExtensionStore as l } from "../../store/recommendation.js";
9
- import { getCurrentLayout as u, getBlockElement as f, regenerateProductRowsWithStyles as p } from "../main/utils.js";
10
- const L = "recommendation-layout-control", i = {
8
+ import { useRecommendationExtensionStore as N } from "../../store/recommendation.js";
9
+ import { getCurrentLayout as l, getBlockElement as A, regenerateProductRowsWithStyles as O } from "../main/utils.js";
10
+ const f = "recommendation-layout-control", a = {
11
11
  LAYOUT: "layout"
12
- }, C = {
13
- LAYOUT: "data-layout"
12
+ }, n = {
13
+ LAYOUT: "data-layout",
14
+ COLUMN_SPACING: "data-column-spacing",
15
+ ROW_SPACING: "data-row-spacing",
16
+ MOBILE_COLUMN_SPACING: "data-mobile-column-spacing",
17
+ MOBILE_ROW_SPACING: "data-mobile-row-spacing"
14
18
  };
15
- class Y extends h {
19
+ class R extends h {
16
20
  constructor() {
17
21
  super(...arguments);
18
- n(this, "store", l());
19
- n(this, "isChangingLayout", !1);
22
+ i(this, "store", N());
23
+ i(this, "isChangingLayout", !1);
20
24
  }
21
25
  getId() {
22
- return L;
26
+ return f;
23
27
  }
24
28
  getTemplate() {
25
29
  return `
@@ -27,8 +31,8 @@ class Y extends h {
27
31
  ${this._GuTwoColumns([
28
32
  this._GuLabel({ text: "Layout Orientation" }),
29
33
  this._GuRadioButton({
30
- name: i.LAYOUT,
31
- buttons: g
34
+ name: a.LAYOUT,
35
+ buttons: p
32
36
  })
33
37
  ])}
34
38
  </div>
@@ -41,9 +45,9 @@ class Y extends h {
41
45
  super.onTemplateNodeUpdated(t), this._setFormValues();
42
46
  }
43
47
  _setFormValues() {
44
- const s = r.getConfig(this.currentNode).layout || u(this.currentNode);
48
+ const s = r.getConfig(this.currentNode).layout || l(this.currentNode);
45
49
  this.api.updateValues({
46
- [i.LAYOUT]: s
50
+ [a.LAYOUT]: s
47
51
  });
48
52
  }
49
53
  /**
@@ -51,18 +55,24 @@ class Y extends h {
51
55
  * Updates node config, data attribute and regenerates product rows
52
56
  */
53
57
  _onLayoutChange(t) {
54
- if (this.isChangingLayout || !this.currentNode || (r.getConfig(this.currentNode).layout || u(this.currentNode)) === t)
58
+ if (this.isChangingLayout || !this.currentNode || (r.getConfig(this.currentNode).layout || l(this.currentNode)) === t)
55
59
  return;
56
- const a = f(this.currentNode);
57
- if (a) {
60
+ const u = A(this.currentNode);
61
+ if (u) {
58
62
  this.isChangingLayout = !0;
59
63
  try {
60
64
  r.updateConfig(
61
65
  this.api,
62
66
  this.currentNode,
63
- { layout: t },
67
+ {
68
+ layout: t,
69
+ columnSpacing: g,
70
+ rowSpacing: m,
71
+ mobileColumnSpacing: d,
72
+ mobileRowSpacing: c
73
+ },
64
74
  `Changed layout to ${t}`
65
- ), this.store.patchCurrentBlockConfig({ orientation: t }), this.api.getDocumentModifier().modifyHtml(a).setAttribute(C.LAYOUT, t).apply(new m(`Update layout to ${t}`)), this._regenerateProductRows(t);
75
+ ), this.store.patchCurrentBlockConfig({ orientation: t }), this.api.getDocumentModifier().modifyHtml(u).setAttribute(n.LAYOUT, t).setAttribute(n.COLUMN_SPACING, g.toString()).setAttribute(n.ROW_SPACING, m.toString()).setAttribute(n.MOBILE_COLUMN_SPACING, d.toString()).setAttribute(n.MOBILE_ROW_SPACING, c.toString()).apply(new _(`Update layout to ${t}`)), this._regenerateProductRows(t);
66
76
  } finally {
67
77
  this.isChangingLayout = !1;
68
78
  }
@@ -74,19 +84,19 @@ class Y extends h {
74
84
  * @param layout - The layout to use for regeneration (passed explicitly to avoid stale DOM reads)
75
85
  */
76
86
  _regenerateProductRows(t) {
77
- this.currentNode && p({
87
+ this.currentNode && O({
78
88
  currentNode: this.currentNode,
79
89
  documentModifier: this.api.getDocumentModifier(),
80
90
  layout: t
81
91
  });
82
92
  }
83
93
  _listenToFormUpdates() {
84
- this.api.onValueChanged(i.LAYOUT, (t) => {
94
+ this.api.onValueChanged(a.LAYOUT, (t) => {
85
95
  this._onLayoutChange(t);
86
96
  });
87
97
  }
88
98
  }
89
99
  export {
90
- L as LAYOUT_CONTROL_ID,
91
- Y as LayoutControl
100
+ f as LAYOUT_CONTROL_ID,
101
+ R as LayoutControl
92
102
  };
@@ -1,22 +1,22 @@
1
- var d = Object.defineProperty;
2
- var l = (o, i, t) => i in o ? d(o, i, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[i] = t;
3
- var a = (o, i, t) => l(o, typeof i != "symbol" ? i + "" : i, t);
4
- import { UEAttr as c } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
5
- import { CommonControl as h } from "../../../common-control.js";
1
+ var c = Object.defineProperty;
2
+ var d = (r, i, t) => i in r ? c(r, i, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[i] = t;
3
+ var a = (r, i, t) => d(r, typeof i != "symbol" ? i + "" : i, t);
4
+ import { UEAttr as h } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
5
+ import { CommonControl as l } from "../../../common-control.js";
6
6
  import { RecommendationConfigService as n } from "../../services/configService.js";
7
7
  import { useRecommendationExtensionStore as m } from "../../store/recommendation.js";
8
- const u = "recommendation-algorithm-control", e = {
8
+ const g = "recommendation-algorithm-control", e = {
9
9
  ALGORITHM: "strategy",
10
10
  PRODUCT_IDS: "productIds"
11
11
  };
12
- class T extends h {
12
+ class T extends l {
13
13
  constructor() {
14
14
  super(...arguments);
15
15
  // Store is used ONLY for API-fetched data (algorithms list), not for config
16
16
  a(this, "store", m());
17
17
  }
18
18
  getId() {
19
- return u;
19
+ return g;
20
20
  }
21
21
  getTemplate() {
22
22
  return `
@@ -52,13 +52,13 @@ class T extends h {
52
52
  });
53
53
  }
54
54
  _initializeSelectItems() {
55
- var r;
56
- const t = (r = this.store) == null ? void 0 : r.getActivePredictiveAlgorithms;
55
+ var o;
56
+ const t = (o = this.store) == null ? void 0 : o.getActivePredictiveAlgorithms;
57
57
  if (t != null && t.length)
58
58
  try {
59
59
  this.api.setUIEAttribute(
60
60
  e.ALGORITHM,
61
- c.SELECTPICKER.items,
61
+ h.SELECTPICKER.items,
62
62
  t
63
63
  );
64
64
  } catch (s) {
@@ -70,7 +70,7 @@ class T extends h {
70
70
  this.api.setVisibility(e.PRODUCT_IDS, s), this.api.setVisibility(`${e.PRODUCT_IDS}_label`, s);
71
71
  }
72
72
  _onAlgorithmChange(t) {
73
- this.currentNode && (n.updateConfig(
73
+ !this.currentNode || n.getConfig(this.currentNode).strategy === t || (n.updateConfig(
74
74
  this.api,
75
75
  this.currentNode,
76
76
  { strategy: t },
@@ -80,13 +80,13 @@ class T extends h {
80
80
  _onProductIdsChange(t) {
81
81
  if (!this.currentNode)
82
82
  return;
83
- const r = t.split(",").map((s) => s.trim()).filter(Boolean);
83
+ const o = t.split(",").map((s) => s.trim()).filter(Boolean);
84
84
  n.updateConfig(
85
85
  this.api,
86
86
  this.currentNode,
87
- { productIds: r },
87
+ { productIds: o },
88
88
  "Updated product IDs"
89
- ), this.store.patchCurrentBlockConfig({ productIds: r });
89
+ ), this.store.patchCurrentBlockConfig({ productIds: o });
90
90
  }
91
91
  _listenToFormUpdates() {
92
92
  this.api.onValueChanged(e.ALGORITHM, (t) => {
@@ -97,6 +97,6 @@ class T extends h {
97
97
  }
98
98
  }
99
99
  export {
100
- u as ALGORITHM_CONTROL_ID,
100
+ g as ALGORITHM_CONTROL_ID,
101
101
  T as AlgorithmControl
102
102
  };