@useinsider/guido 3.12.0-beta.00cbb4c → 3.12.0-beta.19da4fb

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 (96) hide show
  1. package/dist/@types/config/schemas.js +9 -4
  2. package/dist/components/Guido.vue.js +8 -8
  3. package/dist/components/Guido.vue2.js +58 -56
  4. package/dist/components/organisms/email-preview/desktop-preview/DesktopPreview.vue.js +1 -1
  5. package/dist/components/organisms/email-preview/desktop-preview/DesktopPreview.vue2.js +8 -8
  6. package/dist/components/organisms/email-preview/mobile-preview/ContentView.vue.js +5 -5
  7. package/dist/components/organisms/email-preview/mobile-preview/ContentView.vue2.js +10 -10
  8. package/dist/components/organisms/extensions/recommendation/StrategyDetailDrawer.vue.js +38 -0
  9. package/dist/components/organisms/extensions/recommendation/StrategyDetailDrawer.vue2.js +271 -0
  10. package/dist/components/organisms/extensions/recommendation/StrategyInfoBox.vue.js +20 -0
  11. package/dist/components/organisms/extensions/recommendation/StrategyInfoBox.vue2.js +16 -0
  12. package/dist/components/organisms/extensions/recommendation/StrategyPicker.vue.js +20 -0
  13. package/dist/components/organisms/extensions/recommendation/StrategyPicker.vue2.js +80 -0
  14. package/dist/components/organisms/extensions/recommendation/strategy-detail/CampaignTable.vue.js +18 -0
  15. package/dist/components/organisms/extensions/recommendation/strategy-detail/CampaignTable.vue2.js +42 -0
  16. package/dist/components/organisms/extensions/recommendation/strategy-detail/FilterHumanizer.vue.js +20 -0
  17. package/dist/components/organisms/extensions/recommendation/strategy-detail/FilterHumanizer.vue2.js +18 -0
  18. package/dist/components/organisms/extensions/recommendation/strategy-detail/HumanizerCondition.vue.js +20 -0
  19. package/dist/components/organisms/extensions/recommendation/strategy-detail/HumanizerCondition.vue2.js +60 -0
  20. package/dist/components/organisms/extensions/recommendation/strategy-detail/HumanizerGroup.vue.js +19 -0
  21. package/dist/components/organisms/extensions/recommendation/strategy-detail/HumanizerGroup.vue2.js +19 -0
  22. package/dist/components/organisms/extensions/recommendation/strategy-detail/InfoDisplayValue.vue.js +22 -0
  23. package/dist/components/organisms/extensions/recommendation/strategy-detail/InfoDisplayValue.vue2.js +29 -0
  24. package/dist/components/organisms/header/ViewOptions.vue.js +3 -3
  25. package/dist/components/organisms/header/version-history/ViewOptions.vue.js +1 -1
  26. package/dist/composables/usePreviewInteractionGuard.js +36 -11
  27. package/dist/composables/useRecommendation.js +82 -51
  28. package/dist/composables/useRecommendationPreview.js +61 -60
  29. package/dist/composables/useStrategyFilters.js +16 -0
  30. package/dist/config/migrator/recommendationMigrator.js +7 -4
  31. package/dist/enums/date.js +4 -3
  32. package/dist/enums/extensions/filteringV2.js +1024 -0
  33. package/dist/enums/extensions/recommendationBlock.js +43 -29
  34. package/dist/enums/extensions/strategyDetail.js +148 -0
  35. package/dist/extensions/Blocks/Recommendation/constants/controlIds.js +1 -1
  36. package/dist/extensions/Blocks/Recommendation/constants/defaultConfig.js +12 -11
  37. package/dist/extensions/Blocks/Recommendation/controls/blockBackground/index.js +10 -0
  38. package/dist/extensions/Blocks/Recommendation/controls/main/index.js +137 -119
  39. package/dist/extensions/Blocks/Recommendation/controls/main/strategy.js +57 -0
  40. package/dist/extensions/Blocks/Recommendation/extension.js +23 -21
  41. package/dist/extensions/Blocks/Recommendation/settingsPanel.js +41 -40
  42. package/dist/extensions/Blocks/Recommendation/store/recommendation.js +392 -112
  43. package/dist/extensions/Blocks/Recommendation/utils/strategyHumanizer.js +97 -0
  44. package/dist/extensions/Blocks/Recommendation/utils/strategyInfoBox.js +24 -0
  45. package/dist/extensions/Blocks/Recommendation/utils/strategyNavigation.js +8 -0
  46. package/dist/extensions/Blocks/Recommendation/utils/strategySummary.js +95 -0
  47. package/dist/extensions/Blocks/Recommendation/validation/requiredFields.js +24 -10
  48. package/dist/extensions/Blocks/Unsubscribe/utils/constants.js +3 -2
  49. package/dist/extensions/Blocks/controlFactories.js +125 -75
  50. package/dist/guido.css +1 -1
  51. package/dist/node_modules/@vueuse/core/index.js +48 -0
  52. package/dist/node_modules/@vueuse/shared/index.js +57 -27
  53. package/dist/services/recommendationApi.js +86 -29
  54. package/dist/services/stripoApi.js +18 -18
  55. package/dist/src/@types/config/schemas.d.ts +10 -0
  56. package/dist/src/components/organisms/extensions/recommendation/StrategyDetailDrawer.vue.d.ts +2 -0
  57. package/dist/src/components/organisms/extensions/recommendation/StrategyInfoBox.vue.d.ts +26 -0
  58. package/dist/src/components/organisms/extensions/recommendation/StrategyPicker.vue.d.ts +2 -0
  59. package/dist/src/components/organisms/extensions/recommendation/strategy-detail/CampaignTable.vue.d.ts +43 -0
  60. package/dist/src/components/organisms/extensions/recommendation/strategy-detail/FilterHumanizer.vue.d.ts +29 -0
  61. package/dist/src/components/organisms/extensions/recommendation/strategy-detail/HumanizerCondition.vue.d.ts +40 -0
  62. package/dist/src/components/organisms/extensions/recommendation/strategy-detail/HumanizerGroup.vue.d.ts +38 -0
  63. package/dist/src/components/organisms/extensions/recommendation/strategy-detail/InfoDisplayValue.vue.d.ts +51 -0
  64. package/dist/src/composables/useConfig.d.ts +2 -0
  65. package/dist/src/composables/usePreviewInteractionGuard.d.ts +1 -1
  66. package/dist/src/composables/useRecommendation.d.ts +2 -0
  67. package/dist/src/composables/useStrategyFilters.d.ts +24 -0
  68. package/dist/src/enums/extensions/filteringV2.d.ts +72 -0
  69. package/dist/src/enums/extensions/recommendationBlock.d.ts +21 -0
  70. package/dist/src/enums/extensions/strategyDetail.d.ts +90 -0
  71. package/dist/src/extensions/Blocks/Recommendation/constants/controlIds.d.ts +1 -0
  72. package/dist/src/extensions/Blocks/Recommendation/controls/blockBackground/index.d.ts +14 -0
  73. package/dist/src/extensions/Blocks/Recommendation/controls/index.d.ts +1 -0
  74. package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +10 -4
  75. package/dist/src/extensions/Blocks/Recommendation/controls/main/strategy.d.ts +16 -0
  76. package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +894 -1
  77. package/dist/src/extensions/Blocks/Recommendation/types/nodeConfig.d.ts +7 -0
  78. package/dist/src/extensions/Blocks/Recommendation/utils/strategyHumanizer.d.ts +50 -0
  79. package/dist/src/extensions/Blocks/Recommendation/utils/strategyInfoBox.d.ts +33 -0
  80. package/dist/src/extensions/Blocks/Recommendation/utils/strategyNavigation.d.ts +10 -0
  81. package/dist/src/extensions/Blocks/Recommendation/utils/strategySummary.d.ts +34 -0
  82. package/dist/src/extensions/Blocks/Recommendation/validation/requiredFields.d.ts +8 -1
  83. package/dist/src/extensions/Blocks/Unsubscribe/utils/constants.d.ts +1 -0
  84. package/dist/src/extensions/Blocks/controlFactories.d.ts +36 -0
  85. package/dist/src/mock/api/recommendation-strategies.d.ts +2 -0
  86. package/dist/src/services/recommendationApi.d.ts +8 -1
  87. package/dist/src/stores/config.d.ts +18 -0
  88. package/dist/src/utils/genericUtil.d.ts +9 -0
  89. package/dist/src/utils/urlSchemes.d.ts +6 -0
  90. package/dist/static/styles/base.css.js +25 -0
  91. package/dist/static/styles/components/base-input.css.js +6 -7
  92. package/dist/utils/dateUtil.js +23 -10
  93. package/dist/utils/genericUtil.js +10 -1
  94. package/dist/utils/templatePreparation.js +70 -57
  95. package/dist/utils/urlSchemes.js +4 -0
  96. package/package.json +2 -2
@@ -0,0 +1,22 @@
1
+ import a from "./InfoDisplayValue.vue2.js";
2
+ /* empty css */
3
+ import e from "../../../../../_virtual/_plugin-vue2_normalizer.js";
4
+ var n = function() {
5
+ var s = this, t = s._self._c, i = s._self._setupProxy;
6
+ return t("div", { staticClass: "d-f a-i-b l-h-2 mt-2" }, [t("div", { staticClass: "t-c-3 w-s-n-w" }, [s._v(" " + s._s(i.trans(s.title)) + " ")]), t("div", { staticClass: "spaced-dot-sep f-g-1 h-1-s mx-2 w-7-s" }), t("div", { staticClass: "d-f a-i-c" }, [t("div", [s._v(s._s(i.displayValues))]), i.showMore ? t("div", { staticClass: "d-f a-i-c" }, [t("div", { staticClass: "mx-1" }, [s._v(" ... ")]), t(i.InTooltipV2, { attrs: { id: `strategy-detail-show-more-${s.index}`, "static-position": "top right", "dynamic-position": !1, text: i.hiddenDisplayValues, "with-icon": !1 }, scopedSlots: s._u([{ key: "triggerElement", fn: function() {
7
+ return [t("span", { staticClass: "f-w-600" }, [s._v("+" + s._s(i.hiddenValues.length))])];
8
+ }, proxy: !0 }], null, !1, 3725664940) })], 1) : s._e(), s.icon ? t("div", { staticClass: "ml-2" }, [t(i.InTooltipV2, { staticClass: "d-f a-i-c", attrs: { id: `strategy-detail-icon-action-${s.index}`, "static-position": "top right", "dynamic-position": !1, "icon-status": !1, status: !s.disabled, text: i.trans(i.iconTooltipText) }, scopedSlots: s._u([{ key: "triggerElement", fn: function() {
9
+ return [t(i.InIcons, { staticClass: "d-f a-i-c", class: { "i-c-7": !s.disabled, "i-c-2": s.disabled }, attrs: { size: "24", name: s.icon }, on: { click: i.clickOnIcon } })];
10
+ }, proxy: !0 }], null, !1, 4084358903) })], 1) : s._e()])]);
11
+ }, o = [], l = /* @__PURE__ */ e(
12
+ a,
13
+ n,
14
+ o,
15
+ !1,
16
+ null,
17
+ "6e572ff5"
18
+ );
19
+ const p = l.exports;
20
+ export {
21
+ p as default
22
+ };
@@ -0,0 +1,29 @@
1
+ import { defineComponent as _, computed as o, ref as v } from "vue";
2
+ import { useTranslations as I } from "../../../../../composables/useTranslations.js";
3
+ import { InTooltipV2 as V, InIcons as k } from "@useinsider/design-system-vue";
4
+ const h = /* @__PURE__ */ _({
5
+ __name: "InfoDisplayValue",
6
+ props: {
7
+ index: null,
8
+ title: null,
9
+ value: null,
10
+ translateValue: { type: Boolean, default: !1 },
11
+ icon: { default: "" },
12
+ iconTooltip: { default: "" },
13
+ iconTooltipAfterClicked: { default: "" },
14
+ disabled: { type: Boolean, default: !1 }
15
+ },
16
+ emits: ["iconClick"],
17
+ setup(d, { emit: c }) {
18
+ const e = d, l = 3, u = 2e3, r = I(), t = o(() => String(e.value ?? "").split(",").map((n) => n.trim())), i = (n) => e.translateValue ? r(n) : n, f = o(() => t.value.length > l), m = o(() => t.value.slice(0, l).map(i).join(", ")), p = o(() => t.value.slice(l).map(i)), T = o(() => p.value.join(", ")), a = v(e.iconTooltip);
19
+ let s;
20
+ return { __sfc: !0, MAX_INLINE_VALUES: l, TOOLTIP_REVERT_DELAY_MS: u, trans: r, props: e, emit: c, values: t, render: i, showMore: f, displayValues: m, hiddenValues: p, hiddenDisplayValues: T, iconTooltipText: a, revertTimer: s, clickOnIcon: () => {
21
+ e.iconTooltipAfterClicked && (a.value = e.iconTooltipAfterClicked, clearTimeout(s), s = setTimeout(() => {
22
+ a.value = e.iconTooltip;
23
+ }, u)), c("iconClick");
24
+ }, InIcons: k, InTooltipV2: V };
25
+ }
26
+ });
27
+ export {
28
+ h as default
29
+ };
@@ -10,9 +10,9 @@ var n = function() {
10
10
  r,
11
11
  !1,
12
12
  null,
13
- "10599c37"
13
+ "195ab6d4"
14
14
  );
15
- const d = a.exports;
15
+ const c = a.exports;
16
16
  export {
17
- d as default
17
+ c as default
18
18
  };
@@ -10,7 +10,7 @@ var n = function() {
10
10
  r,
11
11
  !1,
12
12
  null,
13
- "38eb0a73"
13
+ "d405ca59"
14
14
  );
15
15
  const d = a.exports;
16
16
  export {
@@ -1,17 +1,42 @@
1
- const o = ["click", "auxclick", "submit"], c = (t) => {
2
- t.preventDefault(), t.stopPropagation();
3
- }, a = () => ({ blockPreviewInteractions: (r) => {
1
+ import { URLS as o, MERGE_TAGS as a } from "../enums/unsubscribe.js";
2
+ import { UNSUBSCRIBE_LINK_SELECTOR as i } from "../extensions/Blocks/Unsubscribe/utils/constants.js";
3
+ import { BASE_SAFE_URL_SCHEMES as u } from "../utils/urlSchemes.js";
4
+ const E = ["click", "auxclick"], d = [
5
+ ...Object.values(a),
6
+ o.UNSUBSCRIBE_URL,
7
+ o.PREFERENCES_URL
8
+ ], l = (e) => {
9
+ if (e.matches(i))
10
+ return !0;
11
+ const r = e.getAttribute("href") ?? "";
12
+ return d.some((t) => r.includes(t));
13
+ }, S = [...u, "tel:", "sms:"], f = (e) => {
14
+ const r = (e.getAttribute("href") ?? "").trim();
15
+ return r === "" || r.startsWith("#") || r.startsWith("{{") ? !1 : S.includes(e.protocol);
16
+ }, m = (e) => {
17
+ var t, n;
18
+ const r = (n = (t = e.target) == null ? void 0 : t.closest) == null ? void 0 : n.call(t, "a");
19
+ if (r) {
20
+ if (l(r) || !f(r)) {
21
+ e.preventDefault(), e.stopPropagation();
22
+ return;
23
+ }
24
+ r.setAttribute("target", "_blank"), r.setAttribute("rel", "noopener noreferrer");
25
+ }
26
+ }, R = (e) => {
27
+ e.preventDefault(), e.stopPropagation();
28
+ }, s = /* @__PURE__ */ new WeakSet(), c = "guidoPreviewGuarded", g = () => ({ guardPreviewInteractions: (r) => {
4
29
  try {
5
- const e = r.contentDocument;
6
- if (!e)
30
+ const t = r.contentDocument;
31
+ if (!t || s.has(t))
7
32
  return;
8
- o.forEach((n) => {
9
- e.addEventListener(n, c, !0);
10
- });
11
- } catch (e) {
12
- console.warn("[usePreviewInteractionGuard] Could not guard preview iframe:", e);
33
+ delete t.documentElement.dataset[c], E.forEach((n) => {
34
+ t.addEventListener(n, m, !0);
35
+ }), t.addEventListener("submit", R, !0), s.add(t), t.documentElement.dataset[c] = "true";
36
+ } catch (t) {
37
+ console.warn("[usePreviewInteractionGuard] Could not guard preview iframe:", t);
13
38
  }
14
39
  } });
15
40
  export {
16
- a as usePreviewInteractionGuard
41
+ g as usePreviewInteractionGuard
17
42
  };
@@ -1,22 +1,21 @@
1
- import { getRecommendationFeedSourceMaps as I, URLS as R } from "../enums/extensions/recommendationBlock.js";
2
- import { MinDeviceViewport as C, DefaultPadding as b } from "../enums/recommendation.js";
3
- import { useRecommendationExtensionStore as l } from "../extensions/Blocks/Recommendation/store/recommendation.js";
4
- import { generateCompleteFilterQuery as h } from "../extensions/Blocks/Recommendation/utils/filterUtil.js";
5
- import { getPartnerRecommendationParams as y } from "../extensions/Blocks/Recommendation/utils/partnerCustomizations.js";
6
- import { useConfigStore as x } from "../stores/config.js";
7
- const k = () => ({
8
- calculateCardWidth: ({
1
+ import { getRecommendationFeedSourceMaps as E, URLS as S } from "../enums/extensions/recommendationBlock.js";
2
+ import { MinDeviceViewport as A, DefaultPadding as U } from "../enums/recommendation.js";
3
+ import { useRecommendationExtensionStore as g } from "../extensions/Blocks/Recommendation/store/recommendation.js";
4
+ import { generateCompleteFilterQuery as _ } from "../extensions/Blocks/Recommendation/utils/filterUtil.js";
5
+ import { getPartnerRecommendationParams as b } from "../extensions/Blocks/Recommendation/utils/partnerCustomizations.js";
6
+ import { useConfigStore as D } from "../stores/config.js";
7
+ const M = () => {
8
+ const f = ({
9
9
  mobileLeftPadding: a,
10
- mobileRightPadding: s,
11
- cardsInRow: c,
12
- unresponsive: o
10
+ mobileRightPadding: c,
11
+ cardsInRow: s,
12
+ unresponsive: r
13
13
  }) => {
14
- const r = o ? c : 1, e = a + s + (r - 1) * b;
15
- return (C - e) / r;
16
- },
17
- getRecommendationCampaignData: (a) => {
18
- const s = l(), c = Number(a), o = s.blockStates[c];
19
- if (!o)
14
+ const n = r ? s : 1, e = a + c + (n - 1) * U;
15
+ return (A - e) / n;
16
+ }, I = (a) => {
17
+ const c = g(), s = Number(a), r = c.blockStates[s];
18
+ if (!r)
20
19
  return {
21
20
  textTrimming: !1,
22
21
  orientation: "vertical",
@@ -29,49 +28,81 @@ const k = () => ({
29
28
  discountBeforeTextValue: "",
30
29
  discountAfterTextValue: ""
31
30
  };
32
- const { recommendationConfigs: r } = o, e = r.orientation === "grid" ? "vertical" : "horizontal";
31
+ const { recommendationConfigs: n } = r, e = n.orientation === "grid" ? "vertical" : "horizontal";
33
32
  return {
34
- textTrimming: r.textTrimming,
33
+ textTrimming: n.textTrimming,
35
34
  orientation: e,
36
35
  mobileLeftPadding: 0,
37
36
  mobileRightPadding: 0,
38
- cardsInRow: r.cardsInRow,
39
- unresponsive: r.unresponsive,
37
+ cardsInRow: n.cardsInRow,
38
+ unresponsive: n.unresponsive,
40
39
  priceBeforeTextValue: "",
41
40
  priceAfterTextValue: "",
42
41
  discountBeforeTextValue: "",
43
42
  discountAfterTextValue: ""
44
43
  };
45
- },
46
- buildCampaignUrl: (a, s) => {
47
- var m;
48
- const c = l(), o = x(), r = Number(a);
49
- let e;
50
- if (s)
51
- e = s;
52
- else {
53
- const i = c.blockStates[r];
54
- if (!i)
55
- return "";
56
- const { recommendationConfigs: n } = i;
57
- e = {
58
- strategy: n.strategy,
59
- language: n.language,
60
- currencyCode: n.currencySettings.value,
61
- size: n.size,
62
- productIds: n.productIds,
63
- filters: n.filters,
64
- shuffleProducts: n.shuffleProducts
65
- };
44
+ }, p = {
45
+ LOCALE: "{locale}",
46
+ CURRENCY: "{currency}",
47
+ CAMPAIGN_ID: "{campaignId}",
48
+ STRATEGY_ID: "{strategyId}",
49
+ CLIENT_ID: "{clientId}",
50
+ USER_ID: "{userId}",
51
+ ITEM_ID: "{itemId}"
52
+ }, y = (a, c) => Object.entries(p).reduce(
53
+ (s, [r, n]) => s.replaceAll(
54
+ n,
55
+ c[r]
56
+ ),
57
+ a
58
+ );
59
+ return {
60
+ calculateCardWidth: f,
61
+ getRecommendationCampaignData: I,
62
+ buildCampaignUrl: (a, c) => {
63
+ var m;
64
+ const s = g(), r = D(), n = Number(a);
65
+ let e;
66
+ if (c)
67
+ e = c;
68
+ else {
69
+ const o = s.blockStates[n];
70
+ if (!o)
71
+ return "";
72
+ const { recommendationConfigs: i } = o;
73
+ e = {
74
+ strategy: i.strategy,
75
+ strategyId: i.strategyId,
76
+ language: i.language,
77
+ currencyCode: i.currencySettings.value,
78
+ size: i.size,
79
+ productIds: i.productIds,
80
+ filters: i.filters,
81
+ shuffleProducts: i.shuffleProducts
82
+ };
83
+ }
84
+ const d = e.strategyId ? s.strategyUrlTemplates[e.strategyId] : "";
85
+ if (d) {
86
+ const o = y(d, {
87
+ LOCALE: e.language,
88
+ CURRENCY: e.currencyCode,
89
+ CAMPAIGN_ID: r.variationId,
90
+ STRATEGY_ID: e.strategyId,
91
+ CLIENT_ID: "6KcLM9TwheVB1mgK",
92
+ USER_ID: "{user_id}",
93
+ ITEM_ID: "{itemId}"
94
+ });
95
+ return s.recommendationCampaignUrls[a] = o, o;
96
+ }
97
+ const C = ((m = E().find((o) => o.key === e.strategy)) == null ? void 0 : m.path) || "", t = new URLSearchParams();
98
+ t.set("locale", e.language), t.set("currency", e.currencyCode), t.set("partnerName", r.partnerName), t.set("size", e.size), t.set("details", "true"), t.set("campaignId", r.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}");
99
+ const R = e.filters.filter((o) => o.isValid), l = _(R);
100
+ l && t.set("filter", l), e.shuffleProducts && t.set("shuffle", "true"), Object.entries(b(r.partnerName, e.strategy)).forEach(([o, i]) => t.set(o, i));
101
+ const T = decodeURIComponent(t.toString()), u = `${S.RECOMMENDATION_API_URL}/v2/${C}?${T}`;
102
+ return s.recommendationCampaignUrls[a] = u, u;
66
103
  }
67
- const f = ((m = I().find((i) => i.key === e.strategy)) == null ? void 0 : m.path) || "", t = new URLSearchParams();
68
- t.set("locale", e.language), t.set("currency", e.currencyCode), 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}");
69
- const g = e.filters.filter((i) => i.isValid), d = h(g);
70
- d && t.set("filter", d), e.shuffleProducts && t.set("shuffle", "true"), Object.entries(y(o.partnerName, e.strategy)).forEach(([i, n]) => t.set(i, n));
71
- const p = decodeURIComponent(t.toString()), u = `${R.RECOMMENDATION_API_URL}/v2/${f}?${p}`;
72
- return c.recommendationCampaignUrls[a] = u, u;
73
- }
74
- });
104
+ };
105
+ };
75
106
  export {
76
- k as useRecommendation
107
+ M as useRecommendation
77
108
  };
@@ -1,111 +1,112 @@
1
- import { BLOCK_ROOT_SELECTOR as S, CURRENCY_ATTR as p, CONTAINER_SELECTOR as O } from "../extensions/Blocks/Recommendation/constants/selectors.js";
2
- import { useRecommendationExtensionStore as h } from "../extensions/Blocks/Recommendation/store/recommendation.js";
3
- import { formatPrice as E } from "../extensions/Blocks/Recommendation/utils/priceFormatter.js";
4
- const f = `${S}[recommendation-id]`, C = ".product-old-price", R = /\{\{(?:reco_)?(\d+_\d+_[a-zA-Z0-9_.]+)\}\}/g, T = new RegExp(
1
+ import { BLOCK_ROOT_SELECTOR as f, CURRENCY_ATTR as A, CONTAINER_SELECTOR as O } from "../extensions/Blocks/Recommendation/constants/selectors.js";
2
+ import { useRecommendationExtensionStore as C } from "../extensions/Blocks/Recommendation/store/recommendation.js";
3
+ import { formatPrice as _ } from "../extensions/Blocks/Recommendation/utils/priceFormatter.js";
4
+ import { BASE_SAFE_URL_SCHEMES as R } from "../utils/urlSchemes.js";
5
+ const S = `${f}[recommendation-id]`, h = ".product-old-price", T = /\{\{(?:reco_)?(\d+_\d+_[a-zA-Z0-9_.]+)\}\}/g, b = new RegExp(
5
6
  "\\{%\\s*if\\s+([\\s\\S]+?)\\s*%\\}([\\s\\S]*?)(?:\\{%\\s*else\\s*%\\}([\\s\\S]*?))?\\{%\\s*endif\\s*%\\}",
6
7
  "g"
7
8
  );
8
- function b(e) {
9
+ function L(e) {
9
10
  return e.replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;").replaceAll('"', "&quot;").replaceAll("'", "&#39;");
10
11
  }
11
- function _(e) {
12
- var s;
13
- const n = (s = e.replace(/[\u0000-\u0020]+/g, "").toLowerCase().match(/^([a-z][a-z0-9+.-]*):/)) == null ? void 0 : s[1];
14
- return n && n !== "http" && n !== "https" && n !== "mailto" ? "" : e;
12
+ function g(e) {
13
+ var c;
14
+ const i = (c = e.replace(/[\u0000-\u0020]+/g, "").toLowerCase().match(/^([a-z][a-z0-9+.-]*):/)) == null ? void 0 : c[1];
15
+ return i && !R.includes(`${i}:`) ? "" : e;
15
16
  }
16
17
  function N(e) {
17
- const t = e.getAttribute(p.CURRENCY) || "USD", n = e.getAttribute(p.DECIMAL_SEPARATOR) || ".", s = e.getAttribute(p.THOUSAND_SEPARATOR) || ",";
18
+ const t = e.getAttribute(A.CURRENCY) || "USD", i = e.getAttribute(A.DECIMAL_SEPARATOR) || ".", c = e.getAttribute(A.THOUSAND_SEPARATOR) || ",";
18
19
  return {
19
20
  code: t,
20
- symbol: e.getAttribute(p.SYMBOL) || t,
21
- alignment: e.getAttribute(p.ALIGNMENT) === "0" ? "before" : "after",
22
- decimalCount: parseInt(e.getAttribute(p.DECIMAL_COUNT) || "2") || 2,
23
- decimalSeparator: n,
24
- thousandSeparator: s
21
+ symbol: e.getAttribute(A.SYMBOL) || t,
22
+ alignment: e.getAttribute(A.ALIGNMENT) === "0" ? "before" : "after",
23
+ decimalCount: parseInt(e.getAttribute(A.DECIMAL_COUNT) || "2") || 2,
24
+ decimalSeparator: i,
25
+ thousandSeparator: c
25
26
  };
26
27
  }
27
- function g(e, t) {
28
+ function E(e, t) {
28
29
  return (e == null ? void 0 : e[t]) ?? Object.values(e ?? {})[0] ?? 0;
29
30
  }
30
- function L(e, t) {
31
- const n = g(e.original_price, t), s = g(e.price, t), o = n > 0 ? Math.round((n - s) / n * 100) : 0;
32
- return o > 0 ? `${o}%` : "0%";
31
+ function $(e, t) {
32
+ const i = E(e.original_price, t), c = E(e.price, t), n = i > 0 ? Math.round((i - c) / i * 100) : 0;
33
+ return n > 0 ? `${n}%` : "0%";
33
34
  }
34
- function P(e, t, n, s, o, a) {
35
- s.forEach((i, c) => {
36
- const r = (m) => `${n}_${c}_${m}`, u = E({ price: g(i.price, o.code), currency: o }), l = E({ price: g(i.original_price, o.code), currency: o }), d = L(i, o.code);
37
- e.set(r("name"), i.name ?? ""), e.set(r("image_url"), _(i.image_url ?? "")), e.set(r("url"), _(i.url ?? "")), e.set(r("item_id"), i.item_id ?? ""), e.set(r("currency"), ""), e.set(r("price"), u), e.set(r("original_price"), l), e.set(r("discount"), d), e.set(r("omnibus_price"), l), e.set(r("omnibus_discount"), d), a && u === l && t.add(`${n}_${c}`), Object.entries(i.product_attributes ?? {}).forEach(([m, A]) => {
38
- e.set(r(`product_attribute.${m}`), String(A)), e.set(r(m), String(A));
35
+ function P(e, t, i, c, n, a) {
36
+ c.forEach((o, s) => {
37
+ const r = (m) => `${i}_${s}_${m}`, u = _({ price: E(o.price, n.code), currency: n }), l = _({ price: E(o.original_price, n.code), currency: n }), d = $(o, n.code);
38
+ e.set(r("name"), o.name ?? ""), e.set(r("image_url"), g(o.image_url ?? "")), e.set(r("url"), g(o.url ?? "")), e.set(r("item_id"), o.item_id ?? ""), e.set(r("currency"), ""), e.set(r("price"), u), e.set(r("original_price"), l), e.set(r("discount"), d), e.set(r("omnibus_price"), l), e.set(r("omnibus_discount"), d), a && u === l && t.add(`${i}_${s}`), Object.entries(o.product_attributes ?? {}).forEach(([m, p]) => {
39
+ e.set(r(`product_attribute.${m}`), String(p)), e.set(r(m), String(p));
39
40
  });
40
41
  });
41
42
  }
42
- function $(e, t) {
43
- const n = e.match(/^(.+?)\s*(!=|==)\s*"([^"]*)"$/);
44
- if (!n)
43
+ function z(e, t) {
44
+ const i = e.match(/^(.+?)\s*(!=|==)\s*"([^"]*)"$/);
45
+ if (!i)
45
46
  return !0;
46
- const [, s, o, a] = n, i = t.get(s.trim()) ?? "";
47
- return o === "!=" ? i !== a : i === a;
47
+ const [, c, n, a] = i, o = t.get(c.trim()) ?? "";
48
+ return n === "!=" ? o !== a : o === a;
48
49
  }
49
- function z(e, t) {
50
+ function w(e, t) {
50
51
  return e.replace(
51
- T,
52
- (n, s, o, a) => s.split(/\s+and\s+/).every((c) => $(c.trim(), t)) ? o : a ?? ""
52
+ b,
53
+ (i, c, n, a) => c.split(/\s+and\s+/).every((s) => z(s.trim(), t)) ? n : a ?? ""
53
54
  );
54
55
  }
55
- function w(e) {
56
+ function D(e) {
56
57
  let t = e;
57
58
  for (; t.children.length === 1; )
58
59
  [t] = t.children;
59
60
  return t;
60
61
  }
61
- function D(e, t) {
62
- var i;
62
+ function I(e, t) {
63
+ var o;
63
64
  if (!t.size)
64
65
  return e;
65
- const n = e.replaceAll("{%", "<!--{%").replaceAll("%}", "%}-->"), s = new DOMParser().parseFromString(n, "text/html");
66
- s.querySelectorAll(f).forEach((c) => {
67
- const r = Number(c.getAttribute("recommendation-id"));
66
+ const i = e.replaceAll("{%", "<!--{%").replaceAll("%}", "%}-->"), c = new DOMParser().parseFromString(i, "text/html");
67
+ c.querySelectorAll(S).forEach((s) => {
68
+ const r = Number(s.getAttribute("recommendation-id"));
68
69
  if (!Number.isFinite(r))
69
70
  return;
70
- const u = c.querySelectorAll(O);
71
- (u.length ? Array.from(u) : [c]).forEach((d) => {
72
- d.querySelectorAll(C).forEach((m, A) => {
73
- t.has(`${r}_${A}`) && (w(m).textContent = "");
71
+ const u = s.querySelectorAll(O);
72
+ (u.length ? Array.from(u) : [s]).forEach((d) => {
73
+ d.querySelectorAll(h).forEach((m, p) => {
74
+ t.has(`${r}_${p}`) && (D(m).textContent = "");
74
75
  });
75
76
  });
76
77
  });
77
- const o = (i = e.match(/<!DOCTYPE[^>]*>/i)) == null ? void 0 : i[0];
78
- return ((o ? `${o}
79
- ` : "") + s.documentElement.outerHTML).replaceAll("<!--{%", "{%").replaceAll("%}-->", "%}").replaceAll("&lt;!--{%", "{%").replaceAll("%}--&gt;", "%}");
78
+ const n = (o = e.match(/<!DOCTYPE[^>]*>/i)) == null ? void 0 : o[0];
79
+ return ((n ? `${n}
80
+ ` : "") + c.documentElement.outerHTML).replaceAll("<!--{%", "{%").replaceAll("%}-->", "%}").replaceAll("&lt;!--{%", "{%").replaceAll("%}--&gt;", "%}");
80
81
  }
81
- function I(e) {
82
+ function y(e) {
82
83
  if (!e || !e.includes("recommendation-block-v2"))
83
84
  return e;
84
- const t = h(), n = new DOMParser().parseFromString(e, "text/html"), s = Array.from(n.querySelectorAll(f)), o = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Set();
85
- if (s.forEach((c) => {
85
+ const t = C(), i = new DOMParser().parseFromString(e, "text/html"), c = Array.from(i.querySelectorAll(S)), n = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Set();
86
+ if (c.forEach((s) => {
86
87
  var l;
87
- const r = Number(c.getAttribute("recommendation-id"));
88
+ const r = Number(s.getAttribute("recommendation-id"));
88
89
  if (!Number.isFinite(r))
89
90
  return;
90
91
  const u = ((l = t.blockStates[r]) == null ? void 0 : l.recommendationProducts) ?? [];
91
92
  u.length && P(
92
- o,
93
+ n,
93
94
  a,
94
95
  r,
95
96
  u,
96
- N(c),
97
- c.getAttribute("hide-price") === "true"
97
+ N(s),
98
+ s.getAttribute("hide-price") === "true"
98
99
  );
99
- }), !o.size)
100
+ }), !n.size)
100
101
  return e;
101
- let i = D(e, a);
102
- return i = i.replace(
103
- R,
104
- (c, r) => o.has(r) ? b(o.get(r)) : c
105
- ), i = z(i, o), i;
102
+ let o = I(e, a);
103
+ return o = o.replace(
104
+ T,
105
+ (s, r) => n.has(r) ? L(n.get(r)) : s
106
+ ), o = w(o, n), o;
106
107
  }
107
- const q = () => ({ substituteRecommendationPreview: I });
108
+ const q = () => ({ substituteRecommendationPreview: y });
108
109
  export {
109
- I as substituteRecommendationPreview,
110
+ y as substituteRecommendationPreview,
110
111
  q as useRecommendationPreview
111
112
  };
@@ -0,0 +1,16 @@
1
+ import { parseJsonField as i } from "../utils/genericUtil.js";
2
+ import { ref as n, computed as e } from "vue";
3
+ const r = 2;
4
+ function m(u) {
5
+ const l = n(r), t = n(!0), s = e(
6
+ () => i(u(), {})
7
+ ), o = e(() => Object.keys(s.value).length), c = e(() => o.value > 0), a = e(() => o.value > r);
8
+ return { filterQuery: e(() => Object.fromEntries(
9
+ Object.entries(s.value).slice(0, l.value)
10
+ )), hasAnyFilter: c, canToggle: a, isCollapsed: t, toggleMore: () => {
11
+ t.value = !t.value, l.value = t.value ? r : o.value;
12
+ } };
13
+ }
14
+ export {
15
+ m as useStrategyFilters
16
+ };
@@ -1,6 +1,6 @@
1
1
  import { BlockId as f } from "../../enums/block.js";
2
- import { useTemplateStore as b } from "../../stores/template.js";
3
- import { mapComposition as y } from "./recommendation/compositionMapper.js";
2
+ import { useTemplateStore as y } from "../../stores/template.js";
3
+ import { mapComposition as b } from "./recommendation/compositionMapper.js";
4
4
  import { extractCurrencyFromBlock as v, extractTitleText as C, extractCardBgColor as M, isPartnerManagedBlock as S } from "./recommendation/extractors.js";
5
5
  import { buildBlockHtml as w } from "./recommendation/htmlBuilder.js";
6
6
  import { parseRecommendationId as x, parseLegacyConfig as R } from "./recommendation/parseLegacyConfig.js";
@@ -20,8 +20,11 @@ function B(i, t, a) {
20
20
  ), !1;
21
21
  const n = a[String(o)] ?? {
22
22
  currencySettings: v(t)
23
- }, c = T(n, r, o), e = y((d = r.composition) == null ? void 0 : d.variables), l = C(t), g = M(t), p = {
23
+ }, c = T(n, r, o), e = b((d = r.composition) == null ? void 0 : d.variables), l = C(t), g = M(t), p = {
24
24
  ...c,
25
+ // Legacy blocks predate RRS and carry no strategy reference. Migrated
26
+ // blocks keep running on their algorithm until a strategy is assigned.
27
+ strategyId: "",
25
28
  composition: e.composition,
26
29
  visibility: e.visibility,
27
30
  textTrimming: e.anyTextTrimming
@@ -56,7 +59,7 @@ function B(i, t, a) {
56
59
  function q(i, t = {}) {
57
60
  const a = new DOMParser(), o = a.parseFromString(i, "text/html"), r = Array.from(o.querySelectorAll(h));
58
61
  try {
59
- b().$patch((e) => {
62
+ y().$patch((e) => {
60
63
  e.migrations = {
61
64
  ...e.migrations,
62
65
  [f.Recommendation]: r.length
@@ -1,5 +1,6 @@
1
- const t = "tr-TR", L = "default";
1
+ const t = "tr-TR", T = "default", L = "UTC";
2
2
  export {
3
- L as DEFAULT,
4
- t as DEFAULT_LOCALE
3
+ T as DEFAULT,
4
+ t as DEFAULT_LOCALE,
5
+ L as DEFAULT_TZ
5
6
  };