@payloadcms/next 3.81.0-internal.181753b → 3.81.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":"isCustomAdminView.d.ts","sourceRoot":"","sources":["../../src/utilities/isCustomAdminView.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAI9C;;GAEG;AACH,eAAO,MAAM,iBAAiB,mCAI3B;IACD,UAAU,EAAE,MAAM,CAAA;IAClB,MAAM,EAAE,eAAe,CAAA;IACvB,KAAK,EAAE,MAAM,CAAA;CACd,KAAG,OAmBH,CAAA"}
1
+ {"version":3,"file":"isCustomAdminView.d.ts","sourceRoot":"","sources":["../../src/utilities/isCustomAdminView.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAI9C;;GAEG;AACH,eAAO,MAAM,iBAAiB,mCAI3B;IACD,UAAU,EAAE,MAAM,CAAA;IAClB,MAAM,EAAE,eAAe,CAAA;IACvB,KAAK,EAAE,MAAM,CAAA;CACd,KAAG,OAuBH,CAAA"}
@@ -18,7 +18,7 @@ export const isCustomAdminView = ({
18
18
  return true;
19
19
  }
20
20
  } else {
21
- if (routeWithoutAdmin.startsWith(view.path)) {
21
+ if (view.path && view.path !== '/' && (routeWithoutAdmin === view.path || routeWithoutAdmin.startsWith(view.path + '/'))) {
22
22
  return true;
23
23
  }
24
24
  }
@@ -1 +1 @@
1
- {"version":3,"file":"isCustomAdminView.js","names":["getRouteWithoutAdmin","isCustomAdminView","adminRoute","config","route","admin","components","views","isPublicAdminRoute","Object","entries","some","_","view","routeWithoutAdmin","exact","path","startsWith"],"sources":["../../src/utilities/isCustomAdminView.ts"],"sourcesContent":["import type { SanitizedConfig } from 'payload'\n\nimport { getRouteWithoutAdmin } from './getRouteWithoutAdmin.js'\n\n/**\n * Returns an array of views marked with 'public: true' in the config\n */\nexport const isCustomAdminView = ({\n adminRoute,\n config,\n route,\n}: {\n adminRoute: string\n config: SanitizedConfig\n route: string\n}): boolean => {\n if (config.admin?.components?.views) {\n const isPublicAdminRoute = Object.entries(config.admin.components.views).some(([_, view]) => {\n const routeWithoutAdmin = getRouteWithoutAdmin({ adminRoute, route })\n\n if (view.exact) {\n if (routeWithoutAdmin === view.path) {\n return true\n }\n } else {\n if (routeWithoutAdmin.startsWith(view.path)) {\n return true\n }\n }\n return false\n })\n return isPublicAdminRoute\n }\n return false\n}\n"],"mappings":"AAEA,SAASA,oBAAoB,QAAQ;AAErC;;;AAGA,OAAO,MAAMC,iBAAA,GAAoBA,CAAC;EAChCC,UAAU;EACVC,MAAM;EACNC;AAAK,CAKN;EACC,IAAID,MAAA,CAAOE,KAAK,EAAEC,UAAA,EAAYC,KAAA,EAAO;IACnC,MAAMC,kBAAA,GAAqBC,MAAA,CAAOC,OAAO,CAACP,MAAA,CAAOE,KAAK,CAACC,UAAU,CAACC,KAAK,EAAEI,IAAI,CAAC,CAAC,CAACC,CAAA,EAAGC,IAAA,CAAK;MACtF,MAAMC,iBAAA,GAAoBd,oBAAA,CAAqB;QAAEE,UAAA;QAAYE;MAAM;MAEnE,IAAIS,IAAA,CAAKE,KAAK,EAAE;QACd,IAAID,iBAAA,KAAsBD,IAAA,CAAKG,IAAI,EAAE;UACnC,OAAO;QACT;MACF,OAAO;QACL,IAAIF,iBAAA,CAAkBG,UAAU,CAACJ,IAAA,CAAKG,IAAI,GAAG;UAC3C,OAAO;QACT;MACF;MACA,OAAO;IACT;IACA,OAAOR,kBAAA;EACT;EACA,OAAO;AACT","ignoreList":[]}
1
+ {"version":3,"file":"isCustomAdminView.js","names":["getRouteWithoutAdmin","isCustomAdminView","adminRoute","config","route","admin","components","views","isPublicAdminRoute","Object","entries","some","_","view","routeWithoutAdmin","exact","path","startsWith"],"sources":["../../src/utilities/isCustomAdminView.ts"],"sourcesContent":["import type { SanitizedConfig } from 'payload'\n\nimport { getRouteWithoutAdmin } from './getRouteWithoutAdmin.js'\n\n/**\n * Returns an array of views marked with 'public: true' in the config\n */\nexport const isCustomAdminView = ({\n adminRoute,\n config,\n route,\n}: {\n adminRoute: string\n config: SanitizedConfig\n route: string\n}): boolean => {\n if (config.admin?.components?.views) {\n const isPublicAdminRoute = Object.entries(config.admin.components.views).some(([_, view]) => {\n const routeWithoutAdmin = getRouteWithoutAdmin({ adminRoute, route })\n\n if (view.exact) {\n if (routeWithoutAdmin === view.path) {\n return true\n }\n } else {\n if (\n view.path &&\n view.path !== '/' &&\n (routeWithoutAdmin === view.path || routeWithoutAdmin.startsWith(view.path + '/'))\n ) {\n return true\n }\n }\n return false\n })\n return isPublicAdminRoute\n }\n return false\n}\n"],"mappings":"AAEA,SAASA,oBAAoB,QAAQ;AAErC;;;AAGA,OAAO,MAAMC,iBAAA,GAAoBA,CAAC;EAChCC,UAAU;EACVC,MAAM;EACNC;AAAK,CAKN;EACC,IAAID,MAAA,CAAOE,KAAK,EAAEC,UAAA,EAAYC,KAAA,EAAO;IACnC,MAAMC,kBAAA,GAAqBC,MAAA,CAAOC,OAAO,CAACP,MAAA,CAAOE,KAAK,CAACC,UAAU,CAACC,KAAK,EAAEI,IAAI,CAAC,CAAC,CAACC,CAAA,EAAGC,IAAA,CAAK;MACtF,MAAMC,iBAAA,GAAoBd,oBAAA,CAAqB;QAAEE,UAAA;QAAYE;MAAM;MAEnE,IAAIS,IAAA,CAAKE,KAAK,EAAE;QACd,IAAID,iBAAA,KAAsBD,IAAA,CAAKG,IAAI,EAAE;UACnC,OAAO;QACT;MACF,OAAO;QACL,IACEH,IAAA,CAAKG,IAAI,IACTH,IAAA,CAAKG,IAAI,KAAK,QACbF,iBAAA,KAAsBD,IAAA,CAAKG,IAAI,IAAIF,iBAAA,CAAkBG,UAAU,CAACJ,IAAA,CAAKG,IAAI,GAAG,IAAG,GAChF;UACA,OAAO;QACT;MACF;MACA,OAAO;IACT;IACA,OAAOR,kBAAA;EACT;EACA,OAAO;AACT","ignoreList":[]}
@@ -0,0 +1,90 @@
1
+ import { describe, expect, it } from 'vitest';
2
+ import { isCustomAdminView } from './isCustomAdminView.js';
3
+ describe('isCustomAdminView', () => {
4
+ const adminRoute = '/admin';
5
+ const configWithCustomDashboard = {
6
+ admin: {
7
+ components: {
8
+ views: {
9
+ dashboard: {
10
+ path: '/'
11
+ }
12
+ }
13
+ }
14
+ }
15
+ };
16
+ it('should not bypass admin access for the root admin route even with a custom dashboard view', () => {
17
+ // The root path '/' maps to the dashboard — it is not a public custom view.
18
+ // canAccessAdmin must still be enforced for the admin root.
19
+ const result = isCustomAdminView({
20
+ adminRoute,
21
+ config: configWithCustomDashboard,
22
+ route: '/admin'
23
+ });
24
+ expect(result).toBe(false);
25
+ });
26
+ it('should not match collection routes as custom dashboard views when dashboard path is "/"', () => {
27
+ const result = isCustomAdminView({
28
+ adminRoute,
29
+ config: configWithCustomDashboard,
30
+ route: '/admin/collections/tickets'
31
+ });
32
+ expect(result).toBe(false);
33
+ });
34
+ it('should not match document routes as custom dashboard views when dashboard path is "/"', () => {
35
+ const result = isCustomAdminView({
36
+ adminRoute,
37
+ config: configWithCustomDashboard,
38
+ route: '/admin/collections/tickets/123'
39
+ });
40
+ expect(result).toBe(false);
41
+ });
42
+ it('should return false when no custom views are configured', () => {
43
+ const config = {};
44
+ const result = isCustomAdminView({
45
+ adminRoute,
46
+ config,
47
+ route: '/admin/collections/tickets'
48
+ });
49
+ expect(result).toBe(false);
50
+ });
51
+ it('should return true for a custom view with a non-root path', () => {
52
+ const config = {
53
+ admin: {
54
+ components: {
55
+ views: {
56
+ myCustomView: {
57
+ path: '/my-custom-view'
58
+ }
59
+ }
60
+ }
61
+ }
62
+ };
63
+ const result = isCustomAdminView({
64
+ adminRoute,
65
+ config,
66
+ route: '/admin/my-custom-view'
67
+ });
68
+ expect(result).toBe(true);
69
+ });
70
+ it('should not match collection routes when a non-root custom view path is set', () => {
71
+ const config = {
72
+ admin: {
73
+ components: {
74
+ views: {
75
+ myCustomView: {
76
+ path: '/my-custom-view'
77
+ }
78
+ }
79
+ }
80
+ }
81
+ };
82
+ const result = isCustomAdminView({
83
+ adminRoute,
84
+ config,
85
+ route: '/admin/collections/tickets'
86
+ });
87
+ expect(result).toBe(false);
88
+ });
89
+ });
90
+ //# sourceMappingURL=isCustomAdminView.spec.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"isCustomAdminView.spec.js","names":["describe","expect","it","isCustomAdminView","adminRoute","configWithCustomDashboard","admin","components","views","dashboard","path","result","config","route","toBe","myCustomView"],"sources":["../../src/utilities/isCustomAdminView.spec.ts"],"sourcesContent":["import type { SanitizedConfig } from 'payload'\n\nimport { describe, expect, it } from 'vitest'\n\nimport { isCustomAdminView } from './isCustomAdminView.js'\n\ndescribe('isCustomAdminView', () => {\n const adminRoute = '/admin'\n\n const configWithCustomDashboard = {\n admin: {\n components: {\n views: {\n dashboard: {\n path: '/',\n },\n },\n },\n },\n } as unknown as SanitizedConfig\n\n it('should not bypass admin access for the root admin route even with a custom dashboard view', () => {\n // The root path '/' maps to the dashboard — it is not a public custom view.\n // canAccessAdmin must still be enforced for the admin root.\n const result = isCustomAdminView({\n adminRoute,\n config: configWithCustomDashboard,\n route: '/admin',\n })\n\n expect(result).toBe(false)\n })\n\n it('should not match collection routes as custom dashboard views when dashboard path is \"/\"', () => {\n const result = isCustomAdminView({\n adminRoute,\n config: configWithCustomDashboard,\n route: '/admin/collections/tickets',\n })\n\n expect(result).toBe(false)\n })\n\n it('should not match document routes as custom dashboard views when dashboard path is \"/\"', () => {\n const result = isCustomAdminView({\n adminRoute,\n config: configWithCustomDashboard,\n route: '/admin/collections/tickets/123',\n })\n\n expect(result).toBe(false)\n })\n\n it('should return false when no custom views are configured', () => {\n const config = {} as SanitizedConfig\n\n const result = isCustomAdminView({\n adminRoute,\n config,\n route: '/admin/collections/tickets',\n })\n\n expect(result).toBe(false)\n })\n\n it('should return true for a custom view with a non-root path', () => {\n const config = {\n admin: {\n components: {\n views: {\n myCustomView: {\n path: '/my-custom-view',\n },\n },\n },\n },\n } as unknown as SanitizedConfig\n\n const result = isCustomAdminView({\n adminRoute,\n config,\n route: '/admin/my-custom-view',\n })\n\n expect(result).toBe(true)\n })\n\n it('should not match collection routes when a non-root custom view path is set', () => {\n const config = {\n admin: {\n components: {\n views: {\n myCustomView: {\n path: '/my-custom-view',\n },\n },\n },\n },\n } as unknown as SanitizedConfig\n\n const result = isCustomAdminView({\n adminRoute,\n config,\n route: '/admin/collections/tickets',\n })\n\n expect(result).toBe(false)\n })\n})\n"],"mappings":"AAEA,SAASA,QAAQ,EAAEC,MAAM,EAAEC,EAAE,QAAQ;AAErC,SAASC,iBAAiB,QAAQ;AAElCH,QAAA,CAAS,qBAAqB;EAC5B,MAAMI,UAAA,GAAa;EAEnB,MAAMC,yBAAA,GAA4B;IAChCC,KAAA,EAAO;MACLC,UAAA,EAAY;QACVC,KAAA,EAAO;UACLC,SAAA,EAAW;YACTC,IAAA,EAAM;UACR;QACF;MACF;IACF;EACF;EAEAR,EAAA,CAAG,6FAA6F;IAC9F;IACA;IACA,MAAMS,MAAA,GAASR,iBAAA,CAAkB;MAC/BC,UAAA;MACAQ,MAAA,EAAQP,yBAAA;MACRQ,KAAA,EAAO;IACT;IAEAZ,MAAA,CAAOU,MAAA,EAAQG,IAAI,CAAC;EACtB;EAEAZ,EAAA,CAAG,2FAA2F;IAC5F,MAAMS,MAAA,GAASR,iBAAA,CAAkB;MAC/BC,UAAA;MACAQ,MAAA,EAAQP,yBAAA;MACRQ,KAAA,EAAO;IACT;IAEAZ,MAAA,CAAOU,MAAA,EAAQG,IAAI,CAAC;EACtB;EAEAZ,EAAA,CAAG,yFAAyF;IAC1F,MAAMS,MAAA,GAASR,iBAAA,CAAkB;MAC/BC,UAAA;MACAQ,MAAA,EAAQP,yBAAA;MACRQ,KAAA,EAAO;IACT;IAEAZ,MAAA,CAAOU,MAAA,EAAQG,IAAI,CAAC;EACtB;EAEAZ,EAAA,CAAG,2DAA2D;IAC5D,MAAMU,MAAA,GAAS,CAAC;IAEhB,MAAMD,MAAA,GAASR,iBAAA,CAAkB;MAC/BC,UAAA;MACAQ,MAAA;MACAC,KAAA,EAAO;IACT;IAEAZ,MAAA,CAAOU,MAAA,EAAQG,IAAI,CAAC;EACtB;EAEAZ,EAAA,CAAG,6DAA6D;IAC9D,MAAMU,MAAA,GAAS;MACbN,KAAA,EAAO;QACLC,UAAA,EAAY;UACVC,KAAA,EAAO;YACLO,YAAA,EAAc;cACZL,IAAA,EAAM;YACR;UACF;QACF;MACF;IACF;IAEA,MAAMC,MAAA,GAASR,iBAAA,CAAkB;MAC/BC,UAAA;MACAQ,MAAA;MACAC,KAAA,EAAO;IACT;IAEAZ,MAAA,CAAOU,MAAA,EAAQG,IAAI,CAAC;EACtB;EAEAZ,EAAA,CAAG,8EAA8E;IAC/E,MAAMU,MAAA,GAAS;MACbN,KAAA,EAAO;QACLC,UAAA,EAAY;UACVC,KAAA,EAAO;YACLO,YAAA,EAAc;cACZL,IAAA,EAAM;YACR;UACF;QACF;MACF;IACF;IAEA,MAAMC,MAAA,GAASR,iBAAA,CAAkB;MAC/BC,UAAA;MACAQ,MAAA;MACAC,KAAA,EAAO;IACT;IAEAZ,MAAA,CAAOU,MAAA,EAAQG,IAAI,CAAC;EACtB;AACF","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/views/ForgotPassword/ForgotPasswordForm/index.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAmB,MAAM,OAAO,CAAA;AAIvC,eAAO,MAAM,kBAAkB,EAAE,KAAK,CAAC,EAgItC,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/views/ForgotPassword/ForgotPasswordForm/index.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAmB,MAAM,OAAO,CAAA;AAIvC,eAAO,MAAM,kBAAkB,EAAE,KAAK,CAAC,EAmItC,CAAA"}
@@ -3,7 +3,7 @@
3
3
  import { c as _c } from "react/compiler-runtime";
4
4
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
5
5
  import { EmailField, Form, FormSubmit, TextField, useConfig, useTranslation } from '@payloadcms/ui';
6
- import { email, text } from 'payload/shared';
6
+ import { email, formatAdminURL, text } from 'payload/shared';
7
7
  import React, { useState } from 'react';
8
8
  import { FormHeader } from '../../../elements/FormHeader/index.js';
9
9
  export const ForgotPasswordForm = () => {
@@ -20,7 +20,7 @@ export const ForgotPasswordForm = () => {
20
20
  user: userSlug
21
21
  } = t0;
22
22
  const {
23
- api
23
+ api: apiRoute
24
24
  } = t1;
25
25
  const {
26
26
  t
@@ -58,7 +58,7 @@ export const ForgotPasswordForm = () => {
58
58
  const handleResponse = t3;
59
59
  let t4;
60
60
  let t5;
61
- if ($[6] !== api || $[7] !== config || $[8] !== handleResponse || $[9] !== hasSubmitted || $[10] !== loginWithUsername || $[11] !== t || $[12] !== userSlug) {
61
+ if ($[6] !== apiRoute || $[7] !== config || $[8] !== handleResponse || $[9] !== hasSubmitted || $[10] !== loginWithUsername || $[11] !== t || $[12] !== userSlug) {
62
62
  t5 = Symbol.for("react.early_return_sentinel");
63
63
  bb0: {
64
64
  const initialState = loginWithUsername ? {
@@ -90,7 +90,10 @@ export const ForgotPasswordForm = () => {
90
90
  break bb0;
91
91
  }
92
92
  t4 = _jsxs(Form, {
93
- action: `${api}/${userSlug}/forgot-password`,
93
+ action: formatAdminURL({
94
+ apiRoute,
95
+ path: `/${userSlug}/forgot-password`
96
+ }),
94
97
  handleResponse,
95
98
  initialState,
96
99
  method: "POST",
@@ -158,7 +161,7 @@ export const ForgotPasswordForm = () => {
158
161
  })]
159
162
  });
160
163
  }
161
- $[6] = api;
164
+ $[6] = apiRoute;
162
165
  $[7] = config;
163
166
  $[8] = handleResponse;
164
167
  $[9] = hasSubmitted;
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["c","_c","EmailField","Form","FormSubmit","TextField","useConfig","useTranslation","email","text","React","useState","FormHeader","ForgotPasswordForm","$","config","getEntityConfig","admin","t0","routes","t1","user","userSlug","api","t","hasSubmitted","setHasSubmitted","t2","collectionSlug","collectionConfig","loginWithUsername","auth","t3","res","successToast","errorToast","json","then","catch","handleResponse","t4","t5","Symbol","for","initialState","username","initialValue","valid","value","undefined","t6","_jsx","description","heading","_jsxs","action","method","children","field","name","label","required","path","validate","type","blockData","data","event","preferences","fields","req","payload","siblingData","autoComplete","value_0","size"],"sources":["../../../../src/views/ForgotPassword/ForgotPasswordForm/index.tsx"],"sourcesContent":["'use client'\n\nimport type { FormProps } from '@payloadcms/ui'\nimport type { FormState, PayloadRequest } from 'payload'\n\nimport { EmailField, Form, FormSubmit, TextField, useConfig, useTranslation } from '@payloadcms/ui'\nimport { email, text } from 'payload/shared'\nimport React, { useState } from 'react'\n\nimport { FormHeader } from '../../../elements/FormHeader/index.js'\n\nexport const ForgotPasswordForm: React.FC = () => {\n const { config, getEntityConfig } = useConfig()\n\n const {\n admin: { user: userSlug },\n routes: { api },\n } = config\n\n const { t } = useTranslation()\n const [hasSubmitted, setHasSubmitted] = useState(false)\n const collectionConfig = getEntityConfig({ collectionSlug: userSlug })\n const loginWithUsername = collectionConfig?.auth?.loginWithUsername\n\n const handleResponse: FormProps['handleResponse'] = (res, successToast, errorToast) => {\n res\n .json()\n .then(() => {\n setHasSubmitted(true)\n successToast(t('general:submissionSuccessful'))\n })\n .catch(() => {\n errorToast(\n loginWithUsername\n ? t('authentication:usernameNotValid')\n : t('authentication:emailNotValid'),\n )\n })\n }\n\n const initialState: FormState = loginWithUsername\n ? {\n username: {\n initialValue: '',\n valid: true,\n value: undefined,\n },\n }\n : {\n email: {\n initialValue: '',\n valid: true,\n value: undefined,\n },\n }\n\n if (hasSubmitted) {\n return (\n <FormHeader\n description={t('authentication:checkYourEmailForPasswordReset')}\n heading={t('authentication:emailSent')}\n />\n )\n }\n\n return (\n <Form\n action={`${api}/${userSlug}/forgot-password`}\n handleResponse={handleResponse}\n initialState={initialState}\n method=\"POST\"\n >\n <FormHeader\n description={\n loginWithUsername\n ? t('authentication:forgotPasswordUsernameInstructions')\n : t('authentication:forgotPasswordEmailInstructions')\n }\n heading={t('authentication:forgotPassword')}\n />\n\n {loginWithUsername ? (\n <TextField\n field={{\n name: 'username',\n label: t('authentication:username'),\n required: true,\n }}\n path=\"username\"\n validate={(value) =>\n text(value, {\n name: 'username',\n type: 'text',\n blockData: {},\n data: {},\n event: 'onChange',\n path: ['username'],\n preferences: { fields: {} },\n req: {\n payload: {\n config,\n },\n t,\n } as unknown as PayloadRequest,\n required: true,\n siblingData: {},\n })\n }\n />\n ) : (\n <EmailField\n field={{\n name: 'email',\n admin: {\n autoComplete: 'email',\n },\n label: t('general:email'),\n required: true,\n }}\n path=\"email\"\n validate={(value) =>\n email(value, {\n name: 'email',\n type: 'email',\n blockData: {},\n data: {},\n event: 'onChange',\n path: ['email'],\n preferences: { fields: {} },\n req: { payload: { config }, t } as unknown as PayloadRequest,\n required: true,\n siblingData: {},\n })\n }\n />\n )}\n <FormSubmit size=\"large\">{t('general:submit')}</FormSubmit>\n </Form>\n )\n}\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;;AAKA,SAASC,UAAU,EAAEC,IAAI,EAAEC,UAAU,EAAEC,SAAS,EAAEC,SAAS,EAAEC,cAAc,QAAQ;AACnF,SAASC,KAAK,EAAEC,IAAI,QAAQ;AAC5B,OAAOC,KAAA,IAASC,QAAQ,QAAQ;AAEhC,SAASC,UAAU,QAAQ;AAE3B,OAAO,MAAMC,kBAAA,GAA+BA,CAAA;EAAA,MAAAC,CAAA,GAAAb,EAAA;EAC1C;IAAAc,MAAA;IAAAC;EAAA,IAAoCV,SAAA;EAEpC;IAAAW,KAAA,EAAAC,EAAA;IAAAC,MAAA,EAAAC;EAAA,IAGIL,MAAA;EAFK;IAAAM,IAAA,EAAAC;EAAA,IAAAJ,EAAkB;EACjB;IAAAK;E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;YAAAC,IAAA,EAEU;YAAA1C,KAAA;cAAAwD,YAAA,EAEU;YAAA;YAAAb,KAAA,EAETpC,CAAA,CAAE;YAAAqC,QAAA;UAAA;UAAAC,IAAA,EAGN;UAAAC,QAAA,EAAAW,OAAA,IAEHlE,KAAA,CAAMwC,OAAA;YAAAW,IAAA,EACE;YAAAK,IAAA,EACA;YAAAC,SAAA;YAAAC,IAAA;YAAAC,KAAA,EAGC;YAAAL,IAAA,GACA;YAAAM,WAAA;cAAAC,MAAA;YAAA;YAAAC,GAAA;cAAAC,OAAA;gBAAAxD;cAAA;cAAAS;YAAA;YAAAqC,QAAA;YAAAW,WAAA;UAAA,CAKT;QAAA,C,GAINrB,IAAA,CAAA/C,UAAA;UAAAuE,IAAA,EAAiB;UAAAlB,QAAA,EAASjC,CAAA,CAAE;QAAA,C;;;;;;;;;;;;;;;;;;;SAtE9BgB,E;CAyEJ","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["c","_c","EmailField","Form","FormSubmit","TextField","useConfig","useTranslation","email","formatAdminURL","text","React","useState","FormHeader","ForgotPasswordForm","$","config","getEntityConfig","admin","t0","routes","t1","user","userSlug","api","apiRoute","t","hasSubmitted","setHasSubmitted","t2","collectionSlug","collectionConfig","loginWithUsername","auth","t3","res","successToast","errorToast","json","then","catch","handleResponse","t4","t5","Symbol","for","initialState","username","initialValue","valid","value","undefined","t6","_jsx","description","heading","_jsxs","action","path","method","children","field","name","label","required","validate","type","blockData","data","event","preferences","fields","req","payload","siblingData","autoComplete","value_0","size"],"sources":["../../../../src/views/ForgotPassword/ForgotPasswordForm/index.tsx"],"sourcesContent":["'use client'\n\nimport type { FormProps } from '@payloadcms/ui'\nimport type { FormState, PayloadRequest } from 'payload'\n\nimport { EmailField, Form, FormSubmit, TextField, useConfig, useTranslation } from '@payloadcms/ui'\nimport { email, formatAdminURL, text } from 'payload/shared'\nimport React, { useState } from 'react'\n\nimport { FormHeader } from '../../../elements/FormHeader/index.js'\n\nexport const ForgotPasswordForm: React.FC = () => {\n const { config, getEntityConfig } = useConfig()\n\n const {\n admin: { user: userSlug },\n routes: { api: apiRoute },\n } = config\n\n const { t } = useTranslation()\n const [hasSubmitted, setHasSubmitted] = useState(false)\n const collectionConfig = getEntityConfig({ collectionSlug: userSlug })\n const loginWithUsername = collectionConfig?.auth?.loginWithUsername\n\n const handleResponse: FormProps['handleResponse'] = (res, successToast, errorToast) => {\n res\n .json()\n .then(() => {\n setHasSubmitted(true)\n successToast(t('general:submissionSuccessful'))\n })\n .catch(() => {\n errorToast(\n loginWithUsername\n ? t('authentication:usernameNotValid')\n : t('authentication:emailNotValid'),\n )\n })\n }\n\n const initialState: FormState = loginWithUsername\n ? {\n username: {\n initialValue: '',\n valid: true,\n value: undefined,\n },\n }\n : {\n email: {\n initialValue: '',\n valid: true,\n value: undefined,\n },\n }\n\n if (hasSubmitted) {\n return (\n <FormHeader\n description={t('authentication:checkYourEmailForPasswordReset')}\n heading={t('authentication:emailSent')}\n />\n )\n }\n\n return (\n <Form\n action={formatAdminURL({\n apiRoute,\n path: `/${userSlug}/forgot-password`,\n })}\n handleResponse={handleResponse}\n initialState={initialState}\n method=\"POST\"\n >\n <FormHeader\n description={\n loginWithUsername\n ? t('authentication:forgotPasswordUsernameInstructions')\n : t('authentication:forgotPasswordEmailInstructions')\n }\n heading={t('authentication:forgotPassword')}\n />\n\n {loginWithUsername ? (\n <TextField\n field={{\n name: 'username',\n label: t('authentication:username'),\n required: true,\n }}\n path=\"username\"\n validate={(value) =>\n text(value, {\n name: 'username',\n type: 'text',\n blockData: {},\n data: {},\n event: 'onChange',\n path: ['username'],\n preferences: { fields: {} },\n req: {\n payload: {\n config,\n },\n t,\n } as unknown as PayloadRequest,\n required: true,\n siblingData: {},\n })\n }\n />\n ) : (\n <EmailField\n field={{\n name: 'email',\n admin: {\n autoComplete: 'email',\n },\n label: t('general:email'),\n required: true,\n }}\n path=\"email\"\n validate={(value) =>\n email(value, {\n name: 'email',\n type: 'email',\n blockData: {},\n data: {},\n event: 'onChange',\n path: ['email'],\n preferences: { fields: {} },\n req: { payload: { config }, t } as unknown as PayloadRequest,\n required: true,\n siblingData: {},\n })\n }\n />\n )}\n <FormSubmit size=\"large\">{t('general:submit')}</FormSubmit>\n </Form>\n )\n}\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;;AAKA,SAASC,UAAU,EAAEC,IAAI,EAAEC,UAAU,EAAEC,SAAS,EAAEC,SAAS,EAAEC,cAAc,QAAQ;AACnF,SAASC,KAAK,EAAEC,cAAc,EAAEC,IAAI,QAAQ;AAC5C,OAAOC,KAAA,IAASC,QAAQ,QAAQ;AAEhC,SAASC,UAAU,QAAQ;AAE3B,OAAO,MAAMC,kBAAA,GAA+BA,CAAA;EAAA,MAAAC,CAAA,GAAAd,EAAA;EAC1C;IAAAe,MAAA;IAAAC;EAAA,IAAoCX,SAAA;EAEpC;IAAAY,KAAA,EAAAC,EAAA;IAAAC,MAAA,EAAAC;EAAA,IAGIL,MAAA;EAFK;IAAAM,IAAA,EAAAC;EAAA,IAAAJ,EAAkB;EACjB;IAAAK,GAAA,EAAAC;EAAA,IAAAJ,EAAiB;EAG3B;IAAAK;EAAA,IAAcnB,cAAA;EACd,OAAAoB,YAAA,EAAAC,eAAA,IAAwChB,QAAA,MAAS;EAAA,IAAAiB,EAAA;EAAA,IAAAd,CAAA,QAAAE,eAAA,IAAAF,CAAA,QAAAQ,QAAA;IACxBM,EAAA,GAAAZ,eAAA;MAAAa,cAAA,EAAkCP;IAAA,CAAS;IAAAR,CAAA,MAAAE,eAAA;IAAAF,CAAA,MAAAQ,QAAA;IAAAR,CAAA,MAAAc,EAAA;EAAA;IAAAA,EAAA,GAAAd,CAAA;EAAA;EAApE,MAAAgB,gBAAA,GAAyBF,EAA2C;EACpE,MAAAG,iBAAA,GAA0BD,gBAAA,EAAAE,IAAA,EAAAD,iBAAA;EAAwB,IAAAE,EAAA;EAAA,IAAAnB,CAAA,QAAAiB,iBAAA,IAA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ASlC,CAAA,CAAE;QAAA,C;;;;;;;;;;;;;;;;;;;SAzE9BgB,E;CA4EJ","ignoreList":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@payloadcms/next",
3
- "version": "3.81.0-internal.181753b",
3
+ "version": "3.81.0",
4
4
  "homepage": "https://payloadcms.com",
5
5
  "repository": {
6
6
  "type": "git",
@@ -91,17 +91,17 @@
91
91
  "@dnd-kit/sortable": "10.0.0",
92
92
  "busboy": "^1.6.0",
93
93
  "dequal": "2.0.3",
94
- "file-type": "19.3.0",
94
+ "file-type": "21.3.4",
95
95
  "graphql-http": "^1.22.0",
96
96
  "graphql-playground-html": "1.6.30",
97
97
  "http-status": "2.1.0",
98
98
  "path-to-regexp": "6.3.0",
99
- "qs-esm": "7.0.2",
99
+ "qs-esm": "8.0.1",
100
100
  "sass": "1.77.4",
101
101
  "uuid": "10.0.0",
102
- "@payloadcms/graphql": "3.81.0-internal.181753b",
103
- "@payloadcms/translations": "3.81.0-internal.181753b",
104
- "@payloadcms/ui": "3.81.0-internal.181753b"
102
+ "@payloadcms/graphql": "3.81.0",
103
+ "@payloadcms/ui": "3.81.0",
104
+ "@payloadcms/translations": "3.81.0"
105
105
  },
106
106
  "devDependencies": {
107
107
  "@babel/cli": "7.27.2",
@@ -119,12 +119,12 @@
119
119
  "esbuild-sass-plugin": "3.3.1",
120
120
  "swc-plugin-transform-remove-imports": "8.3.0",
121
121
  "@payloadcms/eslint-config": "3.28.0",
122
- "payload": "3.81.0-internal.181753b"
122
+ "payload": "3.81.0"
123
123
  },
124
124
  "peerDependencies": {
125
125
  "graphql": "^16.8.1",
126
126
  "next": ">=15.2.9 <15.3.0 || >=15.3.9 <15.4.0 || >=15.4.11 <15.5.0 || >=16.2.0-canary.10 <17.0.0",
127
- "payload": "3.81.0-internal.181753b"
127
+ "payload": "3.81.0"
128
128
  },
129
129
  "engines": {
130
130
  "node": "^18.20.2 || >=20.9.0"