@useinsider/guido 1.0.3-beta.0d0bb85 → 1.0.3-beta.0da597d

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 (118) hide show
  1. package/README.md +172 -3
  2. package/dist/components/Guido.vue.js +1 -1
  3. package/dist/components/Guido.vue2.js +79 -73
  4. package/dist/components/organisms/header/LeftSlot.vue.js +1 -1
  5. package/dist/components/organisms/header/LeftSlot.vue2.js +16 -15
  6. package/dist/components/organisms/header/RightSlot.vue.js +11 -11
  7. package/dist/components/organisms/header/RightSlot.vue2.js +23 -22
  8. package/dist/composables/useBlocksConfig.js +48 -0
  9. package/dist/composables/useGuidoActions.js +19 -9
  10. package/dist/composables/useStripo.js +50 -59
  11. package/dist/config/compiler/unsubscribeCompilerRules.js +33 -28
  12. package/dist/enums/defaults.js +16 -9
  13. package/dist/enums/extensions/recommendationBlock.js +2 -2
  14. package/dist/enums/unsubscribe.js +10 -9
  15. package/dist/extensions/Blocks/Checkbox/block.js +5 -2
  16. package/dist/extensions/Blocks/Checkbox/extension.js +2 -2
  17. package/dist/extensions/Blocks/CouponBlock/extension.js +2 -2
  18. package/dist/extensions/Blocks/Items/block.js +66 -0
  19. package/dist/extensions/Blocks/Items/controls/button/link.js +68 -0
  20. package/dist/extensions/Blocks/Items/controls/cardComposition.js +99 -0
  21. package/dist/extensions/Blocks/Items/controls/image/link.js +68 -0
  22. package/dist/extensions/Blocks/Items/controls/index.js +217 -0
  23. package/dist/extensions/Blocks/Items/controls/name/trimming.js +70 -0
  24. package/dist/extensions/Blocks/Items/controls/price/currencyLocation.js +107 -0
  25. package/dist/extensions/Blocks/Items/controls/price/currencySymbol.js +123 -0
  26. package/dist/extensions/Blocks/Items/controls/price/formattedPrice.js +76 -0
  27. package/dist/extensions/Blocks/Items/controls/price/hideDiscount.js +61 -0
  28. package/dist/extensions/Blocks/Items/controls/settingsControl.js +280 -0
  29. package/dist/extensions/Blocks/Items/enums/controlEnums.js +5 -0
  30. package/dist/extensions/Blocks/Items/enums/productEnums.js +195 -0
  31. package/dist/extensions/Blocks/Items/enums/settingsEnums.js +70 -0
  32. package/dist/extensions/Blocks/Items/extension.js +19 -0
  33. package/dist/extensions/Blocks/Items/iconsRegistry.js +32 -0
  34. package/dist/extensions/Blocks/Items/items.css.js +23 -0
  35. package/dist/extensions/Blocks/Items/layouts/horizontal.html.js +61 -0
  36. package/dist/extensions/Blocks/Items/layouts/vertical.html.js +61 -0
  37. package/dist/extensions/Blocks/Items/settingsPanel.js +106 -0
  38. package/dist/extensions/Blocks/Items/store/items-block.js +71 -0
  39. package/dist/extensions/Blocks/Items/template.js +110 -0
  40. package/dist/extensions/Blocks/Items/utils/configBlockUtils.js +17 -0
  41. package/dist/extensions/Blocks/Items/utils/syncAttributeFromConfigBlock.js +28 -0
  42. package/dist/extensions/Blocks/Items/utils/syncAttributesFromConfigBlock.js +67 -0
  43. package/dist/extensions/Blocks/Items/utils/updateAttributes.js +44 -0
  44. package/dist/extensions/Blocks/RadioButton/block.js +5 -2
  45. package/dist/extensions/Blocks/Recommendation/extension.js +4 -4
  46. package/dist/extensions/Blocks/Recommendation/iconsRegistry.js +43 -43
  47. package/dist/extensions/Blocks/Recommendation/store/recommendation.js +1 -1
  48. package/dist/extensions/Blocks/Recommendation/templates/blockTemplate.js +4 -4
  49. package/dist/extensions/Blocks/common-control.js +174 -110
  50. package/dist/extensions/Blocks/controlFactories.js +223 -0
  51. package/dist/extensions/DynamicContent/dynamic-content-modal.js +25 -19
  52. package/dist/extensions/DynamicContent/dynamic-content.js +128 -33
  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/package.json.js +1 -1
  56. package/dist/services/recommendationApi.js +13 -19
  57. package/dist/services/stripoApi.js +1 -1
  58. package/dist/src/@types/generic.d.ts +36 -6
  59. package/dist/src/components/Guido.vue.d.ts +3 -2
  60. package/dist/src/components/wrappers/WpModal.vue.d.ts +1 -1
  61. package/dist/src/composables/useBlocksConfig.d.ts +11 -0
  62. package/dist/src/composables/useGuidoActions.d.ts +9 -0
  63. package/dist/src/extensions/Blocks/Checkbox/block.d.ts +1 -0
  64. package/dist/src/extensions/Blocks/Items/block.d.ts +13 -0
  65. package/dist/src/extensions/Blocks/Items/controls/button/link.d.ts +14 -0
  66. package/dist/src/extensions/Blocks/Items/controls/cardComposition.d.ts +20 -0
  67. package/dist/src/extensions/Blocks/Items/controls/image/link.d.ts +14 -0
  68. package/dist/src/extensions/Blocks/Items/controls/index.d.ts +501 -0
  69. package/dist/src/extensions/Blocks/Items/controls/name/trimming.d.ts +14 -0
  70. package/dist/src/extensions/Blocks/Items/controls/price/currencyLocation.d.ts +19 -0
  71. package/dist/src/extensions/Blocks/Items/controls/price/currencySymbol.d.ts +21 -0
  72. package/dist/src/extensions/Blocks/Items/controls/price/formattedPrice.d.ts +14 -0
  73. package/dist/src/extensions/Blocks/Items/controls/price/hideDiscount.d.ts +13 -0
  74. package/dist/src/extensions/Blocks/Items/controls/settingsControl.d.ts +42 -0
  75. package/dist/src/extensions/Blocks/Items/enums/controlEnums.d.ts +61 -0
  76. package/dist/src/extensions/Blocks/Items/enums/productEnums.d.ts +154 -0
  77. package/dist/src/extensions/Blocks/Items/enums/settingsEnums.d.ts +43 -0
  78. package/dist/src/extensions/Blocks/Items/extension.d.ts +2 -0
  79. package/dist/src/extensions/Blocks/Items/iconsRegistry.d.ts +4 -0
  80. package/dist/src/extensions/Blocks/Items/settingsPanel.d.ts +4 -0
  81. package/dist/src/extensions/Blocks/Items/store/items-block.d.ts +41 -0
  82. package/dist/src/extensions/Blocks/Items/template.d.ts +16 -0
  83. package/dist/src/extensions/Blocks/Items/utils/configBlockUtils.d.ts +23 -0
  84. package/dist/src/extensions/Blocks/Items/utils/syncAttributeFromConfigBlock.d.ts +32 -0
  85. package/dist/src/extensions/Blocks/Items/utils/syncAttributesFromConfigBlock.d.ts +44 -0
  86. package/dist/src/extensions/Blocks/Items/utils/updateAttributes.d.ts +8 -0
  87. package/dist/src/extensions/Blocks/RadioButton/block.d.ts +1 -0
  88. package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +1 -1
  89. package/dist/src/extensions/Blocks/common-control.d.ts +44 -7
  90. package/dist/src/extensions/Blocks/controlFactories.d.ts +312 -0
  91. package/dist/src/extensions/DynamicContent/dynamic-content-modal.d.ts +9 -2
  92. package/dist/src/extensions/DynamicContent/dynamic-content.d.ts +52 -2
  93. package/dist/src/stores/config.d.ts +9 -2
  94. package/dist/src/stores/dynamic-content.d.ts +3 -3
  95. package/dist/src/stores/editor.d.ts +1 -1
  96. package/dist/src/stores/onboarding.d.ts +1 -1
  97. package/dist/src/stores/preview.d.ts +1 -1
  98. package/dist/src/stores/recommendation.d.ts +1 -1
  99. package/dist/src/stores/save-as-template.d.ts +1 -1
  100. package/dist/src/stores/toaster.d.ts +1 -1
  101. package/dist/src/stores/unsubscribe.d.ts +1 -1
  102. package/dist/src/stores/version-history.d.ts +1 -1
  103. package/dist/src/utils/arrayUtil.d.ts +0 -5
  104. package/dist/src/utils/genericUtil.d.ts +1 -0
  105. package/dist/static/styles/components/narrow-panel.css.js +10 -0
  106. package/dist/static/styles/customEditorStyle.css.js +1 -1
  107. package/dist/stores/config.js +5 -5
  108. package/dist/stores/dynamic-content.js +2 -2
  109. package/dist/stores/editor.js +1 -1
  110. package/dist/stores/onboarding.js +27 -27
  111. package/dist/stores/preview.js +1 -1
  112. package/dist/stores/recommendation.js +3 -3
  113. package/dist/stores/save-as-template.js +2 -2
  114. package/dist/stores/toaster.js +1 -1
  115. package/dist/stores/unsubscribe.js +1 -1
  116. package/dist/stores/version-history.js +4 -4
  117. package/dist/utils/genericUtil.js +18 -8
  118. package/package.json +11 -4
@@ -0,0 +1,99 @@
1
+ import { UIElementType as a, UEAttr as l, ModificationDescription as o } from "../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
2
+ import { CommonControl as s } from "../../common-control.js";
3
+ import { ItemsBlockId as r } from "../enums/controlEnums.js";
4
+ const d = "ui-elements-items-card-composition-block", i = {
5
+ PRODUCT_IMAGE: "image",
6
+ PRODUCT_NAME: "name",
7
+ PRODUCT_QUANTITY: "quantity",
8
+ PRODUCT_PRICE: "price",
9
+ PRODUCT_ORIGINAL_PRICE: "originalPrice",
10
+ PRODUCT_BUTTON: "button"
11
+ };
12
+ class g extends s {
13
+ getId() {
14
+ return d;
15
+ }
16
+ getTemplate() {
17
+ return `
18
+ <div class="items-controls-container">
19
+ ${[
20
+ { name: i.PRODUCT_IMAGE, label: "Product Image" },
21
+ { name: i.PRODUCT_NAME, label: "Product Name" },
22
+ { name: i.PRODUCT_QUANTITY, label: "Product Quantity" },
23
+ { name: i.PRODUCT_PRICE, label: "Product Price" },
24
+ { name: i.PRODUCT_ORIGINAL_PRICE, label: "Product Original Price" },
25
+ { name: i.PRODUCT_BUTTON, label: "Product Button" }
26
+ ].map((t) => this._getToggleContainer(t)).join("")}
27
+ </div>
28
+ `;
29
+ }
30
+ onRender() {
31
+ this._initializeToggles(), this._listenToFormUpdates();
32
+ }
33
+ onDestroy() {
34
+ }
35
+ _getToggleContainer({ name: e, label: t }) {
36
+ return `
37
+ <div class="container">
38
+ <div class="display-flex align-items-center justify-content-between">
39
+ <${a.LABEL} ${l.LABEL.text}="${t}"></${a.LABEL}>
40
+ ${this._GuToggle(e)}
41
+ </div>
42
+ </div>
43
+ `;
44
+ }
45
+ _initializeToggles() {
46
+ this.api.updateValues({
47
+ [i.PRODUCT_IMAGE]: !0,
48
+ [i.PRODUCT_NAME]: !0,
49
+ [i.PRODUCT_QUANTITY]: !0,
50
+ [i.PRODUCT_PRICE]: !0,
51
+ [i.PRODUCT_ORIGINAL_PRICE]: !0,
52
+ [i.PRODUCT_BUTTON]: !0
53
+ });
54
+ }
55
+ _listenToFormUpdates() {
56
+ this.api.onValueChanged(i.PRODUCT_IMAGE, (e) => this._onProductImageChange(e)), this.api.onValueChanged(i.PRODUCT_NAME, (e) => this._onProductNameChange(e)), this.api.onValueChanged(i.PRODUCT_QUANTITY, (e) => this._onProductQuantityChange(e)), this.api.onValueChanged(i.PRODUCT_PRICE, (e) => this._onProductPriceChange(e)), this.api.onValueChanged(
57
+ i.PRODUCT_ORIGINAL_PRICE,
58
+ (e) => this._onProductOriginalPriceChange(e)
59
+ ), this.api.onValueChanged(i.PRODUCT_BUTTON, (e) => this._onProductButtonChange(e));
60
+ }
61
+ _onProductImageChange(e) {
62
+ var n;
63
+ const t = (n = this.currentNode) == null ? void 0 : n.querySelector(`[esd-extension-block-id="${r.IMAGE}"]`);
64
+ t && this.api.getDocumentModifier().modifyHtml(t).setStyle("display", e ? "table-cell" : "none").apply(new o(`Product image visibility changed to ${e ? "visible" : "hidden"}`));
65
+ }
66
+ _onProductNameChange(e) {
67
+ var n;
68
+ const t = (n = this.currentNode) == null ? void 0 : n.querySelector(`[esd-extension-block-id="${r.NAME}"]`);
69
+ t && this.api.getDocumentModifier().modifyHtml(t).setStyle("display", e ? "table-cell" : "none").apply(new o(`Product name visibility changed to ${e ? "visible" : "hidden"}`));
70
+ }
71
+ _onProductQuantityChange(e) {
72
+ var n;
73
+ const t = (n = this.currentNode) == null ? void 0 : n.querySelector(`[esd-extension-block-id="${r.QUANTITY}"]`);
74
+ t && this.api.getDocumentModifier().modifyHtml(t).setStyle("display", e ? "table-cell" : "none").apply(new o(
75
+ `Product quantity visibility changed to ${e ? "visible" : "hidden"}`
76
+ ));
77
+ }
78
+ _onProductPriceChange(e) {
79
+ var n;
80
+ const t = (n = this.currentNode) == null ? void 0 : n.querySelector(`[esd-extension-block-id="${r.PRICE}"]`);
81
+ t && this.api.getDocumentModifier().modifyHtml(t).setStyle("display", e ? "table-cell" : "none").apply(new o(`Product price visibility changed to ${e ? "visible" : "hidden"}`));
82
+ }
83
+ _onProductOriginalPriceChange(e) {
84
+ var n;
85
+ const t = (n = this.currentNode) == null ? void 0 : n.querySelector(`[esd-extension-block-id="${r.ORIGINAL_PRICE}"]`);
86
+ t && this.api.getDocumentModifier().modifyHtml(t).setStyle("display", e ? "table-cell" : "none").apply(new o(
87
+ `Product original price visibility changed to ${e ? "visible" : "hidden"}`
88
+ ));
89
+ }
90
+ _onProductButtonChange(e) {
91
+ var n;
92
+ const t = (n = this.currentNode) == null ? void 0 : n.querySelector(`[esd-extension-block-id="${r.BUTTON}"]`);
93
+ t && this.api.getDocumentModifier().modifyHtml(t).setStyle("display", e ? "table-cell" : "none").apply(new o(`Product button visibility changed to ${e ? "visible" : "hidden"}`));
94
+ }
95
+ }
96
+ export {
97
+ d as COMPOSITION_CONTROL_BLOCK_ID,
98
+ g as ItemsBlockCardCompositionControl
99
+ };
@@ -0,0 +1,68 @@
1
+ var r = Object.defineProperty;
2
+ var a = (o, t, e) => t in o ? r(o, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : o[t] = e;
3
+ var i = (o, t, e) => a(o, typeof t != "symbol" ? t + "" : t, e);
4
+ import { CommonControl as m } from "../../../common-control.js";
5
+ import { ItemsBlockControlId as d } from "../../enums/controlEnums.js";
6
+ import { useItemsBlockStore as l } from "../../store/items-block.js";
7
+ import { syncImageLinkFromAttributes as h } from "../../utils/syncAttributesFromConfigBlock.js";
8
+ import { updateConfigBlockAttributes as p } from "../../utils/updateAttributes.js";
9
+ const s = d.IMAGE_LINK, n = {
10
+ LINK: "link"
11
+ };
12
+ class N extends m {
13
+ constructor() {
14
+ super(...arguments);
15
+ i(this, "store", l());
16
+ }
17
+ getId() {
18
+ return s;
19
+ }
20
+ getTemplate() {
21
+ return `
22
+ <div class="${s}">
23
+ ${this._getLink()}
24
+ </div>
25
+ `;
26
+ }
27
+ onRender() {
28
+ this.api.updateValues({
29
+ [n.LINK]: this.store.imageLink
30
+ }), this._listenToFormUpdates();
31
+ }
32
+ onTemplateNodeUpdated(e) {
33
+ super.onTemplateNodeUpdated(e), this.handleBlockInstanceChange(
34
+ () => h(this.currentNode),
35
+ () => {
36
+ this.api.updateValues({
37
+ [n.LINK]: this.store.imageLink
38
+ });
39
+ }
40
+ );
41
+ }
42
+ _listenToFormUpdates() {
43
+ this.api.onValueChanged(
44
+ n.LINK,
45
+ (e) => this._onLinkChange(e)
46
+ );
47
+ }
48
+ _onLinkChange(e) {
49
+ console.debug("Image link changed to: ", e), this.store.setImageLink(e), p(this.currentNode, this.api);
50
+ }
51
+ _getLink() {
52
+ return `
53
+ ${this._GuOneColumn([
54
+ this._GuLabel({ text: "Link" }),
55
+ this._GuTextInput({
56
+ name: n.LINK,
57
+ placeholder: "Enter Link",
58
+ className: "es-100",
59
+ disabled: !0
60
+ })
61
+ ])}
62
+ `;
63
+ }
64
+ }
65
+ export {
66
+ s as CONTROL_BLOCK_ID,
67
+ N as ImageLinkControl
68
+ };
@@ -0,0 +1,217 @@
1
+ import { createTextAlignControl as r, createTextColorControl as l, createTextSizeControl as e, createTextStyleControl as C, createTextFontFamilyControl as I, createTextBackgroundColorControl as T, createPaddingsControl as i, createImageSizeControl as c, createImageMarginsControl as N, createButtonAlignControl as a, createButtonBorderControl as s, createButtonBorderRadiusControl as A, createButtonColorControl as O, createButtonFontFamilyControl as _, createButtonMarginsControl as E, createButtonPaddingsControl as R, createButtonTextControl as B, createButtonTextSizeControl as P, createButtonTextStyleAndFontColorControl as g, createButtonFitToContainerControl as d } from "../../controlFactories.js";
2
+ import { ItemsBlockId as o, ItemsBlockControlId as t } from "../enums/controlEnums.js";
3
+ const n = ".items-block", u = a(
4
+ t.BUTTON_ALIGN,
5
+ o.BUTTON,
6
+ n
7
+ ), S = s(
8
+ t.BUTTON_BORDER,
9
+ o.BUTTON,
10
+ n
11
+ ), U = A(
12
+ t.BUTTON_BORDER_RADIUS,
13
+ o.BUTTON,
14
+ n
15
+ ), F = O(
16
+ t.BUTTON_COLOR,
17
+ o.BUTTON,
18
+ n
19
+ ), L = _(
20
+ t.BUTTON_FONT_FAMILY,
21
+ o.BUTTON,
22
+ n
23
+ ), m = E(
24
+ t.BUTTON_MARGINS,
25
+ o.BUTTON,
26
+ n
27
+ ), G = R(
28
+ t.BUTTON_PADDINGS,
29
+ o.BUTTON,
30
+ n
31
+ ), y = B(
32
+ t.BUTTON_TEXT,
33
+ o.BUTTON,
34
+ n
35
+ ), M = P(
36
+ t.BUTTON_TEXT_SIZE,
37
+ o.BUTTON,
38
+ n
39
+ ), Y = g(
40
+ t.BUTTON_TEXT_STYLE_AND_FONT_COLOR,
41
+ o.BUTTON,
42
+ n
43
+ ), Q = d(
44
+ t.BUTTON_FIT_TO_CONTENT,
45
+ o.BUTTON,
46
+ n
47
+ ), No = {
48
+ align: u,
49
+ border: S,
50
+ borderRadius: U,
51
+ color: F,
52
+ fontFamily: L,
53
+ margins: m,
54
+ paddings: G,
55
+ text: y,
56
+ textSize: M,
57
+ textStyleAndFontColor: Y,
58
+ fitToContent: Q
59
+ }, D = c(
60
+ t.IMAGE_SIZE,
61
+ o.IMAGE,
62
+ n
63
+ ), x = N(
64
+ t.IMAGE_MARGINS,
65
+ o.IMAGE,
66
+ n
67
+ ), ao = {
68
+ size: D,
69
+ margins: x
70
+ }, z = r(
71
+ t.ORIGINAL_PRICE_ALIGN,
72
+ o.ORIGINAL_PRICE,
73
+ n
74
+ ), k = l(
75
+ t.ORIGINAL_PRICE_COLOR,
76
+ o.ORIGINAL_PRICE,
77
+ n
78
+ ), f = e(
79
+ t.ORIGINAL_PRICE_SIZE,
80
+ o.ORIGINAL_PRICE,
81
+ n
82
+ ), p = C(
83
+ t.ORIGINAL_PRICE_STYLE,
84
+ o.ORIGINAL_PRICE,
85
+ n
86
+ ), b = I(
87
+ t.ORIGINAL_PRICE_FONT_FAMILY,
88
+ o.ORIGINAL_PRICE,
89
+ n
90
+ ), Z = T(
91
+ t.ORIGINAL_PRICE_BACKGROUND,
92
+ o.ORIGINAL_PRICE,
93
+ n
94
+ ), K = i(
95
+ t.ORIGINAL_PRICE_PADDINGS,
96
+ o.ORIGINAL_PRICE,
97
+ n
98
+ ), so = {
99
+ align: z,
100
+ color: k,
101
+ size: f,
102
+ style: p,
103
+ fontFamily: b,
104
+ background: Z,
105
+ paddings: K
106
+ }, X = r(
107
+ t.PRICE_ALIGN,
108
+ o.PRICE,
109
+ n
110
+ ), h = l(
111
+ t.PRICE_COLOR,
112
+ o.PRICE,
113
+ n
114
+ ), j = e(
115
+ t.PRICE_SIZE,
116
+ o.PRICE,
117
+ n
118
+ ), q = C(
119
+ t.PRICE_STYLE,
120
+ o.PRICE,
121
+ n
122
+ ), v = I(
123
+ t.PRICE_FONT_FAMILY,
124
+ o.PRICE,
125
+ n
126
+ ), w = T(
127
+ t.PRICE_BACKGROUND,
128
+ o.PRICE,
129
+ n
130
+ ), H = i(
131
+ t.PRICE_PADDINGS,
132
+ o.PRICE,
133
+ n
134
+ ), Ao = {
135
+ align: X,
136
+ color: h,
137
+ size: j,
138
+ style: q,
139
+ fontFamily: v,
140
+ background: w,
141
+ paddings: H
142
+ }, J = r(
143
+ t.NAME_ALIGN,
144
+ o.NAME,
145
+ n
146
+ ), V = l(
147
+ t.NAME_COLOR,
148
+ o.NAME,
149
+ n
150
+ ), W = e(
151
+ t.NAME_SIZE,
152
+ o.NAME,
153
+ n
154
+ ), $ = C(
155
+ t.NAME_STYLE,
156
+ o.NAME,
157
+ n
158
+ ), oo = I(
159
+ t.NAME_FONT_FAMILY,
160
+ o.NAME,
161
+ n
162
+ ), to = T(
163
+ t.NAME_BACKGROUND,
164
+ o.NAME,
165
+ n
166
+ ), no = i(
167
+ t.NAME_PADDINGS,
168
+ o.NAME,
169
+ n
170
+ ), Oo = {
171
+ align: J,
172
+ color: V,
173
+ size: W,
174
+ style: $,
175
+ fontFamily: oo,
176
+ background: to,
177
+ paddings: no
178
+ }, ro = r(
179
+ t.QUANTITY_ALIGN,
180
+ o.QUANTITY,
181
+ n
182
+ ), lo = l(
183
+ t.QUANTITY_COLOR,
184
+ o.QUANTITY,
185
+ n
186
+ ), eo = I(
187
+ t.QUANTITY_FONT_FAMILY,
188
+ o.QUANTITY,
189
+ n
190
+ ), Co = i(
191
+ t.QUANTITY_PADDINGS,
192
+ o.QUANTITY,
193
+ n
194
+ ), Io = e(
195
+ t.QUANTITY_SIZE,
196
+ o.QUANTITY,
197
+ n
198
+ ), io = C(
199
+ t.QUANTITY_STYLE,
200
+ o.QUANTITY,
201
+ n
202
+ ), _o = {
203
+ align: ro,
204
+ color: lo,
205
+ fontFamily: eo,
206
+ paddings: Co,
207
+ size: Io,
208
+ style: io
209
+ };
210
+ export {
211
+ No as ButtonControls,
212
+ ao as ImageControls,
213
+ Oo as NameControls,
214
+ so as OriginalPriceControls,
215
+ Ao as PriceControls,
216
+ _o as QuantityControls
217
+ };
@@ -0,0 +1,70 @@
1
+ var d = Object.defineProperty;
2
+ var h = (i, t, e) => t in i ? d(i, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : i[t] = e;
3
+ var s = (i, t, e) => h(i, typeof t != "symbol" ? t + "" : t, e);
4
+ import { ModificationDescription as n, UIElementType as a, UEAttr as g } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
5
+ import { CommonControl as c } from "../../../common-control.js";
6
+ import { ItemsBlockControlId as l } from "../../enums/controlEnums.js";
7
+ import { SETTINGS_ENUMS as I } from "../../enums/settingsEnums.js";
8
+ import { useItemsBlockStore as N } from "../../store/items-block.js";
9
+ import { syncNameTrimmingFromAttributes as y } from "../../utils/syncAttributesFromConfigBlock.js";
10
+ import { updateConfigBlockAttributes as M } from "../../utils/updateAttributes.js";
11
+ const f = l.NAME_TRIMMING, r = {
12
+ TRIMMING: "trimming"
13
+ };
14
+ class R extends c {
15
+ constructor() {
16
+ super(...arguments);
17
+ s(this, "store", N());
18
+ }
19
+ getId() {
20
+ return f;
21
+ }
22
+ getTemplate() {
23
+ return `
24
+ <div class="${l.NAME_TRIMMING}">
25
+ ${this._getTextTrimming()}
26
+ </div>
27
+ `;
28
+ }
29
+ onRender() {
30
+ this.api.updateValues({ [r.TRIMMING]: this.store.nameTrimming }), this.api.onValueChanged(r.TRIMMING, (e) => {
31
+ this._onTrimmingChange(e);
32
+ });
33
+ }
34
+ onTemplateNodeUpdated(e) {
35
+ super.onTemplateNodeUpdated(e), this.handleBlockInstanceChange(
36
+ () => y(this.currentNode),
37
+ () => {
38
+ this.api.updateValues({ [r.TRIMMING]: this.store.nameTrimming });
39
+ }
40
+ ), this.store.nameTrimming && this._applyTrimmingStyles();
41
+ }
42
+ _onTrimmingChange(e) {
43
+ this.store.setNameTrimming(e), M(this.currentNode, this.api), this.api.updateValues({ [r.TRIMMING]: e }), this._applyTrimmingStyles(e);
44
+ }
45
+ _applyTrimmingStyles(e) {
46
+ var m;
47
+ const o = (m = this.currentNode) == null ? void 0 : m.querySelector("p");
48
+ if (!o)
49
+ return;
50
+ const p = e !== void 0 ? e : this.store.nameTrimming, T = this.store.orientation === I.ORIENTATION.VERTICAL;
51
+ p ? this.api.getDocumentModifier().modifyHtml(o).setStyle("white-space", "nowrap").setStyle("overflow", "hidden").setStyle("text-overflow", "ellipsis").setStyle("max-width", T ? "130px" : "100%").apply(new n("Text Trimming Enabled")) : this.api.getDocumentModifier().modifyHtml(o).removeStyle("white-space").removeStyle("overflow").removeStyle("text-overflow").removeStyle("max-width").apply(new n("Text Trimming Disabled"));
52
+ }
53
+ _getTextTrimming() {
54
+ return `
55
+ <div class="container">
56
+ <div class="display-flex align-items-center justify-content-between">
57
+ <${a.LABEL}
58
+ ${g.LABEL.text}="${this.api.translate("Text Trimming")}"
59
+ >
60
+ </${a.LABEL}>
61
+ ${this._GuToggle(r.TRIMMING)}
62
+ </div>
63
+ </div>
64
+ `;
65
+ }
66
+ }
67
+ export {
68
+ f as CONTROL_BLOCK_ID,
69
+ R as NameTrimmingControl
70
+ };
@@ -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
+ };