@useinsider/guido 3.18.2-beta.fc246a7 → 3.18.2-beta.fc87f65

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 (57) hide show
  1. package/dist/components/Guido.vue.js +3 -3
  2. package/dist/components/Guido.vue2.js +30 -30
  3. package/dist/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue.js +13 -11
  4. package/dist/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue2.js +76 -57
  5. package/dist/components/organisms/extensions/recommendation/RemoveStrategyModal.vue2.js +23 -37
  6. package/dist/components/organisms/onboarding/OnboardingWrapper.vue2.js +20 -18
  7. package/dist/components/organisms/onboarding/RecommendationStrategyOnboarding.vue.js +21 -0
  8. package/dist/components/organisms/onboarding/RecommendationStrategyOnboarding.vue2.js +47 -0
  9. package/dist/components/organisms/save-as-template/SaveAsTemplateDrawer.vue2.js +34 -34
  10. package/dist/composables/useCustomInterfaceAppearance.js +56 -46
  11. package/dist/composables/useHtmlValidator.js +87 -82
  12. package/dist/composables/useHttp.js +24 -22
  13. package/dist/composables/useRecommendation.js +40 -35
  14. package/dist/composables/useStripo.js +30 -30
  15. package/dist/config/migrator/itemsBlockMigrator.js +167 -257
  16. package/dist/enums/extensions/recommendationBlock.js +38 -31
  17. package/dist/extensions/Blocks/Items/controls/name/trimming.js +17 -18
  18. package/dist/extensions/Blocks/Items/controls/settingsControl.js +105 -114
  19. package/dist/extensions/Blocks/Items/enums/productEnums.js +9 -14
  20. package/dist/extensions/Blocks/Items/layouts/horizontal.html.js +9 -11
  21. package/dist/extensions/Blocks/Items/template.js +204 -219
  22. package/dist/extensions/Blocks/Recommendation/block.js +43 -39
  23. package/dist/extensions/Blocks/Recommendation/constants/defaultConfig.js +21 -20
  24. package/dist/extensions/Blocks/Recommendation/controls/main/index.js +40 -35
  25. package/dist/extensions/Blocks/Recommendation/controls/main/strategy.js +84 -52
  26. package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +74 -74
  27. package/dist/extensions/Blocks/Recommendation/store/recommendation.js +194 -91
  28. package/dist/extensions/Blocks/Recommendation/utils/nodeConfigWriter.js +26 -16
  29. package/dist/extensions/Blocks/Recommendation/utils/strategyCommit.js +24 -0
  30. package/dist/extensions/Blocks/Recommendation/validation/requiredFields.js +21 -12
  31. package/dist/guido.css +1 -1
  32. package/dist/services/templateLibraryApi.js +17 -14
  33. package/dist/src/components/organisms/onboarding/RecommendationStrategyOnboarding.vue.d.ts +2 -0
  34. package/dist/src/enums/extensions/recommendationBlock.d.ts +2 -0
  35. package/dist/src/extensions/Blocks/Items/enums/productEnums.d.ts +0 -3
  36. package/dist/src/extensions/Blocks/Items/template.d.ts +0 -19
  37. package/dist/src/extensions/Blocks/Recommendation/constants/defaultConfig.d.ts +1 -0
  38. package/dist/src/extensions/Blocks/Recommendation/constants/index.d.ts +1 -1
  39. package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +2 -0
  40. package/dist/src/extensions/Blocks/Recommendation/controls/main/strategy.d.ts +9 -0
  41. package/dist/src/extensions/Blocks/Recommendation/controls/main/utils.d.ts +7 -2
  42. package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +79 -0
  43. package/dist/src/extensions/Blocks/Recommendation/utils/strategyCommit.d.ts +14 -0
  44. package/dist/src/extensions/Blocks/Recommendation/validation/requiredFields.d.ts +4 -0
  45. package/dist/src/stores/onboarding.d.ts +377 -0
  46. package/dist/src/utils/genericUtil.d.ts +6 -0
  47. package/dist/src/utils/liquidDynamicContent.d.ts +20 -0
  48. package/dist/static/styles/components/recommendation-strategy.css.js +34 -4
  49. package/dist/static/styles/components/skeleton.css.js +23 -0
  50. package/dist/stores/onboarding.js +41 -36
  51. package/dist/utils/genericUtil.js +63 -54
  52. package/dist/utils/liquidDynamicContent.js +15 -0
  53. package/dist/utils/pairProductVariables.js +71 -71
  54. package/dist/utils/templatePreparation.js +61 -60
  55. package/package.json +5 -5
  56. package/dist/extensions/Blocks/Items/constants/cardLayout.js +0 -20
  57. package/dist/src/extensions/Blocks/Items/constants/cardLayout.d.ts +0 -44
@@ -1,14 +1,20 @@
1
- import { useTranslations as r } from "../../composables/useTranslations.js";
2
- const l = {
1
+ import { useTranslations as n } from "../../composables/useTranslations.js";
2
+ const o = {
3
3
  RECOMMENDATION_API_URL: "https://recommendationv2.api.useinsider.com",
4
4
  // Relative path → same-origin as the embedding inone dashboard.
5
5
  PRODUCT_ATTRIBUTES_PATH: "/product-attributes/get-attributes",
6
6
  RECOMMENDATION_STRATEGIES_PATH: "/api/recommendation-strategies",
7
- RECOMMENDATION_STRATEGIES_PANEL_PATH: "/discovery/recommendation-strategies"
8
- }, c = {
7
+ RECOMMENDATION_STRATEGIES_PANEL_PATH: "/discovery/recommendation-strategies",
8
+ // Smart Recommender hides the Email channel unless the URL asks for it, so a strategy created
9
+ // without this flag can never be Email-suitable and would never reach the editor's list.
10
+ RECOMMENDATION_STRATEGY_CREATE_PATH: "/discovery/recommendation-strategies/create?isEmail=true"
11
+ }, d = (e) => {
12
+ const { RECOMMENDATION_STRATEGIES_PANEL_PATH: r } = o;
13
+ return `${r}/${e}/edit?isEmail=true`;
14
+ }, m = {
9
15
  CLIENT_ID: "clientId"
10
- }, d = () => {
11
- const e = r();
16
+ }, p = () => {
17
+ const e = n();
12
18
  return [
13
19
  {
14
20
  id: 11,
@@ -71,14 +77,14 @@ const l = {
71
77
  path: "top-sellers"
72
78
  }
73
79
  ];
74
- }, m = ["discount", "omnibus_price", "omnibus_discount", "price", "original_price"], p = [
80
+ }, v = ["discount", "omnibus_price", "omnibus_discount", "price", "original_price"], h = [
75
81
  { text: "before the amount", value: "0" },
76
82
  { text: "after the amount", value: "1" }
77
- ], v = [
83
+ ], x = [
78
84
  { text: "dot(.)", value: "." },
79
85
  { text: "comma(,)", value: "," },
80
86
  { text: "space( )", value: " " }
81
- ], h = [
87
+ ], E = [
82
88
  { text: "0", value: "0" },
83
89
  { text: "1", value: "1" },
84
90
  { text: "2", value: "2" },
@@ -90,54 +96,55 @@ const l = {
90
96
  { text: "contains", value: "~" },
91
97
  { text: "does not contain", value: "!~" },
92
98
  { text: "any of", value: a }
93
- ], n = [
99
+ ], s = [
94
100
  { text: "is exactly", value: "=" },
95
101
  { text: "is not exactly", value: "!==" },
96
102
  { text: "contains", value: "~" },
97
103
  { text: "does not contain", value: "!~" },
98
104
  { text: "any of", value: a }
99
- ], o = [
105
+ ], i = [
100
106
  { text: "is equal to", value: "=" },
101
107
  { text: "is greater than", value: ">" },
102
108
  { text: "is less than", value: "<" }
103
- ], s = [
109
+ ], u = [
104
110
  { text: "is equal to", value: "=" },
105
111
  { text: "after", value: ">" },
106
112
  { text: "before", value: "<" }
107
- ], i = [
113
+ ], c = [
108
114
  { text: "true", value: "==" },
109
115
  { text: "false", value: "!=" }
110
- ], x = (e) => {
116
+ ], b = (e) => {
111
117
  if (!e)
112
118
  return t;
113
119
  switch (e) {
114
120
  case "Boolean":
115
- return i;
121
+ return c;
116
122
  case "Date":
117
- return s;
123
+ return u;
118
124
  case "Number":
119
- return o;
125
+ return i;
120
126
  case "String":
121
127
  return t;
122
128
  case "Strings":
123
- return n;
129
+ return s;
124
130
  default:
125
131
  return t;
126
132
  }
127
133
  };
128
134
  export {
129
135
  a as OP_ANY_OF,
130
- m as PriceAttributes,
131
- c as QUERY_PARAMS,
132
- l as URLS,
133
- h as currencyDecimalCounts,
134
- p as currencyLocationMaps,
135
- v as currencyOperators,
136
- x as getOperatorOptions,
137
- d as getRecommendationFeedSourceMaps,
138
- n as operatorOptionsForArrayOfStrings,
139
- i as operatorOptionsForBooleans,
140
- s as operatorOptionsForDates,
141
- o as operatorOptionsForNumbers,
142
- t as operatorOptionsForStrings
136
+ v as PriceAttributes,
137
+ m as QUERY_PARAMS,
138
+ o as URLS,
139
+ E as currencyDecimalCounts,
140
+ h as currencyLocationMaps,
141
+ x as currencyOperators,
142
+ b as getOperatorOptions,
143
+ p as getRecommendationFeedSourceMaps,
144
+ s as operatorOptionsForArrayOfStrings,
145
+ c as operatorOptionsForBooleans,
146
+ u as operatorOptionsForDates,
147
+ i as operatorOptionsForNumbers,
148
+ t as operatorOptionsForStrings,
149
+ d as strategyEditPath
143
150
  };
@@ -1,15 +1,14 @@
1
- import { ModificationDescription as d, UIElementType as s, UEAttr as p } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
2
- import { CommonControl as T } from "../../../common-control.js";
3
- import { nameMaxWidthFor as h } from "../../constants/cardLayout.js";
1
+ import { ModificationDescription as l, UIElementType as s, UEAttr as d } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
2
+ import { CommonControl as p } from "../../../common-control.js";
4
3
  import { ItemsBlockControlId as a } from "../../enums/controlEnums.js";
5
- import { findNameTextNode as c } from "../../utils/nameNode.js";
6
- import { getItemsBlockConfig as r, setItemsBlockConfig as g } from "../../utils/nodeConfigUtils.js";
7
- const I = a.NAME_TRIMMING, n = {
4
+ import { findNameTextNode as T } from "../../utils/nameNode.js";
5
+ import { getItemsBlockConfig as r, setItemsBlockConfig as c } from "../../utils/nodeConfigUtils.js";
6
+ const g = a.NAME_TRIMMING, i = {
8
7
  TRIMMING: "trimming"
9
8
  };
10
- class E extends T {
9
+ class y extends p {
11
10
  getId() {
12
- return I;
11
+ return g;
13
12
  }
14
13
  getTemplate() {
15
14
  return `
@@ -20,39 +19,39 @@ class E extends T {
20
19
  }
21
20
  onRender() {
22
21
  const e = r(this.currentNode);
23
- this.api.updateValues({ [n.TRIMMING]: (e == null ? void 0 : e.nameTrimming) ?? !0 }), this.api.onValueChanged(n.TRIMMING, (t) => {
22
+ this.api.updateValues({ [i.TRIMMING]: (e == null ? void 0 : e.nameTrimming) ?? !0 }), this.api.onValueChanged(i.TRIMMING, (t) => {
24
23
  this._onTrimmingChange(t);
25
24
  });
26
25
  }
27
26
  onTemplateNodeUpdated(e) {
28
27
  super.onTemplateNodeUpdated(e), this.handleBlockInstanceChange(() => {
29
28
  const t = r(this.currentNode);
30
- this.api.updateValues({ [n.TRIMMING]: (t == null ? void 0 : t.nameTrimming) ?? !0 });
29
+ this.api.updateValues({ [i.TRIMMING]: (t == null ? void 0 : t.nameTrimming) ?? !0 });
31
30
  });
32
31
  }
33
32
  _onTrimmingChange(e) {
34
- g(this.currentNode, this.api, { nameTrimming: e }), this.api.updateValues({ [n.TRIMMING]: e }), this._applyTrimmingStyles(e);
33
+ c(this.currentNode, this.api, { nameTrimming: e }), this.api.updateValues({ [i.TRIMMING]: e }), this._applyTrimmingStyles(e);
35
34
  }
36
35
  _applyTrimmingStyles(e) {
37
- const t = c(this.currentNode);
36
+ const t = T(this.currentNode);
38
37
  if (!t)
39
38
  return;
40
- const i = r(this.currentNode), m = e !== void 0 ? e : (i == null ? void 0 : i.nameTrimming) ?? !0, l = h(i == null ? void 0 : i.orientation), o = this.api.getDocumentModifier().modifyHtml(t);
41
- m ? o.setStyle("white-space", "nowrap").setStyle("overflow", "hidden").setStyle("text-overflow", "ellipsis") : o.removeStyle("white-space").removeStyle("overflow").removeStyle("text-overflow"), o.setStyle("max-width", l).apply(new d(`Text Trimming ${m ? "Enabled" : "Disabled"}`));
39
+ const n = r(this.currentNode), m = e !== void 0 ? e : (n == null ? void 0 : n.nameTrimming) ?? !0, o = this.api.getDocumentModifier().modifyHtml(t);
40
+ m ? o.setStyle("white-space", "nowrap").setStyle("overflow", "hidden").setStyle("text-overflow", "ellipsis") : o.removeStyle("white-space").removeStyle("overflow").removeStyle("text-overflow"), o.setStyle("max-width", "100%").apply(new l(`Text Trimming ${m ? "Enabled" : "Disabled"}`));
42
41
  }
43
42
  _getTextTrimming() {
44
43
  return `
45
44
  <div class="display-flex align-items-center justify-content-between">
46
45
  <${s.LABEL}
47
- ${p.LABEL.text}="${this.api.translate("Text Trimming")}"
46
+ ${d.LABEL.text}="${this.api.translate("Text Trimming")}"
48
47
  >
49
48
  </${s.LABEL}>
50
- ${this._GuToggle(n.TRIMMING)}
49
+ ${this._GuToggle(i.TRIMMING)}
51
50
  </div>
52
51
  `;
53
52
  }
54
53
  }
55
54
  export {
56
- I as CONTROL_BLOCK_ID,
57
- E as NameTrimmingControl
55
+ g as CONTROL_BLOCK_ID,
56
+ y as NameTrimmingControl
58
57
  };
@@ -1,22 +1,21 @@
1
- import { ModificationDescription as N, UEAttr as L } from "../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
2
- import { CommonControl as $ } from "../../common-control.js";
3
- import { reorientBlockCellPadding as D, nameMaxWidthFor as f } from "../constants/cardLayout.js";
1
+ import { ModificationDescription as S, UEAttr as L } from "../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
2
+ import { CommonControl as k } from "../../common-control.js";
4
3
  import { ItemsBlockId as I } from "../enums/controlEnums.js";
5
- import { productPairs as y, templateFirstLine as x } from "../enums/productEnums.js";
6
- import { SETTINGS_ENUMS as T, ItemTypeOptions as H, OrientationOptions as w, ItemInCartOptions as g, DefaultConfigValues as U } from "../enums/settingsEnums.js";
7
- import q from "../layouts/horizontal.html.js";
8
- import V from "../layouts/vertical.html.js";
9
- import { getDefaultTemplate as B, wrapInTableRow as C, applyPriceOrientationStyles as G } from "../template.js";
10
- import { findNameTextNode as Y } from "../utils/nameNode.js";
11
- import { getItemsBlockConfig as _, setItemsBlockConfig as M, escapeReplacement as A, deriveItemNumber as v } from "../utils/nodeConfigUtils.js";
12
- const Q = "ui-elements-items-block", p = {
4
+ import { productPairs as y, templateFirstLine as D } from "../enums/productEnums.js";
5
+ import { SETTINGS_ENUMS as d, ItemTypeOptions as x, OrientationOptions as F, ItemInCartOptions as O, DefaultConfigValues as H } from "../enums/settingsEnums.js";
6
+ import $ from "../layouts/horizontal.html.js";
7
+ import w from "../layouts/vertical.html.js";
8
+ import { getDefaultTemplate as q, wrapInTableRow as C } from "../template.js";
9
+ import { findNameTextNode as V } from "../utils/nameNode.js";
10
+ import { getItemsBlockConfig as _, setItemsBlockConfig as M, escapeReplacement as g, deriveItemNumber as B } from "../utils/nodeConfigUtils.js";
11
+ const G = "ui-elements-items-block", m = {
13
12
  ITEMS_TYPE: "itemsType",
14
13
  ORIENTATION: "orientation",
15
14
  ITEM_IDS: "itemIds"
16
15
  };
17
- class se extends $ {
16
+ class te extends k {
18
17
  getId() {
19
- return Q;
18
+ return G;
20
19
  }
21
20
  getTemplate() {
22
21
  return `
@@ -30,18 +29,18 @@ class se extends $ {
30
29
  onRender() {
31
30
  const e = _(this.currentNode);
32
31
  this.api.updateValues({
33
- [p.ORIENTATION]: (e == null ? void 0 : e.orientation) ?? T.ORIENTATION.VERTICAL,
34
- [p.ITEMS_TYPE]: (e == null ? void 0 : e.type) ?? T.ITEMS_TYPE.CART_ITEMS,
35
- [p.ITEM_IDS]: (e == null ? void 0 : e.itemsSelectValue) ?? ""
32
+ [m.ORIENTATION]: (e == null ? void 0 : e.orientation) ?? d.ORIENTATION.VERTICAL,
33
+ [m.ITEMS_TYPE]: (e == null ? void 0 : e.type) ?? d.ITEMS_TYPE.CART_ITEMS,
34
+ [m.ITEM_IDS]: (e == null ? void 0 : e.itemsSelectValue) ?? ""
36
35
  }), this._listenToFormUpdates();
37
36
  }
38
37
  onTemplateNodeUpdated(e) {
39
38
  super.onTemplateNodeUpdated(e), console.debug("Items Block Config", e.getNodeConfig()), this.handleBlockInstanceChange(() => {
40
39
  const r = _(this.currentNode);
41
40
  this.api.updateValues({
42
- [p.ORIENTATION]: (r == null ? void 0 : r.orientation) ?? T.ORIENTATION.VERTICAL,
43
- [p.ITEMS_TYPE]: (r == null ? void 0 : r.type) ?? T.ITEMS_TYPE.CART_ITEMS,
44
- [p.ITEM_IDS]: (r == null ? void 0 : r.itemsSelectValue) ?? ""
41
+ [m.ORIENTATION]: (r == null ? void 0 : r.orientation) ?? d.ORIENTATION.VERTICAL,
42
+ [m.ITEMS_TYPE]: (r == null ? void 0 : r.type) ?? d.ITEMS_TYPE.CART_ITEMS,
43
+ [m.ITEM_IDS]: (r == null ? void 0 : r.itemsSelectValue) ?? ""
45
44
  }), this._initializeSelectItems();
46
45
  });
47
46
  }
@@ -50,10 +49,10 @@ class se extends $ {
50
49
  ${this._GuOneColumn([
51
50
  this._GuLabel({ text: "Item Type" }),
52
51
  this._GuSelect({
53
- name: p.ITEMS_TYPE,
52
+ name: m.ITEMS_TYPE,
54
53
  className: "es-100",
55
54
  placeholder: "Select Item Type",
56
- options: H
55
+ options: x
57
56
  })
58
57
  ])}
59
58
  `;
@@ -63,8 +62,8 @@ class se extends $ {
63
62
  ${this._GuTwoColumns([
64
63
  this._GuLabel({ text: "Orientation" }),
65
64
  this._GuRadioButton({
66
- name: p.ORIENTATION,
67
- buttons: w
65
+ name: m.ORIENTATION,
66
+ buttons: F
68
67
  })
69
68
  ])}
70
69
  `;
@@ -74,7 +73,7 @@ class se extends $ {
74
73
  ${this._GuTwoColumns([
75
74
  this._GuLabel({ text: "Item in Cart" }),
76
75
  this._GuSelect({
77
- name: p.ITEM_IDS,
76
+ name: m.ITEM_IDS,
78
77
  className: "es-100",
79
78
  placeholder: "Select Item In Cart",
80
79
  options: []
@@ -83,32 +82,32 @@ class se extends $ {
83
82
  `;
84
83
  }
85
84
  _onOrientationChange(e) {
86
- this.api.updateValues({ [p.ORIENTATION]: e });
85
+ this.api.updateValues({ [m.ORIENTATION]: e });
87
86
  const r = this.api.getDocumentModifier();
88
87
  M(this.currentNode, this.api, {
89
88
  orientation: e,
90
89
  priceOrientation: "horizontal"
91
- }, r), r.apply(new N("Changed orientation")), this._reOrderTemplate(), setTimeout(() => {
90
+ }, r), r.apply(new S("Changed orientation")), this._reOrderTemplate(), setTimeout(() => {
92
91
  this._recalculateTrimming();
93
92
  }, 50);
94
93
  }
95
94
  _onItemsTypeChange(e) {
96
- const r = T.ITEMS_TYPE[e], t = g[e], i = t == null ? void 0 : t[0];
95
+ const r = d.ITEMS_TYPE[e], t = O[e], i = t == null ? void 0 : t[0];
97
96
  if (!r || !i)
98
97
  return;
99
- const n = i.value, s = i.value.replace("Url}}", "Image}}"), a = this.api.getDocumentModifier();
98
+ const n = i.value, s = i.value.replace("Url}}", "Image}}"), o = this.api.getDocumentModifier();
100
99
  M(this.currentNode, this.api, {
101
100
  source: r,
102
101
  type: r,
103
102
  itemsSelectValue: i.value,
104
103
  imageLink: s,
105
104
  buttonLink: n
106
- }, a), this._updateDataTypeAttributes(r, a), this._initializeSelectItems();
107
- const l = this._getTemplateData(r, i.value);
108
- this._updateImageSrc(l.imageSrc, a), this._updateName(l.name, a), this._updatePrice(l.price, a), this._updateOriginalPrice(l.originalPrice, a), this._updateQuantity(l.quantity, r, a), a.apply(new N("Updated items type"));
105
+ }, o), this._updateDataTypeAttributes(r, o), this._initializeSelectItems();
106
+ const c = this._getTemplateData(r, i.value);
107
+ this._updateImageSrc(c.imageSrc, o), this._updateName(c.name, o), this._updatePrice(c.price, o), this._updateOriginalPrice(c.originalPrice, o), this._updateQuantity(c.quantity, r, o), o.apply(new S("Updated items type"));
109
108
  }
110
109
  _onItemIdsChange(e) {
111
- this.api.updateValues({ [p.ITEM_IDS]: e });
110
+ this.api.updateValues({ [m.ITEM_IDS]: e });
112
111
  const r = e, t = e.replace("Url}}", "Image}}"), i = this.api.getDocumentModifier();
113
112
  M(this.currentNode, this.api, {
114
113
  itemsSelectValue: e,
@@ -116,58 +115,58 @@ class se extends $ {
116
115
  buttonLink: r
117
116
  }, i), this._updateDataNumberAttributes(e, i);
118
117
  const n = this._getTemplateData(void 0, e);
119
- this._updateImageSrc(n.imageSrc, i), this._updateName(n.name, i), this._updatePrice(n.price, i), this._updateOriginalPrice(n.originalPrice, i), this._updateQuantity(n.quantity, void 0, i), i.apply(new N("Updated item selection"));
118
+ this._updateImageSrc(n.imageSrc, i), this._updateName(n.name, i), this._updatePrice(n.price, i), this._updateOriginalPrice(n.originalPrice, i), this._updateQuantity(n.quantity, void 0, i), i.apply(new S("Updated item selection"));
120
119
  }
121
120
  _initializeSelectItems() {
122
121
  this.api.setUIEAttribute(
123
- p.ITEMS_TYPE,
122
+ m.ITEMS_TYPE,
124
123
  L.SELECTPICKER.items,
125
- H
124
+ x
126
125
  );
127
- const e = _(this.currentNode), r = (e == null ? void 0 : e.type) ?? T.ITEMS_TYPE.CART_ITEMS, t = (e == null ? void 0 : e.itemsSelectValue) ?? "";
126
+ const e = _(this.currentNode), r = (e == null ? void 0 : e.type) ?? d.ITEMS_TYPE.CART_ITEMS, t = (e == null ? void 0 : e.itemsSelectValue) ?? "";
128
127
  this.api.updateValues({
129
- [p.ITEMS_TYPE]: r
128
+ [m.ITEMS_TYPE]: r
130
129
  });
131
- const i = g[r];
130
+ const i = O[r];
132
131
  this.api.setUIEAttribute(
133
- p.ITEM_IDS,
132
+ m.ITEM_IDS,
134
133
  L.SELECTPICKER.items,
135
134
  i
136
135
  ), this.api.updateValues({
137
- [p.ITEM_IDS]: t
136
+ [m.ITEM_IDS]: t
138
137
  });
139
138
  }
140
139
  _listenToFormUpdates() {
141
140
  this.api.onValueChanged(
142
- p.ITEMS_TYPE,
141
+ m.ITEMS_TYPE,
143
142
  (e) => this._onItemsTypeChange(e)
144
143
  ), this.api.onValueChanged(
145
- p.ORIENTATION,
144
+ m.ORIENTATION,
146
145
  (e) => this._onOrientationChange(e)
147
146
  ), this.api.onValueChanged(
148
- p.ITEM_IDS,
147
+ m.ITEM_IDS,
149
148
  (e) => this._onItemIdsChange(e)
150
149
  );
151
150
  }
152
151
  _renderTemplate() {
153
- const e = _(this.currentNode), r = (e == null ? void 0 : e.orientation) ?? T.ORIENTATION.VERTICAL, t = (e == null ? void 0 : e.type) ?? T.ITEMS_TYPE.CART_ITEMS, i = (e == null ? void 0 : e.itemsSelectValue) ?? "", n = (e == null ? void 0 : e.priceCurrencySymbol) ?? "", s = (e == null ? void 0 : e.priceCurrencyLocation) ?? "0", a = (e == null ? void 0 : e.priceFormatted) ?? !1;
154
- this.api.getDocumentModifier().modifyHtml(this.currentNode).setInnerHtml(B({
152
+ const e = _(this.currentNode), r = (e == null ? void 0 : e.orientation) ?? d.ORIENTATION.VERTICAL, t = (e == null ? void 0 : e.type) ?? d.ITEMS_TYPE.CART_ITEMS, i = (e == null ? void 0 : e.itemsSelectValue) ?? "", n = (e == null ? void 0 : e.priceCurrencySymbol) ?? "", s = (e == null ? void 0 : e.priceCurrencyLocation) ?? "0", o = (e == null ? void 0 : e.priceFormatted) ?? !1;
153
+ this.api.getDocumentModifier().modifyHtml(this.currentNode).setInnerHtml(q({
155
154
  orientation: r,
156
155
  itemsType: t,
157
156
  itemId: i,
158
157
  currencySymbol: n,
159
158
  currencyLocation: s,
160
- formattedPrice: a
161
- })).apply(new N("Updated template"));
159
+ formattedPrice: o
160
+ })).apply(new S("Updated template"));
162
161
  }
163
162
  _getTemplateData(e, r) {
164
- const t = _(this.currentNode), i = e ?? (t == null ? void 0 : t.type) ?? T.ITEMS_TYPE.CART_ITEMS, n = r ?? (t == null ? void 0 : t.itemsSelectValue) ?? "", s = (t == null ? void 0 : t.priceFormatted) ?? !1, a = (t == null ? void 0 : t.priceSinglePrice) ?? !1, l = g[i].findIndex((h) => h.value === n), c = l > -1 ? l : 0, o = y.PAIRS_FOR_EXTENSION.price[i], d = y.PAIRS_FOR_EXTENSION.originalPrice[i];
165
- let m, u;
166
- return a ? (m = s ? o.DEFAULT_SINGLE_PRICE_FORMATTED : o.DEFAULT_SINGLE_PRICE, u = s ? d.DEFAULT_SINGLE_PRICE_FORMATTED : d.DEFAULT_SINGLE_PRICE) : (m = s ? o.DEFAULT_PRICE_FORMATTED : o.DEFAULT_PRICE, u = s ? d.DEFAULT_PRICE_FORMATTED : d.DEFAULT_PRICE), {
167
- imageSrc: y.PAIRS_FOR_EXTENSION.imageSrc[i].DEFAULT[c],
168
- name: y.PAIRS_FOR_EXTENSION.name[i].DEFAULT[c],
169
- price: m,
170
- originalPrice: u,
163
+ const t = _(this.currentNode), i = e ?? (t == null ? void 0 : t.type) ?? d.ITEMS_TYPE.CART_ITEMS, n = r ?? (t == null ? void 0 : t.itemsSelectValue) ?? "", s = (t == null ? void 0 : t.priceFormatted) ?? !1, o = (t == null ? void 0 : t.priceSinglePrice) ?? !1, c = O[i].findIndex((h) => h.value === n), a = c > -1 ? c : 0, l = y.PAIRS_FOR_EXTENSION.price[i], T = y.PAIRS_FOR_EXTENSION.originalPrice[i];
164
+ let u, p;
165
+ return o ? (u = s ? l.DEFAULT_SINGLE_PRICE_FORMATTED : l.DEFAULT_SINGLE_PRICE, p = s ? T.DEFAULT_SINGLE_PRICE_FORMATTED : T.DEFAULT_SINGLE_PRICE) : (u = s ? l.DEFAULT_PRICE_FORMATTED : l.DEFAULT_PRICE, p = s ? T.DEFAULT_PRICE_FORMATTED : T.DEFAULT_PRICE), {
166
+ imageSrc: y.PAIRS_FOR_EXTENSION.imageSrc[i].DEFAULT[a],
167
+ name: y.PAIRS_FOR_EXTENSION.name[i].DEFAULT[a],
168
+ price: u,
169
+ originalPrice: p,
171
170
  quantity: y.PAIRS_FOR_EXTENSION.quantity[i].DEFAULT,
172
171
  button: y.PAIRS_FOR_EXTENSION.button[i].DEFAULT_LABEL
173
172
  };
@@ -184,79 +183,71 @@ class se extends $ {
184
183
  return;
185
184
  const i = t.getInnerText().trim();
186
185
  let n = t.getInnerHTML().trim();
187
- n = n.replace(i, A(e)), r.modifyHtml(t).setInnerHtml(n);
186
+ n = n.replace(i, g(e)), r.modifyHtml(t).setInnerHtml(n);
188
187
  }
189
188
  _updatePrice(e, r) {
190
- var a;
191
- const t = ((a = this.currentNode) == null ? void 0 : a.querySelectorAll(
189
+ var o;
190
+ const t = ((o = this.currentNode) == null ? void 0 : o.querySelectorAll(
192
191
  `[esd-extension-block-id="${I.PRICE}"]`
193
192
  )) || [], i = _(this.currentNode), n = (i == null ? void 0 : i.priceCurrencySymbol) ?? "", s = (i == null ? void 0 : i.priceCurrencyLocation) ?? "0";
194
- t.forEach((l) => {
195
- const c = this._getParagraphFromBlock(l);
196
- if (!c)
193
+ t.forEach((c) => {
194
+ const a = this._getParagraphFromBlock(c);
195
+ if (!a)
197
196
  return;
198
- const o = c.getInnerHTML().trim() || "", d = c.getInnerText().trim() || "", m = (n == null ? void 0 : n.trim()) || "", u = this._removeCurrencySymbol(d, m), h = this._replacePriceNumber(u, e), E = this._buildPriceContent(h, m, s), S = o.replace(d, A(E));
199
- r.modifyHtml(c).setInnerHtml(S);
197
+ const l = a.getInnerHTML().trim() || "", T = a.getInnerText().trim() || "", u = (n == null ? void 0 : n.trim()) || "", p = this._removeCurrencySymbol(T, u), h = this._replacePriceNumber(p, e), E = this._buildPriceContent(h, u, s), N = l.replace(T, g(E));
198
+ r.modifyHtml(a).setInnerHtml(N);
200
199
  });
201
200
  }
202
201
  _updateOriginalPrice(e, r) {
203
- var a;
204
- const t = ((a = this.currentNode) == null ? void 0 : a.querySelectorAll(
202
+ var o;
203
+ const t = ((o = this.currentNode) == null ? void 0 : o.querySelectorAll(
205
204
  `[esd-extension-block-id="${I.ORIGINAL_PRICE}"]`
206
205
  )) || [], i = _(this.currentNode), n = (i == null ? void 0 : i.priceCurrencySymbol) ?? "", s = (i == null ? void 0 : i.priceCurrencyLocation) ?? "0";
207
- t.forEach((l) => {
208
- const c = this._getParagraphFromBlock(l);
209
- if (!c)
206
+ t.forEach((c) => {
207
+ const a = this._getParagraphFromBlock(c);
208
+ if (!a)
210
209
  return;
211
- const o = c.querySelector("s");
212
- if (!o)
210
+ const l = a.querySelector("s");
211
+ if (!l)
213
212
  return;
214
- const d = o.getInnerHTML().trim() || "", m = o.getInnerText().trim() || "", u = (n == null ? void 0 : n.trim()) || "", h = this._removeCurrencySymbol(m, u), E = this._replacePriceNumber(h, e), S = this._buildPriceContent(E, u, s), R = `<s>${d.replace(m, A(S))}</s>`;
215
- r.modifyHtml(c).setInnerHtml(R);
213
+ const T = l.getInnerHTML().trim() || "", u = l.getInnerText().trim() || "", p = (n == null ? void 0 : n.trim()) || "", h = this._removeCurrencySymbol(u, p), E = this._replacePriceNumber(h, e), N = this._buildPriceContent(E, p, s), R = `<s>${T.replace(u, g(N))}</s>`;
214
+ r.modifyHtml(a).setInnerHtml(R);
216
215
  });
217
216
  }
218
217
  _updateQuantity(e, r, t) {
219
218
  var h;
220
- const i = _(this.currentNode), s = (r ?? (i == null ? void 0 : i.type) ?? T.ITEMS_TYPE.CART_ITEMS) !== T.ITEMS_TYPE.BROWSED_ITEMS, a = (i == null ? void 0 : i.quantityControlEnabled) !== !1, l = s && a, c = (h = this.currentNode) == null ? void 0 : h.querySelector(`[esd-extension-block-id="${I.QUANTITY}"]`);
221
- if (!c)
219
+ const i = _(this.currentNode), s = (r ?? (i == null ? void 0 : i.type) ?? d.ITEMS_TYPE.CART_ITEMS) !== d.ITEMS_TYPE.BROWSED_ITEMS, o = (i == null ? void 0 : i.quantityControlEnabled) !== !1, c = s && o, a = (h = this.currentNode) == null ? void 0 : h.querySelector(`[esd-extension-block-id="${I.QUANTITY}"]`);
220
+ if (!a)
222
221
  return;
223
- const o = this._getParagraphFromBlock(c);
224
- if (!o)
222
+ const l = this._getParagraphFromBlock(a);
223
+ if (!l)
225
224
  return;
226
- const d = o.getInnerText().trim();
227
- let m = o.getInnerHTML().trim();
228
- function u(E, S, P) {
225
+ const T = l.getInnerText().trim();
226
+ let u = l.getInnerHTML().trim();
227
+ function p(E, N, A) {
229
228
  return E.replace(
230
- new RegExp(`(>\\s*)?${S}(\\s*<)?`, "g"),
231
- `$1${P}$2`
229
+ new RegExp(`(>\\s*)?${N}(\\s*<)?`, "g"),
230
+ `$1${A}$2`
232
231
  );
233
232
  }
234
- m = u(m, d, e), t.modifyHtml(o).setInnerHtml(m), t.modifyHtml(c).setStyle("display", l ? "table-cell" : "none");
233
+ u = p(u, T, e), t.modifyHtml(l).setInnerHtml(u), t.modifyHtml(a).setStyle("display", c ? "table-cell" : "none");
235
234
  }
236
235
  _reOrderTemplate(e) {
237
- var h, E, S, P, R, b;
238
- const r = (h = this.currentNode) == null ? void 0 : h.querySelector(`[esd-extension-block-id="${I.IMAGE}"]`), t = (E = this.currentNode) == null ? void 0 : E.querySelector(`[esd-extension-block-id="${I.NAME}"]`), i = ((S = this.currentNode) == null ? void 0 : S.querySelectorAll(
236
+ var h, E, N, A, R, b;
237
+ const r = (h = this.currentNode) == null ? void 0 : h.querySelector(`[esd-extension-block-id="${I.IMAGE}"]`), t = (E = this.currentNode) == null ? void 0 : E.querySelector(`[esd-extension-block-id="${I.NAME}"]`), i = ((N = this.currentNode) == null ? void 0 : N.querySelectorAll(
239
238
  `[esd-extension-block-id="${I.PRICE}"]`
240
- )) || [], n = ((P = this.currentNode) == null ? void 0 : P.querySelectorAll(
239
+ )) || [], n = ((A = this.currentNode) == null ? void 0 : A.querySelectorAll(
241
240
  `[esd-extension-block-id="${I.ORIGINAL_PRICE}"]`
242
- )) || [], [s] = i, [a] = n, l = (R = this.currentNode) == null ? void 0 : R.querySelector(`[esd-extension-block-id="${I.QUANTITY}"]`), c = (b = this.currentNode) == null ? void 0 : b.querySelector(`[esd-extension-block-id="${I.BUTTON}"]`);
243
- if (!r || !t || !s || !a || !l || !c)
241
+ )) || [], [s] = i, [o] = n, c = (R = this.currentNode) == null ? void 0 : R.querySelector(`[esd-extension-block-id="${I.QUANTITY}"]`), a = (b = this.currentNode) == null ? void 0 : b.querySelector(`[esd-extension-block-id="${I.BUTTON}"]`);
242
+ if (!r || !t || !s || !o || !c || !a)
244
243
  return;
245
- const o = _(this.currentNode), d = (o == null ? void 0 : o.orientation) ?? T.ORIENTATION.VERTICAL, m = d === T.ORIENTATION.VERTICAL;
246
- let u = m ? V : q;
244
+ const l = _(this.currentNode), u = ((l == null ? void 0 : l.orientation) ?? d.ORIENTATION.VERTICAL) === d.ORIENTATION.VERTICAL;
245
+ let p = u ? w : $;
247
246
  setTimeout(() => {
248
- const k = A(D(s.getOuterHTML(), m)), F = A(
249
- D(a.getOuterHTML(), m)
250
- );
251
- u = u.replace("{-{-TEMPLATE_FIRST_LINE-}-}", m ? x : "").replace("{-{-PRODUCT_IMAGE-}-}", C(r.getOuterHTML())).replace("{-{-PRODUCT_NAME-}-}", C(t.getOuterHTML())).replaceAll("{-{-PRODUCT_PRICE-}-}", C(k)).replaceAll("{-{-PRODUCT_ORIGINAL_PRICE-}-}", C(F)).replace("{-{-PRODUCT_QUANTITY-}-}", C(l.getOuterHTML())).replace("{-{-PRODUCT_BUTTON-}-}", C(c.getOuterHTML())), u = G(
252
- u,
253
- d,
254
- (o == null ? void 0 : o.priceOrientation) ?? "horizontal",
255
- (o == null ? void 0 : o.priceVisible) ?? !0,
256
- (o == null ? void 0 : o.originalPriceVisible) ?? !0
257
- ), u = u.trim().replace(x, "").slice(0, -5);
258
- const O = e ?? this.api.getDocumentModifier();
259
- O.modifyHtml(r.querySelector("img")).setAttribute("width", U.productImageWidth).setAttribute("height", U.productImageWidth), O.modifyHtml(this.currentNode).setInnerHtml(u), e || O.apply(new N("Reordered template"));
247
+ const f = g(s.getOuterHTML()), U = g(o.getOuterHTML());
248
+ p = p.replace("{-{-TEMPLATE_FIRST_LINE-}-}", u ? D : "").replace("{-{-PRODUCT_IMAGE-}-}", C(r.getOuterHTML())).replace("{-{-PRODUCT_NAME-}-}", C(t.getOuterHTML())).replaceAll("{-{-PRODUCT_PRICE-}-}", C(f)).replaceAll("{-{-PRODUCT_ORIGINAL_PRICE-}-}", C(U)).replace("{-{-PRODUCT_QUANTITY-}-}", C(c.getOuterHTML())).replace("{-{-PRODUCT_BUTTON-}-}", C(a.getOuterHTML())), p = p.trim().replace(D, "").slice(0, -5);
249
+ const P = e ?? this.api.getDocumentModifier();
250
+ P.modifyHtml(r.querySelector("img")).setAttribute("width", H.productImageWidth).setAttribute("height", H.productImageWidth), P.modifyHtml(this.currentNode).setInnerHtml(p), e || P.apply(new S("Reordered template"));
260
251
  }, 50);
261
252
  }
262
253
  _updateDataTypeAttributes(e, r) {
@@ -271,28 +262,28 @@ class se extends $ {
271
262
  _updateDataNumberAttributes(e, r) {
272
263
  if (!this.currentNode)
273
264
  return;
274
- const t = _(this.currentNode), i = (t == null ? void 0 : t.type) ?? T.ITEMS_TYPE.CART_ITEMS, n = v(e, i), s = this.currentNode.closest(".ins-product-td");
275
- s && r.modifyHtml(s).setAttribute("data-number", n), this.currentNode.querySelectorAll("[data-number]").forEach((l) => {
276
- const c = l;
277
- r.modifyHtml(c).setAttribute("data-number", n);
265
+ const t = _(this.currentNode), i = (t == null ? void 0 : t.type) ?? d.ITEMS_TYPE.CART_ITEMS, n = B(e, i), s = this.currentNode.closest(".ins-product-td");
266
+ s && r.modifyHtml(s).setAttribute("data-number", n), this.currentNode.querySelectorAll("[data-number]").forEach((c) => {
267
+ const a = c;
268
+ r.modifyHtml(a).setAttribute("data-number", n);
278
269
  });
279
270
  }
280
271
  _reFillTemplate(e) {
281
272
  const r = this._getTemplateData(e), t = this.api.getDocumentModifier();
282
- this._updateImageSrc(r.imageSrc, t), this._updateName(r.name, t), this._updatePrice(r.price, t), this._updateOriginalPrice(r.originalPrice, t), this._updateQuantity(r.quantity, e, t), t.apply(new N("Refilled template"));
273
+ this._updateImageSrc(r.imageSrc, t), this._updateName(r.name, t), this._updatePrice(r.price, t), this._updateOriginalPrice(r.originalPrice, t), this._updateQuantity(r.quantity, e, t), t.apply(new S("Refilled template"));
283
274
  }
284
275
  _recalculateTrimming() {
285
- var s;
276
+ var n;
286
277
  if (!this.currentNode)
287
278
  return;
288
- const e = (s = this.currentNode) == null ? void 0 : s.querySelector(`[esd-extension-block-id="${I.NAME}"]`);
279
+ const e = (n = this.currentNode) == null ? void 0 : n.querySelector(`[esd-extension-block-id="${I.NAME}"]`);
289
280
  if (!e)
290
281
  return;
291
- const r = Y(e);
282
+ const r = V(e);
292
283
  if (!r)
293
284
  return;
294
- const t = _(this.currentNode), i = (t == null ? void 0 : t.nameTrimming) ?? !0, n = f(t == null ? void 0 : t.orientation);
295
- this.api.getDocumentModifier().modifyHtml(r).setStyle("overflow", "hidden").setStyle("white-space", i ? "nowrap" : "normal").setStyle("text-overflow", i ? "ellipsis" : "unset").setStyle("max-width", n).removeStyle("width").apply(new N("Recalculated trimming after orientation change"));
285
+ const t = _(this.currentNode), i = (t == null ? void 0 : t.nameTrimming) ?? !0;
286
+ this.api.getDocumentModifier().modifyHtml(r).setStyle("overflow", "hidden").setStyle("white-space", i ? "nowrap" : "normal").setStyle("text-overflow", i ? "ellipsis" : "unset").setStyle("max-width", "100%").setStyle("width", "100%").apply(new S("Recalculated trimming after orientation change"));
296
287
  }
297
288
  _getParagraphFromBlock(e) {
298
289
  return e.querySelector("p");
@@ -309,8 +300,8 @@ class se extends $ {
309
300
  } else {
310
301
  const n = t.match(/([^0-9.,\s]+)/);
311
302
  if (n && n[1]) {
312
- const s = n[1].trim(), a = new RegExp(`\\s*${this._escapeRegex(s)}\\s*`);
313
- i = t.replace(a, "").trim();
303
+ const s = n[1].trim(), o = new RegExp(`\\s*${this._escapeRegex(s)}\\s*`);
304
+ i = t.replace(o, "").trim();
314
305
  }
315
306
  }
316
307
  return i;
@@ -324,6 +315,6 @@ class se extends $ {
324
315
  }
325
316
  }
326
317
  export {
327
- Q as CONTROL_BLOCK_ID,
328
- se as ItemsBlockControl
318
+ G as CONTROL_BLOCK_ID,
319
+ te as ItemsBlockControl
329
320
  };