@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.
- package/README.md +17 -1
- package/dist/@types/config/schemas.js +17 -17
- package/dist/components/Guido.vue.js +1 -1
- package/dist/components/Guido.vue2.js +26 -25
- package/dist/components/organisms/header/EditorActions.vue.js +2 -2
- package/dist/composables/useHtmlCompiler.js +15 -13
- package/dist/composables/useSave.js +51 -51
- package/dist/composables/useStripo.js +67 -65
- package/dist/config/compiler/liquidCompilerRules.js +13 -5
- package/dist/config/migrator/itemsBlockMigrator.js +164 -161
- package/dist/extensions/DynamicContent/dynamic-content.js +56 -33
- package/dist/guido.css +1 -1
- package/dist/package.json.js +1 -1
- package/dist/src/@types/config/schemas.d.ts +4 -4
- package/dist/src/@types/generic.d.ts +10 -0
- package/dist/src/composables/useConfig.d.ts +2 -2
- package/dist/src/extensions/DynamicContent/dynamic-content.d.ts +11 -0
- package/dist/src/stores/config.d.ts +21 -21
- package/dist/src/utils/clipboardText.d.ts +1 -0
- package/dist/src/utils/genericUtil.d.ts +6 -1
- package/dist/src/utils/linkTokenPaste.d.ts +3 -0
- package/dist/src/utils/liquidLinkQuotes.d.ts +4 -0
- package/dist/utils/clipboardText.js +31 -0
- package/dist/utils/genericUtil.js +55 -45
- package/dist/utils/linkTokenPaste.js +28 -0
- package/dist/utils/liquidLinkQuotes.js +10 -0
- package/dist/utils/pairProductVariables.js +98 -108
- package/package.json +1 -1
|
@@ -1,55 +1,56 @@
|
|
|
1
|
-
import { useActionsApi as
|
|
2
|
-
import { useAmbiguousDynamicContent as
|
|
3
|
-
import { useBlocksConfig as
|
|
4
|
-
import { useConfig as
|
|
5
|
-
import { useCustomInterfaceAppearance as
|
|
6
|
-
import { useFullStoryBridge as
|
|
7
|
-
import { useModuleRepair as
|
|
8
|
-
import { useStripoEventHandler as
|
|
9
|
-
import { useStripoNotifications as
|
|
10
|
-
import { useToaster as
|
|
11
|
-
import { localePatch as
|
|
12
|
-
import { en as
|
|
13
|
-
import { ToasterTypeOptions as
|
|
14
|
-
import { useStripoApi as
|
|
15
|
-
import
|
|
16
|
-
import { useEditorStore as
|
|
17
|
-
import { buildMergeTagEntries as
|
|
18
|
-
import {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
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 =
|
|
27
|
+
const i = de();
|
|
27
28
|
if (!i) {
|
|
28
|
-
|
|
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
|
|
34
|
-
e.id = "UiEditorScript", e.type = "module", e.src =
|
|
35
|
-
|
|
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(),
|
|
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),
|
|
42
|
-
var w,
|
|
43
|
-
const o =
|
|
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
|
|
46
|
-
t.setTemplate({ html:
|
|
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:
|
|
50
|
-
html:
|
|
51
|
-
css:
|
|
52
|
-
forceRecreate:
|
|
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
|
-
|
|
63
|
-
|
|
64
|
-
|
|
63
|
+
...h.length > 0 ? { specialLinks: h } : {},
|
|
64
|
+
customViewStyles: re,
|
|
65
|
+
conditionsEnabled: C,
|
|
66
|
+
customConditionsEnabled: C,
|
|
65
67
|
enableXSSSecurity: !0,
|
|
66
|
-
modulesDisabled:
|
|
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:
|
|
79
|
+
allowedScriptSourceDomains: j,
|
|
78
80
|
...E ? { baseBlocks: E } : {},
|
|
79
81
|
editorFonts: {
|
|
80
82
|
showDefaultStandardFonts: !0,
|
|
81
83
|
showDefaultNotStandardFonts: !0,
|
|
82
|
-
customFonts:
|
|
84
|
+
customFonts: a
|
|
83
85
|
},
|
|
84
86
|
mergeTags: [
|
|
85
87
|
{
|
|
86
|
-
entries:
|
|
88
|
+
entries: ne(
|
|
87
89
|
i.preselectedDynamicContentList,
|
|
88
|
-
|
|
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
|
|
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 } =
|
|
105
|
-
|
|
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
|
-
|
|
124
|
+
o.hasChanges = !0, o.changeSeq += 1;
|
|
123
125
|
},
|
|
124
|
-
onEvent:
|
|
125
|
-
onModuleAdd:
|
|
126
|
-
notifications:
|
|
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:
|
|
137
|
-
localePatch:
|
|
138
|
+
extensions: M,
|
|
139
|
+
localePatch: ee
|
|
138
140
|
}
|
|
139
141
|
);
|
|
140
142
|
};
|
|
141
|
-
return { initPlugin: async (n,
|
|
142
|
-
const e =
|
|
143
|
+
return { initPlugin: async (n, s, i, a = !1) => {
|
|
144
|
+
const e = A();
|
|
143
145
|
try {
|
|
144
|
-
t.mark("plugin_start"), t.setScriptPreloaded(
|
|
145
|
-
const [
|
|
146
|
-
|
|
147
|
-
|
|
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
|
|
151
|
+
t.mark("fonts_sync_ready"), e.syncModulesEnabled = o, await H(n, s, i, m, o, a);
|
|
150
152
|
} catch {
|
|
151
|
-
e.loadingStatus = !1,
|
|
152
|
-
type:
|
|
153
|
-
message:
|
|
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:
|
|
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
|
-
|
|
168
|
+
Pe as useStripo
|
|
167
169
|
};
|
|
@@ -1,15 +1,23 @@
|
|
|
1
|
-
import { COUPON_PLACEHOLDER_LIQUID as
|
|
2
|
-
|
|
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:
|
|
8
|
-
replacement:
|
|
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
|
-
|
|
22
|
+
s as liquidCompilerRules
|
|
15
23
|
};
|