@payloadcms/next 3.0.0-beta.68 → 3.0.0-beta.69
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/elements/DocumentHeader/Tabs/Tab/TabLink.d.ts.map +1 -1
- package/dist/elements/DocumentHeader/Tabs/Tab/TabLink.js +5 -1
- package/dist/elements/DocumentHeader/Tabs/Tab/TabLink.js.map +1 -1
- package/dist/elements/Nav/index.client.js +10 -4
- package/dist/elements/Nav/index.client.js.map +1 -1
- package/dist/routes/rest/auth/login.d.ts.map +1 -1
- package/dist/routes/rest/auth/login.js +1 -1
- package/dist/routes/rest/auth/login.js.map +1 -1
- package/dist/routes/rest/auth/unlock.d.ts.map +1 -1
- package/dist/routes/rest/auth/unlock.js +1 -1
- package/dist/routes/rest/auth/unlock.js.map +1 -1
- package/dist/utilities/initPage/handleAdminPage.d.ts +4 -0
- package/dist/utilities/initPage/handleAdminPage.d.ts.map +1 -1
- package/dist/utilities/initPage/handleAdminPage.js +3 -1
- package/dist/utilities/initPage/handleAdminPage.js.map +1 -1
- package/dist/utilities/initPage/handleAuthRedirect.d.ts.map +1 -1
- package/dist/utilities/initPage/handleAuthRedirect.js +5 -1
- package/dist/utilities/initPage/handleAuthRedirect.js.map +1 -1
- package/dist/utilities/initPage/index.js.map +1 -1
- package/dist/views/CreateFirstUser/index.client.d.ts +2 -0
- package/dist/views/CreateFirstUser/index.client.d.ts.map +1 -1
- package/dist/views/CreateFirstUser/index.client.js +15 -7
- 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 +30 -7
- package/dist/views/CreateFirstUser/index.js.map +1 -1
- package/dist/views/Dashboard/Default/index.d.ts.map +1 -1
- package/dist/views/Dashboard/Default/index.js +13 -4
- package/dist/views/Dashboard/Default/index.js.map +1 -1
- package/dist/views/Document/getViewsFromConfig.d.ts.map +1 -1
- package/dist/views/Document/getViewsFromConfig.js +3 -3
- package/dist/views/Document/getViewsFromConfig.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/Edit/Default/Auth/index.js +12 -9
- package/dist/views/Edit/Default/Auth/index.js.map +1 -1
- package/dist/views/Edit/Default/Auth/types.d.ts +1 -0
- package/dist/views/Edit/Default/Auth/types.d.ts.map +1 -1
- package/dist/views/Edit/Default/Auth/types.js.map +1 -1
- package/dist/views/Edit/Default/SetDocumentStepNav/index.d.ts.map +1 -1
- package/dist/views/Edit/Default/SetDocumentStepNav/index.js +15 -5
- package/dist/views/Edit/Default/SetDocumentStepNav/index.js.map +1 -1
- package/dist/views/Edit/Default/index.d.ts.map +1 -1
- package/dist/views/Edit/Default/index.js +6 -2
- package/dist/views/Edit/Default/index.js.map +1 -1
- package/dist/views/ForgotPassword/index.d.ts.map +1 -1
- package/dist/views/ForgotPassword/index.js +11 -4
- package/dist/views/ForgotPassword/index.js.map +1 -1
- package/dist/views/List/index.d.ts.map +1 -1
- package/dist/views/List/index.js +10 -4
- package/dist/views/List/index.js.map +1 -1
- package/dist/views/Login/LoginField/index.d.ts +1 -0
- package/dist/views/Login/LoginField/index.d.ts.map +1 -1
- package/dist/views/Login/LoginField/index.js +2 -2
- 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 +8 -4
- 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 +5 -1
- package/dist/views/Logout/LogoutClient.js.map +1 -1
- package/dist/views/Logout/index.js +2 -2
- package/dist/views/Logout/index.js.map +1 -1
- package/dist/views/NotFound/index.client.js +2 -2
- package/dist/views/NotFound/index.client.js.map +1 -1
- package/dist/views/NotFound/index.d.ts.map +1 -1
- package/dist/views/NotFound/index.js +5 -1
- package/dist/views/NotFound/index.js.map +1 -1
- package/dist/views/ResetPassword/index.client.d.ts.map +1 -1
- package/dist/views/ResetPassword/index.client.js +9 -5
- package/dist/views/ResetPassword/index.client.js.map +1 -1
- package/dist/views/ResetPassword/index.d.ts.map +1 -1
- package/dist/views/ResetPassword/index.js +7 -3
- package/dist/views/ResetPassword/index.js.map +1 -1
- package/dist/views/Root/getViewFromConfig.d.ts.map +1 -1
- package/dist/views/Root/getViewFromConfig.js +5 -1
- package/dist/views/Root/getViewFromConfig.js.map +1 -1
- package/dist/views/Root/index.d.ts.map +1 -1
- package/dist/views/Root/index.js +14 -8
- package/dist/views/Root/index.js.map +1 -1
- package/dist/views/Verify/index.d.ts.map +1 -1
- package/dist/views/Verify/index.js +9 -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 +21 -6
- 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 +11 -5
- package/dist/views/Version/Restore/index.js.map +1 -1
- package/dist/views/Version/index.js +2 -2
- package/dist/views/Version/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 +10 -4
- package/dist/views/Versions/cells/CreatedAt/index.js.map +1 -1
- package/package.json +7 -7
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/views/Edit/Default/index.tsx"],"sourcesContent":["'use client'\n\nimport {\n DocumentControls,\n DocumentFields,\n Form,\n type FormProps,\n OperationProvider,\n Upload,\n useAuth,\n useComponentMap,\n useConfig,\n useDocumentEvents,\n useDocumentInfo,\n useEditDepth,\n useUploadEdits,\n} from '@payloadcms/ui'\nimport { getFormState } from '@payloadcms/ui/shared'\nimport { useRouter, useSearchParams } from 'next/navigation.js'\nimport React, { Fragment, useCallback } from 'react'\n\nimport { LeaveWithoutSaving } from '../../../elements/LeaveWithoutSaving/index.js'\nimport { Auth } from './Auth/index.js'\nimport { SetDocumentStepNav } from './SetDocumentStepNav/index.js'\nimport { SetDocumentTitle } from './SetDocumentTitle/index.js'\nimport './index.scss'\n\nconst baseClass = 'collection-edit'\n\n// This component receives props only on _pages_\n// When rendered within a drawer, props are empty\n// This is solely to support custom edit views which get server-rendered\nexport const DefaultEditView: React.FC = () => {\n const {\n id,\n AfterDocument,\n AfterFields,\n BeforeDocument,\n BeforeFields,\n action,\n apiURL,\n collectionSlug,\n disableActions,\n disableLeaveWithoutSaving,\n docPermissions,\n getDocPreferences,\n getVersions,\n globalSlug,\n hasPublishPermission,\n hasSavePermission,\n initialData: data,\n initialState,\n isEditing,\n isInitializing,\n onSave: onSaveFromContext,\n } = useDocumentInfo()\n\n const { refreshCookieAsync, user } = useAuth()\n const config = useConfig()\n const router = useRouter()\n const { getComponentMap, getFieldMap } = useComponentMap()\n const depth = useEditDepth()\n const params = useSearchParams()\n const { reportUpdate } = useDocumentEvents()\n const { resetUploadEdits } = useUploadEdits()\n\n const locale = params.get('locale')\n\n const {\n admin: { user: userSlug },\n collections,\n globals,\n routes: { admin: adminRoute, api: apiRoute },\n serverURL,\n } = config\n\n const collectionConfig =\n collectionSlug && collections.find((collection) => collection.slug === collectionSlug)\n\n const globalConfig = globalSlug && globals.find((global) => global.slug === globalSlug)\n\n const entitySlug = collectionConfig?.slug || globalConfig?.slug\n\n const componentMap = getComponentMap({\n collectionSlug: collectionConfig?.slug,\n globalSlug: globalConfig?.slug,\n })\n const fieldMap = getFieldMap({\n collectionSlug: collectionConfig?.slug,\n globalSlug: globalConfig?.slug,\n })\n\n const operation = collectionSlug && !id ? 'create' : 'update'\n\n const auth = collectionConfig ? collectionConfig.auth : undefined\n const upload = collectionConfig ? collectionConfig.upload : undefined\n\n const preventLeaveWithoutSaving =\n (!(collectionConfig?.versions?.drafts && collectionConfig?.versions?.drafts?.autosave) ||\n !(globalConfig?.versions?.drafts && globalConfig?.versions?.drafts?.autosave)) &&\n !disableLeaveWithoutSaving\n\n const classes = [baseClass, id && `${baseClass}--is-editing`].filter(Boolean).join(' ')\n\n const onSave = useCallback(\n (json) => {\n reportUpdate({\n id,\n entitySlug,\n updatedAt: json?.result?.updatedAt || new Date().toISOString(),\n })\n\n // If we're editing the doc of the logged-in user,\n // Refresh the cookie to get new permissions\n if (user && collectionSlug === userSlug && id === user.id) {\n void refreshCookieAsync()\n }\n\n void getVersions()\n\n if (typeof onSaveFromContext === 'function') {\n void onSaveFromContext({\n ...json,\n operation: id ? 'update' : 'create',\n })\n }\n\n if (!isEditing && depth < 2) {\n // Redirect to the same locale if it's been set\n const redirectRoute = `${adminRoute}/collections/${collectionSlug}/${json?.doc?.id}${locale ? `?locale=${locale}` : ''}`\n router.push(redirectRoute)\n } else {\n resetUploadEdits()\n }\n },\n [\n onSaveFromContext,\n userSlug,\n reportUpdate,\n id,\n entitySlug,\n user,\n depth,\n collectionSlug,\n getVersions,\n isEditing,\n refreshCookieAsync,\n adminRoute,\n router,\n locale,\n resetUploadEdits,\n ],\n )\n\n const onChange: FormProps['onChange'][0] = useCallback(\n async ({ formState: prevFormState }) => {\n const docPreferences = await getDocPreferences()\n\n return getFormState({\n apiRoute,\n body: {\n id,\n collectionSlug,\n docPreferences,\n formState: prevFormState,\n globalSlug,\n operation,\n schemaPath: entitySlug,\n },\n serverURL,\n })\n },\n [serverURL, apiRoute, id, operation, entitySlug, collectionSlug, globalSlug, getDocPreferences],\n )\n\n return (\n <main className={classes}>\n <OperationProvider operation={operation}>\n <Form\n action={action}\n className={`${baseClass}__form`}\n disableValidationOnSubmit\n disabled={isInitializing || !hasSavePermission}\n initialState={!isInitializing && initialState}\n isInitializing={isInitializing}\n method={id ? 'PATCH' : 'POST'}\n onChange={[onChange]}\n onSuccess={onSave}\n >\n {BeforeDocument}\n {preventLeaveWithoutSaving && <LeaveWithoutSaving />}\n <SetDocumentStepNav\n collectionSlug={collectionConfig?.slug}\n globalSlug={globalConfig?.slug}\n id={id}\n pluralLabel={collectionConfig?.labels?.plural}\n useAsTitle={collectionConfig?.admin?.useAsTitle}\n />\n <SetDocumentTitle\n collectionConfig={collectionConfig}\n config={config}\n fallback={depth <= 1 ? id?.toString() : undefined}\n globalConfig={globalConfig}\n />\n <DocumentControls\n apiURL={apiURL}\n data={data}\n disableActions={disableActions}\n hasPublishPermission={hasPublishPermission}\n hasSavePermission={hasSavePermission}\n id={id}\n isEditing={isEditing}\n permissions={docPermissions}\n slug={collectionConfig?.slug || globalConfig?.slug}\n />\n <DocumentFields\n AfterFields={AfterFields}\n BeforeFields={\n BeforeFields || (\n <Fragment>\n {auth && (\n <Auth\n className={`${baseClass}__auth`}\n collectionSlug={collectionConfig.slug}\n disableLocalStrategy={collectionConfig.auth?.disableLocalStrategy}\n email={data?.email}\n loginWithUsername={auth?.loginWithUsername}\n operation={operation}\n readOnly={!hasSavePermission}\n requirePassword={!id}\n useAPIKey={auth.useAPIKey}\n verify={auth.verify}\n />\n )}\n {upload && (\n <React.Fragment>\n {componentMap.Upload !== undefined ? (\n componentMap.Upload\n ) : (\n <Upload\n collectionSlug={collectionConfig.slug}\n initialState={initialState}\n uploadConfig={upload}\n />\n )}\n </React.Fragment>\n )}\n </Fragment>\n )\n }\n docPermissions={docPermissions}\n fieldMap={fieldMap}\n readOnly={!hasSavePermission}\n schemaPath={entitySlug}\n />\n {AfterDocument}\n </Form>\n </OperationProvider>\n </main>\n )\n}\n"],"names":["DocumentControls","DocumentFields","Form","OperationProvider","Upload","useAuth","useComponentMap","useConfig","useDocumentEvents","useDocumentInfo","useEditDepth","useUploadEdits","getFormState","useRouter","useSearchParams","React","Fragment","useCallback","LeaveWithoutSaving","Auth","SetDocumentStepNav","SetDocumentTitle","baseClass","DefaultEditView","id","AfterDocument","AfterFields","BeforeDocument","BeforeFields","action","apiURL","collectionSlug","disableActions","disableLeaveWithoutSaving","docPermissions","getDocPreferences","getVersions","globalSlug","hasPublishPermission","hasSavePermission","initialData","data","initialState","isEditing","isInitializing","onSave","onSaveFromContext","refreshCookieAsync","user","config","router","getComponentMap","getFieldMap","depth","params","reportUpdate","resetUploadEdits","locale","get","admin","userSlug","collections","globals","routes","adminRoute","api","apiRoute","serverURL","collectionConfig","find","collection","slug","globalConfig","global","entitySlug","componentMap","fieldMap","operation","auth","undefined","upload","preventLeaveWithoutSaving","versions","drafts","autosave","classes","filter","Boolean","join","json","updatedAt","result","Date","toISOString","redirectRoute","doc","push","onChange","formState","prevFormState","docPreferences","body","schemaPath","main","className","disableValidationOnSubmit","disabled","method","onSuccess","pluralLabel","labels","plural","useAsTitle","fallback","toString","permissions","disableLocalStrategy","email","loginWithUsername","readOnly","requirePassword","useAPIKey","verify","uploadConfig"],"mappings":"AAAA;;AAEA,SACEA,gBAAgB,EAChBC,cAAc,EACdC,IAAI,EAEJC,iBAAiB,EACjBC,MAAM,EACNC,OAAO,EACPC,eAAe,EACfC,SAAS,EACTC,iBAAiB,EACjBC,eAAe,EACfC,YAAY,EACZC,cAAc,QACT,iBAAgB;AACvB,SAASC,YAAY,QAAQ,wBAAuB;AACpD,SAASC,SAAS,EAAEC,eAAe,QAAQ,qBAAoB;AAC/D,OAAOC,SAASC,QAAQ,EAAEC,WAAW,QAAQ,QAAO;AAEpD,SAASC,kBAAkB,QAAQ,gDAA+C;AAClF,SAASC,IAAI,QAAQ,kBAAiB;AACtC,SAASC,kBAAkB,QAAQ,gCAA+B;AAClE,SAASC,gBAAgB,QAAQ,8BAA6B;AAG9D,MAAMC,YAAY;AAElB,gDAAgD;AAChD,iDAAiD;AACjD,wEAAwE;AACxE,OAAO,MAAMC,kBAA4B;IACvC,MAAM,EACJC,EAAE,EACFC,aAAa,EACbC,WAAW,EACXC,cAAc,EACdC,YAAY,EACZC,MAAM,EACNC,MAAM,EACNC,cAAc,EACdC,cAAc,EACdC,yBAAyB,EACzBC,cAAc,EACdC,iBAAiB,EACjBC,WAAW,EACXC,UAAU,EACVC,oBAAoB,EACpB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SAAS;oCACzBC,QAAQ5C,KAAK4C,MAAM;;gCAGtB1C,wBACC,KAACjE,MAAMC,QAAQ;8CACZ2D,aAAavE,MAAM,KAAK2E,YACvBJ,aAAavE,MAAM,iBAEnB,KAACA;wCACC2B,gBAAgBqC,iBAAiBG,IAAI;wCACrC7B,cAAcA;wCACdiF,cAAc3C;;;;;wBAQ5B9C,gBAAgBA;wBAChB0C,UAAUA;wBACV2C,UAAU,CAAChF;wBACX+D,YAAY5B;;oBAEbjD;;;;;AAKX,EAAC"}
|
|
1
|
+
{"version":3,"sources":["../../../../src/views/Edit/Default/index.tsx"],"sourcesContent":["'use client'\n\nimport {\n DocumentControls,\n DocumentFields,\n Form,\n type FormProps,\n OperationProvider,\n Upload,\n useAuth,\n useComponentMap,\n useConfig,\n useDocumentEvents,\n useDocumentInfo,\n useEditDepth,\n useUploadEdits,\n} from '@payloadcms/ui'\nimport { formatAdminURL, getFormState } from '@payloadcms/ui/shared'\nimport { useRouter, useSearchParams } from 'next/navigation.js'\nimport React, { Fragment, useCallback } from 'react'\n\nimport { LeaveWithoutSaving } from '../../../elements/LeaveWithoutSaving/index.js'\nimport { Auth } from './Auth/index.js'\nimport { SetDocumentStepNav } from './SetDocumentStepNav/index.js'\nimport { SetDocumentTitle } from './SetDocumentTitle/index.js'\nimport './index.scss'\n\nconst baseClass = 'collection-edit'\n\n// This component receives props only on _pages_\n// When rendered within a drawer, props are empty\n// This is solely to support custom edit views which get server-rendered\nexport const DefaultEditView: React.FC = () => {\n const {\n id,\n AfterDocument,\n AfterFields,\n BeforeDocument,\n BeforeFields,\n action,\n apiURL,\n collectionSlug,\n disableActions,\n disableLeaveWithoutSaving,\n docPermissions,\n getDocPreferences,\n getVersions,\n globalSlug,\n hasPublishPermission,\n hasSavePermission,\n initialData: data,\n initialState,\n isEditing,\n isInitializing,\n onSave: onSaveFromContext,\n } = useDocumentInfo()\n\n const { refreshCookieAsync, user } = useAuth()\n const config = useConfig()\n const router = useRouter()\n const { getComponentMap, getFieldMap } = useComponentMap()\n const depth = useEditDepth()\n const params = useSearchParams()\n const { reportUpdate } = useDocumentEvents()\n const { resetUploadEdits } = useUploadEdits()\n\n const locale = params.get('locale')\n\n const {\n admin: { user: userSlug },\n collections,\n globals,\n routes: { admin: adminRoute, api: apiRoute },\n serverURL,\n } = config\n\n const collectionConfig =\n collectionSlug && collections.find((collection) => collection.slug === collectionSlug)\n\n const globalConfig = globalSlug && globals.find((global) => global.slug === globalSlug)\n\n const entitySlug = collectionConfig?.slug || globalConfig?.slug\n\n const componentMap = getComponentMap({\n collectionSlug: collectionConfig?.slug,\n globalSlug: globalConfig?.slug,\n })\n const fieldMap = getFieldMap({\n collectionSlug: collectionConfig?.slug,\n globalSlug: globalConfig?.slug,\n })\n\n const operation = collectionSlug && !id ? 'create' : 'update'\n\n const auth = collectionConfig ? collectionConfig.auth : undefined\n const upload = collectionConfig ? collectionConfig.upload : undefined\n\n const preventLeaveWithoutSaving =\n (!(collectionConfig?.versions?.drafts && collectionConfig?.versions?.drafts?.autosave) ||\n !(globalConfig?.versions?.drafts && globalConfig?.versions?.drafts?.autosave)) &&\n !disableLeaveWithoutSaving\n\n const classes = [baseClass, id && `${baseClass}--is-editing`].filter(Boolean).join(' ')\n\n const onSave = useCallback(\n (json) => {\n reportUpdate({\n id,\n entitySlug,\n updatedAt: json?.result?.updatedAt || new Date().toISOString(),\n })\n\n // If we're editing the doc of the logged-in user,\n // Refresh the cookie to get new permissions\n if (user && collectionSlug === userSlug && id === user.id) {\n void refreshCookieAsync()\n }\n\n void getVersions()\n\n if (typeof onSaveFromContext === 'function') {\n void onSaveFromContext({\n ...json,\n operation: id ? 'update' : 'create',\n })\n }\n\n if (!isEditing && depth < 2) {\n // Redirect to the same locale if it's been set\n const redirectRoute = formatAdminURL({\n adminRoute,\n path: `/collections/${collectionSlug}/${json?.doc?.id}${locale ? `?locale=${locale}` : ''}`,\n })\n router.push(redirectRoute)\n } else {\n resetUploadEdits()\n }\n },\n [\n onSaveFromContext,\n userSlug,\n reportUpdate,\n id,\n entitySlug,\n user,\n depth,\n collectionSlug,\n getVersions,\n isEditing,\n refreshCookieAsync,\n adminRoute,\n router,\n locale,\n resetUploadEdits,\n ],\n )\n\n const onChange: FormProps['onChange'][0] = useCallback(\n async ({ formState: prevFormState }) => {\n const docPreferences = await getDocPreferences()\n\n return getFormState({\n apiRoute,\n body: {\n id,\n collectionSlug,\n docPreferences,\n formState: prevFormState,\n globalSlug,\n operation,\n schemaPath: entitySlug,\n },\n serverURL,\n })\n },\n [serverURL, apiRoute, id, operation, entitySlug, collectionSlug, globalSlug, getDocPreferences],\n )\n\n return (\n <main className={classes}>\n <OperationProvider operation={operation}>\n <Form\n action={action}\n className={`${baseClass}__form`}\n disableValidationOnSubmit\n disabled={isInitializing || !hasSavePermission}\n initialState={!isInitializing && initialState}\n isInitializing={isInitializing}\n method={id ? 'PATCH' : 'POST'}\n onChange={[onChange]}\n onSuccess={onSave}\n >\n {BeforeDocument}\n {preventLeaveWithoutSaving && <LeaveWithoutSaving />}\n <SetDocumentStepNav\n collectionSlug={collectionConfig?.slug}\n globalSlug={globalConfig?.slug}\n id={id}\n pluralLabel={collectionConfig?.labels?.plural}\n useAsTitle={collectionConfig?.admin?.useAsTitle}\n />\n <SetDocumentTitle\n collectionConfig={collectionConfig}\n config={config}\n fallback={depth <= 1 ? id?.toString() : undefined}\n globalConfig={globalConfig}\n />\n <DocumentControls\n apiURL={apiURL}\n data={data}\n disableActions={disableActions}\n hasPublishPermission={hasPublishPermission}\n hasSavePermission={hasSavePermission}\n id={id}\n isEditing={isEditing}\n permissions={docPermissions}\n slug={collectionConfig?.slug || globalConfig?.slug}\n />\n <DocumentFields\n AfterFields={AfterFields}\n BeforeFields={\n BeforeFields || (\n <Fragment>\n {auth && (\n <Auth\n className={`${baseClass}__auth`}\n collectionSlug={collectionConfig.slug}\n disableLocalStrategy={collectionConfig.auth?.disableLocalStrategy}\n email={data?.email}\n loginWithUsername={auth?.loginWithUsername}\n operation={operation}\n readOnly={!hasSavePermission}\n requirePassword={!id}\n useAPIKey={auth.useAPIKey}\n username={data?.username}\n verify={auth.verify}\n />\n )}\n {upload && (\n <React.Fragment>\n {componentMap.Upload !== undefined ? (\n componentMap.Upload\n ) : (\n <Upload\n collectionSlug={collectionConfig.slug}\n initialState={initialState}\n uploadConfig={upload}\n />\n )}\n </React.Fragment>\n )}\n </Fragment>\n )\n }\n docPermissions={docPermissions}\n fieldMap={fieldMap}\n readOnly={!hasSavePermission}\n schemaPath={entitySlug}\n />\n {AfterDocument}\n </Form>\n </OperationProvider>\n </main>\n )\n}\n"],"names":["DocumentControls","DocumentFields","Form","OperationProvider","Upload","useAuth","useComponentMap","useConfig","useDocumentEvents","useDocumentInfo","useEditDepth","useUploadEdits","formatAdminURL","getFormState","useRouter","useSearchParams","React","Fragment","useCallback","LeaveWithoutSaving","Auth","SetDocumentStepNav","SetDocumentTitle","baseClass","DefaultEditView","id","AfterDocument","AfterFields","BeforeDocument","BeforeFields","action","apiURL","collectionSlug","disableActions","disableLeaveWithoutSaving","docPermissions","getDocPreferences","getVersions","globalSlug","hasPublishPermission","hasSavePermission","initialData","data","initialState","isEditing","isInitializing","onSave","onSaveFromContext","refreshCookieAsync","user","config","router","getComponentMap","getFieldMap","depth","params","reportUpdate","resetUploadEdits","locale","get","admin","userSlug","collections","globals","routes","adminRoute","api","apiRoute","serverURL","collectionConfig","find","collection","slug","globalConfig","global","entitySlug","componentMap","fieldMap","operation","auth","undefined","upload","preventLeaveWithoutSaving","versions","drafts","autosave","classes","filter","Boolean","join","json","updatedAt","result","Date","toISOString","redirectRoute","path","doc","push","onChange","formState","prevFormState","docPreferences","body","schemaPath","main","className","disableValidationOnSubmit","disabled","method","onSuccess","pluralLabel","labels","plural","useAsTitle","fallback","toString","permissions","disableLocalStrategy","email","loginWithUsername","readOnly","requirePassword","useAPIKey","username","verify","uploadConfig"],"mappings":"AAAA;;AAEA,SACEA,gBAAgB,EAChBC,cAAc,EACdC,IAAI,E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AAcD;wBAC1B/C,IAAIA;wBACJsF,aAAa1C,kBAAkB2C,QAAQC;wBACvCC,YAAY7C,kBAAkBT,OAAOsD;;kCAEvC,KAAC5F;wBACC+C,kBAAkBA;wBAClBnB,QAAQA;wBACRiE,UAAU7D,SAAS,IAAI7B,IAAI2F,aAAapC;wBACxCP,cAAcA;;kCAEhB,KAACzE;wBACC+B,QAAQA;wBACRW,MAAMA;wBACNT,gBAAgBA;wBAChBM,sBAAsBA;wBACtBC,mBAAmBA;wBACnBf,IAAIA;wBACJmB,WAAWA;wBACXyE,aAAalF;wBACbqC,MAAMH,kBAAkBG,QAAQC,cAAcD;;kCAEhD,KAACvE;wBACC0B,aAAaA;wBACbE,cACEA,8BACE,MAACZ;;gCACE8D,sBACC,KAAC3D;oCACCsF,WAAW,CAAC,EAAEnF,UAAU,MAAM,CAAC;oCAC/BS,gBAAgBqC,iBAAiBG,IAAI;oCACrC8C,sBAAsBjD,iBAAiBU,IAAI,EAAEuC;oCAC7CC,OAAO7E,MAAM6E;oCACbC,mBAAmBzC,MAAMyC;oCACzB1C,WAAWA;oCACX2C,UAAU,CAACjF;oCACXkF,iBAAiB,CAACjG;oCAClBkG,WAAW5C,KAAK4C,SAAS;oCACzBC,UAAUlF,MAAMkF;oCAChBC,QAAQ9C,KAAK8C,MAAM;;gCAGtB5C,wBACC,KAACjE,MAAMC,QAAQ;8CACZ2D,aAAaxE,MAAM,KAAK4E,YACvBJ,aAAaxE,MAAM,iBAEnB,KAACA;wCACC4B,gBAAgBqC,iBAAiBG,IAAI;wCACrC7B,cAAcA;wCACdmF,cAAc7C;;;;;wBAQ5B9C,gBAAgBA;wBAChB0C,UAAUA;wBACV4C,UAAU,CAACjF;wBACXgE,YAAY7B;;oBAEbjD;;;;;AAKX,EAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/views/ForgotPassword/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/views/ForgotPassword/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAK7C,OAAO,KAAmB,MAAM,OAAO,CAAA;AAIvC,OAAO,EAAE,8BAA8B,EAAE,MAAM,WAAW,CAAA;AAG1D,eAAO,MAAM,uBAAuB,oBAAoB,CAAA;AAExD,eAAO,MAAM,kBAAkB,EAAE,KAAK,CAAC,EAAE,CAAC,cAAc,CA2DvD,CAAA"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Button, Translation } from '@payloadcms/ui';
|
|
3
|
+
import { formatAdminURL } from '@payloadcms/ui/shared';
|
|
3
4
|
import LinkImport from 'next/link.js';
|
|
4
5
|
import React, { Fragment } from 'react';
|
|
5
6
|
import { ForgotPasswordForm } from './ForgotPasswordForm/index.js';
|
|
@@ -8,7 +9,7 @@ const Link = LinkImport.default || LinkImport;
|
|
|
8
9
|
export const forgotPasswordBaseClass = 'forgot-password';
|
|
9
10
|
export const ForgotPasswordView = ({ initPageResult })=>{
|
|
10
11
|
const { req: { i18n, payload: { config }, user } } = initPageResult;
|
|
11
|
-
const { admin: { routes: { account: accountRoute } }, routes: { admin } } = config;
|
|
12
|
+
const { admin: { routes: { account: accountRoute, login: loginRoute } }, routes: { admin: adminRoute } } = config;
|
|
12
13
|
if (user) {
|
|
13
14
|
return /*#__PURE__*/ _jsxs(Fragment, {
|
|
14
15
|
children: [
|
|
@@ -19,7 +20,10 @@ export const ForgotPasswordView = ({ initPageResult })=>{
|
|
|
19
20
|
children: /*#__PURE__*/ _jsx(Translation, {
|
|
20
21
|
elements: {
|
|
21
22
|
'0': ({ children })=>/*#__PURE__*/ _jsx(Link, {
|
|
22
|
-
href:
|
|
23
|
+
href: formatAdminURL({
|
|
24
|
+
adminRoute,
|
|
25
|
+
path: accountRoute
|
|
26
|
+
}),
|
|
23
27
|
children: children
|
|
24
28
|
})
|
|
25
29
|
},
|
|
@@ -32,7 +36,7 @@ export const ForgotPasswordView = ({ initPageResult })=>{
|
|
|
32
36
|
Link: Link,
|
|
33
37
|
buttonStyle: "secondary",
|
|
34
38
|
el: "link",
|
|
35
|
-
to:
|
|
39
|
+
to: adminRoute,
|
|
36
40
|
children: i18n.t('general:backToDashboard')
|
|
37
41
|
})
|
|
38
42
|
]
|
|
@@ -42,7 +46,10 @@ export const ForgotPasswordView = ({ initPageResult })=>{
|
|
|
42
46
|
children: [
|
|
43
47
|
/*#__PURE__*/ _jsx(ForgotPasswordForm, {}),
|
|
44
48
|
/*#__PURE__*/ _jsx(Link, {
|
|
45
|
-
href:
|
|
49
|
+
href: formatAdminURL({
|
|
50
|
+
adminRoute,
|
|
51
|
+
path: loginRoute
|
|
52
|
+
}),
|
|
46
53
|
children: i18n.t('authentication:backToLogin')
|
|
47
54
|
})
|
|
48
55
|
]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/views/ForgotPassword/index.tsx"],"sourcesContent":["import type { AdminViewProps } from 'payload'\n\nimport { Button, Translation } from '@payloadcms/ui'\nimport LinkImport from 'next/link.js'\nimport React, { Fragment } from 'react'\n\nimport { ForgotPasswordForm } from './ForgotPasswordForm/index.js'\n\nexport { generateForgotPasswordMetadata } from './meta.js'\n\nconst Link = (LinkImport.default || LinkImport) as unknown as typeof LinkImport.default\nexport const forgotPasswordBaseClass = 'forgot-password'\n\nexport const ForgotPasswordView: React.FC<AdminViewProps> = ({ initPageResult }) => {\n const {\n req: {\n i18n,\n payload: { config },\n user,\n },\n } = initPageResult\n\n const {\n admin: {\n routes: { account: accountRoute },\n },\n routes: { admin },\n } = config\n\n if (user) {\n return (\n <Fragment>\n <h1>{i18n.t('authentication:alreadyLoggedIn')}</h1>\n <p>\n <Translation\n elements={{\n '0': ({ children }) => <Link
|
|
1
|
+
{"version":3,"sources":["../../../src/views/ForgotPassword/index.tsx"],"sourcesContent":["import type { AdminViewProps } from 'payload'\n\nimport { Button, Translation } from '@payloadcms/ui'\nimport { formatAdminURL } from '@payloadcms/ui/shared'\nimport LinkImport from 'next/link.js'\nimport React, { Fragment } from 'react'\n\nimport { ForgotPasswordForm } from './ForgotPasswordForm/index.js'\n\nexport { generateForgotPasswordMetadata } from './meta.js'\n\nconst Link = (LinkImport.default || LinkImport) as unknown as typeof LinkImport.default\nexport const forgotPasswordBaseClass = 'forgot-password'\n\nexport const ForgotPasswordView: React.FC<AdminViewProps> = ({ initPageResult }) => {\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 <h1>{i18n.t('authentication:alreadyLoggedIn')}</h1>\n <p>\n <Translation\n elements={{\n '0': ({ children }) => (\n <Link\n href={formatAdminURL({\n adminRoute,\n path: accountRoute,\n })}\n >\n {children}\n </Link>\n ),\n }}\n i18nKey=\"authentication:loggedInChangePassword\"\n t={i18n.t}\n />\n </p>\n <br />\n <Button Link={Link} buttonStyle=\"secondary\" el=\"link\" 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 >\n {i18n.t('authentication:backToLogin')}\n </Link>\n </Fragment>\n )\n}\n"],"names":["Button","Translation","formatAdminURL","LinkImport","React","Fragment","ForgotPasswordForm","generateForgotPasswordMetadata","Link","default","forgotPasswordBaseClass","ForgotPasswordView","initPageResult","req","i18n","payload","config","user","admin","routes","account","accountRoute","login","loginRoute","adminRoute","h1","t","p","elements","children","href","path","i18nKey","br","buttonStyle","el","to"],"mappings":";AAEA,SAASA,MAAM,EAAEC,WAAW,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":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAS,MAAM,SAAS,CAAA;AAYpD,OAAO,KAAmB,MAAM,OAAO,CAAA;AAMvC,OAAO,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAA;AAEhD,eAAO,MAAM,QAAQ,EAAE,KAAK,CAAC,EAAE,CAAC,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/views/List/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAS,MAAM,SAAS,CAAA;AAYpD,OAAO,KAAmB,MAAM,OAAO,CAAA;AAMvC,OAAO,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAA;AAEhD,eAAO,MAAM,QAAQ,EAAE,KAAK,CAAC,EAAE,CAAC,cAAc,CAoK7C,CAAA"}
|
package/dist/views/List/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { HydrateClientUser, ListInfoProvider, ListQueryProvider, TableColumnsProvider } from '@payloadcms/ui';
|
|
3
|
-
import { RenderCustomComponent } from '@payloadcms/ui/shared';
|
|
3
|
+
import { RenderCustomComponent, formatAdminURL } from '@payloadcms/ui/shared';
|
|
4
4
|
import { notFound } from 'next/navigation.js';
|
|
5
5
|
import { createClientCollectionConfig, mergeListSearchAndWhere } from 'payload';
|
|
6
6
|
import { isNumber, isReactComponentOrFunction } from 'payload/shared';
|
|
@@ -29,7 +29,7 @@ export const ListView = async ({ initPageResult, params, searchParams })=>{
|
|
|
29
29
|
}
|
|
30
30
|
})?.then((res)=>res?.docs?.[0]?.value);
|
|
31
31
|
} catch (error) {} // eslint-disable-line no-empty
|
|
32
|
-
const { routes: { admin } } = config;
|
|
32
|
+
const { routes: { admin: adminRoute } } = config;
|
|
33
33
|
if (collectionConfig) {
|
|
34
34
|
const { admin: { components: { views: { List: CustomList } = {} } = {} } } = collectionConfig;
|
|
35
35
|
if (!visibleEntities.collections.includes(collectionSlug)) {
|
|
@@ -82,7 +82,10 @@ export const ListView = async ({ initPageResult, params, searchParams })=>{
|
|
|
82
82
|
}),
|
|
83
83
|
collectionSlug: collectionSlug,
|
|
84
84
|
hasCreatePermission: permissions?.collections?.[collectionSlug]?.create?.permission,
|
|
85
|
-
newDocumentURL:
|
|
85
|
+
newDocumentURL: formatAdminURL({
|
|
86
|
+
adminRoute,
|
|
87
|
+
path: `/collections/${collectionSlug}/create`
|
|
88
|
+
}),
|
|
86
89
|
children: /*#__PURE__*/ _jsx(ListQueryProvider, {
|
|
87
90
|
data: data,
|
|
88
91
|
defaultLimit: limit || collectionConfig?.admin?.pagination?.defaultLimit,
|
|
@@ -106,7 +109,10 @@ export const ListView = async ({ initPageResult, params, searchParams })=>{
|
|
|
106
109
|
limit,
|
|
107
110
|
listPreferences,
|
|
108
111
|
locale: fullLocale,
|
|
109
|
-
newDocumentURL:
|
|
112
|
+
newDocumentURL: formatAdminURL({
|
|
113
|
+
adminRoute,
|
|
114
|
+
path: `/collections/${collectionSlug}/create`
|
|
115
|
+
}),
|
|
110
116
|
params,
|
|
111
117
|
payload,
|
|
112
118
|
permissions,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/views/List/index.tsx"],"sourcesContent":["import type { AdminViewProps, Where } from 'payload'\n\nimport {\n HydrateClientUser,\n ListInfoProvider,\n ListQueryProvider,\n TableColumnsProvider,\n} from '@payloadcms/ui'\nimport { RenderCustomComponent } from '@payloadcms/ui/shared'\nimport { notFound } from 'next/navigation.js'\nimport { createClientCollectionConfig, mergeListSearchAndWhere } from 'payload'\nimport { isNumber, isReactComponentOrFunction } from 'payload/shared'\nimport React, { Fragment } from 'react'\n\nimport type { DefaultListViewProps, ListPreferences } from './Default/types.js'\n\nimport { DefaultListView } from './Default/index.js'\n\nexport { generateListMetadata } from './meta.js'\n\nexport const ListView: React.FC<AdminViewProps> = async ({\n initPageResult,\n params,\n searchParams,\n}) => {\n const {\n collectionConfig,\n locale: fullLocale,\n permissions,\n req,\n req: {\n i18n,\n locale,\n payload,\n payload: { config },\n query,\n user,\n },\n visibleEntities,\n } = initPageResult\n\n const collectionSlug = collectionConfig?.slug\n\n if (!permissions?.collections?.[collectionSlug]?.read?.permission) {\n notFound()\n }\n\n let listPreferences: ListPreferences\n const preferenceKey = `${collectionSlug}-list`\n\n try {\n listPreferences = (await payload\n .find({\n collection: 'payload-preferences',\n depth: 0,\n limit: 1,\n req,\n user,\n where: {\n key: {\n equals: preferenceKey,\n },\n },\n })\n ?.then((res) => res?.docs?.[0]?.value)) as ListPreferences\n } catch (error) {} // eslint-disable-line no-empty\n\n const {\n routes: { admin },\n } = config\n\n if (collectionConfig) {\n const {\n admin: { components: { views: { List: CustomList } = {} } = {} },\n } = collectionConfig\n\n if (!visibleEntities.collections.includes(collectionSlug)) {\n return notFound()\n }\n\n let CustomListView = null\n\n if (CustomList && typeof CustomList === 'function') {\n CustomListView = CustomList\n } else if (typeof CustomList === 'object' && isReactComponentOrFunction(CustomList.Component)) {\n CustomListView = CustomList.Component\n }\n\n const page = isNumber(query?.page) ? Number(query.page) : 0\n const whereQuery = mergeListSearchAndWhere({\n collectionConfig,\n query: {\n search: typeof query?.search === 'string' ? query.search : undefined,\n where: (query?.where as Where) || undefined,\n },\n })\n const limit = isNumber(query?.limit)\n ? Number(query.limit)\n : listPreferences?.limit || collectionConfig.admin.pagination.defaultLimit\n const sort =\n query?.sort && typeof query.sort === 'string'\n ? query.sort\n : listPreferences?.sort || collectionConfig.defaultSort || undefined\n\n const data = await payload.find({\n collection: collectionSlug,\n depth: 0,\n draft: true,\n fallbackLocale: null,\n limit,\n locale,\n overrideAccess: false,\n page,\n req,\n sort,\n user,\n where: whereQuery || {},\n })\n\n const viewComponentProps: DefaultListViewProps = {\n collectionSlug,\n listSearchableFields: collectionConfig.admin.listSearchableFields,\n }\n\n return (\n <Fragment>\n <HydrateClientUser permissions={permissions} user={user} />\n <ListInfoProvider\n collectionConfig={createClientCollectionConfig({\n collection: collectionConfig,\n t: initPageResult.req.i18n.t,\n })}\n collectionSlug={collectionSlug}\n hasCreatePermission={permissions?.collections?.[collectionSlug]?.create?.permission}\n newDocumentURL={
|
|
1
|
+
{"version":3,"sources":["../../../src/views/List/index.tsx"],"sourcesContent":["import type { AdminViewProps, Where } from 'payload'\n\nimport {\n HydrateClientUser,\n ListInfoProvider,\n ListQueryProvider,\n TableColumnsProvider,\n} from '@payloadcms/ui'\nimport { RenderCustomComponent, formatAdminURL } from '@payloadcms/ui/shared'\nimport { notFound } from 'next/navigation.js'\nimport { createClientCollectionConfig, mergeListSearchAndWhere } from 'payload'\nimport { isNumber, isReactComponentOrFunction } from 'payload/shared'\nimport React, { Fragment } from 'react'\n\nimport type { DefaultListViewProps, ListPreferences } from './Default/types.js'\n\nimport { DefaultListView } from './Default/index.js'\n\nexport { generateListMetadata } from './meta.js'\n\nexport const ListView: React.FC<AdminViewProps> = async ({\n initPageResult,\n params,\n searchParams,\n}) => {\n const {\n collectionConfig,\n locale: fullLocale,\n permissions,\n req,\n req: {\n i18n,\n locale,\n payload,\n payload: { config },\n query,\n user,\n },\n visibleEntities,\n } = initPageResult\n\n const collectionSlug = collectionConfig?.slug\n\n if (!permissions?.collections?.[collectionSlug]?.read?.permission) {\n notFound()\n }\n\n let listPreferences: ListPreferences\n const preferenceKey = `${collectionSlug}-list`\n\n try {\n listPreferences = (await payload\n .find({\n collection: 'payload-preferences',\n depth: 0,\n limit: 1,\n req,\n user,\n where: {\n key: {\n equals: preferenceKey,\n },\n },\n })\n ?.then((res) => res?.docs?.[0]?.value)) as ListPreferences\n } catch (error) {} // eslint-disable-line no-empty\n\n const {\n routes: { admin: adminRoute },\n } = config\n\n if (collectionConfig) {\n const {\n admin: { components: { views: { List: CustomList } = {} } = {} },\n } = collectionConfig\n\n if (!visibleEntities.collections.includes(collectionSlug)) {\n return notFound()\n }\n\n let CustomListView = null\n\n if (CustomList && typeof CustomList === 'function') {\n CustomListView = CustomList\n } else if (typeof CustomList === 'object' && isReactComponentOrFunction(CustomList.Component)) {\n CustomListView = CustomList.Component\n }\n\n const page = isNumber(query?.page) ? Number(query.page) : 0\n const whereQuery = mergeListSearchAndWhere({\n collectionConfig,\n query: {\n search: typeof query?.search === 'string' ? query.search : undefined,\n where: (query?.where as Where) || undefined,\n },\n })\n const limit = isNumber(query?.limit)\n ? Number(query.limit)\n : listPreferences?.limit || collectionConfig.admin.pagination.defaultLimit\n const sort =\n query?.sort && typeof query.sort === 'string'\n ? query.sort\n : listPreferences?.sort || collectionConfig.defaultSort || undefined\n\n const data = await payload.find({\n collection: collectionSlug,\n depth: 0,\n draft: true,\n fallbackLocale: null,\n limit,\n locale,\n overrideAccess: false,\n page,\n req,\n sort,\n user,\n where: whereQuery || {},\n })\n\n const viewComponentProps: DefaultListViewProps = {\n collectionSlug,\n listSearchableFields: collectionConfig.admin.listSearchableFields,\n }\n\n return (\n <Fragment>\n <HydrateClientUser permissions={permissions} user={user} />\n <ListInfoProvider\n collectionConfig={createClientCollectionConfig({\n collection: collectionConfig,\n t: initPageResult.req.i18n.t,\n })}\n collectionSlug={collectionSlug}\n hasCreatePermission={permissions?.collections?.[collectionSlug]?.create?.permission}\n newDocumentURL={formatAdminURL({\n adminRoute,\n path: `/collections/${collectionSlug}/create`,\n })}\n >\n <ListQueryProvider\n data={data}\n defaultLimit={limit || collectionConfig?.admin?.pagination?.defaultLimit}\n defaultSort={sort}\n modifySearchParams\n preferenceKey={preferenceKey}\n >\n <TableColumnsProvider\n collectionSlug={collectionSlug}\n enableRowSelections\n listPreferences={listPreferences}\n preferenceKey={preferenceKey}\n >\n <RenderCustomComponent\n CustomComponent={CustomListView}\n DefaultComponent={DefaultListView}\n componentProps={viewComponentProps}\n serverOnlyProps={{\n collectionConfig,\n data,\n hasCreatePermission:\n permissions?.collections?.[collectionSlug]?.create?.permission,\n i18n,\n limit,\n listPreferences,\n locale: fullLocale,\n newDocumentURL: formatAdminURL({\n adminRoute,\n path: `/collections/${collectionSlug}/create`,\n }),\n params,\n payload,\n permissions,\n searchParams,\n user,\n }}\n />\n </TableColumnsProvider>\n </ListQueryProvider>\n </ListInfoProvider>\n </Fragment>\n )\n }\n\n return notFound()\n}\n"],"names":["HydrateClientUser","ListInfoProvider","ListQueryProvider","TableColumnsProvider","RenderCustomComponent","formatAdminURL","notFound","createClientCollectionConfig","mergeListSearchAndWhere","isNumber","isReactComponentOrFunction","React","Fragment","DefaultListView","generateListMetadata","ListView","initPageResult","params","searchParams","collectionConfig","locale","fullLocale","permissions","req","i18n","payload","config","query","user","visibleEntities","collectionSlug","slug","collections","read","permission","listPreferences","preferenceKey","find","collection","depth","limit","where","key","equals","then","res","docs","value","error","routes","admin","adminRoute","components","views","List","CustomList","includes","CustomListView","Component","page","Number","whereQuery","search","undefined","pagination","defaultLimit","sort","defaultSort","data","draft","fallbackLocale","overrideAccess","viewComponentProps","listSearchableFields","t","hasCreatePermission","create","newDocumentURL","path","modifySearchParams","enableRowSelections","CustomComponent","DefaultComponent","componentProps","serverOnlyProps"],"mappings":";AAEA,SACEA,iBAAiB,EACjBC,gBAAgB,EAChBC,iBAAiB,EACjBC,oBAAoB,QACf,iBAAgB;AACvB,SAASC,qBAAqB,EAAEC,cAAc,QAAQ,wBAAuB;AAC7E,SAASC,QAAQ,QAAQ,qBAAoB;AAC7C,SAASC,4BAA4B,EAAEC,uBAAuB,QAAQ,UAAS;AAC/E,SAASC,QAAQ,EAAEC,0BAA0B,QAAQ,iBAAgB;AACrE,OAAOC,SAASC,QAAQ,QAAQ,QAAO;AAIvC,SAASC,eAAe,QAAQ,qBAAoB;AAEpD,SAASC,oBAAoB,QAAQ,YAAW;AAEhD,OAAO,MAAMC,WAAqC,OAAO,EACvDC,cAAc,EACdC,MAAM,EACNC,YAAY,EACb;IACC,MAAM,EACJC,gBAAgB,EAChBC,QAAQC,UAAU,EAClBC,WAAW,EACXC,GAAG,EACHA,KAAK,EACHC,IAAI,EACJJ,MAAM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;gCACC6E,iBAAiBxB;gCACjByB,kBAAkBrE;gCAClBsE,gBAAgBX;gCAChBY,iBAAiB;oCACfjE;oCACAiD;oCACAO,qBACErD,aAAaU,aAAa,CAACF,eAAe,EAAE8C,QAAQ1C;oCACtDV;oCACAgB;oCACAL;oCACAf,QAAQC;oCACRwD,gBAAgBxE,eAAe;wCAC7B8C;wCACA2B,MAAM,CAAC,aAAa,EAAEhD,eAAe,OAAO,CAAC;oCAC/C;oCACAb;oCACAQ;oCACAH;oCACAJ;oCACAU;gCACF;;;;;;;IAOd;IAEA,OAAOtB;AACT,EAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/views/Login/LoginField/index.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,MAAM,MAAM,eAAe,GAAG;IAC5B,IAAI,EAAE,OAAO,GAAG,iBAAiB,GAAG,UAAU,CAAA;CAC/C,CAAA;AACD,eAAO,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,CAmGhD,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/views/Login/LoginField/index.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,MAAM,MAAM,eAAe,GAAG;IAC5B,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,IAAI,EAAE,OAAO,GAAG,iBAAiB,GAAG,UAAU,CAAA;CAC/C,CAAA;AACD,eAAO,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,CAmGhD,CAAA"}
|
|
@@ -3,7 +3,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
3
3
|
import { EmailField, TextField, useConfig, useTranslation } from '@payloadcms/ui';
|
|
4
4
|
import { email, username } from 'payload/shared';
|
|
5
5
|
import React from 'react';
|
|
6
|
-
export const LoginField = ({ type })=>{
|
|
6
|
+
export const LoginField = ({ type, required = true })=>{
|
|
7
7
|
const { t } = useTranslation();
|
|
8
8
|
const config = useConfig();
|
|
9
9
|
if (type === 'email') {
|
|
@@ -11,7 +11,7 @@ export const LoginField = ({ type })=>{
|
|
|
11
11
|
autoComplete: "email",
|
|
12
12
|
label: t('general:email'),
|
|
13
13
|
name: "email",
|
|
14
|
-
required:
|
|
14
|
+
required: required,
|
|
15
15
|
validate: (value)=>email(value, {
|
|
16
16
|
name: 'email',
|
|
17
17
|
type: 'email',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/views/Login/LoginField/index.tsx"],"sourcesContent":["'use client'\nimport type { PayloadRequest } from 'payload'\n\nimport { EmailField, TextField, useConfig, useTranslation } from '@payloadcms/ui'\nimport { email, username } from 'payload/shared'\nimport React from 'react'\nexport type LoginFieldProps = {\n type: 'email' | 'emailOrUsername' | 'username'\n}\nexport const LoginField: React.FC<LoginFieldProps> = ({ type }) => {\n const { t } = useTranslation()\n const config = useConfig()\n\n if (type === 'email') {\n return (\n <EmailField\n autoComplete=\"email\"\n label={t('general:email')}\n name=\"email\"\n required\n validate={(value) =>\n email(value, {\n name: 'email',\n type: 'email',\n data: {},\n preferences: { fields: {} },\n req: { t } as PayloadRequest,\n required: true,\n siblingData: {},\n })\n }\n />\n )\n }\n\n if (type === 'username') {\n return (\n <TextField\n label={t('authentication:username')}\n name=\"username\"\n required\n validate={(value) =>\n username(value, {\n name: 'username',\n type: 'text',\n data: {},\n preferences: { fields: {} },\n req: {\n payload: {\n config,\n },\n t,\n } as PayloadRequest,\n required: true,\n siblingData: {},\n })\n }\n />\n )\n }\n\n if (type === 'emailOrUsername') {\n return (\n <TextField\n label={t('authentication:emailOrUsername')}\n name=\"username\"\n required\n validate={(value) => {\n const passesUsername = username(value, {\n name: 'username',\n type: 'text',\n data: {},\n preferences: { fields: {} },\n req: {\n payload: {\n config,\n },\n t,\n } as PayloadRequest,\n required: true,\n siblingData: {},\n })\n const passesEmail = email(value, {\n name: 'username',\n type: 'email',\n data: {},\n preferences: { fields: {} },\n req: {\n payload: {\n config,\n },\n t,\n } as PayloadRequest,\n required: true,\n siblingData: {},\n })\n\n if (!passesEmail && !passesUsername) {\n return `${t('general:email')}: ${passesEmail} ${t('general:username')}: ${passesUsername}`\n }\n\n return true\n }}\n />\n )\n }\n\n return null\n}\n"],"names":["EmailField","TextField","useConfig","useTranslation","email","username","React","LoginField","type","t","config","autoComplete","label","name","
|
|
1
|
+
{"version":3,"sources":["../../../../src/views/Login/LoginField/index.tsx"],"sourcesContent":["'use client'\nimport type { PayloadRequest } from 'payload'\n\nimport { EmailField, TextField, useConfig, useTranslation } from '@payloadcms/ui'\nimport { email, username } from 'payload/shared'\nimport React from 'react'\nexport type LoginFieldProps = {\n required?: boolean\n type: 'email' | 'emailOrUsername' | 'username'\n}\nexport const LoginField: React.FC<LoginFieldProps> = ({ type, required = true }) => {\n const { t } = useTranslation()\n const config = useConfig()\n\n if (type === 'email') {\n return (\n <EmailField\n autoComplete=\"email\"\n label={t('general:email')}\n name=\"email\"\n required={required}\n validate={(value) =>\n email(value, {\n name: 'email',\n type: 'email',\n data: {},\n preferences: { fields: {} },\n req: { t } as PayloadRequest,\n required: true,\n siblingData: {},\n })\n }\n />\n )\n }\n\n if (type === 'username') {\n return (\n <TextField\n label={t('authentication:username')}\n name=\"username\"\n required\n validate={(value) =>\n username(value, {\n name: 'username',\n type: 'text',\n data: {},\n preferences: { fields: {} },\n req: {\n payload: {\n config,\n },\n t,\n } as PayloadRequest,\n required: true,\n siblingData: {},\n })\n }\n />\n )\n }\n\n if (type === 'emailOrUsername') {\n return (\n <TextField\n label={t('authentication:emailOrUsername')}\n name=\"username\"\n required\n validate={(value) => {\n const passesUsername = username(value, {\n name: 'username',\n type: 'text',\n data: {},\n preferences: { fields: {} },\n req: {\n payload: {\n config,\n },\n t,\n } as PayloadRequest,\n required: true,\n siblingData: {},\n })\n const passesEmail = email(value, {\n name: 'username',\n type: 'email',\n data: {},\n preferences: { fields: {} },\n req: {\n payload: {\n config,\n },\n t,\n } as PayloadRequest,\n required: true,\n siblingData: {},\n })\n\n if (!passesEmail && !passesUsername) {\n return `${t('general:email')}: ${passesEmail} ${t('general:username')}: ${passesUsername}`\n }\n\n return true\n }}\n />\n )\n }\n\n return null\n}\n"],"names":["EmailField","TextField","useConfig","useTranslation","email","username","React","LoginField","type","required","t","config","autoComplete","label","name","validate","value","data","preferences","fields","req","siblingData","payload","passesUsername","passesEmail"],"mappings":"AAAA;;AAGA,SAASA,UAAU,EAAEC,SAAS,EAAEC,SAAS,EAAEC,cAAc,QAAQ,iBAAgB;AACjF,SAASC,KAAK,EAAEC,QAAQ,QAAQ,iBAAgB;AAChD,OAAOC,WAAW,QAAO;AAKzB,OAAO,MAAMC,aAAwC,CAAC,EAAEC,IAAI,EAAEC,WAAW,IAAI,EAAE;IAC7E,MAAM,EAAEC,CAAC,EAAE,GAAGP;IACd,MAAMQ,SAAST;IAEf,IAAIM,SAAS,SAAS;QACpB,qBACE,KAACR;YACCY,cAAa;YACbC,OAAOH,EAAE;YACTI,MAAK;YACLL,UAAUA;YACVM,UAAU,CAACC,QACTZ,MAAMY,OAAO;oBACXF,MAAM;oBACNN,MAAM;oBACNS,MAAM,CAAC;oBACPC,aAAa;wBAAEC,QAAQ,CAAC;oBAAE;oBAC1BC,KAAK;wBAAEV;oBAAE;oBACTD,UAAU;oBACVY,aAAa,CAAC;gBAChB;;IAIR;IAEA,IAAIb,SAAS,YAAY;QACvB,qBACE,KAACP;YACCY,OAAOH,EAAE;YACTI,MAAK;YACLL,QAAQ;YACRM,UAAU,CAACC,QACTX,SAASW,OAAO;oBACdF,MAAM;oBACNN,MAAM;oBACNS,MAAM,CAAC;oBACPC,aAAa;wBAAEC,QAAQ,CAAC;oBAAE;oBAC1BC,KAAK;wBACHE,SAAS;4BACPX;wBACF;wBACAD;oBACF;oBACAD,UAAU;oBACVY,aAAa,CAAC;gBAChB;;IAIR;IAEA,IAAIb,SAAS,mBAAmB;QAC9B,qBACE,KAACP;YACCY,OAAOH,EAAE;YACTI,MAAK;YACLL,QAAQ;YACRM,UAAU,CAACC;gBACT,MAAMO,iBAAiBlB,SAASW,OAAO;oBACrCF,MAAM;oBACNN,MAAM;oBACNS,MAAM,CAAC;oBACPC,aAAa;wBAAEC,QAAQ,CAAC;oBAAE;oBAC1BC,KAAK;wBACHE,SAAS;4BACPX;wBACF;wBACAD;oBACF;oBACAD,UAAU;oBACVY,aAAa,CAAC;gBAChB;gBACA,MAAMG,cAAcpB,MAAMY,OAAO;oBAC/BF,MAAM;oBACNN,MAAM;oBACNS,MAAM,CAAC;oBACPC,aAAa;wBAAEC,QAAQ,CAAC;oBAAE;oBAC1BC,KAAK;wBACHE,SAAS;4BACPX;wBACF;wBACAD;oBACF;oBACAD,UAAU;oBACVY,aAAa,CAAC;gBAChB;gBAEA,IAAI,CAACG,eAAe,CAACD,gBAAgB;oBACnC,OAAO,CAAC,EAAEb,EAAE,iBAAiB,EAAE,EAAEc,YAAY,CAAC,EAAEd,EAAE,oBAAoB,EAAE,EAAEa,eAAe,CAAC;gBAC5F;gBAEA,OAAO;YACT;;IAGN;IAEA,OAAO;AACT,EAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/views/Login/LoginForm/index.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/views/Login/LoginForm/index.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,MAAM,OAAO,CAAA;AAczB,OAAO,cAAc,CAAA;AAErB,eAAO,MAAM,SAAS,EAAE,KAAK,CAAC,EAAE,CAAC;IAC/B,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,YAAY,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,EAAE,GAAG,SAAS,CAAA;KAAE,CAAA;CAC/D,CA8FA,CAAA"}
|
|
@@ -5,11 +5,12 @@ import React from 'react';
|
|
|
5
5
|
const baseClass = 'login__form';
|
|
6
6
|
const Link = LinkImport.default || LinkImport;
|
|
7
7
|
import { Form, FormSubmit, PasswordField, useConfig, useTranslation } from '@payloadcms/ui';
|
|
8
|
+
import { formatAdminURL } from '@payloadcms/ui/shared';
|
|
8
9
|
import { password } from 'payload/shared';
|
|
9
10
|
import { LoginField } from '../LoginField/index.js';
|
|
10
11
|
export const LoginForm = ({ prefillEmail, prefillPassword, prefillUsername, searchParams })=>{
|
|
11
12
|
const config = useConfig();
|
|
12
|
-
const { admin: { routes: { forgot: forgotRoute }, user: userSlug }, routes: { admin, api } } = config;
|
|
13
|
+
const { admin: { routes: { forgot: forgotRoute }, user: userSlug }, routes: { admin: adminRoute, api: apiRoute } } = config;
|
|
13
14
|
const collectionConfig = config.collections?.find((collection)=>collection?.slug === userSlug);
|
|
14
15
|
const { auth: authOptions } = collectionConfig;
|
|
15
16
|
const loginWithUsername = authOptions.loginWithUsername;
|
|
@@ -42,12 +43,12 @@ export const LoginForm = ({ prefillEmail, prefillPassword, prefillUsername, sear
|
|
|
42
43
|
};
|
|
43
44
|
}
|
|
44
45
|
return /*#__PURE__*/ _jsxs(Form, {
|
|
45
|
-
action: `${
|
|
46
|
+
action: `${apiRoute}/${userSlug}/login`,
|
|
46
47
|
className: baseClass,
|
|
47
48
|
disableSuccessStatus: true,
|
|
48
49
|
initialState: initialState,
|
|
49
50
|
method: "POST",
|
|
50
|
-
redirect: typeof searchParams?.redirect === 'string' ? searchParams.redirect :
|
|
51
|
+
redirect: typeof searchParams?.redirect === 'string' ? searchParams.redirect : adminRoute,
|
|
51
52
|
waitForAutocomplete: true,
|
|
52
53
|
children: [
|
|
53
54
|
/*#__PURE__*/ _jsxs("div", {
|
|
@@ -81,7 +82,10 @@ export const LoginForm = ({ prefillEmail, prefillPassword, prefillUsername, sear
|
|
|
81
82
|
]
|
|
82
83
|
}),
|
|
83
84
|
/*#__PURE__*/ _jsx(Link, {
|
|
84
|
-
href:
|
|
85
|
+
href: formatAdminURL({
|
|
86
|
+
adminRoute,
|
|
87
|
+
path: forgotRoute
|
|
88
|
+
}),
|
|
85
89
|
children: t('authentication:forgotPasswordQuestion')
|
|
86
90
|
}),
|
|
87
91
|
/*#__PURE__*/ _jsx(FormSubmit, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/views/Login/LoginForm/index.tsx"],"sourcesContent":["'use client'\n\nimport LinkImport from 'next/link.js'\nimport React from 'react'\n\nconst baseClass = 'login__form'\nconst Link = (LinkImport.default || LinkImport) as unknown as typeof LinkImport.default\n\nimport type { FormState, PayloadRequest } from 'payload'\n\nimport { Form, FormSubmit, PasswordField, useConfig, useTranslation } from '@payloadcms/ui'\nimport { password } from 'payload/shared'\n\nimport type { LoginFieldProps } from '../LoginField/index.js'\n\nimport { LoginField } from '../LoginField/index.js'\nimport './index.scss'\n\nexport const LoginForm: React.FC<{\n prefillEmail?: string\n prefillPassword?: string\n prefillUsername?: string\n searchParams: { [key: string]: string | string[] | undefined }\n}> = ({ prefillEmail, prefillPassword, prefillUsername, searchParams }) => {\n const config = useConfig()\n\n const {\n admin: {\n routes: { forgot: forgotRoute },\n user: userSlug,\n },\n routes: { admin, api },\n } = config\n\n const collectionConfig = config.collections?.find((collection) => collection?.slug === userSlug)\n const { auth: authOptions } = collectionConfig\n const loginWithUsername = authOptions.loginWithUsername\n const canLoginWithEmail =\n !authOptions.loginWithUsername || authOptions.loginWithUsername.allowEmailLogin\n const canLoginWithUsername = authOptions.loginWithUsername\n\n const [loginType] = React.useState<LoginFieldProps['type']>(() => {\n if (canLoginWithEmail && canLoginWithUsername) return 'emailOrUsername'\n if (canLoginWithUsername) return 'username'\n return 'email'\n })\n\n const { t } = useTranslation()\n\n const initialState: FormState = {\n password: {\n initialValue: prefillPassword ?? undefined,\n valid: true,\n value: prefillPassword ?? undefined,\n },\n }\n\n if (loginWithUsername) {\n initialState.username = {\n initialValue: prefillUsername ?? undefined,\n valid: true,\n value: prefillUsername ?? undefined,\n }\n } else {\n initialState.email = {\n initialValue: prefillEmail ?? undefined,\n valid: true,\n value: prefillEmail ?? undefined,\n }\n }\n\n return (\n <Form\n action={`${
|
|
1
|
+
{"version":3,"sources":["../../../../src/views/Login/LoginForm/index.tsx"],"sourcesContent":["'use client'\n\nimport LinkImport from 'next/link.js'\nimport React from 'react'\n\nconst baseClass = 'login__form'\nconst Link = (LinkImport.default || LinkImport) as unknown as typeof LinkImport.default\n\nimport type { FormState, PayloadRequest } from 'payload'\n\nimport { Form, FormSubmit, PasswordField, useConfig, useTranslation } from '@payloadcms/ui'\nimport { formatAdminURL } from '@payloadcms/ui/shared'\nimport { password } from 'payload/shared'\n\nimport type { LoginFieldProps } from '../LoginField/index.js'\n\nimport { LoginField } from '../LoginField/index.js'\nimport './index.scss'\n\nexport const LoginForm: React.FC<{\n prefillEmail?: string\n prefillPassword?: string\n prefillUsername?: string\n searchParams: { [key: string]: string | string[] | undefined }\n}> = ({ prefillEmail, prefillPassword, prefillUsername, searchParams }) => {\n const config = useConfig()\n\n const {\n admin: {\n routes: { forgot: forgotRoute },\n user: userSlug,\n },\n routes: { admin: adminRoute, api: apiRoute },\n } = config\n\n const collectionConfig = config.collections?.find((collection) => collection?.slug === userSlug)\n const { auth: authOptions } = collectionConfig\n const loginWithUsername = authOptions.loginWithUsername\n const canLoginWithEmail =\n !authOptions.loginWithUsername || authOptions.loginWithUsername.allowEmailLogin\n const canLoginWithUsername = authOptions.loginWithUsername\n\n const [loginType] = React.useState<LoginFieldProps['type']>(() => {\n if (canLoginWithEmail && canLoginWithUsername) return 'emailOrUsername'\n if (canLoginWithUsername) return 'username'\n return 'email'\n })\n\n const { t } = useTranslation()\n\n const initialState: FormState = {\n password: {\n initialValue: prefillPassword ?? undefined,\n valid: true,\n value: prefillPassword ?? undefined,\n },\n }\n\n if (loginWithUsername) {\n initialState.username = {\n initialValue: prefillUsername ?? undefined,\n valid: true,\n value: prefillUsername ?? undefined,\n }\n } else {\n initialState.email = {\n initialValue: prefillEmail ?? undefined,\n valid: true,\n value: prefillEmail ?? undefined,\n }\n }\n\n return (\n <Form\n action={`${apiRoute}/${userSlug}/login`}\n className={baseClass}\n disableSuccessStatus\n initialState={initialState}\n method=\"POST\"\n redirect={typeof searchParams?.redirect === 'string' ? searchParams.redirect : adminRoute}\n waitForAutocomplete\n >\n <div className={`${baseClass}__inputWrap`}>\n <LoginField type={loginType} />\n <PasswordField\n autoComplete=\"off\"\n label={t('general:password')}\n name=\"password\"\n required\n validate={(value) =>\n password(value, {\n name: 'password',\n type: 'text',\n data: {},\n preferences: { fields: {} },\n req: {\n payload: {\n config,\n },\n t,\n } as PayloadRequest,\n required: true,\n siblingData: {},\n })\n }\n />\n </div>\n <Link\n href={formatAdminURL({\n adminRoute,\n path: forgotRoute,\n })}\n >\n {t('authentication:forgotPasswordQuestion')}\n </Link>\n <FormSubmit>{t('authentication:login')}</FormSubmit>\n </Form>\n )\n}\n"],"names":["LinkImport","React","baseClass","Link","default","Form","FormSubmit","PasswordField","useConfig","useTranslation","formatAdminURL","password","LoginField","LoginForm","prefillEmail","prefillPassword","prefillUsername","searchParams","config","admin","routes","forgot","forgotRoute","user","userSlug","adminRoute","api","apiRoute","collectionConfig","collections","find","collection","slug","auth","authOptions","loginWithUsername","canLoginWithEmail","allowEmailLogin","canLoginWithUsername","loginType","useState","t","initialState","initialValue","undefined","valid","value","username","email","action","className","disableSuccessStatus","method","redirect","waitForAutocomplete","div","type","autoComplete","label","name","required","validate","data","preferences","fields","req","payload","siblingData","href","path"],"mappings":"AAAA;;AAEA,OAAOA,gBAAgB,eAAc;AACrC,OAAOC,WAAW,QAAO;AAEzB,MAAMC,YAAY;AAClB,MAAMC,OAAQH,WAAWI,OAAO,IAAIJ;A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C,OAAO;YACPC,OAAOhC,gBAAgB8B;QACzB;IACF;IAEA,qBACE,MAACvC;QACC4C,QAAQ,CAAC,EAAEtB,SAAS,CAAC,EAAEH,SAAS,MAAM,CAAC;QACvC0B,WAAWhD;QACXiD,oBAAoB;QACpBT,cAAcA;QACdU,QAAO;QACPC,UAAU,OAAOpC,cAAcoC,aAAa,WAAWpC,aAAaoC,QAAQ,GAAG5B;QAC/E6B,mBAAmB;;0BAEnB,MAACC;gBAAIL,WAAW,CAAC,EAAEhD,UAAU,WAAW,CAAC;;kCACvC,KAACU;wBAAW4C,MAAMjB;;kCAClB,KAAChC;wBACCkD,cAAa;wBACbC,OAAOjB,EAAE;wBACTkB,MAAK;wBACLC,QAAQ;wBACRC,UAAU,CAACf,QACTnC,SAASmC,OAAO;gCACda,MAAM;gCACNH,MAAM;gCACNM,MAAM,CAAC;gCACPC,aAAa;oCAAEC,QAAQ,CAAC;gCAAE;gCAC1BC,KAAK;oCACHC,SAAS;wCACPhD;oCACF;oCACAuB;gCACF;gCACAmB,UAAU;gCACVO,aAAa,CAAC;4BAChB;;;;0BAIN,KAAChE;gBACCiE,MAAM1D,eAAe;oBACnBe;oBACA4C,MAAM/C;gBACR;0BAECmB,EAAE;;0BAEL,KAACnC;0BAAYmC,EAAE;;;;AAGrB,EAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LogoutClient.d.ts","sourceRoot":"","sources":["../../../src/views/Logout/LogoutClient.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"LogoutClient.d.ts","sourceRoot":"","sources":["../../../src/views/Logout/LogoutClient.tsx"],"names":[],"mappings":"AAIA,OAAO,KAA8B,MAAM,OAAO,CAAA;AAIlD,eAAO,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC;IAClC,UAAU,EAAE,MAAM,CAAA;IAClB,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,QAAQ,EAAE,MAAM,CAAA;CACjB,CAqCA,CAAA"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { Button, useAuth, useTranslation } from '@payloadcms/ui';
|
|
4
|
+
import { formatAdminURL } from '@payloadcms/ui/shared';
|
|
4
5
|
import LinkImport from 'next/link.js';
|
|
5
6
|
import React, { Fragment, useEffect } from 'react';
|
|
6
7
|
const Link = LinkImport.default || LinkImport;
|
|
@@ -31,7 +32,10 @@ export const LogoutClient = (props)=>{
|
|
|
31
32
|
Link: Link,
|
|
32
33
|
buttonStyle: "secondary",
|
|
33
34
|
el: "link",
|
|
34
|
-
url:
|
|
35
|
+
url: formatAdminURL({
|
|
36
|
+
adminRoute,
|
|
37
|
+
path: `/login${redirect && redirect.length > 0 ? `?redirect=${encodeURIComponent(redirect)}` : ''}`
|
|
38
|
+
}),
|
|
35
39
|
children: t('authentication:logBackIn')
|
|
36
40
|
})
|
|
37
41
|
]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/views/Logout/LogoutClient.tsx"],"sourcesContent":["'use client'\nimport { Button, useAuth, useTranslation } from '@payloadcms/ui'\nimport LinkImport from 'next/link.js'\nimport React, { Fragment, useEffect } from 'react'\n\nconst Link = (LinkImport.default || LinkImport) as unknown as typeof LinkImport.default\n\nexport const LogoutClient: React.FC<{\n adminRoute: string\n inactivity?: boolean\n redirect: string\n}> = (props) => {\n const { adminRoute, inactivity, redirect } = props\n\n const [isLoggingOut, setIsLoggingOut] = React.useState<boolean | undefined>(undefined)\n const { logOut } = useAuth()\n const { t } = useTranslation()\n\n useEffect(() => {\n if (!isLoggingOut) {\n setIsLoggingOut(true)\n logOut()\n }\n }, [isLoggingOut, logOut])\n\n if (isLoggingOut) {\n return (\n <Fragment>\n {inactivity && <h2>{t('authentication:loggedOutInactivity')}</h2>}\n {!inactivity && <h2>{t('authentication:loggedOutSuccessfully')}</h2>}\n <Button\n Link={Link}\n buttonStyle=\"secondary\"\n el=\"link\"\n url={
|
|
1
|
+
{"version":3,"sources":["../../../src/views/Logout/LogoutClient.tsx"],"sourcesContent":["'use client'\nimport { Button, useAuth, useTranslation } from '@payloadcms/ui'\nimport { formatAdminURL } from '@payloadcms/ui/shared'\nimport LinkImport from 'next/link.js'\nimport React, { Fragment, useEffect } from 'react'\n\nconst Link = (LinkImport.default || LinkImport) as unknown as typeof LinkImport.default\n\nexport const LogoutClient: React.FC<{\n adminRoute: string\n inactivity?: boolean\n redirect: string\n}> = (props) => {\n const { adminRoute, inactivity, redirect } = props\n\n const [isLoggingOut, setIsLoggingOut] = React.useState<boolean | undefined>(undefined)\n const { logOut } = useAuth()\n const { t } = useTranslation()\n\n useEffect(() => {\n if (!isLoggingOut) {\n setIsLoggingOut(true)\n logOut()\n }\n }, [isLoggingOut, logOut])\n\n if (isLoggingOut) {\n return (\n <Fragment>\n {inactivity && <h2>{t('authentication:loggedOutInactivity')}</h2>}\n {!inactivity && <h2>{t('authentication:loggedOutSuccessfully')}</h2>}\n <Button\n Link={Link}\n buttonStyle=\"secondary\"\n el=\"link\"\n url={formatAdminURL({\n adminRoute,\n path: `/login${\n redirect && redirect.length > 0 ? `?redirect=${encodeURIComponent(redirect)}` : ''\n }`,\n })}\n >\n {t('authentication:logBackIn')}\n </Button>\n </Fragment>\n )\n }\n\n return <Fragment>{t('authentication:loggingOut')}</Fragment>\n}\n"],"names":["Button","useAuth","useTranslation","formatAdminURL","LinkImport","React","Fragment","useEffect","Link","default","LogoutClient","props","adminRoute","inactivity","redirect","isLoggingOut","setIsLoggingOut","useState","undefined","logOut","t","h2","buttonStyle","el","url","path","length","encodeURIComponent"],"mappings":"AAAA;;AACA,SAASA,MAAM,EAAEC,OAAO,EAAEC,cAAc,QAAQ,iBAAgB;AAChE,SAASC,cAAc,QAAQ,wBAAuB;AACtD,OAAOC,gBAAgB,eAAc;AACrC,OAAOC,SAASC,QAAQ,EAAEC,SAAS,QAAQ,QAAO;AAElD,MAAMC,OAAQJ,WAAWK,OAAO,IAAIL;AAEpC,OAAO,MAAMM,eAIR,CAACC;IACJ,MAAM,EAAEC,UAAU,EAAEC,UAAU,EAAEC,QAAQ,EAAE,GAAGH;IAE7C,MAAM,CAACI,cAAcC,gBAAgB,GAAGX,MAAMY,QAAQ,CAAsBC;IAC5E,MAAM,EAAEC,MAAM,EAAE,GAAGlB;IACnB,MAAM,EAAEmB,CAAC,EAAE,GAAGlB;IAEdK,UAAU;QACR,IAAI,CAACQ,cAAc;YACjBC,gBAAgB;YAChBG;QACF;IACF,GAAG;QAACJ;QAAcI;KAAO;IAEzB,IAAIJ,cAAc;QAChB,qBACE,MAACT;;gBACEO,4BAAc,KAACQ;8BAAID,EAAE;;gBACrB,CAACP,4BAAc,KAACQ;8BAAID,EAAE;;8BACvB,KAACpB;oBACCQ,MAAMA;oBACNc,aAAY;oBACZC,IAAG;oBACHC,KAAKrB,eAAe;wBAClBS;wBACAa,MAAM,CAAC,MAAM,EACXX,YAAYA,SAASY,MAAM,GAAG,IAAI,CAAC,UAAU,EAAEC,mBAAmBb,UAAU,CAAC,GAAG,GACjF,CAAC;oBACJ;8BAECM,EAAE;;;;IAIX;IAEA,qBAAO,KAACd;kBAAUc,EAAE;;AACtB,EAAC"}
|
|
@@ -4,11 +4,11 @@ import { LogoutClient } from './LogoutClient.js';
|
|
|
4
4
|
const baseClass = 'logout';
|
|
5
5
|
export { generateLogoutMetadata } from './meta.js';
|
|
6
6
|
export const LogoutView = ({ inactivity, initPageResult, searchParams })=>{
|
|
7
|
-
const { req: { payload: { config: { routes: { admin } } } } } = initPageResult;
|
|
7
|
+
const { req: { payload: { config: { routes: { admin: adminRoute } } } } } = initPageResult;
|
|
8
8
|
return /*#__PURE__*/ _jsx("div", {
|
|
9
9
|
className: `${baseClass}__wrap`,
|
|
10
10
|
children: /*#__PURE__*/ _jsx(LogoutClient, {
|
|
11
|
-
adminRoute:
|
|
11
|
+
adminRoute: adminRoute,
|
|
12
12
|
inactivity: inactivity,
|
|
13
13
|
redirect: searchParams.redirect
|
|
14
14
|
})
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/views/Logout/index.tsx"],"sourcesContent":["import type { AdminViewProps } from 'payload'\n\nimport React from 'react'\n\nimport { LogoutClient } from './LogoutClient.js'\nimport './index.scss'\n\nconst baseClass = 'logout'\n\nexport { generateLogoutMetadata } from './meta.js'\n\nexport const LogoutView: React.FC<\n {\n inactivity?: boolean\n } & AdminViewProps\n> = ({ inactivity, initPageResult, searchParams }) => {\n const {\n req: {\n payload: {\n config: {\n routes: { admin },\n },\n },\n },\n } = initPageResult\n\n return (\n <div className={`${baseClass}__wrap`}>\n <LogoutClient\n adminRoute={
|
|
1
|
+
{"version":3,"sources":["../../../src/views/Logout/index.tsx"],"sourcesContent":["import type { AdminViewProps } from 'payload'\n\nimport React from 'react'\n\nimport { LogoutClient } from './LogoutClient.js'\nimport './index.scss'\n\nconst baseClass = 'logout'\n\nexport { generateLogoutMetadata } from './meta.js'\n\nexport const LogoutView: React.FC<\n {\n inactivity?: boolean\n } & AdminViewProps\n> = ({ inactivity, initPageResult, searchParams }) => {\n const {\n req: {\n payload: {\n config: {\n routes: { admin: adminRoute },\n },\n },\n },\n } = initPageResult\n\n return (\n <div className={`${baseClass}__wrap`}>\n <LogoutClient\n adminRoute={adminRoute}\n inactivity={inactivity}\n redirect={searchParams.redirect as string}\n />\n </div>\n )\n}\n\nexport const LogoutInactivity: React.FC<AdminViewProps> = (props) => {\n return <LogoutView inactivity {...props} />\n}\n"],"names":["React","LogoutClient","baseClass","generateLogoutMetadata","LogoutView","inactivity","initPageResult","searchParams","req","payload","config","routes","admin","adminRoute","div","className","redirect","LogoutInactivity","props"],"mappings":";AAEA,OAAOA,WAAW,QAAO;AAEzB,SAASC,YAAY,QAAQ,oBAAmB;AAGhD,MAAMC,YAAY;AAElB,SAASC,sBAAsB,QAAQ,YAAW;AAElD,OAAO,MAAMC,aAIT,CAAC,EAAEC,UAAU,EAAEC,cAAc,EAAEC,YAAY,EAAE;IAC/C,MAAM,EACJC,KAAK,EACHC,SAAS,EACPC,QAAQ,EACNC,QAAQ,EAAEC,OAAOC,UAAU,EAAE,EAC9B,EACF,EACF,EACF,GAAGP;IAEJ,qBACE,KAACQ;QAAIC,WAAW,CAAC,EAAEb,UAAU,MAAM,CAAC;kBAClC,cAAA,KAACD;YACCY,YAAYA;YACZR,YAAYA;YACZW,UAAUT,aAAaS,QAAQ;;;AAIvC,EAAC;AAED,OAAO,MAAMC,mBAA6C,CAACC;IACzD,qBAAO,KAACd;QAAWC,UAAU;QAAE,GAAGa,KAAK;;AACzC,EAAC"}
|
|
@@ -9,7 +9,7 @@ export const NotFoundClient = (props)=>{
|
|
|
9
9
|
const { marginTop = 'large' } = props;
|
|
10
10
|
const { setStepNav } = useStepNav();
|
|
11
11
|
const { t } = useTranslation();
|
|
12
|
-
const { routes: { admin } } = useConfig();
|
|
12
|
+
const { routes: { admin: adminRoute } } = useConfig();
|
|
13
13
|
useEffect(()=>{
|
|
14
14
|
setStepNav([
|
|
15
15
|
{
|
|
@@ -38,7 +38,7 @@ export const NotFoundClient = (props)=>{
|
|
|
38
38
|
Link: Link,
|
|
39
39
|
className: `${baseClass}__button`,
|
|
40
40
|
el: "link",
|
|
41
|
-
to:
|
|
41
|
+
to: adminRoute,
|
|
42
42
|
children: t('general:backToDashboard')
|
|
43
43
|
})
|
|
44
44
|
]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/views/NotFound/index.client.tsx"],"sourcesContent":["'use client'\nimport { Button, Gutter, useConfig, useStepNav, useTranslation } from '@payloadcms/ui'\nimport LinkImport from 'next/link.js'\nimport React, { useEffect } from 'react'\n\nimport './index.scss'\n\nconst baseClass = 'not-found'\n\nconst Link = (LinkImport.default || LinkImport) as unknown as typeof LinkImport.default\n\nexport const NotFoundClient: React.FC<{\n marginTop?: 'large'\n}> = (props) => {\n const { marginTop = 'large' } = props\n\n const { setStepNav } = useStepNav()\n const { t } = useTranslation()\n\n const {\n routes: { admin },\n } = useConfig()\n\n useEffect(() => {\n setStepNav([\n {\n label: t('general:notFound'),\n },\n ])\n }, [setStepNav, t])\n\n return (\n <div\n className={[baseClass, marginTop && `${baseClass}--margin-top-${marginTop}`]\n .filter(Boolean)\n .join(' ')}\n >\n <Gutter className={`${baseClass}__wrap`}>\n <h1>{t('general:nothingFound')}</h1>\n <p>{t('general:sorryNotFound')}</p>\n <Button Link={Link} className={`${baseClass}__button`} el=\"link\" to={
|
|
1
|
+
{"version":3,"sources":["../../../src/views/NotFound/index.client.tsx"],"sourcesContent":["'use client'\nimport { Button, Gutter, useConfig, useStepNav, useTranslation } from '@payloadcms/ui'\nimport LinkImport from 'next/link.js'\nimport React, { useEffect } from 'react'\n\nimport './index.scss'\n\nconst baseClass = 'not-found'\n\nconst Link = (LinkImport.default || LinkImport) as unknown as typeof LinkImport.default\n\nexport const NotFoundClient: React.FC<{\n marginTop?: 'large'\n}> = (props) => {\n const { marginTop = 'large' } = props\n\n const { setStepNav } = useStepNav()\n const { t } = useTranslation()\n\n const {\n routes: { admin: adminRoute },\n } = useConfig()\n\n useEffect(() => {\n setStepNav([\n {\n label: t('general:notFound'),\n },\n ])\n }, [setStepNav, t])\n\n return (\n <div\n className={[baseClass, marginTop && `${baseClass}--margin-top-${marginTop}`]\n .filter(Boolean)\n .join(' ')}\n >\n <Gutter className={`${baseClass}__wrap`}>\n <h1>{t('general:nothingFound')}</h1>\n <p>{t('general:sorryNotFound')}</p>\n <Button Link={Link} className={`${baseClass}__button`} el=\"link\" to={adminRoute}>\n {t('general:backToDashboard')}\n </Button>\n </Gutter>\n </div>\n )\n}\n"],"names":["Button","Gutter","useConfig","useStepNav","useTranslation","LinkImport","React","useEffect","baseClass","Link","default","NotFoundClient","props","marginTop","setStepNav","t","routes","admin","adminRoute","label","div","className","filter","Boolean","join","h1","p","el","to"],"mappings":"AAAA;;AACA,SAASA,MAAM,EAAEC,MAAM,EAAEC,SAAS,EAAEC,UAAU,EAAEC,cAAc,QAAQ,iBAAgB;AACtF,OAAOC,gBAAgB,eAAc;AACrC,OAAOC,SAASC,SAAS,QAAQ,QAAO;AAIxC,MAAMC,YAAY;AAElB,MAAMC,OAAQJ,WAAWK,OAAO,IAAIL;AAEpC,OAAO,MAAMM,iBAER,CAACC;IACJ,MAAM,EAAEC,YAAY,OAAO,EAAE,GAAGD;IAEhC,MAAM,EAAEE,UAAU,EAAE,GAAGX;IACvB,MAAM,EAAEY,CAAC,EAAE,GAAGX;IAEd,MAAM,EACJY,QAAQ,EAAEC,OAAOC,UAAU,EAAE,EAC9B,GAAGhB;IAEJK,UAAU;QACRO,WAAW;YACT;gBACEK,OAAOJ,EAAE;YACX;SACD;IACH,GAAG;QAACD;QAAYC;KAAE;IAElB,qBACE,KAACK;QACCC,WAAW;YAACb;YAAWK,aAAa,CAAC,EAAEL,UAAU,aAAa,EAAEK,UAAU,CAAC;SAAC,CACzES,MAAM,CAACC,SACPC,IAAI,CAAC;kBAER,cAAA,MAACvB;YAAOoB,WAAW,CAAC,EAAEb,UAAU,MAAM,CAAC;;8BACrC,KAACiB;8BAAIV,EAAE;;8BACP,KAACW;8BAAGX,EAAE;;8BACN,KAACf;oBAAOS,MAAMA;oBAAMY,WAAW,CAAC,EAAEb,UAAU,QAAQ,CAAC;oBAAEmB,IAAG;oBAAOC,IAAIV;8BAClEH,EAAE;;;;;AAKb,EAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/views/NotFound/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAA;AACpD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,MAAM,CAAA;AACpC,OAAO,KAAK,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/views/NotFound/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAA;AACpD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,MAAM,CAAA;AACpC,OAAO,KAAK,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAIlE,OAAO,KAAmB,MAAM,OAAO,CAAA;AAOvC,eAAO,MAAM,oBAAoB,+BAE9B;IACD,MAAM,EAAE,OAAO,CAAC,eAAe,CAAC,GAAG,eAAe,CAAA;IAClD,MAAM,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,EAAE,CAAA;KAAE,CAAA;CAC9C,KAAG,OAAO,CAAC,QAAQ,CAUnB,CAAA;AAED,MAAM,MAAM,oBAAoB,GAAG,CAAC,IAAI,EAAE;IACxC,MAAM,EAAE,eAAe,CAAA;IACvB,IAAI,EAAE,IAAI,CAAA;IACV,MAAM,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,EAAE,CAAA;KAAE,CAAA;CAC9C,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAA;AAEvB,eAAO,MAAM,YAAY,qDAItB;IACD,MAAM,EAAE,OAAO,CAAC,eAAe,CAAC,CAAA;IAChC,MAAM,EAAE;QACN,QAAQ,EAAE,MAAM,EAAE,CAAA;KACnB,CAAA;IACD,YAAY,EAAE;QACZ,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,EAAE,CAAA;KACjC,CAAA;CACF,+BA4BA,CAAA;AAED,eAAO,MAAM,YAAY,EAAE,kBAE1B,CAAA"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { HydrateClientUser } from '@payloadcms/ui';
|
|
3
|
+
import { formatAdminURL } from '@payloadcms/ui/shared';
|
|
3
4
|
import React, { Fragment } from 'react';
|
|
4
5
|
import { DefaultTemplate } from '../../templates/Default/index.js';
|
|
5
6
|
import { getNextRequestI18n } from '../../utilities/getNextRequestI18n.js';
|
|
@@ -20,7 +21,10 @@ export const NotFoundPage = async ({ config: configPromise, params, searchParams
|
|
|
20
21
|
const initPageResult = await initPage({
|
|
21
22
|
config,
|
|
22
23
|
redirectUnauthenticatedUser: true,
|
|
23
|
-
route:
|
|
24
|
+
route: formatAdminURL({
|
|
25
|
+
adminRoute,
|
|
26
|
+
path: '/not-found'
|
|
27
|
+
}),
|
|
24
28
|
searchParams
|
|
25
29
|
});
|
|
26
30
|
return /*#__PURE__*/ _jsxs(Fragment, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/views/NotFound/index.tsx"],"sourcesContent":["import type { I18n } from '@payloadcms/translations'\nimport type { Metadata } from 'next'\nimport type { AdminViewComponent, SanitizedConfig } from 'payload'\n\nimport { HydrateClientUser } from '@payloadcms/ui'\nimport React, { Fragment } from 'react'\n\nimport { DefaultTemplate } from '../../templates/Default/index.js'\nimport { getNextRequestI18n } from '../../utilities/getNextRequestI18n.js'\nimport { initPage } from '../../utilities/initPage/index.js'\nimport { NotFoundClient } from './index.client.js'\n\nexport const generatePageMetadata = async ({\n config: configPromise,\n}: {\n config: Promise<SanitizedConfig> | SanitizedConfig\n params?: { [key: string]: string | string[] }\n}): Promise<Metadata> => {\n const config = await configPromise\n\n const i18n = await getNextRequestI18n({\n config,\n })\n\n return {\n title: i18n.t('general:notFound'),\n }\n}\n\nexport type GenerateViewMetadata = (args: {\n config: SanitizedConfig\n i18n: I18n\n params?: { [key: string]: string | string[] }\n}) => Promise<Metadata>\n\nexport const NotFoundPage = async ({\n config: configPromise,\n params,\n searchParams,\n}: {\n config: Promise<SanitizedConfig>\n params: {\n segments: string[]\n }\n searchParams: {\n [key: string]: string | string[]\n }\n}) => {\n const config = await configPromise\n const { routes: { admin: adminRoute } = {} } = config\n\n const initPageResult = await initPage({\n config,\n redirectUnauthenticatedUser: true,\n route:
|
|
1
|
+
{"version":3,"sources":["../../../src/views/NotFound/index.tsx"],"sourcesContent":["import type { I18n } from '@payloadcms/translations'\nimport type { Metadata } from 'next'\nimport type { AdminViewComponent, SanitizedConfig } from 'payload'\n\nimport { HydrateClientUser } from '@payloadcms/ui'\nimport { formatAdminURL } from '@payloadcms/ui/shared'\nimport React, { Fragment } from 'react'\n\nimport { DefaultTemplate } from '../../templates/Default/index.js'\nimport { getNextRequestI18n } from '../../utilities/getNextRequestI18n.js'\nimport { initPage } from '../../utilities/initPage/index.js'\nimport { NotFoundClient } from './index.client.js'\n\nexport const generatePageMetadata = async ({\n config: configPromise,\n}: {\n config: Promise<SanitizedConfig> | SanitizedConfig\n params?: { [key: string]: string | string[] }\n}): Promise<Metadata> => {\n const config = await configPromise\n\n const i18n = await getNextRequestI18n({\n config,\n })\n\n return {\n title: i18n.t('general:notFound'),\n }\n}\n\nexport type GenerateViewMetadata = (args: {\n config: SanitizedConfig\n i18n: I18n\n params?: { [key: string]: string | string[] }\n}) => Promise<Metadata>\n\nexport const NotFoundPage = async ({\n config: configPromise,\n params,\n searchParams,\n}: {\n config: Promise<SanitizedConfig>\n params: {\n segments: string[]\n }\n searchParams: {\n [key: string]: string | string[]\n }\n}) => {\n const config = await configPromise\n const { routes: { admin: adminRoute } = {} } = config\n\n const initPageResult = await initPage({\n config,\n redirectUnauthenticatedUser: true,\n route: formatAdminURL({ adminRoute, path: '/not-found' }),\n searchParams,\n })\n\n return (\n <Fragment>\n <HydrateClientUser permissions={initPageResult.permissions} user={initPageResult.req.user} />\n <DefaultTemplate\n i18n={initPageResult.req.i18n}\n locale={initPageResult.locale}\n params={params}\n payload={initPageResult.req.payload}\n permissions={initPageResult.permissions}\n searchParams={searchParams}\n user={initPageResult.req.user}\n visibleEntities={initPageResult.visibleEntities}\n >\n <NotFoundClient />\n </DefaultTemplate>\n </Fragment>\n )\n}\n\nexport const NotFoundView: AdminViewComponent = () => {\n return <NotFoundClient marginTop=\"large\" />\n}\n"],"names":["HydrateClientUser","formatAdminURL","React","Fragment","DefaultTemplate","getNextRequestI18n","initPage","NotFoundClient","generatePageMetadata","config","configPromise","i18n","title","t","NotFoundPage","params","searchParams","routes","admin","adminRoute","initPageResult","redirectUnauthenticatedUser","route","path","permissions","user","req","locale","payload","visibleEntities","NotFoundView","marginTop"],"mappings":";AAIA,SAASA,iBAAiB,QAAQ,iBAAgB;AAClD,SAASC,cAAc,QAAQ,wBAAuB;AACtD,OAAOC,SAASC,QAAQ,QAAQ,QAAO;AAEvC,SAASC,eAAe,QAAQ,mCAAkC;AAClE,SAASC,kBAAkB,QAAQ,wCAAuC;AAC1E,SAASC,QAAQ,QAAQ,oCAAmC;AAC5D,SAASC,cAAc,QAAQ,oBAAmB;AAElD,OAAO,MAAMC,uBAAuB,OAAO,EACzCC,QAAQC,aAAa,EAItB;IACC,MAAMD,SAAS,MAAMC;IAErB,MAAMC,OAAO,MAAMN,mBAAmB;QACpCI;IACF;IAEA,OAAO;QACLG,OAAOD,KAAKE,CAAC,CAAC;IAChB;AACF,EAAC;AAQD,OAAO,MAAMC,eAAe,OAAO,EACjCL,QAAQC,aAAa,EACrBK,MAAM,EACNC,YAAY,EASb;IACC,MAAMP,SAAS,MAAMC;IACrB,MAAM,EAAEO,QAAQ,EAAEC,OAAOC,UAAU,EAAE,GAAG,CAAC,CAAC,EAAE,GAAGV;IAE/C,MAAMW,iBAAiB,MAAMd,SAAS;QACpCG;QACAY,6BAA6B;QAC7BC,OAAOrB,eAAe;YAAEkB;YAAYI,MAAM;QAAa;QACvDP;IACF;IAEA,qBACE,MAACb;;0BACC,KAACH;gBAAkBwB,aAAaJ,eAAeI,WAAW;gBAAEC,MAAML,eAAeM,GAAG,CAACD,IAAI;;0BACzF,KAACrB;gBACCO,MAAMS,eAAeM,GAAG,CAACf,IAAI;gBAC7BgB,QAAQP,eAAeO,MAAM;gBAC7BZ,QAAQA;gBACRa,SAASR,eAAeM,GAAG,CAACE,OAAO;gBACnCJ,aAAaJ,eAAeI,WAAW;gBACvCR,cAAcA;gBACdS,MAAML,eAAeM,GAAG,CAACD,IAAI;gBAC7BI,iBAAiBT,eAAeS,eAAe;0BAE/C,cAAA,KAACtB;;;;AAIT,EAAC;AAED,OAAO,MAAMuB,eAAmC;IAC9C,qBAAO,KAACvB;QAAewB,WAAU;;AACnC,EAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.client.d.ts","sourceRoot":"","sources":["../../../src/views/ResetPassword/index.client.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.client.d.ts","sourceRoot":"","sources":["../../../src/views/ResetPassword/index.client.tsx"],"names":[],"mappings":"AAgBA,OAAO,KAAK,MAAM,OAAO,CAAA;AAGzB,KAAK,IAAI,GAAG;IACV,KAAK,EAAE,MAAM,CAAA;CACd,CAAA;AAeD,eAAO,MAAM,mBAAmB,EAAE,KAAK,CAAC,EAAE,CAAC,IAAI,CA8C9C,CAAA"}
|