@useinsider/guido 3.21.2 → 3.22.0-beta.8345109
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/dist/components/organisms/unsubscribe/UnsubscribePageSelection.vue.js +5 -5
- package/dist/components/organisms/unsubscribe/UnsubscribePageSelection.vue2.js +9 -9
- package/dist/composables/useActionsApi.js +22 -21
- package/dist/composables/useFullStoryBridge.js +10 -9
- package/dist/composables/useSave.js +75 -68
- package/dist/composables/validators/useHtmlDocumentCountValidator.js +22 -0
- package/dist/config/migrator/fullStoryScriptMigrator.js +5 -0
- package/dist/config/migrator/index.js +11 -10
- package/dist/guido.css +1 -1
- package/dist/services/templateLibraryApi.js +36 -31
- package/dist/src/composables/validators/useHtmlDocumentCountValidator.d.ts +3 -0
- package/dist/src/config/migrator/fullStoryScriptMigrator.d.ts +1 -0
- package/dist/src/stores/unsubscribe.d.ts +10 -0
- package/dist/src/utils/fullStoryScripts.d.ts +6 -0
- package/dist/src/utils/templatePreparation.d.ts +2 -1
- package/dist/stores/unsubscribe.js +28 -24
- package/dist/utils/fullStoryScripts.js +8 -0
- package/dist/utils/pairProductVariables.js +98 -90
- package/dist/utils/templatePreparation.js +30 -30
- package/package.json +1 -1
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
import a from "./UnsubscribePageSelection.vue2.js";
|
|
2
2
|
/* empty css */
|
|
3
3
|
import n from "../../../_virtual/_plugin-vue2_normalizer.js";
|
|
4
|
-
var
|
|
4
|
+
var i = function() {
|
|
5
5
|
var r = this, e = r._self._c, t = r._self._setupProxy;
|
|
6
6
|
return e(t.WpDrawer, { attrs: { id: "unsubscribe-modal", "description-status": "", size: "large", "footer-button-group-options": t.footerButtonGroupOptions, status: t.unsubscribeStore.pageSelectionDrawerStatus, "title-text": t.trans("newsletter.select-a-template") }, on: { cancelOrBackButtonEvent: t.handleBack, onCloseEvent: t.handleClose, primaryButtonEvent: t.handleSave }, scopedSlots: r._u([{ key: "headerBottomSlot", fn: function() {
|
|
7
7
|
return [e(t.UnsubscribeBreadcrumb, { staticClass: "px-5 py-3" })];
|
|
8
8
|
}, proxy: !0 }]) }, [e("div", { staticClass: "d-g templates-wrapper" }, r._l(t.unsubscribeStore.getTemplatesByActiveType, function(s) {
|
|
9
9
|
return e("div", { key: s.id, staticClass: "template-wrapper", on: { click: function(u) {
|
|
10
10
|
return t.selectTemplate(s.id);
|
|
11
|
-
} } }, [e(t.InContainer, { staticClass: "template-container o-h", class: { selected: t.unsubscribeStore.getSelectedTemplateByActiveType === s.id }, attrs: { border: t.getBorderClass(s.id) } }, [e("div", { staticClass: "w-1 h-1 d-f j-c-c a-i-c" }, [e("img", { staticClass: "w-1 h-1 thumbnail o-h", attrs: { alt: s.name, src: s.thumbnail } })])]), e("div", { staticClass: "mt-1 f-s-1" }, [r._v(" " + r._s(s.name) + " ")])], 1);
|
|
11
|
+
} } }, [e(t.InContainer, { staticClass: "template-container o-h p-r", class: { selected: t.unsubscribeStore.getSelectedTemplateByActiveType === s.id }, attrs: { border: t.getBorderClass(s.id) } }, [e("div", { staticClass: "w-1 h-1 d-f j-c-c a-i-c" }, [e("img", { staticClass: "w-1 h-1 thumbnail o-h", attrs: { alt: s.name, src: s.thumbnail } })]), s.isDefault ? e(t.InChips, { staticClass: "default-chip p-a", attrs: { id: "guido__unsubscribe-default-chip", styles: "stroke", type: "neutral", value: "default", "close-button": !1, interactive: !1, text: t.trans("unsubscription-preference.default") } }) : r._e()], 1), e("div", { staticClass: "mt-1 f-s-1" }, [r._v(" " + r._s(s.name) + " ")])], 1);
|
|
12
12
|
}), 0)]);
|
|
13
|
-
},
|
|
13
|
+
}, o = [], c = /* @__PURE__ */ n(
|
|
14
14
|
a,
|
|
15
|
-
o,
|
|
16
15
|
i,
|
|
16
|
+
o,
|
|
17
17
|
!1,
|
|
18
18
|
null,
|
|
19
|
-
"
|
|
19
|
+
"6750a053"
|
|
20
20
|
);
|
|
21
21
|
const _ = c.exports;
|
|
22
22
|
export {
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { defineComponent as y, ref as T, computed as a, watch as v } from "vue";
|
|
2
2
|
import w from "../../wrappers/WpDrawer.vue.js";
|
|
3
|
-
import { useToaster as
|
|
4
|
-
import { useTranslations as
|
|
3
|
+
import { useToaster as C } from "../../../composables/useToaster.js";
|
|
4
|
+
import { useTranslations as B } from "../../../composables/useTranslations.js";
|
|
5
5
|
import { ToasterTypeOptions as h } from "../../../enums/toaster.js";
|
|
6
6
|
import { useEditorStore as P } from "../../../stores/editor.js";
|
|
7
7
|
import { useUnsubscribeStore as U } from "../../../stores/unsubscribe.js";
|
|
8
|
-
import { InContainer as _ } from "@useinsider/design-system-vue";
|
|
9
|
-
import
|
|
10
|
-
const
|
|
8
|
+
import { InContainer as I, InChips as _ } from "@useinsider/design-system-vue";
|
|
9
|
+
import x from "./UnsubscribeBreadcrumb.vue.js";
|
|
10
|
+
const W = /* @__PURE__ */ y({
|
|
11
11
|
__name: "UnsubscribePageSelection",
|
|
12
|
-
setup(
|
|
13
|
-
const s =
|
|
12
|
+
setup(A) {
|
|
13
|
+
const s = B(), e = U(), r = P(), { showToaster: c } = C(), o = T(!1), i = a(() => e.isActiveTypeLastInCollection ? o.value ? s("unsubscription-preference.applying-changes") : s("statistics.apply") : s("products.select-and-continue")), l = a(() => e.pageSelectionUpdateStatus && e.isActiveTypeFirstInCollection ? s("products.cancel") : s("newsletter.back")), p = a(() => ({
|
|
14
14
|
primaryButton: {
|
|
15
15
|
styling: "solid",
|
|
16
16
|
type: "primary",
|
|
@@ -63,9 +63,9 @@ const N = /* @__PURE__ */ y({
|
|
|
63
63
|
};
|
|
64
64
|
return v(() => e.pageSelectionDrawerStatus, (t) => {
|
|
65
65
|
t && e.pageSelectionUpdateStatus && e.fetchTemplates();
|
|
66
|
-
}), { __sfc: !0, trans: s, unsubscribeStore: e, editorStore: r, showToaster: c, isApplying: o, getPrimaryButtonText: i, getCancelOrBackButtonText: l, footerButtonGroupOptions: p, getBorderClass: d, closeModal: n, handleClose: m, handleBack: b, handleSave: f, selectTemplate: g, WpDrawer: w,
|
|
66
|
+
}), { __sfc: !0, trans: s, unsubscribeStore: e, editorStore: r, showToaster: c, isApplying: o, getPrimaryButtonText: i, getCancelOrBackButtonText: l, footerButtonGroupOptions: p, getBorderClass: d, closeModal: n, handleClose: m, handleBack: b, handleSave: f, selectTemplate: g, WpDrawer: w, InChips: _, InContainer: I, UnsubscribeBreadcrumb: x };
|
|
67
67
|
}
|
|
68
68
|
});
|
|
69
69
|
export {
|
|
70
|
-
|
|
70
|
+
W as default
|
|
71
71
|
};
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { filterAmpErrors as
|
|
2
|
-
import {
|
|
1
|
+
import { filterAmpErrors as v } from "../utils/ampErrorFilter.js";
|
|
2
|
+
import { stripFullStoryScripts as h } from "../utils/fullStoryScripts.js";
|
|
3
|
+
import { getEditorApi as r } from "../utils/stripoEditorApi.js";
|
|
3
4
|
import { useToaster as D } from "./useToaster.js";
|
|
4
|
-
const
|
|
5
|
+
const H = 1e4, T = 3e4, m = (n, l, A) => new Promise((C, p) => {
|
|
5
6
|
const f = setTimeout(
|
|
6
7
|
() => p(new Error(`${n} did not report completion within ${l}ms`)),
|
|
7
8
|
l
|
|
@@ -13,8 +14,8 @@ const h = 1e4, T = 3e4, r = (n, l, A) => new Promise((C, p) => {
|
|
|
13
14
|
} catch (t) {
|
|
14
15
|
d(t);
|
|
15
16
|
}
|
|
16
|
-
}),
|
|
17
|
-
const { handleError: n } = D(), l = (t = {}) =>
|
|
17
|
+
}), _ = () => {
|
|
18
|
+
const { handleError: n } = D(), l = (t = {}) => m(
|
|
18
19
|
"compileEmail",
|
|
19
20
|
T,
|
|
20
21
|
(e, i) => {
|
|
@@ -38,38 +39,38 @@ const h = 1e4, T = 3e4, r = (n, l, A) => new Promise((C, p) => {
|
|
|
38
39
|
resetDataSavedFlag: !1,
|
|
39
40
|
disableLineHeightsReplace: !0
|
|
40
41
|
}, ...t }, u = {
|
|
41
|
-
callback: (
|
|
42
|
-
|
|
42
|
+
callback: (s, g, w, S, y) => {
|
|
43
|
+
s ? i(s) : e({
|
|
43
44
|
html: g,
|
|
44
45
|
ampHtml: w,
|
|
45
|
-
ampErrors:
|
|
46
|
-
displayConditions:
|
|
46
|
+
ampErrors: v(S ?? []),
|
|
47
|
+
displayConditions: y
|
|
47
48
|
});
|
|
48
49
|
},
|
|
49
50
|
...o
|
|
50
51
|
};
|
|
51
|
-
|
|
52
|
+
r().actionsApi.compileEmail(u);
|
|
52
53
|
}
|
|
53
54
|
);
|
|
54
55
|
return {
|
|
55
56
|
getCompiledEmail: l,
|
|
56
|
-
getTemplateData: () =>
|
|
57
|
+
getTemplateData: () => m(
|
|
57
58
|
"getTemplateData",
|
|
58
59
|
T,
|
|
59
60
|
(t) => {
|
|
60
|
-
const e = ({ html: i, css: a, width: o, height: E, utmParams: u, syncModulesIds:
|
|
61
|
-
html: i,
|
|
61
|
+
const e = ({ html: i, css: a, width: o, height: E, utmParams: u, syncModulesIds: s }) => t({
|
|
62
|
+
html: h(i),
|
|
62
63
|
css: a,
|
|
63
64
|
width: o,
|
|
64
65
|
height: E,
|
|
65
66
|
utmParams: u,
|
|
66
|
-
syncModulesIds:
|
|
67
|
+
syncModulesIds: s
|
|
67
68
|
});
|
|
68
|
-
|
|
69
|
+
r().actionsApi.getTemplateData(e);
|
|
69
70
|
}
|
|
70
71
|
),
|
|
71
72
|
activateCustomViewStyles: (t = !0) => {
|
|
72
|
-
|
|
73
|
+
r().actionsApi.activateCustomViewStyles(t);
|
|
73
74
|
},
|
|
74
75
|
getPreviewData: async (t) => {
|
|
75
76
|
try {
|
|
@@ -109,16 +110,16 @@ const h = 1e4, T = 3e4, r = (n, l, A) => new Promise((C, p) => {
|
|
|
109
110
|
}
|
|
110
111
|
}),
|
|
111
112
|
updateHtmlAndCss: (t, e) => {
|
|
112
|
-
const { actionsApi: i } =
|
|
113
|
-
return
|
|
113
|
+
const { actionsApi: i } = r();
|
|
114
|
+
return m("updateHtmlAndCss", H, (a) => {
|
|
114
115
|
i.updateHtmlAndCss(t, e, () => a());
|
|
115
116
|
});
|
|
116
117
|
},
|
|
117
|
-
editorSave: () =>
|
|
118
|
+
editorSave: () => m(
|
|
118
119
|
"save",
|
|
119
120
|
T,
|
|
120
121
|
(t) => {
|
|
121
|
-
|
|
122
|
+
r().actionsApi.save((e) => {
|
|
122
123
|
if (e) {
|
|
123
124
|
n(e, "Failed to save template"), t(!1);
|
|
124
125
|
return;
|
|
@@ -130,5 +131,5 @@ const h = 1e4, T = 3e4, r = (n, l, A) => new Promise((C, p) => {
|
|
|
130
131
|
};
|
|
131
132
|
};
|
|
132
133
|
export {
|
|
133
|
-
|
|
134
|
+
_ as useActionsApi
|
|
134
135
|
};
|
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { FULLSTORY_BRIDGE_SCRIPT_URL as s } from "../utils/fullStoryScripts.js";
|
|
2
|
+
const l = () => ({ injectFullStory: () => {
|
|
3
|
+
var c;
|
|
4
|
+
const n = window;
|
|
5
|
+
if (typeof n._fs_org != "string" || !n._fs_org)
|
|
5
6
|
return;
|
|
6
|
-
const
|
|
7
|
-
if (!
|
|
7
|
+
const e = document.querySelector("ui-editor"), o = (c = e == null ? void 0 : e.shadowRoot) == null ? void 0 : c.querySelector("iframe"), r = o == null ? void 0 : o.contentDocument;
|
|
8
|
+
if (!r || r.querySelector('script[data-fullstory-bridge="true"]'))
|
|
8
9
|
return;
|
|
9
|
-
const t =
|
|
10
|
-
t.src =
|
|
10
|
+
const t = r.createElement("script");
|
|
11
|
+
t.src = s, t.async = !0, t.crossOrigin = "anonymous", t.dataset.fullstoryBridge = "true", r.head.appendChild(t);
|
|
11
12
|
} });
|
|
12
13
|
export {
|
|
13
|
-
|
|
14
|
+
l as useFullStoryBridge
|
|
14
15
|
};
|
|
@@ -1,84 +1,91 @@
|
|
|
1
|
-
import { useActionsApi as
|
|
2
|
-
import { useConfig as
|
|
3
|
-
import { useEditorLock as
|
|
4
|
-
import { useSaveStart as
|
|
5
|
-
import { useSaveValidation as
|
|
6
|
-
import { useSaveValidationRollout as
|
|
7
|
-
import { useSyncModuleExtractor as
|
|
8
|
-
import { ToasterTypeOptions as
|
|
9
|
-
import { useStripoApi as
|
|
10
|
-
import { useConfigStore as
|
|
11
|
-
import { useDynamicContentStore as
|
|
12
|
-
import { useSaveValidationStore as
|
|
13
|
-
import { useTemplatePreparation as
|
|
14
|
-
import { useAllowlist as
|
|
15
|
-
import { useHtmlValidator as
|
|
16
|
-
import { useToaster as
|
|
17
|
-
import { useCouponBlockValidator as
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
1
|
+
import { useActionsApi as q } from "./useActionsApi.js";
|
|
2
|
+
import { useConfig as O } from "./useConfig.js";
|
|
3
|
+
import { useEditorLock as D } from "./useEditorLock.js";
|
|
4
|
+
import { useSaveStart as F, useSaveComplete as j } from "./useGuidoActions.js";
|
|
5
|
+
import { useSaveValidation as z } from "./useSaveValidation.js";
|
|
6
|
+
import { useSaveValidationRollout as G } from "./useSaveValidationRollout.js";
|
|
7
|
+
import { useSyncModuleExtractor as I } from "./useSyncModuleExtractor.js";
|
|
8
|
+
import { ToasterTypeOptions as J } from "../enums/toaster.js";
|
|
9
|
+
import { useStripoApi as K } from "../services/stripoApi.js";
|
|
10
|
+
import { useConfigStore as N } from "../stores/config.js";
|
|
11
|
+
import { useDynamicContentStore as Q } from "../stores/dynamic-content.js";
|
|
12
|
+
import { useSaveValidationStore as X } from "../stores/save-validation.js";
|
|
13
|
+
import { useTemplatePreparation as Y, getHtmlReferencedUnsubscribePages as Z } from "../utils/templatePreparation.js";
|
|
14
|
+
import { useAllowlist as _ } from "./useAllowlist.js";
|
|
15
|
+
import { useHtmlValidator as $ } from "./useHtmlValidator.js";
|
|
16
|
+
import { useToaster as tt } from "./useToaster.js";
|
|
17
|
+
import { useCouponBlockValidator as et } from "./validators/useCouponBlockValidator.js";
|
|
18
|
+
import { useHtmlDocumentCountValidator as ot } from "./validators/useHtmlDocumentCountValidator.js";
|
|
19
|
+
import { useLiquidValidator as it } from "./validators/useLiquidValidator.js";
|
|
20
|
+
import { useSyncModuleBlockValidator as st } from "./validators/useSyncModuleBlockValidator.js";
|
|
21
|
+
import { useUnsubscribeBlockValidator as at } from "./validators/useUnsubscribeBlockValidator.js";
|
|
22
|
+
const Pt = () => {
|
|
23
|
+
const n = F(), w = j(), { validateHtml: y } = $(), { validateLiquidSyntax: E } = it(), { validateCouponBlockTags: b } = et(), { validateUnsubscribeBlockUniqueness: g, validateUnsubscribeBlockHasTemplate: H } = at(), { validateSyncModuleBlocks: l } = st(), { validateSingleHtmlDocument: c } = ot(), { callbacks: r, isFeatureEnabled: v } = O(), { extractSyncModuleData: V } = I(), { setSyncModuleUnsubscriptionPages: x } = K(), { editorSave: C, getTemplateData: u } = q(), { showToaster: k } = tt(), { getBlockedDomains: h, resolveToast: B } = _(), { prepareTemplateDetails: p } = Y(), { collectSaveValidationErrors: T } = z(), { isEnabled: P } = G(), L = X(), U = Q(), S = N(), { runExclusive: m } = D(), d = async (t, e, i) => {
|
|
24
|
+
if (!v("allowlistEnabled"))
|
|
24
25
|
return !1;
|
|
25
|
-
const
|
|
26
|
-
if (!
|
|
26
|
+
const o = await h(t, e);
|
|
27
|
+
if (!o.length)
|
|
27
28
|
return !1;
|
|
28
|
-
if (!
|
|
29
|
-
const s = await
|
|
30
|
-
s != null && s.message &&
|
|
31
|
-
type:
|
|
29
|
+
if (!i) {
|
|
30
|
+
const s = await B(o);
|
|
31
|
+
s != null && s.message && k({
|
|
32
|
+
type: J.Warning,
|
|
32
33
|
message: s.message,
|
|
33
34
|
actionButton: s.actionButton
|
|
34
35
|
});
|
|
35
36
|
}
|
|
36
37
|
return !0;
|
|
37
|
-
},
|
|
38
|
-
if (!await
|
|
38
|
+
}, A = async (t) => !b(t.compiledHtml) || !g(t.compiledHtml) || !H(t.compiledHtml) ? !1 : v("liquidSyntax") ? E(t.compiledHtml) : y(t.compiledHtml, t.dynamicContentList, !0), f = async (t, e) => {
|
|
39
|
+
if (!await C())
|
|
39
40
|
return;
|
|
40
|
-
const { unsubscribePayload:
|
|
41
|
-
if (await
|
|
42
|
-
const
|
|
43
|
-
|
|
41
|
+
const { unsubscribePayload: o, stripoModules: s } = V(t.rawHtml);
|
|
42
|
+
if (await x(o), t.modules = s, !e.suppress) {
|
|
43
|
+
const a = e.blankCompiled ? { compiledHtml: "", ampHtml: "" } : {};
|
|
44
|
+
w({ ...t, ...a, silent: e.silent });
|
|
44
45
|
}
|
|
45
46
|
return t;
|
|
46
|
-
},
|
|
47
|
-
var
|
|
48
|
-
|
|
49
|
-
const
|
|
50
|
-
if (
|
|
51
|
-
|
|
52
|
-
|
|
47
|
+
}, M = async (t, e) => {
|
|
48
|
+
var s;
|
|
49
|
+
n();
|
|
50
|
+
const i = await u();
|
|
51
|
+
if (!c(i.html, e))
|
|
52
|
+
return;
|
|
53
|
+
const o = await p(i);
|
|
54
|
+
if (l(o.rawHtml, e)) {
|
|
55
|
+
if (P.value && !e) {
|
|
56
|
+
const a = await T(
|
|
53
57
|
o.compiledHtml,
|
|
54
58
|
o.dynamicContentList
|
|
55
59
|
);
|
|
56
|
-
if (
|
|
57
|
-
|
|
60
|
+
if (a.length) {
|
|
61
|
+
L.open(a, "save");
|
|
58
62
|
return;
|
|
59
63
|
}
|
|
60
|
-
} else if (!await
|
|
64
|
+
} else if (!await A(o))
|
|
61
65
|
return;
|
|
62
|
-
if (!((
|
|
63
|
-
return
|
|
66
|
+
if (!((s = r.value) != null && s.externalValidation && !await r.value.externalValidation(o)) && !await d(o.compiledHtml, o.css, e))
|
|
67
|
+
return f(o, { silent: e, suppress: t });
|
|
64
68
|
}
|
|
65
|
-
},
|
|
66
|
-
var
|
|
67
|
-
if (!
|
|
69
|
+
}, W = async () => {
|
|
70
|
+
var i;
|
|
71
|
+
if (!S.allowSaveWithErrors)
|
|
72
|
+
return;
|
|
73
|
+
n();
|
|
74
|
+
const t = await u();
|
|
75
|
+
if (!c(t.html, !1))
|
|
68
76
|
return;
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
if (!f.allowSaveWithErrors)
|
|
77
|
+
const e = await p(t);
|
|
78
|
+
if (l(e.rawHtml, !1) && !((i = r.value) != null && i.externalValidation && !await r.value.externalValidation(e)) && !await d(e.compiledHtml, e.css, !1))
|
|
79
|
+
return f(e, { silent: !1, blankCompiled: !0 });
|
|
80
|
+
}, R = async () => {
|
|
81
|
+
if (!S.allowSaveWithErrors)
|
|
75
82
|
return;
|
|
76
|
-
|
|
77
|
-
const { html: t, css: e } = await
|
|
78
|
-
if (!
|
|
83
|
+
n();
|
|
84
|
+
const { html: t, css: e } = await u();
|
|
85
|
+
if (!c(t, !0) || !l(t, !0) || await d(t, e, !0))
|
|
79
86
|
return;
|
|
80
|
-
const
|
|
81
|
-
dynamicContentList:
|
|
87
|
+
const i = Z(t), o = {
|
|
88
|
+
dynamicContentList: U.getSelectedDynamicContentList,
|
|
82
89
|
compiledHtml: "",
|
|
83
90
|
rawHtml: t,
|
|
84
91
|
css: e,
|
|
@@ -88,16 +95,16 @@ const Bt = () => {
|
|
|
88
95
|
// No campaignUrls: hosts overwrite their stored map with any object, and raw HTML can't rebuild it.
|
|
89
96
|
recommendation: { configs: {} },
|
|
90
97
|
unsubscribe: {
|
|
91
|
-
status:
|
|
92
|
-
config:
|
|
98
|
+
status: i.length > 0,
|
|
99
|
+
config: i
|
|
93
100
|
}
|
|
94
101
|
};
|
|
95
|
-
return
|
|
102
|
+
return f(o, { silent: !0 });
|
|
96
103
|
};
|
|
97
|
-
return { save: (t = !1, e = !1) =>
|
|
98
|
-
() =>
|
|
99
|
-
), saveWithErrors: () =>
|
|
104
|
+
return { save: (t = !1, e = !1) => m(
|
|
105
|
+
() => M(t, e)
|
|
106
|
+
), saveWithErrors: () => m(W), saveRawOnly: () => m(R) };
|
|
100
107
|
};
|
|
101
108
|
export {
|
|
102
|
-
|
|
109
|
+
Pt as useSave
|
|
103
110
|
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { useToaster as i } from "../useToaster.js";
|
|
2
|
+
import { useTranslations as m } from "../useTranslations.js";
|
|
3
|
+
import { ToasterTypeOptions as c } from "../../enums/toaster.js";
|
|
4
|
+
const u = "newsletter.multiple-html-designs-detected", r = `(?:[^>"']|"[^"]*"|'[^']*')*`, a = "style|script|noscript|xmp|iframe|noembed|noframes|textarea|title", T = /<html(?=[\s>/])/gi, A = new RegExp(
|
|
5
|
+
`<!--[\\s\\S]*?-->|<!\\[CDATA\\[[\\s\\S]*?\\]\\]>|<(${a})(?=[\\s/>])${r}>[\\s\\S]*?</\\1\\s*>|<([a-zA-Z][\\w:-]*)${r}>`,
|
|
6
|
+
"gi"
|
|
7
|
+
), p = (e) => Array.from(e.matchAll(A)).filter(([, , t]) => (t == null ? void 0 : t.toLowerCase()) === "html").length, g = () => {
|
|
8
|
+
const { showToaster: e } = i(), t = m();
|
|
9
|
+
return { validateSingleHtmlDocument: (o, l = !1) => {
|
|
10
|
+
var n;
|
|
11
|
+
if ((((n = o.match(T)) == null ? void 0 : n.length) ?? 0) < 2)
|
|
12
|
+
return !0;
|
|
13
|
+
const s = p(o);
|
|
14
|
+
return s <= 1 ? !0 : (console.debug("guido:save:blocked", { reason: "multiple-html-documents", htmlRootCount: s }), l || e({
|
|
15
|
+
type: c.Warning,
|
|
16
|
+
message: t(u)
|
|
17
|
+
}), !1);
|
|
18
|
+
} };
|
|
19
|
+
};
|
|
20
|
+
export {
|
|
21
|
+
g as useHtmlDocumentCountValidator
|
|
22
|
+
};
|
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
import { migrateCheckbox as i } from "./checkboxMigrator.js";
|
|
2
2
|
import { migrateCouponBlock as e } from "./couponBlockMigrator.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
3
|
+
import { migrateFullStoryScripts as a } from "./fullStoryScriptMigrator.js";
|
|
4
|
+
import { migrateItemsBlock as n } from "./itemsBlockMigrator.js";
|
|
5
|
+
import { migrateProductNameLink as c } from "./productNameLinkMigrator.js";
|
|
6
|
+
import { migrateRadioButton as g } from "./radioButtonMigrator.js";
|
|
7
|
+
import { migrateRecommendation as p } from "./recommendationMigrator.js";
|
|
7
8
|
import { migrateRecommendationPartnerScope as f } from "./recommendationPartnerMigrator.js";
|
|
8
|
-
import { migrateRecommendationTitle as
|
|
9
|
-
import { migrateSocialIcons as
|
|
10
|
-
import { migrateUnsubscribe as
|
|
11
|
-
const h = async (
|
|
12
|
-
let m =
|
|
13
|
-
return m = i(m), m =
|
|
9
|
+
import { migrateRecommendationTitle as l } from "./recommendationTitleMigrator.js";
|
|
10
|
+
import { migrateSocialIcons as s } from "./socialIconMigrator.js";
|
|
11
|
+
import { migrateUnsubscribe as d } from "./unsubscribeMigrator.js";
|
|
12
|
+
const h = async (o, t = {}, r) => {
|
|
13
|
+
let m = o;
|
|
14
|
+
return m = i(m), m = g(m), m = await d(m), m = e(m), m = p(m, t), r && (m = f(m, r)), m = l(m), m = n(m), m = c(m), m = s(m), m = a(m), m;
|
|
14
15
|
};
|
|
15
16
|
export {
|
|
16
17
|
h as migrate
|
package/dist/guido.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
@charset "UTF-8";.auth-error-modal[data-v-b4d7ae51]{position:relative;z-index:145}.gap-16[data-v-5553d071],.gap-16[data-v-0e1b0c54]{gap:16px}[data-v-b8f24f34] .in-button-v2__wrapper{line-height:0}[data-v-22226124] .in-segments-wrapper__button_selected,[data-v-22226124] .in-segments-wrapper__button_selected:hover{background-color:#dae1fb;color:#0010ac;border-color:#0010ac}[data-v-2cb418af] .in-progress-wrapper__progress p span:last-child{display:none!important}[data-v-2cb418af] .in-progress-description-status{display:none!important}.view-options-wrapper[data-v-87033101]{position:relative;display:inline-block}.new-tag[data-v-87033101]{position:absolute;top:-8px;right:-16px;z-index:10}[data-v-87033101] .guido__view-option-selection-desktop svg,[data-v-87033101] .guido__view-option-selection-mobile svg{margin:0 0 0 2px}[data-v-87033101] .in-segments-wrapper__button_selected,[data-v-87033101] .in-segments-wrapper__button_selected:hover{background-color:#dae1fb}[data-v-87033101] .in-tooltip-wrapper-v2__icon{cursor:pointer}.editor-toolbar[data-v-173c3a40]{gap:4px}.version-history-item[data-v-ee4b9c3f]{flex-basis:200px}.version-history[data-v-fad98586]{gap:8px}.version-history__toolbar[data-v-fad98586]{gap:4px}.view-options-wrapper[data-v-6ebabfe4]{position:relative;display:inline-block}.new-tag[data-v-6ebabfe4]{position:absolute;top:-8px;right:-16px;z-index:10}[data-v-6ebabfe4] .guido__verion-history-view-option-selection-desktop svg,[data-v-6ebabfe4] .guido__verion-history-view-option-selection-mobile svg{margin:0 0 0 2px}[data-v-6ebabfe4] .in-segments-wrapper__button_selected,[data-v-6ebabfe4] .in-segments-wrapper__button_selected:hover{background-color:#dae1fb}[data-v-6ebabfe4] .in-tooltip-wrapper-v2__icon{cursor:pointer}.auto-save-toggle[data-v-2c964af4]{position:relative}.auto-save-toggle__info-box[data-v-2c964af4]{position:absolute;top:100%;left:0;z-index:10;width:280px}.editor-actions[data-v-baf7a5dd]{gap:4px}.header-wrapper[data-v-d11dd577]{min-width:1000px}.guido-loading__wrapper[data-v-07c4b2d8]{height:100%;top:75px!important;bottom:0!important}.validation-error-list[data-v-e48cebe9]{gap:16px}.validation-error-row[data-v-e48cebe9]{gap:8px;padding:24px;border:1px solid #E1E1E1;border-radius:8px}.validation-error-row__icon[data-v-e48cebe9]{flex-shrink:0;font-size:24px;line-height:0}.validation-error-row__text[data-v-e48cebe9]{font-size:13px;line-height:16px;color:#292929;word-break:break-word}.guido-editor__wrapper[data-v-c5146fc5]{--ribbon-offset: 0px;position:relative;width:100%;height:calc(100vh - 128px - var(--ribbon-offset))}.guido-editor__container[data-v-c5146fc5]{width:100%;height:calc(100vh - 128px - var(--ribbon-offset))}.guido-editor__no-header[data-v-c5146fc5]{height:calc(100vh - 75px - var(--ribbon-offset))}[data-v-293f1c47] .in-breadcrumb-wrapper__links{cursor:pointer}.templates-wrapper[data-v-
|
|
1
|
+
@charset "UTF-8";.auth-error-modal[data-v-b4d7ae51]{position:relative;z-index:145}.gap-16[data-v-5553d071],.gap-16[data-v-0e1b0c54]{gap:16px}[data-v-b8f24f34] .in-button-v2__wrapper{line-height:0}[data-v-22226124] .in-segments-wrapper__button_selected,[data-v-22226124] .in-segments-wrapper__button_selected:hover{background-color:#dae1fb;color:#0010ac;border-color:#0010ac}[data-v-2cb418af] .in-progress-wrapper__progress p span:last-child{display:none!important}[data-v-2cb418af] .in-progress-description-status{display:none!important}.view-options-wrapper[data-v-87033101]{position:relative;display:inline-block}.new-tag[data-v-87033101]{position:absolute;top:-8px;right:-16px;z-index:10}[data-v-87033101] .guido__view-option-selection-desktop svg,[data-v-87033101] .guido__view-option-selection-mobile svg{margin:0 0 0 2px}[data-v-87033101] .in-segments-wrapper__button_selected,[data-v-87033101] .in-segments-wrapper__button_selected:hover{background-color:#dae1fb}[data-v-87033101] .in-tooltip-wrapper-v2__icon{cursor:pointer}.editor-toolbar[data-v-173c3a40]{gap:4px}.version-history-item[data-v-ee4b9c3f]{flex-basis:200px}.version-history[data-v-fad98586]{gap:8px}.version-history__toolbar[data-v-fad98586]{gap:4px}.view-options-wrapper[data-v-6ebabfe4]{position:relative;display:inline-block}.new-tag[data-v-6ebabfe4]{position:absolute;top:-8px;right:-16px;z-index:10}[data-v-6ebabfe4] .guido__verion-history-view-option-selection-desktop svg,[data-v-6ebabfe4] .guido__verion-history-view-option-selection-mobile svg{margin:0 0 0 2px}[data-v-6ebabfe4] .in-segments-wrapper__button_selected,[data-v-6ebabfe4] .in-segments-wrapper__button_selected:hover{background-color:#dae1fb}[data-v-6ebabfe4] .in-tooltip-wrapper-v2__icon{cursor:pointer}.auto-save-toggle[data-v-2c964af4]{position:relative}.auto-save-toggle__info-box[data-v-2c964af4]{position:absolute;top:100%;left:0;z-index:10;width:280px}.editor-actions[data-v-baf7a5dd]{gap:4px}.header-wrapper[data-v-d11dd577]{min-width:1000px}.guido-loading__wrapper[data-v-07c4b2d8]{height:100%;top:75px!important;bottom:0!important}.validation-error-list[data-v-e48cebe9]{gap:16px}.validation-error-row[data-v-e48cebe9]{gap:8px;padding:24px;border:1px solid #E1E1E1;border-radius:8px}.validation-error-row__icon[data-v-e48cebe9]{flex-shrink:0;font-size:24px;line-height:0}.validation-error-row__text[data-v-e48cebe9]{font-size:13px;line-height:16px;color:#292929;word-break:break-word}.guido-editor__wrapper[data-v-c5146fc5]{--ribbon-offset: 0px;position:relative;width:100%;height:calc(100vh - 128px - var(--ribbon-offset))}.guido-editor__container[data-v-c5146fc5]{width:100%;height:calc(100vh - 128px - var(--ribbon-offset))}.guido-editor__no-header[data-v-c5146fc5]{height:calc(100vh - 75px - var(--ribbon-offset))}[data-v-293f1c47] .in-breadcrumb-wrapper__links{cursor:pointer}.templates-wrapper[data-v-6750a053]{gap:16px;grid-template-columns:repeat(3,1fr)}.templates-wrapper .template-wrapper[data-v-6750a053]{cursor:pointer}.templates-wrapper .template-wrapper .template-container[data-v-6750a053]{height:274px;padding:2px;transition:none}.templates-wrapper .template-wrapper .template-container.selected[data-v-6750a053]{padding:1px}.templates-wrapper .template-wrapper .template-container .thumbnail[data-v-6750a053]{object-fit:cover;transform:scale(1)}.templates-wrapper .template-wrapper .template-container .default-chip[data-v-6750a053]{top:14px;right:10px}[data-v-b9a93c6e] .guido__verion-history-view-option-selection-desktop svg,[data-v-b9a93c6e] .guido__verion-history-view-option-selection-mobile svg{margin:0 0 0 2px}[data-v-b9a93c6e] .in-segments-wrapper__button_selected,[data-v-b9a93c6e] .in-segments-wrapper__button_selected:hover{background-color:#dae1fb}.error-list[data-v-c3fd5d4b]{gap:16px}.desktop-browser-header[data-v-d86c5af5]{height:79px;min-height:79px}.desktop-browser-header__left[data-v-d86c5af5]{-webkit-user-drag:none;height:79px;width:378px}.desktop-browser-header__center[data-v-d86c5af5]{height:79px;background-repeat:repeat-x;background-size:auto 100%;background-position:left top}.desktop-browser-header__right[data-v-d86c5af5]{-webkit-user-drag:none;height:79px;width:112px}.desktop-preview[data-v-cf946232]{min-width:602px;height:70vh;min-height:583px;border-radius:10px}.desktop-preview iframe[data-v-cf946232]{min-height:504px}.iframe-wrapper[data-v-f255b2bb]{width:258px}.iframe-scaled[data-v-f255b2bb]{width:320px;height:124.0310077519%;transform:scale(.80625);transform-origin:top left}.cropped-text[data-v-eb3d05d7]{width:220px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.mobile-preview-wrapper__phone[data-v-3f472f96]{width:282px}.mobile-preview-wrapper__phone img[data-v-3f472f96]{object-fit:cover;border-radius:44px}.mobile-preview-wrapper__content[data-v-3f472f96]{width:258px;height:450px;left:12px}[data-v-6bcaca8a] .vueperslides__parallax-wrapper{padding-bottom:110px!important}[data-v-f16f20f8] .vueperslides__bullets{pointer-events:none!important}[data-v-f16f20f8] .vueperslides__parallax-wrapper{padding-bottom:110px!important}[data-v-bb3cca55] .vueperslides__bullets{pointer-events:none!important}[data-v-bb3cca55] .vueperslides__parallax-wrapper{height:110px!important;padding-bottom:110px!important}[data-v-19d8cb42] .vueperslides__bullets,[data-v-ec2027ff] .vueperslides__bullets,[data-v-b09e80c4] .vueperslides__bullets{pointer-events:none!important}[data-v-b09e80c4] .vueperslides__parallax-wrapper{height:110px!important;padding-bottom:110px!important}[data-v-9bdef600] .vueperslides__parallax-wrapper{padding-bottom:110px!important}.assign-strategy-drawer-content .assign-strategy-select[data-v-6ce48dfd]{width:100%;max-width:none}.assign-strategy-drawer-content .assign-strategy-select[data-v-6ce48dfd] .in-skeleton{width:100%!important}.assign-strategy-drawer-content .assign-strategy-select[data-v-6ce48dfd] .in-dropdown-box__container{width:413px}.assign-strategy-drawer .spaced-dot-sep{background-image:linear-gradient(90deg,#91949f 20%,#fff0 0);background-position:center bottom;background-repeat:repeat-x;background-size:5px 1px}.assign-strategy-drawer .spaced-dot-sep--top{background-position:center top}.assign-strategy-drawer .spaced-dot-sep--fc-n:first-child{background:none}.legacy-strategy-updated-modal[data-v-da2225a1]{position:relative;z-index:145}
|
|
@@ -1,24 +1,26 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
1
|
+
import { useActionsApi as h } from "../composables/useActionsApi.js";
|
|
2
|
+
import { useConfig as S } from "../composables/useConfig.js";
|
|
3
|
+
import { useHttp as v } from "../composables/useHttp.js";
|
|
4
|
+
import { useToaster as x } from "../composables/useToaster.js";
|
|
5
|
+
import { useTranslations as A } from "../composables/useTranslations.js";
|
|
6
|
+
import { useHtmlDocumentCountValidator as E } from "../composables/validators/useHtmlDocumentCountValidator.js";
|
|
7
|
+
import { useLiquidValidator as N } from "../composables/validators/useLiquidValidator.js";
|
|
8
|
+
import { EditorType as H } from "../enums/defaults.js";
|
|
9
|
+
import { ToasterTypeOptions as P } from "../enums/toaster.js";
|
|
10
|
+
import { useRecommendationExtensionStore as D } from "../extensions/Blocks/Recommendation/store/recommendation.js";
|
|
11
|
+
import { useSaveAsTemplateStore as L } from "../stores/save-as-template.js";
|
|
10
12
|
import { base64EncodeWithSpecialChars as r } from "../utils/base64.js";
|
|
11
|
-
import { isPlainObject as
|
|
12
|
-
import { useTemplatePreparation as
|
|
13
|
-
const
|
|
14
|
-
const { get: n, post: m } =
|
|
13
|
+
import { isPlainObject as q } from "../utils/genericUtil.js";
|
|
14
|
+
import { useTemplatePreparation as F } from "../utils/templatePreparation.js";
|
|
15
|
+
const Z = () => {
|
|
16
|
+
const { get: n, post: m } = v(), { handleError: s, showToaster: l } = x(), { config: c, isFeatureEnabled: p } = S(), { validateLiquidSyntax: T } = N(), { validateSingleHtmlDocument: w } = E(), { getTemplateData: b } = h(), u = A();
|
|
15
17
|
return {
|
|
16
18
|
getCategories: async () => {
|
|
17
19
|
try {
|
|
18
20
|
const { data: e = [] } = await n("/newsletter/template-library/get-template-categories");
|
|
19
21
|
return e;
|
|
20
22
|
} catch (e) {
|
|
21
|
-
return
|
|
23
|
+
return s(e, "Failed to fetch template categories"), [];
|
|
22
24
|
}
|
|
23
25
|
},
|
|
24
26
|
checkTemplateNameAvailability: async (e) => {
|
|
@@ -35,27 +37,30 @@ const B = () => {
|
|
|
35
37
|
);
|
|
36
38
|
return t.toString();
|
|
37
39
|
} catch (t) {
|
|
38
|
-
return
|
|
40
|
+
return s(t, "Failed to create category"), "";
|
|
39
41
|
}
|
|
40
42
|
},
|
|
41
43
|
createTemplate: async () => {
|
|
42
44
|
var e, t, d, y;
|
|
43
45
|
try {
|
|
44
|
-
const { prepareTemplateDetails: i } =
|
|
45
|
-
if (
|
|
46
|
+
const { prepareTemplateDetails: i } = F(), o = L(), g = await b();
|
|
47
|
+
if (!w(g.html))
|
|
46
48
|
return !1;
|
|
47
|
-
const
|
|
48
|
-
|
|
49
|
-
|
|
49
|
+
const a = await i(g);
|
|
50
|
+
if (p("liquidSyntax") && !await T(a.compiledHtml))
|
|
51
|
+
return !1;
|
|
52
|
+
const C = {
|
|
53
|
+
name: o.getTemplateName,
|
|
54
|
+
categories: o.getSelectedCategoryIds,
|
|
50
55
|
productId: ((t = (e = c.value) == null ? void 0 : e.partner) == null ? void 0 : t.productType) || 0,
|
|
51
|
-
editorType:
|
|
56
|
+
editorType: H,
|
|
52
57
|
messageType: ((y = (d = c.value) == null ? void 0 : d.partner) == null ? void 0 : y.messageType) || 0,
|
|
53
58
|
content: r(a.compiledHtml),
|
|
54
59
|
css: r(a.css),
|
|
55
60
|
unsubscriptionPreferencePageStatus: !1,
|
|
56
61
|
unsubscriptionPreferencePages: [],
|
|
57
62
|
recommendationCampaignUrls: r(
|
|
58
|
-
|
|
63
|
+
D().recommendationCampaignUrls
|
|
59
64
|
),
|
|
60
65
|
recommendationConfigs: r({}),
|
|
61
66
|
isGuido: !0,
|
|
@@ -67,31 +72,31 @@ const B = () => {
|
|
|
67
72
|
css: a.css,
|
|
68
73
|
dynamicContentList: a.dynamicContentList
|
|
69
74
|
})
|
|
70
|
-
}, { data:
|
|
75
|
+
}, { data: f } = await m(
|
|
71
76
|
"/newsletter/template-library/create-template",
|
|
72
|
-
|
|
77
|
+
C
|
|
73
78
|
);
|
|
74
|
-
if (!
|
|
79
|
+
if (!q(f))
|
|
75
80
|
throw new Error("Unexpected create-template response");
|
|
76
|
-
return
|
|
81
|
+
return f.type === "alert" ? (l({
|
|
77
82
|
message: u(
|
|
78
83
|
"newsletter.template-library-save-alert",
|
|
79
|
-
{ templateName:
|
|
84
|
+
{ templateName: o.getTemplateName }
|
|
80
85
|
),
|
|
81
|
-
type:
|
|
86
|
+
type: P.Error
|
|
82
87
|
}), !1) : (l({
|
|
83
88
|
message: u(
|
|
84
89
|
"newsletter.template-library-save-success",
|
|
85
|
-
{ templateName:
|
|
90
|
+
{ templateName: o.getTemplateName }
|
|
86
91
|
),
|
|
87
92
|
type: "success"
|
|
88
93
|
}), !0);
|
|
89
94
|
} catch (i) {
|
|
90
|
-
return
|
|
95
|
+
return s(i, "Failed to create template"), !1;
|
|
91
96
|
}
|
|
92
97
|
}
|
|
93
98
|
};
|
|
94
99
|
};
|
|
95
100
|
export {
|
|
96
|
-
|
|
101
|
+
Z as useTemplateLibraryApi
|
|
97
102
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const migrateFullStoryScripts: (html: string) => string;
|
|
@@ -26,6 +26,7 @@ export declare const useUnsubscribeStore: import("pinia").StoreDefinition<"guido
|
|
|
26
26
|
createdAt: string;
|
|
27
27
|
updatedAt: string;
|
|
28
28
|
status: number;
|
|
29
|
+
isDefault?: boolean | undefined;
|
|
29
30
|
}[];
|
|
30
31
|
selectedTemplates: Record<number, number>;
|
|
31
32
|
selectedUnsubscribePages: number[];
|
|
@@ -51,6 +52,7 @@ export declare const useUnsubscribeStore: import("pinia").StoreDefinition<"guido
|
|
|
51
52
|
createdAt: string;
|
|
52
53
|
updatedAt: string;
|
|
53
54
|
status: number;
|
|
55
|
+
isDefault?: boolean | undefined;
|
|
54
56
|
}[];
|
|
55
57
|
selectedTemplates: Record<number, number>;
|
|
56
58
|
selectedUnsubscribePages: number[];
|
|
@@ -76,6 +78,7 @@ export declare const useUnsubscribeStore: import("pinia").StoreDefinition<"guido
|
|
|
76
78
|
createdAt: string;
|
|
77
79
|
updatedAt: string;
|
|
78
80
|
status: number;
|
|
81
|
+
isDefault?: boolean | undefined;
|
|
79
82
|
}[];
|
|
80
83
|
selectedTemplates: Record<number, number>;
|
|
81
84
|
selectedUnsubscribePages: number[];
|
|
@@ -99,6 +102,7 @@ export declare const useUnsubscribeStore: import("pinia").StoreDefinition<"guido
|
|
|
99
102
|
createdAt: string;
|
|
100
103
|
updatedAt: string;
|
|
101
104
|
status: number;
|
|
105
|
+
isDefault?: boolean | undefined;
|
|
102
106
|
}[];
|
|
103
107
|
getThumbnailByTemplateId: (state: {
|
|
104
108
|
templates: {
|
|
@@ -113,6 +117,7 @@ export declare const useUnsubscribeStore: import("pinia").StoreDefinition<"guido
|
|
|
113
117
|
createdAt: string;
|
|
114
118
|
updatedAt: string;
|
|
115
119
|
status: number;
|
|
120
|
+
isDefault?: boolean | undefined;
|
|
116
121
|
}[];
|
|
117
122
|
selectedTemplates: Record<number, number>;
|
|
118
123
|
selectedUnsubscribePages: number[];
|
|
@@ -138,6 +143,7 @@ export declare const useUnsubscribeStore: import("pinia").StoreDefinition<"guido
|
|
|
138
143
|
createdAt: string;
|
|
139
144
|
updatedAt: string;
|
|
140
145
|
status: number;
|
|
146
|
+
isDefault?: boolean | undefined;
|
|
141
147
|
}[];
|
|
142
148
|
selectedTemplates: Record<number, number>;
|
|
143
149
|
selectedUnsubscribePages: number[];
|
|
@@ -163,6 +169,7 @@ export declare const useUnsubscribeStore: import("pinia").StoreDefinition<"guido
|
|
|
163
169
|
createdAt: string;
|
|
164
170
|
updatedAt: string;
|
|
165
171
|
status: number;
|
|
172
|
+
isDefault?: boolean | undefined;
|
|
166
173
|
}[];
|
|
167
174
|
selectedTemplates: Record<number, number>;
|
|
168
175
|
selectedUnsubscribePages: number[];
|
|
@@ -188,6 +195,7 @@ export declare const useUnsubscribeStore: import("pinia").StoreDefinition<"guido
|
|
|
188
195
|
createdAt: string;
|
|
189
196
|
updatedAt: string;
|
|
190
197
|
status: number;
|
|
198
|
+
isDefault?: boolean | undefined;
|
|
191
199
|
}[];
|
|
192
200
|
selectedTemplates: Record<number, number>;
|
|
193
201
|
selectedUnsubscribePages: number[];
|
|
@@ -213,6 +221,7 @@ export declare const useUnsubscribeStore: import("pinia").StoreDefinition<"guido
|
|
|
213
221
|
createdAt: string;
|
|
214
222
|
updatedAt: string;
|
|
215
223
|
status: number;
|
|
224
|
+
isDefault?: boolean | undefined;
|
|
216
225
|
}[];
|
|
217
226
|
selectedTemplates: Record<number, number>;
|
|
218
227
|
selectedUnsubscribePages: number[];
|
|
@@ -238,6 +247,7 @@ export declare const useUnsubscribeStore: import("pinia").StoreDefinition<"guido
|
|
|
238
247
|
createdAt: string;
|
|
239
248
|
updatedAt: string;
|
|
240
249
|
status: number;
|
|
250
|
+
isDefault?: boolean | undefined;
|
|
241
251
|
}[];
|
|
242
252
|
selectedTemplates: Record<number, number>;
|
|
243
253
|
selectedUnsubscribePages: number[];
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const FULLSTORY_BRIDGE_SCRIPT_URL = "https://email-static.useinsider.com/guido/guido-fs.js";
|
|
2
|
+
/**
|
|
3
|
+
* Removes FullStory `<script>` elements that the panel / bridge leave in the editor iframe head,
|
|
4
|
+
* which Stripo then serializes into the stored source. Other scripts are left untouched.
|
|
5
|
+
*/
|
|
6
|
+
export declare function stripFullStoryScripts(html: string): string;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { TemplateData } from '@@/Types/actions-api';
|
|
1
2
|
import type { SavedTemplateDetails } from '@@/Types/stripo';
|
|
2
3
|
/**
|
|
3
4
|
* Collects every unsubscribe page id referenced by the unsubscribe blocks
|
|
@@ -44,7 +45,7 @@ export declare function getHtmlReferencedUnsubscribePages(html: string): number[
|
|
|
44
45
|
*/
|
|
45
46
|
declare function hydrateRecommendationStoreFromRawHtml(rawHtml: string): Promise<void>;
|
|
46
47
|
export declare const useTemplatePreparation: () => {
|
|
47
|
-
prepareTemplateDetails: () => Promise<Omit<SavedTemplateDetails, "metadata">>;
|
|
48
|
+
prepareTemplateDetails: (prefetched?: TemplateData) => Promise<Omit<SavedTemplateDetails, "metadata">>;
|
|
48
49
|
hydrateRecommendationStore: typeof hydrateRecommendationStoreFromRawHtml;
|
|
49
50
|
};
|
|
50
51
|
export {};
|
|
@@ -1,23 +1,27 @@
|
|
|
1
|
-
import { TYPE_COLLECTIONS as
|
|
1
|
+
import { TYPE_COLLECTIONS as c, PAGE_TYPES as r } from "../enums/unsubscribe.js";
|
|
2
2
|
import { useUnsubscribeApi as d } from "../services/unsubscribeApi.js";
|
|
3
3
|
import { defineStore as u } from "pinia";
|
|
4
4
|
let o = null;
|
|
5
|
-
const
|
|
5
|
+
const p = () => ({
|
|
6
6
|
templates: [],
|
|
7
7
|
selectedTemplates: {},
|
|
8
8
|
selectedUnsubscribePages: [],
|
|
9
|
-
selectedCollectionType:
|
|
10
|
-
activeType:
|
|
9
|
+
selectedCollectionType: r.GLOBAL_UNSUBSCRIBE,
|
|
10
|
+
activeType: r.GLOBAL_UNSUBSCRIBE,
|
|
11
11
|
pageSelectionUpdateStatus: !1,
|
|
12
12
|
pageSelectionDrawerStatus: !1,
|
|
13
13
|
typeSelectionDrawerStatus: !1,
|
|
14
14
|
isGlobalUnsubscribeDisabled: !1,
|
|
15
15
|
isSubscriptionPreferencesCenterDisabled: !1,
|
|
16
16
|
pendingBlockId: null
|
|
17
|
-
})
|
|
18
|
-
|
|
17
|
+
});
|
|
18
|
+
function h(e) {
|
|
19
|
+
return [...e].sort((t, l) => +!!l.isDefault - +!!t.isDefault);
|
|
20
|
+
}
|
|
21
|
+
const f = u("guidoUnsubscribe", {
|
|
22
|
+
state: () => p(),
|
|
19
23
|
getters: {
|
|
20
|
-
getSelectedCollection: (e) =>
|
|
24
|
+
getSelectedCollection: (e) => c[e.selectedCollectionType],
|
|
21
25
|
getSelectedTemplateByActiveType: (e) => e.selectedTemplates[e.activeType],
|
|
22
26
|
getTemplatesByActiveType: (e) => e.templates.filter((t) => t.type === e.activeType),
|
|
23
27
|
getThumbnailByTemplateId: (e) => (t) => {
|
|
@@ -25,31 +29,31 @@ const r = () => ({
|
|
|
25
29
|
return ((l = e.templates.find((s) => s.id === t)) == null ? void 0 : l.thumbnail) ?? "";
|
|
26
30
|
},
|
|
27
31
|
getSelectedUnsubscribePagesByCollection: (e) => (t) => {
|
|
28
|
-
const l =
|
|
32
|
+
const l = c[t];
|
|
29
33
|
if (!l)
|
|
30
34
|
return [];
|
|
31
35
|
const s = /* @__PURE__ */ new Map();
|
|
32
36
|
e.templates.forEach((n) => {
|
|
33
37
|
s.set(n.id, n.type);
|
|
34
38
|
});
|
|
35
|
-
const
|
|
39
|
+
const i = new Set(l);
|
|
36
40
|
return e.selectedUnsubscribePages.filter((n) => {
|
|
37
41
|
const a = s.get(n);
|
|
38
|
-
return a !== void 0 &&
|
|
42
|
+
return a !== void 0 && i.has(a);
|
|
39
43
|
});
|
|
40
44
|
},
|
|
41
45
|
isActiveTypeFirstInCollection: (e) => {
|
|
42
|
-
const t =
|
|
46
|
+
const t = c[e.selectedCollectionType] ?? [];
|
|
43
47
|
return e.activeType === t[0];
|
|
44
48
|
},
|
|
45
49
|
isActiveTypeLastInCollection: (e) => {
|
|
46
|
-
const t =
|
|
50
|
+
const t = c[e.selectedCollectionType] ?? [];
|
|
47
51
|
return e.activeType === t[t.length - 1];
|
|
48
52
|
},
|
|
49
53
|
hasTemplatesByCollectionType: (e) => {
|
|
50
54
|
const t = {};
|
|
51
|
-
return (
|
|
52
|
-
t[s] = e.templates.some((
|
|
55
|
+
return (c[e.selectedCollectionType] ?? []).forEach((s) => {
|
|
56
|
+
t[s] = e.templates.some((i) => i.type === s);
|
|
53
57
|
}), t;
|
|
54
58
|
},
|
|
55
59
|
unsubscribePagesStatus: (e) => e.selectedUnsubscribePages.length > 0
|
|
@@ -58,7 +62,7 @@ const r = () => ({
|
|
|
58
62
|
$reset() {
|
|
59
63
|
const { templates: e, selectedUnsubscribePages: t } = this;
|
|
60
64
|
Object.assign(this, {
|
|
61
|
-
...
|
|
65
|
+
...p(),
|
|
62
66
|
templates: e,
|
|
63
67
|
selectedUnsubscribePages: t
|
|
64
68
|
});
|
|
@@ -66,28 +70,28 @@ const r = () => ({
|
|
|
66
70
|
async fetchTemplates(e = !1) {
|
|
67
71
|
!e && this.templates.length || ((e || !o) && (o = (async () => {
|
|
68
72
|
const { getUnsubscribePages: t } = d();
|
|
69
|
-
this.templates = await t();
|
|
73
|
+
this.templates = h(await t());
|
|
70
74
|
})().finally(() => {
|
|
71
75
|
o = null;
|
|
72
76
|
})), await o);
|
|
73
77
|
},
|
|
74
78
|
setCollection(e) {
|
|
75
79
|
this.selectedCollectionType = e;
|
|
76
|
-
const t =
|
|
80
|
+
const t = c[e];
|
|
77
81
|
if (t && t.length > 0) {
|
|
78
82
|
[this.activeType] = t;
|
|
79
83
|
const l = { ...this.selectedTemplates };
|
|
80
84
|
t.forEach((s) => {
|
|
81
85
|
if (!l[s]) {
|
|
82
|
-
const
|
|
83
|
-
|
|
86
|
+
const i = this.templates.find((n) => n.type === s);
|
|
87
|
+
i && (l[s] = i.id);
|
|
84
88
|
}
|
|
85
89
|
}), this.selectedTemplates = l;
|
|
86
90
|
}
|
|
87
91
|
},
|
|
88
92
|
setCollectionWithoutAutoSelection(e) {
|
|
89
93
|
this.selectedCollectionType = e;
|
|
90
|
-
const t =
|
|
94
|
+
const t = c[e];
|
|
91
95
|
t && t.length > 0 && ([this.activeType] = t);
|
|
92
96
|
},
|
|
93
97
|
setSelectedTemplate(e) {
|
|
@@ -107,12 +111,12 @@ const r = () => ({
|
|
|
107
111
|
loadSelectedTemplates(e) {
|
|
108
112
|
const t = new Map(this.templates.map((s) => [s.id, s.type])), l = { ...this.selectedTemplates };
|
|
109
113
|
e.forEach((s) => {
|
|
110
|
-
const
|
|
111
|
-
|
|
114
|
+
const i = t.get(s);
|
|
115
|
+
i !== void 0 && (l[i] = s);
|
|
112
116
|
}), this.selectedTemplates = l;
|
|
113
117
|
},
|
|
114
118
|
getSelectedTemplatesByCollection(e) {
|
|
115
|
-
const t =
|
|
119
|
+
const t = c[e], l = [];
|
|
116
120
|
return t.forEach((s) => {
|
|
117
121
|
this.selectedTemplates[s] && l.push(this.selectedTemplates[s]);
|
|
118
122
|
}), l;
|
|
@@ -129,5 +133,5 @@ const r = () => ({
|
|
|
129
133
|
}
|
|
130
134
|
});
|
|
131
135
|
export {
|
|
132
|
-
|
|
136
|
+
f as useUnsubscribeStore
|
|
133
137
|
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
const o = "https://email-static.useinsider.com/guido/guido-fs.js", E = new RegExp("<script\\b([^>]*?)(?<!\\/)>([\\s\\S]*?)<\\/script\\s*>", "gi"), _ = /<script\b([^>]*?)\/>/gi, e = /\bsrc\s*=\s*["']?(?:https?:)?\/\/(?:[\w-]+\.)*fullstory\.com[/"'\s>]/i, R = /\bdata-fullstory-bridge\b/i, S = /\b_fs_(?:script|namespace)\b/, i = (s, t = "") => e.test(`${s} `) || R.test(s) || s.includes(o) || S.test(t);
|
|
2
|
+
function n(s) {
|
|
3
|
+
return !s || !/fullstory|_fs_|guido-fs\.js/i.test(s) ? s : s.replace(E, (t, c, r) => i(c, r) ? "" : t).replace(_, (t, c) => i(c) ? "" : t);
|
|
4
|
+
}
|
|
5
|
+
export {
|
|
6
|
+
o as FULLSTORY_BRIDGE_SCRIPT_URL,
|
|
7
|
+
n as stripFullStoryScripts
|
|
8
|
+
};
|
|
@@ -1,100 +1,108 @@
|
|
|
1
|
-
import { ITEMS_CURRENCY_ATTR as
|
|
2
|
-
import { productPairs as
|
|
3
|
-
import { escapeReplacement as
|
|
4
|
-
import { preserveTextStyles as
|
|
5
|
-
import { unwrapProductNameLinks as
|
|
6
|
-
const
|
|
1
|
+
import { ITEMS_CURRENCY_ATTR as U, isCustomCurrencySymbol as Y } from "../extensions/Blocks/Items/constants/currency.js";
|
|
2
|
+
import { productPairs as M } from "../extensions/Blocks/Items/enums/productEnums.js";
|
|
3
|
+
import { escapeReplacement as B } from "../extensions/Blocks/Items/utils/nodeConfigUtils.js";
|
|
4
|
+
import { preserveTextStyles as L } from "./preserveTextStyles.js";
|
|
5
|
+
import { unwrapProductNameLinks as X } from "./unwrapProductNameLink.js";
|
|
6
|
+
const q = {
|
|
7
7
|
CART_ITEMS: "ins_apr",
|
|
8
8
|
BROWSED_ITEMS: "browsed_item",
|
|
9
9
|
PURCHASED_ITEMS: "purchased_item"
|
|
10
|
-
},
|
|
11
|
-
function
|
|
12
|
-
let
|
|
13
|
-
for (;
|
|
14
|
-
|
|
15
|
-
return
|
|
10
|
+
}, W = ($) => $.replaceAll("{%", "<!--{%").replaceAll("%}", "%}-->");
|
|
11
|
+
function v($, C, A) {
|
|
12
|
+
let d = C;
|
|
13
|
+
for (; d > 0 && /\s/.test($[d - 1]); )
|
|
14
|
+
d -= 1;
|
|
15
|
+
return A.some((E) => $.endsWith(E, d));
|
|
16
16
|
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
17
|
+
const j = /(\s)href=(["'])(?:[^"']*#!|#)?\2/gi;
|
|
18
|
+
function Q($, C) {
|
|
19
|
+
var d;
|
|
20
|
+
const A = $.ownerDocument.createTreeWalker($, NodeFilter.SHOW_COMMENT);
|
|
21
|
+
for (let E = A.nextNode(); E; E = A.nextNode())
|
|
22
|
+
(d = E.nodeValue) != null && d.includes("[if mso]") && (E.nodeValue = E.nodeValue.replace(j, (k, P) => `${P}href="${C}"`));
|
|
23
|
+
}
|
|
24
|
+
function et($) {
|
|
25
|
+
const C = W($), A = new DOMParser().parseFromString(C, "text/html");
|
|
26
|
+
X(A);
|
|
27
|
+
const d = M.PAIRS_FOR_EXTENSION;
|
|
28
|
+
Object.entries(d).forEach(([o, p]) => {
|
|
29
|
+
A.querySelectorAll(".ins-product-td").forEach((r) => {
|
|
30
|
+
const _ = r.getAttribute("data-number") || "1", y = r.getAttribute("data-type") || "CART_ITEMS";
|
|
31
|
+
r.querySelectorAll(`[product-attr="${o}"]`).forEach((t) => {
|
|
32
|
+
var S, I, O, x;
|
|
33
|
+
const m = t.getAttribute("data-type") || y, n = t.getAttribute("data-number") || _, f = p[m];
|
|
27
34
|
if (f)
|
|
28
|
-
switch (
|
|
35
|
+
switch (o) {
|
|
29
36
|
case "imageSrc": {
|
|
30
|
-
let e = null,
|
|
31
|
-
if (t.tagName === "IMG" ? (e = t,
|
|
37
|
+
let e = null, s = null;
|
|
38
|
+
if (t.tagName === "IMG" ? (e = t, s = e.closest("a")) : (e = t.querySelector("img"), s = t.querySelector("a") || t.closest("a")), !e)
|
|
32
39
|
break;
|
|
33
40
|
const l = f.DEFAULT, c = f.ATTR;
|
|
34
41
|
if (l && e.src) {
|
|
35
|
-
const
|
|
36
|
-
l.some((
|
|
37
|
-
const u =
|
|
38
|
-
return
|
|
39
|
-
}) && (e.src = `{{${c}_${
|
|
42
|
+
const a = e.src;
|
|
43
|
+
l.some((g) => {
|
|
44
|
+
const u = g.split("/").pop() || "", H = a.split("/").pop() || "";
|
|
45
|
+
return a.includes(g) || a.includes(u) || H === u;
|
|
46
|
+
}) && (e.src = `{{${c}_${n}}}`);
|
|
40
47
|
}
|
|
41
|
-
const i = (
|
|
42
|
-
if (i && e.setAttribute("alt", `{{${i}_${
|
|
43
|
-
const
|
|
44
|
-
if (
|
|
45
|
-
const
|
|
46
|
-
(u === "#" || u === "" || u.endsWith("#!") || u.endsWith(
|
|
48
|
+
const i = (I = (S = d.name) == null ? void 0 : S[m]) == null ? void 0 : I.ATTR;
|
|
49
|
+
if (i && e.setAttribute("alt", `{{${i}_${n}}}`), s) {
|
|
50
|
+
const a = (O = d.itemLink) == null ? void 0 : O[m];
|
|
51
|
+
if (a) {
|
|
52
|
+
const b = a.HREF, g = a.DEFAULT_HREF || "#!", u = s.href;
|
|
53
|
+
(u === "#" || u === "" || u.endsWith("#!") || u.endsWith(g) || u === `${window.location.href}${g}` || !u || u === window.location.href) && (s.href = `{{${b}_${n}}}`);
|
|
47
54
|
}
|
|
48
55
|
}
|
|
49
56
|
break;
|
|
50
57
|
}
|
|
51
58
|
case "name": {
|
|
52
|
-
const e = f,
|
|
53
|
-
t.textContent && (t.innerHTML =
|
|
59
|
+
const e = f, s = e.ATTR, l = e.DEFAULT_HREF || "#!", c = e.HREF;
|
|
60
|
+
t.textContent && (t.innerHTML = L(t, `{{${s}_${n}}}`));
|
|
54
61
|
const i = t.closest("a") || (t.tagName === "A" ? t : null);
|
|
55
62
|
if (i && c) {
|
|
56
|
-
const
|
|
57
|
-
(
|
|
63
|
+
const a = i.href, b = `${window.location.href}${l}`;
|
|
64
|
+
(a === b || a.endsWith(l)) && (i.href = `{{${c}_${n}}}`);
|
|
58
65
|
}
|
|
59
66
|
break;
|
|
60
67
|
}
|
|
61
68
|
case "price":
|
|
62
69
|
case "originalPrice": {
|
|
63
|
-
const e = f,
|
|
64
|
-
let
|
|
65
|
-
i ?
|
|
66
|
-
const
|
|
67
|
-
let u = `{{${
|
|
68
|
-
const H = (t.getAttribute(
|
|
69
|
-
let
|
|
70
|
-
G ?
|
|
70
|
+
const e = f, s = t.getAttribute("data-formated"), l = t.getAttribute("data-single_price"), c = s === "true", i = l === "true", a = t.getAttribute(U.POSITION) || "before";
|
|
71
|
+
let b;
|
|
72
|
+
i ? b = c ? e.SINGLE_PRICE_FORMATTED : e.SINGLE_PRICE : b = c ? e.PRICE_FORMATTED : e.PRICE;
|
|
73
|
+
const g = e.CURRENCY;
|
|
74
|
+
let u = `{{${b}_${n}}}`;
|
|
75
|
+
const H = (t.getAttribute(U.SYMBOL) || "").trim(), G = Y(H);
|
|
76
|
+
let F = "";
|
|
77
|
+
G ? F = H : g && (F = `{{${g}_${n}}}`), F && (u = a === "after" ? `${u} ${F}` : `${F} ${u}`), t.innerHTML = L(t, u);
|
|
71
78
|
break;
|
|
72
79
|
}
|
|
73
80
|
case "quantity": {
|
|
74
|
-
const e = f,
|
|
75
|
-
c && l.includes(c) && (t.innerHTML =
|
|
81
|
+
const e = f, s = e.ATTR, l = [e.DEFAULT, ...e.LEGACY_DEFAULTS], c = (x = t.textContent) == null ? void 0 : x.trim();
|
|
82
|
+
c && l.includes(c) && (t.innerHTML = L(t, `{{${s}_${n}}}`));
|
|
76
83
|
break;
|
|
77
84
|
}
|
|
78
85
|
case "button": {
|
|
79
|
-
const e = f,
|
|
86
|
+
const e = f, s = e.HREF, l = e.DEFAULT_HREF || "#!", c = t.tagName === "A" ? t : t.querySelector("a");
|
|
80
87
|
if (c) {
|
|
81
|
-
const i = c.href || "",
|
|
82
|
-
(i === "" || i === "#" || i ===
|
|
88
|
+
const i = c.href || "", a = `${window.location.href}${l}`;
|
|
89
|
+
(i === "" || i === "#" || i === a || i.endsWith(l) || i.endsWith("#!") || i === window.location.href) && (c.href = `{{${s}_${n}}}`);
|
|
83
90
|
}
|
|
91
|
+
Q(t, `{{${s}_${n}}}`);
|
|
84
92
|
break;
|
|
85
93
|
}
|
|
86
94
|
case "itemLink": {
|
|
87
|
-
const e = f,
|
|
95
|
+
const e = f, s = e.HREF, l = e.DEFAULT_HREF || "#!", c = t;
|
|
88
96
|
if (c.href) {
|
|
89
|
-
const i = c.href,
|
|
90
|
-
(i ===
|
|
97
|
+
const i = c.href, a = `${window.location.href}${l}`;
|
|
98
|
+
(i === a || i.endsWith(l)) && (c.href = `{{${s}_${n}}}`);
|
|
91
99
|
}
|
|
92
100
|
break;
|
|
93
101
|
}
|
|
94
102
|
default: {
|
|
95
103
|
if ("ATTR" in f) {
|
|
96
104
|
const e = f.ATTR;
|
|
97
|
-
t.textContent && (t.innerHTML =
|
|
105
|
+
t.textContent && (t.innerHTML = L(t, `{{${e}_${n}}}`));
|
|
98
106
|
}
|
|
99
107
|
break;
|
|
100
108
|
}
|
|
@@ -102,49 +110,49 @@ function Z(S) {
|
|
|
102
110
|
});
|
|
103
111
|
});
|
|
104
112
|
});
|
|
105
|
-
const
|
|
106
|
-
` : "",
|
|
107
|
-
|
|
108
|
-
const
|
|
109
|
-
|
|
110
|
-
element:
|
|
113
|
+
const E = C.match(/<!DOCTYPE[^>]*>/i), k = E ? `${E[0]}
|
|
114
|
+
` : "", P = A.querySelectorAll(".ins-product-td"), N = [];
|
|
115
|
+
P.forEach((o) => {
|
|
116
|
+
const p = o.getAttribute("data-type") || "CART_ITEMS", T = o.getAttribute("data-number") || "1", r = o.outerHTML;
|
|
117
|
+
N.push({
|
|
118
|
+
element: o,
|
|
111
119
|
outerHtml: r,
|
|
112
|
-
type:
|
|
113
|
-
number:
|
|
120
|
+
type: p,
|
|
121
|
+
number: T
|
|
114
122
|
});
|
|
115
123
|
});
|
|
116
|
-
let
|
|
117
|
-
|
|
118
|
-
const r =
|
|
119
|
-
if (
|
|
120
|
-
const
|
|
121
|
-
|
|
124
|
+
let h = k + A.documentElement.outerHTML;
|
|
125
|
+
N.reverse().forEach(({ outerHtml: o, type: p, number: T }) => {
|
|
126
|
+
const r = q[p], _ = r ? `${r}_total_product_kind` : "";
|
|
127
|
+
if (_) {
|
|
128
|
+
const R = parseInt(T) - 1, n = `${`{% if ${_} > ${R} %}`}${o}{% endif %}`;
|
|
129
|
+
h = h.replace(o, B(n));
|
|
122
130
|
}
|
|
123
131
|
});
|
|
124
|
-
const V =
|
|
125
|
-
return V.forEach((
|
|
132
|
+
const V = A.querySelectorAll('[product-attr="originalPrice"][data-type]'), w = /* @__PURE__ */ new Map(), D = /* @__PURE__ */ new Set();
|
|
133
|
+
return V.forEach((o) => {
|
|
126
134
|
var t;
|
|
127
|
-
const
|
|
128
|
-
if (!
|
|
135
|
+
const p = o.getAttribute("data-number"), T = o.getAttribute("data-type");
|
|
136
|
+
if (!p || !q[T])
|
|
129
137
|
return;
|
|
130
|
-
const r =
|
|
131
|
-
if (!r ||
|
|
138
|
+
const r = o.closest(".product-original-price-class");
|
|
139
|
+
if (!r || D.has(r))
|
|
132
140
|
return;
|
|
133
|
-
|
|
134
|
-
const
|
|
135
|
-
|
|
136
|
-
}),
|
|
137
|
-
if (r.includes("{% if") || !
|
|
141
|
+
D.add(r);
|
|
142
|
+
const _ = r.outerHTML, y = (t = o.closest(".ins-product-td")) == null ? void 0 : t.getAttribute("data-nodup"), R = w.get(_) ?? { number: p, type: T, wrap: [] };
|
|
143
|
+
R.wrap.push(y !== "false"), w.set(_, R);
|
|
144
|
+
}), w.forEach(({ number: o, type: p, wrap: T }, r) => {
|
|
145
|
+
if (r.includes("{% if") || !T.some(Boolean))
|
|
138
146
|
return;
|
|
139
|
-
const
|
|
140
|
-
let
|
|
141
|
-
for (;
|
|
142
|
-
const
|
|
143
|
-
|
|
147
|
+
const _ = M.PAIRS_FOR_EXTENSION.price[p].PRICE, y = M.PAIRS_FOR_EXTENSION.originalPrice[p].PRICE, R = `{% if ${_}_${o} != ${y}_${o} %}`, t = [R, W(R)];
|
|
148
|
+
let m = "", n = 0, f = 0, S = h.indexOf(r);
|
|
149
|
+
for (; S !== -1; ) {
|
|
150
|
+
const I = T[f] === !0 && !v(h, S, t);
|
|
151
|
+
m += h.slice(n, S) + (I ? `${R}${r}{% endif %}` : r), n = S + r.length, f += 1, S = h.indexOf(r, n);
|
|
144
152
|
}
|
|
145
|
-
|
|
146
|
-
}),
|
|
153
|
+
h = m + h.slice(n);
|
|
154
|
+
}), h.replaceAll("<!--{%", "{%").replaceAll("%}-->", "%}").replaceAll("<!--{%", "{%").replaceAll("%}-->", "%}");
|
|
147
155
|
}
|
|
148
156
|
export {
|
|
149
|
-
|
|
157
|
+
et as pairProductVariables
|
|
150
158
|
};
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import { useActionsApi as
|
|
2
|
-
import { useConfig as
|
|
3
|
-
import { useHtmlCompiler as
|
|
1
|
+
import { useActionsApi as E } from "../composables/useActionsApi.js";
|
|
2
|
+
import { useConfig as F } from "../composables/useConfig.js";
|
|
3
|
+
import { useHtmlCompiler as I } from "../composables/useHtmlCompiler.js";
|
|
4
4
|
import { useRecommendationExtensionStore as b } from "../extensions/Blocks/Recommendation/store/recommendation.js";
|
|
5
|
-
import { toBlockUrlConfig as
|
|
5
|
+
import { toBlockUrlConfig as R } from "../extensions/Blocks/Recommendation/utils/blockUrlConfig.js";
|
|
6
6
|
import { DATA_ATTRIBUTES as g } from "../extensions/Blocks/Unsubscribe/utils/constants.js";
|
|
7
|
-
import { parsePageList as
|
|
8
|
-
import { useDynamicContentStore as
|
|
9
|
-
import { useEditorStore as
|
|
10
|
-
import { useUnsubscribeStore as
|
|
11
|
-
import { isPlainObject as
|
|
12
|
-
import { assignTrackingIds as
|
|
13
|
-
function
|
|
7
|
+
import { parsePageList as U } from "../extensions/Blocks/Unsubscribe/utils/utils.js";
|
|
8
|
+
import { useDynamicContentStore as L } from "../stores/dynamic-content.js";
|
|
9
|
+
import { useEditorStore as N } from "../stores/editor.js";
|
|
10
|
+
import { useUnsubscribeStore as v } from "../stores/unsubscribe.js";
|
|
11
|
+
import { isPlainObject as z } from "./genericUtil.js";
|
|
12
|
+
import { assignTrackingIds as M } from "./linkTrackingIds.js";
|
|
13
|
+
function O(n) {
|
|
14
14
|
const r = new DOMParser().parseFromString(n, "text/html").querySelectorAll(`[${g.PAGE_LIST}]`), e = [];
|
|
15
15
|
return r.forEach((i) => {
|
|
16
16
|
const t = i.getAttribute(g.PAGE_LIST);
|
|
17
|
-
t && e.push(...
|
|
17
|
+
t && e.push(...U(t));
|
|
18
18
|
}), [...new Set(e)];
|
|
19
19
|
}
|
|
20
20
|
async function S(n) {
|
|
@@ -35,7 +35,7 @@ async function S(n) {
|
|
|
35
35
|
} catch {
|
|
36
36
|
return;
|
|
37
37
|
}
|
|
38
|
-
|
|
38
|
+
z(a) && r.seedBlockUrlConfig(t, R(a));
|
|
39
39
|
});
|
|
40
40
|
try {
|
|
41
41
|
await r.fetchRecommendationCreateData();
|
|
@@ -46,40 +46,40 @@ async function S(n) {
|
|
|
46
46
|
);
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
|
-
const
|
|
50
|
-
const n =
|
|
49
|
+
const Z = () => {
|
|
50
|
+
const n = L(), c = N(), o = v(), { getCompiledEmail: r, getTemplateData: e, updateHtmlAndCss: i } = E(), { compileHtml: t, compileAmpHtml: m } = I(), { isFeatureEnabled: a } = F();
|
|
51
51
|
return {
|
|
52
|
-
prepareTemplateDetails: async () => {
|
|
53
|
-
let { html: s, css: u, syncModulesIds:
|
|
52
|
+
prepareTemplateDetails: async (h) => {
|
|
53
|
+
let { html: s, css: u, syncModulesIds: y = [] } = h ?? await e();
|
|
54
54
|
if (a("linkTrackingIds"))
|
|
55
55
|
try {
|
|
56
|
-
const { html: d, changed:
|
|
57
|
-
c.trackIdSessionFloor =
|
|
56
|
+
const { html: d, changed: x, nextSeq: D } = M(s, c.trackIdSessionFloor);
|
|
57
|
+
c.trackIdSessionFloor = D, x && (s = d, await i(d, u));
|
|
58
58
|
} catch (d) {
|
|
59
59
|
console.error("Tracking-id step failed, saving anyway:", d);
|
|
60
60
|
}
|
|
61
|
-
const { html:
|
|
61
|
+
const { html: T, ampHtml: p = "", ampErrors: A = [] } = await r({
|
|
62
62
|
minimize: !0,
|
|
63
63
|
resetDataSavedFlag: !1
|
|
64
64
|
});
|
|
65
65
|
o.selectedUnsubscribePages.length && await o.fetchTemplates(), await S(s);
|
|
66
|
-
const { compiledHtml:
|
|
66
|
+
const { compiledHtml: w, stats: l, appliedRules: C } = t(T), H = p && m(p).compiledHtml, k = n.getSelectedDynamicContentList, P = b(), f = O(s);
|
|
67
67
|
return console.debug("HTML Compilation Stats:", {
|
|
68
68
|
originalSize: l.originalSize,
|
|
69
69
|
compiledSize: l.compiledSize,
|
|
70
70
|
reduction: `${l.reductionPercentage.toFixed(2)}%`,
|
|
71
|
-
appliedRules:
|
|
71
|
+
appliedRules: C,
|
|
72
72
|
executionTime: `${l.executionTime.toFixed(2)}ms`
|
|
73
73
|
}), {
|
|
74
|
-
dynamicContentList:
|
|
75
|
-
compiledHtml:
|
|
74
|
+
dynamicContentList: k,
|
|
75
|
+
compiledHtml: w,
|
|
76
76
|
rawHtml: s,
|
|
77
77
|
css: u,
|
|
78
|
-
ampHtml:
|
|
79
|
-
ampErrors:
|
|
80
|
-
modules:
|
|
78
|
+
ampHtml: H,
|
|
79
|
+
ampErrors: A,
|
|
80
|
+
modules: y.map(Number),
|
|
81
81
|
recommendation: {
|
|
82
|
-
campaignUrls:
|
|
82
|
+
campaignUrls: P.recommendationCampaignUrls,
|
|
83
83
|
configs: {}
|
|
84
84
|
},
|
|
85
85
|
unsubscribe: {
|
|
@@ -94,6 +94,6 @@ const Y = () => {
|
|
|
94
94
|
};
|
|
95
95
|
};
|
|
96
96
|
export {
|
|
97
|
-
|
|
98
|
-
|
|
97
|
+
O as getHtmlReferencedUnsubscribePages,
|
|
98
|
+
Z as useTemplatePreparation
|
|
99
99
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@useinsider/guido",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.22.0-beta.8345109",
|
|
4
4
|
"description": "Guido is a Vue + TypeScript wrapper for Email Plugin. Easily embed the email editor in your Vue applications.",
|
|
5
5
|
"main": "./dist/guido.umd.cjs",
|
|
6
6
|
"module": "./dist/library.js",
|