@payloadcms/next 3.68.2 → 3.68.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/elements/DocumentHeader/Tabs/Tab/TabLink.d.ts.map +1 -1
- package/dist/elements/DocumentHeader/Tabs/Tab/TabLink.js +24 -19
- package/dist/elements/DocumentHeader/Tabs/Tab/TabLink.js.map +1 -1
- package/dist/elements/Nav/index.client.d.ts.map +1 -1
- package/dist/elements/Nav/index.client.js +21 -15
- package/dist/elements/Nav/index.client.js.map +1 -1
- package/dist/utilities/handleAuthRedirect.d.ts.map +1 -1
- package/dist/utilities/handleAuthRedirect.js +2 -1
- package/dist/utilities/handleAuthRedirect.js.map +1 -1
- package/dist/views/Account/ResetPreferences/index.d.ts.map +1 -1
- package/dist/views/Account/ResetPreferences/index.js +6 -1
- package/dist/views/Account/ResetPreferences/index.js.map +1 -1
- package/dist/views/CreateFirstUser/index.client.d.ts.map +1 -1
- package/dist/views/CreateFirstUser/index.client.js +6 -1
- package/dist/views/CreateFirstUser/index.client.js.map +1 -1
- package/dist/views/Dashboard/Default/index.d.ts.map +1 -1
- package/dist/views/Dashboard/Default/index.js +8 -4
- package/dist/views/Dashboard/Default/index.js.map +1 -1
- package/dist/views/Document/index.d.ts.map +1 -1
- package/dist/views/Document/index.js +6 -2
- package/dist/views/Document/index.js.map +1 -1
- package/dist/views/ForgotPassword/index.d.ts.map +1 -1
- package/dist/views/ForgotPassword/index.js +6 -3
- package/dist/views/ForgotPassword/index.js.map +1 -1
- package/dist/views/List/index.d.ts.map +1 -1
- package/dist/views/List/index.js +2 -1
- package/dist/views/List/index.js.map +1 -1
- package/dist/views/Login/LoginForm/index.d.ts.map +1 -1
- package/dist/views/Login/LoginForm/index.js +24 -17
- package/dist/views/Login/LoginForm/index.js.map +1 -1
- package/dist/views/Logout/LogoutClient.d.ts.map +1 -1
- package/dist/views/Logout/LogoutClient.js +41 -36
- package/dist/views/Logout/LogoutClient.js.map +1 -1
- package/dist/views/NotFound/index.d.ts.map +1 -1
- package/dist/views/NotFound/index.js +1 -0
- package/dist/views/NotFound/index.js.map +1 -1
- package/dist/views/ResetPassword/ResetPasswordForm/index.d.ts.map +1 -1
- package/dist/views/ResetPassword/ResetPasswordForm/index.js +22 -16
- package/dist/views/ResetPassword/ResetPasswordForm/index.js.map +1 -1
- package/dist/views/ResetPassword/index.d.ts.map +1 -1
- package/dist/views/ResetPassword/index.js +4 -2
- package/dist/views/ResetPassword/index.js.map +1 -1
- package/dist/views/Root/getRouteData.js +2 -1
- package/dist/views/Root/getRouteData.js.map +1 -1
- package/dist/views/Root/index.d.ts.map +1 -1
- package/dist/views/Root/index.js +9 -3
- package/dist/views/Root/index.js.map +1 -1
- package/dist/views/Unauthorized/index.d.ts.map +1 -1
- package/dist/views/Unauthorized/index.js +4 -2
- package/dist/views/Unauthorized/index.js.map +1 -1
- package/dist/views/Verify/index.d.ts.map +1 -1
- package/dist/views/Verify/index.js +4 -2
- package/dist/views/Verify/index.js.map +1 -1
- package/dist/views/Version/Default/SetStepNav.d.ts.map +1 -1
- package/dist/views/Version/Default/SetStepNav.js +14 -7
- package/dist/views/Version/Default/SetStepNav.js.map +1 -1
- package/dist/views/Version/Restore/index.d.ts.map +1 -1
- package/dist/views/Version/Restore/index.js +4 -2
- package/dist/views/Version/Restore/index.js.map +1 -1
- package/dist/views/Versions/cells/CreatedAt/index.d.ts.map +1 -1
- package/dist/views/Versions/cells/CreatedAt/index.js +6 -3
- package/dist/views/Versions/cells/CreatedAt/index.js.map +1 -1
- package/dist/views/Versions/index.d.ts.map +1 -1
- package/dist/views/Versions/index.js +6 -2
- package/dist/views/Versions/index.js.map +1 -1
- package/package.json +8 -8
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import { c as _c } from "react/compiler-runtime";
|
|
4
4
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
5
|
-
import { Button, LoadingOverlay, toast, useAuth, useRouteTransition, useTranslation } from '@payloadcms/ui';
|
|
5
|
+
import { Button, LoadingOverlay, toast, useAuth, useConfig, useRouteTransition, useTranslation } from '@payloadcms/ui';
|
|
6
6
|
import { useRouter } from 'next/navigation.js';
|
|
7
7
|
import { formatAdminURL } from 'payload/shared';
|
|
8
8
|
import React, { useEffect } from 'react';
|
|
@@ -18,7 +18,7 @@ const baseClass = 'logout';
|
|
|
18
18
|
* is logged out due to inactivity.
|
|
19
19
|
*/
|
|
20
20
|
export const LogoutClient = props => {
|
|
21
|
-
const $ = _c(
|
|
21
|
+
const $ = _c(24);
|
|
22
22
|
const {
|
|
23
23
|
adminRoute,
|
|
24
24
|
inactivity,
|
|
@@ -28,6 +28,9 @@ export const LogoutClient = props => {
|
|
|
28
28
|
logOut,
|
|
29
29
|
user
|
|
30
30
|
} = useAuth();
|
|
31
|
+
const {
|
|
32
|
+
config
|
|
33
|
+
} = useConfig();
|
|
31
34
|
const {
|
|
32
35
|
startRouteTransition
|
|
33
36
|
} = useRouteTransition();
|
|
@@ -35,17 +38,19 @@ export const LogoutClient = props => {
|
|
|
35
38
|
const isLoggedIn = Boolean(user?.id);
|
|
36
39
|
const navigatingToLoginRef = React.useRef(false);
|
|
37
40
|
let t0;
|
|
38
|
-
if ($[0] !== adminRoute || $[1] !==
|
|
41
|
+
if ($[0] !== adminRoute || $[1] !== config || $[2] !== inactivity || $[3] !== redirect) {
|
|
39
42
|
t0 = () => formatAdminURL({
|
|
40
43
|
adminRoute,
|
|
41
|
-
path: `/login${inactivity && redirect && redirect.length > 0 ? `?redirect=${encodeURIComponent(redirect)}` : ""}
|
|
44
|
+
path: `/login${inactivity && redirect && redirect.length > 0 ? `?redirect=${encodeURIComponent(redirect)}` : ""}`,
|
|
45
|
+
serverURL: config.serverURL
|
|
42
46
|
});
|
|
43
47
|
$[0] = adminRoute;
|
|
44
|
-
$[1] =
|
|
45
|
-
$[2] =
|
|
46
|
-
$[3] =
|
|
48
|
+
$[1] = config;
|
|
49
|
+
$[2] = inactivity;
|
|
50
|
+
$[3] = redirect;
|
|
51
|
+
$[4] = t0;
|
|
47
52
|
} else {
|
|
48
|
-
t0 = $[
|
|
53
|
+
t0 = $[4];
|
|
49
54
|
}
|
|
50
55
|
const [loginRoute] = React.useState(t0);
|
|
51
56
|
const {
|
|
@@ -53,7 +58,7 @@ export const LogoutClient = props => {
|
|
|
53
58
|
} = useTranslation();
|
|
54
59
|
const router = useRouter();
|
|
55
60
|
let t1;
|
|
56
|
-
if ($[
|
|
61
|
+
if ($[5] !== logOut || $[6] !== loginRoute || $[7] !== router || $[8] !== startRouteTransition || $[9] !== t) {
|
|
57
62
|
t1 = async () => {
|
|
58
63
|
if (!navigatingToLoginRef.current) {
|
|
59
64
|
navigatingToLoginRef.current = true;
|
|
@@ -63,19 +68,19 @@ export const LogoutClient = props => {
|
|
|
63
68
|
return;
|
|
64
69
|
}
|
|
65
70
|
};
|
|
66
|
-
$[
|
|
67
|
-
$[
|
|
68
|
-
$[
|
|
69
|
-
$[
|
|
70
|
-
$[
|
|
71
|
-
$[
|
|
71
|
+
$[5] = logOut;
|
|
72
|
+
$[6] = loginRoute;
|
|
73
|
+
$[7] = router;
|
|
74
|
+
$[8] = startRouteTransition;
|
|
75
|
+
$[9] = t;
|
|
76
|
+
$[10] = t1;
|
|
72
77
|
} else {
|
|
73
|
-
t1 = $[
|
|
78
|
+
t1 = $[10];
|
|
74
79
|
}
|
|
75
80
|
const handleLogOut = t1;
|
|
76
81
|
let t2;
|
|
77
82
|
let t3;
|
|
78
|
-
if ($[
|
|
83
|
+
if ($[11] !== handleLogOut || $[12] !== inactivity || $[13] !== isLoggedIn || $[14] !== loginRoute || $[15] !== router || $[16] !== startRouteTransition) {
|
|
79
84
|
t2 = () => {
|
|
80
85
|
if (isLoggedIn && !inactivity) {
|
|
81
86
|
handleLogOut();
|
|
@@ -87,22 +92,22 @@ export const LogoutClient = props => {
|
|
|
87
92
|
}
|
|
88
93
|
};
|
|
89
94
|
t3 = [handleLogOut, isLoggedIn, loginRoute, router, startRouteTransition, inactivity];
|
|
90
|
-
$[
|
|
91
|
-
$[
|
|
92
|
-
$[
|
|
93
|
-
$[
|
|
94
|
-
$[
|
|
95
|
-
$[
|
|
96
|
-
$[
|
|
97
|
-
$[
|
|
95
|
+
$[11] = handleLogOut;
|
|
96
|
+
$[12] = inactivity;
|
|
97
|
+
$[13] = isLoggedIn;
|
|
98
|
+
$[14] = loginRoute;
|
|
99
|
+
$[15] = router;
|
|
100
|
+
$[16] = startRouteTransition;
|
|
101
|
+
$[17] = t2;
|
|
102
|
+
$[18] = t3;
|
|
98
103
|
} else {
|
|
99
|
-
t2 = $[
|
|
100
|
-
t3 = $[
|
|
104
|
+
t2 = $[17];
|
|
105
|
+
t3 = $[18];
|
|
101
106
|
}
|
|
102
107
|
useEffect(t2, t3);
|
|
103
108
|
if (!isLoggedIn && inactivity) {
|
|
104
109
|
let t4;
|
|
105
|
-
if ($[
|
|
110
|
+
if ($[19] !== loginRoute || $[20] !== t) {
|
|
106
111
|
t4 = _jsxs("div", {
|
|
107
112
|
className: `${baseClass}__wrap`,
|
|
108
113
|
children: [_jsx("h2", {
|
|
@@ -115,24 +120,24 @@ export const LogoutClient = props => {
|
|
|
115
120
|
children: t("authentication:logBackIn")
|
|
116
121
|
})]
|
|
117
122
|
});
|
|
118
|
-
$[
|
|
119
|
-
$[
|
|
120
|
-
$[
|
|
123
|
+
$[19] = loginRoute;
|
|
124
|
+
$[20] = t;
|
|
125
|
+
$[21] = t4;
|
|
121
126
|
} else {
|
|
122
|
-
t4 = $[
|
|
127
|
+
t4 = $[21];
|
|
123
128
|
}
|
|
124
129
|
return t4;
|
|
125
130
|
}
|
|
126
131
|
let t4;
|
|
127
|
-
if ($[
|
|
132
|
+
if ($[22] !== t) {
|
|
128
133
|
t4 = _jsx(LoadingOverlay, {
|
|
129
134
|
animationDuration: "0ms",
|
|
130
135
|
loadingText: t("authentication:loggingOut")
|
|
131
136
|
});
|
|
132
|
-
$[
|
|
133
|
-
$[
|
|
137
|
+
$[22] = t;
|
|
138
|
+
$[23] = t4;
|
|
134
139
|
} else {
|
|
135
|
-
t4 = $[
|
|
140
|
+
t4 = $[23];
|
|
136
141
|
}
|
|
137
142
|
return t4;
|
|
138
143
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LogoutClient.js","names":["c","_c","Button","LoadingOverlay","toast","useAuth","useRouteTransition","useTranslation","useRouter","formatAdminURL","React","useEffect","baseClass","LogoutClient","props","$","adminRoute","inactivity","redirect","logOut","user","startRouteTransition","id","isLoggedIn","Boolean","navigatingToLoginRef","useRef","t0","path","length","encodeURIComponent","loginRoute","useState","t","router","t1","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 {\n Button,\n LoadingOverlay,\n toast,\n useAuth,\n useRouteTransition,\n useTranslation,\n} from '@payloadcms/ui'\nimport { useRouter } from 'next/navigation.js'\nimport { formatAdminURL } from 'payload/shared'\nimport React, { useEffect } from 'react'\n\nimport './index.scss'\n\nconst baseClass = 'logout'\n\n/**\n * This component should **just** be the inactivity route and do nothing with logging the user out.\n *\n * It currently handles too much, the auth provider should just log the user out and then\n * we could remove the useEffect in this file. So instead of the logout button\n * being an anchor link, it should be a button that calls `logOut` in the provider.\n *\n * This view is still useful if cookies attempt to refresh and fail, i.e. the user\n * is logged out due to inactivity.\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\n const { startRouteTransition } = useRouteTransition()\n\n const isLoggedIn = React.useMemo(() => {\n return Boolean(user?.id)\n }, [user?.id])\n\n const navigatingToLoginRef = React.useRef(false)\n\n const [loginRoute] = React.useState(() =>\n formatAdminURL({\n adminRoute,\n path: `/login${inactivity && redirect && redirect.length > 0\n ? `?redirect=${encodeURIComponent(redirect)}`\n : ''\n
|
|
1
|
+
{"version":3,"file":"LogoutClient.js","names":["c","_c","Button","LoadingOverlay","toast","useAuth","useConfig","useRouteTransition","useTranslation","useRouter","formatAdminURL","React","useEffect","baseClass","LogoutClient","props","$","adminRoute","inactivity","redirect","logOut","user","config","startRouteTransition","id","isLoggedIn","Boolean","navigatingToLoginRef","useRef","t0","path","length","encodeURIComponent","serverURL","loginRoute","useState","t","router","t1","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 {\n Button,\n LoadingOverlay,\n toast,\n useAuth,\n useConfig,\n useRouteTransition,\n useTranslation,\n} from '@payloadcms/ui'\nimport { useRouter } from 'next/navigation.js'\nimport { formatAdminURL } from 'payload/shared'\nimport React, { useEffect } from 'react'\n\nimport './index.scss'\n\nconst baseClass = 'logout'\n\n/**\n * This component should **just** be the inactivity route and do nothing with logging the user out.\n *\n * It currently handles too much, the auth provider should just log the user out and then\n * we could remove the useEffect in this file. So instead of the logout button\n * being an anchor link, it should be a button that calls `logOut` in the provider.\n *\n * This view is still useful if cookies attempt to refresh and fail, i.e. the user\n * is logged out due to inactivity.\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 { config } = useConfig()\n\n const { startRouteTransition } = useRouteTransition()\n\n const isLoggedIn = React.useMemo(() => {\n return Boolean(user?.id)\n }, [user?.id])\n\n const navigatingToLoginRef = React.useRef(false)\n\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 serverURL: config.serverURL,\n }),\n )\n\n const { t } = useTranslation()\n const router = useRouter()\n\n const handleLogOut = React.useCallback(async () => {\n if (!navigatingToLoginRef.current) {\n navigatingToLoginRef.current = true\n await logOut()\n toast.success(t('authentication:loggedOutSuccessfully'))\n startRouteTransition(() => router.push(loginRoute))\n return\n }\n }, [logOut, loginRoute, router, startRouteTransition, t])\n\n useEffect(() => {\n if (isLoggedIn && !inactivity) {\n void handleLogOut()\n } else if (!navigatingToLoginRef.current) {\n navigatingToLoginRef.current = true\n startRouteTransition(() => router.push(loginRoute))\n }\n }, [handleLogOut, isLoggedIn, loginRoute, router, startRouteTransition, inactivity])\n\n if (!isLoggedIn && inactivity) {\n return (\n <div className={`${baseClass}__wrap`}>\n <h2>{t('authentication:loggedOutInactivity')}</h2>\n <Button buttonStyle=\"secondary\" el=\"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,SACEC,MAAM,EACNC,cAAc,EACdC,KAAK,EACLC,OAAO,EACPC,SAAS,EACTC,kBAAkB,EAClBC,cAAc,QACT;AACP,SAASC,SAAS,QAAQ;AAC1B,SAASC,cAAc,QAAQ;AAC/B,OAAOC,KAAA,IAASC,SAAS,QAAQ;AAIjC,MAAMC,SAAA,GAAY;AAElB;;;;;;;;;;AAUA,OAAO,MAAMC,YAAA,GAIRC,KAAA;EAAA,MAAAC,CAAA,GAAAf,EAAA;EACH;IAAAgB,UAAA;IAAAC,UAAA;IAAAC;EAAA,IAA6CJ,KAAA;EAE7C;IAAAK,MAAA;IAAAC;EAAA,IAAyBhB,OAAA;EACzB;IAAAiB;EAAA,IAAmBhB,SAAA;EAEnB;IAAAiB;EAAA,IAAiChB,kBAAA;EAI7Bc,IAAA,EAAAG,EAAA;EAFJ,MAAAC,UAAA,GACSC,OAAA,CAAQL,IAAA,EAAAG,EAAM;EAGvB,MAAAG,oBAAA,GAA6BhB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C,GACPa,IAAA,CAAA/C,MAAA;UAAAgD,WAAA,EAAoB;UAAAC,EAAA,EAAe;UAAAC,IAAA,EAAY;UAAAC,GAAA,EAAanB,UAAA;UAAAc,QAAA,EACzDZ,CAAA,CAAE;QAAA,C;;;;;;;;WAHPS,E;;;;IASGA,EAAA,GAAAI,IAAA,CAAA9C,cAAA;MAAAmD,iBAAA,EAAmC;MAAAC,WAAA,EAAoBnB,CAAA,CAAE;IAAA,C;;;;;;SAAzDS,E;CACT","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/views/NotFound/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,MAAM,CAAA;AACpC,OAAO,KAAK,EAAE,oBAAoB,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAI/E,OAAO,KAAK,MAAM,OAAO,CAAA;AAQzB,eAAO,MAAM,4BAA4B,+BAEtC;IACD,MAAM,EAAE,OAAO,CAAC,eAAe,CAAC,GAAG,eAAe,CAAA;IAClD,MAAM,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,EAAE,CAAA;KAAE,CAAA;CAC9C,KAAG,OAAO,CAAC,QAAQ,CAUnB,CAAA;AAED,eAAO,MAAM,YAAY,oGAKtB;IACD,MAAM,EAAE,OAAO,CAAC,eAAe,CAAC,CAAA;IAChC,SAAS,EAAE,SAAS,CAAA;IACpB,MAAM,EAAE,OAAO,CAAC;QACd,QAAQ,EAAE,MAAM,EAAE,CAAA;KACnB,CAAC,CAAA;IACF,YAAY,EAAE,OAAO,CAAC;QACpB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,EAAE,CAAA;KACjC,CAAC,CAAA;CACH,+
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/views/NotFound/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,MAAM,CAAA;AACpC,OAAO,KAAK,EAAE,oBAAoB,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAI/E,OAAO,KAAK,MAAM,OAAO,CAAA;AAQzB,eAAO,MAAM,4BAA4B,+BAEtC;IACD,MAAM,EAAE,OAAO,CAAC,eAAe,CAAC,GAAG,eAAe,CAAA;IAClD,MAAM,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,EAAE,CAAA;KAAE,CAAA;CAC9C,KAAG,OAAO,CAAC,QAAQ,CAUnB,CAAA;AAED,eAAO,MAAM,YAAY,oGAKtB;IACD,MAAM,EAAE,OAAO,CAAC,eAAe,CAAC,CAAA;IAChC,SAAS,EAAE,SAAS,CAAA;IACpB,MAAM,EAAE,OAAO,CAAC;QACd,QAAQ,EAAE,MAAM,EAAE,CAAA;KACnB,CAAC,CAAA;IACF,YAAY,EAAE,OAAO,CAAC;QACpB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,EAAE,CAAA;KACjC,CAAC,CAAA;CACH,+BAkDA,CAAA;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,oBAAoB,qBAEvD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["formatAdminURL","qs","React","DefaultTemplate","getNextRequestI18n","getVisibleEntities","initReq","NotFoundClient","generateNotFoundViewMetadata","config","configPromise","i18n","title","t","NotFoundPage","importMap","params","paramsPromise","searchParams","searchParamsPromise","routes","admin","adminRoute","queryString","stringify","addQueryPrefix","locale","permissions","req","payload","key","overrides","fallbackLocale","query","parse","depth","ignoreQueryPrefix","urlSuffix","path","user","canAccessAdmin","_jsx","visibleEntities","NotFoundView","props","marginTop"],"sources":["../../../src/views/NotFound/index.tsx"],"sourcesContent":["import type { Metadata } from 'next'\nimport type { AdminViewServerProps, ImportMap, SanitizedConfig } from 'payload'\n\nimport { formatAdminURL } from 'payload/shared'\nimport * as qs from 'qs-esm'\nimport React from 'react'\n\nimport { DefaultTemplate } from '../../templates/Default/index.js'\nimport { getNextRequestI18n } from '../../utilities/getNextRequestI18n.js'\nimport { getVisibleEntities } from '../../utilities/getVisibleEntities.js'\nimport { initReq } from '../../utilities/initReq.js'\nimport { NotFoundClient } from './index.client.js'\n\nexport const generateNotFoundViewMetadata = async ({\n config: configPromise,\n}: {\n config: Promise<SanitizedConfig> | SanitizedConfig\n params?: { [key: string]: string | string[] }\n}): Promise<Metadata> => {\n const config = await configPromise\n\n const i18n = await getNextRequestI18n({\n config,\n })\n\n return {\n title: i18n.t('general:notFound'),\n }\n}\n\nexport const NotFoundPage = async ({\n config: configPromise,\n importMap,\n params: paramsPromise,\n searchParams: searchParamsPromise,\n}: {\n config: Promise<SanitizedConfig>\n importMap: ImportMap\n params: Promise<{\n segments: string[]\n }>\n searchParams: Promise<{\n [key: string]: string | string[]\n }>\n}) => {\n const config = await configPromise\n const { routes: { admin: adminRoute } = {} } = config\n\n const searchParams = await searchParamsPromise\n const queryString = `${qs.stringify(searchParams ?? {}, { addQueryPrefix: true })}`\n const {\n locale,\n permissions,\n req,\n req: { payload },\n } = await initReq({\n configPromise: config,\n importMap,\n key: 'RootLayout',\n overrides: {\n fallbackLocale: false,\n req: {\n query: qs.parse(queryString, {\n depth: 10,\n ignoreQueryPrefix: true,\n }),\n },\n urlSuffix: `${formatAdminURL({ adminRoute, path: '/not-found' })}${searchParams ? queryString : ''}`,\n },\n })\n\n if (!req.user || !permissions.canAccessAdmin) {\n return <NotFoundClient />\n }\n\n const params = await paramsPromise\n const visibleEntities = getVisibleEntities({ req })\n\n return (\n <DefaultTemplate\n i18n={req.i18n}\n locale={locale}\n params={params}\n payload={payload}\n permissions={permissions}\n searchParams={searchParams}\n user={req.user}\n visibleEntities={visibleEntities}\n >\n <NotFoundClient />\n </DefaultTemplate>\n )\n}\n\nexport function NotFoundView(props: AdminViewServerProps) {\n return <NotFoundClient marginTop=\"large\" />\n}\n"],"mappings":";AAGA,SAASA,cAAc,QAAQ;AAC/B,YAAYC,EAAA,MAAQ;AACpB,OAAOC,KAAA,MAAW;AAElB,SAASC,eAAe,QAAQ;AAChC,SAASC,kBAAkB,QAAQ;AACnC,SAASC,kBAAkB,QAAQ;AACnC,SAASC,OAAO,QAAQ;AACxB,SAASC,cAAc,QAAQ;AAE/B,OAAO,MAAMC,4BAAA,GAA+B,MAAAA,CAAO;EACjDC,MAAA,EAAQC;AAAa,CAItB;EACC,MAAMD,MAAA,GAAS,MAAMC,aAAA;EAErB,MAAMC,IAAA,GAAO,MAAMP,kBAAA,CAAmB;IACpCK;EACF;EAEA,OAAO;IACLG,KAAA,EAAOD,IAAA,CAAKE,CAAC,CAAC;EAChB;AACF;AAEA,OAAO,MAAMC,YAAA,GAAe,MAAAA,CAAO;EACjCL,MAAA,EAAQC,aAAa;EACrBK,SAAS;EACTC,MAAA,EAAQC,aAAa;EACrBC,YAAA,EAAcC;AAAmB,CAUlC;EACC,MAAMV,MAAA,GAAS,MAAMC,aAAA;EACrB,MAAM;IAAEU,MAAA,EAAQ;MAAEC,KAAA,EAAOC;IAAU,CAAE,GAAG,CAAC;EAAC,CAAE,GAAGb,MAAA;EAE/C,MAAMS,YAAA,GAAe,MAAMC,mBAAA;EAC3B,MAAMI,WAAA,GAAc,GAAGtB,EAAA,CAAGuB,SAAS,CAACN,YAAA,IAAgB,CAAC,GAAG;IAAEO,cAAA,EAAgB;EAAK,IAAI;
|
|
1
|
+
{"version":3,"file":"index.js","names":["formatAdminURL","qs","React","DefaultTemplate","getNextRequestI18n","getVisibleEntities","initReq","NotFoundClient","generateNotFoundViewMetadata","config","configPromise","i18n","title","t","NotFoundPage","importMap","params","paramsPromise","searchParams","searchParamsPromise","routes","admin","adminRoute","queryString","stringify","addQueryPrefix","locale","permissions","req","payload","key","overrides","fallbackLocale","query","parse","depth","ignoreQueryPrefix","urlSuffix","path","user","canAccessAdmin","_jsx","visibleEntities","NotFoundView","props","marginTop"],"sources":["../../../src/views/NotFound/index.tsx"],"sourcesContent":["import type { Metadata } from 'next'\nimport type { AdminViewServerProps, ImportMap, SanitizedConfig } from 'payload'\n\nimport { formatAdminURL } from 'payload/shared'\nimport * as qs from 'qs-esm'\nimport React from 'react'\n\nimport { DefaultTemplate } from '../../templates/Default/index.js'\nimport { getNextRequestI18n } from '../../utilities/getNextRequestI18n.js'\nimport { getVisibleEntities } from '../../utilities/getVisibleEntities.js'\nimport { initReq } from '../../utilities/initReq.js'\nimport { NotFoundClient } from './index.client.js'\n\nexport const generateNotFoundViewMetadata = async ({\n config: configPromise,\n}: {\n config: Promise<SanitizedConfig> | SanitizedConfig\n params?: { [key: string]: string | string[] }\n}): Promise<Metadata> => {\n const config = await configPromise\n\n const i18n = await getNextRequestI18n({\n config,\n })\n\n return {\n title: i18n.t('general:notFound'),\n }\n}\n\nexport const NotFoundPage = async ({\n config: configPromise,\n importMap,\n params: paramsPromise,\n searchParams: searchParamsPromise,\n}: {\n config: Promise<SanitizedConfig>\n importMap: ImportMap\n params: Promise<{\n segments: string[]\n }>\n searchParams: Promise<{\n [key: string]: string | string[]\n }>\n}) => {\n const config = await configPromise\n const { routes: { admin: adminRoute } = {} } = config\n\n const searchParams = await searchParamsPromise\n const queryString = `${qs.stringify(searchParams ?? {}, { addQueryPrefix: true })}`\n\n const {\n locale,\n permissions,\n req,\n req: { payload },\n } = await initReq({\n configPromise: config,\n importMap,\n key: 'RootLayout',\n overrides: {\n fallbackLocale: false,\n req: {\n query: qs.parse(queryString, {\n depth: 10,\n ignoreQueryPrefix: true,\n }),\n },\n // intentionally omit `serverURL` to keep URL relative\n urlSuffix: `${formatAdminURL({ adminRoute, path: '/not-found' })}${searchParams ? queryString : ''}`,\n },\n })\n\n if (!req.user || !permissions.canAccessAdmin) {\n return <NotFoundClient />\n }\n\n const params = await paramsPromise\n const visibleEntities = getVisibleEntities({ req })\n\n return (\n <DefaultTemplate\n i18n={req.i18n}\n locale={locale}\n params={params}\n payload={payload}\n permissions={permissions}\n searchParams={searchParams}\n user={req.user}\n visibleEntities={visibleEntities}\n >\n <NotFoundClient />\n </DefaultTemplate>\n )\n}\n\nexport function NotFoundView(props: AdminViewServerProps) {\n return <NotFoundClient marginTop=\"large\" />\n}\n"],"mappings":";AAGA,SAASA,cAAc,QAAQ;AAC/B,YAAYC,EAAA,MAAQ;AACpB,OAAOC,KAAA,MAAW;AAElB,SAASC,eAAe,QAAQ;AAChC,SAASC,kBAAkB,QAAQ;AACnC,SAASC,kBAAkB,QAAQ;AACnC,SAASC,OAAO,QAAQ;AACxB,SAASC,cAAc,QAAQ;AAE/B,OAAO,MAAMC,4BAAA,GAA+B,MAAAA,CAAO;EACjDC,MAAA,EAAQC;AAAa,CAItB;EACC,MAAMD,MAAA,GAAS,MAAMC,aAAA;EAErB,MAAMC,IAAA,GAAO,MAAMP,kBAAA,CAAmB;IACpCK;EACF;EAEA,OAAO;IACLG,KAAA,EAAOD,IAAA,CAAKE,CAAC,CAAC;EAChB;AACF;AAEA,OAAO,MAAMC,YAAA,GAAe,MAAAA,CAAO;EACjCL,MAAA,EAAQC,aAAa;EACrBK,SAAS;EACTC,MAAA,EAAQC,aAAa;EACrBC,YAAA,EAAcC;AAAmB,CAUlC;EACC,MAAMV,MAAA,GAAS,MAAMC,aAAA;EACrB,MAAM;IAAEU,MAAA,EAAQ;MAAEC,KAAA,EAAOC;IAAU,CAAE,GAAG,CAAC;EAAC,CAAE,GAAGb,MAAA;EAE/C,MAAMS,YAAA,GAAe,MAAMC,mBAAA;EAC3B,MAAMI,WAAA,GAAc,GAAGtB,EAAA,CAAGuB,SAAS,CAACN,YAAA,IAAgB,CAAC,GAAG;IAAEO,cAAA,EAAgB;EAAK,IAAI;EAEnF,MAAM;IACJC,MAAM;IACNC,WAAW;IACXC,GAAG;IACHA,GAAA,EAAK;MAAEC;IAAO;EAAE,CACjB,GAAG,MAAMvB,OAAA,CAAQ;IAChBI,aAAA,EAAeD,MAAA;IACfM,SAAA;IACAe,GAAA,EAAK;IACLC,SAAA,EAAW;MACTC,cAAA,EAAgB;MAChBJ,GAAA,EAAK;QACHK,KAAA,EAAOhC,EAAA,CAAGiC,KAAK,CAACX,WAAA,EAAa;UAC3BY,KAAA,EAAO;UACPC,iBAAA,EAAmB;QACrB;MACF;MACA;MACAC,SAAA,EAAW,GAAGrC,cAAA,CAAe;QAAEsB,UAAA;QAAYgB,IAAA,EAAM;MAAa,KAAKpB,YAAA,GAAeK,WAAA,GAAc;IAClG;EACF;EAEA,IAAI,CAACK,GAAA,CAAIW,IAAI,IAAI,CAACZ,WAAA,CAAYa,cAAc,EAAE;IAC5C,oBAAOC,IAAA,CAAClC,cAAA;EACV;EAEA,MAAMS,MAAA,GAAS,MAAMC,aAAA;EACrB,MAAMyB,eAAA,GAAkBrC,kBAAA,CAAmB;IAAEuB;EAAI;EAEjD,oBACEa,IAAA,CAACtC,eAAA;IACCQ,IAAA,EAAMiB,GAAA,CAAIjB,IAAI;IACde,MAAA,EAAQA,MAAA;IACRV,MAAA,EAAQA,MAAA;IACRa,OAAA,EAASA,OAAA;IACTF,WAAA,EAAaA,WAAA;IACbT,YAAA,EAAcA,YAAA;IACdqB,IAAA,EAAMX,GAAA,CAAIW,IAAI;IACdG,eAAA,EAAiBA,eAAA;cAEjB,aAAAD,IAAA,CAAClC,cAAA;;AAGP;AAEA,OAAO,SAASoC,aAAaC,KAA2B;EACtD,oBAAOH,IAAA,CAAClC,cAAA;IAAesC,SAAA,EAAU;;AACnC","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/views/ResetPassword/ResetPasswordForm/index.tsx"],"names":[],"mappings":"AAcA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,KAAK,IAAI,GAAG;IACV,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;CACvB,CAAA;AAED,eAAO,MAAM,iBAAiB,EAAE,KAAK,CAAC,EAAE,CAAC,IAAI,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/views/ResetPassword/ResetPasswordForm/index.tsx"],"names":[],"mappings":"AAcA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,KAAK,IAAI,GAAG;IACV,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;CACvB,CAAA;AAED,eAAO,MAAM,iBAAiB,EAAE,KAAK,CAAC,EAAE,CAAC,IAAI,CA4E5C,CAAA"}
|
|
@@ -4,10 +4,10 @@ import { c as _c } from "react/compiler-runtime";
|
|
|
4
4
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
5
5
|
import { ConfirmPasswordField, Form, FormSubmit, HiddenField, PasswordField, useAuth, useConfig, useTranslation } from '@payloadcms/ui';
|
|
6
6
|
import { useRouter } from 'next/navigation.js';
|
|
7
|
-
import { formatAdminURL } from 'payload/shared';
|
|
7
|
+
import { formatAdminURL, formatApiURL } from 'payload/shared';
|
|
8
8
|
import React from 'react';
|
|
9
9
|
export const ResetPasswordForm = t0 => {
|
|
10
|
-
const $ = _c(
|
|
10
|
+
const $ = _c(13);
|
|
11
11
|
const {
|
|
12
12
|
token
|
|
13
13
|
} = t0;
|
|
@@ -36,7 +36,7 @@ export const ResetPasswordForm = t0 => {
|
|
|
36
36
|
fetchFullUser
|
|
37
37
|
} = useAuth();
|
|
38
38
|
let t5;
|
|
39
|
-
if ($[0] !== adminRoute || $[1] !== fetchFullUser || $[2] !== history || $[3] !== loginRoute) {
|
|
39
|
+
if ($[0] !== adminRoute || $[1] !== fetchFullUser || $[2] !== history || $[3] !== loginRoute || $[4] !== serverURL) {
|
|
40
40
|
t5 = async () => {
|
|
41
41
|
const user = await fetchFullUser();
|
|
42
42
|
if (user) {
|
|
@@ -44,7 +44,8 @@ export const ResetPasswordForm = t0 => {
|
|
|
44
44
|
} else {
|
|
45
45
|
history.push(formatAdminURL({
|
|
46
46
|
adminRoute,
|
|
47
|
-
path: loginRoute
|
|
47
|
+
path: loginRoute,
|
|
48
|
+
serverURL
|
|
48
49
|
}));
|
|
49
50
|
}
|
|
50
51
|
};
|
|
@@ -52,13 +53,14 @@ export const ResetPasswordForm = t0 => {
|
|
|
52
53
|
$[1] = fetchFullUser;
|
|
53
54
|
$[2] = history;
|
|
54
55
|
$[3] = loginRoute;
|
|
55
|
-
$[4] =
|
|
56
|
+
$[4] = serverURL;
|
|
57
|
+
$[5] = t5;
|
|
56
58
|
} else {
|
|
57
|
-
t5 = $[
|
|
59
|
+
t5 = $[5];
|
|
58
60
|
}
|
|
59
61
|
const onSuccess = t5;
|
|
60
62
|
let t6;
|
|
61
|
-
if ($[
|
|
63
|
+
if ($[6] !== apiRoute || $[7] !== i18n || $[8] !== onSuccess || $[9] !== serverURL || $[10] !== token || $[11] !== userSlug) {
|
|
62
64
|
const initialState = {
|
|
63
65
|
"confirm-password": {
|
|
64
66
|
initialValue: "",
|
|
@@ -77,7 +79,11 @@ export const ResetPasswordForm = t0 => {
|
|
|
77
79
|
}
|
|
78
80
|
};
|
|
79
81
|
t6 = _jsxs(Form, {
|
|
80
|
-
action:
|
|
82
|
+
action: formatApiURL({
|
|
83
|
+
apiRoute,
|
|
84
|
+
path: `/${userSlug}/reset-password`,
|
|
85
|
+
serverURL
|
|
86
|
+
}),
|
|
81
87
|
initialState,
|
|
82
88
|
method: "POST",
|
|
83
89
|
onSuccess,
|
|
@@ -101,15 +107,15 @@ export const ResetPasswordForm = t0 => {
|
|
|
101
107
|
children: i18n.t("authentication:resetPassword")
|
|
102
108
|
})]
|
|
103
109
|
});
|
|
104
|
-
$[
|
|
105
|
-
$[
|
|
106
|
-
$[
|
|
107
|
-
$[
|
|
108
|
-
$[
|
|
109
|
-
$[
|
|
110
|
-
$[
|
|
110
|
+
$[6] = apiRoute;
|
|
111
|
+
$[7] = i18n;
|
|
112
|
+
$[8] = onSuccess;
|
|
113
|
+
$[9] = serverURL;
|
|
114
|
+
$[10] = token;
|
|
115
|
+
$[11] = userSlug;
|
|
116
|
+
$[12] = t6;
|
|
111
117
|
} else {
|
|
112
|
-
t6 = $[
|
|
118
|
+
t6 = $[12];
|
|
113
119
|
}
|
|
114
120
|
return t6;
|
|
115
121
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["c","_c","ConfirmPasswordField","Form","FormSubmit","HiddenField","PasswordField","useAuth","useConfig","useTranslation","useRouter","formatAdminURL","React","ResetPasswordForm","t0","$","token","i18n","config","t1","admin","t2","routes","t3","serverURL","t4","user","userSlug","login","loginRoute","adminRoute","api","apiRoute","history","fetchFullUser","t5","push","path","onSuccess","t6","initialState","initialValue","valid","value","password","_jsxs","action","method","children","className","_jsx","field","name","label","t","required","schemaPath","size"],"sources":["../../../../src/views/ResetPassword/ResetPasswordForm/index.tsx"],"sourcesContent":["'use client'\nimport {\n ConfirmPasswordField,\n Form,\n FormSubmit,\n HiddenField,\n PasswordField,\n useAuth,\n useConfig,\n useTranslation,\n} from '@payloadcms/ui'\nimport { useRouter } from 'next/navigation.js'\nimport { type FormState } from 'payload'\nimport { formatAdminURL } from 'payload/shared'\nimport React from 'react'\n\ntype Args = {\n readonly token: string\n}\n\nexport const ResetPasswordForm: React.FC<Args> = ({ token }) => {\n const i18n = useTranslation()\n const {\n config: {\n admin: {\n routes: { login: loginRoute },\n user: userSlug,\n },\n routes: { admin: adminRoute, api: apiRoute },\n serverURL,\n },\n } = useConfig()\n\n const history = useRouter()\n const { fetchFullUser } = useAuth()\n\n const onSuccess = React.useCallback(async () => {\n const user = await fetchFullUser()\n if (user) {\n history.push(adminRoute)\n } else {\n history.push(\n formatAdminURL({\n adminRoute,\n path: loginRoute,\n }),\n )\n }\n }, [adminRoute, fetchFullUser, history, loginRoute])\n\n const initialState: FormState = {\n 'confirm-password': {\n initialValue: '',\n valid: false,\n value: '',\n },\n password: {\n initialValue: '',\n valid: false,\n value: '',\n },\n token: {\n initialValue: token,\n valid: true,\n value: token,\n },\n }\n\n return (\n <Form\n action={
|
|
1
|
+
{"version":3,"file":"index.js","names":["c","_c","ConfirmPasswordField","Form","FormSubmit","HiddenField","PasswordField","useAuth","useConfig","useTranslation","useRouter","formatAdminURL","formatApiURL","React","ResetPasswordForm","t0","$","token","i18n","config","t1","admin","t2","routes","t3","serverURL","t4","user","userSlug","login","loginRoute","adminRoute","api","apiRoute","history","fetchFullUser","t5","push","path","onSuccess","t6","initialState","initialValue","valid","value","password","_jsxs","action","method","children","className","_jsx","field","name","label","t","required","schemaPath","size"],"sources":["../../../../src/views/ResetPassword/ResetPasswordForm/index.tsx"],"sourcesContent":["'use client'\nimport {\n ConfirmPasswordField,\n Form,\n FormSubmit,\n HiddenField,\n PasswordField,\n useAuth,\n useConfig,\n useTranslation,\n} from '@payloadcms/ui'\nimport { useRouter } from 'next/navigation.js'\nimport { type FormState } from 'payload'\nimport { formatAdminURL, formatApiURL } from 'payload/shared'\nimport React from 'react'\n\ntype Args = {\n readonly token: string\n}\n\nexport const ResetPasswordForm: React.FC<Args> = ({ token }) => {\n const i18n = useTranslation()\n const {\n config: {\n admin: {\n routes: { login: loginRoute },\n user: userSlug,\n },\n routes: { admin: adminRoute, api: apiRoute },\n serverURL,\n },\n } = useConfig()\n\n const history = useRouter()\n const { fetchFullUser } = useAuth()\n\n const onSuccess = React.useCallback(async () => {\n const user = await fetchFullUser()\n if (user) {\n history.push(adminRoute)\n } else {\n history.push(\n formatAdminURL({\n adminRoute,\n path: loginRoute,\n serverURL,\n }),\n )\n }\n }, [adminRoute, fetchFullUser, history, loginRoute, serverURL])\n\n const initialState: FormState = {\n 'confirm-password': {\n initialValue: '',\n valid: false,\n value: '',\n },\n password: {\n initialValue: '',\n valid: false,\n value: '',\n },\n token: {\n initialValue: token,\n valid: true,\n value: token,\n },\n }\n\n return (\n <Form\n action={formatApiURL({\n apiRoute,\n path: `/${userSlug}/reset-password`,\n serverURL,\n })}\n initialState={initialState}\n method=\"POST\"\n onSuccess={onSuccess}\n >\n <div className=\"inputWrap\">\n <PasswordField\n field={{\n name: 'password',\n label: i18n.t('authentication:newPassword'),\n required: true,\n }}\n path=\"password\"\n schemaPath={`${userSlug}.password`}\n />\n <ConfirmPasswordField />\n <HiddenField path=\"token\" schemaPath={`${userSlug}.token`} value={token} />\n </div>\n <FormSubmit size=\"large\">{i18n.t('authentication:resetPassword')}</FormSubmit>\n </Form>\n )\n}\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;;AACA,SACEC,oBAAoB,EACpBC,IAAI,EACJC,UAAU,EACVC,WAAW,EACXC,aAAa,EACbC,OAAO,EACPC,SAAS,EACTC,cAAc,QACT;AACP,SAASC,SAAS,QAAQ;AAE1B,SAASC,cAAc,EAAEC,YAAY,QAAQ;AAC7C,OAAOC,KAAA,MAAW;AAMlB,OAAO,MAAMC,iBAAA,GAAoCC,EAAA;EAAA,MAAAC,CAAA,GAAAf,EAAA;EAAC;IAAAgB;EAAA,IAAAF,EAAS;EACzD,MAAAG,IAAA,GAAaT,cAAA;EACb;IAAAU,MAAA,EAAAC;EAAA,IASIZ,SAAA;EARM;IAAAa,KAAA,EAAAC,EAAA;IAAAC,MAAA,EAAAC,EAAA;IAAAC;EAAA,IAAAL,EAOP;EANQ;IAAAG,MAAA,EAAAG,EAAA;IAAAC,IAAA,EAAAC;EAAA,IAAAN,EAGN;EAFS;IAAAO,KAAA,EAAAC;EAAA,IAAAJ,EAAqB;EAGvB;IAAAL,KAAA,EAAAU,UAAA;IAAAC,GAAA,EAAAC;EAAA,IAAAT,EAAoC;EAKhD,MAAAU,OAAA,GAAgBxB,SAAA;EAChB;IAAAyB;EAAA,IAA0B5B,OAAA;EAAA,IAAA6B,EAAA;EAAA,IAAApB,CAAA,QAAAe,UAAA,IAAAf,CAAA,QAAAmB,aAAA,IAAAnB,CAAA,QAAAkB,OAAA,IAAAlB,CAAA,QAAAc,UAAA,IAAAd,CAAA,QAAAS,SAAA;IAEUW,EAAA,SAAAA,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A,CAAAqC,CAAA,CAAO;YAAAC,QAAA;UAAA;UAAAlB,IAAA,EAGX;UAAAmB,UAAA,EACO,GAAG7B,QAAA;QAAmB,C,GAEpCuB,IAAA,CAAAjD,oBAAA,IAAC,GACDiD,IAAA,CAAA9C,WAAA;UAAAiC,IAAA,EAAkB;UAAAmB,UAAA,EAAoB,GAAG7B,QAAA,QAAgB;UAAAgB,KAAA,EAAS3B;QAAA,C;UAEpEkC,IAAA,CAAA/C,UAAA;QAAAsD,IAAA,EAAiB;QAAAT,QAAA,EAAS/B,IAAA,CAAAqC,CAAA,CAAO;MAAA,C;;;;;;;;;;;;SAvBnCf,E;CA0BJ","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/views/ResetPassword/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAA;AAKnD,OAAO,KAAK,MAAM,OAAO,CAAA;AAIzB,OAAO,cAAc,CAAA;AAErB,eAAO,MAAM,sBAAsB,mBAAmB,CAAA;AAEtD,wBAAgB,aAAa,CAAC,EAAE,cAAc,EAAE,MAAM,EAAE,EAAE,oBAAoB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/views/ResetPassword/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAA;AAKnD,OAAO,KAAK,MAAM,OAAO,CAAA;AAIzB,OAAO,cAAc,CAAA;AAErB,eAAO,MAAM,sBAAsB,mBAAmB,CAAA;AAEtD,wBAAgB,aAAa,CAAC,EAAE,cAAc,EAAE,MAAM,EAAE,EAAE,oBAAoB,qBAqE7E"}
|
|
@@ -45,7 +45,8 @@ export function ResetPassword({
|
|
|
45
45
|
}) => /*#__PURE__*/_jsx(Link, {
|
|
46
46
|
href: formatAdminURL({
|
|
47
47
|
adminRoute,
|
|
48
|
-
path: accountRoute
|
|
48
|
+
path: accountRoute,
|
|
49
|
+
serverURL: config.serverURL
|
|
49
50
|
}),
|
|
50
51
|
prefetch: false,
|
|
51
52
|
children: children
|
|
@@ -73,7 +74,8 @@ export function ResetPassword({
|
|
|
73
74
|
}), /*#__PURE__*/_jsx(Link, {
|
|
74
75
|
href: formatAdminURL({
|
|
75
76
|
adminRoute,
|
|
76
|
-
path: loginRoute
|
|
77
|
+
path: loginRoute,
|
|
78
|
+
serverURL: config.serverURL
|
|
77
79
|
}),
|
|
78
80
|
prefetch: false,
|
|
79
81
|
children: i18n.t('authentication:backToLogin')
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["Button","Link","Translation","formatAdminURL","React","FormHeader","ResetPasswordForm","resetPasswordBaseClass","ResetPassword","initPageResult","params","req","segments","_","token","i18n","payload","config","user","admin","routes","account","accountRoute","login","loginRoute","adminRoute","_jsxs","className","_jsx","description","elements","0","children","href","path","prefetch","i18nKey","t","heading","buttonStyle","el","size","to"],"sources":["../../../src/views/ResetPassword/index.tsx"],"sourcesContent":["import type { AdminViewServerProps } from 'payload'\n\nimport { Button, Link } from '@payloadcms/ui'\nimport { Translation } from '@payloadcms/ui/shared'\nimport { formatAdminURL } from 'payload/shared'\nimport React from 'react'\n\nimport { FormHeader } from '../../elements/FormHeader/index.js'\nimport { ResetPasswordForm } from './ResetPasswordForm/index.js'\nimport './index.scss'\n\nexport const resetPasswordBaseClass = 'reset-password'\n\nexport function ResetPassword({ initPageResult, params }: AdminViewServerProps) {\n const { req } = initPageResult\n\n const {\n segments: [_, token],\n } = params\n\n const {\n i18n,\n payload: { config },\n user,\n } = req\n\n const {\n admin: {\n routes: { account: accountRoute, login: loginRoute },\n },\n routes: { admin: adminRoute },\n } = config\n\n if (user) {\n return (\n <div className={`${resetPasswordBaseClass}__wrap`}>\n <FormHeader\n description={\n <Translation\n elements={{\n '0': ({ children }) => (\n <Link\n href={formatAdminURL({\n adminRoute,\n path: accountRoute,\n })}\n prefetch={false}\n >\n {children}\n </Link>\n ),\n }}\n i18nKey=\"authentication:loggedInChangePassword\"\n t={i18n.t}\n />\n }\n heading={i18n.t('authentication:alreadyLoggedIn')}\n />\n <Button buttonStyle=\"secondary\" el=\"link\" size=\"large\" to={adminRoute}>\n {i18n.t('general:backToDashboard')}\n </Button>\n </div>\n )\n }\n\n return (\n <div className={`${resetPasswordBaseClass}__wrap`}>\n <FormHeader heading={i18n.t('authentication:resetPassword')} />\n <ResetPasswordForm token={token} />\n <Link\n href={formatAdminURL({\n adminRoute,\n path: loginRoute,\n })}\n prefetch={false}\n >\n {i18n.t('authentication:backToLogin')}\n </Link>\n </div>\n )\n}\n"],"mappings":";AAEA,SAASA,MAAM,EAAEC,IAAI,QAAQ;AAC7B,SAASC,WAAW,QAAQ;AAC5B,SAASC,cAAc,QAAQ;AAC/B,OAAOC,KAAA,MAAW;AAElB,SAASC,UAAU,QAAQ;AAC3B,SAASC,iBAAiB,QAAQ;AAGlC,OAAO,MAAMC,sBAAA,GAAyB;AAEtC,OAAO,SAASC,cAAc;EAAEC,cAAc;EAAEC;AAAM,CAAwB;EAC5E,MAAM;IAAEC;EAAG,CAAE,GAAGF,cAAA;EAEhB,MAAM;IACJG,QAAA,EAAU,CAACC,CAAA,EAAGC,KAAA;EAAM,CACrB,GAAGJ,MAAA;EAEJ,MAAM;IACJK,IAAI;IACJC,OAAA,EAAS;MAAEC;IAAM,CAAE;IACnBC;EAAI,CACL,GAAGP,GAAA;EAEJ,MAAM;IACJQ,KAAA,EAAO;MACLC,MAAA,EAAQ;QAAEC,OAAA,EAASC,YAAY;QAAEC,KAAA,EAAOC;MAAU;IAAE,CACrD;IACDJ,MAAA,EAAQ;MAAED,KAAA,EAAOM;IAAU;EAAE,CAC9B,GAAGR,MAAA;EAEJ,IAAIC,IAAA,EAAM;IACR,oBACEQ,KAAA,CAAC;MAAIC,SAAA,EAAW,GAAGpB,sBAAA,QAA8B;8BAC/CqB,IAAA,CAACvB,UAAA;QACCwB,WAAA,eACED,IAAA,CAAC1B,WAAA;UACC4B,QAAA,EAAU;YACR,KAAKC,CAAC;cAAEC;YAAQ,CAAE,kBAChBJ,IAAA,CAAC3B,IAAA;cACCgC,IAAA,EAAM9B,cAAA,CAAe;gBACnBsB,UAAA;gBACAS,IAAA,EAAMZ;
|
|
1
|
+
{"version":3,"file":"index.js","names":["Button","Link","Translation","formatAdminURL","React","FormHeader","ResetPasswordForm","resetPasswordBaseClass","ResetPassword","initPageResult","params","req","segments","_","token","i18n","payload","config","user","admin","routes","account","accountRoute","login","loginRoute","adminRoute","_jsxs","className","_jsx","description","elements","0","children","href","path","serverURL","prefetch","i18nKey","t","heading","buttonStyle","el","size","to"],"sources":["../../../src/views/ResetPassword/index.tsx"],"sourcesContent":["import type { AdminViewServerProps } from 'payload'\n\nimport { Button, Link } from '@payloadcms/ui'\nimport { Translation } from '@payloadcms/ui/shared'\nimport { formatAdminURL } from 'payload/shared'\nimport React from 'react'\n\nimport { FormHeader } from '../../elements/FormHeader/index.js'\nimport { ResetPasswordForm } from './ResetPasswordForm/index.js'\nimport './index.scss'\n\nexport const resetPasswordBaseClass = 'reset-password'\n\nexport function ResetPassword({ initPageResult, params }: AdminViewServerProps) {\n const { req } = initPageResult\n\n const {\n segments: [_, token],\n } = params\n\n const {\n i18n,\n payload: { config },\n user,\n } = req\n\n const {\n admin: {\n routes: { account: accountRoute, login: loginRoute },\n },\n routes: { admin: adminRoute },\n } = config\n\n if (user) {\n return (\n <div className={`${resetPasswordBaseClass}__wrap`}>\n <FormHeader\n description={\n <Translation\n elements={{\n '0': ({ children }) => (\n <Link\n href={formatAdminURL({\n adminRoute,\n path: accountRoute,\n serverURL: config.serverURL,\n })}\n prefetch={false}\n >\n {children}\n </Link>\n ),\n }}\n i18nKey=\"authentication:loggedInChangePassword\"\n t={i18n.t}\n />\n }\n heading={i18n.t('authentication:alreadyLoggedIn')}\n />\n <Button buttonStyle=\"secondary\" el=\"link\" size=\"large\" to={adminRoute}>\n {i18n.t('general:backToDashboard')}\n </Button>\n </div>\n )\n }\n\n return (\n <div className={`${resetPasswordBaseClass}__wrap`}>\n <FormHeader heading={i18n.t('authentication:resetPassword')} />\n <ResetPasswordForm token={token} />\n <Link\n href={formatAdminURL({\n adminRoute,\n path: loginRoute,\n serverURL: config.serverURL,\n })}\n prefetch={false}\n >\n {i18n.t('authentication:backToLogin')}\n </Link>\n </div>\n )\n}\n"],"mappings":";AAEA,SAASA,MAAM,EAAEC,IAAI,QAAQ;AAC7B,SAASC,WAAW,QAAQ;AAC5B,SAASC,cAAc,QAAQ;AAC/B,OAAOC,KAAA,MAAW;AAElB,SAASC,UAAU,QAAQ;AAC3B,SAASC,iBAAiB,QAAQ;AAGlC,OAAO,MAAMC,sBAAA,GAAyB;AAEtC,OAAO,SAASC,cAAc;EAAEC,cAAc;EAAEC;AAAM,CAAwB;EAC5E,MAAM;IAAEC;EAAG,CAAE,GAAGF,cAAA;EAEhB,MAAM;IACJG,QAAA,EAAU,CAACC,CAAA,EAAGC,KAAA;EAAM,CACrB,GAAGJ,MAAA;EAEJ,MAAM;IACJK,IAAI;IACJC,OAAA,EAAS;MAAEC;IAAM,CAAE;IACnBC;EAAI,CACL,GAAGP,GAAA;EAEJ,MAAM;IACJQ,KAAA,EAAO;MACLC,MAAA,EAAQ;QAAEC,OAAA,EAASC,YAAY;QAAEC,KAAA,EAAOC;MAAU;IAAE,CACrD;IACDJ,MAAA,EAAQ;MAAED,KAAA,EAAOM;IAAU;EAAE,CAC9B,GAAGR,MAAA;EAEJ,IAAIC,IAAA,EAAM;IACR,oBACEQ,KAAA,CAAC;MAAIC,SAAA,EAAW,GAAGpB,sBAAA,QAA8B;8BAC/CqB,IAAA,CAACvB,UAAA;QACCwB,WAAA,eACED,IAAA,CAAC1B,WAAA;UACC4B,QAAA,EAAU;YACR,KAAKC,CAAC;cAAEC;YAAQ,CAAE,kBAChBJ,IAAA,CAAC3B,IAAA;cACCgC,IAAA,EAAM9B,cAAA,CAAe;gBACnBsB,UAAA;gBACAS,IAAA,EAAMZ,YAAA;gBACNa,SAAA,EAAWlB,MAAA,CAAOkB;cACpB;cACAC,QAAA,EAAU;wBAETJ;;UAGP;UACAK,OAAA,EAAQ;UACRC,CAAA,EAAGvB,IAAA,CAAKuB;;QAGZC,OAAA,EAASxB,IAAA,CAAKuB,CAAC,CAAC;uBAElBV,IAAA,CAAC5B,MAAA;QAAOwC,WAAA,EAAY;QAAYC,EAAA,EAAG;QAAOC,IAAA,EAAK;QAAQC,EAAA,EAAIlB,UAAA;kBACxDV,IAAA,CAAKuB,CAAC,CAAC;;;EAIhB;EAEA,oBACEZ,KAAA,CAAC;IAAIC,SAAA,EAAW,GAAGpB,sBAAA,QAA8B;4BAC/CqB,IAAA,CAACvB,UAAA;MAAWkC,OAAA,EAASxB,IAAA,CAAKuB,CAAC,CAAC;qBAC5BV,IAAA,CAACtB,iBAAA;MAAkBQ,KAAA,EAAOA;qBAC1Bc,IAAA,CAAC3B,IAAA;MACCgC,IAAA,EAAM9B,cAAA,CAAe;QACnBsB,UAAA;QACAS,IAAA,EAAMV,UAAA;QACNW,SAAA,EAAWlB,MAAA,CAAOkB;MACpB;MACAC,QAAA,EAAU;gBAETrB,IAAA,CAAKuB,CAAC,CAAC;;;AAIhB","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getRouteData.js","names":["parseDocumentID","formatAdminURL","isNumber","AccountView","BrowseByFolder","CollectionFolderView","TrashView","CreateFirstUserView","DashboardView","DocumentView","forgotPasswordBaseClass","ForgotPasswordView","ListView","loginBaseClass","LoginView","LogoutInactivity","LogoutView","ResetPassword","resetPasswordBaseClass","UnauthorizedView","Verify","verifyBaseClass","getSubViewActions","getViewActions","getCustomViewByKey","getCustomViewByRoute","getDocumentViewInfo","isPathMatchingRoute","baseClasses","account","folders","forgot","login","reset","verify","oneSegmentViews","browseByFolder","createFirstUser","inactivity","logout","unauthorized","getRouteData","adminRoute","collectionConfig","collectionPreferences","undefined","currentRoute","globalConfig","payload","segments","config","ViewToRender","templateClassName","templateType","documentSubViewType","viewType","routeParams","segmentOne","segmentTwo","segmentThree","segmentFour","segmentFive","segmentSix","isBrowseByFolderEnabled","browseByFolderSlugs","collections","reduce","acc","slug","viewActions","admin","components","actions","length","Component","viewKey","routes","matchedRoute","Object","entries","find","route","exact","path","customView","view","payloadComponent","folderID","collection","listViewType","push","views","list","global","editConfig","edit","token","id","versionID","viewInfo","collectionOrGlobal","viewKeyArg","folderCollection","collectionSlug","db","defaultIDType","Number","reverse","DefaultView"],"sources":["../../../src/views/Root/getRouteData.ts"],"sourcesContent":["import type {\n AdminViewServerProps,\n CollectionPreferences,\n CollectionSlug,\n CustomComponent,\n DocumentSubViewTypes,\n Payload,\n PayloadComponent,\n SanitizedCollectionConfig,\n SanitizedConfig,\n SanitizedGlobalConfig,\n ViewTypes,\n} from 'payload'\nimport type React from 'react'\n\nimport { parseDocumentID } from 'payload'\nimport { formatAdminURL, isNumber } from 'payload/shared'\n\nimport { AccountView } from '../Account/index.js'\nimport { BrowseByFolder } from '../BrowseByFolder/index.js'\nimport { CollectionFolderView } from '../CollectionFolders/index.js'\nimport { TrashView } from '../CollectionTrash/index.js'\nimport { CreateFirstUserView } from '../CreateFirstUser/index.js'\nimport { DashboardView } from '../Dashboard/index.js'\nimport { DocumentView } from '../Document/index.js'\nimport { forgotPasswordBaseClass, ForgotPasswordView } from '../ForgotPassword/index.js'\nimport { ListView } from '../List/index.js'\nimport { loginBaseClass, LoginView } from '../Login/index.js'\nimport { LogoutInactivity, LogoutView } from '../Logout/index.js'\nimport { ResetPassword, resetPasswordBaseClass } from '../ResetPassword/index.js'\nimport { UnauthorizedView } from '../Unauthorized/index.js'\nimport { Verify, verifyBaseClass } from '../Verify/index.js'\nimport { getSubViewActions, getViewActions } from './attachViewActions.js'\nimport { getCustomViewByKey } from './getCustomViewByKey.js'\nimport { getCustomViewByRoute } from './getCustomViewByRoute.js'\nimport { getDocumentViewInfo } from './getDocumentViewInfo.js'\nimport { isPathMatchingRoute } from './isPathMatchingRoute.js'\n\nconst baseClasses = {\n account: 'account',\n folders: 'folders',\n forgot: forgotPasswordBaseClass,\n login: loginBaseClass,\n reset: resetPasswordBaseClass,\n verify: verifyBaseClass,\n}\n\ntype OneSegmentViews = {\n [K in Exclude<keyof SanitizedConfig['admin']['routes'], 'reset'>]: React.FC<AdminViewServerProps>\n}\n\nexport type ViewFromConfig = {\n Component?: React.FC<AdminViewServerProps>\n payloadComponent?: PayloadComponent<AdminViewServerProps>\n}\n\nconst oneSegmentViews: OneSegmentViews = {\n account: AccountView,\n browseByFolder: BrowseByFolder,\n createFirstUser: CreateFirstUserView,\n forgot: ForgotPasswordView,\n inactivity: LogoutInactivity,\n login: LoginView,\n logout: LogoutView,\n unauthorized: UnauthorizedView,\n}\n\ntype GetRouteDataResult = {\n browseByFolderSlugs: CollectionSlug[]\n collectionConfig?: SanitizedCollectionConfig\n DefaultView: ViewFromConfig\n documentSubViewType?: DocumentSubViewTypes\n globalConfig?: SanitizedGlobalConfig\n routeParams: {\n collection?: string\n folderCollection?: string\n folderID?: number | string\n global?: string\n id?: number | string\n token?: string\n versionID?: number | string\n }\n templateClassName: string\n templateType: 'default' | 'minimal'\n viewActions?: CustomComponent[]\n viewType?: ViewTypes\n}\n\ntype GetRouteDataArgs = {\n adminRoute: string\n collectionConfig?: SanitizedCollectionConfig\n /**\n * User preferences for a collection.\n *\n * These preferences are normally undefined\n * unless the user is on the list view and the\n * collection is folder enabled.\n */\n collectionPreferences?: CollectionPreferences\n currentRoute: string\n globalConfig?: SanitizedGlobalConfig\n payload: Payload\n searchParams: {\n [key: string]: string | string[]\n }\n segments: string[]\n}\n\nexport const getRouteData = ({\n adminRoute,\n collectionConfig,\n collectionPreferences = undefined,\n currentRoute,\n globalConfig,\n payload,\n segments,\n}: GetRouteDataArgs): GetRouteDataResult => {\n const { config } = payload\n let ViewToRender: ViewFromConfig = null\n let templateClassName: string\n let templateType: 'default' | 'minimal' | undefined\n let documentSubViewType: DocumentSubViewTypes\n let viewType: ViewTypes\n const routeParams: GetRouteDataResult['routeParams'] = {}\n\n const [segmentOne, segmentTwo, segmentThree, segmentFour, segmentFive, segmentSix] = segments\n\n const isBrowseByFolderEnabled = config.folders && config.folders.browseByFolder\n const browseByFolderSlugs =\n (isBrowseByFolderEnabled &&\n config.collections.reduce((acc, { slug, folders }) => {\n if (folders && folders.browseByFolder) {\n return [...acc, slug]\n }\n return acc\n }, [])) ||\n []\n\n const viewActions: CustomComponent[] = [...(config?.admin?.components?.actions || [])]\n\n switch (segments.length) {\n case 0: {\n if (currentRoute === adminRoute) {\n ViewToRender = {\n Component: DashboardView,\n }\n templateClassName = 'dashboard'\n templateType = 'default'\n viewType = 'dashboard'\n }\n break\n }\n case 1: {\n // users can override the default routes via `admin.routes` config\n // i.e.{ admin: { routes: { logout: '/sign-out', inactivity: '/idle' }}}\n let viewKey: keyof typeof oneSegmentViews\n\n if (config.admin.routes) {\n const matchedRoute = Object.entries(config.admin.routes).find(([, route]) => {\n return isPathMatchingRoute({\n currentRoute,\n exact: true,\n path: formatAdminURL({ adminRoute, path: route }),\n })\n })\n\n if (matchedRoute) {\n viewKey = matchedRoute[0] as keyof typeof oneSegmentViews\n }\n }\n\n // Check if a custom view is configured for this viewKey\n // First try to get custom view by the known viewKey, then fallback to route matching\n const customView =\n (viewKey && getCustomViewByKey({ config, viewKey })) ||\n getCustomViewByRoute({ config, currentRoute })\n\n if (customView?.view?.payloadComponent || customView?.view?.Component) {\n // User has configured a custom view (either overriding a built-in or a new custom view)\n ViewToRender = customView.view\n\n // If this custom view is overriding a built-in view (viewKey matches a built-in),\n // use the built-in's template settings and viewType\n if (viewKey && oneSegmentViews[viewKey]) {\n viewType = viewKey as ViewTypes\n templateClassName = baseClasses[viewKey] || viewKey\n templateType = 'minimal'\n\n if (viewKey === 'account') {\n templateType = 'default'\n }\n\n if (isBrowseByFolderEnabled && viewKey === 'browseByFolder') {\n templateType = 'default'\n viewType = 'folders'\n }\n }\n } else if (oneSegmentViews[viewKey]) {\n // --> /account\n // --> /create-first-user\n // --> /browse-by-folder\n // --> /forgot\n // --> /login\n // --> /logout\n // --> /logout-inactivity\n // --> /unauthorized\n\n ViewToRender = {\n Component: oneSegmentViews[viewKey],\n }\n\n viewType = viewKey as ViewTypes\n\n templateClassName = baseClasses[viewKey]\n templateType = 'minimal'\n\n if (viewKey === 'account') {\n templateType = 'default'\n }\n\n if (isBrowseByFolderEnabled && viewKey === 'browseByFolder') {\n templateType = 'default'\n viewType = 'folders'\n }\n }\n break\n }\n case 2: {\n if (`/${segmentOne}` === config.admin.routes.reset) {\n // --> /reset/:token\n ViewToRender = {\n Component: ResetPassword,\n }\n templateClassName = baseClasses[segmentTwo]\n templateType = 'minimal'\n viewType = 'reset'\n } else if (\n isBrowseByFolderEnabled &&\n `/${segmentOne}` === config.admin.routes.browseByFolder\n ) {\n // --> /browse-by-folder/:folderID\n routeParams.folderID = segmentTwo\n\n ViewToRender = {\n Component: oneSegmentViews.browseByFolder,\n }\n templateClassName = baseClasses.folders\n templateType = 'default'\n viewType = 'folders'\n } else if (collectionConfig) {\n // --> /collections/:collectionSlug'\n routeParams.collection = collectionConfig.slug\n\n if (\n collectionPreferences?.listViewType &&\n collectionPreferences.listViewType === 'folders'\n ) {\n // Render folder view by default if set in preferences\n ViewToRender = {\n Component: CollectionFolderView,\n }\n\n templateClassName = `collection-folders`\n templateType = 'default'\n viewType = 'collection-folders'\n } else {\n ViewToRender = {\n Component: ListView,\n }\n\n templateClassName = `${segmentTwo}-list`\n templateType = 'default'\n viewType = 'list'\n }\n\n viewActions.push(...(collectionConfig.admin.components?.views?.list?.actions || []))\n } else if (globalConfig) {\n // --> /globals/:globalSlug\n routeParams.global = globalConfig.slug\n\n ViewToRender = {\n Component: DocumentView,\n }\n\n templateClassName = 'global-edit'\n templateType = 'default'\n viewType = 'document'\n\n // add default view actions\n viewActions.push(\n ...getViewActions({\n editConfig: globalConfig.admin?.components?.views?.edit,\n viewKey: 'default',\n }),\n )\n }\n break\n }\n default:\n if (segmentTwo === 'verify') {\n // --> /:collectionSlug/verify/:token\n routeParams.collection = segmentOne\n routeParams.token = segmentThree\n\n ViewToRender = {\n Component: Verify,\n }\n\n templateClassName = 'verify'\n templateType = 'minimal'\n viewType = 'verify'\n } else if (collectionConfig) {\n routeParams.collection = collectionConfig.slug\n\n if (segmentThree === 'trash' && typeof segmentFour === 'string') {\n // --> /collections/:collectionSlug/trash/:id (read-only)\n // --> /collections/:collectionSlug/trash/:id/api\n // --> /collections/:collectionSlug/trash/:id/preview\n // --> /collections/:collectionSlug/trash/:id/versions\n // --> /collections/:collectionSlug/trash/:id/versions/:versionID\n routeParams.id = segmentFour\n routeParams.versionID = segmentSix\n\n ViewToRender = {\n Component: DocumentView,\n }\n\n templateClassName = `collection-default-edit`\n templateType = 'default'\n\n const viewInfo = getDocumentViewInfo([segmentFive, segmentSix])\n viewType = viewInfo.viewType\n documentSubViewType = viewInfo.documentSubViewType\n\n viewActions.push(\n ...getSubViewActions({\n collectionOrGlobal: collectionConfig,\n viewKeyArg: documentSubViewType,\n }),\n )\n } else if (segmentThree === 'trash') {\n // --> /collections/:collectionSlug/trash\n ViewToRender = {\n Component: TrashView,\n }\n\n templateClassName = `${segmentTwo}-trash`\n templateType = 'default'\n viewType = 'trash'\n\n viewActions.push(...(collectionConfig.admin.components?.views?.list?.actions || []))\n } else {\n if (config.folders && segmentThree === config.folders.slug && collectionConfig.folders) {\n // Collection Folder Views\n // --> /collections/:collectionSlug/:folderCollectionSlug\n // --> /collections/:collectionSlug/:folderCollectionSlug/:folderID\n routeParams.folderCollection = segmentThree\n routeParams.folderID = segmentFour\n\n ViewToRender = {\n Component: CollectionFolderView,\n }\n\n templateClassName = `collection-folders`\n templateType = 'default'\n viewType = 'collection-folders'\n\n viewActions.push(...(collectionConfig.admin.components?.views?.list?.actions || []))\n } else {\n // Collection Edit Views\n // --> /collections/:collectionSlug/create\n // --> /collections/:collectionSlug/:id\n // --> /collections/:collectionSlug/:id/api\n // --> /collections/:collectionSlug/:id/versions\n // --> /collections/:collectionSlug/:id/versions/:versionID\n routeParams.id = segmentThree === 'create' ? undefined : segmentThree\n routeParams.versionID = segmentFive\n\n ViewToRender = {\n Component: DocumentView,\n }\n\n templateClassName = `collection-default-edit`\n templateType = 'default'\n\n const viewInfo = getDocumentViewInfo([segmentFour, segmentFive])\n viewType = viewInfo.viewType\n documentSubViewType = viewInfo.documentSubViewType\n\n viewActions.push(\n ...getSubViewActions({\n collectionOrGlobal: collectionConfig,\n viewKeyArg: documentSubViewType,\n }),\n )\n }\n }\n } else if (globalConfig) {\n // Global Edit Views\n // --> /globals/:globalSlug/versions\n // --> /globals/:globalSlug/versions/:versionID\n // --> /globals/:globalSlug/api\n routeParams.global = globalConfig.slug\n routeParams.versionID = segmentFour\n\n ViewToRender = {\n Component: DocumentView,\n }\n\n templateClassName = `global-edit`\n templateType = 'default'\n\n const viewInfo = getDocumentViewInfo([segmentThree, segmentFour])\n viewType = viewInfo.viewType\n documentSubViewType = viewInfo.documentSubViewType\n\n viewActions.push(\n ...getSubViewActions({\n collectionOrGlobal: globalConfig,\n viewKeyArg: documentSubViewType,\n }),\n )\n }\n break\n }\n\n if (!ViewToRender) {\n ViewToRender = getCustomViewByRoute({ config, currentRoute })?.view\n }\n\n if (collectionConfig) {\n if (routeParams.id) {\n routeParams.id = parseDocumentID({\n id: routeParams.id,\n collectionSlug: collectionConfig.slug,\n payload,\n })\n }\n\n if (routeParams.versionID) {\n routeParams.versionID = parseDocumentID({\n id: routeParams.versionID,\n collectionSlug: collectionConfig.slug,\n payload,\n })\n }\n }\n\n if (config.folders && routeParams.folderID) {\n routeParams.folderID = parseDocumentID({\n id: routeParams.folderID,\n collectionSlug: config.folders.slug,\n payload,\n })\n }\n\n if (globalConfig && routeParams.versionID) {\n routeParams.versionID =\n payload.db.defaultIDType === 'number' && isNumber(routeParams.versionID)\n ? Number(routeParams.versionID)\n : routeParams.versionID\n }\n\n if (viewActions.length) {\n viewActions.reverse()\n }\n\n return {\n browseByFolderSlugs,\n collectionConfig,\n DefaultView: ViewToRender,\n documentSubViewType,\n globalConfig,\n routeParams,\n templateClassName,\n templateType,\n viewActions: viewActions.length ? viewActions : undefined,\n viewType,\n }\n}\n"],"mappings":"AAeA,SAASA,eAAe,QAAQ;AAChC,SAASC,cAAc,EAAEC,QAAQ,QAAQ;AAEzC,SAASC,WAAW,QAAQ;AAC5B,SAASC,cAAc,QAAQ;AAC/B,SAASC,oBAAoB,QAAQ;AACrC,SAASC,SAAS,QAAQ;AAC1B,SAASC,mBAAmB,QAAQ;AACpC,SAASC,aAAa,QAAQ;AAC9B,SAASC,YAAY,QAAQ;AAC7B,SAASC,uBAAuB,EAAEC,kBAAkB,QAAQ;AAC5D,SAASC,QAAQ,QAAQ;AACzB,SAASC,cAAc,EAAEC,SAAS,QAAQ;AAC1C,SAASC,gBAAgB,EAAEC,UAAU,QAAQ;AAC7C,SAASC,aAAa,EAAEC,sBAAsB,QAAQ;AACtD,SAASC,gBAAgB,QAAQ;AACjC,SAASC,MAAM,EAAEC,eAAe,QAAQ;AACxC,SAASC,iBAAiB,EAAEC,cAAc,QAAQ;AAClD,SAASC,kBAAkB,QAAQ;AACnC,SAASC,oBAAoB,QAAQ;AACrC,SAASC,mBAAmB,QAAQ;AACpC,SAASC,mBAAmB,QAAQ;AAEpC,MAAMC,WAAA,GAAc;EAClBC,OAAA,EAAS;EACTC,OAAA,EAAS;EACTC,MAAA,EAAQrB,uBAAA;EACRsB,KAAA,EAAOnB,cAAA;EACPoB,KAAA,EAAOf,sBAAA;EACPgB,MAAA,EAAQb;AACV;AAWA,MAAMc,eAAA,GAAmC;EACvCN,OAAA,EAAS1B,WAAA;EACTiC,cAAA,EAAgBhC,cAAA;EAChBiC,eAAA,EAAiB9B,mBAAA;EACjBwB,MAAA,EAAQpB,kBAAA;EACR2B,UAAA,EAAYvB,gBAAA;EACZiB,KAAA,EAAOlB,SAAA;EACPy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WAAA,CAAY0C,SAAS;QACzBK,cAAA,EAAgB5D,gBAAA,CAAiByB,IAAI;QACrCpB;MACF;IACF;EACF;EAEA,IAAIE,MAAA,CAAOpB,OAAO,IAAI0B,WAAA,CAAY+B,QAAQ,EAAE;IAC1C/B,WAAA,CAAY+B,QAAQ,GAAGvF,eAAA,CAAgB;MACrCiG,EAAA,EAAIzC,WAAA,CAAY+B,QAAQ;MACxBgB,cAAA,EAAgBrD,MAAA,CAAOpB,OAAO,CAACsC,IAAI;MACnCpB;IACF;EACF;EAEA,IAAID,YAAA,IAAgBS,WAAA,CAAY0C,SAAS,EAAE;IACzC1C,WAAA,CAAY0C,SAAS,GACnBlD,OAAA,CAAQwD,EAAE,CAACC,aAAa,KAAK,YAAYvG,QAAA,CAASsD,WAAA,CAAY0C,SAAS,IACnEQ,MAAA,CAAOlD,WAAA,CAAY0C,SAAS,IAC5B1C,WAAA,CAAY0C,SAAS;EAC7B;EAEA,IAAI7B,WAAA,CAAYI,MAAM,EAAE;IACtBJ,WAAA,CAAYsC,OAAO;EACrB;EAEA,OAAO;IACL3C,mBAAA;IACArB,gBAAA;IACAiE,WAAA,EAAazD,YAAA;IACbG,mBAAA;IACAP,YAAA;IACAS,WAAA;IACAJ,iBAAA;IACAC,YAAA;IACAgB,WAAA,EAAaA,WAAA,CAAYI,MAAM,GAAGJ,WAAA,GAAcxB,SAAA;IAChDU;EACF;AACF","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"getRouteData.js","names":["parseDocumentID","formatAdminURL","isNumber","AccountView","BrowseByFolder","CollectionFolderView","TrashView","CreateFirstUserView","DashboardView","DocumentView","forgotPasswordBaseClass","ForgotPasswordView","ListView","loginBaseClass","LoginView","LogoutInactivity","LogoutView","ResetPassword","resetPasswordBaseClass","UnauthorizedView","Verify","verifyBaseClass","getSubViewActions","getViewActions","getCustomViewByKey","getCustomViewByRoute","getDocumentViewInfo","isPathMatchingRoute","baseClasses","account","folders","forgot","login","reset","verify","oneSegmentViews","browseByFolder","createFirstUser","inactivity","logout","unauthorized","getRouteData","adminRoute","collectionConfig","collectionPreferences","undefined","currentRoute","globalConfig","payload","segments","config","ViewToRender","templateClassName","templateType","documentSubViewType","viewType","routeParams","segmentOne","segmentTwo","segmentThree","segmentFour","segmentFive","segmentSix","isBrowseByFolderEnabled","browseByFolderSlugs","collections","reduce","acc","slug","viewActions","admin","components","actions","length","Component","viewKey","routes","matchedRoute","Object","entries","find","route","exact","path","serverURL","customView","view","payloadComponent","folderID","collection","listViewType","push","views","list","global","editConfig","edit","token","id","versionID","viewInfo","collectionOrGlobal","viewKeyArg","folderCollection","collectionSlug","db","defaultIDType","Number","reverse","DefaultView"],"sources":["../../../src/views/Root/getRouteData.ts"],"sourcesContent":["import type {\n AdminViewServerProps,\n CollectionPreferences,\n CollectionSlug,\n CustomComponent,\n DocumentSubViewTypes,\n Payload,\n PayloadComponent,\n SanitizedCollectionConfig,\n SanitizedConfig,\n SanitizedGlobalConfig,\n ViewTypes,\n} from 'payload'\nimport type React from 'react'\n\nimport { parseDocumentID } from 'payload'\nimport { formatAdminURL, isNumber } from 'payload/shared'\n\nimport { AccountView } from '../Account/index.js'\nimport { BrowseByFolder } from '../BrowseByFolder/index.js'\nimport { CollectionFolderView } from '../CollectionFolders/index.js'\nimport { TrashView } from '../CollectionTrash/index.js'\nimport { CreateFirstUserView } from '../CreateFirstUser/index.js'\nimport { DashboardView } from '../Dashboard/index.js'\nimport { DocumentView } from '../Document/index.js'\nimport { forgotPasswordBaseClass, ForgotPasswordView } from '../ForgotPassword/index.js'\nimport { ListView } from '../List/index.js'\nimport { loginBaseClass, LoginView } from '../Login/index.js'\nimport { LogoutInactivity, LogoutView } from '../Logout/index.js'\nimport { ResetPassword, resetPasswordBaseClass } from '../ResetPassword/index.js'\nimport { UnauthorizedView } from '../Unauthorized/index.js'\nimport { Verify, verifyBaseClass } from '../Verify/index.js'\nimport { getSubViewActions, getViewActions } from './attachViewActions.js'\nimport { getCustomViewByKey } from './getCustomViewByKey.js'\nimport { getCustomViewByRoute } from './getCustomViewByRoute.js'\nimport { getDocumentViewInfo } from './getDocumentViewInfo.js'\nimport { isPathMatchingRoute } from './isPathMatchingRoute.js'\n\nconst baseClasses = {\n account: 'account',\n folders: 'folders',\n forgot: forgotPasswordBaseClass,\n login: loginBaseClass,\n reset: resetPasswordBaseClass,\n verify: verifyBaseClass,\n}\n\ntype OneSegmentViews = {\n [K in Exclude<keyof SanitizedConfig['admin']['routes'], 'reset'>]: React.FC<AdminViewServerProps>\n}\n\nexport type ViewFromConfig = {\n Component?: React.FC<AdminViewServerProps>\n payloadComponent?: PayloadComponent<AdminViewServerProps>\n}\n\nconst oneSegmentViews: OneSegmentViews = {\n account: AccountView,\n browseByFolder: BrowseByFolder,\n createFirstUser: CreateFirstUserView,\n forgot: ForgotPasswordView,\n inactivity: LogoutInactivity,\n login: LoginView,\n logout: LogoutView,\n unauthorized: UnauthorizedView,\n}\n\ntype GetRouteDataResult = {\n browseByFolderSlugs: CollectionSlug[]\n collectionConfig?: SanitizedCollectionConfig\n DefaultView: ViewFromConfig\n documentSubViewType?: DocumentSubViewTypes\n globalConfig?: SanitizedGlobalConfig\n routeParams: {\n collection?: string\n folderCollection?: string\n folderID?: number | string\n global?: string\n id?: number | string\n token?: string\n versionID?: number | string\n }\n templateClassName: string\n templateType: 'default' | 'minimal'\n viewActions?: CustomComponent[]\n viewType?: ViewTypes\n}\n\ntype GetRouteDataArgs = {\n adminRoute: string\n collectionConfig?: SanitizedCollectionConfig\n /**\n * User preferences for a collection.\n *\n * These preferences are normally undefined\n * unless the user is on the list view and the\n * collection is folder enabled.\n */\n collectionPreferences?: CollectionPreferences\n currentRoute: string\n globalConfig?: SanitizedGlobalConfig\n payload: Payload\n searchParams: {\n [key: string]: string | string[]\n }\n segments: string[]\n}\n\nexport const getRouteData = ({\n adminRoute,\n collectionConfig,\n collectionPreferences = undefined,\n currentRoute,\n globalConfig,\n payload,\n segments,\n}: GetRouteDataArgs): GetRouteDataResult => {\n const { config } = payload\n let ViewToRender: ViewFromConfig = null\n let templateClassName: string\n let templateType: 'default' | 'minimal' | undefined\n let documentSubViewType: DocumentSubViewTypes\n let viewType: ViewTypes\n const routeParams: GetRouteDataResult['routeParams'] = {}\n\n const [segmentOne, segmentTwo, segmentThree, segmentFour, segmentFive, segmentSix] = segments\n\n const isBrowseByFolderEnabled = config.folders && config.folders.browseByFolder\n const browseByFolderSlugs =\n (isBrowseByFolderEnabled &&\n config.collections.reduce((acc, { slug, folders }) => {\n if (folders && folders.browseByFolder) {\n return [...acc, slug]\n }\n return acc\n }, [])) ||\n []\n\n const viewActions: CustomComponent[] = [...(config?.admin?.components?.actions || [])]\n\n switch (segments.length) {\n case 0: {\n if (currentRoute === adminRoute) {\n ViewToRender = {\n Component: DashboardView,\n }\n templateClassName = 'dashboard'\n templateType = 'default'\n viewType = 'dashboard'\n }\n break\n }\n case 1: {\n // users can override the default routes via `admin.routes` config\n // i.e.{ admin: { routes: { logout: '/sign-out', inactivity: '/idle' }}}\n let viewKey: keyof typeof oneSegmentViews\n\n if (config.admin.routes) {\n const matchedRoute = Object.entries(config.admin.routes).find(([, route]) => {\n return isPathMatchingRoute({\n currentRoute,\n exact: true,\n path: formatAdminURL({ adminRoute, path: route, serverURL: config.serverURL }),\n })\n })\n\n if (matchedRoute) {\n viewKey = matchedRoute[0] as keyof typeof oneSegmentViews\n }\n }\n\n // Check if a custom view is configured for this viewKey\n // First try to get custom view by the known viewKey, then fallback to route matching\n const customView =\n (viewKey && getCustomViewByKey({ config, viewKey })) ||\n getCustomViewByRoute({ config, currentRoute })\n\n if (customView?.view?.payloadComponent || customView?.view?.Component) {\n // User has configured a custom view (either overriding a built-in or a new custom view)\n ViewToRender = customView.view\n\n // If this custom view is overriding a built-in view (viewKey matches a built-in),\n // use the built-in's template settings and viewType\n if (viewKey && oneSegmentViews[viewKey]) {\n viewType = viewKey as ViewTypes\n templateClassName = baseClasses[viewKey] || viewKey\n templateType = 'minimal'\n\n if (viewKey === 'account') {\n templateType = 'default'\n }\n\n if (isBrowseByFolderEnabled && viewKey === 'browseByFolder') {\n templateType = 'default'\n viewType = 'folders'\n }\n }\n } else if (oneSegmentViews[viewKey]) {\n // --> /account\n // --> /create-first-user\n // --> /browse-by-folder\n // --> /forgot\n // --> /login\n // --> /logout\n // --> /logout-inactivity\n // --> /unauthorized\n\n ViewToRender = {\n Component: oneSegmentViews[viewKey],\n }\n\n viewType = viewKey as ViewTypes\n\n templateClassName = baseClasses[viewKey]\n templateType = 'minimal'\n\n if (viewKey === 'account') {\n templateType = 'default'\n }\n\n if (isBrowseByFolderEnabled && viewKey === 'browseByFolder') {\n templateType = 'default'\n viewType = 'folders'\n }\n }\n break\n }\n case 2: {\n if (`/${segmentOne}` === config.admin.routes.reset) {\n // --> /reset/:token\n ViewToRender = {\n Component: ResetPassword,\n }\n templateClassName = baseClasses[segmentTwo]\n templateType = 'minimal'\n viewType = 'reset'\n } else if (\n isBrowseByFolderEnabled &&\n `/${segmentOne}` === config.admin.routes.browseByFolder\n ) {\n // --> /browse-by-folder/:folderID\n routeParams.folderID = segmentTwo\n\n ViewToRender = {\n Component: oneSegmentViews.browseByFolder,\n }\n templateClassName = baseClasses.folders\n templateType = 'default'\n viewType = 'folders'\n } else if (collectionConfig) {\n // --> /collections/:collectionSlug'\n routeParams.collection = collectionConfig.slug\n\n if (\n collectionPreferences?.listViewType &&\n collectionPreferences.listViewType === 'folders'\n ) {\n // Render folder view by default if set in preferences\n ViewToRender = {\n Component: CollectionFolderView,\n }\n\n templateClassName = `collection-folders`\n templateType = 'default'\n viewType = 'collection-folders'\n } else {\n ViewToRender = {\n Component: ListView,\n }\n\n templateClassName = `${segmentTwo}-list`\n templateType = 'default'\n viewType = 'list'\n }\n\n viewActions.push(...(collectionConfig.admin.components?.views?.list?.actions || []))\n } else if (globalConfig) {\n // --> /globals/:globalSlug\n routeParams.global = globalConfig.slug\n\n ViewToRender = {\n Component: DocumentView,\n }\n\n templateClassName = 'global-edit'\n templateType = 'default'\n viewType = 'document'\n\n // add default view actions\n viewActions.push(\n ...getViewActions({\n editConfig: globalConfig.admin?.components?.views?.edit,\n viewKey: 'default',\n }),\n )\n }\n break\n }\n default:\n if (segmentTwo === 'verify') {\n // --> /:collectionSlug/verify/:token\n routeParams.collection = segmentOne\n routeParams.token = segmentThree\n\n ViewToRender = {\n Component: Verify,\n }\n\n templateClassName = 'verify'\n templateType = 'minimal'\n viewType = 'verify'\n } else if (collectionConfig) {\n routeParams.collection = collectionConfig.slug\n\n if (segmentThree === 'trash' && typeof segmentFour === 'string') {\n // --> /collections/:collectionSlug/trash/:id (read-only)\n // --> /collections/:collectionSlug/trash/:id/api\n // --> /collections/:collectionSlug/trash/:id/preview\n // --> /collections/:collectionSlug/trash/:id/versions\n // --> /collections/:collectionSlug/trash/:id/versions/:versionID\n routeParams.id = segmentFour\n routeParams.versionID = segmentSix\n\n ViewToRender = {\n Component: DocumentView,\n }\n\n templateClassName = `collection-default-edit`\n templateType = 'default'\n\n const viewInfo = getDocumentViewInfo([segmentFive, segmentSix])\n viewType = viewInfo.viewType\n documentSubViewType = viewInfo.documentSubViewType\n\n viewActions.push(\n ...getSubViewActions({\n collectionOrGlobal: collectionConfig,\n viewKeyArg: documentSubViewType,\n }),\n )\n } else if (segmentThree === 'trash') {\n // --> /collections/:collectionSlug/trash\n ViewToRender = {\n Component: TrashView,\n }\n\n templateClassName = `${segmentTwo}-trash`\n templateType = 'default'\n viewType = 'trash'\n\n viewActions.push(...(collectionConfig.admin.components?.views?.list?.actions || []))\n } else {\n if (config.folders && segmentThree === config.folders.slug && collectionConfig.folders) {\n // Collection Folder Views\n // --> /collections/:collectionSlug/:folderCollectionSlug\n // --> /collections/:collectionSlug/:folderCollectionSlug/:folderID\n routeParams.folderCollection = segmentThree\n routeParams.folderID = segmentFour\n\n ViewToRender = {\n Component: CollectionFolderView,\n }\n\n templateClassName = `collection-folders`\n templateType = 'default'\n viewType = 'collection-folders'\n\n viewActions.push(...(collectionConfig.admin.components?.views?.list?.actions || []))\n } else {\n // Collection Edit Views\n // --> /collections/:collectionSlug/create\n // --> /collections/:collectionSlug/:id\n // --> /collections/:collectionSlug/:id/api\n // --> /collections/:collectionSlug/:id/versions\n // --> /collections/:collectionSlug/:id/versions/:versionID\n routeParams.id = segmentThree === 'create' ? undefined : segmentThree\n routeParams.versionID = segmentFive\n\n ViewToRender = {\n Component: DocumentView,\n }\n\n templateClassName = `collection-default-edit`\n templateType = 'default'\n\n const viewInfo = getDocumentViewInfo([segmentFour, segmentFive])\n viewType = viewInfo.viewType\n documentSubViewType = viewInfo.documentSubViewType\n\n viewActions.push(\n ...getSubViewActions({\n collectionOrGlobal: collectionConfig,\n viewKeyArg: documentSubViewType,\n }),\n )\n }\n }\n } else if (globalConfig) {\n // Global Edit Views\n // --> /globals/:globalSlug/versions\n // --> /globals/:globalSlug/versions/:versionID\n // --> /globals/:globalSlug/api\n routeParams.global = globalConfig.slug\n routeParams.versionID = segmentFour\n\n ViewToRender = {\n Component: DocumentView,\n }\n\n templateClassName = `global-edit`\n templateType = 'default'\n\n const viewInfo = getDocumentViewInfo([segmentThree, segmentFour])\n viewType = viewInfo.viewType\n documentSubViewType = viewInfo.documentSubViewType\n\n viewActions.push(\n ...getSubViewActions({\n collectionOrGlobal: globalConfig,\n viewKeyArg: documentSubViewType,\n }),\n )\n }\n break\n }\n\n if (!ViewToRender) {\n ViewToRender = getCustomViewByRoute({ config, currentRoute })?.view\n }\n\n if (collectionConfig) {\n if (routeParams.id) {\n routeParams.id = parseDocumentID({\n id: routeParams.id,\n collectionSlug: collectionConfig.slug,\n payload,\n })\n }\n\n if (routeParams.versionID) {\n routeParams.versionID = parseDocumentID({\n id: routeParams.versionID,\n collectionSlug: collectionConfig.slug,\n payload,\n })\n }\n }\n\n if (config.folders && routeParams.folderID) {\n routeParams.folderID = parseDocumentID({\n id: routeParams.folderID,\n collectionSlug: config.folders.slug,\n payload,\n })\n }\n\n if (globalConfig && routeParams.versionID) {\n routeParams.versionID =\n payload.db.defaultIDType === 'number' && isNumber(routeParams.versionID)\n ? Number(routeParams.versionID)\n : routeParams.versionID\n }\n\n if (viewActions.length) {\n viewActions.reverse()\n }\n\n return {\n browseByFolderSlugs,\n collectionConfig,\n DefaultView: ViewToRender,\n documentSubViewType,\n globalConfig,\n routeParams,\n templateClassName,\n templateType,\n viewActions: viewActions.length ? viewActions : undefined,\n viewType,\n }\n}\n"],"mappings":"AAeA,SAASA,eAAe,QAAQ;AAChC,SAASC,cAAc,EAAEC,QAAQ,QAAQ;AAEzC,SAASC,WAAW,QAAQ;AAC5B,SAASC,cAAc,QAAQ;AAC/B,SAASC,oBAAoB,QAAQ;AACrC,SAASC,SAAS,QAAQ;AAC1B,SAASC,mBAAmB,QAAQ;AACpC,SAASC,aAAa,QAAQ;AAC9B,SAASC,YAAY,QAAQ;AAC7B,SAASC,uBAAuB,EAAEC,kBAAkB,QAAQ;AAC5D,SAASC,QAAQ,QAAQ;AACzB,SAASC,cAAc,EAAEC,SAAS,QAAQ;AAC1C,SAASC,gBAAgB,EAAEC,UAAU,QAAQ;AAC7C,SAASC,aAAa,EAAEC,sBAAsB,QAAQ;AACtD,SAASC,gBAAgB,QAAQ;AACjC,SAASC,MAAM,EAAEC,eAAe,QAAQ;AACxC,SAASC,iBAAiB,EAAEC,cAAc,QAAQ;AAClD,SAASC,kBAAkB,QAAQ;AACnC,SAASC,oBAAoB,QAAQ;AACrC,SAASC,mBAAmB,QAAQ;AACpC,SAASC,mBAAmB,QAAQ;AAEpC,MAAMC,WAAA,GAAc;EAClBC,OAAA,EAAS;EACTC,OAAA,EAAS;EACTC,MAAA,EAAQrB,uBAAA;EACRsB,KAAA,EAAOnB,cAAA;EACPoB,KAAA,EAAOf,sBAAA;EACPgB,MAAA,EAAQb;AACV;AAWA,MAAMc,eAAA,GAAmC;EACvCN,OAAA,EAAS1B,WAAA;EACTiC,cAAA,EAAgBhC,cAAA;EAChBiC,eAAA,EAAiB9B,mBAAA;EACjBwB,MAA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;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,EAAE,CAAA;KAAE,CAAA;CAC9C,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAA;AAEvB,eAAO,MAAM,QAAQ,oGAKlB;IACD,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC,eAAe,CAAC,CAAA;IACzC,QAAQ,CAAC,SAAS,EAAE,SAAS,CAAA;IAC7B,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;QACvB,QAAQ,EAAE,MAAM,EAAE,CAAA;KACnB,CAAC,CAAA;IACF,QAAQ,CAAC,YAAY,EAAE,OAAO,CAAC;QAC7B,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,EAAE,CAAA;KACjC,CAAC,CAAA;CACH,+BA2TA,CAAA"}
|
package/dist/views/Root/index.js
CHANGED
|
@@ -37,7 +37,8 @@ export const RootPage = async ({
|
|
|
37
37
|
const params = await paramsPromise;
|
|
38
38
|
const currentRoute = formatAdminURL({
|
|
39
39
|
adminRoute,
|
|
40
|
-
path: Array.isArray(params.segments) ? `/${params.segments.join('/')}` : null
|
|
40
|
+
path: Array.isArray(params.segments) ? `/${params.segments.join('/')}` : null,
|
|
41
|
+
serverURL: config.serverURL
|
|
41
42
|
});
|
|
42
43
|
const segments = Array.isArray(params.segments) ? params.segments : [];
|
|
43
44
|
const isCollectionRoute = segments[0] === 'collections';
|
|
@@ -111,7 +112,11 @@ export const RootPage = async ({
|
|
|
111
112
|
ignoreQueryPrefix: true
|
|
112
113
|
})
|
|
113
114
|
},
|
|
114
|
-
|
|
115
|
+
// intentionally omit `serverURL` to keep URL relative
|
|
116
|
+
urlSuffix: `${formatAdminURL({
|
|
117
|
+
adminRoute,
|
|
118
|
+
path: Array.isArray(params.segments) ? `/${params.segments.join('/')}` : null
|
|
119
|
+
})}${searchParams ? queryString : ''}`
|
|
115
120
|
}
|
|
116
121
|
});
|
|
117
122
|
if (!permissions.canAccessAdmin && !isPublicAdminRoute({
|
|
@@ -178,7 +183,8 @@ export const RootPage = async ({
|
|
|
178
183
|
}
|
|
179
184
|
const createFirstUserRoute = formatAdminURL({
|
|
180
185
|
adminRoute,
|
|
181
|
-
path: _createFirstUserRoute
|
|
186
|
+
path: _createFirstUserRoute,
|
|
187
|
+
serverURL: config.serverURL
|
|
182
188
|
});
|
|
183
189
|
const usersCollection = config.collections.find(({
|
|
184
190
|
slug
|