@payloadcms/next 3.0.0-canary.c696728 → 3.0.0-canary.c96fa61
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/cjs/withPayload.cjs +156 -0
- package/dist/cjs/withPayload.cjs.map +1 -0
- package/dist/elements/DocumentHeader/Tabs/Tab/TabLink.d.ts.map +1 -1
- package/dist/elements/DocumentHeader/Tabs/Tab/TabLink.js +1 -0
- package/dist/elements/DocumentHeader/Tabs/Tab/TabLink.js.map +1 -1
- package/dist/elements/DocumentHeader/Tabs/Tab/index.d.ts +1 -1
- package/dist/elements/DocumentHeader/Tabs/Tab/index.d.ts.map +1 -1
- package/dist/elements/DocumentHeader/Tabs/Tab/index.js +13 -15
- package/dist/elements/DocumentHeader/Tabs/Tab/index.js.map +1 -1
- package/dist/elements/DocumentHeader/Tabs/Tab/index.scss +70 -68
- package/dist/elements/DocumentHeader/Tabs/index.d.ts.map +1 -1
- package/dist/elements/DocumentHeader/Tabs/index.js +9 -14
- package/dist/elements/DocumentHeader/Tabs/index.js.map +1 -1
- package/dist/elements/DocumentHeader/Tabs/index.scss +41 -39
- package/dist/elements/DocumentHeader/Tabs/tabs/VersionsPill/index.d.ts.map +1 -1
- package/dist/elements/DocumentHeader/Tabs/tabs/VersionsPill/index.js +13 -28
- package/dist/elements/DocumentHeader/Tabs/tabs/VersionsPill/index.js.map +1 -1
- package/dist/elements/DocumentHeader/index.d.ts +0 -1
- package/dist/elements/DocumentHeader/index.d.ts.map +1 -1
- package/dist/elements/DocumentHeader/index.js +9 -12
- package/dist/elements/DocumentHeader/index.js.map +1 -1
- package/dist/elements/DocumentHeader/index.scss +44 -42
- package/dist/elements/FormHeader/index.d.ts +9 -0
- package/dist/elements/FormHeader/index.d.ts.map +1 -0
- package/dist/elements/FormHeader/index.js +20 -0
- package/dist/elements/FormHeader/index.js.map +1 -0
- package/dist/elements/FormHeader/index.scss +8 -0
- package/dist/elements/Logo/index.d.ts.map +1 -1
- package/dist/elements/Logo/index.js +5 -6
- package/dist/elements/Logo/index.js.map +1 -1
- package/dist/elements/Nav/NavWrapper/index.scss +20 -18
- package/dist/elements/Nav/index.client.d.ts +4 -1
- package/dist/elements/Nav/index.client.d.ts.map +1 -1
- package/dist/elements/Nav/index.client.js +41 -95
- package/dist/elements/Nav/index.client.js.map +1 -1
- package/dist/elements/Nav/index.d.ts.map +1 -1
- package/dist/elements/Nav/index.js +60 -23
- package/dist/elements/Nav/index.js.map +1 -1
- package/dist/elements/Nav/index.scss +127 -125
- package/dist/exports/layouts.d.ts +1 -0
- package/dist/exports/layouts.d.ts.map +1 -1
- package/dist/exports/layouts.js +1 -0
- package/dist/exports/layouts.js.map +1 -1
- package/dist/exports/routes.d.ts +1 -1
- package/dist/exports/routes.d.ts.map +1 -1
- package/dist/exports/routes.js +1 -1
- package/dist/exports/routes.js.map +1 -1
- package/dist/exports/utilities.d.ts +1 -0
- package/dist/exports/utilities.d.ts.map +1 -1
- package/dist/exports/utilities.js +2 -0
- package/dist/exports/utilities.js.map +1 -1
- package/dist/exports/views.d.ts +0 -2
- package/dist/exports/views.d.ts.map +1 -1
- package/dist/exports/views.js +0 -2
- package/dist/exports/views.js.map +1 -1
- package/dist/fetchAPI-multipart/processMultipart.d.ts.map +1 -1
- package/dist/fetchAPI-multipart/processMultipart.js +9 -11
- package/dist/fetchAPI-multipart/processMultipart.js.map +1 -1
- package/dist/layouts/Root/NestProviders.d.ts +11 -0
- package/dist/layouts/Root/NestProviders.d.ts.map +1 -0
- package/dist/layouts/Root/NestProviders.js +21 -0
- package/dist/layouts/Root/NestProviders.js.map +1 -0
- package/dist/layouts/Root/index.d.ts +3 -2
- package/dist/layouts/Root/index.d.ts.map +1 -1
- package/dist/layouts/Root/index.js +20 -24
- package/dist/layouts/Root/index.js.map +1 -1
- package/dist/prod/styles.css +1 -1
- package/dist/routes/graphql/handler.d.ts.map +1 -1
- package/dist/routes/graphql/handler.js +23 -11
- package/dist/routes/graphql/handler.js.map +1 -1
- package/dist/routes/rest/auth/login.js +2 -2
- package/dist/routes/rest/auth/login.js.map +1 -1
- package/dist/routes/rest/auth/logout.d.ts.map +1 -1
- package/dist/routes/rest/auth/logout.js +3 -2
- package/dist/routes/rest/auth/logout.js.map +1 -1
- package/dist/routes/rest/auth/refresh.js +2 -2
- package/dist/routes/rest/auth/refresh.js.map +1 -1
- package/dist/routes/rest/auth/registerFirstUser.js +2 -2
- package/dist/routes/rest/auth/registerFirstUser.js.map +1 -1
- package/dist/routes/rest/auth/resetPassword.js +2 -2
- package/dist/routes/rest/auth/resetPassword.js.map +1 -1
- package/dist/routes/rest/collections/create.d.ts.map +1 -1
- package/dist/routes/rest/collections/create.js +5 -1
- package/dist/routes/rest/collections/create.js.map +1 -1
- package/dist/routes/rest/collections/delete.d.ts.map +1 -1
- package/dist/routes/rest/collections/delete.js +8 -0
- package/dist/routes/rest/collections/delete.js.map +1 -1
- package/dist/routes/rest/collections/deleteByID.d.ts.map +1 -1
- package/dist/routes/rest/collections/deleteByID.js +7 -1
- package/dist/routes/rest/collections/deleteByID.js.map +1 -1
- package/dist/routes/rest/collections/duplicate.d.ts.map +1 -1
- package/dist/routes/rest/collections/duplicate.js +5 -1
- package/dist/routes/rest/collections/duplicate.js.map +1 -1
- package/dist/routes/rest/collections/find.d.ts.map +1 -1
- package/dist/routes/rest/collections/find.js +7 -1
- package/dist/routes/rest/collections/find.js.map +1 -1
- package/dist/routes/rest/collections/findByID.d.ts.map +1 -1
- package/dist/routes/rest/collections/findByID.js +5 -1
- package/dist/routes/rest/collections/findByID.js.map +1 -1
- package/dist/routes/rest/collections/findVersionByID.d.ts.map +1 -1
- package/dist/routes/rest/collections/findVersionByID.js +5 -1
- package/dist/routes/rest/collections/findVersionByID.js.map +1 -1
- package/dist/routes/rest/collections/findVersions.d.ts.map +1 -1
- package/dist/routes/rest/collections/findVersions.js +7 -1
- package/dist/routes/rest/collections/findVersions.js.map +1 -1
- package/dist/routes/rest/collections/restoreVersion.d.ts.map +1 -1
- package/dist/routes/rest/collections/restoreVersion.js +2 -0
- package/dist/routes/rest/collections/restoreVersion.js.map +1 -1
- package/dist/routes/rest/collections/update.d.ts.map +1 -1
- package/dist/routes/rest/collections/update.js +10 -0
- package/dist/routes/rest/collections/update.js.map +1 -1
- package/dist/routes/rest/collections/updateByID.d.ts.map +1 -1
- package/dist/routes/rest/collections/updateByID.js +7 -1
- package/dist/routes/rest/collections/updateByID.js.map +1 -1
- package/dist/routes/rest/globals/findOne.d.ts.map +1 -1
- package/dist/routes/rest/globals/findOne.js +5 -1
- package/dist/routes/rest/globals/findOne.js.map +1 -1
- package/dist/routes/rest/globals/findVersionByID.d.ts.map +1 -1
- package/dist/routes/rest/globals/findVersionByID.js +5 -1
- package/dist/routes/rest/globals/findVersionByID.js.map +1 -1
- package/dist/routes/rest/globals/findVersions.d.ts.map +1 -1
- package/dist/routes/rest/globals/findVersions.js +7 -1
- package/dist/routes/rest/globals/findVersions.js.map +1 -1
- package/dist/routes/rest/globals/restoreVersion.d.ts.map +1 -1
- package/dist/routes/rest/globals/restoreVersion.js +2 -0
- package/dist/routes/rest/globals/restoreVersion.js.map +1 -1
- package/dist/routes/rest/globals/update.d.ts.map +1 -1
- package/dist/routes/rest/globals/update.js +5 -1
- package/dist/routes/rest/globals/update.js.map +1 -1
- package/dist/routes/rest/index.d.ts +17 -12
- package/dist/routes/rest/index.d.ts.map +1 -1
- package/dist/routes/rest/index.js +90 -25
- package/dist/routes/rest/index.js.map +1 -1
- package/dist/routes/rest/og/image.d.ts +4 -2
- package/dist/routes/rest/og/image.d.ts.map +1 -1
- package/dist/routes/rest/og/image.js +7 -3
- package/dist/routes/rest/og/image.js.map +1 -1
- package/dist/routes/rest/og/index.d.ts.map +1 -1
- package/dist/routes/rest/og/index.js +7 -12
- package/dist/routes/rest/og/index.js.map +1 -1
- package/dist/routes/rest/routeError.d.ts +2 -7
- package/dist/routes/rest/routeError.d.ts.map +1 -1
- package/dist/routes/rest/routeError.js +34 -66
- package/dist/routes/rest/routeError.js.map +1 -1
- package/dist/routes/rest/utilities/sanitizeJoinParams.d.ts +1 -1
- package/dist/routes/rest/utilities/sanitizeJoinParams.d.ts.map +1 -1
- package/dist/routes/rest/utilities/sanitizeJoinParams.js +9 -5
- package/dist/routes/rest/utilities/sanitizeJoinParams.js.map +1 -1
- package/dist/routes/rest/utilities/sanitizePopulate.d.ts +3 -0
- package/dist/routes/rest/utilities/sanitizePopulate.d.ts.map +1 -0
- package/dist/routes/rest/utilities/sanitizePopulate.js +11 -0
- package/dist/routes/rest/utilities/sanitizePopulate.js.map +1 -0
- package/dist/routes/rest/utilities/sanitizeSelect.d.ts +6 -0
- package/dist/routes/rest/utilities/sanitizeSelect.d.ts.map +1 -0
- package/dist/routes/rest/utilities/sanitizeSelect.js +17 -0
- package/dist/routes/rest/utilities/sanitizeSelect.js.map +1 -0
- package/dist/scss/app.scss +166 -162
- package/dist/scss/colors.scss +256 -254
- package/dist/scss/resets.scss +9 -7
- package/dist/scss/toastify.scss +42 -40
- package/dist/scss/toasts.scss +105 -103
- package/dist/scss/type.scss +80 -79
- package/dist/templates/Default/Wrapper/index.scss +38 -36
- package/dist/templates/Default/index.d.ts +2 -1
- package/dist/templates/Default/index.d.ts.map +1 -1
- package/dist/templates/Default/index.js +97 -41
- package/dist/templates/Default/index.js.map +1 -1
- package/dist/templates/Default/index.scss +60 -58
- package/dist/templates/Minimal/index.scss +22 -20
- package/dist/utilities/getClientConfig.d.ts +7 -0
- package/dist/utilities/getClientConfig.d.ts.map +1 -0
- package/dist/utilities/getClientConfig.js +14 -0
- package/dist/utilities/getClientConfig.js.map +1 -0
- package/dist/utilities/getNextRequestI18n.js +2 -2
- package/dist/utilities/getNextRequestI18n.js.map +1 -1
- package/dist/utilities/getRequestTheme.d.ts.map +1 -1
- package/dist/utilities/getRequestTheme.js +3 -0
- package/dist/utilities/getRequestTheme.js.map +1 -1
- package/dist/utilities/handleServerFunctions.d.ts +3 -0
- package/dist/utilities/handleServerFunctions.d.ts.map +1 -0
- package/dist/utilities/handleServerFunctions.js +35 -0
- package/dist/utilities/handleServerFunctions.js.map +1 -0
- package/dist/utilities/initPage/handleAdminPage.d.ts +13 -11
- package/dist/utilities/initPage/handleAdminPage.d.ts.map +1 -1
- package/dist/utilities/initPage/handleAdminPage.js +16 -20
- package/dist/utilities/initPage/handleAdminPage.js.map +1 -1
- package/dist/utilities/initPage/handleAuthRedirect.d.ts +6 -3
- package/dist/utilities/initPage/handleAuthRedirect.d.ts.map +1 -1
- package/dist/utilities/initPage/handleAuthRedirect.js +23 -36
- package/dist/utilities/initPage/handleAuthRedirect.js.map +1 -1
- package/dist/utilities/initPage/index.d.ts +1 -1
- package/dist/utilities/initPage/index.d.ts.map +1 -1
- package/dist/utilities/initPage/index.js +29 -11
- package/dist/utilities/initPage/index.js.map +1 -1
- package/dist/utilities/initPage/isCustomAdminView.d.ts +10 -0
- package/dist/utilities/initPage/isCustomAdminView.d.ts.map +1 -0
- package/dist/utilities/initPage/isCustomAdminView.js +31 -0
- package/dist/utilities/initPage/isCustomAdminView.js.map +1 -0
- package/dist/utilities/initPage/shared.d.ts +2 -2
- package/dist/utilities/initPage/shared.d.ts.map +1 -1
- package/dist/utilities/initPage/shared.js +19 -13
- package/dist/utilities/initPage/shared.js.map +1 -1
- package/dist/utilities/initReq.d.ts +1 -1
- package/dist/utilities/initReq.d.ts.map +1 -1
- package/dist/utilities/initReq.js +4 -3
- package/dist/utilities/initReq.js.map +1 -1
- package/dist/views/API/LocaleSelector/index.d.ts.map +1 -1
- package/dist/views/API/LocaleSelector/index.js +0 -1
- package/dist/views/API/LocaleSelector/index.js.map +1 -1
- package/dist/views/API/RenderJSON/index.scss +68 -66
- package/dist/views/API/index.client.d.ts.map +1 -1
- package/dist/views/API/index.client.js +10 -13
- package/dist/views/API/index.client.js.map +1 -1
- package/dist/views/API/index.scss +98 -96
- package/dist/views/Account/Settings/index.d.ts +2 -1
- package/dist/views/Account/Settings/index.d.ts.map +1 -1
- package/dist/views/Account/Settings/index.js +3 -3
- package/dist/views/Account/Settings/index.js.map +1 -1
- package/dist/views/Account/Settings/index.scss +37 -35
- package/dist/views/Account/ToggleTheme/index.d.ts.map +1 -1
- package/dist/views/Account/ToggleTheme/index.js +1 -0
- package/dist/views/Account/ToggleTheme/index.js.map +1 -1
- package/dist/views/Account/index.d.ts.map +1 -1
- package/dist/views/Account/index.js +87 -27
- package/dist/views/Account/index.js.map +1 -1
- package/dist/views/CreateFirstUser/index.client.d.ts +3 -1
- package/dist/views/CreateFirstUser/index.client.d.ts.map +1 -1
- package/dist/views/CreateFirstUser/index.client.js +56 -33
- package/dist/views/CreateFirstUser/index.client.js.map +1 -1
- package/dist/views/CreateFirstUser/index.d.ts.map +1 -1
- package/dist/views/CreateFirstUser/index.js +36 -4
- package/dist/views/CreateFirstUser/index.js.map +1 -1
- package/dist/views/CreateFirstUser/index.scss +13 -11
- package/dist/views/Dashboard/Default/index.d.ts +3 -1
- package/dist/views/Dashboard/Default/index.d.ts.map +1 -1
- package/dist/views/Dashboard/Default/index.js +58 -47
- package/dist/views/Dashboard/Default/index.js.map +1 -1
- package/dist/views/Dashboard/Default/index.scss +51 -49
- package/dist/views/Dashboard/index.d.ts.map +1 -1
- package/dist/views/Dashboard/index.js +53 -34
- package/dist/views/Dashboard/index.js.map +1 -1
- package/dist/views/Document/getDocPreferences.d.ts +11 -0
- package/dist/views/Document/getDocPreferences.d.ts.map +1 -0
- package/dist/views/Document/getDocPreferences.js +44 -0
- package/dist/views/Document/getDocPreferences.js.map +1 -0
- package/dist/views/Document/getDocumentData.d.ts +10 -11
- package/dist/views/Document/getDocumentData.d.ts.map +1 -1
- package/dist/views/Document/getDocumentData.js +35 -45
- package/dist/views/Document/getDocumentData.js.map +1 -1
- package/dist/views/Document/getDocumentPermissions.d.ts.map +1 -1
- package/dist/views/Document/getDocumentPermissions.js +6 -5
- package/dist/views/Document/getDocumentPermissions.js.map +1 -1
- package/dist/views/Document/getIsLocked.d.ts +17 -0
- package/dist/views/Document/getIsLocked.d.ts.map +1 -0
- package/dist/views/Document/getIsLocked.js +54 -0
- package/dist/views/Document/getIsLocked.js.map +1 -0
- package/dist/views/Document/getVersions.d.ts +19 -0
- package/dist/views/Document/getVersions.d.ts.map +1 -0
- package/dist/views/Document/getVersions.js +181 -0
- package/dist/views/Document/getVersions.js.map +1 -0
- package/dist/views/Document/getViewsFromConfig.d.ts +1 -1
- package/dist/views/Document/getViewsFromConfig.d.ts.map +1 -1
- package/dist/views/Document/getViewsFromConfig.js +22 -17
- package/dist/views/Document/getViewsFromConfig.js.map +1 -1
- package/dist/views/Document/handleServerFunction.d.ts +24 -0
- package/dist/views/Document/handleServerFunction.d.ts.map +1 -0
- package/dist/views/Document/handleServerFunction.js +156 -0
- package/dist/views/Document/handleServerFunction.js.map +1 -0
- package/dist/views/Document/index.d.ts +5 -1
- package/dist/views/Document/index.d.ts.map +1 -1
- package/dist/views/Document/index.js +182 -72
- package/dist/views/Document/index.js.map +1 -1
- package/dist/views/Document/renderDocumentSlots.d.ts +12 -0
- package/dist/views/Document/renderDocumentSlots.d.ts.map +1 -0
- package/dist/views/Document/renderDocumentSlots.js +92 -0
- package/dist/views/Document/renderDocumentSlots.js.map +1 -0
- package/dist/views/Edit/index.d.ts +3 -2
- package/dist/views/Edit/index.d.ts.map +1 -1
- package/dist/views/Edit/index.js +7 -3
- package/dist/views/Edit/index.js.map +1 -1
- package/dist/views/ForgotPassword/ForgotPasswordForm/index.d.ts.map +1 -1
- package/dist/views/ForgotPassword/ForgotPasswordForm/index.js +12 -12
- package/dist/views/ForgotPassword/ForgotPasswordForm/index.js.map +1 -1
- package/dist/views/ForgotPassword/index.d.ts.map +1 -1
- package/dist/views/ForgotPassword/index.js +10 -8
- package/dist/views/ForgotPassword/index.js.map +1 -1
- package/dist/views/List/handleServerFunction.d.ts +26 -0
- package/dist/views/List/handleServerFunction.d.ts.map +1 -0
- package/dist/views/List/handleServerFunction.js +155 -0
- package/dist/views/List/handleServerFunction.js.map +1 -0
- package/dist/views/List/index.d.ts +12 -2
- package/dist/views/List/index.d.ts.map +1 -1
- package/dist/views/List/index.js +122 -82
- package/dist/views/List/index.js.map +1 -1
- package/dist/views/List/renderListViewSlots.d.ts +8 -0
- package/dist/views/List/renderListViewSlots.d.ts.map +1 -0
- package/dist/views/List/renderListViewSlots.js +44 -0
- package/dist/views/List/renderListViewSlots.js.map +1 -0
- package/dist/views/LivePreview/IFrame/index.scss +8 -6
- package/dist/views/LivePreview/Preview/index.scss +32 -30
- package/dist/views/LivePreview/Toolbar/Controls/index.scss +49 -47
- package/dist/views/LivePreview/Toolbar/SizeInput/index.scss +11 -9
- package/dist/views/LivePreview/Toolbar/index.scss +33 -31
- package/dist/views/LivePreview/ToolbarArea/index.scss +5 -3
- package/dist/views/LivePreview/index.client.d.ts.map +1 -1
- package/dist/views/LivePreview/index.client.js +239 -210
- package/dist/views/LivePreview/index.client.js.map +1 -1
- package/dist/views/LivePreview/index.scss +48 -46
- package/dist/views/Login/LoginField/index.d.ts.map +1 -1
- package/dist/views/Login/LoginField/index.js +3 -1
- package/dist/views/Login/LoginField/index.js.map +1 -1
- package/dist/views/Login/LoginForm/index.d.ts.map +1 -1
- package/dist/views/Login/LoginForm/index.js +2 -1
- package/dist/views/Login/LoginForm/index.js.map +1 -1
- package/dist/views/Login/LoginForm/index.scss +8 -6
- package/dist/views/Login/index.d.ts.map +1 -1
- package/dist/views/Login/index.js +26 -20
- package/dist/views/Login/index.js.map +1 -1
- package/dist/views/Login/index.scss +8 -6
- package/dist/views/Logout/LogoutClient.d.ts.map +1 -1
- package/dist/views/Logout/LogoutClient.js +79 -56
- package/dist/views/Logout/LogoutClient.js.map +1 -1
- package/dist/views/Logout/index.scss +17 -15
- package/dist/views/NotFound/index.d.ts +5 -5
- package/dist/views/NotFound/index.d.ts.map +1 -1
- package/dist/views/NotFound/index.js +7 -2
- package/dist/views/NotFound/index.js.map +1 -1
- package/dist/views/NotFound/index.scss +38 -36
- package/dist/views/ResetPassword/ResetPasswordForm/index.d.ts +7 -0
- package/dist/views/ResetPassword/ResetPasswordForm/index.d.ts.map +1 -0
- package/dist/views/ResetPassword/{index.client.js → ResetPasswordForm/index.js} +27 -16
- package/dist/views/ResetPassword/ResetPasswordForm/index.js.map +1 -0
- package/dist/views/ResetPassword/index.d.ts.map +1 -1
- package/dist/views/ResetPassword/index.js +19 -10
- package/dist/views/ResetPassword/index.js.map +1 -1
- package/dist/views/ResetPassword/index.scss +6 -26
- package/dist/views/Root/getViewFromConfig.d.ts +3 -1
- package/dist/views/Root/getViewFromConfig.d.ts.map +1 -1
- package/dist/views/Root/getViewFromConfig.js +129 -14
- package/dist/views/Root/getViewFromConfig.js.map +1 -1
- package/dist/views/Root/index.d.ts +5 -5
- package/dist/views/Root/index.d.ts.map +1 -1
- package/dist/views/Root/index.js +43 -19
- package/dist/views/Root/index.js.map +1 -1
- package/dist/views/Root/meta.d.ts +5 -5
- package/dist/views/Root/meta.d.ts.map +1 -1
- package/dist/views/Root/meta.js +3 -2
- package/dist/views/Root/meta.js.map +1 -1
- package/dist/views/Unauthorized/index.d.ts.map +1 -1
- package/dist/views/Unauthorized/index.js +14 -7
- package/dist/views/Unauthorized/index.js.map +1 -1
- package/dist/views/Unauthorized/index.scss +4 -31
- package/dist/views/Verify/index.client.d.ts +7 -0
- package/dist/views/Verify/index.client.d.ts.map +1 -0
- package/dist/views/Verify/index.client.js +46 -0
- package/dist/views/Verify/index.client.js.map +1 -0
- package/dist/views/Verify/index.d.ts.map +1 -1
- package/dist/views/Verify/index.js +12 -11
- package/dist/views/Verify/index.js.map +1 -1
- package/dist/views/Verify/index.scss +13 -11
- package/dist/views/Version/Default/index.d.ts.map +1 -1
- package/dist/views/Version/Default/index.js +2 -4
- package/dist/views/Version/Default/index.js.map +1 -1
- package/dist/views/Version/Default/index.scss +52 -50
- package/dist/views/Version/RenderFieldsToDiff/Label/index.scss +5 -3
- package/dist/views/Version/RenderFieldsToDiff/fields/Iterable/index.scss +29 -27
- package/dist/views/Version/RenderFieldsToDiff/fields/Nested/index.scss +11 -9
- package/dist/views/Version/RenderFieldsToDiff/fields/Relationship/index.scss +12 -10
- package/dist/views/Version/RenderFieldsToDiff/fields/Select/index.scss +12 -10
- package/dist/views/Version/RenderFieldsToDiff/fields/Text/index.scss +12 -10
- package/dist/views/Version/RenderFieldsToDiff/index.scss +12 -10
- package/dist/views/Version/Restore/index.js +1 -1
- package/dist/views/Version/Restore/index.js.map +1 -1
- package/dist/views/Version/Restore/index.scss +57 -55
- package/dist/views/Version/SelectComparison/index.scss +12 -10
- package/dist/views/Version/SelectLocales/index.scss +6 -4
- package/dist/views/Version/index.d.ts.map +1 -1
- package/dist/views/Version/index.js +2 -0
- package/dist/views/Version/index.js.map +1 -1
- package/dist/views/Versions/buildColumns.d.ts +3 -2
- package/dist/views/Versions/buildColumns.d.ts.map +1 -1
- package/dist/views/Versions/buildColumns.js +33 -61
- package/dist/views/Versions/buildColumns.js.map +1 -1
- package/dist/views/Versions/cells/AutosaveCell/index.d.ts +7 -0
- package/dist/views/Versions/cells/AutosaveCell/index.d.ts.map +1 -1
- package/dist/views/Versions/cells/AutosaveCell/index.js +48 -37
- package/dist/views/Versions/cells/AutosaveCell/index.js.map +1 -1
- package/dist/views/Versions/cells/CreatedAt/index.d.ts +4 -0
- package/dist/views/Versions/cells/CreatedAt/index.d.ts.map +1 -1
- package/dist/views/Versions/cells/CreatedAt/index.js +43 -44
- package/dist/views/Versions/cells/CreatedAt/index.js.map +1 -1
- package/dist/views/Versions/cells/ID/index.d.ts +3 -1
- package/dist/views/Versions/cells/ID/index.d.ts.map +1 -1
- package/dist/views/Versions/cells/ID/index.js +7 -19
- package/dist/views/Versions/cells/ID/index.js.map +1 -1
- package/dist/views/Versions/getLatestVersion.d.ts +1 -0
- package/dist/views/Versions/getLatestVersion.d.ts.map +1 -1
- package/dist/views/Versions/getLatestVersion.js +15 -4
- package/dist/views/Versions/getLatestVersion.js.map +1 -1
- package/dist/views/Versions/index.client.d.ts.map +1 -1
- package/dist/views/Versions/index.client.js +53 -51
- package/dist/views/Versions/index.client.js.map +1 -1
- package/dist/views/Versions/index.d.ts.map +1 -1
- package/dist/views/Versions/index.js +7 -6
- package/dist/views/Versions/index.js.map +1 -1
- package/dist/views/Versions/index.scss +78 -76
- package/dist/withPayload.d.ts.map +1 -1
- package/dist/withPayload.js +9 -1
- package/dist/withPayload.js.map +1 -1
- package/package.json +10 -10
- package/dist/cjs/withPayload.js +0 -111
- package/dist/cjs/withPayload.js.map +0 -1
- package/dist/elements/DocumentLocked/index.d.ts +0 -12
- package/dist/elements/DocumentLocked/index.d.ts.map +0 -1
- package/dist/elements/DocumentLocked/index.js +0 -142
- package/dist/elements/DocumentLocked/index.js.map +0 -1
- package/dist/elements/DocumentLocked/index.scss +0 -37
- package/dist/elements/DocumentTakeOver/index.d.ts +0 -8
- package/dist/elements/DocumentTakeOver/index.d.ts.map +0 -1
- package/dist/elements/DocumentTakeOver/index.js +0 -98
- package/dist/elements/DocumentTakeOver/index.js.map +0 -1
- package/dist/elements/DocumentTakeOver/index.scss +0 -37
- package/dist/elements/EmailAndUsername/index.d.ts +0 -14
- package/dist/elements/EmailAndUsername/index.d.ts.map +0 -1
- package/dist/elements/EmailAndUsername/index.js +0 -121
- package/dist/elements/EmailAndUsername/index.js.map +0 -1
- package/dist/elements/LeaveWithoutSaving/index.d.ts +0 -4
- package/dist/elements/LeaveWithoutSaving/index.d.ts.map +0 -1
- package/dist/elements/LeaveWithoutSaving/index.js +0 -162
- package/dist/elements/LeaveWithoutSaving/index.js.map +0 -1
- package/dist/elements/LeaveWithoutSaving/index.scss +0 -37
- package/dist/elements/LeaveWithoutSaving/usePreventLeave.d.ts +0 -9
- package/dist/elements/LeaveWithoutSaving/usePreventLeave.d.ts.map +0 -1
- package/dist/elements/LeaveWithoutSaving/usePreventLeave.js +0 -136
- package/dist/elements/LeaveWithoutSaving/usePreventLeave.js.map +0 -1
- package/dist/routes/rest/buildFormState.d.ts +0 -5
- package/dist/routes/rest/buildFormState.d.ts.map +0 -1
- package/dist/routes/rest/buildFormState.js +0 -46
- package/dist/routes/rest/buildFormState.js.map +0 -1
- package/dist/views/Edit/Default/Auth/APIKey.d.ts +0 -6
- package/dist/views/Edit/Default/Auth/APIKey.d.ts.map +0 -1
- package/dist/views/Edit/Default/Auth/APIKey.js +0 -131
- package/dist/views/Edit/Default/Auth/APIKey.js.map +0 -1
- package/dist/views/Edit/Default/Auth/index.d.ts +0 -5
- package/dist/views/Edit/Default/Auth/index.d.ts.map +0 -1
- package/dist/views/Edit/Default/Auth/index.js +0 -307
- package/dist/views/Edit/Default/Auth/index.js.map +0 -1
- package/dist/views/Edit/Default/Auth/index.scss +0 -76
- package/dist/views/Edit/Default/Auth/types.d.ts +0 -17
- package/dist/views/Edit/Default/Auth/types.d.ts.map +0 -1
- package/dist/views/Edit/Default/Auth/types.js +0 -2
- package/dist/views/Edit/Default/Auth/types.js.map +0 -1
- package/dist/views/Edit/Default/SetDocumentStepNav/index.d.ts +0 -11
- package/dist/views/Edit/Default/SetDocumentStepNav/index.d.ts.map +0 -1
- package/dist/views/Edit/Default/SetDocumentStepNav/index.js +0 -130
- package/dist/views/Edit/Default/SetDocumentStepNav/index.js.map +0 -1
- package/dist/views/Edit/Default/SetDocumentTitle/index.d.ts +0 -8
- package/dist/views/Edit/Default/SetDocumentTitle/index.d.ts.map +0 -1
- package/dist/views/Edit/Default/SetDocumentTitle/index.js +0 -81
- package/dist/views/Edit/Default/SetDocumentTitle/index.js.map +0 -1
- package/dist/views/Edit/Default/index.d.ts +0 -4
- package/dist/views/Edit/Default/index.d.ts.map +0 -1
- package/dist/views/Edit/Default/index.js +0 -377
- package/dist/views/Edit/Default/index.js.map +0 -1
- package/dist/views/Edit/Default/index.scss +0 -21
- package/dist/views/Edit/Default/types.d.ts +0 -6
- package/dist/views/Edit/Default/types.d.ts.map +0 -1
- package/dist/views/Edit/Default/types.js +0 -2
- package/dist/views/Edit/Default/types.js.map +0 -1
- package/dist/views/Edit/index.client.d.ts +0 -3
- package/dist/views/Edit/index.client.d.ts.map +0 -1
- package/dist/views/Edit/index.client.js +0 -54
- package/dist/views/Edit/index.client.js.map +0 -1
- package/dist/views/List/Default/index.d.ts +0 -4
- package/dist/views/List/Default/index.d.ts.map +0 -1
- package/dist/views/List/Default/index.js +0 -387
- package/dist/views/List/Default/index.js.map +0 -1
- package/dist/views/List/Default/index.scss +0 -177
- package/dist/views/List/Default/types.d.ts +0 -15
- package/dist/views/List/Default/types.d.ts.map +0 -1
- package/dist/views/List/Default/types.js +0 -2
- package/dist/views/List/Default/types.js.map +0 -1
- package/dist/views/ResetPassword/index.client.d.ts +0 -7
- package/dist/views/ResetPassword/index.client.d.ts.map +0 -1
- package/dist/views/ResetPassword/index.client.js.map +0 -1
|
@@ -1,41 +1,43 @@
|
|
|
1
1
|
@import '../../../scss/styles.scss';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
3
|
+
@layer payload-default {
|
|
4
|
+
.live-preview-toolbar {
|
|
5
|
+
display: flex;
|
|
6
|
+
background-color: var(--theme-bg);
|
|
7
|
+
color: var(--theme-text);
|
|
8
|
+
height: calc(var(--base) * 1.75);
|
|
9
|
+
align-items: center;
|
|
10
|
+
flex-shrink: 0;
|
|
10
11
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
12
|
+
&--static {
|
|
13
|
+
position: relative;
|
|
14
|
+
width: 100%;
|
|
15
|
+
justify-content: center;
|
|
16
|
+
border-bottom: 1px solid var(--theme-elevation-100);
|
|
17
|
+
}
|
|
17
18
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
19
|
+
&--draggable {
|
|
20
|
+
@include shadow-lg;
|
|
21
|
+
position: absolute;
|
|
22
|
+
top: 0;
|
|
23
|
+
left: 0;
|
|
24
|
+
margin: 0;
|
|
25
|
+
border-radius: 4px;
|
|
26
|
+
}
|
|
26
27
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
28
|
+
&__drag-handle {
|
|
29
|
+
background: transparent;
|
|
30
|
+
border: 0;
|
|
31
|
+
padding: 0;
|
|
32
|
+
cursor: grab;
|
|
32
33
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
34
|
+
.icon--drag-handle .fill {
|
|
35
|
+
fill: var(--theme-elevation-300);
|
|
36
|
+
}
|
|
36
37
|
|
|
37
|
-
|
|
38
|
-
|
|
38
|
+
&:active {
|
|
39
|
+
cursor: grabbing;
|
|
40
|
+
}
|
|
39
41
|
}
|
|
40
42
|
}
|
|
41
43
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.client.d.ts","sourceRoot":"","sources":["../../../src/views/LivePreview/index.client.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"index.client.d.ts","sourceRoot":"","sources":["../../../src/views/LivePreview/index.client.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAMV,IAAI,EACJ,iBAAiB,EAClB,MAAM,SAAS,CAAA;AAsBhB,OAAO,KAA6D,MAAM,OAAO,CAAA;AAIjF,OAAO,cAAc,CAAA;AAoarB,eAAO,MAAM,iBAAiB,EAAE,KAAK,CAAC,EAAE,CAAC;IACvC,QAAQ,CAAC,WAAW,EAAE,iBAAiB,CAAC,aAAa,CAAC,CAAA;IACtD,QAAQ,CAAC,WAAW,EAAE,IAAI,CAAA;IAC1B,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;CACrB,CA8CA,CAAA"}
|
|
@@ -2,40 +2,35 @@
|
|
|
2
2
|
|
|
3
3
|
import { c as _c } from "react/compiler-runtime";
|
|
4
4
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
5
|
-
import { DocumentControls, DocumentFields, Form, OperationProvider,
|
|
6
|
-
import {
|
|
7
|
-
import
|
|
8
|
-
import {
|
|
9
|
-
import { SetDocumentStepNav } from '../Edit/Default/SetDocumentStepNav/index.js';
|
|
10
|
-
import { SetDocumentTitle } from '../Edit/Default/SetDocumentTitle/index.js';
|
|
5
|
+
import { DocumentControls, DocumentFields, DocumentLocked, DocumentTakeOver, Form, LeaveWithoutSaving, OperationProvider, SetDocumentStepNav, SetDocumentTitle, useAuth, useConfig, useDocumentDrawerContext, useDocumentEvents, useDocumentInfo, useServerFunctions, useTranslation } from '@payloadcms/ui';
|
|
6
|
+
import { handleBackToDashboard, handleGoBack, handleTakeOver } from '@payloadcms/ui/shared';
|
|
7
|
+
import { useRouter } from 'next/navigation.js';
|
|
8
|
+
import React, { Fragment, useCallback, useEffect, useRef, useState } from 'react';
|
|
11
9
|
import { useLivePreviewContext } from './Context/context.js';
|
|
12
10
|
import { LivePreviewProvider } from './Context/index.js';
|
|
13
11
|
import { LivePreview } from './Preview/index.js';
|
|
14
12
|
import { usePopupWindow } from './usePopupWindow.js';
|
|
15
13
|
const baseClass = 'live-preview';
|
|
16
|
-
const PreviewView =
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
globalConfig,
|
|
24
|
-
schemaPath,
|
|
25
|
-
serverURL
|
|
26
|
-
} = t0;
|
|
14
|
+
const PreviewView = ({
|
|
15
|
+
collectionConfig,
|
|
16
|
+
config,
|
|
17
|
+
fields,
|
|
18
|
+
globalConfig,
|
|
19
|
+
schemaPath
|
|
20
|
+
}) => {
|
|
27
21
|
const {
|
|
28
22
|
id,
|
|
29
23
|
action,
|
|
30
24
|
AfterDocument,
|
|
31
25
|
AfterFields,
|
|
32
26
|
apiURL,
|
|
33
|
-
BeforeDocument,
|
|
34
27
|
BeforeFields,
|
|
35
28
|
collectionSlug,
|
|
29
|
+
currentEditor,
|
|
36
30
|
disableActions,
|
|
37
31
|
disableLeaveWithoutSaving,
|
|
38
32
|
docPermissions,
|
|
33
|
+
documentIsLocked,
|
|
39
34
|
getDocPreferences,
|
|
40
35
|
globalSlug,
|
|
41
36
|
hasPublishPermission,
|
|
@@ -44,18 +39,30 @@ const PreviewView = t0 => {
|
|
|
44
39
|
initialState,
|
|
45
40
|
isEditing,
|
|
46
41
|
isInitializing,
|
|
47
|
-
|
|
42
|
+
lastUpdateTime,
|
|
43
|
+
setCurrentEditor,
|
|
44
|
+
setDocumentIsLocked,
|
|
45
|
+
unlockDocument,
|
|
46
|
+
updateDocumentEditor
|
|
48
47
|
} = useDocumentInfo();
|
|
49
|
-
const operation = id ? "update" : "create";
|
|
50
48
|
const {
|
|
51
|
-
|
|
52
|
-
} =
|
|
49
|
+
getFormState
|
|
50
|
+
} = useServerFunctions();
|
|
53
51
|
const {
|
|
54
|
-
|
|
55
|
-
} =
|
|
52
|
+
onSave: onSaveFromProps
|
|
53
|
+
} = useDocumentDrawerContext();
|
|
54
|
+
const operation = id ? 'update' : 'create';
|
|
56
55
|
const {
|
|
57
|
-
|
|
58
|
-
|
|
56
|
+
config: {
|
|
57
|
+
admin: {
|
|
58
|
+
user: userSlug
|
|
59
|
+
},
|
|
60
|
+
routes: {
|
|
61
|
+
admin: adminRoute
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
} = useConfig();
|
|
65
|
+
const router = useRouter();
|
|
59
66
|
const {
|
|
60
67
|
t
|
|
61
68
|
} = useTranslation();
|
|
@@ -69,193 +76,217 @@ const PreviewView = t0 => {
|
|
|
69
76
|
const {
|
|
70
77
|
reportUpdate
|
|
71
78
|
} = useDocumentEvents();
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
+
const docConfig = collectionConfig || globalConfig;
|
|
80
|
+
const lockDocumentsProp = docConfig?.lockDocuments !== undefined ? docConfig?.lockDocuments : true;
|
|
81
|
+
const isLockingEnabled = lockDocumentsProp !== false;
|
|
82
|
+
const lockDurationDefault = 300 // Default 5 minutes in seconds
|
|
83
|
+
;
|
|
84
|
+
const lockDuration = typeof lockDocumentsProp === 'object' ? lockDocumentsProp.duration : lockDurationDefault;
|
|
85
|
+
const lockDurationInMilliseconds = lockDuration * 1000;
|
|
86
|
+
const [isReadOnlyForIncomingUser, setIsReadOnlyForIncomingUser] = useState(false);
|
|
87
|
+
const [showTakeOverModal, setShowTakeOverModal] = useState(false);
|
|
88
|
+
const abortControllerRef = useRef(new AbortController());
|
|
89
|
+
const [editSessionStartTime, setEditSessionStartTime] = useState(Date.now());
|
|
90
|
+
const lockExpiryTime = lastUpdateTime + lockDurationInMilliseconds;
|
|
91
|
+
const isLockExpired = Date.now() > lockExpiryTime;
|
|
92
|
+
const documentLockStateRef = useRef({
|
|
93
|
+
hasShownLockedModal: false,
|
|
94
|
+
isLocked: false,
|
|
95
|
+
user: null
|
|
96
|
+
});
|
|
97
|
+
const onSave = useCallback(json => {
|
|
98
|
+
reportUpdate({
|
|
99
|
+
id,
|
|
100
|
+
entitySlug: collectionSlug,
|
|
101
|
+
updatedAt: json?.result?.updatedAt || new Date().toISOString()
|
|
102
|
+
});
|
|
103
|
+
// If we're editing the doc of the logged-in user,
|
|
104
|
+
// Refresh the cookie to get new permissions
|
|
105
|
+
if (user && collectionSlug === userSlug && id === user.id) {
|
|
106
|
+
void refreshCookieAsync();
|
|
107
|
+
}
|
|
108
|
+
// Unlock the document after save
|
|
109
|
+
if ((id || globalSlug) && isLockingEnabled) {
|
|
110
|
+
setDocumentIsLocked(false);
|
|
111
|
+
}
|
|
112
|
+
if (typeof onSaveFromProps === 'function') {
|
|
113
|
+
void onSaveFromProps({
|
|
114
|
+
...json,
|
|
115
|
+
operation: id ? 'update' : 'create'
|
|
79
116
|
});
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
117
|
+
}
|
|
118
|
+
}, [collectionSlug, globalSlug, id, isLockingEnabled, onSaveFromProps, refreshCookieAsync, reportUpdate, setDocumentIsLocked, user, userSlug]);
|
|
119
|
+
const onChange = useCallback(async ({
|
|
120
|
+
formState: prevFormState
|
|
121
|
+
}) => {
|
|
122
|
+
if (abortControllerRef.current) {
|
|
123
|
+
try {
|
|
124
|
+
abortControllerRef.current.abort();
|
|
125
|
+
} catch (_err) {
|
|
126
|
+
// swallow error
|
|
88
127
|
}
|
|
89
|
-
};
|
|
90
|
-
$[0] = reportUpdate;
|
|
91
|
-
$[1] = id;
|
|
92
|
-
$[2] = collectionSlug;
|
|
93
|
-
$[3] = user;
|
|
94
|
-
$[4] = userSlug;
|
|
95
|
-
$[5] = refreshCookieAsync;
|
|
96
|
-
$[6] = onSaveFromProps;
|
|
97
|
-
$[7] = t3;
|
|
98
|
-
} else {
|
|
99
|
-
t3 = $[7];
|
|
100
|
-
}
|
|
101
|
-
const onSave = t3;
|
|
102
|
-
let t4;
|
|
103
|
-
if ($[8] !== getDocPreferences || $[9] !== apiRoute || $[10] !== id || $[11] !== operation || $[12] !== schemaPath || $[13] !== serverURL) {
|
|
104
|
-
t4 = async t5 => {
|
|
105
|
-
const {
|
|
106
|
-
formState: prevFormState
|
|
107
|
-
} = t5;
|
|
108
|
-
const docPreferences = await getDocPreferences();
|
|
109
|
-
const {
|
|
110
|
-
state
|
|
111
|
-
} = await getFormState({
|
|
112
|
-
apiRoute,
|
|
113
|
-
body: {
|
|
114
|
-
id,
|
|
115
|
-
docPreferences,
|
|
116
|
-
formState: prevFormState,
|
|
117
|
-
operation,
|
|
118
|
-
schemaPath
|
|
119
|
-
},
|
|
120
|
-
serverURL
|
|
121
|
-
});
|
|
122
|
-
return state;
|
|
123
|
-
};
|
|
124
|
-
$[8] = getDocPreferences;
|
|
125
|
-
$[9] = apiRoute;
|
|
126
|
-
$[10] = id;
|
|
127
|
-
$[11] = operation;
|
|
128
|
-
$[12] = schemaPath;
|
|
129
|
-
$[13] = serverURL;
|
|
130
|
-
$[14] = t4;
|
|
131
|
-
} else {
|
|
132
|
-
t4 = $[14];
|
|
133
|
-
}
|
|
134
|
-
const onChange = t4;
|
|
135
|
-
const t5 = !hasSavePermission;
|
|
136
|
-
const t6 = id ? "PATCH" : "POST";
|
|
137
|
-
let t7;
|
|
138
|
-
if ($[15] !== onChange || $[16] !== collectionConfig || $[17] !== globalConfig || $[18] !== disableLeaveWithoutSaving || $[19] !== t || $[20] !== collectionSlug || $[21] !== globalSlug || $[22] !== id || $[23] !== config || $[24] !== apiURL || $[25] !== initialData || $[26] !== disableActions || $[27] !== hasPublishPermission || $[28] !== hasSavePermission || $[29] !== isEditing || $[30] !== docPermissions || $[31] !== previewWindowType || $[32] !== AfterFields || $[33] !== BeforeFields || $[34] !== fields || $[35] !== BeforeDocument || $[36] !== AfterDocument || $[37] !== action || $[38] !== t5 || $[39] !== initialState || $[40] !== isInitializing || $[41] !== t6 || $[42] !== onSave || $[43] !== operation) {
|
|
139
|
-
let t8;
|
|
140
|
-
if ($[45] !== collectionConfig || $[46] !== globalConfig || $[47] !== disableLeaveWithoutSaving) {
|
|
141
|
-
t8 = (collectionConfig && !(collectionConfig.versions?.drafts && collectionConfig.versions?.drafts?.autosave) || globalConfig && !(globalConfig.versions?.drafts && globalConfig.versions?.drafts?.autosave)) && !disableLeaveWithoutSaving && _jsx(LeaveWithoutSaving, {});
|
|
142
|
-
$[45] = collectionConfig;
|
|
143
|
-
$[46] = globalConfig;
|
|
144
|
-
$[47] = disableLeaveWithoutSaving;
|
|
145
|
-
$[48] = t8;
|
|
146
|
-
} else {
|
|
147
|
-
t8 = $[48];
|
|
148
128
|
}
|
|
149
|
-
const
|
|
129
|
+
const abortController = new AbortController();
|
|
130
|
+
abortControllerRef.current = abortController;
|
|
131
|
+
const currentTime = Date.now();
|
|
132
|
+
const timeSinceLastUpdate = currentTime - editSessionStartTime;
|
|
133
|
+
const updateLastEdited = isLockingEnabled && timeSinceLastUpdate >= 10000 // 10 seconds
|
|
134
|
+
;
|
|
135
|
+
if (updateLastEdited) {
|
|
136
|
+
setEditSessionStartTime(currentTime);
|
|
137
|
+
}
|
|
138
|
+
const docPreferences = await getDocPreferences();
|
|
139
|
+
const {
|
|
140
|
+
lockedState,
|
|
141
|
+
state
|
|
142
|
+
} = await getFormState({
|
|
143
|
+
id,
|
|
150
144
|
collectionSlug,
|
|
151
|
-
|
|
145
|
+
docPermissions,
|
|
146
|
+
docPreferences,
|
|
147
|
+
formState: prevFormState,
|
|
152
148
|
globalSlug,
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
const t10 = _jsx(SetDocumentTitle, {
|
|
159
|
-
collectionConfig,
|
|
160
|
-
config,
|
|
161
|
-
fallback: id?.toString() || "",
|
|
162
|
-
globalConfig
|
|
163
|
-
});
|
|
164
|
-
const t11 = _jsx(DocumentControls, {
|
|
165
|
-
apiURL,
|
|
166
|
-
data: initialData,
|
|
167
|
-
disableActions,
|
|
168
|
-
hasPublishPermission,
|
|
169
|
-
hasSavePermission,
|
|
170
|
-
id,
|
|
171
|
-
isEditing,
|
|
172
|
-
permissions: docPermissions,
|
|
173
|
-
slug: collectionConfig?.slug || globalConfig?.slug
|
|
149
|
+
operation,
|
|
150
|
+
returnLockStatus: isLockingEnabled ? true : false,
|
|
151
|
+
schemaPath,
|
|
152
|
+
signal: abortController.signal,
|
|
153
|
+
updateLastEdited
|
|
174
154
|
});
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
155
|
+
setDocumentIsLocked(true);
|
|
156
|
+
if (isLockingEnabled) {
|
|
157
|
+
const previousOwnerId = typeof documentLockStateRef.current?.user === 'object' ? documentLockStateRef.current?.user?.id : documentLockStateRef.current?.user;
|
|
158
|
+
if (lockedState) {
|
|
159
|
+
const lockedUserID = typeof lockedState.user === 'string' || typeof lockedState.user === 'number' ? lockedState.user : lockedState.user.id;
|
|
160
|
+
if (!documentLockStateRef.current || lockedUserID !== previousOwnerId) {
|
|
161
|
+
if (previousOwnerId === user.id && lockedUserID !== user.id) {
|
|
162
|
+
setShowTakeOverModal(true);
|
|
163
|
+
documentLockStateRef.current.hasShownLockedModal = true;
|
|
164
|
+
}
|
|
165
|
+
documentLockStateRef.current = documentLockStateRef.current = {
|
|
166
|
+
hasShownLockedModal: documentLockStateRef.current?.hasShownLockedModal || false,
|
|
167
|
+
isLocked: true,
|
|
168
|
+
user: lockedState.user
|
|
169
|
+
};
|
|
170
|
+
setCurrentEditor(lockedState.user);
|
|
171
|
+
}
|
|
172
|
+
}
|
|
193
173
|
}
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
174
|
+
return state;
|
|
175
|
+
}, [editSessionStartTime, isLockingEnabled, getDocPreferences, getFormState, id, collectionSlug, docPermissions, globalSlug, operation, schemaPath, setDocumentIsLocked, user.id, setCurrentEditor]);
|
|
176
|
+
// Clean up when the component unmounts or when the document is unlocked
|
|
177
|
+
useEffect(() => {
|
|
178
|
+
return () => {
|
|
179
|
+
if (abortControllerRef.current) {
|
|
180
|
+
try {
|
|
181
|
+
abortControllerRef.current.abort();
|
|
182
|
+
} catch (_err_0) {
|
|
183
|
+
// swallow error
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
if (!isLockingEnabled) {
|
|
187
|
+
return;
|
|
188
|
+
}
|
|
189
|
+
const currentPath = window.location.pathname;
|
|
190
|
+
const documentId = id || globalSlug;
|
|
191
|
+
// Routes where we do NOT want to unlock the document
|
|
192
|
+
const stayWithinDocumentPaths = ['preview', 'api', 'versions'];
|
|
193
|
+
const isStayingWithinDocument = stayWithinDocumentPaths.some(path => currentPath.includes(path));
|
|
194
|
+
// Unlock the document only if we're actually navigating away from the document
|
|
195
|
+
if (documentId && documentIsLocked && !isStayingWithinDocument) {
|
|
196
|
+
// Check if this user is still the current editor
|
|
197
|
+
if (typeof documentLockStateRef.current?.user === 'object' ? documentLockStateRef.current?.user?.id === user?.id : documentLockStateRef.current?.user === user?.id) {
|
|
198
|
+
void unlockDocument(id, collectionSlug ?? globalSlug);
|
|
199
|
+
setDocumentIsLocked(false);
|
|
200
|
+
setCurrentEditor(null);
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
setShowTakeOverModal(false);
|
|
204
|
+
};
|
|
205
|
+
}, [collectionSlug, globalSlug, id, unlockDocument, user, setCurrentEditor, isLockingEnabled, documentIsLocked, setDocumentIsLocked]);
|
|
206
|
+
const shouldShowDocumentLockedModal = documentIsLocked && currentEditor && (typeof currentEditor === 'object' ? currentEditor.id !== user?.id : currentEditor !== user?.id) && !isReadOnlyForIncomingUser && !showTakeOverModal &&
|
|
207
|
+
// eslint-disable-next-line react-compiler/react-compiler
|
|
208
|
+
!documentLockStateRef.current?.hasShownLockedModal && !isLockExpired;
|
|
209
|
+
return /*#__PURE__*/_jsx(OperationProvider, {
|
|
210
|
+
operation: operation,
|
|
211
|
+
children: /*#__PURE__*/_jsxs(Form, {
|
|
212
|
+
action: action,
|
|
213
|
+
className: `${baseClass}__form`,
|
|
214
|
+
disabled: isReadOnlyForIncomingUser || !hasSavePermission,
|
|
215
|
+
initialState: initialState,
|
|
216
|
+
isInitializing: isInitializing,
|
|
217
|
+
method: id ? 'PATCH' : 'POST',
|
|
218
|
+
onChange: [onChange],
|
|
219
|
+
onSuccess: onSave,
|
|
220
|
+
children: [isLockingEnabled && shouldShowDocumentLockedModal && !isReadOnlyForIncomingUser && /*#__PURE__*/_jsx(DocumentLocked, {
|
|
221
|
+
handleGoBack: () => handleGoBack({
|
|
222
|
+
adminRoute,
|
|
223
|
+
collectionSlug,
|
|
224
|
+
router
|
|
225
|
+
}),
|
|
226
|
+
isActive: shouldShowDocumentLockedModal,
|
|
227
|
+
onReadOnly: () => {
|
|
228
|
+
setIsReadOnlyForIncomingUser(true);
|
|
229
|
+
setShowTakeOverModal(false);
|
|
230
|
+
},
|
|
231
|
+
onTakeOver: () => handleTakeOver(id, collectionSlug, globalSlug, user, false, updateDocumentEditor, setCurrentEditor, documentLockStateRef, isLockingEnabled),
|
|
232
|
+
updatedAt: lastUpdateTime,
|
|
233
|
+
user: currentEditor
|
|
234
|
+
}), isLockingEnabled && showTakeOverModal && /*#__PURE__*/_jsx(DocumentTakeOver, {
|
|
235
|
+
handleBackToDashboard: () => handleBackToDashboard({
|
|
236
|
+
adminRoute,
|
|
237
|
+
router
|
|
238
|
+
}),
|
|
239
|
+
isActive: showTakeOverModal,
|
|
240
|
+
onReadOnly: () => {
|
|
241
|
+
setIsReadOnlyForIncomingUser(true);
|
|
242
|
+
setShowTakeOverModal(false);
|
|
243
|
+
}
|
|
244
|
+
}), (collectionConfig && !(collectionConfig.versions?.drafts && collectionConfig.versions?.drafts?.autosave) || globalConfig && !(globalConfig.versions?.drafts && globalConfig.versions?.drafts?.autosave)) && !disableLeaveWithoutSaving && !isReadOnlyForIncomingUser && /*#__PURE__*/_jsx(LeaveWithoutSaving, {}), /*#__PURE__*/_jsx(SetDocumentStepNav, {
|
|
245
|
+
collectionSlug: collectionSlug,
|
|
246
|
+
globalLabel: globalConfig?.label,
|
|
247
|
+
globalSlug: globalSlug,
|
|
248
|
+
id: id,
|
|
249
|
+
pluralLabel: collectionConfig ? collectionConfig?.labels?.plural : undefined,
|
|
250
|
+
useAsTitle: collectionConfig ? collectionConfig?.admin?.useAsTitle : undefined,
|
|
251
|
+
view: t('general:livePreview')
|
|
252
|
+
}), /*#__PURE__*/_jsx(SetDocumentTitle, {
|
|
253
|
+
collectionConfig: collectionConfig,
|
|
254
|
+
config: config,
|
|
255
|
+
fallback: id?.toString() || '',
|
|
256
|
+
globalConfig: globalConfig
|
|
257
|
+
}), /*#__PURE__*/_jsx(DocumentControls, {
|
|
258
|
+
apiURL: apiURL,
|
|
259
|
+
data: initialData,
|
|
260
|
+
disableActions: disableActions,
|
|
261
|
+
hasPublishPermission: hasPublishPermission,
|
|
262
|
+
hasSavePermission: hasSavePermission,
|
|
263
|
+
id: id,
|
|
264
|
+
isEditing: isEditing,
|
|
265
|
+
onTakeOver: () => handleTakeOver(id, collectionSlug, globalSlug, user, true, updateDocumentEditor, setCurrentEditor, documentLockStateRef, isLockingEnabled, setIsReadOnlyForIncomingUser),
|
|
266
|
+
permissions: docPermissions,
|
|
267
|
+
readOnlyForIncomingUser: isReadOnlyForIncomingUser,
|
|
268
|
+
slug: collectionConfig?.slug || globalConfig?.slug,
|
|
269
|
+
user: currentEditor
|
|
270
|
+
}), /*#__PURE__*/_jsxs("div", {
|
|
271
|
+
className: [baseClass, previewWindowType === 'popup' && `${baseClass}--detached`].filter(Boolean).join(' '),
|
|
272
|
+
children: [/*#__PURE__*/_jsxs("div", {
|
|
273
|
+
className: [`${baseClass}__main`, previewWindowType === 'popup' && `${baseClass}__main--popup-open`].filter(Boolean).join(' '),
|
|
274
|
+
children: [/*#__PURE__*/_jsx(DocumentFields, {
|
|
275
|
+
AfterFields: AfterFields,
|
|
276
|
+
BeforeFields: BeforeFields,
|
|
277
|
+
docPermissions: docPermissions,
|
|
278
|
+
fields: fields,
|
|
279
|
+
forceSidebarWrap: true,
|
|
280
|
+
readOnly: isReadOnlyForIncomingUser || !hasSavePermission,
|
|
281
|
+
schemaPathSegments: [collectionSlug || globalSlug]
|
|
282
|
+
}), AfterDocument]
|
|
283
|
+
}), /*#__PURE__*/_jsx(LivePreview, {
|
|
284
|
+
collectionSlug: collectionSlug,
|
|
285
|
+
globalSlug: globalSlug
|
|
222
286
|
})]
|
|
223
|
-
})
|
|
224
|
-
})
|
|
225
|
-
|
|
226
|
-
$[16] = collectionConfig;
|
|
227
|
-
$[17] = globalConfig;
|
|
228
|
-
$[18] = disableLeaveWithoutSaving;
|
|
229
|
-
$[19] = t;
|
|
230
|
-
$[20] = collectionSlug;
|
|
231
|
-
$[21] = globalSlug;
|
|
232
|
-
$[22] = id;
|
|
233
|
-
$[23] = config;
|
|
234
|
-
$[24] = apiURL;
|
|
235
|
-
$[25] = initialData;
|
|
236
|
-
$[26] = disableActions;
|
|
237
|
-
$[27] = hasPublishPermission;
|
|
238
|
-
$[28] = hasSavePermission;
|
|
239
|
-
$[29] = isEditing;
|
|
240
|
-
$[30] = docPermissions;
|
|
241
|
-
$[31] = previewWindowType;
|
|
242
|
-
$[32] = AfterFields;
|
|
243
|
-
$[33] = BeforeFields;
|
|
244
|
-
$[34] = fields;
|
|
245
|
-
$[35] = BeforeDocument;
|
|
246
|
-
$[36] = AfterDocument;
|
|
247
|
-
$[37] = action;
|
|
248
|
-
$[38] = t5;
|
|
249
|
-
$[39] = initialState;
|
|
250
|
-
$[40] = isInitializing;
|
|
251
|
-
$[41] = t6;
|
|
252
|
-
$[42] = onSave;
|
|
253
|
-
$[43] = operation;
|
|
254
|
-
$[44] = t7;
|
|
255
|
-
} else {
|
|
256
|
-
t7 = $[44];
|
|
257
|
-
}
|
|
258
|
-
return t7;
|
|
287
|
+
})]
|
|
288
|
+
})
|
|
289
|
+
});
|
|
259
290
|
};
|
|
260
291
|
export const LivePreviewClient = props => {
|
|
261
292
|
const $ = _c(14);
|
|
@@ -304,10 +335,8 @@ export const LivePreviewClient = props => {
|
|
|
304
335
|
globalSlug
|
|
305
336
|
});
|
|
306
337
|
const schemaPath = collectionSlug || globalSlug;
|
|
307
|
-
t3 =
|
|
308
|
-
children:
|
|
309
|
-
actions: (collectionConfig || globalConfig)?.admin?.components?.views?.edit?.livePreview?.actions
|
|
310
|
-
}), _jsx(LivePreviewProvider, {
|
|
338
|
+
t3 = _jsx(Fragment, {
|
|
339
|
+
children: _jsx(LivePreviewProvider, {
|
|
311
340
|
breakpoints,
|
|
312
341
|
fieldSchema: collectionConfig?.fields || globalConfig?.fields,
|
|
313
342
|
isPopupOpen,
|
|
@@ -323,7 +352,7 @@ export const LivePreviewClient = props => {
|
|
|
323
352
|
schemaPath,
|
|
324
353
|
serverURL
|
|
325
354
|
})
|
|
326
|
-
})
|
|
355
|
+
})
|
|
327
356
|
});
|
|
328
357
|
$[2] = collectionSlug;
|
|
329
358
|
$[3] = getEntityConfig;
|