@nextjs-cms-plugins/cpanel-emails 1.0.1 → 1.0.3
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/client/EmailsPage.d.ts +4 -1
- package/dist/client/EmailsPage.d.ts.map +1 -1
- package/dist/client/EmailsPage.js +2 -2
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +14 -1
- package/package.json +6 -6
|
@@ -1,3 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
type CpanelEmailsPageProps = {
|
|
2
|
+
title?: string;
|
|
3
|
+
};
|
|
4
|
+
export declare const CpanelEmailsPage: ({ title }: CpanelEmailsPageProps) => import("react/jsx-runtime").JSX.Element;
|
|
2
5
|
export default CpanelEmailsPage;
|
|
3
6
|
//# sourceMappingURL=EmailsPage.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EmailsPage.d.ts","sourceRoot":"","sources":["../../src/client/EmailsPage.tsx"],"names":[],"mappings":"AA6CA,eAAO,MAAM,gBAAgB
|
|
1
|
+
{"version":3,"file":"EmailsPage.d.ts","sourceRoot":"","sources":["../../src/client/EmailsPage.tsx"],"names":[],"mappings":"AA6CA,KAAK,qBAAqB,GAAG;IACzB,KAAK,CAAC,EAAE,MAAM,CAAA;CACjB,CAAA;AAED,eAAO,MAAM,gBAAgB,GAAI,WAAW,qBAAqB,4CAiDhE,CAAA;AA0ID,eAAe,gBAAgB,CAAA"}
|
|
@@ -3,7 +3,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
3
3
|
import { useState } from 'react';
|
|
4
4
|
import { trpc as trpcClient } from 'nextjs-cms/api/trpc/client';
|
|
5
5
|
import { useI18n } from 'nextjs-cms/translations/client';
|
|
6
|
-
export const CpanelEmailsPage = () => {
|
|
6
|
+
export const CpanelEmailsPage = ({ title }) => {
|
|
7
7
|
const t = useI18n();
|
|
8
8
|
const trpc = trpcClient;
|
|
9
9
|
const query = trpc?.cpanelEmails?.getEmails.useQuery;
|
|
@@ -18,7 +18,7 @@ export const CpanelEmailsPage = () => {
|
|
|
18
18
|
const quotaMutation = pluginApi.quotaChange.useMutation({ onSuccess: () => refetch() });
|
|
19
19
|
const passwordMutation = pluginApi.passwordChange.useMutation({ onSuccess: () => refetch() });
|
|
20
20
|
const deleteMutation = pluginApi.deleteEmail.useMutation({ onSuccess: () => refetch() });
|
|
21
|
-
return (_jsxs("div", { className: 'bg-white dark:bg-slate-900', children: [_jsx("div", { className: 'bg-linear-to-r from-sky-200 via-emerald-300 to-blue-600 p-8 font-extrabold text-foreground dark:from-blue-800 dark:via-amber-700 dark:to-rose-900', children: _jsx("h1", { className: 'text-3xl', children: t('email_accounts') }) }), _jsxs("div", { className: 'flex flex-col gap-3 p-4', children: [_jsx(CreateEmailForm, { onSubmit: createEmailMutation.mutateAsync, isSubmitting: !!createEmailMutation.isPending }), isLoading && _jsx("div", { className: 'text-muted-foreground', children: "Loading emails\u2026" }), isError && !isLoading && (_jsx("div", { className: 'rounded border border-destructive/50 bg-destructive/10 p-3 text-sm text-destructive', children: error instanceof Error ? error.message : 'Unable to load emails' })), data?.emails?.length ? (_jsx("div", { className: 'grid grid-cols-1 gap-3 md:grid-cols-2 xl:grid-cols-3', children: data.emails.map((email) => (_jsx(EmailCard, { email: email, onDelete: () => deleteMutation.mutateAsync(email.user), onQuotaChange: (quota) => quotaMutation.mutateAsync({ email: email.user, quota }), onPasswordChange: (password, confirm) => passwordMutation.mutateAsync({ email: email.user, password, passwordConfirm: confirm }) }, email.user))) })) : null] })] }));
|
|
21
|
+
return (_jsxs("div", { className: 'bg-white dark:bg-slate-900', children: [_jsx("div", { className: 'bg-linear-to-r from-sky-200 via-emerald-300 to-blue-600 p-8 font-extrabold text-foreground dark:from-blue-800 dark:via-amber-700 dark:to-rose-900', children: _jsx("h1", { className: 'text-3xl', children: title || t('email_accounts') }) }), _jsxs("div", { className: 'flex flex-col gap-3 p-4', children: [_jsx(CreateEmailForm, { onSubmit: createEmailMutation.mutateAsync, isSubmitting: !!createEmailMutation.isPending }), isLoading && _jsx("div", { className: 'text-muted-foreground', children: "Loading emails\u2026" }), isError && !isLoading && (_jsx("div", { className: 'rounded border border-destructive/50 bg-destructive/10 p-3 text-sm text-destructive', children: error instanceof Error ? error.message : 'Unable to load emails' })), data?.emails?.length ? (_jsx("div", { className: 'grid grid-cols-1 gap-3 md:grid-cols-2 xl:grid-cols-3', children: data.emails.map((email) => (_jsx(EmailCard, { email: email, onDelete: () => deleteMutation.mutateAsync(email.user), onQuotaChange: (quota) => quotaMutation.mutateAsync({ email: email.user, quota }), onPasswordChange: (password, confirm) => passwordMutation.mutateAsync({ email: email.user, password, passwordConfirm: confirm }) }, email.user))) })) : null] })] }));
|
|
22
22
|
};
|
|
23
23
|
const CreateEmailForm = ({ onSubmit, isSubmitting, }) => {
|
|
24
24
|
const [email, setEmail] = useState('');
|
package/dist/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare function createPlugin(): import("nextjs-cms/plugins").CMSPluginSingleRoute;
|
|
1
|
+
export declare function createPlugin(): import("nextjs-cms/plugins/server").CMSPluginSingleRoute;
|
|
2
2
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,wBAAgB,YAAY,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,wBAAgB,YAAY,6DAc3B"}
|
package/dist/index.js
CHANGED
package/dist/server.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.tsx"],"names":[],"mappings":"AAOA,wBAA8B,kBAAkB,qDA6B/C"}
|
package/dist/server.js
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { api, HydrateClient } from 'nextjs-cms/api/trpc/server';
|
|
3
3
|
import { CpanelEmailsPage } from './client/EmailsPage.js';
|
|
4
|
+
import { findPluginRouteByPath } from 'nextjs-cms/plugins/server';
|
|
5
|
+
import { resolveLocalizedString, resolveLocale } from 'nextjs-cms/translations';
|
|
6
|
+
import { getCMSConfig } from 'nextjs-cms/core';
|
|
7
|
+
import auth from 'nextjs-cms/auth';
|
|
4
8
|
export default async function CpanelEmailsServer() {
|
|
5
9
|
const helpers = api;
|
|
6
10
|
const prefetch = helpers.cpanelEmails?.getEmails?.prefetch;
|
|
@@ -8,5 +12,14 @@ export default async function CpanelEmailsServer() {
|
|
|
8
12
|
throw new Error('[cpanel-emails] Missing cpanelEmails.getEmails prefetch helper.');
|
|
9
13
|
}
|
|
10
14
|
await prefetch();
|
|
11
|
-
|
|
15
|
+
// Resolve the plugin route title
|
|
16
|
+
const [route, session, config] = await Promise.all([
|
|
17
|
+
findPluginRouteByPath('/cpanel-emails'),
|
|
18
|
+
auth(),
|
|
19
|
+
getCMSConfig(),
|
|
20
|
+
]);
|
|
21
|
+
const { supportedLanguages, fallbackLanguage } = config.i18n;
|
|
22
|
+
const locale = resolveLocale(session?.user?.locale, supportedLanguages, fallbackLanguage);
|
|
23
|
+
const resolvedTitle = route ? resolveLocalizedString(route.title, locale, fallbackLanguage) : '';
|
|
24
|
+
return (_jsx(HydrateClient, { children: _jsx(CpanelEmailsPage, { title: resolvedTitle }) }));
|
|
12
25
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nextjs-cms-plugins/cpanel-emails",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -24,13 +24,13 @@
|
|
|
24
24
|
"zod": "4.1.12"
|
|
25
25
|
},
|
|
26
26
|
"peerDependencies": {
|
|
27
|
-
"react": "19.
|
|
28
|
-
"react-dom": "19.
|
|
29
|
-
"nextjs-cms": "0.6.
|
|
27
|
+
"react": "19.2.3",
|
|
28
|
+
"react-dom": "19.2.3",
|
|
29
|
+
"nextjs-cms": "0.6.3"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"@types/react": "
|
|
33
|
-
"@types/react-dom": "^19.
|
|
32
|
+
"@types/react": "^19.2.7",
|
|
33
|
+
"@types/react-dom": "^19.2.3",
|
|
34
34
|
"typescript": "^5.9.2"
|
|
35
35
|
},
|
|
36
36
|
"scripts": {
|