@aws-amplify/ui-react 1.2.56-legacy-ui-tests.6 → 1.2.60-unstable.5
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/CHANGELOG.md +32 -0
- package/dist/0.js.map +1 -1
- package/dist/1.js +52 -220
- package/dist/1.js.map +1 -1
- package/dist/10.js +1 -8
- package/dist/10.js.map +1 -1
- package/dist/11.js +11 -110
- package/dist/11.js.map +1 -1
- package/dist/12.js +3 -29
- package/dist/12.js.map +1 -1
- package/dist/13.js +60 -339
- package/dist/13.js.map +1 -1
- package/dist/14.js +1 -12
- package/dist/14.js.map +1 -1
- package/dist/15.js +1 -8
- package/dist/15.js.map +1 -1
- package/dist/16.js +9 -31
- package/dist/16.js.map +1 -1
- package/dist/17.js +3 -17
- package/dist/17.js.map +1 -1
- package/dist/18.js +10 -61
- package/dist/18.js.map +1 -1
- package/dist/19.js +1 -11
- package/dist/19.js.map +1 -1
- package/dist/2.js +129 -736
- package/dist/2.js.map +1 -1
- package/dist/20.js +1 -10
- package/dist/20.js.map +1 -1
- package/dist/21.js +3 -13
- package/dist/21.js.map +1 -1
- package/dist/22.js +1 -9
- package/dist/22.js.map +1 -1
- package/dist/23.js +19 -77
- package/dist/23.js.map +1 -1
- package/dist/24.js +1 -18
- package/dist/24.js.map +1 -1
- package/dist/25.js +1 -11
- package/dist/25.js.map +1 -1
- package/dist/26.js +25 -94
- package/dist/26.js.map +1 -1
- package/dist/27.js +1 -8
- package/dist/27.js.map +1 -1
- package/dist/28.js +1 -9
- package/dist/28.js.map +1 -1
- package/dist/29.js +13 -96
- package/dist/29.js.map +1 -1
- package/dist/3.js +235 -859
- package/dist/3.js.map +1 -1
- package/dist/30.js.map +1 -1
- package/dist/4.js +45 -214
- package/dist/4.js.map +1 -1
- package/dist/5.js +39 -169
- package/dist/5.js.map +1 -1
- package/dist/6.js +45 -187
- package/dist/6.js.map +1 -1
- package/dist/7.js +38 -164
- package/dist/7.js.map +1 -1
- package/dist/8.js +45 -187
- package/dist/8.js.map +1 -1
- package/dist/9.js +34 -189
- package/dist/9.js.map +1 -1
- package/dist/@aws-amplify/ui-react.js +293 -1150
- package/dist/@aws-amplify/ui-react.js.map +1 -1
- package/dist/aws-amplify-react.min.js.map +1 -1
- package/dist/polyfills-core-js.js +1774 -2129
- package/dist/polyfills-core-js.js.map +1 -1
- package/dist/polyfills-css-shim.js +47 -113
- package/dist/polyfills-css-shim.js.map +1 -1
- package/dist/polyfills-dom.js +122 -391
- package/dist/polyfills-dom.js.map +1 -1
- package/package.json +3 -3
- package/lib/components.d.ts +0 -56
- package/lib/index.d.ts +0 -2
- package/lib/react-component-lib/createComponent.d.ts +0 -2
- package/lib/react-component-lib/createControllerComponent.d.ts +0 -43
- package/lib/react-component-lib/createOverlayComponent.d.ts +0 -45
- package/lib/react-component-lib/index.d.ts +0 -3
- package/lib/react-component-lib/utils/attachEventProps.d.ts +0 -8
- package/lib/react-component-lib/utils/index.d.ts +0 -8
- package/lib/withAuthenticator.d.ts +0 -3
package/dist/2.js
CHANGED
|
@@ -32,7 +32,6 @@ var __awaiter = undefined && undefined.__awaiter || function (thisArg, _argument
|
|
|
32
32
|
resolve(value);
|
|
33
33
|
});
|
|
34
34
|
}
|
|
35
|
-
|
|
36
35
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
37
36
|
function fulfilled(value) {
|
|
38
37
|
try {
|
|
@@ -41,7 +40,6 @@ var __awaiter = undefined && undefined.__awaiter || function (thisArg, _argument
|
|
|
41
40
|
reject(e);
|
|
42
41
|
}
|
|
43
42
|
}
|
|
44
|
-
|
|
45
43
|
function rejected(value) {
|
|
46
44
|
try {
|
|
47
45
|
step(generator["throw"](value));
|
|
@@ -49,29 +47,26 @@ var __awaiter = undefined && undefined.__awaiter || function (thisArg, _argument
|
|
|
49
47
|
reject(e);
|
|
50
48
|
}
|
|
51
49
|
}
|
|
52
|
-
|
|
53
50
|
function step(result) {
|
|
54
51
|
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
55
52
|
}
|
|
56
|
-
|
|
57
53
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
58
54
|
});
|
|
59
55
|
};
|
|
60
|
-
|
|
61
56
|
var __generator = undefined && undefined.__generator || function (thisArg, body) {
|
|
62
57
|
var _ = {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
58
|
+
label: 0,
|
|
59
|
+
sent: function sent() {
|
|
60
|
+
if (t[0] & 1) throw t[1];
|
|
61
|
+
return t[1];
|
|
62
|
+
},
|
|
63
|
+
trys: [],
|
|
64
|
+
ops: []
|
|
67
65
|
},
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
y,
|
|
73
|
-
t,
|
|
74
|
-
g;
|
|
66
|
+
f,
|
|
67
|
+
y,
|
|
68
|
+
t,
|
|
69
|
+
g;
|
|
75
70
|
return g = {
|
|
76
71
|
next: verb(0),
|
|
77
72
|
"throw": verb(1),
|
|
@@ -79,79 +74,60 @@ var __generator = undefined && undefined.__generator || function (thisArg, body)
|
|
|
79
74
|
}, typeof Symbol === "function" && (g[Symbol.iterator] = function () {
|
|
80
75
|
return this;
|
|
81
76
|
}), g;
|
|
82
|
-
|
|
83
77
|
function verb(n) {
|
|
84
78
|
return function (v) {
|
|
85
79
|
return step([n, v]);
|
|
86
80
|
};
|
|
87
81
|
}
|
|
88
|
-
|
|
89
82
|
function step(op) {
|
|
90
83
|
if (f) throw new TypeError("Generator is already executing.");
|
|
91
|
-
|
|
92
84
|
while (_) {
|
|
93
85
|
try {
|
|
94
86
|
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
95
87
|
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
96
|
-
|
|
97
88
|
switch (op[0]) {
|
|
98
89
|
case 0:
|
|
99
90
|
case 1:
|
|
100
91
|
t = op;
|
|
101
92
|
break;
|
|
102
|
-
|
|
103
93
|
case 4:
|
|
104
94
|
_.label++;
|
|
105
95
|
return {
|
|
106
96
|
value: op[1],
|
|
107
97
|
done: false
|
|
108
98
|
};
|
|
109
|
-
|
|
110
99
|
case 5:
|
|
111
100
|
_.label++;
|
|
112
101
|
y = op[1];
|
|
113
102
|
op = [0];
|
|
114
103
|
continue;
|
|
115
|
-
|
|
116
104
|
case 7:
|
|
117
105
|
op = _.ops.pop();
|
|
118
|
-
|
|
119
106
|
_.trys.pop();
|
|
120
|
-
|
|
121
107
|
continue;
|
|
122
|
-
|
|
123
108
|
default:
|
|
124
109
|
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
125
110
|
_ = 0;
|
|
126
111
|
continue;
|
|
127
112
|
}
|
|
128
|
-
|
|
129
113
|
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
130
114
|
_.label = op[1];
|
|
131
115
|
break;
|
|
132
116
|
}
|
|
133
|
-
|
|
134
117
|
if (op[0] === 6 && _.label < t[1]) {
|
|
135
118
|
_.label = t[1];
|
|
136
119
|
t = op;
|
|
137
120
|
break;
|
|
138
121
|
}
|
|
139
|
-
|
|
140
122
|
if (t && _.label < t[2]) {
|
|
141
123
|
_.label = t[2];
|
|
142
|
-
|
|
143
124
|
_.ops.push(op);
|
|
144
|
-
|
|
145
125
|
break;
|
|
146
126
|
}
|
|
147
|
-
|
|
148
127
|
if (t[2]) _.ops.pop();
|
|
149
|
-
|
|
150
128
|
_.trys.pop();
|
|
151
|
-
|
|
152
129
|
continue;
|
|
153
130
|
}
|
|
154
|
-
|
|
155
131
|
op = body.call(thisArg, _);
|
|
156
132
|
} catch (e) {
|
|
157
133
|
op = [6, e];
|
|
@@ -160,7 +136,6 @@ var __generator = undefined && undefined.__generator || function (thisArg, body)
|
|
|
160
136
|
f = t = 0;
|
|
161
137
|
}
|
|
162
138
|
}
|
|
163
|
-
|
|
164
139
|
if (op[0] & 5) throw op[1];
|
|
165
140
|
return {
|
|
166
141
|
value: op[0] ? op[1] : void 0,
|
|
@@ -168,18 +143,15 @@ var __generator = undefined && undefined.__generator || function (thisArg, body)
|
|
|
168
143
|
};
|
|
169
144
|
}
|
|
170
145
|
};
|
|
171
|
-
|
|
172
146
|
var __spreadArrays = undefined && undefined.__spreadArrays || function () {
|
|
173
147
|
for (var s = 0, i = 0, il = arguments.length; i < il; i++) {
|
|
174
148
|
s += arguments[i].length;
|
|
175
149
|
}
|
|
176
|
-
|
|
177
150
|
for (var r = Array(s), k = 0, i = 0; i < il; i++) {
|
|
178
151
|
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) {
|
|
179
152
|
r[k] = a[j];
|
|
180
153
|
}
|
|
181
154
|
}
|
|
182
|
-
|
|
183
155
|
return r;
|
|
184
156
|
};
|
|
185
157
|
|
|
@@ -190,32 +162,21 @@ var __spreadArrays = undefined && undefined.__spreadArrays || function () {
|
|
|
190
162
|
|
|
191
163
|
|
|
192
164
|
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
var AmplifyConfirmSignIn =
|
|
196
|
-
/** @class */
|
|
197
|
-
function () {
|
|
165
|
+
var AmplifyConfirmSignIn = /** @class */function () {
|
|
198
166
|
function class_1(hostRef) {
|
|
199
167
|
var _this = this;
|
|
200
|
-
|
|
201
168
|
Object(_index_83f2275b_js__WEBPACK_IMPORTED_MODULE_0__["r"])(this, hostRef);
|
|
202
169
|
/** Fires when confirm sign in form is submitted */
|
|
203
|
-
|
|
204
170
|
this.handleSubmit = function (event) {
|
|
205
171
|
return _this.confirm(event);
|
|
206
172
|
};
|
|
207
173
|
/** Used for header text in confirm sign in component */
|
|
208
|
-
|
|
209
|
-
|
|
210
174
|
this.headerText = _Translations_108d469f_js__WEBPACK_IMPORTED_MODULE_4__["T"].CONFIRM_SMS_CODE;
|
|
211
175
|
/** Used for the submit button text in confirm sign in component */
|
|
212
|
-
|
|
213
176
|
this.submitButtonText = _Translations_108d469f_js__WEBPACK_IMPORTED_MODULE_4__["T"].CONFIRM;
|
|
214
177
|
/** Auth state change handler for this component */
|
|
215
|
-
|
|
216
178
|
this.handleAuthStateChange = _helpers_14fcb50c_js__WEBPACK_IMPORTED_MODULE_6__["d"];
|
|
217
179
|
/** Default form field */
|
|
218
|
-
|
|
219
180
|
this.defaultFormFields = [{
|
|
220
181
|
type: 'code',
|
|
221
182
|
required: true,
|
|
@@ -239,41 +200,32 @@ function () {
|
|
|
239
200
|
* ]
|
|
240
201
|
* ```
|
|
241
202
|
*/
|
|
242
|
-
|
|
243
203
|
this.formFields = this.defaultFormFields;
|
|
244
204
|
/** The MFA option to confirm with */
|
|
245
|
-
|
|
246
205
|
this.mfaOption = _auth_types_78df304e_js__WEBPACK_IMPORTED_MODULE_2__["M"].SMS;
|
|
247
206
|
/* Whether or not the confirm-sign-in component is loading */
|
|
248
|
-
|
|
249
207
|
this.loading = false;
|
|
250
208
|
}
|
|
251
|
-
|
|
252
209
|
class_1.prototype.componentWillLoad = function () {
|
|
253
210
|
console.warn('Version `1.x` of Amplify UI has been deprecated and will be removed in a future major version of `aws-amplify`. Please visit https://ui.docs.amplify.aws/ for the current version of Amplify UI.');
|
|
254
211
|
this.setup();
|
|
255
212
|
};
|
|
256
|
-
|
|
257
213
|
class_1.prototype.userHandler = function () {
|
|
258
214
|
this.setup();
|
|
259
215
|
};
|
|
260
|
-
|
|
261
216
|
class_1.prototype.setup = function () {
|
|
262
217
|
if (this.user && this.user['challengeName'] === _auth_types_78df304e_js__WEBPACK_IMPORTED_MODULE_2__["C"].SoftwareTokenMFA) {
|
|
263
|
-
this.mfaOption = _auth_types_78df304e_js__WEBPACK_IMPORTED_MODULE_2__["M"].TOTP;
|
|
264
|
-
|
|
218
|
+
this.mfaOption = _auth_types_78df304e_js__WEBPACK_IMPORTED_MODULE_2__["M"].TOTP;
|
|
219
|
+
// If header text is using default use TOTP string
|
|
265
220
|
if (this.headerText === _Translations_108d469f_js__WEBPACK_IMPORTED_MODULE_4__["T"].CONFIRM_SMS_CODE) {
|
|
266
221
|
this.headerText = _Translations_108d469f_js__WEBPACK_IMPORTED_MODULE_4__["T"].CONFIRM_TOTP_CODE;
|
|
267
222
|
}
|
|
268
223
|
}
|
|
269
|
-
|
|
270
224
|
this.constructedFormFieldOptions = this.constructFormFieldOptions(this.formFields);
|
|
271
225
|
};
|
|
272
|
-
|
|
273
226
|
class_1.prototype.handleCodeChange = function (event) {
|
|
274
227
|
this.code = event.target.value;
|
|
275
228
|
};
|
|
276
|
-
|
|
277
229
|
class_1.prototype.confirm = function (event) {
|
|
278
230
|
return __awaiter(this, void 0, void 0, function () {
|
|
279
231
|
var mfaType, error_1;
|
|
@@ -283,54 +235,30 @@ function () {
|
|
|
283
235
|
if (event) {
|
|
284
236
|
event.preventDefault();
|
|
285
237
|
}
|
|
286
|
-
|
|
287
238
|
mfaType = this.user['challengeName'] === _auth_types_78df304e_js__WEBPACK_IMPORTED_MODULE_2__["C"].SoftwareTokenMFA ? _auth_types_78df304e_js__WEBPACK_IMPORTED_MODULE_2__["C"].SoftwareTokenMFA : null;
|
|
288
|
-
|
|
289
239
|
if (!_aws_amplify_auth__WEBPACK_IMPORTED_MODULE_3__["Auth"] || typeof _aws_amplify_auth__WEBPACK_IMPORTED_MODULE_3__["Auth"].confirmSignIn !== 'function') {
|
|
290
240
|
throw new Error(_constants_c8ecaa24_js__WEBPACK_IMPORTED_MODULE_5__["N"]);
|
|
291
241
|
}
|
|
292
|
-
|
|
293
242
|
this.loading = true;
|
|
294
243
|
_a.label = 1;
|
|
295
|
-
|
|
296
244
|
case 1:
|
|
297
245
|
_a.trys.push([1, 4, 5, 6]);
|
|
298
|
-
|
|
299
|
-
return [4
|
|
300
|
-
/*yield*/
|
|
301
|
-
, _aws_amplify_auth__WEBPACK_IMPORTED_MODULE_3__["Auth"].confirmSignIn(this.user, this.code, mfaType)];
|
|
302
|
-
|
|
246
|
+
return [4 /*yield*/, _aws_amplify_auth__WEBPACK_IMPORTED_MODULE_3__["Auth"].confirmSignIn(this.user, this.code, mfaType)];
|
|
303
247
|
case 2:
|
|
304
248
|
_a.sent();
|
|
305
|
-
|
|
306
|
-
return [4
|
|
307
|
-
/*yield*/
|
|
308
|
-
, Object(_auth_helpers_557b83fc_js__WEBPACK_IMPORTED_MODULE_7__["c"])(this.user, this.handleAuthStateChange)];
|
|
309
|
-
|
|
249
|
+
return [4 /*yield*/, Object(_auth_helpers_557b83fc_js__WEBPACK_IMPORTED_MODULE_7__["c"])(this.user, this.handleAuthStateChange)];
|
|
310
250
|
case 3:
|
|
311
251
|
_a.sent();
|
|
312
|
-
|
|
313
|
-
return [3
|
|
314
|
-
/*break*/
|
|
315
|
-
, 6];
|
|
316
|
-
|
|
252
|
+
return [3 /*break*/, 6];
|
|
317
253
|
case 4:
|
|
318
254
|
error_1 = _a.sent();
|
|
319
255
|
Object(_helpers_14fcb50c_js__WEBPACK_IMPORTED_MODULE_6__["a"])(error_1);
|
|
320
|
-
return [3
|
|
321
|
-
/*break*/
|
|
322
|
-
, 6];
|
|
323
|
-
|
|
256
|
+
return [3 /*break*/, 6];
|
|
324
257
|
case 5:
|
|
325
258
|
this.loading = false;
|
|
326
|
-
return [7
|
|
327
|
-
/*endfinally*/
|
|
328
|
-
];
|
|
329
|
-
|
|
259
|
+
return [7 /*endfinally*/];
|
|
330
260
|
case 6:
|
|
331
|
-
return [2
|
|
332
|
-
/*return*/
|
|
333
|
-
];
|
|
261
|
+
return [2 /*return*/];
|
|
334
262
|
}
|
|
335
263
|
});
|
|
336
264
|
});
|
|
@@ -338,7 +266,6 @@ function () {
|
|
|
338
266
|
|
|
339
267
|
class_1.prototype.constructFormFieldOptions = function (formFields) {
|
|
340
268
|
var _this = this;
|
|
341
|
-
|
|
342
269
|
var content = [];
|
|
343
270
|
if (formFields === undefined) return undefined;
|
|
344
271
|
if (formFields.length <= 0) return this.defaultFormFields;
|
|
@@ -357,10 +284,8 @@ function () {
|
|
|
357
284
|
});
|
|
358
285
|
return content;
|
|
359
286
|
};
|
|
360
|
-
|
|
361
287
|
class_1.prototype.render = function () {
|
|
362
288
|
var _this = this;
|
|
363
|
-
|
|
364
289
|
return Object(_index_83f2275b_js__WEBPACK_IMPORTED_MODULE_0__["h"])(_index_83f2275b_js__WEBPACK_IMPORTED_MODULE_0__["H"], null, Object(_index_83f2275b_js__WEBPACK_IMPORTED_MODULE_0__["h"])("amplify-form-section", {
|
|
365
290
|
headerText: _aws_amplify_core__WEBPACK_IMPORTED_MODULE_1__["I18n"].get(this.headerText),
|
|
366
291
|
handleSubmit: this.handleSubmit,
|
|
@@ -376,7 +301,6 @@ function () {
|
|
|
376
301
|
formFields: this.constructedFormFieldOptions
|
|
377
302
|
})));
|
|
378
303
|
};
|
|
379
|
-
|
|
380
304
|
Object.defineProperty(class_1, "watchers", {
|
|
381
305
|
get: function get() {
|
|
382
306
|
return {
|
|
@@ -388,25 +312,17 @@ function () {
|
|
|
388
312
|
});
|
|
389
313
|
return class_1;
|
|
390
314
|
}();
|
|
391
|
-
|
|
392
|
-
var AmplifyConfirmSignUp =
|
|
393
|
-
/** @class */
|
|
394
|
-
function () {
|
|
315
|
+
var AmplifyConfirmSignUp = /** @class */function () {
|
|
395
316
|
function class_2(hostRef) {
|
|
396
317
|
var _this = this;
|
|
397
|
-
|
|
398
318
|
Object(_index_83f2275b_js__WEBPACK_IMPORTED_MODULE_0__["r"])(this, hostRef);
|
|
399
319
|
/** Fires when sign up form is submitted */
|
|
400
|
-
|
|
401
320
|
this.handleSubmit = function (event) {
|
|
402
321
|
return _this.confirmSignUp(event);
|
|
403
322
|
};
|
|
404
323
|
/** Used for header text in confirm sign up component */
|
|
405
|
-
|
|
406
|
-
|
|
407
324
|
this.headerText = _Translations_108d469f_js__WEBPACK_IMPORTED_MODULE_4__["T"].CONFIRM_SIGN_UP_HEADER_TEXT;
|
|
408
325
|
/** Used for the submit button text in confirm sign up component */
|
|
409
|
-
|
|
410
326
|
this.submitButtonText = _Translations_108d469f_js__WEBPACK_IMPORTED_MODULE_4__["T"].CONFIRM_SIGN_UP_SUBMIT_BUTTON_TEXT;
|
|
411
327
|
/**
|
|
412
328
|
* Form fields allows you to utilize our pre-built components such as username field, code field, password field, email field, etc.
|
|
@@ -424,15 +340,12 @@ function () {
|
|
|
424
340
|
* ]
|
|
425
341
|
* ```
|
|
426
342
|
*/
|
|
427
|
-
|
|
428
343
|
this.formFields = [];
|
|
429
344
|
/** Auth state change handler for this components
|
|
430
345
|
* e.g. SignIn -> 'Create Account' link -> SignUp
|
|
431
346
|
*/
|
|
432
|
-
|
|
433
347
|
this.handleAuthStateChange = _helpers_14fcb50c_js__WEBPACK_IMPORTED_MODULE_6__["d"];
|
|
434
348
|
/** Username Alias is used to setup authentication with `username`, `email` or `phone_number` */
|
|
435
|
-
|
|
436
349
|
this.usernameAlias = 'username';
|
|
437
350
|
this.loading = false;
|
|
438
351
|
this.newFormFields = [];
|
|
@@ -441,20 +354,16 @@ function () {
|
|
|
441
354
|
phoneNumberValue: null
|
|
442
355
|
};
|
|
443
356
|
}
|
|
444
|
-
|
|
445
357
|
class_2.prototype.componentWillLoad = function () {
|
|
446
358
|
console.warn('Version `1.x` of Amplify UI has been deprecated and will be removed in a future major version of `aws-amplify`. Please visit https://ui.docs.amplify.aws/ for the current version of Amplify UI.');
|
|
447
359
|
this.setup();
|
|
448
360
|
};
|
|
449
|
-
|
|
450
361
|
class_2.prototype.formFieldsHandler = function () {
|
|
451
362
|
this.buildFormFields();
|
|
452
363
|
};
|
|
453
|
-
|
|
454
364
|
class_2.prototype.userHandler = function () {
|
|
455
365
|
this.setup();
|
|
456
366
|
};
|
|
457
|
-
|
|
458
367
|
class_2.prototype.setup = function () {
|
|
459
368
|
// TODO: Use optional chaining instead
|
|
460
369
|
this.userInput = this.user && this.user.username;
|
|
@@ -462,10 +371,8 @@ function () {
|
|
|
462
371
|
Object(_helpers_14fcb50c_js__WEBPACK_IMPORTED_MODULE_6__["c"])(this.usernameAlias);
|
|
463
372
|
this.buildFormFields();
|
|
464
373
|
};
|
|
465
|
-
|
|
466
374
|
class_2.prototype.buildDefaultFormFields = function () {
|
|
467
375
|
var _this = this;
|
|
468
|
-
|
|
469
376
|
this.newFormFields = [{
|
|
470
377
|
type: "" + this.usernameAlias,
|
|
471
378
|
required: true,
|
|
@@ -489,17 +396,14 @@ function () {
|
|
|
489
396
|
handleInputChange: this.handleFormFieldInputChange('code')
|
|
490
397
|
}];
|
|
491
398
|
};
|
|
492
|
-
|
|
493
399
|
class_2.prototype.buildFormFields = function () {
|
|
494
400
|
var _this = this;
|
|
495
|
-
|
|
496
401
|
if (this.formFields.length === 0) {
|
|
497
402
|
this.buildDefaultFormFields();
|
|
498
403
|
} else {
|
|
499
404
|
var newFields_1 = [];
|
|
500
405
|
this.formFields.forEach(function (field) {
|
|
501
406
|
var newField = Object.assign({}, field);
|
|
502
|
-
|
|
503
407
|
if (newField.type === 'code') {
|
|
504
408
|
newField['hint'] = Object(_helpers_14fcb50c_js__WEBPACK_IMPORTED_MODULE_6__["i"])(newField) ? Object(_index_83f2275b_js__WEBPACK_IMPORTED_MODULE_0__["h"])("div", null, _aws_amplify_core__WEBPACK_IMPORTED_MODULE_1__["I18n"].get(_Translations_108d469f_js__WEBPACK_IMPORTED_MODULE_4__["T"].CONFIRM_SIGN_UP_LOST_CODE), ' ', Object(_index_83f2275b_js__WEBPACK_IMPORTED_MODULE_0__["h"])("amplify-button", {
|
|
505
409
|
variant: "anchor",
|
|
@@ -508,42 +412,34 @@ function () {
|
|
|
508
412
|
}
|
|
509
413
|
}, _aws_amplify_core__WEBPACK_IMPORTED_MODULE_1__["I18n"].get(_Translations_108d469f_js__WEBPACK_IMPORTED_MODULE_4__["T"].CONFIRM_SIGN_UP_RESEND_CODE))) : newField['hint'];
|
|
510
414
|
}
|
|
511
|
-
|
|
512
415
|
newField['handleInputChange'] = function (event) {
|
|
513
416
|
return _this.handleFormFieldInputWithCallback(event, field);
|
|
514
417
|
};
|
|
515
|
-
|
|
516
418
|
newFields_1.push(newField);
|
|
517
419
|
});
|
|
518
420
|
this.newFormFields = newFields_1;
|
|
519
421
|
}
|
|
520
422
|
};
|
|
521
|
-
|
|
522
423
|
class_2.prototype.handleFormFieldInputChange = function (fieldType) {
|
|
523
424
|
var _this = this;
|
|
524
|
-
|
|
525
425
|
switch (fieldType) {
|
|
526
426
|
case 'username':
|
|
527
427
|
case 'email':
|
|
528
428
|
return function (event) {
|
|
529
429
|
return _this.userInput = event.target.value;
|
|
530
430
|
};
|
|
531
|
-
|
|
532
431
|
case 'phone_number':
|
|
533
432
|
return function (event) {
|
|
534
433
|
return Object(_helpers_14fcb50c_js__WEBPACK_IMPORTED_MODULE_6__["h"])(event, _this.phoneNumber);
|
|
535
434
|
};
|
|
536
|
-
|
|
537
435
|
case 'code':
|
|
538
436
|
return function (event) {
|
|
539
437
|
return _this.code = event.target.value;
|
|
540
438
|
};
|
|
541
|
-
|
|
542
439
|
default:
|
|
543
440
|
return;
|
|
544
441
|
}
|
|
545
442
|
};
|
|
546
|
-
|
|
547
443
|
class_2.prototype.setFieldValue = function (field) {
|
|
548
444
|
switch (field.type) {
|
|
549
445
|
case 'username':
|
|
@@ -553,19 +449,15 @@ function () {
|
|
|
553
449
|
} else {
|
|
554
450
|
this.userInput = field.value;
|
|
555
451
|
}
|
|
556
|
-
|
|
557
452
|
break;
|
|
558
|
-
|
|
559
453
|
case 'phone_number':
|
|
560
454
|
if (field.dialCode) {
|
|
561
455
|
this.phoneNumber.countryDialCodeValue = field.dialCode;
|
|
562
456
|
}
|
|
563
|
-
|
|
564
457
|
this.phoneNumber.phoneNumberValue = field.value;
|
|
565
458
|
break;
|
|
566
459
|
}
|
|
567
460
|
};
|
|
568
|
-
|
|
569
461
|
class_2.prototype.handleFormFieldInputWithCallback = function (event, field) {
|
|
570
462
|
var fnToCall = field['handleInputChange'] ? field['handleInputChange'] : function (event, cb) {
|
|
571
463
|
cb(event);
|
|
@@ -577,21 +469,16 @@ function () {
|
|
|
577
469
|
* Returns the username of the user to confirm. If a valid `user.username` has been passed as a prop, we return that.
|
|
578
470
|
* Otherwise, we return the `userInput` on the form.
|
|
579
471
|
*/
|
|
580
|
-
|
|
581
|
-
|
|
582
472
|
class_2.prototype.getUsername = function () {
|
|
583
473
|
if (this.user && this.user.username) return this.user.username;
|
|
584
|
-
|
|
585
474
|
switch (this.usernameAlias) {
|
|
586
475
|
case 'username':
|
|
587
476
|
case 'email':
|
|
588
477
|
return this.userInput;
|
|
589
|
-
|
|
590
478
|
case 'phone_number':
|
|
591
479
|
return Object(_helpers_14fcb50c_js__WEBPACK_IMPORTED_MODULE_6__["b"])(this.phoneNumber);
|
|
592
480
|
}
|
|
593
481
|
};
|
|
594
|
-
|
|
595
482
|
class_2.prototype.resendConfirmCode = function () {
|
|
596
483
|
return __awaiter(this, void 0, void 0, function () {
|
|
597
484
|
var username, error_2;
|
|
@@ -601,47 +488,30 @@ function () {
|
|
|
601
488
|
if (event) {
|
|
602
489
|
event.preventDefault();
|
|
603
490
|
}
|
|
604
|
-
|
|
605
491
|
if (!_aws_amplify_auth__WEBPACK_IMPORTED_MODULE_3__["Auth"] || typeof _aws_amplify_auth__WEBPACK_IMPORTED_MODULE_3__["Auth"].resendSignUp !== 'function') {
|
|
606
492
|
throw new Error(_constants_c8ecaa24_js__WEBPACK_IMPORTED_MODULE_5__["N"]);
|
|
607
493
|
}
|
|
608
|
-
|
|
609
494
|
_a.label = 1;
|
|
610
|
-
|
|
611
495
|
case 1:
|
|
612
496
|
_a.trys.push([1, 3,, 4]);
|
|
613
|
-
|
|
614
497
|
username = this.getUsername();
|
|
615
498
|
if (!username) throw new Error(_Translations_108d469f_js__WEBPACK_IMPORTED_MODULE_4__["T"].EMPTY_USERNAME);
|
|
616
|
-
return [4
|
|
617
|
-
/*yield*/
|
|
618
|
-
, _aws_amplify_auth__WEBPACK_IMPORTED_MODULE_3__["Auth"].resendSignUp(username.trim())];
|
|
619
|
-
|
|
499
|
+
return [4 /*yield*/, _aws_amplify_auth__WEBPACK_IMPORTED_MODULE_3__["Auth"].resendSignUp(username.trim())];
|
|
620
500
|
case 2:
|
|
621
501
|
_a.sent();
|
|
622
|
-
|
|
623
|
-
return [3
|
|
624
|
-
/*break*/
|
|
625
|
-
, 4];
|
|
626
|
-
|
|
502
|
+
return [3 /*break*/, 4];
|
|
627
503
|
case 3:
|
|
628
504
|
error_2 = _a.sent();
|
|
629
505
|
Object(_helpers_14fcb50c_js__WEBPACK_IMPORTED_MODULE_6__["a"])(error_2);
|
|
630
|
-
return [3
|
|
631
|
-
/*break*/
|
|
632
|
-
, 4];
|
|
633
|
-
|
|
506
|
+
return [3 /*break*/, 4];
|
|
634
507
|
case 4:
|
|
635
|
-
return [2
|
|
636
|
-
/*return*/
|
|
637
|
-
];
|
|
508
|
+
return [2 /*return*/];
|
|
638
509
|
}
|
|
639
510
|
});
|
|
640
511
|
});
|
|
641
|
-
};
|
|
512
|
+
};
|
|
513
|
+
// TODO: Add validation
|
|
642
514
|
// TODO: Prefix
|
|
643
|
-
|
|
644
|
-
|
|
645
515
|
class_2.prototype.confirmSignUp = function (event) {
|
|
646
516
|
return __awaiter(this, void 0, void 0, function () {
|
|
647
517
|
var username, confirmSignUpResult, error_3;
|
|
@@ -651,73 +521,43 @@ function () {
|
|
|
651
521
|
if (event) {
|
|
652
522
|
event.preventDefault();
|
|
653
523
|
}
|
|
654
|
-
|
|
655
524
|
if (!_aws_amplify_auth__WEBPACK_IMPORTED_MODULE_3__["Auth"] || typeof _aws_amplify_auth__WEBPACK_IMPORTED_MODULE_3__["Auth"].confirmSignUp !== 'function') {
|
|
656
525
|
throw new Error(_constants_c8ecaa24_js__WEBPACK_IMPORTED_MODULE_5__["N"]);
|
|
657
526
|
}
|
|
658
|
-
|
|
659
527
|
this.loading = true;
|
|
660
528
|
_a.label = 1;
|
|
661
|
-
|
|
662
529
|
case 1:
|
|
663
530
|
_a.trys.push([1, 6, 7, 8]);
|
|
664
|
-
|
|
665
531
|
username = this.getUsername();
|
|
666
532
|
if (!username) throw new Error(_Translations_108d469f_js__WEBPACK_IMPORTED_MODULE_4__["T"].EMPTY_USERNAME);
|
|
667
533
|
username = username.trim();
|
|
668
|
-
return [4
|
|
669
|
-
/*yield*/
|
|
670
|
-
, _aws_amplify_auth__WEBPACK_IMPORTED_MODULE_3__["Auth"].confirmSignUp(username, this.code)];
|
|
671
|
-
|
|
534
|
+
return [4 /*yield*/, _aws_amplify_auth__WEBPACK_IMPORTED_MODULE_3__["Auth"].confirmSignUp(username, this.code)];
|
|
672
535
|
case 2:
|
|
673
536
|
confirmSignUpResult = _a.sent();
|
|
674
|
-
|
|
675
537
|
if (!confirmSignUpResult) {
|
|
676
538
|
throw new Error(_aws_amplify_core__WEBPACK_IMPORTED_MODULE_1__["I18n"].get(_Translations_108d469f_js__WEBPACK_IMPORTED_MODULE_4__["T"].CONFIRM_SIGN_UP_FAILED));
|
|
677
539
|
}
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
/*
|
|
681
|
-
, 4]; // Auto sign in user if password is available from previous workflow
|
|
682
|
-
|
|
683
|
-
return [4
|
|
684
|
-
/*yield*/
|
|
685
|
-
, Object(_auth_helpers_557b83fc_js__WEBPACK_IMPORTED_MODULE_7__["h"])(username, this._signUpAttrs.password, this.handleAuthStateChange)];
|
|
686
|
-
|
|
540
|
+
if (!(this._signUpAttrs && this._signUpAttrs.password && this._signUpAttrs.password !== '')) return [3 /*break*/, 4];
|
|
541
|
+
// Auto sign in user if password is available from previous workflow
|
|
542
|
+
return [4 /*yield*/, Object(_auth_helpers_557b83fc_js__WEBPACK_IMPORTED_MODULE_7__["h"])(username, this._signUpAttrs.password, this.handleAuthStateChange)];
|
|
687
543
|
case 3:
|
|
688
544
|
// Auto sign in user if password is available from previous workflow
|
|
689
545
|
_a.sent();
|
|
690
|
-
|
|
691
|
-
return [3
|
|
692
|
-
/*break*/
|
|
693
|
-
, 5];
|
|
694
|
-
|
|
546
|
+
return [3 /*break*/, 5];
|
|
695
547
|
case 4:
|
|
696
548
|
this.handleAuthStateChange(_auth_types_78df304e_js__WEBPACK_IMPORTED_MODULE_2__["A"].SignIn);
|
|
697
549
|
_a.label = 5;
|
|
698
|
-
|
|
699
550
|
case 5:
|
|
700
|
-
return [3
|
|
701
|
-
/*break*/
|
|
702
|
-
, 8];
|
|
703
|
-
|
|
551
|
+
return [3 /*break*/, 8];
|
|
704
552
|
case 6:
|
|
705
553
|
error_3 = _a.sent();
|
|
706
554
|
Object(_helpers_14fcb50c_js__WEBPACK_IMPORTED_MODULE_6__["a"])(error_3);
|
|
707
|
-
return [3
|
|
708
|
-
/*break*/
|
|
709
|
-
, 8];
|
|
710
|
-
|
|
555
|
+
return [3 /*break*/, 8];
|
|
711
556
|
case 7:
|
|
712
557
|
this.loading = false;
|
|
713
|
-
return [7
|
|
714
|
-
/*endfinally*/
|
|
715
|
-
];
|
|
716
|
-
|
|
558
|
+
return [7 /*endfinally*/];
|
|
717
559
|
case 8:
|
|
718
|
-
return [2
|
|
719
|
-
/*return*/
|
|
720
|
-
];
|
|
560
|
+
return [2 /*return*/];
|
|
721
561
|
}
|
|
722
562
|
});
|
|
723
563
|
});
|
|
@@ -725,7 +565,6 @@ function () {
|
|
|
725
565
|
|
|
726
566
|
class_2.prototype.render = function () {
|
|
727
567
|
var _this = this;
|
|
728
|
-
|
|
729
568
|
return Object(_index_83f2275b_js__WEBPACK_IMPORTED_MODULE_0__["h"])(_index_83f2275b_js__WEBPACK_IMPORTED_MODULE_0__["H"], null, Object(_index_83f2275b_js__WEBPACK_IMPORTED_MODULE_0__["h"])("amplify-form-section", {
|
|
730
569
|
headerText: _aws_amplify_core__WEBPACK_IMPORTED_MODULE_1__["I18n"].get(this.headerText),
|
|
731
570
|
submitButtonText: _aws_amplify_core__WEBPACK_IMPORTED_MODULE_1__["I18n"].get(this.submitButtonText),
|
|
@@ -741,7 +580,6 @@ function () {
|
|
|
741
580
|
formFields: this.newFormFields
|
|
742
581
|
})));
|
|
743
582
|
};
|
|
744
|
-
|
|
745
583
|
Object.defineProperty(class_2, "watchers", {
|
|
746
584
|
get: function get() {
|
|
747
585
|
return {
|
|
@@ -754,45 +592,30 @@ function () {
|
|
|
754
592
|
});
|
|
755
593
|
return class_2;
|
|
756
594
|
}();
|
|
757
|
-
|
|
758
595
|
var logger = new _aws_amplify_core__WEBPACK_IMPORTED_MODULE_1__["Logger"]('ForgotPassword');
|
|
759
|
-
|
|
760
|
-
var AmplifyForgotPassword =
|
|
761
|
-
/** @class */
|
|
762
|
-
function () {
|
|
596
|
+
var AmplifyForgotPassword = /** @class */function () {
|
|
763
597
|
function class_3(hostRef) {
|
|
764
598
|
var _this = this;
|
|
765
|
-
|
|
766
599
|
Object(_index_83f2275b_js__WEBPACK_IMPORTED_MODULE_0__["r"])(this, hostRef);
|
|
767
600
|
/** The header text of the forgot password section */
|
|
768
|
-
|
|
769
601
|
this.headerText = _Translations_108d469f_js__WEBPACK_IMPORTED_MODULE_4__["T"].RESET_YOUR_PASSWORD;
|
|
770
602
|
/** The text displayed inside of the send code button for the form */
|
|
771
|
-
|
|
772
603
|
this.sendButtonText = _Translations_108d469f_js__WEBPACK_IMPORTED_MODULE_4__["T"].SEND_CODE;
|
|
773
604
|
/** The text displayed inside of the submit button for the form */
|
|
774
|
-
|
|
775
605
|
this.submitButtonText = _Translations_108d469f_js__WEBPACK_IMPORTED_MODULE_4__["T"].SUBMIT;
|
|
776
606
|
/** The form fields displayed inside of the forgot password form */
|
|
777
|
-
|
|
778
607
|
this.formFields = [];
|
|
779
608
|
/** The function called when making a request to reset password */
|
|
780
|
-
|
|
781
609
|
this.handleSend = function (event) {
|
|
782
610
|
return _this.send(event);
|
|
783
611
|
};
|
|
784
612
|
/** The function called when submitting a new password */
|
|
785
|
-
|
|
786
|
-
|
|
787
613
|
this.handleSubmit = function (event) {
|
|
788
614
|
return _this.submit(event);
|
|
789
615
|
};
|
|
790
616
|
/** Auth state change handler for this component */
|
|
791
|
-
|
|
792
|
-
|
|
793
617
|
this.handleAuthStateChange = _helpers_14fcb50c_js__WEBPACK_IMPORTED_MODULE_6__["d"];
|
|
794
618
|
/** Username Alias is used to setup authentication with `username`, `email` or `phone_number` */
|
|
795
|
-
|
|
796
619
|
this.usernameAlias = 'username';
|
|
797
620
|
this.delivery = null;
|
|
798
621
|
this.loading = false;
|
|
@@ -807,37 +630,30 @@ function () {
|
|
|
807
630
|
code: ''
|
|
808
631
|
};
|
|
809
632
|
}
|
|
810
|
-
|
|
811
633
|
class_3.prototype.componentWillLoad = function () {
|
|
812
634
|
console.warn('Version `1.x` of Amplify UI has been deprecated and will be removed in a future major version of `aws-amplify`. Please visit https://ui.docs.amplify.aws/ for the current version of Amplify UI.');
|
|
813
635
|
Object(_helpers_14fcb50c_js__WEBPACK_IMPORTED_MODULE_6__["c"])(this.usernameAlias);
|
|
814
636
|
this.buildFormFields();
|
|
815
637
|
};
|
|
816
|
-
|
|
817
638
|
class_3.prototype.formFieldsHandler = function () {
|
|
818
639
|
this.buildFormFields();
|
|
819
640
|
};
|
|
820
|
-
|
|
821
641
|
class_3.prototype.buildFormFields = function () {
|
|
822
642
|
var _this = this;
|
|
823
|
-
|
|
824
643
|
if (this.formFields.length === 0) {
|
|
825
644
|
this.buildDefaultFormFields();
|
|
826
645
|
} else {
|
|
827
646
|
var newFields_2 = [];
|
|
828
647
|
this.formFields.forEach(function (field) {
|
|
829
648
|
var newField = Object.assign({}, field);
|
|
830
|
-
|
|
831
649
|
newField['handleInputChange'] = function (event) {
|
|
832
650
|
return _this.handleFormFieldInputWithCallback(event, field);
|
|
833
651
|
};
|
|
834
|
-
|
|
835
652
|
newFields_2.push(newField);
|
|
836
653
|
});
|
|
837
654
|
this.newFormFields = newFields_2;
|
|
838
655
|
}
|
|
839
656
|
};
|
|
840
|
-
|
|
841
657
|
class_3.prototype.buildDefaultFormFields = function () {
|
|
842
658
|
switch (this.usernameAlias) {
|
|
843
659
|
case 'email':
|
|
@@ -850,7 +666,6 @@ function () {
|
|
|
850
666
|
}
|
|
851
667
|
}];
|
|
852
668
|
break;
|
|
853
|
-
|
|
854
669
|
case 'phone_number':
|
|
855
670
|
this.newFormFields = [{
|
|
856
671
|
type: 'phone_number',
|
|
@@ -861,7 +676,6 @@ function () {
|
|
|
861
676
|
}
|
|
862
677
|
}];
|
|
863
678
|
break;
|
|
864
|
-
|
|
865
679
|
case 'username':
|
|
866
680
|
default:
|
|
867
681
|
this.newFormFields = [{
|
|
@@ -875,33 +689,27 @@ function () {
|
|
|
875
689
|
break;
|
|
876
690
|
}
|
|
877
691
|
};
|
|
878
|
-
|
|
879
692
|
class_3.prototype.handleFormFieldInputChange = function (fieldType) {
|
|
880
693
|
var _this = this;
|
|
881
|
-
|
|
882
694
|
switch (fieldType) {
|
|
883
695
|
case 'username':
|
|
884
696
|
case 'email':
|
|
885
697
|
return function (event) {
|
|
886
698
|
return _this.forgotPasswordAttrs.userInput = event.target.value;
|
|
887
699
|
};
|
|
888
|
-
|
|
889
700
|
case 'phone_number':
|
|
890
701
|
return function (event) {
|
|
891
702
|
return Object(_helpers_14fcb50c_js__WEBPACK_IMPORTED_MODULE_6__["h"])(event, _this.phoneNumber);
|
|
892
703
|
};
|
|
893
|
-
|
|
894
704
|
case 'password':
|
|
895
705
|
case 'code':
|
|
896
706
|
return function (event) {
|
|
897
707
|
return _this.forgotPasswordAttrs[fieldType] = event.target.value;
|
|
898
708
|
};
|
|
899
|
-
|
|
900
709
|
default:
|
|
901
710
|
return;
|
|
902
711
|
}
|
|
903
712
|
};
|
|
904
|
-
|
|
905
713
|
class_3.prototype.setFieldValue = function (field, formAttributes) {
|
|
906
714
|
switch (field.type) {
|
|
907
715
|
case 'username':
|
|
@@ -911,17 +719,13 @@ function () {
|
|
|
911
719
|
} else {
|
|
912
720
|
formAttributes.userInput = field.value;
|
|
913
721
|
}
|
|
914
|
-
|
|
915
722
|
break;
|
|
916
|
-
|
|
917
723
|
case 'phone_number':
|
|
918
724
|
if (field.dialCode) {
|
|
919
725
|
this.phoneNumber.countryDialCodeValue = field.dialCode;
|
|
920
726
|
}
|
|
921
|
-
|
|
922
727
|
this.phoneNumber.phoneNumberValue = field.value;
|
|
923
728
|
break;
|
|
924
|
-
|
|
925
729
|
case 'password':
|
|
926
730
|
case 'code':
|
|
927
731
|
if (field.value === undefined) {
|
|
@@ -929,11 +733,9 @@ function () {
|
|
|
929
733
|
} else {
|
|
930
734
|
formAttributes[field.type] = field.value;
|
|
931
735
|
}
|
|
932
|
-
|
|
933
736
|
break;
|
|
934
737
|
}
|
|
935
738
|
};
|
|
936
|
-
|
|
937
739
|
class_3.prototype.handleFormFieldInputWithCallback = function (event, field) {
|
|
938
740
|
var fnToCall = field['handleInputChange'] ? field['handleInputChange'] : function (event, cb) {
|
|
939
741
|
cb(event);
|
|
@@ -941,7 +743,6 @@ function () {
|
|
|
941
743
|
var callback = this.handleFormFieldInputChange(field.type);
|
|
942
744
|
fnToCall(event, callback.bind(this));
|
|
943
745
|
};
|
|
944
|
-
|
|
945
746
|
class_3.prototype.send = function (event) {
|
|
946
747
|
return __awaiter(this, void 0, void 0, function () {
|
|
947
748
|
var data, error_4;
|
|
@@ -951,13 +752,10 @@ function () {
|
|
|
951
752
|
if (event) {
|
|
952
753
|
event.preventDefault();
|
|
953
754
|
}
|
|
954
|
-
|
|
955
755
|
if (!_aws_amplify_auth__WEBPACK_IMPORTED_MODULE_3__["Auth"] || typeof _aws_amplify_auth__WEBPACK_IMPORTED_MODULE_3__["Auth"].forgotPassword !== 'function') {
|
|
956
756
|
throw new Error(_constants_c8ecaa24_js__WEBPACK_IMPORTED_MODULE_5__["N"]);
|
|
957
757
|
}
|
|
958
|
-
|
|
959
758
|
this.loading = true;
|
|
960
|
-
|
|
961
759
|
switch (this.usernameAlias) {
|
|
962
760
|
case 'phone_number':
|
|
963
761
|
try {
|
|
@@ -965,19 +763,12 @@ function () {
|
|
|
965
763
|
} catch (error) {
|
|
966
764
|
Object(_helpers_14fcb50c_js__WEBPACK_IMPORTED_MODULE_6__["a"])(error);
|
|
967
765
|
}
|
|
968
|
-
|
|
969
766
|
break;
|
|
970
767
|
}
|
|
971
|
-
|
|
972
768
|
_a.label = 1;
|
|
973
|
-
|
|
974
769
|
case 1:
|
|
975
770
|
_a.trys.push([1, 3, 4, 5]);
|
|
976
|
-
|
|
977
|
-
return [4
|
|
978
|
-
/*yield*/
|
|
979
|
-
, _aws_amplify_auth__WEBPACK_IMPORTED_MODULE_3__["Auth"].forgotPassword(this.forgotPasswordAttrs.userInput.trim())];
|
|
980
|
-
|
|
771
|
+
return [4 /*yield*/, _aws_amplify_auth__WEBPACK_IMPORTED_MODULE_3__["Auth"].forgotPassword(this.forgotPasswordAttrs.userInput.trim())];
|
|
981
772
|
case 2:
|
|
982
773
|
data = _a.sent();
|
|
983
774
|
logger.debug(data);
|
|
@@ -996,27 +787,16 @@ function () {
|
|
|
996
787
|
placeholder: _aws_amplify_core__WEBPACK_IMPORTED_MODULE_1__["I18n"].get(_Translations_108d469f_js__WEBPACK_IMPORTED_MODULE_4__["T"].NEW_PASSWORD_PLACEHOLDER)
|
|
997
788
|
}];
|
|
998
789
|
this.delivery = data.CodeDeliveryDetails;
|
|
999
|
-
return [3
|
|
1000
|
-
/*break*/
|
|
1001
|
-
, 5];
|
|
1002
|
-
|
|
790
|
+
return [3 /*break*/, 5];
|
|
1003
791
|
case 3:
|
|
1004
792
|
error_4 = _a.sent();
|
|
1005
793
|
Object(_helpers_14fcb50c_js__WEBPACK_IMPORTED_MODULE_6__["a"])(error_4);
|
|
1006
|
-
return [3
|
|
1007
|
-
/*break*/
|
|
1008
|
-
, 5];
|
|
1009
|
-
|
|
794
|
+
return [3 /*break*/, 5];
|
|
1010
795
|
case 4:
|
|
1011
796
|
this.loading = false;
|
|
1012
|
-
return [7
|
|
1013
|
-
/*endfinally*/
|
|
1014
|
-
];
|
|
1015
|
-
|
|
797
|
+
return [7 /*endfinally*/];
|
|
1016
798
|
case 5:
|
|
1017
|
-
return [2
|
|
1018
|
-
/*return*/
|
|
1019
|
-
];
|
|
799
|
+
return [2 /*return*/];
|
|
1020
800
|
}
|
|
1021
801
|
});
|
|
1022
802
|
});
|
|
@@ -1025,55 +805,36 @@ function () {
|
|
|
1025
805
|
class_3.prototype.submit = function (event) {
|
|
1026
806
|
return __awaiter(this, void 0, void 0, function () {
|
|
1027
807
|
var _a, userInput, code, password, data, error_5;
|
|
1028
|
-
|
|
1029
808
|
return __generator(this, function (_b) {
|
|
1030
809
|
switch (_b.label) {
|
|
1031
810
|
case 0:
|
|
1032
811
|
if (event) {
|
|
1033
812
|
event.preventDefault();
|
|
1034
813
|
}
|
|
1035
|
-
|
|
1036
814
|
if (!_aws_amplify_auth__WEBPACK_IMPORTED_MODULE_3__["Auth"] || typeof _aws_amplify_auth__WEBPACK_IMPORTED_MODULE_3__["Auth"].forgotPasswordSubmit !== 'function') {
|
|
1037
815
|
throw new Error(_constants_c8ecaa24_js__WEBPACK_IMPORTED_MODULE_5__["N"]);
|
|
1038
816
|
}
|
|
1039
|
-
|
|
1040
817
|
this.loading = true;
|
|
1041
818
|
_b.label = 1;
|
|
1042
|
-
|
|
1043
819
|
case 1:
|
|
1044
820
|
_b.trys.push([1, 3, 4, 5]);
|
|
1045
|
-
|
|
1046
821
|
_a = this.forgotPasswordAttrs, userInput = _a.userInput, code = _a.code, password = _a.password;
|
|
1047
|
-
return [4
|
|
1048
|
-
/*yield*/
|
|
1049
|
-
, _aws_amplify_auth__WEBPACK_IMPORTED_MODULE_3__["Auth"].forgotPasswordSubmit(userInput.trim(), code, password)];
|
|
1050
|
-
|
|
822
|
+
return [4 /*yield*/, _aws_amplify_auth__WEBPACK_IMPORTED_MODULE_3__["Auth"].forgotPasswordSubmit(userInput.trim(), code, password)];
|
|
1051
823
|
case 2:
|
|
1052
824
|
data = _b.sent();
|
|
1053
825
|
logger.debug(data);
|
|
1054
826
|
this.handleAuthStateChange(_auth_types_78df304e_js__WEBPACK_IMPORTED_MODULE_2__["A"].SignIn);
|
|
1055
827
|
this.delivery = null;
|
|
1056
|
-
return [3
|
|
1057
|
-
/*break*/
|
|
1058
|
-
, 5];
|
|
1059
|
-
|
|
828
|
+
return [3 /*break*/, 5];
|
|
1060
829
|
case 3:
|
|
1061
830
|
error_5 = _b.sent();
|
|
1062
831
|
Object(_helpers_14fcb50c_js__WEBPACK_IMPORTED_MODULE_6__["a"])(error_5);
|
|
1063
|
-
return [3
|
|
1064
|
-
/*break*/
|
|
1065
|
-
, 5];
|
|
1066
|
-
|
|
832
|
+
return [3 /*break*/, 5];
|
|
1067
833
|
case 4:
|
|
1068
834
|
this.loading = false;
|
|
1069
|
-
return [7
|
|
1070
|
-
/*endfinally*/
|
|
1071
|
-
];
|
|
1072
|
-
|
|
835
|
+
return [7 /*endfinally*/];
|
|
1073
836
|
case 5:
|
|
1074
|
-
return [2
|
|
1075
|
-
/*return*/
|
|
1076
|
-
];
|
|
837
|
+
return [2 /*return*/];
|
|
1077
838
|
}
|
|
1078
839
|
});
|
|
1079
840
|
});
|
|
@@ -1081,7 +842,6 @@ function () {
|
|
|
1081
842
|
|
|
1082
843
|
class_3.prototype.render = function () {
|
|
1083
844
|
var _this = this;
|
|
1084
|
-
|
|
1085
845
|
var submitFn = this.delivery ? function (event) {
|
|
1086
846
|
return _this.handleSubmit(event);
|
|
1087
847
|
} : function (event) {
|
|
@@ -1105,7 +865,6 @@ function () {
|
|
|
1105
865
|
formFields: this.newFormFields
|
|
1106
866
|
})));
|
|
1107
867
|
};
|
|
1108
|
-
|
|
1109
868
|
Object.defineProperty(class_3, "watchers", {
|
|
1110
869
|
get: function get() {
|
|
1111
870
|
return {
|
|
@@ -1117,33 +876,22 @@ function () {
|
|
|
1117
876
|
});
|
|
1118
877
|
return class_3;
|
|
1119
878
|
}();
|
|
1120
|
-
|
|
1121
879
|
var logger$1 = new _aws_amplify_core__WEBPACK_IMPORTED_MODULE_1__["ConsoleLogger"]('amplify-require-new-password');
|
|
1122
|
-
|
|
1123
|
-
var AmplifyRequireNewPassword =
|
|
1124
|
-
/** @class */
|
|
1125
|
-
function () {
|
|
880
|
+
var AmplifyRequireNewPassword = /** @class */function () {
|
|
1126
881
|
function class_4(hostRef) {
|
|
1127
882
|
var _this = this;
|
|
1128
|
-
|
|
1129
883
|
Object(_index_83f2275b_js__WEBPACK_IMPORTED_MODULE_0__["r"])(this, hostRef);
|
|
1130
884
|
/** The header text of the forgot password section */
|
|
1131
|
-
|
|
1132
885
|
this.headerText = _Translations_108d469f_js__WEBPACK_IMPORTED_MODULE_4__["T"].CHANGE_PASSWORD;
|
|
1133
886
|
/** The text displayed inside of the submit button for the form */
|
|
1134
|
-
|
|
1135
887
|
this.submitButtonText = _Translations_108d469f_js__WEBPACK_IMPORTED_MODULE_4__["T"].CHANGE_PASSWORD_ACTION;
|
|
1136
888
|
/** The function called when submitting a new password */
|
|
1137
|
-
|
|
1138
889
|
this.handleSubmit = function (event) {
|
|
1139
890
|
return _this.completeNewPassword(event);
|
|
1140
891
|
};
|
|
1141
892
|
/** Auth state change handler for this component */
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
893
|
this.handleAuthStateChange = _helpers_14fcb50c_js__WEBPACK_IMPORTED_MODULE_6__["d"];
|
|
1145
894
|
/** The form fields displayed inside of the forgot password form */
|
|
1146
|
-
|
|
1147
895
|
this.formFields = [{
|
|
1148
896
|
type: _auth_types_78df304e_js__WEBPACK_IMPORTED_MODULE_2__["a"].Password,
|
|
1149
897
|
required: true,
|
|
@@ -1164,11 +912,9 @@ function () {
|
|
|
1164
912
|
phoneNumberValue: ' '
|
|
1165
913
|
};
|
|
1166
914
|
}
|
|
1167
|
-
|
|
1168
915
|
class_4.prototype.userHandler = function () {
|
|
1169
916
|
this.setCurrentUser();
|
|
1170
917
|
};
|
|
1171
|
-
|
|
1172
918
|
class_4.prototype.handleRequiredAttributeInputChange = function (attribute, event) {
|
|
1173
919
|
if (attribute === 'phone_number') {
|
|
1174
920
|
this.formatPhoneNumber(event);
|
|
@@ -1176,51 +922,31 @@ function () {
|
|
|
1176
922
|
this.requiredAttributes[attribute] = event.target.value;
|
|
1177
923
|
}
|
|
1178
924
|
};
|
|
1179
|
-
|
|
1180
925
|
class_4.prototype.setCurrentUser = function () {
|
|
1181
926
|
return __awaiter(this, void 0, void 0, function () {
|
|
1182
927
|
var user, error_6, userRequiredAttributes, requiredAttributesMap_1;
|
|
1183
|
-
|
|
1184
928
|
var _this = this;
|
|
1185
|
-
|
|
1186
929
|
return __generator(this, function (_a) {
|
|
1187
930
|
switch (_a.label) {
|
|
1188
931
|
case 0:
|
|
1189
|
-
if (!!this.user) return [3
|
|
1190
|
-
/*break*/
|
|
1191
|
-
, 5];
|
|
932
|
+
if (!!this.user) return [3 /*break*/, 5];
|
|
1192
933
|
_a.label = 1;
|
|
1193
|
-
|
|
1194
934
|
case 1:
|
|
1195
935
|
_a.trys.push([1, 3,, 4]);
|
|
1196
|
-
|
|
1197
|
-
return [4
|
|
1198
|
-
/*yield*/
|
|
1199
|
-
, _aws_amplify_auth__WEBPACK_IMPORTED_MODULE_3__["Auth"].currentAuthenticatedUser()];
|
|
1200
|
-
|
|
936
|
+
return [4 /*yield*/, _aws_amplify_auth__WEBPACK_IMPORTED_MODULE_3__["Auth"].currentAuthenticatedUser()];
|
|
1201
937
|
case 2:
|
|
1202
938
|
user = _a.sent();
|
|
1203
939
|
if (user) this.currentUser = user;
|
|
1204
|
-
return [3
|
|
1205
|
-
/*break*/
|
|
1206
|
-
, 4];
|
|
1207
|
-
|
|
940
|
+
return [3 /*break*/, 4];
|
|
1208
941
|
case 3:
|
|
1209
942
|
error_6 = _a.sent();
|
|
1210
943
|
Object(_helpers_14fcb50c_js__WEBPACK_IMPORTED_MODULE_6__["a"])(error_6);
|
|
1211
|
-
return [3
|
|
1212
|
-
/*break*/
|
|
1213
|
-
, 4];
|
|
1214
|
-
|
|
944
|
+
return [3 /*break*/, 4];
|
|
1215
945
|
case 4:
|
|
1216
|
-
return [3
|
|
1217
|
-
/*break*/
|
|
1218
|
-
, 6];
|
|
1219
|
-
|
|
946
|
+
return [3 /*break*/, 6];
|
|
1220
947
|
case 5:
|
|
1221
948
|
this.currentUser = this.user;
|
|
1222
949
|
_a.label = 6;
|
|
1223
|
-
|
|
1224
950
|
case 6:
|
|
1225
951
|
if (this.currentUser && this.currentUser.challengeParam && this.currentUser.challengeParam.requiredAttributes) {
|
|
1226
952
|
userRequiredAttributes = this.currentUser.challengeParam.requiredAttributes;
|
|
@@ -1241,10 +967,7 @@ function () {
|
|
|
1241
967
|
_this.newFormFields = __spreadArrays(_this.newFormFields, [formField]);
|
|
1242
968
|
});
|
|
1243
969
|
}
|
|
1244
|
-
|
|
1245
|
-
return [2
|
|
1246
|
-
/*return*/
|
|
1247
|
-
];
|
|
970
|
+
return [2 /*return*/];
|
|
1248
971
|
}
|
|
1249
972
|
});
|
|
1250
973
|
});
|
|
@@ -1254,11 +977,9 @@ function () {
|
|
|
1254
977
|
console.warn('Version `1.x` of Amplify UI has been deprecated and will be removed in a future major version of `aws-amplify`. Please visit https://ui.docs.amplify.aws/ for the current version of Amplify UI.');
|
|
1255
978
|
return this.setCurrentUser();
|
|
1256
979
|
};
|
|
1257
|
-
|
|
1258
980
|
class_4.prototype.handlePasswordChange = function (event) {
|
|
1259
981
|
this.password = event.target.value;
|
|
1260
982
|
};
|
|
1261
|
-
|
|
1262
983
|
class_4.prototype.formatPhoneNumber = function (event) {
|
|
1263
984
|
Object(_helpers_14fcb50c_js__WEBPACK_IMPORTED_MODULE_6__["h"])(event, this.phoneNumber);
|
|
1264
985
|
/**
|
|
@@ -1266,7 +987,6 @@ function () {
|
|
|
1266
987
|
* is empty. Adding a check here to try and make sure that doesn't happen...but will
|
|
1267
988
|
* wrap it in a try/catch block just in case as well
|
|
1268
989
|
*/
|
|
1269
|
-
|
|
1270
990
|
try {
|
|
1271
991
|
if (event.target.name === _constants_c8ecaa24_js__WEBPACK_IMPORTED_MODULE_5__["b"] && this.phoneNumber.phoneNumberValue) {
|
|
1272
992
|
var composedInput = Object(_helpers_14fcb50c_js__WEBPACK_IMPORTED_MODULE_6__["b"])(this.phoneNumber);
|
|
@@ -1276,98 +996,57 @@ function () {
|
|
|
1276
996
|
logger$1.error("error in phone number field - " + err);
|
|
1277
997
|
}
|
|
1278
998
|
};
|
|
1279
|
-
|
|
1280
999
|
class_4.prototype.completeNewPassword = function (event) {
|
|
1281
1000
|
return __awaiter(this, void 0, void 0, function () {
|
|
1282
1001
|
var user, _a, error_7;
|
|
1283
|
-
|
|
1284
1002
|
return __generator(this, function (_b) {
|
|
1285
1003
|
switch (_b.label) {
|
|
1286
1004
|
case 0:
|
|
1287
1005
|
if (event) {
|
|
1288
1006
|
event.preventDefault();
|
|
1289
1007
|
}
|
|
1290
|
-
|
|
1291
1008
|
if (!_aws_amplify_auth__WEBPACK_IMPORTED_MODULE_3__["Auth"] || typeof _aws_amplify_auth__WEBPACK_IMPORTED_MODULE_3__["Auth"].completeNewPassword !== 'function') {
|
|
1292
1009
|
throw new Error(_constants_c8ecaa24_js__WEBPACK_IMPORTED_MODULE_5__["N"]);
|
|
1293
1010
|
}
|
|
1294
|
-
|
|
1295
1011
|
this.loading = true;
|
|
1296
1012
|
_b.label = 1;
|
|
1297
|
-
|
|
1298
1013
|
case 1:
|
|
1299
1014
|
_b.trys.push([1, 8, 9, 10]);
|
|
1300
|
-
|
|
1301
|
-
return [4
|
|
1302
|
-
/*yield*/
|
|
1303
|
-
, _aws_amplify_auth__WEBPACK_IMPORTED_MODULE_3__["Auth"].completeNewPassword(this.currentUser, this.password, this.requiredAttributes)];
|
|
1304
|
-
|
|
1015
|
+
return [4 /*yield*/, _aws_amplify_auth__WEBPACK_IMPORTED_MODULE_3__["Auth"].completeNewPassword(this.currentUser, this.password, this.requiredAttributes)];
|
|
1305
1016
|
case 2:
|
|
1306
1017
|
user = _b.sent();
|
|
1307
1018
|
logger$1.debug('complete new password', user);
|
|
1308
1019
|
_a = user.challengeName;
|
|
1309
|
-
|
|
1310
1020
|
switch (_a) {
|
|
1311
1021
|
case _auth_types_78df304e_js__WEBPACK_IMPORTED_MODULE_2__["C"].SMSMFA:
|
|
1312
|
-
return [3
|
|
1313
|
-
/*break*/
|
|
1314
|
-
, 3];
|
|
1315
|
-
|
|
1022
|
+
return [3 /*break*/, 3];
|
|
1316
1023
|
case _auth_types_78df304e_js__WEBPACK_IMPORTED_MODULE_2__["C"].MFASetup:
|
|
1317
|
-
return [3
|
|
1318
|
-
/*break*/
|
|
1319
|
-
, 4];
|
|
1024
|
+
return [3 /*break*/, 4];
|
|
1320
1025
|
}
|
|
1321
|
-
|
|
1322
|
-
return [3
|
|
1323
|
-
/*break*/
|
|
1324
|
-
, 5];
|
|
1325
|
-
|
|
1026
|
+
return [3 /*break*/, 5];
|
|
1326
1027
|
case 3:
|
|
1327
1028
|
this.handleAuthStateChange(_auth_types_78df304e_js__WEBPACK_IMPORTED_MODULE_2__["A"].ConfirmSignIn, user);
|
|
1328
|
-
return [3
|
|
1329
|
-
/*break*/
|
|
1330
|
-
, 7];
|
|
1331
|
-
|
|
1029
|
+
return [3 /*break*/, 7];
|
|
1332
1030
|
case 4:
|
|
1333
1031
|
logger$1.debug('TOTP setup', user.challengeParam);
|
|
1334
1032
|
this.handleAuthStateChange(_auth_types_78df304e_js__WEBPACK_IMPORTED_MODULE_2__["A"].TOTPSetup, user);
|
|
1335
|
-
return [3
|
|
1336
|
-
/*break*/
|
|
1337
|
-
, 7];
|
|
1338
|
-
|
|
1033
|
+
return [3 /*break*/, 7];
|
|
1339
1034
|
case 5:
|
|
1340
|
-
return [4
|
|
1341
|
-
/*yield*/
|
|
1342
|
-
, Object(_auth_helpers_557b83fc_js__WEBPACK_IMPORTED_MODULE_7__["c"])(user, this.handleAuthStateChange)];
|
|
1343
|
-
|
|
1035
|
+
return [4 /*yield*/, Object(_auth_helpers_557b83fc_js__WEBPACK_IMPORTED_MODULE_7__["c"])(user, this.handleAuthStateChange)];
|
|
1344
1036
|
case 6:
|
|
1345
1037
|
_b.sent();
|
|
1346
|
-
|
|
1347
1038
|
_b.label = 7;
|
|
1348
|
-
|
|
1349
1039
|
case 7:
|
|
1350
|
-
return [3
|
|
1351
|
-
/*break*/
|
|
1352
|
-
, 10];
|
|
1353
|
-
|
|
1040
|
+
return [3 /*break*/, 10];
|
|
1354
1041
|
case 8:
|
|
1355
1042
|
error_7 = _b.sent();
|
|
1356
1043
|
Object(_helpers_14fcb50c_js__WEBPACK_IMPORTED_MODULE_6__["a"])(error_7);
|
|
1357
|
-
return [3
|
|
1358
|
-
/*break*/
|
|
1359
|
-
, 10];
|
|
1360
|
-
|
|
1044
|
+
return [3 /*break*/, 10];
|
|
1361
1045
|
case 9:
|
|
1362
1046
|
this.loading = false;
|
|
1363
|
-
return [7
|
|
1364
|
-
/*endfinally*/
|
|
1365
|
-
];
|
|
1366
|
-
|
|
1047
|
+
return [7 /*endfinally*/];
|
|
1367
1048
|
case 10:
|
|
1368
|
-
return [2
|
|
1369
|
-
/*return*/
|
|
1370
|
-
];
|
|
1049
|
+
return [2 /*return*/];
|
|
1371
1050
|
}
|
|
1372
1051
|
});
|
|
1373
1052
|
});
|
|
@@ -1375,7 +1054,6 @@ function () {
|
|
|
1375
1054
|
|
|
1376
1055
|
class_4.prototype.render = function () {
|
|
1377
1056
|
var _this = this;
|
|
1378
|
-
|
|
1379
1057
|
return Object(_index_83f2275b_js__WEBPACK_IMPORTED_MODULE_0__["h"])(_index_83f2275b_js__WEBPACK_IMPORTED_MODULE_0__["H"], null, Object(_index_83f2275b_js__WEBPACK_IMPORTED_MODULE_0__["h"])("amplify-form-section", {
|
|
1380
1058
|
headerText: _aws_amplify_core__WEBPACK_IMPORTED_MODULE_1__["I18n"].get(this.headerText),
|
|
1381
1059
|
handleSubmit: this.handleSubmit,
|
|
@@ -1391,7 +1069,6 @@ function () {
|
|
|
1391
1069
|
formFields: this.newFormFields
|
|
1392
1070
|
})));
|
|
1393
1071
|
};
|
|
1394
|
-
|
|
1395
1072
|
Object.defineProperty(class_4, "watchers", {
|
|
1396
1073
|
get: function get() {
|
|
1397
1074
|
return {
|
|
@@ -1403,34 +1080,23 @@ function () {
|
|
|
1403
1080
|
});
|
|
1404
1081
|
return class_4;
|
|
1405
1082
|
}();
|
|
1406
|
-
|
|
1407
1083
|
var amplifySignInCss = ":host{--footer-size:var(--amplify-text-sm);--footer-color:var(--amplify-grey);--footer-font-family:var(--amplify-font-family);--font-weight:var(--amplify-font-weight)}.sign-in-form-footer{font-family:var(--footer-font-family);font-size:var(--footer-size);color:var(--footer-color);font-weight:--font-weight;display:-ms-flexbox;display:flex;-ms-flex-direction:column-reverse;flex-direction:column-reverse;-ms-flex-align:center;align-items:center;-ms-flex-pack:distribute;justify-content:space-around}.sign-in-form-footer amplify-button{margin-bottom:0.625rem}@media (min-width: 672px){.sign-in-form-footer{display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;-ms-flex-pack:justify;justify-content:space-between;-ms-flex-align:baseline;align-items:baseline}.sign-in-form-footer amplify-button{margin-bottom:0}}.sign-in-form-footer *+*{margin-bottom:15px}.full-width-footer-content{width:100%}";
|
|
1408
|
-
|
|
1409
|
-
var AmplifySignIn =
|
|
1410
|
-
/** @class */
|
|
1411
|
-
function () {
|
|
1084
|
+
var AmplifySignIn = /** @class */function () {
|
|
1412
1085
|
function class_5(hostRef) {
|
|
1413
1086
|
var _this = this;
|
|
1414
|
-
|
|
1415
1087
|
Object(_index_83f2275b_js__WEBPACK_IMPORTED_MODULE_0__["r"])(this, hostRef);
|
|
1416
1088
|
/** Fires when sign in form is submitted */
|
|
1417
|
-
|
|
1418
1089
|
this.handleSubmit = function (event) {
|
|
1419
1090
|
return _this.signIn(event);
|
|
1420
1091
|
};
|
|
1421
1092
|
/** Used for header text in sign in component */
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
1093
|
this.headerText = _Translations_108d469f_js__WEBPACK_IMPORTED_MODULE_4__["T"].SIGN_IN_HEADER_TEXT;
|
|
1425
1094
|
/** Used for the submit button text in sign in component */
|
|
1426
|
-
|
|
1427
1095
|
this.submitButtonText = _Translations_108d469f_js__WEBPACK_IMPORTED_MODULE_4__["T"].SIGN_IN_ACTION;
|
|
1428
1096
|
/** Auth state change handler for this component */
|
|
1429
1097
|
// prettier-ignore
|
|
1430
|
-
|
|
1431
1098
|
this.handleAuthStateChange = _helpers_14fcb50c_js__WEBPACK_IMPORTED_MODULE_6__["d"];
|
|
1432
1099
|
/** Username Alias is used to setup authentication with `username`, `email` or `phone_number` */
|
|
1433
|
-
|
|
1434
1100
|
this.usernameAlias = 'username';
|
|
1435
1101
|
/**
|
|
1436
1102
|
* Form fields allows you to utilize our pre-built components such as username field, code field, password field, email field, etc.
|
|
@@ -1448,14 +1114,11 @@ function () {
|
|
|
1448
1114
|
* ]
|
|
1449
1115
|
* ```
|
|
1450
1116
|
*/
|
|
1451
|
-
|
|
1452
1117
|
this.formFields = [];
|
|
1453
1118
|
/** Hides the sign up link */
|
|
1454
|
-
|
|
1455
1119
|
this.hideSignUp = false;
|
|
1456
1120
|
this.newFormFields = [];
|
|
1457
1121
|
/* Whether or not the sign-in component is loading */
|
|
1458
|
-
|
|
1459
1122
|
this.loading = false;
|
|
1460
1123
|
this.phoneNumber = {
|
|
1461
1124
|
countryDialCodeValue: _constants_c8ecaa24_js__WEBPACK_IMPORTED_MODULE_5__["g"],
|
|
@@ -1466,42 +1129,34 @@ function () {
|
|
|
1466
1129
|
password: ''
|
|
1467
1130
|
};
|
|
1468
1131
|
}
|
|
1469
|
-
|
|
1470
1132
|
class_5.prototype.componentWillLoad = function () {
|
|
1471
1133
|
console.warn('Version `1.x` of Amplify UI has been deprecated and will be removed in a future major version of `aws-amplify`. Please visit https://ui.docs.amplify.aws/ for the current version of Amplify UI.');
|
|
1472
1134
|
Object(_helpers_14fcb50c_js__WEBPACK_IMPORTED_MODULE_6__["c"])(this.usernameAlias);
|
|
1473
1135
|
this.buildFormFields();
|
|
1474
1136
|
};
|
|
1475
|
-
|
|
1476
1137
|
class_5.prototype.formFieldsHandler = function () {
|
|
1477
1138
|
this.buildFormFields();
|
|
1478
1139
|
};
|
|
1479
|
-
|
|
1480
1140
|
class_5.prototype.handleFormFieldInputChange = function (fieldType) {
|
|
1481
1141
|
var _this = this;
|
|
1482
|
-
|
|
1483
1142
|
switch (fieldType) {
|
|
1484
1143
|
case 'username':
|
|
1485
1144
|
case 'email':
|
|
1486
1145
|
return function (event) {
|
|
1487
1146
|
return _this.signInAttributes.userInput = event.target.value;
|
|
1488
1147
|
};
|
|
1489
|
-
|
|
1490
1148
|
case 'phone_number':
|
|
1491
1149
|
return function (event) {
|
|
1492
1150
|
return Object(_helpers_14fcb50c_js__WEBPACK_IMPORTED_MODULE_6__["h"])(event, _this.phoneNumber);
|
|
1493
1151
|
};
|
|
1494
|
-
|
|
1495
1152
|
case 'password':
|
|
1496
1153
|
return function (event) {
|
|
1497
1154
|
return _this.signInAttributes.password = event.target.value;
|
|
1498
1155
|
};
|
|
1499
|
-
|
|
1500
1156
|
default:
|
|
1501
1157
|
return function () {};
|
|
1502
1158
|
}
|
|
1503
1159
|
};
|
|
1504
|
-
|
|
1505
1160
|
class_5.prototype.handleFormFieldInputWithCallback = function (event, field) {
|
|
1506
1161
|
var fnToCall = field['handleInputChange'] ? field['handleInputChange'] : function (event, cb) {
|
|
1507
1162
|
cb(event);
|
|
@@ -1509,7 +1164,6 @@ function () {
|
|
|
1509
1164
|
var callback = this.handleFormFieldInputChange(field.type);
|
|
1510
1165
|
fnToCall(event, callback.bind(this));
|
|
1511
1166
|
};
|
|
1512
|
-
|
|
1513
1167
|
class_5.prototype.signIn = function (event) {
|
|
1514
1168
|
return __awaiter(this, void 0, void 0, function () {
|
|
1515
1169
|
var username;
|
|
@@ -1520,9 +1174,7 @@ function () {
|
|
|
1520
1174
|
if (event) {
|
|
1521
1175
|
event.preventDefault();
|
|
1522
1176
|
}
|
|
1523
|
-
|
|
1524
1177
|
this.loading = true;
|
|
1525
|
-
|
|
1526
1178
|
switch (this.usernameAlias) {
|
|
1527
1179
|
case 'phone_number':
|
|
1528
1180
|
try {
|
|
@@ -1530,21 +1182,13 @@ function () {
|
|
|
1530
1182
|
} catch (error) {
|
|
1531
1183
|
Object(_helpers_14fcb50c_js__WEBPACK_IMPORTED_MODULE_6__["a"])(error);
|
|
1532
1184
|
}
|
|
1533
|
-
|
|
1534
1185
|
}
|
|
1535
|
-
|
|
1536
1186
|
username = this.signInAttributes.userInput.trim();
|
|
1537
|
-
return [4
|
|
1538
|
-
/*yield*/
|
|
1539
|
-
, Object(_auth_helpers_557b83fc_js__WEBPACK_IMPORTED_MODULE_7__["h"])(username, this.signInAttributes.password, this.handleAuthStateChange, this.usernameAlias)];
|
|
1540
|
-
|
|
1187
|
+
return [4 /*yield*/, Object(_auth_helpers_557b83fc_js__WEBPACK_IMPORTED_MODULE_7__["h"])(username, this.signInAttributes.password, this.handleAuthStateChange, this.usernameAlias)];
|
|
1541
1188
|
case 1:
|
|
1542
1189
|
_a.sent();
|
|
1543
|
-
|
|
1544
1190
|
this.loading = false;
|
|
1545
|
-
return [2
|
|
1546
|
-
/*return*/
|
|
1547
|
-
];
|
|
1191
|
+
return [2 /*return*/];
|
|
1548
1192
|
}
|
|
1549
1193
|
});
|
|
1550
1194
|
});
|
|
@@ -1552,9 +1196,7 @@ function () {
|
|
|
1552
1196
|
|
|
1553
1197
|
class_5.prototype.buildDefaultFormFields = function () {
|
|
1554
1198
|
var _this = this;
|
|
1555
|
-
|
|
1556
1199
|
var formFieldInputs = [];
|
|
1557
|
-
|
|
1558
1200
|
switch (this.usernameAlias) {
|
|
1559
1201
|
case 'email':
|
|
1560
1202
|
formFieldInputs.push({
|
|
@@ -1567,7 +1209,6 @@ function () {
|
|
|
1567
1209
|
}
|
|
1568
1210
|
});
|
|
1569
1211
|
break;
|
|
1570
|
-
|
|
1571
1212
|
case 'phone_number':
|
|
1572
1213
|
formFieldInputs.push({
|
|
1573
1214
|
type: 'phone_number',
|
|
@@ -1579,7 +1220,6 @@ function () {
|
|
|
1579
1220
|
}
|
|
1580
1221
|
});
|
|
1581
1222
|
break;
|
|
1582
|
-
|
|
1583
1223
|
case 'username':
|
|
1584
1224
|
default:
|
|
1585
1225
|
formFieldInputs.push({
|
|
@@ -1593,7 +1233,6 @@ function () {
|
|
|
1593
1233
|
});
|
|
1594
1234
|
break;
|
|
1595
1235
|
}
|
|
1596
|
-
|
|
1597
1236
|
formFieldInputs.push({
|
|
1598
1237
|
type: 'password',
|
|
1599
1238
|
hint: Object(_index_83f2275b_js__WEBPACK_IMPORTED_MODULE_0__["h"])("div", null, _aws_amplify_core__WEBPACK_IMPORTED_MODULE_1__["I18n"].get(_Translations_108d469f_js__WEBPACK_IMPORTED_MODULE_4__["T"].FORGOT_PASSWORD_TEXT), ' ', Object(_index_83f2275b_js__WEBPACK_IMPORTED_MODULE_0__["h"])("amplify-button", {
|
|
@@ -1611,17 +1250,15 @@ function () {
|
|
|
1611
1250
|
});
|
|
1612
1251
|
this.newFormFields = __spreadArrays(formFieldInputs);
|
|
1613
1252
|
};
|
|
1614
|
-
|
|
1615
1253
|
class_5.prototype.buildFormFields = function () {
|
|
1616
1254
|
var _this = this;
|
|
1617
|
-
|
|
1618
1255
|
if (this.formFields.length === 0) {
|
|
1619
1256
|
this.buildDefaultFormFields();
|
|
1620
1257
|
} else {
|
|
1621
1258
|
var newFields_3 = [];
|
|
1622
1259
|
this.formFields.forEach(function (field) {
|
|
1623
|
-
var newField = Object.assign({}, field);
|
|
1624
|
-
|
|
1260
|
+
var newField = Object.assign({}, field);
|
|
1261
|
+
// TODO: handle hint better
|
|
1625
1262
|
if (newField.type === 'password') {
|
|
1626
1263
|
newField['hint'] = Object(_helpers_14fcb50c_js__WEBPACK_IMPORTED_MODULE_6__["i"])(newField) ? Object(_index_83f2275b_js__WEBPACK_IMPORTED_MODULE_0__["h"])("div", null, _aws_amplify_core__WEBPACK_IMPORTED_MODULE_1__["I18n"].get(_Translations_108d469f_js__WEBPACK_IMPORTED_MODULE_4__["T"].FORGOT_PASSWORD_TEXT), ' ', Object(_index_83f2275b_js__WEBPACK_IMPORTED_MODULE_0__["h"])("amplify-button", {
|
|
1627
1264
|
variant: "anchor",
|
|
@@ -1631,19 +1268,15 @@ function () {
|
|
|
1631
1268
|
"data-test": "sign-in-forgot-password-link"
|
|
1632
1269
|
}, _aws_amplify_core__WEBPACK_IMPORTED_MODULE_1__["I18n"].get(_Translations_108d469f_js__WEBPACK_IMPORTED_MODULE_4__["T"].RESET_PASSWORD_TEXT))) : newField['hint'];
|
|
1633
1270
|
}
|
|
1634
|
-
|
|
1635
1271
|
newField['handleInputChange'] = function (event) {
|
|
1636
1272
|
return _this.handleFormFieldInputWithCallback(event, field);
|
|
1637
1273
|
};
|
|
1638
|
-
|
|
1639
1274
|
_this.setFieldValue(newField, _this.signInAttributes);
|
|
1640
|
-
|
|
1641
1275
|
newFields_3.push(newField);
|
|
1642
1276
|
});
|
|
1643
1277
|
this.newFormFields = newFields_3;
|
|
1644
1278
|
}
|
|
1645
1279
|
};
|
|
1646
|
-
|
|
1647
1280
|
class_5.prototype.setFieldValue = function (field, formAttributes) {
|
|
1648
1281
|
switch (field.type) {
|
|
1649
1282
|
case 'username':
|
|
@@ -1653,31 +1286,24 @@ function () {
|
|
|
1653
1286
|
} else {
|
|
1654
1287
|
formAttributes.userInput = field.value;
|
|
1655
1288
|
}
|
|
1656
|
-
|
|
1657
1289
|
break;
|
|
1658
|
-
|
|
1659
1290
|
case 'phone_number':
|
|
1660
1291
|
if (field.dialCode) {
|
|
1661
1292
|
this.phoneNumber.countryDialCodeValue = field.dialCode;
|
|
1662
1293
|
}
|
|
1663
|
-
|
|
1664
1294
|
this.phoneNumber.phoneNumberValue = field.value;
|
|
1665
1295
|
break;
|
|
1666
|
-
|
|
1667
1296
|
case 'password':
|
|
1668
1297
|
if (field.value === undefined) {
|
|
1669
1298
|
formAttributes.password = '';
|
|
1670
1299
|
} else {
|
|
1671
1300
|
formAttributes.password = field.value;
|
|
1672
1301
|
}
|
|
1673
|
-
|
|
1674
1302
|
break;
|
|
1675
1303
|
}
|
|
1676
1304
|
};
|
|
1677
|
-
|
|
1678
1305
|
class_5.prototype.render = function () {
|
|
1679
1306
|
var _this = this;
|
|
1680
|
-
|
|
1681
1307
|
return Object(_index_83f2275b_js__WEBPACK_IMPORTED_MODULE_0__["h"])(_index_83f2275b_js__WEBPACK_IMPORTED_MODULE_0__["H"], null, Object(_index_83f2275b_js__WEBPACK_IMPORTED_MODULE_0__["h"])("amplify-form-section", {
|
|
1682
1308
|
headerText: _aws_amplify_core__WEBPACK_IMPORTED_MODULE_1__["I18n"].get(this.headerText),
|
|
1683
1309
|
handleSubmit: this.handleSubmit,
|
|
@@ -1716,7 +1342,6 @@ function () {
|
|
|
1716
1342
|
"data-test": "sign-in-sign-in-button"
|
|
1717
1343
|
}, this.loading ? Object(_index_83f2275b_js__WEBPACK_IMPORTED_MODULE_0__["h"])("amplify-loading-spinner", null) : Object(_index_83f2275b_js__WEBPACK_IMPORTED_MODULE_0__["h"])("span", null, _aws_amplify_core__WEBPACK_IMPORTED_MODULE_1__["I18n"].get(this.submitButtonText)))))))));
|
|
1718
1344
|
};
|
|
1719
|
-
|
|
1720
1345
|
Object.defineProperty(class_5, "watchers", {
|
|
1721
1346
|
get: function get() {
|
|
1722
1347
|
return {
|
|
@@ -1728,40 +1353,27 @@ function () {
|
|
|
1728
1353
|
});
|
|
1729
1354
|
return class_5;
|
|
1730
1355
|
}();
|
|
1731
|
-
|
|
1732
1356
|
AmplifySignIn.style = amplifySignInCss;
|
|
1733
1357
|
var amplifySignUpCss = "amplify-sign-up{--footer-font-family:var(--amplify-font-family);--footer-font-size:var(--amplify-text-sm);--footer-color:var(--amplify-grey);--font-weight:var(--amplify-font-weight)}.sign-up-form-footer{font-family:var(--footer-font-family);font-size:var(--footer-font-size);color:var(--footer-color);font-weight:--font-weight;display:-ms-flexbox;display:flex;-ms-flex-direction:column-reverse;flex-direction:column-reverse;-ms-flex-align:center;align-items:center;-ms-flex-pack:distribute;justify-content:space-around}.sign-up-form-footer amplify-button{margin-bottom:0.625rem}@media (min-width: 672px){.sign-up-form-footer{display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;-ms-flex-pack:justify;justify-content:space-between;-ms-flex-align:baseline;align-items:baseline}.sign-up-form-footer amplify-button{margin-bottom:0}}.sign-up-form-footer *+*{margin-bottom:15px}";
|
|
1734
|
-
|
|
1735
|
-
var AmplifySignUp =
|
|
1736
|
-
/** @class */
|
|
1737
|
-
function () {
|
|
1358
|
+
var AmplifySignUp = /** @class */function () {
|
|
1738
1359
|
function class_6(hostRef) {
|
|
1739
1360
|
var _this = this;
|
|
1740
|
-
|
|
1741
1361
|
Object(_index_83f2275b_js__WEBPACK_IMPORTED_MODULE_0__["r"])(this, hostRef);
|
|
1742
1362
|
/** Fires when sign up form is submitted */
|
|
1743
|
-
|
|
1744
1363
|
this.handleSubmit = function (event) {
|
|
1745
1364
|
return _this.signUp(event);
|
|
1746
1365
|
};
|
|
1747
1366
|
/** Override for handling the Auth.SignUp API call */
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
1367
|
this.handleSignUp = function (params) {
|
|
1751
1368
|
return _this.authSignUp(params);
|
|
1752
1369
|
};
|
|
1753
1370
|
/** Used for header text in sign up component */
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
1371
|
this.headerText = _Translations_108d469f_js__WEBPACK_IMPORTED_MODULE_4__["T"].SIGN_UP_HEADER_TEXT;
|
|
1757
1372
|
/** Used for the submit button text in sign up component */
|
|
1758
|
-
|
|
1759
1373
|
this.submitButtonText = _Translations_108d469f_js__WEBPACK_IMPORTED_MODULE_4__["T"].SIGN_UP_SUBMIT_BUTTON_TEXT;
|
|
1760
1374
|
/** Used for the submit button text in sign up component */
|
|
1761
|
-
|
|
1762
1375
|
this.haveAccountText = _Translations_108d469f_js__WEBPACK_IMPORTED_MODULE_4__["T"].SIGN_UP_HAVE_ACCOUNT_TEXT;
|
|
1763
1376
|
/** Text used for the sign in hyperlink */
|
|
1764
|
-
|
|
1765
1377
|
this.signInText = _Translations_108d469f_js__WEBPACK_IMPORTED_MODULE_4__["T"].SIGN_IN_TEXT;
|
|
1766
1378
|
/**
|
|
1767
1379
|
* Form fields allows you to utilize our pre-built components such as username field, code field, password field, email field, etc.
|
|
@@ -1779,18 +1391,15 @@ function () {
|
|
|
1779
1391
|
* ]
|
|
1780
1392
|
* ```
|
|
1781
1393
|
*/
|
|
1782
|
-
|
|
1783
1394
|
this.formFields = [];
|
|
1784
1395
|
/** Auth state change handler for this component
|
|
1785
1396
|
* e.g. SignIn -> 'Create Account' link -> SignUp
|
|
1786
1397
|
*/
|
|
1787
1398
|
// prettier-ignore
|
|
1788
|
-
|
|
1789
1399
|
this.handleAuthStateChange = _helpers_14fcb50c_js__WEBPACK_IMPORTED_MODULE_6__["d"];
|
|
1790
1400
|
/** Username Alias is used to setup authentication with `username`, `email` or `phone_number` */
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1401
|
+
this.usernameAlias = 'username';
|
|
1402
|
+
// private userInput: string | PhoneNumberInterface;
|
|
1794
1403
|
this.newFormFields = [];
|
|
1795
1404
|
this.phoneNumber = {
|
|
1796
1405
|
countryDialCodeValue: _constants_c8ecaa24_js__WEBPACK_IMPORTED_MODULE_5__["g"],
|
|
@@ -1803,38 +1412,31 @@ function () {
|
|
|
1803
1412
|
attributes: {}
|
|
1804
1413
|
};
|
|
1805
1414
|
}
|
|
1806
|
-
|
|
1807
1415
|
class_6.prototype.handleFormFieldInputChange = function (fieldType) {
|
|
1808
1416
|
var _this = this;
|
|
1809
|
-
|
|
1810
1417
|
switch (fieldType) {
|
|
1811
1418
|
case 'username':
|
|
1812
1419
|
return function (event) {
|
|
1813
1420
|
return _this.signUpAttributes.username = event.target.value;
|
|
1814
1421
|
};
|
|
1815
|
-
|
|
1816
1422
|
case 'password':
|
|
1817
1423
|
return function (event) {
|
|
1818
1424
|
return _this.signUpAttributes.password = event.target.value;
|
|
1819
1425
|
};
|
|
1820
|
-
|
|
1821
1426
|
case 'email':
|
|
1822
1427
|
return function (event) {
|
|
1823
1428
|
return _this.signUpAttributes.attributes.email = event.target.value;
|
|
1824
1429
|
};
|
|
1825
|
-
|
|
1826
1430
|
case 'phone_number':
|
|
1827
1431
|
return function (event) {
|
|
1828
1432
|
return Object(_helpers_14fcb50c_js__WEBPACK_IMPORTED_MODULE_6__["h"])(event, _this.phoneNumber);
|
|
1829
1433
|
};
|
|
1830
|
-
|
|
1831
1434
|
default:
|
|
1832
1435
|
return function (event) {
|
|
1833
1436
|
return _this.signUpAttributes.attributes[fieldType] = event.target.value;
|
|
1834
1437
|
};
|
|
1835
1438
|
}
|
|
1836
1439
|
};
|
|
1837
|
-
|
|
1838
1440
|
class_6.prototype.handleFormFieldInputWithCallback = function (event, field) {
|
|
1839
1441
|
var fnToCall = field['handleInputChange'] ? field['handleInputChange'] : function (event, cb) {
|
|
1840
1442
|
cb(event);
|
|
@@ -1842,32 +1444,23 @@ function () {
|
|
|
1842
1444
|
var callback = this.handleFormFieldInputChange(field.type);
|
|
1843
1445
|
fnToCall(event, callback.bind(this));
|
|
1844
1446
|
};
|
|
1845
|
-
|
|
1846
1447
|
class_6.prototype.authSignUp = function (params) {
|
|
1847
1448
|
return __awaiter(this, void 0, void 0, function () {
|
|
1848
1449
|
var data;
|
|
1849
1450
|
return __generator(this, function (_a) {
|
|
1850
1451
|
switch (_a.label) {
|
|
1851
1452
|
case 0:
|
|
1852
|
-
return [4
|
|
1853
|
-
/*yield*/
|
|
1854
|
-
, _aws_amplify_auth__WEBPACK_IMPORTED_MODULE_3__["Auth"].signUp(params)];
|
|
1855
|
-
|
|
1453
|
+
return [4 /*yield*/, _aws_amplify_auth__WEBPACK_IMPORTED_MODULE_3__["Auth"].signUp(params)];
|
|
1856
1454
|
case 1:
|
|
1857
1455
|
data = _a.sent();
|
|
1858
|
-
|
|
1859
1456
|
if (!data) {
|
|
1860
1457
|
throw new Error(_Translations_108d469f_js__WEBPACK_IMPORTED_MODULE_4__["T"].SIGN_UP_FAILED);
|
|
1861
1458
|
}
|
|
1862
|
-
|
|
1863
|
-
return [2
|
|
1864
|
-
/*return*/
|
|
1865
|
-
, data];
|
|
1459
|
+
return [2 /*return*/, data];
|
|
1866
1460
|
}
|
|
1867
1461
|
});
|
|
1868
1462
|
});
|
|
1869
1463
|
};
|
|
1870
|
-
|
|
1871
1464
|
class_6.prototype.assignPhoneNumberToSignUpAttributes = function () {
|
|
1872
1465
|
if (this.phoneNumber.phoneNumberValue) {
|
|
1873
1466
|
try {
|
|
@@ -1877,7 +1470,6 @@ function () {
|
|
|
1877
1470
|
}
|
|
1878
1471
|
}
|
|
1879
1472
|
};
|
|
1880
|
-
|
|
1881
1473
|
class_6.prototype.assignUserNameAliasToSignUpAttributes = function () {
|
|
1882
1474
|
switch (this.usernameAlias) {
|
|
1883
1475
|
case 'email':
|
|
@@ -1886,12 +1478,10 @@ function () {
|
|
|
1886
1478
|
break;
|
|
1887
1479
|
}
|
|
1888
1480
|
};
|
|
1889
|
-
|
|
1890
1481
|
class_6.prototype.assignFormInputToSignUpAttributes = function () {
|
|
1891
1482
|
this.assignPhoneNumberToSignUpAttributes();
|
|
1892
1483
|
this.assignUserNameAliasToSignUpAttributes();
|
|
1893
1484
|
};
|
|
1894
|
-
|
|
1895
1485
|
class_6.prototype.validateSignUpAttributes = function () {
|
|
1896
1486
|
if (!this.signUpAttributes.username) {
|
|
1897
1487
|
if (this.usernameAlias === _auth_types_78df304e_js__WEBPACK_IMPORTED_MODULE_2__["U"].email) {
|
|
@@ -1902,18 +1492,15 @@ function () {
|
|
|
1902
1492
|
throw new Error(_Translations_108d469f_js__WEBPACK_IMPORTED_MODULE_4__["T"].EMPTY_USERNAME);
|
|
1903
1493
|
}
|
|
1904
1494
|
}
|
|
1905
|
-
|
|
1906
1495
|
if (this.signUpAttributes.username.indexOf(' ') >= 0) {
|
|
1907
1496
|
throw new Error(_Translations_108d469f_js__WEBPACK_IMPORTED_MODULE_4__["T"].USERNAME_REMOVE_WHITESPACE);
|
|
1908
1497
|
}
|
|
1909
|
-
|
|
1910
1498
|
if (this.signUpAttributes.password !== this.signUpAttributes.password.trim()) {
|
|
1911
1499
|
throw new Error(_Translations_108d469f_js__WEBPACK_IMPORTED_MODULE_4__["T"].PASSWORD_REMOVE_WHITESPACE);
|
|
1912
1500
|
}
|
|
1913
|
-
};
|
|
1501
|
+
};
|
|
1502
|
+
// TODO: Add validation
|
|
1914
1503
|
// TODO: Prefix
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
1504
|
class_6.prototype.signUp = function (event) {
|
|
1918
1505
|
return __awaiter(this, void 0, void 0, function () {
|
|
1919
1506
|
var data, signUpAttrs, error_8;
|
|
@@ -1923,68 +1510,40 @@ function () {
|
|
|
1923
1510
|
if (event) {
|
|
1924
1511
|
event.preventDefault();
|
|
1925
1512
|
}
|
|
1926
|
-
|
|
1927
1513
|
if (!_aws_amplify_auth__WEBPACK_IMPORTED_MODULE_3__["Auth"] || typeof _aws_amplify_auth__WEBPACK_IMPORTED_MODULE_3__["Auth"].signUp !== 'function') {
|
|
1928
1514
|
throw new Error(_constants_c8ecaa24_js__WEBPACK_IMPORTED_MODULE_5__["N"]);
|
|
1929
1515
|
}
|
|
1930
|
-
|
|
1931
1516
|
this.loading = true;
|
|
1932
1517
|
this.assignFormInputToSignUpAttributes();
|
|
1933
1518
|
_a.label = 1;
|
|
1934
|
-
|
|
1935
1519
|
case 1:
|
|
1936
1520
|
_a.trys.push([1, 6, 7, 8]);
|
|
1937
|
-
|
|
1938
1521
|
this.validateSignUpAttributes();
|
|
1939
|
-
return [4
|
|
1940
|
-
/*yield*/
|
|
1941
|
-
, this.handleSignUp(this.signUpAttributes)];
|
|
1942
|
-
|
|
1522
|
+
return [4 /*yield*/, this.handleSignUp(this.signUpAttributes)];
|
|
1943
1523
|
case 2:
|
|
1944
1524
|
data = _a.sent();
|
|
1945
|
-
if (!data.userConfirmed) return [3
|
|
1946
|
-
/*
|
|
1947
|
-
, 4];
|
|
1948
|
-
return [4
|
|
1949
|
-
/*yield*/
|
|
1950
|
-
, Object(_auth_helpers_557b83fc_js__WEBPACK_IMPORTED_MODULE_7__["h"])(this.signUpAttributes.username, this.signUpAttributes.password, this.handleAuthStateChange)];
|
|
1951
|
-
|
|
1525
|
+
if (!data.userConfirmed) return [3 /*break*/, 4];
|
|
1526
|
+
return [4 /*yield*/, Object(_auth_helpers_557b83fc_js__WEBPACK_IMPORTED_MODULE_7__["h"])(this.signUpAttributes.username, this.signUpAttributes.password, this.handleAuthStateChange)];
|
|
1952
1527
|
case 3:
|
|
1953
1528
|
_a.sent();
|
|
1954
|
-
|
|
1955
|
-
return [3
|
|
1956
|
-
/*break*/
|
|
1957
|
-
, 5];
|
|
1958
|
-
|
|
1529
|
+
return [3 /*break*/, 5];
|
|
1959
1530
|
case 4:
|
|
1960
1531
|
signUpAttrs = Object.assign({}, this.signUpAttributes);
|
|
1961
1532
|
this.handleAuthStateChange(_auth_types_78df304e_js__WEBPACK_IMPORTED_MODULE_2__["A"].ConfirmSignUp, Object.assign(Object.assign({}, data.user), {
|
|
1962
1533
|
signUpAttrs: signUpAttrs
|
|
1963
1534
|
}));
|
|
1964
1535
|
_a.label = 5;
|
|
1965
|
-
|
|
1966
1536
|
case 5:
|
|
1967
|
-
return [3
|
|
1968
|
-
/*break*/
|
|
1969
|
-
, 8];
|
|
1970
|
-
|
|
1537
|
+
return [3 /*break*/, 8];
|
|
1971
1538
|
case 6:
|
|
1972
1539
|
error_8 = _a.sent();
|
|
1973
1540
|
Object(_helpers_14fcb50c_js__WEBPACK_IMPORTED_MODULE_6__["a"])(error_8);
|
|
1974
|
-
return [3
|
|
1975
|
-
/*break*/
|
|
1976
|
-
, 8];
|
|
1977
|
-
|
|
1541
|
+
return [3 /*break*/, 8];
|
|
1978
1542
|
case 7:
|
|
1979
1543
|
this.loading = false;
|
|
1980
|
-
return [7
|
|
1981
|
-
/*endfinally*/
|
|
1982
|
-
];
|
|
1983
|
-
|
|
1544
|
+
return [7 /*endfinally*/];
|
|
1984
1545
|
case 8:
|
|
1985
|
-
return [2
|
|
1986
|
-
/*return*/
|
|
1987
|
-
];
|
|
1546
|
+
return [2 /*return*/];
|
|
1988
1547
|
}
|
|
1989
1548
|
});
|
|
1990
1549
|
});
|
|
@@ -2021,7 +1580,6 @@ function () {
|
|
|
2021
1580
|
}
|
|
2022
1581
|
}];
|
|
2023
1582
|
break;
|
|
2024
|
-
|
|
2025
1583
|
case 'phone_number':
|
|
2026
1584
|
this.newFormFields = [{
|
|
2027
1585
|
type: 'phone_number',
|
|
@@ -2051,7 +1609,6 @@ function () {
|
|
|
2051
1609
|
}
|
|
2052
1610
|
}];
|
|
2053
1611
|
break;
|
|
2054
|
-
|
|
2055
1612
|
case 'username':
|
|
2056
1613
|
default:
|
|
2057
1614
|
this.newFormFields = [{
|
|
@@ -2091,29 +1648,23 @@ function () {
|
|
|
2091
1648
|
break;
|
|
2092
1649
|
}
|
|
2093
1650
|
};
|
|
2094
|
-
|
|
2095
1651
|
class_6.prototype.buildFormFields = function () {
|
|
2096
1652
|
var _this = this;
|
|
2097
|
-
|
|
2098
1653
|
if (this.formFields.length === 0) {
|
|
2099
1654
|
this.buildDefaultFormFields();
|
|
2100
1655
|
} else {
|
|
2101
1656
|
var newFields_4 = [];
|
|
2102
1657
|
this.formFields.forEach(function (field) {
|
|
2103
1658
|
var newField = Object.assign({}, field);
|
|
2104
|
-
|
|
2105
1659
|
newField['handleInputChange'] = function (event) {
|
|
2106
1660
|
return _this.handleFormFieldInputWithCallback(event, field);
|
|
2107
1661
|
};
|
|
2108
|
-
|
|
2109
1662
|
_this.setFieldValue(field, _this.signUpAttributes);
|
|
2110
|
-
|
|
2111
1663
|
newFields_4.push(newField);
|
|
2112
1664
|
});
|
|
2113
1665
|
this.newFormFields = newFields_4;
|
|
2114
1666
|
}
|
|
2115
1667
|
};
|
|
2116
|
-
|
|
2117
1668
|
class_6.prototype.setFieldValue = function (field, formAttributes) {
|
|
2118
1669
|
switch (field.type) {
|
|
2119
1670
|
case 'username':
|
|
@@ -2122,49 +1673,38 @@ function () {
|
|
|
2122
1673
|
} else {
|
|
2123
1674
|
formAttributes.username = field.value;
|
|
2124
1675
|
}
|
|
2125
|
-
|
|
2126
1676
|
break;
|
|
2127
|
-
|
|
2128
1677
|
case 'password':
|
|
2129
1678
|
if (field.value === undefined) {
|
|
2130
1679
|
formAttributes.password = '';
|
|
2131
1680
|
} else {
|
|
2132
1681
|
formAttributes.password = field.value;
|
|
2133
1682
|
}
|
|
2134
|
-
|
|
2135
1683
|
break;
|
|
2136
|
-
|
|
2137
1684
|
case 'email':
|
|
2138
1685
|
formAttributes.attributes.email = field.value;
|
|
2139
1686
|
break;
|
|
2140
|
-
|
|
2141
1687
|
case 'phone_number':
|
|
2142
1688
|
if (field.dialCode) {
|
|
2143
1689
|
this.phoneNumber.countryDialCodeValue = field.dialCode;
|
|
2144
1690
|
}
|
|
2145
|
-
|
|
2146
1691
|
this.phoneNumber.phoneNumberValue = field.value;
|
|
2147
1692
|
break;
|
|
2148
|
-
|
|
2149
1693
|
default:
|
|
2150
1694
|
formAttributes.attributes[field.type] = field.value;
|
|
2151
1695
|
break;
|
|
2152
1696
|
}
|
|
2153
1697
|
};
|
|
2154
|
-
|
|
2155
1698
|
class_6.prototype.componentWillLoad = function () {
|
|
2156
1699
|
console.warn('Version `1.x` of Amplify UI has been deprecated and will be removed in a future major version of `aws-amplify`. Please visit https://ui.docs.amplify.aws/ for the current version of Amplify UI.');
|
|
2157
1700
|
Object(_helpers_14fcb50c_js__WEBPACK_IMPORTED_MODULE_6__["c"])(this.usernameAlias);
|
|
2158
1701
|
this.buildFormFields();
|
|
2159
1702
|
};
|
|
2160
|
-
|
|
2161
1703
|
class_6.prototype.formFieldsHandler = function () {
|
|
2162
1704
|
this.buildFormFields();
|
|
2163
1705
|
};
|
|
2164
|
-
|
|
2165
1706
|
class_6.prototype.render = function () {
|
|
2166
1707
|
var _this = this;
|
|
2167
|
-
|
|
2168
1708
|
return Object(_index_83f2275b_js__WEBPACK_IMPORTED_MODULE_0__["h"])(_index_83f2275b_js__WEBPACK_IMPORTED_MODULE_0__["H"], null, Object(_index_83f2275b_js__WEBPACK_IMPORTED_MODULE_0__["h"])("amplify-form-section", {
|
|
2169
1709
|
headerText: _aws_amplify_core__WEBPACK_IMPORTED_MODULE_1__["I18n"].get(this.headerText),
|
|
2170
1710
|
handleSubmit: this.handleSubmit,
|
|
@@ -2196,7 +1736,6 @@ function () {
|
|
|
2196
1736
|
disabled: this.loading
|
|
2197
1737
|
}, this.loading ? Object(_index_83f2275b_js__WEBPACK_IMPORTED_MODULE_0__["h"])("amplify-loading-spinner", null) : Object(_index_83f2275b_js__WEBPACK_IMPORTED_MODULE_0__["h"])("span", null, _aws_amplify_core__WEBPACK_IMPORTED_MODULE_1__["I18n"].get(this.submitButtonText))))))));
|
|
2198
1738
|
};
|
|
2199
|
-
|
|
2200
1739
|
Object.defineProperty(class_6, "watchers", {
|
|
2201
1740
|
get: function get() {
|
|
2202
1741
|
return {
|
|
@@ -2208,30 +1747,22 @@ function () {
|
|
|
2208
1747
|
});
|
|
2209
1748
|
return class_6;
|
|
2210
1749
|
}();
|
|
2211
|
-
|
|
2212
1750
|
AmplifySignUp.style = amplifySignUpCss;
|
|
2213
1751
|
var logger$2 = new _aws_amplify_core__WEBPACK_IMPORTED_MODULE_1__["Logger"]('AmplifyVerifyContact');
|
|
2214
|
-
|
|
2215
|
-
var AmplifyVerifyContact =
|
|
2216
|
-
/** @class */
|
|
2217
|
-
function () {
|
|
1752
|
+
var AmplifyVerifyContact = /** @class */function () {
|
|
2218
1753
|
function class_7(hostRef) {
|
|
2219
1754
|
Object(_index_83f2275b_js__WEBPACK_IMPORTED_MODULE_0__["r"])(this, hostRef);
|
|
2220
1755
|
/** Authentication state handler */
|
|
2221
|
-
|
|
2222
1756
|
this.handleAuthStateChange = _helpers_14fcb50c_js__WEBPACK_IMPORTED_MODULE_6__["d"];
|
|
2223
1757
|
this.loading = false;
|
|
2224
1758
|
}
|
|
2225
|
-
|
|
2226
1759
|
class_7.prototype.componentWillLoad = function () {
|
|
2227
1760
|
console.warn('Version `1.x` of Amplify UI has been deprecated and will be removed in a future major version of `aws-amplify`. Please visit https://ui.docs.amplify.aws/ for the current version of Amplify UI.');
|
|
2228
1761
|
};
|
|
2229
|
-
|
|
2230
1762
|
class_7.prototype.handleSubmit = function (event) {
|
|
2231
1763
|
event.preventDefault();
|
|
2232
1764
|
this.verifyAttr ? this.submit(this.code) : this.verify(this.contact);
|
|
2233
1765
|
};
|
|
2234
|
-
|
|
2235
1766
|
class_7.prototype.submit = function (code) {
|
|
2236
1767
|
return __awaiter(this, void 0, void 0, function () {
|
|
2237
1768
|
var attr, data, error_9;
|
|
@@ -2239,48 +1770,30 @@ function () {
|
|
|
2239
1770
|
switch (_a.label) {
|
|
2240
1771
|
case 0:
|
|
2241
1772
|
attr = this.verifyAttr;
|
|
2242
|
-
|
|
2243
1773
|
if (!_aws_amplify_auth__WEBPACK_IMPORTED_MODULE_3__["Auth"] || typeof _aws_amplify_auth__WEBPACK_IMPORTED_MODULE_3__["Auth"].verifyCurrentUserAttributeSubmit !== 'function') {
|
|
2244
1774
|
throw new Error(_constants_c8ecaa24_js__WEBPACK_IMPORTED_MODULE_5__["N"]);
|
|
2245
1775
|
}
|
|
2246
|
-
|
|
2247
1776
|
this.loading = true;
|
|
2248
1777
|
_a.label = 1;
|
|
2249
|
-
|
|
2250
1778
|
case 1:
|
|
2251
1779
|
_a.trys.push([1, 3, 4, 5]);
|
|
2252
|
-
|
|
2253
|
-
return [4
|
|
2254
|
-
/*yield*/
|
|
2255
|
-
, _aws_amplify_auth__WEBPACK_IMPORTED_MODULE_3__["Auth"].verifyCurrentUserAttributeSubmit(attr, code)];
|
|
2256
|
-
|
|
1780
|
+
return [4 /*yield*/, _aws_amplify_auth__WEBPACK_IMPORTED_MODULE_3__["Auth"].verifyCurrentUserAttributeSubmit(attr, code)];
|
|
2257
1781
|
case 2:
|
|
2258
1782
|
data = _a.sent();
|
|
2259
1783
|
logger$2.debug(data);
|
|
2260
1784
|
this.handleAuthStateChange(_auth_types_78df304e_js__WEBPACK_IMPORTED_MODULE_2__["A"].SignedIn, this.user);
|
|
2261
1785
|
this.verifyAttr = null;
|
|
2262
|
-
return [3
|
|
2263
|
-
/*break*/
|
|
2264
|
-
, 5];
|
|
2265
|
-
|
|
1786
|
+
return [3 /*break*/, 5];
|
|
2266
1787
|
case 3:
|
|
2267
1788
|
error_9 = _a.sent();
|
|
2268
1789
|
Object(_helpers_14fcb50c_js__WEBPACK_IMPORTED_MODULE_6__["a"])(error_9);
|
|
2269
1790
|
logger$2.error(error_9);
|
|
2270
|
-
return [3
|
|
2271
|
-
/*break*/
|
|
2272
|
-
, 5];
|
|
2273
|
-
|
|
1791
|
+
return [3 /*break*/, 5];
|
|
2274
1792
|
case 4:
|
|
2275
1793
|
this.loading = false;
|
|
2276
|
-
return [7
|
|
2277
|
-
/*endfinally*/
|
|
2278
|
-
];
|
|
2279
|
-
|
|
1794
|
+
return [7 /*endfinally*/];
|
|
2280
1795
|
case 5:
|
|
2281
|
-
return [2
|
|
2282
|
-
/*return*/
|
|
2283
|
-
];
|
|
1796
|
+
return [2 /*return*/];
|
|
2284
1797
|
}
|
|
2285
1798
|
});
|
|
2286
1799
|
});
|
|
@@ -2294,51 +1807,32 @@ function () {
|
|
|
2294
1807
|
case 0:
|
|
2295
1808
|
if (!contact) {
|
|
2296
1809
|
logger$2.error('Neither Email nor Phone Number selected');
|
|
2297
|
-
return [2
|
|
2298
|
-
/*return*/
|
|
2299
|
-
];
|
|
1810
|
+
return [2 /*return*/];
|
|
2300
1811
|
}
|
|
2301
1812
|
|
|
2302
1813
|
if (!_aws_amplify_auth__WEBPACK_IMPORTED_MODULE_3__["Auth"] || typeof _aws_amplify_auth__WEBPACK_IMPORTED_MODULE_3__["Auth"].verifyCurrentUserAttribute !== 'function') {
|
|
2303
1814
|
throw new Error(_constants_c8ecaa24_js__WEBPACK_IMPORTED_MODULE_5__["N"]);
|
|
2304
1815
|
}
|
|
2305
|
-
|
|
2306
1816
|
this.loading = true;
|
|
2307
1817
|
_a.label = 1;
|
|
2308
|
-
|
|
2309
1818
|
case 1:
|
|
2310
1819
|
_a.trys.push([1, 3, 4, 5]);
|
|
2311
|
-
|
|
2312
|
-
return [4
|
|
2313
|
-
/*yield*/
|
|
2314
|
-
, _aws_amplify_auth__WEBPACK_IMPORTED_MODULE_3__["Auth"].verifyCurrentUserAttribute(contact)];
|
|
2315
|
-
|
|
1820
|
+
return [4 /*yield*/, _aws_amplify_auth__WEBPACK_IMPORTED_MODULE_3__["Auth"].verifyCurrentUserAttribute(contact)];
|
|
2316
1821
|
case 2:
|
|
2317
1822
|
data = _a.sent();
|
|
2318
1823
|
logger$2.debug(data);
|
|
2319
1824
|
this.verifyAttr = contact;
|
|
2320
|
-
return [3
|
|
2321
|
-
/*break*/
|
|
2322
|
-
, 5];
|
|
2323
|
-
|
|
1825
|
+
return [3 /*break*/, 5];
|
|
2324
1826
|
case 3:
|
|
2325
1827
|
error_10 = _a.sent();
|
|
2326
1828
|
Object(_helpers_14fcb50c_js__WEBPACK_IMPORTED_MODULE_6__["a"])(error_10);
|
|
2327
1829
|
logger$2.error(error_10);
|
|
2328
|
-
return [3
|
|
2329
|
-
/*break*/
|
|
2330
|
-
, 5];
|
|
2331
|
-
|
|
1830
|
+
return [3 /*break*/, 5];
|
|
2332
1831
|
case 4:
|
|
2333
1832
|
this.loading = false;
|
|
2334
|
-
return [7
|
|
2335
|
-
/*endfinally*/
|
|
2336
|
-
];
|
|
2337
|
-
|
|
1833
|
+
return [7 /*endfinally*/];
|
|
2338
1834
|
case 5:
|
|
2339
|
-
return [2
|
|
2340
|
-
/*return*/
|
|
2341
|
-
];
|
|
1835
|
+
return [2 /*return*/];
|
|
2342
1836
|
}
|
|
2343
1837
|
});
|
|
2344
1838
|
});
|
|
@@ -2346,17 +1840,14 @@ function () {
|
|
|
2346
1840
|
|
|
2347
1841
|
class_7.prototype.handleInputChange = function (event) {
|
|
2348
1842
|
var inputName = event.target.name;
|
|
2349
|
-
|
|
2350
1843
|
if (inputName === 'code') {
|
|
2351
1844
|
this.code = event.target.value;
|
|
2352
1845
|
} else if (inputName === 'contact') {
|
|
2353
1846
|
this.contact = event.target.value;
|
|
2354
1847
|
}
|
|
2355
1848
|
};
|
|
2356
|
-
|
|
2357
1849
|
class_7.prototype.renderSubmit = function () {
|
|
2358
1850
|
var _this = this;
|
|
2359
|
-
|
|
2360
1851
|
return Object(_index_83f2275b_js__WEBPACK_IMPORTED_MODULE_0__["h"])("div", null, Object(_index_83f2275b_js__WEBPACK_IMPORTED_MODULE_0__["h"])("amplify-input", {
|
|
2361
1852
|
inputProps: {
|
|
2362
1853
|
autocomplete: 'off',
|
|
@@ -2369,26 +1860,20 @@ function () {
|
|
|
2369
1860
|
}
|
|
2370
1861
|
}));
|
|
2371
1862
|
};
|
|
2372
|
-
|
|
2373
1863
|
class_7.prototype.renderVerify = function () {
|
|
2374
1864
|
var _this = this;
|
|
2375
|
-
|
|
2376
1865
|
var user = this.user;
|
|
2377
|
-
|
|
2378
1866
|
if (!user) {
|
|
2379
1867
|
logger$2.debug('No user to verify');
|
|
2380
1868
|
return null;
|
|
2381
1869
|
}
|
|
2382
|
-
|
|
2383
1870
|
var unverified = user.unverified;
|
|
2384
|
-
|
|
2385
1871
|
if (!unverified) {
|
|
2386
1872
|
logger$2.debug('Unverified variable does not exist on user');
|
|
2387
1873
|
return null;
|
|
2388
1874
|
}
|
|
2389
|
-
|
|
2390
1875
|
var email = unverified.email,
|
|
2391
|
-
|
|
1876
|
+
phone_number = unverified.phone_number;
|
|
2392
1877
|
return Object(_index_83f2275b_js__WEBPACK_IMPORTED_MODULE_0__["h"])("div", null, email && Object(_index_83f2275b_js__WEBPACK_IMPORTED_MODULE_0__["h"])("amplify-radio-button", {
|
|
2393
1878
|
label: _aws_amplify_core__WEBPACK_IMPORTED_MODULE_1__["I18n"].get(_Translations_108d469f_js__WEBPACK_IMPORTED_MODULE_4__["T"].VERIFY_CONTACT_EMAIL_LABEL),
|
|
2394
1879
|
key: "email",
|
|
@@ -2413,10 +1898,8 @@ function () {
|
|
|
2413
1898
|
}
|
|
2414
1899
|
}));
|
|
2415
1900
|
};
|
|
2416
|
-
|
|
2417
1901
|
class_7.prototype.render = function () {
|
|
2418
1902
|
var _this = this;
|
|
2419
|
-
|
|
2420
1903
|
return Object(_index_83f2275b_js__WEBPACK_IMPORTED_MODULE_0__["h"])(_index_83f2275b_js__WEBPACK_IMPORTED_MODULE_0__["H"], null, Object(_index_83f2275b_js__WEBPACK_IMPORTED_MODULE_0__["h"])("amplify-form-section", {
|
|
2421
1904
|
handleSubmit: function handleSubmit(event) {
|
|
2422
1905
|
return _this.handleSubmit(event);
|
|
@@ -2433,12 +1916,10 @@ function () {
|
|
|
2433
1916
|
submitButtonText: this.verifyAttr ? _aws_amplify_core__WEBPACK_IMPORTED_MODULE_1__["I18n"].get(_Translations_108d469f_js__WEBPACK_IMPORTED_MODULE_4__["T"].VERIFY_CONTACT_SUBMIT_LABEL) : _aws_amplify_core__WEBPACK_IMPORTED_MODULE_1__["I18n"].get(_Translations_108d469f_js__WEBPACK_IMPORTED_MODULE_4__["T"].VERIFY_CONTACT_VERIFY_LABEL)
|
|
2434
1917
|
}, this.verifyAttr ? this.renderSubmit() : this.renderVerify()));
|
|
2435
1918
|
};
|
|
2436
|
-
|
|
2437
1919
|
return class_7;
|
|
2438
1920
|
}();
|
|
2439
1921
|
|
|
2440
1922
|
|
|
2441
|
-
|
|
2442
1923
|
/***/ }),
|
|
2443
1924
|
|
|
2444
1925
|
/***/ "../amplify-ui-components/dist/esm-es5/auth-helpers-557b83fc.js":
|
|
@@ -2466,7 +1947,6 @@ var __awaiter = undefined && undefined.__awaiter || function (thisArg, _argument
|
|
|
2466
1947
|
resolve(value);
|
|
2467
1948
|
});
|
|
2468
1949
|
}
|
|
2469
|
-
|
|
2470
1950
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
2471
1951
|
function fulfilled(value) {
|
|
2472
1952
|
try {
|
|
@@ -2475,7 +1955,6 @@ var __awaiter = undefined && undefined.__awaiter || function (thisArg, _argument
|
|
|
2475
1955
|
reject(e);
|
|
2476
1956
|
}
|
|
2477
1957
|
}
|
|
2478
|
-
|
|
2479
1958
|
function rejected(value) {
|
|
2480
1959
|
try {
|
|
2481
1960
|
step(generator["throw"](value));
|
|
@@ -2483,29 +1962,26 @@ var __awaiter = undefined && undefined.__awaiter || function (thisArg, _argument
|
|
|
2483
1962
|
reject(e);
|
|
2484
1963
|
}
|
|
2485
1964
|
}
|
|
2486
|
-
|
|
2487
1965
|
function step(result) {
|
|
2488
1966
|
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
2489
1967
|
}
|
|
2490
|
-
|
|
2491
1968
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
2492
1969
|
});
|
|
2493
1970
|
};
|
|
2494
|
-
|
|
2495
1971
|
var __generator = undefined && undefined.__generator || function (thisArg, body) {
|
|
2496
1972
|
var _ = {
|
|
2497
|
-
|
|
2498
|
-
|
|
2499
|
-
|
|
2500
|
-
|
|
1973
|
+
label: 0,
|
|
1974
|
+
sent: function sent() {
|
|
1975
|
+
if (t[0] & 1) throw t[1];
|
|
1976
|
+
return t[1];
|
|
1977
|
+
},
|
|
1978
|
+
trys: [],
|
|
1979
|
+
ops: []
|
|
2501
1980
|
},
|
|
2502
|
-
|
|
2503
|
-
|
|
2504
|
-
|
|
2505
|
-
|
|
2506
|
-
y,
|
|
2507
|
-
t,
|
|
2508
|
-
g;
|
|
1981
|
+
f,
|
|
1982
|
+
y,
|
|
1983
|
+
t,
|
|
1984
|
+
g;
|
|
2509
1985
|
return g = {
|
|
2510
1986
|
next: verb(0),
|
|
2511
1987
|
"throw": verb(1),
|
|
@@ -2513,79 +1989,60 @@ var __generator = undefined && undefined.__generator || function (thisArg, body)
|
|
|
2513
1989
|
}, typeof Symbol === "function" && (g[Symbol.iterator] = function () {
|
|
2514
1990
|
return this;
|
|
2515
1991
|
}), g;
|
|
2516
|
-
|
|
2517
1992
|
function verb(n) {
|
|
2518
1993
|
return function (v) {
|
|
2519
1994
|
return step([n, v]);
|
|
2520
1995
|
};
|
|
2521
1996
|
}
|
|
2522
|
-
|
|
2523
1997
|
function step(op) {
|
|
2524
1998
|
if (f) throw new TypeError("Generator is already executing.");
|
|
2525
|
-
|
|
2526
1999
|
while (_) {
|
|
2527
2000
|
try {
|
|
2528
2001
|
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
2529
2002
|
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
2530
|
-
|
|
2531
2003
|
switch (op[0]) {
|
|
2532
2004
|
case 0:
|
|
2533
2005
|
case 1:
|
|
2534
2006
|
t = op;
|
|
2535
2007
|
break;
|
|
2536
|
-
|
|
2537
2008
|
case 4:
|
|
2538
2009
|
_.label++;
|
|
2539
2010
|
return {
|
|
2540
2011
|
value: op[1],
|
|
2541
2012
|
done: false
|
|
2542
2013
|
};
|
|
2543
|
-
|
|
2544
2014
|
case 5:
|
|
2545
2015
|
_.label++;
|
|
2546
2016
|
y = op[1];
|
|
2547
2017
|
op = [0];
|
|
2548
2018
|
continue;
|
|
2549
|
-
|
|
2550
2019
|
case 7:
|
|
2551
2020
|
op = _.ops.pop();
|
|
2552
|
-
|
|
2553
2021
|
_.trys.pop();
|
|
2554
|
-
|
|
2555
2022
|
continue;
|
|
2556
|
-
|
|
2557
2023
|
default:
|
|
2558
2024
|
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
2559
2025
|
_ = 0;
|
|
2560
2026
|
continue;
|
|
2561
2027
|
}
|
|
2562
|
-
|
|
2563
2028
|
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
2564
2029
|
_.label = op[1];
|
|
2565
2030
|
break;
|
|
2566
2031
|
}
|
|
2567
|
-
|
|
2568
2032
|
if (op[0] === 6 && _.label < t[1]) {
|
|
2569
2033
|
_.label = t[1];
|
|
2570
2034
|
t = op;
|
|
2571
2035
|
break;
|
|
2572
2036
|
}
|
|
2573
|
-
|
|
2574
2037
|
if (t && _.label < t[2]) {
|
|
2575
2038
|
_.label = t[2];
|
|
2576
|
-
|
|
2577
2039
|
_.ops.push(op);
|
|
2578
|
-
|
|
2579
2040
|
break;
|
|
2580
2041
|
}
|
|
2581
|
-
|
|
2582
2042
|
if (t[2]) _.ops.pop();
|
|
2583
|
-
|
|
2584
2043
|
_.trys.pop();
|
|
2585
|
-
|
|
2586
2044
|
continue;
|
|
2587
2045
|
}
|
|
2588
|
-
|
|
2589
2046
|
op = body.call(thisArg, _);
|
|
2590
2047
|
} catch (e) {
|
|
2591
2048
|
op = [6, e];
|
|
@@ -2594,7 +2051,6 @@ var __generator = undefined && undefined.__generator || function (thisArg, body)
|
|
|
2594
2051
|
f = t = 0;
|
|
2595
2052
|
}
|
|
2596
2053
|
}
|
|
2597
|
-
|
|
2598
2054
|
if (op[0] & 5) throw op[1];
|
|
2599
2055
|
return {
|
|
2600
2056
|
value: op[0] ? op[1] : void 0,
|
|
@@ -2608,9 +2064,7 @@ var __generator = undefined && undefined.__generator || function (thisArg, body)
|
|
|
2608
2064
|
|
|
2609
2065
|
|
|
2610
2066
|
|
|
2611
|
-
|
|
2612
2067
|
var logger = new _aws_amplify_core__WEBPACK_IMPORTED_MODULE_0__["Logger"]('auth-helpers');
|
|
2613
|
-
|
|
2614
2068
|
function checkContact(user, handleAuthStateChange) {
|
|
2615
2069
|
return __awaiter(this, void 0, void 0, function () {
|
|
2616
2070
|
var data, newUser, error_1;
|
|
@@ -2619,51 +2073,33 @@ function checkContact(user, handleAuthStateChange) {
|
|
|
2619
2073
|
case 0:
|
|
2620
2074
|
if (!_aws_amplify_auth__WEBPACK_IMPORTED_MODULE_2__["Auth"] || typeof _aws_amplify_auth__WEBPACK_IMPORTED_MODULE_2__["Auth"].verifiedContact !== 'function') {
|
|
2621
2075
|
throw new Error(_constants_c8ecaa24_js__WEBPACK_IMPORTED_MODULE_4__["N"]);
|
|
2622
|
-
}
|
|
2076
|
+
}
|
|
2077
|
+
// If `user` is a federated user, we shouldn't call `verifiedContact`
|
|
2623
2078
|
// since `user` isn't `CognitoUser`
|
|
2624
|
-
|
|
2625
|
-
|
|
2626
2079
|
if (!isCognitoUser(user)) {
|
|
2627
2080
|
handleAuthStateChange(_auth_types_78df304e_js__WEBPACK_IMPORTED_MODULE_1__["A"].SignedIn, user);
|
|
2628
|
-
return [2
|
|
2629
|
-
/*return*/
|
|
2630
|
-
];
|
|
2081
|
+
return [2 /*return*/];
|
|
2631
2082
|
}
|
|
2632
2083
|
|
|
2633
2084
|
_a.label = 1;
|
|
2634
|
-
|
|
2635
2085
|
case 1:
|
|
2636
2086
|
_a.trys.push([1, 3,, 4]);
|
|
2637
|
-
|
|
2638
|
-
return [4
|
|
2639
|
-
/*yield*/
|
|
2640
|
-
, _aws_amplify_auth__WEBPACK_IMPORTED_MODULE_2__["Auth"].verifiedContact(user)];
|
|
2641
|
-
|
|
2087
|
+
return [4 /*yield*/, _aws_amplify_auth__WEBPACK_IMPORTED_MODULE_2__["Auth"].verifiedContact(user)];
|
|
2642
2088
|
case 2:
|
|
2643
2089
|
data = _a.sent();
|
|
2644
|
-
|
|
2645
2090
|
if (!Object(_aws_amplify_core__WEBPACK_IMPORTED_MODULE_0__["isEmpty"])(data.verified) || Object(_aws_amplify_core__WEBPACK_IMPORTED_MODULE_0__["isEmpty"])(data.unverified)) {
|
|
2646
2091
|
handleAuthStateChange(_auth_types_78df304e_js__WEBPACK_IMPORTED_MODULE_1__["A"].SignedIn, user);
|
|
2647
2092
|
} else {
|
|
2648
2093
|
newUser = Object.assign(user, data);
|
|
2649
2094
|
handleAuthStateChange(_auth_types_78df304e_js__WEBPACK_IMPORTED_MODULE_1__["A"].VerifyContact, newUser);
|
|
2650
2095
|
}
|
|
2651
|
-
|
|
2652
|
-
return [3
|
|
2653
|
-
/*break*/
|
|
2654
|
-
, 4];
|
|
2655
|
-
|
|
2096
|
+
return [3 /*break*/, 4];
|
|
2656
2097
|
case 3:
|
|
2657
2098
|
error_1 = _a.sent();
|
|
2658
2099
|
Object(_helpers_14fcb50c_js__WEBPACK_IMPORTED_MODULE_5__["a"])(error_1);
|
|
2659
|
-
return [3
|
|
2660
|
-
/*break*/
|
|
2661
|
-
, 4];
|
|
2662
|
-
|
|
2100
|
+
return [3 /*break*/, 4];
|
|
2663
2101
|
case 4:
|
|
2664
|
-
return [2
|
|
2665
|
-
/*return*/
|
|
2666
|
-
];
|
|
2102
|
+
return [2 /*return*/];
|
|
2667
2103
|
}
|
|
2668
2104
|
});
|
|
2669
2105
|
});
|
|
@@ -2678,76 +2114,41 @@ var handleSignIn = function handleSignIn(username, password, handleAuthStateChan
|
|
|
2678
2114
|
if (!_aws_amplify_auth__WEBPACK_IMPORTED_MODULE_2__["Auth"] || typeof _aws_amplify_auth__WEBPACK_IMPORTED_MODULE_2__["Auth"].signIn !== 'function') {
|
|
2679
2115
|
throw new Error(_constants_c8ecaa24_js__WEBPACK_IMPORTED_MODULE_4__["N"]);
|
|
2680
2116
|
}
|
|
2681
|
-
|
|
2682
2117
|
_a.label = 1;
|
|
2683
|
-
|
|
2684
2118
|
case 1:
|
|
2685
2119
|
_a.trys.push([1, 9,, 10]);
|
|
2686
|
-
|
|
2687
|
-
return [4
|
|
2688
|
-
/*yield*/
|
|
2689
|
-
, _aws_amplify_auth__WEBPACK_IMPORTED_MODULE_2__["Auth"].signIn(username, password)];
|
|
2690
|
-
|
|
2120
|
+
return [4 /*yield*/, _aws_amplify_auth__WEBPACK_IMPORTED_MODULE_2__["Auth"].signIn(username, password)];
|
|
2691
2121
|
case 2:
|
|
2692
2122
|
user = _a.sent();
|
|
2693
2123
|
logger.debug(user);
|
|
2694
|
-
if (!(user.challengeName === _auth_types_78df304e_js__WEBPACK_IMPORTED_MODULE_1__["C"].SMSMFA || user.challengeName === _auth_types_78df304e_js__WEBPACK_IMPORTED_MODULE_1__["C"].SoftwareTokenMFA)) return [3
|
|
2695
|
-
/*break*/
|
|
2696
|
-
, 3];
|
|
2124
|
+
if (!(user.challengeName === _auth_types_78df304e_js__WEBPACK_IMPORTED_MODULE_1__["C"].SMSMFA || user.challengeName === _auth_types_78df304e_js__WEBPACK_IMPORTED_MODULE_1__["C"].SoftwareTokenMFA)) return [3 /*break*/, 3];
|
|
2697
2125
|
logger.debug('confirm user with ' + user.challengeName);
|
|
2698
2126
|
handleAuthStateChange(_auth_types_78df304e_js__WEBPACK_IMPORTED_MODULE_1__["A"].ConfirmSignIn, user);
|
|
2699
|
-
return [3
|
|
2700
|
-
/*break*/
|
|
2701
|
-
, 8];
|
|
2702
|
-
|
|
2127
|
+
return [3 /*break*/, 8];
|
|
2703
2128
|
case 3:
|
|
2704
|
-
if (!(user.challengeName === _auth_types_78df304e_js__WEBPACK_IMPORTED_MODULE_1__["C"].NewPasswordRequired)) return [3
|
|
2705
|
-
/*break*/
|
|
2706
|
-
, 4];
|
|
2129
|
+
if (!(user.challengeName === _auth_types_78df304e_js__WEBPACK_IMPORTED_MODULE_1__["C"].NewPasswordRequired)) return [3 /*break*/, 4];
|
|
2707
2130
|
logger.debug('require new password', user.challengeParam);
|
|
2708
2131
|
handleAuthStateChange(_auth_types_78df304e_js__WEBPACK_IMPORTED_MODULE_1__["A"].ResetPassword, user);
|
|
2709
|
-
return [3
|
|
2710
|
-
/*break*/
|
|
2711
|
-
, 8];
|
|
2712
|
-
|
|
2132
|
+
return [3 /*break*/, 8];
|
|
2713
2133
|
case 4:
|
|
2714
|
-
if (!(user.challengeName === _auth_types_78df304e_js__WEBPACK_IMPORTED_MODULE_1__["C"].MFASetup)) return [3
|
|
2715
|
-
/*break*/
|
|
2716
|
-
, 5];
|
|
2134
|
+
if (!(user.challengeName === _auth_types_78df304e_js__WEBPACK_IMPORTED_MODULE_1__["C"].MFASetup)) return [3 /*break*/, 5];
|
|
2717
2135
|
logger.debug('TOTP setup', user.challengeParam);
|
|
2718
2136
|
handleAuthStateChange(_auth_types_78df304e_js__WEBPACK_IMPORTED_MODULE_1__["A"].TOTPSetup, user);
|
|
2719
|
-
return [3
|
|
2720
|
-
/*break*/
|
|
2721
|
-
, 8];
|
|
2722
|
-
|
|
2137
|
+
return [3 /*break*/, 8];
|
|
2723
2138
|
case 5:
|
|
2724
|
-
if (!(user.challengeName === _auth_types_78df304e_js__WEBPACK_IMPORTED_MODULE_1__["C"].CustomChallenge && user.challengeParam && user.challengeParam.trigger === 'true')) return [3
|
|
2725
|
-
/*break*/
|
|
2726
|
-
, 6];
|
|
2139
|
+
if (!(user.challengeName === _auth_types_78df304e_js__WEBPACK_IMPORTED_MODULE_1__["C"].CustomChallenge && user.challengeParam && user.challengeParam.trigger === 'true')) return [3 /*break*/, 6];
|
|
2727
2140
|
logger.debug('custom challenge', user.challengeParam);
|
|
2728
2141
|
handleAuthStateChange(_auth_types_78df304e_js__WEBPACK_IMPORTED_MODULE_1__["A"].CustomConfirmSignIn, user);
|
|
2729
|
-
return [3
|
|
2730
|
-
/*break*/
|
|
2731
|
-
, 8];
|
|
2732
|
-
|
|
2142
|
+
return [3 /*break*/, 8];
|
|
2733
2143
|
case 6:
|
|
2734
|
-
return [4
|
|
2735
|
-
/*yield*/
|
|
2736
|
-
, checkContact(user, handleAuthStateChange)];
|
|
2737
|
-
|
|
2144
|
+
return [4 /*yield*/, checkContact(user, handleAuthStateChange)];
|
|
2738
2145
|
case 7:
|
|
2739
2146
|
_a.sent();
|
|
2740
|
-
|
|
2741
2147
|
_a.label = 8;
|
|
2742
|
-
|
|
2743
2148
|
case 8:
|
|
2744
|
-
return [3
|
|
2745
|
-
/*break*/
|
|
2746
|
-
, 10];
|
|
2747
|
-
|
|
2149
|
+
return [3 /*break*/, 10];
|
|
2748
2150
|
case 9:
|
|
2749
2151
|
error_2 = _a.sent();
|
|
2750
|
-
|
|
2751
2152
|
if (error_2.code === 'UserNotConfirmedException') {
|
|
2752
2153
|
logger.debug('the user is not confirmed');
|
|
2753
2154
|
handleAuthStateChange(_auth_types_78df304e_js__WEBPACK_IMPORTED_MODULE_1__["A"].ConfirmSignUp, {
|
|
@@ -2765,21 +2166,14 @@ var handleSignIn = function handleSignIn(username, password, handleAuthStateChan
|
|
|
2765
2166
|
if (usernameAlias === _auth_types_78df304e_js__WEBPACK_IMPORTED_MODULE_1__["U"].email) {
|
|
2766
2167
|
error_2.message = _Translations_108d469f_js__WEBPACK_IMPORTED_MODULE_3__["T"].EMPTY_EMAIL;
|
|
2767
2168
|
}
|
|
2768
|
-
|
|
2769
2169
|
if (usernameAlias === _auth_types_78df304e_js__WEBPACK_IMPORTED_MODULE_1__["U"].phone_number) {
|
|
2770
2170
|
error_2.message = _Translations_108d469f_js__WEBPACK_IMPORTED_MODULE_3__["T"].EMPTY_PHONE;
|
|
2771
2171
|
}
|
|
2772
2172
|
}
|
|
2773
|
-
|
|
2774
2173
|
Object(_helpers_14fcb50c_js__WEBPACK_IMPORTED_MODULE_5__["a"])(error_2);
|
|
2775
|
-
return [3
|
|
2776
|
-
/*break*/
|
|
2777
|
-
, 10];
|
|
2778
|
-
|
|
2174
|
+
return [3 /*break*/, 10];
|
|
2779
2175
|
case 10:
|
|
2780
|
-
return [2
|
|
2781
|
-
/*return*/
|
|
2782
|
-
];
|
|
2176
|
+
return [2 /*return*/];
|
|
2783
2177
|
}
|
|
2784
2178
|
});
|
|
2785
2179
|
});
|
|
@@ -2790,7 +2184,6 @@ var isCognitoUser = function isCognitoUser(user) {
|
|
|
2790
2184
|
};
|
|
2791
2185
|
|
|
2792
2186
|
|
|
2793
|
-
|
|
2794
2187
|
/***/ })
|
|
2795
2188
|
|
|
2796
2189
|
}]);
|