@ttoss/react-auth 1.3.1 → 1.3.3
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 +530 -425
- package/dist/index.js +548 -432
- package/package.json +10 -10
package/dist/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/** Powered by @ttoss/config. https://ttoss.dev/docs/modules/packages/config/ */
|
|
2
2
|
"use strict";
|
|
3
|
+
|
|
3
4
|
var __create = Object.create;
|
|
4
5
|
var __defProp = Object.defineProperty;
|
|
5
6
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -7,26 +8,32 @@ var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
|
7
8
|
var __getProtoOf = Object.getPrototypeOf;
|
|
8
9
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
10
|
var __export = (target, all) => {
|
|
10
|
-
for (var name in all)
|
|
11
|
-
|
|
11
|
+
for (var name in all) __defProp(target, name, {
|
|
12
|
+
get: all[name],
|
|
13
|
+
enumerable: true
|
|
14
|
+
});
|
|
12
15
|
};
|
|
13
16
|
var __copyProps = (to, from, except, desc) => {
|
|
14
17
|
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
|
-
for (let key of __getOwnPropNames(from))
|
|
16
|
-
|
|
17
|
-
|
|
18
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
19
|
+
get: () => from[key],
|
|
20
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
21
|
+
});
|
|
18
22
|
}
|
|
19
23
|
return to;
|
|
20
24
|
};
|
|
21
25
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
mod
|
|
28
|
-
|
|
29
|
-
|
|
26
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
27
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
28
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
29
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
30
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
31
|
+
value: mod,
|
|
32
|
+
enumerable: true
|
|
33
|
+
}) : target, mod));
|
|
34
|
+
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
35
|
+
value: true
|
|
36
|
+
}), mod);
|
|
30
37
|
|
|
31
38
|
// src/index.ts
|
|
32
39
|
var src_exports = {};
|
|
@@ -50,15 +57,24 @@ var AuthContext = React.createContext({
|
|
|
50
57
|
user: null,
|
|
51
58
|
tokens: null
|
|
52
59
|
});
|
|
53
|
-
var AuthProvider = ({
|
|
54
|
-
|
|
60
|
+
var AuthProvider = ({
|
|
61
|
+
children
|
|
62
|
+
}) => {
|
|
63
|
+
const [{
|
|
64
|
+
user,
|
|
65
|
+
tokens,
|
|
66
|
+
isAuthenticated
|
|
67
|
+
}, setAuthState] = React.useState({
|
|
55
68
|
user: null,
|
|
56
69
|
tokens: null,
|
|
57
70
|
isAuthenticated: void 0
|
|
58
71
|
});
|
|
59
72
|
React.useEffect(() => {
|
|
60
73
|
const updateUser = () => {
|
|
61
|
-
import_aws_amplify.Auth.currentAuthenticatedUser().then(({
|
|
74
|
+
import_aws_amplify.Auth.currentAuthenticatedUser().then(({
|
|
75
|
+
attributes,
|
|
76
|
+
signInUserSession
|
|
77
|
+
}) => {
|
|
62
78
|
setAuthState({
|
|
63
79
|
user: {
|
|
64
80
|
id: attributes.sub,
|
|
@@ -89,7 +105,15 @@ var AuthProvider = ({ children }) => {
|
|
|
89
105
|
if (isAuthenticated === void 0) {
|
|
90
106
|
return null;
|
|
91
107
|
}
|
|
92
|
-
return /* @__PURE__ */
|
|
108
|
+
return /* @__PURE__ */(0, import_jsx_runtime.jsx)(AuthContext.Provider, {
|
|
109
|
+
value: {
|
|
110
|
+
signOut,
|
|
111
|
+
isAuthenticated,
|
|
112
|
+
user,
|
|
113
|
+
tokens
|
|
114
|
+
},
|
|
115
|
+
children
|
|
116
|
+
});
|
|
93
117
|
};
|
|
94
118
|
var useAuth = () => {
|
|
95
119
|
return React.useContext(AuthContext);
|
|
@@ -105,8 +129,14 @@ var import_ui = require("@ttoss/ui");
|
|
|
105
129
|
var import_react_notifications = require("@ttoss/react-notifications");
|
|
106
130
|
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
107
131
|
var LogoContext = React2.createContext({});
|
|
108
|
-
var LogoProvider = ({
|
|
109
|
-
|
|
132
|
+
var LogoProvider = ({
|
|
133
|
+
children,
|
|
134
|
+
...values
|
|
135
|
+
}) => {
|
|
136
|
+
return /* @__PURE__ */(0, import_jsx_runtime2.jsx)(LogoContext.Provider, {
|
|
137
|
+
value: values,
|
|
138
|
+
children
|
|
139
|
+
});
|
|
110
140
|
};
|
|
111
141
|
var AuthCard = ({
|
|
112
142
|
children,
|
|
@@ -114,33 +144,51 @@ var AuthCard = ({
|
|
|
114
144
|
buttonLabel,
|
|
115
145
|
links = []
|
|
116
146
|
}) => {
|
|
117
|
-
const {
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
147
|
+
const {
|
|
148
|
+
logo
|
|
149
|
+
} = React2.useContext(LogoContext);
|
|
150
|
+
const {
|
|
151
|
+
isLoading
|
|
152
|
+
} = (0, import_react_notifications.useNotifications)();
|
|
153
|
+
return /* @__PURE__ */(0, import_jsx_runtime2.jsx)(import_ui.Card, {
|
|
154
|
+
sx: {
|
|
155
|
+
maxWidth: "564px"
|
|
156
|
+
},
|
|
157
|
+
children: /* @__PURE__ */(0, import_jsx_runtime2.jsxs)(import_ui.Flex, {
|
|
158
|
+
sx: {
|
|
159
|
+
flexDirection: "column",
|
|
160
|
+
gap: 3
|
|
161
|
+
},
|
|
162
|
+
children: [logo && /* @__PURE__ */(0, import_jsx_runtime2.jsx)(import_ui.Flex, {
|
|
163
|
+
sx: {
|
|
164
|
+
width: "100%",
|
|
165
|
+
justifyContent: "center"
|
|
166
|
+
},
|
|
167
|
+
children: logo
|
|
168
|
+
}), /* @__PURE__ */(0, import_jsx_runtime2.jsx)(import_ui.Text, {
|
|
124
169
|
variant: "title",
|
|
125
|
-
sx: {
|
|
170
|
+
sx: {
|
|
171
|
+
alignSelf: "center",
|
|
172
|
+
marginY: 4,
|
|
173
|
+
fontSize: 5
|
|
174
|
+
},
|
|
126
175
|
children: title
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
import_ui.Flex,
|
|
143
|
-
{
|
|
176
|
+
}), children, /* @__PURE__ */(0, import_jsx_runtime2.jsx)(import_ui.Flex, {
|
|
177
|
+
sx: {
|
|
178
|
+
justifyContent: "space-between",
|
|
179
|
+
marginTop: 3
|
|
180
|
+
},
|
|
181
|
+
children: /* @__PURE__ */(0, import_jsx_runtime2.jsx)(import_ui.Button, {
|
|
182
|
+
type: "submit",
|
|
183
|
+
"aria-label": "submit-login",
|
|
184
|
+
variant: "cta",
|
|
185
|
+
disabled: isLoading,
|
|
186
|
+
sx: {
|
|
187
|
+
width: "100%"
|
|
188
|
+
},
|
|
189
|
+
children: buttonLabel
|
|
190
|
+
})
|
|
191
|
+
}), /* @__PURE__ */(0, import_jsx_runtime2.jsx)(import_ui.Flex, {
|
|
144
192
|
sx: {
|
|
145
193
|
justifyContent: "space-between",
|
|
146
194
|
flexDirection: "column",
|
|
@@ -148,12 +196,15 @@ var AuthCard = ({
|
|
|
148
196
|
marginTop: 4,
|
|
149
197
|
color: "text"
|
|
150
198
|
},
|
|
151
|
-
children: links.map(
|
|
152
|
-
return link && /* @__PURE__ */
|
|
199
|
+
children: links.map(link => {
|
|
200
|
+
return link && /* @__PURE__ */(0, import_jsx_runtime2.jsx)(import_ui.Link, {
|
|
201
|
+
onClick: link.onClick,
|
|
202
|
+
children: link.label
|
|
203
|
+
}, link.label);
|
|
153
204
|
})
|
|
154
|
-
}
|
|
155
|
-
)
|
|
156
|
-
|
|
205
|
+
})]
|
|
206
|
+
})
|
|
207
|
+
});
|
|
157
208
|
};
|
|
158
209
|
|
|
159
210
|
// src/AuthConfirmSignUp.tsx
|
|
@@ -164,81 +215,93 @@ var AuthConfirmSignUp = ({
|
|
|
164
215
|
email,
|
|
165
216
|
onConfirmSignUp
|
|
166
217
|
}) => {
|
|
167
|
-
const {
|
|
218
|
+
const {
|
|
219
|
+
intl
|
|
220
|
+
} = (0, import_react_i18n.useI18n)();
|
|
168
221
|
const schema = import_forms.yup.object().shape({
|
|
169
|
-
code: import_forms.yup.string().required(
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
222
|
+
code: import_forms.yup.string().required(intl.formatMessage({
|
|
223
|
+
id: "0XOzcH",
|
|
224
|
+
defaultMessage: [{
|
|
225
|
+
"type": 0,
|
|
226
|
+
"value": "Required field"
|
|
227
|
+
}]
|
|
228
|
+
})).max(6, intl.formatMessage({
|
|
229
|
+
id: "S3pjKw",
|
|
230
|
+
defaultMessage: [{
|
|
231
|
+
"type": 0,
|
|
232
|
+
"value": "Minimum "
|
|
233
|
+
}, {
|
|
234
|
+
"type": 1,
|
|
235
|
+
"value": "value"
|
|
236
|
+
}, {
|
|
237
|
+
"type": 0,
|
|
238
|
+
"value": " characters"
|
|
239
|
+
}]
|
|
240
|
+
}, {
|
|
241
|
+
value: 6
|
|
242
|
+
}))
|
|
184
243
|
}).required();
|
|
185
244
|
const formMethods = (0, import_forms.useForm)({
|
|
186
245
|
resolver: (0, import_forms.yupResolver)(schema)
|
|
187
246
|
});
|
|
188
|
-
return /* @__PURE__ */
|
|
189
|
-
|
|
190
|
-
{
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
247
|
+
return /* @__PURE__ */(0, import_jsx_runtime3.jsx)(import_forms.Form, {
|
|
248
|
+
...formMethods,
|
|
249
|
+
onSubmit: ({
|
|
250
|
+
code
|
|
251
|
+
}) => {
|
|
252
|
+
return onConfirmSignUp({
|
|
253
|
+
code,
|
|
254
|
+
email
|
|
255
|
+
});
|
|
256
|
+
},
|
|
257
|
+
children: /* @__PURE__ */(0, import_jsx_runtime3.jsx)(AuthCard, {
|
|
258
|
+
buttonLabel: intl.formatMessage({
|
|
259
|
+
id: "UNttd+",
|
|
260
|
+
defaultMessage: [{
|
|
261
|
+
"type": 0,
|
|
262
|
+
"value": "Confirm"
|
|
263
|
+
}]
|
|
264
|
+
}),
|
|
265
|
+
title: intl.formatMessage({
|
|
266
|
+
id: "cGR2eI",
|
|
267
|
+
defaultMessage: [{
|
|
268
|
+
"type": 0,
|
|
269
|
+
"value": "Confirmation"
|
|
270
|
+
}]
|
|
271
|
+
}),
|
|
272
|
+
children: /* @__PURE__ */(0, import_jsx_runtime3.jsx)(import_forms.FormFieldInput, {
|
|
273
|
+
name: "code",
|
|
274
|
+
label: intl.formatMessage({
|
|
275
|
+
id: "KY2T6J",
|
|
276
|
+
defaultMessage: [{
|
|
277
|
+
"type": 0,
|
|
278
|
+
"value": "Code"
|
|
279
|
+
}]
|
|
280
|
+
})
|
|
281
|
+
})
|
|
282
|
+
})
|
|
283
|
+
});
|
|
220
284
|
};
|
|
221
285
|
|
|
222
286
|
// src/AuthFullScreen.tsx
|
|
223
287
|
var import_ui2 = require("@ttoss/ui");
|
|
224
288
|
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
225
|
-
var AuthFullScreen = ({
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
);
|
|
289
|
+
var AuthFullScreen = ({
|
|
290
|
+
children
|
|
291
|
+
}) => {
|
|
292
|
+
return /* @__PURE__ */(0, import_jsx_runtime4.jsx)(import_ui2.Flex, {
|
|
293
|
+
sx: {
|
|
294
|
+
height: "100vh",
|
|
295
|
+
width: "100vw",
|
|
296
|
+
justifyContent: "center",
|
|
297
|
+
alignItems: "center",
|
|
298
|
+
margin: 0,
|
|
299
|
+
backgroundPosition: "center",
|
|
300
|
+
backgroundRepeat: "no-repeat",
|
|
301
|
+
backgroundSize: "cover"
|
|
302
|
+
},
|
|
303
|
+
children
|
|
304
|
+
});
|
|
242
305
|
};
|
|
243
306
|
|
|
244
307
|
// src/AuthSignIn.tsx
|
|
@@ -308,7 +371,9 @@ var createAuthTemplate = ({
|
|
|
308
371
|
},
|
|
309
372
|
Export: {
|
|
310
373
|
Name: {
|
|
311
|
-
"Fn::Join": [":", [{
|
|
374
|
+
"Fn::Join": [":", [{
|
|
375
|
+
Ref: "AWS::StackName"
|
|
376
|
+
}, "Region"]]
|
|
312
377
|
}
|
|
313
378
|
}
|
|
314
379
|
},
|
|
@@ -319,7 +384,9 @@ var createAuthTemplate = ({
|
|
|
319
384
|
},
|
|
320
385
|
Export: {
|
|
321
386
|
Name: {
|
|
322
|
-
"Fn::Join": [":", [{
|
|
387
|
+
"Fn::Join": [":", [{
|
|
388
|
+
Ref: "AWS::StackName"
|
|
389
|
+
}, "UserPoolId"]]
|
|
323
390
|
}
|
|
324
391
|
}
|
|
325
392
|
},
|
|
@@ -330,14 +397,16 @@ var createAuthTemplate = ({
|
|
|
330
397
|
},
|
|
331
398
|
Export: {
|
|
332
399
|
Name: {
|
|
333
|
-
"Fn::Join": [":", [{
|
|
400
|
+
"Fn::Join": [":", [{
|
|
401
|
+
Ref: "AWS::StackName"
|
|
402
|
+
}, "AppClientId"]]
|
|
334
403
|
}
|
|
335
404
|
}
|
|
336
405
|
}
|
|
337
406
|
}
|
|
338
407
|
};
|
|
339
408
|
if (schema) {
|
|
340
|
-
const Schema = schema.map(
|
|
409
|
+
const Schema = schema.map(attribute => {
|
|
341
410
|
let NumberAttributeConstraints = void 0;
|
|
342
411
|
if (attribute.numberAttributeConstraints) {
|
|
343
412
|
NumberAttributeConstraints = {
|
|
@@ -369,16 +438,14 @@ var createAuthTemplate = ({
|
|
|
369
438
|
Type: "AWS::Cognito::IdentityPool",
|
|
370
439
|
Properties: {
|
|
371
440
|
AllowUnauthenticatedIdentities: true,
|
|
372
|
-
CognitoIdentityProviders: [
|
|
373
|
-
{
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
"Fn::GetAtt": [CognitoUserPoolLogicalId, "ProviderName"]
|
|
379
|
-
}
|
|
441
|
+
CognitoIdentityProviders: [{
|
|
442
|
+
ClientId: {
|
|
443
|
+
Ref: CognitoUserPoolClientLogicalId
|
|
444
|
+
},
|
|
445
|
+
ProviderName: {
|
|
446
|
+
"Fn::GetAtt": [CognitoUserPoolLogicalId, "ProviderName"]
|
|
380
447
|
}
|
|
381
|
-
]
|
|
448
|
+
}]
|
|
382
449
|
}
|
|
383
450
|
};
|
|
384
451
|
template.Resources[IdentityPoolAuthenticatedIAMRoleLogicalId] = {
|
|
@@ -386,35 +453,31 @@ var createAuthTemplate = ({
|
|
|
386
453
|
Properties: {
|
|
387
454
|
AssumeRolePolicyDocument: {
|
|
388
455
|
Version: "2012-10-17",
|
|
389
|
-
Statement: [
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
Ref: CognitoIdentityPoolLogicalId
|
|
400
|
-
}
|
|
401
|
-
},
|
|
402
|
-
"ForAnyValue:StringLike": {
|
|
403
|
-
"cognito-identity.amazonaws.com:amr": "authenticated"
|
|
456
|
+
Statement: [{
|
|
457
|
+
Effect: "Allow",
|
|
458
|
+
Principal: {
|
|
459
|
+
Federated: "cognito-identity.amazonaws.com"
|
|
460
|
+
},
|
|
461
|
+
Action: ["sts:AssumeRoleWithWebIdentity", "sts:TagSession"],
|
|
462
|
+
Condition: {
|
|
463
|
+
StringEquals: {
|
|
464
|
+
"cognito-identity.amazonaws.com:aud": {
|
|
465
|
+
Ref: CognitoIdentityPoolLogicalId
|
|
404
466
|
}
|
|
467
|
+
},
|
|
468
|
+
"ForAnyValue:StringLike": {
|
|
469
|
+
"cognito-identity.amazonaws.com:amr": "authenticated"
|
|
405
470
|
}
|
|
406
471
|
}
|
|
407
|
-
]
|
|
472
|
+
}]
|
|
408
473
|
},
|
|
409
|
-
Policies: identityPool.authenticatedPolicies || [
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
Statement: [DenyStatement]
|
|
415
|
-
}
|
|
474
|
+
Policies: identityPool.authenticatedPolicies || [{
|
|
475
|
+
PolicyName: "IdentityPoolAuthenticatedIAMRolePolicyName",
|
|
476
|
+
PolicyDocument: {
|
|
477
|
+
Version: "2012-10-17",
|
|
478
|
+
Statement: [DenyStatement]
|
|
416
479
|
}
|
|
417
|
-
]
|
|
480
|
+
}]
|
|
418
481
|
}
|
|
419
482
|
};
|
|
420
483
|
template.Resources[IdentityPoolUnauthenticatedIAMRoleLogicalId] = {
|
|
@@ -422,35 +485,31 @@ var createAuthTemplate = ({
|
|
|
422
485
|
Properties: {
|
|
423
486
|
AssumeRolePolicyDocument: {
|
|
424
487
|
Version: "2012-10-17",
|
|
425
|
-
Statement: [
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
Ref: CognitoIdentityPoolLogicalId
|
|
436
|
-
}
|
|
437
|
-
},
|
|
438
|
-
"ForAnyValue:StringLike": {
|
|
439
|
-
"cognito-identity.amazonaws.com:amr": "unauthenticated"
|
|
488
|
+
Statement: [{
|
|
489
|
+
Effect: "Allow",
|
|
490
|
+
Principal: {
|
|
491
|
+
Federated: "cognito-identity.amazonaws.com"
|
|
492
|
+
},
|
|
493
|
+
Action: "sts:AssumeRoleWithWebIdentity",
|
|
494
|
+
Condition: {
|
|
495
|
+
StringEquals: {
|
|
496
|
+
"cognito-identity.amazonaws.com:aud": {
|
|
497
|
+
Ref: CognitoIdentityPoolLogicalId
|
|
440
498
|
}
|
|
499
|
+
},
|
|
500
|
+
"ForAnyValue:StringLike": {
|
|
501
|
+
"cognito-identity.amazonaws.com:amr": "unauthenticated"
|
|
441
502
|
}
|
|
442
503
|
}
|
|
443
|
-
]
|
|
504
|
+
}]
|
|
444
505
|
},
|
|
445
|
-
Policies: identityPool.authenticatedPolicies || [
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
Statement: [DenyStatement]
|
|
451
|
-
}
|
|
506
|
+
Policies: identityPool.authenticatedPolicies || [{
|
|
507
|
+
PolicyName: "IdentityPoolUnauthenticatedIAMRolePolicyName",
|
|
508
|
+
PolicyDocument: {
|
|
509
|
+
Version: "2012-10-17",
|
|
510
|
+
Statement: [DenyStatement]
|
|
452
511
|
}
|
|
453
|
-
]
|
|
512
|
+
}]
|
|
454
513
|
}
|
|
455
514
|
};
|
|
456
515
|
template.Resources.CognitoIdentityPoolRoleAttachment = {
|
|
@@ -479,10 +538,9 @@ var createAuthTemplate = ({
|
|
|
479
538
|
},
|
|
480
539
|
Export: {
|
|
481
540
|
Name: {
|
|
482
|
-
"Fn::Join": [
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
]
|
|
541
|
+
"Fn::Join": [":", [{
|
|
542
|
+
Ref: "AWS::StackName"
|
|
543
|
+
}, "CognitoIdentityPoolId"]]
|
|
486
544
|
}
|
|
487
545
|
}
|
|
488
546
|
};
|
|
@@ -501,179 +559,214 @@ var AuthSignIn = ({
|
|
|
501
559
|
onSignUp,
|
|
502
560
|
defaultValues
|
|
503
561
|
}) => {
|
|
504
|
-
const {
|
|
562
|
+
const {
|
|
563
|
+
intl
|
|
564
|
+
} = (0, import_react_i18n2.useI18n)();
|
|
505
565
|
const schema = import_forms2.yup.object().shape({
|
|
506
|
-
email: import_forms2.yup.string().required(
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
566
|
+
email: import_forms2.yup.string().required(intl.formatMessage({
|
|
567
|
+
id: "r+QgO+",
|
|
568
|
+
defaultMessage: [{
|
|
569
|
+
"type": 0,
|
|
570
|
+
"value": "Email field is required"
|
|
571
|
+
}]
|
|
572
|
+
})).email(intl.formatMessage({
|
|
573
|
+
id: "OhDL0i",
|
|
574
|
+
defaultMessage: [{
|
|
575
|
+
"type": 0,
|
|
576
|
+
"value": "Invalid email"
|
|
577
|
+
}]
|
|
578
|
+
})),
|
|
579
|
+
password: import_forms2.yup.string().required(intl.formatMessage({
|
|
580
|
+
id: "kdFYba",
|
|
581
|
+
defaultMessage: [{
|
|
582
|
+
"type": 0,
|
|
583
|
+
"value": "Password field is required"
|
|
584
|
+
}]
|
|
585
|
+
})).min(PASSWORD_MINIMUM_LENGTH, intl.formatMessage({
|
|
586
|
+
id: "TZ4WUk",
|
|
587
|
+
defaultMessage: [{
|
|
588
|
+
"type": 0,
|
|
589
|
+
"value": "Password requires "
|
|
590
|
+
}, {
|
|
591
|
+
"type": 1,
|
|
592
|
+
"value": "value"
|
|
593
|
+
}, {
|
|
594
|
+
"type": 0,
|
|
595
|
+
"value": " characters"
|
|
596
|
+
}]
|
|
597
|
+
}, {
|
|
598
|
+
value: PASSWORD_MINIMUM_LENGTH
|
|
599
|
+
})).trim()
|
|
532
600
|
});
|
|
533
601
|
const formMethods = (0, import_forms2.useForm)({
|
|
534
602
|
defaultValues,
|
|
535
603
|
resolver: (0, import_forms2.yupResolver)(schema)
|
|
536
604
|
});
|
|
537
|
-
const onSubmitForm =
|
|
605
|
+
const onSubmitForm = data => {
|
|
538
606
|
return onSignIn(data);
|
|
539
607
|
};
|
|
540
|
-
return /* @__PURE__ */
|
|
541
|
-
|
|
542
|
-
|
|
608
|
+
return /* @__PURE__ */(0, import_jsx_runtime5.jsx)(import_forms2.Form, {
|
|
609
|
+
...formMethods,
|
|
610
|
+
onSubmit: onSubmitForm,
|
|
611
|
+
children: /* @__PURE__ */(0, import_jsx_runtime5.jsxs)(AuthCard, {
|
|
543
612
|
title: intl.formatMessage({
|
|
544
|
-
|
|
545
|
-
defaultMessage:
|
|
613
|
+
id: "R1rFNQ",
|
|
614
|
+
defaultMessage: [{
|
|
615
|
+
"type": 0,
|
|
616
|
+
"value": "Login"
|
|
617
|
+
}]
|
|
546
618
|
}),
|
|
547
619
|
buttonLabel: intl.formatMessage({
|
|
548
|
-
|
|
549
|
-
defaultMessage:
|
|
620
|
+
id: "0cVgsc",
|
|
621
|
+
defaultMessage: [{
|
|
622
|
+
"type": 0,
|
|
623
|
+
"value": "Login"
|
|
624
|
+
}]
|
|
550
625
|
}),
|
|
551
|
-
links: [
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
}
|
|
587
|
-
)
|
|
588
|
-
]
|
|
589
|
-
}
|
|
590
|
-
|
|
626
|
+
links: [{
|
|
627
|
+
onClick: onSignUp,
|
|
628
|
+
label: intl.formatMessage({
|
|
629
|
+
id: "z5s0vm",
|
|
630
|
+
defaultMessage: [{
|
|
631
|
+
"type": 0,
|
|
632
|
+
"value": "Do you forgot your password?"
|
|
633
|
+
}]
|
|
634
|
+
})
|
|
635
|
+
}, {
|
|
636
|
+
onClick: onSignUp,
|
|
637
|
+
label: intl.formatMessage({
|
|
638
|
+
id: "XC1w2U",
|
|
639
|
+
defaultMessage: [{
|
|
640
|
+
"type": 0,
|
|
641
|
+
"value": "Don't have an account? Sign up"
|
|
642
|
+
}]
|
|
643
|
+
})
|
|
644
|
+
}],
|
|
645
|
+
children: [/* @__PURE__ */(0, import_jsx_runtime5.jsx)(import_forms2.FormFieldInput, {
|
|
646
|
+
name: "email",
|
|
647
|
+
label: intl.formatMessage({
|
|
648
|
+
id: "5E12mO",
|
|
649
|
+
defaultMessage: [{
|
|
650
|
+
"type": 0,
|
|
651
|
+
"value": "Email"
|
|
652
|
+
}]
|
|
653
|
+
})
|
|
654
|
+
}), /* @__PURE__ */(0, import_jsx_runtime5.jsx)(import_forms2.FormFieldInput, {
|
|
655
|
+
name: "password",
|
|
656
|
+
label: intl.formatMessage({
|
|
657
|
+
id: "PylVqx",
|
|
658
|
+
defaultMessage: [{
|
|
659
|
+
"type": 0,
|
|
660
|
+
"value": "Password"
|
|
661
|
+
}]
|
|
662
|
+
})
|
|
663
|
+
})]
|
|
664
|
+
})
|
|
665
|
+
});
|
|
591
666
|
};
|
|
592
667
|
|
|
593
668
|
// src/AuthSignUp.tsx
|
|
594
669
|
var import_forms3 = require("@ttoss/forms");
|
|
595
670
|
var import_react_i18n3 = require("@ttoss/react-i18n");
|
|
596
671
|
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
597
|
-
var AuthSignUp = ({
|
|
598
|
-
|
|
672
|
+
var AuthSignUp = ({
|
|
673
|
+
onSignUp,
|
|
674
|
+
onReturnToSignIn
|
|
675
|
+
}) => {
|
|
676
|
+
const {
|
|
677
|
+
intl
|
|
678
|
+
} = (0, import_react_i18n3.useI18n)();
|
|
599
679
|
const schema = import_forms3.yup.object().shape({
|
|
600
|
-
email: import_forms3.yup.string().required(
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
680
|
+
email: import_forms3.yup.string().required(intl.formatMessage({
|
|
681
|
+
id: "r+QgO+",
|
|
682
|
+
defaultMessage: [{
|
|
683
|
+
"type": 0,
|
|
684
|
+
"value": "Email field is required"
|
|
685
|
+
}]
|
|
686
|
+
})).email(intl.formatMessage({
|
|
687
|
+
id: "OhDL0i",
|
|
688
|
+
defaultMessage: [{
|
|
689
|
+
"type": 0,
|
|
690
|
+
"value": "Invalid email"
|
|
691
|
+
}]
|
|
692
|
+
})),
|
|
693
|
+
password: import_forms3.yup.string().required(intl.formatMessage({
|
|
694
|
+
id: "kdFYba",
|
|
695
|
+
defaultMessage: [{
|
|
696
|
+
"type": 0,
|
|
697
|
+
"value": "Password field is required"
|
|
698
|
+
}]
|
|
699
|
+
})).min(PASSWORD_MINIMUM_LENGTH, intl.formatMessage({
|
|
700
|
+
id: "TZ4WUk",
|
|
701
|
+
defaultMessage: [{
|
|
702
|
+
"type": 0,
|
|
703
|
+
"value": "Password requires "
|
|
704
|
+
}, {
|
|
705
|
+
"type": 1,
|
|
706
|
+
"value": "value"
|
|
707
|
+
}, {
|
|
708
|
+
"type": 0,
|
|
709
|
+
"value": " characters"
|
|
710
|
+
}]
|
|
711
|
+
}, {
|
|
712
|
+
value: PASSWORD_MINIMUM_LENGTH
|
|
713
|
+
})).trim()
|
|
626
714
|
});
|
|
627
715
|
const formMethods = (0, import_forms3.useForm)({
|
|
628
716
|
resolver: (0, import_forms3.yupResolver)(schema)
|
|
629
717
|
});
|
|
630
|
-
const onSubmitForm =
|
|
718
|
+
const onSubmitForm = data => {
|
|
631
719
|
return onSignUp(data);
|
|
632
720
|
};
|
|
633
|
-
return /* @__PURE__ */
|
|
634
|
-
|
|
635
|
-
|
|
721
|
+
return /* @__PURE__ */(0, import_jsx_runtime6.jsx)(import_forms3.Form, {
|
|
722
|
+
...formMethods,
|
|
723
|
+
onSubmit: onSubmitForm,
|
|
724
|
+
children: /* @__PURE__ */(0, import_jsx_runtime6.jsxs)(AuthCard, {
|
|
636
725
|
buttonLabel: intl.formatMessage({
|
|
637
|
-
|
|
638
|
-
defaultMessage:
|
|
726
|
+
id: "Pdio77",
|
|
727
|
+
defaultMessage: [{
|
|
728
|
+
"type": 0,
|
|
729
|
+
"value": "Create account"
|
|
730
|
+
}]
|
|
639
731
|
}),
|
|
640
732
|
title: intl.formatMessage({
|
|
641
|
-
|
|
642
|
-
defaultMessage:
|
|
733
|
+
id: "EXZxA0",
|
|
734
|
+
defaultMessage: [{
|
|
735
|
+
"type": 0,
|
|
736
|
+
"value": "Register"
|
|
737
|
+
}]
|
|
643
738
|
}),
|
|
644
|
-
links: [
|
|
645
|
-
{
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
}
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
}
|
|
676
|
-
) });
|
|
739
|
+
links: [{
|
|
740
|
+
label: intl.formatMessage({
|
|
741
|
+
id: "LU2ddR",
|
|
742
|
+
defaultMessage: [{
|
|
743
|
+
"type": 0,
|
|
744
|
+
"value": "Do you already have an account? Sign in"
|
|
745
|
+
}]
|
|
746
|
+
}),
|
|
747
|
+
onClick: onReturnToSignIn
|
|
748
|
+
}],
|
|
749
|
+
children: [/* @__PURE__ */(0, import_jsx_runtime6.jsx)(import_forms3.FormFieldInput, {
|
|
750
|
+
name: "email",
|
|
751
|
+
label: intl.formatMessage({
|
|
752
|
+
id: "5E12mO",
|
|
753
|
+
defaultMessage: [{
|
|
754
|
+
"type": 0,
|
|
755
|
+
"value": "Email"
|
|
756
|
+
}]
|
|
757
|
+
})
|
|
758
|
+
}), /* @__PURE__ */(0, import_jsx_runtime6.jsx)(import_forms3.FormFieldInput, {
|
|
759
|
+
name: "password",
|
|
760
|
+
label: intl.formatMessage({
|
|
761
|
+
id: "PylVqx",
|
|
762
|
+
defaultMessage: [{
|
|
763
|
+
"type": 0,
|
|
764
|
+
"value": "Password"
|
|
765
|
+
}]
|
|
766
|
+
})
|
|
767
|
+
})]
|
|
768
|
+
})
|
|
769
|
+
});
|
|
677
770
|
};
|
|
678
771
|
|
|
679
772
|
// src/Auth.tsx
|
|
@@ -681,137 +774,160 @@ var import_xstate = require("xstate");
|
|
|
681
774
|
var import_react = require("@xstate/react");
|
|
682
775
|
var import_react_notifications2 = require("@ttoss/react-notifications");
|
|
683
776
|
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
684
|
-
var authMachine = (0, import_xstate.createMachine)(
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
}
|
|
697
|
-
},
|
|
698
|
-
signUp: {
|
|
699
|
-
on: {
|
|
700
|
-
SIGN_UP_CONFIRM: {
|
|
701
|
-
actions: ["assignEmail"],
|
|
702
|
-
target: "signUpConfirm"
|
|
703
|
-
},
|
|
704
|
-
RETURN_TO_SIGN_IN: { target: "signIn" }
|
|
777
|
+
var authMachine = (0, import_xstate.createMachine)({
|
|
778
|
+
predictableActionArguments: true,
|
|
779
|
+
initial: "signIn",
|
|
780
|
+
states: {
|
|
781
|
+
signIn: {
|
|
782
|
+
on: {
|
|
783
|
+
SIGN_UP: {
|
|
784
|
+
target: "signUp"
|
|
785
|
+
},
|
|
786
|
+
SIGN_UP_RESEND_CONFIRMATION: {
|
|
787
|
+
actions: ["assignEmail"],
|
|
788
|
+
target: "signUpConfirm"
|
|
705
789
|
}
|
|
706
|
-
}
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
790
|
+
}
|
|
791
|
+
},
|
|
792
|
+
signUp: {
|
|
793
|
+
on: {
|
|
794
|
+
SIGN_UP_CONFIRM: {
|
|
795
|
+
actions: ["assignEmail"],
|
|
796
|
+
target: "signUpConfirm"
|
|
797
|
+
},
|
|
798
|
+
RETURN_TO_SIGN_IN: {
|
|
799
|
+
target: "signIn"
|
|
713
800
|
}
|
|
714
801
|
}
|
|
715
|
-
}
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
return event.email;
|
|
802
|
+
},
|
|
803
|
+
signUpConfirm: {
|
|
804
|
+
on: {
|
|
805
|
+
SIGN_UP_CONFIRMED: {
|
|
806
|
+
actions: ["assignEmail"],
|
|
807
|
+
target: "signIn"
|
|
722
808
|
}
|
|
723
|
-
}
|
|
809
|
+
}
|
|
724
810
|
}
|
|
725
811
|
}
|
|
726
|
-
|
|
812
|
+
}, {
|
|
813
|
+
actions: {
|
|
814
|
+
assignEmail: (0, import_xstate.assign)({
|
|
815
|
+
email: (_, event) => {
|
|
816
|
+
return event.email;
|
|
817
|
+
}
|
|
818
|
+
})
|
|
819
|
+
}
|
|
820
|
+
});
|
|
727
821
|
var AuthLogic = () => {
|
|
728
|
-
const {
|
|
822
|
+
const {
|
|
823
|
+
isAuthenticated
|
|
824
|
+
} = useAuth();
|
|
729
825
|
const [state, send] = (0, import_react.useMachine)(authMachine);
|
|
730
|
-
const {
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
const onSignUp = React3.useCallback(
|
|
751
|
-
async ({ email, password }) => {
|
|
752
|
-
try {
|
|
753
|
-
setLoading(true);
|
|
754
|
-
await import_aws_amplify2.Auth.signUp({
|
|
755
|
-
username: email,
|
|
756
|
-
password,
|
|
757
|
-
attributes: { email }
|
|
758
|
-
});
|
|
759
|
-
send({ type: "SIGN_UP_CONFIRM", email });
|
|
760
|
-
} catch (error) {
|
|
761
|
-
} finally {
|
|
762
|
-
setLoading(false);
|
|
763
|
-
}
|
|
764
|
-
},
|
|
765
|
-
[send, setLoading]
|
|
766
|
-
);
|
|
767
|
-
const onConfirmSignUp = React3.useCallback(
|
|
768
|
-
async ({ email, code }) => {
|
|
769
|
-
try {
|
|
770
|
-
setLoading(true);
|
|
771
|
-
await import_aws_amplify2.Auth.confirmSignUp(email, code);
|
|
772
|
-
send({ type: "SIGN_UP_CONFIRMED", email });
|
|
773
|
-
} catch (error) {
|
|
774
|
-
} finally {
|
|
775
|
-
setLoading(false);
|
|
826
|
+
const {
|
|
827
|
+
setLoading
|
|
828
|
+
} = (0, import_react_notifications2.useNotifications)();
|
|
829
|
+
const onSignIn = React3.useCallback(async ({
|
|
830
|
+
email,
|
|
831
|
+
password
|
|
832
|
+
}) => {
|
|
833
|
+
try {
|
|
834
|
+
setLoading(true);
|
|
835
|
+
await import_aws_amplify2.Auth.signIn(email, password);
|
|
836
|
+
} catch (error) {
|
|
837
|
+
switch (error.code) {
|
|
838
|
+
case "UserNotConfirmedException":
|
|
839
|
+
await import_aws_amplify2.Auth.resendSignUp(email);
|
|
840
|
+
send({
|
|
841
|
+
type: "SIGN_UP_RESEND_CONFIRMATION",
|
|
842
|
+
email
|
|
843
|
+
});
|
|
844
|
+
break;
|
|
845
|
+
default:
|
|
776
846
|
}
|
|
777
|
-
}
|
|
778
|
-
|
|
779
|
-
|
|
847
|
+
} finally {
|
|
848
|
+
setLoading(false);
|
|
849
|
+
}
|
|
850
|
+
}, [send, setLoading]);
|
|
851
|
+
const onSignUp = React3.useCallback(async ({
|
|
852
|
+
email,
|
|
853
|
+
password
|
|
854
|
+
}) => {
|
|
855
|
+
try {
|
|
856
|
+
setLoading(true);
|
|
857
|
+
await import_aws_amplify2.Auth.signUp({
|
|
858
|
+
username: email,
|
|
859
|
+
password,
|
|
860
|
+
attributes: {
|
|
861
|
+
email
|
|
862
|
+
}
|
|
863
|
+
});
|
|
864
|
+
send({
|
|
865
|
+
type: "SIGN_UP_CONFIRM",
|
|
866
|
+
email
|
|
867
|
+
});
|
|
868
|
+
} catch (error) {} finally {
|
|
869
|
+
setLoading(false);
|
|
870
|
+
}
|
|
871
|
+
}, [send, setLoading]);
|
|
872
|
+
const onConfirmSignUp = React3.useCallback(async ({
|
|
873
|
+
email,
|
|
874
|
+
code
|
|
875
|
+
}) => {
|
|
876
|
+
try {
|
|
877
|
+
setLoading(true);
|
|
878
|
+
await import_aws_amplify2.Auth.confirmSignUp(email, code);
|
|
879
|
+
send({
|
|
880
|
+
type: "SIGN_UP_CONFIRMED",
|
|
881
|
+
email
|
|
882
|
+
});
|
|
883
|
+
} catch (error) {} finally {
|
|
884
|
+
setLoading(false);
|
|
885
|
+
}
|
|
886
|
+
}, [send, setLoading]);
|
|
780
887
|
const onReturnToSignIn = React3.useCallback(() => {
|
|
781
|
-
send({
|
|
888
|
+
send({
|
|
889
|
+
type: "RETURN_TO_SIGN_IN"
|
|
890
|
+
});
|
|
782
891
|
}, [send]);
|
|
783
892
|
if (isAuthenticated) {
|
|
784
893
|
return null;
|
|
785
894
|
}
|
|
786
895
|
if (state.matches("signUp")) {
|
|
787
|
-
return /* @__PURE__ */
|
|
896
|
+
return /* @__PURE__ */(0, import_jsx_runtime7.jsx)(AuthSignUp, {
|
|
897
|
+
onSignUp,
|
|
898
|
+
onReturnToSignIn
|
|
899
|
+
});
|
|
788
900
|
}
|
|
789
901
|
if (state.matches("signUpConfirm")) {
|
|
790
|
-
return /* @__PURE__ */
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
email: state.context.email
|
|
795
|
-
}
|
|
796
|
-
);
|
|
902
|
+
return /* @__PURE__ */(0, import_jsx_runtime7.jsx)(AuthConfirmSignUp, {
|
|
903
|
+
onConfirmSignUp,
|
|
904
|
+
email: state.context.email
|
|
905
|
+
});
|
|
797
906
|
}
|
|
798
|
-
return /* @__PURE__ */
|
|
799
|
-
|
|
800
|
-
{
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
defaultValues: { email: state.context.email }
|
|
907
|
+
return /* @__PURE__ */(0, import_jsx_runtime7.jsx)(AuthSignIn, {
|
|
908
|
+
onSignIn,
|
|
909
|
+
onSignUp: () => {
|
|
910
|
+
return send("SIGN_UP");
|
|
911
|
+
},
|
|
912
|
+
defaultValues: {
|
|
913
|
+
email: state.context.email
|
|
806
914
|
}
|
|
807
|
-
);
|
|
915
|
+
});
|
|
808
916
|
};
|
|
809
|
-
var Auth2 = ({
|
|
917
|
+
var Auth2 = ({
|
|
918
|
+
logo,
|
|
919
|
+
fullScreen = true
|
|
920
|
+
}) => {
|
|
810
921
|
const withLogoNode = React3.useMemo(() => {
|
|
811
|
-
return /* @__PURE__ */
|
|
922
|
+
return /* @__PURE__ */(0, import_jsx_runtime7.jsx)(LogoProvider, {
|
|
923
|
+
logo,
|
|
924
|
+
children: /* @__PURE__ */(0, import_jsx_runtime7.jsx)(AuthLogic, {})
|
|
925
|
+
});
|
|
812
926
|
}, [logo]);
|
|
813
927
|
if (fullScreen) {
|
|
814
|
-
return /* @__PURE__ */
|
|
928
|
+
return /* @__PURE__ */(0, import_jsx_runtime7.jsx)(AuthFullScreen, {
|
|
929
|
+
children: withLogoNode
|
|
930
|
+
});
|
|
815
931
|
}
|
|
816
932
|
return withLogoNode;
|
|
817
933
|
};
|
|
@@ -820,4 +936,4 @@ var Auth2 = ({ logo, fullScreen = true }) => {
|
|
|
820
936
|
Auth,
|
|
821
937
|
AuthProvider,
|
|
822
938
|
useAuth
|
|
823
|
-
});
|
|
939
|
+
});
|