@useinsider/guido 2.1.0-beta.42f5dfa → 2.1.0-beta.4bcb91b

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 (149) hide show
  1. package/README.md +3 -1
  2. package/dist/components/organisms/extensions/recommendation/FilterSelectionDrawer.vue2.js +14 -15
  3. package/dist/components/organisms/header/HeaderWrapper.vue.js +9 -9
  4. package/dist/composables/useHtmlValidator.js +84 -106
  5. package/dist/composables/useRecommendation.js +21 -54
  6. package/dist/composables/useSave.js +16 -12
  7. package/dist/composables/useStripo.js +58 -54
  8. package/dist/composables/useStripoEventHandler.js +27 -12
  9. package/dist/composables/useSyncModuleExtractor.js +33 -0
  10. package/dist/config/compiler/recommendationCompilerRules.js +39 -45
  11. package/dist/config/migrator/recommendationMigrator.js +2 -2
  12. package/dist/enums/extensions/recommendationBlock.js +1 -1
  13. package/dist/enums/recommendation.js +15 -16
  14. package/dist/enums/unsubscribe.js +25 -21
  15. package/dist/extensions/Blocks/Recommendation/block.js +9 -130
  16. package/dist/extensions/Blocks/Recommendation/cardCompositionControl.js +187 -0
  17. package/dist/extensions/Blocks/Recommendation/constants.js +13 -0
  18. package/dist/extensions/Blocks/Recommendation/control.js +336 -0
  19. package/dist/extensions/Blocks/Recommendation/controls/cardBackgroundColorControl.js +68 -0
  20. package/dist/extensions/Blocks/Recommendation/controls/index.js +245 -0
  21. package/dist/extensions/Blocks/Recommendation/controls/nameTextTrimControl.js +74 -0
  22. package/dist/extensions/Blocks/Recommendation/controls/{omnibusDiscount/textAfter.js → omnibusDiscountTextAfterControl.js} +14 -16
  23. package/dist/extensions/Blocks/Recommendation/controls/{omnibusDiscount/textBefore.js → omnibusDiscountTextBeforeControl.js} +14 -16
  24. package/dist/extensions/Blocks/Recommendation/controls/{omnibusPrice/textAfter.js → omnibusPriceTextAfterControl.js} +14 -16
  25. package/dist/extensions/Blocks/Recommendation/controls/{omnibusPrice/textBefore.js → omnibusPriceTextBeforeControl.js} +12 -14
  26. package/dist/extensions/Blocks/Recommendation/controls/spacingControl.js +188 -0
  27. package/dist/extensions/Blocks/Recommendation/extension.js +17 -40
  28. package/dist/extensions/Blocks/Recommendation/iconsRegistry.js +3 -19
  29. package/dist/extensions/Blocks/Recommendation/recommendation.css.js +4 -13
  30. package/dist/extensions/Blocks/Recommendation/settingsPanel.js +10 -21
  31. package/dist/extensions/Blocks/Recommendation/store/recommendation.js +193 -230
  32. package/dist/extensions/Blocks/Recommendation/templates/blockTemplate.js +181 -0
  33. package/dist/extensions/Blocks/Recommendation/templates/migrationTemplate.js +189 -0
  34. package/dist/extensions/Blocks/Recommendation/templates/templateUtils.js +209 -0
  35. package/dist/extensions/Blocks/Recommendation/utils/filterUtil.js +9 -9
  36. package/dist/extensions/Blocks/Recommendation/utils/preserveTextStyles.js +15 -26
  37. package/dist/extensions/Blocks/controlFactories.js +93 -125
  38. package/dist/guido.css +1 -1
  39. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js +169 -223
  40. package/dist/services/recommendationApi.js +9 -10
  41. package/dist/services/stripoApi.js +50 -14
  42. package/dist/services/templateLibraryApi.js +13 -16
  43. package/dist/src/@types/events.d.ts +34 -2
  44. package/dist/src/components/wrappers/WpDrawer.vue.d.ts +1 -1
  45. package/dist/src/composables/useRecommendation.d.ts +0 -1
  46. package/dist/src/composables/useSyncModuleExtractor.d.ts +4 -0
  47. package/dist/src/enums/unsubscribe.d.ts +3 -0
  48. package/dist/src/extensions/Blocks/Recommendation/block.d.ts +0 -67
  49. package/dist/src/extensions/Blocks/Recommendation/{controls/cardComposition/index.d.ts → cardCompositionControl.d.ts} +3 -23
  50. package/dist/src/extensions/Blocks/Recommendation/{constants/controlIds.d.ts → constants.d.ts} +24 -0
  51. package/dist/src/extensions/Blocks/Recommendation/control.d.ts +38 -0
  52. package/dist/src/extensions/Blocks/Recommendation/controls/index.d.ts +589 -21
  53. package/dist/src/extensions/Blocks/Recommendation/controls/nameTextTrimControl.d.ts +16 -0
  54. package/dist/src/extensions/Blocks/Recommendation/extension.d.ts +0 -9
  55. package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +468 -131
  56. package/dist/src/extensions/Blocks/Recommendation/templates/blockTemplate.d.ts +16 -0
  57. package/dist/src/extensions/Blocks/Recommendation/templates/{grid/migration.d.ts → migrationTemplate.d.ts} +4 -11
  58. package/dist/src/extensions/Blocks/Recommendation/templates/templateUtils.d.ts +52 -0
  59. package/dist/src/mock/api/settings.d.ts +2 -0
  60. package/dist/src/services/stripoApi.d.ts +5 -0
  61. package/dist/src/stores/editor.d.ts +23 -0
  62. package/dist/static/styles/components/notification.css.js +1 -0
  63. package/dist/static/styles/components/version-history.css.js +10 -2
  64. package/dist/static/styles/components/wide-panel.css.js +18 -2
  65. package/dist/static/styles/customEditorStyle.css.js +2 -25
  66. package/dist/stores/editor.js +2 -1
  67. package/dist/utils/pairProductVariables.js +56 -57
  68. package/dist/utils/templatePreparation.js +14 -15
  69. package/package.json +1 -1
  70. package/dist/config/compiler/utils/recommendationCompilerUtils.js +0 -116
  71. package/dist/extensions/Blocks/Recommendation/constants/blockIds.js +0 -4
  72. package/dist/extensions/Blocks/Recommendation/constants/controlIds.js +0 -4
  73. package/dist/extensions/Blocks/Recommendation/constants/defaultConfig.js +0 -65
  74. package/dist/extensions/Blocks/Recommendation/constants/layout.js +0 -20
  75. package/dist/extensions/Blocks/Recommendation/constants/selectors.js +0 -19
  76. package/dist/extensions/Blocks/Recommendation/controls/button/index.js +0 -64
  77. package/dist/extensions/Blocks/Recommendation/controls/cardBackground/index.js +0 -80
  78. package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +0 -232
  79. package/dist/extensions/Blocks/Recommendation/controls/image/index.js +0 -19
  80. package/dist/extensions/Blocks/Recommendation/controls/layout/index.js +0 -92
  81. package/dist/extensions/Blocks/Recommendation/controls/main/algorithm.js +0 -102
  82. package/dist/extensions/Blocks/Recommendation/controls/main/currency.js +0 -209
  83. package/dist/extensions/Blocks/Recommendation/controls/main/filters.js +0 -52
  84. package/dist/extensions/Blocks/Recommendation/controls/main/index.js +0 -217
  85. package/dist/extensions/Blocks/Recommendation/controls/main/locale.js +0 -70
  86. package/dist/extensions/Blocks/Recommendation/controls/main/productLayout.js +0 -110
  87. package/dist/extensions/Blocks/Recommendation/controls/main/shuffle.js +0 -67
  88. package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +0 -286
  89. package/dist/extensions/Blocks/Recommendation/controls/name/index.js +0 -46
  90. package/dist/extensions/Blocks/Recommendation/controls/name/textTrim.js +0 -108
  91. package/dist/extensions/Blocks/Recommendation/controls/oldPrice/index.js +0 -44
  92. package/dist/extensions/Blocks/Recommendation/controls/omnibusDiscount/index.js +0 -48
  93. package/dist/extensions/Blocks/Recommendation/controls/omnibusPrice/index.js +0 -48
  94. package/dist/extensions/Blocks/Recommendation/controls/price/index.js +0 -44
  95. package/dist/extensions/Blocks/Recommendation/controls/spacing/index.js +0 -222
  96. package/dist/extensions/Blocks/Recommendation/services/configService.js +0 -240
  97. package/dist/extensions/Blocks/Recommendation/templates/grid/elementRenderer.js +0 -233
  98. package/dist/extensions/Blocks/Recommendation/templates/grid/migration.js +0 -251
  99. package/dist/extensions/Blocks/Recommendation/templates/grid/template.js +0 -69
  100. package/dist/extensions/Blocks/Recommendation/templates/index.js +0 -12
  101. package/dist/extensions/Blocks/Recommendation/templates/list/elementRenderer.js +0 -174
  102. package/dist/extensions/Blocks/Recommendation/templates/list/template.js +0 -73
  103. package/dist/extensions/Blocks/Recommendation/templates/utils.js +0 -122
  104. package/dist/extensions/Blocks/Recommendation/types/nodeConfig.js +0 -6
  105. package/dist/extensions/Blocks/Recommendation/utils/priceFormatter.js +0 -29
  106. package/dist/extensions/Blocks/Recommendation/utils/tagName.js +0 -46
  107. package/dist/src/config/compiler/utils/recommendationCompilerUtils.d.ts +0 -17
  108. package/dist/src/extensions/Blocks/Recommendation/constants/blockIds.d.ts +0 -13
  109. package/dist/src/extensions/Blocks/Recommendation/constants/defaultConfig.d.ts +0 -49
  110. package/dist/src/extensions/Blocks/Recommendation/constants/index.d.ts +0 -13
  111. package/dist/src/extensions/Blocks/Recommendation/constants/layout.d.ts +0 -35
  112. package/dist/src/extensions/Blocks/Recommendation/constants/selectors.d.ts +0 -31
  113. package/dist/src/extensions/Blocks/Recommendation/controls/button/index.d.ts +0 -143
  114. package/dist/src/extensions/Blocks/Recommendation/controls/cardBackground/index.d.ts +0 -31
  115. package/dist/src/extensions/Blocks/Recommendation/controls/image/index.d.ts +0 -35
  116. package/dist/src/extensions/Blocks/Recommendation/controls/layout/index.d.ts +0 -37
  117. package/dist/src/extensions/Blocks/Recommendation/controls/main/algorithm.d.ts +0 -29
  118. package/dist/src/extensions/Blocks/Recommendation/controls/main/currency.d.ts +0 -52
  119. package/dist/src/extensions/Blocks/Recommendation/controls/main/filters.d.ts +0 -22
  120. package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +0 -68
  121. package/dist/src/extensions/Blocks/Recommendation/controls/main/locale.d.ts +0 -24
  122. package/dist/src/extensions/Blocks/Recommendation/controls/main/productLayout.d.ts +0 -42
  123. package/dist/src/extensions/Blocks/Recommendation/controls/main/shuffle.d.ts +0 -23
  124. package/dist/src/extensions/Blocks/Recommendation/controls/main/utils.d.ts +0 -214
  125. package/dist/src/extensions/Blocks/Recommendation/controls/name/index.d.ts +0 -97
  126. package/dist/src/extensions/Blocks/Recommendation/controls/name/textTrim.d.ts +0 -34
  127. package/dist/src/extensions/Blocks/Recommendation/controls/oldPrice/index.d.ts +0 -95
  128. package/dist/src/extensions/Blocks/Recommendation/controls/omnibusDiscount/index.d.ts +0 -100
  129. package/dist/src/extensions/Blocks/Recommendation/controls/omnibusDiscount/textAfter.d.ts +0 -15
  130. package/dist/src/extensions/Blocks/Recommendation/controls/omnibusDiscount/textBefore.d.ts +0 -15
  131. package/dist/src/extensions/Blocks/Recommendation/controls/omnibusPrice/index.d.ts +0 -100
  132. package/dist/src/extensions/Blocks/Recommendation/controls/omnibusPrice/textAfter.d.ts +0 -15
  133. package/dist/src/extensions/Blocks/Recommendation/controls/omnibusPrice/textBefore.d.ts +0 -15
  134. package/dist/src/extensions/Blocks/Recommendation/controls/price/index.d.ts +0 -95
  135. package/dist/src/extensions/Blocks/Recommendation/controls/spacing/index.d.ts +0 -83
  136. package/dist/src/extensions/Blocks/Recommendation/services/configService.d.ts +0 -151
  137. package/dist/src/extensions/Blocks/Recommendation/services/index.d.ts +0 -6
  138. package/dist/src/extensions/Blocks/Recommendation/templates/grid/elementRenderer.d.ts +0 -20
  139. package/dist/src/extensions/Blocks/Recommendation/templates/grid/template.d.ts +0 -33
  140. package/dist/src/extensions/Blocks/Recommendation/templates/index.d.ts +0 -39
  141. package/dist/src/extensions/Blocks/Recommendation/templates/list/elementRenderer.d.ts +0 -8
  142. package/dist/src/extensions/Blocks/Recommendation/templates/list/migration.d.ts +0 -25
  143. package/dist/src/extensions/Blocks/Recommendation/templates/list/template.d.ts +0 -18
  144. package/dist/src/extensions/Blocks/Recommendation/templates/utils.d.ts +0 -57
  145. package/dist/src/extensions/Blocks/Recommendation/types/index.d.ts +0 -7
  146. package/dist/src/extensions/Blocks/Recommendation/types/nodeConfig.d.ts +0 -160
  147. package/dist/src/extensions/Blocks/Recommendation/utils/priceFormatter.d.ts +0 -33
  148. package/dist/src/extensions/Blocks/Recommendation/utils/stylePreserver.d.ts +0 -113
  149. package/dist/src/extensions/Blocks/Recommendation/utils/tagName.d.ts +0 -77
package/README.md CHANGED
@@ -1,6 +1,8 @@
1
1
  <p align="center">
2
2
  <a href="https://www.youtube.com/shorts/Y0RwBeMezL4" target="_blank" rel="noopener noreferrer">
3
- <img width="180" src="./public/guido.png" alt="Guido logo">
3
+ <img width="180"
4
+ src="https://web-image.useinsider.com/guido/defaultImageLibrary/iUH0liTK0d2YDsVB5LDN1770169173.jpg"
5
+ alt="Guido logo">
4
6
  </a>
5
7
  </p>
6
8
 
@@ -1,16 +1,16 @@
1
1
  import { defineComponent as n, ref as a, computed as l } from "vue";
2
2
  import i from "../../../wrappers/WpDrawer.vue.js";
3
- import { useTranslations as c } from "../../../../composables/useTranslations.js";
4
- import { useRecommendationExtensionStore as p } from "../../../../extensions/Blocks/Recommendation/store/recommendation.js";
3
+ import { useTranslations as p } from "../../../../composables/useTranslations.js";
4
+ import { useRecommendationExtensionStore as c } from "../../../../extensions/Blocks/Recommendation/store/recommendation.js";
5
5
  import u from "./Filters.vue.js";
6
- const v = /* @__PURE__ */ n({
6
+ const b = /* @__PURE__ */ n({
7
7
  __name: "FilterSelectionDrawer",
8
- setup(f) {
9
- const r = c(), t = p(), e = a(!1), s = l(() => ({
8
+ setup(m) {
9
+ const t = p(), o = c(), e = a(!1), s = l(() => ({
10
10
  primaryButton: {
11
11
  styling: "solid",
12
12
  type: "primary",
13
- labelText: r(
13
+ labelText: t(
14
14
  e.value ? "unsubscription-preference.selecting-type" : "products.select-and-continue"
15
15
  ),
16
16
  loadingStatus: e.value,
@@ -19,20 +19,19 @@ const v = /* @__PURE__ */ n({
19
19
  cancelOrBackButton: {
20
20
  styling: "ghost",
21
21
  type: "secondary",
22
- labelText: r("products.cancel"),
22
+ labelText: t("products.cancel"),
23
23
  disabledStatus: e.value
24
24
  }
25
- })), o = () => {
26
- t.closeFilterDrawer();
25
+ })), r = () => {
26
+ o.filterSelectionDrawerStatus = !1;
27
27
  };
28
- return { __sfc: !0, trans: r, store: t, isApplying: e, footerButtonGroupOptions: s, closeModal: o, applyFilter: () => {
29
- e.value = !0, t.patchCurrentBlockConfig(
30
- { filters: t.recommendationConfigs.filters },
31
- { triggerRefetch: !0 }
32
- ), o(), e.value = !1;
28
+ return { __sfc: !0, trans: t, store: o, isApplying: e, footerButtonGroupOptions: s, closeModal: r, applyFilter: () => {
29
+ e.value = !0, setTimeout(() => {
30
+ console.debug("Filter applied!"), r(), o.generateFilterQuery();
31
+ }, 2e3);
33
32
  }, WpDrawer: i, Filters: u };
34
33
  }
35
34
  });
36
35
  export {
37
- v as default
36
+ b as default
38
37
  };
@@ -1,18 +1,18 @@
1
1
  import o from "./HeaderWrapper.vue2.js";
2
2
  /* empty css */
3
- import s from "../../../_virtual/_plugin-vue2_normalizer.js";
4
- var a = function() {
3
+ import a from "../../../_virtual/_plugin-vue2_normalizer.js";
4
+ var s = function() {
5
5
  var t = this, r = t._self._c, e = t._self._setupProxy;
6
- return r(e.InContainer, { attrs: { border: "bor-w-0 bor-b-w-1 bor-s-s bor-c-6", "border-radius": "bor-r-0" } }, [r("div", { staticClass: "header-wrapper w-1 d-f a-i-c j-c-s-b p-3" }, [r(e.LeftSlot), r(e.MiddleSlot), r(e.RightSlot, { ref: "rightSlotRef" })], 1)]);
7
- }, n = [], _ = /* @__PURE__ */ s(
6
+ return r(e.InContainer, { attrs: { border: "bor-w-0 bor-b-w-1 bor-s-s bor-c-6", "border-radius": "bor-r-0", "data-testid": "guido-header" } }, [r("div", { staticClass: "header-wrapper w-1 d-f a-i-c j-c-s-b p-3" }, [r(e.LeftSlot), r(e.MiddleSlot), r(e.RightSlot, { ref: "rightSlotRef" })], 1)]);
7
+ }, d = [], i = /* @__PURE__ */ a(
8
8
  o,
9
- a,
10
- n,
9
+ s,
10
+ d,
11
11
  !1,
12
12
  null,
13
- "5df46e7a"
13
+ "5c02dcc7"
14
14
  );
15
- const c = _.exports;
15
+ const p = i.exports;
16
16
  export {
17
- c as default
17
+ p as default
18
18
  };
@@ -1,171 +1,149 @@
1
1
  import { useConfig as D } from "./useConfig.js";
2
- import { TemplateTypes as L } from "../enums/defaults.js";
3
- import { DISPLAY_CONDITIONS_REGEX as V, DISPLAY_CONDITIONS_EXCEPTIONS_REGEX as H, CampaignCouldNotBeSavedKey as M, CanNotMakeAnyChangesForRunningKey as $ } from "../enums/html-validator.js";
2
+ import { TemplateTypes as H } from "../enums/defaults.js";
3
+ import { DISPLAY_CONDITIONS_REGEX as P, DISPLAY_CONDITIONS_EXCEPTIONS_REGEX as R, CampaignCouldNotBeSavedKey as _, CanNotMakeAnyChangesForRunningKey as G } from "../enums/html-validator.js";
4
4
  import { ToasterTypeOptions as l } from "../enums/toaster.js";
5
- import { itemsBlockDynamicVariables as P } from "../extensions/Blocks/Items/enums/productEnums.js";
6
- import { useRecommendationExtensionStore as j } from "../extensions/Blocks/Recommendation/store/recommendation.js";
7
- import { useRecommendationStore as G } from "../stores/recommendation.js";
5
+ import { itemsBlockDynamicVariables as $ } from "../extensions/Blocks/Items/enums/productEnums.js";
6
+ import { useRecommendationStore as j } from "../stores/recommendation.js";
8
7
  import { base64EncodeWithSpecialChars as q } from "../utils/base64.js";
9
- import { useHttp as z } from "./useHttp.js";
10
- import { useToaster as U } from "./useToaster.js";
11
- import { useTranslations as X } from "./useTranslations.js";
12
- const K = [
13
- "img",
14
- "url",
15
- "name",
16
- "price",
17
- "currency",
18
- "original_price",
19
- "omnibus_price",
20
- "omnibus_discount"
21
- ];
22
- function Y() {
23
- const a = j();
24
- return Object.keys(a.blockStates).flatMap((d) => {
25
- const f = a.blockStates[Number(d)], i = parseInt(f.recommendationConfigs.size) || 10;
26
- return Array.from({ length: i }, (m, u) => u).flatMap((m) => K.map((u) => `${d}_${m}_${u}`));
27
- });
28
- }
29
- const le = () => {
30
- var p, y;
31
- const { showToaster: a } = U(), { post: d } = z(), { config: f } = D(), i = X(), g = G(), m = ((y = (p = f.value) == null ? void 0 : p.partner) == null ? void 0 : y.messageType) === L.transactional, u = async (e) => {
32
- const t = await d(
8
+ import { useHttp as M } from "./useHttp.js";
9
+ import { useToaster as X } from "./useToaster.js";
10
+ import { useTranslations as z } from "./useTranslations.js";
11
+ const oe = () => {
12
+ var d, f;
13
+ const { showToaster: c } = X(), { post: h } = M(), { config: v } = D(), a = z(), m = j(), u = ((f = (d = v.value) == null ? void 0 : d.partner) == null ? void 0 : f.messageType) === H.transactional, C = async (e) => {
14
+ const t = await h(
33
15
  "/newsletter/template-library/check-template-html-body",
34
16
  { html: q(e) }
35
- ), { status: n, message: c } = t.data;
36
- return n || a({
17
+ ), { status: n, message: r } = t.data;
18
+ return n || c({
37
19
  type: l.Alert,
38
- message: n === void 0 ? c : i("newsletter.invalid-url-link-for-toaster")
39
- }), i(M), c === i($) && a({
20
+ message: n === void 0 ? r : a("newsletter.invalid-url-link-for-toaster")
21
+ }), a(_), r === a(G) && c({
40
22
  type: l.Alert,
41
- message: i("newsletter.already-in-progress")
23
+ message: a("newsletter.already-in-progress")
42
24
  }), n;
43
- }, b = (e) => !["if", "endif", "else", "elif", "now"].includes(e.toLowerCase()), S = (e) => ["if", "endif"].includes(e.toLowerCase()), w = (e, s) => {
25
+ }, w = (e) => !["if", "endif", "else", "elif", "now"].includes(e.toLowerCase()), S = (e) => ["if", "endif"].includes(e.toLowerCase()), b = (e, s) => {
44
26
  const t = e.match(/({%(.*?)%})/g);
45
27
  let n = !0;
46
- return t !== null && !m && t.forEach((c) => {
47
- const o = c.slice(2, -2).trim().match(/(".*?"|[^"\s]+)(?=\s*|\s*$)/g);
48
- if (o && o.length > 0) {
49
- const [r] = o;
50
- b(r) && !s.includes(r) && (a({
28
+ return t !== null && !u && t.forEach((r) => {
29
+ const i = r.slice(2, -2).trim().match(/(".*?"|[^"\s]+)(?=\s*|\s*$)/g);
30
+ if (i && i.length > 0) {
31
+ const [o] = i;
32
+ w(o) && !s.includes(o) && (c({
51
33
  type: l.Warning,
52
- message: i("custom-fields.invalid-custom-fields")
34
+ message: a("custom-fields.invalid-custom-fields")
53
35
  }), n = !1);
54
36
  }
55
37
  }), n;
56
38
  }, E = async (e, s, t) => {
57
- const n = t ? await u(e) : !0;
58
- return w(e, s) && n;
59
- }, A = (e) => e.length > 0 ? !0 : (a({
39
+ const n = t ? await C(e) : !0;
40
+ return b(e, s) && n;
41
+ }, A = (e) => e.length > 0 ? !0 : (c({
60
42
  type: l.Warning,
61
- message: i("newsletter.html-content-is-empty")
62
- }), !1), k = (e) => {
43
+ message: a("newsletter.html-content-is-empty")
44
+ }), !1), x = (e) => {
63
45
  const s = (e.match(/{/gm) || []).length, t = (e.match(/}/gm) || []).length;
64
- return s > t && a({
46
+ return s > t && c({
65
47
  type: l.Warning,
66
- message: i("custom-fields.missing-closing-braces")
67
- }), s < t && a({
48
+ message: a("custom-fields.missing-closing-braces")
49
+ }), s < t && c({
68
50
  type: l.Warning,
69
- message: i("custom-fields.missing-opening-braces")
51
+ message: a("custom-fields.missing-opening-braces")
70
52
  }), s === t;
71
- }, x = (e) => {
53
+ }, k = (e) => {
72
54
  const s = e.match(/{{\s*(\w+\s+((\w+\|\w+)|(\w+)))\s*}}/gm) === null;
73
- return s || a({
55
+ return s || c({
74
56
  type: l.Warning,
75
- message: i("custom-fields.invalid-custom-fields")
57
+ message: a("custom-fields.invalid-custom-fields")
76
58
  }), s;
77
59
  }, T = (e, s) => {
78
60
  const t = e.match(/{{([a-zA-Z0-9_\s]*)}}/gm);
79
- if (t && !m) {
80
- const n = new Set(s.map((o) => o.toLowerCase())), c = [];
81
- if (t.forEach((o) => {
82
- const r = o.slice(2, -2).trim().toLowerCase();
83
- (!n.has(r) || r === "") && c.push(r);
84
- }), c.length > 0) {
85
- const o = `
61
+ if (t && !u) {
62
+ const n = new Set(s.map((i) => i.toLowerCase())), r = [];
63
+ if (t.forEach((i) => {
64
+ const o = i.slice(2, -2).trim().toLowerCase();
65
+ (!n.has(o) || o === "") && r.push(o);
66
+ }), r.length > 0) {
67
+ const i = `
86
68
  <ul>
87
- ${c.map((r) => `<li>${r}</li>`).join("")}
69
+ ${r.map((o) => `<li>${o}</li>`).join("")}
88
70
  </ul>
89
71
  `;
90
- return a({
72
+ return c({
91
73
  type: l.Alert,
92
- message: i("custom-fields.invalid-custom-fields") + o
74
+ message: a("custom-fields.invalid-custom-fields") + i
93
75
  }), !1;
94
76
  }
95
77
  }
96
78
  return !0;
97
- }, I = (e) => {
79
+ }, F = (e) => {
98
80
  const s = e.match(/{%(.*?)%}/g), t = [];
99
81
  let n = !0;
100
- if (s && s.forEach((c) => {
101
- const o = c.match(V), r = c.match(H), B = (o == null ? void 0 : o.join("")) || "";
102
- (!o || c !== B) && !r && (a({
82
+ if (s && s.forEach((r) => {
83
+ const i = r.match(P), o = r.match(R), V = (i == null ? void 0 : i.join("")) || "";
84
+ (!i || r !== V) && !o && (c({
103
85
  type: l.Alert,
104
- message: i("newsletter.display-conditions-invalid-syntax")
105
- }), n = !1), o && o.forEach((h) => {
106
- h.trim() === "=" && (a({
86
+ message: a("newsletter.display-conditions-invalid-syntax")
87
+ }), n = !1), i && i.forEach((g) => {
88
+ g.trim() === "=" && (c({
107
89
  type: l.Alert,
108
- message: i("custom-conditions.wrong-equality-operators")
90
+ message: a("custom-conditions.wrong-equality-operators")
109
91
  }), n = !1);
110
- const C = h.match(/^[a-zA-Z]*$/g);
111
- C && C.forEach((v) => {
112
- S(v) && t.push(v);
92
+ const p = g.match(/^[a-zA-Z]*$/g);
93
+ p && p.forEach((y) => {
94
+ S(y) && t.push(y);
113
95
  });
114
96
  });
115
97
  }), t.length) {
116
- const c = t.filter((r) => r === "if"), o = t.filter((r) => r === "endif");
117
- c.length !== o.length && (a({
98
+ const r = t.filter((o) => o === "if"), i = t.filter((o) => o === "endif");
99
+ r.length !== i.length && (c({
118
100
  type: l.Alert,
119
- message: i("custom-conditions.missing-if-endif-tag")
101
+ message: a("custom-conditions.missing-if-endif-tag")
120
102
  }), n = !1);
121
103
  }
122
104
  return n;
123
- }, F = (e) => {
105
+ }, I = (e) => {
124
106
  const s = (e.match(/{% /gm) || []).length, t = (e.match(/ %}/gm) || []).length, n = s === t;
125
- return n || a({
107
+ return n || c({
126
108
  type: l.Warning,
127
- message: i("custom-conditions.no-space-after-braces")
109
+ message: a("custom-conditions.no-space-after-braces")
128
110
  }), n;
129
- }, _ = (e) => (e.match(/({%(.*?)%})/g) || []).filter((t) => t.includes("if")).map((t) => (t.match(/{{.*}}/gm) || []).length).reduce((t, n) => t + n, 0) > 0 ? (a({
111
+ }, W = (e) => (e.match(/({%(.*?)%})/g) || []).filter((t) => t.includes("if")).map((t) => (t.match(/{{.*}}/gm) || []).length).reduce((t, n) => t + n, 0) > 0 ? (c({
130
112
  type: l.Warning,
131
- message: i("custom-conditions.no-braces-inside-if-tag")
132
- }), !1) : !0, N = () => g.recommendationConfigs && Object.values(g.recommendationConfigs).find((s) => s.filters.find((t) => t.value === "")) !== void 0 ? (a({
113
+ message: a("custom-conditions.no-braces-inside-if-tag")
114
+ }), !1) : !0, L = () => m.recommendationConfigs && Object.values(m.recommendationConfigs).find((s) => s.filters.find((t) => t.value === "")) !== void 0 ? (c({
133
115
  type: l.Alert,
134
- message: i("newsletter.fill-all-necessary-fields")
135
- }), !1) : !0, O = (e) => {
116
+ message: a("newsletter.fill-all-necessary-fields")
117
+ }), !1) : !0, N = (e) => {
136
118
  const s = /src="[^"]*\.(svg|pst)"/gm;
137
- return e.match(s) === null ? !0 : (a({
119
+ return e.match(s) === null ? !0 : (c({
138
120
  type: l.Alert,
139
- message: i("newsletter.invalid-image-type")
121
+ message: a("newsletter.invalid-image-type")
140
122
  }), !1);
141
- }, W = (e) => {
123
+ }, O = (e) => {
142
124
  const n = new DOMParser().parseFromString(e, "text/html").querySelectorAll(".checkbox-block-v2");
143
- return Array.from(n).find((o) => {
144
- var r;
145
- return !((r = o.id) != null && r.trim());
146
- }) ? (a({
125
+ return Array.from(n).find((i) => {
126
+ var o;
127
+ return !((o = i.id) != null && o.trim());
128
+ }) ? (c({
147
129
  type: l.Alert,
148
- message: i("unsubscribe-templates.select-checkbox-groups")
130
+ message: a("unsubscribe-templates.select-checkbox-groups")
149
131
  }), !1) : !0;
150
- }, R = (e) => {
132
+ }, B = (e) => {
151
133
  const n = new DOMParser().parseFromString(e, "text/html").querySelectorAll(".radio-button-v2");
152
- return Array.from(n).find((o) => {
153
- var r;
154
- return !((r = o.id) != null && r.trim());
155
- }) ? (a({
134
+ return Array.from(n).find((i) => {
135
+ var o;
136
+ return !((o = i.id) != null && o.trim());
137
+ }) ? (c({
156
138
  type: l.Alert,
157
- message: i("unsubscribe-templates.select-radio-button-groups")
139
+ message: a("unsubscribe-templates.select-radio-button-groups")
158
140
  }), !1) : !0;
159
141
  };
160
142
  return { validateHtml: async (e, s, t = !1) => {
161
- const n = [
162
- ...s.map((o) => o.value),
163
- ...P,
164
- ...Y()
165
- ];
166
- return await E(e, n, t) && A(e) && k(e) && x(e) && T(e, n) && I(e) && F(e) && _(e) && N() && O(e) && W(e) && R(e);
143
+ const n = [...s.map((i) => i.value), ...$];
144
+ return await E(e, n, t) && A(e) && x(e) && k(e) && T(e, n) && F(e) && I(e) && W(e) && L() && N(e) && O(e) && B(e);
167
145
  } };
168
146
  };
169
147
  export {
170
- le as useHtmlValidator
148
+ oe as useHtmlValidator
171
149
  };
@@ -1,60 +1,27 @@
1
- import { RecommendationFeedSourceMaps as g, URLS as p } from "../enums/extensions/recommendationBlock.js";
2
- import { MinDeviceViewport as R, DefaultPadding as b } from "../enums/recommendation.js";
3
- import { useRecommendationExtensionStore as l } from "../extensions/Blocks/Recommendation/store/recommendation.js";
4
- import { generateCompleteFilterQuery as x } from "../extensions/Blocks/Recommendation/utils/filterUtil.js";
5
- import { useConfigStore as C } from "../stores/config.js";
6
- const N = () => ({
1
+ import { MinDeviceViewport as r, DefaultPadding as c } from "../enums/recommendation.js";
2
+ const m = () => ({
7
3
  calculateCardWidth: ({
8
- mobileLeftPadding: i,
9
- mobileRightPadding: n,
10
- cardsInRow: o,
11
- unresponsive: a
4
+ mobileLeftPadding: e,
5
+ mobileRightPadding: a,
6
+ cardsInRow: n,
7
+ unresponsive: i
12
8
  }) => {
13
- const r = a ? o : 1, e = i + n + (r - 1) * b;
14
- return (R - e) / r;
9
+ const t = i ? n : 1, o = e + a + (t - 1) * c;
10
+ return (r - o) / t;
15
11
  },
16
- getRecommendationCampaignData: (i) => {
17
- const n = l(), o = Number(i), a = n.blockStates[o];
18
- if (!a)
19
- return {
20
- textTrimming: !1,
21
- orientation: "vertical",
22
- mobileLeftPadding: 0,
23
- mobileRightPadding: 0,
24
- cardsInRow: 2,
25
- unresponsive: !1,
26
- priceBeforeTextValue: "",
27
- priceAfterTextValue: "",
28
- discountBeforeTextValue: "",
29
- discountAfterTextValue: ""
30
- };
31
- const { recommendationConfigs: r } = a, e = r.orientation === "grid" ? "vertical" : "horizontal";
32
- return {
33
- textTrimming: r.textTrimming,
34
- orientation: e,
35
- mobileLeftPadding: 0,
36
- mobileRightPadding: 0,
37
- cardsInRow: r.cardsInRow,
38
- unresponsive: r.unresponsive,
39
- priceBeforeTextValue: "",
40
- priceAfterTextValue: "",
41
- discountBeforeTextValue: "",
42
- discountAfterTextValue: ""
43
- };
44
- },
45
- buildCampaignUrl: (i) => {
46
- var d;
47
- const n = l(), o = C(), a = Number(i), r = n.blockStates[a];
48
- if (!r)
49
- return "";
50
- const { recommendationConfigs: e } = r, u = ((d = g.find((s) => s.key === e.strategy)) == null ? void 0 : d.path) || "", t = new URLSearchParams();
51
- t.set("locale", e.language), t.set("currency", e.currencySettings.value), t.set("partnerName", o.partnerName), t.set("size", e.size), t.set("details", "true"), t.set("campaignId", o.variationId), e.strategy === "manualMerchandising" ? t.set("productId", e.productIds.join(",")) : e.strategy === "similarViewed" && t.set("productId", "{itemId}");
52
- const f = e.filters.filter((s) => s.isValid), c = x(f);
53
- c && t.set("filter", c), e.shuffleProducts && t.set("shuffle", "true");
54
- const m = `${p.RECOMMENDATION_API_URL}/v2/${u}?${t.toString()}`;
55
- return n.recommendationCampaignUrls[i] = m, m;
56
- }
12
+ getRecommendationCampaignData: (e) => (console.debug(e), {
13
+ textTrimming: !1,
14
+ orientation: "vertical",
15
+ mobileLeftPadding: 0,
16
+ mobileRightPadding: 0,
17
+ cardsInRow: 2,
18
+ unresponsive: !1,
19
+ priceBeforeTextValue: "",
20
+ priceAfterTextValue: "",
21
+ discountBeforeTextValue: "",
22
+ discountAfterTextValue: ""
23
+ })
57
24
  });
58
25
  export {
59
- N as useRecommendation
26
+ m as useRecommendation
60
27
  };
@@ -1,17 +1,21 @@
1
- import { useConfig as l } from "./useConfig.js";
2
- import { useSaveStart as m, useSaveComplete as c } from "./useGuidoActions.js";
3
- import { useTemplatePreparation as d } from "../utils/templatePreparation.js";
4
- import { useHtmlValidator as p } from "./useHtmlValidator.js";
5
- const w = () => {
6
- const i = m(), s = c(), { validateHtml: o } = p(), { callbacks: a } = l();
7
- return { save: async (r = !1) => {
1
+ import { useConfig as u } from "./useConfig.js";
2
+ import { useSaveStart as d, useSaveComplete as p } from "./useGuidoActions.js";
3
+ import { useSyncModuleExtractor as f } from "./useSyncModuleExtractor.js";
4
+ import { useStripoApi as v } from "../services/stripoApi.js";
5
+ import { useTemplatePreparation as S } from "../utils/templatePreparation.js";
6
+ import { useHtmlValidator as x } from "./useHtmlValidator.js";
7
+ const E = () => {
8
+ const o = d(), s = p(), { validateHtml: i } = x(), { callbacks: a } = u(), { extractSyncModuleUnsubscribeData: r } = f(), { setSyncModuleUnsubscriptionPages: n } = v();
9
+ return { save: async (l = !1) => {
8
10
  var e;
9
- i();
10
- const { prepareTemplateDetails: n } = d(), t = await n();
11
- if (await o(t.compiledHtml, t.dynamicContentList, !0) && !((e = a.value) != null && e.externalValidation && !await a.value.externalValidation(t)))
12
- return r || s(t), t;
11
+ o();
12
+ const { prepareTemplateDetails: c } = S(), t = await c();
13
+ if (!await i(t.compiledHtml, t.dynamicContentList, !0) || (e = a.value) != null && e.externalValidation && !await a.value.externalValidation(t))
14
+ return;
15
+ const m = r(t.rawHtml);
16
+ return await n(m), l || s(t), t;
13
17
  } };
14
18
  };
15
19
  export {
16
- w as useSave
20
+ E as useSave
17
21
  };