@useinsider/guido 2.1.0-beta.aa05b06 → 2.1.0-beta.abc38f2

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 (200) hide show
  1. package/dist/@types/config/schemas.js +1 -1
  2. package/dist/components/organisms/base/Toaster.vue.js +4 -4
  3. package/dist/components/organisms/base/Toaster.vue2.js +12 -9
  4. package/dist/components/organisms/email-preview/desktop-preview/EmailSizeIndicator.vue.js +5 -5
  5. package/dist/components/organisms/email-preview/desktop-preview/EmailSizeIndicator.vue2.js +2 -2
  6. package/dist/components/organisms/extensions/recommendation/FilterItem.vue.js +11 -13
  7. package/dist/components/organisms/extensions/recommendation/FilterItem.vue2.js +54 -23
  8. package/dist/components/organisms/extensions/recommendation/FilterSelectionDrawer.vue.js +7 -5
  9. package/dist/components/organisms/extensions/recommendation/FilterSelectionDrawer.vue2.js +37 -23
  10. package/dist/components/organisms/extensions/recommendation/Filters.vue.js +11 -11
  11. package/dist/components/organisms/extensions/recommendation/Filters.vue2.js +48 -36
  12. package/dist/components/organisms/extensions/recommendation/LogicAdapter.vue2.js +11 -9
  13. package/dist/components/organisms/header/EditorActions.vue.js +10 -8
  14. package/dist/components/organisms/header/EditorActions.vue2.js +40 -30
  15. package/dist/components/organisms/header/MigrationConfirmModal.vue.js +17 -0
  16. package/dist/components/organisms/header/MigrationConfirmModal.vue2.js +39 -0
  17. package/dist/components/organisms/unsubscribe/UnsubscribePageSelection.vue.js +1 -1
  18. package/dist/components/organisms/unsubscribe/UnsubscribePageSelection.vue2.js +19 -19
  19. package/dist/composables/useBlocksConfig.js +21 -20
  20. package/dist/composables/useHtmlValidator.js +114 -104
  21. package/dist/composables/useRecommendation.js +54 -21
  22. package/dist/composables/useStripo.js +25 -23
  23. package/dist/composables/useVersionHistoryApi.js +1 -1
  24. package/dist/config/compiler/recommendationCompilerRules.js +45 -39
  25. package/dist/config/compiler/utils/recommendationCompilerUtils.js +121 -0
  26. package/dist/config/i18n/en/index.js +11 -0
  27. package/dist/config/i18n/en/labels.json.js +12 -0
  28. package/dist/config/i18n/en/toasters.json.js +56 -0
  29. package/dist/config/i18n/en/tooltips.json.js +82 -0
  30. package/dist/config/i18n/index.js +7 -0
  31. package/dist/config/migrator/itemsBlockMigrator.js +129 -120
  32. package/dist/config/migrator/recommendationMigrator.js +58 -54
  33. package/dist/enums/block.js +4 -0
  34. package/dist/enums/extensions/recommendationBlock.js +1 -1
  35. package/dist/enums/recommendation.js +16 -15
  36. package/dist/extensions/Blocks/Items/block.js +30 -21
  37. package/dist/extensions/Blocks/Items/iconsRegistry.js +7 -6
  38. package/dist/extensions/Blocks/Items/items.css.js +48 -0
  39. package/dist/extensions/Blocks/Recommendation/block.js +142 -9
  40. package/dist/extensions/Blocks/Recommendation/constants/blockIds.js +4 -0
  41. package/dist/extensions/Blocks/Recommendation/constants/controlIds.js +4 -0
  42. package/dist/extensions/Blocks/Recommendation/constants/defaultConfig.js +66 -0
  43. package/dist/extensions/Blocks/Recommendation/constants/layout.js +22 -0
  44. package/dist/extensions/Blocks/Recommendation/constants/selectors.js +21 -0
  45. package/dist/extensions/Blocks/Recommendation/controls/button/index.js +64 -0
  46. package/dist/extensions/Blocks/Recommendation/controls/cardBackground/index.js +80 -0
  47. package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +232 -0
  48. package/dist/extensions/Blocks/Recommendation/controls/image/index.js +19 -0
  49. package/dist/extensions/Blocks/Recommendation/controls/layout/index.js +92 -0
  50. package/dist/extensions/Blocks/Recommendation/controls/main/algorithm.js +102 -0
  51. package/dist/extensions/Blocks/Recommendation/controls/main/currency.js +209 -0
  52. package/dist/extensions/Blocks/Recommendation/controls/main/filters.js +52 -0
  53. package/dist/extensions/Blocks/Recommendation/controls/main/index.js +269 -0
  54. package/dist/extensions/Blocks/Recommendation/controls/main/locale.js +70 -0
  55. package/dist/extensions/Blocks/Recommendation/controls/main/productLayout.js +160 -0
  56. package/dist/extensions/Blocks/Recommendation/controls/main/shuffle.js +67 -0
  57. package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +307 -0
  58. package/dist/extensions/Blocks/Recommendation/controls/mobileLayout/cssRules.js +21 -0
  59. package/dist/extensions/Blocks/Recommendation/controls/name/index.js +46 -0
  60. package/dist/extensions/Blocks/Recommendation/controls/name/textTrim.js +108 -0
  61. package/dist/extensions/Blocks/Recommendation/controls/oldPrice/index.js +44 -0
  62. package/dist/extensions/Blocks/Recommendation/controls/omnibusDiscount/index.js +48 -0
  63. package/dist/extensions/Blocks/Recommendation/controls/{omnibusDiscountTextAfterControl.js → omnibusDiscount/textAfter.js} +16 -14
  64. package/dist/extensions/Blocks/Recommendation/controls/{omnibusDiscountTextBeforeControl.js → omnibusDiscount/textBefore.js} +16 -14
  65. package/dist/extensions/Blocks/Recommendation/controls/omnibusPrice/index.js +48 -0
  66. package/dist/extensions/Blocks/Recommendation/controls/{omnibusPriceTextAfterControl.js → omnibusPrice/textAfter.js} +16 -14
  67. package/dist/extensions/Blocks/Recommendation/controls/{omnibusPriceTextBeforeControl.js → omnibusPrice/textBefore.js} +14 -12
  68. package/dist/extensions/Blocks/Recommendation/controls/price/index.js +44 -0
  69. package/dist/extensions/Blocks/Recommendation/controls/spacing/index.js +222 -0
  70. package/dist/extensions/Blocks/Recommendation/extension.js +40 -17
  71. package/dist/extensions/Blocks/Recommendation/iconsRegistry.js +21 -4
  72. package/dist/extensions/Blocks/Recommendation/recommendation.css.js +61 -4
  73. package/dist/extensions/Blocks/Recommendation/services/configService.js +240 -0
  74. package/dist/extensions/Blocks/Recommendation/settingsPanel.js +21 -10
  75. package/dist/extensions/Blocks/Recommendation/store/recommendation.js +311 -218
  76. package/dist/extensions/Blocks/Recommendation/templates/grid/elementRenderer.js +228 -0
  77. package/dist/extensions/Blocks/Recommendation/templates/grid/migration.js +251 -0
  78. package/dist/extensions/Blocks/Recommendation/templates/grid/template.js +66 -0
  79. package/dist/extensions/Blocks/Recommendation/templates/index.js +12 -0
  80. package/dist/extensions/Blocks/Recommendation/templates/list/elementRenderer.js +169 -0
  81. package/dist/extensions/Blocks/Recommendation/templates/list/template.js +73 -0
  82. package/dist/extensions/Blocks/Recommendation/templates/utils.js +134 -0
  83. package/dist/extensions/Blocks/Recommendation/types/nodeConfig.js +6 -0
  84. package/dist/extensions/Blocks/Recommendation/utils/filterUtil.js +12 -12
  85. package/dist/extensions/Blocks/Recommendation/utils/preserveTextStyles.js +26 -15
  86. package/dist/extensions/Blocks/Recommendation/utils/priceFormatter.js +29 -0
  87. package/dist/extensions/Blocks/Recommendation/utils/tagName.js +46 -0
  88. package/dist/extensions/Blocks/Recommendation/validation/filterSchema.js +29 -0
  89. package/dist/extensions/Blocks/Unsubscribe/block.js +29 -29
  90. package/dist/extensions/Blocks/Unsubscribe/control.js +12 -9
  91. package/dist/extensions/Blocks/Unsubscribe/elements/preview.js +13 -11
  92. package/dist/extensions/Blocks/Unsubscribe/styles.css.js +31 -1
  93. package/dist/extensions/Blocks/common-control.js +12 -4
  94. package/dist/extensions/Blocks/controlFactories.js +125 -93
  95. package/dist/extensions/ModulesTabIcons/extension.js +3 -3
  96. package/dist/guido.css +1 -1
  97. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js +242 -186
  98. package/dist/services/recommendationApi.js +11 -8
  99. package/dist/services/stripoApi.js +20 -17
  100. package/dist/services/templateLibraryApi.js +16 -13
  101. package/dist/src/@types/extensions/block.d.ts +2 -0
  102. package/dist/src/components/Guido.vue.d.ts +1 -1
  103. package/dist/src/components/organisms/extensions/recommendation/FilterItem.vue.d.ts +1 -0
  104. package/dist/src/components/organisms/extensions/recommendation/Filters.vue.d.ts +17 -1
  105. package/dist/src/components/organisms/header/EditorActions.vue.d.ts +1 -1
  106. package/dist/src/components/organisms/header/HeaderWrapper.vue.d.ts +1 -1
  107. package/dist/src/components/organisms/header/MigrationConfirmModal.vue.d.ts +6 -0
  108. package/dist/src/components/organisms/header/RightSlot.vue.d.ts +1 -1
  109. package/dist/src/components/wrappers/WpDrawer.vue.d.ts +1 -1
  110. package/dist/src/components/wrappers/WpModal.vue.d.ts +2 -2
  111. package/dist/src/composables/useRecommendation.d.ts +1 -0
  112. package/dist/src/config/compiler/utils/recommendationCompilerUtils.d.ts +17 -0
  113. package/dist/src/config/i18n/en/index.d.ts +1 -0
  114. package/dist/src/config/i18n/index.d.ts +16 -0
  115. package/dist/src/enums/block.d.ts +4 -0
  116. package/dist/src/extensions/Blocks/Items/block.d.ts +3 -1
  117. package/dist/src/extensions/Blocks/Recommendation/block.d.ts +70 -1
  118. package/dist/src/extensions/Blocks/Recommendation/constants/blockIds.d.ts +13 -0
  119. package/dist/src/extensions/Blocks/Recommendation/{constants.d.ts → constants/controlIds.d.ts} +0 -24
  120. package/dist/src/extensions/Blocks/Recommendation/constants/defaultConfig.d.ts +49 -0
  121. package/dist/src/extensions/Blocks/Recommendation/constants/index.d.ts +13 -0
  122. package/dist/src/extensions/Blocks/Recommendation/constants/layout.d.ts +41 -0
  123. package/dist/src/extensions/Blocks/Recommendation/constants/selectors.d.ts +35 -0
  124. package/dist/src/extensions/Blocks/Recommendation/controls/button/index.d.ts +143 -0
  125. package/dist/src/extensions/Blocks/Recommendation/controls/cardBackground/index.d.ts +31 -0
  126. package/dist/src/extensions/Blocks/Recommendation/{cardCompositionControl.d.ts → controls/cardComposition/index.d.ts} +23 -3
  127. package/dist/src/extensions/Blocks/Recommendation/controls/image/index.d.ts +35 -0
  128. package/dist/src/extensions/Blocks/Recommendation/controls/index.d.ts +21 -589
  129. package/dist/src/extensions/Blocks/Recommendation/controls/layout/index.d.ts +37 -0
  130. package/dist/src/extensions/Blocks/Recommendation/controls/main/algorithm.d.ts +29 -0
  131. package/dist/src/extensions/Blocks/Recommendation/controls/main/currency.d.ts +52 -0
  132. package/dist/src/extensions/Blocks/Recommendation/controls/main/filters.d.ts +22 -0
  133. package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +84 -0
  134. package/dist/src/extensions/Blocks/Recommendation/controls/main/locale.d.ts +24 -0
  135. package/dist/src/extensions/Blocks/Recommendation/controls/main/productLayout.d.ts +60 -0
  136. package/dist/src/extensions/Blocks/Recommendation/controls/main/shuffle.d.ts +23 -0
  137. package/dist/src/extensions/Blocks/Recommendation/controls/main/utils.d.ts +221 -0
  138. package/dist/src/extensions/Blocks/Recommendation/controls/mobileLayout/cssRules.d.ts +29 -0
  139. package/dist/src/extensions/Blocks/Recommendation/controls/name/index.d.ts +97 -0
  140. package/dist/src/extensions/Blocks/Recommendation/controls/name/textTrim.d.ts +34 -0
  141. package/dist/src/extensions/Blocks/Recommendation/controls/oldPrice/index.d.ts +95 -0
  142. package/dist/src/extensions/Blocks/Recommendation/controls/omnibusDiscount/index.d.ts +100 -0
  143. package/dist/src/extensions/Blocks/Recommendation/controls/omnibusDiscount/textAfter.d.ts +15 -0
  144. package/dist/src/extensions/Blocks/Recommendation/controls/omnibusDiscount/textBefore.d.ts +15 -0
  145. package/dist/src/extensions/Blocks/Recommendation/controls/omnibusPrice/index.d.ts +100 -0
  146. package/dist/src/extensions/Blocks/Recommendation/controls/omnibusPrice/textAfter.d.ts +15 -0
  147. package/dist/src/extensions/Blocks/Recommendation/controls/omnibusPrice/textBefore.d.ts +15 -0
  148. package/dist/src/extensions/Blocks/Recommendation/controls/price/index.d.ts +95 -0
  149. package/dist/src/extensions/Blocks/Recommendation/controls/spacing/index.d.ts +83 -0
  150. package/dist/src/extensions/Blocks/Recommendation/extension.d.ts +9 -0
  151. package/dist/src/extensions/Blocks/Recommendation/services/configService.d.ts +151 -0
  152. package/dist/src/extensions/Blocks/Recommendation/services/index.d.ts +6 -0
  153. package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +154 -468
  154. package/dist/src/extensions/Blocks/Recommendation/templates/grid/elementRenderer.d.ts +20 -0
  155. package/dist/src/extensions/Blocks/Recommendation/templates/{migrationTemplate.d.ts → grid/migration.d.ts} +11 -4
  156. package/dist/src/extensions/Blocks/Recommendation/templates/grid/template.d.ts +33 -0
  157. package/dist/src/extensions/Blocks/Recommendation/templates/index.d.ts +41 -0
  158. package/dist/src/extensions/Blocks/Recommendation/templates/list/elementRenderer.d.ts +8 -0
  159. package/dist/src/extensions/Blocks/Recommendation/templates/list/migration.d.ts +25 -0
  160. package/dist/src/extensions/Blocks/Recommendation/templates/list/template.d.ts +18 -0
  161. package/dist/src/extensions/Blocks/Recommendation/templates/utils.d.ts +66 -0
  162. package/dist/src/extensions/Blocks/Recommendation/types/index.d.ts +7 -0
  163. package/dist/src/extensions/Blocks/Recommendation/types/nodeConfig.d.ts +166 -0
  164. package/dist/src/extensions/Blocks/Recommendation/utils/priceFormatter.d.ts +33 -0
  165. package/dist/src/extensions/Blocks/Recommendation/utils/stylePreserver.d.ts +113 -0
  166. package/dist/src/extensions/Blocks/Recommendation/utils/tagName.d.ts +77 -0
  167. package/dist/src/extensions/Blocks/Recommendation/validation/filterSchema.d.ts +15 -0
  168. package/dist/src/extensions/Blocks/Unsubscribe/control.d.ts +1 -0
  169. package/dist/src/extensions/Blocks/common-control.d.ts +5 -0
  170. package/dist/src/stores/template.d.ts +29 -0
  171. package/dist/src/utils/migrationBannerHtml.d.ts +2 -0
  172. package/dist/static/assets/info.svg.js +5 -0
  173. package/dist/static/styles/components/notification.css.js +19 -0
  174. package/dist/static/styles/components/tools.css.js +6 -2
  175. package/dist/static/styles/components/version-history.css.js +10 -2
  176. package/dist/static/styles/components/wide-panel.css.js +18 -2
  177. package/dist/static/styles/customEditorStyle.css.js +35 -11
  178. package/dist/static/styles/variables.css.js +2 -0
  179. package/dist/static/templates/empty/index.html.js +74 -0
  180. package/dist/static/templates/empty/style.css.js +779 -0
  181. package/dist/stores/template.js +15 -0
  182. package/dist/stores/unsubscribe.js +37 -34
  183. package/dist/utils/migrationBannerHtml.js +21 -0
  184. package/dist/utils/pairProductVariables.js +57 -56
  185. package/dist/utils/templatePreparation.js +15 -14
  186. package/package.json +2 -2
  187. package/dist/extensions/Blocks/Recommendation/cardCompositionControl.js +0 -187
  188. package/dist/extensions/Blocks/Recommendation/constants.js +0 -13
  189. package/dist/extensions/Blocks/Recommendation/control.js +0 -336
  190. package/dist/extensions/Blocks/Recommendation/controls/cardBackgroundColorControl.js +0 -68
  191. package/dist/extensions/Blocks/Recommendation/controls/index.js +0 -245
  192. package/dist/extensions/Blocks/Recommendation/controls/nameTextTrimControl.js +0 -74
  193. package/dist/extensions/Blocks/Recommendation/controls/spacingControl.js +0 -188
  194. package/dist/extensions/Blocks/Recommendation/templates/blockTemplate.js +0 -181
  195. package/dist/extensions/Blocks/Recommendation/templates/migrationTemplate.js +0 -189
  196. package/dist/extensions/Blocks/Recommendation/templates/templateUtils.js +0 -209
  197. package/dist/src/extensions/Blocks/Recommendation/control.d.ts +0 -38
  198. package/dist/src/extensions/Blocks/Recommendation/controls/nameTextTrimControl.d.ts +0 -16
  199. package/dist/src/extensions/Blocks/Recommendation/templates/blockTemplate.d.ts +0 -16
  200. package/dist/src/extensions/Blocks/Recommendation/templates/templateUtils.d.ts +0 -52
@@ -0,0 +1,52 @@
1
+ var n = Object.defineProperty;
2
+ var o = (i, e, t) => e in i ? n(i, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : i[e] = t;
3
+ var r = (i, e, t) => o(i, typeof e != "symbol" ? e + "" : e, t);
4
+ import { CommonControl as s } from "../../../common-control.js";
5
+ import { useRecommendationExtensionStore as l } from "../../store/recommendation.js";
6
+ const d = "recommendation-filters-control", a = {
7
+ FILTERS: "filterStatus"
8
+ };
9
+ class h extends s {
10
+ constructor() {
11
+ super(...arguments);
12
+ r(this, "store", l());
13
+ r(this, "addFilterListener", () => {
14
+ });
15
+ r(this, "addFilterButton", null);
16
+ }
17
+ getId() {
18
+ return d;
19
+ }
20
+ getTemplate() {
21
+ return `
22
+ <div class="filters-control-container">
23
+ ${this._GuTwoColumns([
24
+ this._GuLabel({ text: "Filters" }),
25
+ this._GuButton({
26
+ name: a.FILTERS,
27
+ label: "Add Filter",
28
+ id: "guido__btn-add-filter"
29
+ })
30
+ ])}
31
+ </div>
32
+ `;
33
+ }
34
+ onRender() {
35
+ this._setupButtonListener();
36
+ }
37
+ onDestroy() {
38
+ var t;
39
+ (t = this.addFilterButton) == null || t.removeEventListener("click", this.addFilterListener);
40
+ }
41
+ _onFilterSelectClick() {
42
+ this.store.openFilterDrawer();
43
+ }
44
+ _setupButtonListener() {
45
+ var t;
46
+ this.addFilterListener = this._onFilterSelectClick.bind(this), this.addFilterButton = this.getContainer().querySelector("#guido__btn-add-filter"), (t = this.addFilterButton) == null || t.addEventListener("click", this.addFilterListener);
47
+ }
48
+ }
49
+ export {
50
+ d as FILTERS_CONTROL_ID,
51
+ h as FiltersControl
52
+ };
@@ -0,0 +1,269 @@
1
+ var m = Object.defineProperty;
2
+ var h = (c, s, t) => s in c ? m(c, s, { enumerable: !0, configurable: !0, writable: !0, value: t }) : c[s] = t;
3
+ var n = (c, s, t) => h(c, typeof s != "symbol" ? s + "" : s, t);
4
+ import { CommonControl as f } from "../../../common-control.js";
5
+ import { RecommendationConfigService as l } from "../../services/configService.js";
6
+ import { useRecommendationExtensionStore as C } from "../../store/recommendation.js";
7
+ import { AlgorithmControl as p } from "./algorithm.js";
8
+ import { ALGORITHM_CONTROL_ID as W } from "./algorithm.js";
9
+ import { CurrencyControl as g } from "./currency.js";
10
+ import { CURRENCY_CONTROL_ID as H } from "./currency.js";
11
+ import { FiltersControl as R } from "./filters.js";
12
+ import { FILTERS_CONTROL_ID as j } from "./filters.js";
13
+ import { LocaleControl as N } from "./locale.js";
14
+ import { LOCALE_CONTROL_ID as K } from "./locale.js";
15
+ import { ProductLayoutControl as y } from "./productLayout.js";
16
+ import { PRODUCT_LAYOUT_CONTROL_ID as J } from "./productLayout.js";
17
+ import { ShuffleControl as _ } from "./shuffle.js";
18
+ import { SHUFFLE_CONTROL_ID as X } from "./shuffle.js";
19
+ import { regenerateProductRowsWithStyles as b, getBlockElement as I, updateProductContentInPlace as P } from "./utils.js";
20
+ import { formatProductPrice as tt, getCardComposition as et, getCurrentLayout as ot, reapplySpacing as rt, regenerateMobileProductRows as it, regenerateProductRows as nt, setCurrencyAttributes as st, updatePricesInPlace as ct, updateSingleProductContent as at } from "./utils.js";
21
+ import { useDebounceFn as u } from "../../../../../node_modules/@vueuse/shared/index.js";
22
+ const T = "recommendation-id", S = "ui-elements-recommendation-block";
23
+ class z extends f {
24
+ constructor() {
25
+ super(...arguments);
26
+ n(this, "store", C());
27
+ n(this, "storeUnsubscription", () => {
28
+ });
29
+ // Sub-control instances for lifecycle management
30
+ n(this, "algorithmControl", null);
31
+ n(this, "localeControl", null);
32
+ n(this, "currencyControl", null);
33
+ n(this, "productLayoutControl", null);
34
+ n(this, "filtersControl", null);
35
+ n(this, "shuffleControl", null);
36
+ /**
37
+ * Debounced product fetch to prevent rapid API calls during config changes
38
+ */
39
+ n(this, "_debouncedFetchProducts", u(() => {
40
+ this.store.fetchRecommendationProducts();
41
+ }, 500));
42
+ /**
43
+ * Debounced regeneration when products arrive from API
44
+ * Tries in-place update first to preserve styles, falls back to full regeneration
45
+ */
46
+ n(this, "_debouncedRegenerateWithProducts", u(() => {
47
+ const t = this.store.recommendationProducts;
48
+ if (!this.currentNode || !this.api)
49
+ return;
50
+ const e = this.api.getDocumentModifier();
51
+ P({
52
+ currentNode: this.currentNode,
53
+ documentModifier: e,
54
+ products: t
55
+ }) || this._regenerateWithProducts(t);
56
+ }, 100));
57
+ }
58
+ getId() {
59
+ return S;
60
+ }
61
+ getTemplate() {
62
+ return this.algorithmControl = new p(), this.localeControl = new N(), this.currencyControl = new g(), this.productLayoutControl = new y(), this.filtersControl = new R(), this.shuffleControl = new _(), `
63
+ <div class="recommendation-controls-container">
64
+ ${this.algorithmControl.getTemplate()}
65
+ ${this.localeControl.getTemplate()}
66
+ ${this.currencyControl.getTemplate()}
67
+ ${this.filtersControl.getTemplate()}
68
+ ${this.productLayoutControl.getTemplate()}
69
+ ${this.shuffleControl.getTemplate()}
70
+ </div>
71
+ `;
72
+ }
73
+ async onRender() {
74
+ var e;
75
+ const t = this._getRecommendationIdFromNode(this.currentNode) ?? this.store.currentRecommendationId;
76
+ if (t !== null && this.store.setCurrentBlock(t), this._listenStateUpdates(), t !== null && ((e = this.store.blockStates[t]) != null && e.isInitialized)) {
77
+ this._initializeSubControls();
78
+ return;
79
+ }
80
+ await this._fetchBlockData(t), this._initializeSubControls();
81
+ }
82
+ /**
83
+ * Immediately regenerate products with styles (no debounce)
84
+ * Used for initial load after fetch completes
85
+ */
86
+ _regenerateWithProducts(t) {
87
+ if (!this.currentNode || !this.api) {
88
+ console.warn("[Recommendation] Cannot regenerate - missing currentNode or api");
89
+ return;
90
+ }
91
+ b({
92
+ currentNode: this.currentNode,
93
+ documentModifier: this.api.getDocumentModifier(),
94
+ products: t
95
+ });
96
+ }
97
+ onTemplateNodeUpdated(t) {
98
+ var r;
99
+ super.onTemplateNodeUpdated(t);
100
+ const e = this._getRecommendationIdFromNode(t);
101
+ e !== null && e !== this.store.currentRecommendationId && this.store.setCurrentBlock(e), this._syncNodeConfigToStore(), e !== null && !((r = this.store.blockStates[e]) != null && r.isInitialized) && this._fetchBlockData(e), [
102
+ this.algorithmControl,
103
+ this.localeControl,
104
+ this.currencyControl,
105
+ this.productLayoutControl,
106
+ this.filtersControl,
107
+ this.shuffleControl
108
+ ].forEach((i) => {
109
+ var a;
110
+ i != null && i.api && (i.currentNode = t, (a = i.onTemplateNodeUpdated) == null || a.call(i, t));
111
+ });
112
+ }
113
+ onDestroy() {
114
+ this.storeUnsubscription(), [
115
+ this.algorithmControl,
116
+ this.localeControl,
117
+ this.currencyControl,
118
+ this.productLayoutControl,
119
+ this.filtersControl,
120
+ this.shuffleControl
121
+ ].forEach((e) => {
122
+ var o;
123
+ return (o = e == null ? void 0 : e.onDestroy) == null ? void 0 : o.call(e);
124
+ });
125
+ }
126
+ /**
127
+ * Initialize all sub-controls with the shared API context
128
+ * Each sub-control manages its own form values and event listeners
129
+ */
130
+ _initializeSubControls() {
131
+ [
132
+ this.algorithmControl,
133
+ this.localeControl,
134
+ this.currencyControl,
135
+ this.productLayoutControl,
136
+ this.filtersControl,
137
+ this.shuffleControl
138
+ ].forEach((e) => {
139
+ var o;
140
+ e && (e.api = this.api, e.currentNode = this.currentNode, (o = e.onRender) == null || o.call(e));
141
+ });
142
+ }
143
+ /**
144
+ * Syncs persisted node config into the Pinia store's block state.
145
+ *
146
+ * setCurrentBlock() creates a default entry (USD, en_US, mostPopular).
147
+ * For saved templates, the real config lives in the node (e.g., TRY, tr_TR).
148
+ * This method reads it and patches the store so fetchRecommendationProducts()
149
+ * uses the correct values.
150
+ *
151
+ * Uses triggerRefetch: false because the fetch hasn't happened yet —
152
+ * values are being prepared for the upcoming initial fetch.
153
+ */
154
+ _syncNodeConfigToStore() {
155
+ var r;
156
+ const t = l.getConfig(this.currentNode), e = this.store.currentRecommendationId, o = e !== null && ((r = this.store.blockStates[e]) == null ? void 0 : r.isInitialized);
157
+ this.store.patchCurrentBlockConfig({
158
+ strategy: t.strategy,
159
+ language: t.language,
160
+ size: t.size,
161
+ productIds: t.productIds,
162
+ // Only sync filters from node config during initial load.
163
+ // After initialization, the Pinia store is the source of truth
164
+ // for filters (edited via the filter drawer).
165
+ ...o ? {} : { filters: t.filters },
166
+ shuffleProducts: t.shuffleProducts,
167
+ currencySettings: {
168
+ name: t.currency.code,
169
+ value: t.currency.code,
170
+ symbol: t.currency.symbol,
171
+ alignment: t.currency.alignment === "before" ? "0" : "1",
172
+ decimalCount: t.currency.decimalCount.toString(),
173
+ decimalSeparator: t.currency.decimalSeparator,
174
+ thousandSeparator: t.currency.thousandSeparator
175
+ }
176
+ }, { triggerRefetch: !1 });
177
+ }
178
+ /**
179
+ * Fetches initial data for a block (filters, algorithms, products).
180
+ * Shared by onRender() and onTemplateNodeUpdated() to avoid duplication.
181
+ * Marks the block as initialized to prevent redundant fetches on re-selection.
182
+ */
183
+ async _fetchBlockData(t) {
184
+ t !== null && this.store.markBlockInitialized(t), (await Promise.allSettled([
185
+ this.store.fetchRecommendationFilters(),
186
+ this.store.fetchRecommendationCreateData(),
187
+ this.store.fetchRecommendationProducts()
188
+ ])).forEach((o, r) => {
189
+ o.status === "rejected" && console.warn(`Recommendation block: ${[
190
+ "fetchRecommendationFilters",
191
+ "fetchRecommendationCreateData",
192
+ "fetchRecommendationProducts"
193
+ ][r]} failed`, o.reason);
194
+ });
195
+ }
196
+ /**
197
+ * Reads the recommendation-id attribute from the block element within the node
198
+ */
199
+ _getRecommendationIdFromNode(t) {
200
+ const e = I(t);
201
+ if (!e || !("getAttribute" in e))
202
+ return null;
203
+ const o = e.getAttribute(T);
204
+ if (!o)
205
+ return null;
206
+ const r = parseInt(o);
207
+ return Number.isNaN(r) ? null : r;
208
+ }
209
+ /**
210
+ * Listen to store changes that require product refresh or regeneration.
211
+ *
212
+ * Uses configVersion counter (incremented only by patchCurrentBlockConfig)
213
+ * to distinguish user-initiated config changes from internal mutations
214
+ * (e.g., fetchRecommendationCreateData setting preferred currency).
215
+ */
216
+ _listenStateUpdates() {
217
+ const { store: t } = this;
218
+ let e = t.recommendationProducts, o = t.$state.configVersion;
219
+ this.storeUnsubscription = t.$subscribe(() => {
220
+ const r = t.$state.configVersion;
221
+ r !== o && (o = r, this._persistFiltersToNodeConfig(), this._debouncedFetchProducts());
222
+ const i = t.recommendationProducts, a = i !== e, d = Array.isArray(i) && i.length > 0;
223
+ a && d && (e = i, this._debouncedRegenerateWithProducts());
224
+ });
225
+ }
226
+ /**
227
+ * Persists the current filter state from Pinia store to the Stripo node config.
228
+ * This ensures filters survive template save/reload cycles.
229
+ */
230
+ _persistFiltersToNodeConfig() {
231
+ if (!this.currentNode || !this.api)
232
+ return;
233
+ const { filters: t } = this.store.recommendationConfigs;
234
+ l.updateConfig(
235
+ this.api,
236
+ this.currentNode,
237
+ { filters: t },
238
+ "Update recommendation filters"
239
+ );
240
+ }
241
+ }
242
+ export {
243
+ W as ALGORITHM_CONTROL_ID,
244
+ p as AlgorithmControl,
245
+ S as CONTROL_BLOCK_ID,
246
+ H as CURRENCY_CONTROL_ID,
247
+ g as CurrencyControl,
248
+ j as FILTERS_CONTROL_ID,
249
+ R as FiltersControl,
250
+ K as LOCALE_CONTROL_ID,
251
+ N as LocaleControl,
252
+ J as PRODUCT_LAYOUT_CONTROL_ID,
253
+ y as ProductLayoutControl,
254
+ z as RecommendationBlockControl,
255
+ X as SHUFFLE_CONTROL_ID,
256
+ _ as ShuffleControl,
257
+ tt as formatProductPrice,
258
+ I as getBlockElement,
259
+ et as getCardComposition,
260
+ ot as getCurrentLayout,
261
+ rt as reapplySpacing,
262
+ it as regenerateMobileProductRows,
263
+ nt as regenerateProductRows,
264
+ b as regenerateProductRowsWithStyles,
265
+ st as setCurrencyAttributes,
266
+ ct as updatePricesInPlace,
267
+ P as updateProductContentInPlace,
268
+ at as updateSingleProductContent
269
+ };
@@ -0,0 +1,70 @@
1
+ var s = Object.defineProperty;
2
+ var r = (o, t, e) => t in o ? s(o, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : o[t] = e;
3
+ var a = (o, t, e) => r(o, typeof t != "symbol" ? t + "" : t, e);
4
+ import { UEAttr as l } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
5
+ import { CommonControl as m } from "../../../common-control.js";
6
+ import { RecommendationConfigService as i } from "../../services/configService.js";
7
+ import { useRecommendationExtensionStore as c } from "../../store/recommendation.js";
8
+ const g = "recommendation-locale-control", n = {
9
+ LOCALE: "language"
10
+ };
11
+ class C extends m {
12
+ constructor() {
13
+ super(...arguments);
14
+ // Store is used ONLY for API-fetched data (language options), not for config
15
+ a(this, "store", c());
16
+ }
17
+ getId() {
18
+ return g;
19
+ }
20
+ getTemplate() {
21
+ return `
22
+ <div class="locale-control-container">
23
+ ${this._GuTwoColumns([
24
+ this._GuLabel({ text: "Recommendation Locale" }),
25
+ this._GuSelect({
26
+ name: n.LOCALE,
27
+ placeholder: "Select Recommendation Locale",
28
+ options: this.store.getLanguages
29
+ })
30
+ ])}
31
+ </div>
32
+ `;
33
+ }
34
+ onRender() {
35
+ this._initializeSelectItems(), this._setFormValues(), this._listenToFormUpdates();
36
+ }
37
+ onTemplateNodeUpdated(e) {
38
+ super.onTemplateNodeUpdated(e), this._setFormValues();
39
+ }
40
+ _setFormValues() {
41
+ const e = i.getConfig(this.currentNode);
42
+ this.api.updateValues({
43
+ [n.LOCALE]: e.language
44
+ });
45
+ }
46
+ _initializeSelectItems() {
47
+ this.api.setUIEAttribute(
48
+ n.LOCALE,
49
+ l.SELECTPICKER.items,
50
+ this.store.getLanguages
51
+ );
52
+ }
53
+ _onLocaleChange(e) {
54
+ this.currentNode && (i.updateConfig(
55
+ this.api,
56
+ this.currentNode,
57
+ { language: e },
58
+ `Changed language to ${e}`
59
+ ), this.store.patchCurrentBlockConfig({ language: e }));
60
+ }
61
+ _listenToFormUpdates() {
62
+ this.api.onValueChanged(n.LOCALE, (e) => {
63
+ this._onLocaleChange(e);
64
+ });
65
+ }
66
+ }
67
+ export {
68
+ g as LOCALE_CONTROL_ID,
69
+ C as LocaleControl
70
+ };
@@ -0,0 +1,160 @@
1
+ var _ = Object.defineProperty;
2
+ var c = (i, o, t) => o in i ? _(i, o, { enumerable: !0, configurable: !0, writable: !0, value: t }) : i[o] = t;
3
+ var d = (i, o, t) => c(i, typeof o != "symbol" ? o + "" : o, t);
4
+ import { EditorStatePropertyType as u, PreviewDeviceMode as R } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
5
+ import { CommonControl as h } from "../../../common-control.js";
6
+ import { MAX_PRODUCT_COUNT as C, MAX_PRODUCTS_PER_ROW as p, MAX_MOBILE_PRODUCTS_PER_ROW as m } from "../../constants/layout.js";
7
+ import { RecommendationConfigService as s } from "../../services/configService.js";
8
+ import { useRecommendationExtensionStore as l } from "../../store/recommendation.js";
9
+ import { ensureMobileCssRulesExist as O } from "../mobileLayout/cssRules.js";
10
+ import { getCurrentLayout as I, regenerateMobileProductRows as g, regenerateProductRowsWithStyles as b } from "./utils.js";
11
+ import { useDebounceFn as N } from "../../../../../node_modules/@vueuse/shared/index.js";
12
+ const P = "recommendation-product-layout-control", e = {
13
+ PRODUCT_COUNT: "size",
14
+ PRODUCT_IN_ROW: "cardsInRow",
15
+ PRODUCT_IN_ROW_LABEL: "cardsInRowLabel",
16
+ MOBILE_CARDS_IN_ROW: "mobileCardsInRow",
17
+ MOBILE_CARDS_IN_ROW_LABEL: "mobileCardsInRowLabel"
18
+ };
19
+ class S extends h {
20
+ constructor() {
21
+ super(...arguments);
22
+ // Store is used for backward compatibility with product fetching and regeneration
23
+ d(this, "store", l());
24
+ d(this, "storeUnsubscription", () => {
25
+ });
26
+ d(this, "_debouncedRegenerateProductRows", N(() => {
27
+ this._regenerateProductRows();
28
+ }, 500));
29
+ }
30
+ getId() {
31
+ return P;
32
+ }
33
+ getTemplate() {
34
+ return `
35
+ <div class="product-layout-control-container">
36
+ ${this._GuTwoColumns([
37
+ this._GuLabel({ text: "Number of Products" }),
38
+ this._GuCounter({ name: e.PRODUCT_COUNT, maxValue: C }),
39
+ this._GuLabel({
40
+ text: "Products in One Row on Desktop",
41
+ name: e.PRODUCT_IN_ROW_LABEL
42
+ }),
43
+ this._GuCounter({ name: e.PRODUCT_IN_ROW, maxValue: p }),
44
+ this._GuLabel({
45
+ text: "Products in One Row on Mobile",
46
+ name: e.MOBILE_CARDS_IN_ROW_LABEL
47
+ }),
48
+ this._GuCounter({
49
+ name: e.MOBILE_CARDS_IN_ROW,
50
+ maxValue: m
51
+ })
52
+ ])}
53
+ </div>
54
+ `;
55
+ }
56
+ onRender() {
57
+ this._setFormValues(), this._updateProductsInRowVisibility(), this._listenToFormUpdates(), this._listenStateUpdates(), this._subscribeToEditorModeChanges();
58
+ }
59
+ onTemplateNodeUpdated(t) {
60
+ super.onTemplateNodeUpdated(t), this._setFormValues(), this._updateProductsInRowVisibility();
61
+ }
62
+ onDestroy() {
63
+ this.storeUnsubscription();
64
+ }
65
+ _setFormValues() {
66
+ const t = s.getConfig(this.currentNode);
67
+ this.api.updateValues({
68
+ [e.PRODUCT_COUNT]: t.size,
69
+ [e.PRODUCT_IN_ROW]: t.cardsInRow,
70
+ [e.MOBILE_CARDS_IN_ROW]: t.mobileCardsInRow
71
+ });
72
+ }
73
+ /**
74
+ * Checks if the editor is currently in mobile preview mode
75
+ * using Stripo's EditorStatePropertyType API.
76
+ */
77
+ _isMobileMode() {
78
+ return this.api.getEditorState()[u.previewDeviceMode] === R.MOBILE;
79
+ }
80
+ /**
81
+ * Updates counter visibility based on layout orientation and editor mode.
82
+ * - List layout: hide both counters (products always full-width)
83
+ * - Grid + desktop mode: show desktop counter, hide mobile counter
84
+ * - Grid + mobile mode: show mobile counter, hide desktop counter
85
+ */
86
+ _updateProductsInRowVisibility() {
87
+ const r = (s.getConfig(this.currentNode).layout || I(this.currentNode)) === "grid", n = this._isMobileMode();
88
+ this.api.setVisibility(e.PRODUCT_IN_ROW, r && !n), this.api.setVisibility(e.PRODUCT_IN_ROW_LABEL, r && !n), this.api.setVisibility(e.MOBILE_CARDS_IN_ROW, r && n), this.api.setVisibility(e.MOBILE_CARDS_IN_ROW_LABEL, r && n);
89
+ }
90
+ /**
91
+ * Subscribes to editor preview mode changes via Stripo API.
92
+ * When the user switches between desktop/mobile preview, toggles
93
+ * which "Products in One Row" counter is visible.
94
+ */
95
+ _subscribeToEditorModeChanges() {
96
+ this.api.onEditorStatePropUpdated(
97
+ u.previewDeviceMode,
98
+ () => {
99
+ this._updateProductsInRowVisibility();
100
+ }
101
+ );
102
+ }
103
+ _onProductCountChange(t) {
104
+ this.currentNode && (s.updateConfig(
105
+ this.api,
106
+ this.currentNode,
107
+ { size: t },
108
+ `Changed product count to ${t}`
109
+ ), this.store.patchCurrentBlockConfig({ size: t }), this._debouncedRegenerateProductRows());
110
+ }
111
+ _onProductsInRowChange(t) {
112
+ this.currentNode && (s.updateConfig(
113
+ this.api,
114
+ this.currentNode,
115
+ { cardsInRow: t },
116
+ `Changed products per row to ${t}`
117
+ ), this.store.patchCurrentBlockConfig({ cardsInRow: t }), this._debouncedRegenerateProductRows());
118
+ }
119
+ _onMobileCardsInRowChange(t) {
120
+ this.currentNode && (s.updateConfig(
121
+ this.api,
122
+ this.currentNode,
123
+ { mobileCardsInRow: t },
124
+ `Changed mobile products per row to ${t}`
125
+ ), O(this.api), g({
126
+ currentNode: this.currentNode,
127
+ documentModifier: this.api.getDocumentModifier()
128
+ }));
129
+ }
130
+ _regenerateProductRows() {
131
+ b({
132
+ currentNode: this.currentNode,
133
+ documentModifier: this.api.getDocumentModifier()
134
+ });
135
+ }
136
+ _listenToFormUpdates() {
137
+ this.api.onValueChanged(e.PRODUCT_COUNT, (t) => {
138
+ this._onProductCountChange(t.toString());
139
+ }), this.api.onValueChanged(e.PRODUCT_IN_ROW, (t) => {
140
+ this._onProductsInRowChange(Number(t));
141
+ }), this.api.onValueChanged(e.MOBILE_CARDS_IN_ROW, (t) => {
142
+ this._onMobileCardsInRowChange(Number(t));
143
+ });
144
+ }
145
+ /**
146
+ * Subscribe to store changes to update visibility when layout changes
147
+ * This is still needed because layout changes come from LayoutControl
148
+ */
149
+ _listenStateUpdates() {
150
+ let t = this.store.recommendationConfigs.orientation;
151
+ this.storeUnsubscription = this.store.$subscribe(() => {
152
+ const a = this.store.recommendationConfigs.orientation;
153
+ a !== t && (t = a, this._updateProductsInRowVisibility());
154
+ });
155
+ }
156
+ }
157
+ export {
158
+ P as PRODUCT_LAYOUT_CONTROL_ID,
159
+ S as ProductLayoutControl
160
+ };
@@ -0,0 +1,67 @@
1
+ var r = Object.defineProperty;
2
+ var u = (o, t, e) => t in o ? r(o, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : o[t] = e;
3
+ var n = (o, t, e) => u(o, typeof t != "symbol" ? t + "" : t, e);
4
+ import { UEAttr as l } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
5
+ import { CommonControl as f } from "../../../common-control.js";
6
+ import { RecommendationConfigService as i } from "../../services/configService.js";
7
+ import { useRecommendationExtensionStore as d } from "../../store/recommendation.js";
8
+ const h = "recommendation-shuffle-control", s = {
9
+ SHUFFLE_PRODUCTS: "shuffleProducts"
10
+ };
11
+ class g extends f {
12
+ constructor() {
13
+ super(...arguments);
14
+ // Store is used for backward compatibility with product fetching
15
+ n(this, "store", d());
16
+ }
17
+ getId() {
18
+ return h;
19
+ }
20
+ getTemplate() {
21
+ return `
22
+ <div class="shuffle-control-container">
23
+ ${this._GuTwoColumns([
24
+ this._GuLabel({ text: "Shuffle Recommended Products" }),
25
+ this._GuToggle(s.SHUFFLE_PRODUCTS)
26
+ ])}
27
+ </div>
28
+ `;
29
+ }
30
+ onRender() {
31
+ this._initializeToggle(), this._setFormValues(), this._listenToFormUpdates();
32
+ }
33
+ onTemplateNodeUpdated(e) {
34
+ super.onTemplateNodeUpdated(e), this._setFormValues();
35
+ }
36
+ _setFormValues() {
37
+ const e = i.getConfig(this.currentNode);
38
+ this.api.updateValues({
39
+ [s.SHUFFLE_PRODUCTS]: e.shuffleProducts
40
+ });
41
+ }
42
+ _initializeToggle() {
43
+ const e = i.getConfig(this.currentNode);
44
+ this.api.setUIEAttribute(
45
+ s.SHUFFLE_PRODUCTS,
46
+ l.SELECTPICKER.items,
47
+ e.shuffleProducts
48
+ );
49
+ }
50
+ _onShuffleChange(e) {
51
+ this.currentNode && (i.updateConfig(
52
+ this.api,
53
+ this.currentNode,
54
+ { shuffleProducts: e },
55
+ `${e ? "Enabled" : "Disabled"} product shuffle`
56
+ ), this.store.patchCurrentBlockConfig({ shuffleProducts: e }));
57
+ }
58
+ _listenToFormUpdates() {
59
+ this.api.onValueChanged(s.SHUFFLE_PRODUCTS, (e) => {
60
+ this._onShuffleChange(!!e);
61
+ });
62
+ }
63
+ }
64
+ export {
65
+ h as SHUFFLE_CONTROL_ID,
66
+ g as ShuffleControl
67
+ };