@useinsider/guido 3.12.0-beta.3450e5f → 3.12.0-beta.3d61e73
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 +29 -0
- package/dist/@types/config/schemas.js +104 -84
- package/dist/components/organisms/email-preview/desktop-preview/DesktopPreview.vue.js +1 -1
- package/dist/components/organisms/email-preview/desktop-preview/DesktopPreview.vue2.js +8 -8
- package/dist/components/organisms/email-preview/mobile-preview/ContentView.vue.js +5 -5
- package/dist/components/organisms/email-preview/mobile-preview/ContentView.vue2.js +10 -10
- package/dist/components/organisms/onboarding/AMPOnboarding.vue.js +11 -10
- package/dist/components/organisms/onboarding/GenericOnboarding.vue.js +1 -1
- package/dist/components/organisms/onboarding/ItemsOnboarding.vue.js +6 -6
- package/dist/components/organisms/onboarding/NewVersionPopup.vue2.js +20 -23
- package/dist/components/organisms/onboarding/TextBlockOnboarding.vue.js +3 -3
- package/dist/components/organisms/onboarding/VersionHistoryOnboarding.vue.js +8 -7
- package/dist/composables/useModuleDynamicContentRepair.js +37 -0
- package/dist/composables/usePreviewInteractionGuard.js +36 -11
- package/dist/composables/useRecommendationPreview.js +61 -60
- package/dist/composables/useStripo.js +70 -67
- package/dist/config/migrator/index.js +7 -6
- package/dist/config/migrator/socialIconMigrator.js +29 -0
- package/dist/enums/academy.js +1 -1
- package/dist/enums/date.js +3 -4
- package/dist/extensions/Blocks/Items/controls/price/formattedPrice.js +43 -41
- package/dist/extensions/Blocks/Recommendation/constants/controlIds.js +1 -1
- package/dist/extensions/Blocks/Recommendation/controls/blockBackground/index.js +10 -0
- package/dist/extensions/Blocks/Recommendation/extension.js +23 -21
- package/dist/extensions/Blocks/Recommendation/settingsPanel.js +41 -40
- package/dist/extensions/Blocks/Unsubscribe/utils/constants.js +3 -2
- package/dist/extensions/Blocks/controlFactories.js +125 -75
- package/dist/guido.css +1 -1
- package/dist/node_modules/valibot/dist/index.js +148 -112
- package/dist/services/stripoApi.js +18 -18
- package/dist/src/@types/config/schemas.d.ts +30 -0
- package/dist/src/@types/generic.d.ts +18 -0
- package/dist/src/composables/useConfig.d.ts +6 -0
- package/dist/src/composables/useModuleDynamicContentRepair.d.ts +18 -0
- package/dist/src/composables/usePreviewInteractionGuard.d.ts +1 -1
- package/dist/src/config/migrator/socialIconMigrator.d.ts +1 -0
- package/dist/src/enums/academy.d.ts +3 -3
- package/dist/src/extensions/Blocks/Recommendation/constants/controlIds.d.ts +1 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/blockBackground/index.d.ts +14 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/index.d.ts +1 -0
- package/dist/src/extensions/Blocks/Unsubscribe/utils/constants.d.ts +1 -0
- package/dist/src/extensions/Blocks/controlFactories.d.ts +36 -0
- package/dist/src/library.d.ts +1 -1
- package/dist/src/stores/config.d.ts +54 -0
- package/dist/src/utils/dynamicContentConverter.d.ts +27 -0
- package/dist/src/utils/environmentUtil.d.ts +5 -2
- package/dist/src/utils/genericUtil.d.ts +18 -1
- package/dist/src/utils/urlSchemes.d.ts +6 -0
- package/dist/utils/dateUtil.js +10 -23
- package/dist/utils/dynamicContentConverter.js +31 -0
- package/dist/utils/environmentUtil.js +3 -2
- package/dist/utils/genericUtil.js +42 -21
- package/dist/utils/urlSchemes.js +4 -0
- package/package.json +1 -1
|
@@ -1,46 +1,43 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import
|
|
3
|
-
import { useConfig as
|
|
1
|
+
import { defineComponent as b, ref as v, computed as o } from "vue";
|
|
2
|
+
import D from "../../wrappers/WpModal.vue.js";
|
|
3
|
+
import { useConfig as _ } from "../../../composables/useConfig.js";
|
|
4
4
|
import { useTranslations as y } from "../../../composables/useTranslations.js";
|
|
5
|
-
import { ACADEMY_LINKS as
|
|
5
|
+
import { ACADEMY_LINKS as m } from "../../../enums/academy.js";
|
|
6
6
|
import L from "../../../static/assets/onboarding-img.svg.js";
|
|
7
|
-
import { useOnboardingStore as
|
|
8
|
-
import { isAfterDate as
|
|
9
|
-
const
|
|
7
|
+
import { useOnboardingStore as h } from "../../../stores/onboarding.js";
|
|
8
|
+
import { isAfterDate as C } from "../../../utils/dateUtil.js";
|
|
9
|
+
const x = /* @__PURE__ */ b({
|
|
10
10
|
__name: "NewVersionPopup",
|
|
11
11
|
emits: ["onboarding-finished"],
|
|
12
|
-
setup(
|
|
13
|
-
const e = y(), t =
|
|
14
|
-
var l,
|
|
15
|
-
return (
|
|
16
|
-
}), n = o(() =>
|
|
17
|
-
|
|
18
|
-
)), f = o(() => n.value ? e("email-editor.onboarding-popup-sunsetted-title") : e("email-editor.onboarding-title")), g = o(() => n.value ? e("email-editor.onboarding-popup-sunsetted-description", {
|
|
19
|
-
sunsetDate: d.value,
|
|
20
|
-
academyLink: c.EMAIL_EDITOR
|
|
12
|
+
setup(w, { emit: i }) {
|
|
13
|
+
const e = y(), t = h(), a = v(!0), { config: s } = _(), p = o(() => {
|
|
14
|
+
var l, u;
|
|
15
|
+
return (u = (l = s.value) == null ? void 0 : l.editor) == null ? void 0 : u.migrationDate;
|
|
16
|
+
}), n = o(() => C(p.value || 0)), c = o(() => n.value ? e("email-editor.onboarding-popup-sunsetted-title") : e("email-editor.onboarding-title")), f = o(() => n.value ? e("email-editor.onboarding-popup-sunsetted-description", {
|
|
17
|
+
academyLink: m.EMAIL_EDITOR
|
|
21
18
|
}) : e("email-editor.onboarding-description", {
|
|
22
|
-
academyLink:
|
|
23
|
-
})),
|
|
19
|
+
academyLink: m.EMAIL_EDITOR
|
|
20
|
+
})), d = o(() => n.value ? e("products.cancel") : e("products.remind-me-later")), g = o(() => ({
|
|
24
21
|
primaryButton: {
|
|
25
22
|
type: "primary",
|
|
26
23
|
labelText: e("left-menu.discover-now")
|
|
27
24
|
},
|
|
28
25
|
secondaryButton: {
|
|
29
26
|
type: "subtle-primary",
|
|
30
|
-
labelText:
|
|
27
|
+
labelText: d.value
|
|
31
28
|
}
|
|
32
29
|
})), r = () => {
|
|
33
|
-
|
|
30
|
+
a.value = !1, i("onboarding-finished");
|
|
34
31
|
};
|
|
35
|
-
return { __sfc: !0, emit:
|
|
32
|
+
return { __sfc: !0, emit: i, trans: e, onboardingStore: t, isVisible: a, config: s, migrationDate: p, isAfterMigrationDate: n, popupTitle: c, popupDescription: f, secondaryButtonLabel: d, footerButtonOptions: g, closePopup: r, handleDiscoverNow: () => {
|
|
36
33
|
t.onDiscoverNowClicked(), r();
|
|
37
34
|
}, handleRemindLater: () => {
|
|
38
35
|
t.onRemindMeLater(), r();
|
|
39
36
|
}, handleClose: () => {
|
|
40
37
|
t.onNewVersionPopupClose(), r();
|
|
41
|
-
}, WpModal:
|
|
38
|
+
}, WpModal: D, onboardingImageSvg: L };
|
|
42
39
|
}
|
|
43
40
|
});
|
|
44
41
|
export {
|
|
45
|
-
|
|
42
|
+
x as default
|
|
46
43
|
};
|
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
import g from "./VersionHistoryOnboarding.vue2.js";
|
|
2
|
+
/* empty css */
|
|
2
3
|
import l from "../../../_virtual/_plugin-vue2_normalizer.js";
|
|
3
4
|
var c = function() {
|
|
4
|
-
var
|
|
5
|
+
var t, n, i, e, s, a;
|
|
5
6
|
var r = this, d = r._self._c, o = r._self._setupProxy;
|
|
6
|
-
return o.isVisible ? d(o.InOnboard, { key: "guido__version-history-onboard", staticClass: "w-21-s p-a z-11", class: (
|
|
7
|
+
return o.isVisible ? d(o.InOnboard, { key: "guido__version-history-onboard", staticClass: "w-21-s p-a z-11", class: (t = o.onboardingStore.getVersionHistoryCurrentCard) == null ? void 0 : t.classes, attrs: { id: "guido__version-history-onboard", "is-multiple-page": "", visible: "", "image-source": "", title: "", "bottom-position": (n = o.onboardingStore.getVersionHistoryCurrentCard) == null ? void 0 : n.bottom, "left-position": (i = o.onboardingStore.getVersionHistoryCurrentCard) == null ? void 0 : i.left, "pages-config": o.onboardingStore.onboardings.versionHistoryOnboarding.config, "pointer-position": (e = o.onboardingStore.getVersionHistoryCurrentCard) == null ? void 0 : e.position, "right-position": (s = o.onboardingStore.getVersionHistoryCurrentCard) == null ? void 0 : s.right, "top-position": (a = o.onboardingStore.getVersionHistoryCurrentCard) == null ? void 0 : a.top }, on: { backButtonClick: o.handleBack, close: function(u) {
|
|
7
8
|
return o.onboardingStore.close("versionHistoryOnboarding");
|
|
8
9
|
}, nextButtonClick: o.handleNext } }) : r._e();
|
|
9
|
-
},
|
|
10
|
+
}, p = [], _ = /* @__PURE__ */ l(
|
|
10
11
|
g,
|
|
11
12
|
c,
|
|
12
|
-
|
|
13
|
+
p,
|
|
13
14
|
!1,
|
|
14
15
|
null,
|
|
15
|
-
|
|
16
|
+
"9bdef600"
|
|
16
17
|
);
|
|
17
|
-
const
|
|
18
|
+
const y = _.exports;
|
|
18
19
|
export {
|
|
19
|
-
|
|
20
|
+
y as default
|
|
20
21
|
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { useConfig as C } from "./useConfig.js";
|
|
2
|
+
import { useToaster as D } from "./useToaster.js";
|
|
3
|
+
import { useTranslations as T } from "./useTranslations.js";
|
|
4
|
+
import { ToasterTypeOptions as g } from "../enums/toaster.js";
|
|
5
|
+
import { buildDynamicContentLookup as h, convertModuleDynamicContent as O } from "../utils/dynamicContentConverter.js";
|
|
6
|
+
import { flattenDynamicContentList as f } from "../utils/genericUtil.js";
|
|
7
|
+
const M = "dynamic-content.unresolved-attributes-on-drop", b = () => {
|
|
8
|
+
const { template: i, isFeatureEnabled: p } = C(), { showToaster: m } = D(), a = T();
|
|
9
|
+
return { handleModuleAdd: (n, o) => {
|
|
10
|
+
var s, c, l;
|
|
11
|
+
try {
|
|
12
|
+
if ((n == null ? void 0 : n.action) !== "ADD" && (n == null ? void 0 : n.action) !== "COPY")
|
|
13
|
+
return;
|
|
14
|
+
const e = h(f((s = i.value) == null ? void 0 : s.dynamicContentList));
|
|
15
|
+
if (e.size === 0)
|
|
16
|
+
return;
|
|
17
|
+
const t = (c = o == null ? void 0 : o.getTargetNode) == null ? void 0 : c.call(o), r = (l = t == null ? void 0 : t.getOuterHTML) == null ? void 0 : l.call(t);
|
|
18
|
+
if (!t || typeof r != "string")
|
|
19
|
+
return;
|
|
20
|
+
const { html: u, unresolved: y } = O(
|
|
21
|
+
r,
|
|
22
|
+
e,
|
|
23
|
+
p("liquidSyntax")
|
|
24
|
+
);
|
|
25
|
+
u !== r && o.modifyHtml(t).replaceWith(u), y.length > 0 && m({
|
|
26
|
+
type: g.Warning,
|
|
27
|
+
message: a(M)
|
|
28
|
+
});
|
|
29
|
+
} catch (e) {
|
|
30
|
+
console.error("Failed to repair dynamic content on module add:", e);
|
|
31
|
+
}
|
|
32
|
+
} };
|
|
33
|
+
};
|
|
34
|
+
export {
|
|
35
|
+
M as UNRESOLVED_DYNAMIC_CONTENT_ON_DROP_KEY,
|
|
36
|
+
b as useModuleDynamicContentRepair
|
|
37
|
+
};
|
|
@@ -1,17 +1,42 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { URLS as o, MERGE_TAGS as a } from "../enums/unsubscribe.js";
|
|
2
|
+
import { UNSUBSCRIBE_LINK_SELECTOR as i } from "../extensions/Blocks/Unsubscribe/utils/constants.js";
|
|
3
|
+
import { BASE_SAFE_URL_SCHEMES as u } from "../utils/urlSchemes.js";
|
|
4
|
+
const E = ["click", "auxclick"], d = [
|
|
5
|
+
...Object.values(a),
|
|
6
|
+
o.UNSUBSCRIBE_URL,
|
|
7
|
+
o.PREFERENCES_URL
|
|
8
|
+
], l = (e) => {
|
|
9
|
+
if (e.matches(i))
|
|
10
|
+
return !0;
|
|
11
|
+
const r = e.getAttribute("href") ?? "";
|
|
12
|
+
return d.some((t) => r.includes(t));
|
|
13
|
+
}, S = [...u, "tel:", "sms:"], f = (e) => {
|
|
14
|
+
const r = (e.getAttribute("href") ?? "").trim();
|
|
15
|
+
return r === "" || r.startsWith("#") || r.startsWith("{{") ? !1 : S.includes(e.protocol);
|
|
16
|
+
}, m = (e) => {
|
|
17
|
+
var t, n;
|
|
18
|
+
const r = (n = (t = e.target) == null ? void 0 : t.closest) == null ? void 0 : n.call(t, "a");
|
|
19
|
+
if (r) {
|
|
20
|
+
if (l(r) || !f(r)) {
|
|
21
|
+
e.preventDefault(), e.stopPropagation();
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
r.setAttribute("target", "_blank"), r.setAttribute("rel", "noopener noreferrer");
|
|
25
|
+
}
|
|
26
|
+
}, R = (e) => {
|
|
27
|
+
e.preventDefault(), e.stopPropagation();
|
|
28
|
+
}, s = /* @__PURE__ */ new WeakSet(), c = "guidoPreviewGuarded", g = () => ({ guardPreviewInteractions: (r) => {
|
|
4
29
|
try {
|
|
5
|
-
const
|
|
6
|
-
if (!
|
|
30
|
+
const t = r.contentDocument;
|
|
31
|
+
if (!t || s.has(t))
|
|
7
32
|
return;
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
});
|
|
11
|
-
} catch (
|
|
12
|
-
console.warn("[usePreviewInteractionGuard] Could not guard preview iframe:",
|
|
33
|
+
delete t.documentElement.dataset[c], E.forEach((n) => {
|
|
34
|
+
t.addEventListener(n, m, !0);
|
|
35
|
+
}), t.addEventListener("submit", R, !0), s.add(t), t.documentElement.dataset[c] = "true";
|
|
36
|
+
} catch (t) {
|
|
37
|
+
console.warn("[usePreviewInteractionGuard] Could not guard preview iframe:", t);
|
|
13
38
|
}
|
|
14
39
|
} });
|
|
15
40
|
export {
|
|
16
|
-
|
|
41
|
+
g as usePreviewInteractionGuard
|
|
17
42
|
};
|
|
@@ -1,111 +1,112 @@
|
|
|
1
|
-
import { BLOCK_ROOT_SELECTOR as
|
|
2
|
-
import { useRecommendationExtensionStore as
|
|
3
|
-
import { formatPrice as
|
|
4
|
-
|
|
1
|
+
import { BLOCK_ROOT_SELECTOR as f, CURRENCY_ATTR as A, CONTAINER_SELECTOR as O } from "../extensions/Blocks/Recommendation/constants/selectors.js";
|
|
2
|
+
import { useRecommendationExtensionStore as C } from "../extensions/Blocks/Recommendation/store/recommendation.js";
|
|
3
|
+
import { formatPrice as _ } from "../extensions/Blocks/Recommendation/utils/priceFormatter.js";
|
|
4
|
+
import { BASE_SAFE_URL_SCHEMES as R } from "../utils/urlSchemes.js";
|
|
5
|
+
const S = `${f}[recommendation-id]`, h = ".product-old-price", T = /\{\{(?:reco_)?(\d+_\d+_[a-zA-Z0-9_.]+)\}\}/g, b = new RegExp(
|
|
5
6
|
"\\{%\\s*if\\s+([\\s\\S]+?)\\s*%\\}([\\s\\S]*?)(?:\\{%\\s*else\\s*%\\}([\\s\\S]*?))?\\{%\\s*endif\\s*%\\}",
|
|
6
7
|
"g"
|
|
7
8
|
);
|
|
8
|
-
function
|
|
9
|
+
function L(e) {
|
|
9
10
|
return e.replaceAll("&", "&").replaceAll("<", "<").replaceAll(">", ">").replaceAll('"', """).replaceAll("'", "'");
|
|
10
11
|
}
|
|
11
|
-
function
|
|
12
|
-
var
|
|
13
|
-
const
|
|
14
|
-
return
|
|
12
|
+
function g(e) {
|
|
13
|
+
var c;
|
|
14
|
+
const i = (c = e.replace(/[\u0000-\u0020]+/g, "").toLowerCase().match(/^([a-z][a-z0-9+.-]*):/)) == null ? void 0 : c[1];
|
|
15
|
+
return i && !R.includes(`${i}:`) ? "" : e;
|
|
15
16
|
}
|
|
16
17
|
function N(e) {
|
|
17
|
-
const t = e.getAttribute(
|
|
18
|
+
const t = e.getAttribute(A.CURRENCY) || "USD", i = e.getAttribute(A.DECIMAL_SEPARATOR) || ".", c = e.getAttribute(A.THOUSAND_SEPARATOR) || ",";
|
|
18
19
|
return {
|
|
19
20
|
code: t,
|
|
20
|
-
symbol: e.getAttribute(
|
|
21
|
-
alignment: e.getAttribute(
|
|
22
|
-
decimalCount: parseInt(e.getAttribute(
|
|
23
|
-
decimalSeparator:
|
|
24
|
-
thousandSeparator:
|
|
21
|
+
symbol: e.getAttribute(A.SYMBOL) || t,
|
|
22
|
+
alignment: e.getAttribute(A.ALIGNMENT) === "0" ? "before" : "after",
|
|
23
|
+
decimalCount: parseInt(e.getAttribute(A.DECIMAL_COUNT) || "2") || 2,
|
|
24
|
+
decimalSeparator: i,
|
|
25
|
+
thousandSeparator: c
|
|
25
26
|
};
|
|
26
27
|
}
|
|
27
|
-
function
|
|
28
|
+
function E(e, t) {
|
|
28
29
|
return (e == null ? void 0 : e[t]) ?? Object.values(e ?? {})[0] ?? 0;
|
|
29
30
|
}
|
|
30
|
-
function
|
|
31
|
-
const
|
|
32
|
-
return
|
|
31
|
+
function $(e, t) {
|
|
32
|
+
const i = E(e.original_price, t), c = E(e.price, t), n = i > 0 ? Math.round((i - c) / i * 100) : 0;
|
|
33
|
+
return n > 0 ? `${n}%` : "0%";
|
|
33
34
|
}
|
|
34
|
-
function P(e, t,
|
|
35
|
-
|
|
36
|
-
const r = (m) => `${
|
|
37
|
-
e.set(r("name"),
|
|
38
|
-
e.set(r(`product_attribute.${m}`), String(
|
|
35
|
+
function P(e, t, i, c, n, a) {
|
|
36
|
+
c.forEach((o, s) => {
|
|
37
|
+
const r = (m) => `${i}_${s}_${m}`, u = _({ price: E(o.price, n.code), currency: n }), l = _({ price: E(o.original_price, n.code), currency: n }), d = $(o, n.code);
|
|
38
|
+
e.set(r("name"), o.name ?? ""), e.set(r("image_url"), g(o.image_url ?? "")), e.set(r("url"), g(o.url ?? "")), e.set(r("item_id"), o.item_id ?? ""), e.set(r("currency"), ""), e.set(r("price"), u), e.set(r("original_price"), l), e.set(r("discount"), d), e.set(r("omnibus_price"), l), e.set(r("omnibus_discount"), d), a && u === l && t.add(`${i}_${s}`), Object.entries(o.product_attributes ?? {}).forEach(([m, p]) => {
|
|
39
|
+
e.set(r(`product_attribute.${m}`), String(p)), e.set(r(m), String(p));
|
|
39
40
|
});
|
|
40
41
|
});
|
|
41
42
|
}
|
|
42
|
-
function
|
|
43
|
-
const
|
|
44
|
-
if (!
|
|
43
|
+
function z(e, t) {
|
|
44
|
+
const i = e.match(/^(.+?)\s*(!=|==)\s*"([^"]*)"$/);
|
|
45
|
+
if (!i)
|
|
45
46
|
return !0;
|
|
46
|
-
const [,
|
|
47
|
-
return
|
|
47
|
+
const [, c, n, a] = i, o = t.get(c.trim()) ?? "";
|
|
48
|
+
return n === "!=" ? o !== a : o === a;
|
|
48
49
|
}
|
|
49
|
-
function
|
|
50
|
+
function w(e, t) {
|
|
50
51
|
return e.replace(
|
|
51
|
-
|
|
52
|
-
(
|
|
52
|
+
b,
|
|
53
|
+
(i, c, n, a) => c.split(/\s+and\s+/).every((s) => z(s.trim(), t)) ? n : a ?? ""
|
|
53
54
|
);
|
|
54
55
|
}
|
|
55
|
-
function
|
|
56
|
+
function D(e) {
|
|
56
57
|
let t = e;
|
|
57
58
|
for (; t.children.length === 1; )
|
|
58
59
|
[t] = t.children;
|
|
59
60
|
return t;
|
|
60
61
|
}
|
|
61
|
-
function
|
|
62
|
-
var
|
|
62
|
+
function I(e, t) {
|
|
63
|
+
var o;
|
|
63
64
|
if (!t.size)
|
|
64
65
|
return e;
|
|
65
|
-
const
|
|
66
|
-
|
|
67
|
-
const r = Number(
|
|
66
|
+
const i = e.replaceAll("{%", "<!--{%").replaceAll("%}", "%}-->"), c = new DOMParser().parseFromString(i, "text/html");
|
|
67
|
+
c.querySelectorAll(S).forEach((s) => {
|
|
68
|
+
const r = Number(s.getAttribute("recommendation-id"));
|
|
68
69
|
if (!Number.isFinite(r))
|
|
69
70
|
return;
|
|
70
|
-
const u =
|
|
71
|
-
(u.length ? Array.from(u) : [
|
|
72
|
-
d.querySelectorAll(
|
|
73
|
-
t.has(`${r}_${
|
|
71
|
+
const u = s.querySelectorAll(O);
|
|
72
|
+
(u.length ? Array.from(u) : [s]).forEach((d) => {
|
|
73
|
+
d.querySelectorAll(h).forEach((m, p) => {
|
|
74
|
+
t.has(`${r}_${p}`) && (D(m).textContent = "");
|
|
74
75
|
});
|
|
75
76
|
});
|
|
76
77
|
});
|
|
77
|
-
const
|
|
78
|
-
return ((
|
|
79
|
-
` : "") +
|
|
78
|
+
const n = (o = e.match(/<!DOCTYPE[^>]*>/i)) == null ? void 0 : o[0];
|
|
79
|
+
return ((n ? `${n}
|
|
80
|
+
` : "") + c.documentElement.outerHTML).replaceAll("<!--{%", "{%").replaceAll("%}-->", "%}").replaceAll("<!--{%", "{%").replaceAll("%}-->", "%}");
|
|
80
81
|
}
|
|
81
|
-
function
|
|
82
|
+
function y(e) {
|
|
82
83
|
if (!e || !e.includes("recommendation-block-v2"))
|
|
83
84
|
return e;
|
|
84
|
-
const t =
|
|
85
|
-
if (
|
|
85
|
+
const t = C(), i = new DOMParser().parseFromString(e, "text/html"), c = Array.from(i.querySelectorAll(S)), n = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Set();
|
|
86
|
+
if (c.forEach((s) => {
|
|
86
87
|
var l;
|
|
87
|
-
const r = Number(
|
|
88
|
+
const r = Number(s.getAttribute("recommendation-id"));
|
|
88
89
|
if (!Number.isFinite(r))
|
|
89
90
|
return;
|
|
90
91
|
const u = ((l = t.blockStates[r]) == null ? void 0 : l.recommendationProducts) ?? [];
|
|
91
92
|
u.length && P(
|
|
92
|
-
|
|
93
|
+
n,
|
|
93
94
|
a,
|
|
94
95
|
r,
|
|
95
96
|
u,
|
|
96
|
-
N(
|
|
97
|
-
|
|
97
|
+
N(s),
|
|
98
|
+
s.getAttribute("hide-price") === "true"
|
|
98
99
|
);
|
|
99
|
-
}), !
|
|
100
|
+
}), !n.size)
|
|
100
101
|
return e;
|
|
101
|
-
let
|
|
102
|
-
return
|
|
103
|
-
|
|
104
|
-
(
|
|
105
|
-
),
|
|
102
|
+
let o = I(e, a);
|
|
103
|
+
return o = o.replace(
|
|
104
|
+
T,
|
|
105
|
+
(s, r) => n.has(r) ? L(n.get(r)) : s
|
|
106
|
+
), o = w(o, n), o;
|
|
106
107
|
}
|
|
107
|
-
const q = () => ({ substituteRecommendationPreview:
|
|
108
|
+
const q = () => ({ substituteRecommendationPreview: y });
|
|
108
109
|
export {
|
|
109
|
-
|
|
110
|
+
y as substituteRecommendationPreview,
|
|
110
111
|
q as useRecommendationPreview
|
|
111
112
|
};
|
|
@@ -1,44 +1,45 @@
|
|
|
1
|
-
import { useActionsApi as
|
|
2
|
-
import { useBlocksConfig as
|
|
3
|
-
import { useConfig as
|
|
4
|
-
import { useCustomInterfaceAppearance as
|
|
5
|
-
import { useFullStoryBridge as
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
import {
|
|
16
|
-
import
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
1
|
+
import { useActionsApi as x } from "./useActionsApi.js";
|
|
2
|
+
import { useBlocksConfig as O } from "./useBlocksConfig.js";
|
|
3
|
+
import { useConfig as q } from "./useConfig.js";
|
|
4
|
+
import { useCustomInterfaceAppearance as H } from "./useCustomInterfaceAppearance.js";
|
|
5
|
+
import { useFullStoryBridge as L } from "./useFullStoryBridge.js";
|
|
6
|
+
import { useModuleDynamicContentRepair as N } from "./useModuleDynamicContentRepair.js";
|
|
7
|
+
import { useStripoEventHandler as z } from "./useStripoEventHandler.js";
|
|
8
|
+
import { useStripoNotifications as $ } from "./useStripoNotifications.js";
|
|
9
|
+
import { useToaster as G } from "./useToaster.js";
|
|
10
|
+
import { localePatch as J } from "../config/i18n/index.js";
|
|
11
|
+
import { en as E } from "../config/i18n/en/index.js";
|
|
12
|
+
import { ToasterTypeOptions as X } from "../enums/toaster.js";
|
|
13
|
+
import { useStripoApi as j } from "../services/stripoApi.js";
|
|
14
|
+
import K from "../static/styles/customEditorStyle.css.js";
|
|
15
|
+
import { useEditorStore as w } from "../stores/editor.js";
|
|
16
|
+
import { buildMergeTagEntries as Q, flattenDynamicContentList as W } from "../utils/genericUtil.js";
|
|
17
|
+
import Y from "../package.json.js";
|
|
18
|
+
const he = (b, l) => {
|
|
19
|
+
const { features: c, template: u, isFeatureEnabled: m } = q(), { handleError: p, showToaster: k } = G(), { getToken: T, getCustomFonts: v, getSyncModulesStatus: B } = j(), { handleEvent: F } = z(), { handleModuleAdd: M } = N(), { getStripoBlocksConfig: A } = O(), { getStripoNotifications: V } = $(), _ = async (n, i = [], r = !1) => {
|
|
20
|
+
var S, y, h, C;
|
|
21
|
+
const e = w(), { html: f, css: a } = n, { baseBlocks: o, extensions: d } = await A(), g = ((S = c.value) == null ? void 0 : S.displayConditions) ?? !0, P = ((y = c.value) == null ? void 0 : y.modulesDisabled) ?? !1, I = ((h = u.value) == null ? void 0 : h.forceRecreate) ?? !1;
|
|
21
22
|
await window.UIEditor.initEditor(
|
|
22
23
|
document.querySelector("#guido-editor"),
|
|
23
24
|
{
|
|
24
|
-
metadata:
|
|
25
|
-
html:
|
|
25
|
+
metadata: b,
|
|
26
|
+
html: f,
|
|
26
27
|
css: a,
|
|
27
|
-
forceRecreate:
|
|
28
|
+
forceRecreate: I,
|
|
28
29
|
locale: "en",
|
|
29
30
|
undoButtonSelector: "#guido__undo-button",
|
|
30
31
|
redoButtonSelector: "#guido__redo-button",
|
|
31
32
|
mobileViewButtonSelector: ".guido__view-option-selection-mobile",
|
|
32
33
|
desktopViewButtonSelector: ".guido__view-option-selection-desktop",
|
|
33
34
|
codeEditorButtonSelector: "#guido__code-button",
|
|
34
|
-
customAppearanceMergetags: !
|
|
35
|
+
customAppearanceMergetags: !m("liquidSyntax"),
|
|
35
36
|
customAppearanceMergetagsBorderColor: "#f1f3fe",
|
|
36
37
|
customAppearanceMergetagsBackgroundColor: "#f1f3fe",
|
|
37
|
-
customViewStyles:
|
|
38
|
-
conditionsEnabled:
|
|
39
|
-
customConditionsEnabled:
|
|
38
|
+
customViewStyles: K,
|
|
39
|
+
conditionsEnabled: g,
|
|
40
|
+
customConditionsEnabled: g,
|
|
40
41
|
enableXSSSecurity: !0,
|
|
41
|
-
modulesDisabled:
|
|
42
|
+
modulesDisabled: P,
|
|
42
43
|
syncModulesEnabled: r,
|
|
43
44
|
messageSettingsEnabled: !0,
|
|
44
45
|
displayGmailAnnotations: !0,
|
|
@@ -48,7 +49,7 @@ const fo = (C, l) => {
|
|
|
48
49
|
selectElementAfterDrop: !0,
|
|
49
50
|
sameFontSizeForOutlook: !0,
|
|
50
51
|
allowedScriptSourceDomains: "https://email-static.useinsider.com https://edge.fullstory.com https://rs.fullstory.com",
|
|
51
|
-
...
|
|
52
|
+
...o ? { baseBlocks: o } : {},
|
|
52
53
|
editorFonts: {
|
|
53
54
|
showDefaultStandardFonts: !0,
|
|
54
55
|
showDefaultNotStandardFonts: !0,
|
|
@@ -56,43 +57,45 @@ const fo = (C, l) => {
|
|
|
56
57
|
},
|
|
57
58
|
mergeTags: [
|
|
58
59
|
{
|
|
59
|
-
entries:
|
|
60
|
+
entries: Q(
|
|
60
61
|
l.preselectedDynamicContentList,
|
|
61
|
-
u
|
|
62
|
+
W((C = u.value) == null ? void 0 : C.dynamicContentList),
|
|
63
|
+
m("liquidSyntax")
|
|
62
64
|
)
|
|
63
65
|
}
|
|
64
66
|
],
|
|
65
|
-
async onTokenRefreshRequest(
|
|
67
|
+
async onTokenRefreshRequest(t) {
|
|
66
68
|
try {
|
|
67
|
-
const
|
|
68
|
-
|
|
69
|
-
} catch (
|
|
70
|
-
|
|
69
|
+
const s = await T();
|
|
70
|
+
t(s);
|
|
71
|
+
} catch (s) {
|
|
72
|
+
p(s, "Failed to refresh token");
|
|
71
73
|
}
|
|
72
74
|
},
|
|
73
75
|
onTemplateLoaded() {
|
|
74
76
|
try {
|
|
75
|
-
const { importCss:
|
|
76
|
-
|
|
77
|
-
|
|
77
|
+
const { importCss: t } = H(), { activateCustomViewStyles: s, updateTimerInClonedTemplate: R } = x(), { injectFullStory: U } = L();
|
|
78
|
+
t(), s(), U(), R(), l.onReady(), e.isStripoInitialized = !0, e.loadingStatus = !1, setTimeout(() => {
|
|
79
|
+
e.hasChanges = !1;
|
|
78
80
|
}, 1e3);
|
|
79
|
-
} catch (
|
|
80
|
-
|
|
81
|
+
} catch (t) {
|
|
82
|
+
p(t, "Failed to load custom interface appearance");
|
|
81
83
|
}
|
|
82
84
|
},
|
|
83
|
-
onCodeEditorVisibilityChanged(
|
|
84
|
-
|
|
85
|
+
onCodeEditorVisibilityChanged(t) {
|
|
86
|
+
e.isCodeEditorOpen = t;
|
|
85
87
|
},
|
|
86
|
-
onEditorVisualModeChanged(
|
|
87
|
-
|
|
88
|
+
onEditorVisualModeChanged(t) {
|
|
89
|
+
e.editorVisualMode = t.toLowerCase();
|
|
88
90
|
},
|
|
89
|
-
onVersionHistoryVisibilityChanged(
|
|
90
|
-
|
|
91
|
+
onVersionHistoryVisibilityChanged(t) {
|
|
92
|
+
e.isVersionHistoryOpen = t;
|
|
91
93
|
},
|
|
92
94
|
onDataChanged() {
|
|
93
|
-
|
|
95
|
+
e.hasChanges = !0;
|
|
94
96
|
},
|
|
95
97
|
onEvent: F,
|
|
98
|
+
onModuleAdd: M,
|
|
96
99
|
notifications: V(),
|
|
97
100
|
ignoreClickOutsideSelectors: [
|
|
98
101
|
"#guido-dynamic-content-modal",
|
|
@@ -100,38 +103,38 @@ const fo = (C, l) => {
|
|
|
100
103
|
".in-drawer__container"
|
|
101
104
|
],
|
|
102
105
|
extensions: d,
|
|
103
|
-
localePatch:
|
|
106
|
+
localePatch: J
|
|
104
107
|
}
|
|
105
108
|
);
|
|
106
|
-
},
|
|
109
|
+
}, D = (n) => new Promise((i, r) => {
|
|
107
110
|
var d;
|
|
108
111
|
if (document.getElementById("UiEditorScript")) {
|
|
109
|
-
Promise.resolve(
|
|
112
|
+
Promise.resolve(n()).then(i, r);
|
|
110
113
|
return;
|
|
111
114
|
}
|
|
112
|
-
const
|
|
113
|
-
|
|
114
|
-
Promise.resolve(
|
|
115
|
-
},
|
|
115
|
+
const e = Y.guido, a = `https://email-static.useinsider.com/guido/${(d = e == null ? void 0 : e.stripo) == null ? void 0 : d.version}/UIEditor.js`, o = document.createElement("script");
|
|
116
|
+
o.id = "UiEditorScript", o.type = "module", o.src = a, o.onload = () => {
|
|
117
|
+
Promise.resolve(n()).then(i, r);
|
|
118
|
+
}, o.onerror = () => {
|
|
116
119
|
r(new Error(`Failed to load Stripo UIEditor script from S3: ${a}`));
|
|
117
|
-
}, document.body.appendChild(
|
|
120
|
+
}, document.body.appendChild(o);
|
|
118
121
|
});
|
|
119
|
-
return { initPlugin: async (
|
|
120
|
-
const i =
|
|
122
|
+
return { initPlugin: async (n) => {
|
|
123
|
+
const i = w();
|
|
121
124
|
try {
|
|
122
|
-
await
|
|
123
|
-
const [r,
|
|
124
|
-
|
|
125
|
+
await D(async () => {
|
|
126
|
+
const [r, e] = await Promise.all([
|
|
127
|
+
v(),
|
|
125
128
|
B()
|
|
126
129
|
]);
|
|
127
|
-
i.syncModulesEnabled =
|
|
130
|
+
i.syncModulesEnabled = e, await _(n, r, e);
|
|
128
131
|
});
|
|
129
132
|
} catch {
|
|
130
|
-
i.loadingStatus = !1,
|
|
131
|
-
type:
|
|
132
|
-
message:
|
|
133
|
+
i.loadingStatus = !1, k({
|
|
134
|
+
type: X.Error,
|
|
135
|
+
message: E["An error has occurred. Please report the error code to support."],
|
|
133
136
|
actionButton: {
|
|
134
|
-
text:
|
|
137
|
+
text: E["Reload page"],
|
|
135
138
|
onClick: () => window.location.reload()
|
|
136
139
|
}
|
|
137
140
|
});
|
|
@@ -139,5 +142,5 @@ const fo = (C, l) => {
|
|
|
139
142
|
} };
|
|
140
143
|
};
|
|
141
144
|
export {
|
|
142
|
-
|
|
145
|
+
he as useStripo
|
|
143
146
|
};
|
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
import { migrateCheckbox as
|
|
1
|
+
import { migrateCheckbox as t } from "./checkboxMigrator.js";
|
|
2
2
|
import { migrateCouponBlock as i } from "./couponBlockMigrator.js";
|
|
3
3
|
import { migrateItemsBlock as e } from "./itemsBlockMigrator.js";
|
|
4
4
|
import { migrateRadioButton as a } from "./radioButtonMigrator.js";
|
|
5
|
-
import { migrateRecommendation as
|
|
5
|
+
import { migrateRecommendation as c } from "./recommendationMigrator.js";
|
|
6
|
+
import { migrateSocialIcons as g } from "./socialIconMigrator.js";
|
|
6
7
|
import { migrateUnsubscribe as n } from "./unsubscribeMigrator.js";
|
|
7
|
-
const
|
|
8
|
-
let m =
|
|
9
|
-
return m =
|
|
8
|
+
const k = async (o, r = {}) => {
|
|
9
|
+
let m = o;
|
|
10
|
+
return m = t(m), m = a(m), m = await n(m), m = i(m), m = c(m, r), m = e(m), m = g(m), m;
|
|
10
11
|
};
|
|
11
12
|
export {
|
|
12
|
-
|
|
13
|
+
k as migrate
|
|
13
14
|
};
|