@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,132 @@
1
+ import { SettingsPanelRegistry as O, SettingsPanelTab as T, SettingsTab as N, ContainerControls as S } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
2
+ import { BLOCK_ID as R } from "./block.js";
3
+ import { COMPOSITION_CONTROL_BLOCK_ID as A } from "./controls/cardComposition.js";
4
+ import { CONTROL_BLOCK_ID as L } from "./controls/settingsControl.js";
5
+ import { ItemsBlockId as E, ItemsBlockControlId as I } from "./enums/controlEnums.js";
6
+ class n extends O {
7
+ registerBlockControls(_) {
8
+ _[R] = [
9
+ new T(
10
+ N.SETTINGS,
11
+ [
12
+ L,
13
+ S.EXTERNAL_INDENTS
14
+ ]
15
+ ),
16
+ new T(
17
+ "Card Composition",
18
+ [
19
+ A
20
+ ]
21
+ ).withLabel("Card Composition")
22
+ ], _[E.ORIGINAL_PRICE] = [
23
+ new T(
24
+ N.SETTINGS,
25
+ [
26
+ I.ORIGINAL_PRICE_STYLE,
27
+ I.ORIGINAL_PRICE_ALIGN,
28
+ I.ORIGINAL_PRICE_PADDINGS
29
+ ]
30
+ ),
31
+ new T(
32
+ N.STYLES,
33
+ [
34
+ I.ORIGINAL_PRICE_COLOR,
35
+ I.ORIGINAL_PRICE_FONT_FAMILY,
36
+ I.ORIGINAL_PRICE_SIZE
37
+ ]
38
+ )
39
+ ], _[E.PRICE] = [
40
+ new T(
41
+ N.SETTINGS,
42
+ [
43
+ I.PRICE_STYLE,
44
+ I.PRICE_ALIGN,
45
+ I.PRICE_HIDE_DISCOUNT,
46
+ I.PRICE_FORMATTED_PRICE,
47
+ I.PRICE_CURRENCY_SYMBOL,
48
+ I.PRICE_CURRENCY_LOCATION,
49
+ I.PRICE_PADDINGS
50
+ ]
51
+ ),
52
+ new T(
53
+ N.STYLES,
54
+ [
55
+ I.PRICE_COLOR,
56
+ I.PRICE_FONT_FAMILY,
57
+ I.PRICE_SIZE
58
+ ]
59
+ )
60
+ ], _[E.NAME] = [
61
+ new T(
62
+ N.SETTINGS,
63
+ [
64
+ I.NAME_STYLE,
65
+ I.NAME_ALIGN,
66
+ I.NAME_TRIMMING,
67
+ I.NAME_PADDINGS
68
+ ]
69
+ ),
70
+ new T(
71
+ N.STYLES,
72
+ [
73
+ I.NAME_FONT_FAMILY,
74
+ I.NAME_SIZE,
75
+ I.NAME_COLOR
76
+ ]
77
+ )
78
+ ], _[E.QUANTITY] = [
79
+ new T(
80
+ N.SETTINGS,
81
+ [
82
+ I.QUANTITY_FONT_FAMILY,
83
+ I.QUANTITY_STYLE
84
+ ]
85
+ ),
86
+ new T(
87
+ N.STYLES,
88
+ [
89
+ I.QUANTITY_ALIGN,
90
+ I.QUANTITY_SIZE,
91
+ I.QUANTITY_COLOR,
92
+ I.QUANTITY_PADDINGS
93
+ ]
94
+ )
95
+ ], _[E.IMAGE] = [
96
+ new T(
97
+ N.SETTINGS,
98
+ [
99
+ I.IMAGE_LINK,
100
+ I.IMAGE_SIZE,
101
+ I.IMAGE_MARGINS
102
+ ]
103
+ )
104
+ ], _[E.BUTTON] = [
105
+ new T(
106
+ N.SETTINGS,
107
+ [
108
+ I.BUTTON_LINK,
109
+ I.BUTTON_TEXT,
110
+ I.BUTTON_ALIGN,
111
+ I.BUTTON_PADDINGS,
112
+ I.BUTTON_MARGINS
113
+ ]
114
+ ),
115
+ new T(
116
+ N.STYLES,
117
+ [
118
+ I.BUTTON_COLOR,
119
+ I.BUTTON_FONT_FAMILY,
120
+ I.BUTTON_TEXT_SIZE,
121
+ I.BUTTON_TEXT_STYLE_AND_FONT_COLOR,
122
+ I.BUTTON_FIT_TO_CONTENT,
123
+ I.BUTTON_BORDER_RADIUS,
124
+ I.BUTTON_BORDER
125
+ ]
126
+ )
127
+ ];
128
+ }
129
+ }
130
+ export {
131
+ n as SettingsPanel
132
+ };
@@ -0,0 +1,71 @@
1
+ import { defineStore as s } from "pinia";
2
+ import { DefaultConfigValues as e } from "../enums/settingsEnums.js";
3
+ const n = (t) => t.replace(/Url\}/, "Image}"), o = (t) => t.replace(/Image\}/, "Url}"), i = () => {
4
+ const t = e.cartItemsSelectControlValue;
5
+ return {
6
+ itemsType: e.itemsType,
7
+ itemIds: t,
8
+ imageLink: n(t),
9
+ buttonLink: o(t),
10
+ orientation: e.cardOrientationControlValue,
11
+ nameTrimming: !1,
12
+ hideDiscount: !1,
13
+ currencySymbol: "USD",
14
+ currencyLocation: "0",
15
+ formattedPrice: !0,
16
+ templateData: {
17
+ imageSrc: "",
18
+ name: "",
19
+ price: "",
20
+ originalPrice: "",
21
+ quantity: "",
22
+ button: ""
23
+ }
24
+ };
25
+ }, a = s("guidoItemsBlock", {
26
+ state: () => i(),
27
+ actions: {
28
+ setItemsType(t) {
29
+ this.itemsType = t;
30
+ },
31
+ setItemIds(t) {
32
+ this.itemIds = t, this.imageLink = n(t), this.buttonLink = o(t);
33
+ },
34
+ setImageLink(t) {
35
+ this.imageLink = t;
36
+ },
37
+ setButtonLink(t) {
38
+ this.buttonLink = t;
39
+ },
40
+ setOrientation(t) {
41
+ this.orientation = t;
42
+ },
43
+ setNameTrimming(t) {
44
+ this.nameTrimming = t;
45
+ },
46
+ setHideDiscount(t) {
47
+ this.hideDiscount = t;
48
+ },
49
+ setCurrencySymbol(t) {
50
+ this.currencySymbol = t;
51
+ },
52
+ setCurrencyLocation(t) {
53
+ this.currencyLocation = t;
54
+ },
55
+ setFormattedPrice(t) {
56
+ this.formattedPrice = t;
57
+ },
58
+ setTemplateData(t) {
59
+ this.templateData = t;
60
+ },
61
+ updateFromAttributes(t) {
62
+ t.itemsType && (this.itemsType = t.itemsType), t.itemIds && this.setItemIds(t.itemIds), t.orientation && (this.orientation = t.orientation);
63
+ },
64
+ reset() {
65
+ Object.assign(this, i());
66
+ }
67
+ }
68
+ });
69
+ export {
70
+ a as useItemsBlockStore
71
+ };
@@ -0,0 +1,194 @@
1
+ import { BlockType as l, BlockAttr as I } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
2
+ import { ItemsBlockId as T } from "./enums/controlEnums.js";
3
+ import { productPairs as r } from "./enums/productEnums.js";
4
+ import { ItemInCartOptions as N, SETTINGS_ENUMS as A } from "./enums/settingsEnums.js";
5
+ import P from "./layouts/horizontal.html.js";
6
+ import S from "./layouts/vertical.html.js";
7
+ const B = `text-decoration:none;
8
+ font-family:-apple-system,
9
+ BlinkMacSystemFont,
10
+ 'Segoe UI',
11
+ Roboto,
12
+ Helvetica,
13
+ Arial,
14
+ sans-serif,
15
+ 'Apple Color Emoji',
16
+ 'Segoe UI Emoji',
17
+ 'Segoe UI Symbol'
18
+ `;
19
+ let [R] = r.PAIRS_FOR_EXTENSION.imageSrc.CART_ITEMS.DEFAULT, [C] = r.PAIRS_FOR_EXTENSION.name.CART_ITEMS.DEFAULT, [_] = r.PAIRS_FOR_EXTENSION.price.CART_ITEMS.DEFAULT_PRICE_FORMATTED, [$] = r.PAIRS_FOR_EXTENSION.originalPrice.CART_ITEMS.DEFAULT_PRICE_FORMATTED, [u] = r.PAIRS_FOR_EXTENSION.quantity.CART_ITEMS.DEFAULT;
20
+ const f = (a, t) => `
21
+ <${l.BLOCK_IMAGE}
22
+ ${I.BLOCK_IMAGE.src}="${R}"
23
+ ${I.BLOCK_IMAGE.alt}="Product Image"
24
+ ${I.BLOCK_IMAGE.href}="#!"
25
+ ${I.BLOCK_IMAGE.width}="70"
26
+ esd-extension-block-id="${T.IMAGE}"
27
+ data-slot-1
28
+ product-attr="imageSrc"
29
+ data-type="${a}"
30
+ data-number="${t}"
31
+ />
32
+ `, g = (a) => `
33
+ <${l.BLOCK_TEXT}
34
+ width="100%"
35
+ align="center"
36
+ class="es-p10"
37
+ data-type="${a}"
38
+ esd-extension-block-id="${T.NAME}"
39
+ >
40
+ <p contenteditable="false">
41
+ <a
42
+ href="#!"
43
+ style="${B}"
44
+ product-attr="name"
45
+ data-slot-2
46
+ width="100%">
47
+ ${C}
48
+ </a>
49
+ </p>
50
+ </${l.BLOCK_TEXT}>
51
+ `, F = (a, t, o, e, i) => {
52
+ let n = _;
53
+ if (e && e.trim()) {
54
+ const d = `&nbsp;${e.trim()}&nbsp;`;
55
+ n = (i || "0") === "1" ? `${_}${d}` : `${d}${_}`;
56
+ }
57
+ const c = i === "1" ? "after" : "before", s = `data-formated="${o ? "true" : "false"}"`, E = `data-curency="${c}"`;
58
+ return `
59
+ <${l.BLOCK_TEXT}
60
+ esd-extension-block-id="${T.PRICE}"
61
+ class="items-block-price"
62
+ width="100%"
63
+ align="center"
64
+ >
65
+ <p
66
+ product-attr="price"
67
+ contenteditable="false"
68
+ data-slot-4
69
+ data-type="${a}"
70
+ data-number="${t}"
71
+ ${s}
72
+ ${E}
73
+ ${e ? `data-currency_symbol="${e}"` : ""}
74
+ >
75
+ ${n}
76
+ </p>
77
+ </${l.BLOCK_TEXT}>
78
+ `;
79
+ }, b = (a, t, o, e, i) => {
80
+ let n = $;
81
+ if (e && e.trim()) {
82
+ const d = `&nbsp;${e.trim()}&nbsp;`;
83
+ n = (i || "0") === "1" ? `${$}${d}` : `${d}${$}`;
84
+ }
85
+ const c = i === "1" ? "after" : "before", s = `data-formated="${o ? "true" : "false"}"`, E = `data-curency="${c}"`;
86
+ return `
87
+ <${l.BLOCK_TEXT}
88
+ class="items-block-price"
89
+ esd-extension-block-id="${T.ORIGINAL_PRICE}"
90
+ width="100%"
91
+ align="center"
92
+ >
93
+ <p
94
+ product-attr="originalPrice"
95
+ contenteditable="false"
96
+ data-slot-5
97
+ style="color: #cc0000"
98
+ data-type="${a}"
99
+ data-number="${t}"
100
+ ${s}
101
+ ${E}
102
+ ${e ? `data-currency_symbol="${e}"` : ""}
103
+ >
104
+ <s>${n}</s>
105
+ </p>
106
+ </${l.BLOCK_TEXT}>
107
+ `;
108
+ }, U = () => `
109
+ <${l.BLOCK_TEXT}
110
+ width="100%"
111
+ align="center"
112
+ class="es-p10"
113
+ esd-extension-block-id="${T.QUANTITY}"
114
+ >
115
+ <p
116
+ product-attr="quantity"
117
+ data-slot-3
118
+ contenteditable="false"
119
+ width="100%">
120
+ ${u}
121
+ </p>
122
+ </${l.BLOCK_TEXT}>
123
+ `, L = (a, t) => `
124
+ <${l.BLOCK_BUTTON}
125
+ width="100%"
126
+ class="ins-button"
127
+ name="buy-button"
128
+ caption="Buy"
129
+ align="center"
130
+ esd-extension-block-id="${T.BUTTON}"
131
+ product-attr="button"
132
+ data-slot-6
133
+ data-type="${a}"
134
+ data-number="${t}"
135
+ >Buy
136
+ </${l.BLOCK_BUTTON}>
137
+ `, m = () => `
138
+ <esd-config-block style="display: none;"></esd-config-block>
139
+ `, O = (a, t, o, e, i, n, c, s) => {
140
+ const p = `${`data-type="${t}" data-number="${o}"`} data-orientation="${e}"`;
141
+ return a.replace(
142
+ /<td([^>]*class="[^"]*ins-product-td[^"]*"[^>]*)>/,
143
+ `<td$1 ${p}>`
144
+ ).replace("{-{-PRODUCT_IMAGE-}-}", f(t, o)).replace("{-{-PRODUCT_NAME-}-}", g(t)).replace(
145
+ "{-{-PRODUCT_PRICE-}-}",
146
+ F(t, o, i, n, c)
147
+ ).replace(
148
+ "{-{-PRODUCT_ORIGINAL_PRICE-}-}",
149
+ b(
150
+ t,
151
+ o,
152
+ i,
153
+ n,
154
+ c
155
+ )
156
+ ).replace("{-{-PRODUCT_QUANTITY-}-}", U()).replace("{-{-PRODUCT_BUTTON-}-}", L(t, o)).replace("{-{-CONFIG_BLOCK-}-}", m());
157
+ };
158
+ function x({
159
+ orientation: a,
160
+ itemsType: t = A.ITEMS_TYPE.CART_ITEMS,
161
+ itemId: o,
162
+ currencySymbol: e,
163
+ currencyLocation: i,
164
+ formattedPrice: n = !0
165
+ }) {
166
+ const c = N[t].findIndex((E) => E.value === o);
167
+ let s = "1";
168
+ if (c >= 0)
169
+ s = String(c + 1);
170
+ else if (o) {
171
+ const E = o.match(/\((\d+)\)/);
172
+ E && ([s] = E);
173
+ }
174
+ return R = r.PAIRS_FOR_EXTENSION.imageSrc[t].DEFAULT[c >= 0 ? c : 0], C = r.PAIRS_FOR_EXTENSION.name[t].DEFAULT[c >= 0 ? c : 0], _ = n ? r.PAIRS_FOR_EXTENSION.price[t].DEFAULT_PRICE_FORMATTED : r.PAIRS_FOR_EXTENSION.price[t].DEFAULT_PRICE, $ = n ? r.PAIRS_FOR_EXTENSION.originalPrice[t].DEFAULT_PRICE_FORMATTED : r.PAIRS_FOR_EXTENSION.originalPrice[t].DEFAULT_PRICE, u = r.PAIRS_FOR_EXTENSION.quantity[t].DEFAULT, a === A.ORIENTATION.VERTICAL ? O(
175
+ S,
176
+ t,
177
+ s,
178
+ a,
179
+ n,
180
+ e,
181
+ i
182
+ ) : O(
183
+ P,
184
+ t,
185
+ s,
186
+ a,
187
+ n,
188
+ e,
189
+ i
190
+ );
191
+ }
192
+ export {
193
+ x as getDefaultTemplate
194
+ };
@@ -0,0 +1,17 @@
1
+ function r(t) {
2
+ if (!t)
3
+ return null;
4
+ const n = t.closest(".items-block-v2");
5
+ return n ? n.querySelector("esd-config-block") : null;
6
+ }
7
+ function o(t, n = !1) {
8
+ return t == null ? n : t === "1" || t === "true";
9
+ }
10
+ function e(t, n = "") {
11
+ return t || n;
12
+ }
13
+ export {
14
+ o as attributeToBoolean,
15
+ e as attributeToString,
16
+ r as getConfigBlock
17
+ };
@@ -0,0 +1,28 @@
1
+ import { configAttributes as i } from "../enums/productEnums.js";
2
+ import { getConfigBlock as c, attributeToBoolean as u, attributeToString as a } from "./configBlockUtils.js";
3
+ function l(r, t) {
4
+ const e = c(r);
5
+ if (!e)
6
+ return;
7
+ const o = e.getAttribute(i[t.attributeName]), n = t.converter(o);
8
+ t.storeSetter(n);
9
+ }
10
+ function b(r, t, e = !1) {
11
+ return {
12
+ attributeName: r,
13
+ storeSetter: t,
14
+ converter: (o) => u(o, e)
15
+ };
16
+ }
17
+ function s(r, t, e = "") {
18
+ return {
19
+ attributeName: r,
20
+ storeSetter: t,
21
+ converter: (o) => a(o, e)
22
+ };
23
+ }
24
+ export {
25
+ b as createBooleanSyncConfig,
26
+ s as createStringSyncConfig,
27
+ l as syncAttributeFromConfigBlock
28
+ };
@@ -0,0 +1,67 @@
1
+ import { useItemsBlockStore as s } from "../store/items-block.js";
2
+ import { syncAttributeFromConfigBlock as e, createBooleanSyncConfig as i, createStringSyncConfig as r } from "./syncAttributeFromConfigBlock.js";
3
+ function C(t) {
4
+ const o = s(), n = i(
5
+ "PRODUCT_NAME_TRIMMING",
6
+ (c) => o.setNameTrimming(c),
7
+ !1
8
+ );
9
+ e(t, n);
10
+ }
11
+ function f(t) {
12
+ const o = s(), n = i(
13
+ "PRODUCT_PRICE_HIDE_DISCOUNT",
14
+ (c) => o.setHideDiscount(c),
15
+ !1
16
+ );
17
+ e(t, n);
18
+ }
19
+ function R(t) {
20
+ const o = s(), n = i(
21
+ "PRODUCT_PRICE_FORMATTED",
22
+ (c) => o.setFormattedPrice(c),
23
+ !0
24
+ );
25
+ e(t, n);
26
+ }
27
+ function _(t) {
28
+ const o = s(), n = r(
29
+ "PRODUCT_PRICE_CURRENCY_SYMBOL",
30
+ (c) => o.setCurrencySymbol(c),
31
+ ""
32
+ );
33
+ e(t, n);
34
+ }
35
+ function y(t) {
36
+ const o = s(), n = r(
37
+ "PRODUCT_PRICE_CURRENCY_LOCATION",
38
+ (c) => o.setCurrencyLocation(c),
39
+ "0"
40
+ );
41
+ e(t, n);
42
+ }
43
+ function T(t) {
44
+ const o = s(), n = r(
45
+ "PRODUCT_BUTTON_LINK",
46
+ (c) => o.setButtonLink(c),
47
+ ""
48
+ );
49
+ e(t, n);
50
+ }
51
+ function g(t) {
52
+ const o = s(), n = r(
53
+ "PRODUCT_IMAGE_LINK",
54
+ (c) => o.setImageLink(c),
55
+ ""
56
+ );
57
+ e(t, n);
58
+ }
59
+ export {
60
+ T as syncButtonLinkFromAttributes,
61
+ y as syncCurrencyLocationFromAttributes,
62
+ _ as syncCurrencySymbolFromAttributes,
63
+ R as syncFormattedPriceFromAttributes,
64
+ f as syncHideDiscountFromAttributes,
65
+ g as syncImageLinkFromAttributes,
66
+ C as syncNameTrimmingFromAttributes
67
+ };
@@ -0,0 +1,44 @@
1
+ import { ModificationDescription as D } from "../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
2
+ import { configAttributes as t } from "../enums/productEnums.js";
3
+ import { DefaultConfigValues as e } from "../enums/settingsEnums.js";
4
+ import { useItemsBlockStore as l } from "../store/items-block.js";
5
+ import { getConfigBlock as p } from "./configBlockUtils.js";
6
+ function b(n, c) {
7
+ const i = p(n);
8
+ if (!i)
9
+ return;
10
+ const C = l(), {
11
+ itemsType: r,
12
+ itemIds: E,
13
+ orientation: T,
14
+ nameTrimming: _,
15
+ hideDiscount: O,
16
+ formattedPrice: m,
17
+ currencySymbol: R,
18
+ currencyLocation: N,
19
+ buttonLink: a,
20
+ imageLink: f
21
+ } = C, u = {
22
+ "data-source": r,
23
+ [t.TYPE]: r,
24
+ [t.ITEMS_INDEX_SELECT_CONTROL_VALUE]: E,
25
+ [t.ORIENTATION]: T,
26
+ [t.PRODUCT_NAME_TRIMMING]: _ ? "1" : "0",
27
+ [t.PRODUCT_PRICE_HIDE_DISCOUNT]: O ? "1" : "0",
28
+ [t.PRODUCT_PRICE_FORMATTED]: m ? "1" : "0",
29
+ [t.PRODUCT_PRICE_CURRENCY_SYMBOL]: R || "",
30
+ [t.PRODUCT_PRICE_CURRENCY_LOCATION]: N || "0",
31
+ [t.PRODUCT_BUTTON_LINK]: a || "",
32
+ [t.PRODUCT_IMAGE_LINK]: f || "",
33
+ [t.NAME_CONTROL_ENABLED]: e.productNameControlEnabled,
34
+ [t.QUANTITY_CONTROL_ENABLED]: e.productQuantityControlEnabled,
35
+ [t.PRICE_CONTROL_OPENED]: e.productPriceControlOpened
36
+ };
37
+ let o = c.getDocumentModifier().modifyHtml(i);
38
+ Object.entries(u).forEach(([I, s]) => {
39
+ o = o.setAttribute(I, s);
40
+ }), o.apply(new D("Update config block attributes from control"));
41
+ }
42
+ export {
43
+ b as updateConfigBlockAttributes
44
+ };
@@ -1,7 +1,7 @@
1
1
  import { Block as t, BlockCompositionType as o } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
2
2
  import { getDefaultTemplate as e } from "./template.js";
3
3
  const r = "radio-button-block";
4
- class c extends t {
4
+ class l extends t {
5
5
  constructor() {
6
6
  super();
7
7
  }
@@ -23,8 +23,11 @@ class c extends t {
23
23
  getTemplate() {
24
24
  return e();
25
25
  }
26
+ allowInnerBlocksDND() {
27
+ return !1;
28
+ }
26
29
  }
27
30
  export {
28
31
  r as BLOCK_ID,
29
- c as RadioButtonCustomBlock
32
+ l as RadioButtonCustomBlock
30
33
  };