@payloadcms/ui 4.0.0-canary.7 → 4.0.0-canary.9
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/elements/AddNewRelation/index.css +28 -28
- package/dist/elements/AppHeader/index.d.ts +2 -1
- package/dist/elements/AppHeader/index.d.ts.map +1 -1
- package/dist/elements/AppHeader/index.js +2 -0
- package/dist/elements/AppHeader/index.js.map +1 -1
- package/dist/elements/BulkUpload/FormsManager/index.d.ts.map +1 -1
- package/dist/elements/BulkUpload/FormsManager/index.js +13 -0
- package/dist/elements/BulkUpload/FormsManager/index.js.map +1 -1
- package/dist/elements/DocumentFields/index.css +8 -0
- package/dist/elements/Hierarchy/Tree/TreeNode/index.css +38 -13
- package/dist/elements/Hierarchy/Tree/TreeNode/index.d.ts.map +1 -1
- package/dist/elements/Hierarchy/Tree/TreeNode/index.js +37 -31
- package/dist/elements/Hierarchy/Tree/TreeNode/index.js.map +1 -1
- package/dist/elements/Hierarchy/Tree/index.css +1 -1
- package/dist/elements/Hierarchy/Tree/index.d.ts.map +1 -1
- package/dist/elements/Hierarchy/Tree/index.js +18 -5
- package/dist/elements/Hierarchy/Tree/index.js.map +1 -1
- package/dist/elements/RenderServerComponent/clientOnly.d.ts +8 -0
- package/dist/elements/RenderServerComponent/clientOnly.d.ts.map +1 -0
- package/dist/elements/RenderServerComponent/clientOnly.js +56 -0
- package/dist/elements/RenderServerComponent/clientOnly.js.map +1 -0
- package/dist/elements/SidebarRow/index.css +0 -2
- package/dist/elements/UserMenu/index.d.ts +1 -0
- package/dist/elements/UserMenu/index.d.ts.map +1 -1
- package/dist/elements/UserMenu/index.js +2 -1
- package/dist/elements/UserMenu/index.js.map +1 -1
- package/dist/exports/client/index.js +1 -86
- package/dist/exports/client/index.js.map +4 -4
- package/dist/exports/server.d.ts +3 -0
- package/dist/exports/server.d.ts.map +1 -0
- package/dist/exports/server.js +2 -0
- package/dist/exports/server.js.map +1 -0
- package/dist/exports/shared/index.js.map +2 -2
- package/dist/fields/Group/index.css +1 -7
- package/dist/fields/Slug/index.d.ts +7 -5
- package/dist/fields/Slug/index.d.ts.map +1 -1
- package/dist/fields/Slug/index.js +6 -4
- package/dist/fields/Slug/index.js.map +1 -1
- package/dist/fields/index.d.ts.map +1 -1
- package/dist/fields/index.js +2 -0
- package/dist/fields/index.js.map +1 -1
- package/dist/forms/Form/types.d.ts +2 -2
- package/dist/forms/Form/types.d.ts.map +1 -1
- package/dist/forms/Form/types.js.map +1 -1
- package/dist/forms/RenderFields/RenderField.d.ts.map +1 -1
- package/dist/forms/RenderFields/RenderField.js +10 -0
- package/dist/forms/RenderFields/RenderField.js.map +1 -1
- package/dist/forms/RenderFields/index.css +4 -4
- package/dist/forms/fieldSchemasToFormState/calculateDefaultValues/index.d.ts +2 -2
- package/dist/forms/fieldSchemasToFormState/calculateDefaultValues/index.d.ts.map +1 -1
- package/dist/forms/fieldSchemasToFormState/calculateDefaultValues/index.js.map +1 -1
- package/dist/forms/fieldSchemasToFormState/calculateDefaultValues/iterateFields.d.ts +2 -2
- package/dist/forms/fieldSchemasToFormState/calculateDefaultValues/iterateFields.d.ts.map +1 -1
- package/dist/forms/fieldSchemasToFormState/calculateDefaultValues/iterateFields.js.map +1 -1
- package/dist/forms/fieldSchemasToFormState/calculateDefaultValues/promise.d.ts +2 -2
- package/dist/forms/fieldSchemasToFormState/calculateDefaultValues/promise.d.ts.map +1 -1
- package/dist/forms/fieldSchemasToFormState/calculateDefaultValues/promise.js.map +1 -1
- package/dist/providers/Auth/index.d.ts +2 -2
- package/dist/providers/Auth/index.d.ts.map +1 -1
- package/dist/providers/Auth/index.js.map +1 -1
- package/dist/providers/DocumentInfo/types.d.ts +2 -2
- package/dist/providers/DocumentInfo/types.d.ts.map +1 -1
- package/dist/providers/DocumentInfo/types.js.map +1 -1
- package/dist/providers/Root/index.d.ts +2 -2
- package/dist/providers/Root/index.d.ts.map +1 -1
- package/dist/providers/Root/index.js.map +1 -1
- package/dist/styles.css +1369 -1
- package/dist/templates/Default/index.d.ts.map +1 -1
- package/dist/templates/Default/index.js +6 -0
- package/dist/templates/Default/index.js.map +1 -1
- package/dist/utilities/copyDataFromLocale.d.ts.map +1 -1
- package/dist/utilities/copyDataFromLocale.js +1 -0
- package/dist/utilities/copyDataFromLocale.js.map +1 -1
- package/dist/utilities/getDocPreferences.d.ts +2 -2
- package/dist/utilities/getDocPreferences.d.ts.map +1 -1
- package/dist/utilities/getDocPreferences.js.map +1 -1
- package/dist/utilities/getDocumentData.d.ts +2 -2
- package/dist/utilities/getDocumentData.d.ts.map +1 -1
- package/dist/utilities/getDocumentData.js.map +1 -1
- package/dist/utilities/getGlobalData.d.ts.map +1 -1
- package/dist/utilities/getGlobalData.js.map +1 -1
- package/dist/utilities/getHasScheduledPublish.d.ts +2 -2
- package/dist/utilities/getHasScheduledPublish.d.ts.map +1 -1
- package/dist/utilities/getHasScheduledPublish.js.map +1 -1
- package/dist/utilities/getIsLocked.d.ts +2 -2
- package/dist/utilities/getIsLocked.d.ts.map +1 -1
- package/dist/utilities/getIsLocked.js.map +1 -1
- package/dist/utilities/getVersions.d.ts +2 -2
- package/dist/utilities/getVersions.d.ts.map +1 -1
- package/dist/utilities/getVersions.js.map +1 -1
- package/dist/utilities/handleAuthRedirect.d.ts +2 -2
- package/dist/utilities/handleAuthRedirect.d.ts.map +1 -1
- package/dist/utilities/handleAuthRedirect.js.map +1 -1
- package/dist/utilities/handleFormStateLocking.d.ts +2 -2
- package/dist/utilities/handleFormStateLocking.d.ts.map +1 -1
- package/dist/utilities/handleFormStateLocking.js.map +1 -1
- package/dist/utilities/handleLivePreview.d.ts +1 -0
- package/dist/utilities/handleLivePreview.d.ts.map +1 -1
- package/dist/utilities/serverFunctionRegistry.d.ts +13 -0
- package/dist/utilities/serverFunctionRegistry.d.ts.map +1 -0
- package/dist/utilities/serverFunctionRegistry.js +25 -0
- package/dist/utilities/serverFunctionRegistry.js.map +1 -0
- package/dist/utilities/slugify.d.ts +1 -1
- package/dist/utilities/slugify.js +1 -1
- package/dist/utilities/slugify.js.map +1 -1
- package/dist/views/Account/ResetPreferences/index.d.ts +2 -2
- package/dist/views/Account/ResetPreferences/index.d.ts.map +1 -1
- package/dist/views/Account/ResetPreferences/index.js.map +1 -1
- package/dist/views/Account/Settings/index.d.ts +2 -2
- package/dist/views/Account/Settings/index.d.ts.map +1 -1
- package/dist/views/Account/Settings/index.js.map +1 -1
- package/dist/views/Dashboard/Default/ModularDashboard/utils/getItemsFromPreferences.d.ts +2 -2
- package/dist/views/Dashboard/Default/ModularDashboard/utils/getItemsFromPreferences.d.ts.map +1 -1
- package/dist/views/Dashboard/Default/ModularDashboard/utils/getItemsFromPreferences.js.map +1 -1
- package/dist/views/Document/index.d.ts.map +1 -1
- package/dist/views/Document/index.js +8 -1
- package/dist/views/Document/index.js.map +1 -1
- package/dist/views/Logout/LogoutClient.d.ts +14 -0
- package/dist/views/Logout/LogoutClient.d.ts.map +1 -1
- package/dist/views/Logout/LogoutClient.js +6 -4
- package/dist/views/Logout/LogoutClient.js.map +1 -1
- package/dist/views/Logout/index.d.ts.map +1 -1
- package/dist/views/Logout/index.js +7 -2
- package/dist/views/Logout/index.js.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/fields/index.d.ts.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/fields/index.js +1 -0
- package/dist/views/Version/RenderFieldsToDiff/fields/index.js.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/utilities/countChangedFields.d.ts.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/utilities/countChangedFields.js +1 -0
- package/dist/views/Version/RenderFieldsToDiff/utilities/countChangedFields.js.map +1 -1
- package/dist/views/Versions/fetchVersions.d.ts +4 -4
- package/dist/views/Versions/fetchVersions.d.ts.map +1 -1
- package/dist/views/Versions/fetchVersions.js.map +1 -1
- package/dist/views/Versions/types.d.ts +2 -2
- package/dist/views/Versions/types.d.ts.map +1 -1
- package/dist/views/Versions/types.js.map +1 -1
- package/dist/widgets/CollectionCards/getCollectionCardsData.d.ts +20 -0
- package/dist/widgets/CollectionCards/getCollectionCardsData.d.ts.map +1 -0
- package/dist/widgets/CollectionCards/getCollectionCardsData.js +29 -0
- package/dist/widgets/CollectionCards/getCollectionCardsData.js.map +1 -0
- package/dist/widgets/CollectionCards/index.client.d.ts +5 -0
- package/dist/widgets/CollectionCards/index.client.d.ts.map +1 -0
- package/dist/widgets/CollectionCards/index.client.js +139 -0
- package/dist/widgets/CollectionCards/index.client.js.map +1 -0
- package/package.json +57 -7
- package/dist/exports/client/CodeEditor-T3624SG3.js +0 -14
- package/dist/exports/client/CodeEditor-T3624SG3.js.map +0 -7
- package/dist/exports/client/DatePicker-6KF52Z3G.js +0 -14
- package/dist/exports/client/DatePicker-6KF52Z3G.js.map +0 -7
- package/dist/exports/client/chunk-5LKBKI4T.js +0 -14
- package/dist/exports/client/chunk-5LKBKI4T.js.map +0 -7
- package/dist/exports/client/chunk-7T64ULOM.js +0 -29
- package/dist/exports/client/chunk-7T64ULOM.js.map +0 -7
- package/dist/exports/client/chunk-DMFYTMX6.js +0 -27
- package/dist/exports/client/chunk-DMFYTMX6.js.map +0 -7
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handleFormStateLocking.js","names":["lockDurationDefault","handleFormStateLocking","id","collectionSlug","globalSlug","req","updateLastEdited","result","payload","collections","lockedDocumentQuery","and","equals","lockDocumentsProp","config","lockDocuments","globals","find","g","slug","lockDuration","duration","lockDurationInMilliseconds","now","Date","getTime","push","updatedAt","greater_than","toISOString","lockedDocument","collection","depth","limit","overrideAccess","pagination","user","where","docs","length","isLocked","lastEditedAt","value","lockOwnerID","db","updateOne","data","returning","deleteExpiredLocksQuery","less_than","deleteMany","create","document","relationTo","undefined"],"sources":["../../src/utilities/handleFormStateLocking.ts"],"sourcesContent":["import type { PayloadRequest,
|
|
1
|
+
{"version":3,"file":"handleFormStateLocking.js","names":["lockDurationDefault","handleFormStateLocking","id","collectionSlug","globalSlug","req","updateLastEdited","result","payload","collections","lockedDocumentQuery","and","equals","lockDocumentsProp","config","lockDocuments","globals","find","g","slug","lockDuration","duration","lockDurationInMilliseconds","now","Date","getTime","push","updatedAt","greater_than","toISOString","lockedDocument","collection","depth","limit","overrideAccess","pagination","user","where","docs","length","isLocked","lastEditedAt","value","lockOwnerID","db","updateOne","data","returning","deleteExpiredLocksQuery","less_than","deleteMany","create","document","relationTo","undefined"],"sources":["../../src/utilities/handleFormStateLocking.ts"],"sourcesContent":["import type { PayloadRequest, User } from 'payload'\n\ntype Args = {\n collectionSlug?: string\n globalSlug?: string\n id?: number | string\n req: PayloadRequest\n updateLastEdited?: boolean\n}\n\ntype Result = {\n isLocked: boolean\n lastEditedAt: string\n user: User\n}\n\nconst lockDurationDefault = 300 // Default 5 minutes in seconds\n\nexport const handleFormStateLocking = async ({\n id,\n collectionSlug,\n globalSlug,\n req,\n updateLastEdited,\n}: Args): Promise<Result> => {\n let result: Result\n\n // Check if the locked-documents collection exists\n if (!req.payload.collections?.['payload-locked-documents']) {\n // If the collection doesn't exist, locking is not available\n return result\n }\n\n if (id || globalSlug) {\n let lockedDocumentQuery\n\n if (collectionSlug) {\n lockedDocumentQuery = {\n and: [\n { 'document.relationTo': { equals: collectionSlug } },\n { 'document.value': { equals: id } },\n ],\n }\n } else if (globalSlug) {\n lockedDocumentQuery = {\n and: [{ globalSlug: { equals: globalSlug } }],\n }\n }\n\n const lockDocumentsProp = collectionSlug\n ? req.payload.collections?.[collectionSlug]?.config.lockDocuments\n : req.payload.config.globals.find((g) => g.slug === globalSlug)?.lockDocuments\n\n const lockDuration =\n typeof lockDocumentsProp === 'object' ? lockDocumentsProp.duration : lockDurationDefault\n const lockDurationInMilliseconds = lockDuration * 1000\n const now = new Date().getTime()\n\n if (lockedDocumentQuery) {\n // Query where the lock is newer than the current time minus the lock duration\n lockedDocumentQuery.and.push({\n updatedAt: {\n greater_than: new Date(now - lockDurationInMilliseconds).toISOString(),\n },\n })\n\n const lockedDocument = await req.payload.find({\n collection: 'payload-locked-documents',\n depth: 1,\n limit: 1,\n overrideAccess: false,\n pagination: false,\n user: req.user,\n where: lockedDocumentQuery,\n })\n\n if (lockedDocument.docs && lockedDocument.docs.length > 0) {\n result = {\n isLocked: true,\n lastEditedAt: lockedDocument.docs[0]?.updatedAt,\n user: lockedDocument.docs[0]?.user?.value,\n }\n\n const lockOwnerID =\n typeof lockedDocument.docs[0]?.user?.value === 'object'\n ? lockedDocument.docs[0]?.user?.value?.id\n : lockedDocument.docs[0]?.user?.value\n // Should only update doc if the incoming / current user is also the owner of the locked doc\n if (updateLastEdited && req.user && lockOwnerID === req.user.id) {\n await req.payload.db.updateOne({\n id: lockedDocument.docs[0].id,\n collection: 'payload-locked-documents',\n data: {},\n returning: false,\n })\n }\n } else {\n // If NO ACTIVE lock document exists, first delete any expired locks and then create a fresh lock\n // Where updatedAt is older than the duration that is specified in the config\n let deleteExpiredLocksQuery\n\n if (collectionSlug) {\n deleteExpiredLocksQuery = {\n and: [\n { 'document.relationTo': { equals: collectionSlug } },\n {\n updatedAt: {\n less_than: new Date(now - lockDurationInMilliseconds).toISOString(),\n },\n },\n ],\n }\n } else if (globalSlug) {\n deleteExpiredLocksQuery = {\n and: [\n { globalSlug: { equals: globalSlug } },\n {\n updatedAt: {\n less_than: new Date(now - lockDurationInMilliseconds).toISOString(),\n },\n },\n ],\n }\n }\n\n await req.payload.db.deleteMany({\n collection: 'payload-locked-documents',\n where: deleteExpiredLocksQuery,\n })\n\n await req.payload.db.create({\n collection: 'payload-locked-documents',\n data: {\n document: collectionSlug\n ? {\n relationTo: collectionSlug,\n value: id,\n }\n : undefined,\n globalSlug: globalSlug ? globalSlug : undefined,\n user: {\n relationTo: req.user.collection,\n value: req.user.id,\n },\n },\n returning: false,\n })\n\n result = {\n isLocked: true,\n lastEditedAt: new Date().toISOString(),\n user: req.user,\n }\n }\n }\n }\n\n return result\n}\n"],"mappings":"AAgBA,MAAMA,mBAAA,GAA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AuB;gBAAEC,MAAA,EAAQT;cAAe;YAAE,GACpD;cACEwB,SAAA,EAAW;gBACTsB,SAAA,EAAW,IAAIzB,IAAA,CAAKD,GAAA,GAAMD,0BAAA,EAA4BO,WAAW;cACnE;YACF;UAEJ;QACF,OAAO,IAAIzB,UAAA,EAAY;UACrB4C,uBAAA,GAA0B;YACxBrC,GAAA,EAAK,CACH;cAAEP,UAAA,EAAY;gBAAEQ,MAAA,EAAQR;cAAW;YAAE,GACrC;cACEuB,SAAA,EAAW;gBACTsB,SAAA,EAAW,IAAIzB,IAAA,CAAKD,GAAA,GAAMD,0BAAA,EAA4BO,WAAW;cACnE;YACF;UAEJ;QACF;QAEA,MAAMxB,GAAA,CAAIG,OAAO,CAACoC,EAAE,CAACM,UAAU,CAAC;UAC9BnB,UAAA,EAAY;UACZM,KAAA,EAAOW;QACT;QAEA,MAAM3C,GAAA,CAAIG,OAAO,CAACoC,EAAE,CAACO,MAAM,CAAC;UAC1BpB,UAAA,EAAY;UACZe,IAAA,EAAM;YACJM,QAAA,EAAUjD,cAAA,GACN;cACEkD,UAAA,EAAYlD,cAAA;cACZuC,KAAA,EAAOxC;YACT,IACAoD,SAAA;YACJlD,UAAA,EAAYA,UAAA,GAAaA,UAAA,GAAakD,SAAA;YACtClB,IAAA,EAAM;cACJiB,UAAA,EAAYhD,GAAA,CAAI+B,IAAI,CAACL,UAAU;cAC/BW,KAAA,EAAOrC,GAAA,CAAI+B,IAAI,CAAClC;YAClB;UACF;UACA6C,SAAA,EAAW;QACb;QAEAxC,MAAA,GAAS;UACPiC,QAAA,EAAU;UACVC,YAAA,EAAc,IAAIjB,IAAA,GAAOK,WAAW;UACpCO,IAAA,EAAM/B,GAAA,CAAI+B;QACZ;MACF;IACF;EACF;EAEA,OAAO7B,MAAA;AACT","ignoreList":[]}
|
|
@@ -11,6 +11,7 @@ export declare const getLivePreviewConfig: ({ collectionConfig, config, globalCo
|
|
|
11
11
|
name: string;
|
|
12
12
|
width: number | string;
|
|
13
13
|
}[];
|
|
14
|
+
openByDefault?: boolean;
|
|
14
15
|
url?: ((args: {
|
|
15
16
|
collectionConfig?: import("payload").SanitizedCollectionConfig;
|
|
16
17
|
data: Record<string, any>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handleLivePreview.d.ts","sourceRoot":"","sources":["../../src/utilities/handleLivePreview.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,gBAAgB,EAChB,YAAY,EACZ,iBAAiB,EACjB,kBAAkB,EAClB,SAAS,EACT,cAAc,EACd,eAAe,EAChB,MAAM,SAAS,CAAA;AAEhB,eAAO,MAAM,oBAAoB,GAAI,mEAKlC;IACD,gBAAgB,CAAC,EAAE,gBAAgB,CAAA;IACnC,MAAM,EAAE,eAAe,CAAA;IACvB,YAAY,CAAC,EAAE,YAAY,CAAA;IAC3B,oBAAoB,EAAE,OAAO,CAAA;CAC9B
|
|
1
|
+
{"version":3,"file":"handleLivePreview.d.ts","sourceRoot":"","sources":["../../src/utilities/handleLivePreview.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,gBAAgB,EAChB,YAAY,EACZ,iBAAiB,EACjB,kBAAkB,EAClB,SAAS,EACT,cAAc,EACd,eAAe,EAChB,MAAM,SAAS,CAAA;AAEhB,eAAO,MAAM,oBAAoB,GAAI,mEAKlC;IACD,gBAAgB,CAAC,EAAE,gBAAgB,CAAA;IACnC,MAAM,EAAE,eAAe,CAAA;IACvB,YAAY,CAAC,EAAE,YAAY,CAAA;IAC3B,oBAAoB,EAAE,OAAO,CAAA;CAC9B;;;;;;;;;wBAsHwhJ,CAAC;;oBAAoF,CAAC;;;;;;;CAlH7mJ,CAAA;AAEF;;;;;GAKG;AACH,eAAO,MAAM,oBAAoB,GAAI,6CAIlC;IACD,gBAAgB,CAAC,EAAE,gBAAgB,CAAA;IACnC,MAAM,EAAE,eAAe,CAAA;IACvB,YAAY,CAAC,EAAE,YAAY,CAAA;CAC5B,KAAG,OAcH,CAAA;AAED;;;;;;;;;GASG;AACH,eAAO,MAAM,iBAAiB,GAAU,+DAOrC;IACD,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,MAAM,EAAE,eAAe,CAAA;IACvB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IAC7B,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,SAAS,CAAC,EAAE,SAAS,CAAA;IACrB,GAAG,EAAE,cAAc,CAAA;CACpB,KAAG,OAAO,CAAC;IACV,oBAAoB,CAAC,EAAE,OAAO,CAAA;IAC9B,iBAAiB,CAAC,EAAE,iBAAiB,CAAA;IACrC,cAAc,CAAC,EAAE,kBAAkB,CAAA;CACpC,CAqDA,CAAA"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { ServerFunction } from 'payload';
|
|
2
|
+
/**
|
|
3
|
+
* Framework-agnostic server function handlers shared across all adapters.
|
|
4
|
+
*
|
|
5
|
+
* Each handler returns a value that may contain React elements (e.g.
|
|
6
|
+
* `customComponents` inside form state, the `Document` / `List` nodes returned
|
|
7
|
+
* by render-document / render-list). Adapters are expected to ship those over
|
|
8
|
+
* the wire as RSC payloads — Next.js's runtime does this natively, while the
|
|
9
|
+
* TanStack Start adapter pipes the result through `serializeForRsc` to convert
|
|
10
|
+
* elements into `renderServerComponent` handles.
|
|
11
|
+
*/
|
|
12
|
+
export declare const sharedServerFunctions: Record<string, ServerFunction<any, any>>;
|
|
13
|
+
//# sourceMappingURL=serverFunctionRegistry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"serverFunctionRegistry.d.ts","sourceRoot":"","sources":["../../src/utilities/serverFunctionRegistry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAS7C;;;;;;;;;GASG;AACH,eAAO,MAAM,qBAAqB,EAAE,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,GAAG,EAAE,GAAG,CAAC,CAO1E,CAAA"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { renderDocumentHandler } from '../views/Document/handleServerFunction.js';
|
|
2
|
+
import { renderListHandler } from '../views/List/handleServerFunction.js';
|
|
3
|
+
import { buildFormStateHandler } from './buildFormState.js';
|
|
4
|
+
import { buildTableStateHandler } from './buildTableState.js';
|
|
5
|
+
import { copyDataFromLocaleHandler } from './copyDataFromLocale.js';
|
|
6
|
+
import { schedulePublishHandler } from './schedulePublishHandler.js';
|
|
7
|
+
/**
|
|
8
|
+
* Framework-agnostic server function handlers shared across all adapters.
|
|
9
|
+
*
|
|
10
|
+
* Each handler returns a value that may contain React elements (e.g.
|
|
11
|
+
* `customComponents` inside form state, the `Document` / `List` nodes returned
|
|
12
|
+
* by render-document / render-list). Adapters are expected to ship those over
|
|
13
|
+
* the wire as RSC payloads — Next.js's runtime does this natively, while the
|
|
14
|
+
* TanStack Start adapter pipes the result through `serializeForRsc` to convert
|
|
15
|
+
* elements into `renderServerComponent` handles.
|
|
16
|
+
*/
|
|
17
|
+
export const sharedServerFunctions = {
|
|
18
|
+
'copy-data-from-locale': copyDataFromLocaleHandler,
|
|
19
|
+
'form-state': buildFormStateHandler,
|
|
20
|
+
'render-document': renderDocumentHandler,
|
|
21
|
+
'render-list': renderListHandler,
|
|
22
|
+
'schedule-publish': schedulePublishHandler,
|
|
23
|
+
'table-state': buildTableStateHandler
|
|
24
|
+
};
|
|
25
|
+
//# sourceMappingURL=serverFunctionRegistry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"serverFunctionRegistry.js","names":["renderDocumentHandler","renderListHandler","buildFormStateHandler","buildTableStateHandler","copyDataFromLocaleHandler","schedulePublishHandler","sharedServerFunctions"],"sources":["../../src/utilities/serverFunctionRegistry.ts"],"sourcesContent":["import type { ServerFunction } from 'payload'\n\nimport { renderDocumentHandler } from '../views/Document/handleServerFunction.js'\nimport { renderListHandler } from '../views/List/handleServerFunction.js'\nimport { buildFormStateHandler } from './buildFormState.js'\nimport { buildTableStateHandler } from './buildTableState.js'\nimport { copyDataFromLocaleHandler } from './copyDataFromLocale.js'\nimport { schedulePublishHandler } from './schedulePublishHandler.js'\n\n/**\n * Framework-agnostic server function handlers shared across all adapters.\n *\n * Each handler returns a value that may contain React elements (e.g.\n * `customComponents` inside form state, the `Document` / `List` nodes returned\n * by render-document / render-list). Adapters are expected to ship those over\n * the wire as RSC payloads — Next.js's runtime does this natively, while the\n * TanStack Start adapter pipes the result through `serializeForRsc` to convert\n * elements into `renderServerComponent` handles.\n */\nexport const sharedServerFunctions: Record<string, ServerFunction<any, any>> = {\n 'copy-data-from-locale': copyDataFromLocaleHandler,\n 'form-state': buildFormStateHandler,\n 'render-document': renderDocumentHandler,\n 'render-list': renderListHandler,\n 'schedule-publish': schedulePublishHandler,\n 'table-state': buildTableStateHandler,\n}\n"],"mappings":"AAEA,SAASA,qBAAqB,QAAQ;AACtC,SAASC,iBAAiB,QAAQ;AAClC,SAASC,qBAAqB,QAAQ;AACtC,SAASC,sBAAsB,QAAQ;AACvC,SAASC,yBAAyB,QAAQ;AAC1C,SAASC,sBAAsB,QAAQ;AAEvC;;;;;;;;;;AAUA,OAAO,MAAMC,qBAAA,GAAkE;EAC7E,yBAAyBF,yBAAA;EACzB,cAAcF,qBAAA;EACd,mBAAmBF,qBAAA;EACnB,eAAeC,iBAAA;EACf,oBAAoBI,sBAAA;EACpB,eAAeF;AACjB","ignoreList":[]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Slugify } from 'payload/shared';
|
|
2
2
|
import { type ServerFunction, type SlugifyServerFunctionArgs } from 'payload';
|
|
3
3
|
/**
|
|
4
|
-
* This server function is directly related to the {@link https://payloadcms.com/docs/fields/
|
|
4
|
+
* This server function is directly related to the {@link https://payloadcms.com/docs/fields/slug | Slug Field}.
|
|
5
5
|
* This is a server function that is used to invoke the user's custom slugify function from the client.
|
|
6
6
|
* This pattern is required, as there is no other way for us to pass their function across the client-server boundary.
|
|
7
7
|
* - Not through props
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { flattenAllFields, getFieldByPath, UnauthorizedError } from 'payload';
|
|
2
2
|
import { slugify as defaultSlugify } from 'payload/shared';
|
|
3
3
|
/**
|
|
4
|
-
* This server function is directly related to the {@link https://payloadcms.com/docs/fields/
|
|
4
|
+
* This server function is directly related to the {@link https://payloadcms.com/docs/fields/slug | Slug Field}.
|
|
5
5
|
* This is a server function that is used to invoke the user's custom slugify function from the client.
|
|
6
6
|
* This pattern is required, as there is no other way for us to pass their function across the client-server boundary.
|
|
7
7
|
* - Not through props
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"slugify.js","names":["flattenAllFields","getFieldByPath","UnauthorizedError","slugify","defaultSlugify","slugifyHandler","args","collectionSlug","data","globalSlug","path","req","valueToSlugify","user","docConfig","payload","collections","config","globals","find","g","slug","Error","field","fields","customSlugify","custom","undefined","result"],"sources":["../../src/utilities/slugify.ts"],"sourcesContent":["import type { Slugify } from 'payload/shared'\n\nimport {\n flattenAllFields,\n getFieldByPath,\n type ServerFunction,\n type SlugifyServerFunctionArgs,\n UnauthorizedError,\n} from 'payload'\nimport { slugify as defaultSlugify } from 'payload/shared'\n\n/**\n * This server function is directly related to the {@link https://payloadcms.com/docs/fields/
|
|
1
|
+
{"version":3,"file":"slugify.js","names":["flattenAllFields","getFieldByPath","UnauthorizedError","slugify","defaultSlugify","slugifyHandler","args","collectionSlug","data","globalSlug","path","req","valueToSlugify","user","docConfig","payload","collections","config","globals","find","g","slug","Error","field","fields","customSlugify","custom","undefined","result"],"sources":["../../src/utilities/slugify.ts"],"sourcesContent":["import type { Slugify } from 'payload/shared'\n\nimport {\n flattenAllFields,\n getFieldByPath,\n type ServerFunction,\n type SlugifyServerFunctionArgs,\n UnauthorizedError,\n} from 'payload'\nimport { slugify as defaultSlugify } from 'payload/shared'\n\n/**\n * This server function is directly related to the {@link https://payloadcms.com/docs/fields/slug | Slug Field}.\n * This is a server function that is used to invoke the user's custom slugify function from the client.\n * This pattern is required, as there is no other way for us to pass their function across the client-server boundary.\n * - Not through props\n * - Not from a server function defined within a server component (see below)\n * When a server function contains non-serializable data within its closure, it gets passed through the boundary (and breaks).\n * The only way to pass server functions to the client (that contain non-serializable data) is if it is globally defined.\n * But we also cannot define this function alongside the server component, as we will not have access to their custom slugify function.\n * See `ServerFunctionsProvider` for more details.\n */\nexport const slugifyHandler: ServerFunction<\n SlugifyServerFunctionArgs,\n Promise<ReturnType<Slugify>>\n> = async (args) => {\n const { collectionSlug, data, globalSlug, path, req, valueToSlugify } = args\n\n if (!req.user) {\n throw new UnauthorizedError()\n }\n\n const docConfig = collectionSlug\n ? req.payload.collections[collectionSlug]?.config\n : globalSlug\n ? req.payload.config.globals.find((g) => g.slug === globalSlug)\n : null\n\n if (!docConfig) {\n throw new Error()\n }\n\n const { field } = getFieldByPath({\n config: req.payload.config,\n fields: flattenAllFields({ fields: docConfig.fields }),\n path,\n })\n\n const customSlugify = (\n typeof field?.custom?.slugify === 'function' ? field.custom.slugify : undefined\n ) as Slugify\n\n const result = customSlugify\n ? await customSlugify({ data, req, valueToSlugify })\n : defaultSlugify(valueToSlugify)\n\n return result\n}\n"],"mappings":"AAEA,SACEA,gBAAgB,EAChBC,cAAc,EAGdC,iBAAiB,QACZ;AACP,SAASC,OAAA,IAAWC,cAAc,QAAQ;AAE1C;;;;;;;;;;;AAWA,OAAO,MAAMC,cAAA,GAGT,MAAOC,IAAA;EACT,MAAM;IAAEC,cAAc;IAAEC,IAAI;IAAEC,UAAU;IAAEC,IAAI;IAAEC,GAAG;IAAEC;EAAc,CAAE,GAAGN,IAAA;EAExE,IAAI,CAACK,GAAA,CAAIE,IAAI,EAAE;IACb,MAAM,IAAIX,iBAAA;EACZ;EAEA,MAAMY,SAAA,GAAYP,cAAA,GACdI,GAAA,CAAII,OAAO,CAACC,WAAW,CAACT,cAAA,CAAe,EAAEU,MAAA,GACzCR,UAAA,GACEE,GAAA,CAAII,OAAO,CAACE,MAAM,CAACC,OAAO,CAACC,IAAI,CAAEC,CAAA,IAAMA,CAAA,CAAEC,IAAI,KAAKZ,UAAA,IAClD;EAEN,IAAI,CAACK,SAAA,EAAW;IACd,MAAM,IAAIQ,KAAA;EACZ;EAEA,MAAM;IAAEC;EAAK,CAAE,GAAGtB,cAAA,CAAe;IAC/BgB,MAAA,EAAQN,GAAA,CAAII,OAAO,CAACE,MAAM;IAC1BO,MAAA,EAAQxB,gBAAA,CAAiB;MAAEwB,MAAA,EAAQV,SAAA,CAAUU;IAAO;IACpDd;EACF;EAEA,MAAMe,aAAA,GACJ,OAAOF,KAAA,EAAOG,MAAA,EAAQvB,OAAA,KAAY,aAAaoB,KAAA,CAAMG,MAAM,CAACvB,OAAO,GAAGwB,SAAA;EAGxE,MAAMC,MAAA,GAASH,aAAA,GACX,MAAMA,aAAA,CAAc;IAAEjB,IAAA;IAAMG,GAAA;IAAKC;EAAe,KAChDR,cAAA,CAAeQ,cAAA;EAEnB,OAAOgB,MAAA;AACT","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/views/Account/ResetPreferences/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/views/Account/ResetPreferences/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,SAAS,CAAA;AAenC,eAAO,MAAM,gBAAgB,EAAE,KAAK,CAAC,EAAE,CAAC;IACtC,QAAQ,CAAC,IAAI,CAAC,EAAE,IAAI,CAAA;CACrB,CAsEA,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["c","_c","formatAdminURL","qs","Fragment","useCallback","toast","Button","ConfirmationModal","useModal","useConfig","useTranslation","confirmResetModalSlug","ResetPreferences","t0","$","user","openModal","t","config","t1","routes","t2","api","apiRoute","t3","stringifiedQuery","stringify","depth","where","equals","id","addQueryPrefix","res","fetch","path","credentials","headers","method","json","message","ok","success","error","t4","_err","handleResetPreferences","t5","_jsxs","children","_jsx","className","buttonStyle","onClick","body","confirmingLabel","heading","modalSlug","onConfirm"],"sources":["../../../../src/views/Account/ResetPreferences/index.tsx"],"sourcesContent":["'use client'\nimport type {
|
|
1
|
+
{"version":3,"file":"index.js","names":["c","_c","formatAdminURL","qs","Fragment","useCallback","toast","Button","ConfirmationModal","useModal","useConfig","useTranslation","confirmResetModalSlug","ResetPreferences","t0","$","user","openModal","t","config","t1","routes","t2","api","apiRoute","t3","stringifiedQuery","stringify","depth","where","equals","id","addQueryPrefix","res","fetch","path","credentials","headers","method","json","message","ok","success","error","t4","_err","handleResetPreferences","t5","_jsxs","children","_jsx","className","buttonStyle","onClick","body","confirmingLabel","heading","modalSlug","onConfirm"],"sources":["../../../../src/views/Account/ResetPreferences/index.tsx"],"sourcesContent":["'use client'\nimport type { User } from 'payload'\n\nimport { formatAdminURL } from 'payload/shared'\nimport * as qs from 'qs-esm'\nimport { Fragment, useCallback } from 'react'\nimport { toast } from 'sonner'\n\nimport { Button } from '../../../elements/Button/index.js'\nimport { ConfirmationModal } from '../../../elements/ConfirmationModal/index.js'\nimport { useModal } from '../../../elements/Modal/index.js'\nimport { useConfig } from '../../../providers/Config/index.js'\nimport { useTranslation } from '../../../providers/Translation/index.js'\n\nconst confirmResetModalSlug = 'confirm-reset-modal'\n\nexport const ResetPreferences: React.FC<{\n readonly user?: User\n}> = ({ user }) => {\n const { openModal } = useModal()\n const { t } = useTranslation()\n const {\n config: {\n routes: { api: apiRoute },\n },\n } = useConfig()\n\n const handleResetPreferences = useCallback(async () => {\n if (!user) {\n return\n }\n\n const stringifiedQuery = qs.stringify(\n {\n depth: 0,\n where: {\n 'user.value': {\n equals: user.id,\n },\n },\n },\n { addQueryPrefix: true },\n )\n\n try {\n const res = await fetch(\n formatAdminURL({\n apiRoute,\n path: `/payload-preferences${stringifiedQuery}`,\n }),\n {\n credentials: 'include',\n headers: {\n 'Content-Type': 'application/json',\n },\n method: 'DELETE',\n },\n )\n\n const json = await res.json()\n const message = json.message\n\n if (res.ok) {\n toast.success(message)\n } else {\n toast.error(message)\n }\n } catch (_err) {\n // swallow error\n }\n }, [apiRoute, user])\n\n return (\n <Fragment>\n <div className=\"payload-reset-preferences\">\n <Button buttonStyle=\"secondary\" onClick={() => openModal(confirmResetModalSlug)}>\n {t('general:resetPreferences')}\n </Button>\n </div>\n <ConfirmationModal\n body={t('general:resetPreferencesDescription')}\n confirmingLabel={t('general:resettingPreferences')}\n heading={t('general:resetPreferences')}\n modalSlug={confirmResetModalSlug}\n onConfirm={handleResetPreferences}\n />\n </Fragment>\n )\n}\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;;AAGA,SAASC,cAAc,QAAQ;AAC/B,YAAYC,EAAA,MAAQ;AACpB,SAASC,QAAQ,EAAEC,WAAW,QAAQ;AACtC,SAASC,KAAK,QAAQ;AAEtB,SAASC,MAAM,QAAQ;AACvB,SAASC,iBAAiB,QAAQ;AAClC,SAASC,QAAQ,QAAQ;AACzB,SAASC,SAAS,QAAQ;AAC1B,SAASC,cAAc,QAAQ;AAE/B,MAAMC,qBAAA,GAAwB;AAE9B,OAAO,MAAMC,gBAAA,GAERC,EAAA;EAAA,MAAAC,CAAA,GAAAd,EAAA;EAAC;IAAAe;EAAA,IAAAF,EAAQ;EACZ;IAAAG;EAAA,IAAsBR,QAAA;EACtB;IAAAS;EAAA,IAAcP,cAAA;EACd;IAAAQ,MAAA,EAAAC;EAAA,IAIIV,SAAA;EAHM;IAAAW,MAAA,EAAAC;EAAA,IAAAF,EAEP;EADS;IAAAG,GAAA,EAAAC;EAAA,IAAAF,EAAiB;EAAA,IAAAG,EAAA;EAAA,IAAAV,CAAA,QAAAS,QAAA,IAAAT,CAAA,QAAAC,IAAA;IAIcS,EAAA,SAAAA,CAAA;MAAA,KACp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GACEC,IAAA,CAAC;QAAAC,SAAA,EAAc;QAAAF,QAAA,EACbC,IAAA,CAAA3C,MAAA;UAAA6C,WAAA,EAAoB;UAAAC,OAAA,EAAqBT,EAAgB;UAAAhC,QAAA,EACtDM,CAAA,CAAE;QAAA,C;UAGPgC,IAAA,CAAA1C,iBAAA;QAAA8C,IAAA,EACQpC,CAAA,CAAE;QAAAqC,eAAA,EACSrC,CAAA,CAAE;QAAAsC,OAAA,EACVtC,CAAA,CAAE;QAAAuC,SAAA,EAAA7C,qBAAA;QAAA8C,SAAA,EAEAZ;MAAA,C;;;;;;;;;SAXfC,E;CAeJ","ignoreList":[]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { I18n } from '@payloadcms/translations';
|
|
2
|
-
import type { BasePayload, Config, LanguageOptions,
|
|
2
|
+
import type { BasePayload, Config, LanguageOptions, User } from 'payload';
|
|
3
3
|
import React from 'react';
|
|
4
4
|
import './index.css';
|
|
5
5
|
export declare const Settings: React.FC<{
|
|
@@ -8,6 +8,6 @@ export declare const Settings: React.FC<{
|
|
|
8
8
|
readonly languageOptions: LanguageOptions;
|
|
9
9
|
readonly payload: BasePayload;
|
|
10
10
|
readonly theme: Config['admin']['theme'];
|
|
11
|
-
readonly user?:
|
|
11
|
+
readonly user?: User;
|
|
12
12
|
}>;
|
|
13
13
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/views/Account/Settings/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAA;AACpD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,EAAE,eAAe,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/views/Account/Settings/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAA;AACpD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,EAAE,eAAe,EAAE,IAAI,EAAE,MAAM,SAAS,CAAA;AAEzE,OAAO,KAAK,MAAM,OAAO,CAAA;AAWzB,OAAO,aAAa,CAAA;AAIpB,eAAO,MAAM,QAAQ,EAAE,KAAK,CAAC,EAAE,CAAC;IAC9B,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAA;IAC3B,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAA;IACnB,QAAQ,CAAC,eAAe,EAAE,eAAe,CAAA;IACzC,QAAQ,CAAC,OAAO,EAAE,WAAW,CAAA;IAC7B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,CAAA;IACxC,QAAQ,CAAC,IAAI,CAAC,EAAE,IAAI,CAAA;CACrB,CAeA,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["React","FieldLabel","AccountLanguageSelector","LanguageSelector","AccountResetPreferences","ResetPreferences","AccountToggleHighContrast","ToggleHighContrast","AccountToggleTheme","ToggleTheme","baseClass","Settings","props","className","i18n","languageOptions","theme","user","_jsxs","filter","Boolean","join","_jsx","t","htmlFor","label"],"sources":["../../../../src/views/Account/Settings/index.tsx"],"sourcesContent":["import type { I18n } from '@payloadcms/translations'\nimport type { BasePayload, Config, LanguageOptions,
|
|
1
|
+
{"version":3,"file":"index.js","names":["React","FieldLabel","AccountLanguageSelector","LanguageSelector","AccountResetPreferences","ResetPreferences","AccountToggleHighContrast","ToggleHighContrast","AccountToggleTheme","ToggleTheme","baseClass","Settings","props","className","i18n","languageOptions","theme","user","_jsxs","filter","Boolean","join","_jsx","t","htmlFor","label"],"sources":["../../../../src/views/Account/Settings/index.tsx"],"sourcesContent":["import type { I18n } from '@payloadcms/translations'\nimport type { BasePayload, Config, LanguageOptions, User } from 'payload'\n\nimport React from 'react'\n\n/* eslint-disable payload/no-imports-from-exports-dir -- Server component must reference exports/client bundle for proper client boundary in prod builds */\nimport {\n FieldLabel,\n AccountLanguageSelector as LanguageSelector,\n AccountResetPreferences as ResetPreferences,\n AccountToggleHighContrast as ToggleHighContrast,\n AccountToggleTheme as ToggleTheme,\n} from '../../../exports/client/index.js'\n/* eslint-enable payload/no-imports-from-exports-dir */\nimport './index.css'\n\nconst baseClass = 'payload-settings'\n\nexport const Settings: React.FC<{\n readonly className?: string\n readonly i18n: I18n\n readonly languageOptions: LanguageOptions\n readonly payload: BasePayload\n readonly theme: Config['admin']['theme']\n readonly user?: User\n}> = (props) => {\n const { className, i18n, languageOptions, theme, user } = props\n\n return (\n <div className={[baseClass, className].filter(Boolean).join(' ')}>\n <h3>{i18n.t('general:payloadSettings')}</h3>\n <div className={`${baseClass}__language`}>\n <FieldLabel htmlFor=\"language-select\" label={i18n.t('general:language')} />\n <LanguageSelector languageOptions={languageOptions} />\n </div>\n {theme === 'all' && <ToggleTheme />}\n <ToggleHighContrast />\n <ResetPreferences user={user} />\n </div>\n )\n}\n"],"mappings":";AAGA,OAAOA,KAAA,MAAW;AAElB;AACA,SACEC,UAAU,EACVC,uBAAA,IAA2BC,gBAAgB,EAC3CC,uBAAA,IAA2BC,gBAAgB,EAC3CC,yBAAA,IAA6BC,kBAAkB,EAC/CC,kBAAA,IAAsBC,WAAW,QAC5B;AACP;AACA,OAAO;AAEP,MAAMC,SAAA,GAAY;AAElB,OAAO,MAAMC,QAAA,GAOPC,KAAA;EACJ,MAAM;IAAEC,SAAS;IAAEC,IAAI;IAAEC,eAAe;IAAEC,KAAK;IAAEC;EAAI,CAAE,GAAGL,KAAA;EAE1D,oBACEM,KAAA,CAAC;IAAIL,SAAA,EAAW,CAACH,SAAA,EAAWG,SAAA,CAAU,CAACM,MAAM,CAACC,OAAA,EAASC,IAAI,CAAC;4BAC1DC,IAAA,CAAC;gBAAIR,IAAA,CAAKS,CAAC,CAAC;qBACZL,KAAA,CAAC;MAAIL,SAAA,EAAW,GAAGH,SAAA,YAAqB;8BACtCY,IAAA,CAACrB,UAAA;QAAWuB,OAAA,EAAQ;QAAkBC,KAAA,EAAOX,IAAA,CAAKS,CAAC,CAAC;uBACpDD,IAAA,CAACnB,gBAAA;QAAiBY,eAAA,EAAiBA;;QAEpCC,KAAA,KAAU,sBAASM,IAAA,CAACb,WAAA,O,aACrBa,IAAA,CAACf,kBAAA,O,aACDe,IAAA,CAACjB,gBAAA;MAAiBY,IAAA,EAAMA;;;AAG9B","ignoreList":[]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { BasePayload,
|
|
1
|
+
import type { BasePayload, User } from 'payload';
|
|
2
2
|
import type { WidgetItem } from '../index.client.js';
|
|
3
|
-
export declare function getItemsFromPreferences(payload: BasePayload, user:
|
|
3
|
+
export declare function getItemsFromPreferences(payload: BasePayload, user: User): Promise<null | WidgetItem[]>;
|
|
4
4
|
//# sourceMappingURL=getItemsFromPreferences.d.ts.map
|
package/dist/views/Dashboard/Default/ModularDashboard/utils/getItemsFromPreferences.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getItemsFromPreferences.d.ts","sourceRoot":"","sources":["../../../../../../src/views/Dashboard/Default/ModularDashboard/utils/getItemsFromPreferences.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,
|
|
1
|
+
{"version":3,"file":"getItemsFromPreferences.d.ts","sourceRoot":"","sources":["../../../../../../src/views/Dashboard/Default/ModularDashboard/utils/getItemsFromPreferences.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,SAAS,CAAA;AAIhD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAA;AAIpD,wBAAsB,uBAAuB,CAC3C,OAAO,EAAE,WAAW,EACpB,IAAI,EAAE,IAAI,GACT,OAAO,CAAC,IAAI,GAAG,UAAU,EAAE,CAAC,CAe9B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getItemsFromPreferences.js","names":["PREFERENCE_KEYS","getPreferences","getItemsFromPreferences","payload","user","savedPreferences","DASHBOARD_LAYOUT","id","collection","value","layouts"],"sources":["../../../../../../src/views/Dashboard/Default/ModularDashboard/utils/getItemsFromPreferences.ts"],"sourcesContent":["import type { BasePayload,
|
|
1
|
+
{"version":3,"file":"getItemsFromPreferences.js","names":["PREFERENCE_KEYS","getPreferences","getItemsFromPreferences","payload","user","savedPreferences","DASHBOARD_LAYOUT","id","collection","value","layouts"],"sources":["../../../../../../src/views/Dashboard/Default/ModularDashboard/utils/getItemsFromPreferences.ts"],"sourcesContent":["import type { BasePayload, User } from 'payload'\n\nimport { PREFERENCE_KEYS } from 'payload/shared'\n\nimport type { WidgetItem } from '../index.client.js'\n\nimport { getPreferences } from '../../../../../utilities/upsertPreferences.js'\n\nexport async function getItemsFromPreferences(\n payload: BasePayload,\n user: User,\n): Promise<null | WidgetItem[]> {\n const savedPreferences = await getPreferences(\n PREFERENCE_KEYS.DASHBOARD_LAYOUT,\n payload,\n user.id,\n user.collection,\n )\n if (\n !savedPreferences?.value ||\n typeof savedPreferences.value !== 'object' ||\n !('layouts' in savedPreferences.value)\n ) {\n return null\n }\n return savedPreferences.value.layouts as null | WidgetItem[]\n}\n"],"mappings":"AAEA,SAASA,eAAe,QAAQ;AAIhC,SAASC,cAAc,QAAQ;AAE/B,OAAO,eAAeC,wBACpBC,OAAoB,EACpBC,IAAU;EAEV,MAAMC,gBAAA,GAAmB,MAAMJ,cAAA,CAC7BD,eAAA,CAAgBM,gBAAgB,EAChCH,OAAA,EACAC,IAAA,CAAKG,EAAE,EACPH,IAAA,CAAKI,UAAU;EAEjB,IACE,CAACH,gBAAA,EAAkBI,KAAA,IACnB,OAAOJ,gBAAA,CAAiBI,KAAK,KAAK,YAClC,EAAE,aAAaJ,gBAAA,CAAiBI,KAAK,CAAD,EACpC;IACA,OAAO;EACT;EACA,OAAOJ,gBAAA,CAAiBI,KAAK,CAACC,OAAO;AACvC","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/views/Document/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,oBAAoB,EAEpB,IAAI,EACJ,uBAAuB,EACvB,uBAAuB,EAEvB,iBAAiB,EACjB,gBAAgB,EAChB,gCAAgC,EACjC,MAAM,SAAS,CAAA;AAIhB,OAAO,KAAK,MAAM,OAAO,CAAA;AA6BzB,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAEtD,MAAM,MAAM,YAAY,GACpB,iBAAiB,GACjB,gBAAgB,CAAC,uBAAuB,CAAC,GACzC,KAAK,CAAC,EAAE,GACR,KAAK,CAAC,EAAE,CAAC,uBAAuB,CAAC,CAAA;AAErC;;;;;GAKG;AACH,eAAO,MAAM,cAAc,GAAU,0PAgBlC;IACD,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,wBAAwB,CAAC,EAAE,OAAO,CAAA;IAClC,QAAQ,CAAC,mBAAmB,CAAC,EAAE,OAAO,CAAA;IACtC,QAAQ,CAAC,mBAAmB,CAAC,EAAE,OAAO,CAAA;IACtC,QAAQ,CAAC,sBAAsB,CAAC,EAAE,OAAO,CAAA;IACzC,QAAQ,CAAC,oBAAoB,CAAC,EAAE,OAAO,CAAA;IACvC,QAAQ,CAAC,EAAE,gCAAgC,CAAA;CAC5C,GAAG,oBAAoB,KAAG,OAAO,CAAC;IACjC,IAAI,EAAE,IAAI,CAAA;IACV,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAC1B,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/views/Document/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,oBAAoB,EAEpB,IAAI,EACJ,uBAAuB,EACvB,uBAAuB,EAEvB,iBAAiB,EACjB,gBAAgB,EAChB,gCAAgC,EACjC,MAAM,SAAS,CAAA;AAIhB,OAAO,KAAK,MAAM,OAAO,CAAA;AA6BzB,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAEtD,MAAM,MAAM,YAAY,GACpB,iBAAiB,GACjB,gBAAgB,CAAC,uBAAuB,CAAC,GACzC,KAAK,CAAC,EAAE,GACR,KAAK,CAAC,EAAE,CAAC,uBAAuB,CAAC,CAAA;AAErC;;;;;GAKG;AACH,eAAO,MAAM,cAAc,GAAU,0PAgBlC;IACD,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,wBAAwB,CAAC,EAAE,OAAO,CAAA;IAClC,QAAQ,CAAC,mBAAmB,CAAC,EAAE,OAAO,CAAA;IACtC,QAAQ,CAAC,mBAAmB,CAAC,EAAE,OAAO,CAAA;IACtC,QAAQ,CAAC,sBAAsB,CAAC,EAAE,OAAO,CAAA;IACzC,QAAQ,CAAC,oBAAoB,CAAC,EAAE,OAAO,CAAA;IACvC,QAAQ,CAAC,EAAE,gCAAgC,CAAA;CAC5C,GAAG,oBAAoB,KAAG,OAAO,CAAC;IACjC,IAAI,EAAE,IAAI,CAAA;IACV,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAC1B,CAsZA,CAAA;AAED,wBAAsB,YAAY,CAAC,KAAK,EAAE,oBAAoB,+QAuB7D"}
|
|
@@ -373,7 +373,7 @@ export const renderDocument = async ({
|
|
|
373
373
|
children: /*#__PURE__*/_jsxs(LivePreviewProvider, {
|
|
374
374
|
breakpoints: livePreviewConfig?.breakpoints,
|
|
375
375
|
isLivePreviewEnabled: isLivePreviewEnabled && operation !== 'create',
|
|
376
|
-
isLivePreviewing: Boolean(entityPreferences?.value?.editViewType === 'live-preview' && livePreviewURL),
|
|
376
|
+
isLivePreviewing: Boolean((entityPreferences?.value?.editViewType === undefined ? livePreviewConfig?.openByDefault : entityPreferences.value.editViewType === 'live-preview') && livePreviewURL),
|
|
377
377
|
isPreviewEnabled: Boolean(isPreviewEnabled),
|
|
378
378
|
previewURL: previewURL,
|
|
379
379
|
typeofLivePreviewURL: typeof livePreviewConfig?.url,
|
|
@@ -408,6 +408,13 @@ export async function DocumentView(props) {
|
|
|
408
408
|
if (error?.message === 'NEXT_REDIRECT') {
|
|
409
409
|
throw error;
|
|
410
410
|
}
|
|
411
|
+
// The TanStack adapter's `req.server.redirect()` throws `redirect:<url>` as a
|
|
412
|
+
// control-flow signal — the target is already recorded on `req.server` and
|
|
413
|
+
// honored upstream in `loadAdminPage`. It isn't a real error, so swallow it
|
|
414
|
+
// without logging, mirroring the `NEXT_REDIRECT` guard above.
|
|
415
|
+
if (error?.message?.startsWith('redirect:')) {
|
|
416
|
+
return;
|
|
417
|
+
}
|
|
411
418
|
logError({
|
|
412
419
|
err: error,
|
|
413
420
|
payload: props.initPageResult.req.payload
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["isolateObjectProperty","logError","formatAdminURL","hasAutosaveEnabled","hasDraftsEnabled","React","DocumentHeader","RenderServerComponent","DocumentInfoProvider","EditDepthProvider","HydrateAuthProvider","LivePreviewProvider","buildFormState","getDocPreferences","getDocumentData","getDocumentPermissions","getHasScheduledPublish","getIsLocked","getVersions","handleLivePreview","handlePreview","isEditing","getIsEditing","getPreferences","NotFoundView","UnauthorizedViewWithGutter","getDocumentView","recordRecentlyViewed","renderDocumentSlots","renderDocument","disableActions","documentSubViewType","drawerSlug","importMap","initialData","initPageResult","overrideEntityVisibility","params","redirectAfterCreate","redirectAfterDelete","redirectAfterDuplicate","redirectAfterRestore","searchParams","versions","viewType","collectionConfig","docID","idFromArgs","globalConfig","locale","permissions","req","i18n","payload","config","routes","admin","adminRoute","api","apiRoute","user","visibleEntities","segments","Array","isArray","collectionSlug","slug","undefined","globalSlug","id","doc","redirectURL","path","encodeURIComponent","server","redirect","Error","isTrashedDoc","Boolean","deletedAt","reqForPermissions","transactionID","reqForLockCheck","docPreferences","docPermissions","hasDeletePermission","hasPublishPermission","hasSavePermission","hasTrashPermission","currentEditor","isLocked","lastUpdateTime","entityPreferences","Promise","all","data","collection","operation","recentlyViewedPromise","hasPublishedDoc","mostRecentVersionIsAutosaved","unpublishedVersionCount","versionCount","state","formState","hasScheduledPublish","code","fallbackLocale","readOnly","renderAllFields","schemaPath","skipValidation","documentViewServerProps","routeSegments","collections","find","visibleSlug","globals","formattedParams","URLSearchParams","append","apiQueryParams","toString","apiURL","View","showHeader","RootViewOverride","components","views","edit","root","Component","shouldAutosave","validateDraftData","drafts","validate","create","depth","draft","documentSlots","Description","clientProps","isLivePreviewEnabled","livePreviewConfig","livePreviewURL","isPreviewEnabled","previewURL","Document","_jsx","initialState","isTrashed","_jsxs","breakpoints","isLivePreviewing","value","editViewType","typeofLivePreviewURL","url","AfterHeader","serverProps","DocumentView","props","RenderedDocument","error","message","err","notFound"],"sources":["../../../src/views/Document/index.tsx"],"sourcesContent":["import type {\n AdminViewServerProps,\n CollectionPreferences,\n Data,\n DocumentViewClientProps,\n DocumentViewServerProps,\n DocumentViewServerPropsOnly,\n EditViewComponent,\n PayloadComponent,\n RenderDocumentVersionsProperties,\n} from 'payload'\n\nimport { isolateObjectProperty, logError } from 'payload'\nimport { formatAdminURL, hasAutosaveEnabled, hasDraftsEnabled } from 'payload/shared'\nimport React from 'react'\n\nimport { DocumentHeader } from '../../elements/DocumentHeader/index.js'\nimport { RenderServerComponent } from '../../elements/RenderServerComponent/index.js'\n/* eslint-disable payload/no-imports-from-exports-dir -- Server component must reference exports/client bundle for proper client boundary in prod builds */\nimport {\n DocumentInfoProvider,\n EditDepthProvider,\n HydrateAuthProvider,\n LivePreviewProvider,\n} from '../../exports/client/index.js'\n/* eslint-enable payload/no-imports-from-exports-dir */\nimport { buildFormState } from '../../utilities/buildFormState.js'\nimport { getDocPreferences } from '../../utilities/getDocPreferences.js'\nimport { getDocumentData } from '../../utilities/getDocumentData.js'\nimport { getDocumentPermissions } from '../../utilities/getDocumentPermissions.js'\nimport { getHasScheduledPublish } from '../../utilities/getHasScheduledPublish.js'\nimport { getIsLocked } from '../../utilities/getIsLocked.js'\nimport { getVersions } from '../../utilities/getVersions.js'\nimport { handleLivePreview } from '../../utilities/handleLivePreview.js'\nimport { handlePreview } from '../../utilities/handlePreview.js'\nimport { isEditing as getIsEditing } from '../../utilities/isEditing.js'\nimport { getPreferences } from '../../utilities/upsertPreferences.js'\nimport { NotFoundView } from '../NotFound/index.js'\nimport { UnauthorizedViewWithGutter } from '../Unauthorized/index.js'\nimport { getDocumentView } from './getDocumentView.js'\nimport { recordRecentlyViewed } from './recordRecentlyViewed.js'\nimport { renderDocumentSlots } from './renderDocumentSlots.js'\n\nexport { getDocumentView } from './getDocumentView.js'\n\nexport type ViewToRender =\n | EditViewComponent\n | PayloadComponent<DocumentViewServerProps>\n | React.FC\n | React.FC<DocumentViewClientProps>\n\n/**\n * This function is responsible for rendering\n * an Edit Document view on the server for both:\n * - default document edit views\n * - on-demand edit views within drawers\n */\nexport const renderDocument = async ({\n disableActions,\n documentSubViewType,\n drawerSlug,\n importMap,\n initialData,\n initPageResult,\n overrideEntityVisibility,\n params,\n redirectAfterCreate,\n redirectAfterDelete,\n redirectAfterDuplicate,\n redirectAfterRestore,\n searchParams,\n versions,\n viewType,\n}: {\n drawerSlug?: string\n overrideEntityVisibility?: boolean\n readonly redirectAfterCreate?: boolean\n readonly redirectAfterDelete?: boolean\n readonly redirectAfterDuplicate?: boolean\n readonly redirectAfterRestore?: boolean\n versions?: RenderDocumentVersionsProperties\n} & AdminViewServerProps): Promise<{\n data: Data\n Document: React.ReactNode\n}> => {\n const {\n collectionConfig,\n docID: idFromArgs,\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 },\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 let isEditing = getIsEditing({ id: idFromArgs, collectionSlug, globalSlug })\n\n // Fetch the doc required for the view\n let doc =\n !idFromArgs && !globalSlug\n ? initialData || null\n : await getDocumentData({\n id: idFromArgs,\n collectionSlug,\n globalSlug,\n locale,\n payload,\n req,\n segments,\n user,\n })\n\n if (isEditing && !doc) {\n // If it's a collection document that doesn't exist, redirect to collection list\n if (collectionSlug) {\n const redirectURL = formatAdminURL({\n adminRoute,\n path: `/collections/${collectionSlug}?notFound=${encodeURIComponent(idFromArgs)}`,\n })\n req.server.redirect(redirectURL)\n } else {\n // For globals or other cases, keep the 404 behavior\n throw new Error('not-found')\n }\n }\n\n const isTrashedDoc = Boolean(doc && 'deletedAt' in doc && typeof doc?.deletedAt === 'string')\n\n // CRITICAL FIX FOR TRANSACTION RACE CONDITION:\n // When running parallel operations with Promise.all, if they share the same req object\n // and one operation calls initTransaction() which MUTATES req.transactionID, that mutation\n // is visible to all parallel operations. This causes:\n // 1. Operation A (e.g., getDocumentPermissions → docAccessOperation) calls initTransaction()\n // which sets req.transactionID = Promise, then resolves it to a UUID\n // 2. Operation B (e.g., getIsLocked) running in parallel receives the SAME req with the mutated transactionID\n // 3. Operation A (does not even know that Operation B even exists and is stil using the transactionID) commits/ends its transaction\n // 4. Operation B tries to use the now-expired session → MongoExpiredSessionError!\n //\n // Solution: Use isolateObjectProperty to create a Proxy that isolates the 'transactionID' property.\n // This allows each operation to have its own transactionID without affecting the parent req.\n // If parent req already has a transaction, preserve it (don't isolate), since this\n // issue only arises when one of the operations calls initTransaction() themselves -\n // because then, that operation will also try to commit/end the transaction itself.\n\n // If the transactionID is already set, the parallel operations will not try to\n // commit/end the transaction themselves, so we don't need to isolate the\n // transactionID property.\n const reqForPermissions = req.transactionID ? req : isolateObjectProperty(req, 'transactionID')\n const reqForLockCheck = req.transactionID ? req : isolateObjectProperty(req, 'transactionID')\n\n const [\n docPreferences,\n {\n docPermissions,\n hasDeletePermission,\n hasPublishPermission,\n hasSavePermission,\n hasTrashPermission,\n },\n { currentEditor, isLocked, lastUpdateTime },\n entityPreferences,\n ] = await Promise.all([\n // Get document preferences\n getDocPreferences({\n id: idFromArgs,\n collectionSlug,\n globalSlug,\n payload,\n user,\n }),\n\n // Get permissions - isolated transactionID prevents cross-contamination\n getDocumentPermissions({\n id: idFromArgs,\n collectionConfig,\n data: doc,\n globalConfig,\n req: reqForPermissions,\n }),\n\n // Fetch document lock state - isolated transactionID prevents cross-contamination\n getIsLocked({\n id: idFromArgs,\n collectionConfig,\n globalConfig,\n isEditing,\n req: reqForLockCheck,\n }),\n\n // get entity preferences\n getPreferences<CollectionPreferences>(\n collectionSlug ? `collection-${collectionSlug}` : `global-${globalSlug}`,\n payload,\n req.user.id,\n req.user.collection,\n ),\n ])\n\n const operation = (collectionSlug && idFromArgs) || globalSlug ? 'update' : 'create'\n\n // Record the document as recently viewed (collections only, never on the create route or for\n // trashed docs). Runs concurrently with the work below and never throws.\n const recentlyViewedPromise =\n collectionSlug && idFromArgs && doc && !isTrashedDoc\n ? recordRecentlyViewed({ id: idFromArgs, collectionSlug, req })\n : undefined\n\n const [\n { hasPublishedDoc, mostRecentVersionIsAutosaved, unpublishedVersionCount, versionCount },\n { state: formState },\n hasScheduledPublish,\n ] = await Promise.all([\n getVersions({\n id: idFromArgs,\n collectionConfig,\n doc,\n docPermissions,\n globalConfig,\n locale: locale?.code,\n payload,\n user,\n }),\n buildFormState({\n id: idFromArgs,\n collectionSlug,\n data: doc,\n docPermissions,\n docPreferences,\n fallbackLocale: false,\n globalSlug,\n locale: locale?.code,\n operation,\n readOnly: isTrashedDoc || isLocked,\n renderAllFields: true,\n req,\n schemaPath: collectionSlug || globalSlug,\n skipValidation: true,\n }),\n getHasScheduledPublish({\n id: idFromArgs,\n collectionConfig,\n globalConfig,\n hasPublishPermission,\n payload,\n user,\n }),\n ])\n\n await recentlyViewedPromise\n\n const documentViewServerProps: DocumentViewServerPropsOnly = {\n doc,\n hasPublishedDoc,\n i18n,\n initPageResult,\n locale,\n params,\n payload,\n permissions,\n routeSegments: segments,\n searchParams,\n server: req.server,\n user,\n versions,\n }\n\n if (\n !overrideEntityVisibility &&\n ((collectionSlug &&\n !visibleEntities?.collections?.find((visibleSlug) => visibleSlug === collectionSlug)) ||\n (globalSlug && !visibleEntities?.globals?.find((visibleSlug) => visibleSlug === globalSlug)))\n ) {\n throw new Error('not-found')\n }\n\n const formattedParams = new URLSearchParams()\n\n if (hasDraftsEnabled(collectionConfig || globalConfig)) {\n formattedParams.append('draft', 'true')\n }\n\n if (locale?.code) {\n formattedParams.append('locale', locale.code)\n }\n\n const apiQueryParams = `?${formattedParams.toString()}`\n\n const apiURL = formatAdminURL({\n apiRoute,\n path: collectionSlug\n ? `/${collectionSlug}/${idFromArgs}${apiQueryParams}`\n : globalSlug\n ? `/${globalSlug}${apiQueryParams}`\n : '',\n })\n\n let View: ViewToRender = null\n\n let showHeader = true\n\n const RootViewOverride =\n collectionConfig?.admin?.components?.views?.edit?.root &&\n 'Component' in collectionConfig.admin.components.views.edit.root\n ? collectionConfig?.admin?.components?.views?.edit?.root?.Component\n : globalConfig?.admin?.components?.views?.edit?.root &&\n 'Component' in globalConfig.admin.components.views.edit.root\n ? globalConfig?.admin?.components?.views?.edit?.root?.Component\n : null\n\n if (RootViewOverride) {\n View = RootViewOverride\n showHeader = false\n } else {\n ;({ View } = getDocumentView({\n collectionConfig,\n config,\n docPermissions,\n globalConfig,\n routeSegments: segments,\n }))\n\n if (View === UnauthorizedViewWithGutter) {\n showHeader = false\n }\n }\n\n if (!View) {\n View = NotFoundView as React.FC<AdminViewServerProps>\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 = hasSavePermission && hasAutosaveEnabled(collectionConfig || globalConfig)\n\n const validateDraftData =\n collectionConfig?.versions?.drafts && collectionConfig?.versions?.drafts?.validate\n\n let id = idFromArgs\n\n if (shouldAutosave && !validateDraftData && !idFromArgs && collectionSlug) {\n doc = await payload.create({\n collection: collectionSlug,\n data: initialData || {},\n depth: 0,\n draft: true,\n fallbackLocale: false,\n locale: locale?.code,\n req,\n user,\n })\n\n if (doc?.id) {\n id = doc.id\n isEditing = getIsEditing({ id: doc.id, collectionSlug, globalSlug })\n\n if (!drawerSlug && redirectAfterCreate !== false) {\n const redirectURL = formatAdminURL({\n adminRoute,\n path: `/collections/${collectionSlug}/${doc.id}`,\n })\n\n req.server.redirect(redirectURL)\n }\n } else {\n throw new Error('not-found')\n }\n }\n\n const documentSlots = renderDocumentSlots({\n id,\n collectionConfig,\n doc: doc as Record<string, unknown>,\n globalConfig,\n hasSavePermission,\n locale,\n permissions,\n req,\n })\n\n // Extract Description from documentSlots to pass to DocumentHeader\n const { Description } = documentSlots\n\n const clientProps: DocumentViewClientProps = {\n formState,\n ...documentSlots,\n documentSubViewType,\n viewType,\n }\n\n const { isLivePreviewEnabled, livePreviewConfig, livePreviewURL } = await handleLivePreview({\n collectionSlug,\n config,\n data: doc,\n globalSlug,\n operation,\n req,\n })\n\n const { isPreviewEnabled, previewURL } = await handlePreview({\n collectionSlug,\n config,\n data: doc,\n globalSlug,\n operation,\n req,\n })\n\n return {\n data: doc,\n Document: (\n <DocumentInfoProvider\n apiURL={apiURL}\n collectionSlug={collectionConfig?.slug}\n currentEditor={currentEditor}\n disableActions={disableActions ?? false}\n docPermissions={docPermissions}\n globalSlug={globalConfig?.slug}\n hasDeletePermission={hasDeletePermission}\n hasPublishedDoc={hasPublishedDoc}\n hasPublishPermission={hasPublishPermission}\n hasSavePermission={hasSavePermission}\n hasScheduledPublish={hasScheduledPublish}\n hasTrashPermission={hasTrashPermission}\n id={id}\n initialData={doc}\n initialState={formState}\n isEditing={isEditing}\n isLocked={isLocked}\n isTrashed={isTrashedDoc}\n key={locale?.code}\n lastUpdateTime={lastUpdateTime}\n mostRecentVersionIsAutosaved={mostRecentVersionIsAutosaved}\n redirectAfterCreate={redirectAfterCreate}\n redirectAfterDelete={redirectAfterDelete}\n redirectAfterDuplicate={redirectAfterDuplicate}\n redirectAfterRestore={redirectAfterRestore}\n unpublishedVersionCount={unpublishedVersionCount}\n versionCount={versionCount}\n >\n <LivePreviewProvider\n breakpoints={livePreviewConfig?.breakpoints}\n isLivePreviewEnabled={isLivePreviewEnabled && operation !== 'create'}\n isLivePreviewing={Boolean(\n entityPreferences?.value?.editViewType === 'live-preview' && livePreviewURL,\n )}\n isPreviewEnabled={Boolean(isPreviewEnabled)}\n previewURL={previewURL}\n typeofLivePreviewURL={typeof livePreviewConfig?.url as 'function' | 'string' | undefined}\n url={livePreviewURL}\n >\n {showHeader && !drawerSlug && (\n <DocumentHeader\n AfterHeader={Description}\n collectionConfig={collectionConfig}\n globalConfig={globalConfig}\n permissions={permissions}\n req={req}\n />\n )}\n <HydrateAuthProvider permissions={permissions} />\n <EditDepthProvider>\n {RenderServerComponent({\n clientProps,\n Component: View,\n importMap,\n serverProps: documentViewServerProps,\n })}\n </EditDepthProvider>\n </LivePreviewProvider>\n </DocumentInfoProvider>\n ),\n }\n}\n\nexport async function DocumentView(props: AdminViewServerProps) {\n try {\n const { Document: RenderedDocument } = await renderDocument(props)\n return RenderedDocument\n } catch (error) {\n if (error?.message === 'NEXT_REDIRECT') {\n throw error\n }\n\n logError({ err: error, payload: props.initPageResult.req.payload })\n\n if (error.message === 'not-found') {\n props.initPageResult.req.server.notFound()\n }\n }\n}\n"],"mappings":";AAYA,SAASA,qBAAqB,EAAEC,QAAQ,QAAQ;AAChD,SAASC,cAAc,EAAEC,kBAAkB,EAAEC,gBAAgB,QAAQ;AACrE,OAAOC,KAAA,MAAW;AAElB,SAASC,cAAc,QAAQ;AAC/B,SAASC,qBAAqB,QAAQ;AACtC;AACA,SACEC,oBAAoB,EACpBC,iBAAiB,EACjBC,mBAAmB,EACnBC,mBAAmB,QACd;AACP;AACA,SAASC,cAAc,QAAQ;AAC/B,SAASC,iBAAiB,QAAQ;AAClC,SAASC,eAAe,QAAQ;AAChC,SAASC,sBAAsB,QAAQ;AACvC,SAASC,sBAAsB,QAAQ;AACvC,SAASC,WAAW,QAAQ;AAC5B,SA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AG,CAACuB,MAAM,CAAC4F,QAAQ;IAC1C;EACF;AACF","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"index.js","names":["isolateObjectProperty","logError","formatAdminURL","hasAutosaveEnabled","hasDraftsEnabled","React","DocumentHeader","RenderServerComponent","DocumentInfoProvider","EditDepthProvider","HydrateAuthProvider","LivePreviewProvider","buildFormState","getDocPreferences","getDocumentData","getDocumentPermissions","getHasScheduledPublish","getIsLocked","getVersions","handleLivePreview","handlePreview","isEditing","getIsEditing","getPreferences","NotFoundView","UnauthorizedViewWithGutter","getDocumentView","recordRecentlyViewed","renderDocumentSlots","renderDocument","disableActions","documentSubViewType","drawerSlug","importMap","initialData","initPageResult","overrideEntityVisibility","params","redirectAfterCreate","redirectAfterDelete","redirectAfterDuplicate","redirectAfterRestore","searchParams","versions","viewType","collectionConfig","docID","idFromArgs","globalConfig","locale","permissions","req","i18n","payload","config","routes","admin","adminRoute","api","apiRoute","user","visibleEntities","segments","Array","isArray","collectionSlug","slug","undefined","globalSlug","id","doc","redirectURL","path","encodeURIComponent","server","redirect","Error","isTrashedDoc","Boolean","deletedAt","reqForPermissions","transactionID","reqForLockCheck","docPreferences","docPermissions","hasDeletePermission","hasPublishPermission","hasSavePermission","hasTrashPermission","currentEditor","isLocked","lastUpdateTime","entityPreferences","Promise","all","data","collection","operation","recentlyViewedPromise","hasPublishedDoc","mostRecentVersionIsAutosaved","unpublishedVersionCount","versionCount","state","formState","hasScheduledPublish","code","fallbackLocale","readOnly","renderAllFields","schemaPath","skipValidation","documentViewServerProps","routeSegments","collections","find","visibleSlug","globals","formattedParams","URLSearchParams","append","apiQueryParams","toString","apiURL","View","showHeader","RootViewOverride","components","views","edit","root","Component","shouldAutosave","validateDraftData","drafts","validate","create","depth","draft","documentSlots","Description","clientProps","isLivePreviewEnabled","livePreviewConfig","livePreviewURL","isPreviewEnabled","previewURL","Document","_jsx","initialState","isTrashed","_jsxs","breakpoints","isLivePreviewing","value","editViewType","openByDefault","typeofLivePreviewURL","url","AfterHeader","serverProps","DocumentView","props","RenderedDocument","error","message","startsWith","err","notFound"],"sources":["../../../src/views/Document/index.tsx"],"sourcesContent":["import type {\n AdminViewServerProps,\n CollectionPreferences,\n Data,\n DocumentViewClientProps,\n DocumentViewServerProps,\n DocumentViewServerPropsOnly,\n EditViewComponent,\n PayloadComponent,\n RenderDocumentVersionsProperties,\n} from 'payload'\n\nimport { isolateObjectProperty, logError } from 'payload'\nimport { formatAdminURL, hasAutosaveEnabled, hasDraftsEnabled } from 'payload/shared'\nimport React from 'react'\n\nimport { DocumentHeader } from '../../elements/DocumentHeader/index.js'\nimport { RenderServerComponent } from '../../elements/RenderServerComponent/index.js'\n/* eslint-disable payload/no-imports-from-exports-dir -- Server component must reference exports/client bundle for proper client boundary in prod builds */\nimport {\n DocumentInfoProvider,\n EditDepthProvider,\n HydrateAuthProvider,\n LivePreviewProvider,\n} from '../../exports/client/index.js'\n/* eslint-enable payload/no-imports-from-exports-dir */\nimport { buildFormState } from '../../utilities/buildFormState.js'\nimport { getDocPreferences } from '../../utilities/getDocPreferences.js'\nimport { getDocumentData } from '../../utilities/getDocumentData.js'\nimport { getDocumentPermissions } from '../../utilities/getDocumentPermissions.js'\nimport { getHasScheduledPublish } from '../../utilities/getHasScheduledPublish.js'\nimport { getIsLocked } from '../../utilities/getIsLocked.js'\nimport { getVersions } from '../../utilities/getVersions.js'\nimport { handleLivePreview } from '../../utilities/handleLivePreview.js'\nimport { handlePreview } from '../../utilities/handlePreview.js'\nimport { isEditing as getIsEditing } from '../../utilities/isEditing.js'\nimport { getPreferences } from '../../utilities/upsertPreferences.js'\nimport { NotFoundView } from '../NotFound/index.js'\nimport { UnauthorizedViewWithGutter } from '../Unauthorized/index.js'\nimport { getDocumentView } from './getDocumentView.js'\nimport { recordRecentlyViewed } from './recordRecentlyViewed.js'\nimport { renderDocumentSlots } from './renderDocumentSlots.js'\n\nexport { getDocumentView } from './getDocumentView.js'\n\nexport type ViewToRender =\n | EditViewComponent\n | PayloadComponent<DocumentViewServerProps>\n | React.FC\n | React.FC<DocumentViewClientProps>\n\n/**\n * This function is responsible for rendering\n * an Edit Document view on the server for both:\n * - default document edit views\n * - on-demand edit views within drawers\n */\nexport const renderDocument = async ({\n disableActions,\n documentSubViewType,\n drawerSlug,\n importMap,\n initialData,\n initPageResult,\n overrideEntityVisibility,\n params,\n redirectAfterCreate,\n redirectAfterDelete,\n redirectAfterDuplicate,\n redirectAfterRestore,\n searchParams,\n versions,\n viewType,\n}: {\n drawerSlug?: string\n overrideEntityVisibility?: boolean\n readonly redirectAfterCreate?: boolean\n readonly redirectAfterDelete?: boolean\n readonly redirectAfterDuplicate?: boolean\n readonly redirectAfterRestore?: boolean\n versions?: RenderDocumentVersionsProperties\n} & AdminViewServerProps): Promise<{\n data: Data\n Document: React.ReactNode\n}> => {\n const {\n collectionConfig,\n docID: idFromArgs,\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 },\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 let isEditing = getIsEditing({ id: idFromArgs, collectionSlug, globalSlug })\n\n // Fetch the doc required for the view\n let doc =\n !idFromArgs && !globalSlug\n ? initialData || null\n : await getDocumentData({\n id: idFromArgs,\n collectionSlug,\n globalSlug,\n locale,\n payload,\n req,\n segments,\n user,\n })\n\n if (isEditing && !doc) {\n // If it's a collection document that doesn't exist, redirect to collection list\n if (collectionSlug) {\n const redirectURL = formatAdminURL({\n adminRoute,\n path: `/collections/${collectionSlug}?notFound=${encodeURIComponent(idFromArgs)}`,\n })\n req.server.redirect(redirectURL)\n } else {\n // For globals or other cases, keep the 404 behavior\n throw new Error('not-found')\n }\n }\n\n const isTrashedDoc = Boolean(doc && 'deletedAt' in doc && typeof doc?.deletedAt === 'string')\n\n // CRITICAL FIX FOR TRANSACTION RACE CONDITION:\n // When running parallel operations with Promise.all, if they share the same req object\n // and one operation calls initTransaction() which MUTATES req.transactionID, that mutation\n // is visible to all parallel operations. This causes:\n // 1. Operation A (e.g., getDocumentPermissions → docAccessOperation) calls initTransaction()\n // which sets req.transactionID = Promise, then resolves it to a UUID\n // 2. Operation B (e.g., getIsLocked) running in parallel receives the SAME req with the mutated transactionID\n // 3. Operation A (does not even know that Operation B even exists and is stil using the transactionID) commits/ends its transaction\n // 4. Operation B tries to use the now-expired session → MongoExpiredSessionError!\n //\n // Solution: Use isolateObjectProperty to create a Proxy that isolates the 'transactionID' property.\n // This allows each operation to have its own transactionID without affecting the parent req.\n // If parent req already has a transaction, preserve it (don't isolate), since this\n // issue only arises when one of the operations calls initTransaction() themselves -\n // because then, that operation will also try to commit/end the transaction itself.\n\n // If the transactionID is already set, the parallel operations will not try to\n // commit/end the transaction themselves, so we don't need to isolate the\n // transactionID property.\n const reqForPermissions = req.transactionID ? req : isolateObjectProperty(req, 'transactionID')\n const reqForLockCheck = req.transactionID ? req : isolateObjectProperty(req, 'transactionID')\n\n const [\n docPreferences,\n {\n docPermissions,\n hasDeletePermission,\n hasPublishPermission,\n hasSavePermission,\n hasTrashPermission,\n },\n { currentEditor, isLocked, lastUpdateTime },\n entityPreferences,\n ] = await Promise.all([\n // Get document preferences\n getDocPreferences({\n id: idFromArgs,\n collectionSlug,\n globalSlug,\n payload,\n user,\n }),\n\n // Get permissions - isolated transactionID prevents cross-contamination\n getDocumentPermissions({\n id: idFromArgs,\n collectionConfig,\n data: doc,\n globalConfig,\n req: reqForPermissions,\n }),\n\n // Fetch document lock state - isolated transactionID prevents cross-contamination\n getIsLocked({\n id: idFromArgs,\n collectionConfig,\n globalConfig,\n isEditing,\n req: reqForLockCheck,\n }),\n\n // get entity preferences\n getPreferences<CollectionPreferences>(\n collectionSlug ? `collection-${collectionSlug}` : `global-${globalSlug}`,\n payload,\n req.user.id,\n req.user.collection,\n ),\n ])\n\n const operation = (collectionSlug && idFromArgs) || globalSlug ? 'update' : 'create'\n\n // Record the document as recently viewed (collections only, never on the create route or for\n // trashed docs). Runs concurrently with the work below and never throws.\n const recentlyViewedPromise =\n collectionSlug && idFromArgs && doc && !isTrashedDoc\n ? recordRecentlyViewed({ id: idFromArgs, collectionSlug, req })\n : undefined\n\n const [\n { hasPublishedDoc, mostRecentVersionIsAutosaved, unpublishedVersionCount, versionCount },\n { state: formState },\n hasScheduledPublish,\n ] = await Promise.all([\n getVersions({\n id: idFromArgs,\n collectionConfig,\n doc,\n docPermissions,\n globalConfig,\n locale: locale?.code,\n payload,\n user,\n }),\n buildFormState({\n id: idFromArgs,\n collectionSlug,\n data: doc,\n docPermissions,\n docPreferences,\n fallbackLocale: false,\n globalSlug,\n locale: locale?.code,\n operation,\n readOnly: isTrashedDoc || isLocked,\n renderAllFields: true,\n req,\n schemaPath: collectionSlug || globalSlug,\n skipValidation: true,\n }),\n getHasScheduledPublish({\n id: idFromArgs,\n collectionConfig,\n globalConfig,\n hasPublishPermission,\n payload,\n user,\n }),\n ])\n\n await recentlyViewedPromise\n\n const documentViewServerProps: DocumentViewServerPropsOnly = {\n doc,\n hasPublishedDoc,\n i18n,\n initPageResult,\n locale,\n params,\n payload,\n permissions,\n routeSegments: segments,\n searchParams,\n server: req.server,\n user,\n versions,\n }\n\n if (\n !overrideEntityVisibility &&\n ((collectionSlug &&\n !visibleEntities?.collections?.find((visibleSlug) => visibleSlug === collectionSlug)) ||\n (globalSlug && !visibleEntities?.globals?.find((visibleSlug) => visibleSlug === globalSlug)))\n ) {\n throw new Error('not-found')\n }\n\n const formattedParams = new URLSearchParams()\n\n if (hasDraftsEnabled(collectionConfig || globalConfig)) {\n formattedParams.append('draft', 'true')\n }\n\n if (locale?.code) {\n formattedParams.append('locale', locale.code)\n }\n\n const apiQueryParams = `?${formattedParams.toString()}`\n\n const apiURL = formatAdminURL({\n apiRoute,\n path: collectionSlug\n ? `/${collectionSlug}/${idFromArgs}${apiQueryParams}`\n : globalSlug\n ? `/${globalSlug}${apiQueryParams}`\n : '',\n })\n\n let View: ViewToRender = null\n\n let showHeader = true\n\n const RootViewOverride =\n collectionConfig?.admin?.components?.views?.edit?.root &&\n 'Component' in collectionConfig.admin.components.views.edit.root\n ? collectionConfig?.admin?.components?.views?.edit?.root?.Component\n : globalConfig?.admin?.components?.views?.edit?.root &&\n 'Component' in globalConfig.admin.components.views.edit.root\n ? globalConfig?.admin?.components?.views?.edit?.root?.Component\n : null\n\n if (RootViewOverride) {\n View = RootViewOverride\n showHeader = false\n } else {\n ;({ View } = getDocumentView({\n collectionConfig,\n config,\n docPermissions,\n globalConfig,\n routeSegments: segments,\n }))\n\n if (View === UnauthorizedViewWithGutter) {\n showHeader = false\n }\n }\n\n if (!View) {\n View = NotFoundView as React.FC<AdminViewServerProps>\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 = hasSavePermission && hasAutosaveEnabled(collectionConfig || globalConfig)\n\n const validateDraftData =\n collectionConfig?.versions?.drafts && collectionConfig?.versions?.drafts?.validate\n\n let id = idFromArgs\n\n if (shouldAutosave && !validateDraftData && !idFromArgs && collectionSlug) {\n doc = await payload.create({\n collection: collectionSlug,\n data: initialData || {},\n depth: 0,\n draft: true,\n fallbackLocale: false,\n locale: locale?.code,\n req,\n user,\n })\n\n if (doc?.id) {\n id = doc.id\n isEditing = getIsEditing({ id: doc.id, collectionSlug, globalSlug })\n\n if (!drawerSlug && redirectAfterCreate !== false) {\n const redirectURL = formatAdminURL({\n adminRoute,\n path: `/collections/${collectionSlug}/${doc.id}`,\n })\n\n req.server.redirect(redirectURL)\n }\n } else {\n throw new Error('not-found')\n }\n }\n\n const documentSlots = renderDocumentSlots({\n id,\n collectionConfig,\n doc: doc as Record<string, unknown>,\n globalConfig,\n hasSavePermission,\n locale,\n permissions,\n req,\n })\n\n // Extract Description from documentSlots to pass to DocumentHeader\n const { Description } = documentSlots\n\n const clientProps: DocumentViewClientProps = {\n formState,\n ...documentSlots,\n documentSubViewType,\n viewType,\n }\n\n const { isLivePreviewEnabled, livePreviewConfig, livePreviewURL } = await handleLivePreview({\n collectionSlug,\n config,\n data: doc,\n globalSlug,\n operation,\n req,\n })\n\n const { isPreviewEnabled, previewURL } = await handlePreview({\n collectionSlug,\n config,\n data: doc,\n globalSlug,\n operation,\n req,\n })\n\n return {\n data: doc,\n Document: (\n <DocumentInfoProvider\n apiURL={apiURL}\n collectionSlug={collectionConfig?.slug}\n currentEditor={currentEditor}\n disableActions={disableActions ?? false}\n docPermissions={docPermissions}\n globalSlug={globalConfig?.slug}\n hasDeletePermission={hasDeletePermission}\n hasPublishedDoc={hasPublishedDoc}\n hasPublishPermission={hasPublishPermission}\n hasSavePermission={hasSavePermission}\n hasScheduledPublish={hasScheduledPublish}\n hasTrashPermission={hasTrashPermission}\n id={id}\n initialData={doc}\n initialState={formState}\n isEditing={isEditing}\n isLocked={isLocked}\n isTrashed={isTrashedDoc}\n key={locale?.code}\n lastUpdateTime={lastUpdateTime}\n mostRecentVersionIsAutosaved={mostRecentVersionIsAutosaved}\n redirectAfterCreate={redirectAfterCreate}\n redirectAfterDelete={redirectAfterDelete}\n redirectAfterDuplicate={redirectAfterDuplicate}\n redirectAfterRestore={redirectAfterRestore}\n unpublishedVersionCount={unpublishedVersionCount}\n versionCount={versionCount}\n >\n <LivePreviewProvider\n breakpoints={livePreviewConfig?.breakpoints}\n isLivePreviewEnabled={isLivePreviewEnabled && operation !== 'create'}\n isLivePreviewing={Boolean(\n (entityPreferences?.value?.editViewType === undefined\n ? livePreviewConfig?.openByDefault\n : entityPreferences.value.editViewType === 'live-preview') && livePreviewURL,\n )}\n isPreviewEnabled={Boolean(isPreviewEnabled)}\n previewURL={previewURL}\n typeofLivePreviewURL={typeof livePreviewConfig?.url as 'function' | 'string' | undefined}\n url={livePreviewURL}\n >\n {showHeader && !drawerSlug && (\n <DocumentHeader\n AfterHeader={Description}\n collectionConfig={collectionConfig}\n globalConfig={globalConfig}\n permissions={permissions}\n req={req}\n />\n )}\n <HydrateAuthProvider permissions={permissions} />\n <EditDepthProvider>\n {RenderServerComponent({\n clientProps,\n Component: View,\n importMap,\n serverProps: documentViewServerProps,\n })}\n </EditDepthProvider>\n </LivePreviewProvider>\n </DocumentInfoProvider>\n ),\n }\n}\n\nexport async function DocumentView(props: AdminViewServerProps) {\n try {\n const { Document: RenderedDocument } = await renderDocument(props)\n return RenderedDocument\n } catch (error) {\n if (error?.message === 'NEXT_REDIRECT') {\n throw error\n }\n\n // The TanStack adapter's `req.server.redirect()` throws `redirect:<url>` as a\n // control-flow signal — the target is already recorded on `req.server` and\n // honored upstream in `loadAdminPage`. It isn't a real error, so swallow it\n // without logging, mirroring the `NEXT_REDIRECT` guard above.\n if (error?.message?.startsWith('redirect:')) {\n return\n }\n\n logError({ err: error, payload: props.initPageResult.req.payload })\n\n if (error.message === 'not-found') {\n props.initPageResult.req.server.notFound()\n }\n }\n}\n"],"mappings":";AAYA,SAASA,qBAAqB,EAAEC,QAAQ,QAAQ;AAChD,SAASC,cAAc,EAAEC,kBAAkB,EAAEC,gBAAgB,QAAQ;AACrE,OAAOC,KAAA,MAAW;AAElB,SAASC,cAAc,QAAQ;AAC/B,SAASC,qBAAqB,QAAQ;AACtC;AACA,SACEC,oBAAoB,EACpBC,iBAAiB,EACjBC,mBAAmB,EACnBC,mBAAmB,QACd;AACP;AACA,SAASC,cAAc,QAAQ;AAC/B,SAASC,iBAAiB,QAAQ;AAClC,SAASC,eAAe,QAAQ;AAChC,SAASC,sBAAsB,QAAQ;AACvC,SAASC,sBAAsB,QAAQ;AACvC,SAASC,WAAW,QAAQ;AAC5B,SAASC,WAAW,QAAQ;AAC5B,SAASC,iBAAiB,QAAQ;AAClC,SAASC,aAAa,QAAQ;AAC9B,SAASC,SAAA,IAAaC,YAAY,QAAQ;AAC1C,SAASC,cAAc,QAAQ;AAC/B,SAASC,YAAY,QAAQ;AAC7B,SAASC,0BAA0B,QAAQ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uB,MAAM,CAAC8F,QAAQ;IAC1C;EACF;AACF","ignoreList":[]}
|
|
@@ -14,5 +14,19 @@ export declare const LogoutClient: React.FC<{
|
|
|
14
14
|
adminRoute: string;
|
|
15
15
|
inactivity?: boolean;
|
|
16
16
|
redirect: string;
|
|
17
|
+
/**
|
|
18
|
+
* The server-resolved user for the logout request. This is the source of
|
|
19
|
+
* truth for *who* to log out: the client `useAuth().user` is unreliable here
|
|
20
|
+
* because the admin `AuthProvider` clears any user that isn't in the admin
|
|
21
|
+
* user collection (a non-admin/public user resolves to `null` via `/me`).
|
|
22
|
+
* On adapters that mount this view's tree after the layout's auth effects
|
|
23
|
+
* (e.g. TanStack Start, where the RSC payload streams in after hydration),
|
|
24
|
+
* that clear races ahead of this component and `useAuth().user` is already
|
|
25
|
+
* `null` at mount — so relying on it would skip the logout request entirely.
|
|
26
|
+
*/
|
|
27
|
+
user?: {
|
|
28
|
+
collection?: string;
|
|
29
|
+
id?: number | string;
|
|
30
|
+
} | null;
|
|
17
31
|
}>;
|
|
18
32
|
//# sourceMappingURL=LogoutClient.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LogoutClient.d.ts","sourceRoot":"","sources":["../../../src/views/Logout/LogoutClient.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAoB,MAAM,OAAO,CAAA;AASxC,OAAO,aAAa,CAAA;AAIpB;;;;;;;;;GASG;AACH,eAAO,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC;IAClC,UAAU,EAAE,MAAM,CAAA;IAClB,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,QAAQ,EAAE,MAAM,CAAA;
|
|
1
|
+
{"version":3,"file":"LogoutClient.d.ts","sourceRoot":"","sources":["../../../src/views/Logout/LogoutClient.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAoB,MAAM,OAAO,CAAA;AASxC,OAAO,aAAa,CAAA;AAIpB;;;;;;;;;GASG;AACH,eAAO,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC;IAClC,UAAU,EAAE,MAAM,CAAA;IAClB,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,QAAQ,EAAE,MAAM,CAAA;IAChB;;;;;;;;;OASG;IACH,IAAI,CAAC,EAAE;QAAE,UAAU,CAAC,EAAE,MAAM,CAAC;QAAC,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,GAAG,IAAI,CAAA;CAC5D,CA+DA,CAAA"}
|
|
@@ -28,17 +28,19 @@ export const LogoutClient = props => {
|
|
|
28
28
|
const {
|
|
29
29
|
adminRoute,
|
|
30
30
|
inactivity,
|
|
31
|
-
redirect
|
|
31
|
+
redirect,
|
|
32
|
+
user: serverUser
|
|
32
33
|
} = props;
|
|
33
34
|
const {
|
|
34
35
|
logOut,
|
|
35
|
-
user
|
|
36
|
+
user: clientUser
|
|
36
37
|
} = useAuth();
|
|
38
|
+
const logoutUser = clientUser ?? serverUser;
|
|
37
39
|
const {
|
|
38
40
|
startRouteTransition
|
|
39
41
|
} = useRouteTransition();
|
|
40
|
-
|
|
41
|
-
const isLoggedIn = Boolean(
|
|
42
|
+
logoutUser?.id;
|
|
43
|
+
const isLoggedIn = Boolean(logoutUser?.id);
|
|
42
44
|
const navigatingToLoginRef = React.useRef(false);
|
|
43
45
|
let t0;
|
|
44
46
|
if ($[0] !== adminRoute || $[1] !== inactivity || $[2] !== redirect) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LogoutClient.js","names":["c","_c","formatAdminURL","React","useEffect","toast","Button","LoadingOverlay","useAuth","useRouter","useRouteTransition","useTranslation","baseClass","LogoutClient","props","$","adminRoute","inactivity","redirect","logOut","
|
|
1
|
+
{"version":3,"file":"LogoutClient.js","names":["c","_c","formatAdminURL","React","useEffect","toast","Button","LoadingOverlay","useAuth","useRouter","useRouteTransition","useTranslation","baseClass","LogoutClient","props","$","adminRoute","inactivity","redirect","user","serverUser","logOut","clientUser","logoutUser","startRouteTransition","id","isLoggedIn","Boolean","navigatingToLoginRef","useRef","t0","path","length","encodeURIComponent","loginRoute","useState","t","router","t1","current","push","handleLogOut","t2","t3","t4","_jsxs","className","children","_jsx","buttonStyle","el","size","url","animationDuration","loadingText"],"sources":["../../../src/views/Logout/LogoutClient.tsx"],"sourcesContent":["'use client'\nimport { formatAdminURL } from 'payload/shared'\nimport React, { useEffect } from 'react'\nimport { toast } from 'sonner'\n\nimport { Button } from '../../elements/Button/index.js'\nimport { LoadingOverlay } from '../../elements/Loading/index.js'\nimport { useAuth } from '../../providers/Auth/index.js'\nimport { useRouter } from '../../providers/RouterAdapter/index.js'\nimport { useRouteTransition } from '../../providers/RouteTransition/index.js'\nimport { useTranslation } from '../../providers/Translation/index.js'\nimport './index.css'\n\nconst baseClass = 'logout'\n\n/**\n * This component should **just** be the inactivity route and do nothing with logging the user out.\n *\n * It currently handles too much, the auth provider should just log the user out and then\n * we could remove the useEffect in this file. So instead of the logout button\n * being an anchor link, it should be a button that calls `logOut` in the provider.\n *\n * This view is still useful if cookies attempt to refresh and fail, i.e. the user\n * is logged out due to inactivity.\n */\nexport const LogoutClient: React.FC<{\n adminRoute: string\n inactivity?: boolean\n redirect: string\n /**\n * The server-resolved user for the logout request. This is the source of\n * truth for *who* to log out: the client `useAuth().user` is unreliable here\n * because the admin `AuthProvider` clears any user that isn't in the admin\n * user collection (a non-admin/public user resolves to `null` via `/me`).\n * On adapters that mount this view's tree after the layout's auth effects\n * (e.g. TanStack Start, where the RSC payload streams in after hydration),\n * that clear races ahead of this component and `useAuth().user` is already\n * `null` at mount — so relying on it would skip the logout request entirely.\n */\n user?: { collection?: string; id?: number | string } | null\n}> = (props) => {\n const { adminRoute, inactivity, redirect, user: serverUser } = props\n\n const { logOut, user: clientUser } = useAuth()\n\n // Prefer the client user when present (covers token refresh / inactivity),\n // but fall back to the server-resolved user so the logout still fires when\n // the client auth state has already been cleared (see `user` prop above).\n const logoutUser = clientUser ?? serverUser\n\n const { startRouteTransition } = useRouteTransition()\n\n const isLoggedIn = React.useMemo(() => {\n return Boolean(logoutUser?.id)\n }, [logoutUser?.id])\n\n const navigatingToLoginRef = React.useRef(false)\n\n const [loginRoute] = React.useState(() =>\n formatAdminURL({\n adminRoute,\n path: `/login${\n inactivity && redirect && redirect.length > 0\n ? `?redirect=${encodeURIComponent(redirect)}`\n : ''\n }`,\n }),\n )\n\n const { t } = useTranslation()\n const router = useRouter()\n\n const handleLogOut = React.useCallback(async () => {\n if (!navigatingToLoginRef.current) {\n navigatingToLoginRef.current = true\n await logOut()\n toast(t('authentication:loggedOutSuccessfully'))\n startRouteTransition(() => router.push(loginRoute))\n return\n }\n }, [logOut, loginRoute, router, startRouteTransition, t])\n\n useEffect(() => {\n if (isLoggedIn && !inactivity) {\n void handleLogOut()\n } else if (!inactivity && !navigatingToLoginRef.current) {\n navigatingToLoginRef.current = true\n startRouteTransition(() => router.push(loginRoute))\n }\n }, [handleLogOut, isLoggedIn, loginRoute, router, startRouteTransition, inactivity])\n\n if (!isLoggedIn && inactivity) {\n return (\n <div className={`${baseClass}__wrap`}>\n <h2>{t('authentication:loggedOutInactivity')}</h2>\n <Button buttonStyle=\"primary\" el=\"link\" size=\"medium\" url={loginRoute}>\n {t('authentication:logBackIn')}\n </Button>\n </div>\n )\n }\n\n return <LoadingOverlay animationDuration={'0ms'} loadingText={t('authentication:loggingOut')} />\n}\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;;AACA,SAASC,cAAc,QAAQ;AAC/B,OAAOC,KAAA,IAASC,SAAS,QAAQ;AACjC,SAASC,KAAK,QAAQ;AAEtB,SAASC,MAAM,QAAQ;AACvB,SAASC,cAAc,QAAQ;AAC/B,SAASC,OAAO,QAAQ;AACxB,SAASC,SAAS,QAAQ;AAC1B,SAASC,kBAAkB,QAAQ;AACnC,SAASC,cAAc,QAAQ;AAC/B,OAAO;AAEP,MAAMC,SAAA,GAAY;AAElB;;;;;;;;;;AAUA,OAAO,MAAMC,YAAA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X,SAAA,CAAUsC,EAOV,EAAGC,EAAgF;EAAA,IAE/E,CAACjB,UAAA,IAAcT,UAAA;IAAA,IAAA2B,EAAA;IAAA,IAAA7B,CAAA,SAAAmB,UAAA,IAAAnB,CAAA,SAAAqB,CAAA;MAEfQ,EAAA,GAAAC,KAAA,CAAC;QAAAC,SAAA,EAAe,GAAAlC,SAAA,QAAoB;QAAAmC,QAAA,GAClCC,IAAA,CAAC;UAAAD,QAAA,EAAIX,CAAA,CAAE;QAAA,C,GACPY,IAAA,CAAA1C,MAAA;UAAA2C,WAAA,EAAoB;UAAAC,EAAA,EAAa;UAAAC,IAAA,EAAY;UAAAC,GAAA,EAAclB,UAAA;UAAAa,QAAA,EACxDX,CAAA,CAAE;QAAA,C;;;;;;;;WAHPQ,E;;;;IASGA,EAAA,GAAAI,IAAA,CAAAzC,cAAA;MAAA8C,iBAAA,EAAmC;MAAAC,WAAA,EAAoBlB,CAAA,CAAE;IAAA,C;;;;;;SAAzDQ,E;CACT","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/views/Logout/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAA;AAEnD,OAAO,KAAK,MAAM,OAAO,CAAA;AAIzB,OAAO,aAAa,CAAA;AAIpB,eAAO,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAC/B;IACE,UAAU,CAAC,EAAE,OAAO,CAAA;CACrB,GAAG,oBAAoB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/views/Logout/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAA;AAEnD,OAAO,KAAK,MAAM,OAAO,CAAA;AAIzB,OAAO,aAAa,CAAA;AAIpB,eAAO,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAC/B;IACE,UAAU,CAAC,EAAE,OAAO,CAAA;CACrB,GAAG,oBAAoB,CAuBzB,CAAA"}
|
|
@@ -17,7 +17,8 @@ export const LogoutView = ({
|
|
|
17
17
|
admin: adminRoute
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
|
-
}
|
|
20
|
+
},
|
|
21
|
+
user
|
|
21
22
|
}
|
|
22
23
|
} = initPageResult;
|
|
23
24
|
return /*#__PURE__*/_jsx("div", {
|
|
@@ -25,7 +26,11 @@ export const LogoutView = ({
|
|
|
25
26
|
children: /*#__PURE__*/_jsx(LogoutClient, {
|
|
26
27
|
adminRoute: adminRoute,
|
|
27
28
|
inactivity: inactivity,
|
|
28
|
-
redirect: searchParams.redirect
|
|
29
|
+
redirect: searchParams.redirect,
|
|
30
|
+
user: user ? {
|
|
31
|
+
id: user.id,
|
|
32
|
+
collection: user.collection
|
|
33
|
+
} : null
|
|
29
34
|
})
|
|
30
35
|
});
|
|
31
36
|
};
|