@useinsider/guido 3.7.0-beta.a6317a3 → 3.7.0-beta.bd7cb8f

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.
@@ -1,172 +1,166 @@
1
- import { useConfig as V } from "./useConfig.js";
2
- import { TemplateTypes as M } from "../enums/defaults.js";
3
- import { DISPLAY_CONDITIONS_REGEX as G, DISPLAY_CONDITIONS_EXCEPTIONS_REGEX as H, CampaignCouldNotBeSavedKey as P, CanNotMakeAnyChangesForRunningKey as X, DYNAMIC_CONTENT_TAG_REGEX as Y, ALLOWED_DYNAMIC_SYSTEM_TOKENS as $, VALID_DYNAMIC_VARIABLE_REGEX as q } from "../enums/html-validator.js";
1
+ import { useConfig as _ } from "./useConfig.js";
2
+ import { TemplateTypes as H } from "../enums/defaults.js";
3
+ import { DISPLAY_CONDITIONS_REGEX as P, DISPLAY_CONDITIONS_EXCEPTIONS_REGEX as G, CampaignCouldNotBeSavedKey as M, CanNotMakeAnyChangesForRunningKey as $ } from "../enums/html-validator.js";
4
4
  import { ToasterTypeOptions as c } from "../enums/toaster.js";
5
- import { itemsBlockDynamicVariables as K } from "../extensions/Blocks/Items/enums/productEnums.js";
6
- import { useRecommendationExtensionStore as j } from "../extensions/Blocks/Recommendation/store/recommendation.js";
7
- import { RecommendationRequiredFieldsKey as z } from "../extensions/Blocks/Recommendation/validation/requiredFields.js";
8
- import { useRecommendationStore as U } from "../stores/recommendation.js";
9
- import { base64EncodeWithSpecialChars as Z } from "../utils/base64.js";
10
- import { useHttp as J } from "./useHttp.js";
11
- import { useToaster as Q } from "./useToaster.js";
12
- import { useTranslations as ee } from "./useTranslations.js";
13
- const te = /recommendation-id="(\d+)"/g;
14
- function se(o) {
15
- return [...o.matchAll(te)].map((d) => d[1]);
5
+ import { itemsBlockDynamicVariables as q } from "../extensions/Blocks/Items/enums/productEnums.js";
6
+ import { useRecommendationExtensionStore as X } from "../extensions/Blocks/Recommendation/store/recommendation.js";
7
+ import { RecommendationRequiredFieldsKey as j } from "../extensions/Blocks/Recommendation/validation/requiredFields.js";
8
+ import { useRecommendationStore as K } from "../stores/recommendation.js";
9
+ import { base64EncodeWithSpecialChars as z } from "../utils/base64.js";
10
+ import { useHttp as U } from "./useHttp.js";
11
+ import { useToaster as Y } from "./useToaster.js";
12
+ import { useTranslations as Z } from "./useTranslations.js";
13
+ const J = /recommendation-id="(\d+)"/g;
14
+ function Q(a) {
15
+ return [...a.matchAll(J)].map((u) => u[1]);
16
16
  }
17
- function ne(o, d) {
18
- return d.some((f) => o.startsWith(`${f}_`));
17
+ function ee(a, u) {
18
+ return u.some((d) => a.startsWith(`${d}_`));
19
19
  }
20
- function ie(o) {
21
- return (o.match(Y) ?? []).filter((f) => {
22
- const i = f.slice(2, -2), u = i.indexOf("|"), g = (u === -1 ? i : i.slice(0, u)).trim();
23
- return $.includes(g) ? !1 : q.test(g) ? u !== -1 && i.slice(u + 1).trim() === "" : !0;
24
- });
25
- }
26
- const ve = () => {
27
- var h, v;
28
- const { showToaster: o } = Q(), { post: d } = J(), { config: f } = V(), i = ee(), u = U(), g = j(), y = ((v = (h = f.value) == null ? void 0 : h.partner) == null ? void 0 : v.messageType) === M.transactional, A = async (e) => {
29
- const t = await d(
20
+ const ge = () => {
21
+ var y, h;
22
+ const { showToaster: a } = Y(), { post: u } = U(), { config: d } = _(), r = Z(), g = K(), S = X(), p = ((h = (y = d.value) == null ? void 0 : y.partner) == null ? void 0 : h.messageType) === H.transactional, b = async (e) => {
23
+ const t = await u(
30
24
  "/newsletter/template-library/check-template-html-body",
31
- { html: Z(e) }
25
+ { html: z(e) }
32
26
  ), { status: n, message: l } = t.data;
33
- return n || o({
27
+ return n || a({
34
28
  type: c.Alert,
35
- message: n === void 0 ? l : i("newsletter.invalid-url-link-for-toaster")
36
- }), i(P), l === i(X) && o({
29
+ message: n === void 0 ? l : r("newsletter.invalid-url-link-for-toaster")
30
+ }), r(M), l === r($) && a({
37
31
  type: c.Alert,
38
- message: i("newsletter.already-in-progress")
32
+ message: r("newsletter.already-in-progress")
39
33
  }), n;
40
- }, S = (e) => !["if", "endif", "else", "elif", "now"].includes(e.toLowerCase()), b = (e) => ["if", "endif"].includes(e.toLowerCase()), I = (e, s) => {
34
+ }, w = (e) => !["if", "endif", "else", "elif", "now"].includes(e.toLowerCase()), E = (e) => ["if", "endif"].includes(e.toLowerCase()), A = (e, s) => {
41
35
  const t = e.match(/({%(.*?)%})/g);
42
36
  let n = !0;
43
- return t !== null && !y && t.forEach((l) => {
44
- const a = l.slice(2, -2).trim().match(/(".*?"|[^"\s]+)(?=\s*|\s*$)/g);
45
- if (a && a.length > 0) {
46
- const [r] = a;
47
- S(r) && !s.includes(r) && (o({
37
+ return t !== null && !p && t.forEach((l) => {
38
+ const o = l.slice(2, -2).trim().match(/(".*?"|[^"\s]+)(?=\s*|\s*$)/g);
39
+ if (o && o.length > 0) {
40
+ const [i] = o;
41
+ w(i) && !s.includes(i) && (a({
48
42
  type: c.Warning,
49
- message: i("custom-fields.invalid-custom-fields")
43
+ message: r("custom-fields.invalid-custom-fields")
50
44
  }), n = !1);
51
45
  }
52
46
  }), n;
53
- }, w = async (e, s, t) => {
54
- const n = t ? await A(e) : !0;
55
- return I(e, s) && n;
56
- }, x = (e) => e.length > 0 ? !0 : (o({
47
+ }, k = async (e, s, t) => {
48
+ const n = t ? await b(e) : !0;
49
+ return A(e, s) && n;
50
+ }, x = (e) => e.length > 0 ? !0 : (a({
57
51
  type: c.Warning,
58
- message: i("newsletter.html-content-is-empty")
59
- }), !1), T = (e) => {
52
+ message: r("newsletter.html-content-is-empty")
53
+ }), !1), I = (e) => {
60
54
  const s = (e.match(/{/gm) || []).length, t = (e.match(/}/gm) || []).length;
61
- return s > t && o({
55
+ return s > t && a({
62
56
  type: c.Warning,
63
- message: i("custom-fields.missing-closing-braces")
64
- }), s < t && o({
57
+ message: r("custom-fields.missing-closing-braces")
58
+ }), s < t && a({
65
59
  type: c.Warning,
66
- message: i("custom-fields.missing-opening-braces")
60
+ message: r("custom-fields.missing-opening-braces")
67
61
  }), s === t;
68
- }, k = (e) => {
69
- const s = ie(e).length === 0;
70
- return s || o({
62
+ }, F = (e) => {
63
+ const s = e.match(/{{\s*(\w+\s+((\w+\|\w+)|(\w+)))\s*}}/gm) === null;
64
+ return s || a({
71
65
  type: c.Warning,
72
- message: i("custom-fields.invalid-custom-fields")
66
+ message: r("custom-fields.invalid-custom-fields")
73
67
  }), s;
74
- }, _ = (e, s) => {
68
+ }, T = (e, s) => {
75
69
  const t = e.match(/{{([a-zA-Z0-9_\s]*)}}/gm);
76
- if (t && !y) {
77
- const n = new Set(s.map((r) => r.toLowerCase())), l = se(e), a = [];
78
- if (t.forEach((r) => {
79
- const m = r.slice(2, -2).trim().toLowerCase();
80
- (!n.has(m) || m === "") && !ne(m, l) && a.push(m);
81
- }), a.length > 0) {
82
- const r = `
70
+ if (t && !p) {
71
+ const n = new Set(s.map((i) => i.toLowerCase())), l = Q(e), o = [];
72
+ if (t.forEach((i) => {
73
+ const m = i.slice(2, -2).trim().toLowerCase();
74
+ (!n.has(m) || m === "") && !ee(m, l) && o.push(m);
75
+ }), o.length > 0) {
76
+ const i = `
83
77
  <ul>
84
- ${a.map((m) => `<li>${m}</li>`).join("")}
78
+ ${o.map((m) => `<li>${m}</li>`).join("")}
85
79
  </ul>
86
80
  `;
87
- return o({
81
+ return a({
88
82
  type: c.Alert,
89
- message: i("custom-fields.invalid-custom-fields") + r
83
+ message: r("custom-fields.invalid-custom-fields") + i
90
84
  }), !1;
91
85
  }
92
86
  }
93
87
  return !0;
94
- }, N = (e) => {
88
+ }, R = (e) => {
95
89
  const s = e.match(/{%(.*?)%}/g), t = [];
96
90
  let n = !0;
97
91
  if (s && s.forEach((l) => {
98
- const a = l.match(G), r = l.match(H), m = (a == null ? void 0 : a.join("")) || "";
99
- (!a || l !== m) && !r && (o({
92
+ const o = l.match(P), i = l.match(G), m = (o == null ? void 0 : o.join("")) || "";
93
+ (!o || l !== m) && !i && (a({
100
94
  type: c.Alert,
101
- message: i("newsletter.display-conditions-invalid-syntax")
102
- }), n = !1), a && a.forEach((p) => {
103
- p.trim() === "=" && (o({
95
+ message: r("newsletter.display-conditions-invalid-syntax")
96
+ }), n = !1), o && o.forEach((f) => {
97
+ f.trim() === "=" && (a({
104
98
  type: c.Alert,
105
- message: i("custom-conditions.wrong-equality-operators")
99
+ message: r("custom-conditions.wrong-equality-operators")
106
100
  }), n = !1);
107
- const C = p.match(/^[a-zA-Z]*$/g);
108
- C && C.forEach((E) => {
109
- b(E) && t.push(E);
101
+ const v = f.match(/^[a-zA-Z]*$/g);
102
+ v && v.forEach((C) => {
103
+ E(C) && t.push(C);
110
104
  });
111
105
  });
112
106
  }), t.length) {
113
- const l = t.filter((r) => r === "if"), a = t.filter((r) => r === "endif");
114
- l.length !== a.length && (o({
107
+ const l = t.filter((i) => i === "if"), o = t.filter((i) => i === "endif");
108
+ l.length !== o.length && (a({
115
109
  type: c.Alert,
116
- message: i("custom-conditions.missing-if-endif-tag")
110
+ message: r("custom-conditions.missing-if-endif-tag")
117
111
  }), n = !1);
118
112
  }
119
113
  return n;
120
- }, R = (e) => {
114
+ }, B = (e) => {
121
115
  const s = (e.match(/{% /gm) || []).length, t = (e.match(/ %}/gm) || []).length, n = s === t;
122
- return n || o({
116
+ return n || a({
123
117
  type: c.Warning,
124
- message: i("custom-conditions.no-space-after-braces")
118
+ message: r("custom-conditions.no-space-after-braces")
125
119
  }), n;
126
- }, D = (e) => (e.match(/({%(.*?)%})/g) || []).filter((t) => t.includes("if")).map((t) => (t.match(/{{.*}}/gm) || []).length).reduce((t, n) => t + n, 0) > 0 ? (o({
120
+ }, W = (e) => (e.match(/({%(.*?)%})/g) || []).filter((t) => t.includes("if")).map((t) => (t.match(/{{.*}}/gm) || []).length).reduce((t, n) => t + n, 0) > 0 ? (a({
127
121
  type: c.Warning,
128
- message: i("custom-conditions.no-braces-inside-if-tag")
129
- }), !1) : !0, F = () => g.hasInvalidBlock() ? (o({
122
+ message: r("custom-conditions.no-braces-inside-if-tag")
123
+ }), !1) : !0, N = () => S.hasInvalidBlock() ? (a({
130
124
  type: c.Alert,
131
- message: i(z)
132
- }), !1) : !0, O = () => u.recommendationConfigs && Object.values(u.recommendationConfigs).find((s) => s.filters.find((t) => t.value === "")) !== void 0 ? (o({
125
+ message: r(j)
126
+ }), !1) : !0, O = () => g.recommendationConfigs && Object.values(g.recommendationConfigs).find((s) => s.filters.find((t) => t.value === "")) !== void 0 ? (a({
133
127
  type: c.Alert,
134
- message: i("newsletter.fill-all-necessary-fields")
135
- }), !1) : !0, B = (e) => {
128
+ message: r("newsletter.fill-all-necessary-fields")
129
+ }), !1) : !0, D = (e) => {
136
130
  const s = /src="[^"]*\.(svg|pst)"/gm;
137
- return e.match(s) === null ? !0 : (o({
131
+ return e.match(s) === null ? !0 : (a({
138
132
  type: c.Alert,
139
- message: i("newsletter.invalid-image-type")
133
+ message: r("newsletter.invalid-image-type")
140
134
  }), !1);
141
135
  }, L = (e) => {
142
136
  const n = new DOMParser().parseFromString(e, "text/html").querySelectorAll(".checkbox-block-v2");
143
- return Array.from(n).find((a) => {
144
- var r;
145
- return !((r = a.id) != null && r.trim());
146
- }) ? (o({
137
+ return Array.from(n).find((o) => {
138
+ var i;
139
+ return !((i = o.id) != null && i.trim());
140
+ }) ? (a({
147
141
  type: c.Alert,
148
- message: i("unsubscribe-templates.select-checkbox-groups")
142
+ message: r("unsubscribe-templates.select-checkbox-groups")
149
143
  }), !1) : !0;
150
- }, W = (e) => {
144
+ }, V = (e) => {
151
145
  const n = new DOMParser().parseFromString(e, "text/html").querySelectorAll(".radio-button-v2");
152
- return Array.from(n).find((a) => {
153
- var r;
154
- return !((r = a.id) != null && r.trim());
155
- }) ? (o({
146
+ return Array.from(n).find((o) => {
147
+ var i;
148
+ return !((i = o.id) != null && i.trim());
149
+ }) ? (a({
156
150
  type: c.Alert,
157
- message: i("unsubscribe-templates.select-radio-button-groups")
151
+ message: r("unsubscribe-templates.select-radio-button-groups")
158
152
  }), !1) : !0;
159
153
  };
160
154
  return { validateHtml: async (e, s, t = !1) => {
161
- var a, r;
155
+ var o, i;
162
156
  const n = [
163
157
  ...s.map((m) => m.value),
164
- ...K,
165
- ...((r = (a = f.value) == null ? void 0 : a.template) == null ? void 0 : r.customFieldAttributes) ?? []
158
+ ...q,
159
+ ...((i = (o = d.value) == null ? void 0 : o.template) == null ? void 0 : i.customFieldAttributes) ?? []
166
160
  ];
167
- return await w(e, n, t) && x(e) && T(e) && k(e) && _(e, n) && N(e) && R(e) && D(e) && F() && O() && B(e) && L(e) && W(e);
161
+ return await k(e, n, t) && x(e) && I(e) && F(e) && T(e, n) && R(e) && B(e) && W(e) && N() && O() && D(e) && L(e) && V(e);
168
162
  } };
169
163
  };
170
164
  export {
171
- ve as useHtmlValidator
165
+ ge as useHtmlValidator
172
166
  };
@@ -1,27 +1,29 @@
1
- import { useActionsApi as D } from "./useActionsApi.js";
2
- import { useBlocksConfig as I } from "./useBlocksConfig.js";
3
- import { useConfig as P } from "./useConfig.js";
4
- import { useCustomInterfaceAppearance as U } from "./useCustomInterfaceAppearance.js";
5
- import { useFullStoryBridge as R } from "./useFullStoryBridge.js";
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
6
  import { useStripoEventHandler as q } from "./useStripoEventHandler.js";
7
- import { useToaster as x } from "./useToaster.js";
8
- import { localePatch as H } from "../config/i18n/index.js";
9
- import { useStripoApi as O } from "../services/stripoApi.js";
10
- import j from "../static/styles/customEditorStyle.css.js";
11
- import { useEditorStore as E } from "../stores/editor.js";
12
- import { dynamicContentToMergeTags as z } from "../utils/genericUtil.js";
13
- import L from "../package.json.js";
14
- const se = (C, l) => {
15
- const { features: c, template: h, isFeatureEnabled: u } = P(), { handleError: m } = x(), { getToken: w, getCustomFonts: b, getSyncModulesStatus: k } = O(), { handleEvent: F } = q(), { getStripoBlocksConfig: B } = I(), T = async (i, r = [], s = !1) => {
7
+ import { useToaster as H } from "./useToaster.js";
8
+ import { localePatch as z } from "../config/i18n/index.js";
9
+ 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) => {
16
18
  var g, S, y;
17
- const e = E(), { html: p, css: a } = i, { baseBlocks: o, extensions: d } = await B(), f = ((g = c.value) == null ? void 0 : g.displayConditions) ?? !0, _ = ((S = c.value) == null ? void 0 : S.modulesDisabled) ?? !1, v = ((y = h.value) == null ? void 0 : y.forceRecreate) ?? !1;
18
- window.UIEditor.initEditor(
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
+ await window.UIEditor.initEditor(
19
21
  document.querySelector("#guido-editor"),
20
22
  {
21
- metadata: C,
23
+ metadata: E,
22
24
  html: p,
23
25
  css: a,
24
- forceRecreate: v,
26
+ forceRecreate: M,
25
27
  locale: "en",
26
28
  undoButtonSelector: "#guido__undo-button",
27
29
  redoButtonSelector: "#guido__redo-button",
@@ -31,12 +33,12 @@ const se = (C, l) => {
31
33
  customAppearanceMergetags: !u("liquidSyntax"),
32
34
  customAppearanceMergetagsBorderColor: "#f1f3fe",
33
35
  customAppearanceMergetagsBackgroundColor: "#f1f3fe",
34
- customViewStyles: j,
36
+ customViewStyles: G,
35
37
  conditionsEnabled: f,
36
38
  customConditionsEnabled: f,
37
39
  enableXSSSecurity: !0,
38
- modulesDisabled: _,
39
- syncModulesEnabled: s,
40
+ modulesDisabled: A,
41
+ syncModulesEnabled: i,
40
42
  messageSettingsEnabled: !0,
41
43
  displayGmailAnnotations: !0,
42
44
  displayHiddenPreheader: !1,
@@ -45,7 +47,7 @@ const se = (C, l) => {
45
47
  selectElementAfterDrop: !0,
46
48
  sameFontSizeForOutlook: !0,
47
49
  allowedScriptSourceDomains: "https://email-static.useinsider.com https://edge.fullstory.com https://rs.fullstory.com",
48
- ...o ? { baseBlocks: o } : {},
50
+ ...t ? { baseBlocks: t } : {},
49
51
  editorFonts: {
50
52
  showDefaultStandardFonts: !0,
51
53
  showDefaultNotStandardFonts: !0,
@@ -53,38 +55,38 @@ const se = (C, l) => {
53
55
  },
54
56
  mergeTags: [
55
57
  {
56
- entries: z(
58
+ entries: J(
57
59
  l.preselectedDynamicContentList,
58
60
  u("liquidSyntax")
59
61
  )
60
62
  }
61
63
  ],
62
- async onTokenRefreshRequest(t) {
64
+ async onTokenRefreshRequest(o) {
63
65
  try {
64
- const n = await w();
65
- t(n);
66
+ const n = await T();
67
+ o(n);
66
68
  } catch (n) {
67
69
  m(n, "Failed to refresh token");
68
70
  }
69
71
  },
70
72
  onTemplateLoaded() {
71
73
  try {
72
- const { importCss: t } = U(), { activateCustomViewStyles: n, updateTimerInClonedTemplate: M } = D(), { injectFullStory: A } = R();
73
- t(), n(), A(), M(), l.onReady(), e.isStripoInitialized = !0, e.loadingStatus = !1, setTimeout(() => {
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(() => {
74
76
  e.hasChanges = !1;
75
77
  }, 1e3);
76
- } catch (t) {
77
- m(t, "Failed to load custom interface appearance");
78
+ } catch (o) {
79
+ m(o, "Failed to load custom interface appearance");
78
80
  }
79
81
  },
80
- onCodeEditorVisibilityChanged(t) {
81
- e.isCodeEditorOpen = t;
82
+ onCodeEditorVisibilityChanged(o) {
83
+ e.isCodeEditorOpen = o;
82
84
  },
83
- onEditorVisualModeChanged(t) {
84
- e.editorVisualMode = t.toLowerCase();
85
+ onEditorVisualModeChanged(o) {
86
+ e.editorVisualMode = o.toLowerCase();
85
87
  },
86
- onVersionHistoryVisibilityChanged(t) {
87
- e.isVersionHistoryOpen = t;
88
+ onVersionHistoryVisibilityChanged(o) {
89
+ e.isVersionHistoryOpen = o;
88
90
  },
89
91
  onDataChanged() {
90
92
  e.hasChanges = !0;
@@ -96,32 +98,44 @@ const se = (C, l) => {
96
98
  ".in-drawer__container"
97
99
  ],
98
100
  extensions: d,
99
- localePatch: H
101
+ localePatch: z
100
102
  }
101
103
  );
102
- }, V = (i) => new Promise((r, s) => {
104
+ }, _ = (s) => new Promise((r, i) => {
103
105
  var d;
104
106
  if (document.getElementById("UiEditorScript")) {
105
- i(), r();
107
+ Promise.resolve(s()).then(r, i);
106
108
  return;
107
109
  }
108
- const e = L.guido, a = `https://email-static.useinsider.com/guido/${(d = e == null ? void 0 : e.stripo) == null ? void 0 : d.version}/UIEditor.js`, o = document.createElement("script");
109
- o.id = "UiEditorScript", o.type = "module", o.src = a, o.onload = () => {
110
- i(), r();
111
- }, o.onerror = () => {
112
- s(new Error(`Failed to load Stripo UIEditor script from S3: ${a}`));
113
- }, document.body.appendChild(o);
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");
111
+ t.id = "UiEditorScript", t.type = "module", t.src = a, t.onload = () => {
112
+ Promise.resolve(s()).then(r, i);
113
+ }, t.onerror = () => {
114
+ i(new Error(`Failed to load Stripo UIEditor script from S3: ${a}`));
115
+ }, document.body.appendChild(t);
114
116
  });
115
- return { initPlugin: async (i) => {
116
- await V(async () => {
117
- const r = E(), [s, e] = await Promise.all([
118
- b(),
119
- k()
120
- ]);
121
- r.syncModulesEnabled = e, await T(i, s, e);
122
- });
117
+ return { initPlugin: async (s) => {
118
+ const r = C();
119
+ try {
120
+ await _(async () => {
121
+ const [i, e] = await Promise.all([
122
+ k(),
123
+ B()
124
+ ]);
125
+ r.syncModulesEnabled = e, await V(s, i, e);
126
+ });
127
+ } catch {
128
+ r.loadingStatus = !1, b({
129
+ type: L.Alert,
130
+ message: h["An error has occurred. Please report the error code to support."],
131
+ actionButton: {
132
+ text: h["Reload page"],
133
+ onClick: () => window.location.reload()
134
+ }
135
+ });
136
+ }
123
137
  } };
124
138
  };
125
139
  export {
126
- se as useStripo
140
+ ce as useStripo
127
141
  };
@@ -1,4 +1,5 @@
1
1
  const e = "Your version has been restored successfully.", o = "Restore Image", t = "Cancel", a = {
2
+ "Reload page": "Reload page",
2
3
  "The image has been deleted.": "The image has been deleted successfully.",
3
4
  "Aim for the drop zone!": "Drag and drop your image inside the upload area to continue.",
4
5
  "Image processing": "The image upload is in progress. This may take some time.",
@@ -1,15 +1,7 @@
1
- const n = "newsletter.already-in-progress", e = "newsletter.campaign-could-not-be-saved", s = / (==|<=|>=|!=|>|<|in) | (if|elif|endif|else|and|or) |("[\S ]+")|('[\S ]+')|([^”\s\n]+)|(({%)|( %}))/gm, o = /{%( )*now( )(".*")( )*%}/gm, i = /\{\{[^{}]+\}\}/g, E = /^[A-Za-z0-9_.]+$/, _ = [
2
- "ins-unsubscribe-link",
3
- "ins-global-unsubscribe-link",
4
- "ins-preferences-unsubscribe-link",
5
- "@COUPON_CODE"
6
- ];
1
+ const e = "newsletter.already-in-progress", n = "newsletter.campaign-could-not-be-saved", o = / (==|<=|>=|!=|>|<|in) | (if|elif|endif|else|and|or) |("[\S ]+")|('[\S ]+')|([^”\s\n]+)|(({%)|( %}))/gm, a = /{%( )*now( )(".*")( )*%}/gm;
7
2
  export {
8
- _ as ALLOWED_DYNAMIC_SYSTEM_TOKENS,
9
- e as CampaignCouldNotBeSavedKey,
10
- n as CanNotMakeAnyChangesForRunningKey,
11
- o as DISPLAY_CONDITIONS_EXCEPTIONS_REGEX,
12
- s as DISPLAY_CONDITIONS_REGEX,
13
- i as DYNAMIC_CONTENT_TAG_REGEX,
14
- E as VALID_DYNAMIC_VARIABLE_REGEX
3
+ n as CampaignCouldNotBeSavedKey,
4
+ e as CanNotMakeAnyChangesForRunningKey,
5
+ a as DISPLAY_CONDITIONS_EXCEPTIONS_REGEX,
6
+ o as DISPLAY_CONDITIONS_REGEX
15
7
  };
@@ -4,6 +4,3 @@ export declare const CampaignCouldNotBeSavedKey = "newsletter.campaign-could-not
4
4
  export declare const DISPLAY_CONDITIONS_REGEX: RegExp;
5
5
  export declare const DISPLAY_CONDITIONS_EXCEPTIONS_REGEX: RegExp;
6
6
  export declare const REMOVE_CONDITIONS_REGEX: RegExp;
7
- export declare const DYNAMIC_CONTENT_TAG_REGEX: RegExp;
8
- export declare const VALID_DYNAMIC_VARIABLE_REGEX: RegExp;
9
- export declare const ALLOWED_DYNAMIC_SYSTEM_TOKENS: string[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@useinsider/guido",
3
- "version": "3.7.0-beta.a6317a3",
3
+ "version": "3.7.0-beta.bd7cb8f",
4
4
  "description": "Guido is a Vue + TypeScript wrapper for Email Plugin. Easily embed the email editor in your Vue applications.",
5
5
  "main": "./dist/guido.umd.cjs",
6
6
  "module": "./dist/library.js",