@useinsider/guido 3.27.1-beta.ee576ab → 3.28.0-beta.fdbde3f
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 +10 -5
- package/dist/components/Guido.vue.js +7 -7
- package/dist/components/Guido.vue2.js +86 -83
- package/dist/components/organisms/dynamic-content/AmbiguousDynamicContentModal.vue.js +24 -0
- package/dist/components/organisms/dynamic-content/AmbiguousDynamicContentModal.vue2.js +59 -0
- package/dist/composables/useAmbiguousDynamicContent.js +72 -0
- package/dist/composables/useHtmlCompiler.js +16 -15
- package/dist/composables/useModuleRepair.js +63 -32
- package/dist/composables/useStripo.js +44 -43
- package/dist/config/compiler/htmlCompilerRules.js +16 -6
- package/dist/config/migrator/itemsBlockMigrator.js +220 -178
- package/dist/enums/dynamic-content.js +4 -0
- package/dist/guido.css +1 -1
- package/dist/package.json.js +4 -4
- package/dist/src/@types/generic.d.ts +7 -0
- package/dist/src/components/organisms/dynamic-content/AmbiguousDynamicContentModal.vue.d.ts +2 -0
- package/dist/src/composables/useAmbiguousDynamicContent.d.ts +7 -0
- package/dist/src/composables/useModuleRepair.d.ts +6 -0
- package/dist/src/enums/dynamic-content.d.ts +3 -0
- package/dist/src/stores/module-dynamic-content.d.ts +30 -0
- package/dist/src/utils/dynamicContentConverter.d.ts +20 -18
- package/dist/src/utils/dynamicContentPendingMarker.d.ts +2 -0
- package/dist/src/utils/genericUtil.d.ts +4 -8
- package/dist/stores/module-dynamic-content.js +20 -0
- package/dist/utils/dynamicContentConverter.js +41 -27
- package/dist/utils/dynamicContentPendingMarker.js +6 -0
- package/dist/utils/genericUtil.js +39 -39
- package/dist/utils/templatePreparation.js +9 -9
- package/package.json +1 -1
|
@@ -1,44 +1,75 @@
|
|
|
1
|
-
import { useConfig as
|
|
2
|
-
import { useToaster as
|
|
3
|
-
import { useTranslations as
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
1
|
+
import { useConfig as h } from "./useConfig.js";
|
|
2
|
+
import { useToaster as v } from "./useToaster.js";
|
|
3
|
+
import { useTranslations as M } from "./useTranslations.js";
|
|
4
|
+
import { ModuleDynamicContentAttribute as T } from "../enums/dynamic-content.js";
|
|
5
|
+
import { ToasterTypeOptions as A } from "../enums/toaster.js";
|
|
6
|
+
import { itemsBlockDynamicVariables as O } from "../extensions/Blocks/Items/enums/productEnums.js";
|
|
7
|
+
import { useDynamicContentStore as E } from "../stores/dynamic-content.js";
|
|
8
|
+
import { useEditorStore as L } from "../stores/editor.js";
|
|
9
|
+
import { useModuleDynamicContentStore as U } from "../stores/module-dynamic-content.js";
|
|
10
|
+
import { buildDynamicContentLookup as _, convertModuleDynamicContent as F } from "../utils/dynamicContentConverter.js";
|
|
11
|
+
import { stripPendingMarker as P } from "../utils/dynamicContentPendingMarker.js";
|
|
12
|
+
import { flattenDynamicContentCandidates as S } from "../utils/genericUtil.js";
|
|
13
|
+
import { repairItemsCurrencyAttributes as N } from "../utils/itemsCurrencyRepair.js";
|
|
14
|
+
import { convertLegacyUnsubscribeInModuleHtml as R } from "../utils/legacyUnsubscribeConversion.js";
|
|
15
|
+
import { extractUsedDynamicContent as k } from "../utils/registerUsedDynamicContent.js";
|
|
16
|
+
const q = "dynamic-content.unresolved-attributes-on-drop", H = /^(\s*<[a-zA-Z][a-zA-Z0-9-]*)/;
|
|
17
|
+
let y = 0;
|
|
18
|
+
const $ = (s) => {
|
|
19
|
+
y += 1;
|
|
20
|
+
const o = `${Date.now().toString(36)}-${y}`;
|
|
21
|
+
return { html: s.replace(H, `$1 ${T.Pending}="${o}"`), id: o };
|
|
22
|
+
}, I = (s, o) => {
|
|
23
|
+
try {
|
|
24
|
+
const i = k(s, o.map(({ text: a, value: m }) => ({ text: a, value: m })));
|
|
25
|
+
i.length > 0 && E().registerDynamicContent(i);
|
|
26
|
+
} catch (i) {
|
|
27
|
+
console.error("Failed to register module dynamic content:", i);
|
|
28
|
+
}
|
|
29
|
+
}, re = () => {
|
|
30
|
+
const { template: s, isFeatureEnabled: o } = h(), { showToaster: i } = v(), a = M(), m = (r) => {
|
|
31
|
+
var u, e;
|
|
32
|
+
const t = o("liquidSyntax") ? [] : S((u = s.value) == null ? void 0 : u.dynamicContentList), c = _(t);
|
|
33
|
+
return c.size === 0 ? { html: r, unresolved: [], ambiguous: [], candidates: t } : {
|
|
34
|
+
...F(
|
|
35
|
+
r,
|
|
36
|
+
c,
|
|
37
|
+
[...((e = s.value) == null ? void 0 : e.customFieldAttributes) ?? [], ...O]
|
|
38
|
+
),
|
|
39
|
+
candidates: t
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
return { handleModuleAdd: (r, t) => {
|
|
43
|
+
var c, u;
|
|
14
44
|
try {
|
|
15
|
-
if ((
|
|
45
|
+
if ((r == null ? void 0 : r.action) !== "ADD" && (r == null ? void 0 : r.action) !== "COPY")
|
|
16
46
|
return;
|
|
17
|
-
const e = (c =
|
|
18
|
-
if (!e || typeof
|
|
47
|
+
const e = (c = t == null ? void 0 : t.getTargetNode) == null ? void 0 : c.call(t), l = (u = e == null ? void 0 : e.getOuterHTML) == null ? void 0 : u.call(e);
|
|
48
|
+
if (!e || typeof l != "string")
|
|
19
49
|
return;
|
|
20
|
-
let
|
|
21
|
-
convertToPriceFormat:
|
|
22
|
-
}),
|
|
23
|
-
|
|
24
|
-
const
|
|
25
|
-
let
|
|
26
|
-
if (
|
|
50
|
+
let n = P(N(l, {
|
|
51
|
+
convertToPriceFormat: o("itemsPriceFormatting")
|
|
52
|
+
})), p = !1;
|
|
53
|
+
o("legacyUnsubscribeConversion") && ({ html: n, converted: p } = R(n));
|
|
54
|
+
const { html: f, unresolved: b, ambiguous: g, candidates: C } = m(n);
|
|
55
|
+
let d = null;
|
|
56
|
+
if (n = f, g.length > 0 && ({ html: n, id: d } = $(n)), n !== l && t.modifyHtml(e).replaceWith(n), I(n, C), p)
|
|
27
57
|
try {
|
|
28
|
-
|
|
29
|
-
} catch (
|
|
30
|
-
console.error("Failed to request the legacy unsubscribe modal:",
|
|
58
|
+
L().isLegacyUnsubscribeModalRequested = !0;
|
|
59
|
+
} catch (D) {
|
|
60
|
+
console.error("Failed to request the legacy unsubscribe modal:", D);
|
|
31
61
|
}
|
|
32
|
-
|
|
33
|
-
type:
|
|
34
|
-
message:
|
|
62
|
+
d && U().enqueue({ id: d, items: g }), b.length > 0 && i({
|
|
63
|
+
type: A.Warning,
|
|
64
|
+
message: a(q)
|
|
35
65
|
});
|
|
36
66
|
} catch (e) {
|
|
37
67
|
console.error("Failed to repair module on add:", e);
|
|
38
68
|
}
|
|
39
|
-
} };
|
|
69
|
+
}, convertDynamicContent: m };
|
|
40
70
|
};
|
|
41
71
|
export {
|
|
42
|
-
|
|
43
|
-
|
|
72
|
+
q as UNRESOLVED_DYNAMIC_CONTENT_ON_DROP_KEY,
|
|
73
|
+
I as registerUsedAttributes,
|
|
74
|
+
re as useModuleRepair
|
|
44
75
|
};
|
|
@@ -1,51 +1,52 @@
|
|
|
1
|
-
import { useActionsApi as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
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";
|
|
4
5
|
import { useCustomInterfaceAppearance as v } from "./useCustomInterfaceAppearance.js";
|
|
5
|
-
import { useFullStoryBridge as
|
|
6
|
-
import { useModuleRepair as
|
|
7
|
-
import { useStripoEventHandler as
|
|
8
|
-
import { useStripoNotifications as
|
|
9
|
-
import { useToaster as
|
|
10
|
-
import { localePatch as
|
|
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";
|
|
11
12
|
import { en as B } from "../config/i18n/en/index.js";
|
|
12
|
-
import { ToasterTypeOptions as
|
|
13
|
-
import { useStripoApi as
|
|
14
|
-
import
|
|
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";
|
|
15
16
|
import { useEditorStore as T } from "../stores/editor.js";
|
|
16
|
-
import { buildMergeTagEntries as
|
|
17
|
-
import { getStripoRuntimeBaseUrl as
|
|
17
|
+
import { buildMergeTagEntries as oe, flattenDynamicContentList as re } from "../utils/genericUtil.js";
|
|
18
|
+
import { getStripoRuntimeBaseUrl as ie } from "../utils/stripoRuntime.js";
|
|
18
19
|
let d = null, F = !1;
|
|
19
|
-
const
|
|
20
|
-
const { features: u, template: m, isFeatureEnabled: p } =
|
|
20
|
+
const ve = (t) => {
|
|
21
|
+
const { features: u, template: m, isFeatureEnabled: p } = 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, s) => {
|
|
21
22
|
if (document.getElementById("UiEditorScript")) {
|
|
22
23
|
n();
|
|
23
24
|
return;
|
|
24
25
|
}
|
|
25
|
-
const i =
|
|
26
|
+
const i = ie();
|
|
26
27
|
if (!i) {
|
|
27
|
-
|
|
28
|
+
s(
|
|
28
29
|
new Error("guido.stripo.version is not set in package.json. Please configure the Stripo version.")
|
|
29
30
|
);
|
|
30
31
|
return;
|
|
31
32
|
}
|
|
32
|
-
const
|
|
33
|
-
e.id = "UiEditorScript", e.type = "module", e.src =
|
|
33
|
+
const a = `${i}UIEditor.js`, e = document.createElement("script");
|
|
34
|
+
e.id = "UiEditorScript", e.type = "module", e.src = a, e.onload = () => {
|
|
34
35
|
F = !0, n();
|
|
35
36
|
}, e.onerror = () => {
|
|
36
|
-
e.remove(),
|
|
37
|
+
e.remove(), s(new Error(`Failed to load Stripo UIEditor script from S3: ${a}`));
|
|
37
38
|
}, document.body.appendChild(e);
|
|
38
39
|
}), d.catch(() => {
|
|
39
40
|
d = null;
|
|
40
|
-
}), d),
|
|
41
|
+
}), d), x = async (n, s, i, a = [], e = !1, c = !1) => {
|
|
41
42
|
var w, k, b, _;
|
|
42
|
-
const o = T(), { html: S, css: y } = n, { baseBlocks: E, extensions:
|
|
43
|
+
const o = T(), { html: S, css: y } = n, { baseBlocks: E, extensions: O } = await L();
|
|
43
44
|
t.mark("blocks_config_ready");
|
|
44
|
-
const h = ((w = u.value) == null ? void 0 : w.displayConditions) ?? !0,
|
|
45
|
+
const h = ((w = u.value) == null ? void 0 : w.displayConditions) ?? !0, H = ((k = u.value) == null ? void 0 : k.modulesDisabled) ?? !1, C = c || (((b = m.value) == null ? void 0 : b.forceRecreate) ?? !1), M = "https://email-static.useinsider.com https://edge.fullstory.com https://rs.fullstory.com";
|
|
45
46
|
t.setTemplate({ html: S, css: y, forceRecreate: C }), v().importCss(), t.mark("init_editor"), await window.UIEditor.initEditor(
|
|
46
47
|
document.querySelector("#guido-editor"),
|
|
47
48
|
{
|
|
48
|
-
metadata:
|
|
49
|
+
metadata: s,
|
|
49
50
|
html: S,
|
|
50
51
|
css: y,
|
|
51
52
|
forceRecreate: C,
|
|
@@ -58,11 +59,11 @@ const ke = (t) => {
|
|
|
58
59
|
customAppearanceMergetags: !p("liquidSyntax"),
|
|
59
60
|
customAppearanceMergetagsBorderColor: "#f1f3fe",
|
|
60
61
|
customAppearanceMergetagsBackgroundColor: "#f1f3fe",
|
|
61
|
-
customViewStyles:
|
|
62
|
+
customViewStyles: te,
|
|
62
63
|
conditionsEnabled: h,
|
|
63
64
|
customConditionsEnabled: h,
|
|
64
65
|
enableXSSSecurity: !0,
|
|
65
|
-
modulesDisabled:
|
|
66
|
+
modulesDisabled: H,
|
|
66
67
|
syncModulesEnabled: e,
|
|
67
68
|
messageSettingsEnabled: !0,
|
|
68
69
|
displayGmailAnnotations: !0,
|
|
@@ -73,18 +74,18 @@ const ke = (t) => {
|
|
|
73
74
|
copyPasteEnabled: !1,
|
|
74
75
|
selectElementAfterDrop: !0,
|
|
75
76
|
sameFontSizeForOutlook: !0,
|
|
76
|
-
allowedScriptSourceDomains:
|
|
77
|
+
allowedScriptSourceDomains: M,
|
|
77
78
|
...E ? { baseBlocks: E } : {},
|
|
78
79
|
editorFonts: {
|
|
79
80
|
showDefaultStandardFonts: !0,
|
|
80
81
|
showDefaultNotStandardFonts: !0,
|
|
81
|
-
customFonts:
|
|
82
|
+
customFonts: a
|
|
82
83
|
},
|
|
83
84
|
mergeTags: [
|
|
84
85
|
{
|
|
85
|
-
entries:
|
|
86
|
+
entries: oe(
|
|
86
87
|
i.preselectedDynamicContentList,
|
|
87
|
-
|
|
88
|
+
re((_ = m.value) == null ? void 0 : _.dynamicContentList),
|
|
88
89
|
p("liquidSyntax")
|
|
89
90
|
)
|
|
90
91
|
}
|
|
@@ -100,8 +101,8 @@ const ke = (t) => {
|
|
|
100
101
|
},
|
|
101
102
|
onTemplateLoaded() {
|
|
102
103
|
try {
|
|
103
|
-
const { activateCustomViewStyles: r, updateTimerInClonedTemplate: l } =
|
|
104
|
-
v().importCss(), r(),
|
|
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(() => {
|
|
105
106
|
o.hasChanges = !1;
|
|
106
107
|
}, 1e3), t.markReady();
|
|
107
108
|
} catch (r) {
|
|
@@ -120,9 +121,9 @@ const ke = (t) => {
|
|
|
120
121
|
onDataChanged() {
|
|
121
122
|
o.hasChanges = !0, o.changeSeq += 1;
|
|
122
123
|
},
|
|
123
|
-
onEvent:
|
|
124
|
-
onModuleAdd:
|
|
125
|
-
notifications:
|
|
124
|
+
onEvent: U,
|
|
125
|
+
onModuleAdd: V,
|
|
126
|
+
notifications: q(),
|
|
126
127
|
// Stripo deselects the block on any click outside the canvas, so every surface
|
|
127
128
|
// that belongs to the block's own flow has to be listed here (SD-153273).
|
|
128
129
|
ignoreClickOutsideSelectors: [
|
|
@@ -132,23 +133,23 @@ const ke = (t) => {
|
|
|
132
133
|
".in-modal-v2-wrapper",
|
|
133
134
|
".in-toasts-wrapper"
|
|
134
135
|
],
|
|
135
|
-
extensions:
|
|
136
|
-
localePatch:
|
|
136
|
+
extensions: O,
|
|
137
|
+
localePatch: Y
|
|
137
138
|
}
|
|
138
139
|
);
|
|
139
140
|
};
|
|
140
|
-
return { initPlugin: async (n,
|
|
141
|
+
return { initPlugin: async (n, s, i, a = !1) => {
|
|
141
142
|
const e = T();
|
|
142
143
|
try {
|
|
143
144
|
t.mark("plugin_start"), t.setScriptPreloaded(F), await g(), t.mark("script_ready");
|
|
144
145
|
const [c, o] = await Promise.all([
|
|
145
146
|
R(),
|
|
146
|
-
|
|
147
|
+
D()
|
|
147
148
|
]);
|
|
148
|
-
t.mark("fonts_sync_ready"), e.syncModulesEnabled = o, await
|
|
149
|
+
t.mark("fonts_sync_ready"), e.syncModulesEnabled = o, await x(n, s, i, c, o, a);
|
|
149
150
|
} catch {
|
|
150
151
|
e.loadingStatus = !1, A({
|
|
151
|
-
type:
|
|
152
|
+
type: Z.Error,
|
|
152
153
|
message: B["An error has occurred. Please report the error code to support."],
|
|
153
154
|
actionButton: {
|
|
154
155
|
text: B["Reload page"],
|
|
@@ -162,5 +163,5 @@ const ke = (t) => {
|
|
|
162
163
|
} };
|
|
163
164
|
};
|
|
164
165
|
export {
|
|
165
|
-
|
|
166
|
+
ve as useStripo
|
|
166
167
|
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
1
|
+
import { PENDING_MARKER_PATTERN as c } from "../../utils/dynamicContentPendingMarker.js";
|
|
2
|
+
import { stripFontTags as l } from "../../utils/stripFontTags.js";
|
|
3
|
+
import { trimHrefWhitespace as d } from "../../utils/trimHrefWhitespace.js";
|
|
4
|
+
const y = [
|
|
4
5
|
{
|
|
5
6
|
id: "fix-url-encoding-start",
|
|
6
7
|
description: "Replace {%22 with %7B%22 to fix URL encoding",
|
|
@@ -59,14 +60,14 @@ const f = [
|
|
|
59
60
|
id: "strip-font-tags",
|
|
60
61
|
description: 'Unwrap browser-translate-injected <font dir="auto"> tags, keeping inner content; other <font> elements are left intact.',
|
|
61
62
|
type: "custom",
|
|
62
|
-
processor: (e) =>
|
|
63
|
+
processor: (e) => l(e),
|
|
63
64
|
priority: 15
|
|
64
65
|
},
|
|
65
66
|
{
|
|
66
67
|
id: "trim-href-whitespace",
|
|
67
68
|
description: "Trim leading/trailing whitespace and from every href value",
|
|
68
69
|
type: "custom",
|
|
69
|
-
processor: (e) =>
|
|
70
|
+
processor: (e) => d(e),
|
|
70
71
|
priority: 16
|
|
71
72
|
},
|
|
72
73
|
{
|
|
@@ -183,6 +184,15 @@ const f = [
|
|
|
183
184
|
flags: "g",
|
|
184
185
|
priority: 45
|
|
185
186
|
},
|
|
187
|
+
{
|
|
188
|
+
id: "remove-dc-pending-marker",
|
|
189
|
+
description: "Strip the editor-only pending dynamic-content choice marker from compiled output",
|
|
190
|
+
type: "regex",
|
|
191
|
+
pattern: c,
|
|
192
|
+
replacement: "",
|
|
193
|
+
flags: "g",
|
|
194
|
+
priority: 46
|
|
195
|
+
},
|
|
186
196
|
{
|
|
187
197
|
id: "remove-script-tags",
|
|
188
198
|
// SD-145051: parity with HB HtmlCleaner.removeUnsafeHtmlTags — strip <script> from
|
|
@@ -208,5 +218,5 @@ const f = [
|
|
|
208
218
|
}
|
|
209
219
|
];
|
|
210
220
|
export {
|
|
211
|
-
|
|
221
|
+
y as defaultHtmlCompilerRules
|
|
212
222
|
};
|