@payloadcms/next 3.69.0-internal.2883df2 → 3.69.0-internal.424436e
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 +1 -0
- package/dist/cjs/withPayload.cjs.map +2 -2
- package/dist/elements/DocumentHeader/Tabs/Tab/TabLink.d.ts.map +1 -1
- package/dist/elements/DocumentHeader/Tabs/Tab/TabLink.js +24 -19
- package/dist/elements/DocumentHeader/Tabs/Tab/TabLink.js.map +1 -1
- package/dist/elements/Nav/index.client.d.ts.map +1 -1
- package/dist/elements/Nav/index.client.js +21 -15
- package/dist/elements/Nav/index.client.js.map +1 -1
- package/dist/templates/Default/index.d.ts.map +1 -1
- package/dist/templates/Default/index.js +20 -35
- package/dist/templates/Default/index.js.map +1 -1
- package/dist/utilities/handleAuthRedirect.d.ts.map +1 -1
- package/dist/utilities/handleAuthRedirect.js +2 -1
- package/dist/utilities/handleAuthRedirect.js.map +1 -1
- package/dist/views/Account/ResetPreferences/index.d.ts.map +1 -1
- package/dist/views/Account/ResetPreferences/index.js +6 -1
- package/dist/views/Account/ResetPreferences/index.js.map +1 -1
- package/dist/views/CreateFirstUser/index.client.d.ts.map +1 -1
- package/dist/views/CreateFirstUser/index.client.js +6 -1
- package/dist/views/CreateFirstUser/index.client.js.map +1 -1
- package/dist/views/Dashboard/Default/index.d.ts.map +1 -1
- package/dist/views/Dashboard/Default/index.js +8 -4
- package/dist/views/Dashboard/Default/index.js.map +1 -1
- package/dist/views/Document/index.d.ts.map +1 -1
- package/dist/views/Document/index.js +6 -2
- package/dist/views/Document/index.js.map +1 -1
- package/dist/views/ForgotPassword/index.d.ts.map +1 -1
- package/dist/views/ForgotPassword/index.js +6 -3
- package/dist/views/ForgotPassword/index.js.map +1 -1
- package/dist/views/List/handleServerFunction.d.ts.map +1 -1
- package/dist/views/List/handleServerFunction.js +4 -1
- package/dist/views/List/handleServerFunction.js.map +1 -1
- package/dist/views/List/index.d.ts.map +1 -1
- package/dist/views/List/index.js +2 -1
- package/dist/views/List/index.js.map +1 -1
- package/dist/views/Login/LoginForm/index.d.ts.map +1 -1
- package/dist/views/Login/LoginForm/index.js +24 -17
- package/dist/views/Login/LoginForm/index.js.map +1 -1
- package/dist/views/Logout/LogoutClient.d.ts.map +1 -1
- package/dist/views/Logout/LogoutClient.js +41 -36
- package/dist/views/Logout/LogoutClient.js.map +1 -1
- package/dist/views/NotFound/index.d.ts.map +1 -1
- package/dist/views/NotFound/index.js +1 -0
- package/dist/views/NotFound/index.js.map +1 -1
- package/dist/views/ResetPassword/ResetPasswordForm/index.d.ts.map +1 -1
- package/dist/views/ResetPassword/ResetPasswordForm/index.js +22 -16
- package/dist/views/ResetPassword/ResetPasswordForm/index.js.map +1 -1
- package/dist/views/ResetPassword/index.d.ts.map +1 -1
- package/dist/views/ResetPassword/index.js +4 -2
- package/dist/views/ResetPassword/index.js.map +1 -1
- package/dist/views/Root/index.d.ts.map +1 -1
- package/dist/views/Root/index.js +6 -4
- package/dist/views/Root/index.js.map +1 -1
- package/dist/views/Root/isPathMatchingRoute.d.ts.map +1 -1
- package/dist/views/Root/isPathMatchingRoute.js.map +1 -1
- package/dist/views/Unauthorized/index.d.ts.map +1 -1
- package/dist/views/Unauthorized/index.js +4 -2
- package/dist/views/Unauthorized/index.js.map +1 -1
- package/dist/views/Verify/index.d.ts.map +1 -1
- package/dist/views/Verify/index.js +4 -2
- package/dist/views/Verify/index.js.map +1 -1
- package/dist/views/Version/Default/SetStepNav.d.ts.map +1 -1
- package/dist/views/Version/Default/SetStepNav.js +14 -7
- package/dist/views/Version/Default/SetStepNav.js.map +1 -1
- package/dist/views/Version/Restore/index.d.ts.map +1 -1
- package/dist/views/Version/Restore/index.js +4 -2
- package/dist/views/Version/Restore/index.js.map +1 -1
- package/dist/views/Versions/cells/CreatedAt/index.d.ts.map +1 -1
- package/dist/views/Versions/cells/CreatedAt/index.js +6 -3
- package/dist/views/Versions/cells/CreatedAt/index.js.map +1 -1
- package/dist/views/Versions/index.d.ts.map +1 -1
- package/dist/views/Versions/index.js +6 -2
- package/dist/views/Versions/index.js.map +1 -1
- package/dist/withPayload/withPayload.d.ts.map +1 -1
- package/dist/withPayload/withPayload.js +1 -1
- package/dist/withPayload/withPayload.js.map +1 -1
- package/package.json +7 -7
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["c","_c","Button","ConfirmationModal","toast","useModal","useTranslation","qs","Fragment","useCallback","confirmResetModalSlug","ResetPreferences","t0","$","apiRoute","user","openModal","t","t1","stringifiedQuery","stringify","depth","where","id","equals","addQueryPrefix","res","fetch","credentials","headers","method","json","message","ok","success","error","t2","_err","handleResetPreferences","t3","_jsxs","children","_jsx","buttonStyle","onClick","body","confirmingLabel","heading","modalSlug","onConfirm"],"sources":["../../../../src/views/Account/ResetPreferences/index.tsx"],"sourcesContent":["'use client'\nimport type { TypedUser } from 'payload'\n\nimport { Button, ConfirmationModal, toast, useModal, useTranslation } from '@payloadcms/ui'\nimport * as qs from 'qs-esm'\nimport { Fragment, useCallback } from 'react'\n\nconst confirmResetModalSlug = 'confirm-reset-modal'\n\nexport const ResetPreferences: React.FC<{\n readonly apiRoute: string\n readonly user?: TypedUser\n}> = ({ apiRoute, user }) => {\n const { openModal } = useModal()\n const { t } = useTranslation()\n\n const handleResetPreferences = useCallback(async () => {\n if (!user) {\n return\n }\n\n const stringifiedQuery = qs.stringify(\n {\n depth: 0,\n where: {\n user: {\n id: {\n equals: user.id,\n },\n },\n },\n },\n { addQueryPrefix: true },\n )\n\n try {\n const res = await fetch(
|
|
1
|
+
{"version":3,"file":"index.js","names":["c","_c","Button","ConfirmationModal","toast","useModal","useTranslation","formatApiURL","qs","Fragment","useCallback","confirmResetModalSlug","ResetPreferences","t0","$","apiRoute","user","openModal","t","t1","stringifiedQuery","stringify","depth","where","id","equals","addQueryPrefix","res","fetch","path","serverURL","undefined","credentials","headers","method","json","message","ok","success","error","t2","_err","handleResetPreferences","t3","_jsxs","children","_jsx","buttonStyle","onClick","body","confirmingLabel","heading","modalSlug","onConfirm"],"sources":["../../../../src/views/Account/ResetPreferences/index.tsx"],"sourcesContent":["'use client'\nimport type { TypedUser } from 'payload'\n\nimport { Button, ConfirmationModal, toast, useModal, useTranslation } from '@payloadcms/ui'\nimport { formatApiURL } from 'payload/shared'\nimport * as qs from 'qs-esm'\nimport { Fragment, useCallback } from 'react'\n\nconst confirmResetModalSlug = 'confirm-reset-modal'\n\nexport const ResetPreferences: React.FC<{\n readonly apiRoute: string\n readonly user?: TypedUser\n}> = ({ apiRoute, user }) => {\n const { openModal } = useModal()\n const { t } = useTranslation()\n\n const handleResetPreferences = useCallback(async () => {\n if (!user) {\n return\n }\n\n const stringifiedQuery = qs.stringify(\n {\n depth: 0,\n where: {\n user: {\n id: {\n equals: user.id,\n },\n },\n },\n },\n { addQueryPrefix: true },\n )\n\n try {\n const res = await fetch(\n formatApiURL({\n apiRoute,\n path: `/payload-preferences${stringifiedQuery}`,\n serverURL: undefined,\n }),\n {\n credentials: 'include',\n headers: {\n 'Content-Type': 'application/json',\n },\n method: 'DELETE',\n },\n )\n\n const json = await res.json()\n const message = json.message\n\n if (res.ok) {\n toast.success(message)\n } else {\n toast.error(message)\n }\n } catch (_err) {\n // swallow error\n }\n }, [apiRoute, user])\n\n return (\n <Fragment>\n <div>\n <Button buttonStyle=\"secondary\" onClick={() => openModal(confirmResetModalSlug)}>\n {t('general:resetPreferences')}\n </Button>\n </div>\n <ConfirmationModal\n body={t('general:resetPreferencesDescription')}\n confirmingLabel={t('general:resettingPreferences')}\n heading={t('general:resetPreferences')}\n modalSlug={confirmResetModalSlug}\n onConfirm={handleResetPreferences}\n />\n </Fragment>\n )\n}\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;;AAGA,SAASC,MAAM,EAAEC,iBAAiB,EAAEC,KAAK,EAAEC,QAAQ,EAAEC,cAAc,QAAQ;AAC3E,SAASC,YAAY,QAAQ;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AK,EAAA;EAAA;IAAAA,EAAA,GAAAL,CAAA;EAAA;EA9CA,MAAA4B,sBAAA,GAA+BvB,EA8CZ;EAAA,IAAAqB,EAAA;EAAA,IAAA1B,CAAA,QAAAG,SAAA;IAK4BuB,EAAA,GAAAA,CAAA,KAAMvB,SAAA,CAAAN,qBAAU;IAAAG,CAAA,MAAAG,SAAA;IAAAH,CAAA,MAAA0B,EAAA;EAAA;IAAAA,EAAA,GAAA1B,CAAA;EAAA;EAAA,IAAA6B,EAAA;EAAA,IAAA7B,CAAA,QAAA4B,sBAAA,IAAA5B,CAAA,QAAAI,CAAA,IAAAJ,CAAA,QAAA0B,EAAA;IAF7DG,EAAA,GAAAC,KAAA,CAAAnC,QAAA;MAAAoC,QAAA,GACEC,IAAA,CAAC;QAAAD,QAAA,EACCC,IAAA,CAAA5C,MAAA;UAAA6C,WAAA,EAAoB;UAAAC,OAAA,EAAqBR,EAAgB;UAAAK,QAAA,EACtD3B,CAAA,CAAE;QAAA,C;UAGP4B,IAAA,CAAA3C,iBAAA;QAAA8C,IAAA,EACQ/B,CAAA,CAAE;QAAAgC,eAAA,EACShC,CAAA,CAAE;QAAAiC,OAAA,EACVjC,CAAA,CAAE;QAAAkC,SAAA,EAAAzC,qBAAA;QAAA0C,SAAA,EAEAX;MAAA,C;;;;;;;;;SAXfC,E;CAeJ","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.client.d.ts","sourceRoot":"","sources":["../../../src/views/CreateFirstUser/index.client.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,mBAAmB,EACnB,SAAS,EACT,wBAAwB,EACxB,4BAA4B,EAC7B,MAAM,SAAS,CAAA;
|
|
1
|
+
{"version":3,"file":"index.client.d.ts","sourceRoot":"","sources":["../../../src/views/CreateFirstUser/index.client.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,mBAAmB,EACnB,SAAS,EACT,wBAAwB,EACxB,4BAA4B,EAC7B,MAAM,SAAS,CAAA;AAgBhB,OAAO,KAAoB,MAAM,OAAO,CAAA;AAExC,eAAO,MAAM,qBAAqB,EAAE,KAAK,CAAC,EAAE,CAAC;IAC3C,cAAc,EAAE,4BAA4B,CAAA;IAC5C,cAAc,EAAE,mBAAmB,CAAA;IACnC,YAAY,EAAE,SAAS,CAAA;IACvB,iBAAiB,CAAC,EAAE,KAAK,GAAG,wBAAwB,CAAA;IACpD,QAAQ,EAAE,MAAM,CAAA;CACjB,CAwGA,CAAA"}
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
4
4
|
import { ConfirmPasswordField, EmailAndUsernameFields, Form, FormSubmit, PasswordField, RenderFields, useAuth, useConfig, useServerFunctions, useTranslation } from '@payloadcms/ui';
|
|
5
5
|
import { abortAndIgnore, handleAbortRef } from '@payloadcms/ui/shared';
|
|
6
|
+
import { formatApiURL } from 'payload/shared';
|
|
6
7
|
import React, { useEffect } from 'react';
|
|
7
8
|
export const CreateFirstUserClient = ({
|
|
8
9
|
docPermissions,
|
|
@@ -64,7 +65,11 @@ export const CreateFirstUserClient = ({
|
|
|
64
65
|
};
|
|
65
66
|
}, []);
|
|
66
67
|
return /*#__PURE__*/_jsxs(Form, {
|
|
67
|
-
action:
|
|
68
|
+
action: formatApiURL({
|
|
69
|
+
apiRoute,
|
|
70
|
+
path: `/${userSlug}/first-register`,
|
|
71
|
+
serverURL
|
|
72
|
+
}),
|
|
68
73
|
initialState: {
|
|
69
74
|
...initialState,
|
|
70
75
|
'confirm-password': {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.client.js","names":["ConfirmPasswordField","EmailAndUsernameFields","Form","FormSubmit","PasswordField","RenderFields","useAuth","useConfig","useServerFunctions","useTranslation","abortAndIgnore","handleAbortRef","React","useEffect","CreateFirstUserClient","docPermissions","docPreferences","initialState","loginWithUsername","userSlug","config","routes","admin","api","apiRoute","serverURL","getEntityConfig","getFormState","t","setUser","abortOnChangeRef","useRef","collectionConfig","collectionSlug","onChange","useCallback","formState","prevFormState","submitted","controller","response","operation","schemaPath","signal","skipValidation","current","state","handleFirstRegister","data","abortOnChange","_jsxs","action","valid","value","method","onSuccess","redirect","validationOperation","_jsx","className","readOnly","autoComplete","field","name","label","required","
|
|
1
|
+
{"version":3,"file":"index.client.js","names":["ConfirmPasswordField","EmailAndUsernameFields","Form","FormSubmit","PasswordField","RenderFields","useAuth","useConfig","useServerFunctions","useTranslation","abortAndIgnore","handleAbortRef","formatApiURL","React","useEffect","CreateFirstUserClient","docPermissions","docPreferences","initialState","loginWithUsername","userSlug","config","routes","admin","api","apiRoute","serverURL","getEntityConfig","getFormState","t","setUser","abortOnChangeRef","useRef","collectionConfig","collectionSlug","onChange","useCallback","formState","prevFormState","submitted","controller","response","operation","schemaPath","signal","skipValidation","current","state","handleFirstRegister","data","abortOnChange","_jsxs","action","path","valid","value","method","onSuccess","redirect","validationOperation","_jsx","className","readOnly","autoComplete","field","name","label","required","fields","forceRender","parentIndexPath","parentPath","parentSchemaPath","permissions","size"],"sources":["../../../src/views/CreateFirstUser/index.client.tsx"],"sourcesContent":["'use client'\nimport type { FormProps, UserWithToken } from '@payloadcms/ui'\nimport type {\n DocumentPreferences,\n FormState,\n LoginWithUsernameOptions,\n SanitizedDocumentPermissions,\n} from 'payload'\n\nimport {\n ConfirmPasswordField,\n EmailAndUsernameFields,\n Form,\n FormSubmit,\n PasswordField,\n RenderFields,\n useAuth,\n useConfig,\n useServerFunctions,\n useTranslation,\n} from '@payloadcms/ui'\nimport { abortAndIgnore, handleAbortRef } from '@payloadcms/ui/shared'\nimport { formatApiURL } from 'payload/shared'\nimport React, { useEffect } from 'react'\n\nexport const CreateFirstUserClient: React.FC<{\n docPermissions: SanitizedDocumentPermissions\n docPreferences: DocumentPreferences\n initialState: FormState\n loginWithUsername?: false | LoginWithUsernameOptions\n userSlug: string\n}> = ({ docPermissions, docPreferences, initialState, loginWithUsername, userSlug }) => {\n const {\n config: {\n routes: { admin, api: apiRoute },\n serverURL,\n },\n getEntityConfig,\n } = useConfig()\n\n const { getFormState } = useServerFunctions()\n\n const { t } = useTranslation()\n const { setUser } = useAuth()\n\n const abortOnChangeRef = React.useRef<AbortController>(null)\n\n const collectionConfig = getEntityConfig({ collectionSlug: userSlug })\n\n const onChange: FormProps['onChange'][0] = React.useCallback(\n async ({ formState: prevFormState, submitted }) => {\n const controller = handleAbortRef(abortOnChangeRef)\n\n const response = await getFormState({\n collectionSlug: userSlug,\n docPermissions,\n docPreferences,\n formState: prevFormState,\n operation: 'create',\n schemaPath: userSlug,\n signal: controller.signal,\n skipValidation: !submitted,\n })\n\n abortOnChangeRef.current = null\n\n if (response && response.state) {\n return response.state\n }\n },\n [userSlug, getFormState, docPermissions, docPreferences],\n )\n\n const handleFirstRegister = (data: UserWithToken) => {\n setUser(data)\n }\n\n useEffect(() => {\n const abortOnChange = abortOnChangeRef.current\n\n return () => {\n abortAndIgnore(abortOnChange)\n }\n }, [])\n\n return (\n <Form\n action={formatApiURL({\n apiRoute,\n path: `/${userSlug}/first-register`,\n serverURL,\n })}\n initialState={{\n ...initialState,\n 'confirm-password': {\n ...initialState['confirm-password'],\n valid: initialState['confirm-password']['valid'] || false,\n value: initialState['confirm-password']['value'] || '',\n },\n }}\n method=\"POST\"\n onChange={[onChange]}\n onSuccess={handleFirstRegister}\n redirect={admin}\n validationOperation=\"create\"\n >\n <EmailAndUsernameFields\n className=\"emailAndUsername\"\n loginWithUsername={loginWithUsername}\n operation=\"create\"\n readOnly={false}\n t={t}\n />\n <PasswordField\n autoComplete=\"off\"\n field={{\n name: 'password',\n label: t('authentication:newPassword'),\n required: true,\n }}\n path=\"password\"\n />\n <ConfirmPasswordField />\n <RenderFields\n fields={collectionConfig.fields}\n forceRender\n parentIndexPath=\"\"\n parentPath=\"\"\n parentSchemaPath={userSlug}\n permissions={true}\n readOnly={false}\n />\n <FormSubmit size=\"large\">{t('general:create')}</FormSubmit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D,YAAA;MACC+D,MAAA,EAAQnC,gBAAA,CAAiBmC,MAAM;MAC/BC,WAAW;MACXC,eAAA,EAAgB;MAChBC,UAAA,EAAW;MACXC,gBAAA,EAAkBpD,QAAA;MAClBqD,WAAA,EAAa;MACbX,QAAA,EAAU;qBAEZF,IAAA,CAACzD,UAAA;MAAWuE,IAAA,EAAK;gBAAS7C,CAAA,CAAE;;;AAGlC","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/views/Dashboard/Default/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAA;AAC1D,OAAO,KAAK,EAAE,wBAAwB,EAAE,UAAU,EAAE,MAAM,EAAe,MAAM,SAAS,CAAA;AAOxF,OAAO,KAAmB,MAAM,OAAO,CAAA;AAEvC,OAAO,cAAc,CAAA;AAIrB,MAAM,MAAM,wBAAwB,GAAG;IACrC,MAAM,EAAE,MAAM,CAAA;CACf,CAAA;AAED,MAAM,MAAM,4BAA4B,GAAG;IACzC,UAAU,EAAE,KAAK,CAAC;QAChB,IAAI,EAAE;YAAE,SAAS,EAAE,OAAO,CAAC;YAAC,aAAa,EAAE,MAAM,CAAC;YAAC,YAAY,EAAE,UAAU,GAAG,MAAM,GAAG,MAAM,CAAA;SAAE,CAAA;QAC/F,YAAY,CAAC,EAAE,MAAM,CAAA;QACrB,IAAI,EAAE,MAAM,CAAA;KACb,CAAC,CAAA;IACF;;;;OAIG;IACH,IAAI,CAAC,EAAE,KAAK,CAAC,aAAa,CAAA;IAC1B,SAAS,CAAC,EAAE,UAAU,CAAC,OAAO,aAAa,CAAC,CAAA;CAC7C,GAAG,wBAAwB,CAAA;AAE5B,MAAM,MAAM,wBAAwB,GAAG,wBAAwB,GAAG,4BAA4B,CAAA;AAE9F,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,wBAAwB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/views/Dashboard/Default/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAA;AAC1D,OAAO,KAAK,EAAE,wBAAwB,EAAE,UAAU,EAAE,MAAM,EAAe,MAAM,SAAS,CAAA;AAOxF,OAAO,KAAmB,MAAM,OAAO,CAAA;AAEvC,OAAO,cAAc,CAAA;AAIrB,MAAM,MAAM,wBAAwB,GAAG;IACrC,MAAM,EAAE,MAAM,CAAA;CACf,CAAA;AAED,MAAM,MAAM,4BAA4B,GAAG;IACzC,UAAU,EAAE,KAAK,CAAC;QAChB,IAAI,EAAE;YAAE,SAAS,EAAE,OAAO,CAAC;YAAC,aAAa,EAAE,MAAM,CAAC;YAAC,YAAY,EAAE,UAAU,GAAG,MAAM,GAAG,MAAM,CAAA;SAAE,CAAA;QAC/F,YAAY,CAAC,EAAE,MAAM,CAAA;QACrB,IAAI,EAAE,MAAM,CAAA;KACb,CAAC,CAAA;IACF;;;;OAIG;IACH,IAAI,CAAC,EAAE,KAAK,CAAC,aAAa,CAAA;IAC1B,SAAS,CAAC,EAAE,UAAU,CAAC,OAAO,aAAa,CAAC,CAAA;CAC7C,GAAG,wBAAwB,CAAA;AAE5B,MAAM,MAAM,wBAAwB,GAAG,wBAAwB,GAAG,4BAA4B,CAAA;AAE9F,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,wBAAwB,qBAsK/D"}
|
|
@@ -26,7 +26,8 @@ export function DefaultDashboard(props) {
|
|
|
26
26
|
},
|
|
27
27
|
routes: {
|
|
28
28
|
admin: adminRoute
|
|
29
|
-
}
|
|
29
|
+
},
|
|
30
|
+
serverURL
|
|
30
31
|
}
|
|
31
32
|
},
|
|
32
33
|
payload,
|
|
@@ -83,11 +84,13 @@ export function DefaultDashboard(props) {
|
|
|
83
84
|
});
|
|
84
85
|
href = formatAdminURL({
|
|
85
86
|
adminRoute,
|
|
86
|
-
path: `/collections/${slug}
|
|
87
|
+
path: `/collections/${slug}`,
|
|
88
|
+
serverURL
|
|
87
89
|
});
|
|
88
90
|
createHREF = formatAdminURL({
|
|
89
91
|
adminRoute,
|
|
90
|
-
path: `/collections/${slug}/create
|
|
92
|
+
path: `/collections/${slug}/create`,
|
|
93
|
+
serverURL
|
|
91
94
|
});
|
|
92
95
|
hasCreatePermission = permissions?.collections?.[slug]?.create;
|
|
93
96
|
}
|
|
@@ -98,7 +101,8 @@ export function DefaultDashboard(props) {
|
|
|
98
101
|
});
|
|
99
102
|
href = formatAdminURL({
|
|
100
103
|
adminRoute,
|
|
101
|
-
path: `/globals/${slug}
|
|
104
|
+
path: `/globals/${slug}`,
|
|
105
|
+
serverURL
|
|
102
106
|
});
|
|
103
107
|
// Find the lock status for the global
|
|
104
108
|
const globalLockData = globalData.find(global => global.slug === slug);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["getTranslation","Button","Card","Gutter","Locked","RenderServerComponent","EntityType","formatAdminURL","React","Fragment","baseClass","DefaultDashboard","props","globalData","i18n","t","locale","navGroups","params","payload","config","admin","components","afterDashboard","beforeDashboard","routes","adminRoute","permissions","searchParams","user","_jsx","className","_jsxs","Component","importMap","serverProps","length","map","entities","label","groupIndex","slug","type","entityIndex","title","buttonAriaLabel","createHREF","href","hasCreatePermission","isLocked","userEditing","collection","path","collections","create","global","globalLockData","find","data","_isLocked","_userEditing","lockDuration","lastEditedAt","Date","_lastEditedAt","getTime","lockDurationInMilliseconds","lockExpirationTime","actions","id","buttonStyle","el","icon","iconStyle","round","to","undefined","titleAs"],"sources":["../../../../src/views/Dashboard/Default/index.tsx"],"sourcesContent":["import type { groupNavItems } from '@payloadcms/ui/shared'\nimport type { AdminViewServerPropsOnly, ClientUser, Locale, ServerProps } from 'payload'\n\nimport { getTranslation } from '@payloadcms/translations'\nimport { Button, Card, Gutter, Locked } from '@payloadcms/ui'\nimport { RenderServerComponent } from '@payloadcms/ui/elements/RenderServerComponent'\nimport { EntityType } from '@payloadcms/ui/shared'\nimport { formatAdminURL } from 'payload/shared'\nimport React, { Fragment } from 'react'\n\nimport './index.scss'\n\nconst baseClass = 'dashboard'\n\nexport type DashboardViewClientProps = {\n locale: Locale\n}\n\nexport type DashboardViewServerPropsOnly = {\n globalData: Array<{\n data: { _isLocked: boolean; _lastEditedAt: string; _userEditing: ClientUser | number | string }\n lockDuration?: number\n slug: string\n }>\n /**\n * @deprecated\n * This prop is deprecated and will be removed in the next major version.\n * Components now import their own `Link` directly from `next/link`.\n */\n Link?: React.ComponentType\n navGroups?: ReturnType<typeof groupNavItems>\n} & AdminViewServerPropsOnly\n\nexport type DashboardViewServerProps = DashboardViewClientProps & DashboardViewServerPropsOnly\n\nexport function DefaultDashboard(props: DashboardViewServerProps) {\n const {\n globalData,\n i18n,\n i18n: { t },\n locale,\n navGroups,\n params,\n payload: {\n config: {\n admin: {\n components: { afterDashboard, beforeDashboard },\n },\n routes: { admin: adminRoute },\n },\n },\n payload,\n permissions,\n searchParams,\n user,\n } = props\n\n return (\n <div className={baseClass}>\n <Gutter className={`${baseClass}__wrap`}>\n {beforeDashboard &&\n RenderServerComponent({\n Component: beforeDashboard,\n importMap: payload.importMap,\n serverProps: {\n i18n,\n locale,\n params,\n payload,\n permissions,\n searchParams,\n user,\n } satisfies ServerProps,\n })}\n\n <Fragment>\n {!navGroups || navGroups?.length === 0 ? (\n <p>no nav groups....</p>\n ) : (\n navGroups.map(({ entities, label }, groupIndex) => {\n return (\n <div className={`${baseClass}__group`} key={groupIndex}>\n <h2 className={`${baseClass}__label`}>{label}</h2>\n <ul className={`${baseClass}__card-list`}>\n {entities.map(({ slug, type, label }, entityIndex) => {\n let title: string\n let buttonAriaLabel: string\n let createHREF: string\n let href: string\n let hasCreatePermission: boolean\n let isLocked = null\n let userEditing = null\n\n if (type === EntityType.collection) {\n title = getTranslation(label, i18n)\n\n buttonAriaLabel = t('general:showAllLabel', { label: title })\n\n href = formatAdminURL({ adminRoute, path: `/collections/${slug}` })\n\n createHREF = formatAdminURL({\n adminRoute,\n path: `/collections/${slug}/create`,\n })\n\n hasCreatePermission = permissions?.collections?.[slug]?.create\n }\n\n if (type === EntityType.global) {\n title = getTranslation(label, i18n)\n\n buttonAriaLabel = t('general:editLabel', {\n label: getTranslation(label, i18n),\n })\n\n href = formatAdminURL({\n adminRoute,\n path: `/globals/${slug}`,\n })\n\n // Find the lock status for the global\n const globalLockData = globalData.find((global) => global.slug === slug)\n if (globalLockData) {\n isLocked = globalLockData.data._isLocked\n userEditing = globalLockData.data._userEditing\n\n // Check if the lock is expired\n const lockDuration = globalLockData?.lockDuration\n const lastEditedAt = new Date(\n globalLockData.data?._lastEditedAt,\n ).getTime()\n\n const lockDurationInMilliseconds = lockDuration * 1000\n const lockExpirationTime = lastEditedAt + lockDurationInMilliseconds\n\n if (new Date().getTime() > lockExpirationTime) {\n isLocked = false\n userEditing = null\n }\n }\n }\n\n return (\n <li key={entityIndex}>\n <Card\n actions={\n isLocked && user?.id !== userEditing?.id ? (\n <Locked className={`${baseClass}__locked`} user={userEditing} />\n ) : hasCreatePermission && type === EntityType.collection ? (\n <Button\n aria-label={t('general:createNewLabel', {\n label,\n })}\n buttonStyle=\"icon-label\"\n el=\"link\"\n icon=\"plus\"\n iconStyle=\"with-border\"\n round\n to={createHREF}\n />\n ) : undefined\n }\n buttonAriaLabel={buttonAriaLabel}\n href={href}\n id={`card-${slug}`}\n title={getTranslation(label, i18n)}\n titleAs=\"h3\"\n />\n </li>\n )\n })}\n </ul>\n </div>\n )\n })\n )}\n </Fragment>\n {afterDashboard &&\n RenderServerComponent({\n Component: afterDashboard,\n importMap: payload.importMap,\n serverProps: {\n i18n,\n locale,\n params,\n payload,\n permissions,\n searchParams,\n user,\n } satisfies ServerProps,\n })}\n </Gutter>\n </div>\n )\n}\n"],"mappings":";AAGA,SAASA,cAAc,QAAQ;AAC/B,SAASC,MAAM,EAAEC,IAAI,EAAEC,MAAM,EAAEC,MAAM,QAAQ;AAC7C,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AA,CAAsB;QACpB4B,SAAA,EAAWV,cAAA;QACXW,SAAA,EAAWf,OAAA,CAAQe,SAAS;QAC5BC,WAAA,EAAa;UACXrB,IAAA;UACAE,MAAA;UACAE,MAAA;UACAC,OAAA;UACAQ,WAAA;UACAC,YAAA;UACAC;QACF;MACF;;;AAIV","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"index.js","names":["getTranslation","Button","Card","Gutter","Locked","RenderServerComponent","EntityType","formatAdminURL","React","Fragment","baseClass","DefaultDashboard","props","globalData","i18n","t","locale","navGroups","params","payload","config","admin","components","afterDashboard","beforeDashboard","routes","adminRoute","serverURL","permissions","searchParams","user","_jsx","className","_jsxs","Component","importMap","serverProps","length","map","entities","label","groupIndex","slug","type","entityIndex","title","buttonAriaLabel","createHREF","href","hasCreatePermission","isLocked","userEditing","collection","path","collections","create","global","globalLockData","find","data","_isLocked","_userEditing","lockDuration","lastEditedAt","Date","_lastEditedAt","getTime","lockDurationInMilliseconds","lockExpirationTime","actions","id","buttonStyle","el","icon","iconStyle","round","to","undefined","titleAs"],"sources":["../../../../src/views/Dashboard/Default/index.tsx"],"sourcesContent":["import type { groupNavItems } from '@payloadcms/ui/shared'\nimport type { AdminViewServerPropsOnly, ClientUser, Locale, ServerProps } from 'payload'\n\nimport { getTranslation } from '@payloadcms/translations'\nimport { Button, Card, Gutter, Locked } from '@payloadcms/ui'\nimport { RenderServerComponent } from '@payloadcms/ui/elements/RenderServerComponent'\nimport { EntityType } from '@payloadcms/ui/shared'\nimport { formatAdminURL } from 'payload/shared'\nimport React, { Fragment } from 'react'\n\nimport './index.scss'\n\nconst baseClass = 'dashboard'\n\nexport type DashboardViewClientProps = {\n locale: Locale\n}\n\nexport type DashboardViewServerPropsOnly = {\n globalData: Array<{\n data: { _isLocked: boolean; _lastEditedAt: string; _userEditing: ClientUser | number | string }\n lockDuration?: number\n slug: string\n }>\n /**\n * @deprecated\n * This prop is deprecated and will be removed in the next major version.\n * Components now import their own `Link` directly from `next/link`.\n */\n Link?: React.ComponentType\n navGroups?: ReturnType<typeof groupNavItems>\n} & AdminViewServerPropsOnly\n\nexport type DashboardViewServerProps = DashboardViewClientProps & DashboardViewServerPropsOnly\n\nexport function DefaultDashboard(props: DashboardViewServerProps) {\n const {\n globalData,\n i18n,\n i18n: { t },\n locale,\n navGroups,\n params,\n payload: {\n config: {\n admin: {\n components: { afterDashboard, beforeDashboard },\n },\n routes: { admin: adminRoute },\n serverURL,\n },\n },\n payload,\n permissions,\n searchParams,\n user,\n } = props\n\n return (\n <div className={baseClass}>\n <Gutter className={`${baseClass}__wrap`}>\n {beforeDashboard &&\n RenderServerComponent({\n Component: beforeDashboard,\n importMap: payload.importMap,\n serverProps: {\n i18n,\n locale,\n params,\n payload,\n permissions,\n searchParams,\n user,\n } satisfies ServerProps,\n })}\n\n <Fragment>\n {!navGroups || navGroups?.length === 0 ? (\n <p>no nav groups....</p>\n ) : (\n navGroups.map(({ entities, label }, groupIndex) => {\n return (\n <div className={`${baseClass}__group`} key={groupIndex}>\n <h2 className={`${baseClass}__label`}>{label}</h2>\n <ul className={`${baseClass}__card-list`}>\n {entities.map(({ slug, type, label }, entityIndex) => {\n let title: string\n let buttonAriaLabel: string\n let createHREF: string\n let href: string\n let hasCreatePermission: boolean\n let isLocked = null\n let userEditing = null\n\n if (type === EntityType.collection) {\n title = getTranslation(label, i18n)\n\n buttonAriaLabel = t('general:showAllLabel', { label: title })\n\n href = formatAdminURL({\n adminRoute,\n path: `/collections/${slug}`,\n serverURL,\n })\n\n createHREF = formatAdminURL({\n adminRoute,\n path: `/collections/${slug}/create`,\n serverURL,\n })\n\n hasCreatePermission = permissions?.collections?.[slug]?.create\n }\n\n if (type === EntityType.global) {\n title = getTranslation(label, i18n)\n\n buttonAriaLabel = t('general:editLabel', {\n label: getTranslation(label, i18n),\n })\n\n href = formatAdminURL({\n adminRoute,\n path: `/globals/${slug}`,\n serverURL,\n })\n\n // Find the lock status for the global\n const globalLockData = globalData.find((global) => global.slug === slug)\n if (globalLockData) {\n isLocked = globalLockData.data._isLocked\n userEditing = globalLockData.data._userEditing\n\n // Check if the lock is expired\n const lockDuration = globalLockData?.lockDuration\n const lastEditedAt = new Date(\n globalLockData.data?._lastEditedAt,\n ).getTime()\n\n const lockDurationInMilliseconds = lockDuration * 1000\n const lockExpirationTime = lastEditedAt + lockDurationInMilliseconds\n\n if (new Date().getTime() > lockExpirationTime) {\n isLocked = false\n userEditing = null\n }\n }\n }\n\n return (\n <li key={entityIndex}>\n <Card\n actions={\n isLocked && user?.id !== userEditing?.id ? (\n <Locked className={`${baseClass}__locked`} user={userEditing} />\n ) : hasCreatePermission && type === EntityType.collection ? (\n <Button\n aria-label={t('general:createNewLabel', {\n label,\n })}\n buttonStyle=\"icon-label\"\n el=\"link\"\n icon=\"plus\"\n iconStyle=\"with-border\"\n round\n to={createHREF}\n />\n ) : undefined\n }\n buttonAriaLabel={buttonAriaLabel}\n href={href}\n id={`card-${slug}`}\n title={getTranslation(label, i18n)}\n titleAs=\"h3\"\n />\n </li>\n )\n })}\n </ul>\n </div>\n )\n })\n )}\n </Fragment>\n {afterDashboard &&\n RenderServerComponent({\n Component: afterDashboard,\n importMap: payload.importMap,\n serverProps: {\n i18n,\n locale,\n params,\n payload,\n permissions,\n searchParams,\n user,\n } satisfies ServerProps,\n })}\n </Gutter>\n </div>\n )\n}\n"],"mappings":";AAGA,SAASA,cAAc,QAAQ;AAC/B,SAASC,MAAM,EAAEC,IAAI,EAAEC,MAAM,EAAEC,MAAM,QAAQ;AAC7C,SAASC,qBAAqB,QAAQ;AACtC,SAASC,UAAU,QAAQ;AAC3B,SAASC,cAAc,QAAQ;AAC/B,OAAOC,KAAA,IAASC,QAAQ,QAAQ;AAIhC,MAAMC,SAAA,GAAY;AAuBlB,OAAO,SAASC,iBAAiBC,KAA+B;EAC9D,MAAM;IACJC,UAAU;IACVC,IAAI;IACJA,IAAA,EAAM;MAAEC;IAAC,CAAE;IACXC,MAAM;IACNC,SAAS;IACTC,MAAM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1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/views/Document/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,oBAAoB,EAEpB,IAAI,EACJ,uBAAuB,EACvB,uBAAuB,EAEvB,iBAAiB,EACjB,gBAAgB,EAChB,gCAAgC,EACjC,MAAM,SAAS,CAAA;AAehB,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,uBAAuB,CAAA;AAcrE,eAAO,MAAM,gBAAgB,EAAE,wBAAiE,CAAA;AAEhG,MAAM,MAAM,YAAY,GACpB,iBAAiB,GACjB,gBAAgB,CAAC,uBAAuB,CAAC,GACzC,KAAK,CAAC,EAAE,GACR,KAAK,CAAC,EAAE,CAAC,uBAAuB,CAAC,CAAA;AAErC;;;;;GAKG;AACH,eAAO,MAAM,cAAc,6PAgBxB;IACD,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,wBAAwB,CAAC,EAAE,OAAO,CAAA;IAClC,QAAQ,CAAC,mBAAmB,CAAC,EAAE,OAAO,CAAA;IACtC,QAAQ,CAAC,mBAAmB,CAAC,EAAE,OAAO,CAAA;IACtC,QAAQ,CAAC,sBAAsB,CAAC,EAAE,OAAO,CAAA;IACzC,QAAQ,CAAC,oBAAoB,CAAC,EAAE,OAAO,CAAA;IACvC,QAAQ,CAAC,EAAE,gCAAgC,CAAA;CAC5C,GAAG,oBAAoB,KAAG,OAAO,CAAC;IACjC,IAAI,EAAE,IAAI,CAAA;IACV,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAC1B,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/views/Document/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,oBAAoB,EAEpB,IAAI,EACJ,uBAAuB,EACvB,uBAAuB,EAEvB,iBAAiB,EACjB,gBAAgB,EAChB,gCAAgC,EACjC,MAAM,SAAS,CAAA;AAehB,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,uBAAuB,CAAA;AAcrE,eAAO,MAAM,gBAAgB,EAAE,wBAAiE,CAAA;AAEhG,MAAM,MAAM,YAAY,GACpB,iBAAiB,GACjB,gBAAgB,CAAC,uBAAuB,CAAC,GACzC,KAAK,CAAC,EAAE,GACR,KAAK,CAAC,EAAE,CAAC,uBAAuB,CAAC,CAAA;AAErC;;;;;GAKG;AACH,eAAO,MAAM,cAAc,6PAgBxB;IACD,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,wBAAwB,CAAC,EAAE,OAAO,CAAA;IAClC,QAAQ,CAAC,mBAAmB,CAAC,EAAE,OAAO,CAAA;IACtC,QAAQ,CAAC,mBAAmB,CAAC,EAAE,OAAO,CAAA;IACtC,QAAQ,CAAC,sBAAsB,CAAC,EAAE,OAAO,CAAA;IACzC,QAAQ,CAAC,oBAAoB,CAAC,EAAE,OAAO,CAAA;IACvC,QAAQ,CAAC,EAAE,gCAAgC,CAAA;CAC5C,GAAG,oBAAoB,KAAG,OAAO,CAAC;IACjC,IAAI,EAAE,IAAI,CAAA;IACV,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAC1B,CAsXA,CAAA;AAED,wBAAsB,YAAY,CAAC,KAAK,EAAE,oBAAoB,+QAe7D"}
|
|
@@ -6,7 +6,7 @@ import { isEditing as getIsEditing } from '@payloadcms/ui/shared';
|
|
|
6
6
|
import { buildFormState } from '@payloadcms/ui/utilities/buildFormState';
|
|
7
7
|
import { notFound, redirect } from 'next/navigation.js';
|
|
8
8
|
import { isolateObjectProperty, logError } from 'payload';
|
|
9
|
-
import { formatAdminURL, hasAutosaveEnabled, hasDraftsEnabled } from 'payload/shared';
|
|
9
|
+
import { formatAdminURL, formatApiURL, hasAutosaveEnabled, hasDraftsEnabled } from 'payload/shared';
|
|
10
10
|
import React from 'react';
|
|
11
11
|
import { DocumentHeader } from '../../elements/DocumentHeader/index.js';
|
|
12
12
|
import { getPreferences } from '../../utilities/getPreferences.js';
|
|
@@ -214,7 +214,11 @@ export const renderDocument = async ({
|
|
|
214
214
|
formattedParams.append('locale', locale.code);
|
|
215
215
|
}
|
|
216
216
|
const apiQueryParams = `?${formattedParams.toString()}`;
|
|
217
|
-
const apiURL =
|
|
217
|
+
const apiURL = formatApiURL({
|
|
218
|
+
apiRoute,
|
|
219
|
+
path: collectionSlug ? `/${collectionSlug}/${idFromArgs}${apiQueryParams}` : globalSlug ? `/${globalSlug}${apiQueryParams}` : '',
|
|
220
|
+
serverURL
|
|
221
|
+
});
|
|
218
222
|
let View = null;
|
|
219
223
|
let showHeader = true;
|
|
220
224
|
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;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["DocumentInfoProvider","EditDepthProvider","HydrateAuthProvider","LivePreviewProvider","RenderServerComponent","handleLivePreview","handlePreview","isEditing","getIsEditing","buildFormState","notFound","redirect","isolateObjectProperty","logError","formatAdminURL","hasAutosaveEnabled","hasDraftsEnabled","React","DocumentHeader","getPreferences","NotFoundView","getDocPreferences","getDocumentData","getDocumentPermissions","getDocumentView","getIsLocked","getMetaBySegment","getVersions","renderDocumentSlots","generateMetadata","args","renderDocument","disableActions","documentSubViewType","drawerSlug","importMap","initialData","initPageResult","overrideEntityVisibility","params","redirectAfterCreate","redirectAfterDelete","redirectAfterDuplicate","redirectAfterRestore","searchParams","versions","viewType","collectionConfig","docID","idFromArgs","globalConfig","locale","permissions","req","i18n","payload","config","routes","admin","adminRoute","api","apiRoute","serverURL","user","visibleEntities","segments","Array","isArray","collectionSlug","slug","undefined","globalSlug","id","doc","redirectURL","path","encodeURIComponent","Error","isTrashedDoc","Boolean","deletedAt","reqForPermissions","transactionID","reqForLockCheck","docPreferences","docPermissions","hasPublishPermission","hasSavePermission","currentEditor","isLocked","lastUpdateTime","entityPreferences","Promise","all","data","collection","operation","hasPublishedDoc","mostRecentVersionIsAutosaved","unpublishedVersionCount","versionCount","state","formState","code","fallbackLocale","readOnly","renderAllFields","schemaPath","skipValidation","documentViewServerProps","routeSegments","collections","find","visibleSlug","globals","formattedParams","URLSearchParams","append","apiQueryParams","toString","apiURL","View","showHeader","RootViewOverride","components","views","edit","root","Component","shouldAutosave","validateDraftData","drafts","validate","create","depth","draft","documentSlots","Description","clientProps","isLivePreviewEnabled","livePreviewConfig","livePreviewURL","isPreviewEnabled","previewURL","Document","_jsx","initialState","isTrashed","_jsxs","breakpoints","isLivePreviewing","value","editViewType","typeofLivePreviewURL","url","AfterHeader","serverProps","DocumentView","props","RenderedDocument","error","message","err"],"sources":["../../../src/views/Document/index.tsx"],"sourcesContent":["import type {\n AdminViewServerProps,\n CollectionPreferences,\n Data,\n DocumentViewClientProps,\n DocumentViewServerProps,\n DocumentViewServerPropsOnly,\n EditViewComponent,\n PayloadComponent,\n RenderDocumentVersionsProperties,\n} from 'payload'\n\nimport {\n DocumentInfoProvider,\n EditDepthProvider,\n HydrateAuthProvider,\n LivePreviewProvider,\n} from '@payloadcms/ui'\nimport { RenderServerComponent } from '@payloadcms/ui/elements/RenderServerComponent'\nimport { handleLivePreview, handlePreview } from '@payloadcms/ui/rsc'\nimport { isEditing as getIsEditing } from '@payloadcms/ui/shared'\nimport { buildFormState } from '@payloadcms/ui/utilities/buildFormState'\nimport { notFound, redirect } from 'next/navigation.js'\nimport { isolateObjectProperty, logError } from 'payload'\nimport { formatAdminURL, hasAutosaveEnabled, hasDraftsEnabled } from 'payload/shared'\nimport React from 'react'\n\nimport type { GenerateEditViewMetadata } from './getMetaBySegment.js'\n\nimport { DocumentHeader } from '../../elements/DocumentHeader/index.js'\nimport { getPreferences } from '../../utilities/getPreferences.js'\nimport { NotFoundView } from '../NotFound/index.js'\nimport { getDocPreferences } from './getDocPreferences.js'\nimport { getDocumentData } from './getDocumentData.js'\nimport { getDocumentPermissions } from './getDocumentPermissions.js'\nimport { getDocumentView } from './getDocumentView.js'\nimport { getIsLocked } from './getIsLocked.js'\nimport { getMetaBySegment } from './getMetaBySegment.js'\nimport { getVersions } from './getVersions.js'\nimport { renderDocumentSlots } from './renderDocumentSlots.js'\n\nexport const generateMetadata: GenerateEditViewMetadata = async (args) => getMetaBySegment(args)\n\nexport type ViewToRender =\n | EditViewComponent\n | PayloadComponent<DocumentViewServerProps>\n | React.FC\n | React.FC<DocumentViewClientProps>\n\n/**\n * This function is responsible for rendering\n * an Edit Document view on the server for both:\n * - default document edit views\n * - on-demand edit views within drawers\n */\nexport const renderDocument = async ({\n disableActions,\n documentSubViewType,\n drawerSlug,\n importMap,\n initialData,\n initPageResult,\n overrideEntityVisibility,\n params,\n redirectAfterCreate,\n redirectAfterDelete,\n redirectAfterDuplicate,\n redirectAfterRestore,\n searchParams,\n versions,\n viewType,\n}: {\n drawerSlug?: string\n overrideEntityVisibility?: boolean\n readonly redirectAfterCreate?: boolean\n readonly redirectAfterDelete?: boolean\n readonly redirectAfterDuplicate?: boolean\n readonly redirectAfterRestore?: boolean\n versions?: RenderDocumentVersionsProperties\n} & AdminViewServerProps): Promise<{\n data: Data\n Document: React.ReactNode\n}> => {\n const {\n collectionConfig,\n docID: idFromArgs,\n globalConfig,\n locale,\n permissions,\n req,\n req: {\n i18n,\n payload,\n payload: {\n config,\n config: {\n routes: { admin: adminRoute, api: apiRoute },\n serverURL,\n },\n },\n user,\n },\n visibleEntities,\n } = initPageResult\n\n const segments = Array.isArray(params?.segments) ? params.segments : []\n const collectionSlug = collectionConfig?.slug || undefined\n const globalSlug = globalConfig?.slug || undefined\n let isEditing = getIsEditing({ id: idFromArgs, collectionSlug, globalSlug })\n\n // Fetch the doc required for the view\n let doc =\n !idFromArgs && !globalSlug\n ? initialData || null\n : await getDocumentData({\n id: idFromArgs,\n collectionSlug,\n globalSlug,\n locale,\n payload,\n req,\n segments,\n user,\n })\n\n if (isEditing && !doc) {\n // If it's a collection document that doesn't exist, redirect to collection list\n if (collectionSlug) {\n const redirectURL = formatAdminURL({\n adminRoute,\n path: `/collections/${collectionSlug}?notFound=${encodeURIComponent(idFromArgs)}`,\n serverURL,\n })\n redirect(redirectURL)\n } else {\n // For globals or other cases, keep the 404 behavior\n throw new Error('not-found')\n }\n }\n\n const isTrashedDoc = Boolean(doc && 'deletedAt' in doc && typeof doc?.deletedAt === 'string')\n\n // CRITICAL FIX FOR TRANSACTION RACE CONDITION:\n // When running parallel operations with Promise.all, if they share the same req object\n // and one operation calls initTransaction() which MUTATES req.transactionID, that mutation\n // is visible to all parallel operations. This causes:\n // 1. Operation A (e.g., getDocumentPermissions → docAccessOperation) calls initTransaction()\n // which sets req.transactionID = Promise, then resolves it to a UUID\n // 2. Operation B (e.g., getIsLocked) running in parallel receives the SAME req with the mutated transactionID\n // 3. Operation A (does not even know that Operation B even exists and is stil using the transactionID) commits/ends its transaction\n // 4. Operation B tries to use the now-expired session → MongoExpiredSessionError!\n //\n // Solution: Use isolateObjectProperty to create a Proxy that isolates the 'transactionID' property.\n // This allows each operation to have its own transactionID without affecting the parent req.\n // If parent req already has a transaction, preserve it (don't isolate), since this\n // issue only arises when one of the operations calls initTransaction() themselves -\n // because then, that operation will also try to commit/end the transaction itself.\n\n // If the transactionID is already set, the parallel operations will not try to\n // commit/end the transaction themselves, so we don't need to isolate the\n // transactionID property.\n const reqForPermissions = req.transactionID ? req : isolateObjectProperty(req, 'transactionID')\n const reqForLockCheck = req.transactionID ? req : isolateObjectProperty(req, 'transactionID')\n\n const [\n docPreferences,\n { docPermissions, hasPublishPermission, hasSavePermission },\n { currentEditor, isLocked, lastUpdateTime },\n entityPreferences,\n ] = await Promise.all([\n // Get document preferences\n getDocPreferences({\n id: idFromArgs,\n collectionSlug,\n globalSlug,\n payload,\n user,\n }),\n\n // Get permissions - isolated transactionID prevents cross-contamination\n getDocumentPermissions({\n id: idFromArgs,\n collectionConfig,\n data: doc,\n globalConfig,\n req: reqForPermissions,\n }),\n\n // Fetch document lock state - isolated transactionID prevents cross-contamination\n getIsLocked({\n id: idFromArgs,\n collectionConfig,\n globalConfig,\n isEditing,\n req: reqForLockCheck,\n }),\n\n // get entity preferences\n getPreferences<CollectionPreferences>(\n collectionSlug ? `collection-${collectionSlug}` : `global-${globalSlug}`,\n payload,\n req.user.id,\n req.user.collection,\n ),\n ])\n\n const operation = (collectionSlug && idFromArgs) || globalSlug ? 'update' : 'create'\n\n const [\n { hasPublishedDoc, mostRecentVersionIsAutosaved, unpublishedVersionCount, versionCount },\n { state: formState },\n ] = await Promise.all([\n getVersions({\n id: idFromArgs,\n collectionConfig,\n doc,\n docPermissions,\n globalConfig,\n locale: locale?.code,\n payload,\n user,\n }),\n buildFormState({\n id: idFromArgs,\n collectionSlug,\n data: doc,\n docPermissions,\n docPreferences,\n fallbackLocale: false,\n globalSlug,\n locale: locale?.code,\n operation,\n readOnly: isTrashedDoc || isLocked,\n renderAllFields: true,\n req,\n schemaPath: collectionSlug || globalSlug,\n skipValidation: true,\n }),\n ])\n\n const documentViewServerProps: DocumentViewServerPropsOnly = {\n doc,\n hasPublishedDoc,\n i18n,\n initPageResult,\n locale,\n params,\n payload,\n permissions,\n routeSegments: segments,\n searchParams,\n user,\n versions,\n }\n\n if (\n !overrideEntityVisibility &&\n ((collectionSlug &&\n !visibleEntities?.collections?.find((visibleSlug) => visibleSlug === collectionSlug)) ||\n (globalSlug && !visibleEntities?.globals?.find((visibleSlug) => visibleSlug === globalSlug)))\n ) {\n throw new Error('not-found')\n }\n\n const formattedParams = new URLSearchParams()\n\n if (hasDraftsEnabled(collectionConfig || globalConfig)) {\n formattedParams.append('draft', 'true')\n }\n\n if (locale?.code) {\n formattedParams.append('locale', locale.code)\n }\n\n const apiQueryParams = `?${formattedParams.toString()}`\n\n const apiURL = collectionSlug\n ? `${serverURL}${apiRoute}/${collectionSlug}/${idFromArgs}${apiQueryParams}`\n : globalSlug\n ? `${serverURL}${apiRoute}/${globalSlug}${apiQueryParams}`\n : ''\n\n let View: ViewToRender = null\n\n let showHeader = true\n\n const RootViewOverride =\n collectionConfig?.admin?.components?.views?.edit?.root &&\n 'Component' in collectionConfig.admin.components.views.edit.root\n ? collectionConfig?.admin?.components?.views?.edit?.root?.Component\n : globalConfig?.admin?.components?.views?.edit?.root &&\n 'Component' in globalConfig.admin.components.views.edit.root\n ? globalConfig?.admin?.components?.views?.edit?.root?.Component\n : null\n\n if (RootViewOverride) {\n View = RootViewOverride\n showHeader = false\n } else {\n ;({ View } = getDocumentView({\n collectionConfig,\n config,\n docPermissions,\n globalConfig,\n routeSegments: segments,\n }))\n }\n\n if (!View) {\n View = NotFoundView\n }\n\n /**\n * Handle case where autoSave is enabled and the document is being created\n * => create document and redirect\n */\n const shouldAutosave = hasSavePermission && hasAutosaveEnabled(collectionConfig || globalConfig)\n\n const validateDraftData =\n collectionConfig?.versions?.drafts && collectionConfig?.versions?.drafts?.validate\n\n let id = idFromArgs\n\n if (shouldAutosave && !validateDraftData && !idFromArgs && collectionSlug) {\n doc = await payload.create({\n collection: collectionSlug,\n data: initialData || {},\n depth: 0,\n draft: true,\n fallbackLocale: false,\n locale: locale?.code,\n req,\n user,\n })\n\n if (doc?.id) {\n id = doc.id\n isEditing = getIsEditing({ id: doc.id, collectionSlug, globalSlug })\n\n if (!drawerSlug && redirectAfterCreate !== false) {\n const redirectURL = formatAdminURL({\n adminRoute,\n path: `/collections/${collectionSlug}/${doc.id}`,\n serverURL,\n })\n\n redirect(redirectURL)\n }\n } else {\n throw new Error('not-found')\n }\n }\n\n const documentSlots = renderDocumentSlots({\n id,\n collectionConfig,\n globalConfig,\n hasSavePermission,\n permissions: docPermissions,\n req,\n })\n\n // Extract Description from documentSlots to pass to DocumentHeader\n const { Description } = documentSlots\n\n const clientProps: DocumentViewClientProps = {\n formState,\n ...documentSlots,\n documentSubViewType,\n viewType,\n }\n\n const { isLivePreviewEnabled, livePreviewConfig, livePreviewURL } = await handleLivePreview({\n collectionSlug,\n config,\n data: doc,\n globalSlug,\n operation,\n req,\n })\n\n const { isPreviewEnabled, previewURL } = await handlePreview({\n collectionSlug,\n config,\n data: doc,\n globalSlug,\n operation,\n req,\n })\n\n return {\n data: doc,\n Document: (\n <DocumentInfoProvider\n apiURL={apiURL}\n collectionSlug={collectionConfig?.slug}\n currentEditor={currentEditor}\n disableActions={disableActions ?? false}\n docPermissions={docPermissions}\n globalSlug={globalConfig?.slug}\n hasPublishedDoc={hasPublishedDoc}\n hasPublishPermission={hasPublishPermission}\n hasSavePermission={hasSavePermission}\n id={id}\n initialData={doc}\n initialState={formState}\n isEditing={isEditing}\n isLocked={isLocked}\n isTrashed={isTrashedDoc}\n key={locale?.code}\n lastUpdateTime={lastUpdateTime}\n mostRecentVersionIsAutosaved={mostRecentVersionIsAutosaved}\n redirectAfterCreate={redirectAfterCreate}\n redirectAfterDelete={redirectAfterDelete}\n redirectAfterDuplicate={redirectAfterDuplicate}\n redirectAfterRestore={redirectAfterRestore}\n unpublishedVersionCount={unpublishedVersionCount}\n versionCount={versionCount}\n >\n <LivePreviewProvider\n breakpoints={livePreviewConfig?.breakpoints}\n isLivePreviewEnabled={isLivePreviewEnabled && operation !== 'create'}\n isLivePreviewing={Boolean(\n entityPreferences?.value?.editViewType === 'live-preview' && livePreviewURL,\n )}\n isPreviewEnabled={Boolean(isPreviewEnabled)}\n previewURL={previewURL}\n typeofLivePreviewURL={typeof livePreviewConfig?.url as 'function' | 'string' | undefined}\n url={livePreviewURL}\n >\n {showHeader && !drawerSlug && (\n <DocumentHeader\n AfterHeader={Description}\n collectionConfig={collectionConfig}\n globalConfig={globalConfig}\n permissions={permissions}\n req={req}\n />\n )}\n <HydrateAuthProvider permissions={permissions} />\n <EditDepthProvider>\n {RenderServerComponent({\n clientProps,\n Component: View,\n importMap,\n serverProps: documentViewServerProps,\n })}\n </EditDepthProvider>\n </LivePreviewProvider>\n </DocumentInfoProvider>\n ),\n }\n}\n\nexport async function DocumentView(props: AdminViewServerProps) {\n try {\n const { Document: RenderedDocument } = await renderDocument(props)\n return RenderedDocument\n } catch (error) {\n if (error?.message === 'NEXT_REDIRECT') {\n throw error\n }\n\n logError({ err: error, payload: props.initPageResult.req.payload })\n\n if (error.message === 'not-found') {\n notFound()\n }\n }\n}\n"],"mappings":";AAYA,SACEA,oBAAoB,EACpBC,iBAAiB,EACjBC,mBAAmB,EACnBC,mBAAmB,QACd;AACP,SAASC,qBAAqB,QAAQ;AACtC,SAASC,iBAAiB,EAAEC,aAAa,QAAQ;AACjD,SAASC,SAAA,IAAaC,YAAY,QAAQ;AAC1C,SAASC,cAAc,QAAQ;AAC/B,SAASC,QAAQ,EAAEC,QAAQ,QAAQ;AACnC,SAASC,qBAAqB,EAAEC,QAAQ,QAAQ;AAChD,SAASC,cAAc,EAAEC,kBAAkB,EAAEC,gBAAgB,QAAQ;AACrE,OAAOC,KAAA,MAAW;AAIlB,SAASC,cAAc,QAAQ;AAC/B,SAASC,cAAc,QAAQ;AAC/B,SAASC,YAAY,QAAQ;AAC7B,SAASC,iBAAiB,QAAQ;AAClC,SAASC,eAAe,QAAQ;AAChC,SAASC,sBAAsB,QAAQ;AACvC,SAASC,eAAe,QAAQ;AAChC,SAASC,WAAW,QAAQ;AAC5B,SAASC,gBAAgB,QAAQ;AACjC,SAASC,WAAW,QAAQ;AAC5B,SAASC,mBAAmB,QAAQ;AAEpC,OAAO,MAAMC,gBAAA,GAA6C,MAAOC,IAAA,IAASJ,gBAAA,CAAiBI,IAAA;AAQ3F;;;;;;AAMA,OAAO,MAAMC,cAAA,GAAiB,MAAAA,CAAO;EACnCC,cAAc;EACdC,mBAAmB;EACnBC,UAAU;EACVC,SAAS;EACTC,WAAW;EACXC,cAAc;EACdC,wBAAwB;EACxBC,MAAM;EACNC,mBAAmB;EACnBC,mBAAmB;EACnBC,sBAAsB;EACtB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A,EAASuG,KAAA,CAAMzH,cAAc,CAACgB,GAAG,CAACE;IAAQ;IAEjE,IAAIyG,KAAA,CAAMC,OAAO,KAAK,aAAa;MACjCvJ,QAAA;IACF;EACF;AACF","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"index.js","names":["DocumentInfoProvider","EditDepthProvider","HydrateAuthProvider","LivePreviewProvider","RenderServerComponent","handleLivePreview","handlePreview","isEditing","getIsEditing","buildFormState","notFound","redirect","isolateObjectProperty","logError","formatAdminURL","formatApiURL","hasAutosaveEnabled","hasDraftsEnabled","React","DocumentHeader","getPreferences","NotFoundView","getDocPreferences","getDocumentData","getDocumentPermissions","getDocumentView","getIsLocked","getMetaBySegment","getVersions","renderDocumentSlots","generateMetadata","args","renderDocument","disableActions","documentSubViewType","drawerSlug","importMap","initialData","initPageResult","overrideEntityVisibility","params","redirectAfterCreate","redirectAfterDelete","redirectAfterDuplicate","redirectAfterRestore","searchParams","versions","viewType","collectionConfig","docID","idFromArgs","globalConfig","locale","permissions","req","i18n","payload","config","routes","admin","adminRoute","api","apiRoute","serverURL","user","visibleEntities","segments","Array","isArray","collectionSlug","slug","undefined","globalSlug","id","doc","redirectURL","path","encodeURIComponent","Error","isTrashedDoc","Boolean","deletedAt","reqForPermissions","transactionID","reqForLockCheck","docPreferences","docPermissions","hasPublishPermission","hasSavePermission","currentEditor","isLocked","lastUpdateTime","entityPreferences","Promise","all","data","collection","operation","hasPublishedDoc","mostRecentVersionIsAutosaved","unpublishedVersionCount","versionCount","state","formState","code","fallbackLocale","readOnly","renderAllFields","schemaPath","skipValidation","documentViewServerProps","routeSegments","collections","find","visibleSlug","globals","formattedParams","URLSearchParams","append","apiQueryParams","toString","apiURL","View","showHeader","RootViewOverride","components","views","edit","root","Component","shouldAutosave","validateDraftData","drafts","validate","create","depth","draft","documentSlots","Description","clientProps","isLivePreviewEnabled","livePreviewConfig","livePreviewURL","isPreviewEnabled","previewURL","Document","_jsx","initialState","isTrashed","_jsxs","breakpoints","isLivePreviewing","value","editViewType","typeofLivePreviewURL","url","AfterHeader","serverProps","DocumentView","props","RenderedDocument","error","message","err"],"sources":["../../../src/views/Document/index.tsx"],"sourcesContent":["import type {\n AdminViewServerProps,\n CollectionPreferences,\n Data,\n DocumentViewClientProps,\n DocumentViewServerProps,\n DocumentViewServerPropsOnly,\n EditViewComponent,\n PayloadComponent,\n RenderDocumentVersionsProperties,\n} from 'payload'\n\nimport {\n DocumentInfoProvider,\n EditDepthProvider,\n HydrateAuthProvider,\n LivePreviewProvider,\n} from '@payloadcms/ui'\nimport { RenderServerComponent } from '@payloadcms/ui/elements/RenderServerComponent'\nimport { handleLivePreview, handlePreview } from '@payloadcms/ui/rsc'\nimport { isEditing as getIsEditing } from '@payloadcms/ui/shared'\nimport { buildFormState } from '@payloadcms/ui/utilities/buildFormState'\nimport { notFound, redirect } from 'next/navigation.js'\nimport { isolateObjectProperty, logError } from 'payload'\nimport { formatAdminURL, formatApiURL, hasAutosaveEnabled, hasDraftsEnabled } from 'payload/shared'\nimport React from 'react'\n\nimport type { GenerateEditViewMetadata } from './getMetaBySegment.js'\n\nimport { DocumentHeader } from '../../elements/DocumentHeader/index.js'\nimport { getPreferences } from '../../utilities/getPreferences.js'\nimport { NotFoundView } from '../NotFound/index.js'\nimport { getDocPreferences } from './getDocPreferences.js'\nimport { getDocumentData } from './getDocumentData.js'\nimport { getDocumentPermissions } from './getDocumentPermissions.js'\nimport { getDocumentView } from './getDocumentView.js'\nimport { getIsLocked } from './getIsLocked.js'\nimport { getMetaBySegment } from './getMetaBySegment.js'\nimport { getVersions } from './getVersions.js'\nimport { renderDocumentSlots } from './renderDocumentSlots.js'\n\nexport const generateMetadata: GenerateEditViewMetadata = async (args) => getMetaBySegment(args)\n\nexport type ViewToRender =\n | EditViewComponent\n | PayloadComponent<DocumentViewServerProps>\n | React.FC\n | React.FC<DocumentViewClientProps>\n\n/**\n * This function is responsible for rendering\n * an Edit Document view on the server for both:\n * - default document edit views\n * - on-demand edit views within drawers\n */\nexport const renderDocument = async ({\n disableActions,\n documentSubViewType,\n drawerSlug,\n importMap,\n initialData,\n initPageResult,\n overrideEntityVisibility,\n params,\n redirectAfterCreate,\n redirectAfterDelete,\n redirectAfterDuplicate,\n redirectAfterRestore,\n searchParams,\n versions,\n viewType,\n}: {\n drawerSlug?: string\n overrideEntityVisibility?: boolean\n readonly redirectAfterCreate?: boolean\n readonly redirectAfterDelete?: boolean\n readonly redirectAfterDuplicate?: boolean\n readonly redirectAfterRestore?: boolean\n versions?: RenderDocumentVersionsProperties\n} & AdminViewServerProps): Promise<{\n data: Data\n Document: React.ReactNode\n}> => {\n const {\n collectionConfig,\n docID: idFromArgs,\n globalConfig,\n locale,\n permissions,\n req,\n req: {\n i18n,\n payload,\n payload: {\n config,\n config: {\n routes: { admin: adminRoute, api: apiRoute },\n serverURL,\n },\n },\n user,\n },\n visibleEntities,\n } = initPageResult\n\n const segments = Array.isArray(params?.segments) ? params.segments : []\n const collectionSlug = collectionConfig?.slug || undefined\n const globalSlug = globalConfig?.slug || undefined\n let isEditing = getIsEditing({ id: idFromArgs, collectionSlug, globalSlug })\n\n // Fetch the doc required for the view\n let doc =\n !idFromArgs && !globalSlug\n ? initialData || null\n : await getDocumentData({\n id: idFromArgs,\n collectionSlug,\n globalSlug,\n locale,\n payload,\n req,\n segments,\n user,\n })\n\n if (isEditing && !doc) {\n // If it's a collection document that doesn't exist, redirect to collection list\n if (collectionSlug) {\n const redirectURL = formatAdminURL({\n adminRoute,\n path: `/collections/${collectionSlug}?notFound=${encodeURIComponent(idFromArgs)}`,\n serverURL,\n })\n redirect(redirectURL)\n } else {\n // For globals or other cases, keep the 404 behavior\n throw new Error('not-found')\n }\n }\n\n const isTrashedDoc = Boolean(doc && 'deletedAt' in doc && typeof doc?.deletedAt === 'string')\n\n // CRITICAL FIX FOR TRANSACTION RACE CONDITION:\n // When running parallel operations with Promise.all, if they share the same req object\n // and one operation calls initTransaction() which MUTATES req.transactionID, that mutation\n // is visible to all parallel operations. This causes:\n // 1. Operation A (e.g., getDocumentPermissions → docAccessOperation) calls initTransaction()\n // which sets req.transactionID = Promise, then resolves it to a UUID\n // 2. Operation B (e.g., getIsLocked) running in parallel receives the SAME req with the mutated transactionID\n // 3. Operation A (does not even know that Operation B even exists and is stil using the transactionID) commits/ends its transaction\n // 4. Operation B tries to use the now-expired session → MongoExpiredSessionError!\n //\n // Solution: Use isolateObjectProperty to create a Proxy that isolates the 'transactionID' property.\n // This allows each operation to have its own transactionID without affecting the parent req.\n // If parent req already has a transaction, preserve it (don't isolate), since this\n // issue only arises when one of the operations calls initTransaction() themselves -\n // because then, that operation will also try to commit/end the transaction itself.\n\n // If the transactionID is already set, the parallel operations will not try to\n // commit/end the transaction themselves, so we don't need to isolate the\n // transactionID property.\n const reqForPermissions = req.transactionID ? req : isolateObjectProperty(req, 'transactionID')\n const reqForLockCheck = req.transactionID ? req : isolateObjectProperty(req, 'transactionID')\n\n const [\n docPreferences,\n { docPermissions, hasPublishPermission, hasSavePermission },\n { currentEditor, isLocked, lastUpdateTime },\n entityPreferences,\n ] = await Promise.all([\n // Get document preferences\n getDocPreferences({\n id: idFromArgs,\n collectionSlug,\n globalSlug,\n payload,\n user,\n }),\n\n // Get permissions - isolated transactionID prevents cross-contamination\n getDocumentPermissions({\n id: idFromArgs,\n collectionConfig,\n data: doc,\n globalConfig,\n req: reqForPermissions,\n }),\n\n // Fetch document lock state - isolated transactionID prevents cross-contamination\n getIsLocked({\n id: idFromArgs,\n collectionConfig,\n globalConfig,\n isEditing,\n req: reqForLockCheck,\n }),\n\n // get entity preferences\n getPreferences<CollectionPreferences>(\n collectionSlug ? `collection-${collectionSlug}` : `global-${globalSlug}`,\n payload,\n req.user.id,\n req.user.collection,\n ),\n ])\n\n const operation = (collectionSlug && idFromArgs) || globalSlug ? 'update' : 'create'\n\n const [\n { hasPublishedDoc, mostRecentVersionIsAutosaved, unpublishedVersionCount, versionCount },\n { state: formState },\n ] = await Promise.all([\n getVersions({\n id: idFromArgs,\n collectionConfig,\n doc,\n docPermissions,\n globalConfig,\n locale: locale?.code,\n payload,\n user,\n }),\n buildFormState({\n id: idFromArgs,\n collectionSlug,\n data: doc,\n docPermissions,\n docPreferences,\n fallbackLocale: false,\n globalSlug,\n locale: locale?.code,\n operation,\n readOnly: isTrashedDoc || isLocked,\n renderAllFields: true,\n req,\n schemaPath: collectionSlug || globalSlug,\n skipValidation: true,\n }),\n ])\n\n const documentViewServerProps: DocumentViewServerPropsOnly = {\n doc,\n hasPublishedDoc,\n i18n,\n initPageResult,\n locale,\n params,\n payload,\n permissions,\n routeSegments: segments,\n searchParams,\n user,\n versions,\n }\n\n if (\n !overrideEntityVisibility &&\n ((collectionSlug &&\n !visibleEntities?.collections?.find((visibleSlug) => visibleSlug === collectionSlug)) ||\n (globalSlug && !visibleEntities?.globals?.find((visibleSlug) => visibleSlug === globalSlug)))\n ) {\n throw new Error('not-found')\n }\n\n const formattedParams = new URLSearchParams()\n\n if (hasDraftsEnabled(collectionConfig || globalConfig)) {\n formattedParams.append('draft', 'true')\n }\n\n if (locale?.code) {\n formattedParams.append('locale', locale.code)\n }\n\n const apiQueryParams = `?${formattedParams.toString()}`\n\n const apiURL = formatApiURL({\n apiRoute,\n path: collectionSlug\n ? `/${collectionSlug}/${idFromArgs}${apiQueryParams}`\n : globalSlug\n ? `/${globalSlug}${apiQueryParams}`\n : '',\n serverURL,\n })\n\n let View: ViewToRender = null\n\n let showHeader = true\n\n const RootViewOverride =\n collectionConfig?.admin?.components?.views?.edit?.root &&\n 'Component' in collectionConfig.admin.components.views.edit.root\n ? collectionConfig?.admin?.components?.views?.edit?.root?.Component\n : globalConfig?.admin?.components?.views?.edit?.root &&\n 'Component' in globalConfig.admin.components.views.edit.root\n ? globalConfig?.admin?.components?.views?.edit?.root?.Component\n : null\n\n if (RootViewOverride) {\n View = RootViewOverride\n showHeader = false\n } else {\n ;({ View } = getDocumentView({\n collectionConfig,\n config,\n docPermissions,\n globalConfig,\n routeSegments: segments,\n }))\n }\n\n if (!View) {\n View = NotFoundView\n }\n\n /**\n * Handle case where autoSave is enabled and the document is being created\n * => create document and redirect\n */\n const shouldAutosave = hasSavePermission && hasAutosaveEnabled(collectionConfig || globalConfig)\n\n const validateDraftData =\n collectionConfig?.versions?.drafts && collectionConfig?.versions?.drafts?.validate\n\n let id = idFromArgs\n\n if (shouldAutosave && !validateDraftData && !idFromArgs && collectionSlug) {\n doc = await payload.create({\n collection: collectionSlug,\n data: initialData || {},\n depth: 0,\n draft: true,\n fallbackLocale: false,\n locale: locale?.code,\n req,\n user,\n })\n\n if (doc?.id) {\n id = doc.id\n isEditing = getIsEditing({ id: doc.id, collectionSlug, globalSlug })\n\n if (!drawerSlug && redirectAfterCreate !== false) {\n const redirectURL = formatAdminURL({\n adminRoute,\n path: `/collections/${collectionSlug}/${doc.id}`,\n serverURL,\n })\n\n redirect(redirectURL)\n }\n } else {\n throw new Error('not-found')\n }\n }\n\n const documentSlots = renderDocumentSlots({\n id,\n collectionConfig,\n globalConfig,\n hasSavePermission,\n permissions: docPermissions,\n req,\n })\n\n // Extract Description from documentSlots to pass to DocumentHeader\n const { Description } = documentSlots\n\n const clientProps: DocumentViewClientProps = {\n formState,\n ...documentSlots,\n documentSubViewType,\n viewType,\n }\n\n const { isLivePreviewEnabled, livePreviewConfig, livePreviewURL } = await handleLivePreview({\n collectionSlug,\n config,\n data: doc,\n globalSlug,\n operation,\n req,\n })\n\n const { isPreviewEnabled, previewURL } = await handlePreview({\n collectionSlug,\n config,\n data: doc,\n globalSlug,\n operation,\n req,\n })\n\n return {\n data: doc,\n Document: (\n <DocumentInfoProvider\n apiURL={apiURL}\n collectionSlug={collectionConfig?.slug}\n currentEditor={currentEditor}\n disableActions={disableActions ?? false}\n docPermissions={docPermissions}\n globalSlug={globalConfig?.slug}\n hasPublishedDoc={hasPublishedDoc}\n hasPublishPermission={hasPublishPermission}\n hasSavePermission={hasSavePermission}\n id={id}\n initialData={doc}\n initialState={formState}\n isEditing={isEditing}\n isLocked={isLocked}\n isTrashed={isTrashedDoc}\n key={locale?.code}\n lastUpdateTime={lastUpdateTime}\n mostRecentVersionIsAutosaved={mostRecentVersionIsAutosaved}\n redirectAfterCreate={redirectAfterCreate}\n redirectAfterDelete={redirectAfterDelete}\n redirectAfterDuplicate={redirectAfterDuplicate}\n redirectAfterRestore={redirectAfterRestore}\n unpublishedVersionCount={unpublishedVersionCount}\n versionCount={versionCount}\n >\n <LivePreviewProvider\n breakpoints={livePreviewConfig?.breakpoints}\n isLivePreviewEnabled={isLivePreviewEnabled && operation !== 'create'}\n isLivePreviewing={Boolean(\n entityPreferences?.value?.editViewType === 'live-preview' && livePreviewURL,\n )}\n isPreviewEnabled={Boolean(isPreviewEnabled)}\n previewURL={previewURL}\n typeofLivePreviewURL={typeof livePreviewConfig?.url as 'function' | 'string' | undefined}\n url={livePreviewURL}\n >\n {showHeader && !drawerSlug && (\n <DocumentHeader\n AfterHeader={Description}\n collectionConfig={collectionConfig}\n globalConfig={globalConfig}\n permissions={permissions}\n req={req}\n />\n )}\n <HydrateAuthProvider permissions={permissions} />\n <EditDepthProvider>\n {RenderServerComponent({\n clientProps,\n Component: View,\n importMap,\n serverProps: documentViewServerProps,\n })}\n </EditDepthProvider>\n </LivePreviewProvider>\n </DocumentInfoProvider>\n ),\n }\n}\n\nexport async function DocumentView(props: AdminViewServerProps) {\n try {\n const { Document: RenderedDocument } = await renderDocument(props)\n return RenderedDocument\n } catch (error) {\n if (error?.message === 'NEXT_REDIRECT') {\n throw error\n }\n\n logError({ err: error, payload: props.initPageResult.req.payload })\n\n if (error.message === 'not-found') {\n notFound()\n }\n }\n}\n"],"mappings":";AAYA,SACEA,oBAAoB,EACpBC,iBAAiB,EACjBC,mBAAmB,EACnBC,mBAAmB,QACd;AACP,SAASC,qBAAqB,QAAQ;AACtC,SAASC,iBAAiB,EAAEC,aAAa,QAAQ;AACjD,SAASC,SAAA,IAAaC,YAAY,QAAQ;AAC1C,SAASC,cAAc,QAAQ;AAC/B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GAAA;QAChDA,GAAA,EAAKb,cAAA;mBAEJnB,UAAA,IAAc,CAACxF,UAAA,iBACd+G,IAAA,CAAC/H,cAAA;UACCyI,WAAA,EAAalB,WAAA;UACb1F,gBAAA,EAAkBA,gBAAA;UAClBG,YAAA,EAAcA,YAAA;UACdE,WAAA,EAAaA,WAAA;UACbC,GAAA,EAAKA;yBAGT4F,IAAA,CAAChJ,mBAAA;UAAoBmD,WAAA,EAAaA;yBAClC6F,IAAA,CAACjJ,iBAAA;oBACEG,qBAAA,CAAsB;YACrBuI,WAAA;YACAV,SAAA,EAAWP,IAAA;YACXtF,SAAA;YACAyH,WAAA,EAAa/C;UACf;;;OArCC1D,MAAA,EAAQoD,IAAA;EA0CnB;AACF;AAEA,OAAO,eAAesD,aAAaC,KAA2B;EAC5D,IAAI;IACF,MAAM;MAAEd,QAAA,EAAUe;IAAgB,CAAE,GAAG,MAAMhI,cAAA,CAAe+H,KAAA;IAC5D,OAAOC,gBAAA;EACT,EAAE,OAAOC,KAAA,EAAO;IACd,IAAIA,KAAA,EAAOC,OAAA,KAAY,iBAAiB;MACtC,MAAMD,KAAA;IACR;IAEApJ,QAAA,CAAS;MAAEsJ,GAAA,EAAKF,KAAA;MAAOzG,OAAA,EAASuG,KAAA,CAAMzH,cAAc,CAACgB,GAAG,CAACE;IAAQ;IAEjE,IAAIyG,KAAA,CAAMC,OAAO,KAAK,aAAa;MACjCxJ,QAAA;IACF;EACF;AACF","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/views/ForgotPassword/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAA;AAKnD,OAAO,KAAmB,MAAM,OAAO,CAAA;AAKvC,eAAO,MAAM,uBAAuB,oBAAoB,CAAA;AAExD,wBAAgB,kBAAkB,CAAC,EAAE,cAAc,EAAE,EAAE,oBAAoB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/views/ForgotPassword/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAA;AAKnD,OAAO,KAAmB,MAAM,OAAO,CAAA;AAKvC,eAAO,MAAM,uBAAuB,oBAAoB,CAAA;AAExD,wBAAgB,kBAAkB,CAAC,EAAE,cAAc,EAAE,EAAE,oBAAoB,qBAiE1E"}
|
|
@@ -27,7 +27,8 @@ export function ForgotPasswordView({
|
|
|
27
27
|
},
|
|
28
28
|
routes: {
|
|
29
29
|
admin: adminRoute
|
|
30
|
-
}
|
|
30
|
+
},
|
|
31
|
+
serverURL
|
|
31
32
|
} = config;
|
|
32
33
|
if (user) {
|
|
33
34
|
return /*#__PURE__*/_jsxs(Fragment, {
|
|
@@ -39,7 +40,8 @@ export function ForgotPasswordView({
|
|
|
39
40
|
}) => /*#__PURE__*/_jsx(Link, {
|
|
40
41
|
href: formatAdminURL({
|
|
41
42
|
adminRoute,
|
|
42
|
-
path: accountRoute
|
|
43
|
+
path: accountRoute,
|
|
44
|
+
serverURL
|
|
43
45
|
}),
|
|
44
46
|
prefetch: false,
|
|
45
47
|
children: children
|
|
@@ -62,7 +64,8 @@ export function ForgotPasswordView({
|
|
|
62
64
|
children: [/*#__PURE__*/_jsx(ForgotPasswordForm, {}), /*#__PURE__*/_jsx(Link, {
|
|
63
65
|
href: formatAdminURL({
|
|
64
66
|
adminRoute,
|
|
65
|
-
path: loginRoute
|
|
67
|
+
path: loginRoute,
|
|
68
|
+
serverURL
|
|
66
69
|
}),
|
|
67
70
|
prefetch: false,
|
|
68
71
|
children: i18n.t('authentication:backToLogin')
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["Button","Link","Translation","formatAdminURL","React","Fragment","FormHeader","ForgotPasswordForm","forgotPasswordBaseClass","ForgotPasswordView","initPageResult","req","i18n","payload","config","user","admin","routes","account","accountRoute","login","loginRoute","adminRoute","_jsxs","_jsx","description","elements","0","children","href","path","prefetch","i18nKey","t","heading","buttonStyle","el","size","to"],"sources":["../../../src/views/ForgotPassword/index.tsx"],"sourcesContent":["import type { AdminViewServerProps } from 'payload'\n\nimport { Button, Link } from '@payloadcms/ui'\nimport { Translation } from '@payloadcms/ui/shared'\nimport { formatAdminURL } from 'payload/shared'\nimport React, { Fragment } from 'react'\n\nimport { FormHeader } from '../../elements/FormHeader/index.js'\nimport { ForgotPasswordForm } from './ForgotPasswordForm/index.js'\n\nexport const forgotPasswordBaseClass = 'forgot-password'\n\nexport function ForgotPasswordView({ initPageResult }: AdminViewServerProps) {\n const {\n req: {\n i18n,\n payload: { config },\n user,\n },\n } = initPageResult\n\n const {\n admin: {\n routes: { account: accountRoute, login: loginRoute },\n },\n routes: { admin: adminRoute },\n } = config\n\n if (user) {\n return (\n <Fragment>\n <FormHeader\n description={\n <Translation\n elements={{\n '0': ({ children }) => (\n <Link\n href={formatAdminURL({\n adminRoute,\n path: accountRoute,\n })}\n prefetch={false}\n >\n {children}\n </Link>\n ),\n }}\n i18nKey=\"authentication:loggedInChangePassword\"\n t={i18n.t}\n />\n }\n heading={i18n.t('authentication:alreadyLoggedIn')}\n />\n <Button buttonStyle=\"secondary\" el=\"link\" size=\"large\" to={adminRoute}>\n {i18n.t('general:backToDashboard')}\n </Button>\n </Fragment>\n )\n }\n\n return (\n <Fragment>\n <ForgotPasswordForm />\n <Link\n href={formatAdminURL({\n adminRoute,\n path: loginRoute,\n })}\n prefetch={false}\n >\n {i18n.t('authentication:backToLogin')}\n </Link>\n </Fragment>\n )\n}\n"],"mappings":";AAEA,SAASA,MAAM,EAAEC,IAAI,QAAQ;AAC7B,SAASC,WAAW,QAAQ;AAC5B,SAASC,cAAc,QAAQ;AAC/B,OAAOC,KAAA,IAASC,QAAQ,QAAQ;AAEhC,SAASC,UAAU,QAAQ;AAC3B,SAASC,kBAAkB,QAAQ;AAEnC,OAAO,MAAMC,uBAAA,GAA0B;AAEvC,OAAO,SAASC,mBAAmB;EAAEC;AAAc,CAAwB;EACzE,MAAM;IACJC,GAAA,EAAK;MACHC,IAAI;MACJC,OAAA,EAAS;QAAEC;MAAM,CAAE;MACnBC;IAAI;EACL,CACF,GAAGL,cAAA;EAEJ,MAAM;IACJM,KAAA,EAAO;MACLC,MAAA,EAAQ;QAAEC,OAAA,EAASC,YAAY;QAAEC,KAAA,EAAOC;MAAU;IAAE,CACrD;IACDJ,MAAA,EAAQ;MAAED,KAAA,EAAOM;IAAU;
|
|
1
|
+
{"version":3,"file":"index.js","names":["Button","Link","Translation","formatAdminURL","React","Fragment","FormHeader","ForgotPasswordForm","forgotPasswordBaseClass","ForgotPasswordView","initPageResult","req","i18n","payload","config","user","admin","routes","account","accountRoute","login","loginRoute","adminRoute","serverURL","_jsxs","_jsx","description","elements","0","children","href","path","prefetch","i18nKey","t","heading","buttonStyle","el","size","to"],"sources":["../../../src/views/ForgotPassword/index.tsx"],"sourcesContent":["import type { AdminViewServerProps } from 'payload'\n\nimport { Button, Link } from '@payloadcms/ui'\nimport { Translation } from '@payloadcms/ui/shared'\nimport { formatAdminURL } from 'payload/shared'\nimport React, { Fragment } from 'react'\n\nimport { FormHeader } from '../../elements/FormHeader/index.js'\nimport { ForgotPasswordForm } from './ForgotPasswordForm/index.js'\n\nexport const forgotPasswordBaseClass = 'forgot-password'\n\nexport function ForgotPasswordView({ initPageResult }: AdminViewServerProps) {\n const {\n req: {\n i18n,\n payload: { config },\n user,\n },\n } = initPageResult\n\n const {\n admin: {\n routes: { account: accountRoute, login: loginRoute },\n },\n routes: { admin: adminRoute },\n serverURL,\n } = config\n\n if (user) {\n return (\n <Fragment>\n <FormHeader\n description={\n <Translation\n elements={{\n '0': ({ children }) => (\n <Link\n href={formatAdminURL({\n adminRoute,\n path: accountRoute,\n serverURL,\n })}\n prefetch={false}\n >\n {children}\n </Link>\n ),\n }}\n i18nKey=\"authentication:loggedInChangePassword\"\n t={i18n.t}\n />\n }\n heading={i18n.t('authentication:alreadyLoggedIn')}\n />\n <Button buttonStyle=\"secondary\" el=\"link\" size=\"large\" to={adminRoute}>\n {i18n.t('general:backToDashboard')}\n </Button>\n </Fragment>\n )\n }\n\n return (\n <Fragment>\n <ForgotPasswordForm />\n <Link\n href={formatAdminURL({\n adminRoute,\n path: loginRoute,\n serverURL,\n })}\n prefetch={false}\n >\n {i18n.t('authentication:backToLogin')}\n </Link>\n </Fragment>\n )\n}\n"],"mappings":";AAEA,SAASA,MAAM,EAAEC,IAAI,QAAQ;AAC7B,SAASC,WAAW,QAAQ;AAC5B,SAASC,cAAc,QAAQ;AAC/B,OAAOC,KAAA,IAASC,QAAQ,QAAQ;AAEhC,SAASC,UAAU,QAAQ;AAC3B,SAASC,kBAAkB,QAAQ;AAEnC,OAAO,MAAMC,uBAAA,GAA0B;AAEvC,OAAO,SAASC,mBAAmB;EAAEC;AAAc,CAAwB;EACzE,MAAM;IACJC,GAAA,EAAK;MACHC,IAAI;MACJC,OAAA,EAAS;QAAEC;MAAM,CAAE;MACnBC;IAAI;EACL,CACF,GAAGL,cAAA;EAEJ,MAAM;IACJM,KAAA,EAAO;MACLC,MAAA,EAAQ;QAAEC,OAAA,EAASC,YAAY;QAAEC,KAAA,EAAOC;MAAU;IAAE,CACrD;IACDJ,MAAA,EAAQ;MAAED,KAAA,EAAOM;IAAU,CAAE;IAC7BC;EAAS,CACV,GAAGT,MAAA;EAEJ,IAAIC,IAAA,EAAM;IACR,oBACES,KAAA,CAACnB,QAAA;8BACCoB,IAAA,CAACnB,UAAA;QACCoB,WAAA,eACED,IAAA,CAACvB,WAAA;UACCyB,QAAA,EAAU;YACR,KAAKC,CAAC;cAAEC;YAAQ,CAAE,kBAChBJ,IAAA,CAACxB,IAAA;cACC6B,IAAA,EAAM3B,cAAA,CAAe;gBACnBmB,UAAA;gBACAS,IAAA,EAAMZ,YAAA;gBACNI;cACF;cACAS,QAAA,EAAU;wBAETH;;UAGP;UACAI,OAAA,EAAQ;UACRC,CAAA,EAAGtB,IAAA,CAAKsB;;QAGZC,OAAA,EAASvB,IAAA,CAAKsB,CAAC,CAAC;uBAElBT,IAAA,CAACzB,MAAA;QAAOoC,WAAA,EAAY;QAAYC,EAAA,EAAG;QAAOC,IAAA,EAAK;QAAQC,EAAA,EAAIjB,UAAA;kBACxDV,IAAA,CAAKsB,CAAC,CAAC;;;EAIhB;EAEA,oBACEV,KAAA,CAACnB,QAAA;4BACCoB,IAAA,CAAClB,kBAAA,O,aACDkB,IAAA,CAACxB,IAAA;MACC6B,IAAA,EAAM3B,cAAA,CAAe;QACnBmB,UAAA;QACAS,IAAA,EAAMV,UAAA;QACNE;MACF;MACAS,QAAA,EAAU;gBAETpB,IAAA,CAAKsB,CAAC,CAAC;;;AAIhB","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handleServerFunction.d.ts","sourceRoot":"","sources":["../../../src/views/List/handleServerFunction.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,4BAA4B,EAAE,MAAM,gBAAgB,CAAA;AAC1F,OAAO,KAAK,EAAyB,cAAc,EAAmB,MAAM,SAAS,CAAA;
|
|
1
|
+
{"version":3,"file":"handleServerFunction.d.ts","sourceRoot":"","sources":["../../../src/views/List/handleServerFunction.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,4BAA4B,EAAE,MAAM,gBAAgB,CAAA;AAC1F,OAAO,KAAK,EAAyB,cAAc,EAAmB,MAAM,SAAS,CAAA;AAerF,eAAO,MAAM,iBAAiB,EAAE,cAAc,CAC5C,sBAAsB,EACtB,OAAO,CAAC,4BAA4B,CAAC,CAuHtC,CAAA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { getClientConfig } from '@payloadcms/ui/utilities/getClientConfig';
|
|
2
2
|
import { headers as getHeaders } from 'next/headers.js';
|
|
3
|
-
import { canAccessAdmin, getAccessResults, isEntityHidden, parseCookies } from 'payload';
|
|
3
|
+
import { canAccessAdmin, getAccessResults, isEntityHidden, parseCookies, UnauthorizedError } from 'payload';
|
|
4
4
|
import { applyLocaleFiltering } from 'payload/shared';
|
|
5
5
|
import { renderListView } from './index.js';
|
|
6
6
|
export const renderListHandler = async args => {
|
|
@@ -26,6 +26,9 @@ export const renderListHandler = async args => {
|
|
|
26
26
|
user
|
|
27
27
|
}
|
|
28
28
|
} = args;
|
|
29
|
+
if (!req.user) {
|
|
30
|
+
throw new UnauthorizedError();
|
|
31
|
+
}
|
|
29
32
|
const headers = await getHeaders();
|
|
30
33
|
const cookies = parseCookies(headers);
|
|
31
34
|
await canAccessAdmin({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handleServerFunction.js","names":["getClientConfig","headers","getHeaders","canAccessAdmin","getAccessResults","isEntityHidden","parseCookies","applyLocaleFiltering","renderListView","renderListHandler","args","collectionSlug","disableActions","disableBulkDelete","disableBulkEdit","disableQueryPresets","drawerSlug","enableRowSelections","overrideEntityVisibility","query","redirectAfterDelete","redirectAfterDuplicate","req","i18n","payload","config","user","cookies","clientConfig","importMap","preferencesKey","preferences","find","collection","depth","limit","where","and","key","equals","id","then","res","docs","value","visibleEntities","collections","map","slug","admin","hidden","filter","Boolean","globals","permissions","List","initPageResult","collectionConfig","globalConfig","global","languageOptions","undefined","translations","params","segments","searchParams","viewType"],"sources":["../../../src/views/List/handleServerFunction.tsx"],"sourcesContent":["import type { RenderListServerFnArgs, RenderListServerFnReturnType } from '@payloadcms/ui'\nimport type { CollectionPreferences, ServerFunction, VisibleEntities } from 'payload'\n\nimport { getClientConfig } from '@payloadcms/ui/utilities/getClientConfig'\nimport { headers as getHeaders } from 'next/headers.js'\nimport {
|
|
1
|
+
{"version":3,"file":"handleServerFunction.js","names":["getClientConfig","headers","getHeaders","canAccessAdmin","getAccessResults","isEntityHidden","parseCookies","UnauthorizedError","applyLocaleFiltering","renderListView","renderListHandler","args","collectionSlug","disableActions","disableBulkDelete","disableBulkEdit","disableQueryPresets","drawerSlug","enableRowSelections","overrideEntityVisibility","query","redirectAfterDelete","redirectAfterDuplicate","req","i18n","payload","config","user","cookies","clientConfig","importMap","preferencesKey","preferences","find","collection","depth","limit","where","and","key","equals","id","then","res","docs","value","visibleEntities","collections","map","slug","admin","hidden","filter","Boolean","globals","permissions","List","initPageResult","collectionConfig","globalConfig","global","languageOptions","undefined","translations","params","segments","searchParams","viewType"],"sources":["../../../src/views/List/handleServerFunction.tsx"],"sourcesContent":["import type { RenderListServerFnArgs, RenderListServerFnReturnType } from '@payloadcms/ui'\nimport type { CollectionPreferences, ServerFunction, VisibleEntities } from 'payload'\n\nimport { getClientConfig } from '@payloadcms/ui/utilities/getClientConfig'\nimport { headers as getHeaders } from 'next/headers.js'\nimport {\n canAccessAdmin,\n getAccessResults,\n isEntityHidden,\n parseCookies,\n UnauthorizedError,\n} from 'payload'\nimport { applyLocaleFiltering } from 'payload/shared'\n\nimport { renderListView } from './index.js'\n\nexport const renderListHandler: ServerFunction<\n RenderListServerFnArgs,\n Promise<RenderListServerFnReturnType>\n> = async (args) => {\n const {\n collectionSlug,\n disableActions,\n disableBulkDelete,\n disableBulkEdit,\n disableQueryPresets,\n drawerSlug,\n enableRowSelections,\n overrideEntityVisibility,\n query,\n redirectAfterDelete,\n redirectAfterDuplicate,\n req,\n req: {\n i18n,\n payload,\n payload: { config },\n user,\n },\n } = args\n\n if (!req.user) {\n throw new UnauthorizedError()\n }\n\n const headers = await getHeaders()\n\n const cookies = parseCookies(headers)\n\n await canAccessAdmin({ req })\n\n const clientConfig = getClientConfig({\n config,\n i18n,\n importMap: payload.importMap,\n user,\n })\n await applyLocaleFiltering({ clientConfig, config, req })\n\n const preferencesKey = `collection-${collectionSlug}`\n\n const preferences = await payload\n .find({\n collection: 'payload-preferences',\n depth: 0,\n limit: 1,\n where: {\n and: [\n {\n key: {\n equals: preferencesKey,\n },\n },\n {\n 'user.relationTo': {\n equals: user.collection,\n },\n },\n {\n 'user.value': {\n equals: user.id,\n },\n },\n ],\n },\n })\n .then((res) => res.docs[0]?.value as CollectionPreferences)\n\n const visibleEntities: VisibleEntities = {\n collections: payload.config.collections\n .map(({ slug, admin: { hidden } }) => (!isEntityHidden({ hidden, user }) ? slug : null))\n .filter(Boolean),\n globals: payload.config.globals\n .map(({ slug, admin: { hidden } }) => (!isEntityHidden({ hidden, user }) ? slug : null))\n .filter(Boolean),\n }\n\n const permissions = await getAccessResults({\n req,\n })\n\n const { List } = await renderListView({\n clientConfig,\n disableActions,\n disableBulkDelete,\n disableBulkEdit,\n disableQueryPresets,\n drawerSlug,\n enableRowSelections,\n i18n,\n importMap: payload.importMap,\n initPageResult: {\n collectionConfig: payload?.collections?.[collectionSlug]?.config,\n cookies,\n globalConfig: payload.config.globals.find((global) => global.slug === collectionSlug),\n languageOptions: undefined, // TODO\n permissions,\n req,\n translations: undefined, // TODO\n visibleEntities,\n },\n overrideEntityVisibility,\n params: {\n segments: ['collections', collectionSlug],\n },\n payload,\n query,\n redirectAfterDelete,\n redirectAfterDuplicate,\n searchParams: {},\n viewType: 'list',\n })\n\n return {\n List,\n preferences,\n }\n}\n"],"mappings":"AAGA,SAASA,eAAe,QAAQ;AAChC,SAASC,OAAA,IAAWC,UAAU,QAAQ;AACtC,SACEC,cAAc,EACdC,gBAAgB,EAChBC,cAAc,EACdC,YAAY,EACZC,iBAAiB,QACZ;AACP,SAASC,oBAAoB,QAAQ;AAErC,SAASC,cAAc,QAAQ;AAE/B,OAAO,MAAMC,iBAAA,GAGT,MAAOC,IAAA;EACT,MAAM;IACJC,cAAc;IACdC,cAAc;IACdC,iBAAiB;IACjBC,eAAe;IACfC,mBAAmB;IACnBC,UAAU;IACVC,mBAAmB;IACnBC,wBAAwB;IACxBC,KAAK;IACLC,mBAAmB;IACnBC,sBAAsB;IACtBC,GAAG;IACHA,GAAA,EAAK;MACHC,IAAI;MACJC,OAAO;MACPA,OAAA,EAAS;QAAEC;MAAM,CAAE;MACnBC;IAAI;EACL,CACF,GAAG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A,EAAO;QAAEC;MAAM;IAAE,CAAE,KAAM,CAAC9C,cAAA,CAAe;MAAE8C,MAAA;MAAQxB;IAAK,KAAKsB,IAAA,GAAO,MACjFG,MAAM,CAACC,OAAA;EACZ;EAEA,MAAME,WAAA,GAAc,MAAMnD,gBAAA,CAAiB;IACzCmB;EACF;EAEA,MAAM;IAAEiC;EAAI,CAAE,GAAG,MAAM/C,cAAA,CAAe;IACpCoB,YAAA;IACAhB,cAAA;IACAC,iBAAA;IACAC,eAAA;IACAC,mBAAA;IACAC,UAAA;IACAC,mBAAA;IACAM,IAAA;IACAM,SAAA,EAAWL,OAAA,CAAQK,SAAS;IAC5B2B,cAAA,EAAgB;MACdC,gBAAA,EAAkBjC,OAAA,EAASsB,WAAA,GAAcnC,cAAA,CAAe,EAAEc,MAAA;MAC1DE,OAAA;MACA+B,YAAA,EAAclC,OAAA,CAAQC,MAAM,CAAC4B,OAAO,CAACrB,IAAI,CAAE2B,MAAA,IAAWA,MAAA,CAAOX,IAAI,KAAKrC,cAAA;MACtEiD,eAAA,EAAiBC,SAAA;MACjBP,WAAA;MACAhC,GAAA;MACAwC,YAAA,EAAcD,SAAA;MACdhB;IACF;IACA3B,wBAAA;IACA6C,MAAA,EAAQ;MACNC,QAAA,EAAU,CAAC,eAAerD,cAAA;IAC5B;IACAa,OAAA;IACAL,KAAA;IACAC,mBAAA;IACAC,sBAAA;IACA4C,YAAA,EAAc,CAAC;IACfC,QAAA,EAAU;EACZ;EAEA,OAAO;IACLX,IAAA;IACAxB;EACF;AACF","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/views/List/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,oBAAoB,EAIpB,SAAS,EACT,mBAAmB,EACnB,uBAAuB,EAEvB,gBAAgB,EAGjB,MAAM,SAAS,CAAA;AAehB,OAAO,KAAmB,MAAM,OAAO,CAAA;AASvC;;GAEG;AAC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AC,MAAM,EAAE,GAAG,CAAC,CAAA;IACrC,iBAAiB,CAAC,EAAE,OAAO,CAAA;IAC3B,eAAe,CAAC,EAAE,OAAO,CAAA;IACzB,mBAAmB,CAAC,EAAE,OAAO,CAAA;IAC7B,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,mBAAmB,EAAE,OAAO,CAAA;IAC5B,wBAAwB,CAAC,EAAE,OAAO,CAAA;IAClC;;OAEG;IACH,KAAK,CAAC,EAAE,SAAS,CAAA;IACjB,mBAAmB,CAAC,EAAE,OAAO,CAAA;IAC7B,sBAAsB,CAAC,EAAE,OAAO,CAAA;IAChC;;OAEG;IACH,KAAK,CAAC,EAAE,OAAO,CAAA;CAChB,GAAG,oBAAoB,CAAA;AAExB;;;;;;;GAOG;AACH,eAAO,MAAM,cAAc,SACnB,kBAAkB,KACvB,OAAO,CAAC;IACT,IAAI,EAAE,KAAK,CAAC,SAAS,CAAA;CACtB,CAsWA,CAAA;AAED,eAAO,MAAM,QAAQ,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,CAWjD,CAAA"}
|
package/dist/views/List/index.js
CHANGED
|
@@ -258,7 +258,8 @@ export const renderListView = async args => {
|
|
|
258
258
|
}) : collectionConfig.admin.description;
|
|
259
259
|
const newDocumentURL = formatAdminURL({
|
|
260
260
|
adminRoute,
|
|
261
|
-
path: `/collections/${collectionSlug}/create
|
|
261
|
+
path: `/collections/${collectionSlug}/create`,
|
|
262
|
+
serverURL: config.serverURL
|
|
262
263
|
});
|
|
263
264
|
const hasCreatePermission = permissions?.collections?.[collectionSlug]?.create;
|
|
264
265
|
const hasDeletePermission = permissions?.collections?.[collectionSlug]?.delete;
|