@useinsider/guido 3.7.1-beta.794b3fc → 3.7.1-beta.ac21e59

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,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,8 +1,6 @@
1
1
  import { useTranslations as r } from "../../composables/useTranslations.js";
2
2
  const l = {
3
- RECOMMENDATION_API_URL: "https://recommendationv2.api.useinsider.com",
4
- // Relative path → same-origin as the embedding inone dashboard.
5
- PRODUCT_ATTRIBUTES_PATH: "/product-attributes/get-attributes"
3
+ RECOMMENDATION_API_URL: "https://recommendationv2.api.useinsider.com"
6
4
  }, c = {
7
5
  CLIENT_ID: "clientId"
8
6
  }, d = () => {
@@ -1,8 +1,8 @@
1
1
  import { getRecommendationFeedSourceMaps as g, getOperatorOptions as R, PriceAttributes as C } from "../../../../enums/extensions/recommendationBlock.js";
2
2
  import { useRecommendationApi as y } from "../../../../services/recommendationApi.js";
3
3
  import { useConfigStore as G } from "../../../../stores/config.js";
4
- import { defineStore as F } from "pinia";
5
- import { DEFAULT_MOBILE_CARDS_IN_ROW as P, DEFAULT_CARDS_IN_ROW as D } from "../constants/layout.js";
4
+ import { defineStore as P } from "pinia";
5
+ import { DEFAULT_MOBILE_CARDS_IN_ROW as D, DEFAULT_CARDS_IN_ROW as F } from "../constants/layout.js";
6
6
  import { EXCLUDED_ALGORITHM_IDS as w } from "../constants/defaultConfig.js";
7
7
  import { getDefaultProducts as S } from "../templates/utils.js";
8
8
  import { generateCompleteFilterQuery as b } from "../utils/filterUtil.js";
@@ -13,7 +13,7 @@ const h = y();
13
13
  let m = null, u = null, d = null;
14
14
  function k() {
15
15
  return {
16
- cardsInRow: D,
16
+ cardsInRow: F,
17
17
  currencySettings: {
18
18
  name: "USD",
19
19
  value: "USD",
@@ -27,7 +27,7 @@ function k() {
27
27
  productIds: [],
28
28
  id: 1,
29
29
  language: "en_US",
30
- mobileCardsInRow: P,
30
+ mobileCardsInRow: D,
31
31
  mobileLayoutEnabled: !1,
32
32
  orientation: "grid",
33
33
  recommendedProducts: [],
@@ -60,7 +60,7 @@ const L = () => ({
60
60
  blockStates: {},
61
61
  currentRecommendationId: null,
62
62
  configVersion: 0
63
- }), K = F("guidoRecommendationExtension", {
63
+ }), K = P("guidoRecommendationExtension", {
64
64
  state: () => L(),
65
65
  getters: {
66
66
  // ====================================================================
@@ -133,7 +133,7 @@ const L = () => ({
133
133
  value: e.text
134
134
  })),
135
135
  getFilterList() {
136
- return Object.values(this.filterList).filter((t) => t.isFilterable !== 0 && t.isFilterable !== !1).map((t) => {
136
+ return Object.values(this.filterList).map((t) => {
137
137
  let e;
138
138
  return t.type === "productAttribute" ? e = `product_attributes.${t.attributeName}` : C.includes(t.attributeName) ? e = `${t.attributeName}.${this.recommendationConfigs.currencySettings.value}` : e = t.attributeName, {
139
139
  text: t.displayName,
@@ -1,52 +1,40 @@
1
- import { useHttp as d } from "../composables/useHttp.js";
2
- import { QUERY_PARAMS as l, URLS as u } from "../enums/extensions/recommendationBlock.js";
3
- const R = (o) => o.reduce(
4
- (a, t, s) => (a[s] = {
5
- attributeName: t.attributeName,
6
- attributeJs: t.attributeJs,
7
- attributeType: t.attributeType,
8
- type: t.type,
9
- displayName: t.displayName,
10
- isFilterable: t.isFilterable
11
- }, a),
12
- {}
13
- ), f = () => {
14
- const { get: o } = d(), { get: a } = d({ headers: {} }), t = "6KcLM9TwheVB1mgK";
1
+ import { useHttp as a } from "../composables/useHttp.js";
2
+ import { QUERY_PARAMS as d, URLS as h } from "../enums/extensions/recommendationBlock.js";
3
+ const y = () => {
4
+ const { get: r } = a(), { get: s } = a({ headers: {} }), m = "6KcLM9TwheVB1mgK";
15
5
  return {
16
6
  fetchRecommendationCreateData: async () => {
17
7
  try {
18
- return (await o("/newsletter/recommendations/create-data")).data;
8
+ return (await r("/newsletter/recommendations/create-data")).data;
19
9
  } catch (e) {
20
10
  throw console.error("fetchUserModalState error:", e), e;
21
11
  }
22
12
  },
23
13
  fetchRecommendationFilters: async () => {
24
14
  try {
25
- const { data: e } = await o(
26
- u.PRODUCT_ATTRIBUTES_PATH
27
- ), n = Array.isArray(e) ? e : (e == null ? void 0 : e.data) ?? [];
28
- return R(n);
15
+ const { data: e } = await r("/stripo/email-recommendation-attributes");
16
+ return e;
29
17
  } catch (e) {
30
18
  throw console.error("fetchRecommendationFilters error:", e), e;
31
19
  }
32
20
  },
33
- fetchRecommendationProducts: async (e, n) => {
34
- var i;
21
+ fetchRecommendationProducts: async (e, i) => {
22
+ var n;
35
23
  try {
36
- const r = new URLSearchParams(Object.entries(n));
37
- r.set(l.CLIENT_ID, t);
38
- const m = decodeURIComponent(r.toString());
39
- console.debug("🏁 Recommendation API Query:", m);
40
- const c = await a(
41
- `${u.RECOMMENDATION_API_URL}/v2/${e}?${m}`
24
+ const t = new URLSearchParams(Object.entries(i));
25
+ t.set(d.CLIENT_ID, m);
26
+ const c = decodeURIComponent(t.toString());
27
+ console.debug("🏁 Recommendation API Query:", c);
28
+ const o = await s(
29
+ `${h.RECOMMENDATION_API_URL}/v2/${e}?${c}`
42
30
  );
43
- return ((i = c == null ? void 0 : c.data) == null ? void 0 : i.data) ?? [];
44
- } catch (r) {
45
- throw console.error("fetchRecommendationProducts error:", r), r;
31
+ return ((n = o == null ? void 0 : o.data) == null ? void 0 : n.data) ?? [];
32
+ } catch (t) {
33
+ throw console.error("fetchRecommendationProducts error:", t), t;
46
34
  }
47
35
  }
48
36
  };
49
37
  };
50
38
  export {
51
- f as useRecommendationApi
39
+ y as useRecommendationApi
52
40
  };
@@ -2,7 +2,6 @@ import type { TextValueObject } from '@@/Types/generic';
2
2
  import type { RecommendationFeedItem } from '@@/Types/recommendation';
3
3
  export declare const URLS: {
4
4
  RECOMMENDATION_API_URL: string;
5
- PRODUCT_ATTRIBUTES_PATH: string;
6
5
  };
7
6
  export declare const QUERY_PARAMS: {
8
7
  CLIENT_ID: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@useinsider/guido",
3
- "version": "3.7.1-beta.794b3fc",
3
+ "version": "3.7.1-beta.ac21e59",
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",