@useinsider/guido 1.0.3-beta.cc614d6 → 1.0.3-beta.cd0d7f3

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 (184) hide show
  1. package/README.md +35 -0
  2. package/dist/components/Guido.vue.js +1 -1
  3. package/dist/components/Guido.vue2.js +44 -41
  4. package/dist/components/organisms/header/RightSlot.vue.js +1 -1
  5. package/dist/components/organisms/header/RightSlot.vue2.js +23 -22
  6. package/dist/components/organisms/onboarding/ItemsOnboarding.vue.js +21 -0
  7. package/dist/components/organisms/onboarding/ItemsOnboarding.vue2.js +99 -0
  8. package/dist/components/organisms/onboarding/OnboardingWrapper.vue2.js +20 -18
  9. package/dist/composables/useActionsApi.js +1 -1
  10. package/dist/composables/useBlocksConfig.js +1 -2
  11. package/dist/composables/useGuidoActions.js +19 -9
  12. package/dist/composables/useHtmlCompiler.js +15 -13
  13. package/dist/composables/useHtmlValidator.js +36 -35
  14. package/dist/composables/useStripo.js +38 -36
  15. package/dist/config/compiler/itemsCompilerRules.js +14 -0
  16. package/dist/config/compiler/unsubscribeCompilerRules.js +33 -28
  17. package/dist/enums/defaults.js +2 -1
  18. package/dist/enums/extensions/recommendationBlock.js +2 -2
  19. package/dist/enums/onboarding.js +7 -3
  20. package/dist/enums/unsubscribe.js +27 -25
  21. package/dist/extensions/Blocks/Checkbox/block.js +5 -2
  22. package/dist/extensions/Blocks/Items/block.js +66 -0
  23. package/dist/extensions/Blocks/Items/controls/button/link.js +68 -0
  24. package/dist/extensions/Blocks/Items/controls/cardComposition.js +193 -0
  25. package/dist/extensions/Blocks/Items/controls/image/link.js +68 -0
  26. package/dist/extensions/Blocks/Items/controls/index.js +217 -0
  27. package/dist/extensions/Blocks/Items/controls/name/trimming.js +70 -0
  28. package/dist/extensions/Blocks/Items/controls/price/currencyLocation.js +107 -0
  29. package/dist/extensions/Blocks/Items/controls/price/currencySymbol.js +123 -0
  30. package/dist/extensions/Blocks/Items/controls/price/formattedPrice.js +76 -0
  31. package/dist/extensions/Blocks/Items/controls/price/hideDiscount.js +61 -0
  32. package/dist/extensions/Blocks/Items/controls/settingsControl.js +309 -0
  33. package/dist/extensions/Blocks/Items/enums/controlEnums.js +5 -0
  34. package/dist/extensions/Blocks/Items/enums/productEnums.js +272 -0
  35. package/dist/extensions/Blocks/Items/enums/settingsEnums.js +76 -0
  36. package/dist/extensions/Blocks/Items/extension.js +19 -0
  37. package/dist/extensions/Blocks/Items/iconsRegistry.js +32 -0
  38. package/dist/extensions/Blocks/Items/items.css.js +23 -0
  39. package/dist/extensions/Blocks/Items/layouts/horizontal.html.js +62 -0
  40. package/dist/extensions/Blocks/Items/layouts/vertical.html.js +61 -0
  41. package/dist/extensions/Blocks/Items/settingsPanel.js +132 -0
  42. package/dist/extensions/Blocks/Items/store/items-block.js +71 -0
  43. package/dist/extensions/Blocks/Items/template.js +194 -0
  44. package/dist/extensions/Blocks/Items/utils/configBlockUtils.js +17 -0
  45. package/dist/extensions/Blocks/Items/utils/syncAttributeFromConfigBlock.js +28 -0
  46. package/dist/extensions/Blocks/Items/utils/syncAttributesFromConfigBlock.js +67 -0
  47. package/dist/extensions/Blocks/Items/utils/updateAttributes.js +44 -0
  48. package/dist/extensions/Blocks/RadioButton/block.js +5 -2
  49. package/dist/extensions/Blocks/Recommendation/iconsRegistry.js +43 -43
  50. package/dist/extensions/Blocks/Recommendation/store/recommendation.js +1 -1
  51. package/dist/extensions/Blocks/common-control.js +174 -110
  52. package/dist/extensions/Blocks/controlFactories.js +223 -0
  53. package/dist/guido.css +1 -1
  54. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js +213 -168
  55. package/dist/node_modules/lodash-es/_DataView.js +6 -0
  56. package/dist/node_modules/lodash-es/_Promise.js +6 -0
  57. package/dist/node_modules/lodash-es/_Set.js +6 -0
  58. package/dist/node_modules/lodash-es/_SetCache.js +13 -0
  59. package/dist/node_modules/lodash-es/_WeakMap.js +6 -0
  60. package/dist/node_modules/lodash-es/_arrayFilter.js +10 -0
  61. package/dist/node_modules/lodash-es/_arrayLikeKeys.js +13 -12
  62. package/dist/node_modules/lodash-es/_arrayMap.js +8 -0
  63. package/dist/node_modules/lodash-es/_arrayPush.js +8 -0
  64. package/dist/node_modules/lodash-es/_arraySome.js +9 -0
  65. package/dist/node_modules/lodash-es/_baseEach.js +6 -0
  66. package/dist/node_modules/lodash-es/_baseFlatten.js +13 -0
  67. package/dist/node_modules/lodash-es/_baseForOwn.js +8 -0
  68. package/dist/node_modules/lodash-es/_baseGet.js +11 -0
  69. package/dist/node_modules/lodash-es/_baseGetAllKeys.js +9 -0
  70. package/dist/node_modules/lodash-es/_baseHasIn.js +6 -0
  71. package/dist/node_modules/lodash-es/_baseIsEqual.js +8 -0
  72. package/dist/node_modules/lodash-es/_baseIsEqualDeep.js +32 -0
  73. package/dist/node_modules/lodash-es/_baseIsMatch.js +29 -0
  74. package/dist/node_modules/lodash-es/_baseIteratee.js +11 -0
  75. package/dist/node_modules/lodash-es/_baseKeys.js +14 -0
  76. package/dist/node_modules/lodash-es/_baseMap.js +11 -0
  77. package/dist/node_modules/lodash-es/_baseMatches.js +12 -0
  78. package/dist/node_modules/lodash-es/_baseMatchesProperty.js +17 -0
  79. package/dist/node_modules/lodash-es/_baseProperty.js +8 -0
  80. package/dist/node_modules/lodash-es/_basePropertyDeep.js +9 -0
  81. package/dist/node_modules/lodash-es/_baseRange.js +9 -0
  82. package/dist/node_modules/lodash-es/_baseToString.js +18 -0
  83. package/dist/node_modules/lodash-es/_baseTrim.js +8 -0
  84. package/dist/node_modules/lodash-es/_cacheHas.js +6 -0
  85. package/dist/node_modules/lodash-es/_castPath.js +10 -0
  86. package/dist/node_modules/lodash-es/_createBaseEach.js +15 -0
  87. package/dist/node_modules/lodash-es/_createRange.js +11 -0
  88. package/dist/node_modules/lodash-es/_equalArrays.js +40 -0
  89. package/dist/node_modules/lodash-es/_equalByTag.js +45 -0
  90. package/dist/node_modules/lodash-es/_equalObjects.js +36 -0
  91. package/dist/node_modules/lodash-es/_getAllKeys.js +9 -0
  92. package/dist/node_modules/lodash-es/_getMatchData.js +12 -0
  93. package/dist/node_modules/lodash-es/_getSymbols.js +10 -0
  94. package/dist/node_modules/lodash-es/_getTag.js +28 -0
  95. package/dist/node_modules/lodash-es/_hasPath.js +19 -0
  96. package/dist/node_modules/lodash-es/_isFlattenable.js +10 -0
  97. package/dist/node_modules/lodash-es/_isKey.js +12 -0
  98. package/dist/node_modules/lodash-es/_isStrictComparable.js +7 -0
  99. package/dist/node_modules/lodash-es/_mapToArray.js +9 -0
  100. package/dist/node_modules/lodash-es/_matchesStrictComparable.js +8 -0
  101. package/dist/node_modules/lodash-es/_memoizeCapped.js +11 -0
  102. package/dist/node_modules/lodash-es/_nativeKeys.js +5 -0
  103. package/dist/node_modules/lodash-es/_setCacheAdd.js +7 -0
  104. package/dist/node_modules/lodash-es/_setCacheHas.js +6 -0
  105. package/dist/node_modules/lodash-es/_setToArray.js +9 -0
  106. package/dist/node_modules/lodash-es/_stringToPath.js +10 -0
  107. package/dist/node_modules/lodash-es/_toKey.js +10 -0
  108. package/dist/node_modules/lodash-es/_trimmedEndIndex.js +9 -0
  109. package/dist/node_modules/lodash-es/flatMap.js +8 -0
  110. package/dist/node_modules/lodash-es/get.js +8 -0
  111. package/dist/node_modules/lodash-es/hasIn.js +8 -0
  112. package/dist/node_modules/lodash-es/isSymbol.js +9 -0
  113. package/dist/node_modules/lodash-es/keys.js +9 -0
  114. package/dist/node_modules/lodash-es/keysIn.js +3 -3
  115. package/dist/node_modules/lodash-es/map.js +11 -0
  116. package/dist/node_modules/lodash-es/property.js +10 -0
  117. package/dist/node_modules/lodash-es/range.js +5 -0
  118. package/dist/node_modules/lodash-es/stubArray.js +6 -0
  119. package/dist/node_modules/lodash-es/toFinite.js +14 -0
  120. package/dist/node_modules/lodash-es/toNumber.js +22 -0
  121. package/dist/node_modules/lodash-es/toString.js +7 -0
  122. package/dist/package.json.js +1 -1
  123. package/dist/services/recommendationApi.js +13 -19
  124. package/dist/src/@types/generic.d.ts +1 -0
  125. package/dist/src/components/Guido.vue.d.ts +1 -0
  126. package/dist/src/components/organisms/onboarding/ItemsOnboarding.vue.d.ts +2 -0
  127. package/dist/src/composables/useGuidoActions.d.ts +9 -0
  128. package/dist/src/config/compiler/itemsCompilerRules.d.ts +2 -0
  129. package/dist/src/enums/onboarding.d.ts +4 -0
  130. package/dist/src/extensions/Blocks/Checkbox/block.d.ts +1 -0
  131. package/dist/src/extensions/Blocks/Items/block.d.ts +13 -0
  132. package/dist/src/extensions/Blocks/Items/controls/button/link.d.ts +14 -0
  133. package/dist/src/extensions/Blocks/Items/controls/cardComposition.d.ts +33 -0
  134. package/dist/src/extensions/Blocks/Items/controls/image/link.d.ts +14 -0
  135. package/dist/src/extensions/Blocks/Items/controls/index.d.ts +501 -0
  136. package/dist/src/extensions/Blocks/Items/controls/name/trimming.d.ts +14 -0
  137. package/dist/src/extensions/Blocks/Items/controls/price/currencyLocation.d.ts +19 -0
  138. package/dist/src/extensions/Blocks/Items/controls/price/currencySymbol.d.ts +21 -0
  139. package/dist/src/extensions/Blocks/Items/controls/price/formattedPrice.d.ts +14 -0
  140. package/dist/src/extensions/Blocks/Items/controls/price/hideDiscount.d.ts +13 -0
  141. package/dist/src/extensions/Blocks/Items/controls/settingsControl.d.ts +45 -0
  142. package/dist/src/extensions/Blocks/Items/enums/controlEnums.d.ts +61 -0
  143. package/dist/src/extensions/Blocks/Items/enums/productEnums.d.ts +161 -0
  144. package/dist/src/extensions/Blocks/Items/enums/settingsEnums.d.ts +49 -0
  145. package/dist/src/extensions/Blocks/Items/extension.d.ts +2 -0
  146. package/dist/src/extensions/Blocks/Items/iconsRegistry.d.ts +4 -0
  147. package/dist/src/extensions/Blocks/Items/settingsPanel.d.ts +4 -0
  148. package/dist/src/extensions/Blocks/Items/store/items-block.d.ts +41 -0
  149. package/dist/src/extensions/Blocks/Items/template.d.ts +16 -0
  150. package/dist/src/extensions/Blocks/Items/utils/configBlockUtils.d.ts +23 -0
  151. package/dist/src/extensions/Blocks/Items/utils/syncAttributeFromConfigBlock.d.ts +32 -0
  152. package/dist/src/extensions/Blocks/Items/utils/syncAttributesFromConfigBlock.d.ts +44 -0
  153. package/dist/src/extensions/Blocks/Items/utils/updateAttributes.d.ts +8 -0
  154. package/dist/src/extensions/Blocks/RadioButton/block.d.ts +1 -0
  155. package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +1 -1
  156. package/dist/src/extensions/Blocks/common-control.d.ts +44 -7
  157. package/dist/src/extensions/Blocks/controlFactories.d.ts +312 -0
  158. package/dist/src/stores/config.d.ts +2 -1
  159. package/dist/src/stores/dynamic-content.d.ts +1 -1
  160. package/dist/src/stores/editor.d.ts +1 -1
  161. package/dist/src/stores/onboarding.d.ts +335 -1
  162. package/dist/src/stores/preview.d.ts +1 -1
  163. package/dist/src/stores/recommendation.d.ts +1 -1
  164. package/dist/src/stores/save-as-template.d.ts +1 -1
  165. package/dist/src/stores/toaster.d.ts +1 -1
  166. package/dist/src/stores/unsubscribe.d.ts +1 -1
  167. package/dist/src/stores/version-history.d.ts +1 -1
  168. package/dist/src/utils/environmentUtil.d.ts +5 -0
  169. package/dist/src/utils/pairProductVariables.d.ts +7 -0
  170. package/dist/static/styles/customEditorStyle.css.js +1 -1
  171. package/dist/stores/config.js +5 -5
  172. package/dist/stores/dynamic-content.js +1 -1
  173. package/dist/stores/editor.js +1 -1
  174. package/dist/stores/onboarding.js +44 -36
  175. package/dist/stores/preview.js +1 -1
  176. package/dist/stores/recommendation.js +3 -3
  177. package/dist/stores/save-as-template.js +2 -2
  178. package/dist/stores/toaster.js +1 -1
  179. package/dist/stores/unsubscribe.js +1 -1
  180. package/dist/stores/version-history.js +4 -4
  181. package/dist/utils/environmentUtil.js +4 -0
  182. package/dist/utils/genericUtil.js +16 -17
  183. package/dist/utils/pairProductVariables.js +136 -0
  184. package/package.json +11 -4
@@ -0,0 +1,107 @@
1
+ var L = Object.defineProperty;
2
+ var R = (i, o, e) => o in i ? L(i, o, { enumerable: !0, configurable: !0, writable: !0, value: e }) : i[o] = e;
3
+ var p = (i, o, e) => R(i, typeof o != "symbol" ? o + "" : o, e);
4
+ import { currencyLocationMaps as m } from "../../../../../enums/extensions/recommendationBlock.js";
5
+ import { UEAttr as N, ModificationDescription as I } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
6
+ import { CommonControl as T } from "../../../common-control.js";
7
+ import { ItemsBlockControlId as h } from "../../enums/controlEnums.js";
8
+ import { useItemsBlockStore as E } from "../../store/items-block.js";
9
+ import { syncCurrencyLocationFromAttributes as f } from "../../utils/syncAttributesFromConfigBlock.js";
10
+ import { updateConfigBlockAttributes as O } from "../../utils/updateAttributes.js";
11
+ const b = h.PRICE_CURRENCY_LOCATION, a = {
12
+ CURRENCY_LOCATION: "currencyLocation"
13
+ };
14
+ class Y extends T {
15
+ constructor() {
16
+ super(...arguments);
17
+ p(this, "store", E());
18
+ }
19
+ getId() {
20
+ return b;
21
+ }
22
+ getTemplate() {
23
+ return `
24
+ <div class="${h.PRICE_CURRENCY_LOCATION}">
25
+ ${this._getCurrencyLocation()}
26
+ </div>
27
+ `;
28
+ }
29
+ onRender() {
30
+ this.api.setUIEAttribute(a.CURRENCY_LOCATION, N.SELECTPICKER.items, m), this.api.updateValues({ [a.CURRENCY_LOCATION]: this.store.currencyLocation }), this.api.onValueChanged(a.CURRENCY_LOCATION, (e) => {
31
+ this._onCurrencyLocationChange(e);
32
+ });
33
+ }
34
+ onTemplateNodeUpdated(e) {
35
+ super.onTemplateNodeUpdated(e), this.handleBlockInstanceChange(
36
+ () => f(this.currentNode),
37
+ () => {
38
+ this.api.updateValues({ [a.CURRENCY_LOCATION]: this.store.currencyLocation });
39
+ }
40
+ );
41
+ }
42
+ _onCurrencyLocationChange(e) {
43
+ if (console.debug("Currency location changed to: ", e), this.store.setCurrencyLocation(e), O(this.currentNode, this.api), !this.currentNode)
44
+ return;
45
+ const t = this._getPriceBlocks();
46
+ if (!t || t.length === 0)
47
+ return;
48
+ const r = e || "0", { currencySymbol: n } = this.store;
49
+ t.forEach((c) => {
50
+ const s = this._getParagraph(c);
51
+ if (!s)
52
+ return;
53
+ const u = s.getInnerHTML() || "", l = s.getInnerText() || "", C = (n == null ? void 0 : n.trim()) || "", d = this._removeCurrencySymbol(l, C), g = this._detectSymbolInText(l) || C, _ = this._buildPriceContent(d, g, r), y = u.replace(l, _);
54
+ this.api.getDocumentModifier().modifyHtml(s).setInnerHtml(y).apply(new I(
55
+ `Updated currency location to ${r === "1" ? "after" : "before"}`
56
+ ));
57
+ });
58
+ }
59
+ _getPriceBlocks() {
60
+ var e, t;
61
+ return ((t = (e = this.currentNode) == null ? void 0 : e.closest(".items-block")) == null ? void 0 : t.querySelectorAll(".items-block-price")) || [];
62
+ }
63
+ _getParagraph(e) {
64
+ return e.querySelector("p");
65
+ }
66
+ _escapeRegex(e) {
67
+ return e.replace(/[-\\^$*+?().|[\]{}]/g, "\\$&");
68
+ }
69
+ _removeCurrencySymbol(e, t) {
70
+ const r = e || "";
71
+ let n = r;
72
+ if (t) {
73
+ const c = new RegExp(`\\s*${this._escapeRegex(t)}\\s*`);
74
+ n = r.replace(c, "").trim();
75
+ } else {
76
+ const c = r.match(/([^0-9.,\s]+)/);
77
+ if (c && c[1]) {
78
+ const s = c[1].trim(), u = new RegExp(`\\s*${this._escapeRegex(s)}\\s*`);
79
+ n = r.replace(u, "").trim();
80
+ }
81
+ }
82
+ return n;
83
+ }
84
+ _detectSymbolInText(e) {
85
+ const t = e.match(/([^0-9.,\s]+)/);
86
+ return t && t[1] ? t[1].trim() : "";
87
+ }
88
+ _buildPriceContent(e, t, r) {
89
+ return t ? r === "1" ? `${e}&nbsp;${t}` : `${t}&nbsp;${e}` : e;
90
+ }
91
+ _getCurrencyLocation() {
92
+ return `
93
+ ${this._GuTwoColumns([
94
+ this._GuLabel({ text: "Currency Location" }),
95
+ this._GuSelect({
96
+ name: a.CURRENCY_LOCATION,
97
+ placeholder: "",
98
+ options: m
99
+ })
100
+ ])}
101
+ `;
102
+ }
103
+ }
104
+ export {
105
+ b as CONTROL_BLOCK_ID,
106
+ Y as PriceCurrencyLocationControl
107
+ };
@@ -0,0 +1,123 @@
1
+ var S = Object.defineProperty;
2
+ var _ = (c, s, e) => s in c ? S(c, s, { enumerable: !0, configurable: !0, writable: !0, value: e }) : c[s] = e;
3
+ var u = (c, s, e) => _(c, typeof s != "symbol" ? s + "" : s, e);
4
+ import { ModificationDescription as b } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
5
+ import { CommonControl as R } from "../../../common-control.js";
6
+ import { ItemsBlockControlId as h } from "../../enums/controlEnums.js";
7
+ import { useItemsBlockStore as f } from "../../store/items-block.js";
8
+ import { syncCurrencySymbolFromAttributes as N } from "../../utils/syncAttributesFromConfigBlock.js";
9
+ import { updateConfigBlockAttributes as B } from "../../utils/updateAttributes.js";
10
+ const E = h.PRICE_CURRENCY_SYMBOL, m = {
11
+ CURRENCY_SYMBOL: "currencySymbol"
12
+ };
13
+ class P extends R {
14
+ constructor() {
15
+ super(...arguments);
16
+ u(this, "store", f());
17
+ u(this, "originalPriceContents", /* @__PURE__ */ new Map());
18
+ }
19
+ getId() {
20
+ return E;
21
+ }
22
+ getTemplate() {
23
+ return `
24
+ <div class="${h.PRICE_CURRENCY_SYMBOL}">
25
+ ${this._getCurrencySymbol()}
26
+ </div>
27
+ `;
28
+ }
29
+ onRender() {
30
+ this.api.updateValues({ [m.CURRENCY_SYMBOL]: this.store.currencySymbol }), this._storeOriginalContents(), this.api.onValueChanged(m.CURRENCY_SYMBOL, (e) => {
31
+ this._onCurrencySymbolChange(e);
32
+ });
33
+ }
34
+ onDestroy() {
35
+ super.onDestroy(), this.originalPriceContents.clear();
36
+ }
37
+ onTemplateNodeUpdated(e) {
38
+ super.onTemplateNodeUpdated(e), this.handleBlockInstanceChange(
39
+ () => N(this.currentNode),
40
+ () => {
41
+ this.api.updateValues({ [m.CURRENCY_SYMBOL]: this.store.currencySymbol }), this._storeOriginalContents();
42
+ }
43
+ );
44
+ }
45
+ _onCurrencySymbolChange(e) {
46
+ var i;
47
+ console.debug("Currency symbol changed to: ", e);
48
+ const r = ((i = this.store.currencySymbol) == null ? void 0 : i.trim()) || "";
49
+ if (this.store.setCurrencySymbol(e), B(this.currentNode, this.api), !this.currentNode)
50
+ return;
51
+ const t = this._getPriceBlocks();
52
+ if (!t || t.length === 0)
53
+ return;
54
+ const o = (e == null ? void 0 : e.trim()) || "", { currencyLocation: n } = this.store;
55
+ t.forEach((l) => {
56
+ const a = this._getParagraph(l);
57
+ if (!a)
58
+ return;
59
+ const y = a.getInnerHTML() || "", p = a.getInnerText() || "", C = this._removeCurrencySymbol(p, r), g = this._buildPriceContent(C, o, n), d = y.replace(p, g);
60
+ this.api.getDocumentModifier().modifyHtml(a).setInnerHtml(d).apply(new b(
61
+ `Updated currency symbol to ${o || "removed"}`
62
+ ));
63
+ });
64
+ }
65
+ _storeOriginalContents() {
66
+ if (!this.currentNode)
67
+ return;
68
+ this.currentNode.querySelectorAll(
69
+ ".items-block-price"
70
+ ).forEach((r) => {
71
+ var o;
72
+ const t = r.querySelector("p");
73
+ if (t && !this.originalPriceContents.has(t)) {
74
+ const n = t.getInnerText() || "", i = ((o = this.store.currencySymbol) == null ? void 0 : o.trim()) || "", l = this._removeCurrencySymbol(n, i);
75
+ this.originalPriceContents.set(t, l);
76
+ }
77
+ });
78
+ }
79
+ _getPriceBlocks() {
80
+ var e, r;
81
+ return ((r = (e = this.currentNode) == null ? void 0 : e.closest(".items-block")) == null ? void 0 : r.querySelectorAll(".items-block-price")) || [];
82
+ }
83
+ _getParagraph(e) {
84
+ return e.querySelector("p");
85
+ }
86
+ _escapeRegex(e) {
87
+ return e.replace(/[-\\^$*+?().|[\]{}]/g, "\\$&");
88
+ }
89
+ _removeCurrencySymbol(e, r) {
90
+ const t = e || "";
91
+ let o = t;
92
+ if (r) {
93
+ const n = new RegExp(`\\s*${this._escapeRegex(r)}\\s*`);
94
+ o = t.replace(n, "").trim();
95
+ } else {
96
+ const n = t.match(/([^0-9.,\s]+)/);
97
+ if (n && n[1]) {
98
+ const i = n[1].trim(), l = new RegExp(`\\s*${this._escapeRegex(i)}\\s*`);
99
+ o = t.replace(l, "").trim();
100
+ }
101
+ }
102
+ return o;
103
+ }
104
+ _buildPriceContent(e, r, t) {
105
+ return r ? t === "1" ? `${e}&nbsp;${r}` : `${r}&nbsp;${e}` : e;
106
+ }
107
+ _getCurrencySymbol() {
108
+ return `
109
+ ${this._GuTwoColumns([
110
+ this._GuLabel({ text: "Currency Symbol" }),
111
+ this._GuTextInput({
112
+ name: m.CURRENCY_SYMBOL,
113
+ placeholder: "Enter Currency Symbol",
114
+ className: "es-180w"
115
+ })
116
+ ])}
117
+ `;
118
+ }
119
+ }
120
+ export {
121
+ E as CONTROL_BLOCK_ID,
122
+ P as PriceCurrencySymbolControl
123
+ };
@@ -0,0 +1,76 @@
1
+ var _ = Object.defineProperty;
2
+ var I = (r, e, t) => e in r ? _(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
3
+ var P = (r, e, t) => I(r, typeof e != "symbol" ? e + "" : e, t);
4
+ import { ModificationDescription as F, UIElementType as m, UEAttr as C } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
5
+ import { CommonControl as h } from "../../../common-control.js";
6
+ import { ItemsBlockControlId as l, ItemsBlockId as A } from "../../enums/controlEnums.js";
7
+ import { productPairs as T } from "../../enums/productEnums.js";
8
+ import { useItemsBlockStore as u } from "../../store/items-block.js";
9
+ import { syncFormattedPriceFromAttributes as g } from "../../utils/syncAttributesFromConfigBlock.js";
10
+ import { updateConfigBlockAttributes as D } from "../../utils/updateAttributes.js";
11
+ const f = l.PRICE_FORMATTED_PRICE, n = {
12
+ FORMATTED_PRICE: "formattedPrice"
13
+ };
14
+ class y extends h {
15
+ constructor() {
16
+ super(...arguments);
17
+ P(this, "store", u());
18
+ }
19
+ getId() {
20
+ return f;
21
+ }
22
+ getTemplate() {
23
+ return `
24
+ <div class="${l.PRICE_FORMATTED_PRICE}">
25
+ ${this._getFormattedPrice()}
26
+ </div>
27
+ `;
28
+ }
29
+ onRender() {
30
+ this.api.updateValues({ [n.FORMATTED_PRICE]: this.store.formattedPrice }), this.api.onValueChanged(n.FORMATTED_PRICE, (t) => {
31
+ this._onFormattedPriceChange(t);
32
+ });
33
+ }
34
+ onTemplateNodeUpdated(t) {
35
+ super.onTemplateNodeUpdated(t), this.handleBlockInstanceChange(
36
+ () => g(this.currentNode),
37
+ () => {
38
+ this.api.updateValues({ [n.FORMATTED_PRICE]: this.store.formattedPrice });
39
+ }
40
+ );
41
+ }
42
+ _onFormattedPriceChange(t) {
43
+ if (console.debug("Formatted price changed to: ", t), this.store.setFormattedPrice(t), D(this.currentNode, this.api), !this.currentNode)
44
+ return;
45
+ const { itemsType: s } = this.store, i = T.PAIRS_FOR_EXTENSION.price[s], o = T.PAIRS_FOR_EXTENSION.originalPrice[s], [c, a] = t ? [i.DEFAULT_PRICE, i.DEFAULT_PRICE_FORMATTED] : [i.DEFAULT_PRICE_FORMATTED, i.DEFAULT_PRICE], [p, R] = t ? [o.DEFAULT_PRICE, o.DEFAULT_PRICE_FORMATTED] : [o.DEFAULT_PRICE_FORMATTED, o.DEFAULT_PRICE];
46
+ this._updatePriceBlock(
47
+ this.currentNode,
48
+ c,
49
+ a,
50
+ "price"
51
+ );
52
+ const d = this.currentNode.closest(".items-block"), E = d == null ? void 0 : d.querySelector(`[esd-extension-block-id="${A.ORIGINAL_PRICE}"]`);
53
+ E && this._updatePriceBlock(E, p, R, "original price");
54
+ }
55
+ _updatePriceBlock(t, s, i, o) {
56
+ const c = t.getInnerHTML().replace(s, i), a = `Updated ${o} to ${this.store.formattedPrice ? "formatted" : "unformatted"}`;
57
+ this.api.getDocumentModifier().modifyHtml(t).setInnerHtml(c).apply(new F(a));
58
+ }
59
+ _getFormattedPrice() {
60
+ return `
61
+ <div class="container">
62
+ <div class="display-flex align-items-center justify-content-between">
63
+ <${m.LABEL}
64
+ ${C.LABEL.text}="${this.api.translate("Formatted Price (e.g. $9.90)")}"
65
+ >
66
+ </${m.LABEL}>
67
+ ${this._GuToggle(n.FORMATTED_PRICE)}
68
+ </div>
69
+ </div>
70
+ `;
71
+ }
72
+ }
73
+ export {
74
+ f as CONTROL_BLOCK_ID,
75
+ y as PriceFormattedPriceControl
76
+ };
@@ -0,0 +1,61 @@
1
+ var d = Object.defineProperty;
2
+ var a = (i, e, t) => e in i ? d(i, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : i[e] = t;
3
+ var o = (i, e, t) => a(i, typeof e != "symbol" ? e + "" : e, t);
4
+ import { UIElementType as n, UEAttr as c } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
5
+ import { CommonControl as u } from "../../../common-control.js";
6
+ import { ItemsBlockControlId as r } from "../../enums/controlEnums.js";
7
+ import { useItemsBlockStore as D } from "../../store/items-block.js";
8
+ import { syncHideDiscountFromAttributes as p } from "../../utils/syncAttributesFromConfigBlock.js";
9
+ import { updateConfigBlockAttributes as I } from "../../utils/updateAttributes.js";
10
+ const l = r.PRICE_HIDE_DISCOUNT, s = {
11
+ HIDE_DISCOUNT: "hideDiscount"
12
+ };
13
+ class N extends u {
14
+ constructor() {
15
+ super(...arguments);
16
+ o(this, "store", D());
17
+ }
18
+ getId() {
19
+ return l;
20
+ }
21
+ getTemplate() {
22
+ return `
23
+ <div class="${r.PRICE_HIDE_DISCOUNT}">
24
+ ${this._getHideDiscount()}
25
+ </div>
26
+ `;
27
+ }
28
+ onRender() {
29
+ this.api.updateValues({ [s.HIDE_DISCOUNT]: this.store.hideDiscount }), this.api.onValueChanged(s.HIDE_DISCOUNT, (t) => {
30
+ this._onHideDiscountChange(t);
31
+ });
32
+ }
33
+ onTemplateNodeUpdated(t) {
34
+ super.onTemplateNodeUpdated(t), this.handleBlockInstanceChange(
35
+ () => p(this.currentNode),
36
+ () => {
37
+ this.api.updateValues({ [s.HIDE_DISCOUNT]: this.store.hideDiscount });
38
+ }
39
+ );
40
+ }
41
+ _onHideDiscountChange(t) {
42
+ this.store.setHideDiscount(t), I(this.currentNode, this.api), this.api.updateValues({ [s.HIDE_DISCOUNT]: t });
43
+ }
44
+ _getHideDiscount() {
45
+ return `
46
+ <div class="container">
47
+ <div class="display-flex align-items-center justify-content-between">
48
+ <${n.LABEL}
49
+ ${c.LABEL.text}="${this.api.translate("Hide if same as discounted ")}"
50
+ >
51
+ </${n.LABEL}>
52
+ ${this._GuToggle(s.HIDE_DISCOUNT)}
53
+ </div>
54
+ </div>
55
+ `;
56
+ }
57
+ }
58
+ export {
59
+ l as CONTROL_BLOCK_ID,
60
+ N as PriceHideDiscountControl
61
+ };
@@ -0,0 +1,309 @@
1
+ var A = Object.defineProperty;
2
+ var M = (T, u, e) => u in T ? A(T, u, { enumerable: !0, configurable: !0, writable: !0, value: e }) : T[u] = e;
3
+ var b = (T, u, e) => M(T, typeof u != "symbol" ? u + "" : u, e);
4
+ import { UEAttr as C, ModificationDescription as d } from "../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
5
+ import { CommonControl as P } from "../../common-control.js";
6
+ import { ItemsBlockId as m } from "../enums/controlEnums.js";
7
+ import { productPairs as p } from "../enums/productEnums.js";
8
+ import { ItemTypeOptions as R, OrientationOptions as D, ItemInCartOptions as y, SETTINGS_ENUMS as S } from "../enums/settingsEnums.js";
9
+ import x from "../layouts/horizontal.html.js";
10
+ import L from "../layouts/vertical.html.js";
11
+ import { useItemsBlockStore as H } from "../store/items-block.js";
12
+ import { getDefaultTemplate as U } from "../template.js";
13
+ import { updateConfigBlockAttributes as f } from "../utils/updateAttributes.js";
14
+ const $ = "ui-elements-items-block", s = {
15
+ ITEMS_TYPE: "itemsType",
16
+ ORIENTATION: "orientation",
17
+ ITEM_IDS: "itemIds"
18
+ };
19
+ class W extends P {
20
+ constructor() {
21
+ super(...arguments);
22
+ b(this, "store", H());
23
+ }
24
+ getId() {
25
+ return $;
26
+ }
27
+ getTemplate() {
28
+ return `
29
+ <div class="items-controls-container">
30
+ ${this._getItemsType()}
31
+ ${this._getItemInCart()}
32
+ ${this._getOrientation()}
33
+ </div>
34
+ `;
35
+ }
36
+ onRender() {
37
+ this.api.updateValues({
38
+ [s.ORIENTATION]: this.store.orientation,
39
+ [s.ITEMS_TYPE]: this.store.itemsType,
40
+ [s.ITEM_IDS]: this.store.itemIds
41
+ }), this._listenToFormUpdates();
42
+ }
43
+ onTemplateNodeUpdated(e) {
44
+ this.currentNode = e, this.api.updateValues({
45
+ [s.ORIENTATION]: this.store.orientation,
46
+ [s.ITEMS_TYPE]: this.store.itemsType,
47
+ [s.ITEM_IDS]: this.store.itemIds
48
+ }), this._initializeSelectItems();
49
+ }
50
+ onDestroy() {
51
+ const e = this._getTemplateData();
52
+ this.store.setTemplateData(e);
53
+ }
54
+ _getItemsType() {
55
+ return `
56
+ ${this._GuOneColumn([
57
+ this._GuLabel({ text: "Item Type" }),
58
+ this._GuSelect({
59
+ name: s.ITEMS_TYPE,
60
+ className: "es-100",
61
+ placeholder: "Select Item Type",
62
+ options: R
63
+ })
64
+ ])}
65
+ `;
66
+ }
67
+ _getOrientation() {
68
+ return `
69
+ ${this._GuTwoColumns([
70
+ this._GuLabel({ text: "Orientation" }),
71
+ this._GuRadioButton({
72
+ name: s.ORIENTATION,
73
+ buttons: D
74
+ })
75
+ ])}
76
+ `;
77
+ }
78
+ _getItemInCart() {
79
+ return `
80
+ ${this._GuTwoColumns([
81
+ this._GuLabel({ text: "Item in Cart" }),
82
+ this._GuSelect({
83
+ name: s.ITEM_IDS,
84
+ className: "es-100",
85
+ placeholder: "Select Item In Cart",
86
+ options: []
87
+ })
88
+ ])}
89
+ `;
90
+ }
91
+ _onOrientationChange(e) {
92
+ console.debug("Orientation changed to: ", e), this.store.setOrientation(e), this.api.updateValues({ [s.ORIENTATION]: e }), f(this.currentNode, this.api), this._reOrderTemplate(), this._recalculateTrimming();
93
+ }
94
+ _onItemsTypeChange(e, i) {
95
+ const { itemIds: t } = this.store, r = S.ITEMS_TYPE[e], n = y[i].findIndex((a) => a.value === t), o = y[e][n];
96
+ r && (this.store.setItemsType(r), this.store.setItemIds(o.value), f(this.currentNode, this.api), this._updateDataTypeAttributes(r), this._initializeSelectItems(), this._reFillTemplate());
97
+ }
98
+ _onItemIdsChange(e) {
99
+ console.debug("Item ids changed to: ", e), this.store.setItemIds(e), this.api.updateValues({ [s.ITEM_IDS]: e }), f(this.currentNode, this.api), this._updateDataNumberAttributes(e), this._reFillTemplate();
100
+ }
101
+ _initializeSelectItems() {
102
+ this.api.setUIEAttribute(
103
+ s.ITEMS_TYPE,
104
+ C.SELECTPICKER.items,
105
+ R
106
+ );
107
+ const { itemsType: e, itemIds: i } = this.store;
108
+ this.api.updateValues({
109
+ [s.ITEMS_TYPE]: e
110
+ });
111
+ const t = y[e];
112
+ this.api.setUIEAttribute(
113
+ s.ITEM_IDS,
114
+ C.SELECTPICKER.items,
115
+ t
116
+ ), this.api.updateValues({
117
+ [s.ITEM_IDS]: i
118
+ });
119
+ }
120
+ _listenToFormUpdates() {
121
+ this.api.onValueChanged(
122
+ s.ITEMS_TYPE,
123
+ (e, i) => this._onItemsTypeChange(e, i)
124
+ ), this.api.onValueChanged(
125
+ s.ORIENTATION,
126
+ (e) => this._onOrientationChange(e)
127
+ ), this.api.onValueChanged(
128
+ s.ITEM_IDS,
129
+ (e) => this._onItemIdsChange(e)
130
+ );
131
+ }
132
+ _renderTemplate() {
133
+ const {
134
+ orientation: e,
135
+ itemsType: i,
136
+ itemIds: t,
137
+ currencySymbol: r,
138
+ currencyLocation: n,
139
+ formattedPrice: o
140
+ } = this.store;
141
+ this.api.getDocumentModifier().modifyHtml(this.currentNode).setInnerHtml(U({
142
+ orientation: e,
143
+ itemsType: i,
144
+ itemId: t,
145
+ currencySymbol: r,
146
+ currencyLocation: n,
147
+ formattedPrice: o
148
+ })).apply(new d("Updated template"));
149
+ }
150
+ _getTemplateData() {
151
+ const { itemsType: e, itemIds: i, formattedPrice: t } = this.store, r = y[e].findIndex((o) => o.value === i), n = r > -1 ? r : 0;
152
+ return {
153
+ imageSrc: p.PAIRS_FOR_EXTENSION.imageSrc[e].DEFAULT[n],
154
+ name: p.PAIRS_FOR_EXTENSION.name[e].DEFAULT[n],
155
+ price: t ? p.PAIRS_FOR_EXTENSION.price[e].DEFAULT_PRICE_FORMATTED : p.PAIRS_FOR_EXTENSION.price[e].DEFAULT_PRICE,
156
+ originalPrice: t ? p.PAIRS_FOR_EXTENSION.originalPrice[e].DEFAULT_PRICE_FORMATTED : p.PAIRS_FOR_EXTENSION.originalPrice[e].DEFAULT_PRICE,
157
+ quantity: p.PAIRS_FOR_EXTENSION.quantity[e].DEFAULT,
158
+ button: p.PAIRS_FOR_EXTENSION.button[e].DEFAULT_LABEL
159
+ };
160
+ }
161
+ _updateImageSrc(e) {
162
+ var t;
163
+ const i = (t = this.currentNode) == null ? void 0 : t.querySelector(`[esd-extension-block-id="${m.IMAGE}"] img`);
164
+ i && this.api.getDocumentModifier().modifyHtml(i).setAttribute("src", e).apply(new d("Updated image src"));
165
+ }
166
+ _updateName(e) {
167
+ var n;
168
+ const i = (n = this.currentNode) == null ? void 0 : n.querySelector(`[esd-extension-block-id="${m.NAME}"]`);
169
+ if (!i)
170
+ return;
171
+ const t = i.getInnerText().trim();
172
+ let r = i.getInnerHTML();
173
+ r = r.replace(t, e), this.api.getDocumentModifier().modifyHtml(i).setInnerHtml(r).apply(new d("Updated name"));
174
+ }
175
+ _updatePrice(e) {
176
+ var g;
177
+ const i = (g = this.currentNode) == null ? void 0 : g.querySelector(`[esd-extension-block-id="${m.PRICE}"]`);
178
+ if (!i)
179
+ return;
180
+ const t = this._getParagraphFromBlock(i);
181
+ if (!t)
182
+ return;
183
+ const r = t.getInnerHTML() || "", n = t.getInnerText() || "", { currencySymbol: o, currencyLocation: a } = this.store, l = (o == null ? void 0 : o.trim()) || "", c = this._removeCurrencySymbol(n, l), I = this._replacePriceNumber(c, e), h = this._buildPriceContent(I, l, a), _ = r.replace(n, h);
184
+ this.api.getDocumentModifier().modifyHtml(t).setInnerHtml(_).apply(new d("Updated price"));
185
+ }
186
+ _updateOriginalPrice(e) {
187
+ var E;
188
+ const i = (E = this.currentNode) == null ? void 0 : E.querySelector(
189
+ `[esd-extension-block-id="${m.ORIGINAL_PRICE}"]`
190
+ );
191
+ if (!i)
192
+ return;
193
+ const t = this._getParagraphFromBlock(i);
194
+ if (!t)
195
+ return;
196
+ const r = t.querySelector("s");
197
+ if (!r)
198
+ return;
199
+ const n = r.getInnerHTML() || "", o = r.getInnerText() || "", { currencySymbol: a, currencyLocation: l } = this.store, c = (a == null ? void 0 : a.trim()) || "", I = this._removeCurrencySymbol(o, c), h = this._replacePriceNumber(I, e), _ = this._buildPriceContent(h, c, l), N = `<s>${n.replace(o, _)}</s>`;
200
+ this.api.getDocumentModifier().modifyHtml(t).setInnerHtml(N).apply(new d("Updated original price"));
201
+ }
202
+ _updateQuantity(e) {
203
+ var a;
204
+ const i = this.store.itemsType !== S.ITEMS_TYPE.BROWSED_ITEMS, t = (a = this.currentNode) == null ? void 0 : a.querySelector(`[esd-extension-block-id="${m.QUANTITY}"]`);
205
+ if (!t)
206
+ return;
207
+ const r = t.getStyle("display") === "none", n = t.getInnerText().trim();
208
+ let o = t.getInnerHTML();
209
+ o = o.replace(n, e), this.api.getDocumentModifier().modifyHtml(t).setInnerHtml(o).setStyle("display", i && !r ? "table-cell" : "none").apply(new d("Updated quantity"));
210
+ }
211
+ _updateButton(e) {
212
+ var n;
213
+ const i = (n = this.currentNode) == null ? void 0 : n.querySelector(`[esd-extension-block-id="${m.BUTTON}"]`);
214
+ if (!i)
215
+ return;
216
+ const t = i.getInnerText().trim();
217
+ let r = i.getInnerHTML();
218
+ r = r.replace(t, e), this.api.getDocumentModifier().modifyHtml(i).setInnerHtml(r).apply(new d("Updated button"));
219
+ }
220
+ _reOrderTemplate() {
221
+ var I, h, _, g, N, E, O;
222
+ const e = (I = this.currentNode) == null ? void 0 : I.querySelector(`[esd-extension-block-id="${m.IMAGE}"]`), i = (h = this.currentNode) == null ? void 0 : h.querySelector(`[esd-extension-block-id="${m.NAME}"]`), t = (_ = this.currentNode) == null ? void 0 : _.querySelector(`[esd-extension-block-id="${m.PRICE}"]`), r = (g = this.currentNode) == null ? void 0 : g.querySelector(
223
+ `[esd-extension-block-id="${m.ORIGINAL_PRICE}"]`
224
+ ), n = (N = this.currentNode) == null ? void 0 : N.querySelector(`[esd-extension-block-id="${m.QUANTITY}"]`), o = (E = this.currentNode) == null ? void 0 : E.querySelector(`[esd-extension-block-id="${m.BUTTON}"]`), a = (O = this.currentNode) == null ? void 0 : O.querySelector("esd-config-block");
225
+ if (!e || !i || !t || !r || !n || !o || !a)
226
+ return;
227
+ const { orientation: l } = this.store;
228
+ let c = l === S.ORIENTATION.VERTICAL ? L : x;
229
+ c = c.replace("{-{-PRODUCT_IMAGE-}-}", e.getOuterHTML()).replace("{-{-PRODUCT_NAME-}-}", i.getOuterHTML()).replace("{-{-PRODUCT_PRICE-}-}", t.getOuterHTML()).replace("{-{-PRODUCT_ORIGINAL_PRICE-}-}", r.getOuterHTML()).replace("{-{-PRODUCT_QUANTITY-}-}", n.getOuterHTML()).replace("{-{-PRODUCT_BUTTON-}-}", o.getOuterHTML()).replace("{-{-CONFIG_BLOCK-}-}", a.getOuterHTML()), c = c.trim().replace('<td align="center" class="ins-product-td items-block">', "").slice(0, -5), this.api.getDocumentModifier().modifyHtml(this.currentNode).setInnerHtml(c).apply(new d("Reordered template"));
230
+ }
231
+ _updateDataTypeAttributes(e) {
232
+ if (!this.currentNode)
233
+ return;
234
+ const i = this.currentNode.closest(".ins-product-td"), t = this.api.getDocumentModifier();
235
+ i && t.modifyHtml(i).setAttribute("data-type", e), this.currentNode.querySelectorAll("[data-type]").forEach((n) => {
236
+ const o = n;
237
+ t.modifyHtml(o).setAttribute("data-type", e);
238
+ }), t.apply(new d("Updated data-type attribute"));
239
+ }
240
+ _updateDataNumberAttributes(e) {
241
+ if (!this.currentNode)
242
+ return;
243
+ const { itemsType: i } = this.store, t = y[i].findIndex((l) => l.value === e);
244
+ let r = "1";
245
+ if (t >= 0)
246
+ r = String(t + 1);
247
+ else if (e) {
248
+ const l = e.match(/\((\d+)\)/);
249
+ if (l) {
250
+ const [, c] = l;
251
+ r = c;
252
+ }
253
+ }
254
+ const n = this.currentNode.closest(".ins-product-td"), o = this.api.getDocumentModifier();
255
+ n && o.modifyHtml(n).setAttribute("data-number", r), this.currentNode.querySelectorAll("[data-number]").forEach((l) => {
256
+ const c = l;
257
+ o.modifyHtml(c).setAttribute("data-number", r);
258
+ }), o.apply(new d("Updated data-number attribute"));
259
+ }
260
+ _reFillTemplate() {
261
+ const e = this._getTemplateData();
262
+ this._updateImageSrc(e.imageSrc), this._updateName(e.name), this._updatePrice(e.price), this._updateOriginalPrice(e.originalPrice), this._updateQuantity(e.quantity), this._updateButton(e.button);
263
+ }
264
+ _recalculateTrimming() {
265
+ var r;
266
+ if (!this.store.nameTrimming || !this.currentNode)
267
+ return;
268
+ const e = (r = this.currentNode) == null ? void 0 : r.querySelector(`[esd-extension-block-id="${m.NAME}"]`);
269
+ if (!e)
270
+ return;
271
+ const i = e.querySelector("p");
272
+ if (!i)
273
+ return;
274
+ const t = this.store.orientation === S.ORIENTATION.VERTICAL;
275
+ this.api.getDocumentModifier().modifyHtml(i).setStyle("white-space", "nowrap").setStyle("overflow", "hidden").setStyle("text-overflow", "ellipsis").setStyle("max-width", t ? "130px" : "100%").apply(new d("Recalculated trimming after orientation change"));
276
+ }
277
+ _getParagraphFromBlock(e) {
278
+ return e.querySelector("p");
279
+ }
280
+ _escapeRegex(e) {
281
+ return e.replace(/[-\\^$*+?().|[\]{}]/g, "\\$&");
282
+ }
283
+ _removeCurrencySymbol(e, i) {
284
+ const t = e || "";
285
+ let r = t;
286
+ if (i) {
287
+ const n = new RegExp(`\\s*${this._escapeRegex(i)}\\s*`);
288
+ r = t.replace(n, "").trim();
289
+ } else {
290
+ const n = t.match(/([^0-9.,\s]+)/);
291
+ if (n && n[1]) {
292
+ const o = n[1].trim(), a = new RegExp(`\\s*${this._escapeRegex(o)}\\s*`);
293
+ r = t.replace(a, "").trim();
294
+ }
295
+ }
296
+ return r;
297
+ }
298
+ _replacePriceNumber(e, i) {
299
+ const t = /([0-9][0-9,.]*)/;
300
+ return e.replace(t, i).trim();
301
+ }
302
+ _buildPriceContent(e, i, t) {
303
+ return i ? t === "1" ? `${e}&nbsp;${i}&nbsp;` : `${i}&nbsp;${e}` : e;
304
+ }
305
+ }
306
+ export {
307
+ $ as CONTROL_BLOCK_ID,
308
+ W as ItemsBlockControl
309
+ };