@payloadcms/ui 3.45.0-internal.5103e58 → 3.45.0
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/Autosave/index.d.ts.map +1 -1
- package/dist/elements/Autosave/index.js +20 -30
- package/dist/elements/Autosave/index.js.map +1 -1
- package/dist/elements/BulkUpload/EditForm/index.d.ts.map +1 -1
- package/dist/elements/BulkUpload/EditForm/index.js +36 -63
- package/dist/elements/BulkUpload/EditForm/index.js.map +1 -1
- package/dist/elements/BulkUpload/EditMany/DrawerContent.d.ts +1 -1
- package/dist/elements/BulkUpload/EditMany/DrawerContent.d.ts.map +1 -1
- package/dist/elements/BulkUpload/EditMany/DrawerContent.js +20 -16
- package/dist/elements/BulkUpload/EditMany/DrawerContent.js.map +1 -1
- package/dist/elements/BulkUpload/FormsManager/index.d.ts.map +1 -1
- package/dist/elements/BulkUpload/FormsManager/index.js +6 -5
- package/dist/elements/BulkUpload/FormsManager/index.js.map +1 -1
- package/dist/elements/BulkUpload/index.d.ts +3 -4
- package/dist/elements/BulkUpload/index.d.ts.map +1 -1
- package/dist/elements/BulkUpload/index.js +26 -33
- package/dist/elements/BulkUpload/index.js.map +1 -1
- package/dist/elements/DocumentDrawer/DrawerContent.d.ts.map +1 -1
- package/dist/elements/DocumentDrawer/DrawerContent.js +9 -7
- package/dist/elements/DocumentDrawer/DrawerContent.js.map +1 -1
- package/dist/elements/FileDetails/StaticFileDetails/index.js +1 -1
- package/dist/elements/FileDetails/StaticFileDetails/index.js.map +1 -1
- package/dist/elements/ListHeader/TitleActions/ListBulkUploadButton.d.ts.map +1 -1
- package/dist/elements/ListHeader/TitleActions/ListBulkUploadButton.js +11 -14
- package/dist/elements/ListHeader/TitleActions/ListBulkUploadButton.js.map +1 -1
- package/dist/elements/Upload/index.d.ts.map +1 -1
- package/dist/elements/Upload/index.js +1 -1
- package/dist/elements/Upload/index.js.map +1 -1
- package/dist/elements/WhereBuilder/index.js +2 -2
- package/dist/elements/WhereBuilder/index.js.map +1 -1
- package/dist/exports/client/index.js +22 -22
- package/dist/exports/client/index.js.map +4 -4
- package/dist/fields/Upload/Input.d.ts.map +1 -1
- package/dist/fields/Upload/Input.js +2 -4
- package/dist/fields/Upload/Input.js.map +1 -1
- package/dist/fields/Upload/index.d.ts.map +1 -1
- package/dist/fields/Upload/index.js +31 -27
- package/dist/fields/Upload/index.js.map +1 -1
- package/dist/forms/Form/fieldReducer.d.ts.map +1 -1
- package/dist/forms/Form/fieldReducer.js +0 -1
- package/dist/forms/Form/fieldReducer.js.map +1 -1
- package/dist/forms/Form/types.d.ts +2 -2
- package/dist/forms/Form/types.d.ts.map +1 -1
- package/dist/forms/Form/types.js.map +1 -1
- package/dist/forms/fieldSchemasToFormState/addFieldStatePromise.d.ts.map +1 -1
- package/dist/forms/fieldSchemasToFormState/addFieldStatePromise.js +19 -23
- package/dist/forms/fieldSchemasToFormState/addFieldStatePromise.js.map +1 -1
- package/dist/forms/fieldSchemasToFormState/calculateDefaultValues/index.d.ts +2 -2
- package/dist/forms/fieldSchemasToFormState/calculateDefaultValues/index.d.ts.map +1 -1
- package/dist/forms/fieldSchemasToFormState/calculateDefaultValues/index.js.map +1 -1
- package/dist/forms/fieldSchemasToFormState/calculateDefaultValues/iterateFields.d.ts +2 -2
- package/dist/forms/fieldSchemasToFormState/calculateDefaultValues/iterateFields.d.ts.map +1 -1
- package/dist/forms/fieldSchemasToFormState/calculateDefaultValues/iterateFields.js.map +1 -1
- package/dist/forms/fieldSchemasToFormState/calculateDefaultValues/promise.d.ts +2 -2
- package/dist/forms/fieldSchemasToFormState/calculateDefaultValues/promise.d.ts.map +1 -1
- package/dist/forms/fieldSchemasToFormState/calculateDefaultValues/promise.js.map +1 -1
- package/dist/forms/fieldSchemasToFormState/isRowCollapsed.d.ts +8 -0
- package/dist/forms/fieldSchemasToFormState/isRowCollapsed.d.ts.map +1 -0
- package/dist/forms/fieldSchemasToFormState/isRowCollapsed.js +18 -0
- package/dist/forms/fieldSchemasToFormState/isRowCollapsed.js.map +1 -0
- package/dist/forms/useField/index.d.ts.map +1 -1
- package/dist/forms/useField/index.js +68 -75
- package/dist/forms/useField/index.js.map +1 -1
- package/dist/hooks/useControllableState.d.ts +6 -0
- package/dist/hooks/useControllableState.d.ts.map +1 -0
- package/dist/hooks/useControllableState.js +21 -0
- package/dist/hooks/useControllableState.js.map +1 -0
- package/dist/hooks/useQueues.d.ts +1 -1
- package/dist/hooks/useQueues.d.ts.map +1 -1
- package/dist/hooks/useQueues.js.map +1 -1
- package/dist/providers/Auth/index.d.ts +2 -2
- package/dist/providers/Auth/index.d.ts.map +1 -1
- package/dist/providers/Auth/index.js.map +1 -1
- package/dist/providers/DocumentInfo/index.d.ts.map +1 -1
- package/dist/providers/DocumentInfo/index.js +12 -11
- package/dist/providers/DocumentInfo/index.js.map +1 -1
- package/dist/providers/Root/index.d.ts +2 -2
- package/dist/providers/Root/index.d.ts.map +1 -1
- package/dist/providers/Root/index.js.map +1 -1
- package/dist/styles.css +1 -1
- package/dist/views/List/index.d.ts.map +1 -1
- package/dist/views/List/index.js +12 -15
- package/dist/views/List/index.js.map +1 -1
- package/package.json +4 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["qs","React","createContext","use","useCallback","useEffect","useMemo","useRef","useState","useAuth","requests","formatDocTitle","useConfig","DocumentTitleProvider","useLocale","useLocaleLoading","usePreferences","useTranslation","UploadEditsProvider","useUploadEdits","useGetDocPermissions","Context","useDocumentInfo","DocumentInfo","children","props","id","collectionSlug","currentEditor","currentEditorFromProps","docPermissions","docPermissionsFromProps","globalSlug","hasPublishedDoc","hasPublishedDocFromProps","hasPublishPermission","hasPublishPermissionFromProps","hasSavePermission","hasSavePermissionFromProps","initialData","initialState","isLocked","isLockedFromProps","lastUpdateTime","lastUpdateTimeFromProps","mostRecentVersionIsAutosaved","mostRecentVersionIsAutosavedFromProps","unpublishedVersionCount","unpublishedVersionCountFromProps","versionCount","versionCountFromProps","setDocPermissions","setHasSavePermission","setHasPublishPermission","permissions","config","admin","dateFormat","routes","api","serverURL","getEntityConfig","collectionConfig","globalConfig","abortControllerRef","AbortController","docConfig","i18n","uploadEdits","title","setDocumentTitle","data","fallback","toString","setMostRecentVersionIsAutosaved","setVersionCount","setHasPublishedDoc","setUnpublishedVersionCount","documentIsLocked","setDocumentIsLocked","setCurrentEditor","setLastUpdateTime","savedDocumentData","setSavedDocumentData","uploadStatus","setUploadStatus","updateUploadStatus","status","getPreference","setPreference","code","locale","localeIsLoading","isInitializing","undefined","baseURL","slug","pluralType","preferencesKey","unlockDocument","docID","isGlobal","query","request","get","credentials","docs","json","length","lockID","delete","headers","error","console","updateDocumentEditor","user","userData","relationTo","collection","value","patch","body","JSON","stringify","getDocPermissions","getDocPreferences","setDocFieldPreferences","path","fieldPreferences","allPreferences","fields","e","incrementVersionCount","newCount","versions","maxPerDoc","Math","min","max","updateSavedDocumentData","re1","current","abort","_err","action","docURL","params","depth","addQueryPrefix","_jsx","DocumentInfoProvider"],"sources":["../../../src/providers/DocumentInfo/index.tsx"],"sourcesContent":["'use client'\nimport type { ClientUser, DocumentPreferences, SanitizedDocumentPermissions } from 'payload'\n\nimport * as qs from 'qs-esm'\nimport React, { createContext, use, useCallback, useEffect, useMemo, useRef, useState } from 'react'\n\nimport { useAuth } from '../../providers/Auth/index.js'\nimport { requests } from '../../utilities/api.js'\nimport { formatDocTitle } from '../../utilities/formatDocTitle/index.js'\nimport { useConfig } from '../Config/index.js'\nimport { DocumentTitleProvider } from '../DocumentTitle/index.js'\nimport { useLocale, useLocaleLoading } from '../Locale/index.js'\nimport { usePreferences } from '../Preferences/index.js'\nimport { useTranslation } from '../Translation/index.js'\nimport { UploadEditsProvider, useUploadEdits } from '../UploadEdits/index.js'\nimport { type DocumentInfoContext, type DocumentInfoProps } from './types.js'\nimport { useGetDocPermissions } from './useGetDocPermissions.js'\n\nconst Context = createContext({} as DocumentInfoContext)\n\nexport type * from './types.js'\n\nexport const useDocumentInfo = (): DocumentInfoContext => use(Context)\n\nconst DocumentInfo: React.FC<\n {\n readonly children: React.ReactNode\n } & DocumentInfoProps\n> = ({ children, ...props }) => {\n const {\n id,\n collectionSlug,\n currentEditor: currentEditorFromProps,\n docPermissions: docPermissionsFromProps,\n globalSlug,\n hasPublishedDoc: hasPublishedDocFromProps,\n hasPublishPermission: hasPublishPermissionFromProps,\n hasSavePermission: hasSavePermissionFromProps,\n initialData,\n initialState,\n isLocked: isLockedFromProps,\n lastUpdateTime: lastUpdateTimeFromProps,\n mostRecentVersionIsAutosaved: mostRecentVersionIsAutosavedFromProps,\n unpublishedVersionCount: unpublishedVersionCountFromProps,\n versionCount: versionCountFromProps,\n } = props\n\n const [docPermissions, setDocPermissions] =\n useState<SanitizedDocumentPermissions>(docPermissionsFromProps)\n\n const [hasSavePermission, setHasSavePermission] = useState<boolean>(hasSavePermissionFromProps)\n\n const [hasPublishPermission, setHasPublishPermission] = useState<boolean>(\n hasPublishPermissionFromProps,\n )\n\n const { permissions } = useAuth()\n\n const {\n config: {\n admin: { dateFormat },\n routes: { api },\n serverURL,\n },\n getEntityConfig,\n } = useConfig()\n\n const collectionConfig = getEntityConfig({ collectionSlug })\n const globalConfig = getEntityConfig({ globalSlug })\n\n const abortControllerRef = useRef(new AbortController())\n const docConfig = collectionConfig || globalConfig\n\n const { i18n } = useTranslation()\n\n const { uploadEdits } = useUploadEdits()\n\n /**\n * @deprecated This state will be removed in v4.\n * This is for performance reasons. Use the `DocumentTitleContext` instead.\n */\n const [title, setDocumentTitle] = useState(() =>\n formatDocTitle({\n collectionConfig,\n data: { ...(initialData || {}), id },\n dateFormat,\n fallback: id?.toString(),\n globalConfig,\n i18n,\n }),\n )\n\n const [mostRecentVersionIsAutosaved, setMostRecentVersionIsAutosaved] = useState(\n mostRecentVersionIsAutosavedFromProps,\n )\n\n const [versionCount, setVersionCount] = useState(versionCountFromProps)\n\n const [hasPublishedDoc, setHasPublishedDoc] = useState(hasPublishedDocFromProps)\n const [unpublishedVersionCount, setUnpublishedVersionCount] = useState(\n unpublishedVersionCountFromProps,\n )\n\n const [documentIsLocked, setDocumentIsLocked] = useState<boolean | undefined>(isLockedFromProps)\n const [currentEditor, setCurrentEditor] = useState<ClientUser | null>(currentEditorFromProps)\n const [lastUpdateTime, setLastUpdateTime] = useState<number>(lastUpdateTimeFromProps)\n const [savedDocumentData, setSavedDocumentData] = useState(initialData)\n const [uploadStatus, setUploadStatus] = useState<'failed' | 'idle' | 'uploading'>('idle')\n\n const updateUploadStatus = useCallback((status: 'failed' | 'idle' | 'uploading') => {\n setUploadStatus(status)\n }, [])\n\n const { getPreference, setPreference } = usePreferences()\n const { code: locale } = useLocale()\n const { localeIsLoading } = useLocaleLoading()\n\n const isInitializing = useMemo(\n () => initialState === undefined || initialData === undefined || localeIsLoading,\n [initialData, initialState, localeIsLoading],\n )\n\n const baseURL = `${serverURL}${api}`\n let slug: string\n let pluralType: 'collections' | 'globals'\n let preferencesKey: string\n\n if (globalSlug) {\n slug = globalSlug\n pluralType = 'globals'\n preferencesKey = `global-${slug}`\n }\n\n if (collectionSlug) {\n slug = collectionSlug\n pluralType = 'collections'\n\n if (id) {\n preferencesKey = `collection-${slug}-${id}`\n }\n }\n\n const unlockDocument = useCallback(\n async (docID: number | string, slug: string) => {\n try {\n const isGlobal = slug === globalSlug\n\n const query = isGlobal\n ? `where[globalSlug][equals]=${slug}`\n : `where[document.value][equals]=${docID}&where[document.relationTo][equals]=${slug}`\n\n const request = await requests.get(`${serverURL}${api}/payload-locked-documents?${query}`, {\n credentials: 'include',\n })\n\n const { docs } = await request.json()\n\n if (docs?.length > 0) {\n const lockID = docs[0].id\n await requests.delete(`${serverURL}${api}/payload-locked-documents/${lockID}`, {\n credentials: 'include',\n headers: {\n 'Content-Type': 'application/json',\n },\n })\n setDocumentIsLocked(false)\n }\n } catch (error) {\n // eslint-disable-next-line no-console\n console.error('Failed to unlock the document', error)\n }\n },\n [serverURL, api, globalSlug],\n )\n\n const updateDocumentEditor = useCallback(\n async (docID: number | string, slug: string, user: ClientUser | number | string) => {\n try {\n const isGlobal = slug === globalSlug\n\n const query = isGlobal\n ? `where[globalSlug][equals]=${slug}`\n : `where[document.value][equals]=${docID}&where[document.relationTo][equals]=${slug}`\n\n // Check if the document is already locked\n const request = await requests.get(`${serverURL}${api}/payload-locked-documents?${query}`, {\n credentials: 'include',\n })\n\n const { docs } = await request.json()\n\n if (docs?.length > 0) {\n const lockID = docs[0].id\n\n const userData =\n typeof user === 'object'\n ? { relationTo: user.collection, value: user.id }\n : { relationTo: 'users', value: user }\n\n // Send a patch request to update the _lastEdited info\n await requests.patch(`${serverURL}${api}/payload-locked-documents/${lockID}`, {\n body: JSON.stringify({\n user: userData,\n }),\n credentials: 'include',\n headers: {\n 'Content-Type': 'application/json',\n },\n })\n }\n } catch (error) {\n // eslint-disable-next-line no-console\n console.error('Failed to update the document editor', error)\n }\n },\n [serverURL, api, globalSlug],\n )\n\n const getDocPermissions = useGetDocPermissions({\n id: id as string,\n api,\n collectionSlug,\n globalSlug,\n i18n,\n locale,\n permissions,\n serverURL,\n setDocPermissions,\n setHasPublishPermission,\n setHasSavePermission,\n })\n\n const getDocPreferences = useCallback(() => {\n return getPreference<DocumentPreferences>(preferencesKey)\n }, [getPreference, preferencesKey])\n\n const setDocFieldPreferences = useCallback<DocumentInfoContext['setDocFieldPreferences']>(\n async (path, fieldPreferences) => {\n const allPreferences = await getDocPreferences()\n\n if (preferencesKey) {\n try {\n await setPreference(preferencesKey, {\n ...allPreferences,\n fields: {\n ...(allPreferences?.fields || {}),\n [path]: {\n ...allPreferences?.fields?.[path],\n ...fieldPreferences,\n },\n },\n })\n } catch (e) {\n console.error(e) // eslint-disable-line no-console\n }\n }\n },\n [setPreference, preferencesKey, getDocPreferences],\n )\n\n const incrementVersionCount = useCallback(() => {\n const newCount = versionCount + 1\n if (collectionConfig && collectionConfig.versions) {\n if (collectionConfig.versions.maxPerDoc > 0) {\n setVersionCount(Math.min(newCount, collectionConfig.versions.maxPerDoc))\n } else {\n setVersionCount(newCount)\n }\n } else if (globalConfig && globalConfig.versions) {\n if (globalConfig.versions.max > 0) {\n setVersionCount(Math.min(newCount, globalConfig.versions.max))\n } else {\n setVersionCount(newCount)\n }\n }\n }, [collectionConfig, globalConfig, versionCount])\n\n const updateSavedDocumentData = React.useCallback<DocumentInfoContext['updateSavedDocumentData']>(\n (json) => {\n setSavedDocumentData(json)\n },\n [],\n )\n\n /**\n * @todo: Remove this in v4\n * Users should use the `DocumentTitleContext` instead.\n */\n useEffect(() => {\n setDocumentTitle(\n formatDocTitle({\n collectionConfig,\n data: { ...savedDocumentData, id },\n dateFormat,\n fallback: id?.toString(),\n globalConfig,\n i18n,\n }),\n )\n }, [collectionConfig, globalConfig, savedDocumentData, dateFormat, i18n, id])\n\n // clean on unmount\n useEffect(() => {\n const re1 = abortControllerRef.current\n\n return () => {\n if (re1) {\n try {\n re1.abort()\n } catch (_err) {\n // swallow error\n }\n }\n }\n }, [])\n\n const action: string = React.useMemo(() => {\n const docURL = `${baseURL}${pluralType === 'globals' ? `/globals` : ''}/${slug}${id ? `/${id}` : ''}`\n const params = {\n depth: 0,\n 'fallback-locale': 'null',\n locale,\n uploadEdits: uploadEdits || undefined,\n }\n\n return `${docURL}${qs.stringify(params, {\n addQueryPrefix: true,\n })}`\n }, [baseURL, locale, pluralType, id, slug, uploadEdits])\n\n const value: DocumentInfoContext = {\n ...props,\n action,\n currentEditor,\n docConfig,\n docPermissions,\n documentIsLocked,\n getDocPermissions,\n getDocPreferences,\n hasPublishedDoc,\n hasPublishPermission,\n hasSavePermission,\n incrementVersionCount,\n initialData,\n initialState,\n isInitializing,\n lastUpdateTime,\n mostRecentVersionIsAutosaved,\n preferencesKey,\n savedDocumentData,\n setCurrentEditor,\n setDocFieldPreferences,\n setDocumentIsLocked,\n setDocumentTitle,\n setHasPublishedDoc,\n setLastUpdateTime,\n setMostRecentVersionIsAutosaved,\n setUnpublishedVersionCount,\n setUploadStatus: updateUploadStatus,\n title,\n unlockDocument,\n unpublishedVersionCount,\n updateDocumentEditor,\n updateSavedDocumentData,\n uploadStatus,\n versionCount,\n }\n\n return (\n <Context value={value}>\n <DocumentTitleProvider>{children}</DocumentTitleProvider>\n </Context>\n )\n}\n\nexport const DocumentInfoProvider: React.FC<\n {\n readonly children: React.ReactNode\n } & DocumentInfoProps\n> = (props) => {\n return (\n <UploadEditsProvider>\n <DocumentInfo {...props} />\n </UploadEditsProvider>\n )\n}\n"],"mappings":"AAAA;;;AAGA,YAAYA,EAAA,MAAQ;AACpB,OAAOC,KAAA,IAASC,aAAa,EAAEC,GAAG,EAAEC,WAAW,EAAEC,SAAS,EAAEC,OAAO,EAAEC,MAAM,EAAEC,QAAQ,QAAQ;AAE7F,SAASC,OAAO,QAAQ;AACxB,SAASC,QAAQ,QAAQ;AACzB,SAASC,cAAc,QAAQ;AAC/B,SAASC,SAAS,QAAQ;AAC1B,SAASC,qBAAqB,QAAQ;AACtC,SAASC,SAAS,EAAEC,gBAAgB,QAAQ;AAC5C,SAASC,cAAc,QAAQ;AAC/B,SAASC,cAAc,QAAQ;AAC/B,SAASC,mBAAmB,EAAEC,cAAc,QAAQ;AAEpD,SAASC,oBAAoB,QAAQ;AAErC,MAAMC,OAAA,gBAAUnB,aAAA,CAAc,CAAC;AAI/B,OAAO,MAAMoB,eAAA,GAAkBA,CAAA,KAA2BnB,GAAA,CAAIkB,OAAA;AAE9D,MAAME,YAAA,GAIFA,CAAC;EAAEC,QAAQ;EAAE,GAAGC;AAAA,CAAO;EACzB,MAAM;IACJC,EAAE;IACFC,cAAc;IACdC,aAAA,EAAeC,sBAAsB;IACrCC,cAAA,EAAgBC,uBAAuB;IACvCC,UAAU;IACVC,eAAA,EAAiBC,wBAAwB;IACzCC,oBAAA,EAAsBC,6BAA6B;IACnDC,iBAAA,EAAmBC,0BAA0B;IAC7CC,WAAW;IACXC,YAAY;IACZC,QAAA,EAAUC,iBAAiB;IAC3BC,cAAA,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EAAYvE,EAAA,EAAIsE,IAAA,EAAM5B,WAAA,CAAY;EAEvD,MAAMmD,KAAA,GAA6B;IACjC,GAAG9F,KAAK;IACRuH,MAAA;IACApH,aAAA;IACAsC,SAAA;IACApC,cAAA;IACAgD,gBAAA;IACA8C,iBAAA;IACAC,iBAAA;IACA5F,eAAA;IACAE,oBAAA;IACAE,iBAAA;IACA+F,qBAAA;IACA7F,WAAA;IACAC,YAAA;IACAqD,cAAA;IACAlD,cAAA;IACAE,4BAAA;IACAqD,cAAA;IACAhB,iBAAA;IACAF,gBAAA;IACA8C,sBAAA;IACA/C,mBAAA;IACAT,gBAAA;IACAM,kBAAA;IACAK,iBAAA;IACAP,+BAAA;IACAG,0BAAA;IACAQ,eAAA,EAAiBC,kBAAA;IACjBjB,KAAA;IACA8B,cAAA;IACApD,uBAAA;IACAmE,oBAAA;IACAyB,uBAAA;IACAvD,YAAA;IACAnC;EACF;EAEA,oBACEoG,IAAA,CAAChI,OAAA;IAAQkG,KAAA,EAAOA,KAAA;cACd,aAAA8B,IAAA,CAACxI,qBAAA;gBAAuBW;;;AAG9B;AAEA,OAAO,MAAM8H,oBAAA,GAIR7H,KAAA;EACH,oBACE4H,IAAA,CAACnI,mBAAA;cACC,aAAAmI,IAAA,CAAC9H,YAAA;MAAc,GAAGE;;;AAGxB","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"index.js","names":["qs","React","createContext","use","useCallback","useEffect","useMemo","useRef","useState","useControllableState","useAuth","requests","formatDocTitle","useConfig","DocumentTitleProvider","useLocale","useLocaleLoading","usePreferences","useTranslation","UploadEditsProvider","useUploadEdits","useGetDocPermissions","Context","useDocumentInfo","DocumentInfo","children","props","id","collectionSlug","currentEditor","currentEditorFromProps","docPermissions","docPermissionsFromProps","globalSlug","hasPublishedDoc","hasPublishedDocFromProps","hasPublishPermission","hasPublishPermissionFromProps","hasSavePermission","hasSavePermissionFromProps","initialData","initialState","isLocked","isLockedFromProps","lastUpdateTime","lastUpdateTimeFromProps","mostRecentVersionIsAutosaved","mostRecentVersionIsAutosavedFromProps","unpublishedVersionCount","unpublishedVersionCountFromProps","versionCount","versionCountFromProps","setDocPermissions","setHasSavePermission","setHasPublishPermission","permissions","config","admin","dateFormat","routes","api","serverURL","getEntityConfig","collectionConfig","globalConfig","abortControllerRef","AbortController","docConfig","i18n","uploadEdits","title","setDocumentTitle","data","fallback","toString","setMostRecentVersionIsAutosaved","setVersionCount","setHasPublishedDoc","setUnpublishedVersionCount","documentIsLocked","setDocumentIsLocked","setCurrentEditor","setLastUpdateTime","savedDocumentData","setSavedDocumentData","uploadStatus","setUploadStatus","updateUploadStatus","status","getPreference","setPreference","code","locale","localeIsLoading","isInitializing","undefined","baseURL","slug","pluralType","preferencesKey","unlockDocument","docID","isGlobal","query","request","get","credentials","docs","json","length","lockID","delete","headers","error","console","updateDocumentEditor","user","userData","relationTo","collection","value","patch","body","JSON","stringify","getDocPermissions","getDocPreferences","setDocFieldPreferences","path","fieldPreferences","allPreferences","fields","e","incrementVersionCount","newCount","versions","maxPerDoc","Math","min","max","updateSavedDocumentData","re1","current","abort","_err","action","docURL","params","depth","addQueryPrefix","_jsx","DocumentInfoProvider"],"sources":["../../../src/providers/DocumentInfo/index.tsx"],"sourcesContent":["'use client'\nimport type { ClientUser, DocumentPreferences } from 'payload'\n\nimport * as qs from 'qs-esm'\nimport React, { createContext, use, useCallback, useEffect, useMemo, useRef, useState } from 'react'\n\nimport { useControllableState } from '../../hooks/useControllableState.js'\nimport { useAuth } from '../../providers/Auth/index.js'\nimport { requests } from '../../utilities/api.js'\nimport { formatDocTitle } from '../../utilities/formatDocTitle/index.js'\nimport { useConfig } from '../Config/index.js'\nimport { DocumentTitleProvider } from '../DocumentTitle/index.js'\nimport { useLocale, useLocaleLoading } from '../Locale/index.js'\nimport { usePreferences } from '../Preferences/index.js'\nimport { useTranslation } from '../Translation/index.js'\nimport { UploadEditsProvider, useUploadEdits } from '../UploadEdits/index.js'\nimport { type DocumentInfoContext, type DocumentInfoProps } from './types.js'\nimport { useGetDocPermissions } from './useGetDocPermissions.js'\n\nconst Context = createContext({} as DocumentInfoContext)\n\nexport type * from './types.js'\n\nexport const useDocumentInfo = (): DocumentInfoContext => use(Context)\n\nconst DocumentInfo: React.FC<\n {\n readonly children: React.ReactNode\n } & DocumentInfoProps\n> = ({ children, ...props }) => {\n const {\n id,\n collectionSlug,\n currentEditor: currentEditorFromProps,\n docPermissions: docPermissionsFromProps,\n globalSlug,\n hasPublishedDoc: hasPublishedDocFromProps,\n hasPublishPermission: hasPublishPermissionFromProps,\n hasSavePermission: hasSavePermissionFromProps,\n initialData,\n initialState,\n isLocked: isLockedFromProps,\n lastUpdateTime: lastUpdateTimeFromProps,\n mostRecentVersionIsAutosaved: mostRecentVersionIsAutosavedFromProps,\n unpublishedVersionCount: unpublishedVersionCountFromProps,\n versionCount: versionCountFromProps,\n } = props\n\n const [docPermissions, setDocPermissions] = useControllableState(docPermissionsFromProps)\n\n const [hasSavePermission, setHasSavePermission] = useControllableState(hasSavePermissionFromProps)\n\n const [hasPublishPermission, setHasPublishPermission] = useControllableState(\n hasPublishPermissionFromProps,\n )\n\n const { permissions } = useAuth()\n\n const {\n config: {\n admin: { dateFormat },\n routes: { api },\n serverURL,\n },\n getEntityConfig,\n } = useConfig()\n\n const collectionConfig = getEntityConfig({ collectionSlug })\n const globalConfig = getEntityConfig({ globalSlug })\n\n const abortControllerRef = useRef(new AbortController())\n const docConfig = collectionConfig || globalConfig\n\n const { i18n } = useTranslation()\n\n const { uploadEdits } = useUploadEdits()\n\n /**\n * @deprecated This state will be removed in v4.\n * This is for performance reasons. Use the `DocumentTitleContext` instead.\n */\n const [title, setDocumentTitle] = useState(() =>\n formatDocTitle({\n collectionConfig,\n data: { ...(initialData || {}), id },\n dateFormat,\n fallback: id?.toString(),\n globalConfig,\n i18n,\n }),\n )\n\n const [mostRecentVersionIsAutosaved, setMostRecentVersionIsAutosaved] = useState(\n mostRecentVersionIsAutosavedFromProps,\n )\n\n const [versionCount, setVersionCount] = useState(versionCountFromProps)\n\n const [hasPublishedDoc, setHasPublishedDoc] = useState(hasPublishedDocFromProps)\n const [unpublishedVersionCount, setUnpublishedVersionCount] = useState(\n unpublishedVersionCountFromProps,\n )\n\n const [documentIsLocked, setDocumentIsLocked] = useControllableState<boolean | undefined>(\n isLockedFromProps,\n )\n const [currentEditor, setCurrentEditor] = useControllableState<ClientUser | null>(\n currentEditorFromProps,\n )\n const [lastUpdateTime, setLastUpdateTime] = useControllableState<number>(lastUpdateTimeFromProps)\n const [savedDocumentData, setSavedDocumentData] = useControllableState(initialData)\n const [uploadStatus, setUploadStatus] = useControllableState<'failed' | 'idle' | 'uploading'>(\n 'idle',\n )\n\n const updateUploadStatus = useCallback(\n (status: 'failed' | 'idle' | 'uploading') => {\n setUploadStatus(status)\n },\n [setUploadStatus],\n )\n\n const { getPreference, setPreference } = usePreferences()\n const { code: locale } = useLocale()\n const { localeIsLoading } = useLocaleLoading()\n\n const isInitializing = useMemo(\n () => initialState === undefined || initialData === undefined || localeIsLoading,\n [initialData, initialState, localeIsLoading],\n )\n\n const baseURL = `${serverURL}${api}`\n let slug: string\n let pluralType: 'collections' | 'globals'\n let preferencesKey: string\n\n if (globalSlug) {\n slug = globalSlug\n pluralType = 'globals'\n preferencesKey = `global-${slug}`\n }\n\n if (collectionSlug) {\n slug = collectionSlug\n pluralType = 'collections'\n\n if (id) {\n preferencesKey = `collection-${slug}-${id}`\n }\n }\n\n const unlockDocument = useCallback(\n async (docID: number | string, slug: string) => {\n try {\n const isGlobal = slug === globalSlug\n\n const query = isGlobal\n ? `where[globalSlug][equals]=${slug}`\n : `where[document.value][equals]=${docID}&where[document.relationTo][equals]=${slug}`\n\n const request = await requests.get(`${serverURL}${api}/payload-locked-documents?${query}`, {\n credentials: 'include',\n })\n\n const { docs } = await request.json()\n\n if (docs?.length > 0) {\n const lockID = docs[0].id\n await requests.delete(`${serverURL}${api}/payload-locked-documents/${lockID}`, {\n credentials: 'include',\n headers: {\n 'Content-Type': 'application/json',\n },\n })\n setDocumentIsLocked(false)\n }\n } catch (error) {\n // eslint-disable-next-line no-console\n console.error('Failed to unlock the document', error)\n }\n },\n [serverURL, api, globalSlug, setDocumentIsLocked],\n )\n\n const updateDocumentEditor = useCallback(\n async (docID: number | string, slug: string, user: ClientUser | number | string) => {\n try {\n const isGlobal = slug === globalSlug\n\n const query = isGlobal\n ? `where[globalSlug][equals]=${slug}`\n : `where[document.value][equals]=${docID}&where[document.relationTo][equals]=${slug}`\n\n // Check if the document is already locked\n const request = await requests.get(`${serverURL}${api}/payload-locked-documents?${query}`, {\n credentials: 'include',\n })\n\n const { docs } = await request.json()\n\n if (docs?.length > 0) {\n const lockID = docs[0].id\n\n const userData =\n typeof user === 'object'\n ? { relationTo: user.collection, value: user.id }\n : { relationTo: 'users', value: user }\n\n // Send a patch request to update the _lastEdited info\n await requests.patch(`${serverURL}${api}/payload-locked-documents/${lockID}`, {\n body: JSON.stringify({\n user: userData,\n }),\n credentials: 'include',\n headers: {\n 'Content-Type': 'application/json',\n },\n })\n }\n } catch (error) {\n // eslint-disable-next-line no-console\n console.error('Failed to update the document editor', error)\n }\n },\n [serverURL, api, globalSlug],\n )\n\n const getDocPermissions = useGetDocPermissions({\n id: id as string,\n api,\n collectionSlug,\n globalSlug,\n i18n,\n locale,\n permissions,\n serverURL,\n setDocPermissions,\n setHasPublishPermission,\n setHasSavePermission,\n })\n\n const getDocPreferences = useCallback(() => {\n return getPreference<DocumentPreferences>(preferencesKey)\n }, [getPreference, preferencesKey])\n\n const setDocFieldPreferences = useCallback<DocumentInfoContext['setDocFieldPreferences']>(\n async (path, fieldPreferences) => {\n const allPreferences = await getDocPreferences()\n\n if (preferencesKey) {\n try {\n await setPreference(preferencesKey, {\n ...allPreferences,\n fields: {\n ...(allPreferences?.fields || {}),\n [path]: {\n ...allPreferences?.fields?.[path],\n ...fieldPreferences,\n },\n },\n })\n } catch (e) {\n console.error(e) // eslint-disable-line no-console\n }\n }\n },\n [setPreference, preferencesKey, getDocPreferences],\n )\n\n const incrementVersionCount = useCallback(() => {\n const newCount = versionCount + 1\n if (collectionConfig && collectionConfig.versions) {\n if (collectionConfig.versions.maxPerDoc > 0) {\n setVersionCount(Math.min(newCount, collectionConfig.versions.maxPerDoc))\n } else {\n setVersionCount(newCount)\n }\n } else if (globalConfig && globalConfig.versions) {\n if (globalConfig.versions.max > 0) {\n setVersionCount(Math.min(newCount, globalConfig.versions.max))\n } else {\n setVersionCount(newCount)\n }\n }\n }, [collectionConfig, globalConfig, versionCount])\n\n const updateSavedDocumentData = React.useCallback<DocumentInfoContext['updateSavedDocumentData']>(\n (json) => {\n setSavedDocumentData(json)\n },\n [setSavedDocumentData],\n )\n\n /**\n * @todo: Remove this in v4\n * Users should use the `DocumentTitleContext` instead.\n */\n useEffect(() => {\n setDocumentTitle(\n formatDocTitle({\n collectionConfig,\n data: { ...savedDocumentData, id },\n dateFormat,\n fallback: id?.toString(),\n globalConfig,\n i18n,\n }),\n )\n }, [collectionConfig, globalConfig, savedDocumentData, dateFormat, i18n, id])\n\n // clean on unmount\n useEffect(() => {\n const re1 = abortControllerRef.current\n\n return () => {\n if (re1) {\n try {\n re1.abort()\n } catch (_err) {\n // swallow error\n }\n }\n }\n }, [])\n\n const action: string = React.useMemo(() => {\n const docURL = `${baseURL}${pluralType === 'globals' ? `/globals` : ''}/${slug}${id ? `/${id}` : ''}`\n const params = {\n depth: 0,\n 'fallback-locale': 'null',\n locale,\n uploadEdits: uploadEdits || undefined,\n }\n\n return `${docURL}${qs.stringify(params, {\n addQueryPrefix: true,\n })}`\n }, [baseURL, locale, pluralType, id, slug, uploadEdits])\n\n const value: DocumentInfoContext = {\n ...props,\n action,\n currentEditor,\n docConfig,\n docPermissions,\n documentIsLocked,\n getDocPermissions,\n getDocPreferences,\n hasPublishedDoc,\n hasPublishPermission,\n hasSavePermission,\n incrementVersionCount,\n initialData,\n initialState,\n isInitializing,\n lastUpdateTime,\n mostRecentVersionIsAutosaved,\n preferencesKey,\n savedDocumentData,\n setCurrentEditor,\n setDocFieldPreferences,\n setDocumentIsLocked,\n setDocumentTitle,\n setHasPublishedDoc,\n setLastUpdateTime,\n setMostRecentVersionIsAutosaved,\n setUnpublishedVersionCount,\n setUploadStatus: updateUploadStatus,\n title,\n unlockDocument,\n unpublishedVersionCount,\n updateDocumentEditor,\n updateSavedDocumentData,\n uploadStatus,\n versionCount,\n }\n\n return (\n <Context value={value}>\n <DocumentTitleProvider>{children}</DocumentTitleProvider>\n </Context>\n )\n}\n\nexport const DocumentInfoProvider: React.FC<\n {\n readonly children: React.ReactNode\n } & DocumentInfoProps\n> = (props) => {\n return (\n <UploadEditsProvider>\n <DocumentInfo {...props} />\n </UploadEditsProvider>\n )\n}\n"],"mappings":"AAAA;;;AAGA,YAAYA,EAAA,MAAQ;AACpB,OAAOC,KAAA,IAASC,aAAa,EAAEC,GAAG,EAAEC,WAAW,EAAEC,SAAS,EAAEC,OAAO,EAAEC,MAAM,EAAEC,QAAQ,QAAQ;AAE7F,SAASC,oBAAoB,QAAQ;AACrC,SAASC,OAAO,QAAQ;AACxB,SAASC,QAAQ,QAAQ;AACzB,SAASC,cAAc,QAAQ;AAC/B,SAASC,SAAS,QAAQ;AAC1B,SAASC,qBAAqB,QAAQ;AACtC,SAASC,SAAS,EAAEC,gBAAgB,QAAQ;AAC5C,SAASC,cAAc,QAAQ;AAC/B,SAASC,cAAc,QAAQ;AAC/B,SAASC,mBAAmB,EAAEC,cAAc,QAAQ;AAEpD,SAASC,oBAAoB,QAAQ;AAErC,MAAMC,OAAA,gBAAUpB,aAAA,CAAc,CAAC;AAI/B,OAAO,MAAMqB,eAAA,GAAkBA,CAAA,KAA2BpB,GAAA,CAAImB,OAAA;AAE9D,MAAME,YAAA,GAIFA,CAAC;EAAEC,QAAQ;EAAE,GAAGC;AAAA,CAAO;EACzB,MAAM;IACJC,EAAE;IACFC,cAAc;IACdC,aAAA,EAAeC,sBAAsB;IACrCC,cAAA,EAAgBC,uBAA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;MACP,mBAAmB;MACnBxD,MAAA;MACAvB,WAAA,EAAaA,WAAA,IAAe0B;IAC9B;IAEA,OAAO,GAAGmD,MAAA,GAASlJ,EAAA,CAAG4H,SAAS,CAACuB,MAAA,EAAQ;MACtCE,cAAA,EAAgB;IAClB,IAAI;EACN,GAAG,CAACrD,OAAA,EAASJ,MAAA,EAAQM,UAAA,EAAYvE,EAAA,EAAIsE,IAAA,EAAM5B,WAAA,CAAY;EAEvD,MAAMmD,KAAA,GAA6B;IACjC,GAAG9F,KAAK;IACRuH,MAAA;IACApH,aAAA;IACAsC,SAAA;IACApC,cAAA;IACAgD,gBAAA;IACA8C,iBAAA;IACAC,iBAAA;IACA5F,eAAA;IACAE,oBAAA;IACAE,iBAAA;IACA+F,qBAAA;IACA7F,WAAA;IACAC,YAAA;IACAqD,cAAA;IACAlD,cAAA;IACAE,4BAAA;IACAqD,cAAA;IACAhB,iBAAA;IACAF,gBAAA;IACA8C,sBAAA;IACA/C,mBAAA;IACAT,gBAAA;IACAM,kBAAA;IACAK,iBAAA;IACAP,+BAAA;IACAG,0BAAA;IACAQ,eAAA,EAAiBC,kBAAA;IACjBjB,KAAA;IACA8B,cAAA;IACApD,uBAAA;IACAmE,oBAAA;IACAyB,uBAAA;IACAvD,YAAA;IACAnC;EACF;EAEA,oBACEoG,IAAA,CAAChI,OAAA;IAAQkG,KAAA,EAAOA,KAAA;cACd,aAAA8B,IAAA,CAACxI,qBAAA;gBAAuBW;;;AAG9B;AAEA,OAAO,MAAM8H,oBAAA,GAIR7H,KAAA;EACH,oBACE4H,IAAA,CAACnI,mBAAA;cACC,aAAAmI,IAAA,CAAC9H,YAAA;MAAc,GAAGE;;;AAGxB","ignoreList":[]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { I18nClient, I18nOptions, Language } from '@payloadcms/translations';
|
|
2
|
-
import type { ClientConfig, LanguageOptions, Locale, SanitizedPermissions, ServerFunctionClient,
|
|
2
|
+
import type { ClientConfig, LanguageOptions, Locale, SanitizedPermissions, ServerFunctionClient, TypedUser } from 'payload';
|
|
3
3
|
import React from 'react';
|
|
4
4
|
import type { Theme } from '../Theme/index.js';
|
|
5
5
|
type Props = {
|
|
@@ -16,7 +16,7 @@ type Props = {
|
|
|
16
16
|
readonly switchLanguageServerAction?: (lang: string) => Promise<void>;
|
|
17
17
|
readonly theme: Theme;
|
|
18
18
|
readonly translations: I18nClient['translations'];
|
|
19
|
-
readonly user: null |
|
|
19
|
+
readonly user: null | TypedUser;
|
|
20
20
|
};
|
|
21
21
|
export declare const RootProvider: React.FC<Props>;
|
|
22
22
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/providers/Root/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAA;AACjF,OAAO,KAAK,EACV,YAAY,EACZ,eAAe,EACf,MAAM,EACN,oBAAoB,EACpB,oBAAoB,EACpB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/providers/Root/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAA;AACjF,OAAO,KAAK,EACV,YAAY,EACZ,eAAe,EACf,MAAM,EACN,oBAAoB,EACpB,oBAAoB,EACpB,SAAS,EACV,MAAM,SAAS,CAAA;AAKhB,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAwB9C,KAAK,KAAK,GAAG;IACX,QAAQ,CAAC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;IAClC,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAA;IAC7B,QAAQ,CAAC,UAAU,EAAE,QAAQ,CAAC,YAAY,CAAC,CAAA;IAC3C,QAAQ,CAAC,YAAY,EAAE,WAAW,CAAC,kBAAkB,CAAC,CAAA;IACtD,QAAQ,CAAC,SAAS,CAAC,EAAE,OAAO,CAAA;IAC5B,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAA;IAC7B,QAAQ,CAAC,eAAe,EAAE,eAAe,CAAA;IACzC,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,CAAC,CAAA;IAChC,QAAQ,CAAC,WAAW,EAAE,oBAAoB,CAAA;IAC1C,QAAQ,CAAC,cAAc,EAAE,oBAAoB,CAAA;IAC7C,QAAQ,CAAC,0BAA0B,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;IACrE,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAA;IACrB,QAAQ,CAAC,YAAY,EAAE,UAAU,CAAC,cAAc,CAAC,CAAA;IACjD,QAAQ,CAAC,IAAI,EAAE,IAAI,GAAG,SAAS,CAAA;CAChC,CAAA;AAED,eAAO,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CAuFxC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["c","_c","DndContext","pointerWithin","ModalContainer","ModalProvider","ScrollInfoProvider","React","LoadingOverlayProvider","NavProvider","StayLoggedInModal","StepNavProvider","ClickOutsideProvider","WindowInfoProvider","AuthProvider","ClientFunctionProvider","ConfigProvider","DocumentEventsProvider","LocaleProvider","ParamsProvider","PreferencesProvider","RouteCache","RouteTransitionProvider","SearchParamsProvider","ServerFunctionsProvider","ThemeProvider","ToastContainer","TranslationProvider","UploadHandlersProvider","RootProvider","t0","$","children","config","dateFNSKey","fallbackLang","isNavOpen","languageCode","languageOptions","locale","permissions","serverFunction","switchLanguageServerAction","theme","translations","user","dndContextID","useId","t1","_jsxs","_jsx","cachingEnabled","process","env","NEXT_PUBLIC_ENABLE_ROUTER_CACHE_REFRESH","language","breakpoints","l","m","s","xs","classPrefix","transTime","zIndex","initialIsOpen","collisionDetection","id"],"sources":["../../../src/providers/Root/index.tsx"],"sourcesContent":["'use client'\nimport type { I18nClient, I18nOptions, Language } from '@payloadcms/translations'\nimport type {\n ClientConfig,\n LanguageOptions,\n Locale,\n SanitizedPermissions,\n ServerFunctionClient,\n
|
|
1
|
+
{"version":3,"file":"index.js","names":["c","_c","DndContext","pointerWithin","ModalContainer","ModalProvider","ScrollInfoProvider","React","LoadingOverlayProvider","NavProvider","StayLoggedInModal","StepNavProvider","ClickOutsideProvider","WindowInfoProvider","AuthProvider","ClientFunctionProvider","ConfigProvider","DocumentEventsProvider","LocaleProvider","ParamsProvider","PreferencesProvider","RouteCache","RouteTransitionProvider","SearchParamsProvider","ServerFunctionsProvider","ThemeProvider","ToastContainer","TranslationProvider","UploadHandlersProvider","RootProvider","t0","$","children","config","dateFNSKey","fallbackLang","isNavOpen","languageCode","languageOptions","locale","permissions","serverFunction","switchLanguageServerAction","theme","translations","user","dndContextID","useId","t1","_jsxs","_jsx","cachingEnabled","process","env","NEXT_PUBLIC_ENABLE_ROUTER_CACHE_REFRESH","language","breakpoints","l","m","s","xs","classPrefix","transTime","zIndex","initialIsOpen","collisionDetection","id"],"sources":["../../../src/providers/Root/index.tsx"],"sourcesContent":["'use client'\nimport type { I18nClient, I18nOptions, Language } from '@payloadcms/translations'\nimport type {\n ClientConfig,\n LanguageOptions,\n Locale,\n SanitizedPermissions,\n ServerFunctionClient,\n TypedUser,\n} from 'payload'\n\nimport { DndContext, pointerWithin } from '@dnd-kit/core'\nimport { ModalContainer, ModalProvider } from '@faceless-ui/modal'\nimport { ScrollInfoProvider } from '@faceless-ui/scroll-info'\nimport React from 'react'\n\nimport type { Theme } from '../Theme/index.js'\n\nimport { LoadingOverlayProvider } from '../../elements/LoadingOverlay/index.js'\nimport { NavProvider } from '../../elements/Nav/context.js'\nimport { StayLoggedInModal } from '../../elements/StayLoggedIn/index.js'\nimport { StepNavProvider } from '../../elements/StepNav/index.js'\nimport { ClickOutsideProvider } from '../../providers/ClickOutside/index.js'\nimport { WindowInfoProvider } from '../../providers/WindowInfo/index.js'\nimport { AuthProvider } from '../Auth/index.js'\nimport { ClientFunctionProvider } from '../ClientFunction/index.js'\nimport { ConfigProvider } from '../Config/index.js'\nimport { DocumentEventsProvider } from '../DocumentEvents/index.js'\nimport { LocaleProvider } from '../Locale/index.js'\nimport { ParamsProvider } from '../Params/index.js'\nimport { PreferencesProvider } from '../Preferences/index.js'\nimport { RouteCache } from '../RouteCache/index.js'\nimport { RouteTransitionProvider } from '../RouteTransition/index.js'\nimport { SearchParamsProvider } from '../SearchParams/index.js'\nimport { ServerFunctionsProvider } from '../ServerFunctions/index.js'\nimport { ThemeProvider } from '../Theme/index.js'\nimport { ToastContainer } from '../ToastContainer/index.js'\nimport { TranslationProvider } from '../Translation/index.js'\nimport { UploadHandlersProvider } from '../UploadHandlers/index.js'\n\ntype Props = {\n readonly children: React.ReactNode\n readonly config: ClientConfig\n readonly dateFNSKey: Language['dateFNSKey']\n readonly fallbackLang: I18nOptions['fallbackLanguage']\n readonly isNavOpen?: boolean\n readonly languageCode: string\n readonly languageOptions: LanguageOptions\n readonly locale?: Locale['code']\n readonly permissions: SanitizedPermissions\n readonly serverFunction: ServerFunctionClient\n readonly switchLanguageServerAction?: (lang: string) => Promise<void>\n readonly theme: Theme\n readonly translations: I18nClient['translations']\n readonly user: null | TypedUser\n}\n\nexport const RootProvider: React.FC<Props> = ({\n children,\n config,\n dateFNSKey,\n fallbackLang,\n isNavOpen,\n languageCode,\n languageOptions,\n locale,\n permissions,\n serverFunction,\n switchLanguageServerAction,\n theme,\n translations,\n user,\n}) => {\n const dndContextID = React.useId()\n\n return (\n <ClickOutsideProvider>\n <ServerFunctionsProvider serverFunction={serverFunction}>\n <RouteTransitionProvider>\n <RouteCache\n cachingEnabled={process.env.NEXT_PUBLIC_ENABLE_ROUTER_CACHE_REFRESH === 'true'}\n >\n <ConfigProvider config={config}>\n <ClientFunctionProvider>\n <TranslationProvider\n dateFNSKey={dateFNSKey}\n fallbackLang={fallbackLang}\n language={languageCode}\n languageOptions={languageOptions}\n switchLanguageServerAction={switchLanguageServerAction}\n translations={translations}\n >\n <WindowInfoProvider\n breakpoints={{\n l: '(max-width: 1440px)',\n m: '(max-width: 1024px)',\n s: '(max-width: 768px)',\n xs: '(max-width: 400px)',\n }}\n >\n <ScrollInfoProvider>\n <SearchParamsProvider>\n <ModalProvider classPrefix=\"payload\" transTime={0} zIndex=\"var(--z-modal)\">\n <AuthProvider permissions={permissions} user={user}>\n <PreferencesProvider>\n <ThemeProvider theme={theme}>\n <ParamsProvider>\n <LocaleProvider locale={locale}>\n <StepNavProvider>\n <LoadingOverlayProvider>\n <DocumentEventsProvider>\n <NavProvider initialIsOpen={isNavOpen}>\n <UploadHandlersProvider>\n <DndContext\n collisionDetection={pointerWithin}\n id={dndContextID}\n >\n {children}\n </DndContext>\n </UploadHandlersProvider>\n </NavProvider>\n </DocumentEventsProvider>\n </LoadingOverlayProvider>\n </StepNavProvider>\n </LocaleProvider>\n </ParamsProvider>\n </ThemeProvider>\n </PreferencesProvider>\n <ModalContainer />\n <StayLoggedInModal />\n </AuthProvider>\n </ModalProvider>\n </SearchParamsProvider>\n </ScrollInfoProvider>\n </WindowInfoProvider>\n </TranslationProvider>\n </ClientFunctionProvider>\n </ConfigProvider>\n </RouteCache>\n </RouteTransitionProvider>\n </ServerFunctionsProvider>\n <ToastContainer />\n </ClickOutsideProvider>\n )\n}\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;;AAWA,SAASC,UAAU,EAAEC,aAAa,QAAQ;AAC1C,SAASC,cAAc,EAAEC,aAAa,QAAQ;AAC9C,SAASC,kBAAkB,QAAQ;AACnC,OAAOC,KAAA,MAAW;AAIlB,SAASC,sBAAsB,QAAQ;AACvC,SAASC,WAAW,QAAQ;AAC5B,SAASC,iBAAiB,QAAQ;AAClC,SAASC,eAAe,QAAQ;AAChC,SAASC,oBAAoB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