@ttoss/react-auth-core 0.2.10 → 0.2.12

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/index.js CHANGED
@@ -7,6 +7,10 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
7
7
  var __getOwnPropNames = Object.getOwnPropertyNames;
8
8
  var __getProtoOf = Object.getPrototypeOf;
9
9
  var __hasOwnProp = Object.prototype.hasOwnProperty;
10
+ var __name = (target, value) => __defProp(target, "name", {
11
+ value,
12
+ configurable: true
13
+ });
10
14
  var __export = (target, all) => {
11
15
  for (var name in all) __defProp(target, name, {
12
16
  get: all[name],
@@ -56,24 +60,22 @@ module.exports = __toCommonJS(index_exports);
56
60
  // src/Auth.tsx
57
61
  var import_react_notifications6 = require("@ttoss/react-notifications");
58
62
  var import_ui7 = require("@ttoss/ui");
59
- var React3 = __toESM(require("react"), 1);
63
+ var React5 = __toESM(require("react"), 1);
60
64
 
61
65
  // src/AuthCard.tsx
62
66
  var import_react_notifications = require("@ttoss/react-notifications");
63
67
  var import_ui = require("@ttoss/ui");
64
- var React = __toESM(require("react"), 1);
65
- var import_jsx_runtime = require("react/jsx-runtime");
66
- var LogoContext = React.createContext({});
67
- var LogoProvider = ({
68
+ var React2 = __toESM(require("react"), 1);
69
+ var LogoContext = /* @__PURE__ */React2.createContext({});
70
+ var LogoProvider = /* @__PURE__ */__name(({
68
71
  children,
69
72
  ...values
70
73
  }) => {
71
- return /* @__PURE__ */(0, import_jsx_runtime.jsx)(LogoContext.Provider, {
72
- value: values,
73
- children
74
- });
75
- };
76
- var AuthCard = ({
74
+ return /* @__PURE__ */React2.createElement(LogoContext.Provider, {
75
+ value: values
76
+ }, children);
77
+ }, "LogoProvider");
78
+ var AuthCard = /* @__PURE__ */__name(({
77
79
  children,
78
80
  title,
79
81
  buttonLabel,
@@ -82,11 +84,11 @@ var AuthCard = ({
82
84
  }) => {
83
85
  const {
84
86
  logo
85
- } = React.useContext(LogoContext);
87
+ } = React2.useContext(LogoContext);
86
88
  const {
87
89
  isLoading
88
90
  } = (0, import_react_notifications.useNotifications)();
89
- return /* @__PURE__ */(0, import_jsx_runtime.jsxs)(import_ui.Box, {
91
+ return /* @__PURE__ */React2.createElement(import_ui.Box, {
90
92
  sx: {
91
93
  maxWidth: "400px",
92
94
  width: "full",
@@ -95,100 +97,90 @@ var AuthCard = ({
95
97
  paddingX: "8",
96
98
  paddingY: "9",
97
99
  backgroundColor: "surface"
100
+ }
101
+ }, logo && /* @__PURE__ */React2.createElement(import_ui.Flex, {
102
+ sx: {
103
+ width: "full",
104
+ maxHeight: "90px",
105
+ justifyContent: "center",
106
+ marginBottom: "8"
107
+ }
108
+ }, logo), /* @__PURE__ */React2.createElement(import_ui.Flex, {
109
+ sx: {
110
+ flexDirection: "column"
111
+ }
112
+ }, /* @__PURE__ */React2.createElement(import_ui.Heading, {
113
+ as: "h2",
114
+ variant: "h2",
115
+ sx: {
116
+ marginBottom: "8"
117
+ }
118
+ }, title), children, /* @__PURE__ */React2.createElement(import_ui.Flex, {
119
+ sx: {
120
+ flexDirection: "column",
121
+ width: "100%",
122
+ gap: "7",
123
+ marginTop: "8"
124
+ }
125
+ }, /* @__PURE__ */React2.createElement(import_ui.Button, {
126
+ type: "submit",
127
+ variant: "accent",
128
+ disabled: isLoading || !isValidForm,
129
+ sx: {
130
+ textAlign: "center",
131
+ display: "initial"
98
132
  },
99
- children: [logo && /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_ui.Flex, {
100
- sx: {
101
- width: "full",
102
- maxHeight: "90px",
103
- justifyContent: "center",
104
- marginBottom: "8"
105
- },
106
- children: logo
107
- }), /* @__PURE__ */(0, import_jsx_runtime.jsxs)(import_ui.Flex, {
108
- sx: {
109
- flexDirection: "column"
110
- },
111
- children: [/* @__PURE__ */(0, import_jsx_runtime.jsx)(import_ui.Heading, {
112
- as: "h2",
113
- variant: "h2",
114
- sx: {
115
- marginBottom: "8"
116
- },
117
- children: title
118
- }), children, /* @__PURE__ */(0, import_jsx_runtime.jsxs)(import_ui.Flex, {
119
- sx: {
120
- flexDirection: "column",
121
- width: "100%",
122
- gap: "7",
123
- marginTop: "8"
124
- },
125
- children: [/* @__PURE__ */(0, import_jsx_runtime.jsx)(import_ui.Button, {
126
- type: "submit",
127
- variant: "accent",
128
- disabled: isLoading || !isValidForm,
129
- sx: {
130
- textAlign: "center",
131
- display: "initial"
132
- },
133
- loading: isLoading,
134
- children: buttonLabel
135
- }), extraButton]
136
- })]
137
- })]
138
- });
139
- };
133
+ loading: isLoading
134
+ }, buttonLabel), extraButton)));
135
+ }, "AuthCard");
140
136
 
141
137
  // src/AuthConfirmSignUpCheckEmail.tsx
142
138
  var import_NotificationCard = require("@ttoss/components/NotificationCard");
143
139
  var import_react_i18n = require("@ttoss/react-i18n");
144
- var import_jsx_runtime2 = require("react/jsx-runtime");
145
- var AuthConfirmSignUpCheckEmail = ({
140
+ var AuthConfirmSignUpCheckEmail = /* @__PURE__ */__name(({
146
141
  onConfirmSignUpCheckEmail
147
142
  }) => {
148
143
  const {
149
144
  intl
150
145
  } = (0, import_react_i18n.useI18n)();
151
- return /* @__PURE__ */(0, import_jsx_runtime2.jsx)("form", {
152
- onSubmit: e => {
146
+ return /* @__PURE__ */React.createElement("form", {
147
+ onSubmit: /* @__PURE__ */__name(e => {
153
148
  e.preventDefault();
154
149
  onConfirmSignUpCheckEmail();
155
- },
156
- children: /* @__PURE__ */(0, import_jsx_runtime2.jsx)(AuthCard, {
157
- isValidForm: true,
158
- buttonLabel: intl.formatMessage({
159
- id: "38HSjr",
160
- defaultMessage: [{
161
- "type": 0,
162
- "value": "Sign In"
163
- }]
164
- }),
165
- title: intl.formatMessage({
166
- id: "cGR2eI",
167
- defaultMessage: [{
168
- "type": 0,
169
- "value": "Confirmation"
170
- }]
171
- }),
172
- children: /* @__PURE__ */(0, import_jsx_runtime2.jsx)(import_NotificationCard.NotificationCard, {
173
- type: "info",
174
- message: intl.formatMessage({
175
- id: "qTQ4hP",
176
- defaultMessage: [{
177
- "type": 0,
178
- "value": "An email has been sent to your address. Please check your inbox and follow the instructions to confirm your sign up."
179
- }]
180
- })
181
- })
150
+ }, "onSubmit")
151
+ }, /* @__PURE__ */React.createElement(AuthCard, {
152
+ isValidForm: true,
153
+ buttonLabel: intl.formatMessage({
154
+ id: "38HSjr",
155
+ defaultMessage: [{
156
+ "type": 0,
157
+ "value": "Sign In"
158
+ }]
159
+ }),
160
+ title: intl.formatMessage({
161
+ id: "cGR2eI",
162
+ defaultMessage: [{
163
+ "type": 0,
164
+ "value": "Confirmation"
165
+ }]
182
166
  })
183
- });
184
- };
167
+ }, /* @__PURE__ */React.createElement(import_NotificationCard.NotificationCard, {
168
+ type: "info",
169
+ message: intl.formatMessage({
170
+ id: "qTQ4hP",
171
+ defaultMessage: [{
172
+ "type": 0,
173
+ "value": "An email has been sent to your address. Please check your inbox and follow the instructions to confirm your sign up."
174
+ }]
175
+ })
176
+ })));
177
+ }, "AuthConfirmSignUpCheckEmail");
185
178
 
186
179
  // src/AuthConfirmSignUpWithCode.tsx
187
180
  var import_NotificationCard2 = require("@ttoss/components/NotificationCard");
188
181
  var import_forms = require("@ttoss/forms");
189
182
  var import_react_i18n2 = require("@ttoss/react-i18n");
190
- var import_jsx_runtime3 = require("react/jsx-runtime");
191
- var AuthConfirmSignUpWithCode = ({
183
+ var AuthConfirmSignUpWithCode = /* @__PURE__ */__name(({
192
184
  email,
193
185
  onConfirmSignUpWithCode
194
186
  }) => {
@@ -221,65 +213,62 @@ var AuthConfirmSignUpWithCode = ({
221
213
  const formMethods = (0, import_forms.useForm)({
222
214
  resolver: (0, import_forms.yupResolver)(schema)
223
215
  });
224
- return /* @__PURE__ */(0, import_jsx_runtime3.jsx)(import_forms.Form, {
216
+ return /* @__PURE__ */React.createElement(import_forms.Form, {
225
217
  ...formMethods,
226
- onSubmit: ({
218
+ onSubmit: /* @__PURE__ */__name(({
227
219
  code
228
220
  }) => {
229
221
  return onConfirmSignUpWithCode({
230
222
  code,
231
223
  email
232
224
  });
225
+ }, "onSubmit")
226
+ }, /* @__PURE__ */React.createElement(AuthCard, {
227
+ buttonLabel: intl.formatMessage({
228
+ id: "UNttd+",
229
+ defaultMessage: [{
230
+ "type": 0,
231
+ "value": "Confirm"
232
+ }]
233
+ }),
234
+ isValidForm: formMethods.formState.isValid,
235
+ title: intl.formatMessage({
236
+ id: "cGR2eI",
237
+ defaultMessage: [{
238
+ "type": 0,
239
+ "value": "Confirmation"
240
+ }]
241
+ })
242
+ }, /* @__PURE__ */React.createElement(import_NotificationCard2.NotificationCard, {
243
+ type: "info",
244
+ message: intl.formatMessage({
245
+ id: "pwv2cR",
246
+ defaultMessage: [{
247
+ "type": 0,
248
+ "value": "We have sent a confirmation code to your email address. Please enter the code below."
249
+ }]
250
+ })
251
+ }), /* @__PURE__ */React.createElement(import_forms.FormFieldInput, {
252
+ sx: {
253
+ marginTop: "6"
233
254
  },
234
- children: /* @__PURE__ */(0, import_jsx_runtime3.jsxs)(AuthCard, {
235
- buttonLabel: intl.formatMessage({
236
- id: "UNttd+",
237
- defaultMessage: [{
238
- "type": 0,
239
- "value": "Confirm"
240
- }]
241
- }),
242
- isValidForm: formMethods.formState.isValid,
243
- title: intl.formatMessage({
244
- id: "cGR2eI",
245
- defaultMessage: [{
246
- "type": 0,
247
- "value": "Confirmation"
248
- }]
249
- }),
250
- children: [/* @__PURE__ */(0, import_jsx_runtime3.jsx)(import_NotificationCard2.NotificationCard, {
251
- type: "info",
252
- message: intl.formatMessage({
253
- id: "pwv2cR",
254
- defaultMessage: [{
255
- "type": 0,
256
- "value": "We have sent a confirmation code to your email address. Please enter the code below."
257
- }]
258
- })
259
- }), /* @__PURE__ */(0, import_jsx_runtime3.jsx)(import_forms.FormFieldInput, {
260
- sx: {
261
- marginTop: "6"
262
- },
263
- name: "code",
264
- label: intl.formatMessage({
265
- id: "KY2T6J",
266
- defaultMessage: [{
267
- "type": 0,
268
- "value": "Code"
269
- }]
270
- })
271
- })]
255
+ name: "code",
256
+ label: intl.formatMessage({
257
+ id: "KY2T6J",
258
+ defaultMessage: [{
259
+ "type": 0,
260
+ "value": "Code"
261
+ }]
272
262
  })
273
- });
274
- };
263
+ })));
264
+ }, "AuthConfirmSignUpWithCode");
275
265
 
276
266
  // src/AuthForgotPassword.tsx
277
267
  var import_forms2 = require("@ttoss/forms");
278
268
  var import_react_i18n3 = require("@ttoss/react-i18n");
279
269
  var import_react_notifications2 = require("@ttoss/react-notifications");
280
270
  var import_ui2 = require("@ttoss/ui");
281
- var import_jsx_runtime4 = require("react/jsx-runtime");
282
- var AuthForgotPassword = props => {
271
+ var AuthForgotPassword = /* @__PURE__ */__name(props => {
283
272
  const {
284
273
  intl
285
274
  } = (0, import_react_i18n3.useI18n)();
@@ -296,84 +285,79 @@ var AuthForgotPassword = props => {
296
285
  resolver: (0, import_forms2.yupResolver)(schema),
297
286
  mode: "onChange"
298
287
  });
299
- return /* @__PURE__ */(0, import_jsx_runtime4.jsx)(import_forms2.Form, {
288
+ return /* @__PURE__ */React.createElement(import_forms2.Form, {
300
289
  ...formMethods,
301
290
  sx: {
302
291
  maxWidth: "390px"
303
292
  },
304
- onSubmit: ({
293
+ onSubmit: /* @__PURE__ */__name(({
305
294
  email
306
295
  }) => {
307
296
  return props.onForgotPassword({
308
297
  email
309
298
  });
310
- },
311
- children: /* @__PURE__ */(0, import_jsx_runtime4.jsxs)(AuthCard, {
312
- buttonLabel: intl.formatMessage({
313
- id: "mZzmNV",
314
- defaultMessage: [{
315
- "type": 0,
316
- "value": "Recover Password"
317
- }]
318
- }),
319
- isValidForm: formMethods.formState.isValid,
320
- title: intl.formatMessage({
321
- id: "S4bbEj",
322
- defaultMessage: [{
323
- "type": 0,
324
- "value": "Recovering Password"
325
- }]
326
- }),
327
- extraButton: /* @__PURE__ */(0, import_jsx_runtime4.jsx)(import_ui2.Button, {
328
- sx: {
329
- textAlign: "center",
330
- display: "initial"
331
- },
332
- variant: "secondary",
333
- onClick: props.onGoToSignIn,
334
- children: intl.formatMessage({
335
- id: "6PdOcy",
336
- defaultMessage: [{
337
- "type": 0,
338
- "value": "Cancel"
339
- }]
340
- })
341
- }),
342
- children: [/* @__PURE__ */(0, import_jsx_runtime4.jsx)(import_forms2.FormFieldInput, {
343
- name: "email",
344
- label: intl.formatMessage({
345
- id: "XreZg+",
346
- defaultMessage: [{
347
- "type": 0,
348
- "value": "Registered Email"
349
- }]
350
- })
351
- }), /* @__PURE__ */(0, import_jsx_runtime4.jsx)(import_react_notifications2.NotificationsBox, {}), props.onGoToSignUp && /* @__PURE__ */(0, import_jsx_runtime4.jsx)(import_ui2.Text, {
352
- sx: {
353
- marginTop: "xl",
354
- cursor: "pointer"
355
- },
356
- as: import_ui2.Link,
357
- onClick: props.onGoToSignUp,
358
- children: intl.formatMessage({
359
- id: "lZvoYL",
360
- defaultMessage: [{
361
- "type": 0,
362
- "value": "Sign up now"
363
- }]
364
- })
365
- })]
299
+ }, "onSubmit")
300
+ }, /* @__PURE__ */React.createElement(AuthCard, {
301
+ buttonLabel: intl.formatMessage({
302
+ id: "mZzmNV",
303
+ defaultMessage: [{
304
+ "type": 0,
305
+ "value": "Recover Password"
306
+ }]
307
+ }),
308
+ isValidForm: formMethods.formState.isValid,
309
+ title: intl.formatMessage({
310
+ id: "S4bbEj",
311
+ defaultMessage: [{
312
+ "type": 0,
313
+ "value": "Recovering Password"
314
+ }]
315
+ }),
316
+ extraButton: /* @__PURE__ */React.createElement(import_ui2.Button, {
317
+ sx: {
318
+ textAlign: "center",
319
+ display: "initial"
320
+ },
321
+ variant: "secondary",
322
+ onClick: props.onGoToSignIn
323
+ }, intl.formatMessage({
324
+ id: "6PdOcy",
325
+ defaultMessage: [{
326
+ "type": 0,
327
+ "value": "Cancel"
328
+ }]
329
+ }))
330
+ }, /* @__PURE__ */React.createElement(import_forms2.FormFieldInput, {
331
+ name: "email",
332
+ label: intl.formatMessage({
333
+ id: "XreZg+",
334
+ defaultMessage: [{
335
+ "type": 0,
336
+ "value": "Registered Email"
337
+ }]
366
338
  })
367
- });
368
- };
339
+ }), /* @__PURE__ */React.createElement(import_react_notifications2.NotificationsBox, null), props.onGoToSignUp && /* @__PURE__ */React.createElement(import_ui2.Text, {
340
+ sx: {
341
+ marginTop: "xl",
342
+ cursor: "pointer"
343
+ },
344
+ as: import_ui2.Link,
345
+ onClick: props.onGoToSignUp
346
+ }, intl.formatMessage({
347
+ id: "lZvoYL",
348
+ defaultMessage: [{
349
+ "type": 0,
350
+ "value": "Sign up now"
351
+ }]
352
+ }))));
353
+ }, "AuthForgotPassword");
369
354
 
370
355
  // src/AuthForgotPasswordResetPassword.tsx
371
356
  var import_forms3 = require("@ttoss/forms");
372
357
  var import_react_i18n4 = require("@ttoss/react-i18n");
373
358
  var import_react_notifications3 = require("@ttoss/react-notifications");
374
359
  var import_ui3 = require("@ttoss/ui");
375
- var import_jsx_runtime5 = require("react/jsx-runtime");
376
- var AuthForgotPasswordResetPassword = props => {
360
+ var AuthForgotPasswordResetPassword = /* @__PURE__ */__name(props => {
377
361
  const {
378
362
  intl
379
363
  } = (0, import_react_i18n4.useI18n)();
@@ -425,12 +409,12 @@ var AuthForgotPasswordResetPassword = props => {
425
409
  resolver: (0, import_forms3.yupResolver)(schema),
426
410
  mode: "onChange"
427
411
  });
428
- return /* @__PURE__ */(0, import_jsx_runtime5.jsx)(import_forms3.Form, {
412
+ return /* @__PURE__ */React.createElement(import_forms3.Form, {
429
413
  ...formMethods,
430
414
  sx: {
431
415
  maxWidth: "390px"
432
416
  },
433
- onSubmit: ({
417
+ onSubmit: /* @__PURE__ */__name(({
434
418
  code,
435
419
  newPassword
436
420
  }) => {
@@ -439,69 +423,65 @@ var AuthForgotPasswordResetPassword = props => {
439
423
  code,
440
424
  newPassword
441
425
  });
442
- },
443
- children: /* @__PURE__ */(0, import_jsx_runtime5.jsxs)(AuthCard, {
444
- buttonLabel: intl.formatMessage({
445
- id: "HT4tSM",
446
- defaultMessage: [{
447
- "type": 0,
448
- "value": "Reset Password"
449
- }]
450
- }),
451
- isValidForm: formMethods.formState.isValid,
452
- title: intl.formatMessage({
453
- id: "HT4tSM",
454
- defaultMessage: [{
455
- "type": 0,
456
- "value": "Reset Password"
457
- }]
458
- }),
459
- extraButton: props.onGoToSignIn ? /* @__PURE__ */(0, import_jsx_runtime5.jsx)(import_ui3.Button, {
460
- type: "button",
461
- sx: {
462
- textAlign: "center",
463
- display: "initial"
464
- },
465
- variant: "secondary",
466
- onClick: props.onGoToSignIn,
467
- children: intl.formatMessage({
468
- id: "6PdOcy",
469
- defaultMessage: [{
470
- "type": 0,
471
- "value": "Cancel"
472
- }]
473
- })
474
- }) : null,
475
- children: [/* @__PURE__ */(0, import_jsx_runtime5.jsx)(import_forms3.FormFieldInput, {
476
- name: "code",
477
- label: intl.formatMessage({
478
- id: "s1OmP0",
479
- defaultMessage: [{
480
- "type": 0,
481
- "value": "Confirmation code"
482
- }]
483
- })
484
- }), /* @__PURE__ */(0, import_jsx_runtime5.jsx)(import_forms3.FormFieldPassword, {
485
- name: "newPassword",
486
- label: intl.formatMessage({
487
- id: "e3IQoc",
488
- defaultMessage: [{
489
- "type": 0,
490
- "value": "New Password"
491
- }]
492
- })
493
- }), /* @__PURE__ */(0, import_jsx_runtime5.jsx)(import_react_notifications3.NotificationsBox, {})]
426
+ }, "onSubmit")
427
+ }, /* @__PURE__ */React.createElement(AuthCard, {
428
+ buttonLabel: intl.formatMessage({
429
+ id: "HT4tSM",
430
+ defaultMessage: [{
431
+ "type": 0,
432
+ "value": "Reset Password"
433
+ }]
434
+ }),
435
+ isValidForm: formMethods.formState.isValid,
436
+ title: intl.formatMessage({
437
+ id: "HT4tSM",
438
+ defaultMessage: [{
439
+ "type": 0,
440
+ "value": "Reset Password"
441
+ }]
442
+ }),
443
+ extraButton: props.onGoToSignIn ? /* @__PURE__ */React.createElement(import_ui3.Button, {
444
+ type: "button",
445
+ sx: {
446
+ textAlign: "center",
447
+ display: "initial"
448
+ },
449
+ variant: "secondary",
450
+ onClick: props.onGoToSignIn
451
+ }, intl.formatMessage({
452
+ id: "6PdOcy",
453
+ defaultMessage: [{
454
+ "type": 0,
455
+ "value": "Cancel"
456
+ }]
457
+ })) : null
458
+ }, /* @__PURE__ */React.createElement(import_forms3.FormFieldInput, {
459
+ name: "code",
460
+ label: intl.formatMessage({
461
+ id: "s1OmP0",
462
+ defaultMessage: [{
463
+ "type": 0,
464
+ "value": "Confirmation code"
465
+ }]
494
466
  })
495
- });
496
- };
467
+ }), /* @__PURE__ */React.createElement(import_forms3.FormFieldPassword, {
468
+ name: "newPassword",
469
+ label: intl.formatMessage({
470
+ id: "e3IQoc",
471
+ defaultMessage: [{
472
+ "type": 0,
473
+ "value": "New Password"
474
+ }]
475
+ })
476
+ }), /* @__PURE__ */React.createElement(import_react_notifications3.NotificationsBox, null)));
477
+ }, "AuthForgotPasswordResetPassword");
497
478
 
498
479
  // src/AuthFullScreen.tsx
499
480
  var import_ui4 = require("@ttoss/ui");
500
- var import_jsx_runtime6 = require("react/jsx-runtime");
501
- var AuthFullScreen = ({
481
+ var AuthFullScreen = /* @__PURE__ */__name(({
502
482
  children
503
483
  }) => {
504
- return /* @__PURE__ */(0, import_jsx_runtime6.jsx)(import_ui4.Flex, {
484
+ return /* @__PURE__ */React.createElement(import_ui4.Flex, {
505
485
  sx: {
506
486
  height: "100vh",
507
487
  width: "100vw",
@@ -511,18 +491,16 @@ var AuthFullScreen = ({
511
491
  backgroundPosition: "center",
512
492
  backgroundRepeat: "no-repeat",
513
493
  backgroundSize: "cover"
514
- },
515
- children
516
- });
517
- };
494
+ }
495
+ }, children);
496
+ }, "AuthFullScreen");
518
497
 
519
498
  // src/AuthSignIn.tsx
520
499
  var import_forms4 = require("@ttoss/forms");
521
500
  var import_react_i18n5 = require("@ttoss/react-i18n");
522
501
  var import_react_notifications4 = require("@ttoss/react-notifications");
523
502
  var import_ui5 = require("@ttoss/ui");
524
- var import_jsx_runtime7 = require("react/jsx-runtime");
525
- var AuthSignIn = ({
503
+ var AuthSignIn = /* @__PURE__ */__name(({
526
504
  onSignIn,
527
505
  onGoToSignUp,
528
506
  defaultValues,
@@ -573,112 +551,105 @@ var AuthSignIn = ({
573
551
  mode: "onChange",
574
552
  resolver: (0, import_forms4.yupResolver)(schema)
575
553
  });
576
- const onSubmitForm = data => {
554
+ const onSubmitForm = /* @__PURE__ */__name(data => {
577
555
  return onSignIn(data);
578
- };
579
- return /* @__PURE__ */(0, import_jsx_runtime7.jsx)(import_forms4.Form, {
556
+ }, "onSubmitForm");
557
+ return /* @__PURE__ */React.createElement(import_forms4.Form, {
580
558
  sx: {
581
559
  maxWidth: "390px",
582
560
  width: "100%"
583
561
  },
584
562
  ...formMethods,
585
- onSubmit: onSubmitForm,
586
- children: /* @__PURE__ */(0, import_jsx_runtime7.jsxs)(AuthCard, {
587
- title: intl.formatMessage({
588
- id: "SQJto2",
589
- defaultMessage: [{
590
- "type": 0,
591
- "value": "Sign in"
592
- }]
593
- }),
594
- buttonLabel: intl.formatMessage({
595
- id: "SQJto2",
596
- defaultMessage: [{
597
- "type": 0,
598
- "value": "Sign in"
599
- }]
600
- }),
601
- isValidForm: formMethods.formState.isValid,
602
- extraButton: onGoToSignUp ? /* @__PURE__ */(0, import_jsx_runtime7.jsx)(import_ui5.Button, {
603
- type: "button",
604
- variant: "secondary",
605
- sx: {
606
- textAlign: "center",
607
- display: "initial"
608
- },
609
- onClick: onGoToSignUp,
610
- children: intl.formatMessage({
611
- id: "EZ3YF2",
612
- defaultMessage: [{
613
- "type": 0,
614
- "value": "Sign up"
615
- }]
616
- })
617
- }) : null,
618
- children: [/* @__PURE__ */(0, import_jsx_runtime7.jsxs)(import_ui5.Flex, {
619
- sx: {
620
- flexDirection: "column",
621
- gap: "xl"
622
- },
623
- children: [/* @__PURE__ */(0, import_jsx_runtime7.jsx)(import_forms4.FormFieldInput, {
624
- name: "email",
625
- label: intl.formatMessage({
626
- id: "5E12mO",
627
- defaultMessage: [{
628
- "type": 0,
629
- "value": "Email"
630
- }]
631
- })
632
- }), /* @__PURE__ */(0, import_jsx_runtime7.jsx)(import_forms4.FormFieldPassword, {
633
- name: "password",
634
- label: intl.formatMessage({
635
- id: "PylVqx",
636
- defaultMessage: [{
637
- "type": 0,
638
- "value": "Password"
639
- }]
640
- })
641
- })]
642
- }), onGoToForgotPassword && /* @__PURE__ */(0, import_jsx_runtime7.jsx)(import_ui5.Flex, {
643
- sx: {
644
- justifyContent: "space-between",
645
- marginTop: "lg"
646
- },
647
- children: /* @__PURE__ */(0, import_jsx_runtime7.jsx)(import_ui5.Text, {
648
- sx: {
649
- marginLeft: "auto",
650
- cursor: "pointer"
651
- },
652
- as: import_ui5.Link,
653
- onClick: onGoToForgotPassword,
654
- children: intl.formatMessage({
655
- id: "BtK6KR",
656
- defaultMessage: [{
657
- "type": 0,
658
- "value": "Forgot password?"
659
- }]
660
- })
661
- })
662
- }), /* @__PURE__ */(0, import_jsx_runtime7.jsx)(import_react_notifications4.NotificationsBox, {})]
563
+ onSubmit: onSubmitForm
564
+ }, /* @__PURE__ */React.createElement(AuthCard, {
565
+ title: intl.formatMessage({
566
+ id: "SQJto2",
567
+ defaultMessage: [{
568
+ "type": 0,
569
+ "value": "Sign in"
570
+ }]
571
+ }),
572
+ buttonLabel: intl.formatMessage({
573
+ id: "SQJto2",
574
+ defaultMessage: [{
575
+ "type": 0,
576
+ "value": "Sign in"
577
+ }]
578
+ }),
579
+ isValidForm: formMethods.formState.isValid,
580
+ extraButton: onGoToSignUp ? /* @__PURE__ */React.createElement(import_ui5.Button, {
581
+ type: "button",
582
+ variant: "secondary",
583
+ sx: {
584
+ textAlign: "center",
585
+ display: "initial"
586
+ },
587
+ onClick: onGoToSignUp
588
+ }, intl.formatMessage({
589
+ id: "EZ3YF2",
590
+ defaultMessage: [{
591
+ "type": 0,
592
+ "value": "Sign up"
593
+ }]
594
+ })) : null
595
+ }, /* @__PURE__ */React.createElement(import_ui5.Flex, {
596
+ sx: {
597
+ flexDirection: "column",
598
+ gap: "xl"
599
+ }
600
+ }, /* @__PURE__ */React.createElement(import_forms4.FormFieldInput, {
601
+ name: "email",
602
+ label: intl.formatMessage({
603
+ id: "5E12mO",
604
+ defaultMessage: [{
605
+ "type": 0,
606
+ "value": "Email"
607
+ }]
663
608
  })
664
- });
665
- };
609
+ }), /* @__PURE__ */React.createElement(import_forms4.FormFieldPassword, {
610
+ name: "password",
611
+ label: intl.formatMessage({
612
+ id: "PylVqx",
613
+ defaultMessage: [{
614
+ "type": 0,
615
+ "value": "Password"
616
+ }]
617
+ })
618
+ })), onGoToForgotPassword && /* @__PURE__ */React.createElement(import_ui5.Flex, {
619
+ sx: {
620
+ justifyContent: "space-between",
621
+ marginTop: "lg"
622
+ }
623
+ }, /* @__PURE__ */React.createElement(import_ui5.Text, {
624
+ sx: {
625
+ marginLeft: "auto",
626
+ cursor: "pointer"
627
+ },
628
+ as: import_ui5.Link,
629
+ onClick: onGoToForgotPassword
630
+ }, intl.formatMessage({
631
+ id: "BtK6KR",
632
+ defaultMessage: [{
633
+ "type": 0,
634
+ "value": "Forgot password?"
635
+ }]
636
+ }))), /* @__PURE__ */React.createElement(import_react_notifications4.NotificationsBox, null)));
637
+ }, "AuthSignIn");
666
638
 
667
639
  // src/AuthSignUp.tsx
668
640
  var import_forms5 = require("@ttoss/forms");
669
641
  var import_react_i18n6 = require("@ttoss/react-i18n");
670
642
  var import_react_notifications5 = require("@ttoss/react-notifications");
671
643
  var import_ui6 = require("@ttoss/ui");
672
- var React2 = __toESM(require("react"), 1);
673
- var import_jsx_runtime8 = require("react/jsx-runtime");
674
- var AuthSignUp = props => {
644
+ var React3 = __toESM(require("react"), 1);
645
+ var AuthSignUp = /* @__PURE__ */__name(props => {
675
646
  const {
676
647
  intl
677
648
  } = (0, import_react_i18n6.useI18n)();
678
649
  const {
679
650
  passwordMinimumLength = 8
680
651
  } = props;
681
- const schema = React2.useMemo(() => {
652
+ const schema = React3.useMemo(() => {
682
653
  return import_forms5.yup.object().shape({
683
654
  email: import_forms5.yup.string().required(intl.formatMessage({
684
655
  id: "d1YCuH",
@@ -736,7 +707,7 @@ var AuthSignUp = props => {
736
707
  })) : import_forms5.yup.boolean()
737
708
  });
738
709
  }, [intl, props.signUpTerms?.isRequired, passwordMinimumLength]);
739
- const signUpTermsLabel = React2.useMemo(() => {
710
+ const signUpTermsLabel = React3.useMemo(() => {
740
711
  if (!props.signUpTerms) {
741
712
  return null;
742
713
  }
@@ -749,163 +720,152 @@ var AuthSignUp = props => {
749
720
  });
750
721
  const termsLinks = props.signUpTerms.terms.map((term, index, terms) => {
751
722
  const finalPunctuation = index === terms.length - 1 ? "." : ", ";
752
- return /* @__PURE__ */(0, import_jsx_runtime8.jsxs)(React2.Fragment, {
753
- children: [/* @__PURE__ */(0, import_jsx_runtime8.jsx)(import_ui6.Link, {
754
- href: term.url,
755
- target: "_blank",
756
- rel: "noreferrer",
757
- children: term.label
758
- }, index), finalPunctuation]
759
- }, index);
760
- });
761
- const label = /* @__PURE__ */(0, import_jsx_runtime8.jsxs)(import_ui6.Text, {
762
- children: [signUpTermsFirstMessage, " ", termsLinks]
723
+ return /* @__PURE__ */React3.createElement(React3.Fragment, {
724
+ key: index
725
+ }, /* @__PURE__ */React3.createElement(import_ui6.Link, {
726
+ key: index,
727
+ href: term.url,
728
+ target: "_blank",
729
+ rel: "noreferrer"
730
+ }, term.label), finalPunctuation);
763
731
  });
732
+ const label = /* @__PURE__ */React3.createElement(import_ui6.Text, null, signUpTermsFirstMessage, " ", termsLinks);
764
733
  return label;
765
734
  }, [intl, props.signUpTerms]);
766
- const signUpTermsNode = React2.useMemo(() => {
735
+ const signUpTermsNode = React3.useMemo(() => {
767
736
  if (!props.signUpTerms) {
768
737
  return null;
769
738
  }
770
739
  if (props.signUpTerms.isRequired) {
771
- return /* @__PURE__ */(0, import_jsx_runtime8.jsx)(import_forms5.FormFieldCheckbox, {
740
+ return /* @__PURE__ */React3.createElement(import_forms5.FormFieldCheckbox, {
772
741
  name: "signUpTerms",
773
742
  label: signUpTermsLabel
774
743
  });
775
744
  } else {
776
- return /* @__PURE__ */(0, import_jsx_runtime8.jsx)(import_jsx_runtime8.Fragment, {
777
- children: signUpTermsLabel
778
- });
745
+ return /* @__PURE__ */React3.createElement(React3.Fragment, null, signUpTermsLabel);
779
746
  }
780
747
  }, [props.signUpTerms, signUpTermsLabel]);
781
748
  const formMethods = (0, import_forms5.useForm)({
782
749
  mode: "onChange",
783
750
  resolver: (0, import_forms5.yupResolver)(schema)
784
751
  });
785
- const onSubmitForm = data => {
752
+ const onSubmitForm = /* @__PURE__ */__name(data => {
786
753
  return props.onSignUp(data);
787
- };
788
- return /* @__PURE__ */(0, import_jsx_runtime8.jsx)(import_forms5.Form, {
754
+ }, "onSubmitForm");
755
+ return /* @__PURE__ */React3.createElement(import_forms5.Form, {
789
756
  sx: {
790
757
  maxWidth: "390px",
791
758
  width: "100%"
792
759
  },
793
760
  ...formMethods,
794
- onSubmit: onSubmitForm,
795
- children: /* @__PURE__ */(0, import_jsx_runtime8.jsxs)(AuthCard, {
796
- buttonLabel: intl.formatMessage({
797
- id: "URJDrG",
798
- defaultMessage: [{
799
- "type": 0,
800
- "value": "Sign up"
801
- }]
802
- }),
803
- title: intl.formatMessage({
804
- id: "oayEC3",
805
- defaultMessage: [{
806
- "type": 0,
807
- "value": "Sign up"
808
- }]
809
- }),
810
- isValidForm: formMethods.formState.isValid,
811
- extraButton: /* @__PURE__ */(0, import_jsx_runtime8.jsx)(import_ui6.Text, {
812
- sx: {
813
- cursor: "pointer"
814
- },
815
- onClick: props.onGoToSignIn,
816
- as: import_ui6.Link,
817
- children: intl.formatMessage({
818
- id: "8GMUPk",
819
- defaultMessage: [{
820
- "type": 0,
821
- "value": "I'm already registered"
822
- }]
823
- })
824
- }),
825
- children: [/* @__PURE__ */(0, import_jsx_runtime8.jsxs)(import_ui6.Flex, {
826
- sx: {
827
- flexDirection: "column",
828
- gap: "xl"
829
- },
830
- children: [/* @__PURE__ */(0, import_jsx_runtime8.jsx)(import_forms5.FormFieldInput, {
831
- name: "email",
832
- label: intl.formatMessage({
833
- id: "5E12mO",
834
- defaultMessage: [{
835
- "type": 0,
836
- "value": "Email"
837
- }]
838
- })
839
- }), /* @__PURE__ */(0, import_jsx_runtime8.jsx)(import_forms5.FormFieldPassword, {
840
- name: "password",
841
- label: intl.formatMessage({
842
- id: "PylVqx",
843
- defaultMessage: [{
844
- "type": 0,
845
- "value": "Password"
846
- }]
847
- })
848
- }), /* @__PURE__ */(0, import_jsx_runtime8.jsx)(import_forms5.FormFieldPassword, {
849
- name: "confirmPassword",
850
- label: intl.formatMessage({
851
- id: "lY+cuM",
852
- defaultMessage: [{
853
- "type": 0,
854
- "value": "Confirm password"
855
- }]
856
- })
857
- }), signUpTermsNode]
858
- }), /* @__PURE__ */(0, import_jsx_runtime8.jsx)(import_react_notifications5.NotificationsBox, {})]
761
+ onSubmit: onSubmitForm
762
+ }, /* @__PURE__ */React3.createElement(AuthCard, {
763
+ buttonLabel: intl.formatMessage({
764
+ id: "URJDrG",
765
+ defaultMessage: [{
766
+ "type": 0,
767
+ "value": "Sign up"
768
+ }]
769
+ }),
770
+ title: intl.formatMessage({
771
+ id: "oayEC3",
772
+ defaultMessage: [{
773
+ "type": 0,
774
+ "value": "Sign up"
775
+ }]
776
+ }),
777
+ isValidForm: formMethods.formState.isValid,
778
+ extraButton: /* @__PURE__ */React3.createElement(import_ui6.Text, {
779
+ sx: {
780
+ cursor: "pointer"
781
+ },
782
+ onClick: props.onGoToSignIn,
783
+ as: import_ui6.Link
784
+ }, intl.formatMessage({
785
+ id: "8GMUPk",
786
+ defaultMessage: [{
787
+ "type": 0,
788
+ "value": "I'm already registered"
789
+ }]
790
+ }))
791
+ }, /* @__PURE__ */React3.createElement(import_ui6.Flex, {
792
+ sx: {
793
+ flexDirection: "column",
794
+ gap: "xl"
795
+ }
796
+ }, /* @__PURE__ */React3.createElement(import_forms5.FormFieldInput, {
797
+ name: "email",
798
+ label: intl.formatMessage({
799
+ id: "5E12mO",
800
+ defaultMessage: [{
801
+ "type": 0,
802
+ "value": "Email"
803
+ }]
859
804
  })
860
- });
861
- };
805
+ }), /* @__PURE__ */React3.createElement(import_forms5.FormFieldPassword, {
806
+ name: "password",
807
+ label: intl.formatMessage({
808
+ id: "PylVqx",
809
+ defaultMessage: [{
810
+ "type": 0,
811
+ "value": "Password"
812
+ }]
813
+ })
814
+ }), /* @__PURE__ */React3.createElement(import_forms5.FormFieldPassword, {
815
+ name: "confirmPassword",
816
+ label: intl.formatMessage({
817
+ id: "lY+cuM",
818
+ defaultMessage: [{
819
+ "type": 0,
820
+ "value": "Confirm password"
821
+ }]
822
+ })
823
+ }), signUpTermsNode), /* @__PURE__ */React3.createElement(import_react_notifications5.NotificationsBox, null)));
824
+ }, "AuthSignUp");
862
825
 
863
826
  // src/ErrorBoundary.tsx
864
827
  var import_NotificationCard3 = require("@ttoss/components/NotificationCard");
865
828
  var import_logger = require("@ttoss/logger");
866
829
  var import_react_i18n7 = require("@ttoss/react-i18n");
830
+ var React4 = __toESM(require("react"), 1);
867
831
  var import_react_error_boundary = require("react-error-boundary");
868
- var import_jsx_runtime9 = require("react/jsx-runtime");
869
- var ErrorFallback = ({
832
+ var ErrorFallback = /* @__PURE__ */__name(({
870
833
  resetErrorBoundary
871
834
  }) => {
872
835
  const {
873
836
  intl
874
837
  } = (0, import_react_i18n7.useI18n)();
875
- return /* @__PURE__ */(0, import_jsx_runtime9.jsx)("div", {
876
- role: "alert",
877
- children: /* @__PURE__ */(0, import_jsx_runtime9.jsx)(import_NotificationCard3.NotificationCard, {
878
- type: "error",
879
- message: intl.formatMessage({
880
- id: "khMx/2",
881
- defaultMessage: [{
882
- "type": 0,
883
- "value": "An error occurred with your authentication. Please try again."
884
- }]
885
- }),
886
- onClose: resetErrorBoundary
887
- })
888
- });
889
- };
890
- var ErrorBoundary = ({
838
+ return /* @__PURE__ */React4.createElement("div", {
839
+ role: "alert"
840
+ }, /* @__PURE__ */React4.createElement(import_NotificationCard3.NotificationCard, {
841
+ type: "error",
842
+ message: intl.formatMessage({
843
+ id: "khMx/2",
844
+ defaultMessage: [{
845
+ "type": 0,
846
+ "value": "An error occurred with your authentication. Please try again."
847
+ }]
848
+ }),
849
+ onClose: resetErrorBoundary
850
+ }));
851
+ }, "ErrorFallback");
852
+ var ErrorBoundary = /* @__PURE__ */__name(({
891
853
  children
892
854
  }) => {
893
- return /* @__PURE__ */(0, import_jsx_runtime9.jsx)(import_react_error_boundary.ErrorBoundary, {
855
+ return /* @__PURE__ */React4.createElement(import_react_error_boundary.ErrorBoundary, {
894
856
  FallbackComponent: ErrorFallback,
895
- onError: error => {
857
+ onError: /* @__PURE__ */__name(error => {
896
858
  (0, import_logger.notify)({
897
859
  type: "error",
898
860
  title: "Authentication Error",
899
861
  message: error.message
900
862
  });
901
- },
902
- children
903
- });
904
- };
863
+ }, "onError")
864
+ }, children);
865
+ }, "ErrorBoundary");
905
866
 
906
867
  // src/Auth.tsx
907
- var import_jsx_runtime10 = require("react/jsx-runtime");
908
- var AuthLogic = props => {
868
+ var AuthLogic = /* @__PURE__ */__name(props => {
909
869
  const {
910
870
  screen,
911
871
  setScreen,
@@ -922,18 +882,18 @@ var AuthLogic = props => {
922
882
  clearNotifications,
923
883
  setLoading
924
884
  } = (0, import_react_notifications6.useNotifications)();
925
- React3.useEffect(() => {
885
+ React5.useEffect(() => {
926
886
  clearNotifications();
927
887
  }, [screen.value, clearNotifications]);
928
- React3.useEffect(() => {
888
+ React5.useEffect(() => {
929
889
  return clearNotifications;
930
890
  }, [clearNotifications]);
931
- const onGoToSignIn = () => {
891
+ const onGoToSignIn = /* @__PURE__ */__name(() => {
932
892
  setScreen({
933
893
  value: "signIn"
934
894
  });
935
- };
936
- const onGoToSignUp = React3.useCallback(() => {
895
+ }, "onGoToSignIn");
896
+ const onGoToSignUp = React5.useCallback(() => {
937
897
  if (!onSignUp) {
938
898
  return void 0;
939
899
  }
@@ -941,7 +901,7 @@ var AuthLogic = props => {
941
901
  value: "signUp"
942
902
  });
943
903
  }, [onSignUp, setScreen]);
944
- const onGoToForgotPassword = React3.useCallback(() => {
904
+ const onGoToForgotPassword = React5.useCallback(() => {
945
905
  if (!onForgotPassword) {
946
906
  return void 0;
947
907
  }
@@ -949,7 +909,7 @@ var AuthLogic = props => {
949
909
  value: "forgotPassword"
950
910
  });
951
911
  }, [onForgotPassword, setScreen]);
952
- const notificationsWrapper = fn => {
912
+ const notificationsWrapper = /* @__PURE__ */__name(fn => {
953
913
  return async input => {
954
914
  if (fn) {
955
915
  clearNotifications();
@@ -959,9 +919,9 @@ var AuthLogic = props => {
959
919
  return result;
960
920
  }
961
921
  };
962
- };
922
+ }, "notificationsWrapper");
963
923
  if (screen.value === "signIn") {
964
- return /* @__PURE__ */(0, import_jsx_runtime10.jsx)(AuthSignIn, {
924
+ return /* @__PURE__ */React5.createElement(AuthSignIn, {
965
925
  onSignIn: notificationsWrapper(onSignIn),
966
926
  onGoToSignUp: onSignUp && onGoToSignUp,
967
927
  onGoToForgotPassword: onForgotPassword && onGoToForgotPassword,
@@ -969,7 +929,7 @@ var AuthLogic = props => {
969
929
  });
970
930
  }
971
931
  if (screen.value === "signUp" && onSignUp) {
972
- return /* @__PURE__ */(0, import_jsx_runtime10.jsx)(AuthSignUp, {
932
+ return /* @__PURE__ */React5.createElement(AuthSignUp, {
973
933
  onSignUp: notificationsWrapper(onSignUp),
974
934
  passwordMinimumLength,
975
935
  onGoToSignIn,
@@ -977,97 +937,84 @@ var AuthLogic = props => {
977
937
  });
978
938
  }
979
939
  if (screen.value === "forgotPassword" && onForgotPassword) {
980
- return /* @__PURE__ */(0, import_jsx_runtime10.jsx)(AuthForgotPassword, {
940
+ return /* @__PURE__ */React5.createElement(AuthForgotPassword, {
981
941
  onForgotPassword: notificationsWrapper(onForgotPassword),
982
942
  onGoToSignIn,
983
943
  onGoToSignUp: onSignUp && onGoToSignUp
984
944
  });
985
945
  }
986
946
  if (screen.value === "confirmResetPassword" && onForgotPasswordResetPassword) {
987
- return /* @__PURE__ */(0, import_jsx_runtime10.jsx)(AuthForgotPasswordResetPassword, {
947
+ return /* @__PURE__ */React5.createElement(AuthForgotPasswordResetPassword, {
988
948
  onForgotPasswordResetPassword: notificationsWrapper(onForgotPasswordResetPassword),
989
949
  onGoToSignIn,
990
950
  email: screen.context.email
991
951
  });
992
952
  }
993
953
  if (screen.value === "confirmSignUpWithCode" && onConfirmSignUpWithCode) {
994
- return /* @__PURE__ */(0, import_jsx_runtime10.jsx)(AuthConfirmSignUpWithCode, {
954
+ return /* @__PURE__ */React5.createElement(AuthConfirmSignUpWithCode, {
995
955
  onConfirmSignUpWithCode: notificationsWrapper(onConfirmSignUpWithCode),
996
956
  email: screen.context.email
997
957
  });
998
958
  }
999
959
  if (screen.value === "confirmSignUpCheckEmail" && onConfirmSignUpCheckEmail) {
1000
- return /* @__PURE__ */(0, import_jsx_runtime10.jsx)(AuthConfirmSignUpCheckEmail, {
960
+ return /* @__PURE__ */React5.createElement(AuthConfirmSignUpCheckEmail, {
1001
961
  onConfirmSignUpCheckEmail
1002
962
  });
1003
963
  }
1004
964
  return null;
1005
- };
1006
- var Auth = props => {
965
+ }, "AuthLogic");
966
+ var Auth = /* @__PURE__ */__name(props => {
1007
967
  const {
1008
968
  layout = {
1009
969
  fullScreen: true
1010
970
  }
1011
971
  } = props;
1012
- const withLogoNode = React3.useMemo(() => {
1013
- return /* @__PURE__ */(0, import_jsx_runtime10.jsx)(LogoProvider, {
1014
- logo: props.logo,
1015
- children: /* @__PURE__ */(0, import_jsx_runtime10.jsx)(ErrorBoundary, {
1016
- children: /* @__PURE__ */(0, import_jsx_runtime10.jsx)(AuthLogic, {
1017
- ...props
1018
- })
1019
- })
1020
- });
972
+ const withLogoNode = React5.useMemo(() => {
973
+ return /* @__PURE__ */React5.createElement(LogoProvider, {
974
+ logo: props.logo
975
+ }, /* @__PURE__ */React5.createElement(ErrorBoundary, null, /* @__PURE__ */React5.createElement(AuthLogic, props)));
1021
976
  }, [props]);
1022
977
  if (layout.fullScreen) {
1023
978
  if (layout.sideContentPosition) {
1024
- return /* @__PURE__ */(0, import_jsx_runtime10.jsx)(AuthFullScreen, {
1025
- children: /* @__PURE__ */(0, import_jsx_runtime10.jsxs)(import_ui7.Flex, {
1026
- sx: {
1027
- width: "100%",
1028
- height: "100%",
1029
- flexDirection: layout.sideContentPosition === "left" ? "row" : "row-reverse"
1030
- },
1031
- children: [/* @__PURE__ */(0, import_jsx_runtime10.jsx)(import_ui7.Flex, {
1032
- sx: {
1033
- width: "100%",
1034
- height: "100%",
1035
- flex: [0, 0, 1],
1036
- justifyContent: "center",
1037
- alignItems: "center"
1038
- },
1039
- children: layout.sideContent
1040
- }), /* @__PURE__ */(0, import_jsx_runtime10.jsx)(import_ui7.Flex, {
1041
- sx: {
1042
- width: "100%",
1043
- height: "100%",
1044
- flex: [1],
1045
- justifyContent: "center",
1046
- alignItems: "center"
1047
- },
1048
- children: withLogoNode
1049
- })]
1050
- })
1051
- });
979
+ return /* @__PURE__ */React5.createElement(AuthFullScreen, null, /* @__PURE__ */React5.createElement(import_ui7.Flex, {
980
+ sx: {
981
+ width: "100%",
982
+ height: "100%",
983
+ flexDirection: layout.sideContentPosition === "left" ? "row" : "row-reverse"
984
+ }
985
+ }, /* @__PURE__ */React5.createElement(import_ui7.Flex, {
986
+ sx: {
987
+ width: "100%",
988
+ height: "100%",
989
+ flex: [0, 0, 1],
990
+ justifyContent: "center",
991
+ alignItems: "center"
992
+ }
993
+ }, layout.sideContent), /* @__PURE__ */React5.createElement(import_ui7.Flex, {
994
+ sx: {
995
+ width: "100%",
996
+ height: "100%",
997
+ flex: [1],
998
+ justifyContent: "center",
999
+ alignItems: "center"
1000
+ }
1001
+ }, withLogoNode)));
1052
1002
  }
1053
- return /* @__PURE__ */(0, import_jsx_runtime10.jsx)(AuthFullScreen, {
1054
- children: withLogoNode
1055
- });
1003
+ return /* @__PURE__ */React5.createElement(AuthFullScreen, null, withLogoNode);
1056
1004
  }
1057
1005
  return withLogoNode;
1058
- };
1006
+ }, "Auth");
1059
1007
 
1060
1008
  // src/AuthProvider.tsx
1061
1009
  var import_react_notifications7 = require("@ttoss/react-notifications");
1062
- var React4 = __toESM(require("react"), 1);
1063
- var import_jsx_runtime11 = require("react/jsx-runtime");
1064
- var AuthContext = React4.createContext(null);
1010
+ var React6 = __toESM(require("react"), 1);
1011
+ var AuthContext = /* @__PURE__ */React6.createContext(null);
1065
1012
  var UNAUTHENTICATED_USER = {
1066
1013
  user: null,
1067
1014
  tokens: null,
1068
1015
  isAuthenticated: false
1069
1016
  };
1070
- var AuthProvider = props => {
1017
+ var AuthProvider = /* @__PURE__ */__name(props => {
1071
1018
  const {
1072
1019
  getAuthData,
1073
1020
  signOut: signOutProp
@@ -1075,16 +1022,16 @@ var AuthProvider = props => {
1075
1022
  const {
1076
1023
  setLoading
1077
1024
  } = (0, import_react_notifications7.useNotifications)();
1078
- const [authData, setAuthData] = React4.useState({
1025
+ const [authData, setAuthData] = React6.useState({
1079
1026
  user: null,
1080
1027
  tokens: null,
1081
1028
  isAuthenticated: void 0
1082
1029
  });
1083
- React4.useEffect(() => {
1030
+ React6.useEffect(() => {
1084
1031
  setLoading(authData.isAuthenticated === void 0);
1085
1032
  }, [authData.isAuthenticated, setLoading]);
1086
- React4.useEffect(() => {
1087
- const fetchAuthData = async () => {
1033
+ React6.useEffect(() => {
1034
+ const fetchAuthData = /* @__PURE__ */__name(async () => {
1088
1035
  try {
1089
1036
  const data = await getAuthData?.();
1090
1037
  if (data) {
@@ -1095,46 +1042,45 @@ var AuthProvider = props => {
1095
1042
  } catch {
1096
1043
  setAuthData(UNAUTHENTICATED_USER);
1097
1044
  }
1098
- };
1045
+ }, "fetchAuthData");
1099
1046
  fetchAuthData();
1100
1047
  }, [getAuthData]);
1101
- const signOut = React4.useCallback(async () => {
1048
+ const signOut = React6.useCallback(async () => {
1102
1049
  await signOutProp?.();
1103
1050
  setAuthData(UNAUTHENTICATED_USER);
1104
1051
  }, [signOutProp]);
1105
1052
  if (authData.isAuthenticated === void 0) {
1106
1053
  return null;
1107
1054
  }
1108
- return /* @__PURE__ */(0, import_jsx_runtime11.jsx)(AuthContext.Provider, {
1055
+ return /* @__PURE__ */React6.createElement(AuthContext.Provider, {
1109
1056
  value: {
1110
1057
  signOut,
1111
1058
  isAuthenticated: authData.isAuthenticated ?? false,
1112
1059
  user: authData.user,
1113
1060
  tokens: authData.tokens,
1114
1061
  setAuthData
1115
- },
1116
- children: props.children
1117
- });
1118
- };
1119
- var useAuth = () => {
1120
- const context = React4.useContext(AuthContext);
1062
+ }
1063
+ }, props.children);
1064
+ }, "AuthProvider");
1065
+ var useAuth = /* @__PURE__ */__name(() => {
1066
+ const context = React6.useContext(AuthContext);
1121
1067
  if (!context) {
1122
1068
  throw new Error("useAuth must be used within an AuthProvider");
1123
1069
  }
1124
1070
  return context;
1125
- };
1071
+ }, "useAuth");
1126
1072
 
1127
1073
  // src/useAuthScreen.ts
1128
- var React5 = __toESM(require("react"), 1);
1129
- var useAuthScreen = initialScreen => {
1130
- const [screen, setScreen] = React5.useState(initialScreen || {
1074
+ var React7 = __toESM(require("react"), 1);
1075
+ var useAuthScreen = /* @__PURE__ */__name(initialScreen => {
1076
+ const [screen, setScreen] = React7.useState(initialScreen || {
1131
1077
  value: "signIn"
1132
1078
  });
1133
1079
  return {
1134
1080
  screen,
1135
1081
  setScreen
1136
1082
  };
1137
- };
1083
+ }, "useAuthScreen");
1138
1084
  // Annotate the CommonJS export names for ESM import in node:
1139
1085
  0 && (module.exports = {
1140
1086
  Auth,