@nextjscms/plugin-cpanel-emails 2.1.21 → 2.1.23
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.js +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -3
- package/dist/router.d.ts.map +1 -1
- package/dist/router.js +8 -6
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +1 -9
- package/package.json +2 -2
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { useState } from 'react';
|
|
4
|
-
import {
|
|
4
|
+
import { usePluginTRPC } from 'nextjs-cms/plugins/client';
|
|
5
5
|
import { useI18n } from 'nextjs-cms/translations/client';
|
|
6
6
|
export const CpanelEmailsPage = ({ title }) => {
|
|
7
7
|
const t = useI18n();
|
|
8
|
-
const trpc =
|
|
8
|
+
const trpc = usePluginTRPC();
|
|
9
9
|
const query = trpc?.cpanelEmails?.getEmails.useQuery;
|
|
10
10
|
const { data, isLoading, isError, error, refetch } = query
|
|
11
11
|
? query()
|
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,6DAa3B"}
|
package/dist/index.js
CHANGED
|
@@ -1,16 +1,15 @@
|
|
|
1
|
-
import { definePlugin } from 'nextjs-cms/plugins/
|
|
1
|
+
import { definePlugin } from 'nextjs-cms/plugins/define';
|
|
2
2
|
import { cpanelEmailsRouter } from './router.js';
|
|
3
3
|
export function createPlugin() {
|
|
4
4
|
return definePlugin({
|
|
5
5
|
title: 'cPanel Emails',
|
|
6
|
-
name: 'plugin_cpanel_emails',
|
|
7
|
-
registryName: 'cpanel-emails',
|
|
8
6
|
router: cpanelEmailsRouter,
|
|
9
7
|
routes: [
|
|
10
8
|
{
|
|
11
9
|
path: '/cpanel-emails',
|
|
12
10
|
title: 'cPanel Emails',
|
|
13
11
|
icon: 'mail',
|
|
12
|
+
prefetch: 'cpanelEmails.getEmails',
|
|
14
13
|
},
|
|
15
14
|
],
|
|
16
15
|
});
|
package/dist/router.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"router.d.ts","sourceRoot":"","sources":["../src/router.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAA;
|
|
1
|
+
{"version":3,"file":"router.d.ts","sourceRoot":"","sources":["../src/router.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAA;AAQxB,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;gBAgDf,CAAb;iBAA2B,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0H7B,CAAA"}
|
package/dist/router.js
CHANGED
|
@@ -2,9 +2,11 @@ import { TRPCError } from '@trpc/server';
|
|
|
2
2
|
import * as z from 'zod';
|
|
3
3
|
import getString from 'nextjs-cms/translations';
|
|
4
4
|
import { CpanelAPI } from 'nextjs-cms/utils';
|
|
5
|
-
import { pluginProcedure, router } from 'nextjs-cms/api/
|
|
5
|
+
import { pluginProcedure, router } from 'nextjs-cms/api/plugin';
|
|
6
|
+
import { extractPluginName } from 'nextjs-cms/plugins/derive';
|
|
7
|
+
const PLUGIN_NAME = extractPluginName(import.meta.url);
|
|
6
8
|
export const cpanelEmailsRouter = router({
|
|
7
|
-
getEmails: pluginProcedure(
|
|
9
|
+
getEmails: pluginProcedure(PLUGIN_NAME).query(async ({ ctx }) => {
|
|
8
10
|
if (!process.env.CPANEL_USER || !process.env.CPANEL_PASSWORD || !process.env.CPANEL_DOMAIN) {
|
|
9
11
|
throw new TRPCError({
|
|
10
12
|
code: 'BAD_REQUEST',
|
|
@@ -24,7 +26,7 @@ export const cpanelEmailsRouter = router({
|
|
|
24
26
|
emails: data.data,
|
|
25
27
|
};
|
|
26
28
|
}),
|
|
27
|
-
createEmail: pluginProcedure(
|
|
29
|
+
createEmail: pluginProcedure(PLUGIN_NAME, 'C')
|
|
28
30
|
.input(z.object({
|
|
29
31
|
email: z.string(),
|
|
30
32
|
password: z.string(),
|
|
@@ -52,7 +54,7 @@ export const cpanelEmailsRouter = router({
|
|
|
52
54
|
}
|
|
53
55
|
return data;
|
|
54
56
|
}),
|
|
55
|
-
quotaChange: pluginProcedure(
|
|
57
|
+
quotaChange: pluginProcedure(PLUGIN_NAME, 'U')
|
|
56
58
|
.input(z.object({
|
|
57
59
|
email: z.string(),
|
|
58
60
|
quota: z.string(),
|
|
@@ -78,7 +80,7 @@ export const cpanelEmailsRouter = router({
|
|
|
78
80
|
}
|
|
79
81
|
return data;
|
|
80
82
|
}),
|
|
81
|
-
passwordChange: pluginProcedure(
|
|
83
|
+
passwordChange: pluginProcedure(PLUGIN_NAME, 'U')
|
|
82
84
|
.input(z.object({
|
|
83
85
|
email: z.string(),
|
|
84
86
|
password: z.string(),
|
|
@@ -111,7 +113,7 @@ export const cpanelEmailsRouter = router({
|
|
|
111
113
|
}
|
|
112
114
|
return data;
|
|
113
115
|
}),
|
|
114
|
-
deleteEmail: pluginProcedure(
|
|
116
|
+
deleteEmail: pluginProcedure(PLUGIN_NAME, 'D')
|
|
115
117
|
.input(z.string())
|
|
116
118
|
.mutation(async ({ input, ctx }) => {
|
|
117
119
|
if (!process.env.CPANEL_USER || !process.env.CPANEL_PASSWORD || !process.env.CPANEL_DOMAIN) {
|
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":"AAMA,wBAA8B,kBAAkB,qDAW/C"}
|
package/dist/server.js
CHANGED
|
@@ -1,18 +1,10 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { api, HydrateClient } from 'nextjs-cms/api/trpc/server';
|
|
3
2
|
import { CpanelEmailsPage } from './client/EmailsPage.js';
|
|
4
3
|
import { findPluginRouteByPath } from 'nextjs-cms/plugins/server';
|
|
5
4
|
import { resolveMultilingualString, resolveLanguage } from 'nextjs-cms/translations';
|
|
6
5
|
import { getCMSConfig } from 'nextjs-cms/core';
|
|
7
6
|
import auth from 'nextjs-cms/auth';
|
|
8
7
|
export default async function CpanelEmailsServer() {
|
|
9
|
-
const helpers = api;
|
|
10
|
-
const prefetch = helpers.cpanelEmails?.getEmails?.prefetch;
|
|
11
|
-
if (!prefetch) {
|
|
12
|
-
throw new Error('[cpanel-emails] Missing cpanelEmails.getEmails prefetch helper.');
|
|
13
|
-
}
|
|
14
|
-
await prefetch();
|
|
15
|
-
// Resolve the plugin route title
|
|
16
8
|
const [route, session, config] = await Promise.all([
|
|
17
9
|
findPluginRouteByPath('/cpanel-emails'),
|
|
18
10
|
auth(),
|
|
@@ -21,5 +13,5 @@ export default async function CpanelEmailsServer() {
|
|
|
21
13
|
const { supportedLanguages, fallbackLanguage } = config.i18n;
|
|
22
14
|
const language = resolveLanguage(session?.user?.language, supportedLanguages, fallbackLanguage);
|
|
23
15
|
const resolvedTitle = route ? resolveMultilingualString(route.title, language, fallbackLanguage) : '';
|
|
24
|
-
return
|
|
16
|
+
return _jsx(CpanelEmailsPage, { title: resolvedTitle });
|
|
25
17
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nextjscms/plugin-cpanel-emails",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.23",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"peerDependencies": {
|
|
27
27
|
"react": "19.2.3",
|
|
28
28
|
"react-dom": "19.2.3",
|
|
29
|
-
"nextjs-cms": "0.9.
|
|
29
|
+
"nextjs-cms": "0.9.23"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"@types/react": "^19.2.7",
|