@useinsider/guido 3.30.0-beta.23d415d → 3.30.0-beta.2d741af
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 +12 -18
- package/dist/@types/config/schemas.js +5 -7
- package/dist/components/Guido.vue.js +5 -5
- package/dist/components/Guido.vue2.js +110 -105
- package/dist/components/organisms/unsubscribe/SfmcUnsubscribeConvertedModal.vue.js +17 -0
- package/dist/components/organisms/unsubscribe/SfmcUnsubscribeConvertedModal.vue2.js +30 -0
- package/dist/composables/useHtmlCompiler.js +13 -15
- package/dist/composables/useModuleRepair.js +56 -50
- package/dist/composables/useStripo.js +85 -79
- package/dist/config/compiler/liquidCompilerRules.js +5 -13
- package/dist/config/migrator/index.js +10 -9
- package/dist/config/migrator/sfmcUnsubscribeTextMigrator.js +20 -0
- package/dist/enums/academy.js +2 -1
- package/dist/extensions/DynamicContent/dynamic-content.js +33 -56
- package/dist/guido.css +1 -1
- package/dist/package.json.js +1 -1
- package/dist/src/@types/config/schemas.d.ts +0 -4
- package/dist/src/@types/generic.d.ts +0 -10
- package/dist/src/components/organisms/unsubscribe/SfmcUnsubscribeConvertedModal.vue.d.ts +2 -0
- package/dist/src/composables/useConfig.d.ts +0 -2
- package/dist/src/composables/useModuleRepair.d.ts +1 -1
- package/dist/src/config/migrator/sfmcUnsubscribeTextMigrator.d.ts +1 -0
- package/dist/src/enums/academy.d.ts +1 -0
- package/dist/src/extensions/DynamicContent/dynamic-content.d.ts +0 -11
- package/dist/src/stores/config.d.ts +0 -21
- package/dist/src/stores/editor.d.ts +54 -0
- package/dist/src/utils/genericUtil.d.ts +1 -6
- package/dist/src/utils/legacyUnsubscribeConversion.d.ts +3 -0
- package/dist/stores/editor.js +2 -0
- package/dist/utils/genericUtil.js +45 -55
- package/dist/utils/legacyUnsubscribeConversion.js +69 -28
- package/package.json +1 -1
- package/dist/src/utils/clipboardText.d.ts +0 -1
- package/dist/src/utils/linkTokenPaste.d.ts +0 -3
- package/dist/src/utils/liquidLinkQuotes.d.ts +0 -4
- package/dist/utils/clipboardText.js +0 -31
- package/dist/utils/linkTokenPaste.js +0 -28
- package/dist/utils/liquidLinkQuotes.js +0 -10
|
@@ -1,75 +1,81 @@
|
|
|
1
|
-
import { useConfig as
|
|
2
|
-
import { useToaster as
|
|
3
|
-
import { useTranslations as
|
|
4
|
-
import { ModuleDynamicContentAttribute as
|
|
5
|
-
import { ToasterTypeOptions as
|
|
6
|
-
import { itemsBlockDynamicVariables as
|
|
1
|
+
import { useConfig as M } from "./useConfig.js";
|
|
2
|
+
import { useToaster as A } from "./useToaster.js";
|
|
3
|
+
import { useTranslations as T } from "./useTranslations.js";
|
|
4
|
+
import { ModuleDynamicContentAttribute as U } from "../enums/dynamic-content.js";
|
|
5
|
+
import { ToasterTypeOptions as O } from "../enums/toaster.js";
|
|
6
|
+
import { itemsBlockDynamicVariables as S } from "../extensions/Blocks/Items/enums/productEnums.js";
|
|
7
7
|
import { useDynamicContentStore as E } from "../stores/dynamic-content.js";
|
|
8
|
-
import { useEditorStore as
|
|
9
|
-
import { useModuleDynamicContentStore as
|
|
10
|
-
import { buildDynamicContentLookup as
|
|
11
|
-
import { stripPendingMarker as
|
|
12
|
-
import { flattenDynamicContentCandidates as
|
|
13
|
-
import { repairItemsCurrencyAttributes as
|
|
14
|
-
import {
|
|
15
|
-
import { extractUsedDynamicContent as
|
|
16
|
-
const
|
|
17
|
-
let
|
|
18
|
-
const
|
|
19
|
-
|
|
20
|
-
const
|
|
21
|
-
return { html: s.replace(
|
|
22
|
-
},
|
|
8
|
+
import { useEditorStore as f } from "../stores/editor.js";
|
|
9
|
+
import { useModuleDynamicContentStore as F } from "../stores/module-dynamic-content.js";
|
|
10
|
+
import { buildDynamicContentLookup as L, convertModuleDynamicContent as _ } from "../utils/dynamicContentConverter.js";
|
|
11
|
+
import { stripPendingMarker as k } from "../utils/dynamicContentPendingMarker.js";
|
|
12
|
+
import { flattenDynamicContentCandidates as q } from "../utils/genericUtil.js";
|
|
13
|
+
import { repairItemsCurrencyAttributes as P } from "../utils/itemsCurrencyRepair.js";
|
|
14
|
+
import { convertAllUnsubscribeInModuleHtml as R, convertLegacyUnsubscribeInModuleHtml as H } from "../utils/legacyUnsubscribeConversion.js";
|
|
15
|
+
import { extractUsedDynamicContent as N } from "../utils/registerUsedDynamicContent.js";
|
|
16
|
+
const I = "dynamic-content.unresolved-attributes-on-drop", $ = /^(\s*<[a-zA-Z][a-zA-Z0-9-]*)/;
|
|
17
|
+
let C = 0;
|
|
18
|
+
const x = (s) => {
|
|
19
|
+
C += 1;
|
|
20
|
+
const n = `${Date.now().toString(36)}-${C}`;
|
|
21
|
+
return { html: s.replace($, `$1 ${U.Pending}="${n}"`), id: n };
|
|
22
|
+
}, z = (s, n) => {
|
|
23
23
|
try {
|
|
24
|
-
const i =
|
|
24
|
+
const i = N(s, n.map(({ text: m, value: l }) => ({ text: m, value: l })));
|
|
25
25
|
i.length > 0 && E().registerDynamicContent(i);
|
|
26
26
|
} catch (i) {
|
|
27
27
|
console.error("Failed to register module dynamic content:", i);
|
|
28
28
|
}
|
|
29
|
-
},
|
|
30
|
-
const { template: s, isFeatureEnabled:
|
|
29
|
+
}, oe = () => {
|
|
30
|
+
const { template: s, isFeatureEnabled: n } = M(), { showToaster: i } = A(), m = T(), l = (o) => {
|
|
31
31
|
var u, e;
|
|
32
|
-
const
|
|
33
|
-
return c.size === 0 ? { html:
|
|
34
|
-
...
|
|
35
|
-
|
|
32
|
+
const r = n("liquidSyntax") ? [] : q((u = s.value) == null ? void 0 : u.dynamicContentList), c = L(r);
|
|
33
|
+
return c.size === 0 ? { html: o, unresolved: [], ambiguous: [], candidates: r } : {
|
|
34
|
+
..._(
|
|
35
|
+
o,
|
|
36
36
|
c,
|
|
37
|
-
[...((e = s.value) == null ? void 0 : e.customFieldAttributes) ?? [], ...
|
|
37
|
+
[...((e = s.value) == null ? void 0 : e.customFieldAttributes) ?? [], ...S]
|
|
38
38
|
),
|
|
39
|
-
candidates:
|
|
39
|
+
candidates: r
|
|
40
40
|
};
|
|
41
41
|
};
|
|
42
|
-
return { handleModuleAdd: (
|
|
42
|
+
return { handleModuleAdd: (o, r) => {
|
|
43
43
|
var c, u;
|
|
44
44
|
try {
|
|
45
|
-
if ((
|
|
45
|
+
if ((o == null ? void 0 : o.action) !== "ADD" && (o == null ? void 0 : o.action) !== "COPY")
|
|
46
46
|
return;
|
|
47
|
-
const e = (c =
|
|
48
|
-
if (!e || typeof
|
|
47
|
+
const e = (c = r == null ? void 0 : r.getTargetNode) == null ? void 0 : c.call(r), a = (u = e == null ? void 0 : e.getOuterHTML) == null ? void 0 : u.call(e);
|
|
48
|
+
if (!e || typeof a != "string")
|
|
49
49
|
return;
|
|
50
|
-
let
|
|
51
|
-
convertToPriceFormat:
|
|
52
|
-
})),
|
|
53
|
-
|
|
54
|
-
const { html:
|
|
50
|
+
let t = k(P(a, {
|
|
51
|
+
convertToPriceFormat: n("itemsPriceFormatting")
|
|
52
|
+
})), b = !1, y = !1;
|
|
53
|
+
n("blockUnsubscribeLinks") ? { html: t, converted: y } = R(t) : n("legacyUnsubscribeConversion") && ({ html: t, converted: b } = H(t));
|
|
54
|
+
const { html: D, unresolved: v, ambiguous: g, candidates: h } = l(t);
|
|
55
55
|
let d = null;
|
|
56
|
-
if (
|
|
56
|
+
if (t = D, g.length > 0 && ({ html: t, id: d } = x(t)), t !== a && r.modifyHtml(e).replaceWith(t), z(t, h), b)
|
|
57
57
|
try {
|
|
58
|
-
|
|
59
|
-
} catch (
|
|
60
|
-
console.error("Failed to request the legacy unsubscribe modal:",
|
|
58
|
+
f().isLegacyUnsubscribeModalRequested = !0;
|
|
59
|
+
} catch (p) {
|
|
60
|
+
console.error("Failed to request the legacy unsubscribe modal:", p);
|
|
61
61
|
}
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
62
|
+
if (y)
|
|
63
|
+
try {
|
|
64
|
+
f().isSfmcUnsubscribeModalRequested = !0;
|
|
65
|
+
} catch (p) {
|
|
66
|
+
console.error("Failed to request the SFMC unsubscribe modal:", p);
|
|
67
|
+
}
|
|
68
|
+
d && F().enqueue({ id: d, items: g }), v.length > 0 && i({
|
|
69
|
+
type: O.Warning,
|
|
70
|
+
message: m(I)
|
|
65
71
|
});
|
|
66
72
|
} catch (e) {
|
|
67
73
|
console.error("Failed to repair module on add:", e);
|
|
68
74
|
}
|
|
69
|
-
}, convertDynamicContent:
|
|
75
|
+
}, convertDynamicContent: l };
|
|
70
76
|
};
|
|
71
77
|
export {
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
78
|
+
I as UNRESOLVED_DYNAMIC_CONTENT_ON_DROP_KEY,
|
|
79
|
+
z as registerUsedAttributes,
|
|
80
|
+
oe as useModuleRepair
|
|
75
81
|
};
|
|
@@ -1,72 +1,70 @@
|
|
|
1
|
-
import { useActionsApi as
|
|
1
|
+
import { useActionsApi as z } from "./useActionsApi.js";
|
|
2
2
|
import { useAmbiguousDynamicContent as $ } from "./useAmbiguousDynamicContent.js";
|
|
3
|
-
import { useBlocksConfig as
|
|
4
|
-
import { useConfig as
|
|
3
|
+
import { useBlocksConfig as G } from "./useBlocksConfig.js";
|
|
4
|
+
import { useConfig as X } from "./useConfig.js";
|
|
5
5
|
import { useCustomInterfaceAppearance as B } from "./useCustomInterfaceAppearance.js";
|
|
6
|
-
import { useFullStoryBridge as
|
|
7
|
-
import { useModuleRepair as
|
|
8
|
-
import { useStripoEventHandler as
|
|
9
|
-
import { useStripoNotifications as
|
|
10
|
-
import { useToaster as
|
|
11
|
-
import { localePatch as
|
|
6
|
+
import { useFullStoryBridge as J } from "./useFullStoryBridge.js";
|
|
7
|
+
import { useModuleRepair as K } from "./useModuleRepair.js";
|
|
8
|
+
import { useStripoEventHandler as Q } from "./useStripoEventHandler.js";
|
|
9
|
+
import { useStripoNotifications as W } from "./useStripoNotifications.js";
|
|
10
|
+
import { useToaster as Y } from "./useToaster.js";
|
|
11
|
+
import { localePatch as Z } from "../config/i18n/index.js";
|
|
12
12
|
import { en as F } from "../config/i18n/en/index.js";
|
|
13
|
-
import { ToasterTypeOptions as
|
|
14
|
-
import { useStripoApi as
|
|
15
|
-
import
|
|
16
|
-
import { useEditorStore as
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
const
|
|
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) => {
|
|
13
|
+
import { ToasterTypeOptions as ee } from "../enums/toaster.js";
|
|
14
|
+
import { useStripoApi as te } from "../services/stripoApi.js";
|
|
15
|
+
import oe from "../static/styles/customEditorStyle.css.js";
|
|
16
|
+
import { useEditorStore as T } from "../stores/editor.js";
|
|
17
|
+
import { buildMergeTagEntries as re, flattenDynamicContentList as ie } from "../utils/genericUtil.js";
|
|
18
|
+
import { getStripoRuntimeBaseUrl as ne } from "../utils/stripoRuntime.js";
|
|
19
|
+
let d = null, A = !1;
|
|
20
|
+
const Be = (o) => {
|
|
21
|
+
const { features: m, template: p, isFeatureEnabled: f } = X(), { handleError: g, showToaster: P } = Y(), { getToken: U, getCustomFonts: R, getSyncModulesStatus: D } = te(), { handleEvent: V } = Q(), { handleModuleAdd: L } = K(), { restorePending: I } = $(), { getStripoBlocksConfig: O } = G(), { getStripoNotifications: q } = W(), S = () => d || (d = new Promise((n, a) => {
|
|
23
22
|
if (document.getElementById("UiEditorScript")) {
|
|
24
23
|
n();
|
|
25
24
|
return;
|
|
26
25
|
}
|
|
27
|
-
const i =
|
|
26
|
+
const i = ne();
|
|
28
27
|
if (!i) {
|
|
29
|
-
|
|
28
|
+
a(
|
|
30
29
|
new Error("guido.stripo.version is not set in package.json. Please configure the Stripo version.")
|
|
31
30
|
);
|
|
32
31
|
return;
|
|
33
32
|
}
|
|
34
|
-
const
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
},
|
|
38
|
-
|
|
39
|
-
}, document.body.appendChild(
|
|
33
|
+
const s = `${i}UIEditor.js`, t = document.createElement("script");
|
|
34
|
+
t.id = "UiEditorScript", t.type = "module", t.src = s, t.onload = () => {
|
|
35
|
+
A = !0, n();
|
|
36
|
+
}, t.onerror = () => {
|
|
37
|
+
t.remove(), a(new Error(`Failed to load Stripo UIEditor script from S3: ${s}`));
|
|
38
|
+
}, document.body.appendChild(t);
|
|
40
39
|
}), d.catch(() => {
|
|
41
40
|
d = null;
|
|
42
|
-
}), d),
|
|
43
|
-
var w,
|
|
44
|
-
const
|
|
45
|
-
|
|
46
|
-
const
|
|
47
|
-
|
|
41
|
+
}), d), x = async (n, a, i, s = [], t = !1, c = !1) => {
|
|
42
|
+
var w, k, _, v;
|
|
43
|
+
const e = T(), { html: y, css: h } = n, { baseBlocks: C, extensions: H } = await O();
|
|
44
|
+
o.mark("blocks_config_ready");
|
|
45
|
+
const E = ((w = m.value) == null ? void 0 : w.displayConditions) ?? !0, M = ((k = m.value) == null ? void 0 : k.modulesDisabled) ?? !1, b = c || (((_ = p.value) == null ? void 0 : _.forceRecreate) ?? !1), N = "https://email-static.useinsider.com https://edge.fullstory.com https://rs.fullstory.com";
|
|
46
|
+
o.setTemplate({ html: y, css: h, forceRecreate: b }), B().importCss(), o.mark("init_editor"), await window.UIEditor.initEditor(
|
|
48
47
|
document.querySelector("#guido-editor"),
|
|
49
48
|
{
|
|
50
|
-
metadata:
|
|
51
|
-
html:
|
|
52
|
-
css:
|
|
53
|
-
forceRecreate:
|
|
49
|
+
metadata: a,
|
|
50
|
+
html: y,
|
|
51
|
+
css: h,
|
|
52
|
+
forceRecreate: b,
|
|
54
53
|
locale: "en",
|
|
55
54
|
undoButtonSelector: "#guido__undo-button",
|
|
56
55
|
redoButtonSelector: "#guido__redo-button",
|
|
57
56
|
mobileViewButtonSelector: ".guido__view-option-selection-mobile",
|
|
58
57
|
desktopViewButtonSelector: ".guido__view-option-selection-desktop",
|
|
59
58
|
codeEditorButtonSelector: "#guido__code-button",
|
|
60
|
-
customAppearanceMergetags: !
|
|
59
|
+
customAppearanceMergetags: !f("liquidSyntax"),
|
|
61
60
|
customAppearanceMergetagsBorderColor: "#f1f3fe",
|
|
62
61
|
customAppearanceMergetagsBackgroundColor: "#f1f3fe",
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
customConditionsEnabled: C,
|
|
62
|
+
customViewStyles: oe,
|
|
63
|
+
conditionsEnabled: E,
|
|
64
|
+
customConditionsEnabled: E,
|
|
67
65
|
enableXSSSecurity: !0,
|
|
68
|
-
modulesDisabled:
|
|
69
|
-
syncModulesEnabled:
|
|
66
|
+
modulesDisabled: M,
|
|
67
|
+
syncModulesEnabled: t,
|
|
70
68
|
messageSettingsEnabled: !0,
|
|
71
69
|
displayGmailAnnotations: !0,
|
|
72
70
|
displayHiddenPreheader: !1,
|
|
@@ -76,56 +74,64 @@ const Pe = (t) => {
|
|
|
76
74
|
copyPasteEnabled: !1,
|
|
77
75
|
selectElementAfterDrop: !0,
|
|
78
76
|
sameFontSizeForOutlook: !0,
|
|
79
|
-
allowedScriptSourceDomains:
|
|
80
|
-
...
|
|
77
|
+
allowedScriptSourceDomains: N,
|
|
78
|
+
...C ? { baseBlocks: C } : {},
|
|
81
79
|
editorFonts: {
|
|
82
80
|
showDefaultStandardFonts: !0,
|
|
83
81
|
showDefaultNotStandardFonts: !0,
|
|
84
|
-
customFonts:
|
|
82
|
+
customFonts: s
|
|
85
83
|
},
|
|
86
84
|
mergeTags: [
|
|
87
85
|
{
|
|
88
|
-
entries:
|
|
86
|
+
entries: re(
|
|
89
87
|
i.preselectedDynamicContentList,
|
|
90
|
-
|
|
91
|
-
|
|
88
|
+
ie((v = p.value) == null ? void 0 : v.dynamicContentList),
|
|
89
|
+
f("liquidSyntax")
|
|
92
90
|
)
|
|
93
91
|
}
|
|
94
92
|
],
|
|
95
93
|
async onTokenRefreshRequest(r) {
|
|
96
94
|
try {
|
|
97
|
-
|
|
98
|
-
const l = await
|
|
99
|
-
|
|
95
|
+
o.mark("token_start");
|
|
96
|
+
const l = await U();
|
|
97
|
+
o.mark("token_end"), r(l);
|
|
100
98
|
} catch (l) {
|
|
101
|
-
|
|
99
|
+
g(l, "Failed to refresh token");
|
|
102
100
|
}
|
|
103
101
|
},
|
|
104
102
|
onTemplateLoaded() {
|
|
105
103
|
try {
|
|
106
|
-
const { activateCustomViewStyles: r, updateTimerInClonedTemplate: l } =
|
|
107
|
-
B().importCss(), r(),
|
|
108
|
-
|
|
109
|
-
|
|
104
|
+
const { activateCustomViewStyles: r, updateTimerInClonedTemplate: l } = z(), { injectFullStory: j } = J();
|
|
105
|
+
B().importCss(), r(), j(), I(), l(), i.onReady(), e.isStripoInitialized = !0, e.loadingStatus = !1, setTimeout(() => {
|
|
106
|
+
try {
|
|
107
|
+
if (e.isUnsubscribeConvertedOnLoad) {
|
|
108
|
+
const u = e.hasChanges;
|
|
109
|
+
e.hasChanges = !0, e.changeSeq += 1, e.isUnsubscribeConvertedOnLoad = !1, u && i.onLoadConversionSettled();
|
|
110
|
+
} else
|
|
111
|
+
e.hasChanges = !1;
|
|
112
|
+
} catch (u) {
|
|
113
|
+
console.error("Failed to settle the change state after template load:", u);
|
|
114
|
+
}
|
|
115
|
+
}, 1e3), o.markReady();
|
|
110
116
|
} catch (r) {
|
|
111
|
-
|
|
117
|
+
g(r, "Failed to load custom interface appearance");
|
|
112
118
|
}
|
|
113
119
|
},
|
|
114
120
|
onCodeEditorVisibilityChanged(r) {
|
|
115
|
-
|
|
121
|
+
e.isCodeEditorOpen = r;
|
|
116
122
|
},
|
|
117
123
|
onEditorVisualModeChanged(r) {
|
|
118
|
-
|
|
124
|
+
e.editorVisualMode = r.toLowerCase();
|
|
119
125
|
},
|
|
120
126
|
onVersionHistoryVisibilityChanged(r) {
|
|
121
|
-
|
|
127
|
+
e.isVersionHistoryOpen = r;
|
|
122
128
|
},
|
|
123
129
|
onDataChanged() {
|
|
124
|
-
|
|
130
|
+
e.hasChanges = !0, e.changeSeq += 1;
|
|
125
131
|
},
|
|
126
132
|
onEvent: V,
|
|
127
|
-
onModuleAdd:
|
|
128
|
-
notifications:
|
|
133
|
+
onModuleAdd: L,
|
|
134
|
+
notifications: q(),
|
|
129
135
|
// Stripo deselects the block on any click outside the canvas, so every surface
|
|
130
136
|
// that belongs to the block's own flow has to be listed here (SD-153273).
|
|
131
137
|
ignoreClickOutsideSelectors: [
|
|
@@ -135,35 +141,35 @@ const Pe = (t) => {
|
|
|
135
141
|
".in-modal-v2-wrapper",
|
|
136
142
|
".in-toasts-wrapper"
|
|
137
143
|
],
|
|
138
|
-
extensions:
|
|
139
|
-
localePatch:
|
|
144
|
+
extensions: H,
|
|
145
|
+
localePatch: Z
|
|
140
146
|
}
|
|
141
147
|
);
|
|
142
148
|
};
|
|
143
|
-
return { initPlugin: async (n,
|
|
144
|
-
const
|
|
149
|
+
return { initPlugin: async (n, a, i, s = !1) => {
|
|
150
|
+
const t = T();
|
|
145
151
|
try {
|
|
146
|
-
|
|
147
|
-
const [
|
|
148
|
-
|
|
149
|
-
|
|
152
|
+
o.mark("plugin_start"), o.setScriptPreloaded(A), await S(), o.mark("script_ready");
|
|
153
|
+
const [c, e] = await Promise.all([
|
|
154
|
+
R(),
|
|
155
|
+
D()
|
|
150
156
|
]);
|
|
151
|
-
|
|
157
|
+
o.mark("fonts_sync_ready"), t.syncModulesEnabled = e, await x(n, a, i, c, e, s);
|
|
152
158
|
} catch {
|
|
153
|
-
|
|
154
|
-
type:
|
|
159
|
+
t.loadingStatus = !1, P({
|
|
160
|
+
type: ee.Error,
|
|
155
161
|
message: F["An error has occurred. Please report the error code to support."],
|
|
156
162
|
actionButton: {
|
|
157
163
|
text: F["Reload page"],
|
|
158
164
|
onClick: () => window.location.reload()
|
|
159
165
|
}
|
|
160
|
-
}),
|
|
166
|
+
}), o.markFailed();
|
|
161
167
|
}
|
|
162
168
|
}, preloadRuntime: () => {
|
|
163
|
-
|
|
169
|
+
S().catch(() => {
|
|
164
170
|
});
|
|
165
171
|
} };
|
|
166
172
|
};
|
|
167
173
|
export {
|
|
168
|
-
|
|
174
|
+
Be as useStripo
|
|
169
175
|
};
|
|
@@ -1,23 +1,15 @@
|
|
|
1
|
-
import { COUPON_PLACEHOLDER_LIQUID as
|
|
2
|
-
|
|
3
|
-
const s = [
|
|
1
|
+
import { COUPON_PLACEHOLDER_LIQUID as e, COUPON_PLACEHOLDER_DEFAULT as i } from "../../extensions/Blocks/CouponBlock/template.js";
|
|
2
|
+
const o = [
|
|
4
3
|
{
|
|
5
4
|
id: "liquid-coupon-code",
|
|
6
5
|
description: "Replace legacy coupon placeholder with liquid syntax",
|
|
7
6
|
type: "replace",
|
|
8
|
-
search:
|
|
9
|
-
replacement:
|
|
7
|
+
search: i,
|
|
8
|
+
replacement: e,
|
|
10
9
|
replaceAll: !0,
|
|
11
10
|
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
|
|
19
11
|
}
|
|
20
12
|
];
|
|
21
13
|
export {
|
|
22
|
-
|
|
14
|
+
o as liquidCompilerRules
|
|
23
15
|
};
|
|
@@ -5,16 +5,17 @@ import { migrateItemsBlock as g } from "./itemsBlockMigrator.js";
|
|
|
5
5
|
import { migrateItemsPriceFormat as n } from "./itemsPriceFormatMigrator.js";
|
|
6
6
|
import { migrateLegacyUnsubscribeText as p } from "./legacyUnsubscribeTextMigrator.js";
|
|
7
7
|
import { migrateProductNameLink as f } from "./productNameLinkMigrator.js";
|
|
8
|
-
import { migrateRadioButton as
|
|
9
|
-
import { migrateRecommendation as
|
|
10
|
-
import { migrateRecommendationPartnerScope as
|
|
11
|
-
import { migrateRecommendationTitle as
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
|
|
8
|
+
import { migrateRadioButton as s } from "./radioButtonMigrator.js";
|
|
9
|
+
import { migrateRecommendation as l } from "./recommendationMigrator.js";
|
|
10
|
+
import { migrateRecommendationPartnerScope as b } from "./recommendationPartnerMigrator.js";
|
|
11
|
+
import { migrateRecommendationTitle as d } from "./recommendationTitleMigrator.js";
|
|
12
|
+
import { migrateSfmcUnsubscribeText as k } from "./sfmcUnsubscribeTextMigrator.js";
|
|
13
|
+
import { migrateSocialIcons as u } from "./socialIconMigrator.js";
|
|
14
|
+
import { migrateUnsubscribe as x } from "./unsubscribeMigrator.js";
|
|
15
|
+
const N = async (t, i = {}, o, r) => {
|
|
15
16
|
let m = t;
|
|
16
|
-
return m = e(m), m =
|
|
17
|
+
return m = e(m), m = s(m), m = k(m), m = p(m), m = await x(m), m = a(m), m = l(m, i), o && (m = b(m, o)), m = d(m), m = g(m), r != null && r.itemsPriceFormatting && (m = n(m)), m = f(m), m = u(m), m = c(m), m;
|
|
17
18
|
};
|
|
18
19
|
export {
|
|
19
|
-
|
|
20
|
+
N as migrate
|
|
20
21
|
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { useConfigStore as s } from "../../stores/config.js";
|
|
2
|
+
import { useEditorStore as n } from "../../stores/editor.js";
|
|
3
|
+
import { hasAnyUnsubscribeClass as i, convertAllUnsubscribeInDocumentHtml as c } from "../../utils/legacyUnsubscribeConversion.js";
|
|
4
|
+
const a = (r) => {
|
|
5
|
+
try {
|
|
6
|
+
if (!i(r) || !s().isFeatureEnabled("blockUnsubscribeLinks"))
|
|
7
|
+
return r;
|
|
8
|
+
const { html: e, converted: o } = c(r);
|
|
9
|
+
if (o) {
|
|
10
|
+
const t = n();
|
|
11
|
+
t.isSfmcUnsubscribeModalRequested = !0, t.isUnsubscribeConvertedOnLoad = !0;
|
|
12
|
+
}
|
|
13
|
+
return e;
|
|
14
|
+
} catch (e) {
|
|
15
|
+
return console.error("SfmcUnsubscribeTextMigrator failed:", e), r;
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
export {
|
|
19
|
+
a as migrateSfmcUnsubscribeText
|
|
20
|
+
};
|
package/dist/enums/academy.js
CHANGED
|
@@ -4,7 +4,8 @@ const e = "https://academy.insiderone.com", o = {
|
|
|
4
4
|
AMP_FOR_EMAILS: `${e}/docs/amp-for-emails`,
|
|
5
5
|
EMAIL_DISPLAY_CONDITIONS: `${e}/docs/new-editor-add-display-conditions-to-an-email`,
|
|
6
6
|
EMAIL_RECOMMENDATION_BLOCK: `${e}/docs/new-editor-email-recommendation-block`,
|
|
7
|
-
LEGACY_UNSUBSCRIBE_MODULE: `${e}/docs/new-editor-add-unsubscribe-pages-into-emails
|
|
7
|
+
LEGACY_UNSUBSCRIBE_MODULE: `${e}/docs/new-editor-add-unsubscribe-pages-into-emails`,
|
|
8
|
+
SFMC_RELAY: `${e}/docs/sfmc-relay`
|
|
8
9
|
};
|
|
9
10
|
export {
|
|
10
11
|
o as ACADEMY_LINKS
|
|
@@ -1,40 +1,37 @@
|
|
|
1
1
|
var c = Object.defineProperty;
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { useConfig as
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
r[l.MERGETAGS] = a;
|
|
2
|
+
var g = (o, s, t) => s in o ? c(o, s, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[s] = t;
|
|
3
|
+
var r = (o, s, t) => g(o, typeof s != "symbol" ? s + "" : s, t);
|
|
4
|
+
import { useConfig as d } from "../../composables/useConfig.js";
|
|
5
|
+
import { findEditorShadowRoot as m } from "../../utils/editorShadowRoot.js";
|
|
6
|
+
import { mergeTagToDynamicContent as u, dynamicContentToMergeTags as h } from "../../utils/genericUtil.js";
|
|
7
|
+
import { UIElement as T, UIElementType as a, UEAttr as y, UIElementTagRegistry as C } from "../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
8
|
+
import { ExternalMergeTagsLibrary as E } from "./dynamic-content-modal.js";
|
|
9
|
+
const l = "external-dynamic-content-ui-element", L = "button-add-dynamic-content";
|
|
10
|
+
class B extends C {
|
|
11
|
+
registerUiElements(s) {
|
|
12
|
+
s[a.MERGETAGS] = l;
|
|
14
13
|
}
|
|
15
14
|
}
|
|
16
|
-
class
|
|
15
|
+
class x extends T {
|
|
17
16
|
constructor() {
|
|
18
17
|
super(...arguments);
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
s(this, "clipboardWindow", null);
|
|
26
|
-
s(this, "clipboardListener", (t) => this._writeTokenAsPlainText(t));
|
|
18
|
+
r(this, "mergeTagsButton", null);
|
|
19
|
+
r(this, "mergeTagsLibrary", null);
|
|
20
|
+
r(this, "clickListener", null);
|
|
21
|
+
r(this, "lastClickedElement", null);
|
|
22
|
+
r(this, "lastClickedFrame", null);
|
|
23
|
+
r(this, "mousedownListener", null);
|
|
27
24
|
}
|
|
28
25
|
getId() {
|
|
29
|
-
return
|
|
26
|
+
return l;
|
|
30
27
|
}
|
|
31
28
|
onRender(t) {
|
|
32
29
|
var e;
|
|
33
|
-
this.mergeTagsButton = t.querySelector("#guido__btn-add-dynamic-content"), this.clickListener = this._onClick.bind(this), (e = this.mergeTagsButton) == null || e.addEventListener("click", this.clickListener), this._setupCoordinateTracking()
|
|
30
|
+
this.mergeTagsButton = t.querySelector("#guido__btn-add-dynamic-content"), this.clickListener = this._onClick.bind(this), (e = this.mergeTagsButton) == null || e.addEventListener("click", this.clickListener), this._setupCoordinateTracking();
|
|
34
31
|
}
|
|
35
32
|
onDestroy() {
|
|
36
33
|
var t;
|
|
37
|
-
this.clickListener && ((t = this.mergeTagsButton) == null || t.removeEventListener("click", this.clickListener)), this._cleanupCoordinateTracking(), this.
|
|
34
|
+
this.clickListener && ((t = this.mergeTagsButton) == null || t.removeEventListener("click", this.clickListener)), this._cleanupCoordinateTracking(), this.mergeTagsButton = null, this.clickListener = null, this.lastClickedElement = null, this.lastClickedFrame = null;
|
|
38
35
|
}
|
|
39
36
|
_onClick() {
|
|
40
37
|
this.openMergeTagLibrary();
|
|
@@ -48,7 +45,7 @@ class P extends p {
|
|
|
48
45
|
onAttributeUpdated(t, e) {
|
|
49
46
|
if (t !== "mergeTag" || !(e != null && e.value))
|
|
50
47
|
return;
|
|
51
|
-
const n =
|
|
48
|
+
const n = u(e), i = this._getLastClickedPosition();
|
|
52
49
|
this.lastClickedElement = null, this.lastClickedFrame = null, this._openDynamicContentLibrary(n, i);
|
|
53
50
|
}
|
|
54
51
|
openMergeTagLibrary() {
|
|
@@ -60,12 +57,12 @@ class P extends p {
|
|
|
60
57
|
* Dispatches event with dynamic content data and position
|
|
61
58
|
*/
|
|
62
59
|
_openDynamicContentLibrary(t, e) {
|
|
63
|
-
this.mergeTagsLibrary || (this.mergeTagsLibrary = new
|
|
60
|
+
this.mergeTagsLibrary || (this.mergeTagsLibrary = new E()), this.mergeTagsLibrary.openMergeTagsLibrary(
|
|
64
61
|
t,
|
|
65
62
|
(n) => {
|
|
66
63
|
if (n.text && n.value) {
|
|
67
|
-
const { isFeatureEnabled: i } =
|
|
68
|
-
this.api.triggerValueChange(
|
|
64
|
+
const { isFeatureEnabled: i } = d();
|
|
65
|
+
this.api.triggerValueChange(h([n], i("liquidSyntax"))[0]);
|
|
69
66
|
} else
|
|
70
67
|
this.api.triggerValueChange(null);
|
|
71
68
|
},
|
|
@@ -94,32 +91,12 @@ class P extends p {
|
|
|
94
91
|
i && (this.lastClickedElement = i, this.lastClickedFrame = t);
|
|
95
92
|
}, t.contentWindow.document.addEventListener("mousedown", this.mousedownListener));
|
|
96
93
|
}
|
|
97
|
-
/**
|
|
98
|
-
* Listens on the canvas window so it runs after Stripo's own copy handler
|
|
99
|
-
*/
|
|
100
|
-
_setupClipboardTracking() {
|
|
101
|
-
var e;
|
|
102
|
-
this._cleanupClipboardTracking();
|
|
103
|
-
const t = (e = this._getEditorFrame()) == null ? void 0 : e.contentWindow;
|
|
104
|
-
t && (this.clipboardWindow = t, t.addEventListener("copy", this.clipboardListener), t.addEventListener("cut", this.clipboardListener));
|
|
105
|
-
}
|
|
106
|
-
_cleanupClipboardTracking() {
|
|
107
|
-
var t, e;
|
|
108
|
-
(t = this.clipboardWindow) == null || t.removeEventListener("copy", this.clipboardListener), (e = this.clipboardWindow) == null || e.removeEventListener("cut", this.clipboardListener), this.clipboardWindow = null;
|
|
109
|
-
}
|
|
110
|
-
/**
|
|
111
|
-
* Link and image fields paste the plain flavour, where Stripo puts the chip label
|
|
112
|
-
*/
|
|
113
|
-
_writeTokenAsPlainText({ clipboardData: t }) {
|
|
114
|
-
const e = m((t == null ? void 0 : t.getData("text/html")) ?? "");
|
|
115
|
-
e !== null && (t == null || t.setData("text/plain", e));
|
|
116
|
-
}
|
|
117
94
|
/**
|
|
118
95
|
* Gets the editor iframe element
|
|
119
96
|
*/
|
|
120
97
|
_getEditorFrame() {
|
|
121
98
|
var e, n;
|
|
122
|
-
const t = (e =
|
|
99
|
+
const t = (e = m()) == null ? void 0 : e.querySelector("iframe");
|
|
123
100
|
return (n = t == null ? void 0 : t.contentWindow) != null && n.document ? t : null;
|
|
124
101
|
}
|
|
125
102
|
/**
|
|
@@ -165,18 +142,18 @@ class P extends p {
|
|
|
165
142
|
getTemplate() {
|
|
166
143
|
return `
|
|
167
144
|
<div>
|
|
168
|
-
<${
|
|
145
|
+
<${a.BUTTON}
|
|
169
146
|
id="guido__btn-add-dynamic-content"
|
|
170
147
|
class="btn btn-primary"
|
|
171
|
-
${
|
|
172
|
-
<${
|
|
173
|
-
</${
|
|
148
|
+
${y.BUTTON.name}="${L}">
|
|
149
|
+
<${a.ICON} src="plus" class="icon icon-button color-primary">
|
|
150
|
+
</${a.ICON}>
|
|
174
151
|
${this.api.translate("Add Dynamic Content")}
|
|
175
|
-
</${
|
|
152
|
+
</${a.BUTTON}>
|
|
176
153
|
</div>`;
|
|
177
154
|
}
|
|
178
155
|
}
|
|
179
156
|
export {
|
|
180
|
-
|
|
181
|
-
|
|
157
|
+
B as DynamicContentTagRegistry,
|
|
158
|
+
x as DynamicContentUiElementExtension
|
|
182
159
|
};
|