@nextjs-cms-plugins/cpanel-dashboard 0.1.1 → 0.1.2

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,17 +1,3 @@
1
- type TrpcLike = {
2
- cpanelDashboard?: {
3
- getData: {
4
- useQuery: () => {
5
- data?: any;
6
- isLoading: boolean;
7
- isError?: boolean;
8
- error?: unknown;
9
- };
10
- };
11
- };
12
- };
13
- export declare const CpanelDashboardPage: ({ trpc }: {
14
- trpc: TrpcLike;
15
- }) => import("react/jsx-runtime").JSX.Element;
1
+ export declare const CpanelDashboardPage: () => import("react/jsx-runtime").JSX.Element;
16
2
  export default CpanelDashboardPage;
17
3
  //# sourceMappingURL=DashboardPage.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"DashboardPage.d.ts","sourceRoot":"","sources":["../../src/client/DashboardPage.tsx"],"names":[],"mappings":"AAMA,KAAK,QAAQ,GAAG;IACZ,eAAe,CAAC,EAAE;QACd,OAAO,EAAE;YACL,QAAQ,EAAE,MAAM;gBACZ,IAAI,CAAC,EAAE,GAAG,CAAA;gBACV,SAAS,EAAE,OAAO,CAAA;gBAClB,OAAO,CAAC,EAAE,OAAO,CAAA;gBACjB,KAAK,CAAC,EAAE,OAAO,CAAA;aAClB,CAAA;SACJ,CAAA;KACJ,CAAA;CACJ,CAAA;AAED,eAAO,MAAM,mBAAmB,GAAI,UAAU;IAAE,IAAI,EAAE,QAAQ,CAAA;CAAE,4CAmF/D,CAAA;AAUD,eAAe,mBAAmB,CAAA"}
1
+ {"version":3,"file":"DashboardPage.d.ts","sourceRoot":"","sources":["../../src/client/DashboardPage.tsx"],"names":[],"mappings":"AAoBA,eAAO,MAAM,mBAAmB,+CAoF/B,CAAA;AAUD,eAAe,mBAAmB,CAAA"}
@@ -2,7 +2,9 @@
2
2
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
3
  import getString from 'nextjs-cms/translations';
4
4
  import { humanReadableFileSize } from 'nextjs-cms/utils';
5
- export const CpanelDashboardPage = ({ trpc }) => {
5
+ import { trpc as trpcClient } from 'nextjs-cms/api/trpc/client';
6
+ export const CpanelDashboardPage = () => {
7
+ const trpc = trpcClient;
6
8
  const query = trpc?.cpanelDashboard?.getData.useQuery;
7
9
  const { data, isLoading, isError, error } = query ? query() : { isLoading: true, isError: true, error: null };
8
10
  if (!query) {
package/dist/index.d.ts CHANGED
@@ -1,5 +1,2 @@
1
- import type { CMSPlugin } from 'nextjs-cms/plugins';
2
- import { cpanelDashboardRouter } from './router.js';
3
- export declare function createPlugin(): CMSPlugin;
4
- export { cpanelDashboardRouter };
1
+ export declare function createPlugin(): import("nextjs-cms/plugins").CMSPluginSingleRoute;
5
2
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAA;AACnD,OAAO,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAA;AAEnD,wBAAgB,YAAY,IAAI,SAAS,CAaxC;AAED,OAAO,EAAE,qBAAqB,EAAE,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,wBAAgB,YAAY,sDAa3B"}
package/dist/index.js CHANGED
@@ -1,16 +1,16 @@
1
+ import { definePlugin } from 'nextjs-cms/plugins';
1
2
  import { cpanelDashboardRouter } from './router.js';
2
3
  export function createPlugin() {
3
- return {
4
- name: 'cPanel Dashboard',
4
+ return definePlugin({
5
+ title: 'cPanel Dashboard',
6
+ name: 'plugin_cpanel_dashboard',
5
7
  router: cpanelDashboardRouter,
6
8
  routes: [
7
9
  {
8
- path: '/dashboard',
9
- title: 'Dashboard',
10
+ path: '/cpanel-dashboard',
11
+ title: 'cPanel Dashboard',
10
12
  icon: 'home',
11
- component: 'cpanelDashboard',
12
13
  },
13
14
  ],
14
- };
15
+ });
15
16
  }
16
- export { cpanelDashboardRouter };
@@ -1 +1 @@
1
- {"version":3,"file":"router.d.ts","sourceRoot":"","sources":["../src/router.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;gBAoDd,CAApB;iBAA2B,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;GA6B1B,CAAA"}
1
+ {"version":3,"file":"router.d.ts","sourceRoot":"","sources":["../src/router.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;gBAmDW,CAAC;iBAA2B,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BxE,CAAA"}
package/dist/router.js CHANGED
@@ -1,9 +1,9 @@
1
1
  import { TRPCError } from '@trpc/server';
2
2
  import getString from 'nextjs-cms/translations';
3
3
  import { CpanelAPI } from 'nextjs-cms/utils';
4
- import { privateProcedure, router } from 'nextjs-cms/api/trpc';
4
+ import { pluginProcedure, router } from 'nextjs-cms/api/trpc';
5
5
  export const cpanelDashboardRouter = router({
6
- getData: privateProcedure.query(async () => {
6
+ getData: pluginProcedure('plugin_cpanel_dashboard').query(async ({ ctx }) => {
7
7
  if (!process.env.CPANEL_USER || !process.env.CPANEL_PASSWORD || !process.env.CPANEL_DOMAIN) {
8
8
  throw new TRPCError({
9
9
  code: 'BAD_REQUEST',
@@ -0,0 +1,2 @@
1
+ export default function CpanelDashboardServer(): Promise<import("react/jsx-runtime").JSX.Element>;
2
+ //# sourceMappingURL=server.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.tsx"],"names":[],"mappings":"AAGA,wBAA8B,qBAAqB,qDAkBlD"}
package/dist/server.js ADDED
@@ -0,0 +1,12 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { api, HydrateClient } from 'nextjs-cms/api/trpc/server';
3
+ import { CpanelDashboardPage } from './client/DashboardPage.js';
4
+ export default async function CpanelDashboardServer() {
5
+ const helpers = api;
6
+ const prefetch = helpers.cpanelDashboard?.getData?.prefetch;
7
+ if (!prefetch) {
8
+ throw new Error('[cpanel-dashboard] Missing cpanelDashboard.getData prefetch helper.');
9
+ }
10
+ await prefetch();
11
+ return (_jsx(HydrateClient, { children: _jsx(CpanelDashboardPage, {}) }));
12
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nextjs-cms-plugins/cpanel-dashboard",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -9,9 +9,9 @@
9
9
  "types": "./dist/index.d.ts",
10
10
  "default": "./dist/index.js"
11
11
  },
12
- "./client": {
13
- "types": "./dist/client.d.ts",
14
- "default": "./dist/client.js"
12
+ "./server": {
13
+ "types": "./dist/server.d.ts",
14
+ "default": "./dist/server.js"
15
15
  }
16
16
  },
17
17
  "files": [
@@ -26,7 +26,7 @@
26
26
  "peerDependencies": {
27
27
  "react": "19.0.0",
28
28
  "react-dom": "19.0.0",
29
- "nextjs-cms": "0.5.68"
29
+ "nextjs-cms": "0.5.69"
30
30
  },
31
31
  "devDependencies": {
32
32
  "@types/react": "~19.0.0",
package/dist/client.d.ts DELETED
@@ -1,19 +0,0 @@
1
- import { CpanelDashboardPage } from './client/DashboardPage.js';
2
- export declare const components: {
3
- cpanelDashboard: ({ trpc }: {
4
- trpc: {
5
- cpanelDashboard?: {
6
- getData: {
7
- useQuery: () => {
8
- data?: any;
9
- isLoading: boolean;
10
- isError?: boolean;
11
- error?: unknown;
12
- };
13
- };
14
- };
15
- };
16
- }) => import("react/jsx-runtime").JSX.Element;
17
- };
18
- export { CpanelDashboardPage };
19
- //# sourceMappingURL=client.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAA;AAE/D,eAAO,MAAM,UAAU;;;;;;4BAKuE,CAAC;;+BAAgE,CAAC;6BAA+B,CAAC;;;;;;CAH/L,CAAA;AAED,OAAO,EAAE,mBAAmB,EAAE,CAAA"}
package/dist/client.js DELETED
@@ -1,5 +0,0 @@
1
- import { CpanelDashboardPage } from './client/DashboardPage.js';
2
- export const components = {
3
- cpanelDashboard: CpanelDashboardPage,
4
- };
5
- export { CpanelDashboardPage };