@useinsider/guido 3.10.1-beta.e36dd40 → 3.11.0-beta.04af241

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 (50) hide show
  1. package/dist/components/organisms/header/EditorActions.vue.js +1 -1
  2. package/dist/components/organisms/header/HeaderWrapper.vue.js +3 -3
  3. package/dist/components/organisms/header/HeaderWrapper.vue2.js +2 -0
  4. package/dist/components/organisms/header/version-history/VersionHistory.vue.js +1 -1
  5. package/dist/components/organisms/unsubscribe/UnsubscribePageSelection.vue.js +5 -5
  6. package/dist/components/organisms/unsubscribe/UnsubscribePageSelection.vue2.js +2 -2
  7. package/dist/components/organisms/unsubscribe/UnsubscribeTypeSelection.vue.js +3 -3
  8. package/dist/components/organisms/unsubscribe/UnsubscribeTypeSelection.vue2.js +9 -9
  9. package/dist/composables/useCortexBlueprintBridge.js +7 -7
  10. package/dist/composables/useCustomInterfaceAppearance.js +16 -18
  11. package/dist/composables/useEmailTemplateApplier.js +9 -9
  12. package/dist/composables/useExport.js +18 -18
  13. package/dist/composables/useHtmlValidator.js +90 -90
  14. package/dist/composables/useStripo.js +53 -51
  15. package/dist/composables/useStripoNotifications.js +26 -0
  16. package/dist/composables/useToaster.js +11 -11
  17. package/dist/composables/useVersionHistoryApi.js +2 -2
  18. package/dist/composables/validators/useLiquidValidator.js +1 -1
  19. package/dist/composables/validators/useUnsubscribeBlockValidator.js +10 -10
  20. package/dist/config/compiler/recommendationCompilerRules.js +55 -38
  21. package/dist/config/compiler/utils/recommendationCompilerUtils.js +88 -77
  22. package/dist/config/i18n/en/labels.json.js +4 -1
  23. package/dist/enums/toaster.js +2 -2
  24. package/dist/enums/unsubscribe.js +41 -36
  25. package/dist/extensions/Blocks/Checkbox/block.js +5 -3
  26. package/dist/extensions/Blocks/Checkbox/control.js +42 -28
  27. package/dist/extensions/Blocks/Items/controls/price/formattedPrice.js +43 -41
  28. package/dist/extensions/Blocks/RadioButton/block.js +9 -7
  29. package/dist/extensions/Blocks/RadioButton/control.js +64 -50
  30. package/dist/extensions/Blocks/Recommendation/useRecommendationBlockWarning.js +7 -7
  31. package/dist/extensions/Blocks/Recommendation/utils/legacyStrategyMap.js +2 -0
  32. package/dist/guido.css +1 -1
  33. package/dist/package.json.js +1 -1
  34. package/dist/services/blankTemplate.js +1 -1
  35. package/dist/services/templateLibraryApi.js +8 -7
  36. package/dist/src/composables/useStripoNotifications.d.ts +10 -0
  37. package/dist/src/enums/toaster.d.ts +2 -2
  38. package/dist/src/enums/unsubscribe.d.ts +2 -0
  39. package/dist/src/extensions/Blocks/Recommendation/utils/legacyStrategyMap.d.ts +1 -0
  40. package/dist/src/stores/toaster.d.ts +2 -3
  41. package/dist/src/utils/environmentUtil.d.ts +5 -2
  42. package/dist/static/styles/components/dropdown-menu.css.js +12 -0
  43. package/dist/static/styles/components/wide-panel.css.js +7 -0
  44. package/dist/stores/toaster.js +10 -10
  45. package/dist/utils/environmentUtil.js +3 -2
  46. package/dist/utils/templatePreparation.js +20 -16
  47. package/package.json +12 -3
  48. package/dist/src/composables/useHtmlValidator.test.d.ts +0 -1
  49. package/dist/src/config/compiler/utils/recommendationIgnoreUtils.test.d.ts +0 -1
  50. package/dist/static/styles/components/notification.css.js +0 -74
@@ -11,11 +11,11 @@ import { RecommendationRequiredFieldsKey as ee } from "../extensions/Blocks/Reco
11
11
  import { useRecommendationStore as te } from "../stores/recommendation.js";
12
12
  import { base64EncodeWithSpecialChars as ne } from "../utils/base64.js";
13
13
  import { useHttp as se } from "./useHttp.js";
14
- import { useToaster as oe } from "./useToaster.js";
15
- import { useTranslations as ie } from "./useTranslations.js";
16
- const re = /recommendation-id="(\d+)"/g;
14
+ import { useToaster as re } from "./useToaster.js";
15
+ import { useTranslations as oe } from "./useTranslations.js";
16
+ const ie = /recommendation-id="(\d+)"/g;
17
17
  function ae(t) {
18
- return [...t.matchAll(re)].map((m) => m[1]);
18
+ return [...t.matchAll(ie)].map((m) => m[1]);
19
19
  }
20
20
  function ce(t, m) {
21
21
  return m.some((f) => t.startsWith(`${f}_`));
@@ -31,34 +31,34 @@ function ue(t) {
31
31
  m.add(Q(f.attributeName, t).toLowerCase());
32
32
  }), m;
33
33
  }
34
- function de(t, m, f, i, d) {
34
+ function de(t, m, f, o, d) {
35
35
  const u = t.match(/{{([a-zA-Z0-9_.\s]*)}}/gm);
36
36
  if (!u)
37
37
  return [];
38
- const p = new Set(m.map((y) => y.toLowerCase())), h = [];
39
- return u.forEach((y) => {
40
- const g = y.slice(2, -2).trim().toLowerCase();
38
+ const p = new Set(m.map((h) => h.toLowerCase())), E = [];
39
+ return u.forEach((h) => {
40
+ const g = h.slice(2, -2).trim().toLowerCase();
41
41
  if (g !== "" && p.has(g))
42
42
  return;
43
- const E = me(g);
44
- if (E && i.has(E.recoId)) {
45
- if (!d || d.has(E.attribute))
43
+ const y = me(g);
44
+ if (y && o.has(y.recoId)) {
45
+ if (!d || d.has(y.attribute))
46
46
  return;
47
- h.push(g);
47
+ E.push(g);
48
48
  return;
49
49
  }
50
- ce(g, f) || g.includes(".") || h.push(g);
51
- }), h;
50
+ ce(g, f) || g.includes(".") || E.push(g);
51
+ }), E;
52
52
  }
53
53
  function fe(t) {
54
- return (t.replace(U, "$1").match(j) ?? []).filter((i) => {
55
- const d = i.slice(2, -2), u = d.indexOf("|"), p = (u === -1 ? d : d.slice(0, u)).trim();
54
+ return (t.replace(U, "$1").match(j) ?? []).filter((o) => {
55
+ const d = o.slice(2, -2), u = d.indexOf("|"), p = (u === -1 ? d : d.slice(0, u)).trim();
56
56
  return q.includes(p) ? !1 : K.test(p) ? u !== -1 && d.slice(u + 1).trim() === "" : !0;
57
57
  });
58
58
  }
59
59
  const xe = () => {
60
- var I, b;
61
- const { showToaster: t } = oe(), { post: m } = se(), { config: f } = W(), i = ie(), d = te(), u = J(), p = ((b = (I = f.value) == null ? void 0 : I.partner) == null ? void 0 : b.messageType) === H.transactional, h = async (e) => {
60
+ var b, S;
61
+ const { showToaster: t } = re(), { post: m } = se(), { config: f } = W(), o = oe(), d = te(), u = J(), p = ((S = (b = f.value) == null ? void 0 : b.partner) == null ? void 0 : S.messageType) === H.transactional, E = async (e) => {
62
62
  if (e.size === 0)
63
63
  return /* @__PURE__ */ new Set();
64
64
  try {
@@ -67,53 +67,53 @@ const xe = () => {
67
67
  return null;
68
68
  }
69
69
  return ue(u.filterList);
70
- }, y = async (e) => {
70
+ }, h = async (e) => {
71
71
  const n = await m(
72
72
  "/newsletter/template-library/check-template-html-body",
73
73
  { html: ne(e) }
74
- ), { status: o, message: a } = n.data;
75
- return o || t({
76
- type: c.Alert,
77
- message: o === void 0 ? a : i("newsletter.invalid-url-link-for-toaster")
78
- }), i($), a === i(Y) && t({
79
- type: c.Alert,
80
- message: i("newsletter.already-in-progress")
81
- }), o;
82
- }, g = (e) => !["if", "endif", "else", "elif", "now"].includes(e.toLowerCase()), E = (e) => ["if", "endif"].includes(e.toLowerCase()), T = (e, s) => {
74
+ ), { status: r, message: a } = n.data;
75
+ return r || t({
76
+ type: c.Error,
77
+ message: r === void 0 ? a : o("newsletter.invalid-url-link-for-toaster")
78
+ }), o($), a === o(Y) && t({
79
+ type: c.Error,
80
+ message: o("newsletter.already-in-progress")
81
+ }), r;
82
+ }, g = (e) => !["if", "endif", "else", "elif", "now"].includes(e.toLowerCase()), y = (e) => ["if", "endif"].includes(e.toLowerCase()), T = (e, s) => {
83
83
  const n = e.match(/({%(.*?)%})/g);
84
- let o = !0;
84
+ let r = !0;
85
85
  return n !== null && !p && n.forEach((a) => {
86
- const r = a.slice(2, -2).trim().match(/(".*?"|[^"\s]+)(?=\s*|\s*$)/g);
87
- if (r && r.length > 0) {
88
- const [l] = r;
86
+ const i = a.slice(2, -2).trim().match(/(".*?"|[^"\s]+)(?=\s*|\s*$)/g);
87
+ if (i && i.length > 0) {
88
+ const [l] = i;
89
89
  g(l) && !s.includes(l) && (t({
90
90
  type: c.Warning,
91
- message: i("custom-fields.invalid-custom-fields")
92
- }), o = !1);
91
+ message: o("custom-fields.invalid-custom-fields")
92
+ }), r = !1);
93
93
  }
94
- }), o;
94
+ }), r;
95
95
  }, w = async (e, s, n) => {
96
- const o = n ? await y(e) : !0;
97
- return T(e, s) && o;
96
+ const r = n ? await h(e) : !0;
97
+ return T(e, s) && r;
98
98
  }, R = (e) => e.length > 0 ? !0 : (t({
99
99
  type: c.Warning,
100
- message: i("newsletter.html-content-is-empty")
100
+ message: o("newsletter.html-content-is-empty")
101
101
  }), !1), _ = (e) => {
102
102
  const s = (e.match(/{/gm) || []).length, n = (e.match(/}/gm) || []).length;
103
103
  return s > n && t({
104
104
  type: c.Warning,
105
- message: i("custom-fields.missing-closing-braces")
105
+ message: o("custom-fields.missing-closing-braces")
106
106
  }), s < n && t({
107
107
  type: c.Warning,
108
- message: i("custom-fields.missing-opening-braces")
108
+ message: o("custom-fields.missing-opening-braces")
109
109
  }), s === n;
110
110
  }, N = (e) => {
111
111
  const s = fe(e).length === 0;
112
112
  return s || t({
113
113
  type: c.Warning,
114
- message: i("custom-fields.invalid-custom-fields")
114
+ message: o("custom-fields.invalid-custom-fields")
115
115
  }), s;
116
- }, x = (e, s, n, o) => {
116
+ }, x = (e, s, n, r) => {
117
117
  if (p)
118
118
  return !0;
119
119
  const a = de(
@@ -121,94 +121,94 @@ const xe = () => {
121
121
  s,
122
122
  ae(e),
123
123
  n,
124
- o
124
+ r
125
125
  );
126
126
  if (a.length > 0) {
127
- const r = `
127
+ const i = `
128
128
  <ul>
129
129
  ${a.map((l) => `<li>${l}</li>`).join("")}
130
130
  </ul>
131
131
  `;
132
132
  return t({
133
- type: c.Alert,
134
- message: i("custom-fields.invalid-custom-fields") + r
133
+ type: c.Error,
134
+ message: o("custom-fields.invalid-custom-fields") + i
135
135
  }), !1;
136
136
  }
137
137
  return !0;
138
138
  }, O = (e) => {
139
139
  const s = e.match(/{%(.*?)%}/g), n = [];
140
- let o = !0;
140
+ let r = !0;
141
141
  if (s && s.forEach((a) => {
142
- const r = a.match(P), l = a.match(X), v = (r == null ? void 0 : r.join("")) || "";
143
- (!r || a !== v) && !l && (t({
144
- type: c.Alert,
145
- message: i("newsletter.display-conditions-invalid-syntax")
146
- }), o = !1), r && r.forEach((C) => {
142
+ const i = a.match(P), l = a.match(X), v = (i == null ? void 0 : i.join("")) || "";
143
+ (!i || a !== v) && !l && (t({
144
+ type: c.Error,
145
+ message: o("newsletter.display-conditions-invalid-syntax")
146
+ }), r = !1), i && i.forEach((C) => {
147
147
  C.trim() === "=" && (t({
148
- type: c.Alert,
149
- message: i("custom-conditions.wrong-equality-operators")
150
- }), o = !1);
151
- const A = C.match(/^[a-zA-Z]*$/g);
152
- A && A.forEach((S) => {
153
- E(S) && n.push(S);
148
+ type: c.Error,
149
+ message: o("custom-conditions.wrong-equality-operators")
150
+ }), r = !1);
151
+ const I = C.match(/^[a-zA-Z]*$/g);
152
+ I && I.forEach((A) => {
153
+ y(A) && n.push(A);
154
154
  });
155
155
  });
156
156
  }), n.length) {
157
- const a = n.filter((l) => l === "if"), r = n.filter((l) => l === "endif");
158
- a.length !== r.length && (t({
159
- type: c.Alert,
160
- message: i("custom-conditions.missing-if-endif-tag")
161
- }), o = !1);
157
+ const a = n.filter((l) => l === "if"), i = n.filter((l) => l === "endif");
158
+ a.length !== i.length && (t({
159
+ type: c.Error,
160
+ message: o("custom-conditions.missing-if-endif-tag")
161
+ }), r = !1);
162
162
  }
163
- return o;
163
+ return r;
164
164
  }, k = (e) => {
165
- const s = (e.match(/{% /gm) || []).length, n = (e.match(/ %}/gm) || []).length, o = s === n;
166
- return o || t({
165
+ const s = (e.match(/{% /gm) || []).length, n = (e.match(/ %}/gm) || []).length, r = s === n;
166
+ return r || t({
167
167
  type: c.Warning,
168
- message: i("custom-conditions.no-space-after-braces")
169
- }), o;
170
- }, B = (e) => (e.match(/({%(.*?)%})/g) || []).filter((n) => n.includes("if")).map((n) => (n.match(/{{.*}}/gm) || []).length).reduce((n, o) => n + o, 0) > 0 ? (t({
168
+ message: o("custom-conditions.no-space-after-braces")
169
+ }), r;
170
+ }, B = (e) => (e.match(/({%(.*?)%})/g) || []).filter((n) => n.includes("if")).map((n) => (n.match(/{{.*}}/gm) || []).length).reduce((n, r) => n + r, 0) > 0 ? (t({
171
171
  type: c.Warning,
172
- message: i("custom-conditions.no-braces-inside-if-tag")
172
+ message: o("custom-conditions.no-braces-inside-if-tag")
173
173
  }), !1) : !0, D = () => u.hasInvalidBlock() ? (t({
174
- type: c.Alert,
175
- message: i(ee)
174
+ type: c.Error,
175
+ message: o(ee)
176
176
  }), !1) : !0, F = () => d.recommendationConfigs && Object.values(d.recommendationConfigs).find((s) => s.filters.find((n) => n.value === "")) !== void 0 ? (t({
177
- type: c.Alert,
178
- message: i("newsletter.fill-all-necessary-fields")
177
+ type: c.Error,
178
+ message: o("newsletter.fill-all-necessary-fields")
179
179
  }), !1) : !0, L = (e) => {
180
180
  const s = /src="[^"]*\.(svg|pst)"/gm;
181
181
  return e.match(s) === null ? !0 : (t({
182
- type: c.Alert,
183
- message: i("newsletter.invalid-image-type")
182
+ type: c.Error,
183
+ message: o("newsletter.invalid-image-type")
184
184
  }), !1);
185
185
  }, V = (e) => {
186
- const o = new DOMParser().parseFromString(e, "text/html").querySelectorAll(".checkbox-block-v2");
187
- return Array.from(o).find((r) => {
186
+ const r = new DOMParser().parseFromString(e, "text/html").querySelectorAll(".checkbox-block-v2");
187
+ return Array.from(r).find((i) => {
188
188
  var l;
189
- return !((l = r.id) != null && l.trim());
189
+ return !((l = i.id) != null && l.trim());
190
190
  }) ? (t({
191
- type: c.Alert,
192
- message: i("unsubscribe-templates.select-checkbox-groups")
191
+ type: c.Error,
192
+ message: o("unsubscribe-templates.select-checkbox-groups")
193
193
  }), !1) : !0;
194
194
  }, M = (e) => {
195
- const o = new DOMParser().parseFromString(e, "text/html").querySelectorAll(".radio-button-v2");
196
- return Array.from(o).find((r) => {
195
+ const r = new DOMParser().parseFromString(e, "text/html").querySelectorAll(".radio-button-v2");
196
+ return Array.from(r).find((i) => {
197
197
  var l;
198
- return !((l = r.id) != null && l.trim());
198
+ return !((l = i.id) != null && l.trim());
199
199
  }) ? (t({
200
- type: c.Alert,
201
- message: i("unsubscribe-templates.select-radio-button-groups")
200
+ type: c.Error,
201
+ message: o("unsubscribe-templates.select-radio-button-groups")
202
202
  }), !1) : !0;
203
203
  };
204
204
  return { validateHtml: async (e, s, n = !1) => {
205
205
  var v, C;
206
- const o = [
207
- ...s.map((A) => A.value),
206
+ const r = [
207
+ ...s.map((I) => I.value),
208
208
  ...z,
209
209
  ...((C = (v = f.value) == null ? void 0 : v.template) == null ? void 0 : C.customFieldAttributes) ?? []
210
- ], a = G(e), r = await h(a);
211
- return await w(e, o, n) && R(e) && _(e) && N(e) && x(e, o, a, r) && O(e) && k(e) && B(e) && D() && F() && L(e) && V(e) && M(e);
210
+ ], a = G(e), i = await E(a);
211
+ return await w(e, r, n) && R(e) && _(e) && N(e) && x(e, r, a, i) && O(e) && k(e) && B(e) && D() && F() && L(e) && V(e) && M(e);
212
212
  } };
213
213
  };
214
214
  export {
@@ -1,29 +1,30 @@
1
- import { useActionsApi as I } from "./useActionsApi.js";
2
- import { useBlocksConfig as U } from "./useBlocksConfig.js";
3
- import { useConfig as R } from "./useConfig.js";
4
- import { useCustomInterfaceAppearance as x } from "./useCustomInterfaceAppearance.js";
5
- import { useFullStoryBridge as O } from "./useFullStoryBridge.js";
6
- import { useStripoEventHandler as q } from "./useStripoEventHandler.js";
7
- import { useToaster as H } from "./useToaster.js";
8
- import { localePatch as z } from "../config/i18n/index.js";
1
+ import { useActionsApi as U } from "./useActionsApi.js";
2
+ import { useBlocksConfig as R } from "./useBlocksConfig.js";
3
+ import { useConfig as x } from "./useConfig.js";
4
+ import { useCustomInterfaceAppearance as O } from "./useCustomInterfaceAppearance.js";
5
+ import { useFullStoryBridge as q } from "./useFullStoryBridge.js";
6
+ import { useStripoEventHandler as H } from "./useStripoEventHandler.js";
7
+ import { useStripoNotifications as N } from "./useStripoNotifications.js";
8
+ import { useToaster as z } from "./useToaster.js";
9
+ import { localePatch as L } from "../config/i18n/index.js";
9
10
  import { en as h } from "../config/i18n/en/index.js";
10
- import { ToasterTypeOptions as L } from "../enums/toaster.js";
11
- import { useStripoApi as $ } from "../services/stripoApi.js";
12
- import G from "../static/styles/customEditorStyle.css.js";
13
- import { useEditorStore as C } from "../stores/editor.js";
14
- import { dynamicContentToMergeTags as J } from "../utils/genericUtil.js";
15
- import N from "../package.json.js";
16
- const ce = (E, l) => {
17
- const { features: c, template: w, isFeatureEnabled: u } = R(), { handleError: m, showToaster: b } = H(), { getToken: T, getCustomFonts: k, getSyncModulesStatus: B } = $(), { handleEvent: F } = q(), { getStripoBlocksConfig: v } = U(), V = async (s, r = [], i = !1) => {
11
+ import { ToasterTypeOptions as $ } from "../enums/toaster.js";
12
+ import { useStripoApi as G } from "../services/stripoApi.js";
13
+ import J from "../static/styles/customEditorStyle.css.js";
14
+ import { useEditorStore as E } from "../stores/editor.js";
15
+ import { dynamicContentToMergeTags as X } from "../utils/genericUtil.js";
16
+ import j from "../package.json.js";
17
+ const fo = (C, l) => {
18
+ const { features: c, template: w, isFeatureEnabled: u } = x(), { handleError: m, showToaster: b } = z(), { getToken: T, getCustomFonts: k, getSyncModulesStatus: B } = G(), { handleEvent: F } = H(), { getStripoBlocksConfig: v } = R(), { getStripoNotifications: V } = N(), _ = async (s, i = [], r = !1) => {
18
19
  var g, S, y;
19
- const e = C(), { html: p, css: a } = s, { baseBlocks: t, extensions: d } = await v(), f = ((g = c.value) == null ? void 0 : g.displayConditions) ?? !0, A = ((S = c.value) == null ? void 0 : S.modulesDisabled) ?? !1, M = ((y = w.value) == null ? void 0 : y.forceRecreate) ?? !1;
20
+ const o = E(), { html: p, css: a } = s, { baseBlocks: t, extensions: d } = await v(), f = ((g = c.value) == null ? void 0 : g.displayConditions) ?? !0, M = ((S = c.value) == null ? void 0 : S.modulesDisabled) ?? !1, P = ((y = w.value) == null ? void 0 : y.forceRecreate) ?? !1;
20
21
  await window.UIEditor.initEditor(
21
22
  document.querySelector("#guido-editor"),
22
23
  {
23
- metadata: E,
24
+ metadata: C,
24
25
  html: p,
25
26
  css: a,
26
- forceRecreate: M,
27
+ forceRecreate: P,
27
28
  locale: "en",
28
29
  undoButtonSelector: "#guido__undo-button",
29
30
  redoButtonSelector: "#guido__redo-button",
@@ -33,12 +34,12 @@ const ce = (E, l) => {
33
34
  customAppearanceMergetags: !u("liquidSyntax"),
34
35
  customAppearanceMergetagsBorderColor: "#f1f3fe",
35
36
  customAppearanceMergetagsBackgroundColor: "#f1f3fe",
36
- customViewStyles: G,
37
+ customViewStyles: J,
37
38
  conditionsEnabled: f,
38
39
  customConditionsEnabled: f,
39
40
  enableXSSSecurity: !0,
40
- modulesDisabled: A,
41
- syncModulesEnabled: i,
41
+ modulesDisabled: M,
42
+ syncModulesEnabled: r,
42
43
  messageSettingsEnabled: !0,
43
44
  displayGmailAnnotations: !0,
44
45
  displayHiddenPreheader: !1,
@@ -51,82 +52,83 @@ const ce = (E, l) => {
51
52
  editorFonts: {
52
53
  showDefaultStandardFonts: !0,
53
54
  showDefaultNotStandardFonts: !0,
54
- customFonts: r
55
+ customFonts: i
55
56
  },
56
57
  mergeTags: [
57
58
  {
58
- entries: J(
59
+ entries: X(
59
60
  l.preselectedDynamicContentList,
60
61
  u("liquidSyntax")
61
62
  )
62
63
  }
63
64
  ],
64
- async onTokenRefreshRequest(o) {
65
+ async onTokenRefreshRequest(e) {
65
66
  try {
66
67
  const n = await T();
67
- o(n);
68
+ e(n);
68
69
  } catch (n) {
69
70
  m(n, "Failed to refresh token");
70
71
  }
71
72
  },
72
73
  onTemplateLoaded() {
73
74
  try {
74
- const { importCss: o } = x(), { activateCustomViewStyles: n, updateTimerInClonedTemplate: P } = I(), { injectFullStory: D } = O();
75
- o(), n(), D(), P(), l.onReady(), e.isStripoInitialized = !0, e.loadingStatus = !1, setTimeout(() => {
76
- e.hasChanges = !1;
75
+ const { importCss: e } = O(), { activateCustomViewStyles: n, updateTimerInClonedTemplate: D } = U(), { injectFullStory: I } = q();
76
+ e(), n(), I(), D(), l.onReady(), o.isStripoInitialized = !0, o.loadingStatus = !1, setTimeout(() => {
77
+ o.hasChanges = !1;
77
78
  }, 1e3);
78
- } catch (o) {
79
- m(o, "Failed to load custom interface appearance");
79
+ } catch (e) {
80
+ m(e, "Failed to load custom interface appearance");
80
81
  }
81
82
  },
82
- onCodeEditorVisibilityChanged(o) {
83
- e.isCodeEditorOpen = o;
83
+ onCodeEditorVisibilityChanged(e) {
84
+ o.isCodeEditorOpen = e;
84
85
  },
85
- onEditorVisualModeChanged(o) {
86
- e.editorVisualMode = o.toLowerCase();
86
+ onEditorVisualModeChanged(e) {
87
+ o.editorVisualMode = e.toLowerCase();
87
88
  },
88
- onVersionHistoryVisibilityChanged(o) {
89
- e.isVersionHistoryOpen = o;
89
+ onVersionHistoryVisibilityChanged(e) {
90
+ o.isVersionHistoryOpen = e;
90
91
  },
91
92
  onDataChanged() {
92
- e.hasChanges = !0;
93
+ o.hasChanges = !0;
93
94
  },
94
95
  onEvent: F,
96
+ notifications: V(),
95
97
  ignoreClickOutsideSelectors: [
96
98
  "#guido-dynamic-content-modal",
97
99
  ".in-on-board-wrapper",
98
100
  ".in-drawer__container"
99
101
  ],
100
102
  extensions: d,
101
- localePatch: z
103
+ localePatch: L
102
104
  }
103
105
  );
104
- }, _ = (s) => new Promise((r, i) => {
106
+ }, A = (s) => new Promise((i, r) => {
105
107
  var d;
106
108
  if (document.getElementById("UiEditorScript")) {
107
- Promise.resolve(s()).then(r, i);
109
+ Promise.resolve(s()).then(i, r);
108
110
  return;
109
111
  }
110
- const e = N.guido, a = `https://email-static.useinsider.com/guido/${(d = e == null ? void 0 : e.stripo) == null ? void 0 : d.version}/UIEditor.js`, t = document.createElement("script");
112
+ const o = j.guido, a = `https://email-static.useinsider.com/guido/${(d = o == null ? void 0 : o.stripo) == null ? void 0 : d.version}/UIEditor.js`, t = document.createElement("script");
111
113
  t.id = "UiEditorScript", t.type = "module", t.src = a, t.onload = () => {
112
- Promise.resolve(s()).then(r, i);
114
+ Promise.resolve(s()).then(i, r);
113
115
  }, t.onerror = () => {
114
- i(new Error(`Failed to load Stripo UIEditor script from S3: ${a}`));
116
+ r(new Error(`Failed to load Stripo UIEditor script from S3: ${a}`));
115
117
  }, document.body.appendChild(t);
116
118
  });
117
119
  return { initPlugin: async (s) => {
118
- const r = C();
120
+ const i = E();
119
121
  try {
120
- await _(async () => {
121
- const [i, e] = await Promise.all([
122
+ await A(async () => {
123
+ const [r, o] = await Promise.all([
122
124
  k(),
123
125
  B()
124
126
  ]);
125
- r.syncModulesEnabled = e, await V(s, i, e);
127
+ i.syncModulesEnabled = o, await _(s, r, o);
126
128
  });
127
129
  } catch {
128
- r.loadingStatus = !1, b({
129
- type: L.Alert,
130
+ i.loadingStatus = !1, b({
131
+ type: $.Error,
130
132
  message: h["An error has occurred. Please report the error code to support."],
131
133
  actionButton: {
132
134
  text: h["Reload page"],
@@ -137,5 +139,5 @@ const ce = (E, l) => {
137
139
  } };
138
140
  };
139
141
  export {
140
- ce as useStripo
142
+ fo as useStripo
141
143
  };
@@ -0,0 +1,26 @@
1
+ import { useToaster as d } from "./useToaster.js";
2
+ import { ToasterTypeOptions as c } from "../enums/toaster.js";
3
+ const g = () => {
4
+ const { showToaster: s, hideToaster: u } = d();
5
+ let r = null;
6
+ const n = (o, t, i, e, f = !0) => {
7
+ r = i;
8
+ const l = e != null && e.action ? { text: e.action.label, onClick: e.action.func } : void 0;
9
+ s({ type: o, message: t, actionButton: l, autoHide: (e == null ? void 0 : e.autoClose) ?? f });
10
+ };
11
+ return { getStripoNotifications: () => ({
12
+ info: (o, t, i) => n(c.Info, o, t, i),
13
+ success: (o, t, i) => n(c.Success, o, t, i),
14
+ warn: (o, t, i) => n(c.Warning, o, t, i),
15
+ error: (o, t, i) => n(c.Error, o, t, i),
16
+ // A loader marks an in-progress operation; Stripo dismisses it via hide(id)
17
+ // when finished, so it must not auto-hide.
18
+ loader: (o, t, i) => n(c.Info, o, t, i, !1),
19
+ hide: (o) => {
20
+ r === o && (u(), r = null);
21
+ }
22
+ }) };
23
+ };
24
+ export {
25
+ g as useStripoNotifications
26
+ };
@@ -1,29 +1,29 @@
1
1
  import { ToasterTypeOptions as T } from "../enums/toaster.js";
2
2
  import { useToasterStore as c } from "../stores/toaster.js";
3
- import { watch as u, nextTick as l } from "vue";
3
+ import { watch as u, nextTick as f } from "vue";
4
4
  const p = () => {
5
- const t = c();
6
- let o = null;
5
+ const o = c();
6
+ let t = null;
7
7
  const s = () => {
8
- o && (clearTimeout(o), o = null);
8
+ t && (clearTimeout(t), t = null);
9
9
  };
10
10
  function r(e = { message: "" }) {
11
- s(), t.hideToaster(), l(() => {
12
- t.showToaster(e);
11
+ s(), o.hideToaster(), f(() => {
12
+ o.showToaster(e);
13
13
  });
14
14
  }
15
15
  function i() {
16
- s(), t.hideToaster();
16
+ s(), o.hideToaster();
17
17
  }
18
18
  function n(e, a) {
19
19
  const m = e instanceof Error ? e.message : String(e);
20
- r({ type: T.Alert, message: `${a}: ${m}` });
20
+ r({ type: T.Error, message: `${a}: ${m}` });
21
21
  }
22
22
  return u(
23
- () => t.shouldAutoHide,
23
+ () => o.shouldAutoHide,
24
24
  (e) => {
25
- s(), e && (o = setTimeout(() => {
26
- t.hideToaster(), s();
25
+ s(), e && (t = setTimeout(() => {
26
+ o.hideToaster(), s();
27
27
  }, 6e3));
28
28
  }
29
29
  ), { showToaster: r, hideToaster: i, handleError: n };
@@ -24,7 +24,7 @@ const S = () => {
24
24
  window.StripoEditorApi.versionHistoryApi.previewVersion(e, (o) => {
25
25
  const r = o instanceof Error ? o.message : String(o);
26
26
  s({
27
- type: t.Alert,
27
+ type: t.Error,
28
28
  message: `Error compiling email: ${r}`
29
29
  });
30
30
  });
@@ -41,7 +41,7 @@ const S = () => {
41
41
  (o) => {
42
42
  const r = o instanceof Error ? o.message : String(o);
43
43
  s({
44
- type: t.Alert,
44
+ type: t.Error,
45
45
  message: `Error compiling email: ${r}`
46
46
  });
47
47
  }
@@ -31,7 +31,7 @@ const v = () => {
31
31
  }), !1) : !0;
32
32
  } catch {
33
33
  return e({
34
- type: a.Alert,
34
+ type: a.Error,
35
35
  message: s("journey-builder.liquid-validation-failed")
36
36
  }), !1;
37
37
  }
@@ -1,8 +1,8 @@
1
1
  import { ToasterTypeOptions as i } from "../../enums/toaster.js";
2
2
  import { PAGE_TYPES as u } from "../../enums/unsubscribe.js";
3
3
  import { UNSUBSCRIBE_BLOCK_SELECTOR as l, DATA_ATTRIBUTES as a } from "../../extensions/Blocks/Unsubscribe/utils/constants.js";
4
- import { useToaster as m } from "../useToaster.js";
5
- import { useTranslations as E } from "../useTranslations.js";
4
+ import { useToaster as E } from "../useToaster.js";
5
+ import { useTranslations as m } from "../useTranslations.js";
6
6
  const T = [
7
7
  {
8
8
  pageType: u.GLOBAL_UNSUBSCRIBE,
@@ -13,23 +13,23 @@ const T = [
13
13
  messageKey: "unsubscription-preference.duplicate-pref-center"
14
14
  }
15
15
  ], g = "unsubscription-preference.duplicate-both", b = "unsubscription-preference.select-page-to-continue", P = () => {
16
- const { showToaster: c } = m(), p = E();
16
+ const { showToaster: c } = E(), p = m();
17
17
  return { validateUnsubscribeBlockUniqueness: (n) => {
18
- const o = new DOMParser().parseFromString(n, "text/html"), s = /* @__PURE__ */ new Map();
18
+ const o = new DOMParser().parseFromString(n, "text/html"), r = /* @__PURE__ */ new Map();
19
19
  o.querySelectorAll(l).forEach((e) => {
20
- const r = Number(e.getAttribute(a.PAGE_TYPE));
21
- s.set(r, (s.get(r) ?? 0) + 1);
20
+ const s = Number(e.getAttribute(a.PAGE_TYPE));
21
+ r.set(s, (r.get(s) ?? 0) + 1);
22
22
  });
23
- const t = T.filter((e) => (s.get(e.pageType) ?? 0) > 1).map((e) => e.messageKey);
23
+ const t = T.filter((e) => (r.get(e.pageType) ?? 0) > 1).map((e) => e.messageKey);
24
24
  return t.length ? (c({
25
- type: i.Alert,
25
+ type: i.Error,
26
26
  message: p(t.length > 1 ? g : t[0])
27
27
  }), !1) : !0;
28
28
  }, validateUnsubscribeBlockHasTemplate: (n) => {
29
29
  const o = new DOMParser().parseFromString(n, "text/html");
30
30
  return Array.from(o.querySelectorAll(l)).some((t) => {
31
- const e = t.getAttribute(a.PAGE_TYPE), r = t.getAttribute(a.PAGE_LIST);
32
- return !e || !r;
31
+ const e = t.getAttribute(a.PAGE_TYPE), s = t.getAttribute(a.PAGE_LIST);
32
+ return !e || !s;
33
33
  }) ? (c({
34
34
  type: i.Warning,
35
35
  message: p(b)