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