@payloadcms/plugin-search 3.69.0-internal.5029b68 → 3.70.0-canary.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.
@@ -1 +1 @@
1
- {"version":3,"file":"index.client.d.ts","sourceRoot":"","sources":["../../../../src/Search/ui/LinkToDoc/index.client.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,EAkDnC,CAAA"}
1
+ {"version":3,"file":"index.client.d.ts","sourceRoot":"","sources":["../../../../src/Search/ui/LinkToDoc/index.client.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,EAgDnC,CAAA"}
@@ -12,12 +12,11 @@ export const LinkToDocClient = ()=>{
12
12
  if (!value?.relationTo || !value?.value) {
13
13
  return null;
14
14
  }
15
- const href = `${serverURL}${formatAdminURL({
15
+ const href = formatAdminURL({
16
16
  adminRoute,
17
17
  path: `/collections/${value.relationTo || ''}/${value.value || ''}`,
18
18
  serverURL
19
- })}`;
20
- const hrefToDisplay = `${process.env.NEXT_BASE_PATH || ''}${href}`;
19
+ });
21
20
  return /*#__PURE__*/ _jsxs("div", {
22
21
  style: {
23
22
  marginBottom: 'var(--spacing-field, 1rem)'
@@ -33,7 +32,7 @@ export const LinkToDocClient = ()=>{
33
32
  children: "Doc URL"
34
33
  }),
35
34
  /*#__PURE__*/ _jsx(CopyToClipboard, {
36
- value: hrefToDisplay
35
+ value: href
37
36
  })
38
37
  ]
39
38
  }),
@@ -48,7 +47,7 @@ export const LinkToDocClient = ()=>{
48
47
  passHref: true,
49
48
  rel: 'noopener noreferrer',
50
49
  target: '_blank',
51
- children: hrefToDisplay
50
+ children: href
52
51
  })
53
52
  })
54
53
  ]
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/Search/ui/LinkToDoc/index.client.tsx"],"sourcesContent":["'use client'\n\nimport { CopyToClipboard, Link, useConfig, useField } from '@payloadcms/ui'\nimport { formatAdminURL } from 'payload/shared'\nimport React from 'react'\n\nexport const LinkToDocClient: React.FC = () => {\n const { config } = useConfig()\n\n const {\n routes: {\n admin: adminRoute, // already includes leading slash\n },\n serverURL,\n } = config\n\n const { value } = useField<{ relationTo?: string; value?: string }>({ path: 'doc' })\n\n if (!value?.relationTo || !value?.value) {\n return null\n }\n\n const href = `${serverURL}${formatAdminURL({\n adminRoute,\n path: `/collections/${value.relationTo || ''}/${value.value || ''}`,\n serverURL,\n })}`\n\n const hrefToDisplay = `${process.env.NEXT_BASE_PATH || ''}${href}`\n\n return (\n <div style={{ marginBottom: 'var(--spacing-field, 1rem)' }}>\n <div>\n <span\n className=\"label\"\n style={{\n color: '#9A9A9A',\n }}\n >\n Doc URL\n </span>\n <CopyToClipboard value={hrefToDisplay} />\n </div>\n <div\n style={{\n fontWeight: '600',\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n }}\n >\n <Link href={href} passHref {...{ rel: 'noopener noreferrer', target: '_blank' }}>\n {hrefToDisplay}\n </Link>\n </div>\n </div>\n )\n}\n"],"names":["CopyToClipboard","Link","useConfig","useField","formatAdminURL","React","LinkToDocClient","config","routes","admin","adminRoute","serverURL","value","path","relationTo","href","hrefToDisplay","process","env","NEXT_BASE_PATH","div","style","marginBottom","span","className","color","fontWeight","overflow","textOverflow","passHref","rel","target"],"mappings":"AAAA;;AAEA,SAASA,eAAe,EAAEC,IAAI,EAAEC,SAAS,EAAEC,QAAQ,QAAQ,iBAAgB;AAC3E,SAASC,cAAc,QAAQ,iBAAgB;AAC/C,OAAOC,WAAW,QAAO;AAEzB,OAAO,MAAMC,kBAA4B;IACvC,MAAM,EAAEC,MAAM,EAAE,GAAGL;IAEnB,MAAM,EACJM,QAAQ,EACNC,OAAOC,UAAU,EAClB,EACDC,SAAS,EACV,GAAGJ;IAEJ,MAAM,EAAEK,KAAK,EAAE,GAAGT,SAAkD;QAAEU,MAAM;IAAM;IAElF,IAAI,CAACD,OAAOE,cAAc,CAACF,OAAOA,OAAO;QACvC,OAAO;IACT;IAEA,MAAMG,OAAO,GAAGJ,YAAYP,eAAe;QACzCM;QACAG,MAAM,CAAC,aAAa,EAAED,MAAME,UAAU,IAAI,GAAG,CAAC,EAAEF,MAAMA,KAAK,IAAI,IAAI;QACnED;IACF,IAAI;IAEJ,MAAMK,gBAAgB,GAAGC,QAAQC,GAAG,CAACC,cAAc,IAAI,KAAKJ,MAAM;IAElE,qBACE,MAACK;QAAIC,OAAO;YAAEC,cAAc;QAA6B;;0BACvD,MAACF;;kCACC,KAACG;wBACCC,WAAU;wBACVH,OAAO;4BACLI,OAAO;wBACT;kCACD;;kCAGD,KAACzB;wBAAgBY,OAAOI;;;;0BAE1B,KAACI;gBACCC,OAAO;oBACLK,YAAY;oBACZC,UAAU;oBACVC,cAAc;gBAChB;0BAEA,cAAA,KAAC3B;oBAAKc,MAAMA;oBAAMc,QAAQ;oBAAOC,KAAK;oBAAuBC,QAAQ;8BAClEf;;;;;AAKX,EAAC"}
1
+ {"version":3,"sources":["../../../../src/Search/ui/LinkToDoc/index.client.tsx"],"sourcesContent":["'use client'\n\nimport { CopyToClipboard, Link, useConfig, useField } from '@payloadcms/ui'\nimport { formatAdminURL } from 'payload/shared'\nimport React from 'react'\n\nexport const LinkToDocClient: React.FC = () => {\n const { config } = useConfig()\n\n const {\n routes: {\n admin: adminRoute, // already includes leading slash\n },\n serverURL,\n } = config\n\n const { value } = useField<{ relationTo?: string; value?: string }>({ path: 'doc' })\n\n if (!value?.relationTo || !value?.value) {\n return null\n }\n\n const href = formatAdminURL({\n adminRoute,\n path: `/collections/${value.relationTo || ''}/${value.value || ''}`,\n serverURL,\n })\n\n return (\n <div style={{ marginBottom: 'var(--spacing-field, 1rem)' }}>\n <div>\n <span\n className=\"label\"\n style={{\n color: '#9A9A9A',\n }}\n >\n Doc URL\n </span>\n <CopyToClipboard value={href} />\n </div>\n <div\n style={{\n fontWeight: '600',\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n }}\n >\n <Link href={href} passHref {...{ rel: 'noopener noreferrer', target: '_blank' }}>\n {href}\n </Link>\n </div>\n </div>\n )\n}\n"],"names":["CopyToClipboard","Link","useConfig","useField","formatAdminURL","React","LinkToDocClient","config","routes","admin","adminRoute","serverURL","value","path","relationTo","href","div","style","marginBottom","span","className","color","fontWeight","overflow","textOverflow","passHref","rel","target"],"mappings":"AAAA;;AAEA,SAASA,eAAe,EAAEC,IAAI,EAAEC,SAAS,EAAEC,QAAQ,QAAQ,iBAAgB;AAC3E,SAASC,cAAc,QAAQ,iBAAgB;AAC/C,OAAOC,WAAW,QAAO;AAEzB,OAAO,MAAMC,kBAA4B;IACvC,MAAM,EAAEC,MAAM,EAAE,GAAGL;IAEnB,MAAM,EACJM,QAAQ,EACNC,OAAOC,UAAU,EAClB,EACDC,SAAS,EACV,GAAGJ;IAEJ,MAAM,EAAEK,KAAK,EAAE,GAAGT,SAAkD;QAAEU,MAAM;IAAM;IAElF,IAAI,CAACD,OAAOE,cAAc,CAACF,OAAOA,OAAO;QACvC,OAAO;IACT;IAEA,MAAMG,OAAOX,eAAe;QAC1BM;QACAG,MAAM,CAAC,aAAa,EAAED,MAAME,UAAU,IAAI,GAAG,CAAC,EAAEF,MAAMA,KAAK,IAAI,IAAI;QACnED;IACF;IAEA,qBACE,MAACK;QAAIC,OAAO;YAAEC,cAAc;QAA6B;;0BACvD,MAACF;;kCACC,KAACG;wBACCC,WAAU;wBACVH,OAAO;4BACLI,OAAO;wBACT;kCACD;;kCAGD,KAACrB;wBAAgBY,OAAOG;;;;0BAE1B,KAACC;gBACCC,OAAO;oBACLK,YAAY;oBACZC,UAAU;oBACVC,cAAc;gBAChB;0BAEA,cAAA,KAACvB;oBAAKc,MAAMA;oBAAMU,QAAQ;oBAAOC,KAAK;oBAAuBC,QAAQ;8BAClEZ;;;;;AAKX,EAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.client.d.ts","sourceRoot":"","sources":["../../../../src/Search/ui/ReindexButton/index.client.tsx"],"names":[],"mappings":"AAaA,OAAO,KAAyC,MAAM,OAAO,CAAA;AAE7D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAA;AAMpD,eAAO,MAAM,mBAAmB,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,CA+H5D,CAAA"}
1
+ {"version":3,"file":"index.client.d.ts","sourceRoot":"","sources":["../../../../src/Search/ui/ReindexButton/index.client.tsx"],"names":[],"mappings":"AAcA,OAAO,KAAyC,MAAM,OAAO,CAAA;AAE7D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAA;AAMpD,eAAO,MAAM,mBAAmB,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,CAqI5D,CAAA"}
@@ -2,6 +2,7 @@
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  import { ConfirmationModal, Popup, PopupList, toast, useConfig, useLocale, useModal, useTranslation } from '@payloadcms/ui';
4
4
  import { useRouter } from 'next/navigation.js';
5
+ import { formatAdminURL } from 'payload/shared';
5
6
  import React, { useCallback, useMemo, useState } from 'react';
6
7
  import { ReindexButtonLabel } from './ReindexButtonLabel/index.js';
7
8
  const confirmReindexModalSlug = 'confirm-reindex-modal';
@@ -20,7 +21,10 @@ export const ReindexButtonClient = ({ collectionLabels, searchCollections, searc
20
21
  return;
21
22
  }
22
23
  try {
23
- const res = await fetch(`${config.routes.api}/${searchSlug}/reindex?locale=${locale.code}`, {
24
+ const res = await fetch(formatAdminURL({
25
+ apiRoute: config.routes.api,
26
+ path: `/${searchSlug}/reindex?locale=${locale.code}`
27
+ }), {
24
28
  body: JSON.stringify({
25
29
  collections: reindexCollections
26
30
  }),
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/Search/ui/ReindexButton/index.client.tsx"],"sourcesContent":["'use client'\n\nimport {\n ConfirmationModal,\n Popup,\n PopupList,\n toast,\n useConfig,\n useLocale,\n useModal,\n useTranslation,\n} from '@payloadcms/ui'\nimport { useRouter } from 'next/navigation.js'\nimport React, { useCallback, useMemo, useState } from 'react'\n\nimport type { ReindexButtonProps } from './types.js'\n\nimport { ReindexButtonLabel } from './ReindexButtonLabel/index.js'\n\nconst confirmReindexModalSlug = 'confirm-reindex-modal'\n\nexport const ReindexButtonClient: React.FC<ReindexButtonProps> = ({\n collectionLabels,\n searchCollections,\n searchSlug,\n}) => {\n const { openModal } = useModal()\n\n const { config } = useConfig()\n\n const {\n i18n: { t },\n } = useTranslation()\n\n const locale = useLocale()\n const router = useRouter()\n\n const [reindexCollections, setReindexCollections] = useState<string[]>([])\n\n const openConfirmModal = useCallback(() => openModal(confirmReindexModalSlug), [openModal])\n\n const handleReindexSubmit = useCallback(async () => {\n if (!reindexCollections.length) {\n return\n }\n\n try {\n const res = await fetch(`${config.routes.api}/${searchSlug}/reindex?locale=${locale.code}`, {\n body: JSON.stringify({\n collections: reindexCollections,\n }),\n method: 'POST',\n })\n\n const { message } = (await res.json()) as { message: string }\n\n if (!res.ok) {\n toast.error(message)\n } else {\n toast.success(message)\n return router.refresh()\n }\n } catch (_err: unknown) {\n // swallow error, toast shown above\n } finally {\n setReindexCollections([])\n }\n }, [reindexCollections, router, searchSlug, locale, config])\n\n const handleShowConfirmModal = useCallback(\n (collections: string | string[] = searchCollections) => {\n setReindexCollections(typeof collections === 'string' ? [collections] : collections)\n openConfirmModal()\n },\n [openConfirmModal, searchCollections],\n )\n\n const handlePopupButtonClick = useCallback(\n (closePopup: () => void, slug?: string) => {\n closePopup()\n handleShowConfirmModal(slug)\n },\n [handleShowConfirmModal],\n )\n\n const getPluralizedLabel = useCallback(\n (slug: string) => {\n const label = collectionLabels[slug]\n if (typeof label === 'string') {\n return label\n } else {\n return label && Object.hasOwn(label, locale.code) ? label[locale.code] : slug\n }\n },\n [collectionLabels, locale.code],\n )\n\n const pluralizedLabels = useMemo(() => {\n return searchCollections.reduce<Record<string, string>>((acc, slug) => {\n const label = getPluralizedLabel(slug)\n if (label) {\n acc[slug] = label\n }\n return acc\n }, {})\n }, [searchCollections, getPluralizedLabel])\n\n const selectedAll = reindexCollections.length === searchCollections.length\n const selectedLabels = reindexCollections.map((slug) => pluralizedLabels[slug]).join(', ')\n\n const modalTitle = selectedAll\n ? t('general:confirmReindexAll')\n : t('general:confirmReindex', { collections: selectedLabels })\n const modalDescription = selectedAll\n ? t('general:confirmReindexDescriptionAll')\n : t('general:confirmReindexDescription', { collections: selectedLabels })\n\n return (\n <div>\n <Popup\n button={<ReindexButtonLabel />}\n render={({ close }) => (\n <PopupList.ButtonGroup>\n {searchCollections.map((collectionSlug) => (\n <PopupList.Button\n key={collectionSlug}\n onClick={() => handlePopupButtonClick(close, collectionSlug)}\n >\n {pluralizedLabels[collectionSlug]}\n </PopupList.Button>\n ))}\n <PopupList.Button onClick={() => handlePopupButtonClick(close)}>\n {t('general:allCollections')}\n </PopupList.Button>\n </PopupList.ButtonGroup>\n )}\n showScrollbar\n size=\"large\"\n verticalAlign=\"bottom\"\n />\n <ConfirmationModal\n body={modalDescription}\n heading={modalTitle}\n modalSlug={confirmReindexModalSlug}\n onConfirm={handleReindexSubmit}\n />\n </div>\n )\n}\n"],"names":["ConfirmationModal","Popup","PopupList","toast","useConfig","useLocale","useModal","useTranslation","useRouter","React","useCallback","useMemo","useState","ReindexButtonLabel","confirmReindexModalSlug","ReindexButtonClient","collectionLabels","searchCollections","searchSlug","openModal","config","i18n","t","locale","router","reindexCollections","setReindexCollections","openConfirmModal","handleReindexSubmit","length","res","fetch","routes","api","code","body","JSON","stringify","collections","method","message","json","ok","error","success","refresh","_err","handleShowConfirmModal","handlePopupButtonClick","closePopup","slug","getPluralizedLabel","label","Object","hasOwn","pluralizedLabels","reduce","acc","selectedAll","selectedLabels","map","join","modalTitle","modalDescription","div","button","render","close","ButtonGroup","collectionSlug","Button","onClick","showScrollbar","size","verticalAlign","heading","modalSlug","onConf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/D;gBACCgE,sBAAQ,KAACpD;gBACTqD,QAAQ,CAAC,EAAEC,KAAK,EAAE,iBAChB,MAACjE,UAAUkE,WAAW;;4BACnBnD,kBAAkB2C,GAAG,CAAC,CAACS,+BACtB,KAACnE,UAAUoE,MAAM;oCAEfC,SAAS,IAAMvB,uBAAuBmB,OAAOE;8CAE5Cd,gBAAgB,CAACc,eAAe;mCAH5BA;0CAMT,KAACnE,UAAUoE,MAAM;gCAACC,SAAS,IAAMvB,uBAAuBmB;0CACrD7C,EAAE;;;;gBAITkD,aAAa;gBACbC,MAAK;gBACLC,eAAc;;0BAEhB,KAAC1E;gBACCmC,MAAM4B;gBACNY,SAASb;gBACTc,WAAW9D;gBACX+D,WAAWjD;;;;AAInB,EAAC"}
1
+ {"version":3,"sources":["../../../../src/Search/ui/ReindexButton/index.client.tsx"],"sourcesContent":["'use client'\n\nimport {\n ConfirmationModal,\n Popup,\n PopupList,\n toast,\n useConfig,\n useLocale,\n useModal,\n useTranslation,\n} from '@payloadcms/ui'\nimport { useRouter } from 'next/navigation.js'\nimport { formatAdminURL } from 'payload/shared'\nimport React, { useCallback, useMemo, useState } from 'react'\n\nimport type { ReindexButtonProps } from './types.js'\n\nimport { ReindexButtonLabel } from './ReindexButtonLabel/index.js'\n\nconst confirmReindexModalSlug = 'confirm-reindex-modal'\n\nexport const ReindexButtonClient: React.FC<ReindexButtonProps> = ({\n collectionLabels,\n searchCollections,\n searchSlug,\n}) => {\n const { openModal } = useModal()\n\n const { config } = useConfig()\n\n const {\n i18n: { t },\n } = useTranslation()\n\n const locale = useLocale()\n const router = useRouter()\n\n const [reindexCollections, setReindexCollections] = useState<string[]>([])\n\n const openConfirmModal = useCallback(() => openModal(confirmReindexModalSlug), [openModal])\n\n const handleReindexSubmit = useCallback(async () => {\n if (!reindexCollections.length) {\n return\n }\n\n try {\n const res = await fetch(\n formatAdminURL({\n apiRoute: config.routes.api,\n path: `/${searchSlug}/reindex?locale=${locale.code}`,\n }),\n {\n body: JSON.stringify({\n collections: reindexCollections,\n }),\n method: 'POST',\n },\n )\n\n const { message } = (await res.json()) as { message: string }\n\n if (!res.ok) {\n toast.error(message)\n } else {\n toast.success(message)\n return router.refresh()\n }\n } catch (_err: unknown) {\n // swallow error, toast shown above\n } finally {\n setReindexCollections([])\n }\n }, [reindexCollections, router, searchSlug, locale, config])\n\n const handleShowConfirmModal = useCallback(\n (collections: string | string[] = searchCollections) => {\n setReindexCollections(typeof collections === 'string' ? [collections] : collections)\n openConfirmModal()\n },\n [openConfirmModal, searchCollections],\n )\n\n const handlePopupButtonClick = useCallback(\n (closePopup: () => void, slug?: string) => {\n closePopup()\n handleShowConfirmModal(slug)\n },\n [handleShowConfirmModal],\n )\n\n const getPluralizedLabel = useCallback(\n (slug: string) => {\n const label = collectionLabels[slug]\n if (typeof label === 'string') {\n return label\n } else {\n return label && Object.hasOwn(label, locale.code) ? label[locale.code] : slug\n }\n },\n [collectionLabels, locale.code],\n )\n\n const pluralizedLabels = useMemo(() => {\n return searchCollections.reduce<Record<string, string>>((acc, slug) => {\n const label = getPluralizedLabel(slug)\n if (label) {\n acc[slug] = label\n }\n return acc\n }, {})\n }, [searchCollections, getPluralizedLabel])\n\n const selectedAll = reindexCollections.length === searchCollections.length\n const selectedLabels = reindexCollections.map((slug) => pluralizedLabels[slug]).join(', ')\n\n const modalTitle = selectedAll\n ? t('general:confirmReindexAll')\n : t('general:confirmReindex', { collections: selectedLabels })\n const modalDescription = selectedAll\n ? t('general:confirmReindexDescriptionAll')\n : t('general:confirmReindexDescription', { collections: selectedLabels })\n\n return (\n <div>\n <Popup\n button={<ReindexButtonLabel />}\n render={({ close }) => (\n <PopupList.ButtonGroup>\n {searchCollections.map((collectionSlug) => (\n <PopupList.Button\n key={collectionSlug}\n onClick={() => handlePopupButtonClick(close, collectionSlug)}\n >\n {pluralizedLabels[collectionSlug]}\n </PopupList.Button>\n ))}\n <PopupList.Button onClick={() => handlePopupButtonClick(close)}>\n {t('general:allCollections')}\n </PopupList.Button>\n </PopupList.ButtonGroup>\n )}\n showScrollbar\n size=\"large\"\n verticalAlign=\"bottom\"\n />\n <ConfirmationModal\n body={modalDescription}\n heading={modalTitle}\n modalSlug={confirmReindexModalSlug}\n onConfirm={handleReindexSubmit}\n />\n </div>\n )\n}\n"],"names":["ConfirmationModal","Popup","PopupList","toast","useConfig","useLocale","useModal","useTranslation","useRouter","formatAdminURL","React","useCallback","useMemo","useState","ReindexButtonLabel","confirmReindexModalSlug","ReindexButtonClient","collectionLabels","searchCollections","searchSlug","openModal","config","i18n","t","locale","router","reindexCollections","setReindexCollections","openConfirmModal","handleReindexSubmit","length","res","fetch","apiRoute","routes","api","path","code","body","JSON","stringify","collections","method","message","json","ok","error","success","refresh","_err","handleShowConfirmModal","handlePopupButtonClick","closePopup","slug","getPluralizedLabel","label","Object","hasOwn","pluralizedLabels","reduce","acc","selectedAll","selectedLabels","map","join","modalTitle","modalDescription","div","button","render","close","ButtonGroup","collectionSlug","Button","onClick","showScrollbar","size","verticalAlign","heading","modalSlug","onConfirm"],"mappings":"AAAA;;AAEA,SACEA,iBAAiB,EACjBC,KAAK,EACLC,SAAS,EACTC,KAAK,EACLC,SAAS,EACTC,SAAS,EACTC,QAAQ,EACRC,cAAc,QACT,iBAAgB;AACvB,SAASC,SAAS,QAAQ,qBAAoB;AAC9C,SAASC,cAAc,QAAQ,iBAAgB;AAC/C,OAAOC,SAASC,WAAW,EAAEC,OAAO,EAAEC,QAAQ,QAAQ,QAAO;AAI7D,SAASC,kBAAkB,QAAQ,gCAA+B;AAElE,MAAMC,0BAA0B;AAEhC,OAAO,MAAMC,sBAAoD,CAAC,EAChEC,gBAAgB,EAChBC,iBAAiB,EACjBC,UAAU,EACX;IACC,MAAM,EAAEC,SAAS,EAAE,GAAGd;IAEtB,MAAM,EAAEe,MAAM,EAAE,GAAGjB;IAEnB,MAAM,EACJkB,MAAM,EAAEC,CAAC,EAAE,EACZ,GAAGhB;IAEJ,MAAMiB,SAASnB;IACf,MAAMo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"name": "@payloadcms/plugin-search",
3
- "version": "3.69.0-internal.5029b68",
3
+ "version": "3.70.0-canary.0",
4
4
  "description": "Search plugin for Payload",
5
5
  "keywords": [
6
6
  "payload",
@@ -50,19 +50,19 @@
50
50
  "dist"
51
51
  ],
52
52
  "dependencies": {
53
- "@payloadcms/next": "3.69.0-internal.5029b68",
54
- "@payloadcms/ui": "3.69.0-internal.5029b68"
53
+ "@payloadcms/next": "3.70.0-canary.0",
54
+ "@payloadcms/ui": "3.70.0-canary.0"
55
55
  },
56
56
  "devDependencies": {
57
57
  "@types/react": "19.2.1",
58
58
  "@types/react-dom": "19.2.1",
59
- "@payloadcms/eslint-config": "3.28.0",
60
- "payload": "3.69.0-internal.5029b68"
59
+ "payload": "3.70.0-canary.0",
60
+ "@payloadcms/eslint-config": "3.28.0"
61
61
  },
62
62
  "peerDependencies": {
63
63
  "react": "^19.0.1 || ^19.1.2 || ^19.2.1",
64
64
  "react-dom": "^19.0.1 || ^19.1.2 || ^19.2.1",
65
- "payload": "3.69.0-internal.5029b68"
65
+ "payload": "3.70.0-canary.0"
66
66
  },
67
67
  "publishConfig": {
68
68
  "registry": "https://registry.npmjs.org/"