@useinsider/guido 2.0.0-beta.a3f32aa → 2.0.0-beta.ac3cd4d
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 +11 -9
- package/dist/composables/useStripo.js +51 -50
- package/dist/extensions/Blocks/CouponBlock/constants.js +4 -0
- package/dist/extensions/Blocks/CouponBlock/controls/index.js +29 -0
- package/dist/extensions/Blocks/CouponBlock/extension.js +5 -4
- package/dist/extensions/Blocks/CouponBlock/settingsPanel.js +20 -14
- package/dist/extensions/Blocks/CouponBlock/template.js +22 -11
- package/dist/extensions/Blocks/controlFactories.js +122 -111
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js +57 -52
- package/dist/src/@types/config/schemas.d.ts +4 -0
- package/dist/src/composables/useConfig.d.ts +2 -0
- package/dist/src/extensions/Blocks/CouponBlock/constants.d.ts +14 -0
- package/dist/src/extensions/Blocks/CouponBlock/controls/index.d.ts +108 -0
- package/dist/src/extensions/Blocks/CouponBlock/template.d.ts +1 -1
- package/dist/src/extensions/Blocks/controlFactories.d.ts +30 -7
- package/dist/src/stores/config.d.ts +18 -0
- package/dist/static/styles/components/button.css.js +1 -1
- package/dist/static/styles/components/narrow-panel.css.js +0 -10
- package/package.json +1 -1
|
@@ -91,7 +91,7 @@ const m = {
|
|
|
91
91
|
showHeader: e(c(), !0),
|
|
92
92
|
/** Custom label for back button (if shown) */
|
|
93
93
|
backButtonLabel: e(t())
|
|
94
|
-
}),
|
|
94
|
+
}), f = o({
|
|
95
95
|
/** Enable dynamic content insertion */
|
|
96
96
|
dynamicContent: e(c(), !0),
|
|
97
97
|
/** Enable save as template functionality */
|
|
@@ -103,8 +103,10 @@ const m = {
|
|
|
103
103
|
/** Enable display conditions */
|
|
104
104
|
displayConditions: e(c(), !0),
|
|
105
105
|
/** Enable unsubscribe block */
|
|
106
|
-
unsubscribe: e(c(), !0)
|
|
107
|
-
|
|
106
|
+
unsubscribe: e(c(), !0),
|
|
107
|
+
/** Disable modules panel in the editor */
|
|
108
|
+
modulesDisabled: e(c(), !1)
|
|
109
|
+
}), A = n([
|
|
108
110
|
"amp-accordion",
|
|
109
111
|
"amp-carousel",
|
|
110
112
|
"amp-form-controls",
|
|
@@ -129,7 +131,7 @@ const m = {
|
|
|
129
131
|
]), E = o({
|
|
130
132
|
/** Default blocks to exclude from the editor */
|
|
131
133
|
excludeDefaults: e(
|
|
132
|
-
a(
|
|
134
|
+
a(A),
|
|
133
135
|
[]
|
|
134
136
|
),
|
|
135
137
|
/** Custom blocks to include in the editor */
|
|
@@ -196,7 +198,7 @@ const m = {
|
|
|
196
198
|
"externalValidation must be a function"
|
|
197
199
|
)
|
|
198
200
|
)
|
|
199
|
-
}),
|
|
201
|
+
}), D = o({
|
|
200
202
|
// Required sections
|
|
201
203
|
/** Identity configuration (required) */
|
|
202
204
|
identity: h,
|
|
@@ -210,7 +212,7 @@ const m = {
|
|
|
210
212
|
/** UI configuration */
|
|
211
213
|
ui: e(T, {}),
|
|
212
214
|
/** Feature toggles */
|
|
213
|
-
features: e(
|
|
215
|
+
features: e(f, {}),
|
|
214
216
|
/** Block configuration */
|
|
215
217
|
blocks: e(E, {}),
|
|
216
218
|
/** Compiler configuration */
|
|
@@ -225,12 +227,12 @@ export {
|
|
|
225
227
|
B as CompilerSchema,
|
|
226
228
|
g as CustomBlockTypeSchema,
|
|
227
229
|
v as CustomRuleSchema,
|
|
228
|
-
|
|
230
|
+
A as DefaultBlockTypeSchema,
|
|
229
231
|
y as DynamicContentSchema,
|
|
230
232
|
I as EditorSchema,
|
|
231
233
|
R as EmailHeaderSchema,
|
|
232
|
-
|
|
233
|
-
|
|
234
|
+
f as FeaturesSchema,
|
|
235
|
+
D as GuidoConfigSchema,
|
|
234
236
|
h as IdentitySchema,
|
|
235
237
|
m as MessageType,
|
|
236
238
|
k as PartnerSchema,
|
|
@@ -1,25 +1,25 @@
|
|
|
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:
|
|
15
|
-
var
|
|
16
|
-
const
|
|
1
|
+
import { useActionsApi as T } from "./useActionsApi.js";
|
|
2
|
+
import { useBlocksConfig as V } from "./useBlocksConfig.js";
|
|
3
|
+
import { useConfig as _ } from "./useConfig.js";
|
|
4
|
+
import { useCustomInterfaceAppearance as B } from "./useCustomInterfaceAppearance.js";
|
|
5
|
+
import { useStripoEventHandler as v } from "./useStripoEventHandler.js";
|
|
6
|
+
import { useToaster as A } from "./useToaster.js";
|
|
7
|
+
import { displayConditions as F } from "../enums/displayConditions.js";
|
|
8
|
+
import { useStripoApi as D } from "../services/stripoApi.js";
|
|
9
|
+
import I from "../static/styles/customEditorStyle.css.js";
|
|
10
|
+
import { useEditorStore as M } from "../stores/editor.js";
|
|
11
|
+
import { dynamicContentToMergeTags as U } from "../utils/genericUtil.js";
|
|
12
|
+
import P from "../package.json.js";
|
|
13
|
+
const K = (c) => {
|
|
14
|
+
const { features: l } = _(), { handleError: u } = A(), { getToken: y, getCustomFonts: S } = D(), { handleEvent: C } = v(), { getStripoBlocksConfig: E } = V(), h = async (i, n = []) => {
|
|
15
|
+
var g, f;
|
|
16
|
+
const o = M(), { html: r, css: p, forceRecreate: a } = i, { baseBlocks: t, extensions: d } = await E(), m = ((g = l.value) == null ? void 0 : g.displayConditions) ?? !0, b = ((f = l.value) == null ? void 0 : f.modulesDisabled) ?? !1;
|
|
17
17
|
window.UIEditor.initEditor(
|
|
18
18
|
document.querySelector("#guido-editor"),
|
|
19
19
|
{
|
|
20
20
|
metadata: c,
|
|
21
|
-
html:
|
|
22
|
-
css:
|
|
21
|
+
html: r,
|
|
22
|
+
css: p,
|
|
23
23
|
forceRecreate: a,
|
|
24
24
|
locale: "en",
|
|
25
25
|
undoButtonSelector: "#guido__undo-button",
|
|
@@ -30,11 +30,12 @@ const N = (c) => {
|
|
|
30
30
|
customAppearanceMergetags: !0,
|
|
31
31
|
customAppearanceMergetagsBorderColor: "#f1f3fe",
|
|
32
32
|
customAppearanceMergetagsBackgroundColor: "#f1f3fe",
|
|
33
|
-
customViewStyles:
|
|
34
|
-
conditionsEnabled:
|
|
35
|
-
customConditionsEnabled:
|
|
36
|
-
conditionCategories:
|
|
33
|
+
customViewStyles: I,
|
|
34
|
+
conditionsEnabled: m,
|
|
35
|
+
customConditionsEnabled: m,
|
|
36
|
+
conditionCategories: F,
|
|
37
37
|
enableXSSSecurity: !0,
|
|
38
|
+
modulesDisabled: b,
|
|
38
39
|
messageSettingsEnabled: !0,
|
|
39
40
|
displayGmailAnnotations: !0,
|
|
40
41
|
displayHiddenPreheader: !1,
|
|
@@ -45,44 +46,44 @@ const N = (c) => {
|
|
|
45
46
|
editorFonts: {
|
|
46
47
|
showDefaultStandardFonts: !0,
|
|
47
48
|
showDefaultNotStandardFonts: !0,
|
|
48
|
-
customFonts:
|
|
49
|
+
customFonts: n
|
|
49
50
|
},
|
|
50
51
|
mergeTags: [
|
|
51
52
|
{
|
|
52
|
-
entries:
|
|
53
|
+
entries: U(c.preselectedDynamicContentList)
|
|
53
54
|
}
|
|
54
55
|
],
|
|
55
|
-
async onTokenRefreshRequest(
|
|
56
|
+
async onTokenRefreshRequest(e) {
|
|
56
57
|
try {
|
|
57
|
-
const s = await
|
|
58
|
-
|
|
58
|
+
const s = await y();
|
|
59
|
+
e(s);
|
|
59
60
|
} catch (s) {
|
|
60
|
-
|
|
61
|
+
u(s, "Failed to refresh token");
|
|
61
62
|
}
|
|
62
63
|
},
|
|
63
64
|
onTemplateLoaded() {
|
|
64
65
|
try {
|
|
65
|
-
const { importCss:
|
|
66
|
-
|
|
67
|
-
|
|
66
|
+
const { importCss: e } = B(), { activateCustomViewStyles: s, updateTimerInClonedTemplate: k } = T();
|
|
67
|
+
e(), s(), k(), c.onReady(), o.isStripoInitialized = !0, o.loadingStatus = !1, setTimeout(() => {
|
|
68
|
+
o.hasChanges = !1;
|
|
68
69
|
}, 1e3);
|
|
69
|
-
} catch (
|
|
70
|
-
|
|
70
|
+
} catch (e) {
|
|
71
|
+
u(e, "Failed to load custom interface appearance");
|
|
71
72
|
}
|
|
72
73
|
},
|
|
73
|
-
onCodeEditorVisibilityChanged(
|
|
74
|
-
|
|
74
|
+
onCodeEditorVisibilityChanged(e) {
|
|
75
|
+
o.isCodeEditorOpen = e;
|
|
75
76
|
},
|
|
76
|
-
onEditorVisualModeChanged(
|
|
77
|
-
|
|
77
|
+
onEditorVisualModeChanged(e) {
|
|
78
|
+
o.editorVisualMode = e.toLowerCase();
|
|
78
79
|
},
|
|
79
|
-
onVersionHistoryVisibilityChanged(
|
|
80
|
-
|
|
80
|
+
onVersionHistoryVisibilityChanged(e) {
|
|
81
|
+
o.isVersionHistoryOpen = e;
|
|
81
82
|
},
|
|
82
83
|
onDataChanged() {
|
|
83
|
-
|
|
84
|
+
o.hasChanges = !0;
|
|
84
85
|
},
|
|
85
|
-
onEvent:
|
|
86
|
+
onEvent: C,
|
|
86
87
|
ignoreClickOutsideSelectors: [
|
|
87
88
|
"#guido-dynamic-content-modal",
|
|
88
89
|
".in-on-board-wrapper",
|
|
@@ -91,26 +92,26 @@ const N = (c) => {
|
|
|
91
92
|
extensions: d
|
|
92
93
|
}
|
|
93
94
|
);
|
|
94
|
-
},
|
|
95
|
+
}, w = (i) => new Promise((n, o) => {
|
|
95
96
|
var d;
|
|
96
97
|
if (document.getElementById("UiEditorScript")) {
|
|
97
|
-
i(),
|
|
98
|
+
i(), n();
|
|
98
99
|
return;
|
|
99
100
|
}
|
|
100
|
-
const
|
|
101
|
+
const r = P.guido, a = `https://email-static.useinsider.com/guido/${(d = r == null ? void 0 : r.stripo) == null ? void 0 : d.version}/UIEditor.js`, t = document.createElement("script");
|
|
101
102
|
t.id = "UiEditorScript", t.type = "module", t.src = a, t.onload = () => {
|
|
102
|
-
i(),
|
|
103
|
+
i(), n();
|
|
103
104
|
}, t.onerror = () => {
|
|
104
|
-
|
|
105
|
+
o(new Error(`Failed to load Stripo UIEditor script from S3: ${a}`));
|
|
105
106
|
}, document.body.appendChild(t);
|
|
106
107
|
});
|
|
107
108
|
return { initPlugin: async (i) => {
|
|
108
|
-
await
|
|
109
|
-
const
|
|
110
|
-
await
|
|
109
|
+
await w(async () => {
|
|
110
|
+
const n = await S();
|
|
111
|
+
await h(i, n);
|
|
111
112
|
});
|
|
112
113
|
} };
|
|
113
114
|
};
|
|
114
115
|
export {
|
|
115
|
-
|
|
116
|
+
K as useStripo
|
|
116
117
|
};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
var t = /* @__PURE__ */ ((c) => (c.TEXT_ALIGN = "coupon-block-text-align-control", c.TEXT_COLOR = "coupon-block-text-color-control", c.TEXT_SIZE = "coupon-block-text-size-control", c.TEXT_STYLE = "coupon-block-text-style-control", c.TEXT_FONT_FAMILY = "coupon-block-text-font-family-control", c.TEXT_BACKGROUND = "coupon-block-text-background-control", c.TEXT_PADDINGS = "coupon-block-text-paddings-control", c.TEXT_LINE_SPACING = "coupon-block-text-line-spacing-control", c))(t || {});
|
|
2
|
+
export {
|
|
3
|
+
t as CouponControlId
|
|
4
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { createTextAlignControl as t, createTextColorControl as e, createTextSizeControl as n, createTextStyleControl as r, createTextFontFamilyControl as T, createTextBackgroundColorControl as l, createPaddingsControl as C, createTextLineSpacingControl as c } from "../../controlFactories.js";
|
|
2
|
+
import { CouponControlId as o } from "../constants.js";
|
|
3
|
+
const i = t(
|
|
4
|
+
o.TEXT_ALIGN
|
|
5
|
+
), E = e(
|
|
6
|
+
o.TEXT_COLOR
|
|
7
|
+
), s = n(
|
|
8
|
+
o.TEXT_SIZE
|
|
9
|
+
), S = r(
|
|
10
|
+
o.TEXT_STYLE
|
|
11
|
+
), _ = T(
|
|
12
|
+
o.TEXT_FONT_FAMILY
|
|
13
|
+
), g = l(
|
|
14
|
+
o.TEXT_BACKGROUND
|
|
15
|
+
), X = C(
|
|
16
|
+
o.TEXT_PADDINGS
|
|
17
|
+
), d = c(
|
|
18
|
+
o.TEXT_LINE_SPACING
|
|
19
|
+
);
|
|
20
|
+
export {
|
|
21
|
+
i as TextAlignControl,
|
|
22
|
+
g as TextBackgroundControl,
|
|
23
|
+
E as TextColorControl,
|
|
24
|
+
_ as TextFontFamilyControl,
|
|
25
|
+
d as TextLineSpacingControl,
|
|
26
|
+
X as TextPaddingsControl,
|
|
27
|
+
s as TextSizeControl,
|
|
28
|
+
S as TextStyleControl
|
|
29
|
+
};
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { ExtensionBuilder as o } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
2
2
|
import { CouponBlock as t } from "./block.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
3
|
+
import { TextAlignControl as n, TextColorControl as r, TextSizeControl as l, TextStyleControl as d, TextFontFamilyControl as e, TextBackgroundControl as i, TextPaddingsControl as C, TextLineSpacingControl as a } from "./controls/index.js";
|
|
4
|
+
import { CouponIconsRegistry as s } from "./iconsRegistry.js";
|
|
5
|
+
import { CouponBlockSettings as m } from "./settingsPanel.js";
|
|
6
|
+
const u = new o().addBlock(t).withSettingsPanelRegistry(m).addControl(n).addControl(r).addControl(l).addControl(d).addControl(e).addControl(i).addControl(C).addControl(a).withIconsRegistry(s).build();
|
|
6
7
|
export {
|
|
7
|
-
|
|
8
|
+
u as default
|
|
8
9
|
};
|
|
@@ -1,24 +1,30 @@
|
|
|
1
|
-
import { SettingsPanelRegistry as
|
|
2
|
-
import { COUPON_BLOCK_ID as
|
|
3
|
-
|
|
1
|
+
import { SettingsPanelRegistry as n, SettingsPanelTab as o, SettingsTab as t } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
2
|
+
import { COUPON_BLOCK_ID as E } from "./block.js";
|
|
3
|
+
import { CouponControlId as T } from "./constants.js";
|
|
4
|
+
class i extends n {
|
|
4
5
|
registerBlockControls(e) {
|
|
5
|
-
e[
|
|
6
|
+
e[E] = [
|
|
6
7
|
new o(
|
|
7
|
-
|
|
8
|
+
t.SETTINGS,
|
|
8
9
|
[
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
10
|
+
T.TEXT_STYLE,
|
|
11
|
+
T.TEXT_ALIGN,
|
|
12
|
+
T.TEXT_PADDINGS
|
|
13
|
+
]
|
|
14
|
+
),
|
|
15
|
+
new o(
|
|
16
|
+
t.STYLES,
|
|
17
|
+
[
|
|
18
|
+
T.TEXT_BACKGROUND,
|
|
19
|
+
T.TEXT_FONT_FAMILY,
|
|
20
|
+
T.TEXT_LINE_SPACING,
|
|
21
|
+
T.TEXT_SIZE,
|
|
22
|
+
T.TEXT_COLOR
|
|
17
23
|
]
|
|
18
24
|
)
|
|
19
25
|
];
|
|
20
26
|
}
|
|
21
27
|
}
|
|
22
28
|
export {
|
|
23
|
-
|
|
29
|
+
i as CouponBlockSettings
|
|
24
30
|
};
|
|
@@ -1,18 +1,29 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
esd-extension-block-id="
|
|
1
|
+
import { BlockType as o } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
2
|
+
import { COUPON_BLOCK_ID as e } from "./block.js";
|
|
3
|
+
const t = `
|
|
4
|
+
<${o.BLOCK_TEXT}
|
|
5
|
+
class="coupon-block ins-coupon-code coupon-block-v2 es-p10"
|
|
6
|
+
align="center"
|
|
7
|
+
esd-extension-block-id="${e}">
|
|
8
|
+
<p
|
|
9
|
+
path="1"
|
|
10
|
+
contenteditable="false"
|
|
11
|
+
style="font-size: 16px; color: #333333;">
|
|
12
|
+
<strong path="1,0">{@COUPON_CODE}</strong>
|
|
13
|
+
</p>
|
|
14
|
+
</${o.BLOCK_TEXT}>
|
|
15
|
+
`, l = `
|
|
16
|
+
<td
|
|
17
|
+
class="coupon-block coupon-block-v2 ins-coupon-code esd-block-text esd-extension-block"
|
|
18
|
+
esd-extension-block-id="${e}"
|
|
8
19
|
>
|
|
9
20
|
<p class="ins-title" contenteditable="false">{@COUPON_CODE}</p>
|
|
10
21
|
</td>
|
|
11
22
|
`;
|
|
12
|
-
function
|
|
13
|
-
return
|
|
23
|
+
function s() {
|
|
24
|
+
return t;
|
|
14
25
|
}
|
|
15
26
|
export {
|
|
16
|
-
|
|
17
|
-
|
|
27
|
+
l as default,
|
|
28
|
+
s as getDefaultTemplate
|
|
18
29
|
};
|