strapi-plugin-magic-mail 1.0.4 → 1.0.5
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/admin/src/pages/EmailDesigner/EditorPage.jsx +25 -15
- package/dist/_chunks/{App-kROs3WSy.js → App-CClpsmQH.js} +188 -197
- package/dist/_chunks/{App-DqArrXrm.mjs → App-DQpXIAmV.mjs} +188 -176
- package/dist/admin/index.js +1 -1
- package/dist/admin/index.mjs +1 -1
- package/dist/server/index.js +1 -1
- package/dist/server/index.mjs +1 -1
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useState, useEffect, useRef
|
|
1
|
+
import React, { useState, useEffect, useRef } from 'react';
|
|
2
2
|
import { useFetchClient, useNotification } from '@strapi/strapi/admin';
|
|
3
3
|
import { useNavigate, useLocation } from 'react-router-dom';
|
|
4
4
|
import { useAuthRefresh } from '../../hooks/useAuthRefresh';
|
|
@@ -26,6 +26,7 @@ import {
|
|
|
26
26
|
CodeBracketIcon,
|
|
27
27
|
} from '@heroicons/react/24/outline';
|
|
28
28
|
import { useLicense } from '../../hooks/useLicense';
|
|
29
|
+
import EmailEditor from 'react-email-editor';
|
|
29
30
|
|
|
30
31
|
// Standard Email Template for Core Emails (when no design exists)
|
|
31
32
|
const STANDARD_EMAIL_TEMPLATE = {
|
|
@@ -107,13 +108,6 @@ const STANDARD_EMAIL_TEMPLATE = {
|
|
|
107
108
|
schemaVersion: 6,
|
|
108
109
|
};
|
|
109
110
|
|
|
110
|
-
// Dynamic import for Email Editor (500KB)
|
|
111
|
-
const EmailEditor = lazy(() =>
|
|
112
|
-
import('react-email-editor').then((module) => ({
|
|
113
|
-
default: module.default || module.EmailEditor || module,
|
|
114
|
-
}))
|
|
115
|
-
);
|
|
116
|
-
|
|
117
111
|
// Styled components
|
|
118
112
|
const Container = styled.div`
|
|
119
113
|
min-height: 100vh;
|
|
@@ -245,6 +239,16 @@ const LoadingContainer = styled.div`
|
|
|
245
239
|
align-items: center;
|
|
246
240
|
`;
|
|
247
241
|
|
|
242
|
+
const EditorCanvas = styled.div`
|
|
243
|
+
min-height: calc(100vh - 240px);
|
|
244
|
+
`;
|
|
245
|
+
|
|
246
|
+
const DesignerLoadingContainer = styled(LoadingContainer)`
|
|
247
|
+
width: 100%;
|
|
248
|
+
min-height: calc(100vh - 240px);
|
|
249
|
+
padding: 40px 20px;
|
|
250
|
+
`;
|
|
251
|
+
|
|
248
252
|
const HiddenInput = styled.input`
|
|
249
253
|
display: none;
|
|
250
254
|
`;
|
|
@@ -585,6 +589,7 @@ const EditorPage = () => {
|
|
|
585
589
|
const [loading, setLoading] = useState(!isNewTemplate && !isCoreEmail);
|
|
586
590
|
const [saving, setSaving] = useState(false);
|
|
587
591
|
const [activeTab, setActiveTab] = useState('html');
|
|
592
|
+
const [editorLoaded, setEditorLoaded] = useState(false);
|
|
588
593
|
|
|
589
594
|
const [templateData, setTemplateData] = useState({
|
|
590
595
|
templateReferenceId: '',
|
|
@@ -937,6 +942,7 @@ const EditorPage = () => {
|
|
|
937
942
|
};
|
|
938
943
|
|
|
939
944
|
const onEditorReady = () => {
|
|
945
|
+
setEditorLoaded(true);
|
|
940
946
|
if (templateData.design && emailEditorRef.current?.editor) {
|
|
941
947
|
setTimeout(() => {
|
|
942
948
|
emailEditorRef.current.editor.loadDesign(templateData.design);
|
|
@@ -1101,12 +1107,16 @@ const EditorPage = () => {
|
|
|
1101
1107
|
|
|
1102
1108
|
<StyledTabsContent value="html">
|
|
1103
1109
|
<TabContentWrapper>
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
<
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
+
{!editorLoaded && (
|
|
1111
|
+
<DesignerLoadingContainer>
|
|
1112
|
+
<Loader>Loading Email Designer...</Loader>
|
|
1113
|
+
</DesignerLoadingContainer>
|
|
1114
|
+
)}
|
|
1115
|
+
<EditorCanvas
|
|
1116
|
+
style={{
|
|
1117
|
+
visibility: editorLoaded ? 'visible' : 'hidden',
|
|
1118
|
+
pointerEvents: editorLoaded ? 'auto' : 'none',
|
|
1119
|
+
}}
|
|
1110
1120
|
>
|
|
1111
1121
|
<EmailEditor
|
|
1112
1122
|
ref={emailEditorRef}
|
|
@@ -1292,7 +1302,7 @@ const EditorPage = () => {
|
|
|
1292
1302
|
}
|
|
1293
1303
|
}}
|
|
1294
1304
|
/>
|
|
1295
|
-
</
|
|
1305
|
+
</EditorCanvas>
|
|
1296
1306
|
</TabContentWrapper>
|
|
1297
1307
|
</StyledTabsContent>
|
|
1298
1308
|
|
|
@@ -1,26 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __copyProps = (to, from, except, desc) => {
|
|
9
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
10
|
-
for (let key of __getOwnPropNames(from))
|
|
11
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
12
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
13
|
-
}
|
|
14
|
-
return to;
|
|
15
|
-
};
|
|
16
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
17
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
18
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
19
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
20
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
21
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
|
-
mod
|
|
23
|
-
));
|
|
24
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
25
3
|
const jsxRuntime = require("react/jsx-runtime");
|
|
26
4
|
const React = require("react");
|
|
@@ -30,9 +8,11 @@ const outline = require("@heroicons/react/24/outline");
|
|
|
30
8
|
const admin = require("@strapi/strapi/admin");
|
|
31
9
|
const styled = require("styled-components");
|
|
32
10
|
const icons = require("@strapi/icons");
|
|
11
|
+
const EmailEditor = require("react-email-editor");
|
|
33
12
|
const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
|
|
34
13
|
const React__default = /* @__PURE__ */ _interopDefault(React);
|
|
35
14
|
const styled__default = /* @__PURE__ */ _interopDefault(styled);
|
|
15
|
+
const EmailEditor__default = /* @__PURE__ */ _interopDefault(EmailEditor);
|
|
36
16
|
const useAuthRefresh = () => {
|
|
37
17
|
const { get } = admin.useFetchClient();
|
|
38
18
|
const intervalRef = React.useRef(null);
|
|
@@ -5422,11 +5402,6 @@ const STANDARD_EMAIL_TEMPLATE = {
|
|
|
5422
5402
|
},
|
|
5423
5403
|
schemaVersion: 6
|
|
5424
5404
|
};
|
|
5425
|
-
const EmailEditor = React.lazy(
|
|
5426
|
-
() => import("react-email-editor").then((module2) => ({
|
|
5427
|
-
default: module2.default || module2.EmailEditor || module2
|
|
5428
|
-
}))
|
|
5429
|
-
);
|
|
5430
5405
|
const Container$1 = styled__default.default.div`
|
|
5431
5406
|
min-height: 100vh;
|
|
5432
5407
|
display: flex;
|
|
@@ -5541,6 +5516,14 @@ const LoadingContainer = styled__default.default.div`
|
|
|
5541
5516
|
justify-content: center;
|
|
5542
5517
|
align-items: center;
|
|
5543
5518
|
`;
|
|
5519
|
+
const EditorCanvas = styled__default.default.div`
|
|
5520
|
+
min-height: calc(100vh - 240px);
|
|
5521
|
+
`;
|
|
5522
|
+
const DesignerLoadingContainer = styled__default.default(LoadingContainer)`
|
|
5523
|
+
width: 100%;
|
|
5524
|
+
min-height: calc(100vh - 240px);
|
|
5525
|
+
padding: 40px 20px;
|
|
5526
|
+
`;
|
|
5544
5527
|
const HiddenInput = styled__default.default.input`
|
|
5545
5528
|
display: none;
|
|
5546
5529
|
`;
|
|
@@ -5854,6 +5837,7 @@ const EditorPage = () => {
|
|
|
5854
5837
|
const [loading, setLoading] = React.useState(!isNewTemplate && !isCoreEmail);
|
|
5855
5838
|
const [saving, setSaving] = React.useState(false);
|
|
5856
5839
|
const [activeTab, setActiveTab] = React.useState("html");
|
|
5840
|
+
const [editorLoaded, setEditorLoaded] = React.useState(false);
|
|
5857
5841
|
const [templateData, setTemplateData] = React.useState({
|
|
5858
5842
|
templateReferenceId: "",
|
|
5859
5843
|
name: "",
|
|
@@ -6136,6 +6120,7 @@ const EditorPage = () => {
|
|
|
6136
6120
|
reader.readAsText(file);
|
|
6137
6121
|
};
|
|
6138
6122
|
const onEditorReady = () => {
|
|
6123
|
+
setEditorLoaded(true);
|
|
6139
6124
|
if (templateData.design && emailEditorRef.current?.editor) {
|
|
6140
6125
|
setTimeout(() => {
|
|
6141
6126
|
emailEditorRef.current.editor.loadDesign(templateData.design);
|
|
@@ -6252,192 +6237,198 @@ const EditorPage = () => {
|
|
|
6252
6237
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Tabs.Trigger, { value: "html", children: "✨ Visual Designer" }),
|
|
6253
6238
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Tabs.Trigger, { value: "text", children: "📝 Plain Text" })
|
|
6254
6239
|
] }) }),
|
|
6255
|
-
/* @__PURE__ */ jsxRuntime.jsx(StyledTabsContent, { value: "html", children: /* @__PURE__ */ jsxRuntime.
|
|
6256
|
-
|
|
6257
|
-
|
|
6258
|
-
|
|
6259
|
-
|
|
6260
|
-
|
|
6261
|
-
|
|
6262
|
-
|
|
6263
|
-
|
|
6264
|
-
|
|
6265
|
-
|
|
6266
|
-
|
|
6267
|
-
|
|
6268
|
-
|
|
6269
|
-
|
|
6270
|
-
|
|
6271
|
-
|
|
6272
|
-
|
|
6273
|
-
|
|
6274
|
-
|
|
6275
|
-
|
|
6276
|
-
|
|
6277
|
-
|
|
6278
|
-
|
|
6279
|
-
|
|
6280
|
-
|
|
6281
|
-
|
|
6282
|
-
|
|
6283
|
-
|
|
6284
|
-
|
|
6285
|
-
|
|
6286
|
-
|
|
6287
|
-
previewInBrowser: true,
|
|
6288
|
-
textEditor: {
|
|
6289
|
-
enabled: true,
|
|
6290
|
-
spellChecker: true,
|
|
6291
|
-
tables: true,
|
|
6292
|
-
cleanPaste: true
|
|
6293
|
-
}
|
|
6294
|
-
},
|
|
6295
|
-
// Fonts
|
|
6296
|
-
fonts: {
|
|
6297
|
-
showDefaultFonts: true,
|
|
6298
|
-
customFonts: [
|
|
6299
|
-
{
|
|
6300
|
-
label: "Inter",
|
|
6301
|
-
value: "'Inter', sans-serif",
|
|
6302
|
-
url: "https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap"
|
|
6240
|
+
/* @__PURE__ */ jsxRuntime.jsx(StyledTabsContent, { value: "html", children: /* @__PURE__ */ jsxRuntime.jsxs(TabContentWrapper, { children: [
|
|
6241
|
+
!editorLoaded && /* @__PURE__ */ jsxRuntime.jsx(DesignerLoadingContainer, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Loader, { children: "Loading Email Designer..." }) }),
|
|
6242
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
6243
|
+
EditorCanvas,
|
|
6244
|
+
{
|
|
6245
|
+
style: {
|
|
6246
|
+
visibility: editorLoaded ? "visible" : "hidden",
|
|
6247
|
+
pointerEvents: editorLoaded ? "auto" : "none"
|
|
6248
|
+
},
|
|
6249
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
6250
|
+
EmailEditor__default.default,
|
|
6251
|
+
{
|
|
6252
|
+
ref: emailEditorRef,
|
|
6253
|
+
onReady: onEditorReady,
|
|
6254
|
+
minHeight: "calc(100vh - 240px)",
|
|
6255
|
+
options: {
|
|
6256
|
+
// Display mode
|
|
6257
|
+
displayMode: "email",
|
|
6258
|
+
locale: "en",
|
|
6259
|
+
projectId: 1,
|
|
6260
|
+
// Required for some features
|
|
6261
|
+
// Merge Tags Config
|
|
6262
|
+
mergeTagsConfig: {
|
|
6263
|
+
autocompleteTriggerChar: "@",
|
|
6264
|
+
sort: false,
|
|
6265
|
+
delimiter: ["{{", "}}"]
|
|
6266
|
+
},
|
|
6267
|
+
// Appearance
|
|
6268
|
+
appearance: {
|
|
6269
|
+
theme: "modern_light",
|
|
6270
|
+
panels: {
|
|
6271
|
+
tools: { dock: "left" }
|
|
6303
6272
|
}
|
|
6304
|
-
|
|
6305
|
-
|
|
6306
|
-
|
|
6307
|
-
|
|
6308
|
-
|
|
6309
|
-
|
|
6310
|
-
|
|
6311
|
-
|
|
6312
|
-
|
|
6313
|
-
|
|
6314
|
-
}
|
|
6273
|
+
},
|
|
6274
|
+
// Features - Enable responsive preview
|
|
6275
|
+
features: {
|
|
6276
|
+
preview: true,
|
|
6277
|
+
previewInBrowser: true,
|
|
6278
|
+
textEditor: {
|
|
6279
|
+
enabled: true,
|
|
6280
|
+
spellChecker: true,
|
|
6281
|
+
tables: true,
|
|
6282
|
+
cleanPaste: true
|
|
6315
6283
|
}
|
|
6316
|
-
}
|
|
6317
|
-
|
|
6318
|
-
|
|
6319
|
-
|
|
6320
|
-
|
|
6321
|
-
|
|
6322
|
-
|
|
6323
|
-
|
|
6324
|
-
|
|
6325
|
-
value: "{{user.firstName}}",
|
|
6326
|
-
sample: "John"
|
|
6327
|
-
},
|
|
6328
|
-
lastName: {
|
|
6329
|
-
name: "Last Name",
|
|
6330
|
-
value: "{{user.lastName}}",
|
|
6331
|
-
sample: "Doe"
|
|
6332
|
-
},
|
|
6333
|
-
email: {
|
|
6334
|
-
name: "Email",
|
|
6335
|
-
value: "{{user.email}}",
|
|
6336
|
-
sample: "john@example.com"
|
|
6337
|
-
},
|
|
6338
|
-
username: {
|
|
6339
|
-
name: "Username",
|
|
6340
|
-
value: "{{user.username}}",
|
|
6341
|
-
sample: "johndoe"
|
|
6284
|
+
},
|
|
6285
|
+
// Fonts
|
|
6286
|
+
fonts: {
|
|
6287
|
+
showDefaultFonts: true,
|
|
6288
|
+
customFonts: [
|
|
6289
|
+
{
|
|
6290
|
+
label: "Inter",
|
|
6291
|
+
value: "'Inter', sans-serif",
|
|
6292
|
+
url: "https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap"
|
|
6342
6293
|
}
|
|
6343
|
-
|
|
6294
|
+
]
|
|
6344
6295
|
},
|
|
6345
|
-
|
|
6346
|
-
|
|
6347
|
-
|
|
6348
|
-
|
|
6349
|
-
|
|
6350
|
-
|
|
6351
|
-
|
|
6352
|
-
|
|
6353
|
-
|
|
6354
|
-
name: "Website",
|
|
6355
|
-
value: "{{company.url}}",
|
|
6356
|
-
sample: "https://acme.com"
|
|
6357
|
-
},
|
|
6358
|
-
address: {
|
|
6359
|
-
name: "Address",
|
|
6360
|
-
value: "{{company.address}}",
|
|
6361
|
-
sample: "123 Main St, City"
|
|
6296
|
+
// Tools configuration - minimal, let Unlayer show all
|
|
6297
|
+
tools: {
|
|
6298
|
+
image: {
|
|
6299
|
+
properties: {
|
|
6300
|
+
src: {
|
|
6301
|
+
value: {
|
|
6302
|
+
url: "https://picsum.photos/600/350"
|
|
6303
|
+
}
|
|
6304
|
+
}
|
|
6362
6305
|
}
|
|
6363
6306
|
}
|
|
6364
6307
|
},
|
|
6365
|
-
|
|
6366
|
-
|
|
6367
|
-
|
|
6368
|
-
|
|
6369
|
-
|
|
6370
|
-
|
|
6371
|
-
|
|
6372
|
-
|
|
6373
|
-
|
|
6374
|
-
|
|
6375
|
-
|
|
6376
|
-
|
|
6377
|
-
|
|
6378
|
-
|
|
6379
|
-
|
|
6380
|
-
|
|
6381
|
-
|
|
6382
|
-
|
|
6383
|
-
|
|
6384
|
-
|
|
6385
|
-
|
|
6386
|
-
|
|
6308
|
+
// Merge Tags with extended support
|
|
6309
|
+
mergeTags: {
|
|
6310
|
+
user: {
|
|
6311
|
+
name: "User",
|
|
6312
|
+
mergeTags: {
|
|
6313
|
+
firstName: {
|
|
6314
|
+
name: "First Name",
|
|
6315
|
+
value: "{{user.firstName}}",
|
|
6316
|
+
sample: "John"
|
|
6317
|
+
},
|
|
6318
|
+
lastName: {
|
|
6319
|
+
name: "Last Name",
|
|
6320
|
+
value: "{{user.lastName}}",
|
|
6321
|
+
sample: "Doe"
|
|
6322
|
+
},
|
|
6323
|
+
email: {
|
|
6324
|
+
name: "Email",
|
|
6325
|
+
value: "{{user.email}}",
|
|
6326
|
+
sample: "john@example.com"
|
|
6327
|
+
},
|
|
6328
|
+
username: {
|
|
6329
|
+
name: "Username",
|
|
6330
|
+
value: "{{user.username}}",
|
|
6331
|
+
sample: "johndoe"
|
|
6332
|
+
}
|
|
6333
|
+
}
|
|
6334
|
+
},
|
|
6335
|
+
company: {
|
|
6336
|
+
name: "Company",
|
|
6337
|
+
mergeTags: {
|
|
6338
|
+
name: {
|
|
6339
|
+
name: "Name",
|
|
6340
|
+
value: "{{company.name}}",
|
|
6341
|
+
sample: "ACME Corp"
|
|
6342
|
+
},
|
|
6343
|
+
url: {
|
|
6344
|
+
name: "Website",
|
|
6345
|
+
value: "{{company.url}}",
|
|
6346
|
+
sample: "https://acme.com"
|
|
6347
|
+
},
|
|
6348
|
+
address: {
|
|
6349
|
+
name: "Address",
|
|
6350
|
+
value: "{{company.address}}",
|
|
6351
|
+
sample: "123 Main St, City"
|
|
6352
|
+
}
|
|
6353
|
+
}
|
|
6354
|
+
},
|
|
6355
|
+
order: {
|
|
6356
|
+
name: "Order",
|
|
6357
|
+
mergeTags: {
|
|
6358
|
+
number: {
|
|
6359
|
+
name: "Number",
|
|
6360
|
+
value: "{{order.number}}",
|
|
6361
|
+
sample: "#12345"
|
|
6362
|
+
},
|
|
6363
|
+
total: {
|
|
6364
|
+
name: "Total",
|
|
6365
|
+
value: "{{order.total}}",
|
|
6366
|
+
sample: "$199.99"
|
|
6367
|
+
},
|
|
6368
|
+
date: {
|
|
6369
|
+
name: "Date",
|
|
6370
|
+
value: "{{order.date}}",
|
|
6371
|
+
sample: "2024-01-15"
|
|
6372
|
+
},
|
|
6373
|
+
status: {
|
|
6374
|
+
name: "Status",
|
|
6375
|
+
value: "{{order.status}}",
|
|
6376
|
+
sample: "Shipped"
|
|
6377
|
+
}
|
|
6378
|
+
}
|
|
6379
|
+
},
|
|
6380
|
+
system: {
|
|
6381
|
+
name: "System",
|
|
6382
|
+
mergeTags: {
|
|
6383
|
+
date: {
|
|
6384
|
+
name: "Current Date",
|
|
6385
|
+
value: "{{system.date}}",
|
|
6386
|
+
sample: (/* @__PURE__ */ new Date()).toLocaleDateString()
|
|
6387
|
+
},
|
|
6388
|
+
year: {
|
|
6389
|
+
name: "Current Year",
|
|
6390
|
+
value: "{{system.year}}",
|
|
6391
|
+
sample: (/* @__PURE__ */ new Date()).getFullYear().toString()
|
|
6392
|
+
},
|
|
6393
|
+
unsubscribe: {
|
|
6394
|
+
name: "Unsubscribe Link",
|
|
6395
|
+
value: "{{system.unsubscribe}}",
|
|
6396
|
+
sample: "https://example.com/unsubscribe"
|
|
6397
|
+
}
|
|
6387
6398
|
}
|
|
6388
6399
|
}
|
|
6389
6400
|
},
|
|
6390
|
-
|
|
6391
|
-
|
|
6392
|
-
|
|
6393
|
-
|
|
6394
|
-
|
|
6395
|
-
|
|
6396
|
-
|
|
6397
|
-
|
|
6398
|
-
|
|
6399
|
-
|
|
6400
|
-
|
|
6401
|
-
sample: (/* @__PURE__ */ new Date()).getFullYear().toString()
|
|
6402
|
-
},
|
|
6403
|
-
unsubscribe: {
|
|
6404
|
-
name: "Unsubscribe Link",
|
|
6405
|
-
value: "{{system.unsubscribe}}",
|
|
6406
|
-
sample: "https://example.com/unsubscribe"
|
|
6407
|
-
}
|
|
6401
|
+
// Special links
|
|
6402
|
+
specialLinks: {
|
|
6403
|
+
unsubscribe: {
|
|
6404
|
+
enabled: true,
|
|
6405
|
+
text: "Unsubscribe",
|
|
6406
|
+
href: "{{system.unsubscribe}}"
|
|
6407
|
+
},
|
|
6408
|
+
webview: {
|
|
6409
|
+
enabled: true,
|
|
6410
|
+
text: "View in browser",
|
|
6411
|
+
href: "{{system.webview}}"
|
|
6408
6412
|
}
|
|
6409
|
-
}
|
|
6410
|
-
},
|
|
6411
|
-
// Special links
|
|
6412
|
-
specialLinks: {
|
|
6413
|
-
unsubscribe: {
|
|
6414
|
-
enabled: true,
|
|
6415
|
-
text: "Unsubscribe",
|
|
6416
|
-
href: "{{system.unsubscribe}}"
|
|
6417
6413
|
},
|
|
6418
|
-
|
|
6414
|
+
// Custom CSS
|
|
6415
|
+
customCSS: [
|
|
6416
|
+
".blockbuilder-content-email { font-family: Inter, -apple-system, BlinkMacSystemFont, sans-serif; }"
|
|
6417
|
+
],
|
|
6418
|
+
// Validation
|
|
6419
|
+
validator: {
|
|
6419
6420
|
enabled: true,
|
|
6420
|
-
|
|
6421
|
-
|
|
6422
|
-
|
|
6423
|
-
|
|
6424
|
-
// Custom CSS
|
|
6425
|
-
customCSS: [
|
|
6426
|
-
".blockbuilder-content-email { font-family: Inter, -apple-system, BlinkMacSystemFont, sans-serif; }"
|
|
6427
|
-
],
|
|
6428
|
-
// Validation
|
|
6429
|
-
validator: {
|
|
6430
|
-
enabled: true,
|
|
6431
|
-
rules: {
|
|
6432
|
-
maxImageSize: 1024 * 1024
|
|
6433
|
-
// 1MB
|
|
6421
|
+
rules: {
|
|
6422
|
+
maxImageSize: 1024 * 1024
|
|
6423
|
+
// 1MB
|
|
6424
|
+
}
|
|
6434
6425
|
}
|
|
6435
6426
|
}
|
|
6436
6427
|
}
|
|
6437
|
-
|
|
6438
|
-
|
|
6439
|
-
|
|
6440
|
-
|
|
6428
|
+
)
|
|
6429
|
+
}
|
|
6430
|
+
)
|
|
6431
|
+
] }) }),
|
|
6441
6432
|
/* @__PURE__ */ jsxRuntime.jsx(StyledTabsContent, { value: "text", children: /* @__PURE__ */ jsxRuntime.jsx(TextTabContent, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
6442
6433
|
designSystem.Textarea,
|
|
6443
6434
|
{
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
2
|
-
import React, { useRef, useEffect, useState
|
|
2
|
+
import React, { useRef, useEffect, useState } from "react";
|
|
3
3
|
import { useNavigate, useLocation } from "react-router-dom";
|
|
4
4
|
import { Modal, Typography, Flex, Box, Field, TextInput, Alert, Textarea, NumberInput, Divider, Toggle, Badge, Button, Loader, SingleSelect, SingleSelectOption, Thead, Tr, Th, Tbody, Td, Table, Tabs } from "@strapi/design-system";
|
|
5
5
|
import { EnvelopeIcon, ServerIcon, SparklesIcon, PlusIcon, PencilIcon, PlayIcon, TrashIcon, MagnifyingGlassIcon, FunnelIcon, CheckIcon, Cog6ToothIcon, DocumentTextIcon, ChartBarIcon, BoltIcon, CheckCircleIcon, ArrowUpTrayIcon, ArrowDownTrayIcon, DocumentArrowDownIcon, CodeBracketIcon, DocumentDuplicateIcon, PaperAirplaneIcon, ClipboardDocumentIcon, ArrowLeftIcon, ClockIcon, XMarkIcon, ArrowUturnLeftIcon, EnvelopeOpenIcon, CursorArrowRaysIcon, ExclamationTriangleIcon, XCircleIcon, KeyIcon } from "@heroicons/react/24/outline";
|
|
6
6
|
import { useFetchClient, useNotification } from "@strapi/strapi/admin";
|
|
7
7
|
import styled, { css, keyframes } from "styled-components";
|
|
8
8
|
import { Star, Mail, Server, Lock, Cog, Check, Cloud, Key, ArrowLeft, ArrowRight } from "@strapi/icons";
|
|
9
|
+
import EmailEditor from "react-email-editor";
|
|
9
10
|
const useAuthRefresh = () => {
|
|
10
11
|
const { get } = useFetchClient();
|
|
11
12
|
const intervalRef = useRef(null);
|
|
@@ -5395,11 +5396,6 @@ const STANDARD_EMAIL_TEMPLATE = {
|
|
|
5395
5396
|
},
|
|
5396
5397
|
schemaVersion: 6
|
|
5397
5398
|
};
|
|
5398
|
-
const EmailEditor = lazy(
|
|
5399
|
-
() => import("react-email-editor").then((module) => ({
|
|
5400
|
-
default: module.default || module.EmailEditor || module
|
|
5401
|
-
}))
|
|
5402
|
-
);
|
|
5403
5399
|
const Container$1 = styled.div`
|
|
5404
5400
|
min-height: 100vh;
|
|
5405
5401
|
display: flex;
|
|
@@ -5514,6 +5510,14 @@ const LoadingContainer = styled.div`
|
|
|
5514
5510
|
justify-content: center;
|
|
5515
5511
|
align-items: center;
|
|
5516
5512
|
`;
|
|
5513
|
+
const EditorCanvas = styled.div`
|
|
5514
|
+
min-height: calc(100vh - 240px);
|
|
5515
|
+
`;
|
|
5516
|
+
const DesignerLoadingContainer = styled(LoadingContainer)`
|
|
5517
|
+
width: 100%;
|
|
5518
|
+
min-height: calc(100vh - 240px);
|
|
5519
|
+
padding: 40px 20px;
|
|
5520
|
+
`;
|
|
5517
5521
|
const HiddenInput = styled.input`
|
|
5518
5522
|
display: none;
|
|
5519
5523
|
`;
|
|
@@ -5827,6 +5831,7 @@ const EditorPage = () => {
|
|
|
5827
5831
|
const [loading, setLoading] = useState(!isNewTemplate && !isCoreEmail);
|
|
5828
5832
|
const [saving, setSaving] = useState(false);
|
|
5829
5833
|
const [activeTab, setActiveTab] = useState("html");
|
|
5834
|
+
const [editorLoaded, setEditorLoaded] = useState(false);
|
|
5830
5835
|
const [templateData, setTemplateData] = useState({
|
|
5831
5836
|
templateReferenceId: "",
|
|
5832
5837
|
name: "",
|
|
@@ -6109,6 +6114,7 @@ const EditorPage = () => {
|
|
|
6109
6114
|
reader.readAsText(file);
|
|
6110
6115
|
};
|
|
6111
6116
|
const onEditorReady = () => {
|
|
6117
|
+
setEditorLoaded(true);
|
|
6112
6118
|
if (templateData.design && emailEditorRef.current?.editor) {
|
|
6113
6119
|
setTimeout(() => {
|
|
6114
6120
|
emailEditorRef.current.editor.loadDesign(templateData.design);
|
|
@@ -6225,192 +6231,198 @@ const EditorPage = () => {
|
|
|
6225
6231
|
/* @__PURE__ */ jsx(Tabs.Trigger, { value: "html", children: "✨ Visual Designer" }),
|
|
6226
6232
|
/* @__PURE__ */ jsx(Tabs.Trigger, { value: "text", children: "📝 Plain Text" })
|
|
6227
6233
|
] }) }),
|
|
6228
|
-
/* @__PURE__ */ jsx(StyledTabsContent, { value: "html", children: /* @__PURE__ */
|
|
6229
|
-
|
|
6230
|
-
|
|
6231
|
-
|
|
6232
|
-
|
|
6233
|
-
|
|
6234
|
-
|
|
6235
|
-
|
|
6236
|
-
|
|
6237
|
-
|
|
6238
|
-
|
|
6239
|
-
|
|
6240
|
-
|
|
6241
|
-
|
|
6242
|
-
|
|
6243
|
-
|
|
6244
|
-
|
|
6245
|
-
|
|
6246
|
-
|
|
6247
|
-
|
|
6248
|
-
|
|
6249
|
-
|
|
6250
|
-
|
|
6251
|
-
|
|
6252
|
-
|
|
6253
|
-
|
|
6254
|
-
|
|
6255
|
-
|
|
6256
|
-
|
|
6257
|
-
|
|
6258
|
-
|
|
6259
|
-
|
|
6260
|
-
previewInBrowser: true,
|
|
6261
|
-
textEditor: {
|
|
6262
|
-
enabled: true,
|
|
6263
|
-
spellChecker: true,
|
|
6264
|
-
tables: true,
|
|
6265
|
-
cleanPaste: true
|
|
6266
|
-
}
|
|
6267
|
-
},
|
|
6268
|
-
// Fonts
|
|
6269
|
-
fonts: {
|
|
6270
|
-
showDefaultFonts: true,
|
|
6271
|
-
customFonts: [
|
|
6272
|
-
{
|
|
6273
|
-
label: "Inter",
|
|
6274
|
-
value: "'Inter', sans-serif",
|
|
6275
|
-
url: "https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap"
|
|
6234
|
+
/* @__PURE__ */ jsx(StyledTabsContent, { value: "html", children: /* @__PURE__ */ jsxs(TabContentWrapper, { children: [
|
|
6235
|
+
!editorLoaded && /* @__PURE__ */ jsx(DesignerLoadingContainer, { children: /* @__PURE__ */ jsx(Loader, { children: "Loading Email Designer..." }) }),
|
|
6236
|
+
/* @__PURE__ */ jsx(
|
|
6237
|
+
EditorCanvas,
|
|
6238
|
+
{
|
|
6239
|
+
style: {
|
|
6240
|
+
visibility: editorLoaded ? "visible" : "hidden",
|
|
6241
|
+
pointerEvents: editorLoaded ? "auto" : "none"
|
|
6242
|
+
},
|
|
6243
|
+
children: /* @__PURE__ */ jsx(
|
|
6244
|
+
EmailEditor,
|
|
6245
|
+
{
|
|
6246
|
+
ref: emailEditorRef,
|
|
6247
|
+
onReady: onEditorReady,
|
|
6248
|
+
minHeight: "calc(100vh - 240px)",
|
|
6249
|
+
options: {
|
|
6250
|
+
// Display mode
|
|
6251
|
+
displayMode: "email",
|
|
6252
|
+
locale: "en",
|
|
6253
|
+
projectId: 1,
|
|
6254
|
+
// Required for some features
|
|
6255
|
+
// Merge Tags Config
|
|
6256
|
+
mergeTagsConfig: {
|
|
6257
|
+
autocompleteTriggerChar: "@",
|
|
6258
|
+
sort: false,
|
|
6259
|
+
delimiter: ["{{", "}}"]
|
|
6260
|
+
},
|
|
6261
|
+
// Appearance
|
|
6262
|
+
appearance: {
|
|
6263
|
+
theme: "modern_light",
|
|
6264
|
+
panels: {
|
|
6265
|
+
tools: { dock: "left" }
|
|
6276
6266
|
}
|
|
6277
|
-
|
|
6278
|
-
|
|
6279
|
-
|
|
6280
|
-
|
|
6281
|
-
|
|
6282
|
-
|
|
6283
|
-
|
|
6284
|
-
|
|
6285
|
-
|
|
6286
|
-
|
|
6287
|
-
}
|
|
6267
|
+
},
|
|
6268
|
+
// Features - Enable responsive preview
|
|
6269
|
+
features: {
|
|
6270
|
+
preview: true,
|
|
6271
|
+
previewInBrowser: true,
|
|
6272
|
+
textEditor: {
|
|
6273
|
+
enabled: true,
|
|
6274
|
+
spellChecker: true,
|
|
6275
|
+
tables: true,
|
|
6276
|
+
cleanPaste: true
|
|
6288
6277
|
}
|
|
6289
|
-
}
|
|
6290
|
-
|
|
6291
|
-
|
|
6292
|
-
|
|
6293
|
-
|
|
6294
|
-
|
|
6295
|
-
|
|
6296
|
-
|
|
6297
|
-
|
|
6298
|
-
value: "{{user.firstName}}",
|
|
6299
|
-
sample: "John"
|
|
6300
|
-
},
|
|
6301
|
-
lastName: {
|
|
6302
|
-
name: "Last Name",
|
|
6303
|
-
value: "{{user.lastName}}",
|
|
6304
|
-
sample: "Doe"
|
|
6305
|
-
},
|
|
6306
|
-
email: {
|
|
6307
|
-
name: "Email",
|
|
6308
|
-
value: "{{user.email}}",
|
|
6309
|
-
sample: "john@example.com"
|
|
6310
|
-
},
|
|
6311
|
-
username: {
|
|
6312
|
-
name: "Username",
|
|
6313
|
-
value: "{{user.username}}",
|
|
6314
|
-
sample: "johndoe"
|
|
6278
|
+
},
|
|
6279
|
+
// Fonts
|
|
6280
|
+
fonts: {
|
|
6281
|
+
showDefaultFonts: true,
|
|
6282
|
+
customFonts: [
|
|
6283
|
+
{
|
|
6284
|
+
label: "Inter",
|
|
6285
|
+
value: "'Inter', sans-serif",
|
|
6286
|
+
url: "https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap"
|
|
6315
6287
|
}
|
|
6316
|
-
|
|
6288
|
+
]
|
|
6317
6289
|
},
|
|
6318
|
-
|
|
6319
|
-
|
|
6320
|
-
|
|
6321
|
-
|
|
6322
|
-
|
|
6323
|
-
|
|
6324
|
-
|
|
6325
|
-
|
|
6326
|
-
|
|
6327
|
-
name: "Website",
|
|
6328
|
-
value: "{{company.url}}",
|
|
6329
|
-
sample: "https://acme.com"
|
|
6330
|
-
},
|
|
6331
|
-
address: {
|
|
6332
|
-
name: "Address",
|
|
6333
|
-
value: "{{company.address}}",
|
|
6334
|
-
sample: "123 Main St, City"
|
|
6290
|
+
// Tools configuration - minimal, let Unlayer show all
|
|
6291
|
+
tools: {
|
|
6292
|
+
image: {
|
|
6293
|
+
properties: {
|
|
6294
|
+
src: {
|
|
6295
|
+
value: {
|
|
6296
|
+
url: "https://picsum.photos/600/350"
|
|
6297
|
+
}
|
|
6298
|
+
}
|
|
6335
6299
|
}
|
|
6336
6300
|
}
|
|
6337
6301
|
},
|
|
6338
|
-
|
|
6339
|
-
|
|
6340
|
-
|
|
6341
|
-
|
|
6342
|
-
|
|
6343
|
-
|
|
6344
|
-
|
|
6345
|
-
|
|
6346
|
-
|
|
6347
|
-
|
|
6348
|
-
|
|
6349
|
-
|
|
6350
|
-
|
|
6351
|
-
|
|
6352
|
-
|
|
6353
|
-
|
|
6354
|
-
|
|
6355
|
-
|
|
6356
|
-
|
|
6357
|
-
|
|
6358
|
-
|
|
6359
|
-
|
|
6302
|
+
// Merge Tags with extended support
|
|
6303
|
+
mergeTags: {
|
|
6304
|
+
user: {
|
|
6305
|
+
name: "User",
|
|
6306
|
+
mergeTags: {
|
|
6307
|
+
firstName: {
|
|
6308
|
+
name: "First Name",
|
|
6309
|
+
value: "{{user.firstName}}",
|
|
6310
|
+
sample: "John"
|
|
6311
|
+
},
|
|
6312
|
+
lastName: {
|
|
6313
|
+
name: "Last Name",
|
|
6314
|
+
value: "{{user.lastName}}",
|
|
6315
|
+
sample: "Doe"
|
|
6316
|
+
},
|
|
6317
|
+
email: {
|
|
6318
|
+
name: "Email",
|
|
6319
|
+
value: "{{user.email}}",
|
|
6320
|
+
sample: "john@example.com"
|
|
6321
|
+
},
|
|
6322
|
+
username: {
|
|
6323
|
+
name: "Username",
|
|
6324
|
+
value: "{{user.username}}",
|
|
6325
|
+
sample: "johndoe"
|
|
6326
|
+
}
|
|
6327
|
+
}
|
|
6328
|
+
},
|
|
6329
|
+
company: {
|
|
6330
|
+
name: "Company",
|
|
6331
|
+
mergeTags: {
|
|
6332
|
+
name: {
|
|
6333
|
+
name: "Name",
|
|
6334
|
+
value: "{{company.name}}",
|
|
6335
|
+
sample: "ACME Corp"
|
|
6336
|
+
},
|
|
6337
|
+
url: {
|
|
6338
|
+
name: "Website",
|
|
6339
|
+
value: "{{company.url}}",
|
|
6340
|
+
sample: "https://acme.com"
|
|
6341
|
+
},
|
|
6342
|
+
address: {
|
|
6343
|
+
name: "Address",
|
|
6344
|
+
value: "{{company.address}}",
|
|
6345
|
+
sample: "123 Main St, City"
|
|
6346
|
+
}
|
|
6347
|
+
}
|
|
6348
|
+
},
|
|
6349
|
+
order: {
|
|
6350
|
+
name: "Order",
|
|
6351
|
+
mergeTags: {
|
|
6352
|
+
number: {
|
|
6353
|
+
name: "Number",
|
|
6354
|
+
value: "{{order.number}}",
|
|
6355
|
+
sample: "#12345"
|
|
6356
|
+
},
|
|
6357
|
+
total: {
|
|
6358
|
+
name: "Total",
|
|
6359
|
+
value: "{{order.total}}",
|
|
6360
|
+
sample: "$199.99"
|
|
6361
|
+
},
|
|
6362
|
+
date: {
|
|
6363
|
+
name: "Date",
|
|
6364
|
+
value: "{{order.date}}",
|
|
6365
|
+
sample: "2024-01-15"
|
|
6366
|
+
},
|
|
6367
|
+
status: {
|
|
6368
|
+
name: "Status",
|
|
6369
|
+
value: "{{order.status}}",
|
|
6370
|
+
sample: "Shipped"
|
|
6371
|
+
}
|
|
6372
|
+
}
|
|
6373
|
+
},
|
|
6374
|
+
system: {
|
|
6375
|
+
name: "System",
|
|
6376
|
+
mergeTags: {
|
|
6377
|
+
date: {
|
|
6378
|
+
name: "Current Date",
|
|
6379
|
+
value: "{{system.date}}",
|
|
6380
|
+
sample: (/* @__PURE__ */ new Date()).toLocaleDateString()
|
|
6381
|
+
},
|
|
6382
|
+
year: {
|
|
6383
|
+
name: "Current Year",
|
|
6384
|
+
value: "{{system.year}}",
|
|
6385
|
+
sample: (/* @__PURE__ */ new Date()).getFullYear().toString()
|
|
6386
|
+
},
|
|
6387
|
+
unsubscribe: {
|
|
6388
|
+
name: "Unsubscribe Link",
|
|
6389
|
+
value: "{{system.unsubscribe}}",
|
|
6390
|
+
sample: "https://example.com/unsubscribe"
|
|
6391
|
+
}
|
|
6360
6392
|
}
|
|
6361
6393
|
}
|
|
6362
6394
|
},
|
|
6363
|
-
|
|
6364
|
-
|
|
6365
|
-
|
|
6366
|
-
|
|
6367
|
-
|
|
6368
|
-
|
|
6369
|
-
|
|
6370
|
-
|
|
6371
|
-
|
|
6372
|
-
|
|
6373
|
-
|
|
6374
|
-
sample: (/* @__PURE__ */ new Date()).getFullYear().toString()
|
|
6375
|
-
},
|
|
6376
|
-
unsubscribe: {
|
|
6377
|
-
name: "Unsubscribe Link",
|
|
6378
|
-
value: "{{system.unsubscribe}}",
|
|
6379
|
-
sample: "https://example.com/unsubscribe"
|
|
6380
|
-
}
|
|
6395
|
+
// Special links
|
|
6396
|
+
specialLinks: {
|
|
6397
|
+
unsubscribe: {
|
|
6398
|
+
enabled: true,
|
|
6399
|
+
text: "Unsubscribe",
|
|
6400
|
+
href: "{{system.unsubscribe}}"
|
|
6401
|
+
},
|
|
6402
|
+
webview: {
|
|
6403
|
+
enabled: true,
|
|
6404
|
+
text: "View in browser",
|
|
6405
|
+
href: "{{system.webview}}"
|
|
6381
6406
|
}
|
|
6382
|
-
}
|
|
6383
|
-
},
|
|
6384
|
-
// Special links
|
|
6385
|
-
specialLinks: {
|
|
6386
|
-
unsubscribe: {
|
|
6387
|
-
enabled: true,
|
|
6388
|
-
text: "Unsubscribe",
|
|
6389
|
-
href: "{{system.unsubscribe}}"
|
|
6390
6407
|
},
|
|
6391
|
-
|
|
6408
|
+
// Custom CSS
|
|
6409
|
+
customCSS: [
|
|
6410
|
+
".blockbuilder-content-email { font-family: Inter, -apple-system, BlinkMacSystemFont, sans-serif; }"
|
|
6411
|
+
],
|
|
6412
|
+
// Validation
|
|
6413
|
+
validator: {
|
|
6392
6414
|
enabled: true,
|
|
6393
|
-
|
|
6394
|
-
|
|
6395
|
-
|
|
6396
|
-
|
|
6397
|
-
// Custom CSS
|
|
6398
|
-
customCSS: [
|
|
6399
|
-
".blockbuilder-content-email { font-family: Inter, -apple-system, BlinkMacSystemFont, sans-serif; }"
|
|
6400
|
-
],
|
|
6401
|
-
// Validation
|
|
6402
|
-
validator: {
|
|
6403
|
-
enabled: true,
|
|
6404
|
-
rules: {
|
|
6405
|
-
maxImageSize: 1024 * 1024
|
|
6406
|
-
// 1MB
|
|
6415
|
+
rules: {
|
|
6416
|
+
maxImageSize: 1024 * 1024
|
|
6417
|
+
// 1MB
|
|
6418
|
+
}
|
|
6407
6419
|
}
|
|
6408
6420
|
}
|
|
6409
6421
|
}
|
|
6410
|
-
|
|
6411
|
-
|
|
6412
|
-
|
|
6413
|
-
|
|
6422
|
+
)
|
|
6423
|
+
}
|
|
6424
|
+
)
|
|
6425
|
+
] }) }),
|
|
6414
6426
|
/* @__PURE__ */ jsx(StyledTabsContent, { value: "text", children: /* @__PURE__ */ jsx(TextTabContent, { children: /* @__PURE__ */ jsx(
|
|
6415
6427
|
Textarea,
|
|
6416
6428
|
{
|
package/dist/admin/index.js
CHANGED
|
@@ -25,7 +25,7 @@ const index = {
|
|
|
25
25
|
id: `${pluginId}.plugin.name`,
|
|
26
26
|
defaultMessage: "MagicMail"
|
|
27
27
|
},
|
|
28
|
-
Component: () => Promise.resolve().then(() => require("../_chunks/App-
|
|
28
|
+
Component: () => Promise.resolve().then(() => require("../_chunks/App-CClpsmQH.js"))
|
|
29
29
|
});
|
|
30
30
|
app.createSettingSection(
|
|
31
31
|
{
|
package/dist/admin/index.mjs
CHANGED
package/dist/server/index.js
CHANGED
package/dist/server/index.mjs
CHANGED
package/package.json
CHANGED