@payloadcms/next 3.0.0-beta.110 → 3.0.0-beta.112

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (150) hide show
  1. package/dist/elements/FormHeader/index.d.ts +9 -0
  2. package/dist/elements/FormHeader/index.d.ts.map +1 -0
  3. package/dist/elements/FormHeader/index.js +20 -0
  4. package/dist/elements/FormHeader/index.js.map +1 -0
  5. package/dist/elements/FormHeader/index.scss +6 -0
  6. package/dist/exports/utilities.d.ts +1 -0
  7. package/dist/exports/utilities.d.ts.map +1 -1
  8. package/dist/exports/utilities.js +1 -0
  9. package/dist/exports/utilities.js.map +1 -1
  10. package/dist/layouts/Root/index.js +6 -6
  11. package/dist/layouts/Root/index.js.map +1 -1
  12. package/dist/prod/styles.css +1 -1
  13. package/dist/routes/rest/auth/login.js +2 -2
  14. package/dist/routes/rest/auth/login.js.map +1 -1
  15. package/dist/routes/rest/auth/logout.d.ts.map +1 -1
  16. package/dist/routes/rest/auth/logout.js +3 -2
  17. package/dist/routes/rest/auth/logout.js.map +1 -1
  18. package/dist/routes/rest/auth/refresh.js +2 -2
  19. package/dist/routes/rest/auth/refresh.js.map +1 -1
  20. package/dist/routes/rest/auth/registerFirstUser.js +2 -2
  21. package/dist/routes/rest/auth/registerFirstUser.js.map +1 -1
  22. package/dist/routes/rest/auth/resetPassword.js +2 -2
  23. package/dist/routes/rest/auth/resetPassword.js.map +1 -1
  24. package/dist/routes/rest/index.d.ts +12 -12
  25. package/dist/routes/rest/index.d.ts.map +1 -1
  26. package/dist/routes/rest/index.js +17 -15
  27. package/dist/routes/rest/index.js.map +1 -1
  28. package/dist/scss/app.scss +166 -162
  29. package/dist/scss/colors.scss +256 -254
  30. package/dist/scss/resets.scss +9 -7
  31. package/dist/scss/toastify.scss +42 -40
  32. package/dist/scss/toasts.scss +105 -103
  33. package/dist/scss/type.scss +80 -79
  34. package/dist/utilities/getNextRequestI18n.js +2 -2
  35. package/dist/utilities/getNextRequestI18n.js.map +1 -1
  36. package/dist/utilities/initPage/handleAdminPage.d.ts +11 -11
  37. package/dist/utilities/initPage/handleAdminPage.d.ts.map +1 -1
  38. package/dist/utilities/initPage/handleAdminPage.js +7 -20
  39. package/dist/utilities/initPage/handleAdminPage.js.map +1 -1
  40. package/dist/utilities/initPage/handleAuthRedirect.d.ts +6 -3
  41. package/dist/utilities/initPage/handleAuthRedirect.d.ts.map +1 -1
  42. package/dist/utilities/initPage/handleAuthRedirect.js +23 -36
  43. package/dist/utilities/initPage/handleAuthRedirect.js.map +1 -1
  44. package/dist/utilities/initPage/index.d.ts +1 -1
  45. package/dist/utilities/initPage/index.d.ts.map +1 -1
  46. package/dist/utilities/initPage/index.js +21 -10
  47. package/dist/utilities/initPage/index.js.map +1 -1
  48. package/dist/utilities/initPage/shared.d.ts +2 -2
  49. package/dist/utilities/initPage/shared.d.ts.map +1 -1
  50. package/dist/utilities/initPage/shared.js +18 -13
  51. package/dist/utilities/initPage/shared.js.map +1 -1
  52. package/dist/utilities/initReq.js +1 -1
  53. package/dist/utilities/initReq.js.map +1 -1
  54. package/dist/views/API/index.scss +98 -96
  55. package/dist/views/Account/Settings/index.scss +37 -35
  56. package/dist/views/CreateFirstUser/index.client.d.ts.map +1 -1
  57. package/dist/views/CreateFirstUser/index.client.js +1 -1
  58. package/dist/views/CreateFirstUser/index.client.js.map +1 -1
  59. package/dist/views/CreateFirstUser/index.scss +13 -11
  60. package/dist/views/Dashboard/Default/index.scss +51 -49
  61. package/dist/views/Edit/Default/Auth/index.scss +56 -54
  62. package/dist/views/Edit/Default/index.js +2 -2
  63. package/dist/views/Edit/Default/index.js.map +1 -1
  64. package/dist/views/Edit/Default/index.scss +15 -13
  65. package/dist/views/ForgotPassword/ForgotPasswordForm/index.d.ts.map +1 -1
  66. package/dist/views/ForgotPassword/ForgotPasswordForm/index.js +9 -11
  67. package/dist/views/ForgotPassword/ForgotPasswordForm/index.js.map +1 -1
  68. package/dist/views/ForgotPassword/index.d.ts.map +1 -1
  69. package/dist/views/ForgotPassword/index.js +6 -6
  70. package/dist/views/ForgotPassword/index.js.map +1 -1
  71. package/dist/views/List/Default/index.scss +136 -134
  72. package/dist/views/LivePreview/IFrame/index.scss +8 -6
  73. package/dist/views/LivePreview/Preview/index.scss +32 -30
  74. package/dist/views/LivePreview/Toolbar/Controls/index.scss +49 -47
  75. package/dist/views/LivePreview/Toolbar/SizeInput/index.scss +11 -9
  76. package/dist/views/LivePreview/Toolbar/index.scss +33 -31
  77. package/dist/views/LivePreview/ToolbarArea/index.scss +5 -3
  78. package/dist/views/LivePreview/index.client.js +2 -2
  79. package/dist/views/LivePreview/index.client.js.map +1 -1
  80. package/dist/views/LivePreview/index.scss +48 -46
  81. package/dist/views/Login/LoginForm/index.js +1 -1
  82. package/dist/views/Login/LoginForm/index.js.map +1 -1
  83. package/dist/views/Login/LoginForm/index.scss +8 -6
  84. package/dist/views/Login/index.scss +8 -6
  85. package/dist/views/Logout/LogoutClient.d.ts.map +1 -1
  86. package/dist/views/Logout/LogoutClient.js +77 -55
  87. package/dist/views/Logout/LogoutClient.js.map +1 -1
  88. package/dist/views/Logout/index.scss +17 -15
  89. package/dist/views/NotFound/index.d.ts +5 -5
  90. package/dist/views/NotFound/index.d.ts.map +1 -1
  91. package/dist/views/NotFound/index.js +4 -2
  92. package/dist/views/NotFound/index.js.map +1 -1
  93. package/dist/views/NotFound/index.scss +38 -36
  94. package/dist/views/ResetPassword/ResetPasswordForm/index.d.ts +7 -0
  95. package/dist/views/ResetPassword/ResetPasswordForm/index.d.ts.map +1 -0
  96. package/dist/views/ResetPassword/{index.client.js → ResetPasswordForm/index.js} +16 -19
  97. package/dist/views/ResetPassword/ResetPasswordForm/index.js.map +1 -0
  98. package/dist/views/ResetPassword/index.d.ts.map +1 -1
  99. package/dist/views/ResetPassword/index.js +17 -10
  100. package/dist/views/ResetPassword/index.js.map +1 -1
  101. package/dist/views/ResetPassword/index.scss +6 -26
  102. package/dist/views/Root/getViewFromConfig.d.ts.map +1 -1
  103. package/dist/views/Root/getViewFromConfig.js +0 -6
  104. package/dist/views/Root/getViewFromConfig.js.map +1 -1
  105. package/dist/views/Root/index.d.ts +5 -5
  106. package/dist/views/Root/index.d.ts.map +1 -1
  107. package/dist/views/Root/index.js +9 -4
  108. package/dist/views/Root/index.js.map +1 -1
  109. package/dist/views/Root/meta.d.ts +5 -5
  110. package/dist/views/Root/meta.d.ts.map +1 -1
  111. package/dist/views/Root/meta.js +2 -1
  112. package/dist/views/Root/meta.js.map +1 -1
  113. package/dist/views/Unauthorized/index.d.ts.map +1 -1
  114. package/dist/views/Unauthorized/index.js +14 -7
  115. package/dist/views/Unauthorized/index.js.map +1 -1
  116. package/dist/views/Unauthorized/index.scss +4 -31
  117. package/dist/views/Verify/index.client.d.ts +7 -0
  118. package/dist/views/Verify/index.client.d.ts.map +1 -0
  119. package/dist/views/Verify/index.client.js +46 -0
  120. package/dist/views/Verify/index.client.js.map +1 -0
  121. package/dist/views/Verify/index.d.ts.map +1 -1
  122. package/dist/views/Verify/index.js +12 -11
  123. package/dist/views/Verify/index.js.map +1 -1
  124. package/dist/views/Verify/index.scss +13 -11
  125. package/dist/views/Version/Default/index.scss +52 -50
  126. package/dist/views/Version/RenderFieldsToDiff/Label/index.scss +5 -3
  127. package/dist/views/Version/RenderFieldsToDiff/fields/Iterable/index.scss +29 -27
  128. package/dist/views/Version/RenderFieldsToDiff/fields/Nested/index.scss +11 -9
  129. package/dist/views/Version/RenderFieldsToDiff/fields/Relationship/index.scss +12 -10
  130. package/dist/views/Version/RenderFieldsToDiff/fields/Select/index.scss +12 -10
  131. package/dist/views/Version/RenderFieldsToDiff/fields/Text/index.scss +12 -10
  132. package/dist/views/Version/RenderFieldsToDiff/index.scss +12 -10
  133. package/dist/views/Version/Restore/index.scss +57 -55
  134. package/dist/views/Version/SelectComparison/index.scss +12 -10
  135. package/dist/views/Version/SelectLocales/index.scss +6 -4
  136. package/dist/views/Version/index.d.ts.map +1 -1
  137. package/dist/views/Version/index.js +2 -0
  138. package/dist/views/Version/index.js.map +1 -1
  139. package/dist/views/Versions/getLatestVersion.d.ts +1 -0
  140. package/dist/views/Versions/getLatestVersion.d.ts.map +1 -1
  141. package/dist/views/Versions/getLatestVersion.js +14 -3
  142. package/dist/views/Versions/getLatestVersion.js.map +1 -1
  143. package/dist/views/Versions/index.d.ts.map +1 -1
  144. package/dist/views/Versions/index.js +2 -0
  145. package/dist/views/Versions/index.js.map +1 -1
  146. package/dist/views/Versions/index.scss +78 -76
  147. package/package.json +9 -9
  148. package/dist/views/ResetPassword/index.client.d.ts +0 -7
  149. package/dist/views/ResetPassword/index.client.d.ts.map +0 -1
  150. package/dist/views/ResetPassword/index.client.js.map +0 -1
@@ -1,140 +1,142 @@
1
1
  @import './styles.scss';
2
2
 
3
- .payload-toast-container {
4
- padding: 0;
5
- margin: 0;
6
-
7
- .payload-toast-close-button {
8
- position: absolute;
9
- order: 3;
10
- left: unset;
11
- inset-inline-end: base(0.8);
12
- top: 50%;
13
- transform: translateY(-50%);
14
- color: var(--theme-elevation-600);
15
- background: unset;
16
- border: none;
17
-
18
- svg {
19
- width: base(0.8);
20
- height: base(0.8);
21
- }
3
+ @layer payload-default {
4
+ .payload-toast-container {
5
+ padding: 0;
6
+ margin: 0;
7
+
8
+ .payload-toast-close-button {
9
+ position: absolute;
10
+ order: 3;
11
+ left: unset;
12
+ inset-inline-end: base(0.8);
13
+ top: 50%;
14
+ transform: translateY(-50%);
15
+ color: var(--theme-elevation-600);
16
+ background: unset;
17
+ border: none;
18
+
19
+ svg {
20
+ width: base(0.8);
21
+ height: base(0.8);
22
+ }
22
23
 
23
- &:hover {
24
- color: var(--theme-elevation-250);
25
- background: none;
26
- }
24
+ &:hover {
25
+ color: var(--theme-elevation-250);
26
+ background: none;
27
+ }
27
28
 
28
- [dir='RTL'] & {
29
- right: unset;
30
- left: 0.5rem;
29
+ [dir='RTL'] & {
30
+ right: unset;
31
+ left: 0.5rem;
32
+ }
31
33
  }
32
- }
33
34
 
34
- .toast-title {
35
- line-height: base(1);
36
- margin-right: base(1);
37
- }
35
+ .toast-title {
36
+ line-height: base(1);
37
+ margin-right: base(1);
38
+ }
38
39
 
39
- .payload-toast-item {
40
- padding: base(0.8);
41
- color: var(--theme-elevation-800);
42
- font-style: normal;
43
- font-weight: 600;
44
- display: flex;
45
- gap: 1rem;
46
- align-items: center;
47
- width: 100%;
48
- border-radius: 4px;
49
- border: 1px solid var(--theme-border-color);
50
- background: var(--theme-input-bg);
51
- box-shadow:
52
- 0px 10px 4px -8px rgba(0, 2, 4, 0.02),
53
- 0px 2px 3px 0px rgba(0, 2, 4, 0.05);
54
-
55
- .toast-content {
56
- transition: opacity 100ms cubic-bezier(0.55, 0.055, 0.675, 0.19);
40
+ .payload-toast-item {
41
+ padding: base(0.8);
42
+ color: var(--theme-elevation-800);
43
+ font-style: normal;
44
+ font-weight: 600;
45
+ display: flex;
46
+ gap: 1rem;
47
+ align-items: center;
57
48
  width: 100%;
58
- }
49
+ border-radius: 4px;
50
+ border: 1px solid var(--theme-border-color);
51
+ background: var(--theme-input-bg);
52
+ box-shadow:
53
+ 0px 10px 4px -8px rgba(0, 2, 4, 0.02),
54
+ 0px 2px 3px 0px rgba(0, 2, 4, 0.05);
59
55
 
60
- &[data-front='false'] {
61
56
  .toast-content {
62
- opacity: 0;
57
+ transition: opacity 100ms cubic-bezier(0.55, 0.055, 0.675, 0.19);
58
+ width: 100%;
63
59
  }
64
- }
65
60
 
66
- &[data-expanded='true'] {
67
- .toast-content {
68
- opacity: 1;
61
+ &[data-front='false'] {
62
+ .toast-content {
63
+ opacity: 0;
64
+ }
69
65
  }
70
- }
71
66
 
72
- .toast-icon {
73
- width: base(0.8);
74
- height: base(0.8);
75
- margin: 0;
76
- display: flex;
77
- align-items: center;
78
- justify-content: center;
67
+ &[data-expanded='true'] {
68
+ .toast-content {
69
+ opacity: 1;
70
+ }
71
+ }
79
72
 
80
- & > * {
81
- width: base(1.2);
82
- height: base(1.2);
73
+ .toast-icon {
74
+ width: base(0.8);
75
+ height: base(0.8);
76
+ margin: 0;
77
+ display: flex;
78
+ align-items: center;
79
+ justify-content: center;
80
+
81
+ & > * {
82
+ width: base(1.2);
83
+ height: base(1.2);
84
+ }
83
85
  }
84
- }
85
86
 
86
- &.toast-warning {
87
- color: var(--theme-warning-800);
88
- border-color: var(--theme-warning-250);
89
- background-color: var(--theme-warning-100);
87
+ &.toast-warning {
88
+ color: var(--theme-warning-800);
89
+ border-color: var(--theme-warning-250);
90
+ background-color: var(--theme-warning-100);
90
91
 
91
- .payload-toast-close-button {
92
- color: var(--theme-warning-600);
92
+ .payload-toast-close-button {
93
+ color: var(--theme-warning-600);
93
94
 
94
- &:hover {
95
- color: var(--theme-warning-250);
95
+ &:hover {
96
+ color: var(--theme-warning-250);
97
+ }
96
98
  }
97
99
  }
98
- }
99
100
 
100
- &.toast-error {
101
- color: var(--theme-error-800);
102
- border-color: var(--theme-error-250);
103
- background-color: var(--theme-error-100);
101
+ &.toast-error {
102
+ color: var(--theme-error-800);
103
+ border-color: var(--theme-error-250);
104
+ background-color: var(--theme-error-100);
104
105
 
105
- .payload-toast-close-button {
106
- color: var(--theme-error-600);
106
+ .payload-toast-close-button {
107
+ color: var(--theme-error-600);
107
108
 
108
- &:hover {
109
- color: var(--theme-error-250);
109
+ &:hover {
110
+ color: var(--theme-error-250);
111
+ }
110
112
  }
111
113
  }
112
- }
113
114
 
114
- &.toast-success {
115
- color: var(--theme-success-800);
116
- border-color: var(--theme-success-250);
117
- background-color: var(--theme-success-100);
115
+ &.toast-success {
116
+ color: var(--theme-success-800);
117
+ border-color: var(--theme-success-250);
118
+ background-color: var(--theme-success-100);
118
119
 
119
- .payload-toast-close-button {
120
- color: var(--theme-success-600);
120
+ .payload-toast-close-button {
121
+ color: var(--theme-success-600);
121
122
 
122
- &:hover {
123
- color: var(--theme-success-250);
123
+ &:hover {
124
+ color: var(--theme-success-250);
125
+ }
124
126
  }
125
127
  }
126
- }
127
128
 
128
- &.toast-info {
129
- color: var(--theme-elevation-800);
130
- border-color: var(--theme-elevation-250);
131
- background-color: var(--theme-elevation-100);
129
+ &.toast-info {
130
+ color: var(--theme-elevation-800);
131
+ border-color: var(--theme-elevation-250);
132
+ background-color: var(--theme-elevation-100);
132
133
 
133
- .payload-toast-close-button {
134
- color: var(--theme-elevation-600);
134
+ .payload-toast-close-button {
135
+ color: var(--theme-elevation-600);
135
136
 
136
- &:hover {
137
- color: var(--theme-elevation-250);
137
+ &:hover {
138
+ color: var(--theme-elevation-250);
139
+ }
138
140
  }
139
141
  }
140
142
  }
@@ -4,106 +4,107 @@
4
4
  /////////////////////////////
5
5
  // HEADINGS
6
6
  /////////////////////////////
7
+ @layer payload-default {
8
+ %h1,
9
+ %h2,
10
+ %h3,
11
+ %h4,
12
+ %h5,
13
+ %h6 {
14
+ font-family: var(--font-body);
15
+ font-weight: 500;
16
+ }
7
17
 
8
- %h1,
9
- %h2,
10
- %h3,
11
- %h4,
12
- %h5,
13
- %h6 {
14
- font-family: var(--font-body);
15
- font-weight: 500;
16
- }
18
+ %h1 {
19
+ margin: 0;
20
+ font-size: base(1.6);
21
+ line-height: base(1.8);
22
+
23
+ @include small-break {
24
+ letter-spacing: -0.5px;
25
+ font-size: base(1.25);
26
+ }
27
+ }
17
28
 
18
- %h1 {
19
- margin: 0;
20
- font-size: base(1.6);
21
- line-height: base(1.8);
29
+ %h2 {
30
+ margin: 0;
31
+ font-size: base(1.3);
32
+ line-height: base(1.6);
22
33
 
23
- @include small-break {
24
- letter-spacing: -0.5px;
25
- font-size: base(1.25);
34
+ @include small-break {
35
+ font-size: base(0.85);
36
+ }
26
37
  }
27
- }
28
38
 
29
- %h2 {
30
- margin: 0;
31
- font-size: base(1.3);
32
- line-height: base(1.6);
39
+ %h3 {
40
+ margin: 0;
41
+ font-size: base(1);
42
+ line-height: base(1.2);
33
43
 
34
- @include small-break {
35
- font-size: base(0.85);
44
+ @include small-break {
45
+ font-size: base(0.65);
46
+ line-height: 1.25;
47
+ }
36
48
  }
37
- }
38
49
 
39
- %h3 {
40
- margin: 0;
41
- font-size: base(1);
42
- line-height: base(1.2);
50
+ %h4 {
51
+ margin: 0;
52
+ font-size: base(0.8);
53
+ line-height: base(1);
54
+ letter-spacing: -0.375px;
55
+ }
43
56
 
44
- @include small-break {
57
+ %h5 {
58
+ margin: 0;
45
59
  font-size: base(0.65);
46
- line-height: 1.25;
60
+ line-height: base(0.8);
47
61
  }
48
- }
49
62
 
50
- %h4 {
51
- margin: 0;
52
- font-size: base(0.8);
53
- line-height: base(1);
54
- letter-spacing: -0.375px;
55
- }
56
-
57
- %h5 {
58
- margin: 0;
59
- font-size: base(0.65);
60
- line-height: base(0.8);
61
- }
63
+ %h6 {
64
+ margin: 0;
65
+ font-size: base(0.6);
66
+ line-height: base(0.8);
67
+ }
62
68
 
63
- %h6 {
64
- margin: 0;
65
- font-size: base(0.6);
66
- line-height: base(0.8);
67
- }
69
+ %small {
70
+ margin: 0;
71
+ font-size: 12px;
72
+ line-height: 20px;
73
+ }
68
74
 
69
- %small {
70
- margin: 0;
71
- font-size: 12px;
72
- line-height: 20px;
73
- }
75
+ /////////////////////////////
76
+ // TYPE STYLES
77
+ /////////////////////////////
74
78
 
75
- /////////////////////////////
76
- // TYPE STYLES
77
- /////////////////////////////
79
+ %large-body {
80
+ font-size: base(0.6);
81
+ line-height: base(1);
82
+ letter-spacing: base(0.02);
78
83
 
79
- %large-body {
80
- font-size: base(0.6);
81
- line-height: base(1);
82
- letter-spacing: base(0.02);
84
+ @include mid-break {
85
+ font-size: base(0.7);
86
+ line-height: base(1);
87
+ }
83
88
 
84
- @include mid-break {
85
- font-size: base(0.7);
86
- line-height: base(1);
89
+ @include small-break {
90
+ font-size: base(0.55);
91
+ line-height: base(0.75);
92
+ }
87
93
  }
88
94
 
89
- @include small-break {
90
- font-size: base(0.55);
91
- line-height: base(0.75);
95
+ %body {
96
+ font-size: $baseline-body-size;
97
+ line-height: $baseline-px;
98
+ font-weight: normal;
99
+ font-family: var(--font-body);
92
100
  }
93
- }
94
-
95
- %body {
96
- font-size: $baseline-body-size;
97
- line-height: $baseline-px;
98
- font-weight: normal;
99
- font-family: var(--font-body);
100
- }
101
101
 
102
- %code {
103
- font-size: base(0.4);
104
- color: var(--theme-elevation-400);
102
+ %code {
103
+ font-size: base(0.4);
104
+ color: var(--theme-elevation-400);
105
105
 
106
- span {
107
- color: var(--theme-elevation-800);
106
+ span {
107
+ color: var(--theme-elevation-800);
108
+ }
108
109
  }
109
110
  }
@@ -14,8 +14,8 @@ export const getNextRequestI18n = async ({
14
14
  context: 'client',
15
15
  language: getRequestLanguage({
16
16
  config,
17
- cookies: cookies(),
18
- headers: headers()
17
+ cookies: await cookies(),
18
+ headers: await headers()
19
19
  })
20
20
  });
21
21
  };
@@ -1 +1 @@
1
- {"version":3,"file":"getNextRequestI18n.js","names":["initI18n","cookies","headers","getRequestLanguage","getNextRequestI18n","config","i18n","context","language"],"sources":["../../src/utilities/getNextRequestI18n.ts"],"sourcesContent":["import type { ClientTranslationsObject, I18nClient } from '@payloadcms/translations'\nimport type { SanitizedConfig } from 'payload'\n\nimport { initI18n } from '@payloadcms/translations'\nimport { cookies, headers } from 'next/headers.js'\n\nimport { getRequestLanguage } from './getRequestLanguage.js'\n\n/**\n * In the context of Next.js, this function initializes the i18n object for the current request.\n *\n * It must be called on the server side, and within the lifecycle of a request since it relies on the request headers and cookies.\n */\nexport const getNextRequestI18n = async <\n // eslint-disable-next-line @typescript-eslint/no-empty-object-type\n TAdditionalTranslations = {},\n TAdditionalClientTranslationKeys extends string = never,\n>({\n config,\n}: {\n config: SanitizedConfig\n}): Promise<\n [TAdditionalClientTranslationKeys] extends [never]\n ? I18nClient\n : TAdditionalTranslations extends object\n ? I18nClient<TAdditionalTranslations, TAdditionalClientTranslationKeys>\n : I18nClient<ClientTranslationsObject, TAdditionalClientTranslationKeys>\n> => {\n return (await initI18n({\n config: config.i18n,\n context: 'client',\n language: getRequestLanguage({ config, cookies: cookies(), headers: headers() }),\n })) as any\n}\n"],"mappings":"AAGA,SAASA,QAAQ,QAAQ;AACzB,SAASC,OAAO,EAAEC,OAAO,QAAQ;AAEjC,SAASC,kBAAkB,QAAQ;AAEnC;;;;;AAKA,OAAO,MAAMC,kBAAA,GAAqB,MAAAA,CAIhC;EACAC;AAAM,CAGP;EAOC,OAAQ,MAAML,QAAA,CAAS;IACrBK,MAAA,EAAQA,MAAA,CAAOC,IAAI;IACnBC,OAAA,EAAS;IACTC,QAAA,EAAUL,kBAAA,CAAmB;MAAEE,MAAA;MAAQJ,OAAA,EAASA,OAAA;MAAWC,OAAA,EAASA,OAAA;IAAU;EAChF;AACF","ignoreList":[]}
1
+ {"version":3,"file":"getNextRequestI18n.js","names":["initI18n","cookies","headers","getRequestLanguage","getNextRequestI18n","config","i18n","context","language"],"sources":["../../src/utilities/getNextRequestI18n.ts"],"sourcesContent":["import type { ClientTranslationsObject, I18nClient } from '@payloadcms/translations'\nimport type { SanitizedConfig } from 'payload'\n\nimport { initI18n } from '@payloadcms/translations'\nimport { cookies, headers } from 'next/headers.js'\n\nimport { getRequestLanguage } from './getRequestLanguage.js'\n\n/**\n * In the context of Next.js, this function initializes the i18n object for the current request.\n *\n * It must be called on the server side, and within the lifecycle of a request since it relies on the request headers and cookies.\n */\nexport const getNextRequestI18n = async <\n // eslint-disable-next-line @typescript-eslint/no-empty-object-type\n TAdditionalTranslations = {},\n TAdditionalClientTranslationKeys extends string = never,\n>({\n config,\n}: {\n config: SanitizedConfig\n}): Promise<\n [TAdditionalClientTranslationKeys] extends [never]\n ? I18nClient\n : TAdditionalTranslations extends object\n ? I18nClient<TAdditionalTranslations, TAdditionalClientTranslationKeys>\n : I18nClient<ClientTranslationsObject, TAdditionalClientTranslationKeys>\n> => {\n return (await initI18n({\n config: config.i18n,\n context: 'client',\n language: getRequestLanguage({ config, cookies: await cookies(), headers: await headers() }),\n })) as any\n}\n"],"mappings":"AAGA,SAASA,QAAQ,QAAQ;AACzB,SAASC,OAAO,EAAEC,OAAO,QAAQ;AAEjC,SAASC,kBAAkB,QAAQ;AAEnC;;;;;AAKA,OAAO,MAAMC,kBAAA,GAAqB,MAAAA,CAIhC;EACAC;AAAM,CAGP;EAOC,OAAQ,MAAML,QAAA,CAAS;IACrBK,MAAA,EAAQA,MAAA,CAAOC,IAAI;IACnBC,OAAA,EAAS;IACTC,QAAA,EAAUL,kBAAA,CAAmB;MAAEE,MAAA;MAAQJ,OAAA,EAAS,MAAMA,OAAA;MAAWC,OAAA,EAAS,MAAMA,OAAA;IAAU;EAC5F;AACF","ignoreList":[]}
@@ -1,16 +1,16 @@
1
- import type { Permissions, SanitizedCollectionConfig, SanitizedConfig, SanitizedGlobalConfig } from 'payload';
2
- export declare const handleAdminPage: ({ adminRoute, config, permissions, route, }: {
1
+ import type { SanitizedCollectionConfig, SanitizedConfig, SanitizedGlobalConfig } from 'payload';
2
+ type Args = {
3
3
  adminRoute: string;
4
4
  config: SanitizedConfig;
5
- permissions: Permissions;
6
5
  route: string;
7
- }) => {
8
- collectionConfig: SanitizedCollectionConfig;
9
- docID: string;
10
- globalConfig: SanitizedGlobalConfig;
11
- } | {
12
- collectionConfig?: undefined;
13
- docID?: undefined;
14
- globalConfig?: undefined;
15
6
  };
7
+ type RouteInfo = {
8
+ collectionConfig?: SanitizedCollectionConfig;
9
+ collectionSlug?: string;
10
+ docID?: string;
11
+ globalConfig?: SanitizedGlobalConfig;
12
+ globalSlug?: string;
13
+ };
14
+ export declare function getRouteInfo({ adminRoute, config, route }: Args): RouteInfo;
15
+ export {};
16
16
  //# sourceMappingURL=handleAdminPage.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"handleAdminPage.d.ts","sourceRoot":"","sources":["../../../src/utilities/initPage/handleAdminPage.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,WAAW,EACX,yBAAyB,EACzB,eAAe,EACf,qBAAqB,EACtB,MAAM,SAAS,CAAA;AAMhB,eAAO,MAAM,eAAe,gDAKzB;IACD,UAAU,EAAE,MAAM,CAAA;IAClB,MAAM,EAAE,eAAe,CAAA;IACvB,WAAW,EAAE,WAAW,CAAA;IACxB,KAAK,EAAE,MAAM,CAAA;CACd;;;;;;;;CAwCA,CAAA"}
1
+ {"version":3,"file":"handleAdminPage.d.ts","sourceRoot":"","sources":["../../../src/utilities/initPage/handleAdminPage.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,yBAAyB,EAAE,eAAe,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAA;AAIhG,KAAK,IAAI,GAAG;IACV,UAAU,EAAE,MAAM,CAAA;IAClB,MAAM,EAAE,eAAe,CAAA;IACvB,KAAK,EAAE,MAAM,CAAA;CACd,CAAA;AACD,KAAK,SAAS,GAAG;IACf,gBAAgB,CAAC,EAAE,yBAAyB,CAAA;IAC5C,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,YAAY,CAAC,EAAE,qBAAqB,CAAA;IACpC,UAAU,CAAC,EAAE,MAAM,CAAA;CACpB,CAAA;AAED,wBAAgB,YAAY,CAAC,EAAE,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,IAAI,GAAG,SAAS,CA8B3E"}
@@ -1,11 +1,9 @@
1
- import { notFound } from 'next/navigation.js';
2
- import { getRouteWithoutAdmin, isAdminAuthRoute, isAdminRoute } from './shared.js';
3
- export const handleAdminPage = ({
1
+ import { getRouteWithoutAdmin, isAdminRoute } from './shared.js';
2
+ export function getRouteInfo({
4
3
  adminRoute,
5
4
  config,
6
- permissions,
7
5
  route
8
- }) => {
6
+ }) {
9
7
  if (isAdminRoute({
10
8
  adminRoute,
11
9
  config,
@@ -24,29 +22,18 @@ export const handleAdminPage = ({
24
22
  let globalConfig;
25
23
  if (collectionSlug) {
26
24
  collectionConfig = config.collections.find(collection => collection.slug === collectionSlug);
27
- if (!collectionConfig) {
28
- notFound();
29
- }
30
25
  }
31
26
  if (globalSlug) {
32
27
  globalConfig = config.globals.find(global => global.slug === globalSlug);
33
- if (!globalConfig) {
34
- notFound();
35
- }
36
- }
37
- if (!permissions.canAccessAdmin && !isAdminAuthRoute({
38
- adminRoute,
39
- config,
40
- route
41
- })) {
42
- notFound();
43
28
  }
44
29
  return {
45
30
  collectionConfig,
31
+ collectionSlug,
46
32
  docID,
47
- globalConfig
33
+ globalConfig,
34
+ globalSlug
48
35
  };
49
36
  }
50
37
  return {};
51
- };
38
+ }
52
39
  //# sourceMappingURL=handleAdminPage.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"handleAdminPage.js","names":["notFound","getRouteWithoutAdmin","isAdminAuthRoute","isAdminRoute","handleAdminPage","adminRoute","config","permissions","route","routeWithoutAdmin","routeSegments","split","filter","Boolean","entityType","entitySlug","createOrID","collectionSlug","undefined","globalSlug","docID","collectionConfig","globalConfig","collections","find","collection","slug","globals","global","canAccessAdmin"],"sources":["../../../src/utilities/initPage/handleAdminPage.ts"],"sourcesContent":["import type {\n Permissions,\n SanitizedCollectionConfig,\n SanitizedConfig,\n SanitizedGlobalConfig,\n} from 'payload'\n\nimport { notFound } from 'next/navigation.js'\n\nimport { getRouteWithoutAdmin, isAdminAuthRoute, isAdminRoute } from './shared.js'\n\nexport const handleAdminPage = ({\n adminRoute,\n config,\n permissions,\n route,\n}: {\n adminRoute: string\n config: SanitizedConfig\n permissions: Permissions\n route: string\n}) => {\n if (isAdminRoute({ adminRoute, config, route })) {\n const routeWithoutAdmin = getRouteWithoutAdmin({ adminRoute, route })\n const routeSegments = routeWithoutAdmin.split('/').filter(Boolean)\n const [entityType, entitySlug, createOrID] = routeSegments\n const collectionSlug = entityType === 'collections' ? entitySlug : undefined\n const globalSlug = entityType === 'globals' ? entitySlug : undefined\n const docID = collectionSlug && createOrID !== 'create' ? createOrID : undefined\n\n let collectionConfig: SanitizedCollectionConfig | undefined\n let globalConfig: SanitizedGlobalConfig | undefined\n\n if (collectionSlug) {\n collectionConfig = config.collections.find((collection) => collection.slug === collectionSlug)\n\n if (!collectionConfig) {\n notFound()\n }\n }\n\n if (globalSlug) {\n globalConfig = config.globals.find((global) => global.slug === globalSlug)\n\n if (!globalConfig) {\n notFound()\n }\n }\n\n if (!permissions.canAccessAdmin && !isAdminAuthRoute({ adminRoute, config, route })) {\n notFound()\n }\n\n return {\n collectionConfig,\n docID,\n globalConfig,\n }\n }\n\n return {}\n}\n"],"mappings":"AAOA,SAASA,QAAQ,QAAQ;AAEzB,SAASC,oBAAoB,EAAEC,gBAAgB,EAAEC,YAAY,QAAQ;AAErE,OAAO,MAAMC,eAAA,GAAkBA,CAAC;EAC9BC,UAAU;EACVC,MAAM;EACNC,WAAW;EACXC;AAAK,CAMN;EACC,IAAIL,YAAA,CAAa;IAAEE,UAAA;IAAYC,MAAA;IAAQE;EAAM,IAAI;IAC/C,MAAMC,iBAAA,GAAoBR,oBAAA,CAAqB;MAAEI,UAAA;MAAYG;IAAM;IACnE,MAAME,aAAA,GAAgBD,iBAAA,CAAkBE,KAAK,CAAC,KAAKC,MAAM,CAACC,OAAA;IAC1D,MAAM,CAACC,UAAA,EAAYC,UAAA,EAAYC,UAAA,CAAW,GAAGN,aAAA;IAC7C,MAAMO,cAAA,GAAiBH,UAAA,KAAe,gBAAgBC,UAAA,GAAaG,SAAA;IACnE,MAAMC,UAAA,GAAaL,UAAA,KAAe,YAAYC,UAAA,GAAaG,SAAA;IAC3D,MAAME,KAAA,GAAQH,cAAA,IAAkBD,UAAA,KAAe,WAAWA,UAAA,GAAaE,SAAA;IAEvE,IAAIG,gBAAA;IACJ,IAAIC,YAAA;IAEJ,IAAIL,cAAA,EAAgB;MAClBI,gBAAA,GAAmBf,MAAA,CAAOiB,WAAW,CAACC,IAAI,CAAEC,UAAA,IAAeA,UAAA,CAAWC,IAAI,KAAKT,cAAA;MAE/E,IAAI,CAACI,gBAAA,EAAkB;QACrBrB,QAAA;MACF;IACF;IAEA,IAAImB,UAAA,EAAY;MACdG,YAAA,GAAehB,MAAA,CAAOqB,OAAO,CAACH,IAAI,CAAEI,MAAA,IAAWA,MAAA,CAAOF,IAAI,KAAKP,UAAA;MAE/D,IAAI,CAACG,YAAA,EAAc;QACjBtB,QAAA;MACF;IACF;IAEA,IAAI,CAACO,WAAA,CAAYsB,cAAc,IAAI,CAAC3B,gBAAA,CAAiB;MAAEG,UAAA;MAAYC,MAAA;MAAQE;IAAM,IAAI;MACnFR,QAAA;IACF;IAEA,OAAO;MACLqB,gBAAA;MACAD,KAAA;MACAE;IACF;EACF;EAEA,OAAO,CAAC;AACV","ignoreList":[]}
1
+ {"version":3,"file":"handleAdminPage.js","names":["getRouteWithoutAdmin","isAdminRoute","getRouteInfo","adminRoute","config","route","routeWithoutAdmin","routeSegments","split","filter","Boolean","entityType","entitySlug","createOrID","collectionSlug","undefined","globalSlug","docID","collectionConfig","globalConfig","collections","find","collection","slug","globals","global"],"sources":["../../../src/utilities/initPage/handleAdminPage.ts"],"sourcesContent":["import type { SanitizedCollectionConfig, SanitizedConfig, SanitizedGlobalConfig } from 'payload'\n\nimport { getRouteWithoutAdmin, isAdminRoute } from './shared.js'\n\ntype Args = {\n adminRoute: string\n config: SanitizedConfig\n route: string\n}\ntype RouteInfo = {\n collectionConfig?: SanitizedCollectionConfig\n collectionSlug?: string\n docID?: string\n globalConfig?: SanitizedGlobalConfig\n globalSlug?: string\n}\n\nexport function getRouteInfo({ adminRoute, config, route }: Args): RouteInfo {\n if (isAdminRoute({ adminRoute, config, route })) {\n const routeWithoutAdmin = getRouteWithoutAdmin({ adminRoute, route })\n const routeSegments = routeWithoutAdmin.split('/').filter(Boolean)\n const [entityType, entitySlug, createOrID] = routeSegments\n const collectionSlug = entityType === 'collections' ? entitySlug : undefined\n const globalSlug = entityType === 'globals' ? entitySlug : undefined\n const docID = collectionSlug && createOrID !== 'create' ? createOrID : undefined\n\n let collectionConfig: SanitizedCollectionConfig | undefined\n let globalConfig: SanitizedGlobalConfig | undefined\n\n if (collectionSlug) {\n collectionConfig = config.collections.find((collection) => collection.slug === collectionSlug)\n }\n\n if (globalSlug) {\n globalConfig = config.globals.find((global) => global.slug === globalSlug)\n }\n\n return {\n collectionConfig,\n collectionSlug,\n docID,\n globalConfig,\n globalSlug,\n }\n }\n\n return {}\n}\n"],"mappings":"AAEA,SAASA,oBAAoB,EAAEC,YAAY,QAAQ;AAenD,OAAO,SAASC,aAAa;EAAEC,UAAU;EAAEC,MAAM;EAAEC;AAAK,CAAQ;EAC9D,IAAIJ,YAAA,CAAa;IAAEE,UAAA;IAAYC,MAAA;IAAQC;EAAM,IAAI;IAC/C,MAAMC,iBAAA,GAAoBN,oBAAA,CAAqB;MAAEG,UAAA;MAAYE;IAAM;IACnE,MAAME,aAAA,GAAgBD,iBAAA,CAAkBE,KAAK,CAAC,KAAKC,MAAM,CAACC,OAAA;IAC1D,MAAM,CAACC,UAAA,EAAYC,UAAA,EAAYC,UAAA,CAAW,GAAGN,aAAA;IAC7C,MAAMO,cAAA,GAAiBH,UAAA,KAAe,gBAAgBC,UAAA,GAAaG,SAAA;IACnE,MAAMC,UAAA,GAAaL,UAAA,KAAe,YAAYC,UAAA,GAAaG,SAAA;IAC3D,MAAME,KAAA,GAAQH,cAAA,IAAkBD,UAAA,KAAe,WAAWA,UAAA,GAAaE,SAAA;IAEvE,IAAIG,gBAAA;IACJ,IAAIC,YAAA;IAEJ,IAAIL,cAAA,EAAgB;MAClBI,gBAAA,GAAmBd,MAAA,CAAOgB,WAAW,CAACC,IAAI,CAAEC,UAAA,IAAeA,UAAA,CAAWC,IAAI,KAAKT,cAAA;IACjF;IAEA,IAAIE,UAAA,EAAY;MACdG,YAAA,GAAef,MAAA,CAAOoB,OAAO,CAACH,IAAI,CAAEI,MAAA,IAAWA,MAAA,CAAOF,IAAI,KAAKP,UAAA;IACjE;IAEA,OAAO;MACLE,gBAAA;MACAJ,cAAA;MACAG,KAAA;MACAE,YAAA;MACAH;IACF;EACF;EAEA,OAAO,CAAC;AACV","ignoreList":[]}
@@ -1,9 +1,12 @@
1
- export declare const handleAuthRedirect: ({ config, redirectUnauthenticatedUser, route, searchParams, }: {
1
+ import type { User } from 'payload';
2
+ type Args = {
2
3
  config: any;
3
- redirectUnauthenticatedUser: boolean | string;
4
4
  route: string;
5
5
  searchParams: {
6
6
  [key: string]: string | string[];
7
7
  };
8
- }) => void;
8
+ user?: User;
9
+ };
10
+ export declare const handleAuthRedirect: ({ config, route, searchParams, user }: Args) => string;
11
+ export {};
9
12
  //# sourceMappingURL=handleAuthRedirect.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"handleAuthRedirect.d.ts","sourceRoot":"","sources":["../../../src/utilities/initPage/handleAuthRedirect.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,kBAAkB,kEAK5B;IACD,MAAM,MAAA;IACN,2BAA2B,EAAE,OAAO,GAAG,MAAM,CAAA;IAC7C,KAAK,EAAE,MAAM,CAAA;IACb,YAAY,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,EAAE,CAAA;KAAE,CAAA;CACnD,SAwCA,CAAA"}
1
+ {"version":3,"file":"handleAuthRedirect.d.ts","sourceRoot":"","sources":["../../../src/utilities/initPage/handleAuthRedirect.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,SAAS,CAAA;AAKnC,KAAK,IAAI,GAAG;IACV,MAAM,MAAA;IACN,KAAK,EAAE,MAAM,CAAA;IACb,YAAY,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,EAAE,CAAA;KAAE,CAAA;IAClD,IAAI,CAAC,EAAE,IAAI,CAAA;CACZ,CAAA;AACD,eAAO,MAAM,kBAAkB,0CAA2C,IAAI,KAAG,MAkChF,CAAA"}
@@ -1,54 +1,41 @@
1
1
  import { formatAdminURL } from '@payloadcms/ui/shared';
2
- import { redirect } from 'next/navigation.js';
3
2
  import * as qs from 'qs-esm';
4
- import { isAdminAuthRoute, isAdminRoute } from './shared.js';
5
3
  export const handleAuthRedirect = ({
6
4
  config,
7
- redirectUnauthenticatedUser,
8
5
  route,
9
- searchParams
6
+ searchParams,
7
+ user
10
8
  }) => {
11
9
  const {
12
10
  admin: {
13
11
  routes: {
14
- login: loginRouteFromConfig
12
+ login: loginRouteFromConfig,
13
+ unauthorized: unauthorizedRoute
15
14
  }
16
15
  },
17
16
  routes: {
18
17
  admin: adminRoute
19
18
  }
20
19
  } = config;
21
- if (!isAdminAuthRoute({
22
- adminRoute,
23
- config,
24
- route
25
- })) {
26
- if (searchParams && 'redirect' in searchParams) {
27
- delete searchParams.redirect;
28
- }
29
- const redirectRoute = encodeURIComponent(route + Object.keys(searchParams ?? {}).length ? `${qs.stringify(searchParams, {
30
- addQueryPrefix: true
31
- })}` : undefined);
32
- const adminLoginRoute = formatAdminURL({
33
- adminRoute,
34
- path: loginRouteFromConfig
35
- });
36
- const customLoginRoute = typeof redirectUnauthenticatedUser === 'string' ? redirectUnauthenticatedUser : undefined;
37
- const loginRoute = isAdminRoute({
38
- adminRoute,
39
- config,
40
- route
41
- }) ? adminLoginRoute : customLoginRoute || loginRouteFromConfig;
42
- const parsedLoginRouteSearchParams = qs.parse(loginRoute.split('?')[1] ?? '');
43
- const searchParamsWithRedirect = `${qs.stringify({
44
- ...parsedLoginRouteSearchParams,
45
- ...(redirectRoute ? {
46
- redirect: redirectRoute
47
- } : {})
48
- }, {
49
- addQueryPrefix: true
50
- })}`;
51
- redirect(`${loginRoute.split('?')[0]}${searchParamsWithRedirect}`);
20
+ if (searchParams && 'redirect' in searchParams) {
21
+ delete searchParams.redirect;
52
22
  }
23
+ const redirectRoute = encodeURIComponent(route + Object.keys(searchParams ?? {}).length ? `${qs.stringify(searchParams, {
24
+ addQueryPrefix: true
25
+ })}` : undefined);
26
+ const redirectTo = formatAdminURL({
27
+ adminRoute,
28
+ path: user ? unauthorizedRoute : loginRouteFromConfig
29
+ });
30
+ const parsedLoginRouteSearchParams = qs.parse(redirectTo.split('?')[1] ?? '');
31
+ const searchParamsWithRedirect = `${qs.stringify({
32
+ ...parsedLoginRouteSearchParams,
33
+ ...(redirectRoute ? {
34
+ redirect: redirectRoute
35
+ } : {})
36
+ }, {
37
+ addQueryPrefix: true
38
+ })}`;
39
+ return `${redirectTo.split('?')[0]}${searchParamsWithRedirect}`;
53
40
  };
54
41
  //# sourceMappingURL=handleAuthRedirect.js.map