@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,10 +1,9 @@
1
1
  import { BlockType as t } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
2
- import { CSS_CLASS_CHECKBOX_BLOCK as l, CSS_CLASS_CHECKBOX_BLOCK_V2 as a } from "./constants/selectors.js";
3
2
  const e = {
4
3
  TITLE: "Unsubscribe From All Email Lists",
5
4
  DESCRIPTION: "You will still receive important transactional and billing-related emails."
6
- }, i = `
7
- <td align="left" class="${l} ${a} esd-block-checkbox es-p20">
5
+ }, l = `
6
+ <td align="left" class="checkbox-block checkbox-block-v2 esd-block-checkbox es-p20">
8
7
  <table cellpadding="0" cellspacing="0" role="presentation" width="100%">
9
8
  <tbody>
10
9
  <tr>
@@ -27,13 +26,13 @@ const e = {
27
26
  </tbody>
28
27
  </table>
29
28
  </td>
30
- `, d = `
29
+ `, o = `
31
30
  <td
32
31
  align="left"
33
32
  esd-extension-block-id="checkbox-block"
34
33
  class="
35
- ${l}
36
- ${a}
34
+ checkbox-block
35
+ checkbox-block-v2
37
36
  esd-block-checkbox
38
37
  esd-checkbox-block
39
38
  esd-extension-block es-p20"
@@ -61,10 +60,10 @@ const e = {
61
60
  </table>
62
61
  </td>
63
62
  `;
64
- function n() {
65
- return i.replace("{-{-TITLE-}-}", `<p path="1">${e.TITLE}</p>`).replace("{-{-DESCRIPTION-}-}", `<p path="1">${e.DESCRIPTION}</p>`);
63
+ function a() {
64
+ return l.replace("{-{-TITLE-}-}", `<p path="1">${e.TITLE}</p>`).replace("{-{-DESCRIPTION-}-}", `<p path="1">${e.DESCRIPTION}</p>`);
66
65
  }
67
66
  export {
68
- d as default,
69
- n as getDefaultTemplate
67
+ o as default,
68
+ a as getDefaultTemplate
70
69
  };
@@ -1,10 +1,9 @@
1
1
  import { ExtensionBuilder as o } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
2
2
  import { RadioButtonCustomBlock as t } from "./block.js";
3
3
  import { RadioButtonControl as i } from "./control.js";
4
- import { RadioButtonBlockBackgroundControl as n } from "./controls/blockBackground/index.js";
5
- import { RadioButtonIconsRegistry as r } from "./iconsRegistry.js";
6
- import { RadioButtonBlockSettingsPanel as d } from "./settingsPanel.js";
7
- const u = new o().addBlock(t).withSettingsPanelRegistry(d).addControl(i).addControl(n).withIconsRegistry(r).build();
4
+ import { RadioButtonIconsRegistry as n } from "./iconsRegistry.js";
5
+ import { RadioButtonBlockSettingsPanel as r } from "./settingsPanel.js";
6
+ const l = new o().addBlock(t).withSettingsPanelRegistry(r).addControl(i).withIconsRegistry(n).build();
8
7
  export {
9
- u as default
8
+ l as default
10
9
  };
@@ -1,27 +1,26 @@
1
- import { SettingsPanelRegistry as r, SettingsPanelTab as t, SettingsTab as o, ContainerControls as n } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
2
- import { BLOCK_ID as i } from "./block.js";
3
- import { RadioButtonControlId as s } from "./constants/controlIds.js";
4
- import { CONTROL_BLOCK_ID as S } from "./control.js";
5
- class B extends r {
6
- registerBlockControls(e) {
7
- e[i] = [
1
+ import { SettingsPanelRegistry as r, SettingsPanelTab as t, SettingsTab as o, ContainerControls as e, TextControls as s } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
2
+ import { BLOCK_ID as T } from "./block.js";
3
+ import { CONTROL_BLOCK_ID as i } from "./control.js";
4
+ class a extends r {
5
+ registerBlockControls(n) {
6
+ n[T] = [
8
7
  new t(
9
8
  o.SETTINGS,
10
9
  [
11
- S,
12
- n.EXTERNAL_INDENTS,
13
- n.DISPLAY_CONDITIONS
10
+ i,
11
+ e.EXTERNAL_INDENTS,
12
+ e.DISPLAY_CONDITIONS
14
13
  ]
15
14
  ),
16
15
  new t(
17
16
  o.STYLES,
18
17
  [
19
- s.BLOCK_BACKGROUND
18
+ s.TEXT_BLOCK_BACKGROUND_COLOR
20
19
  ]
21
20
  )
22
21
  ];
23
22
  }
24
23
  }
25
24
  export {
26
- B as RadioButtonBlockSettingsPanel
25
+ a as RadioButtonBlockSettingsPanel
27
26
  };
@@ -1,18 +1,11 @@
1
1
  import { BlockType as t } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
2
- import { CSS_CLASS_RADIO_BUTTON_BLOCK as d, CSS_CLASS_RADIO_BUTTON_BLOCK_V2 as i } from "./constants/selectors.js";
3
2
  const e = {
4
3
  TITLE: "This is a title text",
5
4
  DESCRIPTION: "This is a description text",
6
5
  YES: "Yes",
7
6
  NO: "No"
8
- }, l = `
9
- <td
10
- align="left"
11
- class="
12
- ${d}
13
- ${i}
14
- esd-block-radio es-p10t es-p10b es-p30r es-p30l"
15
- >
7
+ }, d = `
8
+ <td align="left" class="radio-button-block radio-button-v2 esd-block-radio es-p10t es-p10b es-p30r es-p30l">
16
9
  <table cellpadding="0" cellspacing="0" role="presentation" width="100%">
17
10
  <tbody>
18
11
  <tr>
@@ -82,14 +75,14 @@ const e = {
82
75
  </tbody>
83
76
  </table>
84
77
  </td>
85
- `, n = `
78
+ `, l = `
86
79
  <td
87
80
  align="left"
88
81
  esd-extension-block-id="radio-button-block"
89
82
  esd-handler-name="esd-extension-RadioButtonBlock"
90
83
  class="
91
- ${d}
92
- ${i}
84
+ radio-button-block
85
+ radio-button-v2
93
86
  esd-block-ra
94
87
  esd-radio-button-block
95
88
  esd-extension-block
@@ -156,10 +149,10 @@ const e = {
156
149
  </table>
157
150
  </td>
158
151
  `;
159
- function p() {
160
- return l.replace("{-{-TITLE-}-}", `<p path="1">${e.TITLE}</p>`).replace("{-{-DESCRIPTION-}-}", `<p path="1">${e.DESCRIPTION}</p>`).replace("{-{-YES-}-}", `<p path="1">${e.YES}</p>`).replace("{-{-NO-}-}", `<p path="1">${e.NO}</p>`);
152
+ function a() {
153
+ return d.replace("{-{-TITLE-}-}", `<p path="1">${e.TITLE}</p>`).replace("{-{-DESCRIPTION-}-}", `<p path="1">${e.DESCRIPTION}</p>`).replace("{-{-YES-}-}", `<p path="1">${e.YES}</p>`).replace("{-{-NO-}-}", `<p path="1">${e.NO}</p>`);
161
154
  }
162
155
  export {
163
- n as default,
164
- p as getDefaultTemplate
156
+ l as default,
157
+ a as getDefaultTemplate
165
158
  };
@@ -1,23 +1,23 @@
1
- var c = Object.defineProperty;
2
- var l = (s, o, t) => o in s ? c(s, o, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[o] = t;
3
- var a = (s, o, t) => l(s, typeof o != "symbol" ? o + "" : o, t);
4
- import { UEAttr as h } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
5
- import { CommonControl as d } from "../../../common-control.js";
1
+ var d = Object.defineProperty;
2
+ var h = (r, o, t) => o in r ? d(r, o, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[o] = t;
3
+ var c = (r, o, t) => h(r, typeof o != "symbol" ? o + "" : o, t);
4
+ import { UEAttr as l } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
5
+ import { CommonControl as g } 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
- import { mapLegacyStrategy as g } from "../../utils/legacyStrategyMap.js";
9
- const u = "recommendation-algorithm-control", i = {
8
+ import { mapLegacyStrategy as u } from "../../utils/legacyStrategyMap.js";
9
+ const p = "recommendation-algorithm-control", e = {
10
10
  ALGORITHM: "strategy",
11
11
  PRODUCT_IDS: "productIds"
12
12
  };
13
- class R extends d {
13
+ class S extends g {
14
14
  constructor() {
15
15
  super(...arguments);
16
16
  // Store is used ONLY for API-fetched data (algorithms list), not for config
17
- a(this, "store", m());
17
+ c(this, "store", m());
18
18
  }
19
19
  getId() {
20
- return u;
20
+ return p;
21
21
  }
22
22
  getTemplate() {
23
23
  return `
@@ -25,13 +25,13 @@ class R extends d {
25
25
  ${this._GuTwoColumns([
26
26
  this._GuLabel({ text: this.api.translate("Recommendation Algorithm") }),
27
27
  this._GuSelect({
28
- name: i.ALGORITHM,
28
+ name: e.ALGORITHM,
29
29
  placeholder: this.api.translate("Select Recommendation Algorithm"),
30
30
  options: this.store.getActivePredictiveAlgorithms
31
31
  }),
32
- this._GuLabel({ text: this.api.translate("Product Ids"), name: `${i.PRODUCT_IDS}_label` }),
32
+ this._GuLabel({ text: this.api.translate("Product Ids"), name: `${e.PRODUCT_IDS}_label` }),
33
33
  this._GuTextInput({
34
- name: i.PRODUCT_IDS,
34
+ name: e.PRODUCT_IDS,
35
35
  placeholder: this.api.translate("Enter Product Ids"),
36
36
  className: "es-180w"
37
37
  })
@@ -46,29 +46,28 @@ class R extends d {
46
46
  super.onTemplateNodeUpdated(t), this._initializeSelectItems(), this._setFormValues();
47
47
  }
48
48
  _setFormValues() {
49
- const t = n.getConfig(this.currentNode), e = g(t.strategy) ?? t.strategy;
50
- this._setProductIdsVisibility(e), this.api.updateValues({
51
- [i.ALGORITHM]: e,
52
- [i.PRODUCT_IDS]: t.productIds.join(",")
53
- });
49
+ const t = n.getConfig(this.currentNode), s = u(t.strategy) ?? t.strategy;
50
+ this._setProductIdsVisibility(s);
51
+ const i = { [e.ALGORITHM]: s }, a = t.productIds.join(",");
52
+ this.api.getValues()[e.PRODUCT_IDS] !== a && (i[e.PRODUCT_IDS] = a), this.api.updateValues(i);
54
53
  }
55
54
  _initializeSelectItems() {
56
- var e;
57
- const t = (e = this.store) == null ? void 0 : e.getActivePredictiveAlgorithms;
55
+ var s;
56
+ const t = (s = this.store) == null ? void 0 : s.getActivePredictiveAlgorithms;
58
57
  if (t != null && t.length)
59
58
  try {
60
59
  this.api.setUIEAttribute(
61
- i.ALGORITHM,
62
- h.SELECTPICKER.items,
60
+ e.ALGORITHM,
61
+ l.SELECTPICKER.items,
63
62
  t
64
63
  );
65
- } catch (r) {
66
- console.warn("[AlgorithmControl] Failed to set algorithm options:", r);
64
+ } catch (i) {
65
+ console.warn("[AlgorithmControl] Failed to set algorithm options:", i);
67
66
  }
68
67
  }
69
68
  _setProductIdsVisibility(t) {
70
- const r = (t ?? n.getConfig(this.currentNode).strategy) === "manualMerchandising";
71
- this.api.setVisibility(i.PRODUCT_IDS, r), this.api.setVisibility(`${i.PRODUCT_IDS}_label`, r);
69
+ const i = (t ?? n.getConfig(this.currentNode).strategy) === "manualMerchandising";
70
+ this.api.setVisibility(e.PRODUCT_IDS, i), this.api.setVisibility(`${e.PRODUCT_IDS}_label`, i);
72
71
  }
73
72
  _onAlgorithmChange(t) {
74
73
  !this.currentNode || n.getConfig(this.currentNode).strategy === t || (n.updateConfig(
@@ -79,25 +78,25 @@ class R extends d {
79
78
  ), this.store.patchCurrentBlockConfig({ strategy: t }), this._setProductIdsVisibility(t));
80
79
  }
81
80
  _onProductIdsChange(t) {
82
- if (!this.currentNode)
81
+ if (!this.currentNode || n.getConfig(this.currentNode).productIds.join(",") === t)
83
82
  return;
84
- const e = t.split(",").map((r) => r.trim()).filter(Boolean);
83
+ const i = t.split(",");
85
84
  n.updateConfig(
86
85
  this.api,
87
86
  this.currentNode,
88
- { productIds: e },
87
+ { productIds: i },
89
88
  "Updated product IDs"
90
- ), this.store.patchCurrentBlockConfig({ productIds: e });
89
+ ), this.store.patchCurrentBlockConfig({ productIds: i });
91
90
  }
92
91
  _listenToFormUpdates() {
93
- this.api.onValueChanged(i.ALGORITHM, (t) => {
92
+ this.api.onValueChanged(e.ALGORITHM, (t) => {
94
93
  this._onAlgorithmChange(t);
95
- }), this.api.onValueChanged(i.PRODUCT_IDS, (t) => {
94
+ }), this.api.onValueChanged(e.PRODUCT_IDS, (t) => {
96
95
  this._onProductIdsChange(t);
97
96
  });
98
97
  }
99
98
  }
100
99
  export {
101
- u as ALGORITHM_CONTROL_ID,
102
- R as AlgorithmControl
100
+ p as ALGORITHM_CONTROL_ID,
101
+ S as AlgorithmControl
103
102
  };
@@ -1,15 +1,16 @@
1
1
  import { getRecommendationFeedSourceMaps as g, getOperatorOptions as R, PriceAttributes as C } from "../../../../enums/extensions/recommendationBlock.js";
2
2
  import { useRecommendationApi as y } from "../../../../services/recommendationApi.js";
3
3
  import { useConfigStore as G } from "../../../../stores/config.js";
4
- import { defineStore as F } from "pinia";
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 F, DEFAULT_CARDS_IN_ROW as D } 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
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";
11
+ import { sanitizeProductIds as N } from "../utils/productIds.js";
12
+ import { isFilterValid as x } from "../validation/filterSchema.js";
13
+ import { isConfigValid as L } from "../validation/requiredFields.js";
13
14
  const h = y();
14
15
  let m = null, u = null, d = null;
15
16
  function k() {
@@ -28,7 +29,7 @@ function k() {
28
29
  productIds: [],
29
30
  id: 1,
30
31
  language: "en_US",
31
- mobileCardsInRow: P,
32
+ mobileCardsInRow: F,
32
33
  mobileLayoutEnabled: !1,
33
34
  orientation: "grid",
34
35
  recommendedProducts: [],
@@ -54,7 +55,7 @@ function I() {
54
55
  filterSnapshot: null
55
56
  };
56
57
  }
57
- const L = () => ({
58
+ const U = () => ({
58
59
  recommendationCampaignUrls: {},
59
60
  activePredictiveAlgorithms: [],
60
61
  languages: {},
@@ -63,8 +64,8 @@ const L = () => ({
63
64
  blockStates: {},
64
65
  currentRecommendationId: null,
65
66
  configVersion: 0
66
- }), $ = F("guidoRecommendationExtension", {
67
- state: () => L(),
67
+ }), H = P("guidoRecommendationExtension", {
68
+ state: () => U(),
68
69
  getters: {
69
70
  // ====================================================================
70
71
  // Proxy Getters — Backward Compatible Access to Current Block State
@@ -383,7 +384,7 @@ const L = () => ({
383
384
  const n = [...e.recommendationConfigs.filters];
384
385
  n[r] = {
385
386
  ...t,
386
- isValid: N(t)
387
+ isValid: x(t)
387
388
  }, e.recommendationConfigs.filters = n;
388
389
  }
389
390
  },
@@ -429,7 +430,7 @@ const L = () => ({
429
430
  * every block's recommendationConfigs across user edits.
430
431
  */
431
432
  hasInvalidBlock() {
432
- return Object.values(this.blockStates).some((t) => !x(t.recommendationConfigs, this));
433
+ return Object.values(this.blockStates).some((t) => !L(t.recommendationConfigs, this));
433
434
  },
434
435
  // ====================================================================
435
436
  // Per-Block Product Fetching
@@ -458,7 +459,7 @@ const L = () => ({
458
459
  details: !0,
459
460
  campaignId: o.variationId
460
461
  };
461
- 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
+ r.strategy === "manualMerchandising" ? a.productId = N(r.productIds) : 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
463
  a,
463
464
  v(o.partnerName, r.strategy)
464
465
  );
@@ -479,5 +480,5 @@ const L = () => ({
479
480
  }
480
481
  });
481
482
  export {
482
- $ as useRecommendationExtensionStore
483
+ H as useRecommendationExtensionStore
483
484
  };
@@ -0,0 +1,6 @@
1
+ function n(t) {
2
+ return t.map((i) => i.trim()).filter(Boolean).join(",");
3
+ }
4
+ export {
5
+ n as sanitizeProductIds
6
+ };