@ttoss/react-auth-cognito 2.7.6

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024, Terezinha Tech Operations (ttoss)
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,181 @@
1
+ # @ttoss/react-auth-cognito
2
+
3
+ AWS Cognito authentication module for React applications using AWS Amplify, built on top of `@ttoss/react-auth-core` for provider-agnostic authentication patterns.
4
+
5
+ ## Installation
6
+
7
+ ```shell
8
+ pnpm add @ttoss/react-auth-cognito @ttoss/react-notifications aws-amplify
9
+ ```
10
+
11
+ ## Core Concepts
12
+
13
+ This package provides AWS Cognito-specific implementations of the authentication patterns defined in `@ttoss/react-auth-core`. It automatically handles Amplify configuration, auth state management, and integrates with ttoss notification system.
14
+
15
+ **Key Features:**
16
+
17
+ - AWS Cognito authentication with Amplify
18
+ - Automatic auth state synchronization
19
+ - Built-in error handling and notifications
20
+ - TypeScript support with full type safety
21
+ - ESM-only package
22
+
23
+ ## Quick Start
24
+
25
+ ### 1. Configure AWS Amplify
26
+
27
+ ```ts
28
+ import { Amplify, type ResourcesConfig } from 'aws-amplify';
29
+
30
+ /**
31
+ * https://docs.amplify.aws/gen1/react/build-a-backend/auth/set-up-auth/
32
+ */
33
+ const authConfig: ResourcesConfig['Auth'] = {
34
+ Cognito: {
35
+ // ... your Cognito config
36
+ },
37
+ };
38
+
39
+ Amplify.configure({ Auth: authConfig });
40
+ ```
41
+
42
+ ### 2. Setup Authentication Provider
43
+
44
+ ```tsx
45
+ import { AuthProvider } from '@ttoss/react-auth-cognito';
46
+ import { NotificationsProvider } from '@ttoss/react-notifications';
47
+
48
+ function App() {
49
+ return (
50
+ <NotificationsProvider>
51
+ <AuthProvider>
52
+ <YourApp />
53
+ </AuthProvider>
54
+ </NotificationsProvider>
55
+ );
56
+ }
57
+ ```
58
+
59
+ ### 3. Use Authentication in Components
60
+
61
+ ```tsx
62
+ import { Auth, useAuth } from '@ttoss/react-auth-cognito';
63
+ import { Navigate } from 'react-router-dom';
64
+
65
+ // Authentication form component
66
+ function LoginPage() {
67
+ return <Auth />;
68
+ }
69
+
70
+ // Authentication form with error handling
71
+ function LoginPageWithErrorHandling() {
72
+ const handleAuthError = (error: Error) => {
73
+ console.error('Authentication error:', error);
74
+ // Custom error handling logic
75
+ };
76
+
77
+ return <Auth onError={handleAuthError} />;
78
+ }
79
+
80
+ // Protected route component
81
+ function PrivateRoute({ children }: { children: React.ReactNode }) {
82
+ const { isAuthenticated } = useAuth();
83
+
84
+ if (!isAuthenticated) {
85
+ return <Navigate to="/login" />;
86
+ }
87
+
88
+ return <>{children}</>;
89
+ }
90
+
91
+ // Using auth state
92
+ function UserProfile() {
93
+ const { user, signOut } = useAuth();
94
+
95
+ return (
96
+ <div>
97
+ <h1>Welcome, {user?.email}</h1>
98
+ <button onClick={signOut}>Sign Out</button>
99
+ </div>
100
+ );
101
+ }
102
+ ```
103
+
104
+ ## API Reference
105
+
106
+ ### `<Auth />`
107
+
108
+ The main authentication component that renders sign-in, sign-up, and password recovery flows.
109
+
110
+ **Props:**
111
+
112
+ - `signUpTerms?: React.ReactNode` - Optional terms and conditions to display during sign-up
113
+ - `logo?: React.ReactNode` - Optional logo to display in the authentication form
114
+ - `layout?: 'default' | 'centered'` - Layout style for the authentication form
115
+ - `onError?: (error: Error) => void` - Callback function invoked when authentication errors occur. Receives the error object from failed authentication operations (sign-in, sign-up, password reset, etc.)
116
+
117
+ **Example:**
118
+
119
+ ```tsx
120
+ <Auth
121
+ logo={<img src="/logo.png" alt="Logo" />}
122
+ signUpTerms={<p>By signing up, you agree to our Terms of Service</p>}
123
+ onError={(error) => {
124
+ console.error('Auth error:', error);
125
+ // Send to error tracking service
126
+ }}
127
+ />
128
+ ```
129
+
130
+ ### `useAuth()`
131
+
132
+ Returns authentication state and methods:
133
+
134
+ ```tsx
135
+ const {
136
+ user, // Current user data or null
137
+ isAuthenticated, // Boolean authentication status
138
+ signOut, // Function to sign out user
139
+ } = useAuth();
140
+ ```
141
+
142
+ ### `getAuthData(options?)`
143
+
144
+ Retrieve current authentication data programmatically:
145
+
146
+ ```tsx
147
+ import { getAuthData } from '@ttoss/react-auth-cognito';
148
+
149
+ const authData = await getAuthData({ includeTokens: true });
150
+ ```
151
+
152
+ ### `checkAuth()`
153
+
154
+ Check if user is currently authenticated:
155
+
156
+ ```tsx
157
+ import { checkAuth } from '@ttoss/react-auth-cognito';
158
+
159
+ const isAuthenticated = await checkAuth();
160
+ ```
161
+
162
+ ## Storage Configuration
163
+
164
+ Configure token storage mechanism using Amplify's storage options:
165
+
166
+ ```ts
167
+ import { cognitoUserPoolsTokenProvider } from 'aws-amplify/auth/cognito';
168
+ import { CookieStorage, sessionStorage } from 'aws-amplify/utils';
169
+
170
+ // Cookie storage (recommended for production)
171
+ cognitoUserPoolsTokenProvider.setKeyValueStorage(
172
+ new CookieStorage({
173
+ domain: '.yourdomain.com',
174
+ secure: true,
175
+ sameSite: 'strict',
176
+ })
177
+ );
178
+
179
+ // Session storage (clears on tab close)
180
+ cognitoUserPoolsTokenProvider.setKeyValueStorage(sessionStorage);
181
+ ```
@@ -0,0 +1,243 @@
1
+ /** Powered by @ttoss/config. https://ttoss.dev/docs/modules/packages/config/ */
2
+ var __defProp = Object.defineProperty;
3
+ var __name = (target, value) => __defProp(target, "name", {
4
+ value,
5
+ configurable: true
6
+ });
7
+
8
+ // src/Auth.tsx
9
+ import { Auth as AuthCore, useAuthScreen } from "@ttoss/react-auth-core";
10
+ import { useI18n } from "@ttoss/react-i18n";
11
+ import { useNotifications } from "@ttoss/react-notifications";
12
+ import { confirmResetPassword, confirmSignUp, resendSignUpCode, resetPassword, signIn, signUp } from "aws-amplify/auth";
13
+ import * as React from "react";
14
+ var Auth = /* @__PURE__ */__name(props => {
15
+ const {
16
+ onError
17
+ } = props;
18
+ const {
19
+ intl
20
+ } = useI18n();
21
+ const {
22
+ screen,
23
+ setScreen
24
+ } = useAuthScreen();
25
+ const {
26
+ addNotification
27
+ } = useNotifications();
28
+ const onSignIn = React.useCallback(async ({
29
+ email,
30
+ password
31
+ }) => {
32
+ try {
33
+ const result = await signIn({
34
+ username: email,
35
+ password
36
+ });
37
+ if (result.nextStep.signInStep === "RESET_PASSWORD") {
38
+ addNotification({
39
+ type: "error",
40
+ message: `For your security, we have updated our system and you need to reset your password in 'forgot your password?' to proceed`
41
+ });
42
+ } else if (result.nextStep.signInStep === "CONFIRM_SIGN_UP") {
43
+ await resendSignUpCode({
44
+ username: email
45
+ });
46
+ setScreen({
47
+ value: "confirmSignUpWithCode",
48
+ context: {
49
+ email
50
+ }
51
+ });
52
+ } else if (result.nextStep.signInStep === "DONE") {
53
+ addNotification({
54
+ viewType: "toast",
55
+ type: "success",
56
+ message: intl.formatMessage({
57
+ id: "EO/33N",
58
+ defaultMessage: [{
59
+ "type": 0,
60
+ "value": "Signed in successfully"
61
+ }]
62
+ })
63
+ });
64
+ }
65
+ } catch (error) {
66
+ onError?.(error);
67
+ addNotification({
68
+ type: "error",
69
+ message: error.message
70
+ });
71
+ }
72
+ }, [addNotification, intl, setScreen, onError]);
73
+ const onSignUp = React.useCallback(async ({
74
+ email,
75
+ password
76
+ }) => {
77
+ try {
78
+ await signUp({
79
+ username: email,
80
+ password,
81
+ options: {
82
+ userAttributes: {
83
+ email
84
+ }
85
+ }
86
+ });
87
+ setScreen({
88
+ value: "confirmSignUpWithCode",
89
+ context: {
90
+ email
91
+ }
92
+ });
93
+ } catch (error) {
94
+ onError?.(error);
95
+ addNotification({
96
+ type: "error",
97
+ message: error.message
98
+ });
99
+ }
100
+ }, [setScreen, addNotification, onError]);
101
+ const onConfirmSignUpWithCode = React.useCallback(async ({
102
+ email,
103
+ code
104
+ }) => {
105
+ try {
106
+ await confirmSignUp({
107
+ confirmationCode: code,
108
+ username: email
109
+ });
110
+ setScreen({
111
+ value: "signIn"
112
+ });
113
+ } catch (error) {
114
+ onError?.(error);
115
+ addNotification({
116
+ type: "error",
117
+ message: error.message
118
+ });
119
+ }
120
+ }, [setScreen, addNotification, onError]);
121
+ const onForgotPassword = React.useCallback(async ({
122
+ email
123
+ }) => {
124
+ try {
125
+ await resetPassword({
126
+ username: email
127
+ });
128
+ setScreen({
129
+ value: "confirmResetPassword",
130
+ context: {
131
+ email
132
+ }
133
+ });
134
+ } catch (error) {
135
+ onError?.(error);
136
+ addNotification({
137
+ type: "error",
138
+ message: error.message
139
+ });
140
+ }
141
+ }, [setScreen, addNotification, onError]);
142
+ const onForgotPasswordResetPassword = React.useCallback(async ({
143
+ email,
144
+ code,
145
+ newPassword
146
+ }) => {
147
+ try {
148
+ await confirmResetPassword({
149
+ confirmationCode: code,
150
+ username: email,
151
+ newPassword
152
+ });
153
+ setScreen({
154
+ value: "signIn"
155
+ });
156
+ } catch (error) {
157
+ onError?.(error);
158
+ addNotification({
159
+ type: "error",
160
+ message: error.message
161
+ });
162
+ }
163
+ }, [setScreen, addNotification, onError]);
164
+ return /* @__PURE__ */React.createElement(AuthCore, {
165
+ screen,
166
+ setScreen,
167
+ onSignIn,
168
+ onSignUp,
169
+ onConfirmSignUpWithCode,
170
+ onForgotPassword,
171
+ onForgotPasswordResetPassword,
172
+ signUpTerms: props.signUpTerms,
173
+ logo: props.logo,
174
+ layout: props.layout
175
+ });
176
+ }, "Auth");
177
+
178
+ // src/AuthProvider.tsx
179
+ import { AuthProvider as AuthProviderCore, useAuth } from "@ttoss/react-auth-core";
180
+ import { signOut } from "aws-amplify/auth";
181
+ import { Hub } from "aws-amplify/utils";
182
+ import * as React2 from "react";
183
+
184
+ // src/getAuthData.ts
185
+ import { fetchAuthSession, fetchUserAttributes, getCurrentUser } from "aws-amplify/auth";
186
+ var getAuthData = /* @__PURE__ */__name(async ({
187
+ includeTokens
188
+ } = {}) => {
189
+ const currentUser = await getCurrentUser();
190
+ const [session, user] = await Promise.all([includeTokens ? fetchAuthSession() : Promise.resolve(null), fetchUserAttributes()]);
191
+ const idToken = session?.tokens?.idToken?.toString() ?? "";
192
+ const accessToken = session?.tokens?.accessToken?.toString() ?? "";
193
+ const refreshToken = "";
194
+ return {
195
+ user: {
196
+ id: currentUser.userId,
197
+ email: user.email ?? "",
198
+ emailVerified: user.email_verified === "true"
199
+ },
200
+ tokens: {
201
+ idToken,
202
+ accessToken,
203
+ refreshToken
204
+ },
205
+ isAuthenticated: true
206
+ };
207
+ }, "getAuthData");
208
+ var checkAuth = /* @__PURE__ */__name(async () => {
209
+ try {
210
+ const currentUser = await getCurrentUser();
211
+ return !!currentUser;
212
+ } catch {
213
+ return false;
214
+ }
215
+ }, "checkAuth");
216
+
217
+ // src/AuthProvider.tsx
218
+ var AuthProvider = /* @__PURE__ */__name(props => {
219
+ const [authListenerCount, setAuthListenerCount] = React2.useState(0);
220
+ React2.useEffect(() => {
221
+ const listener = /* @__PURE__ */__name(() => {
222
+ setAuthListenerCount(count => {
223
+ return count + 1;
224
+ });
225
+ }, "listener");
226
+ const stopHubListener = Hub.listen("auth", listener);
227
+ return () => {
228
+ stopHubListener();
229
+ };
230
+ }, []);
231
+ const getAuthDataCallback = React2.useCallback(async () => {
232
+ try {
233
+ return getAuthData();
234
+ } catch {
235
+ return null;
236
+ }
237
+ }, [authListenerCount]);
238
+ return /* @__PURE__ */React2.createElement(AuthProviderCore, {
239
+ getAuthData: getAuthDataCallback,
240
+ signOut
241
+ }, props.children);
242
+ }, "AuthProvider");
243
+ export { Auth, AuthProvider, checkAuth, getAuthData, useAuth };
@@ -0,0 +1,24 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { AuthProps as AuthProps$1, AuthData } from '@ttoss/react-auth-core';
3
+ export { useAuth } from '@ttoss/react-auth-core';
4
+ import * as React from 'react';
5
+
6
+ type AuthProps = Pick<AuthProps$1, 'signUpTerms' | 'logo' | 'layout'> & {
7
+ /**
8
+ * Callback function invoked when an error occurs during authentication operations.
9
+ * Receives the error object that was caught.
10
+ */
11
+ onError?: (error: Error) => void;
12
+ };
13
+ declare const Auth: (props: AuthProps) => react_jsx_runtime.JSX.Element;
14
+
15
+ declare const AuthProvider: (props: {
16
+ children: React.ReactNode;
17
+ }) => react_jsx_runtime.JSX.Element;
18
+
19
+ declare const getAuthData: ({ includeTokens, }?: {
20
+ includeTokens?: boolean;
21
+ }) => Promise<AuthData | null>;
22
+ declare const checkAuth: () => Promise<boolean>;
23
+
24
+ export { Auth, type AuthProps, AuthProvider, checkAuth, getAuthData };
@@ -0,0 +1,410 @@
1
+ {
2
+ "0EjvY6": [
3
+ {
4
+ "type": 0,
5
+ "value": "∞"
6
+ }
7
+ ],
8
+ "0XOzcH": [
9
+ {
10
+ "type": 0,
11
+ "value": "Required field"
12
+ }
13
+ ],
14
+ "1DbX9V": [
15
+ {
16
+ "type": 0,
17
+ "value": "Near limit"
18
+ }
19
+ ],
20
+ "38HSjr": [
21
+ {
22
+ "type": 0,
23
+ "value": "Sign In"
24
+ }
25
+ ],
26
+ "4NwCn9": [
27
+ {
28
+ "type": 0,
29
+ "value": "Reached limit"
30
+ }
31
+ ],
32
+ "5E12mO": [
33
+ {
34
+ "type": 0,
35
+ "value": "Email"
36
+ }
37
+ ],
38
+ "6PdOcy": [
39
+ {
40
+ "type": 0,
41
+ "value": "Cancel"
42
+ }
43
+ ],
44
+ "8GMUPk": [
45
+ {
46
+ "type": 0,
47
+ "value": "I'm already registered"
48
+ }
49
+ ],
50
+ "9cApwd": [
51
+ {
52
+ "type": 0,
53
+ "value": "Please, insert a valid e-mail"
54
+ }
55
+ ],
56
+ "BtK6KR": [
57
+ {
58
+ "type": 0,
59
+ "value": "Forgot password?"
60
+ }
61
+ ],
62
+ "Co3exe": [
63
+ {
64
+ "type": 0,
65
+ "value": "By signing up, you agree to the following Terms and Conditions."
66
+ }
67
+ ],
68
+ "D1C6fR": [
69
+ {
70
+ "type": 0,
71
+ "value": "Field must be at least "
72
+ },
73
+ {
74
+ "type": 1,
75
+ "value": "min"
76
+ },
77
+ {
78
+ "type": 0,
79
+ "value": " characters"
80
+ }
81
+ ],
82
+ "EO/33N": [
83
+ {
84
+ "type": 0,
85
+ "value": "Signed in successfully"
86
+ }
87
+ ],
88
+ "EZ3YF2": [
89
+ {
90
+ "type": 0,
91
+ "value": "Sign up"
92
+ }
93
+ ],
94
+ "G/yZLu": [
95
+ {
96
+ "type": 0,
97
+ "value": "Remove"
98
+ }
99
+ ],
100
+ "HT4tSM": [
101
+ {
102
+ "type": 0,
103
+ "value": "Reset Password"
104
+ }
105
+ ],
106
+ "JEsxDw": [
107
+ {
108
+ "type": 0,
109
+ "value": "Uploading..."
110
+ }
111
+ ],
112
+ "KY2T6J": [
113
+ {
114
+ "type": 0,
115
+ "value": "Code"
116
+ }
117
+ ],
118
+ "MfWGyg": [
119
+ {
120
+ "type": 0,
121
+ "value": "Field is required"
122
+ }
123
+ ],
124
+ "NJ57Qj": [
125
+ {
126
+ "type": 0,
127
+ "value": "Confirm password field is required"
128
+ }
129
+ ],
130
+ "OhDL0i": [
131
+ {
132
+ "type": 0,
133
+ "value": "Invalid email"
134
+ }
135
+ ],
136
+ "PylVqx": [
137
+ {
138
+ "type": 0,
139
+ "value": "Password"
140
+ }
141
+ ],
142
+ "S3pjKw": [
143
+ {
144
+ "type": 0,
145
+ "value": "Minimum "
146
+ },
147
+ {
148
+ "type": 1,
149
+ "value": "value"
150
+ },
151
+ {
152
+ "type": 0,
153
+ "value": " characters"
154
+ }
155
+ ],
156
+ "S4bbEj": [
157
+ {
158
+ "type": 0,
159
+ "value": "Recovering Password"
160
+ }
161
+ ],
162
+ "SQJto2": [
163
+ {
164
+ "type": 0,
165
+ "value": "Sign in"
166
+ }
167
+ ],
168
+ "SfWKyS": [
169
+ {
170
+ "type": 0,
171
+ "value": "Maximum "
172
+ },
173
+ {
174
+ "type": 1,
175
+ "value": "value"
176
+ },
177
+ {
178
+ "type": 0,
179
+ "value": " characters"
180
+ }
181
+ ],
182
+ "TZ4WUk": [
183
+ {
184
+ "type": 0,
185
+ "value": "Password requires "
186
+ },
187
+ {
188
+ "type": 1,
189
+ "value": "value"
190
+ },
191
+ {
192
+ "type": 0,
193
+ "value": " characters"
194
+ }
195
+ ],
196
+ "UNttd+": [
197
+ {
198
+ "type": 0,
199
+ "value": "Confirm"
200
+ }
201
+ ],
202
+ "URJDrG": [
203
+ {
204
+ "type": 0,
205
+ "value": "Sign up"
206
+ }
207
+ ],
208
+ "WU/CqP": [
209
+ {
210
+ "type": 0,
211
+ "value": "Passwords are not the same"
212
+ }
213
+ ],
214
+ "XKyo5X": [
215
+ {
216
+ "type": 0,
217
+ "value": "File Upload"
218
+ }
219
+ ],
220
+ "XreZg+": [
221
+ {
222
+ "type": 0,
223
+ "value": "Registered Email"
224
+ }
225
+ ],
226
+ "ZhaPt0": [
227
+ {
228
+ "type": 0,
229
+ "value": "Invalid Value for Field of type "
230
+ },
231
+ {
232
+ "type": 1,
233
+ "value": "type"
234
+ }
235
+ ],
236
+ "cGR2eI": [
237
+ {
238
+ "type": 0,
239
+ "value": "Confirmation"
240
+ }
241
+ ],
242
+ "d1YCuH": [
243
+ {
244
+ "type": 0,
245
+ "value": "Enter your email address"
246
+ }
247
+ ],
248
+ "e3IQoc": [
249
+ {
250
+ "type": 0,
251
+ "value": "New Password"
252
+ }
253
+ ],
254
+ "eRShvB": [
255
+ {
256
+ "type": 0,
257
+ "value": "Maximum files reached"
258
+ }
259
+ ],
260
+ "fDCMA6": [
261
+ {
262
+ "type": 0,
263
+ "value": "Select Files"
264
+ }
265
+ ],
266
+ "fOOwej": [
267
+ {
268
+ "offset": 0,
269
+ "options": {
270
+ "one": {
271
+ "value": [
272
+ {
273
+ "type": 0,
274
+ "value": "Up to "
275
+ },
276
+ {
277
+ "type": 7
278
+ },
279
+ {
280
+ "type": 0,
281
+ "value": " file"
282
+ }
283
+ ]
284
+ },
285
+ "other": {
286
+ "value": [
287
+ {
288
+ "type": 0,
289
+ "value": "Up to "
290
+ },
291
+ {
292
+ "type": 7
293
+ },
294
+ {
295
+ "type": 0,
296
+ "value": " files"
297
+ }
298
+ ]
299
+ }
300
+ },
301
+ "pluralType": "cardinal",
302
+ "type": 6,
303
+ "value": "max_files"
304
+ }
305
+ ],
306
+ "gy0Ynb": [
307
+ {
308
+ "type": 0,
309
+ "value": "Click or drag files here"
310
+ }
311
+ ],
312
+ "i6IsKy": [
313
+ {
314
+ "type": 0,
315
+ "value": "."
316
+ }
317
+ ],
318
+ "kdFYba": [
319
+ {
320
+ "type": 0,
321
+ "value": "Password field is required"
322
+ }
323
+ ],
324
+ "khMx/2": [
325
+ {
326
+ "type": 0,
327
+ "value": "An error occurred with your authentication. Please try again."
328
+ }
329
+ ],
330
+ "lY+cuM": [
331
+ {
332
+ "type": 0,
333
+ "value": "Confirm password"
334
+ }
335
+ ],
336
+ "lZvoYL": [
337
+ {
338
+ "type": 0,
339
+ "value": "Sign up now"
340
+ }
341
+ ],
342
+ "mZzmNV": [
343
+ {
344
+ "type": 0,
345
+ "value": "Recover Password"
346
+ }
347
+ ],
348
+ "oYpm71": [
349
+ {
350
+ "type": 0,
351
+ "value": "of "
352
+ },
353
+ {
354
+ "type": 1,
355
+ "value": "max"
356
+ }
357
+ ],
358
+ "oayEC3": [
359
+ {
360
+ "type": 0,
361
+ "value": "Sign up"
362
+ }
363
+ ],
364
+ "pwv2cR": [
365
+ {
366
+ "type": 0,
367
+ "value": "We have sent a confirmation code to your email address. Please enter the code below."
368
+ }
369
+ ],
370
+ "qTQ4hP": [
371
+ {
372
+ "type": 0,
373
+ "value": "An email has been sent to your address. Please check your inbox and follow the instructions to confirm your sign up."
374
+ }
375
+ ],
376
+ "qnQYqN": [
377
+ {
378
+ "type": 0,
379
+ "value": "You must accept the terms and conditions"
380
+ }
381
+ ],
382
+ "rskBv4": [
383
+ {
384
+ "type": 0,
385
+ "value": "Unlimited"
386
+ }
387
+ ],
388
+ "s1OmP0": [
389
+ {
390
+ "type": 0,
391
+ "value": "Confirmation code"
392
+ }
393
+ ],
394
+ "yktL1M": [
395
+ {
396
+ "type": 0,
397
+ "value": ","
398
+ }
399
+ ],
400
+ "zr0OS6": [
401
+ {
402
+ "type": 1,
403
+ "value": "percentage"
404
+ },
405
+ {
406
+ "type": 0,
407
+ "value": "% used"
408
+ }
409
+ ]
410
+ }
@@ -0,0 +1,262 @@
1
+ {
2
+ "EO/33N": {
3
+ "defaultMessage": "Signed in successfully"
4
+ },
5
+ "0XOzcH": {
6
+ "module": "@ttoss/react-auth-core",
7
+ "defaultMessage": "Required field",
8
+ "description": "Required field."
9
+ },
10
+ "38HSjr": {
11
+ "module": "@ttoss/react-auth-core",
12
+ "defaultMessage": "Sign In",
13
+ "description": "Sign In"
14
+ },
15
+ "5E12mO": {
16
+ "module": "@ttoss/react-auth-core",
17
+ "defaultMessage": "Email",
18
+ "description": "Email label."
19
+ },
20
+ "6PdOcy": {
21
+ "module": "@ttoss/react-auth-core",
22
+ "defaultMessage": "Cancel",
23
+ "description": "Cancel"
24
+ },
25
+ "8GMUPk": {
26
+ "module": "@ttoss/react-auth-core",
27
+ "defaultMessage": "I'm already registered",
28
+ "description": "Link to sign in on sign up."
29
+ },
30
+ "9cApwd": {
31
+ "module": "@ttoss/react-auth-core",
32
+ "defaultMessage": "Please, insert a valid e-mail",
33
+ "description": "Invalid email."
34
+ },
35
+ "BtK6KR": {
36
+ "module": "@ttoss/react-auth-core",
37
+ "defaultMessage": "Forgot password?",
38
+ "description": "Forgot password?"
39
+ },
40
+ "Co3exe": {
41
+ "module": "@ttoss/react-auth-core",
42
+ "defaultMessage": "By signing up, you agree to the following Terms and Conditions."
43
+ },
44
+ "EZ3YF2": {
45
+ "module": "@ttoss/react-auth-core",
46
+ "defaultMessage": "Sign up",
47
+ "description": "Sign up"
48
+ },
49
+ "HT4tSM": {
50
+ "module": "@ttoss/react-auth-core",
51
+ "defaultMessage": "Reset Password",
52
+ "description": "Reset Password"
53
+ },
54
+ "KY2T6J": {
55
+ "module": "@ttoss/react-auth-core",
56
+ "defaultMessage": "Code",
57
+ "description": "Sign up confirmation code"
58
+ },
59
+ "NJ57Qj": {
60
+ "module": "@ttoss/react-auth-core",
61
+ "defaultMessage": "Confirm password field is required",
62
+ "description": "Confirm Password is required."
63
+ },
64
+ "OhDL0i": {
65
+ "module": "@ttoss/react-auth-core",
66
+ "defaultMessage": "Invalid email",
67
+ "description": "Invalid email."
68
+ },
69
+ "PylVqx": {
70
+ "module": "@ttoss/react-auth-core",
71
+ "defaultMessage": "Password",
72
+ "description": "Password label."
73
+ },
74
+ "S3pjKw": {
75
+ "module": "@ttoss/react-auth-core",
76
+ "defaultMessage": "Minimum {value} characters",
77
+ "description": "Minimum {value} characters."
78
+ },
79
+ "S4bbEj": {
80
+ "module": "@ttoss/react-auth-core",
81
+ "defaultMessage": "Recovering Password",
82
+ "description": "Recovering Password"
83
+ },
84
+ "SQJto2": {
85
+ "module": "@ttoss/react-auth-core",
86
+ "defaultMessage": "Sign in"
87
+ },
88
+ "SfWKyS": {
89
+ "module": "@ttoss/react-auth-core",
90
+ "defaultMessage": "Maximum {value} characters",
91
+ "description": "Maximum {value} characters."
92
+ },
93
+ "TZ4WUk": {
94
+ "module": "@ttoss/react-auth-core",
95
+ "defaultMessage": "Password requires {value} characters",
96
+ "description": "Password must be at least {value} characters long."
97
+ },
98
+ "UNttd+": {
99
+ "module": "@ttoss/react-auth-core",
100
+ "defaultMessage": "Confirm",
101
+ "description": "Confirm"
102
+ },
103
+ "URJDrG": {
104
+ "module": "@ttoss/react-auth-core",
105
+ "defaultMessage": "Sign up",
106
+ "description": "Create account."
107
+ },
108
+ "WU/CqP": {
109
+ "module": "@ttoss/react-auth-core",
110
+ "defaultMessage": "Passwords are not the same",
111
+ "description": "Passwords are not the same"
112
+ },
113
+ "XreZg+": {
114
+ "module": "@ttoss/react-auth-core",
115
+ "defaultMessage": "Registered Email",
116
+ "description": "Registered Email"
117
+ },
118
+ "cGR2eI": {
119
+ "module": "@ttoss/react-auth-core",
120
+ "defaultMessage": "Confirmation",
121
+ "description": "Confirmation"
122
+ },
123
+ "d1YCuH": {
124
+ "module": "@ttoss/react-auth-core",
125
+ "defaultMessage": "Enter your email address",
126
+ "description": "Email is a required field."
127
+ },
128
+ "e3IQoc": {
129
+ "module": "@ttoss/react-auth-core",
130
+ "defaultMessage": "New Password",
131
+ "description": "New Password"
132
+ },
133
+ "kdFYba": {
134
+ "module": "@ttoss/react-auth-core",
135
+ "defaultMessage": "Password field is required",
136
+ "description": "Password is required."
137
+ },
138
+ "khMx/2": {
139
+ "module": "@ttoss/react-auth-core",
140
+ "defaultMessage": "An error occurred with your authentication. Please try again."
141
+ },
142
+ "lY+cuM": {
143
+ "module": "@ttoss/react-auth-core",
144
+ "defaultMessage": "Confirm password",
145
+ "description": "Confirm Password label."
146
+ },
147
+ "lZvoYL": {
148
+ "module": "@ttoss/react-auth-core",
149
+ "defaultMessage": "Sign up now",
150
+ "description": "Sign up now"
151
+ },
152
+ "mZzmNV": {
153
+ "module": "@ttoss/react-auth-core",
154
+ "defaultMessage": "Recover Password",
155
+ "description": "Recover Password"
156
+ },
157
+ "oayEC3": {
158
+ "module": "@ttoss/react-auth-core",
159
+ "defaultMessage": "Sign up",
160
+ "description": "Title on sign up."
161
+ },
162
+ "pwv2cR": {
163
+ "module": "@ttoss/react-auth-core",
164
+ "defaultMessage": "We have sent a confirmation code to your email address. Please enter the code below."
165
+ },
166
+ "qTQ4hP": {
167
+ "module": "@ttoss/react-auth-core",
168
+ "defaultMessage": "An email has been sent to your address. Please check your inbox and follow the instructions to confirm your sign up."
169
+ },
170
+ "qnQYqN": {
171
+ "module": "@ttoss/react-auth-core",
172
+ "defaultMessage": "You must accept the terms and conditions"
173
+ },
174
+ "s1OmP0": {
175
+ "module": "@ttoss/react-auth-core",
176
+ "defaultMessage": "Confirmation code",
177
+ "description": "Confirmation code"
178
+ },
179
+ "0EjvY6": {
180
+ "module": "@ttoss/components",
181
+ "defaultMessage": "∞",
182
+ "description": "Infinity symbol used when the maximum limit is unlimited."
183
+ },
184
+ "1DbX9V": {
185
+ "module": "@ttoss/components",
186
+ "defaultMessage": "Near limit",
187
+ "description": "Alert shown when usage is close to the limit."
188
+ },
189
+ "4NwCn9": {
190
+ "module": "@ttoss/components",
191
+ "defaultMessage": "Reached limit",
192
+ "description": "Alert shown when usage has reached or exceeded the limit."
193
+ },
194
+ "G/yZLu": {
195
+ "module": "@ttoss/components",
196
+ "defaultMessage": "Remove"
197
+ },
198
+ "JEsxDw": {
199
+ "module": "@ttoss/components",
200
+ "defaultMessage": "Uploading..."
201
+ },
202
+ "XKyo5X": {
203
+ "module": "@ttoss/components",
204
+ "defaultMessage": "File Upload"
205
+ },
206
+ "eRShvB": {
207
+ "module": "@ttoss/components",
208
+ "defaultMessage": "Maximum files reached"
209
+ },
210
+ "fDCMA6": {
211
+ "module": "@ttoss/components",
212
+ "defaultMessage": "Select Files"
213
+ },
214
+ "fOOwej": {
215
+ "module": "@ttoss/components",
216
+ "defaultMessage": "{max_files, plural, one {Up to # file} other {Up to # files}}"
217
+ },
218
+ "gy0Ynb": {
219
+ "module": "@ttoss/components",
220
+ "defaultMessage": "Click or drag files here"
221
+ },
222
+ "oYpm71": {
223
+ "module": "@ttoss/components",
224
+ "defaultMessage": "of {max}",
225
+ "description": "Text shown before the max value, e.g. \"of 10\" or \"of ∞\"."
226
+ },
227
+ "rskBv4": {
228
+ "module": "@ttoss/components",
229
+ "defaultMessage": "Unlimited",
230
+ "description": "Shown when a metric has no maximum limit."
231
+ },
232
+ "zr0OS6": {
233
+ "module": "@ttoss/components",
234
+ "defaultMessage": "{percentage}% used",
235
+ "description": "Footer shown for percentage metrics, e.g. \"80% used\"."
236
+ },
237
+ "D1C6fR": {
238
+ "module": "@ttoss/forms",
239
+ "defaultMessage": "Field must be at least {min} characters",
240
+ "description": "Min length field"
241
+ },
242
+ "MfWGyg": {
243
+ "module": "@ttoss/forms",
244
+ "defaultMessage": "Field is required",
245
+ "description": "Field is required"
246
+ },
247
+ "ZhaPt0": {
248
+ "module": "@ttoss/forms",
249
+ "defaultMessage": "Invalid Value for Field of type {type}",
250
+ "description": "Invalid Value"
251
+ },
252
+ "i6IsKy": {
253
+ "module": "@ttoss/forms",
254
+ "defaultMessage": ".",
255
+ "description": "Decimal separator for number formatting (e.g., \".\" for 1.23 or \",\" for 1,23)"
256
+ },
257
+ "yktL1M": {
258
+ "module": "@ttoss/forms",
259
+ "defaultMessage": ",",
260
+ "description": "Thousand separator for number formatting (e.g., \",\" for 1,000 or \".\" for 1.000)"
261
+ }
262
+ }
package/package.json ADDED
@@ -0,0 +1,72 @@
1
+ {
2
+ "name": "@ttoss/react-auth-cognito",
3
+ "version": "2.7.6",
4
+ "description": "React authentication components using AWS Cognito",
5
+ "license": "MIT",
6
+ "author": "ttoss",
7
+ "contributors": [
8
+ "Pedro Arantes <pedro@arantespp.com> (https://arantespp.com/contact)"
9
+ ],
10
+ "repository": {
11
+ "type": "git",
12
+ "url": "https://github.com/ttoss/ttoss.git",
13
+ "directory": "packages/react-auth-cognito"
14
+ },
15
+ "type": "module",
16
+ "exports": {
17
+ ".": {
18
+ "types": "./dist/index.d.ts",
19
+ "default": "./dist/esm/index.js"
20
+ }
21
+ },
22
+ "files": [
23
+ "dist",
24
+ "i18n"
25
+ ],
26
+ "sideEffects": false,
27
+ "dependencies": {
28
+ "react-error-boundary": "^6.0.0",
29
+ "@ttoss/react-auth-core": "^0.3.4"
30
+ },
31
+ "peerDependencies": {
32
+ "aws-amplify": "^6.0.0",
33
+ "react": ">=16.8.0",
34
+ "@ttoss/components": "^2.12.6",
35
+ "@ttoss/logger": "^0.7.3",
36
+ "@ttoss/forms": "^0.40.1",
37
+ "@ttoss/react-notifications": "^2.5.14",
38
+ "@ttoss/ui": "^6.5.1",
39
+ "@ttoss/react-i18n": "^2.0.26"
40
+ },
41
+ "devDependencies": {
42
+ "@jest/globals": "^29.7.0",
43
+ "@types/react": "^19.2.8",
44
+ "aws-amplify": "^6.11.0",
45
+ "jest": "^30.2.0",
46
+ "react": "^19.2.3",
47
+ "tsup": "^8.5.1",
48
+ "@ttoss/cloud-auth": "^0.13.12",
49
+ "@ttoss/components": "^2.12.6",
50
+ "@ttoss/config": "^1.35.12",
51
+ "@ttoss/forms": "^0.40.1",
52
+ "@ttoss/logger": "^0.7.3",
53
+ "@ttoss/i18n-cli": "^0.7.38",
54
+ "@ttoss/react-i18n": "^2.0.26",
55
+ "@ttoss/react-notifications": "^2.5.14",
56
+ "@ttoss/test-utils": "^4.0.3",
57
+ "@ttoss/ui": "^6.5.1"
58
+ },
59
+ "keywords": [
60
+ "React",
61
+ "authentication"
62
+ ],
63
+ "publishConfig": {
64
+ "access": "public",
65
+ "provenance": true
66
+ },
67
+ "scripts": {
68
+ "build": "tsup",
69
+ "i18n": "ttoss-i18n",
70
+ "test": "jest --projects tests/unit"
71
+ }
72
+ }