@payloadcms/next 3.1.0 → 3.1.1-canary.c40ff01
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/layouts/Root/checkDependencies.d.ts +1 -1
- package/dist/layouts/Root/checkDependencies.d.ts.map +1 -1
- package/dist/layouts/Root/checkDependencies.js +2 -2
- package/dist/layouts/Root/checkDependencies.js.map +1 -1
- package/dist/layouts/Root/index.d.ts.map +1 -1
- package/dist/layouts/Root/index.js +3 -4
- package/dist/layouts/Root/index.js.map +1 -1
- package/dist/views/Document/handleServerFunction.d.ts +1 -7
- package/dist/views/Document/handleServerFunction.d.ts.map +1 -1
- package/dist/views/Document/handleServerFunction.js +3 -22
- package/dist/views/Document/handleServerFunction.js.map +1 -1
- package/dist/views/List/handleServerFunction.d.ts +1 -7
- package/dist/views/List/handleServerFunction.d.ts.map +1 -1
- package/dist/views/List/handleServerFunction.js +3 -22
- package/dist/views/List/handleServerFunction.js.map +1 -1
- package/dist/views/Root/index.d.ts.map +1 -1
- package/dist/views/Root/index.js +2 -2
- package/dist/views/Root/index.js.map +1 -1
- package/package.json +7 -7
- package/dist/utilities/getClientConfig.d.ts +0 -8
- package/dist/utilities/getClientConfig.d.ts.map +0 -1
- package/dist/utilities/getClientConfig.js +0 -16
- package/dist/utilities/getClientConfig.js.map +0 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const checkDependencies: () =>
|
|
1
|
+
export declare const checkDependencies: () => void;
|
|
2
2
|
//# sourceMappingURL=checkDependencies.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkDependencies.d.ts","sourceRoot":"","sources":["../../../src/layouts/Root/checkDependencies.ts"],"names":[],"mappings":"AAmBA,eAAO,MAAM,iBAAiB,
|
|
1
|
+
{"version":3,"file":"checkDependencies.d.ts","sourceRoot":"","sources":["../../../src/layouts/Root/checkDependencies.ts"],"names":[],"mappings":"AAmBA,eAAO,MAAM,iBAAiB,YAmC7B,CAAA"}
|
|
@@ -17,11 +17,11 @@ const customReactVersionParser = version => {
|
|
|
17
17
|
};
|
|
18
18
|
};
|
|
19
19
|
let checkedDependencies = false;
|
|
20
|
-
export const checkDependencies =
|
|
20
|
+
export const checkDependencies = () => {
|
|
21
21
|
if (process.env.NODE_ENV !== 'production' && process.env.PAYLOAD_DISABLE_DEPENDENCY_CHECKER !== 'true' && !checkedDependencies) {
|
|
22
22
|
checkedDependencies = true;
|
|
23
23
|
// First check if there are mismatching dependency versions of next / react packages
|
|
24
|
-
|
|
24
|
+
void payloadCheckDependencies({
|
|
25
25
|
dependencyGroups: [{
|
|
26
26
|
name: 'react',
|
|
27
27
|
dependencies: ['react', 'react-dom'],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkDependencies.js","names":["checkDependencies","payloadCheckDependencies","customReactVersionParser","version","mainVersion","preReleases","split","length","date","parts","map","Number","checkedDependencies","process","env","NODE_ENV","PAYLOAD_DISABLE_DEPENDENCY_CHECKER","dependencyGroups","name","dependencies","targetVersionDependency","dependencyVersions","next","required","react","customVersionParser"],"sources":["../../../src/layouts/Root/checkDependencies.ts"],"sourcesContent":["import { type CustomVersionParser, checkDependencies as payloadCheckDependencies } from 'payload'\n\nconst customReactVersionParser: CustomVersionParser = (version) => {\n const [mainVersion, ...preReleases] = version.split('-')\n\n if (preReleases?.length === 3) {\n // Needs different handling, as it's in a format like 19.0.0-rc-06d0b89e-20240801 format\n const date = preReleases[2]\n\n const parts = mainVersion.split('.').map(Number)\n return { parts, preReleases: [date] }\n }\n\n const parts = mainVersion.split('.').map(Number)\n return { parts, preReleases }\n}\n\nlet checkedDependencies = false\n\nexport const checkDependencies =
|
|
1
|
+
{"version":3,"file":"checkDependencies.js","names":["checkDependencies","payloadCheckDependencies","customReactVersionParser","version","mainVersion","preReleases","split","length","date","parts","map","Number","checkedDependencies","process","env","NODE_ENV","PAYLOAD_DISABLE_DEPENDENCY_CHECKER","dependencyGroups","name","dependencies","targetVersionDependency","dependencyVersions","next","required","react","customVersionParser"],"sources":["../../../src/layouts/Root/checkDependencies.ts"],"sourcesContent":["import { type CustomVersionParser, checkDependencies as payloadCheckDependencies } from 'payload'\n\nconst customReactVersionParser: CustomVersionParser = (version) => {\n const [mainVersion, ...preReleases] = version.split('-')\n\n if (preReleases?.length === 3) {\n // Needs different handling, as it's in a format like 19.0.0-rc-06d0b89e-20240801 format\n const date = preReleases[2]\n\n const parts = mainVersion.split('.').map(Number)\n return { parts, preReleases: [date] }\n }\n\n const parts = mainVersion.split('.').map(Number)\n return { parts, preReleases }\n}\n\nlet checkedDependencies = false\n\nexport const checkDependencies = () => {\n if (\n process.env.NODE_ENV !== 'production' &&\n process.env.PAYLOAD_DISABLE_DEPENDENCY_CHECKER !== 'true' &&\n !checkedDependencies\n ) {\n checkedDependencies = true\n\n // First check if there are mismatching dependency versions of next / react packages\n void payloadCheckDependencies({\n dependencyGroups: [\n {\n name: 'react',\n dependencies: ['react', 'react-dom'],\n targetVersionDependency: 'react',\n },\n ],\n dependencyVersions: {\n next: {\n required: false,\n version: '>=15.0.0',\n },\n react: {\n customVersionParser: customReactVersionParser,\n required: false,\n version: '>=19.0.0-rc-65a56d0e-20241020',\n },\n 'react-dom': {\n customVersionParser: customReactVersionParser,\n required: false,\n version: '>=19.0.0-rc-65a56d0e-20241020',\n },\n },\n })\n }\n}\n"],"mappings":"AAAA,SAAmCA,iBAAA,IAAqBC,wBAAwB,QAAQ;AAExF,MAAMC,wBAAA,GAAiDC,OAAA;EACrD,MAAM,CAACC,WAAA,EAAa,GAAGC,WAAA,CAAY,GAAGF,OAAA,CAAQG,KAAK,CAAC;EAEpD,IAAID,WAAA,EAAaE,MAAA,KAAW,GAAG;IAC7B;IACA,MAAMC,IAAA,GAAOH,WAAW,CAAC,EAAE;IAE3B,MAAMI,KAAA,GAAQL,WAAA,CAAYE,KAAK,CAAC,KAAKI,GAAG,CAACC,MAAA;IACzC,OAAO;MAAEF,KAAA;MAAOJ,WAAA,EAAa,CAACG,IAAA;IAAM;EACtC;EAEA,MAAMC,KAAA,GAAQL,WAAA,CAAYE,KAAK,CAAC,KAAKI,GAAG,CAACC,MAAA;EACzC,OAAO;IAAEF,KAAA;IAAOJ;EAAY;AAC9B;AAEA,IAAIO,mBAAA,GAAsB;AAE1B,OAAO,MAAMZ,iBAAA,GAAoBA,CAAA;EAC/B,IACEa,OAAA,CAAQC,GAAG,CAACC,QAAQ,KAAK,gBACzBF,OAAA,CAAQC,GAAG,CAACE,kCAAkC,KAAK,UACnD,CAACJ,mBAAA,EACD;IACAA,mBAAA,GAAsB;IAEtB;IACA,KAAKX,wBAAA,CAAyB;MAC5BgB,gBAAA,EAAkB,CAChB;QACEC,IAAA,EAAM;QACNC,YAAA,EAAc,CAAC,SAAS,YAAY;QACpCC,uBAAA,EAAyB;MAC3B,EACD;MACDC,kBAAA,EAAoB;QAClBC,IAAA,EAAM;UACJC,QAAA,EAAU;UACVpB,OAAA,EAAS;QACX;QACAqB,KAAA,EAAO;UACLC,mBAAA,EAAqBvB,wBAAA;UACrBqB,QAAA,EAAU;UACVpB,OAAA,EAAS;QACX;QACA,aAAa;UACXsB,mBAAA,EAAqBvB,wBAAA;UACrBqB,QAAA,EAAU;UACVpB,OAAA,EAAS;QACX;MACF;IACF;EACF;AACF","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/layouts/Root/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/layouts/Root/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAA;AAO/E,OAAO,KAAK,MAAM,OAAO,CAAA;AASzB,OAAO,8BAA8B,CAAA;AAErC,eAAO,MAAM,QAAQ;;;CAGpB,CAAA;AAED,eAAO,MAAM,UAAU,oEAKpB;IACD,QAAQ,CAAC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;IAClC,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC,eAAe,CAAC,CAAA;IACzC,QAAQ,CAAC,SAAS,EAAE,SAAS,CAAA;IAC7B,QAAQ,CAAC,cAAc,EAAE,oBAAoB,CAAA;CAC9C,+BAsGA,CAAA"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { rtlLanguages } from '@payloadcms/translations';
|
|
3
3
|
import { RootProvider } from '@payloadcms/ui';
|
|
4
|
+
import { getClientConfig } from '@payloadcms/ui/utilities/getClientConfig';
|
|
4
5
|
import { headers as getHeaders, cookies as nextCookies } from 'next/headers.js';
|
|
5
6
|
import { getPayload, parseCookies } from 'payload';
|
|
6
7
|
import React from 'react';
|
|
7
8
|
import { getNavPrefs } from '../../elements/Nav/getNavPrefs.js';
|
|
8
|
-
import { getClientConfig } from '../../utilities/getClientConfig.js';
|
|
9
9
|
import { getRequestLanguage } from '../../utilities/getRequestLanguage.js';
|
|
10
10
|
import { getRequestTheme } from '../../utilities/getRequestTheme.js';
|
|
11
11
|
import { initReq } from '../../utilities/initReq.js';
|
|
@@ -21,7 +21,7 @@ export const RootLayout = async ({
|
|
|
21
21
|
importMap,
|
|
22
22
|
serverFunction
|
|
23
23
|
}) => {
|
|
24
|
-
|
|
24
|
+
checkDependencies();
|
|
25
25
|
const config = await configPromise;
|
|
26
26
|
const headers = await getHeaders();
|
|
27
27
|
const cookies = parseCookies(headers);
|
|
@@ -42,7 +42,6 @@ export const RootLayout = async ({
|
|
|
42
42
|
const {
|
|
43
43
|
i18n,
|
|
44
44
|
permissions,
|
|
45
|
-
req,
|
|
46
45
|
user
|
|
47
46
|
} = await initReq(config);
|
|
48
47
|
const dir = rtlLanguages.includes(languageCode) ? 'RTL' : 'LTR';
|
|
@@ -69,7 +68,7 @@ export const RootLayout = async ({
|
|
|
69
68
|
payload,
|
|
70
69
|
user
|
|
71
70
|
});
|
|
72
|
-
const clientConfig =
|
|
71
|
+
const clientConfig = getClientConfig({
|
|
73
72
|
config,
|
|
74
73
|
i18n,
|
|
75
74
|
importMap
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["rtlLanguages","RootProvider","headers","getHeaders","cookies","nextCookies","getPayload","parseCookies","React","getNavPrefs","
|
|
1
|
+
{"version":3,"file":"index.js","names":["rtlLanguages","RootProvider","getClientConfig","headers","getHeaders","cookies","nextCookies","getPayload","parseCookies","React","getNavPrefs","getRequestLanguage","getRequestTheme","initReq","checkDependencies","NestProviders","metadata","description","title","RootLayout","children","config","configPromise","importMap","serverFunction","languageCode","theme","payload","i18n","permissions","user","dir","includes","languageOptions","Object","entries","supportedLanguages","reduce","acc","language","languageConfig","keys","push","label","translations","general","thisLanguage","value","switchLanguageServerAction","lang","set","name","cookiePrefix","path","navPrefs","clientConfig","_jsxs","_jsx","dateFNSKey","fallbackLang","fallbackLanguage","isNavOpen","open","Array","isArray","admin","components","providers","length","serverProps","id"],"sources":["../../../src/layouts/Root/index.tsx"],"sourcesContent":["import type { AcceptedLanguages } from '@payloadcms/translations'\nimport type { ImportMap, SanitizedConfig, ServerFunctionClient } from 'payload'\n\nimport { rtlLanguages } from '@payloadcms/translations'\nimport { RootProvider } from '@payloadcms/ui'\nimport { getClientConfig } from '@payloadcms/ui/utilities/getClientConfig'\nimport { headers as getHeaders, cookies as nextCookies } from 'next/headers.js'\nimport { getPayload, parseCookies } from 'payload'\nimport React from 'react'\n\nimport { getNavPrefs } from '../../elements/Nav/getNavPrefs.js'\nimport { getRequestLanguage } from '../../utilities/getRequestLanguage.js'\nimport { getRequestTheme } from '../../utilities/getRequestTheme.js'\nimport { initReq } from '../../utilities/initReq.js'\nimport { checkDependencies } from './checkDependencies.js'\nimport { NestProviders } from './NestProviders.js'\n\nimport '@payloadcms/ui/scss/app.scss'\n\nexport const metadata = {\n description: 'Generated by Next.js',\n title: 'Next.js',\n}\n\nexport const RootLayout = async ({\n children,\n config: configPromise,\n importMap,\n serverFunction,\n}: {\n readonly children: React.ReactNode\n readonly config: Promise<SanitizedConfig>\n readonly importMap: ImportMap\n readonly serverFunction: ServerFunctionClient\n}) => {\n checkDependencies()\n\n const config = await configPromise\n\n const headers = await getHeaders()\n const cookies = parseCookies(headers)\n\n const languageCode = getRequestLanguage({\n config,\n cookies,\n headers,\n })\n\n const theme = getRequestTheme({\n config,\n cookies,\n headers,\n })\n\n const payload = await getPayload({ config, importMap })\n\n const { i18n, permissions, user } = await initReq(config)\n\n const dir = (rtlLanguages as unknown as AcceptedLanguages[]).includes(languageCode)\n ? 'RTL'\n : 'LTR'\n\n const languageOptions = Object.entries(config.i18n.supportedLanguages || {}).reduce(\n (acc, [language, languageConfig]) => {\n if (Object.keys(config.i18n.supportedLanguages).includes(language)) {\n acc.push({\n label: languageConfig.translations.general.thisLanguage,\n value: language,\n })\n }\n\n return acc\n },\n [],\n )\n\n async function switchLanguageServerAction(lang: string): Promise<void> {\n 'use server'\n const cookies = await nextCookies()\n cookies.set({\n name: `${config.cookiePrefix || 'payload'}-lng`,\n path: '/',\n value: lang,\n })\n }\n\n const navPrefs = await getNavPrefs({ payload, user })\n\n const clientConfig = getClientConfig({\n config,\n i18n,\n importMap,\n })\n\n return (\n <html data-theme={theme} dir={dir} lang={languageCode}>\n <head>\n <style>{`@layer payload-default, payload;`}</style>\n </head>\n <body>\n <RootProvider\n config={clientConfig}\n dateFNSKey={i18n.dateFNSKey}\n fallbackLang={config.i18n.fallbackLanguage}\n isNavOpen={navPrefs?.open ?? true}\n languageCode={languageCode}\n languageOptions={languageOptions}\n permissions={permissions}\n serverFunction={serverFunction}\n switchLanguageServerAction={switchLanguageServerAction}\n theme={theme}\n translations={i18n.translations}\n user={user}\n >\n {Array.isArray(config.admin?.components?.providers) &&\n config.admin?.components?.providers.length > 0 ? (\n <NestProviders\n importMap={payload.importMap}\n providers={config.admin?.components?.providers}\n serverProps={{\n i18n,\n payload,\n permissions,\n user,\n }}\n >\n {children}\n </NestProviders>\n ) : (\n children\n )}\n </RootProvider>\n <div id=\"portal\" />\n </body>\n </html>\n )\n}\n"],"mappings":";AAGA,SAASA,YAAY,QAAQ;AAC7B,SAASC,YAAY,QAAQ;AAC7B,SAASC,eAAe,QAAQ;AAChC,SAASC,OAAA,IAAWC,UAAU,EAAEC,OAAA,IAAWC,WAAW,QAAQ;AAC9D,SAASC,UAAU,EAAEC,YAAY,QAAQ;AACzC,OAAOC,KAAA,MAAW;AAElB,SAASC,WAAW,QAAQ;AAC5B,SAASC,kBAAkB,QAAQ;AACnC,SAASC,eAAe,QAAQ;AAChC,SAASC,OAAO,QAAQ;AACxB,SAASC,iBAAiB,QAAQ;AAClC,SAASC,aAAa,QAAQ;AAI9B,OAAO,MAAMC,QAAA,GAAW;EACtBC,WAAA,EAAa;EACbC,KAAA,EAAO;AACT;AAEA,OAAO,MAAMC,UAAA,GAAa,MAAAA,CAAO;EAC/BC,QAAQ;EACRC,MAAA,EAAQC,aAAa;EACrBC,SAAS;EACTC;AAAc,CAMf;EACCV,iBAAA;EAEA,MAAMO,MAAA,GAAS,MAAMC,aAAA;EAErB,MAAMnB,OAAA,GAAU,MAAMC,UAAA;EACtB,MAAMC,OAAA,GAAUG,YAAA,CAAaL,OAAA;EAE7B,MAAMsB,YAAA,GAAed,kBAAA,CAAmB;IACtCU,MAAA;IACAhB,OAAA;IACAF;EACF;EAEA,MAAMuB,KAAA,GAAQd,eAAA,CAAgB;IAC5BS,MAAA;IACAhB,OAAA;IACAF;EACF;EAEA,MAAMwB,OAAA,GAAU,MAAMpB,UAAA,CAAW;IAAEc,MAAA;IAAQE;EAAU;EAErD,MAAM;IAAEK,IAAI;IAAEC,WAAW;IAAEC;EAAI,CAAE,GAAG,MAAMjB,OAAA,CA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AAA,EAAWP,QAAA,EAAUQ,IAAA,IAAQ;QAC7BrC,YAAA,EAAcA,YAAA;QACdQ,eAAA,EAAiBA,eAAA;QACjBJ,WAAA,EAAaA,WAAA;QACbL,cAAA,EAAgBA,cAAA;QAChBwB,0BAAA,EAA4BA,0BAAA;QAC5BtB,KAAA,EAAOA,KAAA;QACPkB,YAAA,EAAchB,IAAA,CAAKgB,YAAY;QAC/Bd,IAAA,EAAMA,IAAA;kBAELiC,KAAA,CAAMC,OAAO,CAAC3C,MAAA,CAAO4C,KAAK,EAAEC,UAAA,EAAYC,SAAA,KACzC9C,MAAA,CAAO4C,KAAK,EAAEC,UAAA,EAAYC,SAAA,CAAUC,MAAA,GAAS,iBAC3CX,IAAA,CAAC1C,aAAA;UACCQ,SAAA,EAAWI,OAAA,CAAQJ,SAAS;UAC5B4C,SAAA,EAAW9C,MAAA,CAAO4C,KAAK,EAAEC,UAAA,EAAYC,SAAA;UACrCE,WAAA,EAAa;YACXzC,IAAA;YACAD,OAAA;YACAE,WAAA;YACAC;UACF;oBAECV;aAGHA;uBAGJqC,IAAA,CAAC;QAAIa,EAAA,EAAG;;;;AAIhB","ignoreList":[]}
|
|
@@ -1,10 +1,4 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { ClientConfig, Data, DocumentPreferences, FormState, ImportMap, PayloadRequest, SanitizedConfig } from 'payload';
|
|
3
|
-
export declare const getClientConfig: (args: {
|
|
4
|
-
config: SanitizedConfig;
|
|
5
|
-
i18n: I18nClient;
|
|
6
|
-
importMap: ImportMap;
|
|
7
|
-
}) => ClientConfig;
|
|
1
|
+
import type { Data, DocumentPreferences, FormState, PayloadRequest } from 'payload';
|
|
8
2
|
type RenderDocumentResult = {
|
|
9
3
|
data: any;
|
|
10
4
|
Document: React.ReactNode;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handleServerFunction.d.ts","sourceRoot":"","sources":["../../../src/views/Document/handleServerFunction.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"handleServerFunction.d.ts","sourceRoot":"","sources":["../../../src/views/Document/handleServerFunction.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,mBAAmB,EAAE,SAAS,EAAE,cAAc,EAAmB,MAAM,SAAS,CAAA;AAQpG,KAAK,oBAAoB,GAAG;IAC1B,IAAI,EAAE,GAAG,CAAA;IACT,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;IACzB,WAAW,EAAE,mBAAmB,CAAA;CACjC,CAAA;AAED,eAAO,MAAM,qBAAqB,SAAgB;IAChD,cAAc,EAAE,MAAM,CAAA;IACtB,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB,KAAK,EAAE,MAAM,CAAA;IACb,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,WAAW,CAAC,EAAE,IAAI,CAAA;IAClB,YAAY,CAAC,EAAE,SAAS,CAAA;IACxB,mBAAmB,EAAE,OAAO,CAAA;IAC5B,sBAAsB,EAAE,OAAO,CAAA;IAC/B,GAAG,EAAE,cAAc,CAAA;CACpB,KAAG,OAAO,CAAC,oBAAoB,CA2I/B,CAAA"}
|
|
@@ -1,26 +1,7 @@
|
|
|
1
|
+
import { getClientConfig } from '@payloadcms/ui/utilities/getClientConfig';
|
|
1
2
|
import { headers as getHeaders } from 'next/headers.js';
|
|
2
|
-
import {
|
|
3
|
+
import { getAccessResults, isEntityHidden, parseCookies } from 'payload';
|
|
3
4
|
import { renderDocument } from './index.js';
|
|
4
|
-
let cachedClientConfig = global._payload_clientConfig;
|
|
5
|
-
if (!cachedClientConfig) {
|
|
6
|
-
cachedClientConfig = global._payload_clientConfig = null;
|
|
7
|
-
}
|
|
8
|
-
export const getClientConfig = args => {
|
|
9
|
-
const {
|
|
10
|
-
config,
|
|
11
|
-
i18n,
|
|
12
|
-
importMap
|
|
13
|
-
} = args;
|
|
14
|
-
if (cachedClientConfig && process.env.NODE_ENV !== 'development') {
|
|
15
|
-
return cachedClientConfig;
|
|
16
|
-
}
|
|
17
|
-
cachedClientConfig = createClientConfig({
|
|
18
|
-
config,
|
|
19
|
-
i18n,
|
|
20
|
-
importMap
|
|
21
|
-
});
|
|
22
|
-
return cachedClientConfig;
|
|
23
|
-
};
|
|
24
5
|
export const renderDocumentHandler = async args => {
|
|
25
6
|
const {
|
|
26
7
|
collectionSlug,
|
|
@@ -136,7 +117,7 @@ export const renderDocumentHandler = async args => {
|
|
|
136
117
|
collectionConfig: payload.config.collections.find(collection => collection.slug === collectionSlug),
|
|
137
118
|
cookies,
|
|
138
119
|
docID,
|
|
139
|
-
globalConfig: payload.config.globals.find(
|
|
120
|
+
globalConfig: payload.config.globals.find(global => global.slug === collectionSlug),
|
|
140
121
|
languageOptions: undefined,
|
|
141
122
|
permissions,
|
|
142
123
|
req,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handleServerFunction.js","names":["
|
|
1
|
+
{"version":3,"file":"handleServerFunction.js","names":["getClientConfig","headers","getHeaders","getAccessResults","isEntityHidden","parseCookies","renderDocument","renderDocumentHandler","args","collectionSlug","disableActions","docID","drawerSlug","initialData","redirectAfterDelete","redirectAfterDuplicate","req","i18n","payload","config","user","cookies","incomingUserSlug","collection","adminUserSlug","admin","adminAccessFunction","collections","access","canAccessAdmin","Error","hasUsers","find","depth","limit","pagination","docs","length","clientConfig","importMap","preferences","preferencesKey","where","and","key","equals","id","then","res","value","visibleEntities","map","slug","hidden","filter","Boolean","globals","permissions","data","Document","initPageResult","collectionConfig","globalConfig","global","languageOptions","undefined","translations","params","segments","searchParams"],"sources":["../../../src/views/Document/handleServerFunction.tsx"],"sourcesContent":["import type { Data, DocumentPreferences, FormState, PayloadRequest, VisibleEntities } from 'payload'\n\nimport { getClientConfig } from '@payloadcms/ui/utilities/getClientConfig'\nimport { headers as getHeaders } from 'next/headers.js'\nimport { getAccessResults, isEntityHidden, parseCookies } from 'payload'\n\nimport { renderDocument } from './index.js'\n\ntype RenderDocumentResult = {\n data: any\n Document: React.ReactNode\n preferences: DocumentPreferences\n}\n\nexport const renderDocumentHandler = async (args: {\n collectionSlug: string\n disableActions?: boolean\n docID: string\n drawerSlug?: string\n initialData?: Data\n initialState?: FormState\n redirectAfterDelete: boolean\n redirectAfterDuplicate: boolean\n req: PayloadRequest\n}): Promise<RenderDocumentResult> => {\n const {\n collectionSlug,\n disableActions,\n docID,\n drawerSlug,\n initialData,\n redirectAfterDelete,\n redirectAfterDuplicate,\n req,\n req: {\n i18n,\n payload,\n payload: { config },\n user,\n },\n } = args\n\n const headers = await getHeaders()\n\n const cookies = parseCookies(headers)\n\n const incomingUserSlug = user?.collection\n\n const adminUserSlug = config.admin.user\n\n // If we have a user slug, test it against the functions\n if (incomingUserSlug) {\n const adminAccessFunction = payload.collections[incomingUserSlug].config.access?.admin\n\n // Run the admin access function from the config if it exists\n if (adminAccessFunction) {\n const canAccessAdmin = await adminAccessFunction({ req })\n\n if (!canAccessAdmin) {\n throw new Error('Unauthorized')\n }\n // Match the user collection to the global admin config\n } else if (adminUserSlug !== incomingUserSlug) {\n throw new Error('Unauthorized')\n }\n } else {\n const hasUsers = await payload.find({\n collection: adminUserSlug,\n depth: 0,\n limit: 1,\n pagination: false,\n })\n\n // If there are users, we should not allow access because of /create-first-user\n if (hasUsers.docs.length) {\n throw new Error('Unauthorized')\n }\n }\n\n const clientConfig = getClientConfig({\n config,\n i18n,\n importMap: req.payload.importMap,\n })\n\n let preferences: DocumentPreferences\n\n if (docID) {\n const preferencesKey = `${collectionSlug}-edit-${docID}`\n\n preferences = await payload\n .find({\n collection: 'payload-preferences',\n depth: 0,\n limit: 1,\n where: {\n and: [\n {\n key: {\n equals: preferencesKey,\n },\n },\n {\n 'user.relationTo': {\n equals: user.collection,\n },\n },\n {\n 'user.value': {\n equals: user.id,\n },\n },\n ],\n },\n })\n .then((res) => res.docs[0]?.value as DocumentPreferences)\n }\n\n const visibleEntities: VisibleEntities = {\n collections: payload.config.collections\n .map(({ slug, admin: { hidden } }) => (!isEntityHidden({ hidden, user }) ? slug : null))\n .filter(Boolean),\n globals: payload.config.globals\n .map(({ slug, admin: { hidden } }) => (!isEntityHidden({ hidden, user }) ? slug : null))\n .filter(Boolean),\n }\n\n const permissions = await getAccessResults({\n req,\n })\n\n const { data, Document } = await renderDocument({\n clientConfig,\n disableActions,\n drawerSlug,\n importMap: payload.importMap,\n initialData,\n initPageResult: {\n collectionConfig: payload.config.collections.find(\n (collection) => collection.slug === collectionSlug,\n ),\n cookies,\n docID,\n globalConfig: payload.config.globals.find((global) => global.slug === collectionSlug),\n languageOptions: undefined, // TODO\n permissions,\n req,\n translations: undefined, // TODO\n visibleEntities,\n },\n params: {\n segments: ['collections', collectionSlug, docID],\n },\n redirectAfterDelete,\n redirectAfterDuplicate,\n searchParams: {},\n })\n\n return {\n data,\n Document,\n preferences,\n }\n}\n"],"mappings":"AAEA,SAASA,eAAe,QAAQ;AAChC,SAASC,OAAA,IAAWC,UAAU,QAAQ;AACtC,SAASC,gBAAgB,EAAEC,cAAc,EAAEC,YAAY,QAAQ;AAE/D,SAASC,cAAc,QAAQ;AAQ/B,OAAO,MAAMC,qBAAA,GAAwB,MAAOC,IAAA;EAW1C,MAAM;IACJC,cAAc;IACdC,cAAc;IACdC,KAAK;IACLC,UAAU;IACVC,WAAW;IACXC,mBAAmB;IACnBC,sBAAsB;IACtBC,GAAG;IACHA,GAAA,EAAK;MACHC,IAAI;MACJC,OAAO;MACPA,OAAA,EAAS;QAAEC;MAAM,CAAE;MACnBC;IAAI;EACL,CACF,GAAGZ,IAAA;EAEJ,MAAMP,OAAA,GAAU,MAAMC,UAAA;EAEtB,MAAMmB,OAAA,GAAUhB,YAAA,CAAaJ,OAAA;EAE7B,MAAMqB,gBAAA,GAAmBF,IAAA,EAAMG,UAAA;EAE/B,MAAMC,aAAA,GAAgBL,MAAA,CAAOM,KAAK,CAACL,IAAI;EAEvC;EACA,IAAIE,gBAAA,EAAkB;IACpB,MAAMI,mBAAA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IACAC,sBAAA;IACAsD,YAAA,EAAc,CAAC;EACjB;EAEA,OAAO;IACLX,IAAA;IACAC,QAAA;IACAnB;EACF;AACF","ignoreList":[]}
|
|
@@ -1,11 +1,5 @@
|
|
|
1
|
-
import type { I18nClient } from '@payloadcms/translations';
|
|
2
1
|
import type { ListPreferences } from '@payloadcms/ui';
|
|
3
|
-
import type {
|
|
4
|
-
export declare const getClientConfig: (args: {
|
|
5
|
-
config: SanitizedConfig;
|
|
6
|
-
i18n: I18nClient;
|
|
7
|
-
importMap: ImportMap;
|
|
8
|
-
}) => ClientConfig;
|
|
2
|
+
import type { ListQuery, PayloadRequest } from 'payload';
|
|
9
3
|
type RenderListResult = {
|
|
10
4
|
List: React.ReactNode;
|
|
11
5
|
preferences: ListPreferences;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handleServerFunction.d.ts","sourceRoot":"","sources":["../../../src/views/List/handleServerFunction.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"handleServerFunction.d.ts","sourceRoot":"","sources":["../../../src/views/List/handleServerFunction.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAA;AACrD,OAAO,KAAK,EAAE,SAAS,EAAE,cAAc,EAAmB,MAAM,SAAS,CAAA;AAQzE,KAAK,gBAAgB,GAAG;IACtB,IAAI,EAAE,KAAK,CAAC,SAAS,CAAA;IACrB,WAAW,EAAE,eAAe,CAAA;CAC7B,CAAA;AAED,eAAO,MAAM,iBAAiB,SAAgB;IAC5C,cAAc,EAAE,MAAM,CAAA;IACtB,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB,iBAAiB,CAAC,EAAE,OAAO,CAAA;IAC3B,eAAe,CAAC,EAAE,OAAO,CAAA;IACzB,kBAAkB,EAAE,MAAM,CAAA;IAC1B,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,mBAAmB,EAAE,OAAO,CAAA;IAC5B,KAAK,EAAE,SAAS,CAAA;IAChB,mBAAmB,EAAE,OAAO,CAAA;IAC5B,sBAAsB,EAAE,OAAO,CAAA;IAC/B,GAAG,EAAE,cAAc,CAAA;CACpB,KAAG,OAAO,CAAC,gBAAgB,CA0I3B,CAAA"}
|
|
@@ -1,26 +1,7 @@
|
|
|
1
|
+
import { getClientConfig } from '@payloadcms/ui/utilities/getClientConfig';
|
|
1
2
|
import { headers as getHeaders } from 'next/headers.js';
|
|
2
|
-
import {
|
|
3
|
+
import { getAccessResults, isEntityHidden, parseCookies } from 'payload';
|
|
3
4
|
import { renderListView } from './index.js';
|
|
4
|
-
let cachedClientConfig = global._payload_clientConfig;
|
|
5
|
-
if (!cachedClientConfig) {
|
|
6
|
-
cachedClientConfig = global._payload_clientConfig = null;
|
|
7
|
-
}
|
|
8
|
-
export const getClientConfig = args => {
|
|
9
|
-
const {
|
|
10
|
-
config,
|
|
11
|
-
i18n,
|
|
12
|
-
importMap
|
|
13
|
-
} = args;
|
|
14
|
-
if (cachedClientConfig && process.env.NODE_ENV !== 'development') {
|
|
15
|
-
return cachedClientConfig;
|
|
16
|
-
}
|
|
17
|
-
cachedClientConfig = createClientConfig({
|
|
18
|
-
config,
|
|
19
|
-
i18n,
|
|
20
|
-
importMap
|
|
21
|
-
});
|
|
22
|
-
return cachedClientConfig;
|
|
23
|
-
};
|
|
24
5
|
export const renderListHandler = async args => {
|
|
25
6
|
const {
|
|
26
7
|
collectionSlug,
|
|
@@ -135,7 +116,7 @@ export const renderListHandler = async args => {
|
|
|
135
116
|
initPageResult: {
|
|
136
117
|
collectionConfig: payload.config.collections.find(collection => collection.slug === collectionSlug),
|
|
137
118
|
cookies,
|
|
138
|
-
globalConfig: payload.config.globals.find(
|
|
119
|
+
globalConfig: payload.config.globals.find(global => global.slug === collectionSlug),
|
|
139
120
|
languageOptions: undefined,
|
|
140
121
|
permissions,
|
|
141
122
|
req,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handleServerFunction.js","names":["
|
|
1
|
+
{"version":3,"file":"handleServerFunction.js","names":["getClientConfig","headers","getHeaders","getAccessResults","isEntityHidden","parseCookies","renderListView","renderListHandler","args","collectionSlug","disableActions","disableBulkDelete","disableBulkEdit","drawerSlug","enableRowSelections","query","redirectAfterDelete","redirectAfterDuplicate","req","i18n","payload","config","user","cookies","incomingUserSlug","collection","adminUserSlug","admin","adminAccessFunction","collections","access","canAccessAdmin","Error","hasUsers","find","depth","limit","pagination","docs","length","clientConfig","importMap","preferencesKey","preferences","where","and","key","equals","id","then","res","value","visibleEntities","map","slug","hidden","filter","Boolean","globals","permissions","List","initPageResult","collectionConfig","globalConfig","global","languageOptions","undefined","translations","params","segments","searchParams"],"sources":["../../../src/views/List/handleServerFunction.tsx"],"sourcesContent":["import type { ListPreferences } from '@payloadcms/ui'\nimport type { ListQuery, PayloadRequest, VisibleEntities } from 'payload'\n\nimport { getClientConfig } from '@payloadcms/ui/utilities/getClientConfig'\nimport { headers as getHeaders } from 'next/headers.js'\nimport { getAccessResults, isEntityHidden, parseCookies } from 'payload'\n\nimport { renderListView } from './index.js'\n\ntype RenderListResult = {\n List: React.ReactNode\n preferences: ListPreferences\n}\n\nexport const renderListHandler = async (args: {\n collectionSlug: string\n disableActions?: boolean\n disableBulkDelete?: boolean\n disableBulkEdit?: boolean\n documentDrawerSlug: string\n drawerSlug?: string\n enableRowSelections: boolean\n query: ListQuery\n redirectAfterDelete: boolean\n redirectAfterDuplicate: boolean\n req: PayloadRequest\n}): Promise<RenderListResult> => {\n const {\n collectionSlug,\n disableActions,\n disableBulkDelete,\n disableBulkEdit,\n drawerSlug,\n enableRowSelections,\n query,\n redirectAfterDelete,\n redirectAfterDuplicate,\n req,\n req: {\n i18n,\n payload,\n payload: { config },\n user,\n },\n } = args\n\n const headers = await getHeaders()\n\n const cookies = parseCookies(headers)\n\n const incomingUserSlug = user?.collection\n\n const adminUserSlug = config.admin.user\n\n // If we have a user slug, test it against the functions\n if (incomingUserSlug) {\n const adminAccessFunction = payload.collections[incomingUserSlug].config.access?.admin\n\n // Run the admin access function from the config if it exists\n if (adminAccessFunction) {\n const canAccessAdmin = await adminAccessFunction({ req })\n\n if (!canAccessAdmin) {\n throw new Error('Unauthorized')\n }\n // Match the user collection to the global admin config\n } else if (adminUserSlug !== incomingUserSlug) {\n throw new Error('Unauthorized')\n }\n } else {\n const hasUsers = await payload.find({\n collection: adminUserSlug,\n depth: 0,\n limit: 1,\n pagination: false,\n })\n\n // If there are users, we should not allow access because of /create-first-user\n if (hasUsers.docs.length) {\n throw new Error('Unauthorized')\n }\n }\n\n const clientConfig = getClientConfig({\n config,\n i18n,\n importMap: payload.importMap,\n })\n\n const preferencesKey = `${collectionSlug}-list`\n\n const preferences = await payload\n .find({\n collection: 'payload-preferences',\n depth: 0,\n limit: 1,\n where: {\n and: [\n {\n key: {\n equals: preferencesKey,\n },\n },\n {\n 'user.relationTo': {\n equals: user.collection,\n },\n },\n {\n 'user.value': {\n equals: user.id,\n },\n },\n ],\n },\n })\n .then((res) => res.docs[0]?.value as ListPreferences)\n\n const visibleEntities: VisibleEntities = {\n collections: payload.config.collections\n .map(({ slug, admin: { hidden } }) => (!isEntityHidden({ hidden, user }) ? slug : null))\n .filter(Boolean),\n globals: payload.config.globals\n .map(({ slug, admin: { hidden } }) => (!isEntityHidden({ hidden, user }) ? slug : null))\n .filter(Boolean),\n }\n\n const permissions = await getAccessResults({\n req,\n })\n\n const { List } = await renderListView({\n clientConfig,\n disableActions,\n disableBulkDelete,\n disableBulkEdit,\n drawerSlug,\n enableRowSelections,\n importMap: payload.importMap,\n initPageResult: {\n collectionConfig: payload.config.collections.find(\n (collection) => collection.slug === collectionSlug,\n ),\n cookies,\n globalConfig: payload.config.globals.find((global) => global.slug === collectionSlug),\n languageOptions: undefined, // TODO\n permissions,\n req,\n translations: undefined, // TODO\n visibleEntities,\n },\n params: {\n segments: ['collections', collectionSlug],\n },\n query,\n redirectAfterDelete,\n redirectAfterDuplicate,\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c,MAAMxD,gBAAA,CAAiB;IACzCe;EACF;EAEA,MAAM;IAAE0C;EAAI,CAAE,GAAG,MAAMtD,cAAA,CAAe;IACpCkC,YAAA;IACA9B,cAAA;IACAC,iBAAA;IACAC,eAAA;IACAC,UAAA;IACAC,mBAAA;IACA2B,SAAA,EAAWrB,OAAA,CAAQqB,SAAS;IAC5BoB,cAAA,EAAgB;MACdC,gBAAA,EAAkB1C,OAAA,CAAQC,MAAM,CAACQ,WAAW,CAACK,IAAI,CAC9CT,UAAA,IAAeA,UAAA,CAAW6B,IAAI,KAAK7C,cAAA;MAEtCc,OAAA;MACAwC,YAAA,EAAc3C,OAAA,CAAQC,MAAM,CAACqC,OAAO,CAACxB,IAAI,CAAE8B,MAAA,IAAWA,MAAA,CAAOV,IAAI,KAAK7C,cAAA;MACtEwD,eAAA,EAAiBC,SAAA;MACjBP,WAAA;MACAzC,GAAA;MACAiD,YAAA,EAAcD,SAAA;MACdd;IACF;IACAgB,MAAA,EAAQ;MACNC,QAAA,EAAU,CAAC,eAAe5D,cAAA;IAC5B;IACAM,KAAA;IACAC,mBAAA;IACAC,sBAAA;IACAqD,YAAA,EAAc,CAAC;EACjB;EAEA,OAAO;IACLV,IAAA;IACAjB;EACF;AACF","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/views/Root/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAA;AAC1D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,MAAM,CAAA;AACpC,OAAO,KAAK,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/views/Root/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAA;AAC1D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,MAAM,CAAA;AACpC,OAAO,KAAK,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAMzD,OAAO,KAAmB,MAAM,OAAO,CAAA;AAOvC,OAAO,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAA;AAEhD,MAAM,MAAM,oBAAoB,GAAG,CAAC,IAAI,EAAE;IACxC,MAAM,EAAE,eAAe,CAAA;IACvB,IAAI,EAAE,UAAU,CAAA;IAChB,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,MAAM,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,EAAE,CAAA;KAAE,CAAA;CAC9C,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAA;AAEvB,eAAO,MAAM,QAAQ,oGAKlB;IACD,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC,eAAe,CAAC,CAAA;IACzC,QAAQ,CAAC,SAAS,EAAE,SAAS,CAAA;IAC7B,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;QACvB,QAAQ,EAAE,MAAM,EAAE,CAAA;KACnB,CAAC,CAAA;IACF,QAAQ,CAAC,YAAY,EAAE,OAAO,CAAC;QAC7B,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,EAAE,CAAA;KACjC,CAAC,CAAA;CACH,+BAkIA,CAAA"}
|
package/dist/views/Root/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { RenderServerComponent } from '@payloadcms/ui/elements/RenderServerComponent';
|
|
3
3
|
import { formatAdminURL } from '@payloadcms/ui/shared';
|
|
4
|
+
import { getClientConfig } from '@payloadcms/ui/utilities/getClientConfig';
|
|
4
5
|
import { notFound, redirect } from 'next/navigation.js';
|
|
5
6
|
import React, { Fragment } from 'react';
|
|
6
7
|
import { DefaultTemplate } from '../../templates/Default/index.js';
|
|
7
8
|
import { MinimalTemplate } from '../../templates/Minimal/index.js';
|
|
8
|
-
import { getClientConfig } from '../../utilities/getClientConfig.js';
|
|
9
9
|
import { initPage } from '../../utilities/initPage/index.js';
|
|
10
10
|
import { getViewFromConfig } from './getViewFromConfig.js';
|
|
11
11
|
export { generatePageMetadata } from './meta.js';
|
|
@@ -86,7 +86,7 @@ export const RootPage = async ({
|
|
|
86
86
|
if (!DefaultView?.Component && !DefaultView?.payloadComponent && !dbHasUser) {
|
|
87
87
|
redirect(adminRoute);
|
|
88
88
|
}
|
|
89
|
-
const clientConfig =
|
|
89
|
+
const clientConfig = getClientConfig({
|
|
90
90
|
config,
|
|
91
91
|
i18n: initPageResult?.req.i18n,
|
|
92
92
|
importMap
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["RenderServerComponent","formatAdminURL","notFound","redirect","React","Fragment","DefaultTemplate","MinimalTemplate","
|
|
1
|
+
{"version":3,"file":"index.js","names":["RenderServerComponent","formatAdminURL","getClientConfig","notFound","redirect","React","Fragment","DefaultTemplate","MinimalTemplate","initPage","getViewFromConfig","generatePageMetadata","RootPage","config","configPromise","importMap","params","paramsPromise","searchParams","searchParamsPromise","admin","routes","createFirstUser","_createFirstUserRoute","user","userSlug","adminRoute","currentRoute","path","Array","isArray","segments","join","DefaultView","initPageOptions","serverProps","templateClassName","templateType","initPageResult","dbHasUser","req","payload","db","findOne","collection","then","doc","Component","payloadComponent","redirectTo","createFirstUserRoute","collectionConfig","collections","find","slug","disableLocalStrategy","auth","clientConfig","i18n","RenderedView","clientProps","Fallback","_jsxs","_jsx","className","locale","permissions","viewActions","visibleEntities","globals"],"sources":["../../../src/views/Root/index.tsx"],"sourcesContent":["import type { I18nClient } from '@payloadcms/translations'\nimport type { Metadata } from 'next'\nimport type { ImportMap, SanitizedConfig } from 'payload'\n\nimport { RenderServerComponent } from '@payloadcms/ui/elements/RenderServerComponent'\nimport { formatAdminURL } from '@payloadcms/ui/shared'\nimport { getClientConfig } from '@payloadcms/ui/utilities/getClientConfig'\nimport { notFound, redirect } from 'next/navigation.js'\nimport React, { Fragment } from 'react'\n\nimport { DefaultTemplate } from '../../templates/Default/index.js'\nimport { MinimalTemplate } from '../../templates/Minimal/index.js'\nimport { initPage } from '../../utilities/initPage/index.js'\nimport { getViewFromConfig } from './getViewFromConfig.js'\n\nexport { generatePageMetadata } from './meta.js'\n\nexport type GenerateViewMetadata = (args: {\n config: SanitizedConfig\n i18n: I18nClient\n isEditing?: boolean\n params?: { [key: string]: string | string[] }\n}) => Promise<Metadata>\n\nexport const RootPage = async ({\n config: configPromise,\n importMap,\n params: paramsPromise,\n searchParams: searchParamsPromise,\n}: {\n readonly config: Promise<SanitizedConfig>\n readonly importMap: ImportMap\n readonly params: Promise<{\n segments: string[]\n }>\n readonly searchParams: Promise<{\n [key: string]: string | string[]\n }>\n}) => {\n const config = await configPromise\n\n const {\n admin: {\n routes: { createFirstUser: _createFirstUserRoute },\n user: userSlug,\n },\n routes: { admin: adminRoute },\n } = config\n\n const params = await paramsPromise\n const currentRoute = formatAdminURL({\n adminRoute,\n path: `${Array.isArray(params.segments) ? `/${params.segments.join('/')}` : ''}`,\n })\n\n const segments = Array.isArray(params.segments) ? params.segments : []\n\n const searchParams = await searchParamsPromise\n\n const { DefaultView, initPageOptions, serverProps, templateClassName, templateType } =\n getViewFromConfig({\n adminRoute,\n config,\n currentRoute,\n importMap,\n searchParams,\n segments,\n })\n\n const initPageResult = await initPage(initPageOptions)\n\n const dbHasUser =\n initPageResult.req.user ||\n (await initPageResult?.req.payload.db\n .findOne({\n collection: userSlug,\n req: initPageResult?.req,\n })\n ?.then((doc) => !!doc))\n\n if (!DefaultView?.Component && !DefaultView?.payloadComponent) {\n if (initPageResult?.req?.user) {\n notFound()\n }\n\n if (dbHasUser) {\n redirect(adminRoute)\n }\n }\n\n if (typeof initPageResult?.redirectTo === 'string') {\n redirect(initPageResult.redirectTo)\n }\n\n if (initPageResult) {\n const createFirstUserRoute = formatAdminURL({ adminRoute, path: _createFirstUserRoute })\n\n const collectionConfig = config.collections.find(({ slug }) => slug === userSlug)\n const disableLocalStrategy = collectionConfig?.auth?.disableLocalStrategy\n\n if (disableLocalStrategy && currentRoute === createFirstUserRoute) {\n redirect(adminRoute)\n }\n\n if (!dbHasUser && currentRoute !== createFirstUserRoute && !disableLocalStrategy) {\n redirect(createFirstUserRoute)\n }\n\n if (dbHasUser && currentRoute === createFirstUserRoute) {\n redirect(adminRoute)\n }\n }\n\n if (!DefaultView?.Component && !DefaultView?.payloadComponent && !dbHasUser) {\n redirect(adminRoute)\n }\n\n const clientConfig = getClientConfig({\n config,\n i18n: initPageResult?.req.i18n,\n importMap,\n })\n\n const RenderedView = RenderServerComponent({\n clientProps: { clientConfig },\n Component: DefaultView.payloadComponent,\n Fallback: DefaultView.Component,\n importMap,\n serverProps: {\n ...serverProps,\n clientConfig,\n i18n: initPageResult?.req.i18n,\n importMap,\n initPageResult,\n params,\n payload: initPageResult?.req.payload,\n searchParams,\n },\n })\n\n return (\n <Fragment>\n {!templateType && <Fragment>{RenderedView}</Fragment>}\n {templateType === 'minimal' && (\n <MinimalTemplate className={templateClassName}>{RenderedView}</MinimalTemplate>\n )}\n {templateType === 'default' && (\n <DefaultTemplate\n i18n={initPageResult?.req.i18n}\n locale={initPageResult?.locale}\n params={params}\n payload={initPageResult?.req.payload}\n permissions={initPageResult?.permissions}\n searchParams={searchParams}\n user={initPageResult?.req.user}\n viewActions={serverProps.viewActions}\n visibleEntities={{\n // The reason we are not passing in initPageResult.visibleEntities directly is due to a \"Cannot assign to read only property of object '#<Object>\" error introduced in React 19\n // which this caused as soon as initPageResult.visibleEntities is passed in\n collections: initPageResult?.visibleEntities?.collections,\n globals: initPageResult?.visibleEntities?.globals,\n }}\n >\n {RenderedView}\n </DefaultTemplate>\n )}\n </Fragment>\n )\n}\n"],"mappings":";AAIA,SAASA,qBAAqB,QAAQ;AACtC,SAASC,cAAc,QAAQ;AAC/B,SAASC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AAA,EAAgB8B,eAAA,EAAiBhB,WAAA;QAC9CiB,OAAA,EAAS/B,cAAA,EAAgB8B,eAAA,EAAiBC;MAC5C;gBAECV;;;AAKX","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@payloadcms/next",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.1-canary.c40ff01",
|
|
4
4
|
"homepage": "https://payloadcms.com",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -79,9 +79,9 @@
|
|
|
79
79
|
"sass": "1.77.4",
|
|
80
80
|
"sonner": "^1.5.0",
|
|
81
81
|
"uuid": "10.0.0",
|
|
82
|
-
"@payloadcms/
|
|
83
|
-
"@payloadcms/
|
|
84
|
-
"@payloadcms/ui": "3.1.
|
|
82
|
+
"@payloadcms/graphql": "3.1.1-canary.c40ff01",
|
|
83
|
+
"@payloadcms/translations": "3.1.1-canary.c40ff01",
|
|
84
|
+
"@payloadcms/ui": "3.1.1-canary.c40ff01"
|
|
85
85
|
},
|
|
86
86
|
"devDependencies": {
|
|
87
87
|
"@babel/cli": "^7.24.5",
|
|
@@ -99,13 +99,13 @@
|
|
|
99
99
|
"esbuild-sass-plugin": "3.3.1",
|
|
100
100
|
"eslint-plugin-react-compiler": "19.0.0-beta-a7bf2bd-20241110",
|
|
101
101
|
"swc-plugin-transform-remove-imports": "1.15.0",
|
|
102
|
-
"
|
|
103
|
-
"
|
|
102
|
+
"@payloadcms/eslint-config": "3.0.0",
|
|
103
|
+
"payload": "3.1.1-canary.c40ff01"
|
|
104
104
|
},
|
|
105
105
|
"peerDependencies": {
|
|
106
106
|
"graphql": "^16.8.1",
|
|
107
107
|
"next": "^15.0.0",
|
|
108
|
-
"payload": "3.1.
|
|
108
|
+
"payload": "3.1.1-canary.c40ff01"
|
|
109
109
|
},
|
|
110
110
|
"engines": {
|
|
111
111
|
"node": "^18.20.2 || >=20.9.0"
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { I18nClient } from '@payloadcms/translations';
|
|
2
|
-
import type { ClientConfig, ImportMap, SanitizedConfig } from 'payload';
|
|
3
|
-
export declare const getClientConfig: (args: {
|
|
4
|
-
config: SanitizedConfig;
|
|
5
|
-
i18n: I18nClient;
|
|
6
|
-
importMap: ImportMap;
|
|
7
|
-
}) => Promise<ClientConfig>;
|
|
8
|
-
//# sourceMappingURL=getClientConfig.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getClientConfig.d.ts","sourceRoot":"","sources":["../../src/utilities/getClientConfig.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAA;AAC1D,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAKvE,eAAO,MAAM,eAAe,SACb;IACX,MAAM,EAAE,eAAe,CAAA;IACvB,IAAI,EAAE,UAAU,CAAA;IAChB,SAAS,EAAE,SAAS,CAAA;CACrB,KAAG,OAAO,CAAC,YAAY,CAWzB,CAAA"}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { createClientConfig } from 'payload';
|
|
2
|
-
import { cache } from 'react';
|
|
3
|
-
export const getClientConfig = cache(async args => {
|
|
4
|
-
const {
|
|
5
|
-
config,
|
|
6
|
-
i18n,
|
|
7
|
-
importMap
|
|
8
|
-
} = args;
|
|
9
|
-
const clientConfig = createClientConfig({
|
|
10
|
-
config,
|
|
11
|
-
i18n,
|
|
12
|
-
importMap
|
|
13
|
-
});
|
|
14
|
-
return Promise.resolve(clientConfig);
|
|
15
|
-
});
|
|
16
|
-
//# sourceMappingURL=getClientConfig.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getClientConfig.js","names":["createClientConfig","cache","getClientConfig","args","config","i18n","importMap","clientConfig","Promise","resolve"],"sources":["../../src/utilities/getClientConfig.ts"],"sourcesContent":["import type { I18nClient } from '@payloadcms/translations'\nimport type { ClientConfig, ImportMap, SanitizedConfig } from 'payload'\n\nimport { createClientConfig } from 'payload'\nimport { cache } from 'react'\n\nexport const getClientConfig = cache(\n async (args: {\n config: SanitizedConfig\n i18n: I18nClient\n importMap: ImportMap\n }): Promise<ClientConfig> => {\n const { config, i18n, importMap } = args\n\n const clientConfig = createClientConfig({\n config,\n i18n,\n importMap,\n })\n\n return Promise.resolve(clientConfig)\n },\n)\n"],"mappings":"AAGA,SAASA,kBAAkB,QAAQ;AACnC,SAASC,KAAK,QAAQ;AAEtB,OAAO,MAAMC,eAAA,GAAkBD,KAAA,CAC7B,MAAOE,IAAA;EAKL,MAAM;IAAEC,MAAM;IAAEC,IAAI;IAAEC;EAAS,CAAE,GAAGH,IAAA;EAEpC,MAAMI,YAAA,GAAeP,kBAAA,CAAmB;IACtCI,MAAA;IACAC,IAAA;IACAC;EACF;EAEA,OAAOE,OAAA,CAAQC,OAAO,CAACF,YAAA;AACzB","ignoreList":[]}
|