@useinsider/guido 3.14.0-beta.a865e56 → 3.14.0-beta.a90f01a

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 (34) hide show
  1. package/dist/composables/useHtmlValidator.js +89 -91
  2. package/dist/composables/useRecommendation.js +20 -19
  3. package/dist/config/migrator/checkboxMigrator.js +19 -20
  4. package/dist/config/migrator/radioButtonMigrator.js +25 -26
  5. package/dist/extensions/Blocks/Checkbox/extension.js +5 -6
  6. package/dist/extensions/Blocks/Checkbox/settingsPanel.js +14 -15
  7. package/dist/extensions/Blocks/Checkbox/template.js +9 -10
  8. package/dist/extensions/Blocks/RadioButton/extension.js +4 -5
  9. package/dist/extensions/Blocks/RadioButton/settingsPanel.js +11 -12
  10. package/dist/extensions/Blocks/RadioButton/template.js +9 -16
  11. package/dist/extensions/Blocks/Recommendation/controls/main/algorithm.js +33 -34
  12. package/dist/extensions/Blocks/Recommendation/store/recommendation.js +13 -12
  13. package/dist/extensions/Blocks/Recommendation/utils/productIds.js +6 -0
  14. package/dist/extensions/Blocks/controlFactories.js +115 -117
  15. package/dist/src/extensions/Blocks/Recommendation/utils/productIds.d.ts +6 -0
  16. package/package.json +1 -1
  17. package/dist/extensions/Blocks/Checkbox/constants/controlIds.js +0 -4
  18. package/dist/extensions/Blocks/Checkbox/constants/selectors.js +0 -6
  19. package/dist/extensions/Blocks/Checkbox/controls/blockBackground/index.js +0 -10
  20. package/dist/extensions/Blocks/RadioButton/constants/controlIds.js +0 -4
  21. package/dist/extensions/Blocks/RadioButton/constants/selectors.js +0 -6
  22. package/dist/extensions/Blocks/RadioButton/controls/blockBackground/index.js +0 -10
  23. package/dist/src/extensions/Blocks/Checkbox/constants/controlIds.d.ts +0 -7
  24. package/dist/src/extensions/Blocks/Checkbox/constants/index.d.ts +0 -10
  25. package/dist/src/extensions/Blocks/Checkbox/constants/selectors.d.ts +0 -16
  26. package/dist/src/extensions/Blocks/Checkbox/controls/blockBackground/index.d.ts +0 -14
  27. package/dist/src/extensions/Blocks/RadioButton/constants/controlIds.d.ts +0 -7
  28. package/dist/src/extensions/Blocks/RadioButton/constants/index.d.ts +0 -10
  29. package/dist/src/extensions/Blocks/RadioButton/constants/selectors.d.ts +0 -16
  30. package/dist/src/extensions/Blocks/RadioButton/controls/blockBackground/index.d.ts +0 -14
  31. package/dist/src/extensions/Blocks/_Boilerplate/constants/controlIds.d.ts +0 -7
  32. package/dist/src/extensions/Blocks/_Boilerplate/constants/index.d.ts +0 -10
  33. package/dist/src/extensions/Blocks/_Boilerplate/constants/selectors.d.ts +0 -16
  34. package/dist/src/extensions/Blocks/_Boilerplate/controls/blockBackground/index.d.ts +0 -14
@@ -1,66 +1,64 @@
1
1
  import { useConfig as W } from "./useConfig.js";
2
2
  import { getIgnoredRecommendationBlockIds as G } from "../config/compiler/utils/recommendationIgnoreUtils.js";
3
3
  import { TemplateTypes as H } from "../enums/defaults.js";
4
- import { DISPLAY_CONDITIONS_REGEX as P, DISPLAY_CONDITIONS_EXCEPTIONS_REGEX as X, CampaignCouldNotBeSavedKey as $, CanNotMakeAnyChangesForRunningKey as K, DATA_ATTRIBUTE_REGEX as Y, DYNAMIC_CONTENT_TAG_REGEX as U, ALLOWED_DYNAMIC_SYSTEM_TOKENS as j, VALID_DYNAMIC_VARIABLE_REGEX as q } from "../enums/html-validator.js";
4
+ import { DISPLAY_CONDITIONS_REGEX as P, DISPLAY_CONDITIONS_EXCEPTIONS_REGEX as X, CampaignCouldNotBeSavedKey as $, CanNotMakeAnyChangesForRunningKey as Y, DATA_ATTRIBUTE_REGEX as U, DYNAMIC_CONTENT_TAG_REGEX as j, ALLOWED_DYNAMIC_SYSTEM_TOKENS as q, VALID_DYNAMIC_VARIABLE_REGEX as K } from "../enums/html-validator.js";
5
5
  import { ToasterTypeOptions as c } from "../enums/toaster.js";
6
- import { BLOCK_ROOT_SELECTOR as z } from "../extensions/Blocks/Checkbox/constants/selectors.js";
7
- import { itemsBlockDynamicVariables as Z } from "../extensions/Blocks/Items/enums/productEnums.js";
8
- import { BLOCK_ROOT_SELECTOR as J } from "../extensions/Blocks/RadioButton/constants/selectors.js";
9
- import { RECOMMENDATION_VARIABLE_BUILTIN_ATTRIBUTES as Q } from "../extensions/Blocks/Recommendation/constants/selectors.js";
10
- import { useRecommendationExtensionStore as ee } from "../extensions/Blocks/Recommendation/store/recommendation.js";
11
- import { resolveProductAttrValue as te } from "../extensions/Blocks/Recommendation/templates/utils.js";
12
- import { RecommendationRequiredFieldsKey as ne } from "../extensions/Blocks/Recommendation/validation/requiredFields.js";
13
- import { useRecommendationStore as se } from "../stores/recommendation.js";
14
- import { base64EncodeWithSpecialChars as re } from "../utils/base64.js";
15
- import { useHttp as oe } from "./useHttp.js";
16
- import { useToaster as ie } from "./useToaster.js";
17
- import { useTranslations as ae } from "./useTranslations.js";
18
- const ce = /recommendation-id="(\d+)"/g;
19
- function me(t) {
20
- return [...t.matchAll(ce)].map((l) => l[1]);
6
+ import { itemsBlockDynamicVariables as z } from "../extensions/Blocks/Items/enums/productEnums.js";
7
+ import { RECOMMENDATION_VARIABLE_BUILTIN_ATTRIBUTES as Z } from "../extensions/Blocks/Recommendation/constants/selectors.js";
8
+ import { useRecommendationExtensionStore as J } from "../extensions/Blocks/Recommendation/store/recommendation.js";
9
+ import { resolveProductAttrValue as Q } from "../extensions/Blocks/Recommendation/templates/utils.js";
10
+ import { RecommendationRequiredFieldsKey as ee } from "../extensions/Blocks/Recommendation/validation/requiredFields.js";
11
+ import { useRecommendationStore as te } from "../stores/recommendation.js";
12
+ import { base64EncodeWithSpecialChars as ne } from "../utils/base64.js";
13
+ import { useHttp as se } from "./useHttp.js";
14
+ import { useToaster as re } from "./useToaster.js";
15
+ import { useTranslations as oe } from "./useTranslations.js";
16
+ const ie = /recommendation-id="(\d+)"/g;
17
+ function ae(t) {
18
+ return [...t.matchAll(ie)].map((m) => m[1]);
21
19
  }
22
- function le(t, l) {
23
- return l.some((f) => t.startsWith(`${f}_`));
20
+ function ce(t, m) {
21
+ return m.some((f) => t.startsWith(`${f}_`));
24
22
  }
25
- const ue = /^(\d+)_\d+_(.+)$/;
26
- function de(t) {
27
- const l = t.match(ue);
28
- return l ? { recoId: l[1], attribute: l[2] } : null;
23
+ const le = /^(\d+)_\d+_(.+)$/;
24
+ function me(t) {
25
+ const m = t.match(le);
26
+ return m ? { recoId: m[1], attribute: m[2] } : null;
29
27
  }
30
- function fe(t) {
31
- const l = new Set(Q);
28
+ function ue(t) {
29
+ const m = new Set(Z);
32
30
  return Object.values(t).forEach((f) => {
33
- l.add(te(f.attributeName, t).toLowerCase());
34
- }), l;
31
+ m.add(Q(f.attributeName, t).toLowerCase());
32
+ }), m;
35
33
  }
36
- function pe(t, l, f, o, d) {
34
+ function de(t, m, f, o, d) {
37
35
  const u = t.match(/{{([a-zA-Z0-9_.\s]*)}}/gm);
38
36
  if (!u)
39
37
  return [];
40
- const g = new Set(l.map((C) => C.toLowerCase())), E = [];
41
- return u.forEach((C) => {
42
- const p = C.slice(2, -2).trim().toLowerCase();
43
- if (p !== "" && g.has(p))
38
+ const p = new Set(m.map((h) => h.toLowerCase())), E = [];
39
+ return u.forEach((h) => {
40
+ const g = h.slice(2, -2).trim().toLowerCase();
41
+ if (g !== "" && p.has(g))
44
42
  return;
45
- const h = de(p);
46
- if (h && o.has(h.recoId)) {
47
- if (!d || d.has(h.attribute))
43
+ const y = me(g);
44
+ if (y && o.has(y.recoId)) {
45
+ if (!d || d.has(y.attribute))
48
46
  return;
49
- E.push(p);
47
+ E.push(g);
50
48
  return;
51
49
  }
52
- le(p, f) || p.includes(".") || E.push(p);
50
+ ce(g, f) || g.includes(".") || E.push(g);
53
51
  }), E;
54
52
  }
55
- function ge(t) {
56
- return (t.replace(Y, "$1").match(U) ?? []).filter((o) => {
57
- const d = o.slice(2, -2), u = d.indexOf("|"), g = (u === -1 ? d : d.slice(0, u)).trim();
58
- return j.includes(g) ? !1 : q.test(g) ? u !== -1 && d.slice(u + 1).trim() === "" : !0;
53
+ function fe(t) {
54
+ return (t.replace(U, "$1").match(j) ?? []).filter((o) => {
55
+ const d = o.slice(2, -2), u = d.indexOf("|"), p = (u === -1 ? d : d.slice(0, u)).trim();
56
+ return q.includes(p) ? !1 : K.test(p) ? u !== -1 && d.slice(u + 1).trim() === "" : !0;
59
57
  });
60
58
  }
61
- const De = () => {
62
- var S, T;
63
- const { showToaster: t } = ie(), { post: l } = oe(), { config: f } = W(), o = ae(), d = se(), u = ee(), g = ((T = (S = f.value) == null ? void 0 : S.partner) == null ? void 0 : T.messageType) === H.transactional, E = async (e) => {
59
+ const xe = () => {
60
+ var b, S;
61
+ const { showToaster: t } = re(), { post: m } = se(), { config: f } = W(), o = oe(), d = te(), u = J(), p = ((S = (b = f.value) == null ? void 0 : b.partner) == null ? void 0 : S.messageType) === H.transactional, E = async (e) => {
64
62
  if (e.size === 0)
65
63
  return /* @__PURE__ */ new Set();
66
64
  try {
@@ -68,39 +66,39 @@ const De = () => {
68
66
  } catch {
69
67
  return null;
70
68
  }
71
- return fe(u.filterList);
72
- }, C = async (e) => {
73
- const n = await l(
69
+ return ue(u.filterList);
70
+ }, h = async (e) => {
71
+ const n = await m(
74
72
  "/newsletter/template-library/check-template-html-body",
75
- { html: re(e) }
73
+ { html: ne(e) }
76
74
  ), { status: r, message: a } = n.data;
77
75
  return r || t({
78
76
  type: c.Error,
79
77
  message: r === void 0 ? a : o("newsletter.invalid-url-link-for-toaster")
80
- }), o($), a === o(K) && t({
78
+ }), o($), a === o(Y) && t({
81
79
  type: c.Error,
82
80
  message: o("newsletter.already-in-progress")
83
81
  }), r;
84
- }, p = (e) => !["if", "endif", "else", "elif", "now"].includes(e.toLowerCase()), h = (e) => ["if", "endif"].includes(e.toLowerCase()), R = (e, s) => {
82
+ }, g = (e) => !["if", "endif", "else", "elif", "now"].includes(e.toLowerCase()), y = (e) => ["if", "endif"].includes(e.toLowerCase()), T = (e, s) => {
85
83
  const n = e.match(/({%(.*?)%})/g);
86
84
  let r = !0;
87
- return n !== null && !g && n.forEach((a) => {
85
+ return n !== null && !p && n.forEach((a) => {
88
86
  const i = a.slice(2, -2).trim().match(/(".*?"|[^"\s]+)(?=\s*|\s*$)/g);
89
87
  if (i && i.length > 0) {
90
- const [m] = i;
91
- p(m) && !s.includes(m) && (t({
88
+ const [l] = i;
89
+ g(l) && !s.includes(l) && (t({
92
90
  type: c.Warning,
93
91
  message: o("custom-fields.invalid-custom-fields")
94
92
  }), r = !1);
95
93
  }
96
94
  }), r;
97
- }, A = async (e, s, n) => {
98
- const r = n ? await C(e) : !0;
99
- return R(e, s) && r;
100
- }, _ = (e) => e.length > 0 ? !0 : (t({
95
+ }, w = async (e, s, n) => {
96
+ const r = n ? await h(e) : !0;
97
+ return T(e, s) && r;
98
+ }, R = (e) => e.length > 0 ? !0 : (t({
101
99
  type: c.Warning,
102
100
  message: o("newsletter.html-content-is-empty")
103
- }), !1), O = (e) => {
101
+ }), !1), _ = (e) => {
104
102
  const s = (e.match(/{/gm) || []).length, n = (e.match(/}/gm) || []).length;
105
103
  return s > n && t({
106
104
  type: c.Warning,
@@ -109,26 +107,26 @@ const De = () => {
109
107
  type: c.Warning,
110
108
  message: o("custom-fields.missing-opening-braces")
111
109
  }), s === n;
112
- }, w = (e) => {
113
- const s = ge(e).length === 0;
110
+ }, N = (e) => {
111
+ const s = fe(e).length === 0;
114
112
  return s || t({
115
113
  type: c.Warning,
116
114
  message: o("custom-fields.invalid-custom-fields")
117
115
  }), s;
118
- }, N = (e, s, n, r) => {
119
- if (g)
116
+ }, x = (e, s, n, r) => {
117
+ if (p)
120
118
  return !0;
121
- const a = pe(
119
+ const a = de(
122
120
  e,
123
121
  s,
124
- me(e),
122
+ ae(e),
125
123
  n,
126
124
  r
127
125
  );
128
126
  if (a.length > 0) {
129
127
  const i = `
130
128
  <ul>
131
- ${a.map((m) => `<li>${m}</li>`).join("")}
129
+ ${a.map((l) => `<li>${l}</li>`).join("")}
132
130
  </ul>
133
131
  `;
134
132
  return t({
@@ -137,85 +135,85 @@ const De = () => {
137
135
  }), !1;
138
136
  }
139
137
  return !0;
140
- }, L = (e) => {
138
+ }, O = (e) => {
141
139
  const s = e.match(/{%(.*?)%}/g), n = [];
142
140
  let r = !0;
143
141
  if (s && s.forEach((a) => {
144
- const i = a.match(P), m = a.match(X), v = (i == null ? void 0 : i.join("")) || "";
145
- (!i || a !== v) && !m && (t({
142
+ const i = a.match(P), l = a.match(X), v = (i == null ? void 0 : i.join("")) || "";
143
+ (!i || a !== v) && !l && (t({
146
144
  type: c.Error,
147
145
  message: o("newsletter.display-conditions-invalid-syntax")
148
- }), r = !1), i && i.forEach((y) => {
149
- y.trim() === "=" && (t({
146
+ }), r = !1), i && i.forEach((C) => {
147
+ C.trim() === "=" && (t({
150
148
  type: c.Error,
151
149
  message: o("custom-conditions.wrong-equality-operators")
152
150
  }), r = !1);
153
- const I = y.match(/^[a-zA-Z]*$/g);
154
- I && I.forEach((b) => {
155
- h(b) && n.push(b);
151
+ const I = C.match(/^[a-zA-Z]*$/g);
152
+ I && I.forEach((A) => {
153
+ y(A) && n.push(A);
156
154
  });
157
155
  });
158
156
  }), n.length) {
159
- const a = n.filter((m) => m === "if"), i = n.filter((m) => m === "endif");
157
+ const a = n.filter((l) => l === "if"), i = n.filter((l) => l === "endif");
160
158
  a.length !== i.length && (t({
161
159
  type: c.Error,
162
160
  message: o("custom-conditions.missing-if-endif-tag")
163
161
  }), r = !1);
164
162
  }
165
163
  return r;
166
- }, B = (e) => {
164
+ }, k = (e) => {
167
165
  const s = (e.match(/{% /gm) || []).length, n = (e.match(/ %}/gm) || []).length, r = s === n;
168
166
  return r || t({
169
167
  type: c.Warning,
170
168
  message: o("custom-conditions.no-space-after-braces")
171
169
  }), r;
172
- }, x = (e) => (e.match(/({%(.*?)%})/g) || []).filter((n) => n.includes("if")).map((n) => (n.match(/{{.*}}/gm) || []).length).reduce((n, r) => n + r, 0) > 0 ? (t({
170
+ }, B = (e) => (e.match(/({%(.*?)%})/g) || []).filter((n) => n.includes("if")).map((n) => (n.match(/{{.*}}/gm) || []).length).reduce((n, r) => n + r, 0) > 0 ? (t({
173
171
  type: c.Warning,
174
172
  message: o("custom-conditions.no-braces-inside-if-tag")
175
173
  }), !1) : !0, D = () => u.hasInvalidBlock() ? (t({
176
174
  type: c.Error,
177
- message: o(ne)
175
+ message: o(ee)
178
176
  }), !1) : !0, F = () => d.recommendationConfigs && Object.values(d.recommendationConfigs).find((s) => s.filters.find((n) => n.value === "")) !== void 0 ? (t({
179
177
  type: c.Error,
180
178
  message: o("newsletter.fill-all-necessary-fields")
181
- }), !1) : !0, k = (e) => {
179
+ }), !1) : !0, L = (e) => {
182
180
  const s = /src="[^"]*\.(svg|pst)"/gm;
183
181
  return e.match(s) === null ? !0 : (t({
184
182
  type: c.Error,
185
183
  message: o("newsletter.invalid-image-type")
186
184
  }), !1);
187
185
  }, V = (e) => {
188
- const r = new DOMParser().parseFromString(e, "text/html").querySelectorAll(z);
186
+ const r = new DOMParser().parseFromString(e, "text/html").querySelectorAll(".checkbox-block-v2");
189
187
  return Array.from(r).find((i) => {
190
- var m;
191
- return !((m = i.id) != null && m.trim());
188
+ var l;
189
+ return !((l = i.id) != null && l.trim());
192
190
  }) ? (t({
193
191
  type: c.Error,
194
192
  message: o("unsubscribe-templates.select-checkbox-groups")
195
193
  }), !1) : !0;
196
194
  }, M = (e) => {
197
- const r = new DOMParser().parseFromString(e, "text/html").querySelectorAll(J);
195
+ const r = new DOMParser().parseFromString(e, "text/html").querySelectorAll(".radio-button-v2");
198
196
  return Array.from(r).find((i) => {
199
- var m;
200
- return !((m = i.id) != null && m.trim());
197
+ var l;
198
+ return !((l = i.id) != null && l.trim());
201
199
  }) ? (t({
202
200
  type: c.Error,
203
201
  message: o("unsubscribe-templates.select-radio-button-groups")
204
202
  }), !1) : !0;
205
203
  };
206
204
  return { validateHtml: async (e, s, n = !1) => {
207
- var v, y;
205
+ var v, C;
208
206
  const r = [
209
207
  ...s.map((I) => I.value),
210
- ...Z,
211
- ...((y = (v = f.value) == null ? void 0 : v.template) == null ? void 0 : y.customFieldAttributes) ?? []
208
+ ...z,
209
+ ...((C = (v = f.value) == null ? void 0 : v.template) == null ? void 0 : C.customFieldAttributes) ?? []
212
210
  ], a = G(e), i = await E(a);
213
- return await A(e, r, n) && _(e) && O(e) && w(e) && N(e, r, a, i) && L(e) && B(e) && x(e) && D() && F() && k(e) && V(e) && M(e);
211
+ return await w(e, r, n) && R(e) && _(e) && N(e) && x(e, r, a, i) && O(e) && k(e) && B(e) && D() && F() && L(e) && V(e) && M(e);
214
212
  } };
215
213
  };
216
214
  export {
217
- fe as buildPartnerAttributeNameSet,
218
- pe as findInvalidCustomFields,
219
- de as parseRecommendationVariable,
220
- De as useHtmlValidator
215
+ ue as buildPartnerAttributeNameSet,
216
+ de as findInvalidCustomFields,
217
+ me as parseRecommendationVariable,
218
+ xe as useHtmlValidator
221
219
  };
@@ -3,20 +3,21 @@ import { MinDeviceViewport as C, DefaultPadding as b } from "../enums/recommenda
3
3
  import { useRecommendationExtensionStore as l } from "../extensions/Blocks/Recommendation/store/recommendation.js";
4
4
  import { generateCompleteFilterQuery as h } from "../extensions/Blocks/Recommendation/utils/filterUtil.js";
5
5
  import { getPartnerRecommendationParams as y } from "../extensions/Blocks/Recommendation/utils/partnerCustomizations.js";
6
- import { useConfigStore as x } from "../stores/config.js";
7
- const k = () => ({
6
+ import { sanitizeProductIds as x } from "../extensions/Blocks/Recommendation/utils/productIds.js";
7
+ import { useConfigStore as P } from "../stores/config.js";
8
+ const B = () => ({
8
9
  calculateCardWidth: ({
9
10
  mobileLeftPadding: a,
10
11
  mobileRightPadding: s,
11
12
  cardsInRow: c,
12
- unresponsive: o
13
+ unresponsive: n
13
14
  }) => {
14
- const r = o ? c : 1, e = a + s + (r - 1) * b;
15
+ const r = n ? c : 1, e = a + s + (r - 1) * b;
15
16
  return (C - e) / r;
16
17
  },
17
18
  getRecommendationCampaignData: (a) => {
18
- const s = l(), c = Number(a), o = s.blockStates[c];
19
- if (!o)
19
+ const s = l(), c = Number(a), n = s.blockStates[c];
20
+ if (!n)
20
21
  return {
21
22
  textTrimming: !1,
22
23
  orientation: "vertical",
@@ -29,7 +30,7 @@ const k = () => ({
29
30
  discountBeforeTextValue: "",
30
31
  discountAfterTextValue: ""
31
32
  };
32
- const { recommendationConfigs: r } = o, e = r.orientation === "grid" ? "vertical" : "horizontal";
33
+ const { recommendationConfigs: r } = n, e = r.orientation === "grid" ? "vertical" : "horizontal";
33
34
  return {
34
35
  textTrimming: r.textTrimming,
35
36
  orientation: e,
@@ -45,7 +46,7 @@ const k = () => ({
45
46
  },
46
47
  buildCampaignUrl: (a, s) => {
47
48
  var m;
48
- const c = l(), o = x(), r = Number(a);
49
+ const c = l(), n = P(), r = Number(a);
49
50
  let e;
50
51
  if (s)
51
52
  e = s;
@@ -53,25 +54,25 @@ const k = () => ({
53
54
  const i = c.blockStates[r];
54
55
  if (!i)
55
56
  return "";
56
- const { recommendationConfigs: n } = i;
57
+ const { recommendationConfigs: o } = i;
57
58
  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
59
+ strategy: o.strategy,
60
+ language: o.language,
61
+ currencyCode: o.currencySettings.value,
62
+ size: o.size,
63
+ productIds: o.productIds,
64
+ filters: o.filters,
65
+ shuffleProducts: o.shuffleProducts
65
66
  };
66
67
  }
67
68
  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
+ t.set("locale", e.language), t.set("currency", e.currencyCode), t.set("partnerName", n.partnerName), t.set("size", e.size), t.set("details", "true"), t.set("campaignId", n.variationId), e.strategy === "manualMerchandising" ? t.set("productId", x(e.productIds)) : e.strategy === "similarViewed" && t.set("productId", "{itemId}"), e.strategy === "userBased" && t.set("userId", "{user_id}");
69
70
  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
+ d && t.set("filter", d), e.shuffleProducts && t.set("shuffle", "true"), Object.entries(y(n.partnerName, e.strategy)).forEach(([i, o]) => t.set(i, o));
71
72
  const p = decodeURIComponent(t.toString()), u = `${R.RECOMMENDATION_API_URL}/v2/${f}?${p}`;
72
73
  return c.recommendationCampaignUrls[a] = u, u;
73
74
  }
74
75
  });
75
76
  export {
76
- k as useRecommendation
77
+ B as useRecommendation
77
78
  };
@@ -1,37 +1,36 @@
1
- var g = Object.defineProperty;
2
- var x = (r, t, e) => t in r ? g(r, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : r[t] = e;
3
- var m = (r, t, e) => x(r, typeof t != "symbol" ? t + "" : t, e);
4
- import { CSS_CLASS_CHECKBOX_BLOCK as b, CSS_CLASS_CHECKBOX_BLOCK_V2 as T, BLOCK_ROOT_SELECTOR as f } from "../../extensions/Blocks/Checkbox/constants/selectors.js";
5
- import h from "../../extensions/Blocks/Checkbox/template.js";
6
- import { extractTextFromElement as p, buildTextBlock as C } from "./textBlockMigration.js";
7
- class O {
1
+ var h = Object.defineProperty;
2
+ var g = (r, t, e) => t in r ? h(r, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : r[t] = e;
3
+ var l = (r, t, e) => g(r, typeof t != "symbol" ? t + "" : t, e);
4
+ import f from "../../extensions/Blocks/Checkbox/template.js";
5
+ import { extractTextFromElement as m, buildTextBlock as p } from "./textBlockMigration.js";
6
+ class C {
8
7
  constructor() {
9
- m(this, "parser");
8
+ l(this, "parser");
10
9
  this.parser = new DOMParser();
11
10
  }
12
11
  migrate(t) {
13
12
  try {
14
- const e = this.parser.parseFromString(t, "text/html"), i = e.querySelectorAll(`td.${b}`);
15
- if (i.length === 0)
13
+ const e = this.parser.parseFromString(t, "text/html"), n = e.querySelectorAll("td.checkbox-block");
14
+ if (n.length === 0)
16
15
  return t;
17
- let s = !1;
18
- return i.forEach((o) => {
19
- if (o.classList.contains(T))
16
+ let i = !1;
17
+ return n.forEach((o) => {
18
+ if (o.classList.contains("checkbox-block-v2"))
20
19
  return;
21
- const l = o.getAttribute("id"), c = p(o, "ins-title"), a = p(o, "ins-description"), u = C(c, c.containerClass), S = C(a, a.containerClass), d = h.replace("{-{-TITLE-}-}", u).replace("{-{-DESCRIPTION-}-}", S), n = this.parser.parseFromString(
20
+ const b = o.getAttribute("id"), s = m(o, "ins-title"), a = m(o, "ins-description"), u = p(s, s.containerClass), x = p(a, a.containerClass), d = f.replace("{-{-TITLE-}-}", u).replace("{-{-DESCRIPTION-}-}", x), c = this.parser.parseFromString(
22
21
  `<table id="tempDoc"><tbody><tr>${d}</tr></tbody></table>`,
23
22
  "text/html"
24
- ).querySelector(f);
25
- n && o.parentNode && (n.setAttribute("id", l || ""), o.parentNode.replaceChild(n, o), s = !0);
26
- }), s ? e.documentElement.outerHTML : t;
23
+ ).querySelector(".checkbox-block-v2");
24
+ c && o.parentNode && (c.setAttribute("id", b || ""), o.parentNode.replaceChild(c, o), i = !0);
25
+ }), i ? e.documentElement.outerHTML : t;
27
26
  } catch (e) {
28
27
  return console.error("CheckboxMigrator failed:", e), t;
29
28
  }
30
29
  }
31
30
  }
32
- function D(r) {
33
- return new O().migrate(r);
31
+ function E(r) {
32
+ return new C().migrate(r);
34
33
  }
35
34
  export {
36
- D as migrateCheckbox
35
+ E as migrateCheckbox
37
36
  };
@@ -1,54 +1,53 @@
1
- var R = Object.defineProperty;
2
- var b = (n, t, e) => t in n ? R(n, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[t] = e;
3
- var g = (n, t, e) => b(n, typeof t != "symbol" ? t + "" : t, e);
4
- import { CSS_CLASS_RADIO_BUTTON_BLOCK as C, CSS_CLASS_RADIO_BUTTON_BLOCK_V2 as T, BLOCK_ROOT_SELECTOR as A } from "../../extensions/Blocks/RadioButton/constants/selectors.js";
1
+ var q = Object.defineProperty;
2
+ var C = (o, t, e) => t in o ? q(o, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : o[t] = e;
3
+ var g = (o, t, e) => C(o, typeof t != "symbol" ? t + "" : t, e);
5
4
  import N from "../../extensions/Blocks/RadioButton/template.js";
6
- import { extractTextFromElement as S, buildTextBlock as f } from "./textBlockMigration.js";
7
- class _ {
5
+ import { extractTextFromElement as b, buildTextBlock as f } from "./textBlockMigration.js";
6
+ class R {
8
7
  constructor() {
9
8
  g(this, "parser");
10
9
  this.parser = new DOMParser();
11
10
  }
12
11
  migrate(t) {
13
12
  try {
14
- const e = this.parser.parseFromString(t, "text/html"), o = e.querySelectorAll(`td.${C}`), a = e.querySelectorAll(`td.${T}`);
15
- if (o.length === 0 && a.length === 0)
13
+ const e = this.parser.parseFromString(t, "text/html"), n = e.querySelectorAll("td.radio-button-block"), a = e.querySelectorAll("td.radio-button-v2");
14
+ if (n.length === 0 && a.length === 0)
16
15
  return t;
17
- let s = !1;
18
- return o.forEach((r) => {
19
- if (r.classList.contains(T))
16
+ let i = !1;
17
+ return n.forEach((r) => {
18
+ if (r.classList.contains("radio-button-v2"))
20
19
  return;
21
- const i = r.getAttribute("id"), c = S(r, "ins-title"), p = S(r, "ins-description"), l = S(r, "ins-subscribe"), u = S(r, "ins-unsubscribe"), d = f(c, c.containerClass), m = f(p, p.containerClass), h = f(l), L = f(u), O = N.replace("{-{-TITLE-}-}", d).replace("{-{-DESCRIPTION-}-}", m).replace("{-{-YES-}-}", h).replace("{-{-NO-}-}", L), y = this.parser.parseFromString(
22
- `<table id="tempDoc"><tbody><tr>${O}</tr></tbody></table>`,
20
+ const s = r.getAttribute("id"), c = b(r, "ins-title"), d = b(r, "ins-description"), u = b(r, "ins-subscribe"), l = b(r, "ins-unsubscribe"), p = f(c, c.containerClass), m = f(d, d.containerClass), h = f(u), S = f(l), T = N.replace("{-{-TITLE-}-}", p).replace("{-{-DESCRIPTION-}-}", m).replace("{-{-YES-}-}", h).replace("{-{-NO-}-}", S), y = this.parser.parseFromString(
21
+ `<table id="tempDoc"><tbody><tr>${T}</tr></tbody></table>`,
23
22
  "text/html"
24
- ).querySelector(A);
25
- y && r.parentNode && (y.setAttribute("id", i || ""), r.parentNode.replaceChild(y, r), s = !0);
26
- }), s = this.healRadioButtonV2(e) || s, s ? e.documentElement.outerHTML : t;
23
+ ).querySelector(".radio-button-v2");
24
+ y && r.parentNode && (y.setAttribute("id", s || ""), r.parentNode.replaceChild(y, r), i = !0);
25
+ }), i = this.healRadioButtonV2(e) || i, i ? e.documentElement.outerHTML : t;
27
26
  } catch (e) {
28
27
  return console.error("RadioButtonMigrator failed:", e), t;
29
28
  }
30
29
  }
31
30
  healRadioButtonV2(t) {
32
31
  let e = !1;
33
- return t.querySelectorAll(`td.${T}`).forEach((o) => {
32
+ return t.querySelectorAll("td.radio-button-v2").forEach((n) => {
34
33
  var m;
35
- o.classList.contains(C) || (o.classList.add(C), e = !0);
36
- const a = o.querySelector("input#radioYes"), s = o.querySelector("input#radioNo");
37
- if (!a || !s)
34
+ n.classList.contains("radio-button-block") || (n.classList.add("radio-button-block"), e = !0);
35
+ const a = n.querySelector("input#radioYes"), i = n.querySelector("input#radioNo");
36
+ if (!a || !i)
38
37
  return;
39
38
  const r = ((m = a.parentElement) == null ? void 0 : m.querySelector(":scope > p")) || null;
40
39
  if (!r && !a.hasAttribute("align"))
41
40
  return;
42
- const i = a.closest("tr"), c = s.closest("tr");
43
- if (!i || !c || i === c || !i.parentNode)
41
+ const s = a.closest("tr"), c = i.closest("tr");
42
+ if (!s || !c || s === c || !s.parentNode)
44
43
  return;
45
- const p = (r == null ? void 0 : r.innerHTML.trim()) || "Yes", l = c.cloneNode(!0), u = l.querySelector("input#radioNo"), d = l.querySelector("p");
46
- u && (u.setAttribute("id", "radioYes"), u.removeAttribute("align")), d && (d.innerHTML = p), i.parentNode.replaceChild(l, i), e = !0;
44
+ const d = (r == null ? void 0 : r.innerHTML.trim()) || "Yes", u = c.cloneNode(!0), l = u.querySelector("input#radioNo"), p = u.querySelector("p");
45
+ l && (l.setAttribute("id", "radioYes"), l.removeAttribute("align")), p && (p.innerHTML = d), s.parentNode.replaceChild(u, s), e = !0;
47
46
  }), e;
48
47
  }
49
48
  }
50
- function w(n) {
51
- return new _().migrate(n);
49
+ function w(o) {
50
+ return new R().migrate(o);
52
51
  }
53
52
  export {
54
53
  w as migrateRadioButton
@@ -1,10 +1,9 @@
1
1
  import { ExtensionBuilder as o } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
2
2
  import { CheckboxBlock as t } from "./block.js";
3
- import { CheckboxControl as r } from "./control.js";
4
- import { CheckboxBlockBackgroundControl as e } from "./controls/blockBackground/index.js";
5
- import { CheckboxIconsRegistry as i } from "./iconsRegistry.js";
6
- import { CheckboxBlockSettings as n } from "./settingsPanel.js";
7
- const C = new o().addBlock(t).withSettingsPanelRegistry(n).addControl(r).addControl(e).withIconsRegistry(i).build();
3
+ import { CheckboxControl as e } from "./control.js";
4
+ import { CheckboxIconsRegistry as r } from "./iconsRegistry.js";
5
+ import { CheckboxBlockSettings as i } from "./settingsPanel.js";
6
+ const d = new o().addBlock(t).withSettingsPanelRegistry(i).addControl(e).withIconsRegistry(r).build();
8
7
  export {
9
- C as default
8
+ d as default
10
9
  };
@@ -1,26 +1,25 @@
1
- import { SettingsPanelRegistry as r, SettingsPanelTab as o, SettingsTab as t, ContainerControls as C } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
2
- import { CHECKBOX_BLOCK_ID as n } from "./block.js";
3
- import { CheckboxControlId as i } from "./constants/controlIds.js";
4
- import { CHECKBOX_CONTROL_BLOCK_ID as s } from "./control.js";
5
- class T extends r {
6
- registerBlockControls(e) {
7
- e[n] = [
8
- new o(
9
- t.SETTINGS,
1
+ import { SettingsPanelRegistry as C, SettingsPanelTab as t, SettingsTab as e, ContainerControls as n, TextControls as r } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
2
+ import { CHECKBOX_BLOCK_ID as s } from "./block.js";
3
+ import { CHECKBOX_CONTROL_BLOCK_ID as T } from "./control.js";
4
+ class l extends C {
5
+ registerBlockControls(o) {
6
+ o[s] = [
7
+ new t(
8
+ e.SETTINGS,
10
9
  [
11
- s,
12
- C.EXTERNAL_INDENTS
10
+ T,
11
+ n.EXTERNAL_INDENTS
13
12
  ]
14
13
  ),
15
- new o(
16
- t.STYLES,
14
+ new t(
15
+ e.STYLES,
17
16
  [
18
- i.BLOCK_BACKGROUND
17
+ r.TEXT_BLOCK_BACKGROUND_COLOR
19
18
  ]
20
19
  )
21
20
  ];
22
21
  }
23
22
  }
24
23
  export {
25
- T as CheckboxBlockSettings
24
+ l as CheckboxBlockSettings
26
25
  };