@useinsider/guido 3.1.1-beta.4fc983e → 3.1.1-beta.513425d
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/@types/config/schemas.js +9 -7
- package/dist/components/organisms/header/RightSlot.vue.js +10 -10
- package/dist/components/organisms/header/RightSlot.vue2.js +16 -13
- package/dist/composables/useHtmlCompiler.js +19 -17
- package/dist/composables/useSave.js +17 -16
- package/dist/composables/useStripo.js +32 -32
- package/dist/composables/validators/useLiquidValidator.js +28 -0
- package/dist/config/compiler/liquidCompilerRules.js +14 -0
- package/dist/config/compiler/unsubscribeCompilerRules.js +37 -37
- package/dist/extensions/Blocks/CouponBlock/template.js +22 -13
- package/dist/extensions/Blocks/Recommendation/block.js +1 -1
- package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +1 -1
- package/dist/extensions/Blocks/Recommendation/controls/spacing/index.js +79 -81
- package/dist/extensions/Blocks/Recommendation/utils/tagName.js +6 -6
- package/dist/extensions/Blocks/Unsubscribe/settingsPanel.js +17 -16
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js +218 -324
- package/dist/package.json.js +1 -1
- package/dist/src/@types/config/schemas.d.ts +4 -0
- package/dist/src/@types/generic.d.ts +1 -0
- package/dist/src/composables/useConfig.d.ts +2 -0
- package/dist/src/composables/validators/useLiquidValidator.d.ts +3 -0
- package/dist/src/config/compiler/liquidCompilerRules.d.ts +2 -0
- package/dist/src/extensions/Blocks/Recommendation/utils/tagName.d.ts +3 -3
- package/dist/src/stores/config.d.ts +18 -0
- package/dist/static/styles/components/button.css.js +7 -13
- package/dist/static/styles/components/narrow-panel.css.js +0 -52
- package/dist/utils/templatePreparation.js +16 -14
- package/dist/utils/tooltipUtils.js +5 -4
- package/package.json +4 -4
|
@@ -114,7 +114,9 @@ const m = {
|
|
|
114
114
|
/** Enable unsubscribe block */
|
|
115
115
|
unsubscribe: e(a(), !0),
|
|
116
116
|
/** Disable modules panel in the editor */
|
|
117
|
-
modulesDisabled: e(a(), !1)
|
|
117
|
+
modulesDisabled: e(a(), !1),
|
|
118
|
+
/** Enable Liquid template syntax */
|
|
119
|
+
liquidSyntax: e(a(), !1)
|
|
118
120
|
}), E = n([
|
|
119
121
|
"amp-accordion",
|
|
120
122
|
"amp-carousel",
|
|
@@ -191,12 +193,12 @@ const m = {
|
|
|
191
193
|
M,
|
|
192
194
|
N,
|
|
193
195
|
D
|
|
194
|
-
]),
|
|
196
|
+
]), x = o({
|
|
195
197
|
/** Custom compiler rules to apply */
|
|
196
198
|
customRules: e(c(v), []),
|
|
197
199
|
/** Skip default compiler rules */
|
|
198
200
|
ignoreDefaultRules: e(a(), !1)
|
|
199
|
-
}),
|
|
201
|
+
}), U = o({
|
|
200
202
|
/**
|
|
201
203
|
* External validation handler called before save completes.
|
|
202
204
|
* Return false to cancel the save operation.
|
|
@@ -225,15 +227,15 @@ const m = {
|
|
|
225
227
|
/** Block configuration */
|
|
226
228
|
blocks: e(O, {}),
|
|
227
229
|
/** Compiler configuration */
|
|
228
|
-
compiler: e(
|
|
230
|
+
compiler: e(x, {}),
|
|
229
231
|
/** Callbacks and event handlers */
|
|
230
|
-
callbacks: e(
|
|
232
|
+
callbacks: e(U, {})
|
|
231
233
|
});
|
|
232
234
|
export {
|
|
233
235
|
O as BlocksSchema,
|
|
234
|
-
|
|
236
|
+
U as CallbacksSchema,
|
|
235
237
|
v as CompilerRuleSchema,
|
|
236
|
-
|
|
238
|
+
x as CompilerSchema,
|
|
237
239
|
g as CustomBlockTypeSchema,
|
|
238
240
|
D as CustomRuleSchema,
|
|
239
241
|
E as DefaultBlockTypeSchema,
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
return
|
|
6
|
-
},
|
|
7
|
-
o,
|
|
8
|
-
n,
|
|
1
|
+
import i from "./RightSlot.vue2.js";
|
|
2
|
+
import r from "../../../_virtual/_plugin-vue2_normalizer.js";
|
|
3
|
+
var o = function() {
|
|
4
|
+
var s = this, e = s._self._c, t = s._self._setupProxy;
|
|
5
|
+
return e("div", { staticClass: "d-f a-i-c" }, [t.isLiquidEnabled && !t.editorStore.isVersionHistoryOpen ? e(t.InChips, { staticClass: "mr-3", attrs: { id: "guido__liquid-tag-chip", styles: "stroke", type: "default", value: "liquid-tags", "close-button": !1, "disabled-status": t.editorStore.loadingStatus, interactive: !1, text: t.trans("email-editor.liquid-tags-enabled") } }) : s._e(), t.editorStore.isVersionHistoryOpen ? e(t.RestoreButton) : e(t.EditorActions, { ref: "editorActionsRef" })], 1);
|
|
6
|
+
}, a = [], n = /* @__PURE__ */ r(
|
|
9
7
|
i,
|
|
8
|
+
o,
|
|
9
|
+
a,
|
|
10
10
|
!1,
|
|
11
11
|
null,
|
|
12
12
|
null
|
|
13
13
|
);
|
|
14
|
-
const
|
|
14
|
+
const u = n.exports;
|
|
15
15
|
export {
|
|
16
|
-
|
|
16
|
+
u as default
|
|
17
17
|
};
|
|
@@ -1,19 +1,22 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
|
|
1
|
+
import { defineComponent as a, ref as f, computed as p } from "vue";
|
|
2
|
+
import { useConfig as u } from "../../../composables/useConfig.js";
|
|
3
|
+
import { useTranslations as d } from "../../../composables/useTranslations.js";
|
|
4
|
+
import { useEditorStore as c } from "../../../stores/editor.js";
|
|
5
|
+
import { InChips as l } from "@useinsider/design-system-vue";
|
|
6
|
+
import _ from "./EditorActions.vue.js";
|
|
7
|
+
import S from "./version-history/RestoreButton.vue.js";
|
|
8
|
+
const x = /* @__PURE__ */ a({
|
|
6
9
|
__name: "RightSlot",
|
|
7
|
-
setup(
|
|
8
|
-
const
|
|
9
|
-
return
|
|
10
|
-
handleSave: (
|
|
11
|
-
var
|
|
12
|
-
return (
|
|
10
|
+
setup(h, { expose: r }) {
|
|
11
|
+
const { isFeatureEnabled: o } = u(), n = d(), i = c(), t = f(null), s = p(() => o("liquidSyntax"));
|
|
12
|
+
return r({
|
|
13
|
+
handleSave: (m) => {
|
|
14
|
+
var e;
|
|
15
|
+
return (e = t.value) == null ? void 0 : e.handleSave(m);
|
|
13
16
|
}
|
|
14
|
-
}), { __sfc: !0, editorStore:
|
|
17
|
+
}), { __sfc: !0, isFeatureEnabled: o, trans: n, editorStore: i, editorActionsRef: t, isLiquidEnabled: s, InChips: l, EditorActions: _, RestoreButton: S };
|
|
15
18
|
}
|
|
16
19
|
});
|
|
17
20
|
export {
|
|
18
|
-
|
|
21
|
+
x as default
|
|
19
22
|
};
|
|
@@ -1,28 +1,30 @@
|
|
|
1
1
|
import { defaultHtmlCompilerRules as p } from "../config/compiler/htmlCompilerRules.js";
|
|
2
|
-
import { itemsCompilerRules as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
|
|
2
|
+
import { itemsCompilerRules as n } from "../config/compiler/itemsCompilerRules.js";
|
|
3
|
+
import { liquidCompilerRules as c } from "../config/compiler/liquidCompilerRules.js";
|
|
4
|
+
import { outlookCompilerRules as a } from "../config/compiler/outlookCompilerRules.js";
|
|
5
|
+
import { recommendationCompilerRules as f } from "../config/compiler/recommendationCompilerRules.js";
|
|
6
|
+
import { socialCompilerRules as R } from "../config/compiler/socialCompilerRules.js";
|
|
7
|
+
import { unsubscribeCompilerRules as C } from "../config/compiler/unsubscribeCompilerRules.js";
|
|
8
|
+
import { createHtmlCompiler as d } from "../utils/htmlCompiler.js";
|
|
9
|
+
import { useConfig as g } from "./useConfig.js";
|
|
10
|
+
const F = () => {
|
|
10
11
|
var m, l;
|
|
11
|
-
const { compiler: e } =
|
|
12
|
+
const { compiler: e, isFeatureEnabled: r } = g(), i = ((m = e.value) == null ? void 0 : m.customRules) || [], t = [
|
|
12
13
|
...!!((l = e.value) != null && l.ignoreDefaultRules) ? [] : p,
|
|
14
|
+
...f,
|
|
15
|
+
...C,
|
|
13
16
|
...n,
|
|
17
|
+
...a,
|
|
14
18
|
...R,
|
|
15
|
-
...
|
|
16
|
-
...
|
|
17
|
-
...f,
|
|
18
|
-
...r.map((o, s) => ({
|
|
19
|
+
...r("liquidSyntax") ? c : [],
|
|
20
|
+
...i.map((o, u) => ({
|
|
19
21
|
...o,
|
|
20
|
-
priority: o.priority + 1e3 +
|
|
22
|
+
priority: o.priority + 1e3 + u
|
|
21
23
|
// Ensure additional rules run after default rules
|
|
22
24
|
}))
|
|
23
|
-
],
|
|
24
|
-
return { compileHtml: (o) =>
|
|
25
|
+
], s = d(t);
|
|
26
|
+
return { compileHtml: (o) => s.compile(o) };
|
|
25
27
|
};
|
|
26
28
|
export {
|
|
27
|
-
|
|
29
|
+
F as useHtmlCompiler
|
|
28
30
|
};
|
|
@@ -1,21 +1,22 @@
|
|
|
1
|
-
import { useConfig as
|
|
2
|
-
import { useSaveStart as
|
|
3
|
-
import { useSyncModuleExtractor as
|
|
4
|
-
import { useStripoApi as
|
|
5
|
-
import { useTemplatePreparation as
|
|
6
|
-
import { useHtmlValidator as
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
1
|
+
import { useConfig as v } from "./useConfig.js";
|
|
2
|
+
import { useSaveStart as S, useSaveComplete as V } from "./useGuidoActions.js";
|
|
3
|
+
import { useSyncModuleExtractor as x } from "./useSyncModuleExtractor.js";
|
|
4
|
+
import { useStripoApi as y } from "../services/stripoApi.js";
|
|
5
|
+
import { useTemplatePreparation as w } from "../utils/templatePreparation.js";
|
|
6
|
+
import { useHtmlValidator as b } from "./useHtmlValidator.js";
|
|
7
|
+
import { useLiquidValidator as q } from "./validators/useLiquidValidator.js";
|
|
8
|
+
const k = () => {
|
|
9
|
+
const e = S(), o = V(), { validateHtml: s } = b(), { validateLiquidSyntax: r } = q(), { callbacks: a, isFeatureEnabled: n } = v(), { extractSyncModuleData: l } = x(), { setSyncModuleUnsubscriptionPages: d } = y();
|
|
10
|
+
return { save: async (u = !1) => {
|
|
11
|
+
var i;
|
|
12
|
+
e();
|
|
13
|
+
const { prepareTemplateDetails: c } = w(), t = await c();
|
|
14
|
+
if (!await s(t.compiledHtml, t.dynamicContentList, !0) || n("liquidSyntax") && !await r(t.compiledHtml) || (i = a.value) != null && i.externalValidation && !await a.value.externalValidation(t))
|
|
14
15
|
return;
|
|
15
|
-
const { unsubscribePayload: m, stripoModules:
|
|
16
|
-
return await
|
|
16
|
+
const { unsubscribePayload: m, stripoModules: p } = l(t.rawHtml);
|
|
17
|
+
return await d(m), t.modules = p, u || o(t), t;
|
|
17
18
|
} };
|
|
18
19
|
};
|
|
19
20
|
export {
|
|
20
|
-
|
|
21
|
+
k as useSave
|
|
21
22
|
};
|
|
@@ -1,42 +1,42 @@
|
|
|
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 { localePatch as
|
|
8
|
-
import { displayConditions as
|
|
9
|
-
import { useStripoApi as
|
|
10
|
-
import
|
|
1
|
+
import { useActionsApi as F } from "./useActionsApi.js";
|
|
2
|
+
import { useBlocksConfig as D } from "./useBlocksConfig.js";
|
|
3
|
+
import { useConfig as I } from "./useConfig.js";
|
|
4
|
+
import { useCustomInterfaceAppearance as P } from "./useCustomInterfaceAppearance.js";
|
|
5
|
+
import { useStripoEventHandler as U } from "./useStripoEventHandler.js";
|
|
6
|
+
import { useToaster as R } from "./useToaster.js";
|
|
7
|
+
import { localePatch as H } from "../config/i18n/index.js";
|
|
8
|
+
import { displayConditions as q } from "../enums/displayConditions.js";
|
|
9
|
+
import { useStripoApi as x } from "../services/stripoApi.js";
|
|
10
|
+
import O from "../static/styles/customEditorStyle.css.js";
|
|
11
11
|
import { useEditorStore as S } from "../stores/editor.js";
|
|
12
|
-
import { dynamicContentToMergeTags as
|
|
13
|
-
import
|
|
14
|
-
const
|
|
15
|
-
const { features: l, template: E } =
|
|
12
|
+
import { dynamicContentToMergeTags as L } from "../utils/genericUtil.js";
|
|
13
|
+
import $ from "../package.json.js";
|
|
14
|
+
const ie = (C, c) => {
|
|
15
|
+
const { features: l, template: E, isFeatureEnabled: h } = I(), { handleError: u } = R(), { getToken: b, getCustomFonts: w, getSyncModulesStatus: k } = x(), { handleEvent: T } = U(), { getStripoBlocksConfig: V } = D(), _ = async (i, n = [], r = !1) => {
|
|
16
16
|
var f, g, y;
|
|
17
|
-
const e = S(), { html: m, css: a } = i, { baseBlocks: o, extensions: d } = await
|
|
17
|
+
const e = S(), { html: m, css: a } = i, { baseBlocks: o, extensions: d } = await V(), p = ((f = l.value) == null ? void 0 : f.displayConditions) ?? !0, v = ((g = l.value) == null ? void 0 : g.modulesDisabled) ?? !1, M = ((y = E.value) == null ? void 0 : y.forceRecreate) ?? !1;
|
|
18
18
|
window.UIEditor.initEditor(
|
|
19
19
|
document.querySelector("#guido-editor"),
|
|
20
20
|
{
|
|
21
21
|
metadata: C,
|
|
22
22
|
html: m,
|
|
23
23
|
css: a,
|
|
24
|
-
forceRecreate:
|
|
24
|
+
forceRecreate: M,
|
|
25
25
|
locale: "en",
|
|
26
26
|
undoButtonSelector: "#guido__undo-button",
|
|
27
27
|
redoButtonSelector: "#guido__redo-button",
|
|
28
28
|
mobileViewButtonSelector: ".guido__view-option-selection-mobile",
|
|
29
29
|
desktopViewButtonSelector: ".guido__view-option-selection-desktop",
|
|
30
30
|
codeEditorButtonSelector: "#guido__code-button",
|
|
31
|
-
customAppearanceMergetags: !
|
|
31
|
+
customAppearanceMergetags: !h("liquidSyntax"),
|
|
32
32
|
customAppearanceMergetagsBorderColor: "#f1f3fe",
|
|
33
33
|
customAppearanceMergetagsBackgroundColor: "#f1f3fe",
|
|
34
|
-
customViewStyles:
|
|
34
|
+
customViewStyles: O,
|
|
35
35
|
conditionsEnabled: p,
|
|
36
36
|
customConditionsEnabled: p,
|
|
37
|
-
conditionCategories:
|
|
37
|
+
conditionCategories: q,
|
|
38
38
|
enableXSSSecurity: !0,
|
|
39
|
-
modulesDisabled:
|
|
39
|
+
modulesDisabled: v,
|
|
40
40
|
syncModulesEnabled: r,
|
|
41
41
|
messageSettingsEnabled: !0,
|
|
42
42
|
displayGmailAnnotations: !0,
|
|
@@ -52,12 +52,12 @@ const oe = (C, c) => {
|
|
|
52
52
|
},
|
|
53
53
|
mergeTags: [
|
|
54
54
|
{
|
|
55
|
-
entries:
|
|
55
|
+
entries: L(c.preselectedDynamicContentList)
|
|
56
56
|
}
|
|
57
57
|
],
|
|
58
58
|
async onTokenRefreshRequest(t) {
|
|
59
59
|
try {
|
|
60
|
-
const s = await
|
|
60
|
+
const s = await b();
|
|
61
61
|
t(s);
|
|
62
62
|
} catch (s) {
|
|
63
63
|
u(s, "Failed to refresh token");
|
|
@@ -65,8 +65,8 @@ const oe = (C, c) => {
|
|
|
65
65
|
},
|
|
66
66
|
onTemplateLoaded() {
|
|
67
67
|
try {
|
|
68
|
-
const { importCss: t } =
|
|
69
|
-
t(), s(),
|
|
68
|
+
const { importCss: t } = P(), { activateCustomViewStyles: s, updateTimerInClonedTemplate: A } = F();
|
|
69
|
+
t(), s(), A(), c.onReady(), e.isStripoInitialized = !0, e.loadingStatus = !1, setTimeout(() => {
|
|
70
70
|
e.hasChanges = !1;
|
|
71
71
|
}, 1e3);
|
|
72
72
|
} catch (t) {
|
|
@@ -85,23 +85,23 @@ const oe = (C, c) => {
|
|
|
85
85
|
onDataChanged() {
|
|
86
86
|
e.hasChanges = !0;
|
|
87
87
|
},
|
|
88
|
-
onEvent:
|
|
88
|
+
onEvent: T,
|
|
89
89
|
ignoreClickOutsideSelectors: [
|
|
90
90
|
"#guido-dynamic-content-modal",
|
|
91
91
|
".in-on-board-wrapper",
|
|
92
92
|
".in-drawer__container"
|
|
93
93
|
],
|
|
94
94
|
extensions: d,
|
|
95
|
-
localePatch:
|
|
95
|
+
localePatch: H
|
|
96
96
|
}
|
|
97
97
|
);
|
|
98
|
-
},
|
|
98
|
+
}, B = (i) => new Promise((n, r) => {
|
|
99
99
|
var d;
|
|
100
100
|
if (document.getElementById("UiEditorScript")) {
|
|
101
101
|
i(), n();
|
|
102
102
|
return;
|
|
103
103
|
}
|
|
104
|
-
const e =
|
|
104
|
+
const e = $.guido, a = `https://email-static.useinsider.com/guido/${(d = e == null ? void 0 : e.stripo) == null ? void 0 : d.version}/UIEditor.js`, o = document.createElement("script");
|
|
105
105
|
o.id = "UiEditorScript", o.type = "module", o.src = a, o.onload = () => {
|
|
106
106
|
i(), n();
|
|
107
107
|
}, o.onerror = () => {
|
|
@@ -109,15 +109,15 @@ const oe = (C, c) => {
|
|
|
109
109
|
}, document.body.appendChild(o);
|
|
110
110
|
});
|
|
111
111
|
return { initPlugin: async (i) => {
|
|
112
|
-
await
|
|
112
|
+
await B(async () => {
|
|
113
113
|
const n = S(), [r, e] = await Promise.all([
|
|
114
114
|
w(),
|
|
115
|
-
|
|
115
|
+
k()
|
|
116
116
|
]);
|
|
117
|
-
n.syncModulesEnabled = e, await
|
|
117
|
+
n.syncModulesEnabled = e, await _(i, r, e);
|
|
118
118
|
});
|
|
119
119
|
} };
|
|
120
120
|
};
|
|
121
121
|
export {
|
|
122
|
-
|
|
122
|
+
ie as useStripo
|
|
123
123
|
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { ToasterTypeOptions as l } from "../../enums/toaster.js";
|
|
2
|
+
import { base64EncodeWithSpecialChars as u } from "../../utils/base64.js";
|
|
3
|
+
import { useHttp as d } from "../useHttp.js";
|
|
4
|
+
import { useToaster as m } from "../useToaster.js";
|
|
5
|
+
import { useTranslations as p } from "../useTranslations.js";
|
|
6
|
+
const T = () => {
|
|
7
|
+
const { post: r } = d(), { showToaster: s } = m(), o = p();
|
|
8
|
+
return { validateLiquidSyntax: async (i) => {
|
|
9
|
+
var e, a;
|
|
10
|
+
const n = await r("/newsletter/contents/validate-syntax", [{
|
|
11
|
+
identifier: "default",
|
|
12
|
+
syntax: "liquid",
|
|
13
|
+
contents: {
|
|
14
|
+
subject: null,
|
|
15
|
+
preheader: null,
|
|
16
|
+
html: u(i),
|
|
17
|
+
ampHtml: null
|
|
18
|
+
}
|
|
19
|
+
}]), [t] = n.data;
|
|
20
|
+
return (e = t == null ? void 0 : t.results) != null && e.html ? !0 : (s({
|
|
21
|
+
type: l.Alert,
|
|
22
|
+
message: ((a = t == null ? void 0 : t.errors) == null ? void 0 : a.html) ?? o("journey-builder.liquid-validation-failed")
|
|
23
|
+
}), !1);
|
|
24
|
+
} };
|
|
25
|
+
};
|
|
26
|
+
export {
|
|
27
|
+
T as useLiquidValidator
|
|
28
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
const e = [
|
|
2
|
+
{
|
|
3
|
+
id: "liquid-coupon-code",
|
|
4
|
+
description: "Replace legacy coupon placeholder with liquid syntax",
|
|
5
|
+
type: "replace",
|
|
6
|
+
search: "{@COUPON_CODE}",
|
|
7
|
+
replacement: "{{ins_coupon_code}}",
|
|
8
|
+
replaceAll: !0,
|
|
9
|
+
priority: 50
|
|
10
|
+
}
|
|
11
|
+
];
|
|
12
|
+
export {
|
|
13
|
+
e as liquidCompilerRules
|
|
14
|
+
};
|
|
@@ -1,41 +1,41 @@
|
|
|
1
|
-
import { usePartner as
|
|
2
|
-
import { LINK_REGEXES as
|
|
3
|
-
import { parsePageList as
|
|
4
|
-
import { useConfigStore as
|
|
5
|
-
import { useDynamicContentStore as
|
|
6
|
-
import { useUnsubscribeStore as
|
|
7
|
-
const
|
|
1
|
+
import { usePartner as y } from "../../composables/usePartner.js";
|
|
2
|
+
import { LINK_REGEXES as p, LINK_TYPES as S, INSIDER_ID as m, URLS as R } from "../../enums/unsubscribe.js";
|
|
3
|
+
import { parsePageList as I } from "../../extensions/Blocks/Unsubscribe/utils/utils.js";
|
|
4
|
+
import { useConfigStore as N } from "../../stores/config.js";
|
|
5
|
+
import { useDynamicContentStore as U } from "../../stores/dynamic-content.js";
|
|
6
|
+
import { useUnsubscribeStore as C } from "../../stores/unsubscribe.js";
|
|
7
|
+
const G = [
|
|
8
8
|
{
|
|
9
9
|
id: "add-unsubscribe-link-values",
|
|
10
10
|
description: "Adding unsubscribe link values",
|
|
11
11
|
type: "custom",
|
|
12
12
|
processor: (t) => {
|
|
13
|
-
const { getPartnerName: i } =
|
|
13
|
+
const { getPartnerName: i } = y(), o = N(), s = U(), d = C(), a = o.variationId;
|
|
14
14
|
if (!a)
|
|
15
15
|
return t;
|
|
16
16
|
let e = t;
|
|
17
|
-
const r = `/${i()}/email/${a}?user={{iid}}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
17
|
+
const r = `/${i()}/email/${a}?user={{iid}}`, E = new DOMParser().parseFromString(e, "text/html").querySelectorAll(".unsubscribe-block-v2[data-unsubscribe-page-list]");
|
|
18
|
+
let c = !1, l = !1;
|
|
19
|
+
return E.forEach((f) => {
|
|
20
|
+
var b;
|
|
21
|
+
const u = f.getAttribute("data-unsubscribe-page-list");
|
|
22
|
+
if (!u)
|
|
22
23
|
return;
|
|
23
|
-
const
|
|
24
|
-
(
|
|
25
|
-
)) ?? []
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
}), e;
|
|
24
|
+
const _ = I(u), g = ((b = d.templates) == null ? void 0 : b.filter(
|
|
25
|
+
(n) => _.includes(n.id)
|
|
26
|
+
)) ?? [];
|
|
27
|
+
c = c || g.some((n) => n.type === S.UNSUBSCRIBE_LINK_TYPE), l = l || g.some((n) => n.type === S.PREFERENCES_LINK_TYPE);
|
|
28
|
+
}), (c || l) && (s.selectedDynamicContentList.some((u) => u.value === m) || s.selectedDynamicContentList.push({
|
|
29
|
+
text: m,
|
|
30
|
+
value: m,
|
|
31
|
+
fallback: ""
|
|
32
|
+
})), c && (e = e.replace(
|
|
33
|
+
p.GLOBAL_UNSUBSCRIBE_LINK_REGEX,
|
|
34
|
+
R.UNSUBSCRIBE_URL + r
|
|
35
|
+
)), l && (e = e.replace(
|
|
36
|
+
p.PREFERENCES_UNSUBSCRIBE_LINK_REGEX,
|
|
37
|
+
R.PREFERENCES_URL + r
|
|
38
|
+
)), E.length && (e = e.replace(p.UNSUBSCRIBE_LINK_REGEX, "")), e;
|
|
39
39
|
},
|
|
40
40
|
priority: 60
|
|
41
41
|
},
|
|
@@ -43,7 +43,7 @@ const D = [
|
|
|
43
43
|
id: "remove-data-ogsb-button-styles",
|
|
44
44
|
description: "Removing styles like [data-ogsb] .es-button.es-button-123 { background: red; }",
|
|
45
45
|
type: "regex",
|
|
46
|
-
pattern:
|
|
46
|
+
pattern: p.DATA_OGSB_BUTTON_CSS_REGEX,
|
|
47
47
|
replacement: "",
|
|
48
48
|
flags: "g",
|
|
49
49
|
priority: 61
|
|
@@ -61,16 +61,16 @@ const D = [
|
|
|
61
61
|
type: "custom",
|
|
62
62
|
processor: (t) => {
|
|
63
63
|
let i = t;
|
|
64
|
-
const
|
|
65
|
-
return
|
|
66
|
-
if (
|
|
64
|
+
const o = i.match(/<a[^>]+>(.*?)<\/a>/gm);
|
|
65
|
+
return o && o.forEach((s) => {
|
|
66
|
+
if (s.includes("insEmail=1"))
|
|
67
67
|
return;
|
|
68
|
-
if (
|
|
69
|
-
const a =
|
|
68
|
+
if (s.match(/<a\s+(?:[^>]*?\s+)?href=(["'`”])(.*?)\1\s+(?:[^>]*?\s+)?universal=(["'`”])true\3/gm)) {
|
|
69
|
+
const a = s.replace(/href=(["'`”])(.*?)\1/gm, (e) => {
|
|
70
70
|
const r = e.slice(6, e.length - 1).trim();
|
|
71
71
|
return e.includes("?") || e.includes("#") ? r.slice(-1) === "&" ? e.replace(r, `${r}insEmail=1`) : e.replace(r, `${r}&insEmail=1`) : e.replace(r, `${r}?insEmail=1`);
|
|
72
72
|
});
|
|
73
|
-
i = i.replace(
|
|
73
|
+
i = i.replace(s, a);
|
|
74
74
|
}
|
|
75
75
|
}), i;
|
|
76
76
|
},
|
|
@@ -78,5 +78,5 @@ const D = [
|
|
|
78
78
|
}
|
|
79
79
|
];
|
|
80
80
|
export {
|
|
81
|
-
|
|
81
|
+
G as unsubscribeCompilerRules
|
|
82
82
|
};
|
|
@@ -1,29 +1,38 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { useConfig as n } from "../../../composables/useConfig.js";
|
|
2
|
+
import { BlockType as e } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
3
|
+
import { COUPON_BLOCK_ID as t } from "./block.js";
|
|
4
|
+
const c = "{@COUPON_CODE}", s = "{{ins_coupon_code}}";
|
|
5
|
+
function l() {
|
|
6
|
+
const { isFeatureEnabled: o } = n();
|
|
7
|
+
return o("liquidSyntax") ? s : c;
|
|
8
|
+
}
|
|
9
|
+
function i(o) {
|
|
10
|
+
return `
|
|
11
|
+
<${e.BLOCK_TEXT}
|
|
5
12
|
class="coupon-block ins-coupon-code coupon-block-v2 es-p10"
|
|
6
13
|
align="center"
|
|
7
|
-
esd-extension-block-id="${
|
|
14
|
+
esd-extension-block-id="${t}">
|
|
8
15
|
<p
|
|
9
16
|
path="1"
|
|
10
17
|
contenteditable="false"
|
|
11
18
|
style="font-size: 16px; color: #333333;">
|
|
12
|
-
<strong path="1,0"
|
|
19
|
+
<strong path="1,0">${o}</strong>
|
|
13
20
|
</p>
|
|
14
|
-
</${
|
|
15
|
-
|
|
21
|
+
</${e.BLOCK_TEXT}>
|
|
22
|
+
`;
|
|
23
|
+
}
|
|
24
|
+
const u = `
|
|
16
25
|
<td
|
|
17
26
|
class="coupon-block coupon-block-v2 ins-coupon-code esd-block-text esd-extension-block"
|
|
18
|
-
esd-extension-block-id="${
|
|
27
|
+
esd-extension-block-id="${t}"
|
|
19
28
|
>
|
|
20
29
|
<p class="ins-title" contenteditable="false">{@COUPON_CODE}</p>
|
|
21
30
|
</td>
|
|
22
31
|
`;
|
|
23
|
-
function
|
|
24
|
-
return
|
|
32
|
+
function d() {
|
|
33
|
+
return i(l());
|
|
25
34
|
}
|
|
26
35
|
export {
|
|
27
|
-
|
|
28
|
-
|
|
36
|
+
u as default,
|
|
37
|
+
d as getDefaultTemplate
|
|
29
38
|
};
|
|
@@ -169,7 +169,7 @@ class q extends b {
|
|
|
169
169
|
if (e && e.includes(a))
|
|
170
170
|
return t;
|
|
171
171
|
}
|
|
172
|
-
return "querySelector" in t ? t.querySelector(`.${a}`)
|
|
172
|
+
return "querySelector" in t ? t.querySelector(`.${a}`) : null;
|
|
173
173
|
}
|
|
174
174
|
/**
|
|
175
175
|
* Migrate configuration from legacy format
|