@payloadcms/next 3.0.0-beta.126 → 3.0.0-beta.127
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/utilities/initPage/handleAuthRedirect.js +2 -2
- package/dist/utilities/initPage/handleAuthRedirect.js.map +1 -1
- package/dist/views/Login/index.js +1 -1
- package/dist/views/Login/index.js.map +1 -1
- package/dist/views/Logout/LogoutClient.d.ts.map +1 -1
- package/dist/views/Logout/LogoutClient.js +5 -4
- package/dist/views/Logout/LogoutClient.js.map +1 -1
- package/package.json +6 -6
|
@@ -20,9 +20,9 @@ export const handleAuthRedirect = ({
|
|
|
20
20
|
if (searchParams && 'redirect' in searchParams) {
|
|
21
21
|
delete searchParams.redirect;
|
|
22
22
|
}
|
|
23
|
-
const redirectRoute =
|
|
23
|
+
const redirectRoute = (route !== adminRoute ? route : '') + (Object.keys(searchParams ?? {}).length > 0 ? `${qs.stringify(searchParams, {
|
|
24
24
|
addQueryPrefix: true
|
|
25
|
-
})}` :
|
|
25
|
+
})}` : '');
|
|
26
26
|
const redirectTo = formatAdminURL({
|
|
27
27
|
adminRoute,
|
|
28
28
|
path: user ? unauthorizedRoute : loginRouteFromConfig
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handleAuthRedirect.js","names":["formatAdminURL","qs","handleAuthRedirect","config","route","searchParams","user","admin","routes","login","loginRouteFromConfig","unauthorized","unauthorizedRoute","adminRoute","redirect","redirectRoute","
|
|
1
|
+
{"version":3,"file":"handleAuthRedirect.js","names":["formatAdminURL","qs","handleAuthRedirect","config","route","searchParams","user","admin","routes","login","loginRouteFromConfig","unauthorized","unauthorizedRoute","adminRoute","redirect","redirectRoute","Object","keys","length","stringify","addQueryPrefix","redirectTo","path","parsedLoginRouteSearchParams","parse","split","searchParamsWithRedirect"],"sources":["../../../src/utilities/initPage/handleAuthRedirect.ts"],"sourcesContent":["import type { User } from 'payload'\n\nimport { formatAdminURL } from '@payloadcms/ui/shared'\nimport * as qs from 'qs-esm'\n\ntype Args = {\n config\n route: string\n searchParams: { [key: string]: string | string[] }\n user?: User\n}\nexport const handleAuthRedirect = ({ config, route, searchParams, user }: Args): string => {\n const {\n admin: {\n routes: { login: loginRouteFromConfig, unauthorized: unauthorizedRoute },\n },\n routes: { admin: adminRoute },\n } = config\n\n if (searchParams && 'redirect' in searchParams) {\n delete searchParams.redirect\n }\n\n const redirectRoute =\n (route !== adminRoute ? route : '') +\n (Object.keys(searchParams ?? {}).length > 0\n ? `${qs.stringify(searchParams, { addQueryPrefix: true })}`\n : '')\n\n const redirectTo = formatAdminURL({\n adminRoute,\n path: user ? unauthorizedRoute : loginRouteFromConfig,\n })\n\n const parsedLoginRouteSearchParams = qs.parse(redirectTo.split('?')[1] ?? '')\n\n const searchParamsWithRedirect = `${qs.stringify(\n {\n ...parsedLoginRouteSearchParams,\n ...(redirectRoute ? { redirect: redirectRoute } : {}),\n },\n { addQueryPrefix: true },\n )}`\n\n return `${redirectTo.split('?')[0]}${searchParamsWithRedirect}`\n}\n"],"mappings":"AAEA,SAASA,cAAc,QAAQ;AAC/B,YAAYC,EAAA,MAAQ;AAQpB,OAAO,MAAMC,kBAAA,GAAqBA,CAAC;EAAEC,MAAM;EAAEC,KAAK;EAAEC,YAAY;EAAEC;AAAI,CAAQ;EAC5E,MAAM;IACJC,KAAA,EAAO;MACLC,MAAA,EAAQ;QAAEC,KAAA,EAAOC,oBAAoB;QAAEC,YAAA,EAAcC;MAAiB;IAAE,CACzE;IACDJ,MAAA,EAAQ;MAAED,KAAA,EAAOM;IAAU;EAAE,CAC9B,GAAGV,MAAA;EAEJ,IAAIE,YAAA,IAAgB,cAAcA,YAAA,EAAc;IAC9C,OAAOA,YAAA,CAAaS,QAAQ;EAC9B;EAEA,MAAMC,aAAA,GACJ,CAACX,KAAA,KAAUS,UAAA,GAAaT,KAAA,GAAQ,EAAC,KAChCY,MAAA,CAAOC,IAAI,CAACZ,YAAA,IAAgB,CAAC,GAAGa,MAAM,GAAG,IACtC,GAAGjB,EAAA,CAAGkB,SAAS,CAACd,YAAA,EAAc;IAAEe,cAAA,EAAgB;EAAK,IAAI,GACzD,EAAC;EAEP,MAAMC,UAAA,GAAarB,cAAA,CAAe;IAChCa,UAAA;IACAS,IAAA,EAAMhB,IAAA,GAAOM,iBAAA,GAAoBF;EACnC;EAEA,MAAMa,4BAAA,GAA+BtB,EAAA,CAAGuB,KAAK,CAACH,UAAA,CAAWI,KAAK,CAAC,IAAI,CAAC,EAAE,IAAI;EAE1E,MAAMC,wBAAA,GAA2B,GAAGzB,EAAA,CAAGkB,SAAS,CAC9C;IACE,GAAGI,4BAA4B;IAC/B,IAAIR,aAAA,GAAgB;MAAED,QAAA,EAAUC;IAAc,IAAI,CAAC,CAAC;EACtD,GACA;IAAEK,cAAA,EAAgB;EAAK,IACtB;EAEH,OAAO,GAAGC,UAAA,CAAWI,KAAK,CAAC,IAAI,CAAC,EAAE,GAAGC,wBAAA,EAA0B;AACjE","ignoreList":[]}
|
|
@@ -52,7 +52,7 @@ export const LoginView = ({
|
|
|
52
52
|
const mappedBeforeLogins = createMappedComponent(beforeLogin, undefined, undefined, 'beforeLogin');
|
|
53
53
|
const mappedAfterLogins = createMappedComponent(afterLogin, undefined, undefined, 'afterLogin');
|
|
54
54
|
if (user) {
|
|
55
|
-
redirect(admin);
|
|
55
|
+
redirect(searchParams.redirect || admin);
|
|
56
56
|
}
|
|
57
57
|
const collectionConfig = collections.find(({
|
|
58
58
|
slug
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["getCreateMappedComponent","RenderComponent","redirect","React","Fragment","Logo","LoginForm","generateLoginMetadata","loginBaseClass","LoginView","initPageResult","params","searchParams","locale","permissions","req","i18n","payload","config","user","admin","components","afterLogin","beforeLogin","userSlug","collections","routes","createMappedComponent","importMap","serverProps","mappedBeforeLogins","undefined","mappedAfterLogins","collectionConfig","find","slug","prefillAutoLogin","autoLogin","prefillOnly","prefillUsername","username","prefillEmail","email","prefillPassword","password","_jsxs","_jsx","className","mappedComponent","auth","disableLocalStrategy"],"sources":["../../../src/views/Login/index.tsx"],"sourcesContent":["import type { AdminViewProps } from 'payload'\n\nimport { getCreateMappedComponent, RenderComponent } from '@payloadcms/ui/shared'\nimport { redirect } from 'next/navigation.js'\nimport React, { Fragment } from 'react'\n\nimport { Logo } from '../../elements/Logo/index.js'\nimport './index.scss'\nimport { LoginForm } from './LoginForm/index.js'\n\nexport { generateLoginMetadata } from './meta.js'\n\nexport const loginBaseClass = 'login'\n\nexport const LoginView: React.FC<AdminViewProps> = ({ initPageResult, params, searchParams }) => {\n const { locale, permissions, req } = initPageResult\n\n const {\n i18n,\n payload: { config },\n payload,\n user,\n } = req\n\n const {\n admin: { components: { afterLogin, beforeLogin } = {}, user: userSlug },\n collections,\n routes: { admin },\n } = config\n\n const createMappedComponent = getCreateMappedComponent({\n importMap: payload.importMap,\n serverProps: {\n i18n,\n locale,\n params,\n payload,\n permissions,\n searchParams,\n user,\n },\n })\n\n const mappedBeforeLogins = createMappedComponent(beforeLogin, undefined, undefined, 'beforeLogin')\n\n const mappedAfterLogins = createMappedComponent(afterLogin, undefined, undefined, 'afterLogin')\n\n if (user) {\n redirect(admin)\n }\n\n const collectionConfig = collections.find(({ slug }) => slug === userSlug)\n\n const prefillAutoLogin =\n typeof config.admin?.autoLogin === 'object' && config.admin?.autoLogin.prefillOnly\n\n const prefillUsername =\n prefillAutoLogin && typeof config.admin?.autoLogin === 'object'\n ? config.admin?.autoLogin.username\n : undefined\n\n const prefillEmail =\n prefillAutoLogin && typeof config.admin?.autoLogin === 'object'\n ? config.admin?.autoLogin.email\n : undefined\n\n const prefillPassword =\n prefillAutoLogin && typeof config.admin?.autoLogin === 'object'\n ? config.admin?.autoLogin.password\n : undefined\n\n return (\n <Fragment>\n <div className={`${loginBaseClass}__brand`}>\n <Logo\n i18n={i18n}\n locale={locale}\n params={params}\n payload={payload}\n permissions={permissions}\n searchParams={searchParams}\n user={user}\n />\n </div>\n <RenderComponent mappedComponent={mappedBeforeLogins} />\n {!collectionConfig?.auth?.disableLocalStrategy && (\n <LoginForm\n prefillEmail={prefillEmail}\n prefillPassword={prefillPassword}\n prefillUsername={prefillUsername}\n searchParams={searchParams}\n />\n )}\n <RenderComponent mappedComponent={mappedAfterLogins} />\n </Fragment>\n )\n}\n"],"mappings":";AAEA,SAASA,wBAAwB,EAAEC,eAAe,QAAQ;AAC1D,SAASC,QAAQ,QAAQ;AACzB,OAAOC,KAAA,IAASC,QAAQ,QAAQ;AAEhC,SAASC,IAAI,QAAQ;AAErB,SAASC,SAAS,QAAQ;AAE1B,SAASC,qBAAqB,QAAQ;AAEtC,OAAO,MAAMC,cAAA,GAAiB;AAE9B,OAAO,MAAMC,SAAA,GAAsCA,CAAC;EAAEC,cAAc;EAAEC,MAAM;EAAEC;AAAY,CAAE;EAC1F,MAAM;IAAEC,MAAM;IAAEC,WAAW;IAAEC;EAAG,CAAE,GAAGL,cAAA;EAErC,MAAM;IACJM,IAAI;IACJC,OAAA,EAAS;MAAEC;IAAM,CAAE;IACnBD,OAAO;IACPE;EAAI,CACL,GAAGJ,GAAA;EAEJ,MAAM;IACJK,KAAA,EAAO;MAAEC,UAAA,EAAY;QAAEC,UAAU;QAAEC;MAAW,CAAE,GAAG,CAAC,CAAC;MAAEJ,IAAA,EAAMK;IAAQ,CAAE;IACvEC,WAAW;IACXC,MAAA,EAAQ;MAAEN;IAAK;EAAE,CAClB,GAAGF,MAAA;EAEJ,MAAMS,qBAAA,GAAwB3B,wBAAA,CAAyB;IACrD4B,SAAA,EAAWX,OAAA,CAAQW,SAAS;IAC5BC,WAAA,EAAa;MACXb,IAAA;MACAH,MAAA;MACAF,MAAA;MACAM,OAAA;MACAH,WAAA;MACAF,YAAA;MACAO;IACF;EACF;EAEA,MAAMW,kBAAA,GAAqBH,qBAAA,CAAsBJ,WAAA,EAAaQ,SAAA,EAAWA,SAAA,EAAW;EAEpF,MAAMC,iBAAA,GAAoBL,qBAAA,CAAsBL,UAAA,EAAYS,SAAA,EAAWA,SAAA,EAAW;EAElF,IAAIZ,IAAA,EAAM;IACRjB,QAAA,
|
|
1
|
+
{"version":3,"file":"index.js","names":["getCreateMappedComponent","RenderComponent","redirect","React","Fragment","Logo","LoginForm","generateLoginMetadata","loginBaseClass","LoginView","initPageResult","params","searchParams","locale","permissions","req","i18n","payload","config","user","admin","components","afterLogin","beforeLogin","userSlug","collections","routes","createMappedComponent","importMap","serverProps","mappedBeforeLogins","undefined","mappedAfterLogins","collectionConfig","find","slug","prefillAutoLogin","autoLogin","prefillOnly","prefillUsername","username","prefillEmail","email","prefillPassword","password","_jsxs","_jsx","className","mappedComponent","auth","disableLocalStrategy"],"sources":["../../../src/views/Login/index.tsx"],"sourcesContent":["import type { AdminViewProps } from 'payload'\n\nimport { getCreateMappedComponent, RenderComponent } from '@payloadcms/ui/shared'\nimport { redirect } from 'next/navigation.js'\nimport React, { Fragment } from 'react'\n\nimport { Logo } from '../../elements/Logo/index.js'\nimport './index.scss'\nimport { LoginForm } from './LoginForm/index.js'\n\nexport { generateLoginMetadata } from './meta.js'\n\nexport const loginBaseClass = 'login'\n\nexport const LoginView: React.FC<AdminViewProps> = ({ initPageResult, params, searchParams }) => {\n const { locale, permissions, req } = initPageResult\n\n const {\n i18n,\n payload: { config },\n payload,\n user,\n } = req\n\n const {\n admin: { components: { afterLogin, beforeLogin } = {}, user: userSlug },\n collections,\n routes: { admin },\n } = config\n\n const createMappedComponent = getCreateMappedComponent({\n importMap: payload.importMap,\n serverProps: {\n i18n,\n locale,\n params,\n payload,\n permissions,\n searchParams,\n user,\n },\n })\n\n const mappedBeforeLogins = createMappedComponent(beforeLogin, undefined, undefined, 'beforeLogin')\n\n const mappedAfterLogins = createMappedComponent(afterLogin, undefined, undefined, 'afterLogin')\n\n if (user) {\n redirect((searchParams.redirect as string) || admin)\n }\n\n const collectionConfig = collections.find(({ slug }) => slug === userSlug)\n\n const prefillAutoLogin =\n typeof config.admin?.autoLogin === 'object' && config.admin?.autoLogin.prefillOnly\n\n const prefillUsername =\n prefillAutoLogin && typeof config.admin?.autoLogin === 'object'\n ? config.admin?.autoLogin.username\n : undefined\n\n const prefillEmail =\n prefillAutoLogin && typeof config.admin?.autoLogin === 'object'\n ? config.admin?.autoLogin.email\n : undefined\n\n const prefillPassword =\n prefillAutoLogin && typeof config.admin?.autoLogin === 'object'\n ? config.admin?.autoLogin.password\n : undefined\n\n return (\n <Fragment>\n <div className={`${loginBaseClass}__brand`}>\n <Logo\n i18n={i18n}\n locale={locale}\n params={params}\n payload={payload}\n permissions={permissions}\n searchParams={searchParams}\n user={user}\n />\n </div>\n <RenderComponent mappedComponent={mappedBeforeLogins} />\n {!collectionConfig?.auth?.disableLocalStrategy && (\n <LoginForm\n prefillEmail={prefillEmail}\n prefillPassword={prefillPassword}\n prefillUsername={prefillUsername}\n searchParams={searchParams}\n />\n )}\n <RenderComponent mappedComponent={mappedAfterLogins} />\n </Fragment>\n )\n}\n"],"mappings":";AAEA,SAASA,wBAAwB,EAAEC,eAAe,QAAQ;AAC1D,SAASC,QAAQ,QAAQ;AACzB,OAAOC,KAAA,IAASC,QAAQ,QAAQ;AAEhC,SAASC,IAAI,QAAQ;AAErB,SAASC,SAAS,QAAQ;AAE1B,SAASC,qBAAqB,QAAQ;AAEtC,OAAO,MAAMC,cAAA,GAAiB;AAE9B,OAAO,MAAMC,SAAA,GAAsCA,CAAC;EAAEC,cAAc;EAAEC,MAAM;EAAEC;AAAY,CAAE;EAC1F,MAAM;IAAEC,MAAM;IAAEC,WAAW;IAAEC;EAAG,CAAE,GAAGL,cAAA;EAErC,MAAM;IACJM,IAAI;IACJC,OAAA,EAAS;MAAEC;IAAM,CAAE;IACnBD,OAAO;IACPE;EAAI,CACL,GAAGJ,GAAA;EAEJ,MAAM;IACJK,KAAA,EAAO;MAAEC,UAAA,EAAY;QAAEC,UAAU;QAAEC;MAAW,CAAE,GAAG,CAAC,CAAC;MAAEJ,IAAA,E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,GACxBb,SAAA;EAEN,oBACEc,KAAA,CAACzC,QAAA;4BACC0C,IAAA,CAAC;MAAIC,SAAA,EAAW,GAAGvC,cAAA,SAAuB;gBACxC,aAAAsC,IAAA,CAACzC,IAAA;QACCW,IAAA,EAAMA,IAAA;QACNH,MAAA,EAAQA,MAAA;QACRF,MAAA,EAAQA,MAAA;QACRM,OAAA,EAASA,OAAA;QACTH,WAAA,EAAaA,WAAA;QACbF,YAAA,EAAcA,YAAA;QACdO,IAAA,EAAMA;;qBAGV2B,IAAA,CAAC7C,eAAA;MAAgB+C,eAAA,EAAiBlB;QACjC,CAACG,gBAAA,EAAkBgB,IAAA,EAAMC,oBAAA,iBACxBJ,IAAA,CAACxC,SAAA;MACCmC,YAAA,EAAcA,YAAA;MACdE,eAAA,EAAiBA,eAAA;MACjBJ,eAAA,EAAiBA,eAAA;MACjB3B,YAAA,EAAcA;qBAGlBkC,IAAA,CAAC7C,eAAA;MAAgB+C,eAAA,EAAiBhB;;;AAGxC","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LogoutClient.d.ts","sourceRoot":"","sources":["../../../src/views/Logout/LogoutClient.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAoB,MAAM,OAAO,CAAA;AAExC,OAAO,cAAc,CAAA;AAMrB,eAAO,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC;IAClC,UAAU,EAAE,MAAM,CAAA;IAClB,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,QAAQ,EAAE,MAAM,CAAA;CACjB,
|
|
1
|
+
{"version":3,"file":"LogoutClient.d.ts","sourceRoot":"","sources":["../../../src/views/Logout/LogoutClient.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAoB,MAAM,OAAO,CAAA;AAExC,OAAO,cAAc,CAAA;AAMrB,eAAO,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC;IAClC,UAAU,EAAE,MAAM,CAAA;IAClB,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,QAAQ,EAAE,MAAM,CAAA;CACjB,CAiDA,CAAA"}
|
|
@@ -16,7 +16,11 @@ export const LogoutClient = props => {
|
|
|
16
16
|
inactivity,
|
|
17
17
|
redirect
|
|
18
18
|
} = props;
|
|
19
|
-
const
|
|
19
|
+
const {
|
|
20
|
+
logOut,
|
|
21
|
+
user
|
|
22
|
+
} = useAuth();
|
|
23
|
+
const [isLoggedOut, setIsLoggedOut] = React.useState(!user);
|
|
20
24
|
const logOutSuccessRef = React.useRef(false);
|
|
21
25
|
let t0;
|
|
22
26
|
if ($[0] !== adminRoute || $[1] !== inactivity || $[2] !== redirect) {
|
|
@@ -32,9 +36,6 @@ export const LogoutClient = props => {
|
|
|
32
36
|
t0 = $[3];
|
|
33
37
|
}
|
|
34
38
|
const [loginRoute] = React.useState(t0);
|
|
35
|
-
const {
|
|
36
|
-
logOut
|
|
37
|
-
} = useAuth();
|
|
38
39
|
const {
|
|
39
40
|
t
|
|
40
41
|
} = useTranslation();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LogoutClient.js","names":["c","_c","Button","LoadingOverlay","toast","useAuth","useTranslation","formatAdminURL","LinkImport","useRouter","React","useEffect","baseClass","Link","default","LogoutClient","props","$","adminRoute","inactivity","redirect","isLoggedOut","setIsLoggedOut","useState","
|
|
1
|
+
{"version":3,"file":"LogoutClient.js","names":["c","_c","Button","LoadingOverlay","toast","useAuth","useTranslation","formatAdminURL","LinkImport","useRouter","React","useEffect","baseClass","Link","default","LogoutClient","props","$","adminRoute","inactivity","redirect","logOut","user","isLoggedOut","setIsLoggedOut","useState","logOutSuccessRef","useRef","t0","path","length","encodeURIComponent","loginRoute","t","router","t1","loggedOut","current","success","push","handleLogOut","t2","t3","t4","_jsxs","className","children","_jsx","buttonStyle","el","size","url","animationDuration","loadingText"],"sources":["../../../src/views/Logout/LogoutClient.tsx"],"sourcesContent":["'use client'\nimport { Button, LoadingOverlay, toast, useAuth, useTranslation } from '@payloadcms/ui'\nimport { formatAdminURL } from '@payloadcms/ui/shared'\nimport LinkImport from 'next/link.js'\nimport { useRouter } from 'next/navigation.js'\nimport React, { useEffect } from 'react'\n\nimport './index.scss'\n\nconst baseClass = 'logout'\n\nconst Link = (LinkImport.default || LinkImport) as unknown as typeof LinkImport.default\n\nexport const LogoutClient: React.FC<{\n adminRoute: string\n inactivity?: boolean\n redirect: string\n}> = (props) => {\n const { adminRoute, inactivity, redirect } = props\n\n const { logOut, user } = useAuth()\n const [isLoggedOut, setIsLoggedOut] = React.useState<boolean>(!user)\n const logOutSuccessRef = React.useRef(false)\n const [loginRoute] = React.useState(() =>\n formatAdminURL({\n adminRoute,\n path: `/login${\n inactivity && redirect && redirect.length > 0\n ? `?redirect=${encodeURIComponent(redirect)}`\n : ''\n }`,\n }),\n )\n\n const { t } = useTranslation()\n const router = useRouter()\n\n const handleLogOut = React.useCallback(async () => {\n const loggedOut = await logOut()\n setIsLoggedOut(loggedOut)\n if (!inactivity && loggedOut && !logOutSuccessRef.current) {\n toast.success(t('authentication:loggedOutSuccessfully'))\n logOutSuccessRef.current = true\n router.push(loginRoute)\n return\n }\n }, [inactivity, logOut, loginRoute, router, t])\n\n useEffect(() => {\n if (!isLoggedOut) {\n void handleLogOut()\n }\n }, [handleLogOut, isLoggedOut])\n\n if (isLoggedOut && inactivity) {\n return (\n <div className={`${baseClass}__wrap`}>\n <h2>{t('authentication:loggedOutInactivity')}</h2>\n <Button buttonStyle=\"secondary\" el=\"link\" Link={Link} size=\"large\" url={loginRoute}>\n {t('authentication:logBackIn')}\n </Button>\n </div>\n )\n }\n\n return <LoadingOverlay animationDuration={'0ms'} loadingText={t('authentication:loggingOut')} />\n}\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;;AACA,SAASC,MAAM,EAAEC,cAAc,EAAEC,KAAK,EAAEC,OAAO,EAAEC,cAAc,QAAQ;AACvE,SAASC,cAAc,QAAQ;AAC/B,OAAOC,UAAA,MAAgB;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A8C,WAAA,EAAoB;UAAAC,EAAA,EAAe;UAAApC,IAAA;UAAAqC,IAAA,EAAwB;UAAAC,GAAA,EAAanB,UAAA;UAAAc,QAAA,EACrEb,CAAA,CAAE;QAAA,C;;;;;;;;WAHPU,E;;;;IASGA,EAAA,GAAAI,IAAA,CAAA5C,cAAA;MAAAiD,iBAAA,EAAmC;MAAAC,WAAA,EAAoBpB,CAAA,CAAE;IAAA,C;;;;;;SAAzDU,E;CACT","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@payloadcms/next",
|
|
3
|
-
"version": "3.0.0-beta.
|
|
3
|
+
"version": "3.0.0-beta.127",
|
|
4
4
|
"homepage": "https://payloadcms.com",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -71,9 +71,9 @@
|
|
|
71
71
|
"sonner": "^1.5.0",
|
|
72
72
|
"uuid": "10.0.0",
|
|
73
73
|
"ws": "^8.16.0",
|
|
74
|
-
"@payloadcms/
|
|
75
|
-
"@payloadcms/
|
|
76
|
-
"@payloadcms/ui": "3.0.0-beta.
|
|
74
|
+
"@payloadcms/translations": "3.0.0-beta.127",
|
|
75
|
+
"@payloadcms/graphql": "3.0.0-beta.127",
|
|
76
|
+
"@payloadcms/ui": "3.0.0-beta.127"
|
|
77
77
|
},
|
|
78
78
|
"devDependencies": {
|
|
79
79
|
"@babel/cli": "^7.24.5",
|
|
@@ -93,12 +93,12 @@
|
|
|
93
93
|
"eslint-plugin-react-compiler": "0.0.0-experimental-7670337-20240918",
|
|
94
94
|
"swc-plugin-transform-remove-imports": "1.15.0",
|
|
95
95
|
"@payloadcms/eslint-config": "3.0.0-beta.112",
|
|
96
|
-
"payload": "3.0.0-beta.
|
|
96
|
+
"payload": "3.0.0-beta.127"
|
|
97
97
|
},
|
|
98
98
|
"peerDependencies": {
|
|
99
99
|
"graphql": "^16.8.1",
|
|
100
100
|
"next": "^15.0.0",
|
|
101
|
-
"payload": "3.0.0-beta.
|
|
101
|
+
"payload": "3.0.0-beta.127"
|
|
102
102
|
},
|
|
103
103
|
"engines": {
|
|
104
104
|
"node": "^18.20.2 || >=20.9.0"
|