@useinsider/guido 2.1.0-beta.ff9b498 → 2.2.0-beta.1696353
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 +1 -3
- package/dist/composables/useSave.js +12 -16
- package/dist/composables/useStripo.js +54 -58
- package/dist/composables/useStripoEventHandler.js +12 -27
- package/dist/config/migrator/itemsBlockMigrator.js +97 -101
- package/dist/enums/unsubscribe.js +21 -25
- package/dist/services/stripoApi.js +14 -50
- package/dist/src/@types/events.d.ts +2 -34
- package/dist/src/enums/unsubscribe.d.ts +0 -3
- package/dist/src/services/stripoApi.d.ts +0 -5
- package/dist/src/stores/editor.d.ts +0 -23
- package/dist/stores/editor.js +1 -2
- package/package.json +1 -1
- package/dist/composables/useSyncModuleExtractor.js +0 -33
- package/dist/src/composables/useSyncModuleExtractor.d.ts +0 -4
- package/dist/src/mock/api/settings.d.ts +0 -2
package/README.md
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
<p align="center">
|
|
2
2
|
<a href="https://www.youtube.com/shorts/Y0RwBeMezL4" target="_blank" rel="noopener noreferrer">
|
|
3
|
-
<img width="180"
|
|
4
|
-
src="https://web-image.useinsider.com/guido/defaultImageLibrary/iUH0liTK0d2YDsVB5LDN1770169173.jpg"
|
|
5
|
-
alt="Guido logo">
|
|
3
|
+
<img width="180" src="./public/guido.png" alt="Guido logo">
|
|
6
4
|
</a>
|
|
7
5
|
</p>
|
|
8
6
|
|
|
@@ -1,21 +1,17 @@
|
|
|
1
|
-
import { useConfig as
|
|
2
|
-
import { useSaveStart as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
const o = d(), s = p(), { validateHtml: i } = x(), { callbacks: a } = u(), { extractSyncModuleUnsubscribeData: r } = f(), { setSyncModuleUnsubscriptionPages: n } = v();
|
|
9
|
-
return { save: async (l = !1) => {
|
|
1
|
+
import { useConfig as l } from "./useConfig.js";
|
|
2
|
+
import { useSaveStart as m, useSaveComplete as c } from "./useGuidoActions.js";
|
|
3
|
+
import { useTemplatePreparation as d } from "../utils/templatePreparation.js";
|
|
4
|
+
import { useHtmlValidator as p } from "./useHtmlValidator.js";
|
|
5
|
+
const w = () => {
|
|
6
|
+
const i = m(), s = c(), { validateHtml: o } = p(), { callbacks: a } = l();
|
|
7
|
+
return { save: async (r = !1) => {
|
|
10
8
|
var e;
|
|
11
|
-
|
|
12
|
-
const { prepareTemplateDetails:
|
|
13
|
-
if (
|
|
14
|
-
return;
|
|
15
|
-
const m = r(t.rawHtml);
|
|
16
|
-
return await n(m), l || s(t), t;
|
|
9
|
+
i();
|
|
10
|
+
const { prepareTemplateDetails: n } = d(), t = await n();
|
|
11
|
+
if (await o(t.compiledHtml, t.dynamicContentList, !0) && !((e = a.value) != null && e.externalValidation && !await a.value.externalValidation(t)))
|
|
12
|
+
return r || s(t), t;
|
|
17
13
|
} };
|
|
18
14
|
};
|
|
19
15
|
export {
|
|
20
|
-
|
|
16
|
+
w as useSave
|
|
21
17
|
};
|
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
import { useActionsApi as
|
|
2
|
-
import { useBlocksConfig as
|
|
3
|
-
import { useConfig as
|
|
4
|
-
import { useCustomInterfaceAppearance as
|
|
5
|
-
import { useStripoEventHandler as
|
|
6
|
-
import { useToaster as
|
|
7
|
-
import { displayConditions as
|
|
8
|
-
import { useStripoApi as
|
|
9
|
-
import
|
|
10
|
-
import { useEditorStore as
|
|
11
|
-
import { dynamicContentToMergeTags as
|
|
12
|
-
import
|
|
13
|
-
const
|
|
14
|
-
const { features: l, template:
|
|
15
|
-
var g, f
|
|
16
|
-
const
|
|
1
|
+
import { useActionsApi as _ } from "./useActionsApi.js";
|
|
2
|
+
import { useBlocksConfig as B } from "./useBlocksConfig.js";
|
|
3
|
+
import { useConfig as v } from "./useConfig.js";
|
|
4
|
+
import { useCustomInterfaceAppearance as A } from "./useCustomInterfaceAppearance.js";
|
|
5
|
+
import { useStripoEventHandler as F } from "./useStripoEventHandler.js";
|
|
6
|
+
import { useToaster as D } from "./useToaster.js";
|
|
7
|
+
import { displayConditions as I } from "../enums/displayConditions.js";
|
|
8
|
+
import { useStripoApi as M } from "../services/stripoApi.js";
|
|
9
|
+
import U from "../static/styles/customEditorStyle.css.js";
|
|
10
|
+
import { useEditorStore as P } from "../stores/editor.js";
|
|
11
|
+
import { dynamicContentToMergeTags as R } from "../utils/genericUtil.js";
|
|
12
|
+
import H from "../package.json.js";
|
|
13
|
+
const W = (c) => {
|
|
14
|
+
const { features: l, template: y } = v(), { handleError: u } = D(), { getToken: C, getCustomFonts: S } = M(), { handleEvent: E } = F(), { getStripoBlocksConfig: h } = B(), w = async (i, n = []) => {
|
|
15
|
+
var m, g, f;
|
|
16
|
+
const o = P(), { html: r, css: p } = i, { baseBlocks: s, extensions: t } = await h(), a = ((m = l.value) == null ? void 0 : m.displayConditions) ?? !0, k = ((g = l.value) == null ? void 0 : g.modulesDisabled) ?? !1, T = ((f = y.value) == null ? void 0 : f.forceRecreate) ?? !1;
|
|
17
17
|
window.UIEditor.initEditor(
|
|
18
18
|
document.querySelector("#guido-editor"),
|
|
19
19
|
{
|
|
20
20
|
metadata: c,
|
|
21
|
-
html:
|
|
22
|
-
css:
|
|
23
|
-
forceRecreate:
|
|
21
|
+
html: r,
|
|
22
|
+
css: p,
|
|
23
|
+
forceRecreate: T,
|
|
24
24
|
locale: "en",
|
|
25
25
|
undoButtonSelector: "#guido__undo-button",
|
|
26
26
|
redoButtonSelector: "#guido__redo-button",
|
|
@@ -30,20 +30,19 @@ const Z = (c) => {
|
|
|
30
30
|
customAppearanceMergetags: !0,
|
|
31
31
|
customAppearanceMergetagsBorderColor: "#f1f3fe",
|
|
32
32
|
customAppearanceMergetagsBackgroundColor: "#f1f3fe",
|
|
33
|
-
customViewStyles:
|
|
34
|
-
conditionsEnabled:
|
|
35
|
-
customConditionsEnabled:
|
|
36
|
-
conditionCategories:
|
|
33
|
+
customViewStyles: U,
|
|
34
|
+
conditionsEnabled: a,
|
|
35
|
+
customConditionsEnabled: a,
|
|
36
|
+
conditionCategories: I,
|
|
37
37
|
enableXSSSecurity: !0,
|
|
38
|
-
modulesDisabled:
|
|
39
|
-
syncModulesEnabled: r,
|
|
38
|
+
modulesDisabled: k,
|
|
40
39
|
messageSettingsEnabled: !0,
|
|
41
40
|
displayGmailAnnotations: !0,
|
|
42
41
|
displayHiddenPreheader: !1,
|
|
43
42
|
displayTitle: !1,
|
|
44
43
|
displayUTM: !1,
|
|
45
44
|
selectElementAfterDrop: !0,
|
|
46
|
-
...
|
|
45
|
+
...s ? { baseBlocks: s } : {},
|
|
47
46
|
editorFonts: {
|
|
48
47
|
showDefaultStandardFonts: !0,
|
|
49
48
|
showDefaultNotStandardFonts: !0,
|
|
@@ -51,71 +50,68 @@ const Z = (c) => {
|
|
|
51
50
|
},
|
|
52
51
|
mergeTags: [
|
|
53
52
|
{
|
|
54
|
-
entries:
|
|
53
|
+
entries: R(c.preselectedDynamicContentList)
|
|
55
54
|
}
|
|
56
55
|
],
|
|
57
|
-
async onTokenRefreshRequest(
|
|
56
|
+
async onTokenRefreshRequest(e) {
|
|
58
57
|
try {
|
|
59
|
-
const
|
|
60
|
-
|
|
61
|
-
} catch (
|
|
62
|
-
u(
|
|
58
|
+
const d = await C();
|
|
59
|
+
e(d);
|
|
60
|
+
} catch (d) {
|
|
61
|
+
u(d, "Failed to refresh token");
|
|
63
62
|
}
|
|
64
63
|
},
|
|
65
64
|
onTemplateLoaded() {
|
|
66
65
|
try {
|
|
67
|
-
const { importCss:
|
|
68
|
-
|
|
69
|
-
|
|
66
|
+
const { importCss: e } = A(), { activateCustomViewStyles: d, updateTimerInClonedTemplate: V } = _();
|
|
67
|
+
e(), d(), V(), c.onReady(), o.isStripoInitialized = !0, o.loadingStatus = !1, setTimeout(() => {
|
|
68
|
+
o.hasChanges = !1;
|
|
70
69
|
}, 1e3);
|
|
71
|
-
} catch (
|
|
72
|
-
u(
|
|
70
|
+
} catch (e) {
|
|
71
|
+
u(e, "Failed to load custom interface appearance");
|
|
73
72
|
}
|
|
74
73
|
},
|
|
75
|
-
onCodeEditorVisibilityChanged(
|
|
76
|
-
|
|
74
|
+
onCodeEditorVisibilityChanged(e) {
|
|
75
|
+
o.isCodeEditorOpen = e;
|
|
77
76
|
},
|
|
78
|
-
onEditorVisualModeChanged(
|
|
79
|
-
|
|
77
|
+
onEditorVisualModeChanged(e) {
|
|
78
|
+
o.editorVisualMode = e.toLowerCase();
|
|
80
79
|
},
|
|
81
|
-
onVersionHistoryVisibilityChanged(
|
|
82
|
-
|
|
80
|
+
onVersionHistoryVisibilityChanged(e) {
|
|
81
|
+
o.isVersionHistoryOpen = e;
|
|
83
82
|
},
|
|
84
83
|
onDataChanged() {
|
|
85
|
-
|
|
84
|
+
o.hasChanges = !0;
|
|
86
85
|
},
|
|
87
|
-
onEvent:
|
|
86
|
+
onEvent: E,
|
|
88
87
|
ignoreClickOutsideSelectors: [
|
|
89
88
|
"#guido-dynamic-content-modal",
|
|
90
89
|
".in-on-board-wrapper",
|
|
91
90
|
".in-drawer__container"
|
|
92
91
|
],
|
|
93
|
-
extensions:
|
|
92
|
+
extensions: t
|
|
94
93
|
}
|
|
95
94
|
);
|
|
96
|
-
},
|
|
97
|
-
var
|
|
95
|
+
}, b = (i) => new Promise((n, o) => {
|
|
96
|
+
var a;
|
|
98
97
|
if (document.getElementById("UiEditorScript")) {
|
|
99
98
|
i(), n();
|
|
100
99
|
return;
|
|
101
100
|
}
|
|
102
|
-
const
|
|
103
|
-
t.id = "UiEditorScript", t.type = "module", t.src =
|
|
101
|
+
const r = H.guido, s = `https://email-static.useinsider.com/guido/${(a = r == null ? void 0 : r.stripo) == null ? void 0 : a.version}/UIEditor.js`, t = document.createElement("script");
|
|
102
|
+
t.id = "UiEditorScript", t.type = "module", t.src = s, t.onload = () => {
|
|
104
103
|
i(), n();
|
|
105
104
|
}, t.onerror = () => {
|
|
106
|
-
|
|
105
|
+
o(new Error(`Failed to load Stripo UIEditor script from S3: ${s}`));
|
|
107
106
|
}, document.body.appendChild(t);
|
|
108
107
|
});
|
|
109
108
|
return { initPlugin: async (i) => {
|
|
110
|
-
await
|
|
111
|
-
const n = S()
|
|
112
|
-
|
|
113
|
-
w()
|
|
114
|
-
]);
|
|
115
|
-
n.syncModulesEnabled = e, await T(i, r, e);
|
|
109
|
+
await b(async () => {
|
|
110
|
+
const n = await S();
|
|
111
|
+
await w(i, n);
|
|
116
112
|
});
|
|
117
113
|
} };
|
|
118
114
|
};
|
|
119
115
|
export {
|
|
120
|
-
|
|
116
|
+
W as useStripo
|
|
121
117
|
};
|
|
@@ -1,35 +1,20 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
if (e === "BLOCK_TEXT") {
|
|
9
|
-
const o = l(), t = !o.shouldShowOnboarding("textBlockOnboarding"), c = o.isActive("textBlockOnboarding");
|
|
10
|
-
if (t || c)
|
|
1
|
+
import { useOnboardingStore as i } from "../stores/onboarding.js";
|
|
2
|
+
const c = () => {
|
|
3
|
+
const e = {
|
|
4
|
+
block_dropped: ({ blockName: t }) => {
|
|
5
|
+
if (t === "BLOCK_TEXT") {
|
|
6
|
+
const n = i(), o = !n.shouldShowOnboarding("textBlockOnboarding"), r = n.isActive("textBlockOnboarding");
|
|
7
|
+
if (o || r)
|
|
11
8
|
return;
|
|
12
|
-
|
|
9
|
+
n.start("textBlockOnboarding");
|
|
13
10
|
}
|
|
14
|
-
},
|
|
15
|
-
module_saved: async (e) => {
|
|
16
|
-
n.syncModulesEnabled && (console.debug("[module_saved] Saved module data:", e), await d(e));
|
|
17
|
-
},
|
|
18
|
-
module_dropped: async (e) => {
|
|
19
|
-
if (!n.syncModulesEnabled)
|
|
20
|
-
return;
|
|
21
|
-
const { moduleId: o } = e, t = await r(o);
|
|
22
|
-
console.debug("[module_dropped] Sync module data:", t), t.unsubscriptionPreferencePages.length && await s.fetchTemplates();
|
|
23
|
-
},
|
|
24
|
-
module_updated: async (e) => {
|
|
25
|
-
n.syncModulesEnabled && (console.debug("[module_updated] Updated module data:", e), await d(e));
|
|
26
11
|
}
|
|
27
12
|
};
|
|
28
|
-
return { handleEvent: async (
|
|
29
|
-
const
|
|
30
|
-
|
|
13
|
+
return { handleEvent: async (t, n) => {
|
|
14
|
+
const o = e[t];
|
|
15
|
+
o && await o(n);
|
|
31
16
|
} };
|
|
32
17
|
};
|
|
33
18
|
export {
|
|
34
|
-
|
|
19
|
+
c as useStripoEventHandler
|
|
35
20
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
var B = Object.defineProperty;
|
|
2
|
-
var U = (
|
|
3
|
-
var M = (
|
|
2
|
+
var U = (r, t, e) => t in r ? B(r, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : r[t] = e;
|
|
3
|
+
var M = (r, t, e) => U(r, typeof t != "symbol" ? t + "" : t, e);
|
|
4
4
|
import { productPairs as v } from "../../extensions/Blocks/Items/enums/productEnums.js";
|
|
5
|
-
import { ItemInCartOptions as E, DefaultConfigValues as g, SETTINGS_ENUMS as
|
|
5
|
+
import { ItemInCartOptions as E, DefaultConfigValues as g, SETTINGS_ENUMS as d } from "../../extensions/Blocks/Items/enums/settingsEnums.js";
|
|
6
6
|
import { getDefaultTemplate as K } from "../../extensions/Blocks/Items/template.js";
|
|
7
7
|
const w = {
|
|
8
8
|
img: {
|
|
@@ -74,76 +74,76 @@ const w = {
|
|
|
74
74
|
function F() {
|
|
75
75
|
return String(Date.now() + Math.floor(Math.random() * 1e3));
|
|
76
76
|
}
|
|
77
|
-
function q(
|
|
78
|
-
return
|
|
79
|
-
CartItems:
|
|
80
|
-
BrowsedItems:
|
|
81
|
-
PurchasedItems:
|
|
82
|
-
CART_ITEMS:
|
|
83
|
-
BROWSED_ITEMS:
|
|
84
|
-
PURCHASED_ITEMS:
|
|
85
|
-
}[
|
|
77
|
+
function q(r) {
|
|
78
|
+
return r ? {
|
|
79
|
+
CartItems: d.ITEMS_TYPE.CART_ITEMS,
|
|
80
|
+
BrowsedItems: d.ITEMS_TYPE.BROWSED_ITEMS,
|
|
81
|
+
PurchasedItems: d.ITEMS_TYPE.PURCHASED_ITEMS,
|
|
82
|
+
CART_ITEMS: d.ITEMS_TYPE.CART_ITEMS,
|
|
83
|
+
BROWSED_ITEMS: d.ITEMS_TYPE.BROWSED_ITEMS,
|
|
84
|
+
PURCHASED_ITEMS: d.ITEMS_TYPE.PURCHASED_ITEMS
|
|
85
|
+
}[r] || d.ITEMS_TYPE.CART_ITEMS : d.ITEMS_TYPE.CART_ITEMS;
|
|
86
86
|
}
|
|
87
|
-
function R(
|
|
88
|
-
const t = (a, o) => a == null ? o : a === "1" || a === "true",
|
|
89
|
-
let n =
|
|
87
|
+
function R(r) {
|
|
88
|
+
const t = (a, o) => a == null ? o : a === "1" || a === "true", e = (a, o) => a || o, i = r["data-type"] || r["data-source"], l = q(i);
|
|
89
|
+
let n = r["data-cart_items_select_control_value"] || g.cartItemsSelectControlValue;
|
|
90
90
|
if (n && !n.includes("{{") && /^\d+$/.test(n)) {
|
|
91
|
-
const a = parseInt(n) - 1, o = E[
|
|
91
|
+
const a = parseInt(n) - 1, o = E[l];
|
|
92
92
|
o && o[a] && (n = o[a].value);
|
|
93
93
|
}
|
|
94
94
|
return {
|
|
95
95
|
initialized: !0,
|
|
96
|
-
blockInstanceId: r
|
|
97
|
-
source:
|
|
98
|
-
type:
|
|
96
|
+
blockInstanceId: e(r["data-block-instance-id"], F()),
|
|
97
|
+
source: l,
|
|
98
|
+
type: l,
|
|
99
99
|
itemsSelectValue: n,
|
|
100
|
-
orientation:
|
|
101
|
-
nameTrimming: t(
|
|
102
|
-
priceHideDiscount: t(
|
|
103
|
-
priceFormatted: t(
|
|
104
|
-
priceSinglePrice: t(
|
|
105
|
-
priceCurrencySymbol:
|
|
106
|
-
|
|
100
|
+
orientation: r["data-card_orientation_control_value"] || d.ORIENTATION.VERTICAL,
|
|
101
|
+
nameTrimming: t(r["data-product_name_control_trim"], !0),
|
|
102
|
+
priceHideDiscount: t(r["data-product_price_control_nodup"], !0),
|
|
103
|
+
priceFormatted: t(r["data-product_price_control_formated"], !0),
|
|
104
|
+
priceSinglePrice: t(r["data-product_price_control_single_price"], !1),
|
|
105
|
+
priceCurrencySymbol: e(
|
|
106
|
+
r["data-product_price_control_currency_symbol"],
|
|
107
107
|
g.productPriceCurrencySymbolControlValue
|
|
108
108
|
),
|
|
109
|
-
priceCurrencyLocation:
|
|
110
|
-
|
|
109
|
+
priceCurrencyLocation: e(
|
|
110
|
+
r["data-product_price_currency_location"],
|
|
111
111
|
g.productPriceCurrencyLocationControlValue
|
|
112
112
|
),
|
|
113
|
-
priceOrientation:
|
|
114
|
-
quantityControlEnabled: t(
|
|
115
|
-
buttonLink: r
|
|
116
|
-
imageLink: r
|
|
117
|
-
buttonLabel: r
|
|
118
|
-
buttonFullWidth: t(
|
|
119
|
-
imageVisible: t(
|
|
120
|
-
nameVisible: t(
|
|
121
|
-
quantityVisible: t(
|
|
122
|
-
priceVisible: t(
|
|
123
|
-
originalPriceVisible: t(
|
|
124
|
-
buttonVisible: t(
|
|
113
|
+
priceOrientation: r["data-product_original_price_control_orientation"] || "horizontal",
|
|
114
|
+
quantityControlEnabled: t(r["data-product_quantity_control_enabled"], !0),
|
|
115
|
+
buttonLink: e(r["data-product_button_link"], g.productButtonLinkControlValue),
|
|
116
|
+
imageLink: e(r["data-product_image_link"], g.productImageLinkControlValue),
|
|
117
|
+
buttonLabel: e(r["data-product_button_control_label"], "Buy"),
|
|
118
|
+
buttonFullWidth: t(r["data-product_button_control_atw"], !0),
|
|
119
|
+
imageVisible: t(r["data-product_image_control_enabled"], !0),
|
|
120
|
+
nameVisible: t(r["data-product_name_control_enabled"], !0),
|
|
121
|
+
quantityVisible: t(r["data-product_quantity_control_enabled"], !0),
|
|
122
|
+
priceVisible: t(r["data-product_price_control_enabled"], !0),
|
|
123
|
+
originalPriceVisible: t(r["data-product_original_price_control_enabled"], !0),
|
|
124
|
+
buttonVisible: t(r["data-product_button_control_enabled"], !0)
|
|
125
125
|
};
|
|
126
126
|
}
|
|
127
|
-
const
|
|
127
|
+
const $ = {
|
|
128
128
|
ins_apr: "CART_ITEMS",
|
|
129
129
|
browsed_item: "BROWSED_ITEMS",
|
|
130
130
|
purchased_item: "PURCHASED_ITEMS"
|
|
131
131
|
};
|
|
132
|
-
function
|
|
133
|
-
const
|
|
132
|
+
function x(r, t) {
|
|
133
|
+
const e = {
|
|
134
134
|
CART_ITEMS: `{{Abandoned Cart Item (${t}) Image}}`,
|
|
135
135
|
BROWSED_ITEMS: `{{Browsed Item (${t}) Image}}`,
|
|
136
136
|
PURCHASED_ITEMS: `{{Purchased Item (${t}) Image}}`
|
|
137
137
|
};
|
|
138
|
-
return r
|
|
138
|
+
return e[r] || e.CART_ITEMS;
|
|
139
139
|
}
|
|
140
|
-
function
|
|
141
|
-
const
|
|
140
|
+
function O(r, t) {
|
|
141
|
+
const e = {
|
|
142
142
|
CART_ITEMS: `{{Abandoned Cart Item (${t}) Url}}`,
|
|
143
143
|
BROWSED_ITEMS: `{{Browsed Item (${t}) Url}}`,
|
|
144
144
|
PURCHASED_ITEMS: `{{Purchased Item (${t}) Url}}`
|
|
145
145
|
};
|
|
146
|
-
return r
|
|
146
|
+
return e[r] || e.CART_ITEMS;
|
|
147
147
|
}
|
|
148
148
|
class V {
|
|
149
149
|
constructor() {
|
|
@@ -152,12 +152,12 @@ class V {
|
|
|
152
152
|
}
|
|
153
153
|
migrate(t) {
|
|
154
154
|
try {
|
|
155
|
-
let
|
|
156
|
-
|
|
157
|
-
const
|
|
155
|
+
let e = this.removeJinjaConditionals(t);
|
|
156
|
+
e = this.replaceTemplateVariables(e);
|
|
157
|
+
const i = this.parser.parseFromString(e, "text/html"), l = i.querySelectorAll(
|
|
158
158
|
"td.esd-cart-items-block, td.esd-browsed-items-block, td.esd-purchased-items-block"
|
|
159
159
|
);
|
|
160
|
-
return
|
|
160
|
+
return l.length === 0 ? (console.warn("ItemsBlockMigrator: No blocks found with items block selectors"), e) : (l.forEach((n) => {
|
|
161
161
|
const a = this.extractConfiguration(n), o = K({
|
|
162
162
|
orientation: a.orientation,
|
|
163
163
|
itemsType: a.itemsType,
|
|
@@ -173,19 +173,19 @@ class V {
|
|
|
173
173
|
originalPriceStyles: a.originalPriceStyles,
|
|
174
174
|
quantityStyles: a.quantityStyles,
|
|
175
175
|
nodeConfig: R(a.configBlockAttributes)
|
|
176
|
-
}),
|
|
176
|
+
}), c = this.parser.parseFromString(
|
|
177
177
|
`<table><tbody><tr>${o}</tr></tbody></table>`,
|
|
178
178
|
"text/html"
|
|
179
179
|
).querySelector("td");
|
|
180
|
-
if (
|
|
180
|
+
if (c && n.parentNode) {
|
|
181
181
|
const f = R(a.configBlockAttributes);
|
|
182
|
-
|
|
183
|
-
const
|
|
184
|
-
|
|
182
|
+
c.setAttribute("esd-ext-config", JSON.stringify(f));
|
|
183
|
+
const u = c.querySelector("esd-config-block");
|
|
184
|
+
u && u.remove(), n.parentNode.replaceChild(c, n);
|
|
185
185
|
}
|
|
186
|
-
}),
|
|
187
|
-
} catch (
|
|
188
|
-
return console.error("ItemsBlockMigrator failed:",
|
|
186
|
+
}), i.documentElement.outerHTML);
|
|
187
|
+
} catch (e) {
|
|
188
|
+
return console.error("ItemsBlockMigrator failed:", e), t;
|
|
189
189
|
}
|
|
190
190
|
}
|
|
191
191
|
/**
|
|
@@ -196,22 +196,22 @@ class V {
|
|
|
196
196
|
*/
|
|
197
197
|
extractConfiguration(t) {
|
|
198
198
|
var C, D, P;
|
|
199
|
-
const
|
|
200
|
-
let
|
|
201
|
-
|
|
202
|
-
const p = t.querySelector('a[product-attr="name"]'),
|
|
199
|
+
const e = ((C = t.querySelector("[data-type]")) == null ? void 0 : C.getAttribute("data-type")) || "CART_ITEMS", i = ((D = t.querySelector("[data-number]")) == null ? void 0 : D.getAttribute("data-number")) || "1", l = parseInt(i) - 1, n = E[e], a = ((P = n == null ? void 0 : n[l]) == null ? void 0 : P.value) || n[0].value, o = t.querySelector('[product-attr="price"]'), _ = (o == null ? void 0 : o.getAttribute("data-currency_symbol")) || "USD", f = ((o == null ? void 0 : o.getAttribute("data-curency")) || "before") === "after" ? "1" : "0", u = (o == null ? void 0 : o.getAttribute("data-formated")) !== "false", s = this.extractConfigBlockAttributes(t, e, i), b = s["data-card_orientation_control_value"];
|
|
200
|
+
let S;
|
|
201
|
+
b ? S = b === "horizontal" ? "horizontal" : "vertical" : S = t.querySelector('[colspan="2"]') !== null ? "vertical" : "horizontal";
|
|
202
|
+
const p = t.querySelector('a[product-attr="name"]'), T = (p == null ? void 0 : p.getAttribute("style")) || void 0, y = t.querySelector('a[product-attr="button"]'), m = (y == null ? void 0 : y.getAttribute("style")) || void 0, k = (o == null ? void 0 : o.getAttribute("style")) || void 0, I = t.querySelector("p.original-price"), h = (I == null ? void 0 : I.getAttribute("style")) || void 0, A = t.querySelector('[product-attr="quantity"]'), L = (A == null ? void 0 : A.getAttribute("style")) || void 0;
|
|
203
203
|
return {
|
|
204
|
-
orientation:
|
|
205
|
-
itemsType:
|
|
204
|
+
orientation: S,
|
|
205
|
+
itemsType: e,
|
|
206
206
|
itemId: a,
|
|
207
207
|
currencySymbol: _,
|
|
208
208
|
currencyLocation: f,
|
|
209
|
-
formattedPrice:
|
|
209
|
+
formattedPrice: u,
|
|
210
210
|
configBlockAttributes: s,
|
|
211
|
-
nameStyles:
|
|
211
|
+
nameStyles: T,
|
|
212
212
|
buttonStyles: m,
|
|
213
|
-
priceStyles:
|
|
214
|
-
originalPriceStyles:
|
|
213
|
+
priceStyles: k,
|
|
214
|
+
originalPriceStyles: h,
|
|
215
215
|
quantityStyles: L
|
|
216
216
|
};
|
|
217
217
|
}
|
|
@@ -222,17 +222,17 @@ class V {
|
|
|
222
222
|
* @param itemsType - The type of items (CART_ITEMS, BROWSED_ITEMS, PURCHASED_ITEMS)
|
|
223
223
|
* @param itemNumber - The item number (1-based index)
|
|
224
224
|
*/
|
|
225
|
-
extractConfigBlockAttributes(t,
|
|
226
|
-
const
|
|
227
|
-
if (!
|
|
225
|
+
extractConfigBlockAttributes(t, e, i) {
|
|
226
|
+
const l = t.querySelector("esd-config-block"), n = {};
|
|
227
|
+
if (!l)
|
|
228
228
|
return this.getDefaultConfigBlockAttributes();
|
|
229
|
-
if (Array.from(
|
|
229
|
+
if (Array.from(l.attributes).forEach((o) => {
|
|
230
230
|
o.name.startsWith("data-") && (n[o.name] = o.value);
|
|
231
231
|
}), n["data-cart_items_select_control_value"]) {
|
|
232
232
|
const o = n["data-cart_items_select_control_value"];
|
|
233
233
|
if (/^\d+$/.test(o)) {
|
|
234
|
-
const _ = parseInt(o) - 1,
|
|
235
|
-
|
|
234
|
+
const _ = parseInt(o) - 1, c = E[e];
|
|
235
|
+
c && c[_] && (n["data-cart_items_select_control_value"] = c[_].value);
|
|
236
236
|
}
|
|
237
237
|
}
|
|
238
238
|
if (n["data-product_price_control_curency"]) {
|
|
@@ -242,7 +242,7 @@ class V {
|
|
|
242
242
|
}
|
|
243
243
|
(!n["data-product_price_control_currency_symbol"] || n["data-product_price_control_currency_symbol"].trim() === "") && (n["data-product_price_control_currency_symbol"] = "USD");
|
|
244
244
|
const a = { ...this.getDefaultConfigBlockAttributes(), ...n };
|
|
245
|
-
return a["data-type"] =
|
|
245
|
+
return a["data-type"] = e, a["data-source"] = e, a["data-product_image_link"] = x(e, i), a["data-product_button_link"] = O(e, i), a;
|
|
246
246
|
}
|
|
247
247
|
/**
|
|
248
248
|
* Returns default esd-config-block attributes based on the old template structure
|
|
@@ -297,22 +297,18 @@ class V {
|
|
|
297
297
|
* - Cart Items: ins_apr_total_product_kind, ins_apr_price_N, ins_apr_originalprice_N
|
|
298
298
|
* - Browsed Items: browsed_item_total_product_kind, browsed_item_price_N, browsed_item_originalprice_N
|
|
299
299
|
* - Purchased Items: purchased_item_total_product_kind, purchased_item_price_N, purchased_item_originalprice_N
|
|
300
|
-
*
|
|
301
|
-
* IMPORTANT: Preserves the esd-custom-display-conditions attribute on <body> which
|
|
302
|
-
* contains display condition Jinja scripts that should NOT be removed.
|
|
303
300
|
*/
|
|
304
301
|
removeJinjaConditionals(t) {
|
|
305
|
-
|
|
306
|
-
let i = c ? t.replace(c[0], r) : t;
|
|
307
|
-
return i = i.replace(
|
|
302
|
+
let e = t.replace(
|
|
308
303
|
/\{%\s*if\s+(ins_apr|browsed_item|purchased_item)_total_product_kind\s*(>|>)\s*\d+\s*%\}/g,
|
|
309
304
|
""
|
|
310
|
-
)
|
|
305
|
+
);
|
|
306
|
+
return e = e.replace(
|
|
311
307
|
/\{%\s*if\s+(ins_apr|browsed_item|purchased_item)_price_\d+\s*(!=|!=)\s*\1_originalprice_\d+\s*%\}/g,
|
|
312
308
|
""
|
|
313
|
-
),
|
|
309
|
+
), e = e.replace(/\{%\s*endif\s*%\}/g, ""), e = e.replace(/\n\s*\n\s*\n/g, `
|
|
314
310
|
|
|
315
|
-
`),
|
|
311
|
+
`), e;
|
|
316
312
|
}
|
|
317
313
|
/**
|
|
318
314
|
* Replaces template variables with default values from productPairs
|
|
@@ -324,31 +320,31 @@ class V {
|
|
|
324
320
|
* - {{purchased_item_formattedprice_5}} → '1,490.49' (PURCHASED_ITEMS)
|
|
325
321
|
*/
|
|
326
322
|
replaceTemplateVariables(t) {
|
|
327
|
-
const { PAIRS_FOR_EXTENSION:
|
|
328
|
-
return t.replace(/{{([^}]+)}}/g, (
|
|
329
|
-
const n =
|
|
323
|
+
const { PAIRS_FOR_EXTENSION: e } = v;
|
|
324
|
+
return t.replace(/{{([^}]+)}}/g, (i, l) => {
|
|
325
|
+
const n = l.match(/^(ins_apr|browsed_item|purchased_item)_([a-z_]+)_(\d+)$/);
|
|
330
326
|
if (!n)
|
|
331
|
-
return
|
|
332
|
-
const [, a, o, _] = n,
|
|
333
|
-
if (!
|
|
334
|
-
return console.warn(`Unknown variable prefix: ${a}`),
|
|
327
|
+
return i;
|
|
328
|
+
const [, a, o, _] = n, c = $[a];
|
|
329
|
+
if (!c)
|
|
330
|
+
return console.warn(`Unknown variable prefix: ${a}`), i;
|
|
335
331
|
const f = w[o];
|
|
336
332
|
if (!f)
|
|
337
|
-
return console.warn(`Unknown variable suffix mapping for: ${o}`),
|
|
338
|
-
const { pairsKey:
|
|
333
|
+
return console.warn(`Unknown variable suffix mapping for: ${o}`), i;
|
|
334
|
+
const { pairsKey: u, defaultKey: s, isArray: b } = f, p = e[u][c];
|
|
339
335
|
if (!p)
|
|
340
|
-
return console.warn(`No data found for: ${
|
|
341
|
-
if (
|
|
336
|
+
return console.warn(`No data found for: ${u}.${c}`), i;
|
|
337
|
+
if (b) {
|
|
342
338
|
const y = parseInt(_) - 1, m = p[s];
|
|
343
|
-
return Array.isArray(m) && m[y] ? m[y] : (console.warn(`Array value not found: ${
|
|
339
|
+
return Array.isArray(m) && m[y] ? m[y] : (console.warn(`Array value not found: ${u}.${c}.${s}[${y}]`), i);
|
|
344
340
|
}
|
|
345
|
-
const
|
|
346
|
-
return
|
|
341
|
+
const T = p[s];
|
|
342
|
+
return T !== void 0 ? String(T) : (console.warn(`Default value not found: ${u}.${c}.${s}`), i);
|
|
347
343
|
});
|
|
348
344
|
}
|
|
349
345
|
}
|
|
350
|
-
function G(
|
|
351
|
-
return new V().migrate(
|
|
346
|
+
function G(r) {
|
|
347
|
+
return new V().migrate(r);
|
|
352
348
|
}
|
|
353
349
|
export {
|
|
354
350
|
G as migrateItemsBlock
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { useTranslations as e } from "../composables/useTranslations.js";
|
|
2
2
|
import { getEnvironmentPrefix as R } from "../utils/environmentUtil.js";
|
|
3
|
-
const
|
|
3
|
+
const I = {
|
|
4
4
|
UNSUBSCRIBE_LINK_TYPE: 1,
|
|
5
5
|
PREFERENCES_LINK_TYPE: 3
|
|
6
|
-
},
|
|
6
|
+
}, r = {
|
|
7
7
|
UNSUBSCRIBE_LINK_REGEX: /{{ins-unsubscribe-link}}/g,
|
|
8
8
|
DATA_OGSB_BUTTON_CSS_REGEX: "\\[data-ogsb\\]\\s*\\.es-button\\.es-button-[0-9]+\\s*\\{(?:[^\\}]*)\\}",
|
|
9
9
|
GLOBAL_UNSUBSCRIBE_LINK_REGEX: /{{ins-global-unsubscribe-link}}/g,
|
|
10
10
|
PREFERENCES_UNSUBSCRIBE_LINK_REGEX: /{{ins-preferences-unsubscribe-link}}/g
|
|
11
|
-
},
|
|
12
|
-
UNSUBSCRIBE_URL: `https://mail.${
|
|
13
|
-
PREFERENCES_URL: `https://mail.${
|
|
14
|
-
},
|
|
11
|
+
}, s = R(), _ = {
|
|
12
|
+
UNSUBSCRIBE_URL: `https://mail.${s}.com/user/v1/unsub`,
|
|
13
|
+
PREFERENCES_URL: `https://mail.${s}.com/user/v1/prefs`
|
|
14
|
+
}, i = "iid", B = {
|
|
15
15
|
name: "Global Unsubscribe",
|
|
16
16
|
sendGridId: "G"
|
|
17
17
|
}, C = "/email/unsubscribe-pages", E = {
|
|
@@ -20,9 +20,6 @@ const _ = {
|
|
|
20
20
|
SUBSCRIPTION_PREFERENCE_CENTER: 3,
|
|
21
21
|
SUBSCRIPTION_PREFERENCE_CONFIRMATION: 4,
|
|
22
22
|
RESUBSCRIBE: 5
|
|
23
|
-
}, U = {
|
|
24
|
-
[E.GLOBAL_UNSUBSCRIBE]: "custom-unsubscribe",
|
|
25
|
-
[E.SUBSCRIPTION_PREFERENCE_CENTER]: "custom-preferences"
|
|
26
23
|
}, t = {
|
|
27
24
|
[E.GLOBAL_UNSUBSCRIBE]: [
|
|
28
25
|
E.GLOBAL_UNSUBSCRIBE,
|
|
@@ -33,30 +30,29 @@ const _ = {
|
|
|
33
30
|
E.SUBSCRIPTION_PREFERENCE_CENTER,
|
|
34
31
|
E.SUBSCRIPTION_PREFERENCE_CONFIRMATION
|
|
35
32
|
]
|
|
36
|
-
},
|
|
37
|
-
const
|
|
33
|
+
}, U = () => {
|
|
34
|
+
const n = e();
|
|
38
35
|
return {
|
|
39
|
-
[E.GLOBAL_UNSUBSCRIBE]:
|
|
40
|
-
[E.GLOBAL_UNSUBSCRIBE_CONFIRMATION_PAGE]:
|
|
41
|
-
[E.RESUBSCRIBE]:
|
|
42
|
-
[E.SUBSCRIPTION_PREFERENCE_CENTER]:
|
|
43
|
-
[E.SUBSCRIPTION_PREFERENCE_CONFIRMATION]:
|
|
36
|
+
[E.GLOBAL_UNSUBSCRIBE]: n("unsubscription-preference.type-global-unsubscribe"),
|
|
37
|
+
[E.GLOBAL_UNSUBSCRIBE_CONFIRMATION_PAGE]: n("unsubscription-preference.type-global-unsubscription-confirmation"),
|
|
38
|
+
[E.RESUBSCRIBE]: n("unsubscription-preference.type-resubscribe"),
|
|
39
|
+
[E.SUBSCRIPTION_PREFERENCE_CENTER]: n("unsubscription-preference.type-subscription-preferences-center"),
|
|
40
|
+
[E.SUBSCRIPTION_PREFERENCE_CONFIRMATION]: n("unsubscription-preference.type-subscription-preferences-confirmation")
|
|
44
41
|
};
|
|
45
|
-
},
|
|
42
|
+
}, c = {
|
|
46
43
|
default: "{{ins-unsubscribe-link}}",
|
|
47
44
|
[E.GLOBAL_UNSUBSCRIBE]: "{{ins-global-unsubscribe-link}}",
|
|
48
45
|
[E.SUBSCRIPTION_PREFERENCE_CENTER]: "{{ins-preferences-unsubscribe-link}}"
|
|
49
46
|
};
|
|
50
47
|
export {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
48
|
+
B as DEFAULT_UNSUBSCRIBE_GROUP,
|
|
49
|
+
i as INSIDER_ID,
|
|
50
|
+
r as LINK_REGEXES,
|
|
51
|
+
I as LINK_TYPES,
|
|
52
|
+
c as MERGE_TAGS,
|
|
56
53
|
E as PAGE_TYPES,
|
|
57
54
|
t as TYPE_COLLECTIONS,
|
|
58
55
|
C as UNSUBSCRIBE_PAGES_LINK,
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
c as getTypeTranslations
|
|
56
|
+
_ as URLS,
|
|
57
|
+
U as getTypeTranslations
|
|
62
58
|
};
|
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
import { useHttp as
|
|
2
|
-
import { useToaster as
|
|
1
|
+
import { useHttp as m } from "../composables/useHttp.js";
|
|
2
|
+
import { useToaster as i } from "../composables/useToaster.js";
|
|
3
3
|
import { MAX_DEFAULT_TEMPLATE_ID as p } from "../enums/defaults.js";
|
|
4
|
-
const
|
|
5
|
-
const { get:
|
|
4
|
+
const y = () => {
|
|
5
|
+
const { get: r } = m(), { handleError: o } = i();
|
|
6
6
|
return {
|
|
7
7
|
getToken: async () => {
|
|
8
8
|
try {
|
|
9
|
-
const t = Number(localStorage.getItem("ins-guido-test-instance")), { data: e } = await
|
|
9
|
+
const t = Number(localStorage.getItem("ins-guido-test-instance")), { data: e } = await r(`/stripo/get-user-token?test=${t}`);
|
|
10
10
|
return e.body.token;
|
|
11
11
|
} catch (t) {
|
|
12
|
-
return
|
|
12
|
+
return o(t, "Failed to fetch token"), "";
|
|
13
13
|
}
|
|
14
14
|
},
|
|
15
15
|
getCustomFonts: async () => {
|
|
16
16
|
try {
|
|
17
|
-
const { data: t = [] } = await
|
|
17
|
+
const { data: t = [] } = await r("/stripo/get-partner-custom-fonts");
|
|
18
18
|
return t.map((e) => ({
|
|
19
19
|
...e,
|
|
20
20
|
active: !0
|
|
21
21
|
}));
|
|
22
22
|
} catch (t) {
|
|
23
|
-
return
|
|
23
|
+
return o(t, "Failed to fetch custom fonts"), [];
|
|
24
24
|
}
|
|
25
25
|
},
|
|
26
26
|
getDefaultTemplate: async () => {
|
|
@@ -29,52 +29,16 @@ const b = () => {
|
|
|
29
29
|
css: ""
|
|
30
30
|
};
|
|
31
31
|
try {
|
|
32
|
-
const
|
|
33
|
-
`/stripo/default-template/${
|
|
34
|
-
),
|
|
35
|
-
return !
|
|
32
|
+
const c = new URLSearchParams(window.location.search).get("default-template"), s = c ? parseInt(c) : 0, l = s >= 1 && s <= p ? s : 0, { data: n } = await r(
|
|
33
|
+
`/stripo/default-template/${l}`
|
|
34
|
+
), a = typeof n == "string" ? JSON.parse(n) : n;
|
|
35
|
+
return !a || typeof a != "object" || !("html" in a) || !("css" in a) ? t : a;
|
|
36
36
|
} catch (e) {
|
|
37
|
-
return
|
|
38
|
-
}
|
|
39
|
-
},
|
|
40
|
-
getSyncModulesStatus: async () => {
|
|
41
|
-
try {
|
|
42
|
-
const { data: t } = await s("/newsletter/settings/synchronisation-in-modules-status");
|
|
43
|
-
return t.status;
|
|
44
|
-
} catch (t) {
|
|
45
|
-
return r(t, "Failed to fetch sync modules status"), !1;
|
|
46
|
-
}
|
|
47
|
-
},
|
|
48
|
-
updateSyncModule: async (t) => {
|
|
49
|
-
try {
|
|
50
|
-
return await c(`/stripo/stripo-modules/${t.moduleId}/update`, t), !0;
|
|
51
|
-
} catch (e) {
|
|
52
|
-
return r(e, "Failed to update sync module"), !1;
|
|
53
|
-
}
|
|
54
|
-
},
|
|
55
|
-
getSyncModule: async (t) => {
|
|
56
|
-
try {
|
|
57
|
-
const { data: e } = await s(`/stripo/stripo-modules/${t}/get`);
|
|
58
|
-
return e;
|
|
59
|
-
} catch (e) {
|
|
60
|
-
return r(e, "Failed to get sync module"), {
|
|
61
|
-
id: 0,
|
|
62
|
-
stripoId: 0,
|
|
63
|
-
unsubscriptionPreferencePages: []
|
|
64
|
-
};
|
|
65
|
-
}
|
|
66
|
-
},
|
|
67
|
-
setSyncModuleUnsubscriptionPages: async (t) => {
|
|
68
|
-
if (t.length === 0)
|
|
69
|
-
return !0;
|
|
70
|
-
try {
|
|
71
|
-
return await c("/stripo/stripo-modules/set-unsubscription-preference-pages", t), !0;
|
|
72
|
-
} catch (e) {
|
|
73
|
-
return r(e, "Failed to set unsubscription preference pages"), !1;
|
|
37
|
+
return o(e, "Failed to fetch default template"), t;
|
|
74
38
|
}
|
|
75
39
|
}
|
|
76
40
|
};
|
|
77
41
|
};
|
|
78
42
|
export {
|
|
79
|
-
|
|
43
|
+
y as useStripoApi
|
|
80
44
|
};
|
|
@@ -1,38 +1,6 @@
|
|
|
1
|
-
export type StripoEventType = 'save' | 'export' | 'close' | 'autosave' | 'publish' | 'export:requested' | 'export:ready'
|
|
2
|
-
export interface ModuleUpdatedParams {
|
|
3
|
-
target: string;
|
|
4
|
-
blockType: string;
|
|
5
|
-
moduleId: number;
|
|
6
|
-
moduleCategory: string | null;
|
|
7
|
-
syncModule: boolean;
|
|
8
|
-
}
|
|
9
|
-
export interface ModuleDroppedParams {
|
|
10
|
-
target: string;
|
|
11
|
-
blockType: string;
|
|
12
|
-
moduleId: number;
|
|
13
|
-
syncModule: boolean;
|
|
14
|
-
}
|
|
15
|
-
export interface SyncModuleUnsubscribePayload {
|
|
16
|
-
stripoModuleId: string;
|
|
17
|
-
unsubscriptionPreferencePages: number[];
|
|
18
|
-
type: string;
|
|
19
|
-
}
|
|
20
|
-
export interface SyncModuleResponse {
|
|
21
|
-
id: number;
|
|
22
|
-
stripoId: number;
|
|
23
|
-
unsubscriptionPreferencePages: UnsubscriptionPreferencePage[];
|
|
24
|
-
}
|
|
25
|
-
export interface UnsubscriptionPreferencePage {
|
|
26
|
-
id: number;
|
|
27
|
-
name: string;
|
|
28
|
-
type: number;
|
|
29
|
-
status: number;
|
|
30
|
-
isVisible: number;
|
|
31
|
-
thumbnail: string;
|
|
32
|
-
createdAt: string;
|
|
33
|
-
}
|
|
1
|
+
export type StripoEventType = 'save' | 'export' | 'close' | 'autosave' | 'publish' | 'export:requested' | 'export:ready';
|
|
34
2
|
export interface EventHandler {
|
|
35
|
-
(params: Record<string,
|
|
3
|
+
(params: Record<string, string>): void | Promise<void>;
|
|
36
4
|
}
|
|
37
5
|
export interface EventHandlers {
|
|
38
6
|
[eventType: string]: EventHandler;
|
|
@@ -25,9 +25,6 @@ export declare const PAGE_TYPES: {
|
|
|
25
25
|
SUBSCRIPTION_PREFERENCE_CONFIRMATION: number;
|
|
26
26
|
RESUBSCRIBE: number;
|
|
27
27
|
};
|
|
28
|
-
export declare const UNSUBSCRIBE_SYNC_MODULE_TYPES: {
|
|
29
|
-
[x: number]: string;
|
|
30
|
-
};
|
|
31
28
|
export declare const TYPE_COLLECTIONS: {
|
|
32
29
|
[x: number]: number[];
|
|
33
30
|
};
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { ModuleUpdatedParams, SyncModuleResponse, SyncModuleUnsubscribePayload } from '@@/Types/events';
|
|
2
1
|
import type { CustomFont, Template } from '@@/Types/stripo';
|
|
3
2
|
export declare const useStripoApi: () => {
|
|
4
3
|
getToken: () => Promise<string>;
|
|
@@ -6,8 +5,4 @@ export declare const useStripoApi: () => {
|
|
|
6
5
|
active: boolean;
|
|
7
6
|
})[]>;
|
|
8
7
|
getDefaultTemplate: () => Promise<Template>;
|
|
9
|
-
getSyncModulesStatus: () => Promise<boolean>;
|
|
10
|
-
updateSyncModule: (params: ModuleUpdatedParams) => Promise<boolean>;
|
|
11
|
-
getSyncModule: (moduleId: number) => Promise<SyncModuleResponse>;
|
|
12
|
-
setSyncModuleUnsubscriptionPages: (payload: SyncModuleUnsubscribePayload[]) => Promise<boolean>;
|
|
13
8
|
};
|
|
@@ -8,7 +8,6 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
|
|
|
8
8
|
hasChanges: boolean;
|
|
9
9
|
isStripoInitialized: boolean;
|
|
10
10
|
templateId: string;
|
|
11
|
-
syncModulesEnabled: boolean;
|
|
12
11
|
}, {
|
|
13
12
|
isEditorToolbarVisible: (state: {
|
|
14
13
|
loadingStatus: boolean;
|
|
@@ -20,7 +19,6 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
|
|
|
20
19
|
hasChanges: boolean;
|
|
21
20
|
isStripoInitialized: boolean;
|
|
22
21
|
templateId: string;
|
|
23
|
-
syncModulesEnabled: boolean;
|
|
24
22
|
} & import("pinia").PiniaCustomStateProperties<{
|
|
25
23
|
loadingStatus: boolean;
|
|
26
24
|
isCodeEditorOpen: boolean;
|
|
@@ -31,7 +29,6 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
|
|
|
31
29
|
hasChanges: boolean;
|
|
32
30
|
isStripoInitialized: boolean;
|
|
33
31
|
templateId: string;
|
|
34
|
-
syncModulesEnabled: boolean;
|
|
35
32
|
}>) => boolean;
|
|
36
33
|
isUndoButtonDisabled: (state: {
|
|
37
34
|
loadingStatus: boolean;
|
|
@@ -43,7 +40,6 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
|
|
|
43
40
|
hasChanges: boolean;
|
|
44
41
|
isStripoInitialized: boolean;
|
|
45
42
|
templateId: string;
|
|
46
|
-
syncModulesEnabled: boolean;
|
|
47
43
|
} & import("pinia").PiniaCustomStateProperties<{
|
|
48
44
|
loadingStatus: boolean;
|
|
49
45
|
isCodeEditorOpen: boolean;
|
|
@@ -54,7 +50,6 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
|
|
|
54
50
|
hasChanges: boolean;
|
|
55
51
|
isStripoInitialized: boolean;
|
|
56
52
|
templateId: string;
|
|
57
|
-
syncModulesEnabled: boolean;
|
|
58
53
|
}>) => boolean;
|
|
59
54
|
isRedoButtonDisabled: (state: {
|
|
60
55
|
loadingStatus: boolean;
|
|
@@ -66,7 +61,6 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
|
|
|
66
61
|
hasChanges: boolean;
|
|
67
62
|
isStripoInitialized: boolean;
|
|
68
63
|
templateId: string;
|
|
69
|
-
syncModulesEnabled: boolean;
|
|
70
64
|
} & import("pinia").PiniaCustomStateProperties<{
|
|
71
65
|
loadingStatus: boolean;
|
|
72
66
|
isCodeEditorOpen: boolean;
|
|
@@ -77,7 +71,6 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
|
|
|
77
71
|
hasChanges: boolean;
|
|
78
72
|
isStripoInitialized: boolean;
|
|
79
73
|
templateId: string;
|
|
80
|
-
syncModulesEnabled: boolean;
|
|
81
74
|
}>) => boolean;
|
|
82
75
|
isCodeEditorButtonDisabled: (state: {
|
|
83
76
|
loadingStatus: boolean;
|
|
@@ -89,7 +82,6 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
|
|
|
89
82
|
hasChanges: boolean;
|
|
90
83
|
isStripoInitialized: boolean;
|
|
91
84
|
templateId: string;
|
|
92
|
-
syncModulesEnabled: boolean;
|
|
93
85
|
} & import("pinia").PiniaCustomStateProperties<{
|
|
94
86
|
loadingStatus: boolean;
|
|
95
87
|
isCodeEditorOpen: boolean;
|
|
@@ -100,7 +92,6 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
|
|
|
100
92
|
hasChanges: boolean;
|
|
101
93
|
isStripoInitialized: boolean;
|
|
102
94
|
templateId: string;
|
|
103
|
-
syncModulesEnabled: boolean;
|
|
104
95
|
}>) => boolean;
|
|
105
96
|
isPreviewButtonDisabled: (state: {
|
|
106
97
|
loadingStatus: boolean;
|
|
@@ -112,7 +103,6 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
|
|
|
112
103
|
hasChanges: boolean;
|
|
113
104
|
isStripoInitialized: boolean;
|
|
114
105
|
templateId: string;
|
|
115
|
-
syncModulesEnabled: boolean;
|
|
116
106
|
} & import("pinia").PiniaCustomStateProperties<{
|
|
117
107
|
loadingStatus: boolean;
|
|
118
108
|
isCodeEditorOpen: boolean;
|
|
@@ -123,7 +113,6 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
|
|
|
123
113
|
hasChanges: boolean;
|
|
124
114
|
isStripoInitialized: boolean;
|
|
125
115
|
templateId: string;
|
|
126
|
-
syncModulesEnabled: boolean;
|
|
127
116
|
}>) => boolean;
|
|
128
117
|
isViewOptionsDisabled: (state: {
|
|
129
118
|
loadingStatus: boolean;
|
|
@@ -135,7 +124,6 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
|
|
|
135
124
|
hasChanges: boolean;
|
|
136
125
|
isStripoInitialized: boolean;
|
|
137
126
|
templateId: string;
|
|
138
|
-
syncModulesEnabled: boolean;
|
|
139
127
|
} & import("pinia").PiniaCustomStateProperties<{
|
|
140
128
|
loadingStatus: boolean;
|
|
141
129
|
isCodeEditorOpen: boolean;
|
|
@@ -146,7 +134,6 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
|
|
|
146
134
|
hasChanges: boolean;
|
|
147
135
|
isStripoInitialized: boolean;
|
|
148
136
|
templateId: string;
|
|
149
|
-
syncModulesEnabled: boolean;
|
|
150
137
|
}>) => boolean;
|
|
151
138
|
isVersionHistoryButtonDisabled: (state: {
|
|
152
139
|
loadingStatus: boolean;
|
|
@@ -158,7 +145,6 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
|
|
|
158
145
|
hasChanges: boolean;
|
|
159
146
|
isStripoInitialized: boolean;
|
|
160
147
|
templateId: string;
|
|
161
|
-
syncModulesEnabled: boolean;
|
|
162
148
|
} & import("pinia").PiniaCustomStateProperties<{
|
|
163
149
|
loadingStatus: boolean;
|
|
164
150
|
isCodeEditorOpen: boolean;
|
|
@@ -169,7 +155,6 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
|
|
|
169
155
|
hasChanges: boolean;
|
|
170
156
|
isStripoInitialized: boolean;
|
|
171
157
|
templateId: string;
|
|
172
|
-
syncModulesEnabled: boolean;
|
|
173
158
|
}>) => boolean;
|
|
174
159
|
isExportButtonDisabled: (state: {
|
|
175
160
|
loadingStatus: boolean;
|
|
@@ -181,7 +166,6 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
|
|
|
181
166
|
hasChanges: boolean;
|
|
182
167
|
isStripoInitialized: boolean;
|
|
183
168
|
templateId: string;
|
|
184
|
-
syncModulesEnabled: boolean;
|
|
185
169
|
} & import("pinia").PiniaCustomStateProperties<{
|
|
186
170
|
loadingStatus: boolean;
|
|
187
171
|
isCodeEditorOpen: boolean;
|
|
@@ -192,7 +176,6 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
|
|
|
192
176
|
hasChanges: boolean;
|
|
193
177
|
isStripoInitialized: boolean;
|
|
194
178
|
templateId: string;
|
|
195
|
-
syncModulesEnabled: boolean;
|
|
196
179
|
}>) => boolean;
|
|
197
180
|
isSaveAsButtonDisabled: (state: {
|
|
198
181
|
loadingStatus: boolean;
|
|
@@ -204,7 +187,6 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
|
|
|
204
187
|
hasChanges: boolean;
|
|
205
188
|
isStripoInitialized: boolean;
|
|
206
189
|
templateId: string;
|
|
207
|
-
syncModulesEnabled: boolean;
|
|
208
190
|
} & import("pinia").PiniaCustomStateProperties<{
|
|
209
191
|
loadingStatus: boolean;
|
|
210
192
|
isCodeEditorOpen: boolean;
|
|
@@ -215,7 +197,6 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
|
|
|
215
197
|
hasChanges: boolean;
|
|
216
198
|
isStripoInitialized: boolean;
|
|
217
199
|
templateId: string;
|
|
218
|
-
syncModulesEnabled: boolean;
|
|
219
200
|
}>) => boolean;
|
|
220
201
|
isTestButtonDisabled: (state: {
|
|
221
202
|
loadingStatus: boolean;
|
|
@@ -227,7 +208,6 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
|
|
|
227
208
|
hasChanges: boolean;
|
|
228
209
|
isStripoInitialized: boolean;
|
|
229
210
|
templateId: string;
|
|
230
|
-
syncModulesEnabled: boolean;
|
|
231
211
|
} & import("pinia").PiniaCustomStateProperties<{
|
|
232
212
|
loadingStatus: boolean;
|
|
233
213
|
isCodeEditorOpen: boolean;
|
|
@@ -238,7 +218,6 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
|
|
|
238
218
|
hasChanges: boolean;
|
|
239
219
|
isStripoInitialized: boolean;
|
|
240
220
|
templateId: string;
|
|
241
|
-
syncModulesEnabled: boolean;
|
|
242
221
|
}>) => boolean;
|
|
243
222
|
isSaveButtonDisabled: (state: {
|
|
244
223
|
loadingStatus: boolean;
|
|
@@ -250,7 +229,6 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
|
|
|
250
229
|
hasChanges: boolean;
|
|
251
230
|
isStripoInitialized: boolean;
|
|
252
231
|
templateId: string;
|
|
253
|
-
syncModulesEnabled: boolean;
|
|
254
232
|
} & import("pinia").PiniaCustomStateProperties<{
|
|
255
233
|
loadingStatus: boolean;
|
|
256
234
|
isCodeEditorOpen: boolean;
|
|
@@ -261,6 +239,5 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
|
|
|
261
239
|
hasChanges: boolean;
|
|
262
240
|
isStripoInitialized: boolean;
|
|
263
241
|
templateId: string;
|
|
264
|
-
syncModulesEnabled: boolean;
|
|
265
242
|
}>) => boolean;
|
|
266
243
|
}, {}>;
|
package/dist/stores/editor.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@useinsider/guido",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.2.0-beta.1696353",
|
|
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",
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { UNSUBSCRIBE_SYNC_MODULE_TYPES as S } from "../enums/unsubscribe.js";
|
|
2
|
-
import { DATA_ATTRIBUTES as a } from "../extensions/Blocks/Unsubscribe/utils/constants.js";
|
|
3
|
-
import { useEditorStore as d } from "../stores/editor.js";
|
|
4
|
-
const T = ".esd-synchronizable-module", m = '[esd-extension-block-id="unsubscribe-block"]', A = "esd-custom-block-id", M = () => {
|
|
5
|
-
const l = d();
|
|
6
|
-
return { extractSyncModuleUnsubscribeData: (p) => {
|
|
7
|
-
if (!l.syncModulesEnabled)
|
|
8
|
-
return [];
|
|
9
|
-
const E = new DOMParser().parseFromString(p, "text/html").querySelectorAll(T), e = [];
|
|
10
|
-
return E.forEach((r) => {
|
|
11
|
-
const s = r.getAttribute(A);
|
|
12
|
-
if (!s)
|
|
13
|
-
return;
|
|
14
|
-
r.querySelectorAll(m).forEach((o) => {
|
|
15
|
-
const n = o.getAttribute(a.PAGE_LIST), c = o.getAttribute(a.PAGE_TYPE);
|
|
16
|
-
if (!n || !c)
|
|
17
|
-
return;
|
|
18
|
-
const b = parseInt(c), u = S[b];
|
|
19
|
-
if (!u)
|
|
20
|
-
return;
|
|
21
|
-
const i = n.split(",").map((t) => parseInt(t.trim())).filter((t) => !Number.isNaN(t));
|
|
22
|
-
i.length !== 0 && e.push({
|
|
23
|
-
stripoModuleId: s,
|
|
24
|
-
unsubscriptionPreferencePages: i,
|
|
25
|
-
type: u
|
|
26
|
-
});
|
|
27
|
-
});
|
|
28
|
-
}), e;
|
|
29
|
-
} };
|
|
30
|
-
};
|
|
31
|
-
export {
|
|
32
|
-
M as useSyncModuleExtractor
|
|
33
|
-
};
|