@nextjscms/plugin-cpanel-emails 2.1.23 → 2.1.24

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.
@@ -1 +1 @@
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"}
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,4CAwDhE,CAAA;AAsID,eAAe,gBAAgB,CAAA"}
@@ -18,25 +18,29 @@ export const CpanelEmailsPage = ({ title }) => {
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: title || t('emailAccounts') }) }), _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: 'text-foreground bg-linear-to-r from-sky-200 via-emerald-300 to-blue-600 p-8 font-extrabold dark:from-blue-800 dark:via-amber-700 dark:to-rose-900', children: _jsx("h1", { className: 'text-3xl', children: title || t('emailAccounts') }) }), _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: 'border-destructive/50 bg-destructive/10 text-destructive rounded border p-3 text-sm', 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({
22
+ email: email.user,
23
+ password,
24
+ passwordConfirm: confirm,
25
+ }) }, email.user))) })) : null] })] }));
22
26
  };
23
27
  const CreateEmailForm = ({ onSubmit, isSubmitting, }) => {
24
28
  const [email, setEmail] = useState('');
25
29
  const [password, setPassword] = useState('');
26
30
  const [quota, setQuota] = useState('1024');
27
31
  const t = useI18n();
28
- return (_jsxs("form", { className: 'rounded-lg border bg-card p-4 text-card-foreground shadow-sm', onSubmit: async (e) => {
32
+ return (_jsxs("form", { className: 'bg-card text-card-foreground rounded-lg border p-4 shadow-sm', onSubmit: async (e) => {
29
33
  e.preventDefault();
30
34
  await onSubmit({ email, password, quota });
31
35
  setEmail('');
32
36
  setPassword('');
33
- }, children: [_jsx("div", { className: 'text-lg font-semibold', children: t('createNewEmailAccount') }), _jsxs("div", { className: 'mt-3 grid grid-cols-1 gap-3 md:grid-cols-3', children: [_jsx("input", { className: 'rounded border px-3 py-2 text-sm', value: email, onChange: (e) => setEmail(e.target.value), placeholder: t('email'), required: true }), _jsx("input", { className: 'rounded border px-3 py-2 text-sm', type: 'password', value: password, onChange: (e) => setPassword(e.target.value), placeholder: t('password'), required: true }), _jsx("input", { className: 'rounded border px-3 py-2 text-sm', value: quota, onChange: (e) => setQuota(e.target.value), placeholder: t('quota'), required: true })] }), _jsx("button", { type: 'submit', disabled: isSubmitting, className: 'mt-3 inline-flex items-center justify-center rounded bg-primary px-4 py-2 text-sm font-semibold text-primary-foreground shadow-sm hover:opacity-90 disabled:opacity-50', children: isSubmitting ? t('loading') + '…' : t('create') })] }));
37
+ }, children: [_jsx("div", { className: 'text-lg font-semibold', children: t('createNewEmailAccount') }), _jsxs("div", { className: 'mt-3 grid grid-cols-1 gap-3 md:grid-cols-3', children: [_jsx("input", { className: 'rounded border px-3 py-2 text-sm', value: email, onChange: (e) => setEmail(e.target.value), placeholder: t('email'), required: true }), _jsx("input", { className: 'rounded border px-3 py-2 text-sm', type: 'password', value: password, onChange: (e) => setPassword(e.target.value), placeholder: t('password'), required: true }), _jsx("input", { className: 'rounded border px-3 py-2 text-sm', value: quota, onChange: (e) => setQuota(e.target.value), placeholder: t('quota'), required: true })] }), _jsx("button", { type: 'submit', disabled: isSubmitting, className: 'bg-primary text-primary-foreground mt-3 inline-flex items-center justify-center rounded px-4 py-2 text-sm font-semibold shadow-sm hover:opacity-90 disabled:opacity-50', children: isSubmitting ? t('loading') + '…' : t('create') })] }));
34
38
  };
35
39
  const EmailCard = ({ email, onDelete, onQuotaChange, onPasswordChange, }) => {
36
40
  const [quota, setQuota] = useState(email.diskquota);
37
41
  const [password, setPassword] = useState('');
38
42
  const [confirm, setConfirm] = useState('');
39
43
  const t = useI18n();
40
- return (_jsxs("div", { className: 'rounded-lg border bg-card p-4 text-card-foreground shadow-sm', children: [_jsxs("div", { className: 'flex items-center justify-between', children: [_jsx("div", { className: 'font-semibold', children: email.user }), _jsx("button", { className: 'text-sm text-destructive hover:underline', type: 'button', onClick: () => onDelete(), children: t('delete') })] }), _jsxs("div", { className: 'mt-2 text-sm text-muted-foreground', children: [_jsxs("div", { children: ["Disk Used: ", email.diskusedpercent, " / ", email.diskquota] }), _jsxs("div", { children: ["Login: ", email.user] })] }), _jsxs("div", { className: 'mt-3 space-y-2 text-sm', children: [_jsxs("label", { className: 'block', children: [_jsx("span", { className: 'text-xs text-muted-foreground', children: "Quota" }), _jsx("input", { className: 'mt-1 w-full rounded border px-3 py-2', value: quota, onChange: (e) => setQuota(e.target.value) }), _jsx("button", { type: 'button', className: 'mt-1 inline-flex items-center justify-center rounded bg-primary px-3 py-1 text-xs font-semibold text-primary-foreground hover:opacity-90', onClick: () => onQuotaChange(quota), children: t('update') })] }), _jsxs("label", { className: 'block', children: [_jsx("span", { className: 'text-xs text-muted-foreground', children: "Password" }), _jsx("input", { className: 'mt-1 w-full rounded border px-3 py-2', type: 'password', value: password, onChange: (e) => setPassword(e.target.value) })] }), _jsxs("label", { className: 'block', children: [_jsx("span", { className: 'text-xs text-muted-foreground', children: "Confirm" }), _jsx("input", { className: 'mt-1 w-full rounded border px-3 py-2', type: 'password', value: confirm, onChange: (e) => setConfirm(e.target.value) })] }), _jsx("button", { type: 'button', className: 'inline-flex items-center justify-center rounded bg-primary px-3 py-1 text-xs font-semibold text-primary-foreground hover:opacity-90', onClick: () => onPasswordChange(password, confirm), children: t('changePassword') })] })] }));
44
+ return (_jsxs("div", { className: 'bg-card text-card-foreground rounded-lg border p-4 shadow-sm', children: [_jsxs("div", { className: 'flex items-center justify-between', children: [_jsx("div", { className: 'font-semibold', children: email.user }), _jsx("button", { className: 'text-destructive text-sm hover:underline', type: 'button', onClick: () => onDelete(), children: t('delete') })] }), _jsxs("div", { className: 'text-muted-foreground mt-2 text-sm', children: [_jsxs("div", { children: ["Disk Used: ", email.diskusedpercent, " / ", email.diskquota] }), _jsxs("div", { children: ["Login: ", email.user] })] }), _jsxs("div", { className: 'mt-3 space-y-2 text-sm', children: [_jsxs("label", { className: 'block', children: [_jsx("span", { className: 'text-muted-foreground text-xs', children: "Quota" }), _jsx("input", { className: 'mt-1 w-full rounded border px-3 py-2', value: quota, onChange: (e) => setQuota(e.target.value) }), _jsx("button", { type: 'button', className: 'bg-primary text-primary-foreground mt-1 inline-flex items-center justify-center rounded px-3 py-1 text-xs font-semibold hover:opacity-90', onClick: () => onQuotaChange(quota), children: t('update') })] }), _jsxs("label", { className: 'block', children: [_jsx("span", { className: 'text-muted-foreground text-xs', children: "Password" }), _jsx("input", { className: 'mt-1 w-full rounded border px-3 py-2', type: 'password', value: password, onChange: (e) => setPassword(e.target.value) })] }), _jsxs("label", { className: 'block', children: [_jsx("span", { className: 'text-muted-foreground text-xs', children: "Confirm" }), _jsx("input", { className: 'mt-1 w-full rounded border px-3 py-2', type: 'password', value: confirm, onChange: (e) => setConfirm(e.target.value) })] }), _jsx("button", { type: 'button', className: 'bg-primary text-primary-foreground inline-flex items-center justify-center rounded px-3 py-1 text-xs font-semibold hover:opacity-90', onClick: () => onPasswordChange(password, confirm), children: t('changePassword') })] })] }));
41
45
  };
42
46
  export default CpanelEmailsPage;
package/dist/index.d.ts CHANGED
@@ -1,2 +1,82 @@
1
- export declare function createPlugin(): import("nextjs-cms/plugins/server").CMSPluginSingleRoute;
1
+ export declare const cpanelEmailsPlugin: {
2
+ readonly package: "@nextjscms/plugin-cpanel-emails";
3
+ readonly title: "cPanel Emails";
4
+ readonly routes: readonly [{
5
+ readonly path: "/cpanel-emails";
6
+ readonly title: "cPanel Emails";
7
+ readonly icon: "mail";
8
+ readonly prefetch: "cpanelEmails.getEmails";
9
+ }];
10
+ };
11
+ export declare function createPlugin(): Promise<{
12
+ router: import("@trpc/server").TRPCBuiltRouter<{
13
+ ctx: {
14
+ headers: Headers;
15
+ db: import("drizzle-orm/mysql2").MySql2Database<typeof import("nextjs-cms/db/schema")> & {
16
+ $client: import("mysql2/promise").Pool;
17
+ };
18
+ session: import("nextjs-cms").Session | null;
19
+ };
20
+ meta: object;
21
+ errorShape: {
22
+ data: {
23
+ zodError: import("zod").ZodFlattenedError<unknown, string> | null;
24
+ code: import("@trpc/server").TRPC_ERROR_CODE_KEY;
25
+ httpStatus: number;
26
+ path?: string;
27
+ stack?: string;
28
+ };
29
+ message: string;
30
+ code: import("@trpc/server").TRPC_ERROR_CODE_NUMBER;
31
+ };
32
+ transformer: true;
33
+ }, import("@trpc/server").TRPCDecorateCreateRouterOptions<{
34
+ getEmails: import("@trpc/server").TRPCQueryProcedure<{
35
+ input: void;
36
+ output: {
37
+ emails: any;
38
+ };
39
+ meta: object;
40
+ }>;
41
+ createEmail: import("@trpc/server").TRPCMutationProcedure<{
42
+ input: {
43
+ email: string;
44
+ password: string;
45
+ quota: string;
46
+ };
47
+ output: any;
48
+ meta: object;
49
+ }>;
50
+ quotaChange: import("@trpc/server").TRPCMutationProcedure<{
51
+ input: {
52
+ email: string;
53
+ quota: string;
54
+ };
55
+ output: any;
56
+ meta: object;
57
+ }>;
58
+ passwordChange: import("@trpc/server").TRPCMutationProcedure<{
59
+ input: {
60
+ email: string;
61
+ password: string;
62
+ passwordConfirm: string;
63
+ };
64
+ output: any;
65
+ meta: object;
66
+ }>;
67
+ deleteEmail: import("@trpc/server").TRPCMutationProcedure<{
68
+ input: string;
69
+ output: any;
70
+ meta: object;
71
+ }>;
72
+ }>>;
73
+ package: "@nextjscms/plugin-cpanel-emails";
74
+ title: "cPanel Emails";
75
+ routes: readonly [{
76
+ readonly path: "/cpanel-emails";
77
+ readonly title: "cPanel Emails";
78
+ readonly icon: "mail";
79
+ readonly prefetch: "cpanelEmails.getEmails";
80
+ }];
81
+ }>;
2
82
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,wBAAgB,YAAY,6DAa3B"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,kBAAkB;;;;;;;;;CAW7B,CAAA;AAEF,wBAAsB,YAAY;;;;;;;;;;;;;;;oBAQijD,CAAC;qBAA2B,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAD/mD"}
package/dist/index.js CHANGED
@@ -1,16 +1,20 @@
1
1
  import { definePlugin } from 'nextjs-cms/plugins/define';
2
- import { cpanelEmailsRouter } from './router.js';
3
- export function createPlugin() {
4
- return definePlugin({
5
- title: 'cPanel Emails',
2
+ export const cpanelEmailsPlugin = definePlugin({
3
+ package: '@nextjscms/plugin-cpanel-emails',
4
+ title: 'cPanel Emails',
5
+ routes: [
6
+ {
7
+ path: '/cpanel-emails',
8
+ title: 'cPanel Emails',
9
+ icon: 'mail',
10
+ prefetch: 'cpanelEmails.getEmails',
11
+ },
12
+ ],
13
+ });
14
+ export async function createPlugin() {
15
+ const { cpanelEmailsRouter } = await import('./router.js');
16
+ return {
17
+ ...cpanelEmailsPlugin,
6
18
  router: cpanelEmailsRouter,
7
- routes: [
8
- {
9
- path: '/cpanel-emails',
10
- title: 'cPanel Emails',
11
- icon: 'mail',
12
- prefetch: 'cpanelEmails.getEmails',
13
- },
14
- ],
15
- });
19
+ };
16
20
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nextjscms/plugin-cpanel-emails",
3
- "version": "2.1.23",
3
+ "version": "2.1.24",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",