@payloadcms/next 3.71.0-internal-debug.80dab4c → 3.71.0-internal.27e1e08
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/auth/login.js +58 -52
- package/dist/auth/login.js.map +1 -1
- package/dist/auth/logout.js +44 -39
- package/dist/auth/logout.js.map +1 -1
- package/dist/auth/refresh.js +47 -45
- package/dist/auth/refresh.js.map +1 -1
- package/dist/cjs/withPayload.cjs +23 -61
- package/dist/cjs/withPayload.cjs.map +2 -2
- package/dist/config.js +0 -1
- package/dist/config.js.map +1 -1
- package/dist/elements/DocumentHeader/Tabs/ShouldRenderTabs.js +15 -9
- package/dist/elements/DocumentHeader/Tabs/ShouldRenderTabs.js.map +1 -1
- package/dist/elements/DocumentHeader/Tabs/Tab/TabLink.js +71 -40
- package/dist/elements/DocumentHeader/Tabs/Tab/TabLink.js.map +1 -1
- package/dist/elements/DocumentHeader/Tabs/Tab/index.js +59 -65
- package/dist/elements/DocumentHeader/Tabs/Tab/index.js.map +1 -1
- package/dist/elements/DocumentHeader/Tabs/index.js +70 -80
- package/dist/elements/DocumentHeader/Tabs/index.js.map +1 -1
- package/dist/elements/DocumentHeader/Tabs/tabs/VersionsPill/index.js +23 -16
- package/dist/elements/DocumentHeader/Tabs/tabs/VersionsPill/index.js.map +1 -1
- package/dist/elements/DocumentHeader/Tabs/tabs/index.js +69 -61
- package/dist/elements/DocumentHeader/Tabs/tabs/index.js.map +1 -1
- package/dist/elements/DocumentHeader/index.js +28 -48
- package/dist/elements/DocumentHeader/index.js.map +1 -1
- package/dist/elements/FormHeader/index.js +16 -30
- package/dist/elements/FormHeader/index.js.map +1 -1
- package/dist/elements/Logo/index.js +34 -19
- package/dist/elements/Logo/index.js.map +1 -1
- package/dist/elements/Nav/NavHamburger/index.js +44 -23
- package/dist/elements/Nav/NavHamburger/index.js.map +1 -1
- package/dist/elements/Nav/NavWrapper/index.js +54 -28
- package/dist/elements/Nav/NavWrapper/index.js.map +1 -1
- package/dist/elements/Nav/SettingsMenuButton/index.js +39 -33
- package/dist/elements/Nav/SettingsMenuButton/index.js.map +1 -1
- package/dist/elements/Nav/getNavPrefs.js +22 -27
- package/dist/elements/Nav/getNavPrefs.js.map +1 -1
- package/dist/elements/Nav/index.client.js +118 -97
- package/dist/elements/Nav/index.client.js.map +1 -1
- package/dist/elements/Nav/index.js +127 -148
- package/dist/elements/Nav/index.js.map +1 -1
- package/dist/exports/auth.js +0 -1
- package/dist/exports/auth.js.map +1 -1
- package/dist/exports/client.js +1 -1
- package/dist/exports/client.js.map +1 -1
- package/dist/exports/layouts.js +0 -1
- package/dist/exports/layouts.js.map +1 -1
- package/dist/exports/routes.js +0 -1
- package/dist/exports/routes.js.map +1 -1
- package/dist/exports/rsc.js +0 -1
- package/dist/exports/rsc.js.map +1 -1
- package/dist/exports/templates.js +0 -1
- package/dist/exports/templates.js.map +1 -1
- package/dist/exports/utilities.js +12 -7
- package/dist/exports/utilities.js.map +1 -1
- package/dist/exports/views.js +0 -1
- package/dist/exports/views.js.map +1 -1
- package/dist/index.js +0 -1
- package/dist/index.js.map +1 -1
- package/dist/layouts/Root/NestProviders.js +20 -21
- package/dist/layouts/Root/NestProviders.js.map +1 -1
- package/dist/layouts/Root/checkDependencies.js +41 -49
- package/dist/layouts/Root/checkDependencies.js.map +1 -1
- package/dist/layouts/Root/index.js +103 -128
- package/dist/layouts/Root/index.js.map +1 -1
- package/dist/prod/styles.css +1 -5
- package/dist/routes/graphql/handler.js +122 -114
- package/dist/routes/graphql/handler.js.map +1 -1
- package/dist/routes/graphql/index.js +0 -1
- package/dist/routes/graphql/index.js.map +1 -1
- package/dist/routes/graphql/playground.js +27 -28
- package/dist/routes/graphql/playground.js.map +1 -1
- package/dist/routes/index.js +0 -1
- package/dist/routes/index.js.map +1 -1
- package/dist/routes/rest/index.js +22 -23
- package/dist/routes/rest/index.js.map +1 -1
- package/dist/routes/rest/og/image.js +79 -103
- package/dist/routes/rest/og/image.js.map +1 -1
- package/dist/routes/rest/og/index.js +54 -59
- package/dist/routes/rest/og/index.js.map +1 -1
- package/dist/templates/Default/NavHamburger/index.js +20 -12
- package/dist/templates/Default/NavHamburger/index.js.map +1 -1
- package/dist/templates/Default/Wrapper/index.js +44 -20
- package/dist/templates/Default/Wrapper/index.js.map +1 -1
- package/dist/templates/Default/index.js +116 -147
- package/dist/templates/Default/index.js.map +1 -1
- package/dist/templates/Minimal/index.js +17 -26
- package/dist/templates/Minimal/index.js.map +1 -1
- package/dist/utilities/getExistingAuthToken.js +2 -3
- package/dist/utilities/getExistingAuthToken.js.map +1 -1
- package/dist/utilities/getNextRequestI18n.js +13 -12
- package/dist/utilities/getNextRequestI18n.js.map +1 -1
- package/dist/utilities/getPayloadHMR.js +5 -5
- package/dist/utilities/getPayloadHMR.js.map +1 -1
- package/dist/utilities/getPreferences.js +22 -27
- package/dist/utilities/getPreferences.js.map +1 -1
- package/dist/utilities/getRequestLocale.js +14 -13
- package/dist/utilities/getRequestLocale.js.map +1 -1
- package/dist/utilities/getRequestTheme.js +19 -19
- package/dist/utilities/getRequestTheme.js.map +1 -1
- package/dist/utilities/getRouteWithoutAdmin.js +5 -3
- package/dist/utilities/getRouteWithoutAdmin.js.map +1 -1
- package/dist/utilities/handleAuthRedirect.js +36 -22
- package/dist/utilities/handleAuthRedirect.js.map +1 -1
- package/dist/utilities/handleServerFunctions.js +41 -34
- package/dist/utilities/handleServerFunctions.js.map +1 -1
- package/dist/utilities/initReq.js +96 -78
- package/dist/utilities/initReq.js.map +1 -1
- package/dist/utilities/isCustomAdminView.js +26 -22
- package/dist/utilities/isCustomAdminView.js.map +1 -1
- package/dist/utilities/isPublicAdminRoute.js +20 -26
- package/dist/utilities/isPublicAdminRoute.js.map +1 -1
- package/dist/utilities/meta.js +63 -68
- package/dist/utilities/meta.js.map +1 -1
- package/dist/utilities/selectiveCache.js +26 -25
- package/dist/utilities/selectiveCache.js.map +1 -1
- package/dist/utilities/setPayloadAuthCookie.js +22 -19
- package/dist/utilities/setPayloadAuthCookie.js.map +1 -1
- package/dist/utilities/slugify.js +33 -24
- package/dist/utilities/slugify.js.map +1 -1
- package/dist/utilities/timestamp.js +6 -7
- package/dist/utilities/timestamp.js.map +1 -1
- package/dist/views/API/LocaleSelector/index.js +39 -17
- package/dist/views/API/LocaleSelector/index.js.map +1 -1
- package/dist/views/API/RenderJSON/index.js +126 -171
- package/dist/views/API/RenderJSON/index.js.map +1 -1
- package/dist/views/API/index.client.js +197 -290
- package/dist/views/API/index.client.js.map +1 -1
- package/dist/views/API/index.js +2 -7
- package/dist/views/API/index.js.map +1 -1
- package/dist/views/API/metadata.js +23 -18
- package/dist/views/API/metadata.js.map +1 -1
- package/dist/views/Account/ResetPreferences/index.js +102 -78
- package/dist/views/Account/ResetPreferences/index.js.map +1 -1
- package/dist/views/Account/Settings/LanguageSelector.js +47 -18
- package/dist/views/Account/Settings/LanguageSelector.js.map +1 -1
- package/dist/views/Account/Settings/index.js +25 -60
- package/dist/views/Account/Settings/index.js.map +1 -1
- package/dist/views/Account/ToggleTheme/index.js +55 -38
- package/dist/views/Account/ToggleTheme/index.js.map +1 -1
- package/dist/views/Account/index.client.js +32 -16
- package/dist/views/Account/index.client.js.map +1 -1
- package/dist/views/Account/index.js +158 -147
- package/dist/views/Account/index.js.map +1 -1
- package/dist/views/Account/metadata.js +12 -8
- package/dist/views/Account/metadata.js.map +1 -1
- package/dist/views/BrowseByFolder/buildView.js +157 -138
- package/dist/views/BrowseByFolder/buildView.js.map +1 -1
- package/dist/views/BrowseByFolder/index.js +16 -16
- package/dist/views/BrowseByFolder/index.js.map +1 -1
- package/dist/views/BrowseByFolder/metadata.js +15 -13
- package/dist/views/BrowseByFolder/metadata.js.map +1 -1
- package/dist/views/CollectionFolders/buildView.js +142 -122
- package/dist/views/CollectionFolders/buildView.js.map +1 -1
- package/dist/views/CollectionFolders/index.js +16 -16
- package/dist/views/CollectionFolders/index.js.map +1 -1
- package/dist/views/CollectionFolders/metadata.js +21 -18
- package/dist/views/CollectionFolders/metadata.js.map +1 -1
- package/dist/views/CollectionFolders/renderFolderViewSlots.js +61 -58
- package/dist/views/CollectionFolders/renderFolderViewSlots.js.map +1 -1
- package/dist/views/CollectionTrash/index.js +17 -17
- package/dist/views/CollectionTrash/index.js.map +1 -1
- package/dist/views/CollectionTrash/metadata.js +21 -18
- package/dist/views/CollectionTrash/metadata.js.map +1 -1
- package/dist/views/CreateFirstUser/index.client.js +103 -117
- package/dist/views/CreateFirstUser/index.client.js.map +1 -1
- package/dist/views/CreateFirstUser/index.js +81 -87
- package/dist/views/CreateFirstUser/index.js.map +1 -1
- package/dist/views/CreateFirstUser/metadata.js +12 -8
- package/dist/views/CreateFirstUser/metadata.js.map +1 -1
- package/dist/views/Dashboard/Default/ModularDashboard/DashboardStepNav.js +138 -147
- package/dist/views/Dashboard/Default/ModularDashboard/DashboardStepNav.js.map +1 -1
- package/dist/views/Dashboard/Default/ModularDashboard/index.client.js +405 -423
- package/dist/views/Dashboard/Default/ModularDashboard/index.client.js.map +1 -1
- package/dist/views/Dashboard/Default/ModularDashboard/index.js +75 -72
- package/dist/views/Dashboard/Default/ModularDashboard/index.js.map +1 -1
- package/dist/views/Dashboard/Default/ModularDashboard/renderWidget/RenderWidget.js +89 -62
- package/dist/views/Dashboard/Default/ModularDashboard/renderWidget/RenderWidget.js.map +1 -1
- package/dist/views/Dashboard/Default/ModularDashboard/renderWidget/getDefaultLayoutServerFn.js +47 -40
- package/dist/views/Dashboard/Default/ModularDashboard/renderWidget/getDefaultLayoutServerFn.js.map +1 -1
- package/dist/views/Dashboard/Default/ModularDashboard/renderWidget/renderWidgetServerFn.js +65 -64
- package/dist/views/Dashboard/Default/ModularDashboard/renderWidget/renderWidgetServerFn.js.map +1 -1
- package/dist/views/Dashboard/Default/ModularDashboard/useDashboardLayout.js +147 -164
- package/dist/views/Dashboard/Default/ModularDashboard/useDashboardLayout.js.map +1 -1
- package/dist/views/Dashboard/Default/ModularDashboard/utils/collisionDetection.js +30 -31
- package/dist/views/Dashboard/Default/ModularDashboard/utils/collisionDetection.js.map +1 -1
- package/dist/views/Dashboard/Default/ModularDashboard/utils/sensors.js +229 -223
- package/dist/views/Dashboard/Default/ModularDashboard/utils/sensors.js.map +1 -1
- package/dist/views/Dashboard/Default/index.js +45 -59
- package/dist/views/Dashboard/Default/index.js.map +1 -1
- package/dist/views/Dashboard/index.js +42 -46
- package/dist/views/Dashboard/index.js.map +1 -1
- package/dist/views/Dashboard/metadata.js +14 -10
- package/dist/views/Dashboard/metadata.js.map +1 -1
- package/dist/views/Document/getCustomDocumentViewByKey.js +2 -3
- package/dist/views/Document/getCustomDocumentViewByKey.js.map +1 -1
- package/dist/views/Document/getCustomViewByRoute.js +30 -27
- package/dist/views/Document/getCustomViewByRoute.js.map +1 -1
- package/dist/views/Document/getDocPreferences.js +41 -40
- package/dist/views/Document/getDocPreferences.js.map +1 -1
- package/dist/views/Document/getDocumentData.js +55 -44
- package/dist/views/Document/getDocumentData.js.map +1 -1
- package/dist/views/Document/getDocumentPermissions.js +80 -77
- package/dist/views/Document/getDocumentPermissions.js.map +1 -1
- package/dist/views/Document/getDocumentView.js +283 -313
- package/dist/views/Document/getDocumentView.js.map +1 -1
- package/dist/views/Document/getIsLocked.js +66 -66
- package/dist/views/Document/getIsLocked.js.map +1 -1
- package/dist/views/Document/getMetaBySegment.js +136 -130
- package/dist/views/Document/getMetaBySegment.js.map +1 -1
- package/dist/views/Document/getVersions.js +195 -205
- package/dist/views/Document/getVersions.js.map +1 -1
- package/dist/views/Document/handleServerFunction.js +128 -103
- package/dist/views/Document/handleServerFunction.js.map +1 -1
- package/dist/views/Document/index.js +355 -316
- package/dist/views/Document/index.js.map +1 -1
- package/dist/views/Document/metadata.js +1 -2
- package/dist/views/Document/metadata.js.map +1 -1
- package/dist/views/Document/renderDocumentSlots.js +132 -121
- package/dist/views/Document/renderDocumentSlots.js.map +1 -1
- package/dist/views/Edit/index.js +6 -10
- package/dist/views/Edit/index.js.map +1 -1
- package/dist/views/Edit/metadata.js +46 -36
- package/dist/views/Edit/metadata.js.map +1 -1
- package/dist/views/ForgotPassword/ForgotPasswordForm/index.js +164 -130
- package/dist/views/ForgotPassword/ForgotPasswordForm/index.js.map +1 -1
- package/dist/views/ForgotPassword/index.js +62 -79
- package/dist/views/ForgotPassword/index.js.map +1 -1
- package/dist/views/ForgotPassword/metadata.js +12 -8
- package/dist/views/ForgotPassword/metadata.js.map +1 -1
- package/dist/views/List/createSerializableValue.js +11 -12
- package/dist/views/List/createSerializableValue.js.map +1 -1
- package/dist/views/List/enrichDocsWithVersionStatus.js +86 -86
- package/dist/views/List/enrichDocsWithVersionStatus.js.map +1 -1
- package/dist/views/List/extractRelationshipDisplayValue.js +14 -15
- package/dist/views/List/extractRelationshipDisplayValue.js.map +1 -1
- package/dist/views/List/extractValueOrRelationshipID.js +15 -16
- package/dist/views/List/extractValueOrRelationshipID.js.map +1 -1
- package/dist/views/List/handleGroupBy.js +150 -133
- package/dist/views/List/handleGroupBy.js.map +1 -1
- package/dist/views/List/handleServerFunction.js +121 -98
- package/dist/views/List/handleServerFunction.js.map +1 -1
- package/dist/views/List/index.js +323 -305
- package/dist/views/List/index.js.map +1 -1
- package/dist/views/List/metadata.js +20 -17
- package/dist/views/List/metadata.js.map +1 -1
- package/dist/views/List/renderListViewSlots.js +75 -82
- package/dist/views/List/renderListViewSlots.js.map +1 -1
- package/dist/views/List/resolveAllFilterOptions.js +45 -43
- package/dist/views/List/resolveAllFilterOptions.js.map +1 -1
- package/dist/views/List/transformColumnsToSelect.js +8 -9
- package/dist/views/List/transformColumnsToSelect.js.map +1 -1
- package/dist/views/Login/LoginField/index.js +89 -57
- package/dist/views/Login/LoginField/index.js.map +1 -1
- package/dist/views/Login/LoginForm/index.js +160 -107
- package/dist/views/Login/LoginForm/index.js.map +1 -1
- package/dist/views/Login/index.js +85 -82
- package/dist/views/Login/index.js.map +1 -1
- package/dist/views/Login/metadata.js +12 -8
- package/dist/views/Login/metadata.js.map +1 -1
- package/dist/views/Logout/LogoutClient.js +120 -84
- package/dist/views/Logout/LogoutClient.js.map +1 -1
- package/dist/views/Logout/index.js +29 -29
- package/dist/views/Logout/index.js.map +1 -1
- package/dist/views/Logout/metadata.js +11 -7
- package/dist/views/Logout/metadata.js.map +1 -1
- package/dist/views/NotFound/index.client.js +82 -71
- package/dist/views/NotFound/index.client.js.map +1 -1
- package/dist/views/NotFound/index.js +73 -72
- package/dist/views/NotFound/index.js.map +1 -1
- package/dist/views/NotFound/metadata.js +9 -7
- package/dist/views/NotFound/metadata.js.map +1 -1
- package/dist/views/ResetPassword/ResetPasswordForm/index.js +108 -97
- package/dist/views/ResetPassword/ResetPasswordForm/index.js.map +1 -1
- package/dist/views/ResetPassword/index.js +73 -93
- package/dist/views/ResetPassword/index.js.map +1 -1
- package/dist/views/ResetPassword/metadata.js +12 -8
- package/dist/views/ResetPassword/metadata.js.map +1 -1
- package/dist/views/Root/attachViewActions.js +23 -18
- package/dist/views/Root/attachViewActions.js.map +1 -1
- package/dist/views/Root/generateCustomViewMetadata.js +21 -19
- package/dist/views/Root/generateCustomViewMetadata.js.map +1 -1
- package/dist/views/Root/getCustomViewByKey.js +14 -12
- package/dist/views/Root/getCustomViewByKey.js.map +1 -1
- package/dist/views/Root/getCustomViewByRoute.js +42 -31
- package/dist/views/Root/getCustomViewByRoute.js.map +1 -1
- package/dist/views/Root/getDocumentViewInfo.js +23 -24
- package/dist/views/Root/getDocumentViewInfo.js.map +1 -1
- package/dist/views/Root/getRouteData.js +325 -333
- package/dist/views/Root/getRouteData.js.map +1 -1
- package/dist/views/Root/index.js +270 -248
- package/dist/views/Root/index.js.map +1 -1
- package/dist/views/Root/isPathMatchingRoute.js +26 -21
- package/dist/views/Root/isPathMatchingRoute.js.map +1 -1
- package/dist/views/Root/metadata.js +181 -176
- package/dist/views/Root/metadata.js.map +1 -1
- package/dist/views/Unauthorized/index.js +46 -54
- package/dist/views/Unauthorized/index.js.map +1 -1
- package/dist/views/Unauthorized/metadata.js +12 -8
- package/dist/views/Unauthorized/metadata.js.map +1 -1
- package/dist/views/Verify/index.client.js +43 -25
- package/dist/views/Verify/index.client.js.map +1 -1
- package/dist/views/Verify/index.js +64 -69
- package/dist/views/Verify/index.js.map +1 -1
- package/dist/views/Verify/metadata.js +12 -8
- package/dist/views/Verify/metadata.js.map +1 -1
- package/dist/views/Version/Default/SelectedLocalesContext.js +4 -4
- package/dist/views/Version/Default/SelectedLocalesContext.js.map +1 -1
- package/dist/views/Version/Default/SetStepNav.js +127 -86
- package/dist/views/Version/Default/SetStepNav.js.map +1 -1
- package/dist/views/Version/Default/index.js +236 -380
- package/dist/views/Version/Default/index.js.map +1 -1
- package/dist/views/Version/Default/types.js +1 -2
- package/dist/views/Version/Default/types.js.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/DiffCollapser/index.js +119 -102
- package/dist/views/Version/RenderFieldsToDiff/DiffCollapser/index.js.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/RenderVersionFieldsToDiff.js +73 -78
- package/dist/views/Version/RenderFieldsToDiff/RenderVersionFieldsToDiff.js.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/buildVersionFields.js +408 -363
- package/dist/views/Version/RenderFieldsToDiff/buildVersionFields.js.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/fields/Collapsible/index.js +51 -40
- package/dist/views/Version/RenderFieldsToDiff/fields/Collapsible/index.js.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/fields/Date/index.js +67 -35
- package/dist/views/Version/RenderFieldsToDiff/fields/Date/index.js.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/fields/Group/index.js +56 -59
- package/dist/views/Version/RenderFieldsToDiff/fields/Group/index.js.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/fields/Iterable/index.js +117 -139
- package/dist/views/Version/RenderFieldsToDiff/fields/Iterable/index.js.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/fields/Relationship/generateLabelFromValue.js +41 -36
- package/dist/views/Version/RenderFieldsToDiff/fields/Relationship/generateLabelFromValue.js.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/fields/Relationship/index.js +178 -192
- package/dist/views/Version/RenderFieldsToDiff/fields/Relationship/index.js.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/fields/Row/index.js +11 -17
- package/dist/views/Version/RenderFieldsToDiff/fields/Row/index.js.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/fields/Select/index.js +73 -48
- package/dist/views/Version/RenderFieldsToDiff/fields/Select/index.js.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/fields/Tabs/index.js +143 -132
- package/dist/views/Version/RenderFieldsToDiff/fields/Tabs/index.js.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/fields/Text/index.js +81 -56
- package/dist/views/Version/RenderFieldsToDiff/fields/Text/index.js.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/fields/Upload/index.js +211 -252
- package/dist/views/Version/RenderFieldsToDiff/fields/Upload/index.js.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/fields/index.js +22 -23
- package/dist/views/Version/RenderFieldsToDiff/fields/index.js.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/index.js +9 -12
- package/dist/views/Version/RenderFieldsToDiff/index.js.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/utilities/countChangedFields.js +228 -213
- package/dist/views/Version/RenderFieldsToDiff/utilities/countChangedFields.js.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/utilities/countChangedFields.spec.js +826 -1005
- package/dist/views/Version/RenderFieldsToDiff/utilities/countChangedFields.spec.js.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/utilities/fieldHasChanges.js +1 -2
- package/dist/views/Version/RenderFieldsToDiff/utilities/fieldHasChanges.js.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/utilities/fieldHasChanges.spec.js +43 -44
- package/dist/views/Version/RenderFieldsToDiff/utilities/fieldHasChanges.spec.js.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/utilities/getFieldPathsModified.js +22 -25
- package/dist/views/Version/RenderFieldsToDiff/utilities/getFieldPathsModified.js.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/utilities/getFieldsForRowComparison.js +36 -32
- package/dist/views/Version/RenderFieldsToDiff/utilities/getFieldsForRowComparison.js.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/utilities/getFieldsForRowComparison.spec.js +129 -145
- package/dist/views/Version/RenderFieldsToDiff/utilities/getFieldsForRowComparison.spec.js.map +1 -1
- package/dist/views/Version/Restore/index.js +93 -117
- package/dist/views/Version/Restore/index.js.map +1 -1
- package/dist/views/Version/SelectComparison/VersionDrawer/CreatedAtCell.js +50 -33
- package/dist/views/Version/SelectComparison/VersionDrawer/CreatedAtCell.js.map +1 -1
- package/dist/views/Version/SelectComparison/VersionDrawer/index.js +226 -170
- package/dist/views/Version/SelectComparison/VersionDrawer/index.js.map +1 -1
- package/dist/views/Version/SelectComparison/index.js +50 -73
- package/dist/views/Version/SelectComparison/index.js.map +1 -1
- package/dist/views/Version/SelectComparison/types.js +1 -2
- package/dist/views/Version/SelectComparison/types.js.map +1 -1
- package/dist/views/Version/SelectLocales/index.js +32 -34
- package/dist/views/Version/SelectLocales/index.js.map +1 -1
- package/dist/views/Version/VersionPillLabel/VersionPillLabel.js +95 -104
- package/dist/views/Version/VersionPillLabel/VersionPillLabel.js.map +1 -1
- package/dist/views/Version/VersionPillLabel/getVersionLabel.js +27 -23
- package/dist/views/Version/VersionPillLabel/getVersionLabel.js.map +1 -1
- package/dist/views/Version/fetchVersions.js +138 -113
- package/dist/views/Version/fetchVersions.js.map +1 -1
- package/dist/views/Version/index.js +323 -325
- package/dist/views/Version/index.js.map +1 -1
- package/dist/views/Version/metadata.js +50 -43
- package/dist/views/Version/metadata.js.map +1 -1
- package/dist/views/Versions/buildColumns.js +79 -95
- package/dist/views/Versions/buildColumns.js.map +1 -1
- package/dist/views/Versions/cells/AutosaveCell/index.js +38 -34
- package/dist/views/Versions/cells/AutosaveCell/index.js.map +1 -1
- package/dist/views/Versions/cells/CreatedAt/index.js +53 -32
- package/dist/views/Versions/cells/CreatedAt/index.js.map +1 -1
- package/dist/views/Versions/cells/ID/index.js +8 -10
- package/dist/views/Versions/cells/ID/index.js.map +1 -1
- package/dist/views/Versions/index.client.js +83 -106
- package/dist/views/Versions/index.client.js.map +1 -1
- package/dist/views/Versions/index.js +143 -143
- package/dist/views/Versions/index.js.map +1 -1
- package/dist/views/Versions/metadata.js +44 -37
- package/dist/views/Versions/metadata.js.map +1 -1
- package/dist/views/Versions/types.js +1 -2
- package/dist/views/Versions/types.js.map +1 -1
- package/dist/withPayload/withPayload.js +143 -198
- package/dist/withPayload/withPayload.js.map +1 -1
- package/dist/withPayload/withPayload.utils.js +95 -92
- package/dist/withPayload/withPayload.utils.js.map +1 -1
- package/dist/withPayload/withPayloadLegacy.js +40 -42
- package/dist/withPayload/withPayloadLegacy.js.map +1 -1
- package/package.json +7 -7
- package/dist/elements/DocumentHeader/Tabs/Tab/index.scss +0 -38
- package/dist/elements/DocumentHeader/Tabs/index.scss +0 -54
- package/dist/elements/DocumentHeader/Tabs/tabs/VersionsPill/index.scss +0 -9
- package/dist/elements/DocumentHeader/index.scss +0 -64
- package/dist/elements/FormHeader/index.scss +0 -8
- package/dist/elements/Nav/NavWrapper/index.scss +0 -27
- package/dist/elements/Nav/SettingsMenuButton/index.scss +0 -11
- package/dist/elements/Nav/index.scss +0 -173
- package/dist/esbuildEntry.d.ts +0 -5
- package/dist/esbuildEntry.d.ts.map +0 -1
- package/dist/esbuildEntry.js +0 -6
- package/dist/esbuildEntry.js.map +0 -1
- package/dist/templates/Default/Wrapper/index.scss +0 -58
- package/dist/templates/Default/index.scss +0 -79
- package/dist/templates/Minimal/index.scss +0 -30
- package/dist/views/API/RenderJSON/index.scss +0 -129
- package/dist/views/API/index.scss +0 -119
- package/dist/views/Account/Settings/index.scss +0 -48
- package/dist/views/CreateFirstUser/index.scss +0 -21
- package/dist/views/Dashboard/Default/ModularDashboard/index.scss +0 -316
- package/dist/views/Login/LoginForm/index.scss +0 -10
- package/dist/views/Login/index.scss +0 -10
- package/dist/views/Logout/index.scss +0 -25
- package/dist/views/NotFound/index.scss +0 -57
- package/dist/views/ResetPassword/index.scss +0 -11
- package/dist/views/Unauthorized/index.scss +0 -14
- package/dist/views/Verify/index.scss +0 -16
- package/dist/views/Version/Default/index.scss +0 -170
- package/dist/views/Version/RenderFieldsToDiff/DiffCollapser/index.scss +0 -81
- package/dist/views/Version/RenderFieldsToDiff/fields/Date/index.scss +0 -12
- package/dist/views/Version/RenderFieldsToDiff/fields/Group/index.scss +0 -9
- package/dist/views/Version/RenderFieldsToDiff/fields/Iterable/index.scss +0 -59
- package/dist/views/Version/RenderFieldsToDiff/fields/Relationship/index.scss +0 -91
- package/dist/views/Version/RenderFieldsToDiff/fields/Select/index.scss +0 -4
- package/dist/views/Version/RenderFieldsToDiff/fields/Tabs/index.scss +0 -9
- package/dist/views/Version/RenderFieldsToDiff/fields/Text/index.scss +0 -4
- package/dist/views/Version/RenderFieldsToDiff/fields/Upload/index.scss +0 -121
- package/dist/views/Version/RenderFieldsToDiff/index.scss +0 -24
- package/dist/views/Version/Restore/index.scss +0 -84
- package/dist/views/Version/SelectComparison/VersionDrawer/index.scss +0 -18
- package/dist/views/Version/SelectComparison/index.scss +0 -9
- package/dist/views/Version/VersionPillLabel/index.scss +0 -26
- package/dist/views/Versions/cells/AutosaveCell/index.scss +0 -9
- package/dist/views/Versions/index.scss +0 -110
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { DocumentInfoProvider, EditDepthProvider, HydrateAuthProvider, LivePreviewProvider } from '@payloadcms/ui';
|
|
3
3
|
import { RenderServerComponent } from '@payloadcms/ui/elements/RenderServerComponent';
|
|
4
4
|
import { handleLivePreview, handlePreview } from '@payloadcms/ui/rsc';
|
|
@@ -19,333 +19,372 @@ import { getIsLocked } from './getIsLocked.js';
|
|
|
19
19
|
import { getMetaBySegment } from './getMetaBySegment.js';
|
|
20
20
|
import { getVersions } from './getVersions.js';
|
|
21
21
|
import { renderDocumentSlots } from './renderDocumentSlots.js';
|
|
22
|
-
export const generateMetadata = async
|
|
22
|
+
export const generateMetadata = async args => getMetaBySegment(args);
|
|
23
23
|
/**
|
|
24
24
|
* This function is responsible for rendering
|
|
25
25
|
* an Edit Document view on the server for both:
|
|
26
26
|
* - default document edit views
|
|
27
27
|
* - on-demand edit views within drawers
|
|
28
|
-
*/
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
28
|
+
*/
|
|
29
|
+
export const renderDocument = async ({
|
|
30
|
+
disableActions,
|
|
31
|
+
documentSubViewType,
|
|
32
|
+
drawerSlug,
|
|
33
|
+
importMap,
|
|
34
|
+
initialData,
|
|
35
|
+
initPageResult,
|
|
36
|
+
overrideEntityVisibility,
|
|
37
|
+
params,
|
|
38
|
+
redirectAfterCreate,
|
|
39
|
+
redirectAfterDelete,
|
|
40
|
+
redirectAfterDuplicate,
|
|
41
|
+
redirectAfterRestore,
|
|
42
|
+
searchParams,
|
|
43
|
+
versions,
|
|
44
|
+
viewType
|
|
45
|
+
}) => {
|
|
46
|
+
const {
|
|
47
|
+
collectionConfig,
|
|
48
|
+
docID: idFromArgs,
|
|
49
|
+
globalConfig,
|
|
50
|
+
locale,
|
|
51
|
+
permissions,
|
|
52
|
+
req,
|
|
53
|
+
req: {
|
|
54
|
+
i18n,
|
|
55
|
+
payload,
|
|
56
|
+
payload: {
|
|
57
|
+
config,
|
|
58
|
+
config: {
|
|
59
|
+
routes: {
|
|
60
|
+
admin: adminRoute,
|
|
61
|
+
api: apiRoute
|
|
62
|
+
},
|
|
63
|
+
serverURL
|
|
60
64
|
}
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
getDocumentPermissions({
|
|
94
|
-
id: idFromArgs,
|
|
95
|
-
collectionConfig,
|
|
96
|
-
data: doc,
|
|
97
|
-
globalConfig,
|
|
98
|
-
req: reqForPermissions
|
|
99
|
-
}),
|
|
100
|
-
// Fetch document lock state - isolated transactionID prevents cross-contamination
|
|
101
|
-
getIsLocked({
|
|
102
|
-
id: idFromArgs,
|
|
103
|
-
collectionConfig,
|
|
104
|
-
globalConfig,
|
|
105
|
-
isEditing,
|
|
106
|
-
req: reqForLockCheck
|
|
107
|
-
}),
|
|
108
|
-
// get entity preferences
|
|
109
|
-
getPreferences(collectionSlug ? `collection-${collectionSlug}` : `global-${globalSlug}`, payload, req.user.id, req.user.collection)
|
|
110
|
-
]);
|
|
111
|
-
const operation = collectionSlug && idFromArgs || globalSlug ? 'update' : 'create';
|
|
112
|
-
const [{ hasPublishedDoc, mostRecentVersionIsAutosaved, unpublishedVersionCount, versionCount }, { state: formState }] = await Promise.all([
|
|
113
|
-
getVersions({
|
|
114
|
-
id: idFromArgs,
|
|
115
|
-
collectionConfig,
|
|
116
|
-
doc,
|
|
117
|
-
docPermissions,
|
|
118
|
-
globalConfig,
|
|
119
|
-
locale: locale?.code,
|
|
120
|
-
payload,
|
|
121
|
-
user
|
|
122
|
-
}),
|
|
123
|
-
buildFormState({
|
|
124
|
-
id: idFromArgs,
|
|
125
|
-
collectionSlug,
|
|
126
|
-
data: doc,
|
|
127
|
-
docPermissions,
|
|
128
|
-
docPreferences,
|
|
129
|
-
fallbackLocale: false,
|
|
130
|
-
globalSlug,
|
|
131
|
-
locale: locale?.code,
|
|
132
|
-
operation,
|
|
133
|
-
readOnly: isTrashedDoc || isLocked,
|
|
134
|
-
renderAllFields: true,
|
|
135
|
-
req,
|
|
136
|
-
schemaPath: collectionSlug || globalSlug,
|
|
137
|
-
skipValidation: true
|
|
138
|
-
})
|
|
139
|
-
]);
|
|
140
|
-
const documentViewServerProps = {
|
|
141
|
-
doc,
|
|
142
|
-
hasPublishedDoc,
|
|
143
|
-
i18n,
|
|
144
|
-
initPageResult,
|
|
145
|
-
locale,
|
|
146
|
-
params,
|
|
147
|
-
payload,
|
|
148
|
-
permissions,
|
|
149
|
-
routeSegments: segments,
|
|
150
|
-
searchParams,
|
|
151
|
-
user,
|
|
152
|
-
versions
|
|
153
|
-
};
|
|
154
|
-
if (!overrideEntityVisibility && (collectionSlug && !visibleEntities?.collections?.find((visibleSlug)=>visibleSlug === collectionSlug) || globalSlug && !visibleEntities?.globals?.find((visibleSlug)=>visibleSlug === globalSlug))) {
|
|
155
|
-
throw new Error('not-found');
|
|
156
|
-
}
|
|
157
|
-
const formattedParams = new URLSearchParams();
|
|
158
|
-
if (hasDraftsEnabled(collectionConfig || globalConfig)) {
|
|
159
|
-
formattedParams.append('draft', 'true');
|
|
160
|
-
}
|
|
161
|
-
if (locale?.code) {
|
|
162
|
-
formattedParams.append('locale', locale.code);
|
|
163
|
-
}
|
|
164
|
-
const apiQueryParams = `?${formattedParams.toString()}`;
|
|
165
|
-
const apiURL = formatAdminURL({
|
|
166
|
-
apiRoute,
|
|
167
|
-
path: collectionSlug ? `/${collectionSlug}/${idFromArgs}${apiQueryParams}` : globalSlug ? `/${globalSlug}${apiQueryParams}` : ''
|
|
168
|
-
});
|
|
169
|
-
let View = null;
|
|
170
|
-
let showHeader = true;
|
|
171
|
-
const RootViewOverride = collectionConfig?.admin?.components?.views?.edit?.root && 'Component' in collectionConfig.admin.components.views.edit.root ? collectionConfig?.admin?.components?.views?.edit?.root?.Component : globalConfig?.admin?.components?.views?.edit?.root && 'Component' in globalConfig.admin.components.views.edit.root ? globalConfig?.admin?.components?.views?.edit?.root?.Component : null;
|
|
172
|
-
if (RootViewOverride) {
|
|
173
|
-
View = RootViewOverride;
|
|
174
|
-
showHeader = false;
|
|
65
|
+
},
|
|
66
|
+
user
|
|
67
|
+
},
|
|
68
|
+
visibleEntities
|
|
69
|
+
} = initPageResult;
|
|
70
|
+
const segments = Array.isArray(params?.segments) ? params.segments : [];
|
|
71
|
+
const collectionSlug = collectionConfig?.slug || undefined;
|
|
72
|
+
const globalSlug = globalConfig?.slug || undefined;
|
|
73
|
+
let isEditing = getIsEditing({
|
|
74
|
+
id: idFromArgs,
|
|
75
|
+
collectionSlug,
|
|
76
|
+
globalSlug
|
|
77
|
+
});
|
|
78
|
+
// Fetch the doc required for the view
|
|
79
|
+
let doc = !idFromArgs && !globalSlug ? initialData || null : await getDocumentData({
|
|
80
|
+
id: idFromArgs,
|
|
81
|
+
collectionSlug,
|
|
82
|
+
globalSlug,
|
|
83
|
+
locale,
|
|
84
|
+
payload,
|
|
85
|
+
req,
|
|
86
|
+
segments,
|
|
87
|
+
user
|
|
88
|
+
});
|
|
89
|
+
if (isEditing && !doc) {
|
|
90
|
+
// If it's a collection document that doesn't exist, redirect to collection list
|
|
91
|
+
if (collectionSlug) {
|
|
92
|
+
const redirectURL = formatAdminURL({
|
|
93
|
+
adminRoute,
|
|
94
|
+
path: `/collections/${collectionSlug}?notFound=${encodeURIComponent(idFromArgs)}`
|
|
95
|
+
});
|
|
96
|
+
redirect(redirectURL);
|
|
175
97
|
} else {
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
collectionConfig,
|
|
179
|
-
config,
|
|
180
|
-
docPermissions,
|
|
181
|
-
globalConfig,
|
|
182
|
-
routeSegments: segments
|
|
183
|
-
}));
|
|
184
|
-
}
|
|
185
|
-
if (!View) {
|
|
186
|
-
View = NotFoundView;
|
|
187
|
-
}
|
|
188
|
-
/**
|
|
189
|
-
* Handle case where autoSave is enabled and the document is being created
|
|
190
|
-
* => create document and redirect
|
|
191
|
-
*/ const shouldAutosave = hasSavePermission && hasAutosaveEnabled(collectionConfig || globalConfig);
|
|
192
|
-
const validateDraftData = collectionConfig?.versions?.drafts && collectionConfig?.versions?.drafts?.validate;
|
|
193
|
-
let id = idFromArgs;
|
|
194
|
-
if (shouldAutosave && !validateDraftData && !idFromArgs && collectionSlug) {
|
|
195
|
-
doc = await payload.create({
|
|
196
|
-
collection: collectionSlug,
|
|
197
|
-
data: initialData || {},
|
|
198
|
-
depth: 0,
|
|
199
|
-
draft: true,
|
|
200
|
-
fallbackLocale: false,
|
|
201
|
-
locale: locale?.code,
|
|
202
|
-
req,
|
|
203
|
-
user
|
|
204
|
-
});
|
|
205
|
-
if (doc?.id) {
|
|
206
|
-
id = doc.id;
|
|
207
|
-
isEditing = getIsEditing({
|
|
208
|
-
id: doc.id,
|
|
209
|
-
collectionSlug,
|
|
210
|
-
globalSlug
|
|
211
|
-
});
|
|
212
|
-
if (!drawerSlug && redirectAfterCreate !== false) {
|
|
213
|
-
const redirectURL = formatAdminURL({
|
|
214
|
-
adminRoute,
|
|
215
|
-
path: `/collections/${collectionSlug}/${doc.id}`
|
|
216
|
-
});
|
|
217
|
-
redirect(redirectURL);
|
|
218
|
-
}
|
|
219
|
-
} else {
|
|
220
|
-
throw new Error('not-found');
|
|
221
|
-
}
|
|
98
|
+
// For globals or other cases, keep the 404 behavior
|
|
99
|
+
throw new Error('not-found');
|
|
222
100
|
}
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
101
|
+
}
|
|
102
|
+
const isTrashedDoc = Boolean(doc && 'deletedAt' in doc && typeof doc?.deletedAt === 'string');
|
|
103
|
+
// CRITICAL FIX FOR TRANSACTION RACE CONDITION:
|
|
104
|
+
// When running parallel operations with Promise.all, if they share the same req object
|
|
105
|
+
// and one operation calls initTransaction() which MUTATES req.transactionID, that mutation
|
|
106
|
+
// is visible to all parallel operations. This causes:
|
|
107
|
+
// 1. Operation A (e.g., getDocumentPermissions → docAccessOperation) calls initTransaction()
|
|
108
|
+
// which sets req.transactionID = Promise, then resolves it to a UUID
|
|
109
|
+
// 2. Operation B (e.g., getIsLocked) running in parallel receives the SAME req with the mutated transactionID
|
|
110
|
+
// 3. Operation A (does not even know that Operation B even exists and is stil using the transactionID) commits/ends its transaction
|
|
111
|
+
// 4. Operation B tries to use the now-expired session → MongoExpiredSessionError!
|
|
112
|
+
//
|
|
113
|
+
// Solution: Use isolateObjectProperty to create a Proxy that isolates the 'transactionID' property.
|
|
114
|
+
// This allows each operation to have its own transactionID without affecting the parent req.
|
|
115
|
+
// If parent req already has a transaction, preserve it (don't isolate), since this
|
|
116
|
+
// issue only arises when one of the operations calls initTransaction() themselves -
|
|
117
|
+
// because then, that operation will also try to commit/end the transaction itself.
|
|
118
|
+
// If the transactionID is already set, the parallel operations will not try to
|
|
119
|
+
// commit/end the transaction themselves, so we don't need to isolate the
|
|
120
|
+
// transactionID property.
|
|
121
|
+
const reqForPermissions = req.transactionID ? req : isolateObjectProperty(req, 'transactionID');
|
|
122
|
+
const reqForLockCheck = req.transactionID ? req : isolateObjectProperty(req, 'transactionID');
|
|
123
|
+
const [docPreferences, {
|
|
124
|
+
docPermissions,
|
|
125
|
+
hasPublishPermission,
|
|
126
|
+
hasSavePermission
|
|
127
|
+
}, {
|
|
128
|
+
currentEditor,
|
|
129
|
+
isLocked,
|
|
130
|
+
lastUpdateTime
|
|
131
|
+
}, entityPreferences] = await Promise.all([
|
|
132
|
+
// Get document preferences
|
|
133
|
+
getDocPreferences({
|
|
134
|
+
id: idFromArgs,
|
|
135
|
+
collectionSlug,
|
|
136
|
+
globalSlug,
|
|
137
|
+
payload,
|
|
138
|
+
user
|
|
139
|
+
}),
|
|
140
|
+
// Get permissions - isolated transactionID prevents cross-contamination
|
|
141
|
+
getDocumentPermissions({
|
|
142
|
+
id: idFromArgs,
|
|
143
|
+
collectionConfig,
|
|
144
|
+
data: doc,
|
|
145
|
+
globalConfig,
|
|
146
|
+
req: reqForPermissions
|
|
147
|
+
}),
|
|
148
|
+
// Fetch document lock state - isolated transactionID prevents cross-contamination
|
|
149
|
+
getIsLocked({
|
|
150
|
+
id: idFromArgs,
|
|
151
|
+
collectionConfig,
|
|
152
|
+
globalConfig,
|
|
153
|
+
isEditing,
|
|
154
|
+
req: reqForLockCheck
|
|
155
|
+
}),
|
|
156
|
+
// get entity preferences
|
|
157
|
+
getPreferences(collectionSlug ? `collection-${collectionSlug}` : `global-${globalSlug}`, payload, req.user.id, req.user.collection)]);
|
|
158
|
+
const operation = collectionSlug && idFromArgs || globalSlug ? 'update' : 'create';
|
|
159
|
+
const [{
|
|
160
|
+
hasPublishedDoc,
|
|
161
|
+
mostRecentVersionIsAutosaved,
|
|
162
|
+
unpublishedVersionCount,
|
|
163
|
+
versionCount
|
|
164
|
+
}, {
|
|
165
|
+
state: formState
|
|
166
|
+
}] = await Promise.all([getVersions({
|
|
167
|
+
id: idFromArgs,
|
|
168
|
+
collectionConfig,
|
|
169
|
+
doc,
|
|
170
|
+
docPermissions,
|
|
171
|
+
globalConfig,
|
|
172
|
+
locale: locale?.code,
|
|
173
|
+
payload,
|
|
174
|
+
user
|
|
175
|
+
}), buildFormState({
|
|
176
|
+
id: idFromArgs,
|
|
177
|
+
collectionSlug,
|
|
178
|
+
data: doc,
|
|
179
|
+
docPermissions,
|
|
180
|
+
docPreferences,
|
|
181
|
+
fallbackLocale: false,
|
|
182
|
+
globalSlug,
|
|
183
|
+
locale: locale?.code,
|
|
184
|
+
operation,
|
|
185
|
+
readOnly: isTrashedDoc || isLocked,
|
|
186
|
+
renderAllFields: true,
|
|
187
|
+
req,
|
|
188
|
+
schemaPath: collectionSlug || globalSlug,
|
|
189
|
+
skipValidation: true
|
|
190
|
+
})]);
|
|
191
|
+
const documentViewServerProps = {
|
|
192
|
+
doc,
|
|
193
|
+
hasPublishedDoc,
|
|
194
|
+
i18n,
|
|
195
|
+
initPageResult,
|
|
196
|
+
locale,
|
|
197
|
+
params,
|
|
198
|
+
payload,
|
|
199
|
+
permissions,
|
|
200
|
+
routeSegments: segments,
|
|
201
|
+
searchParams,
|
|
202
|
+
user,
|
|
203
|
+
versions
|
|
204
|
+
};
|
|
205
|
+
if (!overrideEntityVisibility && (collectionSlug && !visibleEntities?.collections?.find(visibleSlug => visibleSlug === collectionSlug) || globalSlug && !visibleEntities?.globals?.find(visibleSlug => visibleSlug === globalSlug))) {
|
|
206
|
+
throw new Error('not-found');
|
|
207
|
+
}
|
|
208
|
+
const formattedParams = new URLSearchParams();
|
|
209
|
+
if (hasDraftsEnabled(collectionConfig || globalConfig)) {
|
|
210
|
+
formattedParams.append('draft', 'true');
|
|
211
|
+
}
|
|
212
|
+
if (locale?.code) {
|
|
213
|
+
formattedParams.append('locale', locale.code);
|
|
214
|
+
}
|
|
215
|
+
const apiQueryParams = `?${formattedParams.toString()}`;
|
|
216
|
+
const apiURL = formatAdminURL({
|
|
217
|
+
apiRoute,
|
|
218
|
+
path: collectionSlug ? `/${collectionSlug}/${idFromArgs}${apiQueryParams}` : globalSlug ? `/${globalSlug}${apiQueryParams}` : ''
|
|
219
|
+
});
|
|
220
|
+
let View = null;
|
|
221
|
+
let showHeader = true;
|
|
222
|
+
const RootViewOverride = collectionConfig?.admin?.components?.views?.edit?.root && 'Component' in collectionConfig.admin.components.views.edit.root ? collectionConfig?.admin?.components?.views?.edit?.root?.Component : globalConfig?.admin?.components?.views?.edit?.root && 'Component' in globalConfig.admin.components.views.edit.root ? globalConfig?.admin?.components?.views?.edit?.root?.Component : null;
|
|
223
|
+
if (RootViewOverride) {
|
|
224
|
+
View = RootViewOverride;
|
|
225
|
+
showHeader = false;
|
|
226
|
+
} else {
|
|
227
|
+
({
|
|
228
|
+
View
|
|
229
|
+
} = getDocumentView({
|
|
230
|
+
collectionConfig,
|
|
231
|
+
config,
|
|
232
|
+
docPermissions,
|
|
233
|
+
globalConfig,
|
|
234
|
+
routeSegments: segments
|
|
235
|
+
}));
|
|
236
|
+
}
|
|
237
|
+
if (!View) {
|
|
238
|
+
View = NotFoundView;
|
|
239
|
+
}
|
|
240
|
+
/**
|
|
241
|
+
* Handle case where autoSave is enabled and the document is being created
|
|
242
|
+
* => create document and redirect
|
|
243
|
+
*/
|
|
244
|
+
const shouldAutosave = hasSavePermission && hasAutosaveEnabled(collectionConfig || globalConfig);
|
|
245
|
+
const validateDraftData = collectionConfig?.versions?.drafts && collectionConfig?.versions?.drafts?.validate;
|
|
246
|
+
let id = idFromArgs;
|
|
247
|
+
if (shouldAutosave && !validateDraftData && !idFromArgs && collectionSlug) {
|
|
248
|
+
doc = await payload.create({
|
|
249
|
+
collection: collectionSlug,
|
|
250
|
+
data: initialData || {},
|
|
251
|
+
depth: 0,
|
|
252
|
+
draft: true,
|
|
253
|
+
fallbackLocale: false,
|
|
254
|
+
locale: locale?.code,
|
|
255
|
+
req,
|
|
256
|
+
user
|
|
230
257
|
});
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
...documentSlots,
|
|
236
|
-
documentSubViewType,
|
|
237
|
-
viewType
|
|
238
|
-
};
|
|
239
|
-
const { isLivePreviewEnabled, livePreviewConfig, livePreviewURL } = await handleLivePreview({
|
|
258
|
+
if (doc?.id) {
|
|
259
|
+
id = doc.id;
|
|
260
|
+
isEditing = getIsEditing({
|
|
261
|
+
id: doc.id,
|
|
240
262
|
collectionSlug,
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
263
|
+
globalSlug
|
|
264
|
+
});
|
|
265
|
+
if (!drawerSlug && redirectAfterCreate !== false) {
|
|
266
|
+
const redirectURL = formatAdminURL({
|
|
267
|
+
adminRoute,
|
|
268
|
+
path: `/collections/${collectionSlug}/${doc.id}`
|
|
269
|
+
});
|
|
270
|
+
redirect(redirectURL);
|
|
271
|
+
}
|
|
272
|
+
} else {
|
|
273
|
+
throw new Error('not-found');
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
const documentSlots = renderDocumentSlots({
|
|
277
|
+
id,
|
|
278
|
+
collectionConfig,
|
|
279
|
+
globalConfig,
|
|
280
|
+
hasSavePermission,
|
|
281
|
+
permissions: docPermissions,
|
|
282
|
+
req
|
|
283
|
+
});
|
|
284
|
+
// Extract Description from documentSlots to pass to DocumentHeader
|
|
285
|
+
const {
|
|
286
|
+
Description
|
|
287
|
+
} = documentSlots;
|
|
288
|
+
const clientProps = {
|
|
289
|
+
formState,
|
|
290
|
+
...documentSlots,
|
|
291
|
+
documentSubViewType,
|
|
292
|
+
viewType
|
|
293
|
+
};
|
|
294
|
+
const {
|
|
295
|
+
isLivePreviewEnabled,
|
|
296
|
+
livePreviewConfig,
|
|
297
|
+
livePreviewURL
|
|
298
|
+
} = await handleLivePreview({
|
|
299
|
+
collectionSlug,
|
|
300
|
+
config,
|
|
301
|
+
data: doc,
|
|
302
|
+
globalSlug,
|
|
303
|
+
operation,
|
|
304
|
+
req
|
|
305
|
+
});
|
|
306
|
+
const {
|
|
307
|
+
isPreviewEnabled,
|
|
308
|
+
previewURL
|
|
309
|
+
} = await handlePreview({
|
|
310
|
+
collectionSlug,
|
|
311
|
+
config,
|
|
312
|
+
data: doc,
|
|
313
|
+
globalSlug,
|
|
314
|
+
operation,
|
|
315
|
+
req
|
|
316
|
+
});
|
|
317
|
+
return {
|
|
318
|
+
data: doc,
|
|
319
|
+
Document: /*#__PURE__*/_jsx(DocumentInfoProvider, {
|
|
320
|
+
apiURL: apiURL,
|
|
321
|
+
collectionSlug: collectionConfig?.slug,
|
|
322
|
+
currentEditor: currentEditor,
|
|
323
|
+
disableActions: disableActions ?? false,
|
|
324
|
+
docPermissions: docPermissions,
|
|
325
|
+
globalSlug: globalConfig?.slug,
|
|
326
|
+
hasPublishedDoc: hasPublishedDoc,
|
|
327
|
+
hasPublishPermission: hasPublishPermission,
|
|
328
|
+
hasSavePermission: hasSavePermission,
|
|
329
|
+
id: id,
|
|
330
|
+
initialData: doc,
|
|
331
|
+
initialState: formState,
|
|
332
|
+
isEditing: isEditing,
|
|
333
|
+
isLocked: isLocked,
|
|
334
|
+
isTrashed: isTrashedDoc,
|
|
335
|
+
lastUpdateTime: lastUpdateTime,
|
|
336
|
+
mostRecentVersionIsAutosaved: mostRecentVersionIsAutosaved,
|
|
337
|
+
redirectAfterCreate: redirectAfterCreate,
|
|
338
|
+
redirectAfterDelete: redirectAfterDelete,
|
|
339
|
+
redirectAfterDuplicate: redirectAfterDuplicate,
|
|
340
|
+
redirectAfterRestore: redirectAfterRestore,
|
|
341
|
+
unpublishedVersionCount: unpublishedVersionCount,
|
|
342
|
+
versionCount: versionCount,
|
|
343
|
+
children: /*#__PURE__*/_jsxs(LivePreviewProvider, {
|
|
344
|
+
breakpoints: livePreviewConfig?.breakpoints,
|
|
345
|
+
isLivePreviewEnabled: isLivePreviewEnabled && operation !== 'create',
|
|
346
|
+
isLivePreviewing: Boolean(entityPreferences?.value?.editViewType === 'live-preview' && livePreviewURL),
|
|
347
|
+
isPreviewEnabled: Boolean(isPreviewEnabled),
|
|
348
|
+
previewURL: previewURL,
|
|
349
|
+
typeofLivePreviewURL: typeof livePreviewConfig?.url,
|
|
350
|
+
url: livePreviewURL,
|
|
351
|
+
children: [showHeader && !drawerSlug && /*#__PURE__*/_jsx(DocumentHeader, {
|
|
352
|
+
AfterHeader: Description,
|
|
353
|
+
collectionConfig: collectionConfig,
|
|
354
|
+
globalConfig: globalConfig,
|
|
355
|
+
permissions: permissions,
|
|
356
|
+
req: req
|
|
357
|
+
}), /*#__PURE__*/_jsx(HydrateAuthProvider, {
|
|
358
|
+
permissions: permissions
|
|
359
|
+
}), /*#__PURE__*/_jsx(EditDepthProvider, {
|
|
360
|
+
children: RenderServerComponent({
|
|
361
|
+
clientProps,
|
|
362
|
+
Component: View,
|
|
363
|
+
importMap,
|
|
364
|
+
serverProps: documentViewServerProps
|
|
365
|
+
})
|
|
366
|
+
})]
|
|
367
|
+
})
|
|
368
|
+
}, locale?.code)
|
|
369
|
+
};
|
|
332
370
|
};
|
|
333
371
|
export async function DocumentView(props) {
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
}
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
372
|
+
try {
|
|
373
|
+
const {
|
|
374
|
+
Document: RenderedDocument
|
|
375
|
+
} = await renderDocument(props);
|
|
376
|
+
return RenderedDocument;
|
|
377
|
+
} catch (error) {
|
|
378
|
+
if (error?.message === 'NEXT_REDIRECT') {
|
|
379
|
+
throw error;
|
|
380
|
+
}
|
|
381
|
+
logError({
|
|
382
|
+
err: error,
|
|
383
|
+
payload: props.initPageResult.req.payload
|
|
384
|
+
});
|
|
385
|
+
if (error.message === 'not-found') {
|
|
386
|
+
notFound();
|
|
348
387
|
}
|
|
388
|
+
}
|
|
349
389
|
}
|
|
350
|
-
|
|
351
390
|
//# sourceMappingURL=index.js.map
|