@ttoss/react-auth 2.5.12 → 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 CHANGED
@@ -1,6 +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 useI18n7 } from "@ttoss/react-i18n";
4
5
  import { useNotifications as useNotifications2 } from "@ttoss/react-notifications";
5
6
  import { Flex as Flex5 } from "@ttoss/ui";
6
7
  import { confirmResetPassword, confirmSignUp, resendSignUpCode, resetPassword, signIn, signUp } from "aws-amplify/auth";
@@ -10,13 +11,58 @@ import * as React5 from "react";
10
11
  import { useNotifications } from "@ttoss/react-notifications";
11
12
  import { Box, Button, Flex, Heading } from "@ttoss/ui";
12
13
  import * as React from "react";
13
- import { jsx, jsxs } from "react/jsx-runtime";
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";
14
60
  var LogoContext = React.createContext({});
15
61
  var LogoProvider = ({
16
62
  children,
17
63
  ...values
18
64
  }) => {
19
- return /* @__PURE__ */jsx(LogoContext.Provider, {
65
+ return /* @__PURE__ */jsx2(LogoContext.Provider, {
20
66
  value: values,
21
67
  children
22
68
  });
@@ -44,7 +90,7 @@ var AuthCard = ({
44
90
  paddingY: "9",
45
91
  backgroundColor: "surface"
46
92
  },
47
- children: [logo && /* @__PURE__ */jsx(Flex, {
93
+ children: [logo && /* @__PURE__ */jsx2(Flex, {
48
94
  sx: {
49
95
  width: "full",
50
96
  maxHeight: "90px",
@@ -56,21 +102,23 @@ var AuthCard = ({
56
102
  sx: {
57
103
  flexDirection: "column"
58
104
  },
59
- children: [/* @__PURE__ */jsx(Heading, {
105
+ children: [/* @__PURE__ */jsx2(Heading, {
60
106
  as: "h2",
61
107
  variant: "h2",
62
108
  sx: {
63
109
  marginBottom: "8"
64
110
  },
65
111
  children: title
66
- }), children, /* @__PURE__ */jsxs(Flex, {
112
+ }), /* @__PURE__ */jsx2(ErrorBoundary, {
113
+ children
114
+ }), /* @__PURE__ */jsxs(Flex, {
67
115
  sx: {
68
116
  flexDirection: "column",
69
117
  width: "100%",
70
118
  gap: "7",
71
119
  marginTop: "8"
72
120
  },
73
- children: [/* @__PURE__ */jsx(Button, {
121
+ children: [/* @__PURE__ */jsx2(Button, {
74
122
  type: "submit",
75
123
  "aria-label": "submit-button",
76
124
  variant: "accent",
@@ -88,17 +136,17 @@ var AuthCard = ({
88
136
  };
89
137
 
90
138
  // src/AuthConfirmSignUp.tsx
91
- import { NotificationCard } from "@ttoss/components/NotificationCard";
139
+ import { NotificationCard as NotificationCard2 } from "@ttoss/components/NotificationCard";
92
140
  import { Form, FormFieldInput, useForm, yup, yupResolver } from "@ttoss/forms";
93
- import { useI18n } from "@ttoss/react-i18n";
94
- import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
141
+ import { useI18n as useI18n2 } from "@ttoss/react-i18n";
142
+ import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
95
143
  var AuthConfirmSignUp = ({
96
144
  email,
97
145
  onConfirmSignUp
98
146
  }) => {
99
147
  const {
100
148
  intl
101
- } = useI18n();
149
+ } = useI18n2();
102
150
  const schema = yup.object().shape({
103
151
  code: yup.string().required(intl.formatMessage({
104
152
  id: "0XOzcH",
@@ -125,7 +173,7 @@ var AuthConfirmSignUp = ({
125
173
  const formMethods = useForm({
126
174
  resolver: yupResolver(schema)
127
175
  });
128
- return /* @__PURE__ */jsx2(Form, {
176
+ return /* @__PURE__ */jsx3(Form, {
129
177
  ...formMethods,
130
178
  onSubmit: ({
131
179
  code
@@ -151,7 +199,7 @@ var AuthConfirmSignUp = ({
151
199
  "value": "Confirmation"
152
200
  }]
153
201
  }),
154
- children: [/* @__PURE__ */jsx2(NotificationCard, {
202
+ children: [/* @__PURE__ */jsx3(NotificationCard2, {
155
203
  type: "info",
156
204
  message: intl.formatMessage({
157
205
  id: "pwv2cR",
@@ -160,7 +208,7 @@ var AuthConfirmSignUp = ({
160
208
  "value": "We have sent a confirmation code to your email address. Please enter the code below."
161
209
  }]
162
210
  })
163
- }), /* @__PURE__ */jsx2(FormFieldInput, {
211
+ }), /* @__PURE__ */jsx3(FormFieldInput, {
164
212
  sx: {
165
213
  marginTop: "6"
166
214
  },
@@ -179,10 +227,10 @@ var AuthConfirmSignUp = ({
179
227
 
180
228
  // src/AuthForgotPassword.tsx
181
229
  import { Form as Form2, FormFieldInput as FormFieldInput2, useForm as useForm2, yup as yup2, yupResolver as yupResolver2 } from "@ttoss/forms";
182
- import { useI18n as useI18n2 } from "@ttoss/react-i18n";
230
+ import { useI18n as useI18n3 } from "@ttoss/react-i18n";
183
231
  import { NotificationsBox } from "@ttoss/react-notifications";
184
232
  import { Button as Button2, Link, Text } from "@ttoss/ui";
185
- import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
233
+ import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
186
234
  var AuthForgotPassword = ({
187
235
  onForgotPassword,
188
236
  onCancel,
@@ -190,7 +238,7 @@ var AuthForgotPassword = ({
190
238
  }) => {
191
239
  const {
192
240
  intl
193
- } = useI18n2();
241
+ } = useI18n3();
194
242
  const schema = yup2.object().shape({
195
243
  email: yup2.string().required(intl.formatMessage({
196
244
  id: "5oOshZ",
@@ -210,7 +258,7 @@ var AuthForgotPassword = ({
210
258
  resolver: yupResolver2(schema),
211
259
  mode: "onBlur"
212
260
  });
213
- return /* @__PURE__ */jsx3(Form2, {
261
+ return /* @__PURE__ */jsx4(Form2, {
214
262
  ...formMethods,
215
263
  sx: {
216
264
  maxWidth: "390px"
@@ -238,7 +286,7 @@ var AuthForgotPassword = ({
238
286
  "value": "Recovering Password"
239
287
  }]
240
288
  }),
241
- extraButton: /* @__PURE__ */jsx3(Button2, {
289
+ extraButton: /* @__PURE__ */jsx4(Button2, {
242
290
  sx: {
243
291
  textAlign: "center",
244
292
  display: "initial"
@@ -253,7 +301,7 @@ var AuthForgotPassword = ({
253
301
  }]
254
302
  })
255
303
  }),
256
- children: [/* @__PURE__ */jsx3(FormFieldInput2, {
304
+ children: [/* @__PURE__ */jsx4(FormFieldInput2, {
257
305
  name: "email",
258
306
  label: intl.formatMessage({
259
307
  id: "XreZg+",
@@ -262,7 +310,7 @@ var AuthForgotPassword = ({
262
310
  "value": "Registered Email"
263
311
  }]
264
312
  })
265
- }), /* @__PURE__ */jsx3(NotificationsBox, {}), /* @__PURE__ */jsx3(Text, {
313
+ }), /* @__PURE__ */jsx4(NotificationsBox, {}), /* @__PURE__ */jsx4(Text, {
266
314
  sx: {
267
315
  marginTop: "xl",
268
316
  cursor: "pointer"
@@ -286,11 +334,11 @@ var PASSWORD_MINIMUM_LENGTH = 8;
286
334
 
287
335
  // src/AuthForgotPasswordResetPassword.tsx
288
336
  import { Form as Form3, FormFieldInput as FormFieldInput3, FormFieldPassword, useForm as useForm3, yup as yup3, yupResolver as yupResolver3 } from "@ttoss/forms";
289
- import { useI18n as useI18n3 } from "@ttoss/react-i18n";
337
+ import { useI18n as useI18n4 } from "@ttoss/react-i18n";
290
338
  import { NotificationsBox as NotificationsBox2 } from "@ttoss/react-notifications";
291
339
  import { Button as Button3 } from "@ttoss/ui";
292
340
  import * as React2 from "react";
293
- import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
341
+ import { jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
294
342
  var AuthForgotPasswordResetPassword = ({
295
343
  email,
296
344
  onForgotPasswordResetPassword,
@@ -298,7 +346,7 @@ var AuthForgotPasswordResetPassword = ({
298
346
  }) => {
299
347
  const {
300
348
  intl
301
- } = useI18n3();
349
+ } = useI18n4();
302
350
  const schema = React2.useMemo(() => {
303
351
  return yup3.object().shape({
304
352
  code: yup3.string().required(intl.formatMessage({
@@ -362,7 +410,7 @@ var AuthForgotPasswordResetPassword = ({
362
410
  resolver: yupResolver3(schema),
363
411
  mode: "onBlur"
364
412
  });
365
- return /* @__PURE__ */jsx4(Form3, {
413
+ return /* @__PURE__ */jsx5(Form3, {
366
414
  ...formMethods,
367
415
  sx: {
368
416
  maxWidth: "390px"
@@ -393,7 +441,7 @@ var AuthForgotPasswordResetPassword = ({
393
441
  "value": "Recovering Password"
394
442
  }]
395
443
  }),
396
- extraButton: /* @__PURE__ */jsx4(Button3, {
444
+ extraButton: /* @__PURE__ */jsx5(Button3, {
397
445
  sx: {
398
446
  textAlign: "center",
399
447
  display: "initial"
@@ -408,7 +456,7 @@ var AuthForgotPasswordResetPassword = ({
408
456
  }]
409
457
  })
410
458
  }),
411
- children: [/* @__PURE__ */jsx4(FormFieldInput3, {
459
+ children: [/* @__PURE__ */jsx5(FormFieldInput3, {
412
460
  name: "code",
413
461
  label: intl.formatMessage({
414
462
  id: "42HafR",
@@ -417,7 +465,7 @@ var AuthForgotPasswordResetPassword = ({
417
465
  "value": "Code"
418
466
  }]
419
467
  })
420
- }), /* @__PURE__ */jsx4(FormFieldPassword, {
468
+ }), /* @__PURE__ */jsx5(FormFieldPassword, {
421
469
  name: "password",
422
470
  label: intl.formatMessage({
423
471
  id: "PylVqx",
@@ -426,7 +474,7 @@ var AuthForgotPasswordResetPassword = ({
426
474
  "value": "Password"
427
475
  }]
428
476
  })
429
- }), /* @__PURE__ */jsx4(FormFieldPassword, {
477
+ }), /* @__PURE__ */jsx5(FormFieldPassword, {
430
478
  name: "confirmPassword",
431
479
  label: intl.formatMessage({
432
480
  id: "lY+cuM",
@@ -435,18 +483,18 @@ var AuthForgotPasswordResetPassword = ({
435
483
  "value": "Confirm password"
436
484
  }]
437
485
  })
438
- }), /* @__PURE__ */jsx4(NotificationsBox2, {})]
486
+ }), /* @__PURE__ */jsx5(NotificationsBox2, {})]
439
487
  })
440
488
  });
441
489
  };
442
490
 
443
491
  // src/AuthFullScreen.tsx
444
492
  import { Flex as Flex2 } from "@ttoss/ui";
445
- import { jsx as jsx5 } from "react/jsx-runtime";
493
+ import { jsx as jsx6 } from "react/jsx-runtime";
446
494
  var AuthFullScreen = ({
447
495
  children
448
496
  }) => {
449
- return /* @__PURE__ */jsx5(Flex2, {
497
+ return /* @__PURE__ */jsx6(Flex2, {
450
498
  sx: {
451
499
  height: "100vh",
452
500
  width: "100vw",
@@ -465,7 +513,7 @@ var AuthFullScreen = ({
465
513
  import { fetchAuthSession, fetchUserAttributes, getCurrentUser, signOut as awsSignOut } from "aws-amplify/auth";
466
514
  import { Hub } from "aws-amplify/utils";
467
515
  import * as React3 from "react";
468
- import { jsx as jsx6 } from "react/jsx-runtime";
516
+ import { jsx as jsx7 } from "react/jsx-runtime";
469
517
  var signOut = () => {
470
518
  return awsSignOut();
471
519
  };
@@ -526,7 +574,7 @@ var AuthProvider = ({
526
574
  if (isAuthenticated === void 0) {
527
575
  return null;
528
576
  }
529
- return /* @__PURE__ */jsx6(AuthContext.Provider, {
577
+ return /* @__PURE__ */jsx7(AuthContext.Provider, {
530
578
  value: {
531
579
  signOut,
532
580
  isAuthenticated,
@@ -542,10 +590,10 @@ var useAuth = () => {
542
590
 
543
591
  // src/AuthSignIn.tsx
544
592
  import { Form as Form4, FormFieldInput as FormFieldInput4, FormFieldPassword as FormFieldPassword2, useForm as useForm4, yup as yup4, yupResolver as yupResolver4 } from "@ttoss/forms";
545
- import { useI18n as useI18n4 } from "@ttoss/react-i18n";
593
+ import { useI18n as useI18n5 } from "@ttoss/react-i18n";
546
594
  import { NotificationsBox as NotificationsBox3 } from "@ttoss/react-notifications";
547
595
  import { Button as Button4, Flex as Flex3, Link as Link2, Text as Text2 } from "@ttoss/ui";
548
- import { jsx as jsx7, jsxs as jsxs5 } from "react/jsx-runtime";
596
+ import { jsx as jsx8, jsxs as jsxs5 } from "react/jsx-runtime";
549
597
  var AuthSignIn = ({
550
598
  onSignIn,
551
599
  onSignUp,
@@ -554,7 +602,7 @@ var AuthSignIn = ({
554
602
  }) => {
555
603
  const {
556
604
  intl
557
- } = useI18n4();
605
+ } = useI18n5();
558
606
  const schema = yup4.object().shape({
559
607
  email: yup4.string().required(intl.formatMessage({
560
608
  id: "d1YCuH",
@@ -600,7 +648,7 @@ var AuthSignIn = ({
600
648
  const onSubmitForm = data => {
601
649
  return onSignIn(data);
602
650
  };
603
- return /* @__PURE__ */jsx7(Form4, {
651
+ return /* @__PURE__ */jsx8(Form4, {
604
652
  sx: {
605
653
  maxWidth: "390px",
606
654
  width: "100%"
@@ -623,7 +671,7 @@ var AuthSignIn = ({
623
671
  }]
624
672
  }),
625
673
  isValidForm: formMethods.formState.isValid,
626
- extraButton: /* @__PURE__ */jsx7(Button4, {
674
+ extraButton: /* @__PURE__ */jsx8(Button4, {
627
675
  type: "button",
628
676
  variant: "secondary",
629
677
  sx: {
@@ -645,7 +693,7 @@ var AuthSignIn = ({
645
693
  flexDirection: "column",
646
694
  gap: "xl"
647
695
  },
648
- children: [/* @__PURE__ */jsx7(FormFieldInput4, {
696
+ children: [/* @__PURE__ */jsx8(FormFieldInput4, {
649
697
  name: "email",
650
698
  label: intl.formatMessage({
651
699
  id: "5E12mO",
@@ -654,7 +702,7 @@ var AuthSignIn = ({
654
702
  "value": "Email"
655
703
  }]
656
704
  })
657
- }), /* @__PURE__ */jsx7(FormFieldPassword2, {
705
+ }), /* @__PURE__ */jsx8(FormFieldPassword2, {
658
706
  name: "password",
659
707
  label: intl.formatMessage({
660
708
  id: "PylVqx",
@@ -664,12 +712,12 @@ var AuthSignIn = ({
664
712
  }]
665
713
  })
666
714
  })]
667
- }), /* @__PURE__ */jsx7(Flex3, {
715
+ }), /* @__PURE__ */jsx8(Flex3, {
668
716
  sx: {
669
717
  justifyContent: "space-between",
670
718
  marginTop: "lg"
671
719
  },
672
- children: /* @__PURE__ */jsx7(Text2, {
720
+ children: /* @__PURE__ */jsx8(Text2, {
673
721
  sx: {
674
722
  marginLeft: "auto",
675
723
  cursor: "pointer"
@@ -684,22 +732,22 @@ var AuthSignIn = ({
684
732
  }]
685
733
  })
686
734
  })
687
- }), /* @__PURE__ */jsx7(NotificationsBox3, {})]
735
+ }), /* @__PURE__ */jsx8(NotificationsBox3, {})]
688
736
  })
689
737
  });
690
738
  };
691
739
 
692
740
  // src/AuthSignUp.tsx
693
741
  import { Form as Form5, FormFieldCheckbox, FormFieldInput as FormFieldInput5, FormFieldPassword as FormFieldPassword3, useForm as useForm5, yup as yup5, yupResolver as yupResolver5 } from "@ttoss/forms";
694
- import { useI18n as useI18n5 } from "@ttoss/react-i18n";
742
+ import { useI18n as useI18n6 } from "@ttoss/react-i18n";
695
743
  import { NotificationsBox as NotificationsBox4 } from "@ttoss/react-notifications";
696
744
  import { Flex as Flex4, Link as Link3, Text as Text3 } from "@ttoss/ui";
697
745
  import * as React4 from "react";
698
- import { Fragment as Fragment2, jsx as jsx8, jsxs as jsxs6 } from "react/jsx-runtime";
746
+ import { Fragment as Fragment2, jsx as jsx9, jsxs as jsxs6 } from "react/jsx-runtime";
699
747
  var AuthSignUp = props => {
700
748
  const {
701
749
  intl
702
- } = useI18n5();
750
+ } = useI18n6();
703
751
  const schema = React4.useMemo(() => {
704
752
  return yup5.object().shape({
705
753
  email: yup5.string().required(intl.formatMessage({
@@ -772,7 +820,7 @@ var AuthSignUp = props => {
772
820
  const termsLinks = props.signUpTerms.terms.map((term, index, terms) => {
773
821
  const finalPunctuation = index === terms.length - 1 ? "." : ", ";
774
822
  return /* @__PURE__ */jsxs6(React4.Fragment, {
775
- children: [/* @__PURE__ */jsx8(Link3, {
823
+ children: [/* @__PURE__ */jsx9(Link3, {
776
824
  href: term.url,
777
825
  target: "_blank",
778
826
  rel: "noreferrer",
@@ -790,12 +838,12 @@ var AuthSignUp = props => {
790
838
  return null;
791
839
  }
792
840
  if (props.signUpTerms.isRequired) {
793
- return /* @__PURE__ */jsx8(FormFieldCheckbox, {
841
+ return /* @__PURE__ */jsx9(FormFieldCheckbox, {
794
842
  name: "signUpTerms",
795
843
  label: signUpTermsLabel
796
844
  });
797
845
  } else {
798
- return /* @__PURE__ */jsx8(Fragment2, {
846
+ return /* @__PURE__ */jsx9(Fragment2, {
799
847
  children: signUpTermsLabel
800
848
  });
801
849
  }
@@ -807,7 +855,7 @@ var AuthSignUp = props => {
807
855
  const onSubmitForm = data => {
808
856
  return props.onSignUp(data);
809
857
  };
810
- return /* @__PURE__ */jsx8(Form5, {
858
+ return /* @__PURE__ */jsx9(Form5, {
811
859
  sx: {
812
860
  maxWidth: "390px",
813
861
  width: "100%"
@@ -830,7 +878,7 @@ var AuthSignUp = props => {
830
878
  }]
831
879
  }),
832
880
  isValidForm: formMethods.formState.isValid,
833
- extraButton: /* @__PURE__ */jsx8(Text3, {
881
+ extraButton: /* @__PURE__ */jsx9(Text3, {
834
882
  sx: {
835
883
  cursor: "pointer"
836
884
  },
@@ -849,7 +897,7 @@ var AuthSignUp = props => {
849
897
  flexDirection: "column",
850
898
  gap: "xl"
851
899
  },
852
- children: [/* @__PURE__ */jsx8(FormFieldInput5, {
900
+ children: [/* @__PURE__ */jsx9(FormFieldInput5, {
853
901
  name: "email",
854
902
  label: intl.formatMessage({
855
903
  id: "5E12mO",
@@ -858,7 +906,7 @@ var AuthSignUp = props => {
858
906
  "value": "Email"
859
907
  }]
860
908
  })
861
- }), /* @__PURE__ */jsx8(FormFieldPassword3, {
909
+ }), /* @__PURE__ */jsx9(FormFieldPassword3, {
862
910
  name: "password",
863
911
  label: intl.formatMessage({
864
912
  id: "PylVqx",
@@ -867,7 +915,7 @@ var AuthSignUp = props => {
867
915
  "value": "Password"
868
916
  }]
869
917
  })
870
- }), /* @__PURE__ */jsx8(FormFieldPassword3, {
918
+ }), /* @__PURE__ */jsx9(FormFieldPassword3, {
871
919
  name: "confirmPassword",
872
920
  label: intl.formatMessage({
873
921
  id: "lY+cuM",
@@ -877,14 +925,17 @@ var AuthSignUp = props => {
877
925
  }]
878
926
  })
879
927
  }), signUpTermsNode]
880
- }), /* @__PURE__ */jsx8(NotificationsBox4, {})]
928
+ }), /* @__PURE__ */jsx9(NotificationsBox4, {})]
881
929
  })
882
930
  });
883
931
  };
884
932
 
885
933
  // src/Auth.tsx
886
- import { jsx as jsx9, jsxs as jsxs7 } from "react/jsx-runtime";
934
+ import { jsx as jsx10, jsxs as jsxs7 } from "react/jsx-runtime";
887
935
  var AuthLogic = props => {
936
+ const {
937
+ intl
938
+ } = useI18n7();
888
939
  const {
889
940
  isAuthenticated
890
941
  } = useAuth();
@@ -928,10 +979,17 @@ var AuthLogic = props => {
928
979
  email
929
980
  }
930
981
  });
931
- } else {
982
+ } else if (result.nextStep.signInStep === "DONE") {
932
983
  addNotification({
933
- type: "error",
934
- message: "Unknown error"
984
+ viewType: "toast",
985
+ type: "success",
986
+ message: intl.formatMessage({
987
+ id: "EO/33N",
988
+ defaultMessage: [{
989
+ "type": 0,
990
+ "value": "Signed in successfully"
991
+ }]
992
+ })
935
993
  });
936
994
  }
937
995
  } catch (error) {
@@ -942,7 +1000,7 @@ var AuthLogic = props => {
942
1000
  } finally {
943
1001
  setLoading(false);
944
1002
  }
945
- }, [addNotification, setLoading]);
1003
+ }, [addNotification, intl, setLoading]);
946
1004
  const onSignUp = React5.useCallback(async ({
947
1005
  email,
948
1006
  password
@@ -1058,20 +1116,20 @@ var AuthLogic = props => {
1058
1116
  return null;
1059
1117
  }
1060
1118
  if (screen.value === "signUp") {
1061
- return /* @__PURE__ */jsx9(AuthSignUp, {
1119
+ return /* @__PURE__ */jsx10(AuthSignUp, {
1062
1120
  onSignUp,
1063
1121
  onReturnToSignIn,
1064
1122
  signUpTerms: props.signUpTerms
1065
1123
  });
1066
1124
  }
1067
1125
  if (screen.value === "signUpConfirm" || screen.value === "signUpResendConfirmation") {
1068
- return /* @__PURE__ */jsx9(AuthConfirmSignUp, {
1126
+ return /* @__PURE__ */jsx10(AuthConfirmSignUp, {
1069
1127
  onConfirmSignUp,
1070
1128
  email: screen.context.email
1071
1129
  });
1072
1130
  }
1073
1131
  if (screen.value === "forgotPassword") {
1074
- return /* @__PURE__ */jsx9(AuthForgotPassword, {
1132
+ return /* @__PURE__ */jsx10(AuthForgotPassword, {
1075
1133
  onForgotPassword,
1076
1134
  onCancel: onReturnToSignIn,
1077
1135
  onSignUp: () => {
@@ -1083,13 +1141,13 @@ var AuthLogic = props => {
1083
1141
  });
1084
1142
  }
1085
1143
  if (screen.value === "forgotPasswordResetPassword") {
1086
- return /* @__PURE__ */jsx9(AuthForgotPasswordResetPassword, {
1144
+ return /* @__PURE__ */jsx10(AuthForgotPasswordResetPassword, {
1087
1145
  email: screen.context.email,
1088
1146
  onForgotPasswordResetPassword,
1089
1147
  onCancel: onReturnToSignIn
1090
1148
  });
1091
1149
  }
1092
- return /* @__PURE__ */jsx9(AuthSignIn, {
1150
+ return /* @__PURE__ */jsx10(AuthSignIn, {
1093
1151
  onSignIn,
1094
1152
  onSignUp: () => {
1095
1153
  setScreen({
@@ -1115,23 +1173,25 @@ var Auth = props => {
1115
1173
  }
1116
1174
  } = props;
1117
1175
  const withLogoNode = React5.useMemo(() => {
1118
- return /* @__PURE__ */jsx9(LogoProvider, {
1176
+ return /* @__PURE__ */jsx10(LogoProvider, {
1119
1177
  logo: props.logo,
1120
- children: /* @__PURE__ */jsx9(AuthLogic, {
1121
- signUpTerms: props.signUpTerms
1178
+ children: /* @__PURE__ */jsx10(ErrorBoundary, {
1179
+ children: /* @__PURE__ */jsx10(AuthLogic, {
1180
+ signUpTerms: props.signUpTerms
1181
+ })
1122
1182
  })
1123
1183
  });
1124
1184
  }, [props.logo, props.signUpTerms]);
1125
1185
  if (layout.fullScreen) {
1126
1186
  if (layout.sideContentPosition) {
1127
- return /* @__PURE__ */jsx9(AuthFullScreen, {
1187
+ return /* @__PURE__ */jsx10(AuthFullScreen, {
1128
1188
  children: /* @__PURE__ */jsxs7(Flex5, {
1129
1189
  sx: {
1130
1190
  width: "100%",
1131
1191
  height: "100%",
1132
1192
  flexDirection: layout.sideContentPosition === "left" ? "row" : "row-reverse"
1133
1193
  },
1134
- children: [/* @__PURE__ */jsx9(Flex5, {
1194
+ children: [/* @__PURE__ */jsx10(Flex5, {
1135
1195
  sx: {
1136
1196
  width: "100%",
1137
1197
  height: "100%",
@@ -1140,7 +1200,7 @@ var Auth = props => {
1140
1200
  alignItems: "center"
1141
1201
  },
1142
1202
  children: layout.sideContent
1143
- }), /* @__PURE__ */jsx9(Flex5, {
1203
+ }), /* @__PURE__ */jsx10(Flex5, {
1144
1204
  sx: {
1145
1205
  width: "100%",
1146
1206
  height: "100%",
@@ -1153,7 +1213,7 @@ var Auth = props => {
1153
1213
  })
1154
1214
  });
1155
1215
  }
1156
- return /* @__PURE__ */jsx9(AuthFullScreen, {
1216
+ return /* @__PURE__ */jsx10(AuthFullScreen, {
1157
1217
  children: withLogoNode
1158
1218
  });
1159
1219
  }
@@ -67,6 +67,12 @@
67
67
  "value": " characters"
68
68
  }
69
69
  ],
70
+ "EO/33N": [
71
+ {
72
+ "type": 0,
73
+ "value": "Signed in successfully"
74
+ }
75
+ ],
70
76
  "EZ3YF2": [
71
77
  {
72
78
  "type": 0,
@@ -201,6 +207,12 @@
201
207
  "value": "Password field is required"
202
208
  }
203
209
  ],
210
+ "khMx/2": [
211
+ {
212
+ "type": 0,
213
+ "value": "An error occurred with your authentication. Please try again."
214
+ }
215
+ ],
204
216
  "lY+cuM": [
205
217
  {
206
218
  "type": 0,
package/i18n/lang/en.json CHANGED
@@ -34,6 +34,9 @@
34
34
  "Co3exe": {
35
35
  "defaultMessage": "By signing up, you agree to the following Terms and Conditions."
36
36
  },
37
+ "EO/33N": {
38
+ "defaultMessage": "Signed in successfully"
39
+ },
37
40
  "EZ3YF2": {
38
41
  "defaultMessage": "Sign up",
39
42
  "description": "Sign up"
@@ -101,6 +104,9 @@
101
104
  "defaultMessage": "Password field is required",
102
105
  "description": "Password is required."
103
106
  },
107
+ "khMx/2": {
108
+ "defaultMessage": "An error occurred with your authentication. Please try again."
109
+ },
104
110
  "lY+cuM": {
105
111
  "defaultMessage": "Confirm password",
106
112
  "description": "Confirm Password label."
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ttoss/react-auth",
3
- "version": "2.5.12",
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
33
  "@ttoss/components": "^2.2.6",
31
34
  "@ttoss/forms": "^0.29.7",
32
- "@ttoss/react-i18n": "^2.0.10",
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/react-i18n": "^2.0.10",
51
+ "@ttoss/logger": "^0.5.0",
48
52
  "@ttoss/forms": "^0.29.7",
49
- "@ttoss/react-notifications": "^2.1.12",
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": [