@useinsider/guido 3.30.1 → 3.30.2-beta.1e7c743
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 -1
- package/dist/components/Guido.vue.js +5 -5
- package/dist/components/Guido.vue2.js +115 -109
- package/dist/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue.js +1 -1
- package/dist/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue2.js +54 -48
- package/dist/components/organisms/unsubscribe/SfmcUnsubscribeConvertedModal.vue.js +17 -0
- package/dist/components/organisms/unsubscribe/SfmcUnsubscribeConvertedModal.vue2.js +30 -0
- package/dist/composables/useModuleRepair.js +56 -50
- package/dist/composables/useStripo.js +87 -79
- package/dist/config/migrator/index.js +14 -13
- package/dist/config/migrator/recommendation/cssCascade.js +84 -0
- package/dist/config/migrator/recommendation/extractors.js +195 -89
- package/dist/config/migrator/recommendation/themeMapper.js +33 -21
- package/dist/config/migrator/recommendationMigrator.js +70 -63
- package/dist/config/migrator/sfmcUnsubscribeTextMigrator.js +20 -0
- package/dist/enums/academy.js +2 -1
- package/dist/guido.css +1 -1
- package/dist/package.json.js +2 -2
- package/dist/src/components/organisms/unsubscribe/SfmcUnsubscribeConvertedModal.vue.d.ts +2 -0
- package/dist/src/composables/useModuleRepair.d.ts +1 -1
- package/dist/src/config/migrator/index.d.ts +1 -1
- package/dist/src/config/migrator/recommendation/cssCascade.d.ts +24 -0
- package/dist/src/config/migrator/recommendation/extractors.d.ts +18 -1
- package/dist/src/config/migrator/recommendationMigrator.d.ts +2 -1
- package/dist/src/config/migrator/sfmcUnsubscribeTextMigrator.d.ts +1 -0
- package/dist/src/enums/academy.d.ts +1 -0
- package/dist/src/stores/editor.d.ts +54 -0
- package/dist/src/utils/legacyUnsubscribeConversion.d.ts +3 -0
- package/dist/stores/editor.js +2 -0
- package/dist/utils/legacyUnsubscribeConversion.js +69 -28
- package/package.json +1 -1
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { defineComponent as n, computed as t } from "vue";
|
|
2
|
+
import i from "../../wrappers/WpModal.vue.js";
|
|
3
|
+
import { useTranslations as a } from "../../../composables/useTranslations.js";
|
|
4
|
+
import { ACADEMY_LINKS as c } from "../../../enums/academy.js";
|
|
5
|
+
import { useEditorStore as m } from "../../../stores/editor.js";
|
|
6
|
+
const S = /* @__PURE__ */ n({
|
|
7
|
+
__name: "SfmcUnsubscribeConvertedModal",
|
|
8
|
+
setup(p) {
|
|
9
|
+
const o = a(), e = m(), r = t(
|
|
10
|
+
() => e.isSfmcUnsubscribeModalRequested && e.isStripoInitialized
|
|
11
|
+
), s = t(() => ({
|
|
12
|
+
secondaryButton: {
|
|
13
|
+
type: "subtle-primary",
|
|
14
|
+
labelText: o("email-editor.legacy-unsubscribe-converted-modal-visit-academy")
|
|
15
|
+
},
|
|
16
|
+
primaryButton: {
|
|
17
|
+
type: "primary",
|
|
18
|
+
labelText: o("action-builder.ok")
|
|
19
|
+
}
|
|
20
|
+
}));
|
|
21
|
+
return { __sfc: !0, trans: o, editorStore: e, isVisible: r, footerButtonOptions: s, close: () => {
|
|
22
|
+
e.isSfmcUnsubscribeModalRequested = !1;
|
|
23
|
+
}, openAcademy: () => {
|
|
24
|
+
window.open(c.SFMC_RELAY, "_blank", "noopener,noreferrer");
|
|
25
|
+
}, WpModal: i };
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
export {
|
|
29
|
+
S as default
|
|
30
|
+
};
|
|
@@ -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,70 +1,70 @@
|
|
|
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
|
|
1
|
+
import { useActionsApi as z } from "./useActionsApi.js";
|
|
2
|
+
import { useAmbiguousDynamicContent as $ } from "./useAmbiguousDynamicContent.js";
|
|
3
|
+
import { useBlocksConfig as G } from "./useBlocksConfig.js";
|
|
4
|
+
import { useConfig as X } from "./useConfig.js";
|
|
5
|
+
import { useCustomInterfaceAppearance as B } from "./useCustomInterfaceAppearance.js";
|
|
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
|
+
import { en as F } from "../config/i18n/en/index.js";
|
|
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
16
|
import { useEditorStore as T } from "../stores/editor.js";
|
|
17
|
-
import { buildMergeTagEntries as
|
|
18
|
-
import { getStripoRuntimeBaseUrl as
|
|
19
|
-
let d = null,
|
|
20
|
-
const
|
|
21
|
-
const { features:
|
|
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) => {
|
|
22
22
|
if (document.getElementById("UiEditorScript")) {
|
|
23
23
|
n();
|
|
24
24
|
return;
|
|
25
25
|
}
|
|
26
|
-
const i =
|
|
26
|
+
const i = ne();
|
|
27
27
|
if (!i) {
|
|
28
|
-
|
|
28
|
+
a(
|
|
29
29
|
new Error("guido.stripo.version is not set in package.json. Please configure the Stripo version.")
|
|
30
30
|
);
|
|
31
31
|
return;
|
|
32
32
|
}
|
|
33
|
-
const
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
},
|
|
37
|
-
|
|
38
|
-
}, 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);
|
|
39
39
|
}), d.catch(() => {
|
|
40
40
|
d = null;
|
|
41
|
-
}), d), x = async (n,
|
|
42
|
-
var w, k,
|
|
43
|
-
const
|
|
44
|
-
|
|
45
|
-
const
|
|
46
|
-
|
|
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(
|
|
47
47
|
document.querySelector("#guido-editor"),
|
|
48
48
|
{
|
|
49
|
-
metadata:
|
|
50
|
-
html:
|
|
51
|
-
css:
|
|
52
|
-
forceRecreate:
|
|
49
|
+
metadata: a,
|
|
50
|
+
html: y,
|
|
51
|
+
css: h,
|
|
52
|
+
forceRecreate: b,
|
|
53
53
|
locale: "en",
|
|
54
54
|
undoButtonSelector: "#guido__undo-button",
|
|
55
55
|
redoButtonSelector: "#guido__redo-button",
|
|
56
56
|
mobileViewButtonSelector: ".guido__view-option-selection-mobile",
|
|
57
57
|
desktopViewButtonSelector: ".guido__view-option-selection-desktop",
|
|
58
58
|
codeEditorButtonSelector: "#guido__code-button",
|
|
59
|
-
customAppearanceMergetags: !
|
|
59
|
+
customAppearanceMergetags: !f("liquidSyntax"),
|
|
60
60
|
customAppearanceMergetagsBorderColor: "#f1f3fe",
|
|
61
61
|
customAppearanceMergetagsBackgroundColor: "#f1f3fe",
|
|
62
|
-
customViewStyles:
|
|
63
|
-
conditionsEnabled:
|
|
64
|
-
customConditionsEnabled:
|
|
62
|
+
customViewStyles: oe,
|
|
63
|
+
conditionsEnabled: E,
|
|
64
|
+
customConditionsEnabled: E,
|
|
65
65
|
enableXSSSecurity: !0,
|
|
66
|
-
modulesDisabled:
|
|
67
|
-
syncModulesEnabled:
|
|
66
|
+
modulesDisabled: M,
|
|
67
|
+
syncModulesEnabled: t,
|
|
68
68
|
messageSettingsEnabled: !0,
|
|
69
69
|
displayGmailAnnotations: !0,
|
|
70
70
|
displayHiddenPreheader: !1,
|
|
@@ -74,55 +74,63 @@ const ve = (t) => {
|
|
|
74
74
|
copyPasteEnabled: !1,
|
|
75
75
|
selectElementAfterDrop: !0,
|
|
76
76
|
sameFontSizeForOutlook: !0,
|
|
77
|
-
allowedScriptSourceDomains:
|
|
78
|
-
...
|
|
77
|
+
allowedScriptSourceDomains: N,
|
|
78
|
+
...C ? { baseBlocks: C } : {},
|
|
79
79
|
editorFonts: {
|
|
80
80
|
showDefaultStandardFonts: !0,
|
|
81
81
|
showDefaultNotStandardFonts: !0,
|
|
82
|
-
customFonts:
|
|
82
|
+
customFonts: s
|
|
83
83
|
},
|
|
84
84
|
mergeTags: [
|
|
85
85
|
{
|
|
86
|
-
entries:
|
|
86
|
+
entries: re(
|
|
87
87
|
i.preselectedDynamicContentList,
|
|
88
|
-
|
|
89
|
-
|
|
88
|
+
ie((v = p.value) == null ? void 0 : v.dynamicContentList),
|
|
89
|
+
f("liquidSyntax")
|
|
90
90
|
)
|
|
91
91
|
}
|
|
92
92
|
],
|
|
93
93
|
async onTokenRefreshRequest(r) {
|
|
94
94
|
try {
|
|
95
|
-
|
|
96
|
-
const l = await
|
|
97
|
-
|
|
95
|
+
o.mark("token_start");
|
|
96
|
+
const l = await U();
|
|
97
|
+
o.mark("token_end"), r(l);
|
|
98
98
|
} catch (l) {
|
|
99
|
-
|
|
99
|
+
g(l, "Failed to refresh token");
|
|
100
100
|
}
|
|
101
101
|
},
|
|
102
102
|
onTemplateLoaded() {
|
|
103
103
|
try {
|
|
104
|
-
const { activateCustomViewStyles: r, updateTimerInClonedTemplate: l } =
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
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();
|
|
108
116
|
} catch (r) {
|
|
109
|
-
|
|
117
|
+
g(r, "Failed to load custom interface appearance");
|
|
110
118
|
}
|
|
111
119
|
},
|
|
112
120
|
onCodeEditorVisibilityChanged(r) {
|
|
113
|
-
|
|
121
|
+
e.isCodeEditorOpen = r;
|
|
114
122
|
},
|
|
115
123
|
onEditorVisualModeChanged(r) {
|
|
116
|
-
|
|
124
|
+
e.editorVisualMode = r.toLowerCase();
|
|
117
125
|
},
|
|
118
126
|
onVersionHistoryVisibilityChanged(r) {
|
|
119
|
-
|
|
127
|
+
e.isVersionHistoryOpen = r;
|
|
120
128
|
},
|
|
121
129
|
onDataChanged() {
|
|
122
|
-
|
|
130
|
+
e.hasChanges = !0, e.changeSeq += 1;
|
|
123
131
|
},
|
|
124
|
-
onEvent:
|
|
125
|
-
onModuleAdd:
|
|
132
|
+
onEvent: V,
|
|
133
|
+
onModuleAdd: L,
|
|
126
134
|
notifications: q(),
|
|
127
135
|
// Stripo deselects the block on any click outside the canvas, so every surface
|
|
128
136
|
// that belongs to the block's own flow has to be listed here (SD-153273).
|
|
@@ -133,35 +141,35 @@ const ve = (t) => {
|
|
|
133
141
|
".in-modal-v2-wrapper",
|
|
134
142
|
".in-toasts-wrapper"
|
|
135
143
|
],
|
|
136
|
-
extensions:
|
|
137
|
-
localePatch:
|
|
144
|
+
extensions: H,
|
|
145
|
+
localePatch: Z
|
|
138
146
|
}
|
|
139
147
|
);
|
|
140
148
|
};
|
|
141
|
-
return { initPlugin: async (n,
|
|
142
|
-
const
|
|
149
|
+
return { initPlugin: async (n, a, i, s = !1) => {
|
|
150
|
+
const t = T();
|
|
143
151
|
try {
|
|
144
|
-
|
|
145
|
-
const [c,
|
|
152
|
+
o.mark("plugin_start"), o.setScriptPreloaded(A), await S(), o.mark("script_ready");
|
|
153
|
+
const [c, e] = await Promise.all([
|
|
146
154
|
R(),
|
|
147
155
|
D()
|
|
148
156
|
]);
|
|
149
|
-
|
|
157
|
+
o.mark("fonts_sync_ready"), t.syncModulesEnabled = e, await x(n, a, i, c, e, s);
|
|
150
158
|
} catch {
|
|
151
|
-
|
|
152
|
-
type:
|
|
153
|
-
message:
|
|
159
|
+
t.loadingStatus = !1, P({
|
|
160
|
+
type: ee.Error,
|
|
161
|
+
message: F["An error has occurred. Please report the error code to support."],
|
|
154
162
|
actionButton: {
|
|
155
|
-
text:
|
|
163
|
+
text: F["Reload page"],
|
|
156
164
|
onClick: () => window.location.reload()
|
|
157
165
|
}
|
|
158
|
-
}),
|
|
166
|
+
}), o.markFailed();
|
|
159
167
|
}
|
|
160
168
|
}, preloadRuntime: () => {
|
|
161
|
-
|
|
169
|
+
S().catch(() => {
|
|
162
170
|
});
|
|
163
171
|
} };
|
|
164
172
|
};
|
|
165
173
|
export {
|
|
166
|
-
|
|
174
|
+
Be as useStripo
|
|
167
175
|
};
|
|
@@ -1,20 +1,21 @@
|
|
|
1
|
-
import { migrateCheckbox as
|
|
2
|
-
import { migrateCouponBlock as
|
|
3
|
-
import { migrateFullStoryScripts as
|
|
4
|
-
import { migrateItemsBlock as
|
|
5
|
-
import { migrateItemsPriceFormat as
|
|
6
|
-
import { migrateLegacyUnsubscribeText as
|
|
7
|
-
import { migrateProductNameLink as
|
|
1
|
+
import { migrateCheckbox as a } from "./checkboxMigrator.js";
|
|
2
|
+
import { migrateCouponBlock as c } from "./couponBlockMigrator.js";
|
|
3
|
+
import { migrateFullStoryScripts as g } from "./fullStoryScriptMigrator.js";
|
|
4
|
+
import { migrateItemsBlock as n } from "./itemsBlockMigrator.js";
|
|
5
|
+
import { migrateItemsPriceFormat as p } from "./itemsPriceFormatMigrator.js";
|
|
6
|
+
import { migrateLegacyUnsubscribeText as f } from "./legacyUnsubscribeTextMigrator.js";
|
|
7
|
+
import { migrateProductNameLink as s } from "./productNameLinkMigrator.js";
|
|
8
8
|
import { migrateRadioButton as l } from "./radioButtonMigrator.js";
|
|
9
|
-
import { migrateRecommendation as
|
|
9
|
+
import { migrateRecommendation as b } from "./recommendationMigrator.js";
|
|
10
10
|
import { migrateRecommendationPartnerScope as d } from "./recommendationPartnerMigrator.js";
|
|
11
|
-
import { migrateRecommendationTitle as
|
|
12
|
-
import {
|
|
11
|
+
import { migrateRecommendationTitle as k } from "./recommendationTitleMigrator.js";
|
|
12
|
+
import { migrateSfmcUnsubscribeText as u } from "./sfmcUnsubscribeTextMigrator.js";
|
|
13
|
+
import { migrateSocialIcons as x } from "./socialIconMigrator.js";
|
|
13
14
|
import { migrateUnsubscribe as P } from "./unsubscribeMigrator.js";
|
|
14
|
-
const
|
|
15
|
+
const j = async (t, i = {}, o, r, e = "") => {
|
|
15
16
|
let m = t;
|
|
16
|
-
return m =
|
|
17
|
+
return m = a(m), m = l(m), m = u(m), m = f(m), m = await P(m), m = c(m), m = b(m, i, e), o && (m = d(m, o)), m = k(m), m = n(m), r != null && r.itemsPriceFormatting && (m = p(m)), m = s(m), m = x(m), m = g(m), m;
|
|
17
18
|
};
|
|
18
19
|
export {
|
|
19
|
-
|
|
20
|
+
j as migrate
|
|
20
21
|
};
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
const f = /\s*!important\s*$/i, g = /\/\*[\s\S]*?\*\//g, a = /#[\w-]+/g, p = /\.[\w-]+|\[[^\]]*\]|:(?!:)[\w-]+(?:\([^)]*\))?/g, d = /::[\w-]+/g, E = /(?:^|[\s>+~])([a-z][\w-]*)/gi;
|
|
2
|
+
function h(o) {
|
|
3
|
+
return o.split(";").flatMap((r) => {
|
|
4
|
+
const s = r.indexOf(":");
|
|
5
|
+
if (s < 0)
|
|
6
|
+
return [];
|
|
7
|
+
const e = r.slice(0, s).trim().toLowerCase(), t = r.slice(s + 1), n = t.replace(f, "").trim();
|
|
8
|
+
return e && n ? [{ prop: e, value: n, important: f.test(t) }] : [];
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
function w(o, r) {
|
|
12
|
+
let s = 0;
|
|
13
|
+
for (let e = r; e < o.length; e += 1)
|
|
14
|
+
if (o[e] === "{")
|
|
15
|
+
s += 1;
|
|
16
|
+
else if (o[e] === "}" && (s -= 1, s === 0))
|
|
17
|
+
return e;
|
|
18
|
+
return o.length;
|
|
19
|
+
}
|
|
20
|
+
function m(o) {
|
|
21
|
+
let r = 0;
|
|
22
|
+
return Array.from(o).reduce((e, t) => (t === "(" || t === "[" ? r += 1 : (t === ")" || t === "]") && r > 0 && (r -= 1), t === "," && r === 0 ? e.push("") : e[e.length - 1] += t, e), [""]).map((e) => e.trim()).filter(Boolean);
|
|
23
|
+
}
|
|
24
|
+
function v(o) {
|
|
25
|
+
const r = o.replace(g, ""), s = [];
|
|
26
|
+
let e = 0;
|
|
27
|
+
for (; e < r.length; ) {
|
|
28
|
+
const t = r.indexOf("{", e);
|
|
29
|
+
if (t < 0)
|
|
30
|
+
break;
|
|
31
|
+
const n = r.slice(e, t), i = n.slice(n.lastIndexOf(";") + 1).trim(), c = w(r, t);
|
|
32
|
+
if (i && !i.startsWith("@")) {
|
|
33
|
+
const l = m(i), u = h(r.slice(t + 1, c));
|
|
34
|
+
l.length > 0 && u.length > 0 && s.push({ selectors: l, declarations: u });
|
|
35
|
+
}
|
|
36
|
+
e = c + 1;
|
|
37
|
+
}
|
|
38
|
+
return s;
|
|
39
|
+
}
|
|
40
|
+
function S(o) {
|
|
41
|
+
var i, c;
|
|
42
|
+
const r = o.replace(d, " "), s = ((i = r.match(a)) == null ? void 0 : i.length) ?? 0, e = r.replace(a, " "), t = ((c = e.match(p)) == null ? void 0 : c.length) ?? 0, n = Array.from(e.replace(p, " ").matchAll(E)).length;
|
|
43
|
+
return s * 1e6 + t * 1e3 + n;
|
|
44
|
+
}
|
|
45
|
+
function O(o, r) {
|
|
46
|
+
return r.reduce((s, e) => {
|
|
47
|
+
let t = !1;
|
|
48
|
+
try {
|
|
49
|
+
t = o.matches(e);
|
|
50
|
+
} catch {
|
|
51
|
+
t = !1;
|
|
52
|
+
}
|
|
53
|
+
if (!t)
|
|
54
|
+
return s;
|
|
55
|
+
const n = S(e);
|
|
56
|
+
return s === void 0 || n > s ? n : s;
|
|
57
|
+
}, void 0);
|
|
58
|
+
}
|
|
59
|
+
function y(o, r) {
|
|
60
|
+
const s = /* @__PURE__ */ new Map();
|
|
61
|
+
if (!o)
|
|
62
|
+
return s;
|
|
63
|
+
const e = [];
|
|
64
|
+
return r.forEach((t, n) => {
|
|
65
|
+
const i = O(o, t.selectors);
|
|
66
|
+
i !== void 0 && t.declarations.forEach((c, l) => {
|
|
67
|
+
e.push({
|
|
68
|
+
...c,
|
|
69
|
+
tier: c.important ? 2 : 0,
|
|
70
|
+
weight: i,
|
|
71
|
+
order: n * 1e3 + l
|
|
72
|
+
});
|
|
73
|
+
});
|
|
74
|
+
}), h(o.getAttribute("style") ?? "").forEach((t, n) => {
|
|
75
|
+
e.push({ ...t, tier: t.important ? 3 : 1, weight: 0, order: n });
|
|
76
|
+
}), e.sort((t, n) => t.tier - n.tier || t.weight - n.weight || t.order - n.order).forEach((t, n) => {
|
|
77
|
+
s.set(t.prop, { value: t.value, position: n });
|
|
78
|
+
}), s;
|
|
79
|
+
}
|
|
80
|
+
export {
|
|
81
|
+
v as parseCssRules,
|
|
82
|
+
h as parseDeclarations,
|
|
83
|
+
y as resolveDeclaredStyle
|
|
84
|
+
};
|