@useinsider/guido 3.30.0-beta.4b59dc6 → 3.30.0-beta.4c3dba9

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,55 +1,56 @@
1
- import { useActionsApi as j } from "./useActionsApi.js";
2
- import { useAmbiguousDynamicContent as z } from "./useAmbiguousDynamicContent.js";
3
- import { useBlocksConfig as $ } from "./useBlocksConfig.js";
4
- import { useConfig as G } from "./useConfig.js";
5
- import { useCustomInterfaceAppearance as v } from "./useCustomInterfaceAppearance.js";
6
- import { useFullStoryBridge as X } from "./useFullStoryBridge.js";
7
- import { useModuleRepair as J } from "./useModuleRepair.js";
8
- import { useStripoEventHandler as K } from "./useStripoEventHandler.js";
9
- import { useStripoNotifications as Q } from "./useStripoNotifications.js";
10
- import { useToaster as W } from "./useToaster.js";
11
- import { localePatch as Y } from "../config/i18n/index.js";
12
- import { en as B } from "../config/i18n/en/index.js";
13
- import { ToasterTypeOptions as Z } from "../enums/toaster.js";
14
- import { useStripoApi as ee } from "../services/stripoApi.js";
15
- import te from "../static/styles/customEditorStyle.css.js";
16
- import { useEditorStore as T } from "../stores/editor.js";
17
- import { buildMergeTagEntries as oe, flattenDynamicContentList as re } from "../utils/genericUtil.js";
18
- import { getStripoRuntimeBaseUrl as ie } from "../utils/stripoRuntime.js";
19
- let d = null, F = !1;
20
- const ve = (t) => {
21
- const { features: m, template: p, isFeatureEnabled: c } = G(), { handleError: f, showToaster: A } = W(), { getToken: P, getCustomFonts: R, getSyncModulesStatus: D } = ee(), { handleEvent: U } = K(), { handleModuleAdd: V } = J(), { restorePending: I } = z(), { getStripoBlocksConfig: L } = $(), { getStripoNotifications: q } = Q(), g = () => d || (d = new Promise((n, a) => {
1
+ import { useActionsApi as G } from "./useActionsApi.js";
2
+ import { useAmbiguousDynamicContent as $ } from "./useAmbiguousDynamicContent.js";
3
+ import { useBlocksConfig as X } from "./useBlocksConfig.js";
4
+ import { useConfig as J } from "./useConfig.js";
5
+ import { useCustomInterfaceAppearance as B } from "./useCustomInterfaceAppearance.js";
6
+ import { useFullStoryBridge as K } from "./useFullStoryBridge.js";
7
+ import { useModuleRepair as Q } from "./useModuleRepair.js";
8
+ import { useStripoEventHandler as W } from "./useStripoEventHandler.js";
9
+ import { useStripoNotifications as Y } from "./useStripoNotifications.js";
10
+ import { useToaster as Z } from "./useToaster.js";
11
+ import { localePatch as ee } from "../config/i18n/index.js";
12
+ import { en as F } from "../config/i18n/en/index.js";
13
+ import { ToasterTypeOptions as te } from "../enums/toaster.js";
14
+ import { useStripoApi as oe } from "../services/stripoApi.js";
15
+ import re from "../static/styles/customEditorStyle.css.js";
16
+ import { useEditorStore as A } from "../stores/editor.js";
17
+ import { buildSpecialLinkGroups as ie, buildMergeTagEntries as ne, flattenDynamicContentList as se } from "../utils/genericUtil.js";
18
+ import { listenForLinkTokenPaste as ae } from "../utils/linkTokenPaste.js";
19
+ import { getStripoRuntimeBaseUrl as de } from "../utils/stripoRuntime.js";
20
+ let d = null, P = !1;
21
+ const Pe = (t) => {
22
+ const { features: p, template: u, isFeatureEnabled: c } = J(), { handleError: f, showToaster: L } = Z(), { getToken: R, getCustomFonts: D, getSyncModulesStatus: U } = oe(), { handleEvent: V } = W(), { handleModuleAdd: I } = Q(), { restorePending: q } = $(), { getStripoBlocksConfig: x } = X(), { getStripoNotifications: O } = Y(), g = () => d || (d = new Promise((n, s) => {
22
23
  if (document.getElementById("UiEditorScript")) {
23
24
  n();
24
25
  return;
25
26
  }
26
- const i = ie();
27
+ const i = de();
27
28
  if (!i) {
28
- a(
29
+ s(
29
30
  new Error("guido.stripo.version is not set in package.json. Please configure the Stripo version.")
30
31
  );
31
32
  return;
32
33
  }
33
- const s = `${i}UIEditor.js`, e = document.createElement("script");
34
- e.id = "UiEditorScript", e.type = "module", e.src = s, e.onload = () => {
35
- F = !0, n();
34
+ const a = `${i}UIEditor.js`, e = document.createElement("script");
35
+ e.id = "UiEditorScript", e.type = "module", e.src = a, e.onload = () => {
36
+ P = !0, n();
36
37
  }, e.onerror = () => {
37
- e.remove(), a(new Error(`Failed to load Stripo UIEditor script from S3: ${s}`));
38
+ e.remove(), s(new Error(`Failed to load Stripo UIEditor script from S3: ${a}`));
38
39
  }, document.body.appendChild(e);
39
40
  }), d.catch(() => {
40
41
  d = null;
41
- }), d), x = async (n, a, i, s = [], e = !1, u = !1) => {
42
- var w, k, b, _;
43
- const o = T(), { html: y, css: S } = n, { baseBlocks: E, extensions: O } = await L();
42
+ }), d), H = async (n, s, i, a = [], e = !1, m = !1) => {
43
+ var w, b, _, v, T;
44
+ const o = A(), { html: S, css: y } = n, { baseBlocks: E, extensions: M } = await x();
44
45
  t.mark("blocks_config_ready");
45
- const h = ((w = m.value) == null ? void 0 : w.displayConditions) ?? !0, H = ((k = m.value) == null ? void 0 : k.modulesDisabled) ?? !1, C = u || (((b = p.value) == null ? void 0 : b.forceRecreate) ?? !1), M = "https://email-static.useinsider.com https://edge.fullstory.com https://rs.fullstory.com";
46
- t.setTemplate({ html: y, css: S, forceRecreate: C }), v().importCss(), t.mark("init_editor"), await window.UIEditor.initEditor(
46
+ const C = ((w = p.value) == null ? void 0 : w.displayConditions) ?? !0, N = ((b = p.value) == null ? void 0 : b.modulesDisabled) ?? !1, h = c("dynamicContentSpecialLinks") ? ie((_ = u.value) == null ? void 0 : _.dynamicContentList, c("liquidSyntax")) : [], k = m || (((v = u.value) == null ? void 0 : v.forceRecreate) ?? !1), j = "https://email-static.useinsider.com https://edge.fullstory.com https://rs.fullstory.com";
47
+ t.setTemplate({ html: S, css: y, forceRecreate: k }), B().importCss(), t.mark("init_editor"), await window.UIEditor.initEditor(
47
48
  document.querySelector("#guido-editor"),
48
49
  {
49
- metadata: a,
50
- html: y,
51
- css: S,
52
- forceRecreate: C,
50
+ metadata: s,
51
+ html: S,
52
+ css: y,
53
+ forceRecreate: k,
53
54
  locale: "en",
54
55
  undoButtonSelector: "#guido__undo-button",
55
56
  redoButtonSelector: "#guido__redo-button",
@@ -59,11 +60,12 @@ const ve = (t) => {
59
60
  customAppearanceMergetags: !c("liquidSyntax"),
60
61
  customAppearanceMergetagsBorderColor: "#f1f3fe",
61
62
  customAppearanceMergetagsBackgroundColor: "#f1f3fe",
62
- customViewStyles: te,
63
- conditionsEnabled: h,
64
- customConditionsEnabled: h,
63
+ ...h.length > 0 ? { specialLinks: h } : {},
64
+ customViewStyles: re,
65
+ conditionsEnabled: C,
66
+ customConditionsEnabled: C,
65
67
  enableXSSSecurity: !0,
66
- modulesDisabled: H,
68
+ modulesDisabled: N,
67
69
  syncModulesEnabled: e,
68
70
  messageSettingsEnabled: !0,
69
71
  displayGmailAnnotations: !0,
@@ -74,18 +76,18 @@ const ve = (t) => {
74
76
  copyPasteEnabled: !1,
75
77
  selectElementAfterDrop: !0,
76
78
  sameFontSizeForOutlook: !0,
77
- allowedScriptSourceDomains: M,
79
+ allowedScriptSourceDomains: j,
78
80
  ...E ? { baseBlocks: E } : {},
79
81
  editorFonts: {
80
82
  showDefaultStandardFonts: !0,
81
83
  showDefaultNotStandardFonts: !0,
82
- customFonts: s
84
+ customFonts: a
83
85
  },
84
86
  mergeTags: [
85
87
  {
86
- entries: oe(
88
+ entries: ne(
87
89
  i.preselectedDynamicContentList,
88
- re((_ = p.value) == null ? void 0 : _.dynamicContentList),
90
+ se((T = u.value) == null ? void 0 : T.dynamicContentList),
89
91
  c("liquidSyntax")
90
92
  )
91
93
  }
@@ -93,7 +95,7 @@ const ve = (t) => {
93
95
  async onTokenRefreshRequest(r) {
94
96
  try {
95
97
  t.mark("token_start");
96
- const l = await P();
98
+ const l = await R();
97
99
  t.mark("token_end"), r(l);
98
100
  } catch (l) {
99
101
  f(l, "Failed to refresh token");
@@ -101,8 +103,8 @@ const ve = (t) => {
101
103
  },
102
104
  onTemplateLoaded() {
103
105
  try {
104
- const { activateCustomViewStyles: r, updateTimerInClonedTemplate: l } = j(), { injectFullStory: N } = X();
105
- v().importCss(), r(), N(), I(), l(), i.onReady(), o.isStripoInitialized = !0, o.loadingStatus = !1, setTimeout(() => {
106
+ const { activateCustomViewStyles: r, updateTimerInClonedTemplate: l } = G(), { injectFullStory: z } = K();
107
+ B().importCss(), r(), z(), ae(), q(), l(), i.onReady(), o.isStripoInitialized = !0, o.loadingStatus = !1, setTimeout(() => {
106
108
  o.hasChanges = !1;
107
109
  }, 1e3), t.markReady();
108
110
  } catch (r) {
@@ -119,11 +121,11 @@ const ve = (t) => {
119
121
  o.isVersionHistoryOpen = r;
120
122
  },
121
123
  onDataChanged() {
122
- c("readonly") || (o.hasChanges = !0), o.changeSeq += 1;
124
+ o.hasChanges = !0, o.changeSeq += 1;
123
125
  },
124
- onEvent: U,
125
- onModuleAdd: V,
126
- notifications: q(),
126
+ onEvent: V,
127
+ onModuleAdd: I,
128
+ notifications: O(),
127
129
  // Stripo deselects the block on any click outside the canvas, so every surface
128
130
  // that belongs to the block's own flow has to be listed here (SD-153273).
129
131
  ignoreClickOutsideSelectors: [
@@ -133,26 +135,26 @@ const ve = (t) => {
133
135
  ".in-modal-v2-wrapper",
134
136
  ".in-toasts-wrapper"
135
137
  ],
136
- extensions: O,
137
- localePatch: Y
138
+ extensions: M,
139
+ localePatch: ee
138
140
  }
139
141
  );
140
142
  };
141
- return { initPlugin: async (n, a, i, s = !1) => {
142
- const e = T();
143
+ return { initPlugin: async (n, s, i, a = !1) => {
144
+ const e = A();
143
145
  try {
144
- t.mark("plugin_start"), t.setScriptPreloaded(F), await g(), t.mark("script_ready");
145
- const [u, o] = await Promise.all([
146
- R(),
147
- D()
146
+ t.mark("plugin_start"), t.setScriptPreloaded(P), await g(), t.mark("script_ready");
147
+ const [m, o] = await Promise.all([
148
+ D(),
149
+ U()
148
150
  ]);
149
- t.mark("fonts_sync_ready"), e.syncModulesEnabled = o, await x(n, a, i, u, o, s);
151
+ t.mark("fonts_sync_ready"), e.syncModulesEnabled = o, await H(n, s, i, m, o, a);
150
152
  } catch {
151
- e.loadingStatus = !1, A({
152
- type: Z.Error,
153
- message: B["An error has occurred. Please report the error code to support."],
153
+ e.loadingStatus = !1, L({
154
+ type: te.Error,
155
+ message: F["An error has occurred. Please report the error code to support."],
154
156
  actionButton: {
155
- text: B["Reload page"],
157
+ text: F["Reload page"],
156
158
  onClick: () => window.location.reload()
157
159
  }
158
160
  }), t.markFailed();
@@ -163,5 +165,5 @@ const ve = (t) => {
163
165
  } };
164
166
  };
165
167
  export {
166
- ve as useStripo
168
+ Pe as useStripo
167
169
  };
@@ -1,15 +1,23 @@
1
- import { COUPON_PLACEHOLDER_LIQUID as e, COUPON_PLACEHOLDER_DEFAULT as i } from "../../extensions/Blocks/CouponBlock/template.js";
2
- const o = [
1
+ import { COUPON_PLACEHOLDER_LIQUID as i, COUPON_PLACEHOLDER_DEFAULT as o } from "../../extensions/Blocks/CouponBlock/template.js";
2
+ import { singleQuoteLiquidLinks as r } from "../../utils/liquidLinkQuotes.js";
3
+ const s = [
3
4
  {
4
5
  id: "liquid-coupon-code",
5
6
  description: "Replace legacy coupon placeholder with liquid syntax",
6
7
  type: "replace",
7
- search: i,
8
- replacement: e,
8
+ search: o,
9
+ replacement: i,
9
10
  replaceAll: !0,
10
11
  priority: 50
12
+ },
13
+ {
14
+ id: "liquid-single-quote-links",
15
+ description: "Replace " string literals with single quotes inside {{ }} tags of href and src values",
16
+ type: "custom",
17
+ processor: (e) => r(e),
18
+ priority: 60
11
19
  }
12
20
  ];
13
21
  export {
14
- o as liquidCompilerRules
22
+ s as liquidCompilerRules
15
23
  };