@useinsider/guido 1.4.4-beta.eb9b460 → 2.0.0-beta.015a9b6

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 (117) hide show
  1. package/README.md +295 -664
  2. package/dist/@types/config/defaults.js +44 -0
  3. package/dist/@types/config/schemas.js +231 -0
  4. package/dist/@types/config/validator.js +56 -0
  5. package/dist/components/Guido.vue.js +3 -3
  6. package/dist/components/Guido.vue2.js +68 -92
  7. package/dist/components/organisms/base/Toaster.vue.js +6 -6
  8. package/dist/components/organisms/email-preview/amp/AmpErrorModal.vue.js +7 -7
  9. package/dist/components/organisms/email-preview/amp/AmpToggle.vue.js +7 -8
  10. package/dist/components/organisms/email-preview/amp/AmpToggle.vue2.js +4 -3
  11. package/dist/components/organisms/email-preview/desktop-preview/DesktopPreview.vue.js +10 -14
  12. package/dist/components/organisms/email-preview/desktop-preview/DesktopPreview.vue2.js +18 -22
  13. package/dist/components/organisms/email-preview/desktop-preview/EmailSizeIndicator.vue.js +7 -7
  14. package/dist/components/organisms/email-preview/desktop-preview/EmailSizeIndicator.vue2.js +2 -2
  15. package/dist/components/organisms/email-preview/mobile-preview/InboxView.vue.js +5 -5
  16. package/dist/components/organisms/email-preview/mobile-preview/InboxView.vue2.js +13 -13
  17. package/dist/components/organisms/email-preview/mobile-preview/MobilePreview.vue.js +10 -10
  18. package/dist/components/organisms/email-preview/mobile-preview/MobilePreview.vue2.js +15 -14
  19. package/dist/components/organisms/header/LeftSlot.vue.js +2 -2
  20. package/dist/components/organisms/header/LeftSlot.vue2.js +18 -15
  21. package/dist/components/organisms/header/MiddleSlot.vue.js +1 -1
  22. package/dist/components/organisms/header/MiddleSlot.vue2.js +14 -13
  23. package/dist/components/organisms/header/RightSlot.vue.js +12 -12
  24. package/dist/components/organisms/onboarding/NewVersionPopup.vue2.js +22 -19
  25. package/dist/components/organisms/unsubscribe/UnsubscribeBreadcrumb.vue.js +4 -4
  26. package/dist/components/organisms/unsubscribe/UnsubscribeBreadcrumb.vue2.js +8 -8
  27. package/dist/components/organisms/unsubscribe/UnsubscribeTypeSelection.vue.js +3 -3
  28. package/dist/components/organisms/unsubscribe/UnsubscribeTypeSelection.vue2.js +17 -17
  29. package/dist/components/organisms/unsubscribe/UnsubscribeWrapper.vue.js +10 -10
  30. package/dist/composables/useActionsApi.js +42 -25
  31. package/dist/composables/useBlocksConfig.js +23 -20
  32. package/dist/composables/useConfig.js +51 -5
  33. package/dist/composables/useHtmlCompiler.js +20 -19
  34. package/dist/composables/useHtmlValidator.js +41 -41
  35. package/dist/composables/usePartner.js +19 -9
  36. package/dist/composables/useStripo.js +51 -50
  37. package/dist/composables/useTimerClone.js +53 -0
  38. package/dist/composables/useTranslations.js +3 -2
  39. package/dist/config/compiler/unsubscribeCompilerRules.js +1 -1
  40. package/dist/enums/defaults.js +4 -67
  41. package/dist/enums/unsubscribe.js +23 -20
  42. package/dist/extensions/Blocks/CouponBlock/constants.js +4 -0
  43. package/dist/extensions/Blocks/CouponBlock/controls/index.js +29 -0
  44. package/dist/extensions/Blocks/CouponBlock/extension.js +5 -4
  45. package/dist/extensions/Blocks/CouponBlock/settingsPanel.js +20 -14
  46. package/dist/extensions/Blocks/CouponBlock/template.js +22 -11
  47. package/dist/extensions/Blocks/Recommendation/store/recommendation.js +12 -11
  48. package/dist/extensions/Blocks/controlFactories.js +122 -111
  49. package/dist/guido.css +1 -1
  50. package/dist/library.js +12 -2
  51. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js +57 -52
  52. package/dist/node_modules/lodash-es/_arrayLikeKeys.js +10 -10
  53. package/dist/node_modules/valibot/dist/index.js +476 -103
  54. package/dist/services/stripoApi.js +13 -14
  55. package/dist/services/templateLibraryApi.js +18 -18
  56. package/dist/src/@types/config/defaults.d.ts +68 -0
  57. package/dist/src/@types/config/index.d.ts +14 -0
  58. package/dist/src/@types/config/schemas.d.ts +509 -0
  59. package/dist/src/@types/config/types.d.ts +142 -0
  60. package/dist/src/@types/config/validator.d.ts +119 -0
  61. package/dist/src/@types/generic.d.ts +4 -45
  62. package/dist/src/components/Guido.vue.d.ts +13 -12
  63. package/dist/src/components/wrappers/WpModal.vue.d.ts +1 -1
  64. package/dist/src/composables/useActionsApi.d.ts +2 -0
  65. package/dist/src/composables/useConfig.d.ts +186 -2
  66. package/dist/src/composables/usePartner.d.ts +8 -0
  67. package/dist/src/composables/useTimerClone.d.ts +6 -0
  68. package/dist/src/enums/defaults.d.ts +5 -6
  69. package/dist/src/enums/unsubscribe.d.ts +5 -1
  70. package/dist/src/extensions/Blocks/CouponBlock/constants.d.ts +14 -0
  71. package/dist/src/extensions/Blocks/CouponBlock/controls/index.d.ts +108 -0
  72. package/dist/src/extensions/Blocks/CouponBlock/template.d.ts +1 -1
  73. package/dist/src/extensions/Blocks/controlFactories.d.ts +30 -7
  74. package/dist/src/library.d.ts +3 -1
  75. package/dist/src/stores/config.d.ts +1564 -102
  76. package/dist/static/assets/desktop/desktop-mockup-center.svg.js +4 -0
  77. package/dist/static/assets/desktop/desktop-mockup-left.svg.js +4 -0
  78. package/dist/static/assets/desktop/desktop-mockup-right.svg.js +4 -0
  79. package/dist/static/assets/mobile/email-mockup.svg.js +4 -0
  80. package/dist/static/assets/mobile/inbox-mockup.svg.js +4 -0
  81. package/dist/static/styles/components/narrow-panel.css.js +0 -10
  82. package/dist/stores/config.js +141 -9
  83. package/package.json +1 -1
  84. package/dist/components/organisms/email-preview/desktop-preview/EmailHeaderInfo.vue.js +0 -17
  85. package/dist/components/organisms/email-preview/desktop-preview/EmailHeaderInfo.vue2.js +0 -20
  86. package/dist/node_modules/lodash-es/_apply.js +0 -16
  87. package/dist/node_modules/lodash-es/_assignMergeValue.js +0 -8
  88. package/dist/node_modules/lodash-es/_assignValue.js +0 -10
  89. package/dist/node_modules/lodash-es/_baseAssignValue.js +0 -12
  90. package/dist/node_modules/lodash-es/_baseCreate.js +0 -17
  91. package/dist/node_modules/lodash-es/_baseKeysIn.js +0 -15
  92. package/dist/node_modules/lodash-es/_baseMerge.js +0 -20
  93. package/dist/node_modules/lodash-es/_baseMergeDeep.js +0 -31
  94. package/dist/node_modules/lodash-es/_baseRest.js +0 -9
  95. package/dist/node_modules/lodash-es/_baseSetToString.js +0 -14
  96. package/dist/node_modules/lodash-es/_cloneArrayBuffer.js +0 -8
  97. package/dist/node_modules/lodash-es/_cloneBuffer.js +0 -9
  98. package/dist/node_modules/lodash-es/_cloneTypedArray.js +0 -8
  99. package/dist/node_modules/lodash-es/_copyArray.js +0 -9
  100. package/dist/node_modules/lodash-es/_copyObject.js +0 -14
  101. package/dist/node_modules/lodash-es/_createAssigner.js +0 -15
  102. package/dist/node_modules/lodash-es/_defineProperty.js +0 -11
  103. package/dist/node_modules/lodash-es/_getPrototype.js +0 -5
  104. package/dist/node_modules/lodash-es/_initCloneObject.js +0 -9
  105. package/dist/node_modules/lodash-es/_nativeKeysIn.js +0 -10
  106. package/dist/node_modules/lodash-es/_overRest.js +0 -15
  107. package/dist/node_modules/lodash-es/_safeGet.js +0 -7
  108. package/dist/node_modules/lodash-es/_setToString.js +0 -6
  109. package/dist/node_modules/lodash-es/_shortOut.js +0 -16
  110. package/dist/node_modules/lodash-es/constant.js +0 -8
  111. package/dist/node_modules/lodash-es/isArrayLikeObject.js +0 -8
  112. package/dist/node_modules/lodash-es/isPlainObject.js +0 -16
  113. package/dist/node_modules/lodash-es/keysIn.js +0 -9
  114. package/dist/node_modules/lodash-es/merge.js +0 -8
  115. package/dist/node_modules/lodash-es/toPlainObject.js +0 -8
  116. package/dist/static/assets/inbox-mockup.svg.js +0 -4
  117. package/dist/static/assets/phone-mockup.svg.js +0 -4
@@ -1,17 +1,17 @@
1
- import { defineComponent as h, ref as b, computed as m, watch as _ } from "vue";
2
- import v from "../../wrappers/WpDrawer.vue.js";
3
- import { useToaster as B } from "../../../composables/useToaster.js";
4
- import { useTranslations as N } from "../../../composables/useTranslations.js";
5
- import { ToasterTypeOptions as U } from "../../../enums/toaster.js";
6
- import { PAGE_TYPES as l, ACADEMY_LINK as w, UNSUBSCRIBE_PAGES_LINK as P, TYPE_TRANSLATIONS as R } from "../../../enums/unsubscribe.js";
7
- import { useUnsubscribeStore as D } from "../../../stores/unsubscribe.js";
8
- import { InSegments as I } from "@useinsider/design-system-vue";
9
- const z = /* @__PURE__ */ h({
1
+ import { defineComponent as v, ref as b, computed as m, watch as _ } from "vue";
2
+ import B from "../../wrappers/WpDrawer.vue.js";
3
+ import { useToaster as U } from "../../../composables/useToaster.js";
4
+ import { useTranslations as w } from "../../../composables/useTranslations.js";
5
+ import { ToasterTypeOptions as N } from "../../../enums/toaster.js";
6
+ import { PAGE_TYPES as l, ACADEMY_LINK as D, getTypeTranslations as P, UNSUBSCRIBE_PAGES_LINK as R } from "../../../enums/unsubscribe.js";
7
+ import { useUnsubscribeStore as I } from "../../../stores/unsubscribe.js";
8
+ import { InSegments as G } from "@useinsider/design-system-vue";
9
+ const K = /* @__PURE__ */ v({
10
10
  __name: "UnsubscribeTypeSelection",
11
- setup(G) {
12
- const e = N(), { showToaster: f } = B(), t = D(), n = b(!1), i = b(!0), o = b(l.GLOBAL_UNSUBSCRIBE), S = e(
11
+ setup(x) {
12
+ const e = w(), { showToaster: f } = U(), t = I(), n = b(!1), i = b(!0), o = b(l.GLOBAL_UNSUBSCRIBE), S = e(
13
13
  "unsubscription-preference.select-unsubscribe-page-description",
14
- { action: `<a href="${w}" target="_blank">${e("ds-rules.visit-academy")}</a>` }
14
+ { action: `<a href="${D}" target="_blank">${e("ds-rules.visit-academy")}</a>` }
15
15
  ), T = m(() => [
16
16
  {
17
17
  description: e("unsubscription-preference.type-global-unsubscribe-description"),
@@ -62,7 +62,7 @@ const z = /* @__PURE__ */ h({
62
62
  p || r.push(Number(c));
63
63
  }), r.length === 0)
64
64
  return !0;
65
- const a = r.map((c) => R[c]);
65
+ const h = P(), a = r.map((c) => h[c]);
66
66
  let u = "";
67
67
  if (r.length === 1)
68
68
  u = e("unsubscription-preference.create-page-to-continue", {
@@ -81,12 +81,12 @@ const z = /* @__PURE__ */ h({
81
81
  });
82
82
  }
83
83
  return f({
84
- type: U.Warning,
84
+ type: N.Warning,
85
85
  message: u,
86
86
  actionButton: {
87
87
  text: "Go to Unsubscribe Pages",
88
88
  onClick: () => {
89
- window.location.href = P;
89
+ window.location.href = R;
90
90
  }
91
91
  }
92
92
  }), !1;
@@ -99,9 +99,9 @@ const z = /* @__PURE__ */ h({
99
99
  };
100
100
  return _(() => t.typeSelectionDrawerStatus, (s) => {
101
101
  s && (i.value = !0, o.value = l.GLOBAL_UNSUBSCRIBE, t.isGlobalUnsubscribeDisabled && (o.value = t.isSubscriptionPreferencesCenterDisabled ? 0 : l.SUBSCRIPTION_PREFERENCE_CENTER), i.value = !1);
102
- }), { __sfc: !0, trans: e, showToaster: f, unsubscribeStore: t, isSelecting: n, skeletonStatus: i, selectedCollection: o, descriptionText: S, segmentList: T, footerButtonGroupOptions: y, closeModal: d, changeCollection: E, validateTemplates: g, selectCollection: C, WpDrawer: v, InSegments: I };
102
+ }), { __sfc: !0, trans: e, showToaster: f, unsubscribeStore: t, isSelecting: n, skeletonStatus: i, selectedCollection: o, descriptionText: S, segmentList: T, footerButtonGroupOptions: y, closeModal: d, changeCollection: E, validateTemplates: g, selectCollection: C, WpDrawer: B, InSegments: G };
103
103
  }
104
104
  });
105
105
  export {
106
- z as default
106
+ K as default
107
107
  };
@@ -1,18 +1,18 @@
1
- import o from "./UnsubscribeWrapper.vue2.js";
2
- import t from "../../../_virtual/_plugin-vue2_normalizer.js";
3
- var _ = function() {
4
- var s;
5
- var e = this, n = e._self._c, r = e._self._setupProxy;
6
- return (s = r.config.extensions) != null && s.unsubscribe ? n("div", [n(r.UnsubscribeTypeSelection), n(r.UnsubscribePageSelection)], 1) : e._e();
7
- }, c = [], i = /* @__PURE__ */ t(
8
- o,
1
+ import _ from "./UnsubscribeWrapper.vue2.js";
2
+ import o from "../../../_virtual/_plugin-vue2_normalizer.js";
3
+ var c = function() {
4
+ var s, t;
5
+ var e = this, r = e._self._c, n = e._self._setupProxy;
6
+ return (t = (s = n.config) == null ? void 0 : s.features) != null && t.unsubscribe ? r("div", [r(n.UnsubscribeTypeSelection), r(n.UnsubscribePageSelection)], 1) : e._e();
7
+ }, i = [], a = /* @__PURE__ */ o(
9
8
  _,
10
9
  c,
10
+ i,
11
11
  !1,
12
12
  null,
13
13
  null
14
14
  );
15
- const l = i.exports;
15
+ const p = a.exports;
16
16
  export {
17
- l as default
17
+ p as default
18
18
  };
@@ -1,7 +1,7 @@
1
- import { useToaster as g } from "./useToaster.js";
2
- const A = () => {
3
- const { handleError: l } = g(), n = (t = {}) => new Promise((e, a) => {
4
- const i = { ...{
1
+ import { useToaster as w } from "./useToaster.js";
2
+ const S = () => {
3
+ const { handleError: l } = w(), s = (t = {}) => new Promise((e, i) => {
4
+ const n = { ...{
5
5
  minimize: !0,
6
6
  utmEntity: {
7
7
  utmSource: "",
@@ -21,28 +21,28 @@ const A = () => {
21
21
  resetDataSavedFlag: !1,
22
22
  disableLineHeightsReplace: !0
23
23
  }, ...t }, m = {
24
- callback: (s, c, p, u, d) => {
25
- s ? a(s) : e({
26
- html: c,
27
- ampHtml: p,
28
- ampErrors: u,
29
- displayConditions: d
24
+ callback: (o, p, d, c, u) => {
25
+ o ? i(o) : e({
26
+ html: p,
27
+ ampHtml: d,
28
+ ampErrors: c,
29
+ displayConditions: u
30
30
  });
31
31
  },
32
- ...i
32
+ ...n
33
33
  };
34
34
  window.StripoEditorApi.actionsApi.compileEmail(m);
35
35
  });
36
36
  return {
37
- getCompiledEmail: n,
37
+ getCompiledEmail: s,
38
38
  getTemplateData: () => new Promise((t) => {
39
- const e = ({ html: a, css: o, width: i, height: r, utmParams: m, syncModulesIds: s }) => t({
40
- html: a,
41
- css: o,
42
- width: i,
39
+ const e = ({ html: i, css: a, width: n, height: r, utmParams: m, syncModulesIds: o }) => t({
40
+ html: i,
41
+ css: a,
42
+ width: n,
43
43
  height: r,
44
44
  utmParams: m,
45
- syncModulesIds: s
45
+ syncModulesIds: o
46
46
  });
47
47
  window.StripoEditorApi.actionsApi.getTemplateData(e);
48
48
  }),
@@ -53,15 +53,15 @@ const A = () => {
53
53
  try {
54
54
  const {
55
55
  html: e,
56
- displayConditions: a,
57
- ampHtml: o = "",
58
- ampErrors: i = []
59
- } = await n({ minimize: !1, resetDataSavedFlag: !1, ...t });
56
+ displayConditions: i,
57
+ ampHtml: a = "",
58
+ ampErrors: n = []
59
+ } = await s({ minimize: !1, resetDataSavedFlag: !1, ...t });
60
60
  return {
61
61
  html: e,
62
- ampHtml: o,
63
- ampErrors: i,
64
- displayConditions: a
62
+ ampHtml: a,
63
+ ampErrors: n,
64
+ displayConditions: i
65
65
  };
66
66
  } catch (e) {
67
67
  return l(e, "Error loading preview"), {
@@ -71,9 +71,26 @@ const A = () => {
71
71
  displayConditions: []
72
72
  };
73
73
  }
74
+ },
75
+ updateTimerInClonedTemplate: () => new Promise((t) => {
76
+ var e, i;
77
+ if (typeof ((i = (e = window.StripoEditorApi) == null ? void 0 : e.actionsApi) == null ? void 0 : i.updateTimerInClonedTemplate) != "function") {
78
+ t(null);
79
+ return;
80
+ }
81
+ try {
82
+ window.StripoEditorApi.actionsApi.updateTimerInClonedTemplate((a, n) => {
83
+ a ? (l(a, "Failed to update timer in cloned template"), t(null)) : t(n || null);
84
+ });
85
+ } catch (a) {
86
+ l(a, "Failed to call updateTimerInClonedTemplate"), t(null);
87
+ }
88
+ }),
89
+ updateHtmlAndCss: (t, e) => {
90
+ window.StripoEditorApi.actionsApi.updateHtmlAndCss(t, e);
74
91
  }
75
92
  };
76
93
  };
77
94
  export {
78
- A as useActionsApi
95
+ S as useActionsApi
79
96
  };
@@ -1,4 +1,5 @@
1
- const l = {
1
+ import { useConfigStore as l } from "../stores/config.js";
2
+ const r = {
2
3
  "amp-accordion": "ampAccordionEnabled",
3
4
  "amp-carousel": "ampCarouselEnabled",
4
5
  "amp-form-controls": "ampFormControlsEnabled",
@@ -23,26 +24,28 @@ const l = {
23
24
  }, a = (n) => {
24
25
  if (!n || !n.length)
25
26
  return {};
26
- const o = {};
27
- return n.forEach((e) => {
28
- const t = l[e];
29
- t && (o[t] = !1);
30
- }), o;
31
- }, r = async (n) => !n || !n.length ? [] : (await Promise.all(
32
- n.map(async (e) => {
33
- const t = c[e];
27
+ const e = {};
28
+ return n.forEach((o) => {
29
+ const t = r[o];
30
+ t && (e[t] = !1);
31
+ }), e;
32
+ }, i = async (n) => !n || !n.length ? [] : (await Promise.all(
33
+ n.map(async (o) => {
34
+ const t = c[o];
34
35
  return t ? (await t()).default : null;
35
36
  })
36
- )).filter((e) => e !== null), s = () => ({
37
- getStripoBlocksConfig: async () => {
38
- var e;
39
- const o = (e = window.GuidoConfig) == null ? void 0 : e.blocks;
40
- return {
41
- baseBlocks: a(o == null ? void 0 : o.excludeDefaults),
42
- extensions: await r(o == null ? void 0 : o.includeCustoms)
43
- };
44
- }
45
- });
37
+ )).filter((o) => o !== null), m = () => {
38
+ const n = l();
39
+ return {
40
+ getStripoBlocksConfig: async () => {
41
+ const o = n.blocks;
42
+ return {
43
+ baseBlocks: a(o == null ? void 0 : o.excludeDefaults),
44
+ extensions: await i(o == null ? void 0 : o.includeCustoms)
45
+ };
46
+ }
47
+ };
48
+ };
46
49
  export {
47
- s as useBlocksConfig
50
+ m as useBlocksConfig
48
51
  };
@@ -1,7 +1,53 @@
1
- import { DefaultGuidoConfig as o } from "../enums/defaults.js";
2
- const t = () => ({
3
- config: typeof window > "u" ? o : window.GuidoConfig || o
4
- });
1
+ import { useConfigStore as F } from "../stores/config.js";
2
+ import { storeToRefs as I } from "pinia";
3
+ const k = () => {
4
+ const e = F(), {
5
+ config: t,
6
+ initialized: o,
7
+ identity: r,
8
+ partner: i,
9
+ template: n,
10
+ editor: a,
11
+ ui: s,
12
+ features: u,
13
+ blocks: d,
14
+ compiler: p,
15
+ templateId: c,
16
+ userId: f,
17
+ variationId: m,
18
+ partnerName: g,
19
+ productType: l,
20
+ messageType: b,
21
+ username: C,
22
+ showHeader: y
23
+ } = I(e);
24
+ return {
25
+ // State refs
26
+ config: t,
27
+ initialized: o,
28
+ // Section refs
29
+ identity: r,
30
+ partner: i,
31
+ template: n,
32
+ editor: a,
33
+ ui: s,
34
+ features: u,
35
+ blocks: d,
36
+ compiler: p,
37
+ // Convenience refs
38
+ templateId: c,
39
+ userId: f,
40
+ variationId: m,
41
+ partnerName: g,
42
+ productType: l,
43
+ messageType: b,
44
+ username: C,
45
+ showHeader: y,
46
+ // Methods
47
+ getConfig: () => t.value,
48
+ isFeatureEnabled: (E) => e.isFeatureEnabled(E)
49
+ };
50
+ };
5
51
  export {
6
- t as useConfig
52
+ k as useConfig
7
53
  };
@@ -1,27 +1,28 @@
1
- import { defaultHtmlCompilerRules as t } from "../config/compiler/htmlCompilerRules.js";
2
- import { itemsCompilerRules as p } from "../config/compiler/itemsCompilerRules.js";
3
- import { outlookCompilerRules as s } from "../config/compiler/outlookCompilerRules.js";
4
- import { recommendationCompilerRules as u } from "../config/compiler/recommendationCompilerRules.js";
5
- import { socialCompilerRules as n } from "../config/compiler/socialCompilerRules.js";
6
- import { unsubscribeCompilerRules as c } from "../config/compiler/unsubscribeCompilerRules.js";
7
- import { createHtmlCompiler as f } from "../utils/htmlCompiler.js";
8
- import { useConfig as R } from "./useConfig.js";
9
- const x = () => {
10
- const { config: e } = R(), m = e.htmlCompilerRules || [], l = [
11
- ...!!e.ignoreDefaultHtmlCompilerRules ? [] : t,
1
+ import { defaultHtmlCompilerRules as p } from "../config/compiler/htmlCompilerRules.js";
2
+ import { itemsCompilerRules as u } from "../config/compiler/itemsCompilerRules.js";
3
+ import { outlookCompilerRules as c } from "../config/compiler/outlookCompilerRules.js";
4
+ import { recommendationCompilerRules as n } from "../config/compiler/recommendationCompilerRules.js";
5
+ import { socialCompilerRules as f } from "../config/compiler/socialCompilerRules.js";
6
+ import { unsubscribeCompilerRules as R } from "../config/compiler/unsubscribeCompilerRules.js";
7
+ import { createHtmlCompiler as a } from "../utils/htmlCompiler.js";
8
+ import { useConfig as C } from "./useConfig.js";
9
+ const B = () => {
10
+ var m, l;
11
+ const { compiler: e } = C(), r = ((m = e.value) == null ? void 0 : m.customRules) || [], t = [
12
+ ...!!((l = e.value) != null && l.ignoreDefaultRules) ? [] : p,
13
+ ...n,
14
+ ...R,
12
15
  ...u,
13
16
  ...c,
14
- ...p,
15
- ...s,
16
- ...n,
17
- ...m.map((o, i) => ({
17
+ ...f,
18
+ ...r.map((o, s) => ({
18
19
  ...o,
19
- priority: o.priority + 1e3 + i
20
+ priority: o.priority + 1e3 + s
20
21
  // Ensure additional rules run after default rules
21
22
  }))
22
- ], r = f(l);
23
- return { compileHtml: (o) => r.compile(o) };
23
+ ], i = a(t);
24
+ return { compileHtml: (o) => i.compile(o) };
24
25
  };
25
26
  export {
26
- x as useHtmlCompiler
27
+ B as useHtmlCompiler
27
28
  };
@@ -1,47 +1,47 @@
1
- import { useConfig as V } from "./useConfig.js";
2
- import { TemplateTypes as D } from "../enums/defaults.js";
3
- import { DISPLAY_CONDITIONS_REGEX as H, DISPLAY_CONDITIONS_EXCEPTIONS_REGEX as P, CampaignCouldNotBeSavedKey as R, CanNotMakeAnyChangesForRunningKey as _ } from "../enums/html-validator.js";
1
+ import { useConfig as D } from "./useConfig.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 G } from "../extensions/Blocks/Items/enums/productEnums.js";
6
- import { useRecommendationStore as $ } from "../stores/recommendation.js";
7
- import { base64EncodeWithSpecialChars as j } from "../utils/base64.js";
8
- import { useHttp as q } from "./useHttp.js";
9
- import { useToaster as M } from "./useToaster.js";
10
- import { useTranslations as X } from "./useTranslations.js";
11
- const ie = () => {
12
- var d;
13
- const { showToaster: c } = M(), { post: y } = q(), { config: h } = V(), a = X(), m = $(), u = ((d = h.partner) == null ? void 0 : d.messageType) === D.transactional, v = async (e) => {
14
- const t = await y(
5
+ import { itemsBlockDynamicVariables as $ } from "../extensions/Blocks/Items/enums/productEnums.js";
6
+ import { useRecommendationStore as j } from "../stores/recommendation.js";
7
+ import { base64EncodeWithSpecialChars as q } from "../utils/base64.js";
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(
15
15
  "/newsletter/template-library/check-template-html-body",
16
- { html: j(e) }
16
+ { html: q(e) }
17
17
  ), { status: n, message: r } = t.data;
18
18
  return n || c({
19
19
  type: l.Alert,
20
20
  message: n === void 0 ? r : a("newsletter.invalid-url-link-for-toaster")
21
- }), a(R), r === a(_) && c({
21
+ }), a(_), r === a(G) && c({
22
22
  type: l.Alert,
23
23
  message: a("newsletter.already-in-progress")
24
24
  }), n;
25
- }, C = (e) => !["if", "endif", "else", "elif", "now"].includes(e.toLowerCase()), w = (e) => ["if", "endif"].includes(e.toLowerCase()), S = (e, s) => {
25
+ }, w = (e) => !["if", "endif", "else", "elif", "now"].includes(e.toLowerCase()), S = (e) => ["if", "endif"].includes(e.toLowerCase()), b = (e, s) => {
26
26
  const t = e.match(/({%(.*?)%})/g);
27
27
  let n = !0;
28
28
  return t !== null && !u && t.forEach((r) => {
29
29
  const i = r.slice(2, -2).trim().match(/(".*?"|[^"\s]+)(?=\s*|\s*$)/g);
30
30
  if (i && i.length > 0) {
31
31
  const [o] = i;
32
- C(o) && !s.includes(o) && (c({
32
+ w(o) && !s.includes(o) && (c({
33
33
  type: l.Warning,
34
34
  message: a("custom-fields.invalid-custom-fields")
35
35
  }), n = !1);
36
36
  }
37
37
  }), n;
38
- }, b = async (e, s, t) => {
39
- const n = t ? await v(e) : !0;
40
- return S(e, s) && n;
41
- }, E = (e) => e.length > 0 ? !0 : (c({
38
+ }, E = async (e, s, t) => {
39
+ const n = t ? await C(e) : !0;
40
+ return b(e, s) && n;
41
+ }, A = (e) => e.length > 0 ? !0 : (c({
42
42
  type: l.Warning,
43
43
  message: a("newsletter.html-content-is-empty")
44
- }), !1), A = (e) => {
44
+ }), !1), x = (e) => {
45
45
  const s = (e.match(/{/gm) || []).length, t = (e.match(/}/gm) || []).length;
46
46
  return s > t && c({
47
47
  type: l.Warning,
@@ -50,13 +50,13 @@ const ie = () => {
50
50
  type: l.Warning,
51
51
  message: a("custom-fields.missing-opening-braces")
52
52
  }), s === t;
53
- }, x = (e) => {
53
+ }, k = (e) => {
54
54
  const s = e.match(/{{\s*(\w+\s+((\w+\|\w+)|(\w+)))\s*}}/gm) === null;
55
55
  return s || c({
56
56
  type: l.Warning,
57
57
  message: a("custom-fields.invalid-custom-fields")
58
58
  }), s;
59
- }, k = (e, s) => {
59
+ }, T = (e, s) => {
60
60
  const t = e.match(/{{([a-zA-Z0-9_\s]*)}}/gm);
61
61
  if (t && !u) {
62
62
  const n = new Set(s.map((i) => i.toLowerCase())), r = [];
@@ -76,22 +76,22 @@ const ie = () => {
76
76
  }
77
77
  }
78
78
  return !0;
79
- }, T = (e) => {
79
+ }, F = (e) => {
80
80
  const s = e.match(/{%(.*?)%}/g), t = [];
81
81
  let n = !0;
82
82
  if (s && s.forEach((r) => {
83
- const i = r.match(H), o = r.match(P), B = (i == null ? void 0 : i.join("")) || "";
84
- (!i || r !== B) && !o && (c({
83
+ const i = r.match(P), o = r.match(R), V = (i == null ? void 0 : i.join("")) || "";
84
+ (!i || r !== V) && !o && (c({
85
85
  type: l.Alert,
86
86
  message: a("newsletter.display-conditions-invalid-syntax")
87
- }), n = !1), i && i.forEach((f) => {
88
- f.trim() === "=" && (c({
87
+ }), n = !1), i && i.forEach((g) => {
88
+ g.trim() === "=" && (c({
89
89
  type: l.Alert,
90
90
  message: a("custom-conditions.wrong-equality-operators")
91
91
  }), n = !1);
92
- const g = f.match(/^[a-zA-Z]*$/g);
93
- g && g.forEach((p) => {
94
- w(p) && t.push(p);
92
+ const p = g.match(/^[a-zA-Z]*$/g);
93
+ p && p.forEach((y) => {
94
+ S(y) && t.push(y);
95
95
  });
96
96
  });
97
97
  }), t.length) {
@@ -102,25 +102,25 @@ const ie = () => {
102
102
  }), n = !1);
103
103
  }
104
104
  return n;
105
- }, F = (e) => {
105
+ }, I = (e) => {
106
106
  const s = (e.match(/{% /gm) || []).length, t = (e.match(/ %}/gm) || []).length, n = s === t;
107
107
  return n || c({
108
108
  type: l.Warning,
109
109
  message: a("custom-conditions.no-space-after-braces")
110
110
  }), n;
111
- }, I = (e) => (e.match(/({%(.*?)%})/g) || []).filter((t) => t.includes("if")).map((t) => (t.match(/{{.*}}/gm) || []).length).reduce((t, n) => t + n, 0) > 0 ? (c({
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({
112
112
  type: l.Warning,
113
113
  message: a("custom-conditions.no-braces-inside-if-tag")
114
- }), !1) : !0, W = () => m.recommendationConfigs && Object.values(m.recommendationConfigs).find((s) => s.filters.find((t) => t.value === "")) !== void 0 ? (c({
114
+ }), !1) : !0, L = () => m.recommendationConfigs && Object.values(m.recommendationConfigs).find((s) => s.filters.find((t) => t.value === "")) !== void 0 ? (c({
115
115
  type: l.Alert,
116
116
  message: a("newsletter.fill-all-necessary-fields")
117
- }), !1) : !0, L = (e) => {
117
+ }), !1) : !0, N = (e) => {
118
118
  const s = /src="[^"]*\.(svg|pst)"/gm;
119
119
  return e.match(s) === null ? !0 : (c({
120
120
  type: l.Alert,
121
121
  message: a("newsletter.invalid-image-type")
122
122
  }), !1);
123
- }, N = (e) => {
123
+ }, O = (e) => {
124
124
  const n = new DOMParser().parseFromString(e, "text/html").querySelectorAll(".checkbox-block-v2");
125
125
  return Array.from(n).find((i) => {
126
126
  var o;
@@ -129,7 +129,7 @@ const ie = () => {
129
129
  type: l.Alert,
130
130
  message: a("unsubscribe-templates.select-checkbox-groups")
131
131
  }), !1) : !0;
132
- }, O = (e) => {
132
+ }, B = (e) => {
133
133
  const n = new DOMParser().parseFromString(e, "text/html").querySelectorAll(".radio-button-v2");
134
134
  return Array.from(n).find((i) => {
135
135
  var o;
@@ -140,10 +140,10 @@ const ie = () => {
140
140
  }), !1) : !0;
141
141
  };
142
142
  return { validateHtml: async (e, s, t = !1) => {
143
- const n = [...s.map((i) => i.value), ...G];
144
- return await b(e, n, t) && E(e) && A(e) && x(e) && k(e, n) && T(e) && F(e) && I(e) && W() && L(e) && N(e) && O(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);
145
145
  } };
146
146
  };
147
147
  export {
148
- ie as useHtmlValidator
148
+ oe as useHtmlValidator
149
149
  };
@@ -1,18 +1,28 @@
1
- import { TEST_PARTNER_LIST as r, DefaultProductType as o, ProductIds as n } from "../enums/defaults.js";
2
- const i = () => {
3
- const e = () => window.location.hostname.split(".")[0] || "";
1
+ import { useConfigStore as i } from "../stores/config.js";
2
+ import { ProductType as t } from "../@types/config/schemas.js";
3
+ import { isTestPartner as o } from "../@types/config/defaults.js";
4
+ const T = () => {
5
+ const e = i(), n = () => e.initialized && e.partnerName ? e.partnerName : window.location.hostname.split(".")[0] || "";
4
6
  return {
5
- getPartnerName: e,
7
+ getPartnerName: n,
6
8
  getProductType: () => {
7
- const t = window.location.pathname.split("/").filter(Boolean)[0] || o;
8
- return n[t] || 0;
9
+ if (e.initialized)
10
+ return e.productType;
11
+ const r = window.location.pathname.split("/").filter(Boolean)[0] || "email";
12
+ return {
13
+ email: t.EMAIL,
14
+ architect: t.ARCHITECT,
15
+ unsubscribePages: t.UNSUBSCRIBE_PAGES
16
+ }[r] || t.EMAIL;
9
17
  },
18
+ getMessageType: () => e.initialized ? e.messageType : 1,
19
+ getUsername: () => e.initialized ? e.username : "Guido User",
10
20
  isTestPartner: () => {
11
- const t = e();
12
- return r.includes(t);
21
+ const r = n();
22
+ return o(r);
13
23
  }
14
24
  };
15
25
  };
16
26
  export {
17
- i as usePartner
27
+ T as usePartner
18
28
  };