@useinsider/guido 3.19.0-beta.4b9be3a → 3.19.0-beta.4e3e6c4

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 (88) hide show
  1. package/README.md +21 -3
  2. package/dist/@types/config/schemas.js +59 -51
  3. package/dist/components/Guido.vue.js +8 -8
  4. package/dist/components/Guido.vue2.js +84 -87
  5. package/dist/components/organisms/base/AuthErrorModal.vue.js +18 -0
  6. package/dist/components/organisms/base/AuthErrorModal.vue2.js +29 -0
  7. package/dist/components/organisms/base/Toaster.vue2.js +13 -12
  8. package/dist/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue.js +13 -11
  9. package/dist/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue2.js +78 -57
  10. package/dist/components/organisms/extensions/recommendation/LegacyStrategyUpdatedModal.vue.js +18 -0
  11. package/dist/components/organisms/extensions/recommendation/LegacyStrategyUpdatedModal.vue2.js +25 -0
  12. package/dist/components/organisms/extensions/recommendation/RemoveStrategyModal.vue2.js +28 -42
  13. package/dist/components/organisms/header/EditorActions.vue.js +4 -4
  14. package/dist/components/organisms/header/EditorActions.vue2.js +23 -25
  15. package/dist/components/organisms/onboarding/OnboardingWrapper.vue2.js +28 -24
  16. package/dist/components/organisms/onboarding/RecommendationLegacyStrategyOnboarding.vue.js +21 -0
  17. package/dist/components/organisms/onboarding/RecommendationLegacyStrategyOnboarding.vue2.js +46 -0
  18. package/dist/components/organisms/onboarding/RecommendationStrategyOnboarding.vue.js +21 -0
  19. package/dist/components/organisms/onboarding/RecommendationStrategyOnboarding.vue2.js +47 -0
  20. package/dist/components/wrappers/WpModal.vue.js +1 -1
  21. package/dist/components/wrappers/WpModal.vue2.js +4 -3
  22. package/dist/composables/useActionsApi.js +44 -43
  23. package/dist/composables/useAuthError.js +52 -0
  24. package/dist/composables/useCodeEditorApi.js +23 -9
  25. package/dist/composables/useCortexBlueprintBridge.js +54 -120
  26. package/dist/composables/useCustomInterfaceAppearance.js +65 -51
  27. package/dist/composables/useEmailTemplateApplier.js +51 -96
  28. package/dist/composables/useHtmlValidator.js +87 -82
  29. package/dist/composables/useHttp.js +61 -54
  30. package/dist/composables/useLegacyStrategyConversion.js +61 -0
  31. package/dist/composables/useRecommendation.js +40 -35
  32. package/dist/composables/useStripo.js +30 -30
  33. package/dist/composables/useToaster.js +18 -22
  34. package/dist/composables/useTranslations.js +3 -2
  35. package/dist/composables/useVersionHistoryApi.js +33 -24
  36. package/dist/composables/validators/useLiquidValidator.js +15 -15
  37. package/dist/enums/extensions/recommendationBlock.js +49 -33
  38. package/dist/extensions/Blocks/Recommendation/block.js +61 -42
  39. package/dist/extensions/Blocks/Recommendation/constants/defaultConfig.js +21 -20
  40. package/dist/extensions/Blocks/Recommendation/controls/main/index.js +100 -94
  41. package/dist/extensions/Blocks/Recommendation/controls/main/strategy.js +130 -55
  42. package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +74 -74
  43. package/dist/extensions/Blocks/Recommendation/store/recommendation.js +273 -92
  44. package/dist/extensions/Blocks/Recommendation/utils/legacyStrategyMigration.js +42 -0
  45. package/dist/extensions/Blocks/Recommendation/utils/nodeConfigWriter.js +26 -16
  46. package/dist/extensions/Blocks/Recommendation/utils/strategyCommit.js +24 -0
  47. package/dist/extensions/Blocks/Recommendation/validation/requiredFields.js +21 -12
  48. package/dist/guido.css +1 -1
  49. package/dist/services/recommendationApi.js +46 -37
  50. package/dist/src/@types/config/schemas.d.ts +16 -0
  51. package/dist/src/components/organisms/base/AuthErrorModal.vue.d.ts +2 -0
  52. package/dist/src/components/organisms/extensions/recommendation/LegacyStrategyUpdatedModal.vue.d.ts +2 -0
  53. package/dist/src/components/organisms/onboarding/RecommendationLegacyStrategyOnboarding.vue.d.ts +2 -0
  54. package/dist/src/components/organisms/onboarding/RecommendationStrategyOnboarding.vue.d.ts +2 -0
  55. package/dist/src/components/wrappers/WpModal.vue.d.ts +5 -1
  56. package/dist/src/composables/useAuthError.d.ts +12 -0
  57. package/dist/src/composables/useConfig.d.ts +4 -0
  58. package/dist/src/composables/useCortexBlueprintBridge.d.ts +3 -4
  59. package/dist/src/composables/useEmailTemplateApplier.d.ts +5 -26
  60. package/dist/src/composables/useHttp.d.ts +2 -0
  61. package/dist/src/composables/useLegacyStrategyConversion.d.ts +3 -0
  62. package/dist/src/enums/extensions/recommendationBlock.d.ts +7 -1
  63. package/dist/src/extensions/Blocks/Recommendation/block.d.ts +10 -0
  64. package/dist/src/extensions/Blocks/Recommendation/constants/defaultConfig.d.ts +1 -0
  65. package/dist/src/extensions/Blocks/Recommendation/constants/index.d.ts +1 -1
  66. package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +2 -0
  67. package/dist/src/extensions/Blocks/Recommendation/controls/main/strategy.d.ts +10 -0
  68. package/dist/src/extensions/Blocks/Recommendation/controls/main/utils.d.ts +7 -2
  69. package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +162 -1
  70. package/dist/src/extensions/Blocks/Recommendation/utils/legacyStrategyMigration.d.ts +32 -0
  71. package/dist/src/extensions/Blocks/Recommendation/utils/strategyCommit.d.ts +14 -0
  72. package/dist/src/extensions/Blocks/Recommendation/validation/requiredFields.d.ts +4 -0
  73. package/dist/src/services/recommendationApi.d.ts +2 -1
  74. package/dist/src/stores/config.d.ts +322 -0
  75. package/dist/src/stores/guido-email-editor.d.ts +10 -32
  76. package/dist/src/stores/onboarding.d.ts +808 -10
  77. package/dist/src/utils/stripoEditorApi.d.ts +4 -0
  78. package/dist/static/assets/icons/filled-arrow-rising.svg.js +5 -0
  79. package/dist/static/assets/icons/line-info.svg.js +5 -0
  80. package/dist/static/styles/components/recommendation-strategy.css.js +104 -9
  81. package/dist/static/styles/components/skeleton.css.js +23 -0
  82. package/dist/stores/config.js +74 -60
  83. package/dist/stores/guido-email-editor.js +1 -3
  84. package/dist/stores/onboarding.js +46 -36
  85. package/dist/stores/unsubscribe.js +3 -3
  86. package/dist/utils/stripoEditorApi.js +11 -0
  87. package/dist/utils/templatePreparation.js +55 -55
  88. package/package.json +2 -1
@@ -1,88 +1,95 @@
1
- import { getCsrfToken as O } from "../utils/genericUtil.js";
2
- import { ref as m, computed as T } from "vue";
3
- const X = (b = {}) => {
4
- const p = m(!1), a = m(null), u = m(null), g = T(() => p.value), y = T(() => a.value !== null), v = {
1
+ import { getCsrfToken as D } from "../utils/genericUtil.js";
2
+ import { ref as T, computed as w } from "vue";
3
+ import { isPanelOrigin as j, reportAuthError as X } from "./useAuthError.js";
4
+ const k = [401, 403, 419], _ = (g = {}) => {
5
+ const h = T(!1), n = T(null), c = T(null), b = w(() => h.value), y = w(() => n.value !== null), E = {
5
6
  baseURL: "",
6
7
  timeout: 1e4,
7
8
  retry: 0,
8
9
  retryDelay: 1e3,
9
10
  headers: {
10
11
  "Content-Type": "application/json",
11
- "X-CSRF-TOKEN": O(),
12
+ "X-CSRF-TOKEN": D(),
12
13
  Accept: "application/json",
14
+ // Without this a guest fetch gets a 302 to the login page, never an auth status.
13
15
  "X-Requested-With": "XMLHttpRequest"
14
16
  },
15
- ...b
16
- }, w = (e, s) => {
17
+ ...g
18
+ }, x = (e, r) => {
17
19
  if (e.startsWith("http://") || e.startsWith("https://"))
18
20
  return e;
19
- const t = s || v.baseURL || "";
21
+ const t = r || E.baseURL || "";
20
22
  return t.endsWith("/") && e.startsWith("/") ? `${t}${e.slice(1)}` : t.endsWith("/") || e.startsWith("/") ? `${t}${e}` : `${t}/${e}`;
21
- }, P = (e) => new Promise((s, t) => {
23
+ }, P = (e) => new Promise((r, t) => {
22
24
  setTimeout(() => {
23
25
  t(new Error("Request timeout"));
24
26
  }, e);
25
- }), x = (e) => new Promise((s) => {
26
- setTimeout(s, e);
27
- }), i = async (e, s, t, L = {}) => {
28
- a.value = null, p.value = !0, u.value = new AbortController();
29
- const n = { ...v, ...L }, D = w(s, n.baseURL), c = {
27
+ }), R = (e) => new Promise((r) => {
28
+ setTimeout(r, e);
29
+ }), i = async (e, r, t, W = {}) => {
30
+ n.value = null, h.value = !0, c.value = new AbortController();
31
+ const a = { ...E, ...W }, p = x(r, a.baseURL), f = {
30
32
  method: e,
31
- headers: { ...n.headers },
32
- signal: u.value.signal,
33
- ...n
33
+ headers: { ...a.headers },
34
+ signal: c.value.signal,
35
+ ...a
34
36
  };
35
- t && ["POST", "PUT", "PATCH"].includes(e) && (t instanceof FormData ? (delete c.headers["Content-Type"], c.body = t) : c.body = JSON.stringify(t));
36
- const E = async (h = 0) => {
37
+ t && ["POST", "PUT", "PATCH"].includes(e) && (t instanceof FormData ? (delete f.headers["Content-Type"], f.body = t) : f.body = JSON.stringify(t));
38
+ const v = async (m = 0) => {
39
+ if (window.isSessionExpired)
40
+ throw n.value = { message: "Session expired" }, new Error("Session expired");
37
41
  try {
38
- const o = [fetch(D, c)];
39
- n.timeout && o.push(P(n.timeout));
40
- const r = await Promise.race(o);
41
- if (!r.ok) {
42
- const H = `HTTP Error: ${r.status} ${r.statusText}`, d = new Error(H);
43
- throw d.status = r.status, d.statusText = r.statusText, d.response = r, d;
42
+ const o = [fetch(p, f)];
43
+ a.timeout && o.push(P(a.timeout));
44
+ const s = await Promise.race(o);
45
+ if (!s.ok) {
46
+ const H = `HTTP Error: ${s.status} ${s.statusText}`, u = new Error(H);
47
+ throw u.status = s.status, u.statusText = s.statusText, u.response = s, u.authReported = k.includes(s.status) && j(p), u.authReported && Promise.resolve().then(() => s.clone().text().catch(() => "")).then((O) => X(
48
+ s.status,
49
+ O,
50
+ new URL(p, window.location.href).href
51
+ )).catch(() => {
52
+ }), u;
44
53
  }
45
- let f;
46
- const l = r.headers.get("content-type");
47
- return l != null && l.includes("application/json") ? f = await r.json() : l != null && l.includes("text/") ? f = await r.text() : f = await r.blob(), {
48
- data: f,
49
- status: r.status,
50
- statusText: r.statusText,
51
- headers: r.headers
54
+ let d;
55
+ const l = s.headers.get("content-type");
56
+ return l != null && l.includes("application/json") ? d = await s.json() : l != null && l.includes("text/") ? d = await s.text() : d = await s.blob(), {
57
+ data: d,
58
+ status: s.status,
59
+ statusText: s.statusText,
60
+ headers: s.headers
52
61
  };
53
62
  } catch (o) {
54
- const r = o instanceof Error && o.name === "AbortError";
55
- if (h < (n.retry || 0) && !r)
56
- return await x(n.retryDelay || 1e3), E(h + 1);
57
- throw o instanceof Error ? o.name === "AbortError" ? a.value = { message: "Request was cancelled" } : a.value = { message: o.message } : a.value = o, o;
63
+ const s = o instanceof Error && o.name === "AbortError";
64
+ if (m < (a.retry || 0) && !s)
65
+ return await R(a.retryDelay || 1e3), v(m + 1);
66
+ throw o instanceof Error ? o.name === "AbortError" ? n.value = { message: "Request was cancelled" } : n.value = { message: o.message } : n.value = o, o;
58
67
  }
59
68
  };
60
69
  try {
61
- return await E();
70
+ return await v();
62
71
  } finally {
63
- p.value = !1, u.value = null;
72
+ h.value = !1, c.value = null;
64
73
  }
65
- }, C = (e, s) => i("GET", e, void 0, s), R = (e, s, t) => i("POST", e, s, t), $ = (e, s, t) => i("PUT", e, s, t), q = (e, s, t) => i("PATCH", e, s, t), A = (e, s) => i("DELETE", e, void 0, s), U = (e) => {
66
- u.value && u.value.abort(e);
67
- }, W = () => {
68
- a.value = null;
74
+ }, A = (e, r) => i("GET", e, void 0, r), S = (e, r, t) => i("POST", e, r, t), U = (e, r, t) => i("PUT", e, r, t), C = (e, r, t) => i("PATCH", e, r, t), $ = (e, r) => i("DELETE", e, void 0, r), q = (e) => {
75
+ c.value && c.value.abort(e);
76
+ }, L = () => {
77
+ n.value = null;
69
78
  };
70
79
  return {
71
- // State
72
- loading: g,
73
- error: T(() => a.value),
80
+ loading: b,
81
+ error: w(() => n.value),
74
82
  hasError: y,
75
- // Methods
76
83
  request: i,
77
- get: C,
78
- post: R,
79
- put: $,
80
- patch: q,
81
- delete: A,
82
- cancel: U,
83
- clearError: W
84
+ get: A,
85
+ post: S,
86
+ put: U,
87
+ patch: C,
88
+ delete: $,
89
+ cancel: q,
90
+ clearError: L
84
91
  };
85
92
  };
86
93
  export {
87
- X as useHttp
94
+ _ as useHttp
88
95
  };
@@ -0,0 +1,61 @@
1
+ import { useRecommendation as I } from "./useRecommendation.js";
2
+ import { useToaster as C } from "./useToaster.js";
3
+ import { useTranslations as v } from "./useTranslations.js";
4
+ import { ToasterTypeOptions as g } from "../enums/toaster.js";
5
+ import "../extensions/Blocks/Recommendation/constants/selectors.js";
6
+ import { CURRENT_CONFIG_VERSION as L } from "../extensions/Blocks/Recommendation/constants/defaultConfig.js";
7
+ import { useRecommendationExtensionStore as b } from "../extensions/Blocks/Recommendation/store/recommendation.js";
8
+ import { resolveMigrationTarget as R, buildLegacyMigrationPayload as T } from "../extensions/Blocks/Recommendation/utils/legacyStrategyMigration.js";
9
+ import { commitBlockChangeOutsidePanel as h } from "../extensions/Blocks/Recommendation/utils/nodeConfigWriter.js";
10
+ import { useConfigStore as k } from "../stores/config.js";
11
+ const F = () => {
12
+ const e = b(), r = k(), { buildCampaignUrl: m } = I(), { showToaster: i } = C(), c = v();
13
+ return { convertLegacyStrategy: async () => {
14
+ const t = e.currentRecommendationId;
15
+ if (t === null || !e.isLegacyStrategyBlock || e.legacyConversionLoading)
16
+ return "";
17
+ const { strategy: d, productIds: y, size: l, strategyId: p, nodeConfigVersion: u } = e.recommendationConfigs, f = { strategyId: p, size: l, nodeConfigVersion: u }, s = R({
18
+ campaignId: r.campaignId,
19
+ templateLibraryId: r.templateLibraryId
20
+ }), S = T({
21
+ blockId: t,
22
+ url: m(String(t)),
23
+ campaignId: r.campaignId,
24
+ variationId: r.variationId,
25
+ strategy: d,
26
+ productIds: y,
27
+ target: s
28
+ });
29
+ let o;
30
+ try {
31
+ o = await e.convertLegacyStrategy(S, s);
32
+ } catch (n) {
33
+ return console.error("[useLegacyStrategyConversion] migration failed", n), i({
34
+ type: g.Error,
35
+ message: c("email-editor.legacy-strategy-update-failed")
36
+ }), "";
37
+ }
38
+ try {
39
+ await e.fetchStrategyProductsForBlock(t);
40
+ } catch (n) {
41
+ console.error("[useLegacyStrategyConversion] product refetch failed", n);
42
+ }
43
+ const a = e.blockStates[t];
44
+ return a ? h(
45
+ t,
46
+ {
47
+ strategyId: o,
48
+ size: a.recommendationConfigs.size,
49
+ configVersion: L
50
+ },
51
+ a.recommendationProducts,
52
+ "Converted legacy recommendation strategy"
53
+ ) ? (e.currentRecommendationId === t && e.openLegacyStrategyUpdatedModal(), o) : (console.error("[useLegacyStrategyConversion] node write failed", t), e.revertLegacyConversion(t, f), i({
54
+ type: g.Error,
55
+ message: c("email-editor.legacy-strategy-update-failed")
56
+ }), "") : o;
57
+ } };
58
+ };
59
+ export {
60
+ F as useLegacyStrategyConversion
61
+ };
@@ -1,23 +1,23 @@
1
1
  import { getRecommendationFeedSourceMaps as y, URLS as I } from "../enums/extensions/recommendationBlock.js";
2
2
  import { MinDeviceViewport as C, DefaultPadding as R } from "../enums/recommendation.js";
3
- import { useRecommendationExtensionStore as l } from "../extensions/Blocks/Recommendation/store/recommendation.js";
3
+ import { useRecommendationExtensionStore as g } from "../extensions/Blocks/Recommendation/store/recommendation.js";
4
4
  import { generateCompleteFilterQuery as b } from "../extensions/Blocks/Recommendation/utils/filterUtil.js";
5
5
  import { getPartnerRecommendationParams as h } from "../extensions/Blocks/Recommendation/utils/partnerCustomizations.js";
6
6
  import { sanitizeProductIds as x } from "../extensions/Blocks/Recommendation/utils/productIds.js";
7
7
  import { useConfigStore as P } from "../stores/config.js";
8
8
  const B = () => ({
9
9
  calculateCardWidth: ({
10
- mobileLeftPadding: i,
10
+ mobileLeftPadding: s,
11
11
  mobileRightPadding: c,
12
- cardsInRow: s,
13
- unresponsive: n
12
+ cardsInRow: o,
13
+ unresponsive: a
14
14
  }) => {
15
- const o = n ? s : 1, e = i + c + (o - 1) * R;
16
- return (C - e) / o;
15
+ const i = a ? o : 1, e = s + c + (i - 1) * R;
16
+ return (C - e) / i;
17
17
  },
18
- getRecommendationCampaignData: (i) => {
19
- const c = l(), s = Number(i), n = c.blockStates[s];
20
- if (!n)
18
+ getRecommendationCampaignData: (s) => {
19
+ const c = g(), o = Number(s), a = c.blockStates[o];
20
+ if (!a)
21
21
  return {
22
22
  textTrimming: !1,
23
23
  orientation: "vertical",
@@ -30,54 +30,59 @@ const B = () => ({
30
30
  discountBeforeTextValue: "",
31
31
  discountAfterTextValue: ""
32
32
  };
33
- const { recommendationConfigs: o } = n, e = o.orientation === "grid" ? "vertical" : "horizontal";
33
+ const { recommendationConfigs: i } = a, e = i.orientation === "grid" ? "vertical" : "horizontal";
34
34
  return {
35
- textTrimming: o.textTrimming,
35
+ textTrimming: i.textTrimming,
36
36
  orientation: e,
37
37
  mobileLeftPadding: 0,
38
38
  mobileRightPadding: 0,
39
- cardsInRow: o.cardsInRow,
40
- unresponsive: o.unresponsive,
39
+ cardsInRow: i.cardsInRow,
40
+ unresponsive: i.unresponsive,
41
41
  priceBeforeTextValue: "",
42
42
  priceAfterTextValue: "",
43
43
  discountBeforeTextValue: "",
44
44
  discountAfterTextValue: ""
45
45
  };
46
46
  },
47
- buildCampaignUrl: (i, c) => {
48
- var m;
49
- const s = l(), n = P(), o = Number(i);
47
+ buildCampaignUrl: (s, c) => {
48
+ var l;
49
+ const o = g(), a = P(), i = Number(s);
50
50
  let e;
51
51
  if (c)
52
52
  e = c;
53
53
  else {
54
- const a = s.blockStates[o];
55
- if (!a)
54
+ const r = o.blockStates[i];
55
+ if (!r)
56
56
  return "";
57
- const { recommendationConfigs: r } = a;
57
+ const { recommendationConfigs: n } = r;
58
58
  e = {
59
- strategy: r.strategy,
60
- strategyId: r.strategyId,
61
- language: r.language,
62
- currencyCode: r.currencySettings.value,
63
- size: r.size,
64
- productIds: r.productIds,
65
- filters: r.filters,
66
- shuffleProducts: r.shuffleProducts
59
+ strategy: n.strategy,
60
+ strategyId: n.strategyId,
61
+ language: n.language,
62
+ currencyCode: n.currencySettings.value,
63
+ size: n.size,
64
+ productIds: n.productIds,
65
+ filters: n.filters,
66
+ shuffleProducts: n.shuffleProducts
67
67
  };
68
68
  }
69
- if (e.strategyId && n.isFeatureEnabled("reusableRecommendationStrategy"))
70
- return s.recommendationCampaignUrls[i] = {
69
+ if (e.strategyId && a.isFeatureEnabled("reusableRecommendationStrategy"))
70
+ return o.recommendationCampaignUrls[s] = {
71
71
  strategyId: e.strategyId,
72
72
  locale: e.language,
73
73
  currency: e.currencyCode
74
74
  }, "";
75
- const g = ((m = y().find((a) => a.key === e.strategy)) == null ? void 0 : m.path) || "", t = new URLSearchParams();
76
- t.set("locale", e.language), t.set("currency", e.currencyCode), t.set("partnerName", n.partnerName), t.set("size", e.size), t.set("details", "true"), t.set("campaignId", n.variationId), e.strategy === "manualMerchandising" ? t.set("productId", x(e.productIds)) : e.strategy === "similarViewed" && t.set("productId", "{itemId}"), e.strategy === "userBased" && t.set("userId", "{user_id}");
77
- const f = e.filters.filter((a) => a.isValid), d = b(f);
78
- d && t.set("filter", d), e.shuffleProducts && t.set("shuffle", "true"), Object.entries(h(n.partnerName, e.strategy)).forEach(([a, r]) => t.set(a, r));
79
- const p = decodeURIComponent(t.toString()), u = `${I.RECOMMENDATION_API_URL}/v2/${g}?${p}`;
80
- return s.recommendationCampaignUrls[i] = u, u;
75
+ const d = ((l = y().find((r) => r.key === e.strategy)) == null ? void 0 : l.path) || "";
76
+ if (!d) {
77
+ const r = { ...o.recommendationCampaignUrls };
78
+ return delete r[s], o.recommendationCampaignUrls = r, "";
79
+ }
80
+ const t = new URLSearchParams();
81
+ t.set("locale", e.language), t.set("currency", e.currencyCode), t.set("partnerName", a.partnerName), t.set("size", e.size), t.set("details", "true"), t.set("campaignId", a.variationId), e.strategy === "manualMerchandising" ? t.set("productId", x(e.productIds)) : e.strategy === "similarViewed" && t.set("productId", "{itemId}"), e.strategy === "userBased" && t.set("userId", "{user_id}");
82
+ const f = e.filters.filter((r) => r.isValid), m = b(f);
83
+ m && t.set("filter", m), e.shuffleProducts && t.set("shuffle", "true"), Object.entries(h(a.partnerName, e.strategy)).forEach(([r, n]) => t.set(r, n));
84
+ const p = decodeURIComponent(t.toString()), u = `${I.RECOMMENDATION_API_URL}/v2/${d}?${p}`;
85
+ return o.recommendationCampaignUrls[s] = u, u;
81
86
  }
82
87
  });
83
88
  export {
@@ -1,23 +1,23 @@
1
- import { useActionsApi as x } from "./useActionsApi.js";
2
- import { useBlocksConfig as L } from "./useBlocksConfig.js";
3
- import { useConfig as O } from "./useConfig.js";
4
- import { useCustomInterfaceAppearance as H } from "./useCustomInterfaceAppearance.js";
1
+ import { useActionsApi as L } from "./useActionsApi.js";
2
+ import { useBlocksConfig as O } from "./useBlocksConfig.js";
3
+ import { useConfig as H } from "./useConfig.js";
4
+ import { useCustomInterfaceAppearance as w } from "./useCustomInterfaceAppearance.js";
5
5
  import { useFullStoryBridge as N } from "./useFullStoryBridge.js";
6
6
  import { useModuleRepair as j } from "./useModuleRepair.js";
7
7
  import { useStripoEventHandler as z } from "./useStripoEventHandler.js";
8
8
  import { useStripoNotifications as $ } from "./useStripoNotifications.js";
9
9
  import { useToaster as G } from "./useToaster.js";
10
10
  import { localePatch as J } from "../config/i18n/index.js";
11
- import { en as w } from "../config/i18n/en/index.js";
11
+ import { en as b } from "../config/i18n/en/index.js";
12
12
  import { ToasterTypeOptions as X } from "../enums/toaster.js";
13
13
  import { useStripoApi as K } from "../services/stripoApi.js";
14
14
  import Q from "../static/styles/customEditorStyle.css.js";
15
- import { useEditorStore as b } from "../stores/editor.js";
15
+ import { useEditorStore as k } from "../stores/editor.js";
16
16
  import { buildMergeTagEntries as W, flattenDynamicContentList as Y } from "../utils/genericUtil.js";
17
17
  import Z from "../package.json.js";
18
18
  let n = null;
19
- const Ce = () => {
20
- const { features: c, template: u, isFeatureEnabled: m } = O(), { handleError: p, showToaster: k } = G(), { getToken: B, getCustomFonts: M, getSyncModulesStatus: T } = K(), { handleEvent: v } = z(), { handleModuleAdd: F } = j(), { getStripoBlocksConfig: A } = L(), { getStripoNotifications: V } = $(), f = () => n || (n = new Promise((i, s) => {
19
+ const he = () => {
20
+ const { features: c, template: u, isFeatureEnabled: m } = H(), { handleError: p, showToaster: B } = G(), { getToken: M, getCustomFonts: T, getSyncModulesStatus: v } = K(), { handleEvent: F } = z(), { handleModuleAdd: A } = j(), { getStripoBlocksConfig: V } = O(), { getStripoNotifications: _ } = $(), f = () => n || (n = new Promise((i, s) => {
21
21
  var d;
22
22
  if (document.getElementById("UiEditorScript")) {
23
23
  i();
@@ -29,16 +29,16 @@ const Ce = () => {
29
29
  }, document.body.appendChild(e);
30
30
  }), n.catch(() => {
31
31
  n = null;
32
- }), n), _ = async (i, s, o, a = [], r = !1) => {
32
+ }), n), D = async (i, s, o, a = [], r = !1) => {
33
33
  var y, E, h, C;
34
- const e = b(), { html: d, css: D } = i, { baseBlocks: g, extensions: R } = await A(), S = ((y = c.value) == null ? void 0 : y.displayConditions) ?? !0, P = ((E = c.value) == null ? void 0 : E.modulesDisabled) ?? !1, U = !!d || (((h = u.value) == null ? void 0 : h.forceRecreate) ?? !1);
35
- await window.UIEditor.initEditor(
34
+ const e = k(), { html: d, css: R } = i, { baseBlocks: g, extensions: P } = await V(), S = ((y = c.value) == null ? void 0 : y.displayConditions) ?? !0, U = ((E = c.value) == null ? void 0 : E.modulesDisabled) ?? !1, I = !!d || (((h = u.value) == null ? void 0 : h.forceRecreate) ?? !1), q = "https://email-static.useinsider.com https://edge.fullstory.com https://rs.fullstory.com";
35
+ w().importCss(), await window.UIEditor.initEditor(
36
36
  document.querySelector("#guido-editor"),
37
37
  {
38
38
  metadata: s,
39
39
  html: d,
40
- css: D,
41
- forceRecreate: U,
40
+ css: R,
41
+ forceRecreate: I,
42
42
  locale: "en",
43
43
  undoButtonSelector: "#guido__undo-button",
44
44
  redoButtonSelector: "#guido__redo-button",
@@ -52,7 +52,7 @@ const Ce = () => {
52
52
  conditionsEnabled: S,
53
53
  customConditionsEnabled: S,
54
54
  enableXSSSecurity: !0,
55
- modulesDisabled: P,
55
+ modulesDisabled: U,
56
56
  syncModulesEnabled: r,
57
57
  messageSettingsEnabled: !0,
58
58
  displayGmailAnnotations: !0,
@@ -62,7 +62,7 @@ const Ce = () => {
62
62
  displayUTM: !1,
63
63
  selectElementAfterDrop: !0,
64
64
  sameFontSizeForOutlook: !0,
65
- allowedScriptSourceDomains: "https://email-static.useinsider.com https://edge.fullstory.com https://rs.fullstory.com",
65
+ allowedScriptSourceDomains: q,
66
66
  ...g ? { baseBlocks: g } : {},
67
67
  editorFonts: {
68
68
  showDefaultStandardFonts: !0,
@@ -80,7 +80,7 @@ const Ce = () => {
80
80
  ],
81
81
  async onTokenRefreshRequest(t) {
82
82
  try {
83
- const l = await B();
83
+ const l = await M();
84
84
  t(l);
85
85
  } catch (l) {
86
86
  p(l, "Failed to refresh token");
@@ -88,8 +88,8 @@ const Ce = () => {
88
88
  },
89
89
  onTemplateLoaded() {
90
90
  try {
91
- const { importCss: t } = H(), { activateCustomViewStyles: l, updateTimerInClonedTemplate: I } = x(), { injectFullStory: q } = N();
92
- t(), l(), q(), I(), o.onReady(), e.isStripoInitialized = !0, e.loadingStatus = !1, setTimeout(() => {
91
+ const { activateCustomViewStyles: t, updateTimerInClonedTemplate: l } = L(), { injectFullStory: x } = N();
92
+ w().importCss(), t(), x(), l(), o.onReady(), e.isStripoInitialized = !0, e.loadingStatus = !1, setTimeout(() => {
93
93
  e.hasChanges = !1;
94
94
  }, 1e3);
95
95
  } catch (t) {
@@ -108,34 +108,34 @@ const Ce = () => {
108
108
  onDataChanged() {
109
109
  e.hasChanges = !0, e.changeSeq += 1;
110
110
  },
111
- onEvent: v,
112
- onModuleAdd: F,
113
- notifications: V(),
111
+ onEvent: F,
112
+ onModuleAdd: A,
113
+ notifications: _(),
114
114
  ignoreClickOutsideSelectors: [
115
115
  "#guido-dynamic-content-modal",
116
116
  ".in-on-board-wrapper",
117
117
  ".in-drawer__container"
118
118
  ],
119
- extensions: R,
119
+ extensions: P,
120
120
  localePatch: J
121
121
  }
122
122
  );
123
123
  };
124
124
  return { initPlugin: async (i, s, o) => {
125
- const a = b();
125
+ const a = k();
126
126
  try {
127
127
  await f();
128
128
  const [r, e] = await Promise.all([
129
- M(),
130
- T()
129
+ T(),
130
+ v()
131
131
  ]);
132
- a.syncModulesEnabled = e, await _(i, s, o, r, e);
132
+ a.syncModulesEnabled = e, await D(i, s, o, r, e);
133
133
  } catch {
134
- a.loadingStatus = !1, k({
134
+ a.loadingStatus = !1, B({
135
135
  type: X.Error,
136
- message: w["An error has occurred. Please report the error code to support."],
136
+ message: b["An error has occurred. Please report the error code to support."],
137
137
  actionButton: {
138
- text: w["Reload page"],
138
+ text: b["Reload page"],
139
139
  onClick: () => window.location.reload()
140
140
  }
141
141
  });
@@ -146,5 +146,5 @@ const Ce = () => {
146
146
  } };
147
147
  };
148
148
  export {
149
- Ce as useStripo
149
+ he as useStripo
150
150
  };
@@ -1,32 +1,28 @@
1
1
  import { ToasterTypeOptions as T } from "../enums/toaster.js";
2
- import { useToasterStore as c } from "../stores/toaster.js";
3
- import { watch as u, nextTick as f } from "vue";
4
- const p = () => {
5
- const o = c();
6
- let t = null;
7
- const s = () => {
8
- t && (clearTimeout(t), t = null);
2
+ import { useToasterStore as u } from "../stores/toaster.js";
3
+ import { nextTick as c } from "vue";
4
+ const s = /* @__PURE__ */ new WeakMap(), p = () => {
5
+ const t = u(), o = () => {
6
+ const e = s.get(t);
7
+ e && (clearTimeout(e), s.delete(t));
9
8
  };
10
- function r(e = { message: "" }) {
11
- s(), o.hideToaster(), f(() => {
12
- o.showToaster(e);
9
+ function i(e = { message: "" }) {
10
+ o(), t.hideToaster(), c(() => {
11
+ t.showToaster(e), t.shouldAutoHide && s.set(t, setTimeout(() => {
12
+ t.hideToaster(), o();
13
+ }, 6e3));
13
14
  });
14
15
  }
15
- function i() {
16
- s(), o.hideToaster();
16
+ function n() {
17
+ o(), t.hideToaster();
17
18
  }
18
- function n(e, a) {
19
+ function a(e, r) {
20
+ if (e != null && e.authReported)
21
+ return;
19
22
  const m = e instanceof Error ? e.message : String(e);
20
- r({ type: T.Error, message: `${a}: ${m}` });
23
+ i({ type: T.Error, message: `${r}: ${m}` });
21
24
  }
22
- return u(
23
- () => o.shouldAutoHide,
24
- (e) => {
25
- s(), e && (t = setTimeout(() => {
26
- o.hideToaster(), s();
27
- }, 6e3));
28
- }
29
- ), { showToaster: r, hideToaster: i, handleError: n };
25
+ return { showToaster: i, hideToaster: n, handleError: a };
30
26
  };
31
27
  export {
32
28
  p as useToaster
@@ -6,9 +6,10 @@ import { useConfig } from "./useConfig.js";
6
6
  const useTranslations = () => {
7
7
  var o, e;
8
8
  const { config } = useConfig(), translationsPath = ((e = (o = config.value) == null ? void 0 : o.editor) == null ? void 0 : e.translationsPath) || DEFAULT_EDITOR.translationsPath, translations = ref(eval(translationsPath)), trans = (t, n) => {
9
- const r = translations.value[t];
9
+ var s;
10
+ const r = (s = translations.value) == null ? void 0 : s[t];
10
11
  return r ? n ? Object.entries(n).reduce(
11
- (s, [i, a]) => s.replace(new RegExp(`{${i}}`, "g"), String(a)),
12
+ (i, [a, l]) => i.replace(new RegExp(`{${a}}`, "g"), String(l)),
12
13
  r
13
14
  ) : r : (console.warn(`Translation key not found: ${t}`), t);
14
15
  };
@@ -1,54 +1,63 @@
1
1
  import { ToasterTypeOptions as t } from "../enums/toaster.js";
2
- import { useVersionHistoryStore as c } from "../stores/version-history.js";
3
- import { useToaster as w } from "./useToaster.js";
4
- const S = () => {
5
- const i = c(), { showToaster: s } = w(), n = (e) => {
6
- i.$reset(), i.updateState(e);
7
- }, p = () => {
8
- i.$reset();
2
+ import { useVersionHistoryStore as m } from "../stores/version-history.js";
3
+ import { findEditorApi as w, EDITOR_NOT_READY_MESSAGE as y } from "../utils/stripoEditorApi.js";
4
+ import { useToaster as V } from "./useToaster.js";
5
+ const d = () => {
6
+ const n = m(), { showToaster: i } = V(), o = (e) => {
7
+ var s;
8
+ const r = (s = w()) == null ? void 0 : s.versionHistoryApi;
9
+ if (!r) {
10
+ i({ type: t.Error, message: y });
11
+ return;
12
+ }
13
+ e(r);
14
+ }, p = (e) => {
15
+ n.$reset(), n.updateState(e);
16
+ }, a = () => {
17
+ n.$reset();
9
18
  };
10
19
  return {
11
20
  openVersionHistory: () => {
12
- window.StripoEditorApi.versionHistoryApi.openVersionHistory(n, p);
21
+ o((e) => e.openVersionHistory(p, a));
13
22
  },
14
23
  closeVersionHistory: () => {
15
- window.StripoEditorApi.versionHistoryApi.closeVersionHistory();
24
+ o((e) => e.closeVersionHistory());
16
25
  },
17
26
  switchToDesktopPreview: () => {
18
- window.StripoEditorApi.versionHistoryApi.switchToDesktopPreview();
27
+ o((e) => e.switchToDesktopPreview());
19
28
  },
20
29
  switchToMobilePreview: () => {
21
- window.StripoEditorApi.versionHistoryApi.switchToMobilePreview();
30
+ o((e) => e.switchToMobilePreview());
22
31
  },
23
32
  previewVersion: (e) => {
24
- window.StripoEditorApi.versionHistoryApi.previewVersion(e, (o) => {
25
- const r = o instanceof Error ? o.message : String(o);
26
- s({
33
+ o((r) => r.previewVersion(e, (s) => {
34
+ const c = s instanceof Error ? s.message : String(s);
35
+ i({
27
36
  type: t.Error,
28
- message: `Error compiling email: ${r}`
37
+ message: `Error compiling email: ${c}`
29
38
  });
30
- });
39
+ }));
31
40
  },
32
41
  restoreVersion: (e) => {
33
- window.StripoEditorApi.versionHistoryApi.restoreVersion(
42
+ o((r) => r.restoreVersion(
34
43
  e,
35
44
  () => {
36
- s({
45
+ i({
37
46
  type: t.Success,
38
47
  message: "Your version has been restored successfully."
39
48
  });
40
49
  },
41
- (o) => {
42
- const r = o instanceof Error ? o.message : String(o);
43
- s({
50
+ (s) => {
51
+ const c = s instanceof Error ? s.message : String(s);
52
+ i({
44
53
  type: t.Error,
45
- message: `Error compiling email: ${r}`
54
+ message: `Error compiling email: ${c}`
46
55
  });
47
56
  }
48
- );
57
+ ));
49
58
  }
50
59
  };
51
60
  };
52
61
  export {
53
- S as useVersionHistoryApi
62
+ d as useVersionHistoryApi
54
63
  };