@nextsparkjs/core 0.1.0-beta.149 → 0.1.0-beta.150
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/components/dashboard/block-editor/block-picker.d.ts +6 -1
- package/dist/components/dashboard/block-editor/block-picker.d.ts.map +1 -1
- package/dist/components/dashboard/block-editor/block-picker.js +34 -12
- package/dist/components/dashboard/block-editor/block-preview-canvas.d.ts +2 -1
- package/dist/components/dashboard/block-editor/block-preview-canvas.d.ts.map +1 -1
- package/dist/components/dashboard/block-editor/block-preview-canvas.js +5 -0
- package/dist/components/dashboard/block-editor/builder-editor-view.d.ts.map +1 -1
- package/dist/components/dashboard/block-editor/builder-editor-view.js +41 -13
- package/dist/components/dashboard/block-editor/floating-block-toolbar.d.ts +2 -1
- package/dist/components/dashboard/block-editor/floating-block-toolbar.d.ts.map +1 -1
- package/dist/components/dashboard/block-editor/floating-block-toolbar.js +17 -1
- package/dist/components/dashboard/block-editor/tree-view-node.d.ts +4 -1
- package/dist/components/dashboard/block-editor/tree-view-node.d.ts.map +1 -1
- package/dist/components/dashboard/block-editor/tree-view-node.js +52 -1
- package/dist/components/dashboard/block-editor/tree-view.d.ts +4 -1
- package/dist/components/dashboard/block-editor/tree-view.d.ts.map +1 -1
- package/dist/components/dashboard/block-editor/tree-view.js +6 -0
- package/dist/components/entities/EntityTable.d.ts +1 -1
- package/dist/components/entities/EntityTable.d.ts.map +1 -1
- package/dist/components/entities/EntityTable.js +14 -1
- package/dist/components/entities/entity-table.types.d.ts +2 -0
- package/dist/components/entities/entity-table.types.d.ts.map +1 -1
- package/dist/components/entities/wrappers/EntityListWrapper.d.ts.map +1 -1
- package/dist/components/entities/wrappers/EntityListWrapper.js +19 -1
- package/dist/emails/otp-verification.d.ts +9 -0
- package/dist/emails/otp-verification.d.ts.map +1 -0
- package/dist/emails/otp-verification.js +72 -0
- package/dist/emails/reset-password.d.ts +9 -0
- package/dist/emails/reset-password.d.ts.map +1 -0
- package/dist/emails/reset-password.js +95 -0
- package/dist/emails/team-invitation.d.ts +9 -0
- package/dist/emails/team-invitation.d.ts.map +1 -0
- package/dist/emails/team-invitation.js +93 -0
- package/dist/emails/verify-email.d.ts +13 -0
- package/dist/emails/verify-email.d.ts.map +1 -0
- package/dist/emails/verify-email.js +84 -0
- package/dist/lib/api/entities.d.ts +6 -1
- package/dist/lib/api/entities.d.ts.map +1 -1
- package/dist/lib/api/entities.js +23 -2
- package/dist/lib/auth.d.ts.map +1 -1
- package/dist/lib/auth.js +12 -7
- package/dist/lib/blocks/clipboard.d.ts +11 -0
- package/dist/lib/blocks/clipboard.d.ts.map +1 -0
- package/dist/lib/blocks/clipboard.js +30 -0
- package/dist/lib/email/index.d.ts +1 -0
- package/dist/lib/email/index.d.ts.map +1 -1
- package/dist/lib/email/index.js +12 -0
- package/dist/lib/email/send.d.ts +15 -0
- package/dist/lib/email/send.d.ts.map +1 -0
- package/dist/lib/email/send.js +11 -0
- package/dist/lib/email/templates.d.ts +42 -29
- package/dist/lib/email/templates.d.ts.map +1 -1
- package/dist/lib/email/templates.js +8 -303
- package/dist/lib/email/types.d.ts +32 -0
- package/dist/lib/email/types.d.ts.map +1 -1
- package/dist/lib/services/subscription.service.d.ts +2 -2
- package/dist/lib/services/subscription.service.d.ts.map +1 -1
- package/dist/lib/services/subscription.service.js +6 -6
- package/dist/messages/de/email.json +58 -0
- package/dist/messages/en/admin.json +6 -2
- package/dist/messages/en/email.json +58 -0
- package/dist/messages/en/index.d.ts +4 -0
- package/dist/messages/en/index.d.ts.map +1 -1
- package/dist/messages/es/admin.json +6 -2
- package/dist/messages/es/email.json +58 -0
- package/dist/messages/es/index.d.ts +4 -0
- package/dist/messages/es/index.d.ts.map +1 -1
- package/dist/messages/fr/email.json +58 -0
- package/dist/messages/it/email.json +58 -0
- package/dist/messages/pt/email.json +58 -0
- package/dist/styles/classes.json +3 -2
- package/dist/templates/app/api/v1/teams/[teamId]/members/route.ts +9 -7
- package/dist/templates/contents/themes/starter/emails/_README.md +69 -0
- package/dist/templates/contents/themes/starter/emails/verify-email.ts +34 -0
- package/package.json +6 -2
- package/scripts/build/registry/discovery/emails.mjs +146 -0
- package/scripts/build/registry/generators/email-registry.mjs +94 -0
- package/scripts/build/registry.mjs +8 -4
- package/templates/app/api/v1/teams/[teamId]/members/route.ts +9 -7
- package/templates/contents/themes/starter/emails/_README.md +69 -0
- package/templates/contents/themes/starter/emails/verify-email.ts +34 -0
- package/tests/jest/__mocks__/@nextsparkjs/registries/email-registry.ts +41 -0
- package/tests/jest/__mocks__/next-intl-server.js +55 -0
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { getTranslations } from "next-intl/server";
|
|
2
|
+
const APP_NAME_FALLBACK = process.env.NEXT_PUBLIC_APP_NAME || "Your App";
|
|
3
|
+
const OTP_EXPIRES_MINUTES = 5;
|
|
4
|
+
async function otpVerification(data, locale) {
|
|
5
|
+
const t = await getTranslations({ locale, namespace: "email.otpVerification" });
|
|
6
|
+
const appName = data.appName || APP_NAME_FALLBACK;
|
|
7
|
+
const year = (/* @__PURE__ */ new Date()).getFullYear();
|
|
8
|
+
return {
|
|
9
|
+
subject: t("subject", { otp: data.otp, appName }),
|
|
10
|
+
html: `
|
|
11
|
+
<!DOCTYPE html>
|
|
12
|
+
<html>
|
|
13
|
+
<head>
|
|
14
|
+
<meta charset="utf-8">
|
|
15
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
16
|
+
</head>
|
|
17
|
+
<body style="margin: 0; padding: 0; font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; background-color: #f4f4f4;">
|
|
18
|
+
<table role="presentation" width="100%" cellspacing="0" cellpadding="0" border="0">
|
|
19
|
+
<tr>
|
|
20
|
+
<td align="center" style="padding: 40px 0;">
|
|
21
|
+
<table role="presentation" width="600" cellspacing="0" cellpadding="0" border="0" style="background-color: #ffffff; border-radius: 8px; box-shadow: 0 2px 4px rgba(0,0,0,0.1);">
|
|
22
|
+
<!-- Header -->
|
|
23
|
+
<tr>
|
|
24
|
+
<td style="padding: 40px 40px 20px 40px; text-align: center; background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); border-radius: 8px 8px 0 0;">
|
|
25
|
+
<h1 style="color: #ffffff; font-size: 28px; margin: 0; font-weight: 600;">${appName}</h1>
|
|
26
|
+
<p style="color: #ffffff; font-size: 16px; margin: 10px 0 0 0; opacity: 0.95;">${t("headerSubtitle")}</p>
|
|
27
|
+
</td>
|
|
28
|
+
</tr>
|
|
29
|
+
|
|
30
|
+
<!-- Content -->
|
|
31
|
+
<tr>
|
|
32
|
+
<td style="padding: 40px; text-align: center;">
|
|
33
|
+
<h2 style="color: #333333; font-size: 24px; margin: 0 0 20px 0; font-weight: 600;">${t("title")}</h2>
|
|
34
|
+
|
|
35
|
+
<p style="color: #666666; font-size: 16px; line-height: 1.6; margin: 0 0 30px 0;">
|
|
36
|
+
${t("intro")}
|
|
37
|
+
</p>
|
|
38
|
+
|
|
39
|
+
<div style="margin: 0 auto 30px; padding: 20px 40px; background-color: #f8f8f8; border-radius: 8px; display: inline-block;">
|
|
40
|
+
<span style="font-size: 36px; font-weight: 700; letter-spacing: 8px; color: #333333; font-family: monospace;">${data.otp}</span>
|
|
41
|
+
</div>
|
|
42
|
+
|
|
43
|
+
<p style="color: #999999; font-size: 14px; line-height: 1.6; margin: 0;">
|
|
44
|
+
${t("expiresNotice", { minutes: OTP_EXPIRES_MINUTES })}<br>
|
|
45
|
+
${t("ignoreNotice")}
|
|
46
|
+
</p>
|
|
47
|
+
</td>
|
|
48
|
+
</tr>
|
|
49
|
+
|
|
50
|
+
<!-- Footer -->
|
|
51
|
+
<tr>
|
|
52
|
+
<td style="padding: 30px 40px; background-color: #f8f8f8; border-radius: 0 0 8px 8px; text-align: center;">
|
|
53
|
+
<p style="color: #999999; font-size: 14px; margin: 0 0 10px 0;">
|
|
54
|
+
${t("copyright", { year, appName })}
|
|
55
|
+
</p>
|
|
56
|
+
<p style="color: #999999; font-size: 12px; margin: 0;">
|
|
57
|
+
${t("footerLine1", { appName })}
|
|
58
|
+
</p>
|
|
59
|
+
</td>
|
|
60
|
+
</tr>
|
|
61
|
+
</table>
|
|
62
|
+
</td>
|
|
63
|
+
</tr>
|
|
64
|
+
</table>
|
|
65
|
+
</body>
|
|
66
|
+
</html>
|
|
67
|
+
`
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
export {
|
|
71
|
+
otpVerification as default
|
|
72
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Core default: Reset Password template.
|
|
3
|
+
*
|
|
4
|
+
* Themes can override by creating `themes/<theme>/emails/reset-password.ts`
|
|
5
|
+
* with a default export matching this contract.
|
|
6
|
+
*/
|
|
7
|
+
import type { EmailContent, PasswordResetEmailData } from '../lib/email/types';
|
|
8
|
+
export default function resetPassword(data: PasswordResetEmailData, locale?: string): Promise<EmailContent>;
|
|
9
|
+
//# sourceMappingURL=reset-password.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reset-password.d.ts","sourceRoot":"","sources":["../../src/emails/reset-password.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EAAE,YAAY,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAI/E,wBAA8B,aAAa,CACzC,IAAI,EAAE,sBAAsB,EAC5B,MAAM,CAAC,EAAE,MAAM,GACd,OAAO,CAAC,YAAY,CAAC,CA0FvB"}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { getTranslations } from "next-intl/server";
|
|
2
|
+
const APP_NAME_FALLBACK = process.env.NEXT_PUBLIC_APP_NAME || "Your App";
|
|
3
|
+
async function resetPassword(data, locale) {
|
|
4
|
+
const t = await getTranslations({ locale, namespace: "email.resetPassword" });
|
|
5
|
+
const appName = data.appName || APP_NAME_FALLBACK;
|
|
6
|
+
const year = (/* @__PURE__ */ new Date()).getFullYear();
|
|
7
|
+
const greeting = `${t("greetingPrefix")}${data.userName ? ` ${data.userName}` : ""},`;
|
|
8
|
+
const expiresIn = data.expiresIn || t("defaultExpiresIn");
|
|
9
|
+
return {
|
|
10
|
+
subject: t("subject", { appName }),
|
|
11
|
+
html: `
|
|
12
|
+
<!DOCTYPE html>
|
|
13
|
+
<html>
|
|
14
|
+
<head>
|
|
15
|
+
<meta charset="utf-8">
|
|
16
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
17
|
+
</head>
|
|
18
|
+
<body style="margin: 0; padding: 0; font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; background-color: #f4f4f4;">
|
|
19
|
+
<table role="presentation" width="100%" cellspacing="0" cellpadding="0" border="0">
|
|
20
|
+
<tr>
|
|
21
|
+
<td align="center" style="padding: 40px 0;">
|
|
22
|
+
<table role="presentation" width="600" cellspacing="0" cellpadding="0" border="0" style="background-color: #ffffff; border-radius: 8px; box-shadow: 0 2px 4px rgba(0,0,0,0.1);">
|
|
23
|
+
<!-- Header -->
|
|
24
|
+
<tr>
|
|
25
|
+
<td style="padding: 40px 40px 20px 40px; text-align: center; background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%); border-radius: 8px 8px 0 0;">
|
|
26
|
+
<h1 style="color: #ffffff; font-size: 28px; margin: 0; font-weight: 600;">${appName}</h1>
|
|
27
|
+
<p style="color: #ffffff; font-size: 16px; margin: 10px 0 0 0; opacity: 0.95;">${t("headerSubtitle")}</p>
|
|
28
|
+
</td>
|
|
29
|
+
</tr>
|
|
30
|
+
|
|
31
|
+
<!-- Content -->
|
|
32
|
+
<tr>
|
|
33
|
+
<td style="padding: 40px;">
|
|
34
|
+
<h2 style="color: #333333; font-size: 24px; margin: 0 0 20px 0; font-weight: 600;">${t("title")}</h2>
|
|
35
|
+
|
|
36
|
+
<p style="color: #666666; font-size: 16px; line-height: 1.6; margin: 0 0 20px 0;">
|
|
37
|
+
${greeting}
|
|
38
|
+
</p>
|
|
39
|
+
|
|
40
|
+
<p style="color: #666666; font-size: 16px; line-height: 1.6; margin: 0 0 30px 0;">
|
|
41
|
+
${t("intro")}
|
|
42
|
+
</p>
|
|
43
|
+
|
|
44
|
+
<table role="presentation" cellspacing="0" cellpadding="0" border="0" style="margin: 0 auto;">
|
|
45
|
+
<tr>
|
|
46
|
+
<td style="border-radius: 6px; background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);">
|
|
47
|
+
<a href="${data.resetUrl}" target="_blank" style="display: inline-block; padding: 14px 32px; font-size: 16px; font-weight: 600; color: #ffffff; text-decoration: none; border-radius: 6px;">
|
|
48
|
+
${t("buttonLabel")}
|
|
49
|
+
</a>
|
|
50
|
+
</td>
|
|
51
|
+
</tr>
|
|
52
|
+
</table>
|
|
53
|
+
|
|
54
|
+
<div style="margin: 30px 0; padding: 20px; background-color: #fff3cd; border-left: 4px solid #ffc107; border-radius: 4px;">
|
|
55
|
+
<p style="color: #856404; font-size: 14px; margin: 0; font-weight: 600;">
|
|
56
|
+
${t("securityNoticeTitle")}
|
|
57
|
+
</p>
|
|
58
|
+
<p style="color: #856404; font-size: 14px; margin: 10px 0 0 0; line-height: 1.5;">
|
|
59
|
+
${t("securityNoticeExpiry", { expiresIn })}<br>
|
|
60
|
+
${t("securityNoticeIgnore")}
|
|
61
|
+
</p>
|
|
62
|
+
</div>
|
|
63
|
+
|
|
64
|
+
<p style="color: #999999; font-size: 14px; line-height: 1.6; margin: 20px 0 0 0; padding: 20px; background-color: #f8f8f8; border-radius: 6px;">
|
|
65
|
+
<strong>${t("helpHeading")}</strong><br>
|
|
66
|
+
${t("helpInstructions")}<br>
|
|
67
|
+
<span style="color: #f5576c; word-break: break-all; font-size: 12px;">${data.resetUrl}</span>
|
|
68
|
+
</p>
|
|
69
|
+
</td>
|
|
70
|
+
</tr>
|
|
71
|
+
|
|
72
|
+
<!-- Footer -->
|
|
73
|
+
<tr>
|
|
74
|
+
<td style="padding: 30px 40px; background-color: #f8f8f8; border-radius: 0 0 8px 8px; text-align: center;">
|
|
75
|
+
<p style="color: #999999; font-size: 14px; margin: 0 0 10px 0;">
|
|
76
|
+
${t("copyright", { year, appName })}
|
|
77
|
+
</p>
|
|
78
|
+
<p style="color: #999999; font-size: 12px; margin: 0;">
|
|
79
|
+
${t("footerLine1", { appName })}
|
|
80
|
+
<br>${t("footerLine2")}
|
|
81
|
+
</p>
|
|
82
|
+
</td>
|
|
83
|
+
</tr>
|
|
84
|
+
</table>
|
|
85
|
+
</td>
|
|
86
|
+
</tr>
|
|
87
|
+
</table>
|
|
88
|
+
</body>
|
|
89
|
+
</html>
|
|
90
|
+
`
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
export {
|
|
94
|
+
resetPassword as default
|
|
95
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Core default: Team Invitation template.
|
|
3
|
+
*
|
|
4
|
+
* Themes can override by creating `themes/<theme>/emails/team-invitation.ts`
|
|
5
|
+
* with a default export matching this contract.
|
|
6
|
+
*/
|
|
7
|
+
import type { EmailContent, TeamInvitationEmailData } from '../lib/email/types';
|
|
8
|
+
export default function teamInvitation(data: TeamInvitationEmailData, locale?: string): Promise<EmailContent>;
|
|
9
|
+
//# sourceMappingURL=team-invitation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"team-invitation.d.ts","sourceRoot":"","sources":["../../src/emails/team-invitation.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EAAE,YAAY,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AAIhF,wBAA8B,cAAc,CAC1C,IAAI,EAAE,uBAAuB,EAC7B,MAAM,CAAC,EAAE,MAAM,GACd,OAAO,CAAC,YAAY,CAAC,CAwFvB"}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { getTranslations } from "next-intl/server";
|
|
2
|
+
const APP_NAME_FALLBACK = process.env.NEXT_PUBLIC_APP_NAME || "Your App";
|
|
3
|
+
async function teamInvitation(data, locale) {
|
|
4
|
+
const t = await getTranslations({ locale, namespace: "email.teamInvitation" });
|
|
5
|
+
const appName = data.appName || APP_NAME_FALLBACK;
|
|
6
|
+
const year = (/* @__PURE__ */ new Date()).getFullYear();
|
|
7
|
+
return {
|
|
8
|
+
subject: t("subject", { teamName: data.teamName, appName }),
|
|
9
|
+
html: `
|
|
10
|
+
<!DOCTYPE html>
|
|
11
|
+
<html>
|
|
12
|
+
<head>
|
|
13
|
+
<meta charset="utf-8">
|
|
14
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
15
|
+
</head>
|
|
16
|
+
<body style="margin: 0; padding: 0; font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; background-color: #f4f4f4;">
|
|
17
|
+
<table role="presentation" width="100%" cellspacing="0" cellpadding="0" border="0">
|
|
18
|
+
<tr>
|
|
19
|
+
<td align="center" style="padding: 40px 0;">
|
|
20
|
+
<table role="presentation" width="600" cellspacing="0" cellpadding="0" border="0" style="background-color: #ffffff; border-radius: 8px; box-shadow: 0 2px 4px rgba(0,0,0,0.1);">
|
|
21
|
+
<!-- Header -->
|
|
22
|
+
<tr>
|
|
23
|
+
<td style="padding: 40px 40px 20px 40px; text-align: center; background: linear-gradient(135deg, #4F46E5 0%, #7C3AED 100%); border-radius: 8px 8px 0 0;">
|
|
24
|
+
<h1 style="color: #ffffff; font-size: 28px; margin: 0; font-weight: 600;">${appName}</h1>
|
|
25
|
+
<p style="color: #ffffff; font-size: 16px; margin: 10px 0 0 0; opacity: 0.95;">${t("headerSubtitle")}</p>
|
|
26
|
+
</td>
|
|
27
|
+
</tr>
|
|
28
|
+
|
|
29
|
+
<!-- Content -->
|
|
30
|
+
<tr>
|
|
31
|
+
<td style="padding: 40px;">
|
|
32
|
+
<h2 style="color: #333333; font-size: 24px; margin: 0 0 20px 0; font-weight: 600;">${t("title")}</h2>
|
|
33
|
+
|
|
34
|
+
<p style="color: #666666; font-size: 16px; line-height: 1.6; margin: 0 0 20px 0;">
|
|
35
|
+
${t("bodyIntro", { inviterName: data.inviterName, teamName: data.teamName, role: data.role })}
|
|
36
|
+
</p>
|
|
37
|
+
|
|
38
|
+
<p style="color: #666666; font-size: 16px; line-height: 1.6; margin: 0 0 30px 0;">
|
|
39
|
+
${t("bodyAction")}
|
|
40
|
+
</p>
|
|
41
|
+
|
|
42
|
+
<table role="presentation" cellspacing="0" cellpadding="0" border="0" style="margin: 0 auto;">
|
|
43
|
+
<tr>
|
|
44
|
+
<td style="border-radius: 6px; background: linear-gradient(135deg, #4F46E5 0%, #7C3AED 100%);">
|
|
45
|
+
<a href="${data.acceptUrl}" target="_blank" style="display: inline-block; padding: 14px 32px; font-size: 16px; font-weight: 600; color: #ffffff; text-decoration: none; border-radius: 6px;">
|
|
46
|
+
${t("buttonLabel")}
|
|
47
|
+
</a>
|
|
48
|
+
</td>
|
|
49
|
+
</tr>
|
|
50
|
+
</table>
|
|
51
|
+
|
|
52
|
+
<div style="margin: 30px 0; padding: 20px; background-color: #f0f9ff; border-left: 4px solid #4F46E5; border-radius: 4px;">
|
|
53
|
+
<p style="color: #1e40af; font-size: 14px; margin: 0; font-weight: 600;">
|
|
54
|
+
${t("detailsTitle")}
|
|
55
|
+
</p>
|
|
56
|
+
<p style="color: #1e40af; font-size: 14px; margin: 10px 0 0 0; line-height: 1.5;">
|
|
57
|
+
${t("detailsExpiry", { expiresIn: data.expiresIn })}<br>
|
|
58
|
+
${t("detailsCreateAccount")}
|
|
59
|
+
</p>
|
|
60
|
+
</div>
|
|
61
|
+
|
|
62
|
+
<p style="color: #999999; font-size: 14px; line-height: 1.6; margin: 20px 0 0 0; padding: 20px; background-color: #f8f8f8; border-radius: 6px;">
|
|
63
|
+
<strong>${t("helpHeading")}</strong><br>
|
|
64
|
+
${t("helpInstructions")}<br>
|
|
65
|
+
<span style="color: #4F46E5; word-break: break-all; font-size: 12px;">${data.acceptUrl}</span>
|
|
66
|
+
</p>
|
|
67
|
+
</td>
|
|
68
|
+
</tr>
|
|
69
|
+
|
|
70
|
+
<!-- Footer -->
|
|
71
|
+
<tr>
|
|
72
|
+
<td style="padding: 30px 40px; background-color: #f8f8f8; border-radius: 0 0 8px 8px; text-align: center;">
|
|
73
|
+
<p style="color: #999999; font-size: 14px; margin: 0 0 10px 0;">
|
|
74
|
+
${t("copyright", { year, appName })}
|
|
75
|
+
</p>
|
|
76
|
+
<p style="color: #999999; font-size: 12px; margin: 0;">
|
|
77
|
+
${t("footerSentTo", { inviteeEmail: data.inviteeEmail })}<br>
|
|
78
|
+
${t("footerUnexpected")}
|
|
79
|
+
</p>
|
|
80
|
+
</td>
|
|
81
|
+
</tr>
|
|
82
|
+
</table>
|
|
83
|
+
</td>
|
|
84
|
+
</tr>
|
|
85
|
+
</table>
|
|
86
|
+
</body>
|
|
87
|
+
</html>
|
|
88
|
+
`
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
export {
|
|
92
|
+
teamInvitation as default
|
|
93
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Core default: Verify Email template.
|
|
3
|
+
*
|
|
4
|
+
* Themes can override by creating `themes/<theme>/emails/verify-email.ts` with
|
|
5
|
+
* a default export matching this contract. The build-time email registry will
|
|
6
|
+
* pick the theme version over this one when the active theme has the file.
|
|
7
|
+
*
|
|
8
|
+
* @see packages/core/scripts/build/registry/discovery/emails.mjs
|
|
9
|
+
* @see packages/core/scripts/build/registry/generators/email-registry.mjs
|
|
10
|
+
*/
|
|
11
|
+
import type { EmailContent, VerificationEmailData } from '../lib/email/types';
|
|
12
|
+
export default function verifyEmail(data: VerificationEmailData, locale?: string): Promise<EmailContent>;
|
|
13
|
+
//# sourceMappingURL=verify-email.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"verify-email.d.ts","sourceRoot":"","sources":["../../src/emails/verify-email.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAGH,OAAO,KAAK,EAAE,YAAY,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAI9E,wBAA8B,WAAW,CACvC,IAAI,EAAE,qBAAqB,EAC3B,MAAM,CAAC,EAAE,MAAM,GACd,OAAO,CAAC,YAAY,CAAC,CA+EvB"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { getTranslations } from "next-intl/server";
|
|
2
|
+
const APP_NAME_FALLBACK = process.env.NEXT_PUBLIC_APP_NAME || "Your App";
|
|
3
|
+
async function verifyEmail(data, locale) {
|
|
4
|
+
const t = await getTranslations({ locale, namespace: "email.verifyEmail" });
|
|
5
|
+
const appName = data.appName || APP_NAME_FALLBACK;
|
|
6
|
+
const year = (/* @__PURE__ */ new Date()).getFullYear();
|
|
7
|
+
const greeting = `${t("greetingPrefix")}${data.userName ? ` ${data.userName}` : ""},`;
|
|
8
|
+
return {
|
|
9
|
+
subject: t("subject", { appName }),
|
|
10
|
+
html: `
|
|
11
|
+
<!DOCTYPE html>
|
|
12
|
+
<html>
|
|
13
|
+
<head>
|
|
14
|
+
<meta charset="utf-8">
|
|
15
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
16
|
+
</head>
|
|
17
|
+
<body style="margin: 0; padding: 0; font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; background-color: #f4f4f4;">
|
|
18
|
+
<table role="presentation" width="100%" cellspacing="0" cellpadding="0" border="0">
|
|
19
|
+
<tr>
|
|
20
|
+
<td align="center" style="padding: 40px 0;">
|
|
21
|
+
<table role="presentation" width="600" cellspacing="0" cellpadding="0" border="0" style="background-color: #ffffff; border-radius: 8px; box-shadow: 0 2px 4px rgba(0,0,0,0.1);">
|
|
22
|
+
<!-- Header -->
|
|
23
|
+
<tr>
|
|
24
|
+
<td style="padding: 40px 40px 20px 40px; text-align: center; background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); border-radius: 8px 8px 0 0;">
|
|
25
|
+
<h1 style="color: #ffffff; font-size: 28px; margin: 0; font-weight: 600;">${appName}</h1>
|
|
26
|
+
<p style="color: #ffffff; font-size: 16px; margin: 10px 0 0 0; opacity: 0.95;">${t("headerSubtitle")}</p>
|
|
27
|
+
</td>
|
|
28
|
+
</tr>
|
|
29
|
+
|
|
30
|
+
<!-- Content -->
|
|
31
|
+
<tr>
|
|
32
|
+
<td style="padding: 40px;">
|
|
33
|
+
<h2 style="color: #333333; font-size: 24px; margin: 0 0 20px 0; font-weight: 600;">${t("title")}</h2>
|
|
34
|
+
|
|
35
|
+
<p style="color: #666666; font-size: 16px; line-height: 1.6; margin: 0 0 20px 0;">
|
|
36
|
+
${greeting}
|
|
37
|
+
</p>
|
|
38
|
+
|
|
39
|
+
<p style="color: #666666; font-size: 16px; line-height: 1.6; margin: 0 0 30px 0;">
|
|
40
|
+
${t("intro")}
|
|
41
|
+
</p>
|
|
42
|
+
|
|
43
|
+
<table role="presentation" cellspacing="0" cellpadding="0" border="0" style="margin: 0 auto;">
|
|
44
|
+
<tr>
|
|
45
|
+
<td style="border-radius: 6px; background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);">
|
|
46
|
+
<a href="${data.verificationUrl}" target="_blank" style="display: inline-block; padding: 14px 32px; font-size: 16px; font-weight: 600; color: #ffffff; text-decoration: none; border-radius: 6px;">
|
|
47
|
+
${t("buttonLabel")}
|
|
48
|
+
</a>
|
|
49
|
+
</td>
|
|
50
|
+
</tr>
|
|
51
|
+
</table>
|
|
52
|
+
|
|
53
|
+
<p style="color: #999999; font-size: 14px; line-height: 1.6; margin: 30px 0 0 0; padding: 20px; background-color: #f8f8f8; border-radius: 6px;">
|
|
54
|
+
<strong>${t("helpHeading")}</strong><br>
|
|
55
|
+
${t("helpInstructions")}<br>
|
|
56
|
+
<span style="color: #667eea; word-break: break-all; font-size: 12px;">${data.verificationUrl}</span>
|
|
57
|
+
</p>
|
|
58
|
+
</td>
|
|
59
|
+
</tr>
|
|
60
|
+
|
|
61
|
+
<!-- Footer -->
|
|
62
|
+
<tr>
|
|
63
|
+
<td style="padding: 30px 40px; background-color: #f8f8f8; border-radius: 0 0 8px 8px; text-align: center;">
|
|
64
|
+
<p style="color: #999999; font-size: 14px; margin: 0 0 10px 0;">
|
|
65
|
+
${t("copyright", { year, appName })}
|
|
66
|
+
</p>
|
|
67
|
+
<p style="color: #999999; font-size: 12px; margin: 0;">
|
|
68
|
+
${t("footerLine1", { appName })}
|
|
69
|
+
<br>${t("footerLine2")}
|
|
70
|
+
</p>
|
|
71
|
+
</td>
|
|
72
|
+
</tr>
|
|
73
|
+
</table>
|
|
74
|
+
</td>
|
|
75
|
+
</tr>
|
|
76
|
+
</table>
|
|
77
|
+
</body>
|
|
78
|
+
</html>
|
|
79
|
+
`
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
export {
|
|
83
|
+
verifyEmail as default
|
|
84
|
+
};
|
|
@@ -75,7 +75,7 @@ export declare class EntityApiClient {
|
|
|
75
75
|
/**
|
|
76
76
|
* Create new entity
|
|
77
77
|
*/
|
|
78
|
-
create(entityType: string, data: EntityData): Promise<EntityData>;
|
|
78
|
+
create(entityType: string, data: EntityData, extraHeaders?: Record<string, string>): Promise<EntityData>;
|
|
79
79
|
/**
|
|
80
80
|
* Update entity
|
|
81
81
|
*/
|
|
@@ -116,6 +116,10 @@ export declare class EntityApiClient {
|
|
|
116
116
|
* Get entity activity/audit log for dashboard
|
|
117
117
|
*/
|
|
118
118
|
getEntityActivity(entityType: string, limit?: number): Promise<Record<string, unknown>[]>;
|
|
119
|
+
/**
|
|
120
|
+
* Duplicate an entity — fetches the original, strips identity fields, and creates a copy
|
|
121
|
+
*/
|
|
122
|
+
duplicate(entityType: string, id: string): Promise<EntityData>;
|
|
119
123
|
/**
|
|
120
124
|
* Detect if entity has custom override (client-side detection)
|
|
121
125
|
*/
|
|
@@ -130,6 +134,7 @@ export declare const deleteEntityData: (entityType: string, id: string) => Promi
|
|
|
130
134
|
}>;
|
|
131
135
|
export declare const getEntityData: (entityType: string, id: string, includeMeta?: boolean) => Promise<EntityData>;
|
|
132
136
|
export declare const listEntityData: (entityType: string, params?: EntityListParams) => Promise<EntityListResponse>;
|
|
137
|
+
export declare const duplicateEntityData: (entityType: string, id: string) => Promise<EntityData>;
|
|
133
138
|
/**
|
|
134
139
|
* Get child entities for a parent entity
|
|
135
140
|
* Example: Get order items for an order
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"entities.d.ts","sourceRoot":"","sources":["../../../src/lib/api/entities.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,MAAM,WAAW,UAAU;IACzB,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;CACvB;AAED,MAAM,WAAW,gBAAgB;IAC/B,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAChC,WAAW,CAAC,EAAE,OAAO,CAAA;CACtB;AAED,MAAM,WAAW,kBAAkB;IACjC,OAAO,EAAE,IAAI,CAAA;IACb,IAAI,EAAE,UAAU,EAAE,CAAA;IAClB,IAAI,EAAE;QACJ,SAAS,EAAE,MAAM,CAAA;QACjB,IAAI,EAAE,MAAM,CAAA;QACZ,KAAK,EAAE,MAAM,CAAA;QACb,KAAK,EAAE,MAAM,CAAA;QACb,UAAU,EAAE,MAAM,CAAA;QAClB,WAAW,EAAE,OAAO,CAAA;QACpB,WAAW,EAAE,OAAO,CAAA;KACrB,CAAA;CACF;AAED,MAAM,WAAW,WAAW;IAC1B,KAAK,EAAE,MAAM,CAAA;IACb,WAAW,EAAE,MAAM,CAAA;IACnB,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,CAAC,EAAE;QACP,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KACtB,CAAA;CACF;AAED,MAA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AAC,QAAQ,CAAC,CAsBnB"}
|
package/dist/lib/api/entities.js
CHANGED
|
@@ -147,11 +147,11 @@ class EntityApiClient {
|
|
|
147
147
|
/**
|
|
148
148
|
* Create new entity
|
|
149
149
|
*/
|
|
150
|
-
async create(entityType, data) {
|
|
150
|
+
async create(entityType, data, extraHeaders = {}) {
|
|
151
151
|
const endpointPath = await this.getEndpointPath(entityType);
|
|
152
152
|
const response = await fetch(`${this.baseUrl}/${endpointPath}`, {
|
|
153
153
|
method: "POST",
|
|
154
|
-
headers: buildHeaders(),
|
|
154
|
+
headers: buildHeaders(extraHeaders),
|
|
155
155
|
credentials: "include",
|
|
156
156
|
// Include cookies for session auth
|
|
157
157
|
body: JSON.stringify(data)
|
|
@@ -401,6 +401,23 @@ class EntityApiClient {
|
|
|
401
401
|
return [];
|
|
402
402
|
}
|
|
403
403
|
}
|
|
404
|
+
/**
|
|
405
|
+
* Duplicate an entity — fetches the original, strips identity fields, and creates a copy
|
|
406
|
+
*/
|
|
407
|
+
async duplicate(entityType, id) {
|
|
408
|
+
const original = await this.get(entityType, id, true);
|
|
409
|
+
const copyData = {
|
|
410
|
+
...original,
|
|
411
|
+
title: `${original.title || ""} (Copy)`,
|
|
412
|
+
slug: `${original.slug || ""}-copy-${Date.now().toString(36)}`,
|
|
413
|
+
status: "draft"
|
|
414
|
+
};
|
|
415
|
+
delete copyData.id;
|
|
416
|
+
delete copyData.createdAt;
|
|
417
|
+
delete copyData.updatedAt;
|
|
418
|
+
const hasBlocks = "blocks" in copyData && Array.isArray(copyData.blocks);
|
|
419
|
+
return this.create(entityType, copyData, hasBlocks ? { "x-builder-source": "true" } : {});
|
|
420
|
+
}
|
|
404
421
|
/**
|
|
405
422
|
* Detect if entity has custom override (client-side detection)
|
|
406
423
|
*/
|
|
@@ -425,6 +442,9 @@ const getEntityData = async (entityType, id, includeMeta = false) => {
|
|
|
425
442
|
const listEntityData = async (entityType, params = {}) => {
|
|
426
443
|
return entityApi.list(entityType, params);
|
|
427
444
|
};
|
|
445
|
+
const duplicateEntityData = async (entityType, id) => {
|
|
446
|
+
return entityApi.duplicate(entityType, id);
|
|
447
|
+
};
|
|
428
448
|
const getEntityChildren = async (parentEntityType, parentId, childEntityName, params = {}) => {
|
|
429
449
|
const apiPath = clientMetaSystemAdapter.getApiPath(parentEntityType);
|
|
430
450
|
const endpointPath = apiPath || (parentEntityType.endsWith("s") ? parentEntityType : `${parentEntityType}s`);
|
|
@@ -464,6 +484,7 @@ export {
|
|
|
464
484
|
EntityApiClient,
|
|
465
485
|
createEntityData,
|
|
466
486
|
deleteEntityData,
|
|
487
|
+
duplicateEntityData,
|
|
467
488
|
entityApi,
|
|
468
489
|
fetchWithTeam,
|
|
469
490
|
getEntityChildren,
|
package/dist/lib/auth.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../src/lib/auth.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../src/lib/auth.ts"],"names":[],"mappings":"AAWA,OAAO,EAAgF,KAAK,QAAQ,EAAE,MAAM,UAAU,CAAC;AAkDvH,eAAO,MAAM,IAAI;;;;kGAmX+7qgB,CAAC;oBAAyB,CAAC;;sBAAqD,CAAC;;qBAA4D,CAAC;;sBAA2E,CAAC;;uBAAgE,CAAC;;uBAAoD,CAAC;;0BAA2D,CAAC;6BAAwC,CAAC;mBAA8B,CAAC;oBAAgD,CAAC;;0BAAsD,CAAC;6BAAuD,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kGAA8pD,CAAC;oBAAyB,CAAC;;sBAAqD,CAAC;;qBAA4D,CAAC;;sBAA2E,CAAC;;uBAAgE,CAAC;;uBAAoD,CAAC;;0BAA2D,CAAC;6BAAwC,CAAC;mBAA8B,CAAC;oBAAgD,CAAC;;0BAAsD,CAAC;6BAAuD,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;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M,WAAW,GAAG,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,GAAG;IAC1D,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,QAAQ,CAAC;IAChB,KAAK,CAAC,EAAE,OAAO,kBAAkB,EAAE,QAAQ,EAAE,CAAC;CAC/C,CAAC;AAEF;;;GAGG;AACH,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,OAAO,CAAC,SAAS,CAAC,CAAC;IAC5B,IAAI,EAAE,WAAW,CAAC;CACnB;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAsB,eAAe,CACnC,OAAO,EAAE,OAAO,GACf,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC,CAO9B"}
|
package/dist/lib/auth.js
CHANGED
|
@@ -3,7 +3,12 @@ import { Pool } from "pg";
|
|
|
3
3
|
import { nextCookies } from "better-auth/next-js";
|
|
4
4
|
import { emailOTP } from "better-auth/plugins";
|
|
5
5
|
import { parseSSLConfig, stripSSLParams } from "./db.js";
|
|
6
|
-
import { EmailFactory
|
|
6
|
+
import { EmailFactory } from "./email/index.js";
|
|
7
|
+
import {
|
|
8
|
+
sendVerifyEmail,
|
|
9
|
+
sendResetPasswordEmail,
|
|
10
|
+
sendOtpVerificationEmail
|
|
11
|
+
} from "./email/send.js";
|
|
7
12
|
import { I18N_CONFIG, USER_ROLES_CONFIG, TEAMS_CONFIG, AUTH_CONFIG, APP_CONFIG_MERGED } from "./config/index.js";
|
|
8
13
|
import { getUserFlags } from "./services/user-flags.service.js";
|
|
9
14
|
import { TeamService } from "./services/team.service.js";
|
|
@@ -72,12 +77,12 @@ const auth = betterAuth({
|
|
|
72
77
|
sendResetPassword: async ({ user, url, token }) => {
|
|
73
78
|
try {
|
|
74
79
|
const resetUrl = `${url}?token=${token}`;
|
|
75
|
-
const template =
|
|
80
|
+
const template = await sendResetPasswordEmail({
|
|
76
81
|
userName: user.firstName || "",
|
|
77
82
|
resetUrl,
|
|
78
83
|
appName: process.env.NEXT_PUBLIC_APP_NAME || "Your App",
|
|
79
84
|
expiresIn: "1 hour"
|
|
80
|
-
});
|
|
85
|
+
}, I18N_CONFIG.defaultLocale);
|
|
81
86
|
const response = await emailService.send({
|
|
82
87
|
to: user.email,
|
|
83
88
|
...template
|
|
@@ -101,11 +106,11 @@ const auth = betterAuth({
|
|
|
101
106
|
sendVerificationEmail: async ({ user, token }) => {
|
|
102
107
|
try {
|
|
103
108
|
const verifyUrl = `${baseUrl}/api/auth/verify-email?token=${token}`;
|
|
104
|
-
const template =
|
|
109
|
+
const template = await sendVerifyEmail({
|
|
105
110
|
userName: user.firstName || "",
|
|
106
111
|
verificationUrl: verifyUrl,
|
|
107
112
|
appName: process.env.NEXT_PUBLIC_APP_NAME || "Your App"
|
|
108
|
-
});
|
|
113
|
+
}, I18N_CONFIG.defaultLocale);
|
|
109
114
|
const response = await emailService.send({
|
|
110
115
|
to: user.email,
|
|
111
116
|
...template
|
|
@@ -159,12 +164,12 @@ const auth = betterAuth({
|
|
|
159
164
|
// Intercept OAuth signup attempts
|
|
160
165
|
emailOTP({
|
|
161
166
|
async sendVerificationOTP({ email, otp, type }) {
|
|
162
|
-
const template =
|
|
167
|
+
const template = await sendOtpVerificationEmail({
|
|
163
168
|
email,
|
|
164
169
|
otp,
|
|
165
170
|
type,
|
|
166
171
|
appName: process.env.NEXT_PUBLIC_APP_NAME || "Your App"
|
|
167
|
-
});
|
|
172
|
+
}, I18N_CONFIG.defaultLocale);
|
|
168
173
|
await emailService.send({ to: email, ...template });
|
|
169
174
|
},
|
|
170
175
|
otpLength: 6,
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { BlockInstance } from '../../types/blocks';
|
|
2
|
+
export interface ClipboardBlock {
|
|
3
|
+
blockSlug: string;
|
|
4
|
+
props: Record<string, unknown>;
|
|
5
|
+
copiedAt: number;
|
|
6
|
+
}
|
|
7
|
+
export declare function copyBlockToClipboard(block: BlockInstance): void;
|
|
8
|
+
export declare function getBlockFromClipboard(): ClipboardBlock | null;
|
|
9
|
+
export declare function hasBlockInClipboard(): boolean;
|
|
10
|
+
export declare function clearBlockClipboard(): void;
|
|
11
|
+
//# sourceMappingURL=clipboard.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clipboard.d.ts","sourceRoot":"","sources":["../../../src/lib/blocks/clipboard.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAIvD,MAAM,WAAW,cAAc;IAC7B,SAAS,EAAE,MAAM,CAAA;IACjB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IAC9B,QAAQ,EAAE,MAAM,CAAA;CACjB;AAED,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,aAAa,GAAG,IAAI,CAO/D;AAED,wBAAgB,qBAAqB,IAAI,cAAc,GAAG,IAAI,CAQ7D;AAED,wBAAgB,mBAAmB,IAAI,OAAO,CAE7C;AAED,wBAAgB,mBAAmB,IAAI,IAAI,CAE1C"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
const CLIPBOARD_KEY = "nextspark:block-clipboard";
|
|
2
|
+
function copyBlockToClipboard(block) {
|
|
3
|
+
const data = {
|
|
4
|
+
blockSlug: block.blockSlug,
|
|
5
|
+
props: { ...block.props },
|
|
6
|
+
copiedAt: Date.now()
|
|
7
|
+
};
|
|
8
|
+
localStorage.setItem(CLIPBOARD_KEY, JSON.stringify(data));
|
|
9
|
+
}
|
|
10
|
+
function getBlockFromClipboard() {
|
|
11
|
+
const raw = localStorage.getItem(CLIPBOARD_KEY);
|
|
12
|
+
if (!raw) return null;
|
|
13
|
+
try {
|
|
14
|
+
return JSON.parse(raw);
|
|
15
|
+
} catch {
|
|
16
|
+
return null;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
function hasBlockInClipboard() {
|
|
20
|
+
return localStorage.getItem(CLIPBOARD_KEY) !== null;
|
|
21
|
+
}
|
|
22
|
+
function clearBlockClipboard() {
|
|
23
|
+
localStorage.removeItem(CLIPBOARD_KEY);
|
|
24
|
+
}
|
|
25
|
+
export {
|
|
26
|
+
clearBlockClipboard,
|
|
27
|
+
copyBlockToClipboard,
|
|
28
|
+
getBlockFromClipboard,
|
|
29
|
+
hasBlockInClipboard
|
|
30
|
+
};
|