@useinsider/guido 1.0.3-beta.9b9f41a → 1.0.3-beta.9d0ef3f
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 +3 -32
- package/dist/components/Guido.vue.js +1 -1
- package/dist/components/Guido.vue2.js +49 -48
- package/dist/composables/useActionsApi.js +33 -24
- package/dist/composables/useHtmlCompiler.js +15 -13
- package/dist/composables/useHtmlValidator.js +36 -35
- package/dist/composables/useStripo.js +58 -52
- package/dist/composables/useTimerClone.js +52 -0
- package/dist/config/compiler/itemsCompilerRules.js +14 -0
- package/dist/enums/unsubscribe.js +27 -26
- package/dist/extensions/Blocks/Checkbox/control.js +15 -14
- package/dist/extensions/Blocks/Checkbox/template.js +14 -9
- package/dist/extensions/Blocks/Items/block.js +26 -26
- package/dist/extensions/Blocks/Items/controls/cardComposition.js +151 -57
- package/dist/extensions/Blocks/Items/controls/name/trimming.js +2 -2
- package/dist/extensions/Blocks/Items/controls/settingsControl.js +149 -117
- package/dist/extensions/Blocks/Items/enums/productEnums.js +83 -5
- package/dist/extensions/Blocks/Items/enums/settingsEnums.js +7 -1
- package/dist/extensions/Blocks/Items/layouts/horizontal.html.js +57 -56
- package/dist/extensions/Blocks/Items/layouts/vertical.html.js +54 -55
- package/dist/extensions/Blocks/Items/settingsPanel.js +56 -31
- package/dist/extensions/Blocks/Items/template.js +138 -59
- package/dist/extensions/Blocks/RadioButton/control.js +18 -17
- package/dist/extensions/Blocks/RadioButton/template.js +18 -9
- package/dist/extensions/Blocks/Unsubscribe/block.js +27 -27
- package/dist/guido.css +1 -1
- package/dist/node_modules/lodash-es/_DataView.js +6 -0
- package/dist/node_modules/lodash-es/_Promise.js +6 -0
- package/dist/node_modules/lodash-es/_Set.js +6 -0
- package/dist/node_modules/lodash-es/_SetCache.js +13 -0
- package/dist/node_modules/lodash-es/_WeakMap.js +6 -0
- package/dist/node_modules/lodash-es/_arrayFilter.js +10 -0
- package/dist/node_modules/lodash-es/_arrayLikeKeys.js +13 -12
- package/dist/node_modules/lodash-es/_arrayMap.js +8 -0
- package/dist/node_modules/lodash-es/_arrayPush.js +8 -0
- package/dist/node_modules/lodash-es/_arraySome.js +9 -0
- package/dist/node_modules/lodash-es/_baseEach.js +6 -0
- package/dist/node_modules/lodash-es/_baseFlatten.js +13 -0
- package/dist/node_modules/lodash-es/_baseForOwn.js +8 -0
- package/dist/node_modules/lodash-es/_baseGet.js +11 -0
- package/dist/node_modules/lodash-es/_baseGetAllKeys.js +9 -0
- package/dist/node_modules/lodash-es/_baseHasIn.js +6 -0
- package/dist/node_modules/lodash-es/_baseIsEqual.js +8 -0
- package/dist/node_modules/lodash-es/_baseIsEqualDeep.js +32 -0
- package/dist/node_modules/lodash-es/_baseIsMatch.js +29 -0
- package/dist/node_modules/lodash-es/_baseIteratee.js +11 -0
- package/dist/node_modules/lodash-es/_baseKeys.js +14 -0
- package/dist/node_modules/lodash-es/_baseMap.js +11 -0
- package/dist/node_modules/lodash-es/_baseMatches.js +12 -0
- package/dist/node_modules/lodash-es/_baseMatchesProperty.js +17 -0
- package/dist/node_modules/lodash-es/_baseProperty.js +8 -0
- package/dist/node_modules/lodash-es/_basePropertyDeep.js +9 -0
- package/dist/node_modules/lodash-es/_baseRange.js +9 -0
- package/dist/node_modules/lodash-es/_baseToString.js +18 -0
- package/dist/node_modules/lodash-es/_baseTrim.js +8 -0
- package/dist/node_modules/lodash-es/_cacheHas.js +6 -0
- package/dist/node_modules/lodash-es/_castPath.js +10 -0
- package/dist/node_modules/lodash-es/_createBaseEach.js +15 -0
- package/dist/node_modules/lodash-es/_createRange.js +11 -0
- package/dist/node_modules/lodash-es/_equalArrays.js +40 -0
- package/dist/node_modules/lodash-es/_equalByTag.js +45 -0
- package/dist/node_modules/lodash-es/_equalObjects.js +36 -0
- package/dist/node_modules/lodash-es/_getAllKeys.js +9 -0
- package/dist/node_modules/lodash-es/_getMatchData.js +12 -0
- package/dist/node_modules/lodash-es/_getSymbols.js +10 -0
- package/dist/node_modules/lodash-es/_getTag.js +28 -0
- package/dist/node_modules/lodash-es/_hasPath.js +19 -0
- package/dist/node_modules/lodash-es/_isFlattenable.js +10 -0
- package/dist/node_modules/lodash-es/_isKey.js +12 -0
- package/dist/node_modules/lodash-es/_isStrictComparable.js +7 -0
- package/dist/node_modules/lodash-es/_mapToArray.js +9 -0
- package/dist/node_modules/lodash-es/_matchesStrictComparable.js +8 -0
- package/dist/node_modules/lodash-es/_memoizeCapped.js +11 -0
- package/dist/node_modules/lodash-es/_nativeKeys.js +5 -0
- package/dist/node_modules/lodash-es/_setCacheAdd.js +7 -0
- package/dist/node_modules/lodash-es/_setCacheHas.js +6 -0
- package/dist/node_modules/lodash-es/_setToArray.js +9 -0
- package/dist/node_modules/lodash-es/_stringToPath.js +10 -0
- package/dist/node_modules/lodash-es/_toKey.js +10 -0
- package/dist/node_modules/lodash-es/_trimmedEndIndex.js +9 -0
- package/dist/node_modules/lodash-es/flatMap.js +8 -0
- package/dist/node_modules/lodash-es/get.js +8 -0
- package/dist/node_modules/lodash-es/hasIn.js +8 -0
- package/dist/node_modules/lodash-es/isSymbol.js +9 -0
- package/dist/node_modules/lodash-es/keys.js +9 -0
- package/dist/node_modules/lodash-es/keysIn.js +3 -3
- package/dist/node_modules/lodash-es/map.js +11 -0
- package/dist/node_modules/lodash-es/property.js +10 -0
- package/dist/node_modules/lodash-es/range.js +5 -0
- package/dist/node_modules/lodash-es/stubArray.js +6 -0
- package/dist/node_modules/lodash-es/toFinite.js +14 -0
- package/dist/node_modules/lodash-es/toNumber.js +22 -0
- package/dist/node_modules/lodash-es/toString.js +7 -0
- package/dist/src/composables/useActionsApi.d.ts +1 -0
- package/dist/src/composables/useTimerClone.d.ts +6 -0
- package/dist/src/config/compiler/itemsCompilerRules.d.ts +2 -0
- package/dist/src/extensions/Blocks/Checkbox/template.d.ts +1 -1
- package/dist/src/extensions/Blocks/Items/block.d.ts +14 -0
- package/dist/src/extensions/Blocks/Items/controls/cardComposition.d.ts +20 -7
- package/dist/src/extensions/Blocks/Items/controls/settingsControl.d.ts +8 -2
- package/dist/src/extensions/Blocks/Items/enums/productEnums.d.ts +8 -0
- package/dist/src/extensions/Blocks/Items/enums/settingsEnums.d.ts +6 -0
- package/dist/src/extensions/Blocks/Items/template.d.ts +9 -1
- package/dist/src/extensions/Blocks/RadioButton/template.d.ts +1 -1
- package/dist/src/utils/environmentUtil.d.ts +5 -0
- package/dist/src/utils/pairProductVariables.d.ts +7 -0
- package/dist/utils/environmentUtil.js +4 -0
- package/dist/utils/pairProductVariables.js +136 -0
- package/package.json +3 -10
|
@@ -1,25 +1,26 @@
|
|
|
1
|
-
import { useActionsApi as
|
|
2
|
-
import { useBlocksConfig as
|
|
3
|
-
import { useConfig as
|
|
4
|
-
import { useCustomInterfaceAppearance as
|
|
5
|
-
import { useStripoEventHandler as
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import {
|
|
12
|
-
import
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
1
|
+
import { useActionsApi as V } from "./useActionsApi.js";
|
|
2
|
+
import { useBlocksConfig as _ } from "./useBlocksConfig.js";
|
|
3
|
+
import { useConfig as A } from "./useConfig.js";
|
|
4
|
+
import { useCustomInterfaceAppearance as B } from "./useCustomInterfaceAppearance.js";
|
|
5
|
+
import { useStripoEventHandler as v } from "./useStripoEventHandler.js";
|
|
6
|
+
import { useTimerClone as F } from "./useTimerClone.js";
|
|
7
|
+
import { useToaster as I } from "./useToaster.js";
|
|
8
|
+
import { displayConditions as M } from "../enums/displayConditions.js";
|
|
9
|
+
import { useStripoApi as U } from "../services/stripoApi.js";
|
|
10
|
+
import D from "../static/styles/customEditorStyle.css.js";
|
|
11
|
+
import { useEditorStore as P } from "../stores/editor.js";
|
|
12
|
+
import { dynamicContentToMergeTags as H } from "../utils/genericUtil.js";
|
|
13
|
+
import O from "../package.json.js";
|
|
14
|
+
const Y = (c) => {
|
|
15
|
+
const { config: u } = A(), { handleError: p } = I(), { getToken: m, getCustomFonts: C } = U(), { handleEvent: S } = v(), { getStripoBlocksConfig: E } = _(), w = async (i, r = []) => {
|
|
16
|
+
var g, y;
|
|
17
|
+
const e = P(), { html: s, css: f, forceRecreate: a } = i, { baseBlocks: t, extensions: d } = await E();
|
|
17
18
|
window.UIEditor.initEditor(
|
|
18
19
|
document.querySelector("#guido-editor"),
|
|
19
20
|
{
|
|
20
|
-
metadata:
|
|
21
|
-
html:
|
|
22
|
-
css:
|
|
21
|
+
metadata: c,
|
|
22
|
+
html: s,
|
|
23
|
+
css: f,
|
|
23
24
|
forceRecreate: a,
|
|
24
25
|
locale: "en",
|
|
25
26
|
undoButtonSelector: "#guido__undo-button",
|
|
@@ -30,14 +31,18 @@ const N = (d) => {
|
|
|
30
31
|
customAppearanceMergetags: !0,
|
|
31
32
|
customAppearanceMergetagsBorderColor: "#f1f3fe",
|
|
32
33
|
customAppearanceMergetagsBackgroundColor: "#f1f3fe",
|
|
33
|
-
customViewStyles:
|
|
34
|
-
conditionsEnabled: ((
|
|
35
|
-
customConditionsEnabled: ((
|
|
36
|
-
conditionCategories:
|
|
34
|
+
customViewStyles: D,
|
|
35
|
+
conditionsEnabled: ((g = u.features) == null ? void 0 : g.displayConditions) ?? !0,
|
|
36
|
+
customConditionsEnabled: ((y = u.features) == null ? void 0 : y.displayConditions) ?? !0,
|
|
37
|
+
conditionCategories: M,
|
|
37
38
|
enableXSSSecurity: !0,
|
|
38
|
-
messageSettingsEnabled: !
|
|
39
|
+
messageSettingsEnabled: !0,
|
|
40
|
+
displayGmailAnnotations: !0,
|
|
41
|
+
displayHiddenPreheader: !1,
|
|
42
|
+
displayTitle: !1,
|
|
43
|
+
displayUTM: !1,
|
|
39
44
|
selectElementAfterDrop: !0,
|
|
40
|
-
...
|
|
45
|
+
...t ? { baseBlocks: t } : {},
|
|
41
46
|
editorFonts: {
|
|
42
47
|
showDefaultStandardFonts: !0,
|
|
43
48
|
showDefaultNotStandardFonts: !0,
|
|
@@ -45,68 +50,69 @@ const N = (d) => {
|
|
|
45
50
|
},
|
|
46
51
|
mergeTags: [
|
|
47
52
|
{
|
|
48
|
-
entries:
|
|
53
|
+
entries: H(c.preselectedDynamicContentList)
|
|
49
54
|
}
|
|
50
55
|
],
|
|
51
56
|
async onTokenRefreshRequest(o) {
|
|
52
57
|
try {
|
|
53
|
-
const
|
|
54
|
-
o(
|
|
55
|
-
} catch (
|
|
56
|
-
|
|
58
|
+
const n = await m();
|
|
59
|
+
o(n);
|
|
60
|
+
} catch (n) {
|
|
61
|
+
p(n, "Failed to refresh token");
|
|
57
62
|
}
|
|
58
63
|
},
|
|
59
64
|
onTemplateLoaded() {
|
|
65
|
+
var o, n;
|
|
60
66
|
try {
|
|
61
|
-
const { importCss:
|
|
62
|
-
|
|
63
|
-
|
|
67
|
+
const { importCss: l } = B(), { activateCustomViewStyles: T, updateTimerInClonedTemplate: b } = V(), { updateTimersOnLoad: k } = F();
|
|
68
|
+
l(), T(), typeof ((n = (o = window.StripoEditorApi) == null ? void 0 : o.actionsApi) == null ? void 0 : n.updateTimerInClonedTemplate) == "function" ? b() : k(m), c.onReady(), e.isStripoInitialized = !0, e.loadingStatus = !1, setTimeout(() => {
|
|
69
|
+
e.hasChanges = !1;
|
|
64
70
|
}, 1e3);
|
|
65
|
-
} catch (
|
|
66
|
-
l
|
|
71
|
+
} catch (l) {
|
|
72
|
+
p(l, "Failed to load custom interface appearance");
|
|
67
73
|
}
|
|
68
74
|
},
|
|
69
75
|
onCodeEditorVisibilityChanged(o) {
|
|
70
|
-
|
|
76
|
+
e.isCodeEditorOpen = o;
|
|
71
77
|
},
|
|
72
78
|
onEditorVisualModeChanged(o) {
|
|
73
|
-
|
|
79
|
+
e.editorVisualMode = o.toLowerCase();
|
|
74
80
|
},
|
|
75
81
|
onVersionHistoryVisibilityChanged(o) {
|
|
76
|
-
|
|
82
|
+
e.isVersionHistoryOpen = o;
|
|
77
83
|
},
|
|
78
84
|
onDataChanged() {
|
|
79
|
-
|
|
85
|
+
e.hasChanges = !0;
|
|
80
86
|
},
|
|
81
|
-
onEvent:
|
|
87
|
+
onEvent: S,
|
|
82
88
|
ignoreClickOutsideSelectors: [
|
|
83
89
|
"#guido-dynamic-content-modal",
|
|
84
90
|
".in-on-board-wrapper",
|
|
85
91
|
".in-drawer__container"
|
|
86
92
|
],
|
|
87
|
-
extensions:
|
|
93
|
+
extensions: d
|
|
88
94
|
}
|
|
89
95
|
);
|
|
90
|
-
},
|
|
91
|
-
var
|
|
96
|
+
}, h = (i) => new Promise((r, e) => {
|
|
97
|
+
var d;
|
|
92
98
|
if (document.getElementById("UiEditorScript")) {
|
|
93
99
|
i(), r();
|
|
94
100
|
return;
|
|
95
101
|
}
|
|
96
|
-
const
|
|
97
|
-
|
|
102
|
+
const s = O.guido, a = `https://email-static.useinsider.com/guido/${(d = s == null ? void 0 : s.stripo) == null ? void 0 : d.version}/UIEditor.js`, t = document.createElement("script");
|
|
103
|
+
t.id = "UiEditorScript", t.type = "module", t.src = a, t.onload = () => {
|
|
98
104
|
i(), r();
|
|
99
|
-
},
|
|
100
|
-
|
|
101
|
-
}, document.body.appendChild(
|
|
105
|
+
}, t.onerror = () => {
|
|
106
|
+
e(new Error(`Failed to load Stripo UIEditor script from S3: ${a}`));
|
|
107
|
+
}, document.body.appendChild(t);
|
|
102
108
|
});
|
|
103
109
|
return { initPlugin: async (i) => {
|
|
104
|
-
await
|
|
105
|
-
const r = await
|
|
106
|
-
await
|
|
110
|
+
await h(async () => {
|
|
111
|
+
const r = await C();
|
|
112
|
+
await w(i, r);
|
|
107
113
|
});
|
|
108
114
|
} };
|
|
109
115
|
};
|
|
110
116
|
export {
|
|
111
|
-
|
|
117
|
+
Y as useStripo
|
|
112
118
|
};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { useToaster as T } from "./useToaster.js";
|
|
2
|
+
import { useStripoApi as f } from "../services/stripoApi.js";
|
|
3
|
+
const E = () => {
|
|
4
|
+
const { handleError: c } = T(), { getToken: l } = f(), s = (t) => /esd-timer-id="(\d+)"/.test(t), i = async (t, e) => {
|
|
5
|
+
try {
|
|
6
|
+
const r = await fetch("https://plugins.stripo.email/api/v1/timers/clone", {
|
|
7
|
+
method: "POST",
|
|
8
|
+
headers: {
|
|
9
|
+
"ES-PLUGIN-AUTH": `Bearer ${e}`,
|
|
10
|
+
"Content-Type": "application/json"
|
|
11
|
+
},
|
|
12
|
+
body: JSON.stringify({ html: t })
|
|
13
|
+
});
|
|
14
|
+
if (!r.ok)
|
|
15
|
+
throw new Error(`Stripo API error: ${r.status} ${r.statusText}`);
|
|
16
|
+
return (await r.json()).html;
|
|
17
|
+
} catch (r) {
|
|
18
|
+
return c(r, "Failed to clone timer IDs"), null;
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
return {
|
|
22
|
+
hasTimerBlocks: s,
|
|
23
|
+
cloneTimersInHtml: i,
|
|
24
|
+
cloneTimersOnSave: async (t) => {
|
|
25
|
+
if (!s(t))
|
|
26
|
+
return t;
|
|
27
|
+
const e = await l();
|
|
28
|
+
return e && await i(t, e) || t;
|
|
29
|
+
},
|
|
30
|
+
updateTimersOnLoad: async (t) => {
|
|
31
|
+
var e, r, n, d, p, u;
|
|
32
|
+
try {
|
|
33
|
+
const o = (r = (e = window.UIEditor) == null ? void 0 : e.getHtml) == null ? void 0 : r.call(e);
|
|
34
|
+
if (!o || !s(o))
|
|
35
|
+
return;
|
|
36
|
+
const m = await t();
|
|
37
|
+
if (!m)
|
|
38
|
+
return;
|
|
39
|
+
const a = await i(o, m);
|
|
40
|
+
if (!a || a === o)
|
|
41
|
+
return;
|
|
42
|
+
const w = ((d = (n = window.UIEditor) == null ? void 0 : n.getCss) == null ? void 0 : d.call(n)) || "";
|
|
43
|
+
(u = (p = window.StripoEditorApi) == null ? void 0 : p.actionsApi) != null && u.updateHtmlAndCss && window.StripoEditorApi.actionsApi.updateHtmlAndCss(a, w);
|
|
44
|
+
} catch (o) {
|
|
45
|
+
c(o, "Failed to update timer blocks");
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
export {
|
|
51
|
+
E as useTimerClone
|
|
52
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { pairProductVariables as r } from "../../utils/pairProductVariables.js";
|
|
2
|
+
const t = [
|
|
3
|
+
{
|
|
4
|
+
id: "pair-product-variables",
|
|
5
|
+
description: "Replace product default values with template variables",
|
|
6
|
+
type: "custom",
|
|
7
|
+
processor: r,
|
|
8
|
+
priority: 60
|
|
9
|
+
// After recommendation rules (priority 50-53)
|
|
10
|
+
}
|
|
11
|
+
];
|
|
12
|
+
export {
|
|
13
|
+
t as itemsCompilerRules
|
|
14
|
+
};
|
|
@@ -1,25 +1,26 @@
|
|
|
1
|
-
import { useTranslations as
|
|
2
|
-
|
|
1
|
+
import { useTranslations as n } from "../composables/useTranslations.js";
|
|
2
|
+
import { getEnvironmentPrefix as R } from "../utils/environmentUtil.js";
|
|
3
|
+
const e = n(), I = {
|
|
3
4
|
UNSUBSCRIBE_LINK_TYPE: 1,
|
|
4
5
|
PREFERENCES_LINK_TYPE: 3
|
|
5
|
-
},
|
|
6
|
+
}, r = {
|
|
6
7
|
UNSUBSCRIBE_LINK_REGEX: /{{ins-unsubscribe-link}}/g,
|
|
7
8
|
DATA_OGSB_BUTTON_CSS_REGEX: "\\[data-ogsb\\]\\s*\\.es-button\\.es-button-[0-9]+\\s*\\{(?:[^\\}]*)\\}",
|
|
8
9
|
GLOBAL_UNSUBSCRIBE_LINK_REGEX: /{{ins-global-unsubscribe-link}}/g,
|
|
9
10
|
PREFERENCES_UNSUBSCRIBE_LINK_REGEX: /{{ins-preferences-unsubscribe-link}}/g
|
|
10
|
-
},
|
|
11
|
-
UNSUBSCRIBE_URL:
|
|
12
|
-
PREFERENCES_URL:
|
|
13
|
-
},
|
|
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 = {
|
|
14
15
|
name: "Global Unsubscribe",
|
|
15
16
|
sendGridId: "G"
|
|
16
|
-
},
|
|
17
|
+
}, C = "https://academy.useinsider.com/docs/global-unsubscribe-preference-center", c = "/email/unsubscribe-pages", E = {
|
|
17
18
|
GLOBAL_UNSUBSCRIBE: 1,
|
|
18
19
|
GLOBAL_UNSUBSCRIBE_CONFIRMATION_PAGE: 2,
|
|
19
20
|
SUBSCRIPTION_PREFERENCE_CENTER: 3,
|
|
20
21
|
SUBSCRIPTION_PREFERENCE_CONFIRMATION: 4,
|
|
21
22
|
RESUBSCRIBE: 5
|
|
22
|
-
},
|
|
23
|
+
}, t = {
|
|
23
24
|
[E.GLOBAL_UNSUBSCRIBE]: [
|
|
24
25
|
E.GLOBAL_UNSUBSCRIBE,
|
|
25
26
|
E.GLOBAL_UNSUBSCRIBE_CONFIRMATION_PAGE,
|
|
@@ -29,27 +30,27 @@ const s = e(), R = {
|
|
|
29
30
|
E.SUBSCRIPTION_PREFERENCE_CENTER,
|
|
30
31
|
E.SUBSCRIPTION_PREFERENCE_CONFIRMATION
|
|
31
32
|
]
|
|
32
|
-
},
|
|
33
|
-
[E.GLOBAL_UNSUBSCRIBE]:
|
|
34
|
-
[E.GLOBAL_UNSUBSCRIBE_CONFIRMATION_PAGE]:
|
|
35
|
-
[E.RESUBSCRIBE]:
|
|
36
|
-
[E.SUBSCRIPTION_PREFERENCE_CENTER]:
|
|
37
|
-
[E.SUBSCRIPTION_PREFERENCE_CONFIRMATION]:
|
|
38
|
-
},
|
|
33
|
+
}, U = {
|
|
34
|
+
[E.GLOBAL_UNSUBSCRIBE]: e("unsubscription-preference.type-global-unsubscribe"),
|
|
35
|
+
[E.GLOBAL_UNSUBSCRIBE_CONFIRMATION_PAGE]: e("unsubscription-preference.type-global-unsubscription-confirmation"),
|
|
36
|
+
[E.RESUBSCRIBE]: e("unsubscription-preference.type-resubscribe"),
|
|
37
|
+
[E.SUBSCRIPTION_PREFERENCE_CENTER]: e("unsubscription-preference.type-subscription-preferences-center"),
|
|
38
|
+
[E.SUBSCRIPTION_PREFERENCE_CONFIRMATION]: e("unsubscription-preference.type-subscription-preferences-confirmation")
|
|
39
|
+
}, o = {
|
|
39
40
|
default: "{{ins-unsubscribe-link}}",
|
|
40
41
|
[E.GLOBAL_UNSUBSCRIBE]: "{{ins-global-unsubscribe-link}}",
|
|
41
42
|
[E.SUBSCRIPTION_PREFERENCE_CENTER]: "{{ins-preferences-unsubscribe-link}}"
|
|
42
43
|
};
|
|
43
44
|
export {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
45
|
+
C as ACADEMY_LINK,
|
|
46
|
+
B as DEFAULT_UNSUBSCRIBE_GROUP,
|
|
47
|
+
i as INSIDER_ID,
|
|
48
|
+
r as LINK_REGEXES,
|
|
49
|
+
I as LINK_TYPES,
|
|
50
|
+
o as MERGE_TAGS,
|
|
50
51
|
E as PAGE_TYPES,
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
52
|
+
t as TYPE_COLLECTIONS,
|
|
53
|
+
U as TYPE_TRANSLATIONS,
|
|
54
|
+
c as UNSUBSCRIBE_PAGES_LINK,
|
|
55
|
+
_ as URLS
|
|
55
56
|
};
|
|
@@ -2,9 +2,9 @@ var d = Object.defineProperty;
|
|
|
2
2
|
var l = (r, n, e) => n in r ? d(r, n, { enumerable: !0, configurable: !0, writable: !0, value: e }) : r[n] = e;
|
|
3
3
|
var o = (r, n, e) => l(r, typeof n != "symbol" ? n + "" : n, e);
|
|
4
4
|
import { useHttp as L } from "../../../composables/useHttp.js";
|
|
5
|
-
import { DEFAULT_UNSUBSCRIBE_GROUP as
|
|
5
|
+
import { DEFAULT_UNSUBSCRIBE_GROUP as c } from "../../../enums/unsubscribe.js";
|
|
6
6
|
import { Control as h, UIElementType as i, UEAttr as t, ModificationDescription as p } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
7
|
-
const m = "ui-elements-checkbox",
|
|
7
|
+
const m = "ui-elements-checkbox", u = "select", { get: C } = L();
|
|
8
8
|
class S extends h {
|
|
9
9
|
constructor() {
|
|
10
10
|
super(...arguments);
|
|
@@ -16,15 +16,16 @@ class S extends h {
|
|
|
16
16
|
return m;
|
|
17
17
|
}
|
|
18
18
|
_setFormValues() {
|
|
19
|
-
if (this.currentNode && "getAttribute" in this.currentNode) {
|
|
19
|
+
if (this.selectedUnsubGroup = "", this.currentNode && "getAttribute" in this.currentNode) {
|
|
20
20
|
const e = this.currentNode.getAttribute("id");
|
|
21
21
|
if (e) {
|
|
22
|
-
const s = e ===
|
|
23
|
-
s && (this.selectedUnsubGroup = s
|
|
24
|
-
[a]: this.selectedUnsubGroup
|
|
25
|
-
}));
|
|
22
|
+
const s = e === c.sendGridId ? e : Number(e);
|
|
23
|
+
s && (this.selectedUnsubGroup = s);
|
|
26
24
|
}
|
|
27
25
|
}
|
|
26
|
+
this.api.updateValues({
|
|
27
|
+
[u]: this.selectedUnsubGroup
|
|
28
|
+
});
|
|
28
29
|
}
|
|
29
30
|
_getLabel(e, s = `${Math.random()}`) {
|
|
30
31
|
return `
|
|
@@ -54,7 +55,7 @@ class S extends h {
|
|
|
54
55
|
</${i.LABEL}>
|
|
55
56
|
|
|
56
57
|
<${i.SELECTPICKER}
|
|
57
|
-
${t.SELECTPICKER.name}="${
|
|
58
|
+
${t.SELECTPICKER.name}="${u}"
|
|
58
59
|
${t.SELECTPICKER.placeholder}="${this.api.translate("Select Unsubscribe Group")}">
|
|
59
60
|
${this._getSelect()}
|
|
60
61
|
</${i.SELECTPICKER}>
|
|
@@ -66,21 +67,21 @@ class S extends h {
|
|
|
66
67
|
this.currentNode && this.api.getDocumentModifier().modifyHtml(this.currentNode).setAttribute("id", e.toString()).apply(new p(`Updated text to ${e}`));
|
|
67
68
|
}
|
|
68
69
|
_listenToFormUpdates() {
|
|
69
|
-
this.api.onValueChanged(
|
|
70
|
+
this.api.onValueChanged(u, (e) => this._onSelectChange(e));
|
|
70
71
|
}
|
|
71
72
|
onTemplateNodeUpdated(e) {
|
|
72
|
-
this.currentNode = e;
|
|
73
|
+
this.currentNode = e, this._setFormValues();
|
|
73
74
|
}
|
|
74
75
|
// eslint-disable-next-line @typescript-eslint/no-misused-promises
|
|
75
76
|
async onRender() {
|
|
76
77
|
const e = await C(
|
|
77
78
|
"/unsubscribe-groups/unsubscribe-list"
|
|
78
|
-
), s = [
|
|
79
|
-
[t.SELECT_ITEM.text]:
|
|
80
|
-
[t.SELECT_ITEM.value]:
|
|
79
|
+
), s = [c, ...e.data], E = s.map((a) => ({
|
|
80
|
+
[t.SELECT_ITEM.text]: a.name,
|
|
81
|
+
[t.SELECT_ITEM.value]: a.sendGridId
|
|
81
82
|
}));
|
|
82
83
|
this.unsubList = s, this.api.setUIEAttribute(
|
|
83
|
-
|
|
84
|
+
u,
|
|
84
85
|
t.SELECTPICKER.items,
|
|
85
86
|
E
|
|
86
87
|
), this._setFormValues(), this._listenToFormUpdates();
|
|
@@ -3,7 +3,7 @@ const e = {
|
|
|
3
3
|
TITLE: "Unsubscribe From All Email Lists",
|
|
4
4
|
DESCRIPTION: "You will still receive important transactional and billing-related emails."
|
|
5
5
|
}, l = `
|
|
6
|
-
<td align="left" class="checkbox-block-v2 esd-block-checkbox es-p20">
|
|
6
|
+
<td align="left" class="checkbox-block checkbox-block-v2 esd-block-checkbox es-p20">
|
|
7
7
|
<table cellpadding="0" cellspacing="0" role="presentation" width="100%">
|
|
8
8
|
<tbody>
|
|
9
9
|
<tr>
|
|
@@ -26,11 +26,16 @@ const e = {
|
|
|
26
26
|
</tbody>
|
|
27
27
|
</table>
|
|
28
28
|
</td>
|
|
29
|
-
`,
|
|
30
|
-
<td
|
|
31
|
-
align="left"
|
|
32
|
-
esd-extension-block-id="checkbox-block"
|
|
33
|
-
class="
|
|
29
|
+
`, o = `
|
|
30
|
+
<td
|
|
31
|
+
align="left"
|
|
32
|
+
esd-extension-block-id="checkbox-block"
|
|
33
|
+
class="
|
|
34
|
+
checkbox-block
|
|
35
|
+
checkbox-block-v2
|
|
36
|
+
esd-block-checkbox
|
|
37
|
+
esd-checkbox-block
|
|
38
|
+
esd-extension-block es-p20"
|
|
34
39
|
>
|
|
35
40
|
<table cellpadding="0" cellspacing="0" role="presentation" width="100%">
|
|
36
41
|
<tbody>
|
|
@@ -55,10 +60,10 @@ const e = {
|
|
|
55
60
|
</table>
|
|
56
61
|
</td>
|
|
57
62
|
`;
|
|
58
|
-
function
|
|
63
|
+
function a() {
|
|
59
64
|
return l.replace("{-{-TITLE-}-}", `<p path="1">${e.TITLE}</p>`).replace("{-{-DESCRIPTION-}-}", `<p path="1">${e.DESCRIPTION}</p>`);
|
|
60
65
|
}
|
|
61
66
|
export {
|
|
62
|
-
|
|
63
|
-
|
|
67
|
+
o as default,
|
|
68
|
+
a as getDefaultTemplate
|
|
64
69
|
};
|
|
@@ -1,19 +1,20 @@
|
|
|
1
|
-
import { useOnboardingStore as
|
|
2
|
-
import { Block as
|
|
1
|
+
import { useOnboardingStore as y } from "../../../stores/onboarding.js";
|
|
2
|
+
import { Block as R, BlockCompositionType as L, ModificationDescription as a } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
3
3
|
import { configAttributes as t } from "./enums/productEnums.js";
|
|
4
4
|
import { DefaultConfigValues as e, SETTINGS_ENUMS as l } from "./enums/settingsEnums.js";
|
|
5
|
-
import { useItemsBlockStore as
|
|
6
|
-
import { getDefaultTemplate as
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
import { useItemsBlockStore as S } from "./store/items-block.js";
|
|
6
|
+
import { getDefaultTemplate as V } from "./template.js";
|
|
7
|
+
import { syncCurrencySymbolFromAttributes as B, syncCurrencyLocationFromAttributes as U, syncFormattedPriceFromAttributes as k } from "./utils/syncAttributesFromConfigBlock.js";
|
|
8
|
+
const M = "items-block";
|
|
9
|
+
class x extends R {
|
|
9
10
|
getId() {
|
|
10
|
-
return
|
|
11
|
+
return M;
|
|
11
12
|
}
|
|
12
13
|
getIcon() {
|
|
13
14
|
return "items-icon";
|
|
14
15
|
}
|
|
15
16
|
getBlockCompositionType() {
|
|
16
|
-
return
|
|
17
|
+
return L.CONTAINER;
|
|
17
18
|
}
|
|
18
19
|
getName() {
|
|
19
20
|
return this.api.translate("Items");
|
|
@@ -22,14 +23,13 @@ class V extends _ {
|
|
|
22
23
|
return this.api.translate("Items lets you display personalized products based on user behavior.");
|
|
23
24
|
}
|
|
24
25
|
getTemplate() {
|
|
25
|
-
|
|
26
|
-
return D({
|
|
26
|
+
return V({
|
|
27
27
|
orientation: l.ORIENTATION.HORIZONTAL,
|
|
28
28
|
itemsType: l.ITEMS_TYPE.CART_ITEMS,
|
|
29
29
|
itemId: "{{Abandoned Cart Item (1) Url}}",
|
|
30
|
-
currencySymbol:
|
|
31
|
-
currencyLocation:
|
|
32
|
-
formattedPrice:
|
|
30
|
+
currencySymbol: e.productPriceCurrencySymbolControlValue,
|
|
31
|
+
currencyLocation: e.productPriceCurrencyLocationControlValue,
|
|
32
|
+
formattedPrice: e.productPriceFormattedControlValue === "1"
|
|
33
33
|
});
|
|
34
34
|
}
|
|
35
35
|
allowInnerBlocksDND() {
|
|
@@ -39,29 +39,29 @@ class V extends _ {
|
|
|
39
39
|
const n = r.querySelector("esd-config-block");
|
|
40
40
|
if (!n)
|
|
41
41
|
return;
|
|
42
|
-
const o = n,
|
|
43
|
-
if (Number(
|
|
44
|
-
if (!
|
|
45
|
-
const i =
|
|
46
|
-
this.api.getDocumentModifier().modifyHtml(o).setAttribute(t.BLOCK_INSTANCE_ID, i).apply(new
|
|
42
|
+
const o = n, s = o.getAttribute("data-initialized") || "0", u = o.getAttribute(t.BLOCK_INSTANCE_ID), c = () => String(Date.now() + Math.floor(Math.random() * 1e3));
|
|
43
|
+
if (Number(s)) {
|
|
44
|
+
if (!u) {
|
|
45
|
+
const i = c();
|
|
46
|
+
this.api.getDocumentModifier().modifyHtml(o).setAttribute(t.BLOCK_INSTANCE_ID, i).apply(new a("Assign block instance ID to legacy block"));
|
|
47
47
|
}
|
|
48
48
|
} else {
|
|
49
|
-
const i = e.itemsType,
|
|
50
|
-
this.api.getDocumentModifier().modifyHtml(o).setAttribute("data-source", i).setAttribute(t.TYPE, i).setAttribute(t.ITEMS_INDEX_SELECT_CONTROL_VALUE,
|
|
49
|
+
const i = e.itemsType, I = e.cartItemsSelectControlValue, d = e.cardOrientationControlValue, m = e.productNameTrimmingControlValue, C = e.productPriceHideDiscountControlValue, b = e.productPriceFormattedControlValue, T = e.productPriceCurrencySymbolControlValue, A = e.productPriceCurrencyLocationControlValue, E = e.productButtonLinkControlValue, O = e.productImageLinkControlValue, _ = e.productImageVisible, p = e.productNameVisible, N = e.productQuantityVisible, f = e.productPriceVisible, g = e.productOriginalPriceVisible, D = e.productButtonVisible, P = c();
|
|
50
|
+
this.api.getDocumentModifier().modifyHtml(o).setAttribute("data-source", i).setAttribute(t.TYPE, i).setAttribute(t.ITEMS_INDEX_SELECT_CONTROL_VALUE, I).setAttribute(t.ORIENTATION, d).setAttribute(t.PRODUCT_NAME_TRIMMING, m).setAttribute(t.PRODUCT_PRICE_HIDE_DISCOUNT, C).setAttribute(t.PRODUCT_PRICE_FORMATTED, b).setAttribute(t.PRODUCT_PRICE_CURRENCY_SYMBOL, T).setAttribute(t.PRODUCT_PRICE_CURRENCY_LOCATION, A).setAttribute(t.PRODUCT_BUTTON_LINK, E).setAttribute(t.PRODUCT_IMAGE_LINK, O).setAttribute(t.BLOCK_INSTANCE_ID, P).setAttribute("data-initialized", "1").setAttribute(t.NAME_CONTROL_ENABLED, e.productNameControlEnabled).setAttribute(
|
|
51
51
|
t.QUANTITY_CONTROL_ENABLED,
|
|
52
52
|
e.productQuantityControlEnabled
|
|
53
|
-
).setAttribute(t.PRICE_CONTROL_OPENED, e.productPriceControlOpened).apply(new
|
|
53
|
+
).setAttribute(t.PRICE_CONTROL_OPENED, e.productPriceControlOpened).setAttribute(t.PRODUCT_IMAGE_VISIBLE, _).setAttribute(t.PRODUCT_NAME_VISIBLE, p).setAttribute(t.PRODUCT_QUANTITY_VISIBLE, N).setAttribute(t.PRODUCT_PRICE_VISIBLE, f).setAttribute(t.PRODUCT_ORIGINAL_PRICE_VISIBLE, g).setAttribute(t.PRODUCT_BUTTON_VISIBLE, D).apply(new a("Initialize config block attributes with defaults")), y().startOnboarding("itemsOnboarding");
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
56
|
onSelect(r) {
|
|
57
|
-
const n = r.querySelector("esd-config-block"), o =
|
|
57
|
+
const n = r.querySelector("esd-config-block"), o = S();
|
|
58
58
|
if (!n)
|
|
59
59
|
return;
|
|
60
|
-
const
|
|
61
|
-
o.setItemsType(
|
|
60
|
+
const s = n, u = s.getAttribute(t.TYPE) || e.itemsType, c = s.getAttribute(t.ITEMS_INDEX_SELECT_CONTROL_VALUE) || e.cartItemsSelectControlValue, i = s.getAttribute(t.ORIENTATION) || e.cardOrientationControlValue;
|
|
61
|
+
o.setItemsType(u), o.setItemIds(c), o.setOrientation(i), B(r), U(r), k(r);
|
|
62
62
|
}
|
|
63
63
|
}
|
|
64
64
|
export {
|
|
65
|
-
|
|
66
|
-
|
|
65
|
+
M as BLOCK_ID,
|
|
66
|
+
x as ItemsBlock
|
|
67
67
|
};
|