@payloadcms/next 3.29.0-internal.3471e81 → 3.29.0-internal.7b98279

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.
Files changed (41) hide show
  1. package/dist/cjs/withPayload.cjs +5 -2
  2. package/dist/cjs/withPayload.cjs.map +1 -1
  3. package/dist/prod/styles.css +1 -1
  4. package/dist/views/Document/handleServerFunction.d.ts +0 -1
  5. package/dist/views/Document/handleServerFunction.d.ts.map +1 -1
  6. package/dist/views/Document/handleServerFunction.js +0 -2
  7. package/dist/views/Document/handleServerFunction.js.map +1 -1
  8. package/dist/views/Document/index.d.ts +1 -4
  9. package/dist/views/Document/index.d.ts.map +1 -1
  10. package/dist/views/Document/index.js +1 -3
  11. package/dist/views/Document/index.js.map +1 -1
  12. package/dist/views/Document/renderDocumentSlots.d.ts.map +1 -1
  13. package/dist/views/Document/renderDocumentSlots.js +7 -0
  14. package/dist/views/Document/renderDocumentSlots.js.map +1 -1
  15. package/dist/views/List/handleServerFunction.d.ts +0 -1
  16. package/dist/views/List/handleServerFunction.d.ts.map +1 -1
  17. package/dist/views/List/handleServerFunction.js +0 -2
  18. package/dist/views/List/handleServerFunction.js.map +1 -1
  19. package/dist/views/List/index.d.ts +1 -4
  20. package/dist/views/List/index.d.ts.map +1 -1
  21. package/dist/views/List/index.js +2 -33
  22. package/dist/views/List/index.js.map +1 -1
  23. package/dist/views/List/renderListViewSlots.d.ts.map +1 -1
  24. package/dist/views/List/renderListViewSlots.js.map +1 -1
  25. package/dist/views/LivePreview/Context/context.d.ts.map +1 -1
  26. package/dist/views/LivePreview/Context/context.js +4 -2
  27. package/dist/views/LivePreview/Context/context.js.map +1 -1
  28. package/dist/views/LivePreview/Context/index.js +1 -1
  29. package/dist/views/LivePreview/Context/index.js.map +1 -1
  30. package/dist/views/Version/Default/SelectedLocalesContext.d.ts +2 -1
  31. package/dist/views/Version/Default/SelectedLocalesContext.d.ts.map +1 -1
  32. package/dist/views/Version/Default/SelectedLocalesContext.js +4 -2
  33. package/dist/views/Version/Default/SelectedLocalesContext.js.map +1 -1
  34. package/dist/views/Version/Default/index.js +1 -1
  35. package/dist/views/Version/Default/index.js.map +1 -1
  36. package/dist/views/Version/RenderFieldsToDiff/fields/Select/index.d.ts.map +1 -1
  37. package/dist/views/Version/RenderFieldsToDiff/fields/Select/index.js +2 -18
  38. package/dist/views/Version/RenderFieldsToDiff/fields/Select/index.js.map +1 -1
  39. package/dist/withPayload.js +1 -1
  40. package/dist/withPayload.js.map +1 -1
  41. package/package.json +6 -6
@@ -1 +1 @@
1
- {"version":3,"file":"renderListViewSlots.js","names":["RenderServerComponent","renderListViewSlots","clientProps","collectionConfig","description","payload","serverProps","result","admin","components","afterList","AfterList","Component","importMap","listMenuItems","Array","isArray","afterListTable","AfterListTable","beforeList","BeforeList","beforeListTable","BeforeListTable","Description","collectionSlug","slug"],"sources":["../../../src/views/List/renderListViewSlots.tsx"],"sourcesContent":["import type {\n AfterListClientProps,\n AfterListTableClientProps,\n AfterListTableServerPropsOnly,\n BeforeListClientProps,\n BeforeListServerPropsOnly,\n BeforeListTableClientProps,\n BeforeListTableServerPropsOnly,\n ListViewServerPropsOnly,\n ListViewSlots,\n ListViewSlotSharedClientProps,\n Payload,\n SanitizedCollectionConfig,\n StaticDescription,\n ViewDescriptionClientProps,\n ViewDescriptionServerPropsOnly,\n} from 'payload'\n\nimport { RenderServerComponent } from '@payloadcms/ui/elements/RenderServerComponent'\n\ntype Args = {\n clientProps: ListViewSlotSharedClientProps\n collectionConfig: SanitizedCollectionConfig\n description?: StaticDescription\n payload: Payload\n serverProps: ListViewServerPropsOnly\n}\n\nexport const renderListViewSlots = ({\n clientProps,\n collectionConfig,\n description,\n payload,\n serverProps,\n}: Args): ListViewSlots => {\n const result: ListViewSlots = {} as ListViewSlots\n\n if (collectionConfig.admin.components?.afterList) {\n result.AfterList = RenderServerComponent({\n clientProps: clientProps satisfies AfterListClientProps,\n Component: collectionConfig.admin.components.afterList,\n importMap: payload.importMap,\n serverProps: serverProps satisfies AfterListTableServerPropsOnly,\n })\n }\n\n const listMenuItems = collectionConfig.admin.components?.listMenuItems\n\n if (Array.isArray(listMenuItems)) {\n result.listMenuItems = [\n RenderServerComponent({\n clientProps,\n Component: listMenuItems,\n importMap: payload.importMap,\n serverProps,\n }),\n ]\n }\n\n if (collectionConfig.admin.components?.afterListTable) {\n result.AfterListTable = RenderServerComponent({\n clientProps: clientProps satisfies AfterListTableClientProps,\n Component: collectionConfig.admin.components.afterListTable,\n importMap: payload.importMap,\n serverProps: serverProps satisfies AfterListTableServerPropsOnly,\n })\n }\n\n if (collectionConfig.admin.components?.beforeList) {\n result.BeforeList = RenderServerComponent({\n clientProps: clientProps satisfies BeforeListClientProps,\n Component: collectionConfig.admin.components.beforeList,\n importMap: payload.importMap,\n serverProps: serverProps satisfies BeforeListServerPropsOnly,\n })\n }\n\n if (collectionConfig.admin.components?.beforeListTable) {\n result.BeforeListTable = RenderServerComponent({\n clientProps: clientProps satisfies BeforeListTableClientProps,\n Component: collectionConfig.admin.components.beforeListTable,\n importMap: payload.importMap,\n serverProps: serverProps satisfies BeforeListTableServerPropsOnly,\n })\n }\n\n if (collectionConfig.admin.components?.Description) {\n result.Description = RenderServerComponent({\n clientProps: {\n collectionSlug: collectionConfig.slug,\n description,\n } satisfies ViewDescriptionClientProps,\n Component: collectionConfig.admin.components.Description,\n importMap: payload.importMap,\n serverProps: serverProps satisfies ViewDescriptionServerPropsOnly,\n })\n }\n\n return result\n}\n"],"mappings":"AAkBA,SAASA,qBAAqB,QAAQ;AAUtC,OAAO,MAAMC,mBAAA,GAAsBA,CAAC;EAClCC,WAAW;EACXC,gBAAgB;EAChBC,WAAW;EACXC,OAAO;EACPC;AAAW,CACN;EACL,MAAMC,MAAA,GAAwB,CAAC;EAE/B,IAAIJ,gBAAA,CAAiBK,KAAK,CAACC,UAAU,EAAEC,SAAA,EAAW;IAChDH,MAAA,CAAOI,SAAS,GAAGX,qBAAA,C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C5DR,SAAA,EAAWR,OAAA,CAAQQ,SAAS;MAC5BP,WAAA,EAAaA;IACf;EACF;EAEA,IAAIH,gBAAA,CAAiBK,KAAK,CAACC,UAAU,EAAEc,WAAA,EAAa;IAClDhB,MAAA,CAAOgB,WAAW,GAAGvB,qBAAA,CAAsB;MACzCE,WAAA,EAAa;QACXsB,cAAA,EAAgBrB,gBAAA,CAAiBsB,IAAI;QACrCrB;MACF;MACAQ,SAAA,EAAWT,gBAAA,CAAiBK,KAAK,CAACC,UAAU,CAACc,WAAW;MACxDV,SAAA,EAAWR,OAAA,CAAQQ,SAAS;MAC5BP,WAAA,EAAaA;IACf;EACF;EAEA,OAAOC,MAAA;AACT","ignoreList":[]}
1
+ {"version":3,"file":"renderListViewSlots.js","names":["RenderServerComponent","renderListViewSlots","clientProps","collectionConfig","description","payload","serverProps","result","admin","components","afterList","AfterList","Component","importMap","listMenuItems","Array","isArray","afterListTable","AfterListTable","beforeList","BeforeList","beforeListTable","BeforeListTable","Description","collectionSlug","slug"],"sources":["../../../src/views/List/renderListViewSlots.tsx"],"sourcesContent":["import type {\n AfterListClientProps,\n AfterListTableClientProps,\n AfterListTableServerPropsOnly,\n BeforeListClientProps,\n BeforeListServerPropsOnly,\n BeforeListTableClientProps,\n BeforeListTableServerPropsOnly,\n ListViewServerPropsOnly,\n ListViewSlots,\n ListViewSlotSharedClientProps,\n Payload,\n SanitizedCollectionConfig,\n StaticDescription,\n ViewDescriptionClientProps,\n ViewDescriptionServerPropsOnly,\n} from 'payload'\n\nimport { RenderServerComponent } from '@payloadcms/ui/elements/RenderServerComponent'\n\ntype Args = {\n clientProps: ListViewSlotSharedClientProps\n collectionConfig: SanitizedCollectionConfig\n description?: StaticDescription\n payload: Payload\n serverProps: ListViewServerPropsOnly\n}\n\nexport const renderListViewSlots = ({\n clientProps,\n collectionConfig,\n description,\n payload,\n serverProps,\n}: Args): ListViewSlots => {\n const result: ListViewSlots = {} as ListViewSlots\n\n if (collectionConfig.admin.components?.afterList) {\n result.AfterList = RenderServerComponent({\n clientProps: clientProps satisfies AfterListClientProps,\n Component: collectionConfig.admin.components.afterList,\n importMap: payload.importMap,\n serverProps: serverProps satisfies AfterListTableServerPropsOnly,\n })\n }\n\n const listMenuItems = collectionConfig.admin.components?.listMenuItems\n if (Array.isArray(listMenuItems)) {\n result.listMenuItems = [\n RenderServerComponent({\n clientProps,\n Component: listMenuItems,\n importMap: payload.importMap,\n serverProps,\n }),\n ]\n }\n\n if (collectionConfig.admin.components?.afterListTable) {\n result.AfterListTable = RenderServerComponent({\n clientProps: clientProps satisfies AfterListTableClientProps,\n Component: collectionConfig.admin.components.afterListTable,\n importMap: payload.importMap,\n serverProps: serverProps satisfies AfterListTableServerPropsOnly,\n })\n }\n\n if (collectionConfig.admin.components?.beforeList) {\n result.BeforeList = RenderServerComponent({\n clientProps: clientProps satisfies BeforeListClientProps,\n Component: collectionConfig.admin.components.beforeList,\n importMap: payload.importMap,\n serverProps: serverProps satisfies BeforeListServerPropsOnly,\n })\n }\n\n if (collectionConfig.admin.components?.beforeListTable) {\n result.BeforeListTable = RenderServerComponent({\n clientProps: clientProps satisfies BeforeListTableClientProps,\n Component: collectionConfig.admin.components.beforeListTable,\n importMap: payload.importMap,\n serverProps: serverProps satisfies BeforeListTableServerPropsOnly,\n })\n }\n\n if (collectionConfig.admin.components?.Description) {\n result.Description = RenderServerComponent({\n clientProps: {\n collectionSlug: collectionConfig.slug,\n description,\n } satisfies ViewDescriptionClientProps,\n Component: collectionConfig.admin.components.Description,\n importMap: payload.importMap,\n serverProps: serverProps satisfies ViewDescriptionServerPropsOnly,\n })\n }\n\n return result\n}\n"],"mappings":"AAkBA,SAASA,qBAAqB,QAAQ;AAUtC,OAAO,MAAMC,mBAAA,GAAsBA,CAAC;EAClCC,WAAW;EACXC,gBAAgB;EAChBC,WAAW;EACXC,OAAO;EACPC;AAAW,CACN;EACL,MAAMC,MAAA,GAAwB,CAAC;EAE/B,IAAIJ,gBAAA,CAAiBK,KAAK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WAAA;MACbU,SAAA,EAAWT,gBAAA,CAAiBK,KAAK,CAACC,UAAU,CAACY,eAAe;MAC5DR,SAAA,EAAWR,OAAA,CAAQQ,SAAS;MAC5BP,WAAA,EAAaA;IACf;EACF;EAEA,IAAIH,gBAAA,CAAiBK,KAAK,CAACC,UAAU,EAAEc,WAAA,EAAa;IAClDhB,MAAA,CAAOgB,WAAW,GAAGvB,qBAAA,CAAsB;MACzCE,WAAA,EAAa;QACXsB,cAAA,EAAgBrB,gBAAA,CAAiBsB,IAAI;QACrCrB;MACF;MACAQ,SAAA,EAAWT,gBAAA,CAAiBK,KAAK,CAACC,UAAU,CAACc,WAAW;MACxDV,SAAA,EAAWR,OAAA,CAAQQ,SAAS;MAC5BP,WAAA,EAAaA;IACf;EACF;EAEA,OAAOC,MAAA;AACT","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../../../src/views/LivePreview/Context/context.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAA;AAChD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAA;AACvD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AACrC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAI9B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAC1D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAA;AAEzD,MAAM,WAAW,sBAAsB;IACrC,UAAU,EAAE,OAAO,CAAA;IACnB,UAAU,EAAE,iBAAiB,CAAC,aAAa,CAAC,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,CAAA;IAC5D,WAAW,EAAE,iBAAiB,CAAC,aAAa,CAAC,CAAA;IAC7C,eAAe,CAAC,EAAE,UAAU,CAAC,OAAO,iBAAiB,CAAC,CAAA;IACtD,eAAe,EAAE,OAAO,CAAA;IAC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uCAmC7B,CAAA;AAEF,eAAO,MAAM,qBAAqB,8BAAuC,CAAA"}
@@ -1,6 +1,6 @@
1
1
  'use client';
2
2
 
3
- import { createContext, use } from 'react';
3
+ import { createContext, useContext } from 'react';
4
4
  export const LivePreviewContext = createContext({
5
5
  appIsReady: false,
6
6
  breakpoint: undefined,
@@ -37,5 +37,7 @@ export const LivePreviewContext = createContext({
37
37
  url: undefined,
38
38
  zoom: 1
39
39
  });
40
- export const useLivePreviewContext = () => use(LivePreviewContext);
40
+ export const useLivePreviewContext = () => {
41
+ return useContext(LivePreviewContext);
42
+ };
41
43
  //# sourceMappingURL=context.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"context.js","names":["createContext","use","LivePreviewContext","appIsReady","breakpoint","undefined","breakpoints","fieldSchemaJSON","iframeHasLoaded","iframeRef","isPopupOpen","measuredDeviceSize","height","width","openPopupWindow","popupRef","previewWindowType","setAppIsReady","setBreakpoint","setHeight","setIframeHasLoaded","setMeasuredDeviceSize","setPreviewWindowType","setSize","setToolbarPosition","setWidth","setZoom","size","toolbarPosition","x","y","url","zoom","useLivePreviewContext"],"sources":["../../../../src/views/LivePreview/Context/context.ts"],"sourcesContent":["'use client'\nimport type { LivePreviewConfig } from 'payload'\nimport type { fieldSchemaToJSON } from 'payload/shared'\nimport type { Dispatch } from 'react'\nimport type React from 'react'\n\nimport { createContext, use } from 'react'\n\nimport type { usePopupWindow } from '../usePopupWindow.js'\nimport type { SizeReducerAction } from './sizeReducer.js'\n\nexport interface LivePreviewContextType {\n appIsReady: boolean\n breakpoint: LivePreviewConfig['breakpoints'][number]['name']\n breakpoints: LivePreviewConfig['breakpoints']\n fieldSchemaJSON?: ReturnType<typeof fieldSchemaToJSON>\n iframeHasLoaded: boolean\n iframeRef: React.RefObject<HTMLIFrameElement | null>\n isPopupOpen: boolean\n measuredDeviceSize: {\n height: number\n width: number\n }\n openPopupWindow: ReturnType<typeof usePopupWindow>['openPopupWindow']\n popupRef?: React.RefObject<null | Window>\n previewWindowType: 'iframe' | 'popup'\n setAppIsReady: (appIsReady: boolean) => void\n setBreakpoint: (breakpoint: LivePreviewConfig['breakpoints'][number]['name']) => void\n setHeight: (height: number) => void\n setIframeHasLoaded: (loaded: boolean) => void\n setMeasuredDeviceSize: (size: { height: number; width: number }) => void\n setPreviewWindowType: (previewWindowType: 'iframe' | 'popup') => void\n setSize: Dispatch<SizeReducerAction>\n setToolbarPosition: (position: { x: number; y: number }) => void\n setWidth: (width: number) => void\n setZoom: (zoom: number) => void\n size: {\n height: number\n width: number\n }\n toolbarPosition: {\n x: number\n y: number\n }\n url: string | undefined\n zoom: number\n}\n\nexport const LivePreviewContext = createContext<LivePreviewContextType>({\n appIsReady: false,\n breakpoint: undefined,\n breakpoints: undefined,\n fieldSchemaJSON: undefined,\n iframeHasLoaded: false,\n iframeRef: undefined,\n isPopupOpen: false,\n measuredDeviceSize: {\n height: 0,\n width: 0,\n },\n openPopupWindow: () => {},\n popupRef: undefined,\n previewWindowType: 'iframe',\n setAppIsReady: () => {},\n setBreakpoint: () => {},\n setHeight: () => {},\n setIframeHasLoaded: () => {},\n setMeasuredDeviceSize: () => {},\n setPreviewWindowType: () => {},\n setSize: () => {},\n setToolbarPosition: () => {},\n setWidth: () => {},\n setZoom: () => {},\n size: {\n height: 0,\n width: 0,\n },\n toolbarPosition: {\n x: 0,\n y: 0,\n },\n url: undefined,\n zoom: 1,\n})\n\nexport const useLivePreviewContext = () => use(LivePreviewContext)\n"],"mappings":"AAAA;;AAMA,SAASA,aAAa,EAAEC,GAAG,QAAQ;AA0CnC,OAAO,MAAMC,kBAAA,GAAqBF,aAAA,CAAsC;EACtEG,UAAA,EAAY;EACZC,UAAA,EAAYC,SAAA;EACZC,WAAA,EAAaD,SAAA;EACbE,eAAA,EAAiBF,SAAA;EACjBG,eAAA,EAAiB;EACjBC,SAAA,EAAWJ,SAAA;EACXK,WAAA,EAAa;EACbC,kBAAA,EAAoB;IAClBC,MAAA,EAAQ;IACRC,KAAA,EAAO;EACT;EACAC,eAAA,EAAiBA,CAAA,MAAO;EACxBC,QAAA,EAAUV,SAAA;EACVW,iBAAA,EAAmB;EACnBC,aAAA,EAAeA,CAAA,MAAO;EACtBC,aAAA,EAAeA,CAAA,MAAO;EACtBC,SAAA,EAAWA,CAAA,MAAO;EAClBC,kBAAA,EAAoBA,CAAA,MAAO;EAC3BC,qBAAA,EAAuBA,CAAA,MAAO;EAC9BC,oBAAA,EAAsBA,CAAA,MAAO;EAC7BC,OAAA,EAASA,CAAA,MAAO;EAChBC,kBAAA,EAAoBA,CAAA,MAAO;EAC3BC,QAAA,EAAUA,CAAA,MAAO;EACjBC,OAAA,EAASA,CAAA,MAAO;EAChBC,IAAA,EAAM;IACJf,MAAA,EAAQ;IACRC,KAAA,EAAO;EACT;EACAe,eAAA,EAAiB;IACfC,CAAA,EAAG;IACHC,CAAA,EAAG;EACL;EACAC,GAAA,EAAK1B,SAAA;EACL2B,IAAA,EAAM;AACR;AAEA,OAAO,MAAMC,qBAAA,GAAwBA,CAAA,KAAMhC,GAAA,CAAIC,kBAAA","ignoreList":[]}
1
+ {"version":3,"file":"context.js","names":["createContext","useContext","LivePreviewContext","appIsReady","breakpoint","undefined","breakpoints","fieldSchemaJSON","iframeHasLoaded","iframeRef","isPopupOpen","measuredDeviceSize","height","width","openPopupWindow","popupRef","previewWindowType","setAppIsReady","setBreakpoint","setHeight","setIframeHasLoaded","setMeasuredDeviceSize","setPreviewWindowType","setSize","setToolbarPosition","setWidth","setZoom","size","toolbarPosition","x","y","url","zoom","useLivePreviewContext"],"sources":["../../../../src/views/LivePreview/Context/context.ts"],"sourcesContent":["'use client'\nimport type { LivePreviewConfig } from 'payload'\nimport type { fieldSchemaToJSON } from 'payload/shared'\nimport type { Dispatch } from 'react'\nimport type React from 'react'\n\nimport { createContext, useContext } from 'react'\n\nimport type { usePopupWindow } from '../usePopupWindow.js'\nimport type { SizeReducerAction } from './sizeReducer.js'\n\nexport interface LivePreviewContextType {\n appIsReady: boolean\n breakpoint: LivePreviewConfig['breakpoints'][number]['name']\n breakpoints: LivePreviewConfig['breakpoints']\n fieldSchemaJSON?: ReturnType<typeof fieldSchemaToJSON>\n iframeHasLoaded: boolean\n iframeRef: React.RefObject<HTMLIFrameElement | null>\n isPopupOpen: boolean\n measuredDeviceSize: {\n height: number\n width: number\n }\n openPopupWindow: ReturnType<typeof usePopupWindow>['openPopupWindow']\n popupRef?: React.RefObject<null | Window>\n previewWindowType: 'iframe' | 'popup'\n setAppIsReady: (appIsReady: boolean) => void\n setBreakpoint: (breakpoint: LivePreviewConfig['breakpoints'][number]['name']) => void\n setHeight: (height: number) => void\n setIframeHasLoaded: (loaded: boolean) => void\n setMeasuredDeviceSize: (size: { height: number; width: number }) => void\n setPreviewWindowType: (previewWindowType: 'iframe' | 'popup') => void\n setSize: Dispatch<SizeReducerAction>\n setToolbarPosition: (position: { x: number; y: number }) => void\n setWidth: (width: number) => void\n setZoom: (zoom: number) => void\n size: {\n height: number\n width: number\n }\n toolbarPosition: {\n x: number\n y: number\n }\n url: string | undefined\n zoom: number\n}\n\nexport const LivePreviewContext = createContext<LivePreviewContextType>({\n appIsReady: false,\n breakpoint: undefined,\n breakpoints: undefined,\n fieldSchemaJSON: undefined,\n iframeHasLoaded: false,\n iframeRef: undefined,\n isPopupOpen: false,\n measuredDeviceSize: {\n height: 0,\n width: 0,\n },\n openPopupWindow: () => {},\n popupRef: undefined,\n previewWindowType: 'iframe',\n setAppIsReady: () => {},\n setBreakpoint: () => {},\n setHeight: () => {},\n setIframeHasLoaded: () => {},\n setMeasuredDeviceSize: () => {},\n setPreviewWindowType: () => {},\n setSize: () => {},\n setToolbarPosition: () => {},\n setWidth: () => {},\n setZoom: () => {},\n size: {\n height: 0,\n width: 0,\n },\n toolbarPosition: {\n x: 0,\n y: 0,\n },\n url: undefined,\n zoom: 1,\n})\n\nexport const useLivePreviewContext = () => useContext(LivePreviewContext)\n"],"mappings":"AAAA;;AAMA,SAASA,aAAa,EAAEC,UAAU,QAAQ;AA0C1C,OAAO,MAAMC,kBAAA,GAAqBF,aAAA,CAAsC;EACtEG,UAAA,EAAY;EACZC,UAAA,EAAYC,SAAA;EACZC,WAAA,EAAaD,SAAA;EACbE,eAAA,EAAiBF,SAAA;EACjBG,eAAA,EAAiB;EACjBC,SAAA,EAAWJ,SAAA;EACXK,WAAA,EAAa;EACbC,kBAAA,EAAoB;IAClBC,MAAA,EAAQ;IACRC,KAAA,EAAO;EACT;EACAC,eAAA,EAAiBA,CAAA,MAAO;EACxBC,QAAA,EAAUV,SAAA;EACVW,iBAAA,EAAmB;EACnBC,aAAA,EAAeA,CAAA,MAAO;EACtBC,aAAA,EAAeA,CAAA,MAAO;EACtBC,SAAA,EAAWA,CAAA,MAAO;EAClBC,kBAAA,EAAoBA,CAAA,MAAO;EAC3BC,qBAAA,EAAuBA,CAAA,MAAO;EAC9BC,oBAAA,EAAsBA,CAAA,MAAO;EAC7BC,OAAA,EAASA,CAAA,MAAO;EAChBC,kBAAA,EAAoBA,CAAA,MAAO;EAC3BC,QAAA,EAAUA,CAAA,MAAO;EACjBC,OAAA,EAASA,CAAA,MAAO;EAChBC,IAAA,EAAM;IACJf,MAAA,EAAQ;IACRC,KAAA,EAAO;EACT;EACAe,eAAA,EAAiB;IACfC,CAAA,EAAG;IACHC,CAAA,EAAG;EACL;EACAC,GAAA,EAAK1B,SAAA;EACL2B,IAAA,EAAM;AACR;AAEA,OAAO,MAAMC,qBAAA,GAAwBA,CAAA;EAAA,OAAMhC,UAAA,CAAAC,kBAAW;AAAA","ignoreList":[]}
@@ -116,7 +116,7 @@ export const LivePreviewProvider = ({
116
116
  handleWindowChange('iframe');
117
117
  }
118
118
  }, [previewWindowType, isPopupOpen, handleWindowChange]);
119
- return /*#__PURE__*/_jsx(LivePreviewContext, {
119
+ return /*#__PURE__*/_jsx(LivePreviewContext.Provider, {
120
120
  value: {
121
121
  appIsReady,
122
122
  breakpoint,
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["DndContext","useConfig","fieldSchemaToJSON","React","useCallback","useEffect","useState","customCollisionDetection","LivePreviewContext","sizeReducer","LivePreviewProvider","breakpoints","children","fieldSchema","isPopupOpen","openPopupWindow","popupRef","url","previewWindowType","setPreviewWindowType","appIsReady","setAppIsReady","listeningForMessages","setListeningForMessages","iframeRef","useRef","iframeHasLoaded","setIframeHasLoaded","config","zoom","setZoom","position","setPosition","x","y","size","setSize","useReducer","height","width","measuredDeviceSize","setMeasuredDeviceSize","breakpoint","setBreakpoint","fieldSchemaJSON","handleDragEnd","ev","over","id","newPos","delta","setWidth","type","value","setHeight","foundBreakpoint","find","bp","name","handleMessage","event","startsWith","origin","data","ready","window","addEventListener","removeEventListener","handleWindowChange","newPreviewWindowType","_jsx","setToolbarPosition","toolbarPosition","collisionDetection","onDragEnd"],"sources":["../../../../src/views/LivePreview/Context/index.tsx"],"sourcesContent":["'use client'\nimport type { ClientField, LivePreviewConfig } from 'payload'\n\nimport { DndContext } from '@dnd-kit/core'\nimport { useConfig } from '@payloadcms/ui'\nimport { fieldSchemaToJSON } from 'payload/shared'\nimport React, { useCallback, useEffect, useState } from 'react'\n\nimport type { usePopupWindow } from '../usePopupWindow.js'\n\nimport { customCollisionDetection } from './collisionDetection.js'\nimport { LivePreviewContext } from './context.js'\nimport { sizeReducer } from './sizeReducer.js'\n\nexport type LivePreviewProviderProps = {\n appIsReady?: boolean\n breakpoints?: LivePreviewConfig['breakpoints']\n children: React.ReactNode\n deviceSize?: {\n height: number\n width: number\n }\n fieldSchema: ClientField[]\n isPopupOpen?: boolean\n openPopupWindow?: ReturnType<typeof usePopupWindow>['openPopupWindow']\n popupRef?: React.RefObject<Window>\n url?: string\n}\n\nexport const LivePreviewProvider: React.FC<LivePreviewProviderProps> = ({\n breakpoints,\n children,\n fieldSchema,\n isPopupOpen,\n openPopupWindow,\n popupRef,\n url,\n}) => {\n const [previewWindowType, setPreviewWindowType] = useState<'iframe' | 'popup'>('iframe')\n\n const [appIsReady, setAppIsReady] = useState(false)\n const [listeningForMessages, setListeningForMessages] = useState(false)\n\n const iframeRef = React.useRef<HTMLIFrameElement>(null)\n\n const [iframeHasLoaded, setIframeHasLoaded] = useState(false)\n const { config } = useConfig()\n\n const [zoom, setZoom] = useState(1)\n\n const [position, setPosition] = useState({ x: 0, y: 0 })\n\n const [size, setSize] = React.useReducer(sizeReducer, { height: 0, width: 0 })\n\n const [measuredDeviceSize, setMeasuredDeviceSize] = useState({\n height: 0,\n width: 0,\n })\n\n const [breakpoint, setBreakpoint] =\n React.useState<LivePreviewConfig['breakpoints'][0]['name']>('responsive')\n\n const [fieldSchemaJSON] = useState(() => {\n return fieldSchemaToJSON(fieldSchema, config)\n })\n\n // The toolbar needs to freely drag and drop around the page\n const handleDragEnd = (ev) => {\n // only update position if the toolbar is completely within the preview area\n // otherwise reset it back to the previous position\n // TODO: reset to the nearest edge of the preview area\n if (ev.over && ev.over.id === 'live-preview-area') {\n const newPos = {\n x: position.x + ev.delta.x,\n y: position.y + ev.delta.y,\n }\n\n setPosition(newPos)\n } else {\n // reset\n }\n }\n\n const setWidth = useCallback(\n (width) => {\n setSize({ type: 'width', value: width })\n },\n [setSize],\n )\n\n const setHeight = useCallback(\n (height) => {\n setSize({ type: 'height', value: height })\n },\n [setSize],\n )\n\n // explicitly set new width and height when as new breakpoints are selected\n // exclude `custom` breakpoint as it is handled by the `setWidth` and `setHeight` directly\n useEffect(() => {\n const foundBreakpoint = breakpoints?.find((bp) => bp.name === breakpoint)\n\n if (\n foundBreakpoint &&\n breakpoint !== 'responsive' &&\n breakpoint !== 'custom' &&\n typeof foundBreakpoint?.width === 'number' &&\n typeof foundBreakpoint?.height === 'number'\n ) {\n setSize({\n type: 'reset',\n value: {\n height: foundBreakpoint.height,\n width: foundBreakpoint.width,\n },\n })\n }\n }, [breakpoint, breakpoints])\n\n // Receive the `ready` message from the popup window\n // This indicates that the app is ready to receive `window.postMessage` events\n // This is also the only cross-origin way of detecting when a popup window has loaded\n // Unlike iframe elements which have an `onLoad` handler, there is no way to access `window.open` on popups\n useEffect(() => {\n const handleMessage = (event: MessageEvent) => {\n if (\n url?.startsWith(event.origin) &&\n event.data &&\n typeof event.data === 'object' &&\n event.data.type === 'payload-live-preview'\n ) {\n if (event.data.ready) {\n setAppIsReady(true)\n }\n }\n }\n\n window.addEventListener('message', handleMessage)\n\n setListeningForMessages(true)\n\n return () => {\n window.removeEventListener('message', handleMessage)\n }\n }, [url, listeningForMessages])\n\n const handleWindowChange = useCallback(\n (type: 'iframe' | 'popup') => {\n setAppIsReady(false)\n setPreviewWindowType(type)\n if (type === 'popup') {\n openPopupWindow()\n }\n },\n [openPopupWindow],\n )\n\n // when the user closes the popup window, switch back to the iframe\n // the `usePopupWindow` reports the `isPopupOpen` state for us to use here\n useEffect(() => {\n const newPreviewWindowType = isPopupOpen ? 'popup' : 'iframe'\n\n if (newPreviewWindowType !== previewWindowType) {\n handleWindowChange('iframe')\n }\n }, [previewWindowType, isPopupOpen, handleWindowChange])\n\n return (\n <LivePreviewContext\n value={{\n appIsReady,\n breakpoint,\n breakpoints,\n fieldSchemaJSON,\n iframeHasLoaded,\n iframeRef,\n isPopupOpen,\n measuredDeviceSize,\n openPopupWindow,\n popupRef,\n previewWindowType,\n setAppIsReady,\n setBreakpoint,\n setHeight,\n setIframeHasLoaded,\n setMeasuredDeviceSize,\n setPreviewWindowType: handleWindowChange,\n setSize,\n setToolbarPosition: setPosition,\n setWidth,\n setZoom,\n size,\n toolbarPosition: position,\n url,\n zoom,\n }}\n >\n <DndContext collisionDetection={customCollisionDetection} onDragEnd={handleDragEnd}>\n {listeningForMessages && children}\n </DndContext>\n </LivePreviewContext>\n )\n}\n"],"mappings":"AAAA;;;AAGA,SAASA,UAAU,QAAQ;AAC3B,SAASC,SAAS,QAAQ;AAC1B,SAASC,iBAAiB,QAAQ;AAClC,OAAOC,KAAA,IAASC,WAAW,EAAEC,SAAS,EAAEC,QAAQ,QAAQ;AAIxD,SAASC,wBAAwB,QAAQ;AACzC,SAASC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,UAAA;MAAWyE,kBAAA,EAAoBlE,wBAAA;MAA0BmE,SAAA,EAAW7B,aAAA;gBAClEvB,oBAAA,IAAwBV;;;AAIjC","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["DndContext","useConfig","fieldSchemaToJSON","React","useCallback","useEffect","useState","customCollisionDetection","LivePreviewContext","sizeReducer","LivePreviewProvider","breakpoints","children","fieldSchema","isPopupOpen","openPopupWindow","popupRef","url","previewWindowType","setPreviewWindowType","appIsReady","setAppIsReady","listeningForMessages","setListeningForMessages","iframeRef","useRef","iframeHasLoaded","setIframeHasLoaded","config","zoom","setZoom","position","setPosition","x","y","size","setSize","useReducer","height","width","measuredDeviceSize","setMeasuredDeviceSize","breakpoint","setBreakpoint","fieldSchemaJSON","handleDragEnd","ev","over","id","newPos","delta","setWidth","type","value","setHeight","foundBreakpoint","find","bp","name","handleMessage","event","startsWith","origin","data","ready","window","addEventListener","removeEventListener","handleWindowChange","newPreviewWindowType","_jsx","Provider","setToolbarPosition","toolbarPosition","collisionDetection","onDragEnd"],"sources":["../../../../src/views/LivePreview/Context/index.tsx"],"sourcesContent":["'use client'\nimport type { ClientField, LivePreviewConfig } from 'payload'\n\nimport { DndContext } from '@dnd-kit/core'\nimport { useConfig } from '@payloadcms/ui'\nimport { fieldSchemaToJSON } from 'payload/shared'\nimport React, { useCallback, useEffect, useState } from 'react'\n\nimport type { usePopupWindow } from '../usePopupWindow.js'\n\nimport { customCollisionDetection } from './collisionDetection.js'\nimport { LivePreviewContext } from './context.js'\nimport { sizeReducer } from './sizeReducer.js'\n\nexport type LivePreviewProviderProps = {\n appIsReady?: boolean\n breakpoints?: LivePreviewConfig['breakpoints']\n children: React.ReactNode\n deviceSize?: {\n height: number\n width: number\n }\n fieldSchema: ClientField[]\n isPopupOpen?: boolean\n openPopupWindow?: ReturnType<typeof usePopupWindow>['openPopupWindow']\n popupRef?: React.RefObject<Window>\n url?: string\n}\n\nexport const LivePreviewProvider: React.FC<LivePreviewProviderProps> = ({\n breakpoints,\n children,\n fieldSchema,\n isPopupOpen,\n openPopupWindow,\n popupRef,\n url,\n}) => {\n const [previewWindowType, setPreviewWindowType] = useState<'iframe' | 'popup'>('iframe')\n\n const [appIsReady, setAppIsReady] = useState(false)\n const [listeningForMessages, setListeningForMessages] = useState(false)\n\n const iframeRef = React.useRef<HTMLIFrameElement>(null)\n\n const [iframeHasLoaded, setIframeHasLoaded] = useState(false)\n const { config } = useConfig()\n\n const [zoom, setZoom] = useState(1)\n\n const [position, setPosition] = useState({ x: 0, y: 0 })\n\n const [size, setSize] = React.useReducer(sizeReducer, { height: 0, width: 0 })\n\n const [measuredDeviceSize, setMeasuredDeviceSize] = useState({\n height: 0,\n width: 0,\n })\n\n const [breakpoint, setBreakpoint] =\n React.useState<LivePreviewConfig['breakpoints'][0]['name']>('responsive')\n\n const [fieldSchemaJSON] = useState(() => {\n return fieldSchemaToJSON(fieldSchema, config)\n })\n\n // The toolbar needs to freely drag and drop around the page\n const handleDragEnd = (ev) => {\n // only update position if the toolbar is completely within the preview area\n // otherwise reset it back to the previous position\n // TODO: reset to the nearest edge of the preview area\n if (ev.over && ev.over.id === 'live-preview-area') {\n const newPos = {\n x: position.x + ev.delta.x,\n y: position.y + ev.delta.y,\n }\n\n setPosition(newPos)\n } else {\n // reset\n }\n }\n\n const setWidth = useCallback(\n (width) => {\n setSize({ type: 'width', value: width })\n },\n [setSize],\n )\n\n const setHeight = useCallback(\n (height) => {\n setSize({ type: 'height', value: height })\n },\n [setSize],\n )\n\n // explicitly set new width and height when as new breakpoints are selected\n // exclude `custom` breakpoint as it is handled by the `setWidth` and `setHeight` directly\n useEffect(() => {\n const foundBreakpoint = breakpoints?.find((bp) => bp.name === breakpoint)\n\n if (\n foundBreakpoint &&\n breakpoint !== 'responsive' &&\n breakpoint !== 'custom' &&\n typeof foundBreakpoint?.width === 'number' &&\n typeof foundBreakpoint?.height === 'number'\n ) {\n setSize({\n type: 'reset',\n value: {\n height: foundBreakpoint.height,\n width: foundBreakpoint.width,\n },\n })\n }\n }, [breakpoint, breakpoints])\n\n // Receive the `ready` message from the popup window\n // This indicates that the app is ready to receive `window.postMessage` events\n // This is also the only cross-origin way of detecting when a popup window has loaded\n // Unlike iframe elements which have an `onLoad` handler, there is no way to access `window.open` on popups\n useEffect(() => {\n const handleMessage = (event: MessageEvent) => {\n if (\n url?.startsWith(event.origin) &&\n event.data &&\n typeof event.data === 'object' &&\n event.data.type === 'payload-live-preview'\n ) {\n if (event.data.ready) {\n setAppIsReady(true)\n }\n }\n }\n\n window.addEventListener('message', handleMessage)\n\n setListeningForMessages(true)\n\n return () => {\n window.removeEventListener('message', handleMessage)\n }\n }, [url, listeningForMessages])\n\n const handleWindowChange = useCallback(\n (type: 'iframe' | 'popup') => {\n setAppIsReady(false)\n setPreviewWindowType(type)\n if (type === 'popup') {\n openPopupWindow()\n }\n },\n [openPopupWindow],\n )\n\n // when the user closes the popup window, switch back to the iframe\n // the `usePopupWindow` reports the `isPopupOpen` state for us to use here\n useEffect(() => {\n const newPreviewWindowType = isPopupOpen ? 'popup' : 'iframe'\n\n if (newPreviewWindowType !== previewWindowType) {\n handleWindowChange('iframe')\n }\n }, [previewWindowType, isPopupOpen, handleWindowChange])\n\n return (\n <LivePreviewContext.Provider\n value={{\n appIsReady,\n breakpoint,\n breakpoints,\n fieldSchemaJSON,\n iframeHasLoaded,\n iframeRef,\n isPopupOpen,\n measuredDeviceSize,\n openPopupWindow,\n popupRef,\n previewWindowType,\n setAppIsReady,\n setBreakpoint,\n setHeight,\n setIframeHasLoaded,\n setMeasuredDeviceSize,\n setPreviewWindowType: handleWindowChange,\n setSize,\n setToolbarPosition: setPosition,\n setWidth,\n setZoom,\n size,\n toolbarPosition: position,\n url,\n zoom,\n }}\n >\n <DndContext collisionDetection={customCollisionDetection} onDragEnd={handleDragEnd}>\n {listeningForMessages && children}\n </DndContext>\n </LivePreviewContext.Provider>\n )\n}\n"],"mappings":"AAAA;;;AAGA,SAASA,UAAU,QAAQ;AA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AAsBiD,kBAAA;MACtBhC,OAAA;MACAoC,kBAAA,EAAoBxC,WAAA;MACpBmB,QAAA;MACArB,OAAA;MACAK,IAAA;MACAsC,eAAA,EAAiB1C,QAAA;MACjBd,GAAA;MACAY;IACF;cAEA,aAAAyC,IAAA,CAACtE,UAAA;MAAW0E,kBAAA,EAAoBnE,wBAAA;MAA0BoE,SAAA,EAAW9B,aAAA;gBAClEvB,oBAAA,IAAwBV;;;AAIjC","ignoreList":[]}
@@ -1,7 +1,8 @@
1
+ import React from 'react';
1
2
  type SelectedLocalesContextType = {
2
3
  selectedLocales: string[];
3
4
  };
4
- export declare const SelectedLocalesContext: import("react").Context<SelectedLocalesContextType>;
5
+ export declare const SelectedLocalesContext: React.Context<SelectedLocalesContextType>;
5
6
  export declare const useSelectedLocales: () => SelectedLocalesContextType;
6
7
  export {};
7
8
  //# sourceMappingURL=SelectedLocalesContext.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"SelectedLocalesContext.d.ts","sourceRoot":"","sources":["../../../../src/views/Version/Default/SelectedLocalesContext.tsx"],"names":[],"mappings":"AAIA,KAAK,0BAA0B,GAAG;IAChC,eAAe,EAAE,MAAM,EAAE,CAAA;CAC1B,CAAA;AAED,eAAO,MAAM,sBAAsB,qDAEjC,CAAA;AAEF,eAAO,MAAM,kBAAkB,kCAAoC,CAAA"}
1
+ {"version":3,"file":"SelectedLocalesContext.d.ts","sourceRoot":"","sources":["../../../../src/views/Version/Default/SelectedLocalesContext.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAwB,MAAM,OAAO,CAAA;AAE5C,KAAK,0BAA0B,GAAG;IAChC,eAAe,EAAE,MAAM,EAAE,CAAA;CAC1B,CAAA;AAED,eAAO,MAAM,sBAAsB,2CAEjC,CAAA;AAEF,eAAO,MAAM,kBAAkB,kCAAiD,CAAA"}
@@ -1,8 +1,10 @@
1
1
  'use client';
2
2
 
3
- import { createContext, use } from 'react';
3
+ import React, { createContext } from 'react';
4
4
  export const SelectedLocalesContext = /*#__PURE__*/createContext({
5
5
  selectedLocales: []
6
6
  });
7
- export const useSelectedLocales = () => use(SelectedLocalesContext);
7
+ export const useSelectedLocales = () => {
8
+ return React.useContext(SelectedLocalesContext);
9
+ };
8
10
  //# sourceMappingURL=SelectedLocalesContext.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SelectedLocalesContext.js","names":["createContext","use","SelectedLocalesContext","selectedLocales","useSelectedLocales"],"sources":["../../../../src/views/Version/Default/SelectedLocalesContext.tsx"],"sourcesContent":["'use client'\n\nimport { createContext, use } from 'react'\n\ntype SelectedLocalesContextType = {\n selectedLocales: string[]\n}\n\nexport const SelectedLocalesContext = createContext<SelectedLocalesContextType>({\n selectedLocales: [],\n})\n\nexport const useSelectedLocales = () => use(SelectedLocalesContext)\n"],"mappings":"AAAA;;AAEA,SAASA,aAAa,EAAEC,GAAG,QAAQ;AAMnC,OAAO,MAAMC,sBAAA,gBAAyBF,aAAA,CAA0C;EAC9EG,eAAA,EAAiB;AACnB;AAEA,OAAO,MAAMC,kBAAA,GAAqBA,CAAA,KAAMH,GAAA,CAAIC,sBAAA","ignoreList":[]}
1
+ {"version":3,"file":"SelectedLocalesContext.js","names":["React","createContext","SelectedLocalesContext","selectedLocales","useSelectedLocales","useContext"],"sources":["../../../../src/views/Version/Default/SelectedLocalesContext.tsx"],"sourcesContent":["'use client'\n\nimport React, { createContext } from 'react'\n\ntype SelectedLocalesContextType = {\n selectedLocales: string[]\n}\n\nexport const SelectedLocalesContext = createContext<SelectedLocalesContextType>({\n selectedLocales: [],\n})\n\nexport const useSelectedLocales = () => React.useContext(SelectedLocalesContext)\n"],"mappings":"AAAA;;AAEA,OAAOA,KAAA,IAASC,aAAa,QAAQ;AAMrC,OAAO,MAAMC,sBAAA,gBAAyBD,aAAA,CAA0C;EAC9EE,eAAA,EAAiB;AACnB;AAEA,OAAO,MAAMC,kBAAA,GAAqBA,CAAA;EAAA,OAAMJ,KAAA,CAAAK,UAAA,CAAAH,sBAAiB;AAAA","ignoreList":[]}
@@ -154,7 +154,7 @@ export const DefaultVersionView = ({
154
154
  options: availableLocales,
155
155
  value: selectedLocales
156
156
  })]
157
- }), /*#__PURE__*/_jsx(SelectedLocalesContext, {
157
+ }), /*#__PURE__*/_jsx(SelectedLocalesContext.Provider, {
158
158
  value: {
159
159
  selectedLocales: selectedLocales.map(locale_1 => locale_1.value)
160
160
  },
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["CheckboxInput","Gutter","useConfig","useDocumentInfo","useRouteTransition","useTranslation","formatDate","usePathname","useRouter","useSearchParams","React","useEffect","useMemo","useState","Restore","SelectComparison","SelectLocales","SelectedLocalesContext","SetStepNav","baseClass","DefaultVersionView","canUpdate","doc","latestDraftVersion","latestPublishedVersion","modifiedOnly","modifiedOnlyProp","RenderedDiff","selectedLocales","selectedLocalesProp","versionID","config","getEntityConfig","availableLocales","localization","locales","map","locale","label","value","code","i18n","id","collectionSlug","globalSlug","startRouteTransition","collectionConfig","globalConfig","setSelectedLocales","compareValue","setCompareValue","router","pathname","searchParams","setModifiedOnly","onToggleModifiedOnly","current","URLSearchParams","Array","from","entries","delete","set","JSON","stringify","search","toString","query","push","admin","dateFormat","routes","api","apiRoute","serverURL","versionCreatedAt","updatedAt","date","pattern","compareBaseURL","draftsEnabled","Boolean","versions","drafts","_jsxs","className","_jsx","fields","t","version","autosave","labels","singular","originalDocID","status","_status","versionDate","checked","onToggle","baseURL","onChange","parentID","options"],"sources":["../../../../src/views/Version/Default/index.tsx"],"sourcesContent":["'use client'\nimport type { OptionObject } from 'payload'\n\nimport {\n CheckboxInput,\n Gutter,\n useConfig,\n useDocumentInfo,\n useRouteTransition,\n useTranslation,\n} from '@payloadcms/ui'\nimport { formatDate } from '@payloadcms/ui/shared'\nimport { usePathname, useRouter, useSearchParams } from 'next/navigation.js'\nimport React, { useEffect, useMemo, useState } from 'react'\n\nimport type { CompareOption, DefaultVersionsViewProps } from './types.js'\n\nimport Restore from '../Restore/index.js'\nimport { SelectComparison } from '../SelectComparison/index.js'\nimport './index.scss'\nimport { SelectLocales } from '../SelectLocales/index.js'\nimport { SelectedLocalesContext } from './SelectedLocalesContext.js'\nimport { SetStepNav } from './SetStepNav.js'\n\nconst baseClass = 'view-version'\n\nexport const DefaultVersionView: React.FC<DefaultVersionsViewProps> = ({\n canUpdate,\n doc,\n latestDraftVersion,\n latestPublishedVersion,\n modifiedOnly: modifiedOnlyProp,\n RenderedDiff,\n selectedLocales: selectedLocalesProp,\n versionID,\n}) => {\n const { config, getEntityConfig } = useConfig()\n\n const availableLocales = useMemo(\n () =>\n config.localization\n ? config.localization.locales.map((locale) => ({\n label: locale.label,\n value: locale.code,\n }))\n : [],\n [config.localization],\n )\n\n const { i18n } = useTranslation()\n const { id, collectionSlug, globalSlug } = useDocumentInfo()\n const { startRouteTransition } = useRouteTransition()\n\n const [collectionConfig] = useState(() => getEntityConfig({ collectionSlug }))\n\n const [globalConfig] = useState(() => getEntityConfig({ globalSlug }))\n\n const [selectedLocales, setSelectedLocales] = useState<OptionObject[]>(selectedLocalesProp)\n\n const [compareValue, setCompareValue] = useState<CompareOption>()\n const router = useRouter()\n const pathname = usePathname()\n const searchParams = useSearchParams()\n const [modifiedOnly, setModifiedOnly] = useState(modifiedOnlyProp)\n function onToggleModifiedOnly() {\n setModifiedOnly(!modifiedOnly)\n }\n\n useEffect(() => {\n // If the selected comparison doc or locales change, update URL params so that version page\n // This is so that RSC can update the version comparison state\n const current = new URLSearchParams(Array.from(searchParams.entries()))\n\n if (!compareValue) {\n current.delete('compareValue')\n } else {\n current.set('compareValue', compareValue?.value)\n }\n\n if (!selectedLocales) {\n current.delete('localeCodes')\n } else {\n current.set('localeCodes', JSON.stringify(selectedLocales.map((locale) => locale.value)))\n }\n\n if (!modifiedOnly) {\n current.delete('modifiedOnly')\n } else {\n current.set('modifiedOnly', 'true')\n }\n\n const search = current.toString()\n const query = search ? `?${search}` : ''\n\n // TODO: this transition occurs multiple times during the initial rendering phases, need to evaluate\n startRouteTransition(() => router.push(`${pathname}${query}`))\n }, [\n compareValue,\n pathname,\n router,\n searchParams,\n selectedLocales,\n modifiedOnly,\n startRouteTransition,\n ])\n\n const {\n admin: { dateFormat },\n localization,\n routes: { api: apiRoute },\n serverURL,\n } = config\n\n const versionCreatedAt = doc?.updatedAt\n ? formatDate({ date: doc.updatedAt, i18n, pattern: dateFormat })\n : ''\n\n const compareBaseURL = `${serverURL}${apiRoute}/${globalSlug ? 'globals/' : ''}${\n collectionSlug || globalSlug\n }/versions`\n\n const draftsEnabled = Boolean((collectionConfig || globalConfig)?.versions.drafts)\n\n return (\n <main className={baseClass}>\n <SetStepNav\n collectionConfig={collectionConfig}\n collectionSlug={collectionSlug}\n doc={doc}\n fields={(collectionConfig || globalConfig)?.fields}\n globalConfig={globalConfig}\n globalSlug={globalSlug}\n id={id}\n />\n <Gutter className={`${baseClass}__wrap`}>\n <div className={`${baseClass}__header-wrap`}>\n <p className={`${baseClass}__created-at`}>\n {i18n.t('version:versionCreatedOn', {\n version: i18n.t(doc?.autosave ? 'version:autosavedVersion' : 'version:version'),\n })}\n </p>\n <header className={`${baseClass}__header`}>\n <h2>{versionCreatedAt}</h2>\n {canUpdate && (\n <Restore\n className={`${baseClass}__restore`}\n collectionSlug={collectionSlug}\n globalSlug={globalSlug}\n label={collectionConfig?.labels.singular || globalConfig?.label}\n originalDocID={id}\n status={doc?.version?._status}\n versionDate={versionCreatedAt}\n versionID={versionID}\n />\n )}\n <span className={`${baseClass}__modifiedCheckBox`}>\n <CheckboxInput\n checked={modifiedOnly}\n id={'modifiedOnly'}\n label={i18n.t('version:modifiedOnly')}\n onToggle={onToggleModifiedOnly}\n />\n </span>\n </header>\n </div>\n <div className={`${baseClass}__controls`}>\n <SelectComparison\n baseURL={compareBaseURL}\n draftsEnabled={draftsEnabled}\n latestDraftVersion={latestDraftVersion}\n latestPublishedVersion={latestPublishedVersion}\n onChange={setCompareValue}\n parentID={id}\n value={compareValue}\n versionID={versionID}\n />\n {localization && (\n <SelectLocales\n onChange={setSelectedLocales}\n options={availableLocales}\n value={selectedLocales}\n />\n )}\n </div>\n <SelectedLocalesContext\n value={{ selectedLocales: selectedLocales.map((locale) => locale.value) }}\n >\n {doc?.version && RenderedDiff}\n </SelectedLocalesContext>\n </Gutter>\n </main>\n )\n}\n"],"mappings":"AAAA;;;AAGA,SACEA,aAAa,EACbC,MAAM,EACNC,SAAS,EACTC,eAAe,EACfC,kBAAkB,EAClBC,cAAc,QACT;AACP,SAASC,UAAU,QAAQ;AAC3B,SAASC,WAAW,EAAEC,SAAS,EAAEC,eAAe,QAAQ;AACxD,OAAOC,KAAA,IAASC,SAAS,EAAEC,OAAO,EAAEC,QAAQ,QAAQ;AAIpD,OAAOC,OAAA,MAAa;AACpB,SAASC,gBAAgB,QAAQ;AAEjC,SAASC,aAAa,QAAQ;AAC9B,SAASC,sBAAsB,QAAQ;AACvC,SAASC,UAAU,QAAQ;AAE3B,MAAMC,SAAA,GAAY;AAElB,OAAO,MAAMC,kBAAA,GAAyDA,CAAC;EACrEC,SAAS;EACTC,GAAG;EACHC,kBAAkB;EAClBC,sBAAsB;EACtBC,YAAA,EAAcC,gBAAgB;EAC9BC,YAAY;EACZC,eAAA,EAAiBC,mBAAmB;EACpCC;AAAS,CACV;EACC,MAAM;IAAEC,MAAM;IAAEC;EAAe,CAAE,GAAG9B,SAAA;EAEpC,MAAM+B,gBAAA,GAAmBrB,OAAA,CACvB,MACEmB,MAAA,CAAOG,YAAY,GACfH,MAAA,CAAOG,YAAY,CAACC,OAAO,CAACC,GAAG,CAAEC,MAAA,KAAY;IAC3CC,KAAA,EAAOD,MAAA,CAAOC,KAAK;IACnBC,KAAA,EAAOF,MAAA,CAAOG;EAChB,MACA,EAAE,EACR,CAACT,MAAA,CAAOG,YAAY,CAAC;EAGvB,MAAM;IAAEO;EAAI,CAAE,GAAGpC,cAAA;EACjB,MAAM;IAAEqC,EAAE;IAAEC,cAAc;IAAEC;EAAU,CAAE,GAAGzC,eAAA;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F,QAAA,EAAUpD,kBAAA;UACVsD,OAAA,EAASrE,gBAAA;UACTM,KAAA,EAAOX;;uBAIb0D,IAAA,CAACrE,sBAAA;QACCsB,KAAA,EAAO;UAAEX,eAAA,EAAiBA,eAAA,CAAgBQ,GAAG,CAAEC,QAAA,IAAWA,QAAA,CAAOE,KAAK;QAAE;kBAEvEjB,GAAA,EAAKmE,OAAA,IAAW9D;;;;AAK3B","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["CheckboxInput","Gutter","useConfig","useDocumentInfo","useRouteTransition","useTranslation","formatDate","usePathname","useRouter","useSearchParams","React","useEffect","useMemo","useState","Restore","SelectComparison","SelectLocales","SelectedLocalesContext","SetStepNav","baseClass","DefaultVersionView","canUpdate","doc","latestDraftVersion","latestPublishedVersion","modifiedOnly","modifiedOnlyProp","RenderedDiff","selectedLocales","selectedLocalesProp","versionID","config","getEntityConfig","availableLocales","localization","locales","map","locale","label","value","code","i18n","id","collectionSlug","globalSlug","startRouteTransition","collectionConfig","globalConfig","setSelectedLocales","compareValue","setCompareValue","router","pathname","searchParams","setModifiedOnly","onToggleModifiedOnly","current","URLSearchParams","Array","from","entries","delete","set","JSON","stringify","search","toString","query","push","admin","dateFormat","routes","api","apiRoute","serverURL","versionCreatedAt","updatedAt","date","pattern","compareBaseURL","draftsEnabled","Boolean","versions","drafts","_jsxs","className","_jsx","fields","t","version","autosave","labels","singular","originalDocID","status","_status","versionDate","checked","onToggle","baseURL","onChange","parentID","options","Provider"],"sources":["../../../../src/views/Version/Default/index.tsx"],"sourcesContent":["'use client'\nimport type { OptionObject } from 'payload'\n\nimport {\n CheckboxInput,\n Gutter,\n useConfig,\n useDocumentInfo,\n useRouteTransition,\n useTranslation,\n} from '@payloadcms/ui'\nimport { formatDate } from '@payloadcms/ui/shared'\nimport { usePathname, useRouter, useSearchParams } from 'next/navigation.js'\nimport React, { useEffect, useMemo, useState } from 'react'\n\nimport type { CompareOption, DefaultVersionsViewProps } from './types.js'\n\nimport Restore from '../Restore/index.js'\nimport { SelectComparison } from '../SelectComparison/index.js'\nimport './index.scss'\nimport { SelectLocales } from '../SelectLocales/index.js'\nimport { SelectedLocalesContext } from './SelectedLocalesContext.js'\nimport { SetStepNav } from './SetStepNav.js'\n\nconst baseClass = 'view-version'\n\nexport const DefaultVersionView: React.FC<DefaultVersionsViewProps> = ({\n canUpdate,\n doc,\n latestDraftVersion,\n latestPublishedVersion,\n modifiedOnly: modifiedOnlyProp,\n RenderedDiff,\n selectedLocales: selectedLocalesProp,\n versionID,\n}) => {\n const { config, getEntityConfig } = useConfig()\n\n const availableLocales = useMemo(\n () =>\n config.localization\n ? config.localization.locales.map((locale) => ({\n label: locale.label,\n value: locale.code,\n }))\n : [],\n [config.localization],\n )\n\n const { i18n } = useTranslation()\n const { id, collectionSlug, globalSlug } = useDocumentInfo()\n const { startRouteTransition } = useRouteTransition()\n\n const [collectionConfig] = useState(() => getEntityConfig({ collectionSlug }))\n\n const [globalConfig] = useState(() => getEntityConfig({ globalSlug }))\n\n const [selectedLocales, setSelectedLocales] = useState<OptionObject[]>(selectedLocalesProp)\n\n const [compareValue, setCompareValue] = useState<CompareOption>()\n const router = useRouter()\n const pathname = usePathname()\n const searchParams = useSearchParams()\n const [modifiedOnly, setModifiedOnly] = useState(modifiedOnlyProp)\n function onToggleModifiedOnly() {\n setModifiedOnly(!modifiedOnly)\n }\n\n useEffect(() => {\n // If the selected comparison doc or locales change, update URL params so that version page\n // This is so that RSC can update the version comparison state\n const current = new URLSearchParams(Array.from(searchParams.entries()))\n\n if (!compareValue) {\n current.delete('compareValue')\n } else {\n current.set('compareValue', compareValue?.value)\n }\n\n if (!selectedLocales) {\n current.delete('localeCodes')\n } else {\n current.set('localeCodes', JSON.stringify(selectedLocales.map((locale) => locale.value)))\n }\n\n if (!modifiedOnly) {\n current.delete('modifiedOnly')\n } else {\n current.set('modifiedOnly', 'true')\n }\n\n const search = current.toString()\n const query = search ? `?${search}` : ''\n\n // TODO: this transition occurs multiple times during the initial rendering phases, need to evaluate\n startRouteTransition(() => router.push(`${pathname}${query}`))\n }, [\n compareValue,\n pathname,\n router,\n searchParams,\n selectedLocales,\n modifiedOnly,\n startRouteTransition,\n ])\n\n const {\n admin: { dateFormat },\n localization,\n routes: { api: apiRoute },\n serverURL,\n } = config\n\n const versionCreatedAt = doc?.updatedAt\n ? formatDate({ date: doc.updatedAt, i18n, pattern: dateFormat })\n : ''\n\n const compareBaseURL = `${serverURL}${apiRoute}/${globalSlug ? 'globals/' : ''}${\n collectionSlug || globalSlug\n }/versions`\n\n const draftsEnabled = Boolean((collectionConfig || globalConfig)?.versions.drafts)\n\n return (\n <main className={baseClass}>\n <SetStepNav\n collectionConfig={collectionConfig}\n collectionSlug={collectionSlug}\n doc={doc}\n fields={(collectionConfig || globalConfig)?.fields}\n globalConfig={globalConfig}\n globalSlug={globalSlug}\n id={id}\n />\n <Gutter className={`${baseClass}__wrap`}>\n <div className={`${baseClass}__header-wrap`}>\n <p className={`${baseClass}__created-at`}>\n {i18n.t('version:versionCreatedOn', {\n version: i18n.t(doc?.autosave ? 'version:autosavedVersion' : 'version:version'),\n })}\n </p>\n <header className={`${baseClass}__header`}>\n <h2>{versionCreatedAt}</h2>\n {canUpdate && (\n <Restore\n className={`${baseClass}__restore`}\n collectionSlug={collectionSlug}\n globalSlug={globalSlug}\n label={collectionConfig?.labels.singular || globalConfig?.label}\n originalDocID={id}\n status={doc?.version?._status}\n versionDate={versionCreatedAt}\n versionID={versionID}\n />\n )}\n <span className={`${baseClass}__modifiedCheckBox`}>\n <CheckboxInput\n checked={modifiedOnly}\n id={'modifiedOnly'}\n label={i18n.t('version:modifiedOnly')}\n onToggle={onToggleModifiedOnly}\n />\n </span>\n </header>\n </div>\n <div className={`${baseClass}__controls`}>\n <SelectComparison\n baseURL={compareBaseURL}\n draftsEnabled={draftsEnabled}\n latestDraftVersion={latestDraftVersion}\n latestPublishedVersion={latestPublishedVersion}\n onChange={setCompareValue}\n parentID={id}\n value={compareValue}\n versionID={versionID}\n />\n {localization && (\n <SelectLocales\n onChange={setSelectedLocales}\n options={availableLocales}\n value={selectedLocales}\n />\n )}\n </div>\n <SelectedLocalesContext.Provider\n value={{ selectedLocales: selectedLocales.map((locale) => locale.value) }}\n >\n {doc?.version && RenderedDiff}\n </SelectedLocalesContext.Provider>\n </Gutter>\n </main>\n )\n}\n"],"mappings":"AAAA;;;AAGA,SACEA,aAAa,EACbC,MAAM,EACNC,SAAS,EACTC,eAAe,EACfC,kBAAkB,EAClBC,cAAc,QACT;AACP,SAASC,UAAU,QAAQ;AAC3B,SAASC,WAAW,EAAEC,SAAS,EAAEC,eAAe,QAAQ;AACxD,OAAOC,KAAA,IAASC,SAAS,EAAEC,OAAO,EAAEC,QAAQ,QAAQ;AAIpD,OAAOC,OAAA,MAAa;AACpB,SAASC,gBAAgB,QAAQ;AAEjC,SAASC,aAAa,QAAQ;AAC9B,SAASC,sBAAsB,QAAQ;AACvC,SAASC,UAAU,QAAQ;AAE3B,MAAMC,SAAA,GAAY;AAElB,OAAO,MAAMC,kBAAA,GAAyDA,CAAC;EACrEC,SAAS;EACTC,GAAG;EACHC,kBAAkB;EAClBC,sBAAsB;EACtBC,YAAA,EAAcC,gBAAgB;EAC9BC,YAAY;EACZC,eAAA,EAAiBC,mBAAmB;EACpCC;AAAS,CACV;EACC,MAAM;IAAEC,MAAM;IAAEC;EAAe,CAAE,GAAG9B,SAAA;EAEpC,MAAM+B,gBAAA,GAAmBrB,OAAA,CACvB,MACEmB,MAAA,CAAOG,YAAY,GACfH,MAAA,CAAOG,YAAY,CAACC,OAAO,CAACC,GAAG,CAAEC,MAAA,KAAY;IAC3CC,KAAA,EAAOD,MAAA,CAAOC,KAAK;IACnBC,KAAA,EAAOF,MAAA,CAAOG;EAChB,MACA,EAAE,EACR,CAACT,MAAA,CAAOG,YAAY,CAAC;EAGvB,MAAM;IAAEO;EAAI,CAAE,GAAGpC,cAAA;EACjB,MAAM;IAAEqC,EAAE;IAAEC,cAAc;IAAE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CoD,IAAA,CAACtE,aAAA;UACCoF,QAAA,EAAUpD,kBAAA;UACVsD,OAAA,EAASrE,gBAAA;UACTM,KAAA,EAAOX;;uBAIb0D,IAAA,CAACrE,sBAAA,CAAuBsF,QAAQ;QAC9BhE,KAAA,EAAO;UAAEX,eAAA,EAAiBA,eAAA,CAAgBQ,GAAG,CAAEC,QAAA,IAAWA,QAAA,CAAOE,KAAK;QAAE;kBAEvEjB,GAAA,EAAKmE,OAAA,IAAW9D;;;;AAK3B","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/views/Version/RenderFieldsToDiff/fields/Select/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAuB,8BAA8B,EAAE,MAAM,SAAS,CAAA;AAOlF,OAAO,cAAc,CAAA;AAqDrB,eAAO,MAAM,MAAM,EAAE,8BAwDpB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/views/Version/RenderFieldsToDiff/fields/Select/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAA6B,8BAA8B,EAAE,MAAM,SAAS,CAAA;AAOxF,OAAO,cAAc,CAAA;AAqCrB,eAAO,MAAM,MAAM,EAAE,8BAwDpB,CAAA"}
@@ -15,27 +15,11 @@ const getOptionsToRender = (value, options, hasMany) => {
15
15
  }
16
16
  return options.find(option => (typeof option === 'string' ? option : option.value) === value) || String(value);
17
17
  };
18
- /**
19
- * Translates option labels while ensuring they are strings.
20
- * If `options.label` is a JSX element, it falls back to `options.value` because `DiffViewer`
21
- * expects all values to be strings.
22
- */
23
18
  const getTranslatedOptions = (options, i18n) => {
24
19
  if (Array.isArray(options)) {
25
- return options.map(option => {
26
- if (typeof option === 'string') {
27
- return option;
28
- }
29
- const translatedLabel = getTranslation(option.label, i18n);
30
- // Ensure the result is a string, otherwise use option.value
31
- return typeof translatedLabel === 'string' ? translatedLabel : option.value;
32
- }).join(', ');
20
+ return options.map(option => typeof option === 'string' ? option : getTranslation(option.label, i18n)).join(', ');
33
21
  }
34
- if (typeof options === 'string') {
35
- return options;
36
- }
37
- const translatedLabel = getTranslation(options.label, i18n);
38
- return typeof translatedLabel === 'string' ? translatedLabel : options.value;
22
+ return typeof options === 'string' ? options : getTranslation(options.label, i18n);
39
23
  };
40
24
  export const Select = t0 => {
41
25
  const $ = _c(11);
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["c","_c","getTranslation","useTranslation","React","Label","diffStyles","DiffViewer","baseClass","getOptionsToRender","value","options","hasMany","Array","isArray","map","val","find","option","String","getTranslatedOptions","i18n","translatedLabel","label","join","Select","t0","$","comparisonValue","diffMethod","field","locale","versionValue","placeholder","t","t1","comparisonToRender","JSON","stringify","versionToRender","t2","_jsx","className","children","_jsxs"],"sources":["../../../../../../src/views/Version/RenderFieldsToDiff/fields/Select/index.tsx"],"sourcesContent":["'use client'\nimport type { I18nClient } from '@payloadcms/translations'\nimport type { Option, SelectField, SelectFieldDiffClientComponent } from 'payload'\n\nimport { getTranslation } from '@payloadcms/translations'\nimport { useTranslation } from '@payloadcms/ui'\nimport React from 'react'\n\nimport Label from '../../Label/index.js'\nimport './index.scss'\nimport { diffStyles } from '../styles.js'\nimport { DiffViewer } from './DiffViewer/index.js'\n\nconst baseClass = 'select-diff'\n\nconst getOptionsToRender = (\n value: string,\n options: SelectField['options'],\n hasMany: boolean,\n): Option | Option[] => {\n if (hasMany && Array.isArray(value)) {\n return value.map(\n (val) =>\n options.find((option) => (typeof option === 'string' ? option : option.value) === val) ||\n String(val),\n )\n }\n return (\n options.find((option) => (typeof option === 'string' ? option : option.value) === value) ||\n String(value)\n )\n}\n\n/**\n * Translates option labels while ensuring they are strings.\n * If `options.label` is a JSX element, it falls back to `options.value` because `DiffViewer`\n * expects all values to be strings.\n */\nconst getTranslatedOptions = (options: Option | Option[], i18n: I18nClient): string => {\n if (Array.isArray(options)) {\n return options\n .map((option) => {\n if (typeof option === 'string') {\n return option\n }\n const translatedLabel = getTranslation(option.label, i18n)\n\n // Ensure the result is a string, otherwise use option.value\n return typeof translatedLabel === 'string' ? translatedLabel : option.value\n })\n .join(', ')\n }\n\n if (typeof options === 'string') {\n return options\n }\n\n const translatedLabel = getTranslation(options.label, i18n)\n\n return typeof translatedLabel === 'string' ? translatedLabel : options.value\n}\n\nexport const Select: SelectFieldDiffClientComponent = ({\n comparisonValue,\n diffMethod,\n field,\n locale,\n versionValue,\n}) => {\n const { i18n } = useTranslation()\n\n let placeholder = ''\n\n if (versionValue == comparisonValue) {\n placeholder = `[${i18n.t('general:noValue')}]`\n }\n\n const options = 'options' in field && field.options\n\n const comparisonToRender =\n typeof comparisonValue !== 'undefined'\n ? getTranslatedOptions(\n getOptionsToRender(\n typeof comparisonValue === 'string' ? comparisonValue : JSON.stringify(comparisonValue),\n options,\n field.hasMany,\n ),\n i18n,\n )\n : placeholder\n\n const versionToRender =\n typeof versionValue !== 'undefined'\n ? getTranslatedOptions(\n getOptionsToRender(\n typeof versionValue === 'string' ? versionValue : JSON.stringify(versionValue),\n options,\n field.hasMany,\n ),\n i18n,\n )\n : placeholder\n\n return (\n <div className={baseClass}>\n <Label>\n {locale && <span className={`${baseClass}__locale-label`}>{locale}</span>}\n {'label' in field && getTranslation(field.label || '', i18n)}\n </Label>\n <DiffViewer\n comparisonToRender={comparisonToRender}\n diffMethod={diffMethod}\n diffStyles={diffStyles}\n placeholder={placeholder}\n versionToRender={versionToRender}\n />\n </div>\n )\n}\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;;AAIA,SAASC,cAAc,QAAQ;AAC/B,SAASC,cAAc,QAAQ;AAC/B,OAAOC,KAAA,MAAW;AAElB,OAAOC,KAAA,MAAW;AAElB,SAASC,UAAU,QAAQ;AAC3B,SAASC,UAAU,QAAQ;AAE3B,MAAMC,SAAA,GAAY;AAElB,MAAMC,kBAAA,GAAqBA,CACzBC,KAAA,EACAC,OAAA,EACAC,OAAA;EAEA,IAAI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cAAA,CAAe4B,KAAA,CAAAP,KAAA,IAAe,IAAIF,IAAA;MAAA,C,GAEzDoB,IAAA,CAAAlC,UAAA;QAAA6B,kBAAA;QAAAP,UAAA;QAAAvB,UAAA;QAAA2B,WAAA;QAAAM;MAAA,C;;;;;;;;;;;;;;SALFJ,E;CAcJ","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["c","_c","getTranslation","useTranslation","React","Label","diffStyles","DiffViewer","baseClass","getOptionsToRender","value","options","hasMany","Array","isArray","map","val","find","option","String","getTranslatedOptions","i18n","label","join","Select","t0","$","comparisonValue","diffMethod","field","locale","versionValue","placeholder","t","t1","comparisonToRender","JSON","stringify","versionToRender","t2","_jsx","className","children","_jsxs"],"sources":["../../../../../../src/views/Version/RenderFieldsToDiff/fields/Select/index.tsx"],"sourcesContent":["'use client'\nimport type { I18nClient } from '@payloadcms/translations'\nimport type { OptionObject, SelectField, SelectFieldDiffClientComponent } from 'payload'\n\nimport { getTranslation } from '@payloadcms/translations'\nimport { useTranslation } from '@payloadcms/ui'\nimport React from 'react'\n\nimport Label from '../../Label/index.js'\nimport './index.scss'\nimport { diffStyles } from '../styles.js'\nimport { DiffViewer } from './DiffViewer/index.js'\n\nconst baseClass = 'select-diff'\n\nconst getOptionsToRender = (\n value: string,\n options: SelectField['options'],\n hasMany: boolean,\n): (OptionObject | string)[] | OptionObject | string => {\n if (hasMany && Array.isArray(value)) {\n return value.map(\n (val) =>\n options.find((option) => (typeof option === 'string' ? option : option.value) === val) ||\n String(val),\n )\n }\n return (\n options.find((option) => (typeof option === 'string' ? option : option.value) === value) ||\n String(value)\n )\n}\n\nconst getTranslatedOptions = (\n options: (OptionObject | string)[] | OptionObject | string,\n i18n: I18nClient,\n): string => {\n if (Array.isArray(options)) {\n return options\n .map((option) => (typeof option === 'string' ? option : getTranslation(option.label, i18n)))\n .join(', ')\n }\n\n return typeof options === 'string' ? options : getTranslation(options.label, i18n)\n}\n\nexport const Select: SelectFieldDiffClientComponent = ({\n comparisonValue,\n diffMethod,\n field,\n locale,\n versionValue,\n}) => {\n const { i18n } = useTranslation()\n\n let placeholder = ''\n\n if (versionValue == comparisonValue) {\n placeholder = `[${i18n.t('general:noValue')}]`\n }\n\n const options = 'options' in field && field.options\n\n const comparisonToRender =\n typeof comparisonValue !== 'undefined'\n ? getTranslatedOptions(\n getOptionsToRender(\n typeof comparisonValue === 'string' ? comparisonValue : JSON.stringify(comparisonValue),\n options,\n field.hasMany,\n ),\n i18n,\n )\n : placeholder\n\n const versionToRender =\n typeof versionValue !== 'undefined'\n ? getTranslatedOptions(\n getOptionsToRender(\n typeof versionValue === 'string' ? versionValue : JSON.stringify(versionValue),\n options,\n field.hasMany,\n ),\n i18n,\n )\n : placeholder\n\n return (\n <div className={baseClass}>\n <Label>\n {locale && <span className={`${baseClass}__locale-label`}>{locale}</span>}\n {'label' in field && getTranslation(field.label || '', i18n)}\n </Label>\n <DiffViewer\n comparisonToRender={comparisonToRender}\n diffMethod={diffMethod}\n diffStyles={diffStyles}\n placeholder={placeholder}\n versionToRender={versionToRender}\n />\n </div>\n )\n}\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;;AAIA,SAASC,cAAc,QAAQ;AAC/B,SAASC,cAAc,QAAQ;AAC/B,OAAOC,KAAA,MAAW;AAElB,OAAOC,KAAA,MAAW;AAElB,SAASC,UAAU,QAAQ;AAC3B,SAASC,UAAU,QAAQ;AAE3B,MAAMC,SAAA,GAAY;AAElB,MAAMC,kBAAA,GAAqBA,CACzBC,KAAA,EACAC,OAAA,EACAC,OAAA;EAEA,IAAIA,OAAA,IAAWC,KAAA,CAAMC,OAAO,CAACJ,KAAA,GAAQ;IACnC,OAAOA,KAAA,CAAMK,GAAG,CACbC,GAAA,IACCL,OAAA,CAAQM,IAAI,CAAEC,MAAA,IAAW,CAAC,OAAOA,MAAA,KAAW,WAAWA,MAAA,GAASA,MAAA,CAAOR,KAAK,MAAMM,GAAA,KAClFG,MAAA,CAAOH,GAAA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cACvBP,oBAAA,CACEX,kBAAA,CACE,OAAOkB,eAAA,KAAoB,WAAWA,eAAA,GAAkBS,IAAA,CAAAC,SAAA,CAAeV,eAAA,GACvEhB,OAAA,EACAkB,KAAA,CAAAjB,OAAa,GAEfS,IAAA,IAEFW,WAAA;IAEN,MAAAM,eAAA,GACE,OAAOP,YAAA,KAAiB,cACpBX,oBAAA,CACEX,kBAAA,CACE,OAAOsB,YAAA,KAAiB,WAAWA,YAAA,GAAeK,IAAA,CAAAC,SAAA,CAAeN,YAAA,GACjEpB,OAAA,EACAkB,KAAA,CAAAjB,OAAa,GAEfS,IAAA,IAEFW,WAAA;IAAA,IAAAO,EAAA;IAAA,IAAAb,CAAA,QAAAI,MAAA;MAKCS,EAAA,GAAAT,MAAA,IAAUU,IAAA,CAAC;QAAAC,SAAA,EAAgB,GAAAjC,SAAA,gBAA4B;QAAAkC,QAAA,EAAGZ;MAAA,C;;;;;;IAF/DI,EAAA,GAAAS,KAAA,CAAC;MAAAF,SAAA,EAAAjC,SAAA;MAAAkC,QAAA,GACCC,KAAA,CAAAtC,KAAA;QAAAqC,QAAA,GACGH,E,EACA,WAAWV,KAAA,IAAS3B,cAAA,CAAe2B,KAAA,CAAAP,KAAA,IAAe,IAAID,IAAA;MAAA,C,GAEzDmB,IAAA,CAAAjC,UAAA;QAAA4B,kBAAA;QAAAP,UAAA;QAAAtB,UAAA;QAAA0B,WAAA;QAAAM;MAAA,C;;;;;;;;;;;;;;SALFJ,E;CAcJ","ignoreList":[]}
@@ -71,7 +71,7 @@
71
71
  },
72
72
  serverExternalPackages: [...(nextConfig?.serverExternalPackages || []), 'drizzle-kit', 'drizzle-kit/api', 'pino', 'libsql', 'pino-pretty', 'graphql',
73
73
  // Do not bundle server-only packages during dev to improve compile speed
74
- ...(process.env.NODE_ENV === 'development' && options.devBundleServerPackages === false ? ['payload', '@payloadcms/db-mongodb', '@payloadcms/db-postgres', '@payloadcms/db-sqlite', '@payloadcms/db-vercel-postgres', '@payloadcms/drizzle', '@payloadcms/email-nodemailer', '@payloadcms/email-resend', '@payloadcms/graphql', '@payloadcms/payload-cloud', '@payloadcms/plugin-redirects'] : [])],
74
+ ...(process.env.npm_lifecycle_event === 'dev' && options.devBundleServerPackages === false ? ['payload', '@payloadcms/db-mongodb', '@payloadcms/db-postgres', '@payloadcms/db-sqlite', '@payloadcms/db-vercel-postgres', '@payloadcms/drizzle', '@payloadcms/email-nodemailer', '@payloadcms/email-resend', '@payloadcms/graphql', '@payloadcms/payload-cloud', '@payloadcms/plugin-cloud-storage', '@payloadcms/plugin-redirects', '@payloadcms/plugin-sentry', '@payloadcms/plugin-stripe'] : [])],
75
75
  webpack: (webpackConfig, webpackOptions) => {
76
76
  const incomingWebpackConfig = typeof nextConfig.webpack === 'function' ? nextConfig.webpack(webpackConfig, webpackOptions) : webpackConfig;
77
77
  return {
@@ -1 +1 @@
1
- {"version":3,"file":"withPayload.js","names":["withPayload","nextConfig","options","env","experimental","staleTimes","dynamic","console","warn","NEXT_PUBLIC_ENABLE_ROUTER_CACHE_REFRESH","process","PAYLOAD_PATCH_TURBOPACK_WARNINGS","turbopackWarningText","consoleWarn","args","includes","poweredByHeader","key","value","toReturn","outputFileTracingExcludes","outputFileTracingIncludes","turbo","resolveAlias","headers","headersFromConfig","source","serverExternalPackages","NODE_ENV","devBundleServerPackages","webpack","webpackConfig","webpackOptions","incomingWebpackConfig","externals","ignoreWarnings","module","file","resolve","alias","fallback","aws4","kerberos","snappy","basePath","NEXT_BASE_PATH"],"sources":["../src/withPayload.js"],"sourcesContent":["/**\n * @param {import('next').NextConfig} nextConfig\n * @param {Object} [options] - Optional configuration options\n * @param {boolean} [options.devBundleServerPackages] - Whether to bundle server packages in development mode. @default true\n *\n * @returns {import('next').NextConfig}\n * */\nexport const withPayload = (nextConfig = {}, options = {}) => {\n const env = nextConfig?.env || {}\n\n if (nextConfig.experimental?.staleTimes?.dynamic) {\n console.warn(\n 'Payload detected a non-zero value for the `staleTimes.dynamic` option in your Next.js config. This will slow down page transitions and may cause stale data to load within the Admin panel. To clear this warning, remove the `staleTimes.dynamic` option from your Next.js config or set it to 0. In the future, Next.js may support scoping this option to specific routes.',\n )\n env.NEXT_PUBLIC_ENABLE_ROUTER_CACHE_REFRESH = 'true'\n }\n\n if (process.env.PAYLOAD_PATCH_TURBOPACK_WARNINGS !== 'false') {\n const turbopackWarningText =\n 'Packages that should be external need to be installed in the project directory, so they can be resolved from the output files.\\nTry to install it into the project directory by running'\n\n const consoleWarn = console.warn\n console.warn = (...args) => {\n // Force to disable serverExternalPackages warnings: https://github.com/vercel/next.js/issues/68805\n if (\n (typeof args[1] === 'string' && args[1].includes(turbopackWarningText)) ||\n (typeof args[0] === 'string' && args[0].includes(turbopackWarningText))\n ) {\n return\n }\n\n consoleWarn(...args)\n }\n }\n\n const poweredByHeader = {\n key: 'X-Powered-By',\n value: 'Next.js, Payload',\n }\n\n /**\n * @type {import('next').NextConfig}\n */\n const toReturn = {\n ...nextConfig,\n env,\n outputFileTracingExcludes: {\n ...(nextConfig?.outputFileTracingExcludes || {}),\n '**/*': [\n ...(nextConfig?.outputFileTracingExcludes?.['**/*'] || []),\n 'drizzle-kit',\n 'drizzle-kit/api',\n ],\n },\n outputFileTracingIncludes: {\n ...(nextConfig?.outputFileTracingIncludes || {}),\n '**/*': [...(nextConfig?.outputFileTracingIncludes?.['**/*'] || []), '@libsql/client'],\n },\n experimental: {\n ...(nextConfig?.experimental || {}),\n turbo: {\n ...(nextConfig?.experimental?.turbo || {}),\n resolveAlias: {\n ...(nextConfig?.experimental?.turbo?.resolveAlias || {}),\n 'payload-mock-package': 'payload-mock-package',\n },\n },\n },\n // We disable the poweredByHeader here because we add it manually in the headers function below\n ...(nextConfig?.poweredByHeader !== false ? { poweredByHeader: false } : {}),\n headers: async () => {\n const headersFromConfig = 'headers' in nextConfig ? await nextConfig.headers() : []\n\n return [\n ...(headersFromConfig || []),\n {\n source: '/:path*',\n headers: [\n {\n key: 'Accept-CH',\n value: 'Sec-CH-Prefers-Color-Scheme',\n },\n {\n key: 'Vary',\n value: 'Sec-CH-Prefers-Color-Scheme',\n },\n {\n key: 'Critical-CH',\n value: 'Sec-CH-Prefers-Color-Scheme',\n },\n ...(nextConfig?.poweredByHeader !== false ? [poweredByHeader] : []),\n ],\n },\n ]\n },\n serverExternalPackages: [\n ...(nextConfig?.serverExternalPackages || []),\n 'drizzle-kit',\n 'drizzle-kit/api',\n 'pino',\n 'libsql',\n 'pino-pretty',\n 'graphql',\n // Do not bundle server-only packages during dev to improve compile speed\n ...(process.env.NODE_ENV === 'development' && options.devBundleServerPackages === false\n ? [\n 'payload',\n '@payloadcms/db-mongodb',\n '@payloadcms/db-postgres',\n '@payloadcms/db-sqlite',\n '@payloadcms/db-vercel-postgres',\n '@payloadcms/drizzle',\n '@payloadcms/email-nodemailer',\n '@payloadcms/email-resend',\n '@payloadcms/graphql',\n '@payloadcms/payload-cloud',\n '@payloadcms/plugin-redirects',\n // TODO: Add the following packages, excluding their /client subpath exports, once Next.js supports it\n //'@payloadcms/plugin-cloud-storage',\n //'@payloadcms/plugin-sentry',\n //'@payloadcms/plugin-stripe',\n // @payloadcms/richtext-lexical\n //'@payloadcms/storage-azure',\n //'@payloadcms/storage-gcs',\n //'@payloadcms/storage-s3',\n //'@payloadcms/storage-uploadthing',\n //'@payloadcms/storage-vercel-blob',\n ]\n : []),\n ],\n webpack: (webpackConfig, webpackOptions) => {\n const incomingWebpackConfig =\n typeof nextConfig.webpack === 'function'\n ? nextConfig.webpack(webpackConfig, webpackOptions)\n : webpackConfig\n\n return {\n ...incomingWebpackConfig,\n externals: [\n ...(incomingWebpackConfig?.externals || []),\n 'drizzle-kit',\n 'drizzle-kit/api',\n 'sharp',\n 'libsql',\n ],\n ignoreWarnings: [\n ...(incomingWebpackConfig?.ignoreWarnings || []),\n { module: /node_modules\\/mongodb\\/lib\\/utils\\.js/ },\n { file: /node_modules\\/mongodb\\/lib\\/utils\\.js/ },\n { module: /node_modules\\/mongodb\\/lib\\/bson\\.js/ },\n { file: /node_modules\\/mongodb\\/lib\\/bson\\.js/ },\n ],\n resolve: {\n ...(incomingWebpackConfig?.resolve || {}),\n alias: {\n ...(incomingWebpackConfig?.resolve?.alias || {}),\n },\n fallback: {\n ...(incomingWebpackConfig?.resolve?.fallback || {}),\n '@aws-sdk/credential-providers': false,\n '@mongodb-js/zstd': false,\n aws4: false,\n kerberos: false,\n 'mongodb-client-encryption': false,\n snappy: false,\n 'supports-color': false,\n 'yocto-queue': false,\n },\n },\n }\n },\n }\n\n if (nextConfig.basePath) {\n toReturn.env.NEXT_BASE_PATH = nextConfig.basePath\n }\n\n return toReturn\n}\n\nexport default withPayload\n"],"mappings":"AAAA;;;;;;KAOA,OAAO,MAAMA,WAAA,GAAcA,CAACC,UAAA,GAAa,CAAC,CAAC,EAAEC,OAAA,GAAU,CAAC,CAAC;EACvD,MAAMC,GAAA,GAAMF,UAAA,EAAYE,GAAA,IAAO,CAAC;EAEhC,IAAIF,UAAA,CAAWG,YAAY,EAAEC,UAAA,EAAYC,OAAA,EAAS;IAChDC,OAAA,CAAQC,IAAI,CACV;IAEFL,GAAA,CAAIM,uCAAuC,GAAG;EAChD;EAEA,IAAIC,OAAA,CAAQP,GAAG,CAACQ,gCAAgC,KAAK,SAAS;IAC5D,MAAMC,oBAAA,GACJ;IAEF,MAAMC,WAAA,GAAcN,OAAA,CAAQC,IAAI;IAChCD,OAAA,CAAQC,IAAI,GAAG,CAAC,GAAGM,IAAA;MACjB;MACA,IACE,OAAQA,IAAI,CAAC,EAAE,KAAK,YAAYA,IAAI,CAAC,EAAE,CAACC,QAAQ,CAACH,oBAAA,KAChD,OAAOE,IAAI,CAAC,EAAE,KAAK,YAAYA,IAAI,CAAC,EAAE,CAACC,QAAQ,CAACH,oBAAA,GACjD;QACA;MACF;MAEAC,WAAA,IAAeC,IAAA;IACjB;EACF;EAEA,MAAME,eAAA,GAAkB;IACtBC,GAAA,EAAK;IACLC,KAAA,EAAO;EACT;EAEA;;;E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,CAAW2C,QAAQ;EACnD;EAEA,OAAOzB,QAAA;AACT;AAEA,eAAenB,WAAA","ignoreList":[]}
1
+ {"version":3,"file":"withPayload.js","names":["withPayload","nextConfig","options","env","experimental","staleTimes","dynamic","console","warn","NEXT_PUBLIC_ENABLE_ROUTER_CACHE_REFRESH","process","PAYLOAD_PATCH_TURBOPACK_WARNINGS","turbopackWarningText","consoleWarn","args","includes","poweredByHeader","key","value","toReturn","outputFileTracingExcludes","outputFileTracingIncludes","turbo","resolveAlias","headers","headersFromConfig","source","serverExternalPackages","npm_lifecycle_event","devBundleServerPackages","webpack","webpackConfig","webpackOptions","incomingWebpackConfig","externals","ignoreWarnings","module","file","resolve","alias","fallback","aws4","kerberos","snappy","basePath","NEXT_BASE_PATH"],"sources":["../src/withPayload.js"],"sourcesContent":["/**\n * @param {import('next').NextConfig} nextConfig\n * @param {Object} [options] - Optional configuration options\n * @param {boolean} [options.devBundleServerPackages] - Whether to bundle server packages in development mode. @default true\n *\n * @returns {import('next').NextConfig}\n * */\nexport const withPayload = (nextConfig = {}, options = {}) => {\n const env = nextConfig?.env || {}\n\n if (nextConfig.experimental?.staleTimes?.dynamic) {\n console.warn(\n 'Payload detected a non-zero value for the `staleTimes.dynamic` option in your Next.js config. This will slow down page transitions and may cause stale data to load within the Admin panel. To clear this warning, remove the `staleTimes.dynamic` option from your Next.js config or set it to 0. In the future, Next.js may support scoping this option to specific routes.',\n )\n env.NEXT_PUBLIC_ENABLE_ROUTER_CACHE_REFRESH = 'true'\n }\n\n if (process.env.PAYLOAD_PATCH_TURBOPACK_WARNINGS !== 'false') {\n const turbopackWarningText =\n 'Packages that should be external need to be installed in the project directory, so they can be resolved from the output files.\\nTry to install it into the project directory by running'\n\n const consoleWarn = console.warn\n console.warn = (...args) => {\n // Force to disable serverExternalPackages warnings: https://github.com/vercel/next.js/issues/68805\n if (\n (typeof args[1] === 'string' && args[1].includes(turbopackWarningText)) ||\n (typeof args[0] === 'string' && args[0].includes(turbopackWarningText))\n ) {\n return\n }\n\n consoleWarn(...args)\n }\n }\n\n const poweredByHeader = {\n key: 'X-Powered-By',\n value: 'Next.js, Payload',\n }\n\n /**\n * @type {import('next').NextConfig}\n */\n const toReturn = {\n ...nextConfig,\n env,\n outputFileTracingExcludes: {\n ...(nextConfig?.outputFileTracingExcludes || {}),\n '**/*': [\n ...(nextConfig?.outputFileTracingExcludes?.['**/*'] || []),\n 'drizzle-kit',\n 'drizzle-kit/api',\n ],\n },\n outputFileTracingIncludes: {\n ...(nextConfig?.outputFileTracingIncludes || {}),\n '**/*': [...(nextConfig?.outputFileTracingIncludes?.['**/*'] || []), '@libsql/client'],\n },\n experimental: {\n ...(nextConfig?.experimental || {}),\n turbo: {\n ...(nextConfig?.experimental?.turbo || {}),\n resolveAlias: {\n ...(nextConfig?.experimental?.turbo?.resolveAlias || {}),\n 'payload-mock-package': 'payload-mock-package',\n },\n },\n },\n // We disable the poweredByHeader here because we add it manually in the headers function below\n ...(nextConfig?.poweredByHeader !== false ? { poweredByHeader: false } : {}),\n headers: async () => {\n const headersFromConfig = 'headers' in nextConfig ? await nextConfig.headers() : []\n\n return [\n ...(headersFromConfig || []),\n {\n source: '/:path*',\n headers: [\n {\n key: 'Accept-CH',\n value: 'Sec-CH-Prefers-Color-Scheme',\n },\n {\n key: 'Vary',\n value: 'Sec-CH-Prefers-Color-Scheme',\n },\n {\n key: 'Critical-CH',\n value: 'Sec-CH-Prefers-Color-Scheme',\n },\n ...(nextConfig?.poweredByHeader !== false ? [poweredByHeader] : []),\n ],\n },\n ]\n },\n serverExternalPackages: [\n ...(nextConfig?.serverExternalPackages || []),\n 'drizzle-kit',\n 'drizzle-kit/api',\n 'pino',\n 'libsql',\n 'pino-pretty',\n 'graphql',\n // Do not bundle server-only packages during dev to improve compile speed\n ...(process.env.npm_lifecycle_event === 'dev' && options.devBundleServerPackages === false\n ? [\n 'payload',\n '@payloadcms/db-mongodb',\n '@payloadcms/db-postgres',\n '@payloadcms/db-sqlite',\n '@payloadcms/db-vercel-postgres',\n '@payloadcms/drizzle',\n '@payloadcms/email-nodemailer',\n '@payloadcms/email-resend',\n '@payloadcms/graphql',\n '@payloadcms/payload-cloud',\n '@payloadcms/plugin-cloud-storage',\n '@payloadcms/plugin-redirects',\n '@payloadcms/plugin-sentry',\n '@payloadcms/plugin-stripe',\n // TODO: Add the following packages, excluding their /client subpath exports, once Next.js supports it\n // @payloadcms/richtext-lexical\n //'@payloadcms/storage-azure',\n //'@payloadcms/storage-gcs',\n //'@payloadcms/storage-s3',\n //'@payloadcms/storage-uploadthing',\n //'@payloadcms/storage-vercel-blob',\n ]\n : []),\n ],\n webpack: (webpackConfig, webpackOptions) => {\n const incomingWebpackConfig =\n typeof nextConfig.webpack === 'function'\n ? nextConfig.webpack(webpackConfig, webpackOptions)\n : webpackConfig\n\n return {\n ...incomingWebpackConfig,\n externals: [\n ...(incomingWebpackConfig?.externals || []),\n 'drizzle-kit',\n 'drizzle-kit/api',\n 'sharp',\n 'libsql',\n ],\n ignoreWarnings: [\n ...(incomingWebpackConfig?.ignoreWarnings || []),\n { module: /node_modules\\/mongodb\\/lib\\/utils\\.js/ },\n { file: /node_modules\\/mongodb\\/lib\\/utils\\.js/ },\n { module: /node_modules\\/mongodb\\/lib\\/bson\\.js/ },\n { file: /node_modules\\/mongodb\\/lib\\/bson\\.js/ },\n ],\n resolve: {\n ...(incomingWebpackConfig?.resolve || {}),\n alias: {\n ...(incomingWebpackConfig?.resolve?.alias || {}),\n },\n fallback: {\n ...(incomingWebpackConfig?.resolve?.fallback || {}),\n '@aws-sdk/credential-providers': false,\n '@mongodb-js/zstd': false,\n aws4: false,\n kerberos: false,\n 'mongodb-client-encryption': false,\n snappy: false,\n 'supports-color': false,\n 'yocto-queue': false,\n },\n },\n }\n },\n }\n\n if (nextConfig.basePath) {\n toReturn.env.NEXT_BASE_PATH = nextConfig.basePath\n }\n\n return toReturn\n}\n\nexport default withPayload\n"],"mappings":"AAAA;;;;;;KAOA,OAAO,MAAMA,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,qBAAqB;QACxBC,SAAA,EAAW,C,IACLD,qBAAA,EAAuBC,SAAA,IAAa,EAAE,GAC1C,eACA,mBACA,SACA,SACD;QACDC,cAAA,EAAgB,C,IACVF,qBAAA,EAAuBE,cAAA,IAAkB,EAAE,GAC/C;UAAEC,MAAA,EAAQ;QAAwC,GAClD;UAAEC,IAAA,EAAM;QAAwC,GAChD;UAAED,MAAA,EAAQ;QAAuC,GACjD;UAAEC,IAAA,EAAM;QAAuC,EAChD;QACDC,OAAA,EAAS;UACP,IAAIL,qBAAA,EAAuBK,OAAA,IAAW,CAAC,CAAC;UACxCC,KAAA,EAAO;YACL,IAAIN,qBAAA,EAAuBK,OAAA,EAASC,KAAA,IAAS,CAAC,CAAC;UACjD;UACAC,QAAA,EAAU;YACR,IAAIP,qBAAA,EAAuBK,OAAA,EAASE,QAAA,IAAY,CAAC,CAAC;YAClD,iCAAiC;YACjC,oBAAoB;YACpBC,IAAA,EAAM;YACNC,QAAA,EAAU;YACV,6BAA6B;YAC7BC,MAAA,EAAQ;YACR,kBAAkB;YAClB,eAAe;UACjB;QACF;MACF;IACF;EACF;EAEA,IAAI1C,UAAA,CAAW2C,QAAQ,EAAE;IACvBzB,QAAA,CAAShB,GAAG,CAAC0C,cAAc,GAAG5C,UAAA,CAAW2C,QAAQ;EACnD;EAEA,OAAOzB,QAAA;AACT;AAEA,eAAenB,WAAA","ignoreList":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@payloadcms/next",
3
- "version": "3.29.0-internal.3471e81",
3
+ "version": "3.29.0-internal.7b98279",
4
4
  "homepage": "https://payloadcms.com",
5
5
  "repository": {
6
6
  "type": "git",
@@ -79,9 +79,9 @@
79
79
  "react-diff-viewer-continued": "4.0.5",
80
80
  "sass": "1.77.4",
81
81
  "uuid": "10.0.0",
82
- "@payloadcms/graphql": "3.29.0-internal.3471e81",
83
- "@payloadcms/ui": "3.29.0-internal.3471e81",
84
- "@payloadcms/translations": "3.29.0-internal.3471e81"
82
+ "@payloadcms/graphql": "3.29.0-internal.7b98279",
83
+ "@payloadcms/translations": "3.29.0-internal.7b98279",
84
+ "@payloadcms/ui": "3.29.0-internal.7b98279"
85
85
  },
86
86
  "devDependencies": {
87
87
  "@babel/cli": "7.26.4",
@@ -99,13 +99,13 @@
99
99
  "esbuild-sass-plugin": "3.3.1",
100
100
  "eslint-plugin-react-compiler": "19.0.0-beta-714736e-20250131",
101
101
  "swc-plugin-transform-remove-imports": "3.1.0",
102
- "payload": "3.29.0-internal.3471e81",
102
+ "payload": "3.29.0-internal.7b98279",
103
103
  "@payloadcms/eslint-config": "3.28.0"
104
104
  },
105
105
  "peerDependencies": {
106
106
  "graphql": "^16.8.1",
107
107
  "next": "^15.0.0",
108
- "payload": "3.29.0-internal.3471e81"
108
+ "payload": "3.29.0-internal.7b98279"
109
109
  },
110
110
  "engines": {
111
111
  "node": "^18.20.2 || >=20.9.0"