@ttoss/react-auth 2.5.13 → 2.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/index.js +119 -70
- package/i18n/compiled/en.json +6 -0
- package/i18n/lang/en.json +3 -0
- package/package.json +11 -6
package/dist/esm/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/** Powered by @ttoss/config. https://ttoss.dev/docs/modules/packages/config/ */
|
|
2
2
|
|
|
3
3
|
// src/Auth.tsx
|
|
4
|
-
import { useI18n as
|
|
4
|
+
import { useI18n as useI18n7 } from "@ttoss/react-i18n";
|
|
5
5
|
import { useNotifications as useNotifications2 } from "@ttoss/react-notifications";
|
|
6
6
|
import { Flex as Flex5 } from "@ttoss/ui";
|
|
7
7
|
import { confirmResetPassword, confirmSignUp, resendSignUpCode, resetPassword, signIn, signUp } from "aws-amplify/auth";
|
|
@@ -11,13 +11,58 @@ import * as React5 from "react";
|
|
|
11
11
|
import { useNotifications } from "@ttoss/react-notifications";
|
|
12
12
|
import { Box, Button, Flex, Heading } from "@ttoss/ui";
|
|
13
13
|
import * as React from "react";
|
|
14
|
-
|
|
14
|
+
|
|
15
|
+
// src/ErrorBoundary.tsx
|
|
16
|
+
import { NotificationCard } from "@ttoss/components/NotificationCard";
|
|
17
|
+
import { notify } from "@ttoss/logger";
|
|
18
|
+
import { useI18n } from "@ttoss/react-i18n";
|
|
19
|
+
import { ErrorBoundary as ReactErrorBoundary } from "react-error-boundary";
|
|
20
|
+
import { jsx } from "react/jsx-runtime";
|
|
21
|
+
var ErrorFallback = ({
|
|
22
|
+
resetErrorBoundary
|
|
23
|
+
}) => {
|
|
24
|
+
const {
|
|
25
|
+
intl
|
|
26
|
+
} = useI18n();
|
|
27
|
+
return /* @__PURE__ */jsx("div", {
|
|
28
|
+
role: "alert",
|
|
29
|
+
children: /* @__PURE__ */jsx(NotificationCard, {
|
|
30
|
+
type: "error",
|
|
31
|
+
message: intl.formatMessage({
|
|
32
|
+
id: "khMx/2",
|
|
33
|
+
defaultMessage: [{
|
|
34
|
+
"type": 0,
|
|
35
|
+
"value": "An error occurred with your authentication. Please try again."
|
|
36
|
+
}]
|
|
37
|
+
}),
|
|
38
|
+
onClose: resetErrorBoundary
|
|
39
|
+
})
|
|
40
|
+
});
|
|
41
|
+
};
|
|
42
|
+
var ErrorBoundary = ({
|
|
43
|
+
children
|
|
44
|
+
}) => {
|
|
45
|
+
return /* @__PURE__ */jsx(ReactErrorBoundary, {
|
|
46
|
+
FallbackComponent: ErrorFallback,
|
|
47
|
+
onError: error => {
|
|
48
|
+
notify({
|
|
49
|
+
type: "error",
|
|
50
|
+
title: "Authentication Error",
|
|
51
|
+
message: error.message
|
|
52
|
+
});
|
|
53
|
+
},
|
|
54
|
+
children
|
|
55
|
+
});
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
// src/AuthCard.tsx
|
|
59
|
+
import { jsx as jsx2, jsxs } from "react/jsx-runtime";
|
|
15
60
|
var LogoContext = React.createContext({});
|
|
16
61
|
var LogoProvider = ({
|
|
17
62
|
children,
|
|
18
63
|
...values
|
|
19
64
|
}) => {
|
|
20
|
-
return /* @__PURE__ */
|
|
65
|
+
return /* @__PURE__ */jsx2(LogoContext.Provider, {
|
|
21
66
|
value: values,
|
|
22
67
|
children
|
|
23
68
|
});
|
|
@@ -45,7 +90,7 @@ var AuthCard = ({
|
|
|
45
90
|
paddingY: "9",
|
|
46
91
|
backgroundColor: "surface"
|
|
47
92
|
},
|
|
48
|
-
children: [logo && /* @__PURE__ */
|
|
93
|
+
children: [logo && /* @__PURE__ */jsx2(Flex, {
|
|
49
94
|
sx: {
|
|
50
95
|
width: "full",
|
|
51
96
|
maxHeight: "90px",
|
|
@@ -57,21 +102,23 @@ var AuthCard = ({
|
|
|
57
102
|
sx: {
|
|
58
103
|
flexDirection: "column"
|
|
59
104
|
},
|
|
60
|
-
children: [/* @__PURE__ */
|
|
105
|
+
children: [/* @__PURE__ */jsx2(Heading, {
|
|
61
106
|
as: "h2",
|
|
62
107
|
variant: "h2",
|
|
63
108
|
sx: {
|
|
64
109
|
marginBottom: "8"
|
|
65
110
|
},
|
|
66
111
|
children: title
|
|
67
|
-
}),
|
|
112
|
+
}), /* @__PURE__ */jsx2(ErrorBoundary, {
|
|
113
|
+
children
|
|
114
|
+
}), /* @__PURE__ */jsxs(Flex, {
|
|
68
115
|
sx: {
|
|
69
116
|
flexDirection: "column",
|
|
70
117
|
width: "100%",
|
|
71
118
|
gap: "7",
|
|
72
119
|
marginTop: "8"
|
|
73
120
|
},
|
|
74
|
-
children: [/* @__PURE__ */
|
|
121
|
+
children: [/* @__PURE__ */jsx2(Button, {
|
|
75
122
|
type: "submit",
|
|
76
123
|
"aria-label": "submit-button",
|
|
77
124
|
variant: "accent",
|
|
@@ -89,17 +136,17 @@ var AuthCard = ({
|
|
|
89
136
|
};
|
|
90
137
|
|
|
91
138
|
// src/AuthConfirmSignUp.tsx
|
|
92
|
-
import { NotificationCard } from "@ttoss/components/NotificationCard";
|
|
139
|
+
import { NotificationCard as NotificationCard2 } from "@ttoss/components/NotificationCard";
|
|
93
140
|
import { Form, FormFieldInput, useForm, yup, yupResolver } from "@ttoss/forms";
|
|
94
|
-
import { useI18n } from "@ttoss/react-i18n";
|
|
95
|
-
import { jsx as
|
|
141
|
+
import { useI18n as useI18n2 } from "@ttoss/react-i18n";
|
|
142
|
+
import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
96
143
|
var AuthConfirmSignUp = ({
|
|
97
144
|
email,
|
|
98
145
|
onConfirmSignUp
|
|
99
146
|
}) => {
|
|
100
147
|
const {
|
|
101
148
|
intl
|
|
102
|
-
} =
|
|
149
|
+
} = useI18n2();
|
|
103
150
|
const schema = yup.object().shape({
|
|
104
151
|
code: yup.string().required(intl.formatMessage({
|
|
105
152
|
id: "0XOzcH",
|
|
@@ -126,7 +173,7 @@ var AuthConfirmSignUp = ({
|
|
|
126
173
|
const formMethods = useForm({
|
|
127
174
|
resolver: yupResolver(schema)
|
|
128
175
|
});
|
|
129
|
-
return /* @__PURE__ */
|
|
176
|
+
return /* @__PURE__ */jsx3(Form, {
|
|
130
177
|
...formMethods,
|
|
131
178
|
onSubmit: ({
|
|
132
179
|
code
|
|
@@ -152,7 +199,7 @@ var AuthConfirmSignUp = ({
|
|
|
152
199
|
"value": "Confirmation"
|
|
153
200
|
}]
|
|
154
201
|
}),
|
|
155
|
-
children: [/* @__PURE__ */
|
|
202
|
+
children: [/* @__PURE__ */jsx3(NotificationCard2, {
|
|
156
203
|
type: "info",
|
|
157
204
|
message: intl.formatMessage({
|
|
158
205
|
id: "pwv2cR",
|
|
@@ -161,7 +208,7 @@ var AuthConfirmSignUp = ({
|
|
|
161
208
|
"value": "We have sent a confirmation code to your email address. Please enter the code below."
|
|
162
209
|
}]
|
|
163
210
|
})
|
|
164
|
-
}), /* @__PURE__ */
|
|
211
|
+
}), /* @__PURE__ */jsx3(FormFieldInput, {
|
|
165
212
|
sx: {
|
|
166
213
|
marginTop: "6"
|
|
167
214
|
},
|
|
@@ -180,10 +227,10 @@ var AuthConfirmSignUp = ({
|
|
|
180
227
|
|
|
181
228
|
// src/AuthForgotPassword.tsx
|
|
182
229
|
import { Form as Form2, FormFieldInput as FormFieldInput2, useForm as useForm2, yup as yup2, yupResolver as yupResolver2 } from "@ttoss/forms";
|
|
183
|
-
import { useI18n as
|
|
230
|
+
import { useI18n as useI18n3 } from "@ttoss/react-i18n";
|
|
184
231
|
import { NotificationsBox } from "@ttoss/react-notifications";
|
|
185
232
|
import { Button as Button2, Link, Text } from "@ttoss/ui";
|
|
186
|
-
import { jsx as
|
|
233
|
+
import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
187
234
|
var AuthForgotPassword = ({
|
|
188
235
|
onForgotPassword,
|
|
189
236
|
onCancel,
|
|
@@ -191,7 +238,7 @@ var AuthForgotPassword = ({
|
|
|
191
238
|
}) => {
|
|
192
239
|
const {
|
|
193
240
|
intl
|
|
194
|
-
} =
|
|
241
|
+
} = useI18n3();
|
|
195
242
|
const schema = yup2.object().shape({
|
|
196
243
|
email: yup2.string().required(intl.formatMessage({
|
|
197
244
|
id: "5oOshZ",
|
|
@@ -211,7 +258,7 @@ var AuthForgotPassword = ({
|
|
|
211
258
|
resolver: yupResolver2(schema),
|
|
212
259
|
mode: "onBlur"
|
|
213
260
|
});
|
|
214
|
-
return /* @__PURE__ */
|
|
261
|
+
return /* @__PURE__ */jsx4(Form2, {
|
|
215
262
|
...formMethods,
|
|
216
263
|
sx: {
|
|
217
264
|
maxWidth: "390px"
|
|
@@ -239,7 +286,7 @@ var AuthForgotPassword = ({
|
|
|
239
286
|
"value": "Recovering Password"
|
|
240
287
|
}]
|
|
241
288
|
}),
|
|
242
|
-
extraButton: /* @__PURE__ */
|
|
289
|
+
extraButton: /* @__PURE__ */jsx4(Button2, {
|
|
243
290
|
sx: {
|
|
244
291
|
textAlign: "center",
|
|
245
292
|
display: "initial"
|
|
@@ -254,7 +301,7 @@ var AuthForgotPassword = ({
|
|
|
254
301
|
}]
|
|
255
302
|
})
|
|
256
303
|
}),
|
|
257
|
-
children: [/* @__PURE__ */
|
|
304
|
+
children: [/* @__PURE__ */jsx4(FormFieldInput2, {
|
|
258
305
|
name: "email",
|
|
259
306
|
label: intl.formatMessage({
|
|
260
307
|
id: "XreZg+",
|
|
@@ -263,7 +310,7 @@ var AuthForgotPassword = ({
|
|
|
263
310
|
"value": "Registered Email"
|
|
264
311
|
}]
|
|
265
312
|
})
|
|
266
|
-
}), /* @__PURE__ */
|
|
313
|
+
}), /* @__PURE__ */jsx4(NotificationsBox, {}), /* @__PURE__ */jsx4(Text, {
|
|
267
314
|
sx: {
|
|
268
315
|
marginTop: "xl",
|
|
269
316
|
cursor: "pointer"
|
|
@@ -287,11 +334,11 @@ var PASSWORD_MINIMUM_LENGTH = 8;
|
|
|
287
334
|
|
|
288
335
|
// src/AuthForgotPasswordResetPassword.tsx
|
|
289
336
|
import { Form as Form3, FormFieldInput as FormFieldInput3, FormFieldPassword, useForm as useForm3, yup as yup3, yupResolver as yupResolver3 } from "@ttoss/forms";
|
|
290
|
-
import { useI18n as
|
|
337
|
+
import { useI18n as useI18n4 } from "@ttoss/react-i18n";
|
|
291
338
|
import { NotificationsBox as NotificationsBox2 } from "@ttoss/react-notifications";
|
|
292
339
|
import { Button as Button3 } from "@ttoss/ui";
|
|
293
340
|
import * as React2 from "react";
|
|
294
|
-
import { jsx as
|
|
341
|
+
import { jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
295
342
|
var AuthForgotPasswordResetPassword = ({
|
|
296
343
|
email,
|
|
297
344
|
onForgotPasswordResetPassword,
|
|
@@ -299,7 +346,7 @@ var AuthForgotPasswordResetPassword = ({
|
|
|
299
346
|
}) => {
|
|
300
347
|
const {
|
|
301
348
|
intl
|
|
302
|
-
} =
|
|
349
|
+
} = useI18n4();
|
|
303
350
|
const schema = React2.useMemo(() => {
|
|
304
351
|
return yup3.object().shape({
|
|
305
352
|
code: yup3.string().required(intl.formatMessage({
|
|
@@ -363,7 +410,7 @@ var AuthForgotPasswordResetPassword = ({
|
|
|
363
410
|
resolver: yupResolver3(schema),
|
|
364
411
|
mode: "onBlur"
|
|
365
412
|
});
|
|
366
|
-
return /* @__PURE__ */
|
|
413
|
+
return /* @__PURE__ */jsx5(Form3, {
|
|
367
414
|
...formMethods,
|
|
368
415
|
sx: {
|
|
369
416
|
maxWidth: "390px"
|
|
@@ -394,7 +441,7 @@ var AuthForgotPasswordResetPassword = ({
|
|
|
394
441
|
"value": "Recovering Password"
|
|
395
442
|
}]
|
|
396
443
|
}),
|
|
397
|
-
extraButton: /* @__PURE__ */
|
|
444
|
+
extraButton: /* @__PURE__ */jsx5(Button3, {
|
|
398
445
|
sx: {
|
|
399
446
|
textAlign: "center",
|
|
400
447
|
display: "initial"
|
|
@@ -409,7 +456,7 @@ var AuthForgotPasswordResetPassword = ({
|
|
|
409
456
|
}]
|
|
410
457
|
})
|
|
411
458
|
}),
|
|
412
|
-
children: [/* @__PURE__ */
|
|
459
|
+
children: [/* @__PURE__ */jsx5(FormFieldInput3, {
|
|
413
460
|
name: "code",
|
|
414
461
|
label: intl.formatMessage({
|
|
415
462
|
id: "42HafR",
|
|
@@ -418,7 +465,7 @@ var AuthForgotPasswordResetPassword = ({
|
|
|
418
465
|
"value": "Code"
|
|
419
466
|
}]
|
|
420
467
|
})
|
|
421
|
-
}), /* @__PURE__ */
|
|
468
|
+
}), /* @__PURE__ */jsx5(FormFieldPassword, {
|
|
422
469
|
name: "password",
|
|
423
470
|
label: intl.formatMessage({
|
|
424
471
|
id: "PylVqx",
|
|
@@ -427,7 +474,7 @@ var AuthForgotPasswordResetPassword = ({
|
|
|
427
474
|
"value": "Password"
|
|
428
475
|
}]
|
|
429
476
|
})
|
|
430
|
-
}), /* @__PURE__ */
|
|
477
|
+
}), /* @__PURE__ */jsx5(FormFieldPassword, {
|
|
431
478
|
name: "confirmPassword",
|
|
432
479
|
label: intl.formatMessage({
|
|
433
480
|
id: "lY+cuM",
|
|
@@ -436,18 +483,18 @@ var AuthForgotPasswordResetPassword = ({
|
|
|
436
483
|
"value": "Confirm password"
|
|
437
484
|
}]
|
|
438
485
|
})
|
|
439
|
-
}), /* @__PURE__ */
|
|
486
|
+
}), /* @__PURE__ */jsx5(NotificationsBox2, {})]
|
|
440
487
|
})
|
|
441
488
|
});
|
|
442
489
|
};
|
|
443
490
|
|
|
444
491
|
// src/AuthFullScreen.tsx
|
|
445
492
|
import { Flex as Flex2 } from "@ttoss/ui";
|
|
446
|
-
import { jsx as
|
|
493
|
+
import { jsx as jsx6 } from "react/jsx-runtime";
|
|
447
494
|
var AuthFullScreen = ({
|
|
448
495
|
children
|
|
449
496
|
}) => {
|
|
450
|
-
return /* @__PURE__ */
|
|
497
|
+
return /* @__PURE__ */jsx6(Flex2, {
|
|
451
498
|
sx: {
|
|
452
499
|
height: "100vh",
|
|
453
500
|
width: "100vw",
|
|
@@ -466,7 +513,7 @@ var AuthFullScreen = ({
|
|
|
466
513
|
import { fetchAuthSession, fetchUserAttributes, getCurrentUser, signOut as awsSignOut } from "aws-amplify/auth";
|
|
467
514
|
import { Hub } from "aws-amplify/utils";
|
|
468
515
|
import * as React3 from "react";
|
|
469
|
-
import { jsx as
|
|
516
|
+
import { jsx as jsx7 } from "react/jsx-runtime";
|
|
470
517
|
var signOut = () => {
|
|
471
518
|
return awsSignOut();
|
|
472
519
|
};
|
|
@@ -527,7 +574,7 @@ var AuthProvider = ({
|
|
|
527
574
|
if (isAuthenticated === void 0) {
|
|
528
575
|
return null;
|
|
529
576
|
}
|
|
530
|
-
return /* @__PURE__ */
|
|
577
|
+
return /* @__PURE__ */jsx7(AuthContext.Provider, {
|
|
531
578
|
value: {
|
|
532
579
|
signOut,
|
|
533
580
|
isAuthenticated,
|
|
@@ -543,10 +590,10 @@ var useAuth = () => {
|
|
|
543
590
|
|
|
544
591
|
// src/AuthSignIn.tsx
|
|
545
592
|
import { Form as Form4, FormFieldInput as FormFieldInput4, FormFieldPassword as FormFieldPassword2, useForm as useForm4, yup as yup4, yupResolver as yupResolver4 } from "@ttoss/forms";
|
|
546
|
-
import { useI18n as
|
|
593
|
+
import { useI18n as useI18n5 } from "@ttoss/react-i18n";
|
|
547
594
|
import { NotificationsBox as NotificationsBox3 } from "@ttoss/react-notifications";
|
|
548
595
|
import { Button as Button4, Flex as Flex3, Link as Link2, Text as Text2 } from "@ttoss/ui";
|
|
549
|
-
import { jsx as
|
|
596
|
+
import { jsx as jsx8, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
550
597
|
var AuthSignIn = ({
|
|
551
598
|
onSignIn,
|
|
552
599
|
onSignUp,
|
|
@@ -555,7 +602,7 @@ var AuthSignIn = ({
|
|
|
555
602
|
}) => {
|
|
556
603
|
const {
|
|
557
604
|
intl
|
|
558
|
-
} =
|
|
605
|
+
} = useI18n5();
|
|
559
606
|
const schema = yup4.object().shape({
|
|
560
607
|
email: yup4.string().required(intl.formatMessage({
|
|
561
608
|
id: "d1YCuH",
|
|
@@ -601,7 +648,7 @@ var AuthSignIn = ({
|
|
|
601
648
|
const onSubmitForm = data => {
|
|
602
649
|
return onSignIn(data);
|
|
603
650
|
};
|
|
604
|
-
return /* @__PURE__ */
|
|
651
|
+
return /* @__PURE__ */jsx8(Form4, {
|
|
605
652
|
sx: {
|
|
606
653
|
maxWidth: "390px",
|
|
607
654
|
width: "100%"
|
|
@@ -624,7 +671,7 @@ var AuthSignIn = ({
|
|
|
624
671
|
}]
|
|
625
672
|
}),
|
|
626
673
|
isValidForm: formMethods.formState.isValid,
|
|
627
|
-
extraButton: /* @__PURE__ */
|
|
674
|
+
extraButton: /* @__PURE__ */jsx8(Button4, {
|
|
628
675
|
type: "button",
|
|
629
676
|
variant: "secondary",
|
|
630
677
|
sx: {
|
|
@@ -646,7 +693,7 @@ var AuthSignIn = ({
|
|
|
646
693
|
flexDirection: "column",
|
|
647
694
|
gap: "xl"
|
|
648
695
|
},
|
|
649
|
-
children: [/* @__PURE__ */
|
|
696
|
+
children: [/* @__PURE__ */jsx8(FormFieldInput4, {
|
|
650
697
|
name: "email",
|
|
651
698
|
label: intl.formatMessage({
|
|
652
699
|
id: "5E12mO",
|
|
@@ -655,7 +702,7 @@ var AuthSignIn = ({
|
|
|
655
702
|
"value": "Email"
|
|
656
703
|
}]
|
|
657
704
|
})
|
|
658
|
-
}), /* @__PURE__ */
|
|
705
|
+
}), /* @__PURE__ */jsx8(FormFieldPassword2, {
|
|
659
706
|
name: "password",
|
|
660
707
|
label: intl.formatMessage({
|
|
661
708
|
id: "PylVqx",
|
|
@@ -665,12 +712,12 @@ var AuthSignIn = ({
|
|
|
665
712
|
}]
|
|
666
713
|
})
|
|
667
714
|
})]
|
|
668
|
-
}), /* @__PURE__ */
|
|
715
|
+
}), /* @__PURE__ */jsx8(Flex3, {
|
|
669
716
|
sx: {
|
|
670
717
|
justifyContent: "space-between",
|
|
671
718
|
marginTop: "lg"
|
|
672
719
|
},
|
|
673
|
-
children: /* @__PURE__ */
|
|
720
|
+
children: /* @__PURE__ */jsx8(Text2, {
|
|
674
721
|
sx: {
|
|
675
722
|
marginLeft: "auto",
|
|
676
723
|
cursor: "pointer"
|
|
@@ -685,22 +732,22 @@ var AuthSignIn = ({
|
|
|
685
732
|
}]
|
|
686
733
|
})
|
|
687
734
|
})
|
|
688
|
-
}), /* @__PURE__ */
|
|
735
|
+
}), /* @__PURE__ */jsx8(NotificationsBox3, {})]
|
|
689
736
|
})
|
|
690
737
|
});
|
|
691
738
|
};
|
|
692
739
|
|
|
693
740
|
// src/AuthSignUp.tsx
|
|
694
741
|
import { Form as Form5, FormFieldCheckbox, FormFieldInput as FormFieldInput5, FormFieldPassword as FormFieldPassword3, useForm as useForm5, yup as yup5, yupResolver as yupResolver5 } from "@ttoss/forms";
|
|
695
|
-
import { useI18n as
|
|
742
|
+
import { useI18n as useI18n6 } from "@ttoss/react-i18n";
|
|
696
743
|
import { NotificationsBox as NotificationsBox4 } from "@ttoss/react-notifications";
|
|
697
744
|
import { Flex as Flex4, Link as Link3, Text as Text3 } from "@ttoss/ui";
|
|
698
745
|
import * as React4 from "react";
|
|
699
|
-
import { Fragment as Fragment2, jsx as
|
|
746
|
+
import { Fragment as Fragment2, jsx as jsx9, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
700
747
|
var AuthSignUp = props => {
|
|
701
748
|
const {
|
|
702
749
|
intl
|
|
703
|
-
} =
|
|
750
|
+
} = useI18n6();
|
|
704
751
|
const schema = React4.useMemo(() => {
|
|
705
752
|
return yup5.object().shape({
|
|
706
753
|
email: yup5.string().required(intl.formatMessage({
|
|
@@ -773,7 +820,7 @@ var AuthSignUp = props => {
|
|
|
773
820
|
const termsLinks = props.signUpTerms.terms.map((term, index, terms) => {
|
|
774
821
|
const finalPunctuation = index === terms.length - 1 ? "." : ", ";
|
|
775
822
|
return /* @__PURE__ */jsxs6(React4.Fragment, {
|
|
776
|
-
children: [/* @__PURE__ */
|
|
823
|
+
children: [/* @__PURE__ */jsx9(Link3, {
|
|
777
824
|
href: term.url,
|
|
778
825
|
target: "_blank",
|
|
779
826
|
rel: "noreferrer",
|
|
@@ -791,12 +838,12 @@ var AuthSignUp = props => {
|
|
|
791
838
|
return null;
|
|
792
839
|
}
|
|
793
840
|
if (props.signUpTerms.isRequired) {
|
|
794
|
-
return /* @__PURE__ */
|
|
841
|
+
return /* @__PURE__ */jsx9(FormFieldCheckbox, {
|
|
795
842
|
name: "signUpTerms",
|
|
796
843
|
label: signUpTermsLabel
|
|
797
844
|
});
|
|
798
845
|
} else {
|
|
799
|
-
return /* @__PURE__ */
|
|
846
|
+
return /* @__PURE__ */jsx9(Fragment2, {
|
|
800
847
|
children: signUpTermsLabel
|
|
801
848
|
});
|
|
802
849
|
}
|
|
@@ -808,7 +855,7 @@ var AuthSignUp = props => {
|
|
|
808
855
|
const onSubmitForm = data => {
|
|
809
856
|
return props.onSignUp(data);
|
|
810
857
|
};
|
|
811
|
-
return /* @__PURE__ */
|
|
858
|
+
return /* @__PURE__ */jsx9(Form5, {
|
|
812
859
|
sx: {
|
|
813
860
|
maxWidth: "390px",
|
|
814
861
|
width: "100%"
|
|
@@ -831,7 +878,7 @@ var AuthSignUp = props => {
|
|
|
831
878
|
}]
|
|
832
879
|
}),
|
|
833
880
|
isValidForm: formMethods.formState.isValid,
|
|
834
|
-
extraButton: /* @__PURE__ */
|
|
881
|
+
extraButton: /* @__PURE__ */jsx9(Text3, {
|
|
835
882
|
sx: {
|
|
836
883
|
cursor: "pointer"
|
|
837
884
|
},
|
|
@@ -850,7 +897,7 @@ var AuthSignUp = props => {
|
|
|
850
897
|
flexDirection: "column",
|
|
851
898
|
gap: "xl"
|
|
852
899
|
},
|
|
853
|
-
children: [/* @__PURE__ */
|
|
900
|
+
children: [/* @__PURE__ */jsx9(FormFieldInput5, {
|
|
854
901
|
name: "email",
|
|
855
902
|
label: intl.formatMessage({
|
|
856
903
|
id: "5E12mO",
|
|
@@ -859,7 +906,7 @@ var AuthSignUp = props => {
|
|
|
859
906
|
"value": "Email"
|
|
860
907
|
}]
|
|
861
908
|
})
|
|
862
|
-
}), /* @__PURE__ */
|
|
909
|
+
}), /* @__PURE__ */jsx9(FormFieldPassword3, {
|
|
863
910
|
name: "password",
|
|
864
911
|
label: intl.formatMessage({
|
|
865
912
|
id: "PylVqx",
|
|
@@ -868,7 +915,7 @@ var AuthSignUp = props => {
|
|
|
868
915
|
"value": "Password"
|
|
869
916
|
}]
|
|
870
917
|
})
|
|
871
|
-
}), /* @__PURE__ */
|
|
918
|
+
}), /* @__PURE__ */jsx9(FormFieldPassword3, {
|
|
872
919
|
name: "confirmPassword",
|
|
873
920
|
label: intl.formatMessage({
|
|
874
921
|
id: "lY+cuM",
|
|
@@ -878,17 +925,17 @@ var AuthSignUp = props => {
|
|
|
878
925
|
}]
|
|
879
926
|
})
|
|
880
927
|
}), signUpTermsNode]
|
|
881
|
-
}), /* @__PURE__ */
|
|
928
|
+
}), /* @__PURE__ */jsx9(NotificationsBox4, {})]
|
|
882
929
|
})
|
|
883
930
|
});
|
|
884
931
|
};
|
|
885
932
|
|
|
886
933
|
// src/Auth.tsx
|
|
887
|
-
import { jsx as
|
|
934
|
+
import { jsx as jsx10, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
888
935
|
var AuthLogic = props => {
|
|
889
936
|
const {
|
|
890
937
|
intl
|
|
891
|
-
} =
|
|
938
|
+
} = useI18n7();
|
|
892
939
|
const {
|
|
893
940
|
isAuthenticated
|
|
894
941
|
} = useAuth();
|
|
@@ -1069,20 +1116,20 @@ var AuthLogic = props => {
|
|
|
1069
1116
|
return null;
|
|
1070
1117
|
}
|
|
1071
1118
|
if (screen.value === "signUp") {
|
|
1072
|
-
return /* @__PURE__ */
|
|
1119
|
+
return /* @__PURE__ */jsx10(AuthSignUp, {
|
|
1073
1120
|
onSignUp,
|
|
1074
1121
|
onReturnToSignIn,
|
|
1075
1122
|
signUpTerms: props.signUpTerms
|
|
1076
1123
|
});
|
|
1077
1124
|
}
|
|
1078
1125
|
if (screen.value === "signUpConfirm" || screen.value === "signUpResendConfirmation") {
|
|
1079
|
-
return /* @__PURE__ */
|
|
1126
|
+
return /* @__PURE__ */jsx10(AuthConfirmSignUp, {
|
|
1080
1127
|
onConfirmSignUp,
|
|
1081
1128
|
email: screen.context.email
|
|
1082
1129
|
});
|
|
1083
1130
|
}
|
|
1084
1131
|
if (screen.value === "forgotPassword") {
|
|
1085
|
-
return /* @__PURE__ */
|
|
1132
|
+
return /* @__PURE__ */jsx10(AuthForgotPassword, {
|
|
1086
1133
|
onForgotPassword,
|
|
1087
1134
|
onCancel: onReturnToSignIn,
|
|
1088
1135
|
onSignUp: () => {
|
|
@@ -1094,13 +1141,13 @@ var AuthLogic = props => {
|
|
|
1094
1141
|
});
|
|
1095
1142
|
}
|
|
1096
1143
|
if (screen.value === "forgotPasswordResetPassword") {
|
|
1097
|
-
return /* @__PURE__ */
|
|
1144
|
+
return /* @__PURE__ */jsx10(AuthForgotPasswordResetPassword, {
|
|
1098
1145
|
email: screen.context.email,
|
|
1099
1146
|
onForgotPasswordResetPassword,
|
|
1100
1147
|
onCancel: onReturnToSignIn
|
|
1101
1148
|
});
|
|
1102
1149
|
}
|
|
1103
|
-
return /* @__PURE__ */
|
|
1150
|
+
return /* @__PURE__ */jsx10(AuthSignIn, {
|
|
1104
1151
|
onSignIn,
|
|
1105
1152
|
onSignUp: () => {
|
|
1106
1153
|
setScreen({
|
|
@@ -1126,23 +1173,25 @@ var Auth = props => {
|
|
|
1126
1173
|
}
|
|
1127
1174
|
} = props;
|
|
1128
1175
|
const withLogoNode = React5.useMemo(() => {
|
|
1129
|
-
return /* @__PURE__ */
|
|
1176
|
+
return /* @__PURE__ */jsx10(LogoProvider, {
|
|
1130
1177
|
logo: props.logo,
|
|
1131
|
-
children: /* @__PURE__ */
|
|
1132
|
-
|
|
1178
|
+
children: /* @__PURE__ */jsx10(ErrorBoundary, {
|
|
1179
|
+
children: /* @__PURE__ */jsx10(AuthLogic, {
|
|
1180
|
+
signUpTerms: props.signUpTerms
|
|
1181
|
+
})
|
|
1133
1182
|
})
|
|
1134
1183
|
});
|
|
1135
1184
|
}, [props.logo, props.signUpTerms]);
|
|
1136
1185
|
if (layout.fullScreen) {
|
|
1137
1186
|
if (layout.sideContentPosition) {
|
|
1138
|
-
return /* @__PURE__ */
|
|
1187
|
+
return /* @__PURE__ */jsx10(AuthFullScreen, {
|
|
1139
1188
|
children: /* @__PURE__ */jsxs7(Flex5, {
|
|
1140
1189
|
sx: {
|
|
1141
1190
|
width: "100%",
|
|
1142
1191
|
height: "100%",
|
|
1143
1192
|
flexDirection: layout.sideContentPosition === "left" ? "row" : "row-reverse"
|
|
1144
1193
|
},
|
|
1145
|
-
children: [/* @__PURE__ */
|
|
1194
|
+
children: [/* @__PURE__ */jsx10(Flex5, {
|
|
1146
1195
|
sx: {
|
|
1147
1196
|
width: "100%",
|
|
1148
1197
|
height: "100%",
|
|
@@ -1151,7 +1200,7 @@ var Auth = props => {
|
|
|
1151
1200
|
alignItems: "center"
|
|
1152
1201
|
},
|
|
1153
1202
|
children: layout.sideContent
|
|
1154
|
-
}), /* @__PURE__ */
|
|
1203
|
+
}), /* @__PURE__ */jsx10(Flex5, {
|
|
1155
1204
|
sx: {
|
|
1156
1205
|
width: "100%",
|
|
1157
1206
|
height: "100%",
|
|
@@ -1164,7 +1213,7 @@ var Auth = props => {
|
|
|
1164
1213
|
})
|
|
1165
1214
|
});
|
|
1166
1215
|
}
|
|
1167
|
-
return /* @__PURE__ */
|
|
1216
|
+
return /* @__PURE__ */jsx10(AuthFullScreen, {
|
|
1168
1217
|
children: withLogoNode
|
|
1169
1218
|
});
|
|
1170
1219
|
}
|
package/i18n/compiled/en.json
CHANGED
package/i18n/lang/en.json
CHANGED
|
@@ -104,6 +104,9 @@
|
|
|
104
104
|
"defaultMessage": "Password field is required",
|
|
105
105
|
"description": "Password is required."
|
|
106
106
|
},
|
|
107
|
+
"khMx/2": {
|
|
108
|
+
"defaultMessage": "An error occurred with your authentication. Please try again."
|
|
109
|
+
},
|
|
107
110
|
"lY+cuM": {
|
|
108
111
|
"defaultMessage": "Confirm password",
|
|
109
112
|
"description": "Confirm Password label."
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ttoss/react-auth",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.6.0",
|
|
4
4
|
"description": "ttoss authentication module for React apps.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "ttoss",
|
|
@@ -24,13 +24,17 @@
|
|
|
24
24
|
"i18n"
|
|
25
25
|
],
|
|
26
26
|
"sideEffects": false,
|
|
27
|
+
"dependencies": {
|
|
28
|
+
"react-error-boundary": "^5.0.0"
|
|
29
|
+
},
|
|
27
30
|
"peerDependencies": {
|
|
28
31
|
"aws-amplify": "^6.0.0",
|
|
29
32
|
"react": ">=16.8.0",
|
|
30
|
-
"@ttoss/forms": "^0.29.7",
|
|
31
33
|
"@ttoss/components": "^2.2.6",
|
|
32
|
-
"@ttoss/
|
|
34
|
+
"@ttoss/forms": "^0.29.7",
|
|
35
|
+
"@ttoss/logger": "^0.5.0",
|
|
33
36
|
"@ttoss/react-notifications": "^2.1.12",
|
|
37
|
+
"@ttoss/react-i18n": "^2.0.10",
|
|
34
38
|
"@ttoss/ui": "^5.5.4"
|
|
35
39
|
},
|
|
36
40
|
"devDependencies": {
|
|
@@ -41,13 +45,14 @@
|
|
|
41
45
|
"react": "^19.0.0",
|
|
42
46
|
"tsup": "^8.3.5",
|
|
43
47
|
"@ttoss/cloud-auth": "^0.12.27",
|
|
44
|
-
"@ttoss/components": "^2.2.6",
|
|
45
48
|
"@ttoss/config": "^1.35.2",
|
|
49
|
+
"@ttoss/components": "^2.2.6",
|
|
46
50
|
"@ttoss/i18n-cli": "^0.7.27",
|
|
47
|
-
"@ttoss/
|
|
48
|
-
"@ttoss/react-notifications": "^2.1.12",
|
|
51
|
+
"@ttoss/logger": "^0.5.0",
|
|
49
52
|
"@ttoss/forms": "^0.29.7",
|
|
53
|
+
"@ttoss/react-i18n": "^2.0.10",
|
|
50
54
|
"@ttoss/test-utils": "^2.1.22",
|
|
55
|
+
"@ttoss/react-notifications": "^2.1.12",
|
|
51
56
|
"@ttoss/ui": "^5.5.4"
|
|
52
57
|
},
|
|
53
58
|
"keywords": [
|