@useinsider/guido 2.1.0-beta.c1e85ba → 2.1.0-beta.c2eabd2

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 (152) hide show
  1. package/README.md +1 -3
  2. package/dist/components/Guido.vue.js +1 -1
  3. package/dist/components/Guido.vue2.js +39 -36
  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/FilterSelectionDrawer.vue2.js +15 -14
  7. package/dist/composables/useHtmlValidator.js +114 -104
  8. package/dist/composables/useRecommendation.js +54 -21
  9. package/dist/composables/useSave.js +12 -16
  10. package/dist/composables/useStripo.js +54 -58
  11. package/dist/composables/useStripoEventHandler.js +12 -27
  12. package/dist/config/compiler/recommendationCompilerRules.js +45 -39
  13. package/dist/config/compiler/utils/recommendationCompilerUtils.js +121 -0
  14. package/dist/config/migrator/itemsBlockMigrator.js +101 -97
  15. package/dist/config/migrator/recommendationMigrator.js +2 -2
  16. package/dist/enums/extensions/recommendationBlock.js +1 -1
  17. package/dist/enums/recommendation.js +16 -15
  18. package/dist/enums/unsubscribe.js +21 -25
  19. package/dist/extensions/Blocks/Recommendation/block.js +133 -9
  20. package/dist/extensions/Blocks/Recommendation/constants/blockIds.js +4 -0
  21. package/dist/extensions/Blocks/Recommendation/constants/controlIds.js +4 -0
  22. package/dist/extensions/Blocks/Recommendation/constants/defaultConfig.js +66 -0
  23. package/dist/extensions/Blocks/Recommendation/constants/layout.js +22 -0
  24. package/dist/extensions/Blocks/Recommendation/constants/selectors.js +21 -0
  25. package/dist/extensions/Blocks/Recommendation/controls/button/index.js +64 -0
  26. package/dist/extensions/Blocks/Recommendation/controls/cardBackground/index.js +80 -0
  27. package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +232 -0
  28. package/dist/extensions/Blocks/Recommendation/controls/image/index.js +19 -0
  29. package/dist/extensions/Blocks/Recommendation/controls/layout/index.js +92 -0
  30. package/dist/extensions/Blocks/Recommendation/controls/main/algorithm.js +102 -0
  31. package/dist/extensions/Blocks/Recommendation/controls/main/currency.js +209 -0
  32. package/dist/extensions/Blocks/Recommendation/controls/main/filters.js +52 -0
  33. package/dist/extensions/Blocks/Recommendation/controls/main/index.js +250 -0
  34. package/dist/extensions/Blocks/Recommendation/controls/main/locale.js +70 -0
  35. package/dist/extensions/Blocks/Recommendation/controls/main/productLayout.js +160 -0
  36. package/dist/extensions/Blocks/Recommendation/controls/main/shuffle.js +67 -0
  37. package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +307 -0
  38. package/dist/extensions/Blocks/Recommendation/controls/mobileLayout/cssRules.js +21 -0
  39. package/dist/extensions/Blocks/Recommendation/controls/name/index.js +46 -0
  40. package/dist/extensions/Blocks/Recommendation/controls/name/textTrim.js +108 -0
  41. package/dist/extensions/Blocks/Recommendation/controls/oldPrice/index.js +44 -0
  42. package/dist/extensions/Blocks/Recommendation/controls/omnibusDiscount/index.js +48 -0
  43. package/dist/extensions/Blocks/Recommendation/controls/{omnibusDiscountTextAfterControl.js → omnibusDiscount/textAfter.js} +16 -14
  44. package/dist/extensions/Blocks/Recommendation/controls/{omnibusDiscountTextBeforeControl.js → omnibusDiscount/textBefore.js} +16 -14
  45. package/dist/extensions/Blocks/Recommendation/controls/omnibusPrice/index.js +48 -0
  46. package/dist/extensions/Blocks/Recommendation/controls/{omnibusPriceTextAfterControl.js → omnibusPrice/textAfter.js} +16 -14
  47. package/dist/extensions/Blocks/Recommendation/controls/{omnibusPriceTextBeforeControl.js → omnibusPrice/textBefore.js} +14 -12
  48. package/dist/extensions/Blocks/Recommendation/controls/price/index.js +44 -0
  49. package/dist/extensions/Blocks/Recommendation/controls/spacing/index.js +222 -0
  50. package/dist/extensions/Blocks/Recommendation/extension.js +40 -17
  51. package/dist/extensions/Blocks/Recommendation/iconsRegistry.js +19 -3
  52. package/dist/extensions/Blocks/Recommendation/recommendation.css.js +13 -4
  53. package/dist/extensions/Blocks/Recommendation/services/configService.js +240 -0
  54. package/dist/extensions/Blocks/Recommendation/settingsPanel.js +21 -10
  55. package/dist/extensions/Blocks/Recommendation/store/recommendation.js +254 -207
  56. package/dist/extensions/Blocks/Recommendation/templates/grid/elementRenderer.js +228 -0
  57. package/dist/extensions/Blocks/Recommendation/templates/grid/migration.js +251 -0
  58. package/dist/extensions/Blocks/Recommendation/templates/grid/template.js +66 -0
  59. package/dist/extensions/Blocks/Recommendation/templates/index.js +12 -0
  60. package/dist/extensions/Blocks/Recommendation/templates/list/elementRenderer.js +169 -0
  61. package/dist/extensions/Blocks/Recommendation/templates/list/template.js +73 -0
  62. package/dist/extensions/Blocks/Recommendation/templates/utils.js +134 -0
  63. package/dist/extensions/Blocks/Recommendation/types/nodeConfig.js +6 -0
  64. package/dist/extensions/Blocks/Recommendation/utils/filterUtil.js +9 -9
  65. package/dist/extensions/Blocks/Recommendation/utils/preserveTextStyles.js +26 -15
  66. package/dist/extensions/Blocks/Recommendation/utils/priceFormatter.js +29 -0
  67. package/dist/extensions/Blocks/Recommendation/utils/tagName.js +46 -0
  68. package/dist/extensions/Blocks/controlFactories.js +125 -93
  69. package/dist/guido.css +1 -1
  70. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js +242 -186
  71. package/dist/services/recommendationApi.js +11 -8
  72. package/dist/services/stripoApi.js +12 -48
  73. package/dist/services/templateLibraryApi.js +16 -13
  74. package/dist/src/@types/events.d.ts +2 -38
  75. package/dist/src/components/wrappers/WpDrawer.vue.d.ts +1 -1
  76. package/dist/src/composables/useRecommendation.d.ts +1 -0
  77. package/dist/src/config/compiler/utils/recommendationCompilerUtils.d.ts +17 -0
  78. package/dist/src/enums/unsubscribe.d.ts +0 -3
  79. package/dist/src/extensions/Blocks/Recommendation/block.d.ts +67 -0
  80. package/dist/src/extensions/Blocks/Recommendation/constants/blockIds.d.ts +13 -0
  81. package/dist/src/extensions/Blocks/Recommendation/{constants.d.ts → constants/controlIds.d.ts} +0 -24
  82. package/dist/src/extensions/Blocks/Recommendation/constants/defaultConfig.d.ts +49 -0
  83. package/dist/src/extensions/Blocks/Recommendation/constants/index.d.ts +13 -0
  84. package/dist/src/extensions/Blocks/Recommendation/constants/layout.d.ts +41 -0
  85. package/dist/src/extensions/Blocks/Recommendation/constants/selectors.d.ts +35 -0
  86. package/dist/src/extensions/Blocks/Recommendation/controls/button/index.d.ts +143 -0
  87. package/dist/src/extensions/Blocks/Recommendation/controls/cardBackground/index.d.ts +31 -0
  88. package/dist/src/extensions/Blocks/Recommendation/{cardCompositionControl.d.ts → controls/cardComposition/index.d.ts} +23 -3
  89. package/dist/src/extensions/Blocks/Recommendation/controls/image/index.d.ts +35 -0
  90. package/dist/src/extensions/Blocks/Recommendation/controls/index.d.ts +21 -589
  91. package/dist/src/extensions/Blocks/Recommendation/controls/layout/index.d.ts +37 -0
  92. package/dist/src/extensions/Blocks/Recommendation/controls/main/algorithm.d.ts +29 -0
  93. package/dist/src/extensions/Blocks/Recommendation/controls/main/currency.d.ts +52 -0
  94. package/dist/src/extensions/Blocks/Recommendation/controls/main/filters.d.ts +22 -0
  95. package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +79 -0
  96. package/dist/src/extensions/Blocks/Recommendation/controls/main/locale.d.ts +24 -0
  97. package/dist/src/extensions/Blocks/Recommendation/controls/main/productLayout.d.ts +60 -0
  98. package/dist/src/extensions/Blocks/Recommendation/controls/main/shuffle.d.ts +23 -0
  99. package/dist/src/extensions/Blocks/Recommendation/controls/main/utils.d.ts +221 -0
  100. package/dist/src/extensions/Blocks/Recommendation/controls/mobileLayout/cssRules.d.ts +29 -0
  101. package/dist/src/extensions/Blocks/Recommendation/controls/name/index.d.ts +97 -0
  102. package/dist/src/extensions/Blocks/Recommendation/controls/name/textTrim.d.ts +34 -0
  103. package/dist/src/extensions/Blocks/Recommendation/controls/oldPrice/index.d.ts +95 -0
  104. package/dist/src/extensions/Blocks/Recommendation/controls/omnibusDiscount/index.d.ts +100 -0
  105. package/dist/src/extensions/Blocks/Recommendation/controls/omnibusDiscount/textAfter.d.ts +15 -0
  106. package/dist/src/extensions/Blocks/Recommendation/controls/omnibusDiscount/textBefore.d.ts +15 -0
  107. package/dist/src/extensions/Blocks/Recommendation/controls/omnibusPrice/index.d.ts +100 -0
  108. package/dist/src/extensions/Blocks/Recommendation/controls/omnibusPrice/textAfter.d.ts +15 -0
  109. package/dist/src/extensions/Blocks/Recommendation/controls/omnibusPrice/textBefore.d.ts +15 -0
  110. package/dist/src/extensions/Blocks/Recommendation/controls/price/index.d.ts +95 -0
  111. package/dist/src/extensions/Blocks/Recommendation/controls/spacing/index.d.ts +83 -0
  112. package/dist/src/extensions/Blocks/Recommendation/extension.d.ts +9 -0
  113. package/dist/src/extensions/Blocks/Recommendation/services/configService.d.ts +151 -0
  114. package/dist/src/extensions/Blocks/Recommendation/services/index.d.ts +6 -0
  115. package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +138 -468
  116. package/dist/src/extensions/Blocks/Recommendation/templates/grid/elementRenderer.d.ts +20 -0
  117. package/dist/src/extensions/Blocks/Recommendation/templates/{migrationTemplate.d.ts → grid/migration.d.ts} +11 -4
  118. package/dist/src/extensions/Blocks/Recommendation/templates/grid/template.d.ts +33 -0
  119. package/dist/src/extensions/Blocks/Recommendation/templates/index.d.ts +41 -0
  120. package/dist/src/extensions/Blocks/Recommendation/templates/list/elementRenderer.d.ts +8 -0
  121. package/dist/src/extensions/Blocks/Recommendation/templates/list/migration.d.ts +25 -0
  122. package/dist/src/extensions/Blocks/Recommendation/templates/list/template.d.ts +18 -0
  123. package/dist/src/extensions/Blocks/Recommendation/templates/utils.d.ts +66 -0
  124. package/dist/src/extensions/Blocks/Recommendation/types/index.d.ts +7 -0
  125. package/dist/src/extensions/Blocks/Recommendation/types/nodeConfig.d.ts +166 -0
  126. package/dist/src/extensions/Blocks/Recommendation/utils/priceFormatter.d.ts +33 -0
  127. package/dist/src/extensions/Blocks/Recommendation/utils/stylePreserver.d.ts +113 -0
  128. package/dist/src/extensions/Blocks/Recommendation/utils/tagName.d.ts +77 -0
  129. package/dist/src/services/stripoApi.d.ts +0 -5
  130. package/dist/src/stores/editor.d.ts +0 -23
  131. package/dist/static/styles/customEditorStyle.css.js +35 -11
  132. package/dist/stores/editor.js +1 -2
  133. package/dist/utils/pairProductVariables.js +57 -56
  134. package/dist/utils/templatePreparation.js +15 -14
  135. package/package.json +1 -1
  136. package/dist/composables/useSyncModuleExtractor.js +0 -45
  137. package/dist/extensions/Blocks/Recommendation/cardCompositionControl.js +0 -187
  138. package/dist/extensions/Blocks/Recommendation/constants.js +0 -13
  139. package/dist/extensions/Blocks/Recommendation/control.js +0 -336
  140. package/dist/extensions/Blocks/Recommendation/controls/cardBackgroundColorControl.js +0 -68
  141. package/dist/extensions/Blocks/Recommendation/controls/index.js +0 -245
  142. package/dist/extensions/Blocks/Recommendation/controls/nameTextTrimControl.js +0 -74
  143. package/dist/extensions/Blocks/Recommendation/controls/spacingControl.js +0 -188
  144. package/dist/extensions/Blocks/Recommendation/templates/blockTemplate.js +0 -181
  145. package/dist/extensions/Blocks/Recommendation/templates/migrationTemplate.js +0 -189
  146. package/dist/extensions/Blocks/Recommendation/templates/templateUtils.js +0 -209
  147. package/dist/src/composables/useSyncModuleExtractor.d.ts +0 -4
  148. package/dist/src/extensions/Blocks/Recommendation/control.d.ts +0 -38
  149. package/dist/src/extensions/Blocks/Recommendation/controls/nameTextTrimControl.d.ts +0 -16
  150. package/dist/src/extensions/Blocks/Recommendation/templates/blockTemplate.d.ts +0 -16
  151. package/dist/src/extensions/Blocks/Recommendation/templates/templateUtils.d.ts +0 -52
  152. package/dist/src/mock/api/settings.d.ts +0 -2
@@ -1,6 +1,6 @@
1
1
  import { useHttp as c } from "../composables/useHttp.js";
2
- import { URLS as a } from "../enums/extensions/recommendationBlock.js";
3
- const R = () => {
2
+ import { URLS as m } from "../enums/extensions/recommendationBlock.js";
3
+ const f = () => {
4
4
  const { get: o } = c();
5
5
  return {
6
6
  fetchRecommendationCreateData: async () => {
@@ -18,14 +18,17 @@ const R = () => {
18
18
  throw console.error("fetchRecommendationFilters error:", e), e;
19
19
  }
20
20
  },
21
- fetchRecommendationProducts: async (e, n) => {
21
+ fetchRecommendationProducts: async (e, a) => {
22
+ var n;
22
23
  try {
23
- const t = decodeURIComponent(new URLSearchParams(Object.entries(n)).toString());
24
+ const t = decodeURIComponent(new URLSearchParams(Object.entries(a)).toString());
24
25
  console.debug("🏁 Recommendation API Query:", t);
25
- const r = await o(
26
- `${a.RECOMMENDATION_API_URL}/v2/${e}?${t}`
26
+ const { get: s } = c({
27
+ headers: {}
28
+ }), r = await s(
29
+ `${m.RECOMMENDATION_API_URL}/v2/${e}?${t}`
27
30
  );
28
- return (r == null ? void 0 : r.data) ?? [];
31
+ return ((n = r == null ? void 0 : r.data) == null ? void 0 : n.data) ?? [];
29
32
  } catch (t) {
30
33
  throw console.error("fetchRecommendationProducts error:", t), t;
31
34
  }
@@ -33,5 +36,5 @@ const R = () => {
33
36
  };
34
37
  };
35
38
  export {
36
- R as useRecommendationApi
39
+ f as useRecommendationApi
37
40
  };
@@ -1,26 +1,26 @@
1
- import { useHttp as l } from "../composables/useHttp.js";
2
- import { useToaster as d } from "../composables/useToaster.js";
1
+ import { useHttp as m } from "../composables/useHttp.js";
2
+ import { useToaster as i } from "../composables/useToaster.js";
3
3
  import { MAX_DEFAULT_TEMPLATE_ID as p } from "../enums/defaults.js";
4
- const b = () => {
5
- const { get: s, post: c } = l(), { handleError: r } = d();
4
+ const y = () => {
5
+ const { get: r } = m(), { handleError: o } = i();
6
6
  return {
7
7
  getToken: async () => {
8
8
  try {
9
- const t = Number(localStorage.getItem("ins-guido-test-instance")), { data: e } = await s(`/stripo/get-user-token?test=${t}`);
9
+ const t = Number(localStorage.getItem("ins-guido-test-instance")), { data: e } = await r(`/stripo/get-user-token?test=${t}`);
10
10
  return e.body.token;
11
11
  } catch (t) {
12
- return r(t, "Failed to fetch token"), "";
12
+ return o(t, "Failed to fetch token"), "";
13
13
  }
14
14
  },
15
15
  getCustomFonts: async () => {
16
16
  try {
17
- const { data: t = [] } = await s("/stripo/get-partner-custom-fonts");
17
+ const { data: t = [] } = await r("/stripo/get-partner-custom-fonts");
18
18
  return t.map((e) => ({
19
19
  ...e,
20
20
  active: !0
21
21
  }));
22
22
  } catch (t) {
23
- return r(t, "Failed to fetch custom fonts"), [];
23
+ return o(t, "Failed to fetch custom fonts"), [];
24
24
  }
25
25
  },
26
26
  getDefaultTemplate: async () => {
@@ -29,52 +29,16 @@ const b = () => {
29
29
  css: ""
30
30
  };
31
31
  try {
32
- const u = new URLSearchParams(window.location.search).get("default-template"), o = u ? parseInt(u) : 0, i = o >= 1 && o <= p ? o : 0, { data: n } = await s(
33
- `/stripo/default-template/${i}`
32
+ const c = new URLSearchParams(window.location.search).get("default-template"), s = c ? parseInt(c) : 0, l = s >= 1 && s <= p ? s : 0, { data: n } = await r(
33
+ `/stripo/default-template/${l}`
34
34
  ), a = typeof n == "string" ? JSON.parse(n) : n;
35
35
  return !a || typeof a != "object" || !("html" in a) || !("css" in a) ? t : a;
36
36
  } catch (e) {
37
- return r(e, "Failed to fetch default template"), t;
38
- }
39
- },
40
- getSyncModulesStatus: async () => {
41
- try {
42
- const { data: t } = await s("/newsletter/settings/synchronisation-in-modules-status");
43
- return t.status;
44
- } catch (t) {
45
- return r(t, "Failed to fetch sync modules status"), !1;
46
- }
47
- },
48
- updateSyncModule: async (t) => {
49
- try {
50
- return await c(`/stripo/stripo-modules/${t.moduleId}/update`), !0;
51
- } catch (e) {
52
- return r(e, "Failed to update sync module"), !1;
53
- }
54
- },
55
- getSyncModule: async (t) => {
56
- try {
57
- const { data: e } = await s(`/stripo/stripo-modules/${t}/get`);
58
- return e;
59
- } catch (e) {
60
- return r(e, "Failed to get sync module"), {
61
- id: 0,
62
- stripoId: 0,
63
- unsubscriptionPreferencePages: []
64
- };
65
- }
66
- },
67
- setSyncModuleUnsubscriptionPages: async (t) => {
68
- if (t.length === 0)
69
- return !0;
70
- try {
71
- return await c("/stripo/stripo-modules/set-unsubscription-preference-pages", t), !0;
72
- } catch (e) {
73
- return r(e, "Failed to set unsubscription preference pages"), !1;
37
+ return o(e, "Failed to fetch default template"), t;
74
38
  }
75
39
  }
76
40
  };
77
41
  };
78
42
  export {
79
- b as useStripoApi
43
+ y as useStripoApi
80
44
  };
@@ -3,29 +3,30 @@ import { useHttp as f } from "../composables/useHttp.js";
3
3
  import { useToaster as w } from "../composables/useToaster.js";
4
4
  import { useTranslations as b } from "../composables/useTranslations.js";
5
5
  import { EditorType as h } from "../enums/defaults.js";
6
- import { useSaveAsTemplateStore as C } from "../stores/save-as-template.js";
6
+ import { useRecommendationExtensionStore as C } from "../extensions/Blocks/Recommendation/store/recommendation.js";
7
+ import { useSaveAsTemplateStore as v } from "../stores/save-as-template.js";
7
8
  import { base64EncodeWithSpecialChars as a } from "../utils/base64.js";
8
- import { useTemplatePreparation as v } from "../utils/templatePreparation.js";
9
- const L = () => {
10
- const { get: m, post: n } = f(), { handleError: o, showToaster: i } = w(), { config: l } = T(), p = b();
9
+ import { useTemplatePreparation as S } from "../utils/templatePreparation.js";
10
+ const R = () => {
11
+ const { get: n, post: c } = f(), { handleError: o, showToaster: i } = w(), { config: l } = T(), p = b();
11
12
  return {
12
13
  getCategories: async () => {
13
14
  try {
14
- const { data: e = [] } = await m("/newsletter/template-library/get-template-categories");
15
+ const { data: e = [] } = await n("/newsletter/template-library/get-template-categories");
15
16
  return e;
16
17
  } catch (e) {
17
18
  return o(e, "Failed to fetch template categories"), [];
18
19
  }
19
20
  },
20
21
  checkTemplateNameAvailability: async (e) => {
21
- const { data: { status: t = !1 } } = await m(
22
+ const { data: { status: t = !1 } } = await n(
22
23
  `/newsletter/template-library/template-name-exists?name=${e}`
23
24
  );
24
25
  return !t;
25
26
  },
26
27
  createCategory: async (e) => {
27
28
  try {
28
- const { data: { id: t } } = await n(
29
+ const { data: { id: t } } = await c(
29
30
  "/newsletter/template-library/create-category",
30
31
  { name: e }
31
32
  );
@@ -37,7 +38,7 @@ const L = () => {
37
38
  createTemplate: async () => {
38
39
  var e, t, g, y;
39
40
  try {
40
- const { prepareTemplateDetails: c } = v(), r = C(), s = await c(), u = {
41
+ const { prepareTemplateDetails: m } = S(), r = v(), s = await m(), u = {
41
42
  name: r.getTemplateName,
42
43
  categories: r.getSelectedCategoryIds,
43
44
  productId: ((t = (e = l.value) == null ? void 0 : e.partner) == null ? void 0 : t.productType) || 0,
@@ -47,7 +48,9 @@ const L = () => {
47
48
  css: a(s.css),
48
49
  unsubscriptionPreferencePageStatus: !1,
49
50
  unsubscriptionPreferencePages: [],
50
- recommendationCampaignUrls: a({}),
51
+ recommendationCampaignUrls: a(
52
+ C().recommendationCampaignUrls
53
+ ),
51
54
  recommendationConfigs: a({}),
52
55
  isGuido: !0,
53
56
  stripoConfig: a({
@@ -55,7 +58,7 @@ const L = () => {
55
58
  html: s.rawHtml,
56
59
  css: s.css
57
60
  })
58
- }, { data: { type: d } } = await n(
61
+ }, { data: { type: d } } = await c(
59
62
  "/newsletter/template-library/create-template",
60
63
  u
61
64
  );
@@ -76,12 +79,12 @@ const L = () => {
76
79
  ),
77
80
  type: "success"
78
81
  });
79
- } catch (c) {
80
- o(c, "Failed to create template");
82
+ } catch (m) {
83
+ o(m, "Failed to create template");
81
84
  }
82
85
  }
83
86
  };
84
87
  };
85
88
  export {
86
- L as useTemplateLibraryApi
89
+ R as useTemplateLibraryApi
87
90
  };
@@ -1,42 +1,6 @@
1
- export type StripoEventType = 'save' | 'export' | 'close' | 'autosave' | 'publish' | 'export:requested' | 'export:ready' | 'module_updated' | 'module_dropped';
2
- export interface ModuleUpdatedParams {
3
- target: string;
4
- blockType: string;
5
- moduleId: number;
6
- moduleCategory: string | null;
7
- syncModule: boolean;
8
- }
9
- export interface ModuleDroppedParams {
10
- target: string;
11
- blockType: string;
12
- moduleId: number;
13
- syncModule: boolean;
14
- }
15
- export interface SyncModuleUnsubscribePayload {
16
- stripoModuleId: string;
17
- unsubscriptionPreferencePages: number[];
18
- type: string;
19
- }
20
- export interface SyncModuleExtractResult {
21
- unsubscribePayload: SyncModuleUnsubscribePayload[];
22
- stripoModules: string[];
23
- }
24
- export interface SyncModuleResponse {
25
- id: number;
26
- stripoId: number;
27
- unsubscriptionPreferencePages: UnsubscriptionPreferencePage[];
28
- }
29
- export interface UnsubscriptionPreferencePage {
30
- id: number;
31
- name: string;
32
- type: number;
33
- status: number;
34
- isVisible: number;
35
- thumbnail: string;
36
- createdAt: string;
37
- }
1
+ export type StripoEventType = 'save' | 'export' | 'close' | 'autosave' | 'publish' | 'export:requested' | 'export:ready';
38
2
  export interface EventHandler {
39
- (params: Record<string, unknown>): void | Promise<void>;
3
+ (params: Record<string, string>): void | Promise<void>;
40
4
  }
41
5
  export interface EventHandlers {
42
6
  [eventType: string]: EventHandler;
@@ -33,8 +33,8 @@ declare const __VLS_component: import("vue").DefineComponent<__VLS_WithDefaults<
33
33
  descriptionStatus: boolean;
34
34
  descriptionText: string;
35
35
  }>>>, {
36
- className: string;
37
36
  size: "small" | "medium" | "large";
37
+ className: string;
38
38
  closeOnOutsideClick: boolean;
39
39
  descriptionStatus: boolean;
40
40
  descriptionText: string;
@@ -15,5 +15,6 @@ interface CampaignData extends CardWidthParams {
15
15
  export declare const useRecommendation: () => {
16
16
  calculateCardWidth: ({ mobileLeftPadding, mobileRightPadding, cardsInRow, unresponsive, }: CardWidthParams) => number;
17
17
  getRecommendationCampaignData: (id: string) => CampaignData;
18
+ buildCampaignUrl: (campaignId: string) => string;
18
19
  };
19
20
  export {};
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Formats a price template variable with the correct currency alignment.
3
+ * @param campaignId - The recommendation block campaign ID
4
+ * @param productIndex - Zero-based product index
5
+ * @param attribute - Price attribute name (e.g., 'price', 'original_price')
6
+ * @param alignment - Currency alignment from block config: 'before' or 'after'
7
+ * @returns Formatted price string with currency variable in correct position
8
+ */
9
+ export declare function formatPriceVariable(campaignId: string, productIndex: number, attribute: string, alignment: string): string;
10
+ /**
11
+ * Transforms recommendation block HTML by replacing product data with
12
+ * template variables.
13
+ * Preserves the full document structure (DOCTYPE, html, head, body).
14
+ * @param html - The raw template HTML
15
+ * @returns HTML with template variables replacing product data
16
+ */
17
+ export declare function prepareRecommendationBlocks(html: string): string;
@@ -25,9 +25,6 @@ export declare const PAGE_TYPES: {
25
25
  SUBSCRIPTION_PREFERENCE_CONFIRMATION: number;
26
26
  RESUBSCRIBE: number;
27
27
  };
28
- export declare const UNSUBSCRIBE_SYNC_MODULE_TYPES: {
29
- [x: number]: string;
30
- };
31
28
  export declare const TYPE_COLLECTIONS: {
32
29
  [x: number]: number[];
33
30
  };
@@ -1,11 +1,78 @@
1
+ /**
2
+ * Recommendation Block
3
+ *
4
+ * Main block class for the Recommendation extension.
5
+ * Handles block lifecycle including configuration initialization and migration.
6
+ * Supports multiple block instances with unique recommendation-id attributes.
7
+ */
8
+ import type { ImmutableHtmlNode } from '@stripoinc/ui-editor-extensions';
1
9
  import { Block, BlockCompositionType } from '@stripoinc/ui-editor-extensions';
2
10
  export declare const BLOCK_ID = "recommendation-block";
3
11
  export declare class RecommendationBlock extends Block {
12
+ /**
13
+ * Stores the ID generated in getTemplate() so onCreated() can reuse it.
14
+ * This avoids generating a new (different) ID in onCreated().
15
+ */
16
+ private _pendingBlockId;
4
17
  constructor();
5
18
  getId(): string;
6
19
  getIcon(): string;
7
20
  getBlockCompositionType(): BlockCompositionType;
8
21
  getName(): string;
9
22
  getDescription(): string;
23
+ /**
24
+ * Returns the template HTML for a new recommendation block.
25
+ * Generates a unique recommendation ID and embeds the instance class
26
+ * (ins-recommendation-v3-block-{id}) directly in the template HTML.
27
+ * This is necessary because Stripo's Angular rendering manages the class
28
+ * attribute and overwrites dynamically added classes via setAttribute.
29
+ */
10
30
  getTemplate(): string;
31
+ /**
32
+ * Called when a new block is dropped into the template
33
+ *
34
+ * Uses the ID from getTemplate() (which already embedded the instance class)
35
+ * and assigns the recommendation-id attribute + initializes configuration.
36
+ * @param node - The newly created block node
37
+ */
38
+ onCreated(node: ImmutableHtmlNode): void;
39
+ /**
40
+ * Called when the document changes or template is loaded
41
+ *
42
+ * Handles migration from legacy templates that don't have node config
43
+ * and assigns recommendation-id to legacy blocks that lack one.
44
+ * @param node - The block node that may need migration
45
+ */
46
+ onDocumentChanged(node: ImmutableHtmlNode): void;
47
+ /**
48
+ * Called when a block is deleted from the template
49
+ *
50
+ * Cleans up the per-block state from the Pinia store.
51
+ * @param node - The block node being deleted
52
+ */
53
+ onDelete(node: ImmutableHtmlNode): void;
54
+ /**
55
+ * Generates the next unique recommendation ID by scanning all existing blocks
56
+ * in the document and finding the maximum existing ID + 1.
57
+ */
58
+ private _generateNextId;
59
+ /**
60
+ * Assigns a recommendation-id attribute to the block element.
61
+ * The instance class (ins-recommendation-v3-block-{id}) is embedded in the template
62
+ * HTML by getTemplate(), since Stripo's Angular rendering overwrites dynamically
63
+ * added classes via setAttribute.
64
+ */
65
+ private _assignRecommendationId;
66
+ /**
67
+ * Gets the recommendation-id from a block node
68
+ */
69
+ private _getRecommendationId;
70
+ /**
71
+ * Gets the block element (the element with BLOCK_CLASS)
72
+ */
73
+ private _getBlockElement;
74
+ /**
75
+ * Migrate configuration from legacy format
76
+ */
77
+ private _migrateFromLegacy;
11
78
  }
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Block IDs used in the Recommendation Extension
3
+ * These IDs are used in the esd-extension-block-id attribute to identify specific blocks
4
+ */
5
+ export declare enum RecommendationBlockId {
6
+ BUTTON = "recommendation-block-button",
7
+ NAME = "recommendation-block-name",
8
+ PRICE = "recommendation-block-price",
9
+ OLD_PRICE = "recommendation-block-old-price",
10
+ OMNIBUS_PRICE = "recommendation-block-omnibus-price",
11
+ OMNIBUS_DISCOUNT = "recommendation-block-omnibus-discount",
12
+ IMAGE = "recommendation-block-image"
13
+ }
@@ -1,27 +1,3 @@
1
- /**
2
- * Attribute type constants used in templates
3
- * These are used as keys in ElementRenderer and composition arrays
4
- */
5
- export declare const ATTR_PRODUCT_IMAGE = "productImage";
6
- export declare const ATTR_PRODUCT_NAME = "productName";
7
- export declare const ATTR_PRODUCT_PRICE = "productPrice";
8
- export declare const ATTR_PRODUCT_OLD_PRICE = "productOldPrice";
9
- export declare const ATTR_PRODUCT_OMNIBUS_PRICE = "productOmnibusPrice";
10
- export declare const ATTR_PRODUCT_OMNIBUS_DISCOUNT = "productOmnibusDiscount";
11
- export declare const ATTR_PRODUCT_BUTTON = "productButton";
12
- /**
13
- * Block IDs used in the Recommendation Extension
14
- * These IDs are used in the esd-extension-block-id attribute to identify specific blocks
15
- */
16
- export declare enum RecommendationBlockId {
17
- BUTTON = "recommendation-block-button",
18
- NAME = "recommendation-block-name",
19
- PRICE = "recommendation-block-price",
20
- OLD_PRICE = "recommendation-block-old-price",
21
- OMNIBUS_PRICE = "recommendation-block-omnibus-price",
22
- OMNIBUS_DISCOUNT = "recommendation-block-omnibus-discount",
23
- IMAGE = "recommendation-block-image"
24
- }
25
1
  /**
26
2
  * Control IDs used in the Recommendation Extension
27
3
  * These IDs are returned by the getId() method of each control
@@ -0,0 +1,49 @@
1
+ /**
2
+ * Default Configuration for Recommendation Block
3
+ *
4
+ * This module provides the default values for RecommendationNodeConfig.
5
+ * These values are used when:
6
+ * - A new block is dropped into the template
7
+ * - Migrating legacy templates without stored config
8
+ * - Merging partial updates with existing config
9
+ */
10
+ import type { RecommendationNodeConfig, CurrencyConfig, OmnibusTextConfig } from '../types/nodeConfig';
11
+ /**
12
+ * Default currency configuration
13
+ * Uses USD as the base currency with standard formatting
14
+ * Note: symbol stores the currency code (e.g., 'USD'), not the symbol character ('$')
15
+ * This matches the Currency Symbol dropdown which shows currency codes
16
+ */
17
+ export declare const DEFAULT_CURRENCY: CurrencyConfig;
18
+ /**
19
+ * Default omnibus price text configuration
20
+ * Pre-filled with common EU Omnibus Directive text
21
+ */
22
+ export declare const DEFAULT_OMNIBUS_PRICE: OmnibusTextConfig;
23
+ /**
24
+ * Default omnibus discount text configuration
25
+ */
26
+ export declare const DEFAULT_OMNIBUS_DISCOUNT: OmnibusTextConfig;
27
+ /**
28
+ * Default card composition order
29
+ * Defines the visual order of elements in product cards
30
+ */
31
+ export declare const DEFAULT_COMPOSITION: string[];
32
+ /**
33
+ * Default visibility settings for card elements
34
+ * Omnibus elements are hidden by default (not all regions require them)
35
+ */
36
+ export declare const DEFAULT_VISIBILITY: Record<string, boolean>;
37
+ /**
38
+ * Complete default configuration for Recommendation Block
39
+ *
40
+ * This is the single source of truth for default values.
41
+ * All other code should import and use this constant.
42
+ */
43
+ export declare const DEFAULT_NODE_CONFIG: RecommendationNodeConfig;
44
+ /**
45
+ * Current configuration version
46
+ * Increment this when making breaking changes to the schema
47
+ * Used for migration detection
48
+ */
49
+ export declare const CURRENT_CONFIG_VERSION = 1;
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Recommendation Extension Constants
3
+ *
4
+ * This module re-exports all constants for the Recommendation extension.
5
+ * Import from this file for cleaner imports.
6
+ * @example
7
+ * import { RecommendationBlockId, CONTAINER_SELECTOR } from './constants';
8
+ */
9
+ export { RecommendationBlockId } from './blockIds';
10
+ export { RecommendationControlId } from './controlIds';
11
+ export { CONTAINER_SELECTOR, DESKTOP_CONTAINER_SELECTOR, MOBILE_CONTAINER_SELECTOR, CURRENCY_ATTR, ATTR_PRODUCT_IMAGE, ATTR_PRODUCT_NAME, ATTR_PRODUCT_PRICE, ATTR_PRODUCT_OLD_PRICE, ATTR_PRODUCT_OMNIBUS_PRICE, ATTR_PRODUCT_OMNIBUS_DISCOUNT, ATTR_PRODUCT_BUTTON, } from './selectors';
12
+ export { LAYOUT_VALUES, LAYOUT_OPTIONS, DEFAULT_PRODUCTS_PER_ROW, DEFAULT_CARDS_IN_ROW, DEFAULT_MOBILE_CARDS_IN_ROW, MAX_PRODUCT_COUNT, MIN_PRODUCT_COUNT, MAX_PRODUCTS_PER_ROW, MIN_PRODUCTS_PER_ROW, MAX_MOBILE_PRODUCTS_PER_ROW, MIN_MOBILE_PRODUCTS_PER_ROW, DEFAULT_COLUMN_SPACING, DEFAULT_ROW_SPACING, MIN_SPACING, MAX_SPACING, SPACING_STEP, } from './layout';
13
+ export { DEFAULT_NODE_CONFIG, DEFAULT_CURRENCY, DEFAULT_COMPOSITION, DEFAULT_VISIBILITY, CURRENT_CONFIG_VERSION, } from './defaultConfig';
@@ -0,0 +1,41 @@
1
+ /** Type-safe layout orientation values */
2
+ export declare const LAYOUT_VALUES: {
3
+ GRID: "grid";
4
+ LIST: "list";
5
+ };
6
+ /** Layout options for radio button UI control */
7
+ export declare const LAYOUT_OPTIONS: ({
8
+ icon: string;
9
+ value: "grid";
10
+ } | {
11
+ icon: string;
12
+ value: "list";
13
+ })[];
14
+ /** Default number of products displayed per row in grid layout */
15
+ export declare const DEFAULT_PRODUCTS_PER_ROW = 3;
16
+ /** Default number of cards in a row (used in store initialization) */
17
+ export declare const DEFAULT_CARDS_IN_ROW = 3;
18
+ /** Maximum number of products that can be displayed */
19
+ export declare const MAX_PRODUCT_COUNT = 9;
20
+ /** Minimum number of products that can be displayed */
21
+ export declare const MIN_PRODUCT_COUNT = 1;
22
+ /** Maximum number of products per row in grid layout */
23
+ export declare const MAX_PRODUCTS_PER_ROW = 4;
24
+ /** Minimum number of products per row in grid layout */
25
+ export declare const MIN_PRODUCTS_PER_ROW = 1;
26
+ /** Default number of products per row on mobile */
27
+ export declare const DEFAULT_MOBILE_CARDS_IN_ROW = 1;
28
+ /** Maximum products per row on mobile */
29
+ export declare const MAX_MOBILE_PRODUCTS_PER_ROW = 2;
30
+ /** Minimum products per row on mobile */
31
+ export declare const MIN_MOBILE_PRODUCTS_PER_ROW = 1;
32
+ /** Default column spacing between product cards (5px on each side = 10px total) */
33
+ export declare const DEFAULT_COLUMN_SPACING = 10;
34
+ /** Default row spacing between product rows */
35
+ export declare const DEFAULT_ROW_SPACING = 20;
36
+ /** Minimum spacing value */
37
+ export declare const MIN_SPACING = 0;
38
+ /** Maximum spacing value */
39
+ export declare const MAX_SPACING = 50;
40
+ /** Spacing adjustment step */
41
+ export declare const SPACING_STEP = 5;
@@ -0,0 +1,35 @@
1
+ /**
2
+ * CSS selectors and data attributes used across the Recommendation extension
3
+ */
4
+ /**
5
+ * Container selector for the product container element
6
+ * Used across controls to target elements within the recommendation block
7
+ */
8
+ export declare const CONTAINER_SELECTOR = ".ins-recommendation-product-container";
9
+ /** Desktop product container selector */
10
+ export declare const DESKTOP_CONTAINER_SELECTOR = ".ins-recommendation-desktop-container";
11
+ /** Mobile product container selector */
12
+ export declare const MOBILE_CONTAINER_SELECTOR = ".ins-recommendation-mobile-container";
13
+ /**
14
+ * Currency HTML attributes set on the block element
15
+ * These are read by the HTML compiler at runtime to format prices
16
+ */
17
+ export declare const CURRENCY_ATTR: {
18
+ readonly CURRENCY: "currency";
19
+ readonly SYMBOL: "currency-symbol";
20
+ readonly ALIGNMENT: "currency-alignment";
21
+ readonly THOUSAND_SEPARATOR: "currency-thousand-separator";
22
+ readonly DECIMAL_SEPARATOR: "currency-decimal-separator";
23
+ readonly DECIMAL_COUNT: "currency-decimal-count";
24
+ };
25
+ /**
26
+ * Attribute type constants used in templates
27
+ * These are used as keys in ElementRenderer and composition arrays
28
+ */
29
+ export declare const ATTR_PRODUCT_IMAGE = "productImage";
30
+ export declare const ATTR_PRODUCT_NAME = "productName";
31
+ export declare const ATTR_PRODUCT_PRICE = "productPrice";
32
+ export declare const ATTR_PRODUCT_OLD_PRICE = "productOldPrice";
33
+ export declare const ATTR_PRODUCT_OMNIBUS_PRICE = "productOmnibusPrice";
34
+ export declare const ATTR_PRODUCT_OMNIBUS_DISCOUNT = "productOmnibusDiscount";
35
+ export declare const ATTR_PRODUCT_BUTTON = "productButton";