@payloadcms/next 3.0.0-beta.46 → 3.0.0-beta.48
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/prod/styles.css +1 -1
- package/dist/routes/rest/auth/refresh.d.ts.map +1 -1
- package/dist/routes/rest/auth/refresh.js +1 -2
- package/dist/routes/rest/auth/refresh.js.map +1 -1
- package/dist/routes/rest/index.d.ts.map +1 -1
- package/dist/routes/rest/index.js +8 -0
- package/dist/routes/rest/index.js.map +1 -1
- package/dist/utilities/createPayloadRequest.d.ts.map +1 -1
- package/dist/utilities/createPayloadRequest.js +9 -7
- package/dist/utilities/createPayloadRequest.js.map +1 -1
- package/dist/utilities/initPage/index.d.ts.map +1 -1
- package/dist/utilities/initPage/index.js +38 -5
- package/dist/utilities/initPage/index.js.map +1 -1
- package/dist/utilities/initPage/shared.d.ts.map +1 -1
- package/dist/utilities/initPage/shared.js +2 -1
- package/dist/utilities/initPage/shared.js.map +1 -1
- package/dist/utilities/meta.d.ts.map +1 -1
- package/dist/utilities/meta.js +1 -2
- package/dist/utilities/meta.js.map +1 -1
- package/dist/views/API/LocaleSelector/index.js.map +1 -1
- package/dist/views/Account/Settings/LanguageSelector.d.ts.map +1 -1
- package/dist/views/Account/Settings/LanguageSelector.js +3 -2
- package/dist/views/Account/Settings/LanguageSelector.js.map +1 -1
- package/dist/views/Account/index.js +1 -1
- package/dist/views/Account/index.js.map +1 -1
- package/dist/views/Document/getDocumentData.js +1 -1
- package/dist/views/Document/getDocumentData.js.map +1 -1
- package/dist/views/Document/index.d.ts.map +1 -1
- package/dist/views/Document/index.js +18 -5
- package/dist/views/Document/index.js.map +1 -1
- package/dist/views/ForgotPassword/ForgotPasswordForm/index.d.ts.map +1 -1
- package/dist/views/ForgotPassword/ForgotPasswordForm/index.js +4 -4
- package/dist/views/ForgotPassword/ForgotPasswordForm/index.js.map +1 -1
- package/dist/views/Root/getViewFromConfig.js.map +1 -1
- package/dist/views/Version/Default/types.d.ts +1 -2
- package/dist/views/Version/Default/types.d.ts.map +1 -1
- package/dist/views/Version/Default/types.js.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/fields/index.d.ts +2 -2
- package/package.json +7 -7
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/views/Account/index.tsx"],"sourcesContent":["import type { ServerSideEditViewProps } from 'payload/types'\nimport type { AdminViewProps } from 'payload/types'\n\nimport { DocumentHeader } from '@payloadcms/ui/elements/DocumentHeader'\nimport { HydrateClientUser } from '@payloadcms/ui/elements/HydrateClientUser'\nimport { RenderCustomComponent } from '@payloadcms/ui/elements/RenderCustomComponent'\nimport { DocumentInfoProvider } from '@payloadcms/ui/providers/DocumentInfo'\nimport { FormQueryParamsProvider } from '@payloadcms/ui/providers/FormQueryParams'\nimport { notFound } from 'next/navigation.js'\nimport React from 'react'\n\nimport { getDocumentData } from '../Document/getDocumentData.js'\nimport { getDocumentPermissions } from '../Document/getDocumentPermissions.js'\nimport { EditView } from '../Edit/index.js'\nimport { Settings } from './Settings/index.js'\n\nexport { generateAccountMetadata } from './meta.js'\n\nexport const Account: React.FC<AdminViewProps> = async ({\n initPageResult,\n params,\n searchParams,\n}) => {\n const {\n languageOptions,\n locale,\n permissions,\n req,\n req: {\n i18n,\n payload,\n payload: { config },\n user,\n },\n } = initPageResult\n\n const {\n admin: { components: { views: { Account: CustomAccountComponent } = {} } = {}, user: userSlug },\n routes: { api },\n serverURL,\n } = config\n\n const collectionConfig = config.collections.find((collection) => collection.slug === userSlug)\n\n if (collectionConfig && user?.id) {\n const { docPermissions, hasPublishPermission, hasSavePermission } =\n await getDocumentPermissions({\n id: user.id,\n collectionConfig,\n data: user,\n req,\n })\n\n const { data, formState } = await getDocumentData({\n id: user.id,\n collectionConfig,\n locale,\n req,\n })\n\n const viewComponentProps: ServerSideEditViewProps = {\n initPageResult,\n params,\n routeSegments: [],\n searchParams,\n }\n\n return (\n <DocumentInfoProvider\n AfterFields={<Settings i18n={i18n} languageOptions={languageOptions} />}\n action={`${serverURL}${api}/${userSlug}${user?.id ? `/${user.id}` : ''}`}\n apiURL={`${serverURL}${api}/${userSlug}${user?.id ? `/${user.id}` : ''}`}\n collectionSlug={userSlug}\n docPermissions={docPermissions}\n hasPublishPermission={hasPublishPermission}\n hasSavePermission={hasSavePermission}\n id={user?.id.toString()}\n initialData={data}\n initialState={formState}\n isEditing\n >\n <DocumentHeader\n collectionConfig={collectionConfig}\n config={payload.config}\n hideTabs\n i18n={i18n}\n permissions={permissions}\n />\n <HydrateClientUser permissions={permissions} user={user} />\n <FormQueryParamsProvider\n initialParams={{\n depth: 0,\n 'fallback-locale': 'null',\n locale: locale
|
|
1
|
+
{"version":3,"sources":["../../../src/views/Account/index.tsx"],"sourcesContent":["import type { ServerSideEditViewProps } from 'payload/types'\nimport type { AdminViewProps } from 'payload/types'\n\nimport { DocumentHeader } from '@payloadcms/ui/elements/DocumentHeader'\nimport { HydrateClientUser } from '@payloadcms/ui/elements/HydrateClientUser'\nimport { RenderCustomComponent } from '@payloadcms/ui/elements/RenderCustomComponent'\nimport { DocumentInfoProvider } from '@payloadcms/ui/providers/DocumentInfo'\nimport { FormQueryParamsProvider } from '@payloadcms/ui/providers/FormQueryParams'\nimport { notFound } from 'next/navigation.js'\nimport React from 'react'\n\nimport { getDocumentData } from '../Document/getDocumentData.js'\nimport { getDocumentPermissions } from '../Document/getDocumentPermissions.js'\nimport { EditView } from '../Edit/index.js'\nimport { Settings } from './Settings/index.js'\n\nexport { generateAccountMetadata } from './meta.js'\n\nexport const Account: React.FC<AdminViewProps> = async ({\n initPageResult,\n params,\n searchParams,\n}) => {\n const {\n languageOptions,\n locale,\n permissions,\n req,\n req: {\n i18n,\n payload,\n payload: { config },\n user,\n },\n } = initPageResult\n\n const {\n admin: { components: { views: { Account: CustomAccountComponent } = {} } = {}, user: userSlug },\n routes: { api },\n serverURL,\n } = config\n\n const collectionConfig = config.collections.find((collection) => collection.slug === userSlug)\n\n if (collectionConfig && user?.id) {\n const { docPermissions, hasPublishPermission, hasSavePermission } =\n await getDocumentPermissions({\n id: user.id,\n collectionConfig,\n data: user,\n req,\n })\n\n const { data, formState } = await getDocumentData({\n id: user.id,\n collectionConfig,\n locale,\n req,\n })\n\n const viewComponentProps: ServerSideEditViewProps = {\n initPageResult,\n params,\n routeSegments: [],\n searchParams,\n }\n\n return (\n <DocumentInfoProvider\n AfterFields={<Settings i18n={i18n} languageOptions={languageOptions} />}\n action={`${serverURL}${api}/${userSlug}${user?.id ? `/${user.id}` : ''}`}\n apiURL={`${serverURL}${api}/${userSlug}${user?.id ? `/${user.id}` : ''}`}\n collectionSlug={userSlug}\n docPermissions={docPermissions}\n hasPublishPermission={hasPublishPermission}\n hasSavePermission={hasSavePermission}\n id={user?.id.toString()}\n initialData={data}\n initialState={formState}\n isEditing\n >\n <DocumentHeader\n collectionConfig={collectionConfig}\n config={payload.config}\n hideTabs\n i18n={i18n}\n permissions={permissions}\n />\n <HydrateClientUser permissions={permissions} user={user} />\n <FormQueryParamsProvider\n initialParams={{\n depth: 0,\n 'fallback-locale': 'null',\n locale: locale?.code,\n uploadEdits: undefined,\n }}\n >\n <RenderCustomComponent\n CustomComponent={\n typeof CustomAccountComponent === 'function' ? CustomAccountComponent : undefined\n }\n DefaultComponent={EditView}\n componentProps={viewComponentProps}\n serverOnlyProps={{\n i18n,\n locale,\n params,\n payload,\n permissions,\n searchParams,\n user,\n }}\n />\n </FormQueryParamsProvider>\n </DocumentInfoProvider>\n )\n }\n\n return notFound()\n}\n"],"names":["DocumentHeader","HydrateClientUser","RenderCustomComponent","DocumentInfoProvider","FormQueryParamsProvider","notFound","React","getDocumentData","getDocumentPermissions","EditView","Settings","generateAccountMetadata","Account","initPageResult","params","searchParams","languageOptions","locale","permissions","req","i18n","payload","config","user","admin","components","views","CustomAccountComponent","userSlug","routes","api","serverURL","collectionConfig","collections","find","collection","slug","id","docPermissions","hasPublishPermission","hasSavePermission","data","formState","viewComponentProps","routeSegments","AfterFields","action","apiURL","collectionSlug","toString","initialData","initialState","isEditing","hideTabs","initialParams","depth","code","uploadEdits","undefined","CustomComponent","DefaultComponent","componentProps","serverOnlyProps"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";AAGA,SAASA,cAAc,QAAQ,yCAAwC;AACvE,SAASC,iBAAiB,QAAQ,4CAA2C;AAC7E,SAASC,qBAAqB,QAAQ,gDAA+C;AACrF,SAASC,oBAAoB,QAAQ,wCAAuC;AAC5E,SAASC,uBAAuB,QAAQ,2CAA0C;AAClF,SAASC,QAAQ,QAAQ,qBAAoB;AAC7C,OAAOC,WAAW,QAAO;AAEzB,SAASC,eAAe,QAAQ,iCAAgC;AAChE,SAASC,sBAAsB,QAAQ,wCAAuC;AAC9E,SAASC,QAAQ,QAAQ,mBAAkB;AAC3C,SAASC,QAAQ,QAAQ,sBAAqB;AAE9C,SAASC,uBAAuB,QAAQ,YAAW;AAEnD,OAAO,MAAMC,UAAoC,OAAO,EACtDC,cAAc,EACdC,MAAM,EACNC,YAAY,EACb;IACC,MAAM,EACJC,eAAe,EACfC,MAAM,EACNC,WAAW,EACXC,GAAG,EACHA,KAAK,EACHC,IAAI,EACJC,OAAO,EACPA,SAAS,EAAEC,MAAM,EAAE,EACnBC,IAAI,EACL,EACF,GAAGV;IAEJ,MAAM,EACJW,OAAO,EAAEC,YAAY,EAAEC,OAAO,EAAEd,SAASe,sBAAsB,EAAE,GAAG,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,EAAEJ,MAAMK,QAAQ,EAAE,EAC/FC,QAAQ,EAAEC,GAAG,EAAE,EACfC,SAAS,EACV,GAAGT;IAEJ,MAAMU,mBAAmBV,OAAOW,WAAW,CAACC,IAAI,CAAC,CAACC,aAAeA,WAAWC,IAAI,KAAKR;IAErF,IAAII,oBAAoBT,MAAMc,IAAI;QAChC,MAA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1C;4BACAH;4BACAH;4BACAO;4BACAH;4BACAH;4BACAQ;wBACF;;;;;IAKV;IAEA,OAAOlB;AACT,EAAC"}
|
|
@@ -10,7 +10,7 @@ export const getDocumentData = async (args)=>{
|
|
|
10
10
|
id,
|
|
11
11
|
collectionSlug: collectionConfig?.slug,
|
|
12
12
|
globalSlug: globalConfig?.slug,
|
|
13
|
-
locale: locale
|
|
13
|
+
locale: locale?.code,
|
|
14
14
|
operation: collectionConfig && id || globalConfig ? 'update' : 'create',
|
|
15
15
|
schemaPath: collectionConfig?.slug || globalConfig?.slug
|
|
16
16
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/views/Document/getDocumentData.tsx"],"sourcesContent":["import type { Locale } from 'payload/config'\nimport type {\n Data,\n PayloadRequestWithData,\n SanitizedCollectionConfig,\n SanitizedGlobalConfig,\n} from 'payload/types'\n\nimport { buildFormState } from '@payloadcms/ui/utilities/buildFormState'\nimport { reduceFieldsToValues } from '@payloadcms/ui/utilities/reduceFieldsToValues'\n\nexport const getDocumentData = async (args: {\n collectionConfig?: SanitizedCollectionConfig\n globalConfig?: SanitizedGlobalConfig\n id?: number | string\n locale: Locale\n req: PayloadRequestWithData\n}): Promise<Data> => {\n const { id, collectionConfig, globalConfig, locale, req } = args\n\n try {\n const formState = await buildFormState({\n req: {\n ...req,\n data: {\n id,\n collectionSlug: collectionConfig?.slug,\n globalSlug: globalConfig?.slug,\n locale: locale
|
|
1
|
+
{"version":3,"sources":["../../../src/views/Document/getDocumentData.tsx"],"sourcesContent":["import type { Locale } from 'payload/config'\nimport type {\n Data,\n PayloadRequestWithData,\n SanitizedCollectionConfig,\n SanitizedGlobalConfig,\n} from 'payload/types'\n\nimport { buildFormState } from '@payloadcms/ui/utilities/buildFormState'\nimport { reduceFieldsToValues } from '@payloadcms/ui/utilities/reduceFieldsToValues'\n\nexport const getDocumentData = async (args: {\n collectionConfig?: SanitizedCollectionConfig\n globalConfig?: SanitizedGlobalConfig\n id?: number | string\n locale: Locale\n req: PayloadRequestWithData\n}): Promise<Data> => {\n const { id, collectionConfig, globalConfig, locale, req } = args\n\n try {\n const formState = await buildFormState({\n req: {\n ...req,\n data: {\n id,\n collectionSlug: collectionConfig?.slug,\n globalSlug: globalConfig?.slug,\n locale: locale?.code,\n operation: (collectionConfig && id) || globalConfig ? 'update' : 'create',\n schemaPath: collectionConfig?.slug || globalConfig?.slug,\n },\n },\n })\n\n const data = reduceFieldsToValues(formState, true)\n\n return {\n data,\n formState,\n }\n } catch (error) {\n console.error('Error getting document data', error) // eslint-disable-line no-console\n return {}\n }\n}\n"],"names":["buildFormState","reduceFieldsToValues","getDocumentData","args","id","collectionConfig","globalConfig","locale","req","formState","data","collectionSlug","slug","globalSlug","code","operation","schemaPath","error","console"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAQA,SAASA,cAAc,QAAQ,0CAAyC;AACxE,SAASC,oBAAoB,QAAQ,gDAA+C;AAEpF,OAAO,MAAMC,kBAAkB,OAAOC;IAOpC,MAAM,EAAEC,EAAE,EAAEC,gBAAgB,EAAEC,YAAY,EAAEC,MAAM,EAAEC,GAAG,EAAE,GAAGL;IAE5D,IAAI;QACF,MAAMM,YAAY,MAAMT,eAAe;YACrCQ,KAAK;gBACH,GAAGA,GAAG;gBACNE,MAAM;oBACJN;oBACAO,gBAAgBN,kBAAkBO;oBAClCC,YAAYP,cAAcM;oBAC1BL,QAAQA,QAAQO;oBAChBC,WAAW,AAACV,oBAAoBD,MAAOE,eAAe,WAAW;oBACjEU,YAAYX,kBAAkBO,QAAQN,cAAcM;gBACtD;YACF;QACF;QAEA,MAAMF,OAAOT,qBAAqBQ,WAAW;QAE7C,OAAO;YACLC;YACAD;QACF;IACF,EAAE,OAAOQ,OAAO;QACdC,QAAQD,KAAK,CAAC,+BAA+BA,OAAO,iCAAiC;;QACrF,OAAO,CAAC;IACV;AACF,EAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/views/Document/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/views/Document/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAsB,cAAc,EAA2B,MAAM,eAAe,CAAA;AAWhG,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,uBAAuB,CAAA;AAQrE,eAAO,MAAM,gBAAgB,EAAE,wBAAiE,CAAA;AAEhG,eAAO,MAAM,QAAQ,EAAE,KAAK,CAAC,EAAE,CAAC,cAAc,CAmO7C,CAAA"}
|
|
@@ -7,6 +7,7 @@ import { EditDepthProvider } from '@payloadcms/ui/providers/EditDepth';
|
|
|
7
7
|
import { FormQueryParamsProvider } from '@payloadcms/ui/providers/FormQueryParams';
|
|
8
8
|
import { isEditing as getIsEditing } from '@payloadcms/ui/utilities/isEditing';
|
|
9
9
|
import { notFound, redirect } from 'next/navigation.js';
|
|
10
|
+
import QueryString from 'qs';
|
|
10
11
|
import React from 'react';
|
|
11
12
|
import { NotFoundView } from '../NotFound/index.js';
|
|
12
13
|
import { getDocumentData } from './getDocumentData.js';
|
|
@@ -49,7 +50,13 @@ export const Document = async ({ initPageResult, params, searchParams })=>{
|
|
|
49
50
|
notFound();
|
|
50
51
|
}
|
|
51
52
|
action = `${serverURL}${apiRoute}/${collectionSlug}${isEditing ? `/${id}` : ''}`;
|
|
52
|
-
|
|
53
|
+
const apiQueryParams = QueryString.stringify({
|
|
54
|
+
draft: collectionConfig.versions?.drafts ? 'true' : undefined,
|
|
55
|
+
locale: locale?.code
|
|
56
|
+
}, {
|
|
57
|
+
addQueryPrefix: true
|
|
58
|
+
});
|
|
59
|
+
apiURL = `${serverURL}${apiRoute}/${collectionSlug}/${id}${apiQueryParams}`;
|
|
53
60
|
const editConfig = collectionConfig?.admin?.components?.views?.Edit;
|
|
54
61
|
ViewOverride = typeof editConfig === 'function' ? editConfig : null;
|
|
55
62
|
if (!ViewOverride) {
|
|
@@ -72,7 +79,13 @@ export const Document = async ({ initPageResult, params, searchParams })=>{
|
|
|
72
79
|
notFound();
|
|
73
80
|
}
|
|
74
81
|
action = `${serverURL}${apiRoute}/globals/${globalSlug}`;
|
|
75
|
-
|
|
82
|
+
const apiQueryParams = QueryString.stringify({
|
|
83
|
+
draft: globalConfig.versions?.drafts ? 'true' : undefined,
|
|
84
|
+
locale: locale?.code
|
|
85
|
+
}, {
|
|
86
|
+
addQueryPrefix: true
|
|
87
|
+
});
|
|
88
|
+
apiURL = `${serverURL}${apiRoute}/${globalSlug}${apiQueryParams}`;
|
|
76
89
|
const editConfig = globalConfig?.admin?.components?.views?.Edit;
|
|
77
90
|
ViewOverride = typeof editConfig === 'function' ? editConfig : null;
|
|
78
91
|
if (!ViewOverride) {
|
|
@@ -102,7 +115,7 @@ export const Document = async ({ initPageResult, params, searchParams })=>{
|
|
|
102
115
|
depth: 0,
|
|
103
116
|
draft: true,
|
|
104
117
|
fallbackLocale: null,
|
|
105
|
-
locale: locale
|
|
118
|
+
locale: locale?.code,
|
|
106
119
|
req,
|
|
107
120
|
user
|
|
108
121
|
});
|
|
@@ -150,7 +163,7 @@ export const Document = async ({ initPageResult, params, searchParams })=>{
|
|
|
150
163
|
initialParams: {
|
|
151
164
|
depth: 0,
|
|
152
165
|
'fallback-locale': 'null',
|
|
153
|
-
locale: locale
|
|
166
|
+
locale: locale?.code,
|
|
154
167
|
uploadEdits: undefined
|
|
155
168
|
},
|
|
156
169
|
children: ErrorView ? /*#__PURE__*/ _jsx(ErrorView, {
|
|
@@ -171,7 +184,7 @@ export const Document = async ({ initPageResult, params, searchParams })=>{
|
|
|
171
184
|
}
|
|
172
185
|
})
|
|
173
186
|
})
|
|
174
|
-
}, `${collectionSlug || globalSlug}
|
|
187
|
+
}, `${collectionSlug || globalSlug}${locale?.code ? `-${locale?.code}` : ''}`)
|
|
175
188
|
]
|
|
176
189
|
});
|
|
177
190
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/views/Document/index.tsx"],"sourcesContent":["import type { EditViewComponent } from 'payload/config'\nimport type { AdminViewComponent, ServerSideEditViewProps } from 'payload/types'\nimport type { AdminViewProps } from 'payload/types'\n\nimport { DocumentHeader } from '@payloadcms/ui/elements/DocumentHeader'\nimport { HydrateClientUser } from '@payloadcms/ui/elements/HydrateClientUser'\nimport { RenderCustomComponent } from '@payloadcms/ui/elements/RenderCustomComponent'\nimport { DocumentInfoProvider } from '@payloadcms/ui/providers/DocumentInfo'\nimport { EditDepthProvider } from '@payloadcms/ui/providers/EditDepth'\nimport { FormQueryParamsProvider } from '@payloadcms/ui/providers/FormQueryParams'\nimport { isEditing as getIsEditing } from '@payloadcms/ui/utilities/isEditing'\nimport { notFound, redirect } from 'next/navigation.js'\nimport React from 'react'\n\nimport type { GenerateEditViewMetadata } from './getMetaBySegment.js'\n\nimport { NotFoundView } from '../NotFound/index.js'\nimport { getDocumentData } from './getDocumentData.js'\nimport { getDocumentPermissions } from './getDocumentPermissions.js'\nimport { getMetaBySegment } from './getMetaBySegment.js'\nimport { getViewsFromConfig } from './getViewsFromConfig.js'\n\nexport const generateMetadata: GenerateEditViewMetadata = async (args) => getMetaBySegment(args)\n\nexport const Document: React.FC<AdminViewProps> = async ({\n initPageResult,\n params,\n searchParams,\n}) => {\n const {\n collectionConfig,\n docID: id,\n globalConfig,\n locale,\n permissions,\n req,\n req: {\n i18n,\n payload,\n payload: {\n config,\n config: {\n routes: { admin: adminRoute, api: apiRoute },\n serverURL,\n },\n },\n user,\n },\n visibleEntities,\n } = initPageResult\n\n const segments = Array.isArray(params?.segments) ? params.segments : []\n const collectionSlug = collectionConfig?.slug || undefined\n const globalSlug = globalConfig?.slug || undefined\n\n const isEditing = getIsEditing({ id, collectionSlug, globalSlug })\n\n let ViewOverride: EditViewComponent\n let CustomView: EditViewComponent\n let DefaultView: EditViewComponent\n let ErrorView: AdminViewComponent\n\n let apiURL: string\n let action: string\n\n const { data, formState } = await getDocumentData({\n id,\n collectionConfig,\n globalConfig,\n locale,\n req,\n })\n\n const { docPermissions, hasPublishPermission, hasSavePermission } = await getDocumentPermissions({\n id,\n collectionConfig,\n data,\n globalConfig,\n req,\n })\n\n if (collectionConfig) {\n if (!visibleEntities?.collections?.find((visibleSlug) => visibleSlug === collectionSlug)) {\n notFound()\n }\n\n action = `${serverURL}${apiRoute}/${collectionSlug}${isEditing ? `/${id}` : ''}`\n\n apiURL = `${serverURL}${apiRoute}/${collectionSlug}/${id}?locale=${locale.code}${\n collectionConfig.versions?.drafts ? '&draft=true' : ''\n }`\n\n const editConfig = collectionConfig?.admin?.components?.views?.Edit\n ViewOverride = typeof editConfig === 'function' ? editConfig : null\n\n if (!ViewOverride) {\n const collectionViews = getViewsFromConfig({\n collectionConfig,\n config,\n docPermissions,\n routeSegments: segments,\n })\n\n CustomView = collectionViews?.CustomView\n DefaultView = collectionViews?.DefaultView\n ErrorView = collectionViews?.ErrorView\n }\n\n if (!CustomView && !DefaultView && !ViewOverride && !ErrorView) {\n ErrorView = NotFoundView\n }\n }\n\n if (globalConfig) {\n if (!visibleEntities?.globals?.find((visibleSlug) => visibleSlug === globalSlug)) {\n notFound()\n }\n\n action = `${serverURL}${apiRoute}/globals/${globalSlug}`\n\n apiURL = `${serverURL}${apiRoute}/${globalSlug}?locale=${locale.code}${\n globalConfig.versions?.drafts ? '&draft=true' : ''\n }`\n\n const editConfig = globalConfig?.admin?.components?.views?.Edit\n ViewOverride = typeof editConfig === 'function' ? editConfig : null\n\n if (!ViewOverride) {\n const globalViews = getViewsFromConfig({\n config,\n docPermissions,\n globalConfig,\n routeSegments: segments,\n })\n\n CustomView = globalViews?.CustomView\n DefaultView = globalViews?.DefaultView\n ErrorView = globalViews?.ErrorView\n\n if (!CustomView && !DefaultView && !ViewOverride && !ErrorView) {\n ErrorView = NotFoundView\n }\n }\n }\n\n /**\n * Handle case where autoSave is enabled and the document is being created\n * => create document and redirect\n */\n const shouldAutosave =\n hasSavePermission &&\n ((collectionConfig?.versions?.drafts && collectionConfig?.versions?.drafts?.autosave) ||\n (globalConfig?.versions?.drafts && globalConfig?.versions?.drafts?.autosave))\n const validateDraftData =\n collectionConfig?.versions?.drafts && collectionConfig?.versions?.drafts?.validate\n\n if (shouldAutosave && !validateDraftData && !id && collectionSlug) {\n const doc = await payload.create({\n collection: collectionSlug,\n data: {},\n depth: 0,\n draft: true,\n fallbackLocale: null,\n locale: locale.code,\n req,\n user,\n })\n\n if (doc?.id) {\n const redirectURL = `${serverURL}${adminRoute}/collections/${collectionSlug}/${doc.id}`\n redirect(redirectURL)\n } else {\n notFound()\n }\n }\n\n const viewComponentProps: ServerSideEditViewProps = {\n initPageResult,\n params,\n routeSegments: segments,\n searchParams,\n }\n\n return (\n <DocumentInfoProvider\n action={action}\n apiURL={apiURL}\n collectionSlug={collectionConfig?.slug}\n disableActions={false}\n docPermissions={docPermissions}\n globalSlug={globalConfig?.slug}\n hasPublishPermission={hasPublishPermission}\n hasSavePermission={hasSavePermission}\n id={id}\n initialData={data}\n initialState={formState}\n isEditing={isEditing}\n >\n {!ViewOverride && (\n <DocumentHeader\n collectionConfig={collectionConfig}\n config={payload.config}\n globalConfig={globalConfig}\n i18n={i18n}\n permissions={permissions}\n />\n )}\n <HydrateClientUser permissions={permissions} user={user} />\n <EditDepthProvider depth={1} key={`${collectionSlug || globalSlug}-${locale.code}`}>\n <FormQueryParamsProvider\n initialParams={{\n depth: 0,\n 'fallback-locale': 'null',\n locale: locale.code,\n uploadEdits: undefined,\n }}\n >\n {ErrorView ? (\n <ErrorView initPageResult={initPageResult} searchParams={searchParams} />\n ) : (\n <RenderCustomComponent\n CustomComponent={ViewOverride || CustomView}\n DefaultComponent={DefaultView}\n componentProps={viewComponentProps}\n serverOnlyProps={{\n i18n,\n locale,\n params,\n payload,\n permissions,\n searchParams,\n user,\n }}\n />\n )}\n </FormQueryParamsProvider>\n </EditDepthProvider>\n </DocumentInfoProvider>\n )\n}\n"],"names":["DocumentHeader","HydrateClientUser","RenderCustomComponent","DocumentInfoProvider","EditDepthProvider","FormQueryParamsProvider","isEditing","getIsEditing","notFound","redirect","React","NotFoundView","getDocumentData","getDocumentPermissions","getMetaBySegment","getViewsFromConfig","generateMetadata","args","Document","initPageResult","params","searchParams","collectionConfig","docID","id","globalConfig","locale","permissions","req","i18n","payload","config","routes","admin","adminRoute","api","apiRoute","serverURL","user","visibleEntities","segments","Array","isArray","collectionSlug","slug","undefined","globalSlug","ViewOverride","CustomView","DefaultView","ErrorView","apiURL","action","data","formState","docPermissions","hasPublishPermission","hasSavePermission","collections","find","visibleSlug","code","versions","drafts","editConfig","components","views","Edit","collectionViews","routeSegments","globals","globalViews","shouldAutosave","autosave","validateDraftData","validate","doc","create","collection","depth","draft","fallbackLocale","redirectURL","viewComponentProps","disableActions","initialData","initialState","initialParams","uploadEdits","CustomComponent","DefaultComponent","componentProps","serverOnlyProps"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";AAIA,SAASA,cAAc,QAAQ,yCAAwC;AACvE,SAASC,iBAAiB,QAAQ,4CAA2C;AAC7E,SAASC,qBAAqB,QAAQ,gDAA+C;AACrF,SAASC,oBAAoB,QAAQ,wCAAuC;AAC5E,SAASC,iBAAiB,QAAQ,qCAAoC;AACtE,SAASC,uBAAuB,QAAQ,2CAA0C;AAClF,SAASC,aAAaC,YAAY,QAAQ,qCAAoC;AAC9E,SAASC,QAAQ,EAAEC,QAAQ,QAAQ,qBAAoB;AACvD,OAAOC,WAAW,QAAO;AAIzB,SAASC,YAAY,QAAQ,uBAAsB;AACnD,SAASC,eAAe,QAA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0B,aAAaA;gBAAaW,MAAMA;;0BACnD,KAAClC;gBAAkB2E,OAAO;0BACxB,cAAA,KAAC1E;oBACCkF,eAAe;wBACbR,OAAO;wBACP,mBAAmB;wBACnBrD,QAAQA,OAAOmC,IAAI;wBACnB2B,aAAa3C;oBACf;8BAECK,0BACC,KAACA;wBAAU/B,gBAAgBA;wBAAgBE,cAAcA;uCAEzD,KAACnB;wBACCuF,iBAAiB1C,gBAAgBC;wBACjC0C,kBAAkBzC;wBAClB0C,gBAAgBR;wBAChBS,iBAAiB;4BACf/D;4BACAH;4BACAN;4BACAU;4BACAH;4BACAN;4BACAiB;wBACF;;;eAxB0B,CAAC,EAAEK,kBAAkBG,WAAW,CAAC,EAAEpB,OAAOmC,IAAI,CAAC,CAAC;;;AA+BxF,EAAC"}
|
|
1
|
+
{"version":3,"sources":["../../../src/views/Document/index.tsx"],"sourcesContent":["import type { EditViewComponent } from 'payload/config'\nimport type { AdminViewComponent, AdminViewProps, ServerSideEditViewProps } from 'payload/types'\n\nimport { DocumentHeader } from '@payloadcms/ui/elements/DocumentHeader'\nimport { HydrateClientUser } from '@payloadcms/ui/elements/HydrateClientUser'\nimport { RenderCustomComponent } from '@payloadcms/ui/elements/RenderCustomComponent'\nimport { DocumentInfoProvider } from '@payloadcms/ui/providers/DocumentInfo'\nimport { EditDepthProvider } from '@payloadcms/ui/providers/EditDepth'\nimport { FormQueryParamsProvider } from '@payloadcms/ui/providers/FormQueryParams'\nimport { isEditing as getIsEditing } from '@payloadcms/ui/utilities/isEditing'\nimport { notFound, redirect } from 'next/navigation.js'\nimport QueryString from 'qs'\nimport React from 'react'\n\nimport type { GenerateEditViewMetadata } from './getMetaBySegment.js'\n\nimport { NotFoundView } from '../NotFound/index.js'\nimport { getDocumentData } from './getDocumentData.js'\nimport { getDocumentPermissions } from './getDocumentPermissions.js'\nimport { getMetaBySegment } from './getMetaBySegment.js'\nimport { getViewsFromConfig } from './getViewsFromConfig.js'\n\nexport const generateMetadata: GenerateEditViewMetadata = async (args) => getMetaBySegment(args)\n\nexport const Document: React.FC<AdminViewProps> = async ({\n initPageResult,\n params,\n searchParams,\n}) => {\n const {\n collectionConfig,\n docID: id,\n globalConfig,\n locale,\n permissions,\n req,\n req: {\n i18n,\n payload,\n payload: {\n config,\n config: {\n routes: { admin: adminRoute, api: apiRoute },\n serverURL,\n },\n },\n user,\n },\n visibleEntities,\n } = initPageResult\n\n const segments = Array.isArray(params?.segments) ? params.segments : []\n const collectionSlug = collectionConfig?.slug || undefined\n const globalSlug = globalConfig?.slug || undefined\n\n const isEditing = getIsEditing({ id, collectionSlug, globalSlug })\n\n let ViewOverride: EditViewComponent\n let CustomView: EditViewComponent\n let DefaultView: EditViewComponent\n let ErrorView: AdminViewComponent\n\n let apiURL: string\n let action: string\n\n const { data, formState } = await getDocumentData({\n id,\n collectionConfig,\n globalConfig,\n locale,\n req,\n })\n\n const { docPermissions, hasPublishPermission, hasSavePermission } = await getDocumentPermissions({\n id,\n collectionConfig,\n data,\n globalConfig,\n req,\n })\n\n if (collectionConfig) {\n if (!visibleEntities?.collections?.find((visibleSlug) => visibleSlug === collectionSlug)) {\n notFound()\n }\n\n action = `${serverURL}${apiRoute}/${collectionSlug}${isEditing ? `/${id}` : ''}`\n const apiQueryParams = QueryString.stringify(\n {\n draft: collectionConfig.versions?.drafts ? 'true' : undefined,\n locale: locale?.code,\n },\n { addQueryPrefix: true },\n )\n apiURL = `${serverURL}${apiRoute}/${collectionSlug}/${id}${apiQueryParams}`\n\n const editConfig = collectionConfig?.admin?.components?.views?.Edit\n ViewOverride = typeof editConfig === 'function' ? editConfig : null\n\n if (!ViewOverride) {\n const collectionViews = getViewsFromConfig({\n collectionConfig,\n config,\n docPermissions,\n routeSegments: segments,\n })\n\n CustomView = collectionViews?.CustomView\n DefaultView = collectionViews?.DefaultView\n ErrorView = collectionViews?.ErrorView\n }\n\n if (!CustomView && !DefaultView && !ViewOverride && !ErrorView) {\n ErrorView = NotFoundView\n }\n }\n\n if (globalConfig) {\n if (!visibleEntities?.globals?.find((visibleSlug) => visibleSlug === globalSlug)) {\n notFound()\n }\n\n action = `${serverURL}${apiRoute}/globals/${globalSlug}`\n\n const apiQueryParams = QueryString.stringify(\n {\n draft: globalConfig.versions?.drafts ? 'true' : undefined,\n locale: locale?.code,\n },\n { addQueryPrefix: true },\n )\n apiURL = `${serverURL}${apiRoute}/${globalSlug}${apiQueryParams}`\n\n const editConfig = globalConfig?.admin?.components?.views?.Edit\n ViewOverride = typeof editConfig === 'function' ? editConfig : null\n\n if (!ViewOverride) {\n const globalViews = getViewsFromConfig({\n config,\n docPermissions,\n globalConfig,\n routeSegments: segments,\n })\n\n CustomView = globalViews?.CustomView\n DefaultView = globalViews?.DefaultView\n ErrorView = globalViews?.ErrorView\n\n if (!CustomView && !DefaultView && !ViewOverride && !ErrorView) {\n ErrorView = NotFoundView\n }\n }\n }\n\n /**\n * Handle case where autoSave is enabled and the document is being created\n * => create document and redirect\n */\n const shouldAutosave =\n hasSavePermission &&\n ((collectionConfig?.versions?.drafts && collectionConfig?.versions?.drafts?.autosave) ||\n (globalConfig?.versions?.drafts && globalConfig?.versions?.drafts?.autosave))\n const validateDraftData =\n collectionConfig?.versions?.drafts && collectionConfig?.versions?.drafts?.validate\n\n if (shouldAutosave && !validateDraftData && !id && collectionSlug) {\n const doc = await payload.create({\n collection: collectionSlug,\n data: {},\n depth: 0,\n draft: true,\n fallbackLocale: null,\n locale: locale?.code,\n req,\n user,\n })\n\n if (doc?.id) {\n const redirectURL = `${serverURL}${adminRoute}/collections/${collectionSlug}/${doc.id}`\n redirect(redirectURL)\n } else {\n notFound()\n }\n }\n\n const viewComponentProps: ServerSideEditViewProps = {\n initPageResult,\n params,\n routeSegments: segments,\n searchParams,\n }\n\n return (\n <DocumentInfoProvider\n action={action}\n apiURL={apiURL}\n collectionSlug={collectionConfig?.slug}\n disableActions={false}\n docPermissions={docPermissions}\n globalSlug={globalConfig?.slug}\n hasPublishPermission={hasPublishPermission}\n hasSavePermission={hasSavePermission}\n id={id}\n initialData={data}\n initialState={formState}\n isEditing={isEditing}\n >\n {!ViewOverride && (\n <DocumentHeader\n collectionConfig={collectionConfig}\n config={payload.config}\n globalConfig={globalConfig}\n i18n={i18n}\n permissions={permissions}\n />\n )}\n <HydrateClientUser permissions={permissions} user={user} />\n <EditDepthProvider\n depth={1}\n key={`${collectionSlug || globalSlug}${locale?.code ? `-${locale?.code}` : ''}`}\n >\n <FormQueryParamsProvider\n initialParams={{\n depth: 0,\n 'fallback-locale': 'null',\n locale: locale?.code,\n uploadEdits: undefined,\n }}\n >\n {ErrorView ? (\n <ErrorView initPageResult={initPageResult} searchParams={searchParams} />\n ) : (\n <RenderCustomComponent\n CustomComponent={ViewOverride || CustomView}\n DefaultComponent={DefaultView}\n componentProps={viewComponentProps}\n serverOnlyProps={{\n i18n,\n locale,\n params,\n payload,\n permissions,\n searchParams,\n user,\n }}\n />\n )}\n </FormQueryParamsProvider>\n </EditDepthProvider>\n </DocumentInfoProvider>\n )\n}\n"],"names":["DocumentHeader","HydrateClientUser","RenderCustomComponent","DocumentInfoProvider","EditDepthProvider","FormQueryParamsProvider","isEditing","getIsEditing","notFound","redirect","QueryString","React","NotFoundView","getDocumentData","getDocumentPermissions","getMetaBySegment","getViewsFromConfig","generateMetadata","args","Document","initPageResult","params","searchParams","collectionConfig","docID","id","globalConfig","locale","permissions","req","i18n","payload","config","routes","admin","adminRoute","api","apiRoute","serverURL","user","visibleEntities","segments","Array","isArray","collectionSlug","slug","undefined","globalSlug","ViewOverride","CustomView","DefaultView","ErrorView","apiURL","action","data","formState","docPermissions","hasPublishPermission","hasSavePermission","collections","find","visibleSlug","apiQueryParams","stringify","draft","versions","drafts","code","addQueryPrefix","editConfig","components","views","Edit","collectionViews","routeSegments","globals","globalViews","shouldAutosave","autosave","validateDraftData","validate","doc","create","collection","depth","fallbackLocale","redirectURL","viewComponentProps","disableActions","initialData","initialState","initialParams","uploadEdits","CustomComponent","DefaultComponent","componentProps","serverOnl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AEK,kBAAkBG,WAAW,EAAEpB,QAAQwC,OAAO,CAAC,CAAC,EAAExC,QAAQwC,KAAK,CAAC,GAAG,GAAG,CAAC;;;AAgCvF,EAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/views/ForgotPassword/ForgotPasswordForm/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/views/ForgotPassword/ForgotPasswordForm/index.tsx"],"names":[],"mappings":"AAWA,OAAO,KAA6B,MAAM,OAAO,CAAA;AAEjD,eAAO,MAAM,kBAAkB,EAAE,KAAK,CAAC,EAqEtC,CAAA"}
|
|
@@ -7,17 +7,17 @@ import { useConfig } from '@payloadcms/ui/providers/Config';
|
|
|
7
7
|
import { useTranslation } from '@payloadcms/ui/providers/Translation';
|
|
8
8
|
import { email } from 'payload/fields/validations';
|
|
9
9
|
import React, { Fragment, useState } from 'react';
|
|
10
|
-
import { toast } from 'sonner';
|
|
11
10
|
export const ForgotPasswordForm = ()=>{
|
|
12
11
|
const config = useConfig();
|
|
13
12
|
const { admin: { user: userSlug }, routes: { api } } = config;
|
|
14
13
|
const { t } = useTranslation();
|
|
15
14
|
const [hasSubmitted, setHasSubmitted] = useState(false);
|
|
16
|
-
const handleResponse = (res)=>{
|
|
15
|
+
const handleResponse = (res, successToast, errorToast)=>{
|
|
17
16
|
res.json().then(()=>{
|
|
18
17
|
setHasSubmitted(true);
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
successToast(t('general:submissionSuccessful'));
|
|
19
|
+
}).catch(()=>{
|
|
20
|
+
errorToast(t('authentication:emailNotValid'));
|
|
21
21
|
});
|
|
22
22
|
};
|
|
23
23
|
const initialState = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/views/ForgotPassword/ForgotPasswordForm/index.tsx"],"sourcesContent":["'use client'\n\nimport type { FormState, PayloadRequestWithData } from 'payload/types'\n\nimport { Email } from '@payloadcms/ui/fields/Email'\nimport { Form } from '@payloadcms/ui/forms/Form'\nimport { FormSubmit } from '@payloadcms/ui/forms/Submit'\nimport { useConfig } from '@payloadcms/ui/providers/Config'\nimport { useTranslation } from '@payloadcms/ui/providers/Translation'\nimport { email } from 'payload/fields/validations'\nimport React, { Fragment, useState } from 'react'\
|
|
1
|
+
{"version":3,"sources":["../../../../src/views/ForgotPassword/ForgotPasswordForm/index.tsx"],"sourcesContent":["'use client'\n\nimport type { FormProps } from '@payloadcms/ui/forms/Form'\nimport type { FormState, PayloadRequestWithData } from 'payload/types'\n\nimport { Email } from '@payloadcms/ui/fields/Email'\nimport { Form } from '@payloadcms/ui/forms/Form'\nimport { FormSubmit } from '@payloadcms/ui/forms/Submit'\nimport { useConfig } from '@payloadcms/ui/providers/Config'\nimport { useTranslation } from '@payloadcms/ui/providers/Translation'\nimport { email } from 'payload/fields/validations'\nimport React, { Fragment, useState } from 'react'\n\nexport const ForgotPasswordForm: React.FC = () => {\n const config = useConfig()\n\n const {\n admin: { user: userSlug },\n routes: { api },\n } = config\n\n const { t } = useTranslation()\n const [hasSubmitted, setHasSubmitted] = useState(false)\n\n const handleResponse: FormProps['handleResponse'] = (res, successToast, errorToast) => {\n res\n .json()\n .then(() => {\n setHasSubmitted(true)\n successToast(t('general:submissionSuccessful'))\n })\n .catch(() => {\n errorToast(t('authentication:emailNotValid'))\n })\n }\n\n const initialState: FormState = {\n email: {\n initialValue: '',\n valid: true,\n value: undefined,\n },\n }\n\n if (hasSubmitted) {\n return (\n <Fragment>\n <h1>{t('authentication:emailSent')}</h1>\n <p>{t('authentication:checkYourEmailForPasswordReset')}</p>\n </Fragment>\n )\n }\n\n return (\n <Form\n action={`${api}/${userSlug}/forgot-password`}\n handleResponse={handleResponse}\n initialState={initialState}\n method=\"POST\"\n >\n <h1>{t('authentication:forgotPassword')}</h1>\n <p>{t('authentication:forgotPasswordEmailInstructions')}</p>\n <Email\n autoComplete=\"email\"\n label={t('general:email')}\n name=\"email\"\n required\n validate={(value) =>\n email(value, {\n name: 'email',\n type: 'email',\n data: {},\n preferences: { fields: {} },\n req: { t } as PayloadRequestWithData,\n required: true,\n siblingData: {},\n })\n }\n />\n <FormSubmit>{t('general:submit')}</FormSubmit>\n </Form>\n )\n}\n"],"names":["Email","Form","FormSubmit","useConfig","useTranslation","email","React","Fragment","useState","ForgotPasswordForm","config","admin","user","userSlug","routes","api","t","hasSubmitted","setHasSubmitted","handleResponse","res","successToast","errorToast","json","then","catch","initialState","initialValue","valid","value","undefined","h1","p","action","method","autoComplete","label","name","required","validate","type","data","preferences","fields","req","siblingData"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA;;AAKA,SAASA,KAAK,QAAQ,8BAA6B;AACnD,SAASC,IAAI,QAAQ,4BAA2B;AAChD,SAASC,UAAU,QAAQ,8BAA6B;AACxD,SAASC,SAAS,QAAQ,kCAAiC;AAC3D,SAASC,cAAc,QAAQ,uCAAsC;AACrE,SAASC,KAAK,QAAQ,6BAA4B;AAClD,OAAOC,SAASC,QAAQ,EAAEC,QAAQ,QAAQ,QAAO;AAEjD,OAAO,MAAMC,qBAA+B;IAC1C,MAAMC,SAASP;IAEf,MAAM,EACJQ,OAAO,EAAEC,MAAMC,QAAQ,EAAE,EACzBC,QAAQ,EAAEC,GAAG,EAAE,EAChB,GAAGL;IAEJ,MAAM,EAAEM,CAAC,EAAE,GAAGZ;IACd,MAAM,CAACa,cAAcC,gBAAgB,GAAGV,SAAS;IAEjD,MAAMW,iBAA8C,CAACC,KAAKC,cAAcC;QACtEF,IACGG,IAAI,GACJC,IAAI,CAAC;YACJN,gBAAgB;YAChBG,aAAaL,EAAE;QACjB,GACCS,KAAK,CAAC;YACLH,WAAWN,EAAE;QACf;IACJ;IAEA,MAAMU,eAA0B;QAC9BrB,OAAO;YACLsB,cAAc;YACdC,OAAO;YACPC,OAAOC;QACT;IACF;IAEA,IAAIb,cAAc;QAChB,qBACE,MAACV;;8BACC,KAACwB;8BAAIf,EAAE;;8BACP,KAACgB;8BAAGhB,EAAE;;;;IAGZ;IAEA,qBACE,MAACf;QACCgC,QAAQ,CAAC,EAAElB,IAAI,CAAC,EAAEF,SAAS,gBAAgB,CAAC;QAC5CM,gBAAgBA;QAChBO,cAAcA;QACdQ,QAAO;;0BAEP,KAACH;0BAAIf,EAAE;;0BACP,KAACgB;0BAAGhB,EAAE;;0BACN,KAAChB;gBACCmC,cAAa;gBACbC,OAAOpB,EAAE;gBACTqB,MAAK;gBACLC,QAAQ;gBACRC,UAAU,CAACV,QACTxB,MAAMwB,OAAO;wBACXQ,MAAM;wBACNG,MAAM;wBACNC,MAAM,CAAC;wBACPC,aAAa;4BAAEC,QAAQ,CAAC;wBAAE;wBAC1BC,KAAK;4BAAE5B;wBAAE;wBACTsB,UAAU;wBACVO,aAAa,CAAC;oBAChB;;0BAGJ,KAAC3C;0BAAYc,EAAE;;;;AAGrB,EAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/views/Root/getViewFromConfig.tsx"],"sourcesContent":["import type { SanitizedConfig } from 'payload/config'\nimport type { AdminViewComponent } from 'payload/types'\n\nimport type { initPage } from '../../utilities/initPage/index.js'\n\nimport { Account } from '../Account/index.js'\nimport { CreateFirstUserView } from '../CreateFirstUser/index.js'\nimport { Dashboard } from '../Dashboard/index.js'\nimport { Document as DocumentView } from '../Document/index.js'\nimport { ForgotPasswordView, forgotPasswordBaseClass } from '../ForgotPassword/index.js'\nimport { ListView } from '../List/index.js'\nimport { LoginView, loginBaseClass } from '../Login/index.js'\nimport { LogoutInactivity, LogoutView } from '../Logout/index.js'\nimport { ResetPassword, resetPasswordBaseClass } from '../ResetPassword/index.js'\nimport { UnauthorizedView } from '../Unauthorized/index.js'\nimport { Verify, verifyBaseClass } from '../Verify/index.js'\nimport { getCustomViewByRoute } from './getCustomViewByRoute.js'\nimport { isPathMatchingRoute } from './isPathMatchingRoute.js'\n\nconst baseClasses = {\n account: 'account',\n forgot: forgotPasswordBaseClass,\n login: loginBaseClass,\n reset: resetPasswordBaseClass,\n verify: verifyBaseClass,\n}\n\ntype OneSegmentViews = {\n [K in keyof SanitizedConfig['admin']['routes']]: AdminViewComponent\n}\n\nconst oneSegmentViews: OneSegmentViews = {\n account: Account,\n createFirstUser: CreateFirstUserView,\n forgot: ForgotPasswordView,\n inactivity: LogoutInactivity,\n login: LoginView,\n logout: LogoutView,\n unauthorized: UnauthorizedView,\n}\n\nexport const getViewFromConfig = ({\n adminRoute,\n config,\n currentRoute,\n searchParams,\n segments,\n}: {\n adminRoute\n config: SanitizedConfig\n currentRoute: string\n searchParams: {\n [key: string]: string | string[]\n }\n segments: string[]\n}): {\n DefaultView: AdminViewComponent\n initPageOptions: Parameters<typeof initPage>[0]\n templateClassName: string\n templateType: 'default' | 'minimal'\n} => {\n let ViewToRender: AdminViewComponent = null\n let templateClassName: string\n let templateType: 'default' | 'minimal' | undefined\n\n const initPageOptions: Parameters<typeof initPage>[0] = {\n config,\n route: currentRoute,\n searchParams,\n }\n\n const [segmentOne, segmentTwo] = segments\n\n const isGlobal = segmentOne === 'globals'\n const isCollection = segmentOne === 'collections'\n\n switch (segments.length) {\n case 0: {\n if (currentRoute === adminRoute) {\n ViewToRender = Dashboard\n templateClassName = 'dashboard'\n templateType = 'default'\n initPageOptions.redirectUnauthenticatedUser = true\n }\n break\n }\n case 1: {\n // users can override the default routes via `admin.routes` config\n // i.e.{ admin: { routes: { logout: '/sign-out', inactivity: '/idle' }}}\n let viewToRender: keyof typeof oneSegmentViews\n\n if (config.admin.routes) {\n const matchedRoute = Object.entries(config.admin.routes).find(([, route]) => {\n return isPathMatchingRoute({\n currentRoute,\n exact: true,\n path: `${adminRoute}${route}`,\n })\n })\n\n if (matchedRoute) {\n viewToRender = matchedRoute[0] as keyof typeof oneSegmentViews\n }\n }\n\n if (oneSegmentViews[viewToRender]) {\n // --> /account\n // --> /create-first-user\n // --> /forgot\n // --> /login\n // --> /logout\n // --> /logout-inactivity\n // --> /unauthorized\n\n ViewToRender = oneSegmentViews[viewToRender]\n templateClassName = baseClasses[viewToRender]\n templateType = 'minimal'\n\n if (viewToRender === 'account') {\n initPageOptions.redirectUnauthenticatedUser = true\n templateType = 'default'\n }\n }\n break\n }\n case 2: {\n if (segmentOne === 'reset') {\n // --> /reset/:token\n ViewToRender = ResetPassword\n templateClassName = baseClasses[segmentTwo]\n templateType = 'minimal'\n }\n\n if (isCollection) {\n // --> /collections/:collectionSlug\n initPageOptions.redirectUnauthenticatedUser = true\n ViewToRender = ListView\n templateClassName = `${segmentTwo}-list`\n templateType = 'default'\n } else if (isGlobal) {\n // --> /globals/:globalSlug\n initPageOptions.redirectUnauthenticatedUser = true\n ViewToRender = DocumentView\n templateClassName = 'global-edit'\n templateType = 'default'\n }\n break\n }\n default:\n if (segmentTwo === 'verify') {\n // --> /:collectionSlug/verify/:token\n ViewToRender = Verify\n templateClassName = 'verify'\n templateType = 'minimal'\n } else if (isCollection) {\n // Custom Views\n // --> /collections/:collectionSlug/:id\n // --> /collections/:collectionSlug/:id/preview\n // --> /collections/:collectionSlug/:id/versions\n // --> /collections/:collectionSlug/:id/versions/:versionId\n // --> /collections/:collectionSlug/:id/api\n initPageOptions.redirectUnauthenticatedUser = true\n ViewToRender = DocumentView\n templateClassName = `collection-default-edit`\n templateType = 'default'\n } else if (isGlobal) {\n // Custom Views\n // --> /globals/:globalSlug/versions\n // --> /globals/:globalSlug/preview\n // --> /globals/:globalSlug/versions/:versionId\n // --> /globals/:globalSlug/api\n initPageOptions.redirectUnauthenticatedUser = true\n ViewToRender = DocumentView\n templateClassName = `global-edit`\n templateType = 'default'\n }\n break\n }\n\n if (!ViewToRender) {\n ViewToRender = getCustomViewByRoute({ config, currentRoute })\n }\n\n return {\n DefaultView: ViewToRender,\n initPageOptions,\n templateClassName,\n templateType,\n }\n}\n"],"names":["Account","CreateFirstUserView","Dashboard","Document","DocumentView","ForgotPasswordView","forgotPasswordBaseClass","ListView","LoginView","loginBaseClass","LogoutInactivity","LogoutView","ResetPassword","resetPasswordBaseClass","UnauthorizedView","Verify","verifyBaseClass","getCustomViewByRoute","isPathMatchingRoute","baseClasses","account","forgot","login","reset","verify","oneSegmentViews","createFirstUser","inactivity","logout","unauthorized","getViewFromConfig","adminRoute","config","currentRoute","searchParams","segments","ViewToRender","templateClassName","templateType","initPageOptions","route","segmentOne","segmentTwo","isGlobal","isCollection","length","redirectUnauthenticatedUser","viewToRender","admin","routes","matchedRoute","Object","entries","find","exact","path","DefaultView"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAKA,SAASA,OAAO,QAAQ,sBAAqB;AAC7C,SAASC,mBAAmB,QAAQ,8BAA6B;AACjE,SAASC,SAAS,QAAQ,wBAAuB;AACjD,SAASC,YAAYC,YAAY,QAAQ,uBAAsB;AAC/D,SAASC,kBAAkB,EAAEC,uBAAuB,QAAQ,6BAA4B;AACxF,SAASC,QAAQ,QAAQ,mBAAkB;AAC3C,SAASC,SAAS,EAAEC,cAAc,QAAQ,oBAAmB;AAC7D,SAASC,gBAAgB,EAAEC,UAAU,QAAQ,qBAAoB;AACjE,SAASC,aAAa,EAAEC,sBAAsB,QAAQ,4BAA2B;AACjF,SAASC,gBAAgB,QAAQ,2BAA0B;AAC3D,SAASC,MAAM,EAAEC,eAAe,QAAQ,qBAAoB;AAC5D,SAASC,oBAAoB,QAAQ,4BAA2B;AAChE,SAASC,mBAAmB,QAAQ,2BAA0B;AAE9D,MAAMC,cAAc;IAClBC,SAAS;IACTC,QAAQf;IACRgB,OAAOb;IACPc,OAAOV;IACPW,Q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sources":["../../../src/views/Root/getViewFromConfig.tsx"],"sourcesContent":["import type { SanitizedConfig } from 'payload/config'\nimport type { AdminViewComponent } from 'payload/types'\n\nimport type { initPage } from '../../utilities/initPage/index.js'\n\nimport { Account } from '../Account/index.js'\nimport { CreateFirstUserView } from '../CreateFirstUser/index.js'\nimport { Dashboard } from '../Dashboard/index.js'\nimport { Document as DocumentView } from '../Document/index.js'\nimport { ForgotPasswordView, forgotPasswordBaseClass } from '../ForgotPassword/index.js'\nimport { ListView } from '../List/index.js'\nimport { LoginView, loginBaseClass } from '../Login/index.js'\nimport { LogoutInactivity, LogoutView } from '../Logout/index.js'\nimport { ResetPassword, resetPasswordBaseClass } from '../ResetPassword/index.js'\nimport { UnauthorizedView } from '../Unauthorized/index.js'\nimport { Verify, verifyBaseClass } from '../Verify/index.js'\nimport { getCustomViewByRoute } from './getCustomViewByRoute.js'\nimport { isPathMatchingRoute } from './isPathMatchingRoute.js'\n\nconst baseClasses = {\n account: 'account',\n forgot: forgotPasswordBaseClass,\n login: loginBaseClass,\n reset: resetPasswordBaseClass,\n verify: verifyBaseClass,\n}\n\ntype OneSegmentViews = {\n [K in Exclude<keyof SanitizedConfig['admin']['routes'], 'reset'>]: AdminViewComponent\n}\n\nconst oneSegmentViews: OneSegmentViews = {\n account: Account,\n createFirstUser: CreateFirstUserView,\n forgot: ForgotPasswordView,\n inactivity: LogoutInactivity,\n login: LoginView,\n logout: LogoutView,\n unauthorized: UnauthorizedView,\n}\n\nexport const getViewFromConfig = ({\n adminRoute,\n config,\n currentRoute,\n searchParams,\n segments,\n}: {\n adminRoute\n config: SanitizedConfig\n currentRoute: string\n searchParams: {\n [key: string]: string | string[]\n }\n segments: string[]\n}): {\n DefaultView: AdminViewComponent\n initPageOptions: Parameters<typeof initPage>[0]\n templateClassName: string\n templateType: 'default' | 'minimal'\n} => {\n let ViewToRender: AdminViewComponent = null\n let templateClassName: string\n let templateType: 'default' | 'minimal' | undefined\n\n const initPageOptions: Parameters<typeof initPage>[0] = {\n config,\n route: currentRoute,\n searchParams,\n }\n\n const [segmentOne, segmentTwo] = segments\n\n const isGlobal = segmentOne === 'globals'\n const isCollection = segmentOne === 'collections'\n\n switch (segments.length) {\n case 0: {\n if (currentRoute === adminRoute) {\n ViewToRender = Dashboard\n templateClassName = 'dashboard'\n templateType = 'default'\n initPageOptions.redirectUnauthenticatedUser = true\n }\n break\n }\n case 1: {\n // users can override the default routes via `admin.routes` config\n // i.e.{ admin: { routes: { logout: '/sign-out', inactivity: '/idle' }}}\n let viewToRender: keyof typeof oneSegmentViews\n\n if (config.admin.routes) {\n const matchedRoute = Object.entries(config.admin.routes).find(([, route]) => {\n return isPathMatchingRoute({\n currentRoute,\n exact: true,\n path: `${adminRoute}${route}`,\n })\n })\n\n if (matchedRoute) {\n viewToRender = matchedRoute[0] as keyof typeof oneSegmentViews\n }\n }\n\n if (oneSegmentViews[viewToRender]) {\n // --> /account\n // --> /create-first-user\n // --> /forgot\n // --> /login\n // --> /logout\n // --> /logout-inactivity\n // --> /unauthorized\n\n ViewToRender = oneSegmentViews[viewToRender]\n templateClassName = baseClasses[viewToRender]\n templateType = 'minimal'\n\n if (viewToRender === 'account') {\n initPageOptions.redirectUnauthenticatedUser = true\n templateType = 'default'\n }\n }\n break\n }\n case 2: {\n if (segmentOne === 'reset') {\n // --> /reset/:token\n ViewToRender = ResetPassword\n templateClassName = baseClasses[segmentTwo]\n templateType = 'minimal'\n }\n\n if (isCollection) {\n // --> /collections/:collectionSlug\n initPageOptions.redirectUnauthenticatedUser = true\n ViewToRender = ListView\n templateClassName = `${segmentTwo}-list`\n templateType = 'default'\n } else if (isGlobal) {\n // --> /globals/:globalSlug\n initPageOptions.redirectUnauthenticatedUser = true\n ViewToRender = DocumentView\n templateClassName = 'global-edit'\n templateType = 'default'\n }\n break\n }\n default:\n if (segmentTwo === 'verify') {\n // --> /:collectionSlug/verify/:token\n ViewToRender = Verify\n templateClassName = 'verify'\n templateType = 'minimal'\n } else if (isCollection) {\n // Custom Views\n // --> /collections/:collectionSlug/:id\n // --> /collections/:collectionSlug/:id/preview\n // --> /collections/:collectionSlug/:id/versions\n // --> /collections/:collectionSlug/:id/versions/:versionId\n // --> /collections/:collectionSlug/:id/api\n initPageOptions.redirectUnauthenticatedUser = true\n ViewToRender = DocumentView\n templateClassName = `collection-default-edit`\n templateType = 'default'\n } else if (isGlobal) {\n // Custom Views\n // --> /globals/:globalSlug/versions\n // --> /globals/:globalSlug/preview\n // --> /globals/:globalSlug/versions/:versionId\n // --> /globals/:globalSlug/api\n initPageOptions.redirectUnauthenticatedUser = true\n ViewToRender = DocumentView\n templateClassName = `global-edit`\n templateType = 'default'\n }\n break\n }\n\n if (!ViewToRender) {\n ViewToRender = getCustomViewByRoute({ config, currentRoute })\n }\n\n return {\n DefaultView: ViewToRender,\n initPageOptions,\n templateClassName,\n templateType,\n }\n}\n"],"names":["Account","CreateFirstUserView","Dashboard","Document","DocumentView","ForgotPasswordView","forgotPasswordBaseClass","ListView","LoginView","loginBaseClass","LogoutInactivity","LogoutView","ResetPassword","resetPasswordBaseClass","UnauthorizedView","Verify","verifyBaseClass","getCustomViewByRoute","isPathMatchingRoute","baseClasses","account","forgot","login","reset","verify","oneSegmentViews","createFirstUser","inactivity","logout","unauthorized","getViewFromConfig","adminRoute","config","currentRoute","searchParams","segments","ViewToRender","templateClassName","templateType","initPageOptions","route","segmentOne","segmentTwo","isGlobal","isCollection","length","redirectUnauthenticatedUser","viewToRender","admin","routes","matchedRoute","Object","entries","find","exact","path","DefaultView"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAKA,SAASA,OAAO,QAAQ,sBAAqB;AAC7C,SAASC,mBAAmB,QAAQ,8BAA6B;AACjE,SAASC,SAA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A+C;gBAC/C,gDAAgD;gBAChD,2DAA2D;gBAC3D,2CAA2C;gBAC3CL,gBAAgBO,2BAA2B,GAAG;gBAC9CV,eAAehC;gBACfiC,oBAAoB,CAAC,uBAAuB,CAAC;gBAC7CC,eAAe;YACjB,OAAO,IAAIK,UAAU;gBACnB,eAAe;gBACf,oCAAoC;gBACpC,mCAAmC;gBACnC,+CAA+C;gBAC/C,+BAA+B;gBAC/BJ,gBAAgBO,2BAA2B,GAAG;gBAC9CV,eAAehC;gBACfiC,oBAAoB,CAAC,WAAW,CAAC;gBACjCC,eAAe;YACjB;YACA;IACJ;IAEA,IAAI,CAACF,cAAc;QACjBA,eAAenB,qBAAqB;YAAEe;YAAQC;QAAa;IAC7D;IAEA,OAAO;QACLuB,aAAapB;QACbG;QACAF;QACAC;IACF;AACF,EAAC"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { CollectionPermission, GlobalPermission } from 'payload/auth';
|
|
2
|
-
import type { OptionObject } from 'payload/types';
|
|
3
|
-
import type { Document } from 'payload/types';
|
|
2
|
+
import type { Document, OptionObject } from 'payload/types';
|
|
4
3
|
export type CompareOption = {
|
|
5
4
|
label: string;
|
|
6
5
|
options?: CompareOption[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/views/Version/Default/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAA;AAC1E,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/views/Version/Default/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAA;AAC1E,OAAO,KAAK,EAAE,QAAQ,EAAG,YAAY,EAAE,MAAM,eAAe,CAAA;AAE5D,MAAM,MAAM,aAAa,GAAG;IAC1B,KAAK,EAAE,MAAM,CAAA;IACb,OAAO,CAAC,EAAE,aAAa,EAAE,CAAA;IACzB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,KAAK,EAAE,MAAM,CAAA;CACd,CAAA;AAED,MAAM,MAAM,wBAAwB,GAAG;IACrC,GAAG,EAAE,QAAQ,CAAA;IACb,cAAc,EAAE,oBAAoB,GAAG,gBAAgB,CAAA;IACvD,oBAAoB,EAAE,QAAQ,CAAA;IAC9B,aAAa,EAAE,YAAY,EAAE,CAAA;IAC7B,aAAa,EAAE,QAAQ,CAAA;IACvB,YAAY,EAAE,QAAQ,CAAA;IACtB,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/views/Version/Default/types.ts"],"sourcesContent":["import type { CollectionPermission, GlobalPermission } from 'payload/auth'\nimport type {
|
|
1
|
+
{"version":3,"sources":["../../../../src/views/Version/Default/types.ts"],"sourcesContent":["import type { CollectionPermission, GlobalPermission } from 'payload/auth'\nimport type { Document , OptionObject } from 'payload/types'\n\nexport type CompareOption = {\n label: string\n options?: CompareOption[]\n relationTo?: string\n value: string\n}\n\nexport type DefaultVersionsViewProps = {\n doc: Document\n docPermissions: CollectionPermission | GlobalPermission\n initialComparisonDoc: Document\n localeOptions: OptionObject[]\n mostRecentDoc: Document\n publishedDoc: Document\n versionID?: string\n}\n"],"names":[],"rangeMappings":"","mappings":"AAUA,WAQC"}
|
|
@@ -17,7 +17,7 @@ declare const _default: {
|
|
|
17
17
|
isClearable?: boolean;
|
|
18
18
|
isSortable?: boolean;
|
|
19
19
|
name?: string;
|
|
20
|
-
onChange?: (e: string) => void;
|
|
20
|
+
onChange?: (e: string | string[]) => void;
|
|
21
21
|
options?: import("packages/payload/src/exports/types.js").Option[];
|
|
22
22
|
path?: string;
|
|
23
23
|
value?: string;
|
|
@@ -33,7 +33,7 @@ declare const _default: {
|
|
|
33
33
|
isClearable?: boolean;
|
|
34
34
|
isSortable?: boolean;
|
|
35
35
|
name?: string;
|
|
36
|
-
onChange?: (e: string) => void;
|
|
36
|
+
onChange?: (e: string | string[]) => void;
|
|
37
37
|
options?: import("packages/payload/src/exports/types.js").Option[];
|
|
38
38
|
path?: string;
|
|
39
39
|
value?: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@payloadcms/next",
|
|
3
|
-
"version": "3.0.0-beta.
|
|
3
|
+
"version": "3.0.0-beta.48",
|
|
4
4
|
"homepage": "https://payloadcms.com",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -42,9 +42,9 @@
|
|
|
42
42
|
"sass": "1.77.4",
|
|
43
43
|
"sonner": "^1.5.0",
|
|
44
44
|
"ws": "^8.16.0",
|
|
45
|
-
"@payloadcms/graphql": "3.0.0-beta.
|
|
46
|
-
"@payloadcms/ui": "3.0.0-beta.
|
|
47
|
-
"@payloadcms/translations": "3.0.0-beta.
|
|
45
|
+
"@payloadcms/graphql": "3.0.0-beta.48",
|
|
46
|
+
"@payloadcms/ui": "3.0.0-beta.48",
|
|
47
|
+
"@payloadcms/translations": "3.0.0-beta.48"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
50
|
"@next/eslint-plugin-next": "^14.1.0",
|
|
@@ -63,13 +63,13 @@
|
|
|
63
63
|
"terser-webpack-plugin": "^5.3.10",
|
|
64
64
|
"webpack": "^5.78.0",
|
|
65
65
|
"webpack-cli": "^5.1.4",
|
|
66
|
-
"
|
|
67
|
-
"
|
|
66
|
+
"@payloadcms/eslint-config": "1.1.1",
|
|
67
|
+
"payload": "3.0.0-beta.48"
|
|
68
68
|
},
|
|
69
69
|
"peerDependencies": {
|
|
70
70
|
"graphql": "^16.8.1",
|
|
71
71
|
"next": "^15.0.0-rc.0",
|
|
72
|
-
"payload": "3.0.0-beta.
|
|
72
|
+
"payload": "3.0.0-beta.48"
|
|
73
73
|
},
|
|
74
74
|
"engines": {
|
|
75
75
|
"node": "^18.20.2 || >=20.9.0"
|