@aws-amplify/ui-react 1.2.26 → 1.2.54-legacy-ui.10
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 +224 -0
- package/dist/0.js.map +1 -1
- package/dist/1.js +656 -2000
- package/dist/1.js.map +1 -1
- package/dist/10.js +23 -681
- package/dist/10.js.map +1 -1
- package/dist/11.js +1157 -20
- package/dist/11.js.map +1 -1
- package/dist/12.js +61 -1087
- package/dist/12.js.map +1 -1
- package/dist/13.js +1146 -64
- package/dist/13.js.map +1 -1
- package/dist/14.js +34 -1163
- package/dist/14.js.map +1 -1
- package/dist/15.js +17 -37
- package/dist/15.js.map +1 -1
- package/dist/16.js +109 -13
- package/dist/16.js.map +1 -1
- package/dist/17.js +32 -67
- package/dist/17.js.map +1 -1
- package/dist/18.js +236 -46
- package/dist/18.js.map +1 -1
- package/dist/19.js +35 -224
- package/dist/19.js.map +1 -1
- package/dist/2.js +2190 -159
- package/dist/2.js.map +1 -1
- package/dist/20.js +28 -48
- package/dist/20.js.map +1 -1
- package/dist/21.js +46 -25
- package/dist/21.js.map +1 -1
- package/dist/22.js +22 -25
- package/dist/22.js.map +1 -1
- package/dist/23.js +254 -25
- package/dist/23.js.map +1 -1
- package/dist/24.js +62 -230
- package/dist/24.js.map +1 -1
- package/dist/25.js +28 -62
- package/dist/25.js.map +1 -1
- package/dist/26.js +349 -30
- package/dist/26.js.map +1 -1
- package/dist/27.js +24 -352
- package/dist/27.js.map +1 -1
- package/dist/28.js +25 -22
- package/dist/28.js.map +1 -1
- package/dist/29.js +483 -26
- package/dist/29.js.map +1 -1
- package/dist/3.js +2710 -1818
- package/dist/3.js.map +1 -1
- package/dist/30.js +1 -502
- package/dist/30.js.map +1 -1
- package/dist/31.js +1 -1
- package/dist/31.js.map +1 -1
- package/dist/32.js +12 -1
- package/dist/32.js.map +1 -1
- package/dist/4.js +361 -3669
- package/dist/4.js.map +1 -1
- package/dist/5.js +48 -242
- package/dist/5.js.map +1 -1
- package/dist/6.js +118 -74
- package/dist/6.js.map +1 -1
- package/dist/7.js +55 -99
- package/dist/7.js.map +1 -1
- package/dist/8.js +98 -46
- package/dist/8.js.map +1 -1
- package/dist/9.js +474 -412
- package/dist/9.js.map +1 -1
- package/dist/@aws-amplify/ui-react.js +50 -44
- package/dist/@aws-amplify/ui-react.js.map +1 -1
- package/dist/aws-amplify-react.min.js +2 -2
- package/dist/aws-amplify-react.min.js.map +1 -1
- package/dist/polyfills-core-js.js +5 -11
- package/dist/polyfills-core-js.js.map +1 -1
- package/dist/polyfills-css-shim.js.map +1 -1
- package/dist/polyfills-dom.js.map +1 -1
- package/package.json +3 -3
- package/dist/33.js +0 -13
- package/dist/33.js.map +0 -1
package/dist/2.js
CHANGED
|
@@ -1,15 +1,21 @@
|
|
|
1
1
|
(this["webpackJsonpaws_amplify_react"] = this["webpackJsonpaws_amplify_react"] || []).push([[2],{
|
|
2
2
|
|
|
3
|
-
/***/ "../amplify-ui-components/dist/esm-es5/amplify-
|
|
4
|
-
|
|
5
|
-
!*** ../amplify-ui-components/dist/esm-es5/amplify-
|
|
6
|
-
|
|
7
|
-
/*! exports provided:
|
|
3
|
+
/***/ "../amplify-ui-components/dist/esm-es5/amplify-confirm-sign-in_7.entry.js":
|
|
4
|
+
/*!********************************************************************************!*\
|
|
5
|
+
!*** ../amplify-ui-components/dist/esm-es5/amplify-confirm-sign-in_7.entry.js ***!
|
|
6
|
+
\********************************************************************************/
|
|
7
|
+
/*! exports provided: amplify_confirm_sign_in, amplify_confirm_sign_up, amplify_forgot_password, amplify_require_new_password, amplify_sign_in, amplify_sign_up, amplify_verify_contact */
|
|
8
8
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
9
9
|
|
|
10
10
|
"use strict";
|
|
11
11
|
__webpack_require__.r(__webpack_exports__);
|
|
12
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "
|
|
12
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "amplify_confirm_sign_in", function() { return AmplifyConfirmSignIn; });
|
|
13
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "amplify_confirm_sign_up", function() { return AmplifyConfirmSignUp; });
|
|
14
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "amplify_forgot_password", function() { return AmplifyForgotPassword; });
|
|
15
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "amplify_require_new_password", function() { return AmplifyRequireNewPassword; });
|
|
16
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "amplify_sign_in", function() { return AmplifySignIn; });
|
|
17
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "amplify_sign_up", function() { return AmplifySignUp; });
|
|
18
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "amplify_verify_contact", function() { return AmplifyVerifyContact; });
|
|
13
19
|
/* harmony import */ var _index_83f2275b_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./index-83f2275b.js */ "../amplify-ui-components/dist/esm-es5/index-83f2275b.js");
|
|
14
20
|
/* harmony import */ var _aws_amplify_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @aws-amplify/core */ "@aws-amplify/core");
|
|
15
21
|
/* harmony import */ var _aws_amplify_core__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_aws_amplify_core__WEBPACK_IMPORTED_MODULE_1__);
|
|
@@ -163,7 +169,19 @@ var __generator = undefined && undefined.__generator || function (thisArg, body)
|
|
|
163
169
|
}
|
|
164
170
|
};
|
|
165
171
|
|
|
166
|
-
var
|
|
172
|
+
var __spreadArrays = undefined && undefined.__spreadArrays || function () {
|
|
173
|
+
for (var s = 0, i = 0, il = arguments.length; i < il; i++) {
|
|
174
|
+
s += arguments[i].length;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
for (var r = Array(s), k = 0, i = 0; i < il; i++) {
|
|
178
|
+
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) {
|
|
179
|
+
r[k] = a[j];
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
return r;
|
|
184
|
+
};
|
|
167
185
|
|
|
168
186
|
|
|
169
187
|
|
|
@@ -173,80 +191,143 @@ var _a;
|
|
|
173
191
|
|
|
174
192
|
|
|
175
193
|
|
|
176
|
-
var authSlotNames = (_a = {}, _a[_auth_types_78df304e_js__WEBPACK_IMPORTED_MODULE_2__["A"].SignIn] = 'sign-in', _a[_auth_types_78df304e_js__WEBPACK_IMPORTED_MODULE_2__["A"].ConfirmSignIn] = 'confirm-sign-in', _a[_auth_types_78df304e_js__WEBPACK_IMPORTED_MODULE_2__["A"].SignUp] = 'sign-up', _a[_auth_types_78df304e_js__WEBPACK_IMPORTED_MODULE_2__["A"].ConfirmSignUp] = 'confirm-sign-up', _a[_auth_types_78df304e_js__WEBPACK_IMPORTED_MODULE_2__["A"].ForgotPassword] = 'forgot-password', _a[_auth_types_78df304e_js__WEBPACK_IMPORTED_MODULE_2__["A"].ResetPassword] = 'require-new-password', _a[_auth_types_78df304e_js__WEBPACK_IMPORTED_MODULE_2__["A"].VerifyContact] = 'verify-contact', _a[_auth_types_78df304e_js__WEBPACK_IMPORTED_MODULE_2__["A"].TOTPSetup] = 'totp-setup', _a[_auth_types_78df304e_js__WEBPACK_IMPORTED_MODULE_2__["A"].Loading] = 'loading', _a);
|
|
177
|
-
var amplifyAuthenticatorCss = ":host{--background-color:var(--amplify-background-color);--width:28.75rem;--min-width:20rem;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;--box-shadow:1px 1px 4px 0 rgba(0, 0, 0, 0.15);--border-radius:6px;--padding:35px 40px;--margin-bottom:20px;--container-height:100vh;--container-display:flex;--container-justify:center;--container-align:center}.auth-container{display:var(--container-display);-ms-flex-pack:var(--container-justify);justify-content:var(--container-justify);-ms-flex-align:var(--container-align);align-items:var(--container-align);min-height:var(--container-height)}";
|
|
178
|
-
var logger = new _aws_amplify_core__WEBPACK_IMPORTED_MODULE_1__["Logger"]('Authenticator');
|
|
179
194
|
|
|
180
|
-
var
|
|
195
|
+
var AmplifyConfirmSignIn =
|
|
181
196
|
/** @class */
|
|
182
197
|
function () {
|
|
183
198
|
function class_1(hostRef) {
|
|
184
199
|
var _this = this;
|
|
185
200
|
|
|
186
201
|
Object(_index_83f2275b_js__WEBPACK_IMPORTED_MODULE_0__["r"])(this, hostRef);
|
|
187
|
-
/**
|
|
202
|
+
/** Fires when confirm sign in form is submitted */
|
|
188
203
|
|
|
189
|
-
this.
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
/** Hide amplify-toast for auth errors */
|
|
204
|
+
this.handleSubmit = function (event) {
|
|
205
|
+
return _this.confirm(event);
|
|
206
|
+
};
|
|
207
|
+
/** Used for header text in confirm sign in component */
|
|
194
208
|
|
|
195
209
|
|
|
196
|
-
this.
|
|
197
|
-
|
|
198
|
-
this.toastMessage = '';
|
|
210
|
+
this.headerText = _Translations_108d469f_js__WEBPACK_IMPORTED_MODULE_4__["T"].CONFIRM_SMS_CODE;
|
|
211
|
+
/** Used for the submit button text in confirm sign in component */
|
|
199
212
|
|
|
200
|
-
this.
|
|
201
|
-
|
|
213
|
+
this.submitButtonText = _Translations_108d469f_js__WEBPACK_IMPORTED_MODULE_4__["T"].CONFIRM;
|
|
214
|
+
/** Auth state change handler for this component */
|
|
202
215
|
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
case 'signIn':
|
|
206
|
-
Object(_auth_helpers_557b83fc_js__WEBPACK_IMPORTED_MODULE_7__["c"])(payload.data, _helpers_14fcb50c_js__WEBPACK_IMPORTED_MODULE_6__["d"]);
|
|
207
|
-
break;
|
|
216
|
+
this.handleAuthStateChange = _helpers_14fcb50c_js__WEBPACK_IMPORTED_MODULE_6__["d"];
|
|
217
|
+
/** Default form field */
|
|
208
218
|
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
219
|
+
this.defaultFormFields = [{
|
|
220
|
+
type: 'code',
|
|
221
|
+
required: true,
|
|
222
|
+
handleInputChange: function handleInputChange(event) {
|
|
223
|
+
return _this.handleCodeChange(event);
|
|
214
224
|
}
|
|
215
|
-
};
|
|
225
|
+
}];
|
|
226
|
+
/**
|
|
227
|
+
* Form fields allows you to utilize our pre-built components such as username field, code field, password field, email field, etc.
|
|
228
|
+
* by passing an array of strings that you would like the order of the form to be in. If you need more customization, such as changing
|
|
229
|
+
* text for a label or adjust a placeholder, you can follow the structure below in order to do just that.
|
|
230
|
+
* ```
|
|
231
|
+
* [
|
|
232
|
+
* {
|
|
233
|
+
* type: string,
|
|
234
|
+
* label: string,
|
|
235
|
+
* placeholder: string,
|
|
236
|
+
* hint: string | Functional Component | null,
|
|
237
|
+
* required: boolean
|
|
238
|
+
* }
|
|
239
|
+
* ]
|
|
240
|
+
* ```
|
|
241
|
+
*/
|
|
216
242
|
|
|
217
|
-
this.
|
|
218
|
-
|
|
243
|
+
this.formFields = this.defaultFormFields;
|
|
244
|
+
/** The MFA option to confirm with */
|
|
219
245
|
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
}
|
|
225
|
-
};
|
|
246
|
+
this.mfaOption = _auth_types_78df304e_js__WEBPACK_IMPORTED_MODULE_2__["M"].SMS;
|
|
247
|
+
/* Whether or not the confirm-sign-in component is loading */
|
|
248
|
+
|
|
249
|
+
this.loading = false;
|
|
226
250
|
}
|
|
227
251
|
|
|
228
252
|
class_1.prototype.componentWillLoad = function () {
|
|
229
|
-
|
|
230
|
-
|
|
253
|
+
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
|
+
this.setup();
|
|
255
|
+
};
|
|
256
|
+
|
|
257
|
+
class_1.prototype.userHandler = function () {
|
|
258
|
+
this.setup();
|
|
259
|
+
};
|
|
260
|
+
|
|
261
|
+
class_1.prototype.setup = function () {
|
|
262
|
+
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; // If header text is using default use TOTP string
|
|
264
|
+
|
|
265
|
+
if (this.headerText === _Translations_108d469f_js__WEBPACK_IMPORTED_MODULE_4__["T"].CONFIRM_SMS_CODE) {
|
|
266
|
+
this.headerText = _Translations_108d469f_js__WEBPACK_IMPORTED_MODULE_4__["T"].CONFIRM_TOTP_CODE;
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
this.constructedFormFieldOptions = this.constructFormFieldOptions(this.formFields);
|
|
271
|
+
};
|
|
272
|
+
|
|
273
|
+
class_1.prototype.handleCodeChange = function (event) {
|
|
274
|
+
this.code = event.target.value;
|
|
275
|
+
};
|
|
231
276
|
|
|
277
|
+
class_1.prototype.confirm = function (event) {
|
|
278
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
279
|
+
var mfaType, error_1;
|
|
232
280
|
return __generator(this, function (_a) {
|
|
233
281
|
switch (_a.label) {
|
|
234
282
|
case 0:
|
|
235
|
-
|
|
236
|
-
|
|
283
|
+
if (event) {
|
|
284
|
+
event.preventDefault();
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
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
|
+
if (!_aws_amplify_auth__WEBPACK_IMPORTED_MODULE_3__["Auth"] || typeof _aws_amplify_auth__WEBPACK_IMPORTED_MODULE_3__["Auth"].confirmSignIn !== 'function') {
|
|
290
|
+
throw new Error(_constants_c8ecaa24_js__WEBPACK_IMPORTED_MODULE_5__["N"]);
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
this.loading = true;
|
|
294
|
+
_a.label = 1;
|
|
295
|
+
|
|
296
|
+
case 1:
|
|
297
|
+
_a.trys.push([1, 4, 5, 6]);
|
|
237
298
|
|
|
238
|
-
_this.toastMessage = '';
|
|
239
|
-
});
|
|
240
|
-
if (!this.hideToast) _aws_amplify_core__WEBPACK_IMPORTED_MODULE_1__["Hub"].listen(_constants_c8ecaa24_js__WEBPACK_IMPORTED_MODULE_5__["U"], this.handleToastEvent);
|
|
241
|
-
_aws_amplify_core__WEBPACK_IMPORTED_MODULE_1__["Hub"].listen(_constants_c8ecaa24_js__WEBPACK_IMPORTED_MODULE_5__["A"], this.handleExternalAuthEvent);
|
|
242
|
-
Object(_aws_amplify_auth__WEBPACK_IMPORTED_MODULE_3__["appendToCognitoUserAgent"])('amplify-authenticator');
|
|
243
299
|
return [4
|
|
244
300
|
/*yield*/
|
|
245
|
-
, this.
|
|
301
|
+
, _aws_amplify_auth__WEBPACK_IMPORTED_MODULE_3__["Auth"].confirmSignIn(this.user, this.code, mfaType)];
|
|
246
302
|
|
|
247
|
-
case
|
|
303
|
+
case 2:
|
|
304
|
+
_a.sent();
|
|
305
|
+
|
|
306
|
+
return [4
|
|
307
|
+
/*yield*/
|
|
308
|
+
, Object(_auth_helpers_557b83fc_js__WEBPACK_IMPORTED_MODULE_7__["c"])(this.user, this.handleAuthStateChange)];
|
|
309
|
+
|
|
310
|
+
case 3:
|
|
248
311
|
_a.sent();
|
|
249
312
|
|
|
313
|
+
return [3
|
|
314
|
+
/*break*/
|
|
315
|
+
, 6];
|
|
316
|
+
|
|
317
|
+
case 4:
|
|
318
|
+
error_1 = _a.sent();
|
|
319
|
+
Object(_helpers_14fcb50c_js__WEBPACK_IMPORTED_MODULE_6__["a"])(error_1);
|
|
320
|
+
return [3
|
|
321
|
+
/*break*/
|
|
322
|
+
, 6];
|
|
323
|
+
|
|
324
|
+
case 5:
|
|
325
|
+
this.loading = false;
|
|
326
|
+
return [7
|
|
327
|
+
/*endfinally*/
|
|
328
|
+
];
|
|
329
|
+
|
|
330
|
+
case 6:
|
|
250
331
|
return [2
|
|
251
332
|
/*return*/
|
|
252
333
|
];
|
|
@@ -255,157 +336,2107 @@ function () {
|
|
|
255
336
|
});
|
|
256
337
|
};
|
|
257
338
|
|
|
258
|
-
class_1.prototype.
|
|
259
|
-
|
|
260
|
-
var _this = this;
|
|
339
|
+
class_1.prototype.constructFormFieldOptions = function (formFields) {
|
|
340
|
+
var _this = this;
|
|
261
341
|
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
342
|
+
var content = [];
|
|
343
|
+
if (formFields === undefined) return undefined;
|
|
344
|
+
if (formFields.length <= 0) return this.defaultFormFields;
|
|
345
|
+
formFields.forEach(function (formField) {
|
|
346
|
+
if (typeof formField === 'string' || formField.type !== 'code') {
|
|
347
|
+
// This is either a `string`, and/or a custom field that isn't `code`. Pass this directly.
|
|
348
|
+
content.push(formField);
|
|
349
|
+
} else {
|
|
350
|
+
// This is a code input field. Attach input handler.
|
|
351
|
+
content.push(Object.assign({
|
|
352
|
+
handleInputChange: function handleInputChange(event) {
|
|
353
|
+
return _this.handleCodeChange(event);
|
|
354
|
+
}
|
|
355
|
+
}, formField));
|
|
356
|
+
}
|
|
357
|
+
});
|
|
358
|
+
return content;
|
|
359
|
+
};
|
|
360
|
+
|
|
361
|
+
class_1.prototype.render = function () {
|
|
362
|
+
var _this = this;
|
|
363
|
+
|
|
364
|
+
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
|
+
headerText: _aws_amplify_core__WEBPACK_IMPORTED_MODULE_1__["I18n"].get(this.headerText),
|
|
366
|
+
handleSubmit: this.handleSubmit,
|
|
367
|
+
submitButtonText: _aws_amplify_core__WEBPACK_IMPORTED_MODULE_1__["I18n"].get(this.submitButtonText),
|
|
368
|
+
loading: this.loading,
|
|
369
|
+
secondaryFooterContent: Object(_index_83f2275b_js__WEBPACK_IMPORTED_MODULE_0__["h"])("span", null, Object(_index_83f2275b_js__WEBPACK_IMPORTED_MODULE_0__["h"])("amplify-button", {
|
|
370
|
+
variant: "anchor",
|
|
371
|
+
onClick: function onClick() {
|
|
372
|
+
return _this.handleAuthStateChange(_auth_types_78df304e_js__WEBPACK_IMPORTED_MODULE_2__["A"].SignIn);
|
|
373
|
+
}
|
|
374
|
+
}, _aws_amplify_core__WEBPACK_IMPORTED_MODULE_1__["I18n"].get(_Translations_108d469f_js__WEBPACK_IMPORTED_MODULE_4__["T"].BACK_TO_SIGN_IN)))
|
|
375
|
+
}, Object(_index_83f2275b_js__WEBPACK_IMPORTED_MODULE_0__["h"])("amplify-auth-fields", {
|
|
376
|
+
formFields: this.constructedFormFieldOptions
|
|
377
|
+
})));
|
|
378
|
+
};
|
|
379
|
+
|
|
380
|
+
Object.defineProperty(class_1, "watchers", {
|
|
381
|
+
get: function get() {
|
|
382
|
+
return {
|
|
383
|
+
"user": ["userHandler"]
|
|
384
|
+
};
|
|
385
|
+
},
|
|
386
|
+
enumerable: false,
|
|
387
|
+
configurable: true
|
|
388
|
+
});
|
|
389
|
+
return class_1;
|
|
390
|
+
}();
|
|
391
|
+
|
|
392
|
+
var AmplifyConfirmSignUp =
|
|
393
|
+
/** @class */
|
|
394
|
+
function () {
|
|
395
|
+
function class_2(hostRef) {
|
|
396
|
+
var _this = this;
|
|
397
|
+
|
|
398
|
+
Object(_index_83f2275b_js__WEBPACK_IMPORTED_MODULE_0__["r"])(this, hostRef);
|
|
399
|
+
/** Fires when sign up form is submitted */
|
|
400
|
+
|
|
401
|
+
this.handleSubmit = function (event) {
|
|
402
|
+
return _this.confirmSignUp(event);
|
|
403
|
+
};
|
|
404
|
+
/** Used for header text in confirm sign up component */
|
|
405
|
+
|
|
406
|
+
|
|
407
|
+
this.headerText = _Translations_108d469f_js__WEBPACK_IMPORTED_MODULE_4__["T"].CONFIRM_SIGN_UP_HEADER_TEXT;
|
|
408
|
+
/** Used for the submit button text in confirm sign up component */
|
|
409
|
+
|
|
410
|
+
this.submitButtonText = _Translations_108d469f_js__WEBPACK_IMPORTED_MODULE_4__["T"].CONFIRM_SIGN_UP_SUBMIT_BUTTON_TEXT;
|
|
411
|
+
/**
|
|
412
|
+
* Form fields allows you to utilize our pre-built components such as username field, code field, password field, email field, etc.
|
|
413
|
+
* by passing an array of strings that you would like the order of the form to be in. If you need more customization, such as changing
|
|
414
|
+
* text for a label or adjust a placeholder, you can follow the structure below in order to do just that.
|
|
415
|
+
* ```
|
|
416
|
+
* [
|
|
417
|
+
* {
|
|
418
|
+
* type: string,
|
|
419
|
+
* label: string,
|
|
420
|
+
* placeholder: string,
|
|
421
|
+
* hint: string | Functional Component | null,
|
|
422
|
+
* required: boolean
|
|
423
|
+
* }
|
|
424
|
+
* ]
|
|
425
|
+
* ```
|
|
426
|
+
*/
|
|
427
|
+
|
|
428
|
+
this.formFields = [];
|
|
429
|
+
/** Auth state change handler for this components
|
|
430
|
+
* e.g. SignIn -> 'Create Account' link -> SignUp
|
|
431
|
+
*/
|
|
432
|
+
|
|
433
|
+
this.handleAuthStateChange = _helpers_14fcb50c_js__WEBPACK_IMPORTED_MODULE_6__["d"];
|
|
434
|
+
/** Username Alias is used to setup authentication with `username`, `email` or `phone_number` */
|
|
435
|
+
|
|
436
|
+
this.usernameAlias = 'username';
|
|
437
|
+
this.loading = false;
|
|
438
|
+
this.newFormFields = [];
|
|
439
|
+
this.phoneNumber = {
|
|
440
|
+
countryDialCodeValue: _constants_c8ecaa24_js__WEBPACK_IMPORTED_MODULE_5__["g"],
|
|
441
|
+
phoneNumberValue: null
|
|
442
|
+
};
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
class_2.prototype.componentWillLoad = function () {
|
|
446
|
+
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
|
+
this.setup();
|
|
448
|
+
};
|
|
449
|
+
|
|
450
|
+
class_2.prototype.formFieldsHandler = function () {
|
|
451
|
+
this.buildFormFields();
|
|
452
|
+
};
|
|
453
|
+
|
|
454
|
+
class_2.prototype.userHandler = function () {
|
|
455
|
+
this.setup();
|
|
456
|
+
};
|
|
457
|
+
|
|
458
|
+
class_2.prototype.setup = function () {
|
|
459
|
+
// TODO: Use optional chaining instead
|
|
460
|
+
this.userInput = this.user && this.user.username;
|
|
461
|
+
this._signUpAttrs = this.user && this.user.signUpAttrs;
|
|
462
|
+
Object(_helpers_14fcb50c_js__WEBPACK_IMPORTED_MODULE_6__["c"])(this.usernameAlias);
|
|
463
|
+
this.buildFormFields();
|
|
464
|
+
};
|
|
465
|
+
|
|
466
|
+
class_2.prototype.buildDefaultFormFields = function () {
|
|
467
|
+
var _this = this;
|
|
468
|
+
|
|
469
|
+
this.newFormFields = [{
|
|
470
|
+
type: "" + this.usernameAlias,
|
|
471
|
+
required: true,
|
|
472
|
+
handleInputChange: this.handleFormFieldInputChange("" + this.usernameAlias),
|
|
473
|
+
value: this.userInput,
|
|
474
|
+
disabled: this.userInput ? true : false,
|
|
475
|
+
inputProps: {
|
|
476
|
+
autocomplete: 'username'
|
|
477
|
+
}
|
|
478
|
+
}, {
|
|
479
|
+
type: 'code',
|
|
480
|
+
label: _aws_amplify_core__WEBPACK_IMPORTED_MODULE_1__["I18n"].get(_Translations_108d469f_js__WEBPACK_IMPORTED_MODULE_4__["T"].CONFIRM_SIGN_UP_CODE_LABEL),
|
|
481
|
+
placeholder: _aws_amplify_core__WEBPACK_IMPORTED_MODULE_1__["I18n"].get(_Translations_108d469f_js__WEBPACK_IMPORTED_MODULE_4__["T"].CONFIRM_SIGN_UP_CODE_PLACEHOLDER),
|
|
482
|
+
required: true,
|
|
483
|
+
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"].CONFIRM_SIGN_UP_LOST_CODE), ' ', Object(_index_83f2275b_js__WEBPACK_IMPORTED_MODULE_0__["h"])("amplify-button", {
|
|
484
|
+
variant: "anchor",
|
|
485
|
+
onClick: function onClick() {
|
|
486
|
+
return _this.resendConfirmCode();
|
|
487
|
+
}
|
|
488
|
+
}, _aws_amplify_core__WEBPACK_IMPORTED_MODULE_1__["I18n"].get(_Translations_108d469f_js__WEBPACK_IMPORTED_MODULE_4__["T"].CONFIRM_SIGN_UP_RESEND_CODE))),
|
|
489
|
+
handleInputChange: this.handleFormFieldInputChange('code')
|
|
490
|
+
}];
|
|
491
|
+
};
|
|
492
|
+
|
|
493
|
+
class_2.prototype.buildFormFields = function () {
|
|
494
|
+
var _this = this;
|
|
495
|
+
|
|
496
|
+
if (this.formFields.length === 0) {
|
|
497
|
+
this.buildDefaultFormFields();
|
|
498
|
+
} else {
|
|
499
|
+
var newFields_1 = [];
|
|
500
|
+
this.formFields.forEach(function (field) {
|
|
501
|
+
var newField = Object.assign({}, field);
|
|
502
|
+
|
|
503
|
+
if (newField.type === 'code') {
|
|
504
|
+
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
|
+
variant: "anchor",
|
|
506
|
+
onClick: function onClick() {
|
|
507
|
+
return _this.resendConfirmCode();
|
|
508
|
+
}
|
|
509
|
+
}, _aws_amplify_core__WEBPACK_IMPORTED_MODULE_1__["I18n"].get(_Translations_108d469f_js__WEBPACK_IMPORTED_MODULE_4__["T"].CONFIRM_SIGN_UP_RESEND_CODE))) : newField['hint'];
|
|
265
510
|
}
|
|
266
511
|
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
Object(_helpers_14fcb50c_js__WEBPACK_IMPORTED_MODULE_6__["d"])(_this.initialAuthState);
|
|
273
|
-
})];
|
|
512
|
+
newField['handleInputChange'] = function (event) {
|
|
513
|
+
return _this.handleFormFieldInputWithCallback(event, field);
|
|
514
|
+
};
|
|
515
|
+
|
|
516
|
+
newFields_1.push(newField);
|
|
274
517
|
});
|
|
275
|
-
|
|
518
|
+
this.newFormFields = newFields_1;
|
|
519
|
+
}
|
|
276
520
|
};
|
|
277
521
|
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
522
|
+
class_2.prototype.handleFormFieldInputChange = function (fieldType) {
|
|
523
|
+
var _this = this;
|
|
524
|
+
|
|
525
|
+
switch (fieldType) {
|
|
526
|
+
case 'username':
|
|
527
|
+
case 'email':
|
|
528
|
+
return function (event) {
|
|
529
|
+
return _this.userInput = event.target.value;
|
|
530
|
+
};
|
|
531
|
+
|
|
532
|
+
case 'phone_number':
|
|
533
|
+
return function (event) {
|
|
534
|
+
return Object(_helpers_14fcb50c_js__WEBPACK_IMPORTED_MODULE_6__["h"])(event, _this.phoneNumber);
|
|
535
|
+
};
|
|
536
|
+
|
|
537
|
+
case 'code':
|
|
538
|
+
return function (event) {
|
|
539
|
+
return _this.code = event.target.value;
|
|
540
|
+
};
|
|
541
|
+
|
|
542
|
+
default:
|
|
543
|
+
return;
|
|
544
|
+
}
|
|
545
|
+
};
|
|
285
546
|
|
|
286
|
-
|
|
287
|
-
|
|
547
|
+
class_2.prototype.setFieldValue = function (field) {
|
|
548
|
+
switch (field.type) {
|
|
549
|
+
case 'username':
|
|
550
|
+
case 'email':
|
|
551
|
+
if (field.value === undefined) {
|
|
552
|
+
this.userInput = '';
|
|
288
553
|
} else {
|
|
289
|
-
this.
|
|
554
|
+
this.userInput = field.value;
|
|
290
555
|
}
|
|
291
556
|
|
|
292
|
-
|
|
293
|
-
if (this.authData) logger.log('Auth Data was set:', this.authData);
|
|
557
|
+
break;
|
|
294
558
|
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
559
|
+
case 'phone_number':
|
|
560
|
+
if (field.dialCode) {
|
|
561
|
+
this.phoneNumber.countryDialCodeValue = field.dialCode;
|
|
298
562
|
}
|
|
299
563
|
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
564
|
+
this.phoneNumber.phoneNumberValue = field.value;
|
|
565
|
+
break;
|
|
566
|
+
}
|
|
567
|
+
};
|
|
568
|
+
|
|
569
|
+
class_2.prototype.handleFormFieldInputWithCallback = function (event, field) {
|
|
570
|
+
var fnToCall = field['handleInputChange'] ? field['handleInputChange'] : function (event, cb) {
|
|
571
|
+
cb(event);
|
|
572
|
+
};
|
|
573
|
+
var callback = this.handleFormFieldInputChange(field.type);
|
|
574
|
+
fnToCall(event, callback.bind(this));
|
|
575
|
+
};
|
|
576
|
+
/**
|
|
577
|
+
* Returns the username of the user to confirm. If a valid `user.username` has been passed as a prop, we return that.
|
|
578
|
+
* Otherwise, we return the `userInput` on the form.
|
|
579
|
+
*/
|
|
580
|
+
|
|
581
|
+
|
|
582
|
+
class_2.prototype.getUsername = function () {
|
|
583
|
+
if (this.user && this.user.username) return this.user.username;
|
|
584
|
+
|
|
585
|
+
switch (this.usernameAlias) {
|
|
586
|
+
case 'username':
|
|
587
|
+
case 'email':
|
|
588
|
+
return this.userInput;
|
|
589
|
+
|
|
590
|
+
case 'phone_number':
|
|
591
|
+
return Object(_helpers_14fcb50c_js__WEBPACK_IMPORTED_MODULE_6__["b"])(this.phoneNumber);
|
|
592
|
+
}
|
|
593
|
+
};
|
|
594
|
+
|
|
595
|
+
class_2.prototype.resendConfirmCode = function () {
|
|
596
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
597
|
+
var username, error_2;
|
|
598
|
+
return __generator(this, function (_a) {
|
|
599
|
+
switch (_a.label) {
|
|
600
|
+
case 0:
|
|
601
|
+
if (event) {
|
|
602
|
+
event.preventDefault();
|
|
603
|
+
}
|
|
604
|
+
|
|
605
|
+
if (!_aws_amplify_auth__WEBPACK_IMPORTED_MODULE_3__["Auth"] || typeof _aws_amplify_auth__WEBPACK_IMPORTED_MODULE_3__["Auth"].resendSignUp !== 'function') {
|
|
606
|
+
throw new Error(_constants_c8ecaa24_js__WEBPACK_IMPORTED_MODULE_5__["N"]);
|
|
607
|
+
}
|
|
608
|
+
|
|
609
|
+
_a.label = 1;
|
|
610
|
+
|
|
611
|
+
case 1:
|
|
612
|
+
_a.trys.push([1, 3,, 4]);
|
|
613
|
+
|
|
614
|
+
username = this.getUsername();
|
|
615
|
+
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
|
+
|
|
620
|
+
case 2:
|
|
621
|
+
_a.sent();
|
|
622
|
+
|
|
623
|
+
return [3
|
|
624
|
+
/*break*/
|
|
625
|
+
, 4];
|
|
626
|
+
|
|
627
|
+
case 3:
|
|
628
|
+
error_2 = _a.sent();
|
|
629
|
+
Object(_helpers_14fcb50c_js__WEBPACK_IMPORTED_MODULE_6__["a"])(error_2);
|
|
630
|
+
return [3
|
|
631
|
+
/*break*/
|
|
632
|
+
, 4];
|
|
633
|
+
|
|
634
|
+
case 4:
|
|
635
|
+
return [2
|
|
636
|
+
/*return*/
|
|
637
|
+
];
|
|
638
|
+
}
|
|
303
639
|
});
|
|
304
640
|
});
|
|
305
|
-
}; //
|
|
641
|
+
}; // TODO: Add validation
|
|
642
|
+
// TODO: Prefix
|
|
306
643
|
|
|
307
644
|
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
645
|
+
class_2.prototype.confirmSignUp = function (event) {
|
|
646
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
647
|
+
var username, confirmSignUpResult, error_3;
|
|
648
|
+
return __generator(this, function (_a) {
|
|
649
|
+
switch (_a.label) {
|
|
650
|
+
case 0:
|
|
651
|
+
if (event) {
|
|
652
|
+
event.preventDefault();
|
|
653
|
+
}
|
|
315
654
|
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
});
|
|
655
|
+
if (!_aws_amplify_auth__WEBPACK_IMPORTED_MODULE_3__["Auth"] || typeof _aws_amplify_auth__WEBPACK_IMPORTED_MODULE_3__["Auth"].confirmSignUp !== 'function') {
|
|
656
|
+
throw new Error(_constants_c8ecaa24_js__WEBPACK_IMPORTED_MODULE_5__["N"]);
|
|
657
|
+
}
|
|
320
658
|
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
usernameAlias: this.usernameAlias
|
|
324
|
-
});
|
|
659
|
+
this.loading = true;
|
|
660
|
+
_a.label = 1;
|
|
325
661
|
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
user: this.authData,
|
|
329
|
-
usernameAlias: this.usernameAlias
|
|
330
|
-
});
|
|
662
|
+
case 1:
|
|
663
|
+
_a.trys.push([1, 6, 7, 8]);
|
|
331
664
|
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
665
|
+
username = this.getUsername();
|
|
666
|
+
if (!username) throw new Error(_Translations_108d469f_js__WEBPACK_IMPORTED_MODULE_4__["T"].EMPTY_USERNAME);
|
|
667
|
+
username = username.trim();
|
|
668
|
+
return [4
|
|
669
|
+
/*yield*/
|
|
670
|
+
, _aws_amplify_auth__WEBPACK_IMPORTED_MODULE_3__["Auth"].confirmSignUp(username, this.code)];
|
|
336
671
|
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
user: this.authData
|
|
340
|
-
});
|
|
672
|
+
case 2:
|
|
673
|
+
confirmSignUpResult = _a.sent();
|
|
341
674
|
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
});
|
|
675
|
+
if (!confirmSignUpResult) {
|
|
676
|
+
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
|
+
}
|
|
346
678
|
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
});
|
|
679
|
+
if (!(this._signUpAttrs && this._signUpAttrs.password && this._signUpAttrs.password !== '')) return [3
|
|
680
|
+
/*break*/
|
|
681
|
+
, 4]; // Auto sign in user if password is available from previous workflow
|
|
351
682
|
|
|
352
|
-
|
|
353
|
-
|
|
683
|
+
return [4
|
|
684
|
+
/*yield*/
|
|
685
|
+
, Object(_auth_helpers_557b83fc_js__WEBPACK_IMPORTED_MODULE_7__["h"])(username, this._signUpAttrs.password, this.handleAuthStateChange)];
|
|
354
686
|
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
}; // Returns a slot containing the Auth component corresponding to the given authState
|
|
687
|
+
case 3:
|
|
688
|
+
// Auto sign in user if password is available from previous workflow
|
|
689
|
+
_a.sent();
|
|
359
690
|
|
|
691
|
+
return [3
|
|
692
|
+
/*break*/
|
|
693
|
+
, 5];
|
|
360
694
|
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
var slotIsEmpty = this.el.querySelector("[slot=\"" + slotName + "\"]") === null; // true if no element has been inserted to the slot
|
|
695
|
+
case 4:
|
|
696
|
+
this.handleAuthStateChange(_auth_types_78df304e_js__WEBPACK_IMPORTED_MODULE_2__["A"].SignIn);
|
|
697
|
+
_a.label = 5;
|
|
365
698
|
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
699
|
+
case 5:
|
|
700
|
+
return [3
|
|
701
|
+
/*break*/
|
|
702
|
+
, 8];
|
|
370
703
|
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
704
|
+
case 6:
|
|
705
|
+
error_3 = _a.sent();
|
|
706
|
+
Object(_helpers_14fcb50c_js__WEBPACK_IMPORTED_MODULE_6__["a"])(error_3);
|
|
707
|
+
return [3
|
|
708
|
+
/*break*/
|
|
709
|
+
, 8];
|
|
710
|
+
|
|
711
|
+
case 7:
|
|
712
|
+
this.loading = false;
|
|
713
|
+
return [7
|
|
714
|
+
/*endfinally*/
|
|
715
|
+
];
|
|
375
716
|
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
717
|
+
case 8:
|
|
718
|
+
return [2
|
|
719
|
+
/*return*/
|
|
720
|
+
];
|
|
721
|
+
}
|
|
722
|
+
});
|
|
723
|
+
});
|
|
380
724
|
};
|
|
381
725
|
|
|
382
|
-
|
|
726
|
+
class_2.prototype.render = function () {
|
|
383
727
|
var _this = this;
|
|
384
728
|
|
|
385
|
-
return Object(_index_83f2275b_js__WEBPACK_IMPORTED_MODULE_0__["h"])(_index_83f2275b_js__WEBPACK_IMPORTED_MODULE_0__["H"], null,
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
"
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
729
|
+
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
|
+
headerText: _aws_amplify_core__WEBPACK_IMPORTED_MODULE_1__["I18n"].get(this.headerText),
|
|
731
|
+
submitButtonText: _aws_amplify_core__WEBPACK_IMPORTED_MODULE_1__["I18n"].get(this.submitButtonText),
|
|
732
|
+
handleSubmit: this.handleSubmit,
|
|
733
|
+
loading: this.loading,
|
|
734
|
+
secondaryFooterContent: Object(_index_83f2275b_js__WEBPACK_IMPORTED_MODULE_0__["h"])("div", null, Object(_index_83f2275b_js__WEBPACK_IMPORTED_MODULE_0__["h"])("span", null, Object(_index_83f2275b_js__WEBPACK_IMPORTED_MODULE_0__["h"])("amplify-button", {
|
|
735
|
+
variant: "anchor",
|
|
736
|
+
onClick: function onClick() {
|
|
737
|
+
return _this.handleAuthStateChange(_auth_types_78df304e_js__WEBPACK_IMPORTED_MODULE_2__["A"].SignIn);
|
|
738
|
+
}
|
|
739
|
+
}, _aws_amplify_core__WEBPACK_IMPORTED_MODULE_1__["I18n"].get(_Translations_108d469f_js__WEBPACK_IMPORTED_MODULE_4__["T"].BACK_TO_SIGN_IN))))
|
|
740
|
+
}, Object(_index_83f2275b_js__WEBPACK_IMPORTED_MODULE_0__["h"])("amplify-auth-fields", {
|
|
741
|
+
formFields: this.newFormFields
|
|
742
|
+
})));
|
|
396
743
|
};
|
|
397
744
|
|
|
398
|
-
Object.defineProperty(
|
|
745
|
+
Object.defineProperty(class_2, "watchers", {
|
|
399
746
|
get: function get() {
|
|
400
|
-
return
|
|
747
|
+
return {
|
|
748
|
+
"formFields": ["formFieldsHandler"],
|
|
749
|
+
"user": ["userHandler"]
|
|
750
|
+
};
|
|
401
751
|
},
|
|
402
752
|
enumerable: false,
|
|
403
753
|
configurable: true
|
|
404
754
|
});
|
|
405
|
-
return
|
|
755
|
+
return class_2;
|
|
756
|
+
}();
|
|
757
|
+
|
|
758
|
+
var logger = new _aws_amplify_core__WEBPACK_IMPORTED_MODULE_1__["Logger"]('ForgotPassword');
|
|
759
|
+
|
|
760
|
+
var AmplifyForgotPassword =
|
|
761
|
+
/** @class */
|
|
762
|
+
function () {
|
|
763
|
+
function class_3(hostRef) {
|
|
764
|
+
var _this = this;
|
|
765
|
+
|
|
766
|
+
Object(_index_83f2275b_js__WEBPACK_IMPORTED_MODULE_0__["r"])(this, hostRef);
|
|
767
|
+
/** The header text of the forgot password section */
|
|
768
|
+
|
|
769
|
+
this.headerText = _Translations_108d469f_js__WEBPACK_IMPORTED_MODULE_4__["T"].RESET_YOUR_PASSWORD;
|
|
770
|
+
/** The text displayed inside of the send code button for the form */
|
|
771
|
+
|
|
772
|
+
this.sendButtonText = _Translations_108d469f_js__WEBPACK_IMPORTED_MODULE_4__["T"].SEND_CODE;
|
|
773
|
+
/** The text displayed inside of the submit button for the form */
|
|
774
|
+
|
|
775
|
+
this.submitButtonText = _Translations_108d469f_js__WEBPACK_IMPORTED_MODULE_4__["T"].SUBMIT;
|
|
776
|
+
/** The form fields displayed inside of the forgot password form */
|
|
777
|
+
|
|
778
|
+
this.formFields = [];
|
|
779
|
+
/** The function called when making a request to reset password */
|
|
780
|
+
|
|
781
|
+
this.handleSend = function (event) {
|
|
782
|
+
return _this.send(event);
|
|
783
|
+
};
|
|
784
|
+
/** The function called when submitting a new password */
|
|
785
|
+
|
|
786
|
+
|
|
787
|
+
this.handleSubmit = function (event) {
|
|
788
|
+
return _this.submit(event);
|
|
789
|
+
};
|
|
790
|
+
/** Auth state change handler for this component */
|
|
791
|
+
|
|
792
|
+
|
|
793
|
+
this.handleAuthStateChange = _helpers_14fcb50c_js__WEBPACK_IMPORTED_MODULE_6__["d"];
|
|
794
|
+
/** Username Alias is used to setup authentication with `username`, `email` or `phone_number` */
|
|
795
|
+
|
|
796
|
+
this.usernameAlias = 'username';
|
|
797
|
+
this.delivery = null;
|
|
798
|
+
this.loading = false;
|
|
799
|
+
this.phoneNumber = {
|
|
800
|
+
countryDialCodeValue: _constants_c8ecaa24_js__WEBPACK_IMPORTED_MODULE_5__["g"],
|
|
801
|
+
phoneNumberValue: null
|
|
802
|
+
};
|
|
803
|
+
this.newFormFields = [];
|
|
804
|
+
this.forgotPasswordAttrs = {
|
|
805
|
+
userInput: '',
|
|
806
|
+
password: '',
|
|
807
|
+
code: ''
|
|
808
|
+
};
|
|
809
|
+
}
|
|
810
|
+
|
|
811
|
+
class_3.prototype.componentWillLoad = function () {
|
|
812
|
+
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
|
+
Object(_helpers_14fcb50c_js__WEBPACK_IMPORTED_MODULE_6__["c"])(this.usernameAlias);
|
|
814
|
+
this.buildFormFields();
|
|
815
|
+
};
|
|
816
|
+
|
|
817
|
+
class_3.prototype.formFieldsHandler = function () {
|
|
818
|
+
this.buildFormFields();
|
|
819
|
+
};
|
|
820
|
+
|
|
821
|
+
class_3.prototype.buildFormFields = function () {
|
|
822
|
+
var _this = this;
|
|
823
|
+
|
|
824
|
+
if (this.formFields.length === 0) {
|
|
825
|
+
this.buildDefaultFormFields();
|
|
826
|
+
} else {
|
|
827
|
+
var newFields_2 = [];
|
|
828
|
+
this.formFields.forEach(function (field) {
|
|
829
|
+
var newField = Object.assign({}, field);
|
|
830
|
+
|
|
831
|
+
newField['handleInputChange'] = function (event) {
|
|
832
|
+
return _this.handleFormFieldInputWithCallback(event, field);
|
|
833
|
+
};
|
|
834
|
+
|
|
835
|
+
newFields_2.push(newField);
|
|
836
|
+
});
|
|
837
|
+
this.newFormFields = newFields_2;
|
|
838
|
+
}
|
|
839
|
+
};
|
|
840
|
+
|
|
841
|
+
class_3.prototype.buildDefaultFormFields = function () {
|
|
842
|
+
switch (this.usernameAlias) {
|
|
843
|
+
case 'email':
|
|
844
|
+
this.newFormFields = [{
|
|
845
|
+
type: 'email',
|
|
846
|
+
required: true,
|
|
847
|
+
handleInputChange: this.handleFormFieldInputChange('email'),
|
|
848
|
+
inputProps: {
|
|
849
|
+
'data-test': 'forgot-password-email-input'
|
|
850
|
+
}
|
|
851
|
+
}];
|
|
852
|
+
break;
|
|
853
|
+
|
|
854
|
+
case 'phone_number':
|
|
855
|
+
this.newFormFields = [{
|
|
856
|
+
type: 'phone_number',
|
|
857
|
+
required: true,
|
|
858
|
+
handleInputChange: this.handleFormFieldInputChange('phone_number'),
|
|
859
|
+
inputProps: {
|
|
860
|
+
'data-test': 'forgot-password-phone-number-input'
|
|
861
|
+
}
|
|
862
|
+
}];
|
|
863
|
+
break;
|
|
864
|
+
|
|
865
|
+
case 'username':
|
|
866
|
+
default:
|
|
867
|
+
this.newFormFields = [{
|
|
868
|
+
type: 'username',
|
|
869
|
+
required: true,
|
|
870
|
+
handleInputChange: this.handleFormFieldInputChange('username'),
|
|
871
|
+
inputProps: {
|
|
872
|
+
'data-test': 'forgot-password-username-input'
|
|
873
|
+
}
|
|
874
|
+
}];
|
|
875
|
+
break;
|
|
876
|
+
}
|
|
877
|
+
};
|
|
878
|
+
|
|
879
|
+
class_3.prototype.handleFormFieldInputChange = function (fieldType) {
|
|
880
|
+
var _this = this;
|
|
881
|
+
|
|
882
|
+
switch (fieldType) {
|
|
883
|
+
case 'username':
|
|
884
|
+
case 'email':
|
|
885
|
+
return function (event) {
|
|
886
|
+
return _this.forgotPasswordAttrs.userInput = event.target.value;
|
|
887
|
+
};
|
|
888
|
+
|
|
889
|
+
case 'phone_number':
|
|
890
|
+
return function (event) {
|
|
891
|
+
return Object(_helpers_14fcb50c_js__WEBPACK_IMPORTED_MODULE_6__["h"])(event, _this.phoneNumber);
|
|
892
|
+
};
|
|
893
|
+
|
|
894
|
+
case 'password':
|
|
895
|
+
case 'code':
|
|
896
|
+
return function (event) {
|
|
897
|
+
return _this.forgotPasswordAttrs[fieldType] = event.target.value;
|
|
898
|
+
};
|
|
899
|
+
|
|
900
|
+
default:
|
|
901
|
+
return;
|
|
902
|
+
}
|
|
903
|
+
};
|
|
904
|
+
|
|
905
|
+
class_3.prototype.setFieldValue = function (field, formAttributes) {
|
|
906
|
+
switch (field.type) {
|
|
907
|
+
case 'username':
|
|
908
|
+
case 'email':
|
|
909
|
+
if (field.value === undefined) {
|
|
910
|
+
formAttributes.userInput = '';
|
|
911
|
+
} else {
|
|
912
|
+
formAttributes.userInput = field.value;
|
|
913
|
+
}
|
|
914
|
+
|
|
915
|
+
break;
|
|
916
|
+
|
|
917
|
+
case 'phone_number':
|
|
918
|
+
if (field.dialCode) {
|
|
919
|
+
this.phoneNumber.countryDialCodeValue = field.dialCode;
|
|
920
|
+
}
|
|
921
|
+
|
|
922
|
+
this.phoneNumber.phoneNumberValue = field.value;
|
|
923
|
+
break;
|
|
924
|
+
|
|
925
|
+
case 'password':
|
|
926
|
+
case 'code':
|
|
927
|
+
if (field.value === undefined) {
|
|
928
|
+
formAttributes[field.type] = '';
|
|
929
|
+
} else {
|
|
930
|
+
formAttributes[field.type] = field.value;
|
|
931
|
+
}
|
|
932
|
+
|
|
933
|
+
break;
|
|
934
|
+
}
|
|
935
|
+
};
|
|
936
|
+
|
|
937
|
+
class_3.prototype.handleFormFieldInputWithCallback = function (event, field) {
|
|
938
|
+
var fnToCall = field['handleInputChange'] ? field['handleInputChange'] : function (event, cb) {
|
|
939
|
+
cb(event);
|
|
940
|
+
};
|
|
941
|
+
var callback = this.handleFormFieldInputChange(field.type);
|
|
942
|
+
fnToCall(event, callback.bind(this));
|
|
943
|
+
};
|
|
944
|
+
|
|
945
|
+
class_3.prototype.send = function (event) {
|
|
946
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
947
|
+
var data, error_4;
|
|
948
|
+
return __generator(this, function (_a) {
|
|
949
|
+
switch (_a.label) {
|
|
950
|
+
case 0:
|
|
951
|
+
if (event) {
|
|
952
|
+
event.preventDefault();
|
|
953
|
+
}
|
|
954
|
+
|
|
955
|
+
if (!_aws_amplify_auth__WEBPACK_IMPORTED_MODULE_3__["Auth"] || typeof _aws_amplify_auth__WEBPACK_IMPORTED_MODULE_3__["Auth"].forgotPassword !== 'function') {
|
|
956
|
+
throw new Error(_constants_c8ecaa24_js__WEBPACK_IMPORTED_MODULE_5__["N"]);
|
|
957
|
+
}
|
|
958
|
+
|
|
959
|
+
this.loading = true;
|
|
960
|
+
|
|
961
|
+
switch (this.usernameAlias) {
|
|
962
|
+
case 'phone_number':
|
|
963
|
+
try {
|
|
964
|
+
this.forgotPasswordAttrs.userInput = Object(_helpers_14fcb50c_js__WEBPACK_IMPORTED_MODULE_6__["b"])(this.phoneNumber);
|
|
965
|
+
} catch (error) {
|
|
966
|
+
Object(_helpers_14fcb50c_js__WEBPACK_IMPORTED_MODULE_6__["a"])(error);
|
|
967
|
+
}
|
|
968
|
+
|
|
969
|
+
break;
|
|
970
|
+
}
|
|
971
|
+
|
|
972
|
+
_a.label = 1;
|
|
973
|
+
|
|
974
|
+
case 1:
|
|
975
|
+
_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
|
+
|
|
981
|
+
case 2:
|
|
982
|
+
data = _a.sent();
|
|
983
|
+
logger.debug(data);
|
|
984
|
+
this.newFormFields = [{
|
|
985
|
+
type: 'code',
|
|
986
|
+
required: true,
|
|
987
|
+
handleInputChange: this.handleFormFieldInputChange('code'),
|
|
988
|
+
inputProps: {
|
|
989
|
+
'data-test': 'forgot-password-code-input'
|
|
990
|
+
}
|
|
991
|
+
}, {
|
|
992
|
+
type: 'password',
|
|
993
|
+
required: true,
|
|
994
|
+
handleInputChange: this.handleFormFieldInputChange('password'),
|
|
995
|
+
label: _aws_amplify_core__WEBPACK_IMPORTED_MODULE_1__["I18n"].get(_Translations_108d469f_js__WEBPACK_IMPORTED_MODULE_4__["T"].NEW_PASSWORD_LABEL),
|
|
996
|
+
placeholder: _aws_amplify_core__WEBPACK_IMPORTED_MODULE_1__["I18n"].get(_Translations_108d469f_js__WEBPACK_IMPORTED_MODULE_4__["T"].NEW_PASSWORD_PLACEHOLDER)
|
|
997
|
+
}];
|
|
998
|
+
this.delivery = data.CodeDeliveryDetails;
|
|
999
|
+
return [3
|
|
1000
|
+
/*break*/
|
|
1001
|
+
, 5];
|
|
1002
|
+
|
|
1003
|
+
case 3:
|
|
1004
|
+
error_4 = _a.sent();
|
|
1005
|
+
Object(_helpers_14fcb50c_js__WEBPACK_IMPORTED_MODULE_6__["a"])(error_4);
|
|
1006
|
+
return [3
|
|
1007
|
+
/*break*/
|
|
1008
|
+
, 5];
|
|
1009
|
+
|
|
1010
|
+
case 4:
|
|
1011
|
+
this.loading = false;
|
|
1012
|
+
return [7
|
|
1013
|
+
/*endfinally*/
|
|
1014
|
+
];
|
|
1015
|
+
|
|
1016
|
+
case 5:
|
|
1017
|
+
return [2
|
|
1018
|
+
/*return*/
|
|
1019
|
+
];
|
|
1020
|
+
}
|
|
1021
|
+
});
|
|
1022
|
+
});
|
|
1023
|
+
};
|
|
1024
|
+
|
|
1025
|
+
class_3.prototype.submit = function (event) {
|
|
1026
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
1027
|
+
var _a, userInput, code, password, data, error_5;
|
|
1028
|
+
|
|
1029
|
+
return __generator(this, function (_b) {
|
|
1030
|
+
switch (_b.label) {
|
|
1031
|
+
case 0:
|
|
1032
|
+
if (event) {
|
|
1033
|
+
event.preventDefault();
|
|
1034
|
+
}
|
|
1035
|
+
|
|
1036
|
+
if (!_aws_amplify_auth__WEBPACK_IMPORTED_MODULE_3__["Auth"] || typeof _aws_amplify_auth__WEBPACK_IMPORTED_MODULE_3__["Auth"].forgotPasswordSubmit !== 'function') {
|
|
1037
|
+
throw new Error(_constants_c8ecaa24_js__WEBPACK_IMPORTED_MODULE_5__["N"]);
|
|
1038
|
+
}
|
|
1039
|
+
|
|
1040
|
+
this.loading = true;
|
|
1041
|
+
_b.label = 1;
|
|
1042
|
+
|
|
1043
|
+
case 1:
|
|
1044
|
+
_b.trys.push([1, 3, 4, 5]);
|
|
1045
|
+
|
|
1046
|
+
_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
|
+
|
|
1051
|
+
case 2:
|
|
1052
|
+
data = _b.sent();
|
|
1053
|
+
logger.debug(data);
|
|
1054
|
+
this.handleAuthStateChange(_auth_types_78df304e_js__WEBPACK_IMPORTED_MODULE_2__["A"].SignIn);
|
|
1055
|
+
this.delivery = null;
|
|
1056
|
+
return [3
|
|
1057
|
+
/*break*/
|
|
1058
|
+
, 5];
|
|
1059
|
+
|
|
1060
|
+
case 3:
|
|
1061
|
+
error_5 = _b.sent();
|
|
1062
|
+
Object(_helpers_14fcb50c_js__WEBPACK_IMPORTED_MODULE_6__["a"])(error_5);
|
|
1063
|
+
return [3
|
|
1064
|
+
/*break*/
|
|
1065
|
+
, 5];
|
|
1066
|
+
|
|
1067
|
+
case 4:
|
|
1068
|
+
this.loading = false;
|
|
1069
|
+
return [7
|
|
1070
|
+
/*endfinally*/
|
|
1071
|
+
];
|
|
1072
|
+
|
|
1073
|
+
case 5:
|
|
1074
|
+
return [2
|
|
1075
|
+
/*return*/
|
|
1076
|
+
];
|
|
1077
|
+
}
|
|
1078
|
+
});
|
|
1079
|
+
});
|
|
1080
|
+
};
|
|
1081
|
+
|
|
1082
|
+
class_3.prototype.render = function () {
|
|
1083
|
+
var _this = this;
|
|
1084
|
+
|
|
1085
|
+
var submitFn = this.delivery ? function (event) {
|
|
1086
|
+
return _this.handleSubmit(event);
|
|
1087
|
+
} : function (event) {
|
|
1088
|
+
return _this.handleSend(event);
|
|
1089
|
+
};
|
|
1090
|
+
var submitButtonText = this.delivery ? this.submitButtonText : this.sendButtonText;
|
|
1091
|
+
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", {
|
|
1092
|
+
headerText: _aws_amplify_core__WEBPACK_IMPORTED_MODULE_1__["I18n"].get(this.headerText),
|
|
1093
|
+
handleSubmit: submitFn,
|
|
1094
|
+
loading: this.loading,
|
|
1095
|
+
secondaryFooterContent: Object(_index_83f2275b_js__WEBPACK_IMPORTED_MODULE_0__["h"])("amplify-button", {
|
|
1096
|
+
variant: "anchor",
|
|
1097
|
+
onClick: function onClick() {
|
|
1098
|
+
return _this.handleAuthStateChange(_auth_types_78df304e_js__WEBPACK_IMPORTED_MODULE_2__["A"].SignIn);
|
|
1099
|
+
},
|
|
1100
|
+
"data-test": "forgot-password-back-to-sign-in-link"
|
|
1101
|
+
}, _aws_amplify_core__WEBPACK_IMPORTED_MODULE_1__["I18n"].get(_Translations_108d469f_js__WEBPACK_IMPORTED_MODULE_4__["T"].BACK_TO_SIGN_IN)),
|
|
1102
|
+
testDataPrefix: 'forgot-password',
|
|
1103
|
+
submitButtonText: _aws_amplify_core__WEBPACK_IMPORTED_MODULE_1__["I18n"].get(submitButtonText)
|
|
1104
|
+
}, Object(_index_83f2275b_js__WEBPACK_IMPORTED_MODULE_0__["h"])("amplify-auth-fields", {
|
|
1105
|
+
formFields: this.newFormFields
|
|
1106
|
+
})));
|
|
1107
|
+
};
|
|
1108
|
+
|
|
1109
|
+
Object.defineProperty(class_3, "watchers", {
|
|
1110
|
+
get: function get() {
|
|
1111
|
+
return {
|
|
1112
|
+
"formFields": ["formFieldsHandler"]
|
|
1113
|
+
};
|
|
1114
|
+
},
|
|
1115
|
+
enumerable: false,
|
|
1116
|
+
configurable: true
|
|
1117
|
+
});
|
|
1118
|
+
return class_3;
|
|
1119
|
+
}();
|
|
1120
|
+
|
|
1121
|
+
var logger$1 = new _aws_amplify_core__WEBPACK_IMPORTED_MODULE_1__["ConsoleLogger"]('amplify-require-new-password');
|
|
1122
|
+
|
|
1123
|
+
var AmplifyRequireNewPassword =
|
|
1124
|
+
/** @class */
|
|
1125
|
+
function () {
|
|
1126
|
+
function class_4(hostRef) {
|
|
1127
|
+
var _this = this;
|
|
1128
|
+
|
|
1129
|
+
Object(_index_83f2275b_js__WEBPACK_IMPORTED_MODULE_0__["r"])(this, hostRef);
|
|
1130
|
+
/** The header text of the forgot password section */
|
|
1131
|
+
|
|
1132
|
+
this.headerText = _Translations_108d469f_js__WEBPACK_IMPORTED_MODULE_4__["T"].CHANGE_PASSWORD;
|
|
1133
|
+
/** The text displayed inside of the submit button for the form */
|
|
1134
|
+
|
|
1135
|
+
this.submitButtonText = _Translations_108d469f_js__WEBPACK_IMPORTED_MODULE_4__["T"].CHANGE_PASSWORD_ACTION;
|
|
1136
|
+
/** The function called when submitting a new password */
|
|
1137
|
+
|
|
1138
|
+
this.handleSubmit = function (event) {
|
|
1139
|
+
return _this.completeNewPassword(event);
|
|
1140
|
+
};
|
|
1141
|
+
/** Auth state change handler for this component */
|
|
1142
|
+
|
|
1143
|
+
|
|
1144
|
+
this.handleAuthStateChange = _helpers_14fcb50c_js__WEBPACK_IMPORTED_MODULE_6__["d"];
|
|
1145
|
+
/** The form fields displayed inside of the forgot password form */
|
|
1146
|
+
|
|
1147
|
+
this.formFields = [{
|
|
1148
|
+
type: _auth_types_78df304e_js__WEBPACK_IMPORTED_MODULE_2__["a"].Password,
|
|
1149
|
+
required: true,
|
|
1150
|
+
handleInputChange: function handleInputChange(event) {
|
|
1151
|
+
return _this.handlePasswordChange(event);
|
|
1152
|
+
},
|
|
1153
|
+
label: _aws_amplify_core__WEBPACK_IMPORTED_MODULE_1__["I18n"].get(_Translations_108d469f_js__WEBPACK_IMPORTED_MODULE_4__["T"].NEW_PASSWORD_LABEL),
|
|
1154
|
+
placeholder: _aws_amplify_core__WEBPACK_IMPORTED_MODULE_1__["I18n"].get(_Translations_108d469f_js__WEBPACK_IMPORTED_MODULE_4__["T"].NEW_PASSWORD_PLACEHOLDER),
|
|
1155
|
+
inputProps: {
|
|
1156
|
+
'data-test': 'require-new-password-password-input'
|
|
1157
|
+
}
|
|
1158
|
+
}];
|
|
1159
|
+
this.loading = false;
|
|
1160
|
+
this.requiredAttributes = {};
|
|
1161
|
+
this.newFormFields = this.formFields;
|
|
1162
|
+
this.phoneNumber = {
|
|
1163
|
+
countryDialCodeValue: _constants_c8ecaa24_js__WEBPACK_IMPORTED_MODULE_5__["g"],
|
|
1164
|
+
phoneNumberValue: ' '
|
|
1165
|
+
};
|
|
1166
|
+
}
|
|
1167
|
+
|
|
1168
|
+
class_4.prototype.userHandler = function () {
|
|
1169
|
+
this.setCurrentUser();
|
|
1170
|
+
};
|
|
1171
|
+
|
|
1172
|
+
class_4.prototype.handleRequiredAttributeInputChange = function (attribute, event) {
|
|
1173
|
+
if (attribute === 'phone_number') {
|
|
1174
|
+
this.formatPhoneNumber(event);
|
|
1175
|
+
} else {
|
|
1176
|
+
this.requiredAttributes[attribute] = event.target.value;
|
|
1177
|
+
}
|
|
1178
|
+
};
|
|
1179
|
+
|
|
1180
|
+
class_4.prototype.setCurrentUser = function () {
|
|
1181
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
1182
|
+
var user, error_6, userRequiredAttributes, requiredAttributesMap_1;
|
|
1183
|
+
|
|
1184
|
+
var _this = this;
|
|
1185
|
+
|
|
1186
|
+
return __generator(this, function (_a) {
|
|
1187
|
+
switch (_a.label) {
|
|
1188
|
+
case 0:
|
|
1189
|
+
if (!!this.user) return [3
|
|
1190
|
+
/*break*/
|
|
1191
|
+
, 5];
|
|
1192
|
+
_a.label = 1;
|
|
1193
|
+
|
|
1194
|
+
case 1:
|
|
1195
|
+
_a.trys.push([1, 3,, 4]);
|
|
1196
|
+
|
|
1197
|
+
return [4
|
|
1198
|
+
/*yield*/
|
|
1199
|
+
, _aws_amplify_auth__WEBPACK_IMPORTED_MODULE_3__["Auth"].currentAuthenticatedUser()];
|
|
1200
|
+
|
|
1201
|
+
case 2:
|
|
1202
|
+
user = _a.sent();
|
|
1203
|
+
if (user) this.currentUser = user;
|
|
1204
|
+
return [3
|
|
1205
|
+
/*break*/
|
|
1206
|
+
, 4];
|
|
1207
|
+
|
|
1208
|
+
case 3:
|
|
1209
|
+
error_6 = _a.sent();
|
|
1210
|
+
Object(_helpers_14fcb50c_js__WEBPACK_IMPORTED_MODULE_6__["a"])(error_6);
|
|
1211
|
+
return [3
|
|
1212
|
+
/*break*/
|
|
1213
|
+
, 4];
|
|
1214
|
+
|
|
1215
|
+
case 4:
|
|
1216
|
+
return [3
|
|
1217
|
+
/*break*/
|
|
1218
|
+
, 6];
|
|
1219
|
+
|
|
1220
|
+
case 5:
|
|
1221
|
+
this.currentUser = this.user;
|
|
1222
|
+
_a.label = 6;
|
|
1223
|
+
|
|
1224
|
+
case 6:
|
|
1225
|
+
if (this.currentUser && this.currentUser.challengeParam && this.currentUser.challengeParam.requiredAttributes) {
|
|
1226
|
+
userRequiredAttributes = this.currentUser.challengeParam.requiredAttributes;
|
|
1227
|
+
requiredAttributesMap_1 = Object(_helpers_14fcb50c_js__WEBPACK_IMPORTED_MODULE_6__["g"])();
|
|
1228
|
+
userRequiredAttributes.forEach(function (attribute) {
|
|
1229
|
+
var formField = {
|
|
1230
|
+
type: attribute,
|
|
1231
|
+
required: true,
|
|
1232
|
+
label: requiredAttributesMap_1[attribute].label,
|
|
1233
|
+
placeholder: requiredAttributesMap_1[attribute].placeholder,
|
|
1234
|
+
handleInputChange: function handleInputChange(event) {
|
|
1235
|
+
return _this.handleRequiredAttributeInputChange(attribute, event);
|
|
1236
|
+
},
|
|
1237
|
+
inputProps: {
|
|
1238
|
+
'data-test': "require-new-password-" + attribute + "-input"
|
|
1239
|
+
}
|
|
1240
|
+
};
|
|
1241
|
+
_this.newFormFields = __spreadArrays(_this.newFormFields, [formField]);
|
|
1242
|
+
});
|
|
1243
|
+
}
|
|
1244
|
+
|
|
1245
|
+
return [2
|
|
1246
|
+
/*return*/
|
|
1247
|
+
];
|
|
1248
|
+
}
|
|
1249
|
+
});
|
|
1250
|
+
});
|
|
1251
|
+
};
|
|
1252
|
+
|
|
1253
|
+
class_4.prototype.componentWillLoad = function () {
|
|
1254
|
+
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
|
+
return this.setCurrentUser();
|
|
1256
|
+
};
|
|
1257
|
+
|
|
1258
|
+
class_4.prototype.handlePasswordChange = function (event) {
|
|
1259
|
+
this.password = event.target.value;
|
|
1260
|
+
};
|
|
1261
|
+
|
|
1262
|
+
class_4.prototype.formatPhoneNumber = function (event) {
|
|
1263
|
+
Object(_helpers_14fcb50c_js__WEBPACK_IMPORTED_MODULE_6__["h"])(event, this.phoneNumber);
|
|
1264
|
+
/**
|
|
1265
|
+
* composePhoneNumberInput will throw an error if the phoneNumberValue it receives
|
|
1266
|
+
* is empty. Adding a check here to try and make sure that doesn't happen...but will
|
|
1267
|
+
* wrap it in a try/catch block just in case as well
|
|
1268
|
+
*/
|
|
1269
|
+
|
|
1270
|
+
try {
|
|
1271
|
+
if (event.target.name === _constants_c8ecaa24_js__WEBPACK_IMPORTED_MODULE_5__["b"] && this.phoneNumber.phoneNumberValue) {
|
|
1272
|
+
var composedInput = Object(_helpers_14fcb50c_js__WEBPACK_IMPORTED_MODULE_6__["b"])(this.phoneNumber);
|
|
1273
|
+
this.requiredAttributes['phone_number'] = composedInput;
|
|
1274
|
+
}
|
|
1275
|
+
} catch (err) {
|
|
1276
|
+
logger$1.error("error in phone number field - " + err);
|
|
1277
|
+
}
|
|
1278
|
+
};
|
|
1279
|
+
|
|
1280
|
+
class_4.prototype.completeNewPassword = function (event) {
|
|
1281
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
1282
|
+
var user, _a, error_7;
|
|
1283
|
+
|
|
1284
|
+
return __generator(this, function (_b) {
|
|
1285
|
+
switch (_b.label) {
|
|
1286
|
+
case 0:
|
|
1287
|
+
if (event) {
|
|
1288
|
+
event.preventDefault();
|
|
1289
|
+
}
|
|
1290
|
+
|
|
1291
|
+
if (!_aws_amplify_auth__WEBPACK_IMPORTED_MODULE_3__["Auth"] || typeof _aws_amplify_auth__WEBPACK_IMPORTED_MODULE_3__["Auth"].completeNewPassword !== 'function') {
|
|
1292
|
+
throw new Error(_constants_c8ecaa24_js__WEBPACK_IMPORTED_MODULE_5__["N"]);
|
|
1293
|
+
}
|
|
1294
|
+
|
|
1295
|
+
this.loading = true;
|
|
1296
|
+
_b.label = 1;
|
|
1297
|
+
|
|
1298
|
+
case 1:
|
|
1299
|
+
_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
|
+
|
|
1305
|
+
case 2:
|
|
1306
|
+
user = _b.sent();
|
|
1307
|
+
logger$1.debug('complete new password', user);
|
|
1308
|
+
_a = user.challengeName;
|
|
1309
|
+
|
|
1310
|
+
switch (_a) {
|
|
1311
|
+
case _auth_types_78df304e_js__WEBPACK_IMPORTED_MODULE_2__["C"].SMSMFA:
|
|
1312
|
+
return [3
|
|
1313
|
+
/*break*/
|
|
1314
|
+
, 3];
|
|
1315
|
+
|
|
1316
|
+
case _auth_types_78df304e_js__WEBPACK_IMPORTED_MODULE_2__["C"].MFASetup:
|
|
1317
|
+
return [3
|
|
1318
|
+
/*break*/
|
|
1319
|
+
, 4];
|
|
1320
|
+
}
|
|
1321
|
+
|
|
1322
|
+
return [3
|
|
1323
|
+
/*break*/
|
|
1324
|
+
, 5];
|
|
1325
|
+
|
|
1326
|
+
case 3:
|
|
1327
|
+
this.handleAuthStateChange(_auth_types_78df304e_js__WEBPACK_IMPORTED_MODULE_2__["A"].ConfirmSignIn, user);
|
|
1328
|
+
return [3
|
|
1329
|
+
/*break*/
|
|
1330
|
+
, 7];
|
|
1331
|
+
|
|
1332
|
+
case 4:
|
|
1333
|
+
logger$1.debug('TOTP setup', user.challengeParam);
|
|
1334
|
+
this.handleAuthStateChange(_auth_types_78df304e_js__WEBPACK_IMPORTED_MODULE_2__["A"].TOTPSetup, user);
|
|
1335
|
+
return [3
|
|
1336
|
+
/*break*/
|
|
1337
|
+
, 7];
|
|
1338
|
+
|
|
1339
|
+
case 5:
|
|
1340
|
+
return [4
|
|
1341
|
+
/*yield*/
|
|
1342
|
+
, Object(_auth_helpers_557b83fc_js__WEBPACK_IMPORTED_MODULE_7__["c"])(user, this.handleAuthStateChange)];
|
|
1343
|
+
|
|
1344
|
+
case 6:
|
|
1345
|
+
_b.sent();
|
|
1346
|
+
|
|
1347
|
+
_b.label = 7;
|
|
1348
|
+
|
|
1349
|
+
case 7:
|
|
1350
|
+
return [3
|
|
1351
|
+
/*break*/
|
|
1352
|
+
, 10];
|
|
1353
|
+
|
|
1354
|
+
case 8:
|
|
1355
|
+
error_7 = _b.sent();
|
|
1356
|
+
Object(_helpers_14fcb50c_js__WEBPACK_IMPORTED_MODULE_6__["a"])(error_7);
|
|
1357
|
+
return [3
|
|
1358
|
+
/*break*/
|
|
1359
|
+
, 10];
|
|
1360
|
+
|
|
1361
|
+
case 9:
|
|
1362
|
+
this.loading = false;
|
|
1363
|
+
return [7
|
|
1364
|
+
/*endfinally*/
|
|
1365
|
+
];
|
|
1366
|
+
|
|
1367
|
+
case 10:
|
|
1368
|
+
return [2
|
|
1369
|
+
/*return*/
|
|
1370
|
+
];
|
|
1371
|
+
}
|
|
1372
|
+
});
|
|
1373
|
+
});
|
|
1374
|
+
};
|
|
1375
|
+
|
|
1376
|
+
class_4.prototype.render = function () {
|
|
1377
|
+
var _this = this;
|
|
1378
|
+
|
|
1379
|
+
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
|
+
headerText: _aws_amplify_core__WEBPACK_IMPORTED_MODULE_1__["I18n"].get(this.headerText),
|
|
1381
|
+
handleSubmit: this.handleSubmit,
|
|
1382
|
+
loading: this.loading,
|
|
1383
|
+
secondaryFooterContent: Object(_index_83f2275b_js__WEBPACK_IMPORTED_MODULE_0__["h"])("amplify-button", {
|
|
1384
|
+
variant: "anchor",
|
|
1385
|
+
onClick: function onClick() {
|
|
1386
|
+
return _this.handleAuthStateChange(_auth_types_78df304e_js__WEBPACK_IMPORTED_MODULE_2__["A"].SignIn);
|
|
1387
|
+
}
|
|
1388
|
+
}, _aws_amplify_core__WEBPACK_IMPORTED_MODULE_1__["I18n"].get(_Translations_108d469f_js__WEBPACK_IMPORTED_MODULE_4__["T"].BACK_TO_SIGN_IN)),
|
|
1389
|
+
submitButtonText: _aws_amplify_core__WEBPACK_IMPORTED_MODULE_1__["I18n"].get(this.submitButtonText)
|
|
1390
|
+
}, Object(_index_83f2275b_js__WEBPACK_IMPORTED_MODULE_0__["h"])("amplify-auth-fields", {
|
|
1391
|
+
formFields: this.newFormFields
|
|
1392
|
+
})));
|
|
1393
|
+
};
|
|
1394
|
+
|
|
1395
|
+
Object.defineProperty(class_4, "watchers", {
|
|
1396
|
+
get: function get() {
|
|
1397
|
+
return {
|
|
1398
|
+
"user": ["userHandler"]
|
|
1399
|
+
};
|
|
1400
|
+
},
|
|
1401
|
+
enumerable: false,
|
|
1402
|
+
configurable: true
|
|
1403
|
+
});
|
|
1404
|
+
return class_4;
|
|
1405
|
+
}();
|
|
1406
|
+
|
|
1407
|
+
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 () {
|
|
1412
|
+
function class_5(hostRef) {
|
|
1413
|
+
var _this = this;
|
|
1414
|
+
|
|
1415
|
+
Object(_index_83f2275b_js__WEBPACK_IMPORTED_MODULE_0__["r"])(this, hostRef);
|
|
1416
|
+
/** Fires when sign in form is submitted */
|
|
1417
|
+
|
|
1418
|
+
this.handleSubmit = function (event) {
|
|
1419
|
+
return _this.signIn(event);
|
|
1420
|
+
};
|
|
1421
|
+
/** Used for header text in sign in component */
|
|
1422
|
+
|
|
1423
|
+
|
|
1424
|
+
this.headerText = _Translations_108d469f_js__WEBPACK_IMPORTED_MODULE_4__["T"].SIGN_IN_HEADER_TEXT;
|
|
1425
|
+
/** Used for the submit button text in sign in component */
|
|
1426
|
+
|
|
1427
|
+
this.submitButtonText = _Translations_108d469f_js__WEBPACK_IMPORTED_MODULE_4__["T"].SIGN_IN_ACTION;
|
|
1428
|
+
/** Auth state change handler for this component */
|
|
1429
|
+
// prettier-ignore
|
|
1430
|
+
|
|
1431
|
+
this.handleAuthStateChange = _helpers_14fcb50c_js__WEBPACK_IMPORTED_MODULE_6__["d"];
|
|
1432
|
+
/** Username Alias is used to setup authentication with `username`, `email` or `phone_number` */
|
|
1433
|
+
|
|
1434
|
+
this.usernameAlias = 'username';
|
|
1435
|
+
/**
|
|
1436
|
+
* Form fields allows you to utilize our pre-built components such as username field, code field, password field, email field, etc.
|
|
1437
|
+
* by passing an array of strings that you would like the order of the form to be in. If you need more customization, such as changing
|
|
1438
|
+
* text for a label or adjust a placeholder, you can follow the structure below in order to do just that.
|
|
1439
|
+
* ```
|
|
1440
|
+
* [
|
|
1441
|
+
* {
|
|
1442
|
+
* type: string,
|
|
1443
|
+
* label: string,
|
|
1444
|
+
* placeholder: string,
|
|
1445
|
+
* hint: string | Functional Component | null,
|
|
1446
|
+
* required: boolean
|
|
1447
|
+
* }
|
|
1448
|
+
* ]
|
|
1449
|
+
* ```
|
|
1450
|
+
*/
|
|
1451
|
+
|
|
1452
|
+
this.formFields = [];
|
|
1453
|
+
/** Hides the sign up link */
|
|
1454
|
+
|
|
1455
|
+
this.hideSignUp = false;
|
|
1456
|
+
this.newFormFields = [];
|
|
1457
|
+
/* Whether or not the sign-in component is loading */
|
|
1458
|
+
|
|
1459
|
+
this.loading = false;
|
|
1460
|
+
this.phoneNumber = {
|
|
1461
|
+
countryDialCodeValue: _constants_c8ecaa24_js__WEBPACK_IMPORTED_MODULE_5__["g"],
|
|
1462
|
+
phoneNumberValue: null
|
|
1463
|
+
};
|
|
1464
|
+
this.signInAttributes = {
|
|
1465
|
+
userInput: '',
|
|
1466
|
+
password: ''
|
|
1467
|
+
};
|
|
1468
|
+
}
|
|
1469
|
+
|
|
1470
|
+
class_5.prototype.componentWillLoad = function () {
|
|
1471
|
+
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
|
+
Object(_helpers_14fcb50c_js__WEBPACK_IMPORTED_MODULE_6__["c"])(this.usernameAlias);
|
|
1473
|
+
this.buildFormFields();
|
|
1474
|
+
};
|
|
1475
|
+
|
|
1476
|
+
class_5.prototype.formFieldsHandler = function () {
|
|
1477
|
+
this.buildFormFields();
|
|
1478
|
+
};
|
|
1479
|
+
|
|
1480
|
+
class_5.prototype.handleFormFieldInputChange = function (fieldType) {
|
|
1481
|
+
var _this = this;
|
|
1482
|
+
|
|
1483
|
+
switch (fieldType) {
|
|
1484
|
+
case 'username':
|
|
1485
|
+
case 'email':
|
|
1486
|
+
return function (event) {
|
|
1487
|
+
return _this.signInAttributes.userInput = event.target.value;
|
|
1488
|
+
};
|
|
1489
|
+
|
|
1490
|
+
case 'phone_number':
|
|
1491
|
+
return function (event) {
|
|
1492
|
+
return Object(_helpers_14fcb50c_js__WEBPACK_IMPORTED_MODULE_6__["h"])(event, _this.phoneNumber);
|
|
1493
|
+
};
|
|
1494
|
+
|
|
1495
|
+
case 'password':
|
|
1496
|
+
return function (event) {
|
|
1497
|
+
return _this.signInAttributes.password = event.target.value;
|
|
1498
|
+
};
|
|
1499
|
+
|
|
1500
|
+
default:
|
|
1501
|
+
return function () {};
|
|
1502
|
+
}
|
|
1503
|
+
};
|
|
1504
|
+
|
|
1505
|
+
class_5.prototype.handleFormFieldInputWithCallback = function (event, field) {
|
|
1506
|
+
var fnToCall = field['handleInputChange'] ? field['handleInputChange'] : function (event, cb) {
|
|
1507
|
+
cb(event);
|
|
1508
|
+
};
|
|
1509
|
+
var callback = this.handleFormFieldInputChange(field.type);
|
|
1510
|
+
fnToCall(event, callback.bind(this));
|
|
1511
|
+
};
|
|
1512
|
+
|
|
1513
|
+
class_5.prototype.signIn = function (event) {
|
|
1514
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
1515
|
+
var username;
|
|
1516
|
+
return __generator(this, function (_a) {
|
|
1517
|
+
switch (_a.label) {
|
|
1518
|
+
case 0:
|
|
1519
|
+
// avoid submitting the form
|
|
1520
|
+
if (event) {
|
|
1521
|
+
event.preventDefault();
|
|
1522
|
+
}
|
|
1523
|
+
|
|
1524
|
+
this.loading = true;
|
|
1525
|
+
|
|
1526
|
+
switch (this.usernameAlias) {
|
|
1527
|
+
case 'phone_number':
|
|
1528
|
+
try {
|
|
1529
|
+
this.signInAttributes.userInput = Object(_helpers_14fcb50c_js__WEBPACK_IMPORTED_MODULE_6__["b"])(this.phoneNumber);
|
|
1530
|
+
} catch (error) {
|
|
1531
|
+
Object(_helpers_14fcb50c_js__WEBPACK_IMPORTED_MODULE_6__["a"])(error);
|
|
1532
|
+
}
|
|
1533
|
+
|
|
1534
|
+
}
|
|
1535
|
+
|
|
1536
|
+
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
|
+
|
|
1541
|
+
case 1:
|
|
1542
|
+
_a.sent();
|
|
1543
|
+
|
|
1544
|
+
this.loading = false;
|
|
1545
|
+
return [2
|
|
1546
|
+
/*return*/
|
|
1547
|
+
];
|
|
1548
|
+
}
|
|
1549
|
+
});
|
|
1550
|
+
});
|
|
1551
|
+
};
|
|
1552
|
+
|
|
1553
|
+
class_5.prototype.buildDefaultFormFields = function () {
|
|
1554
|
+
var _this = this;
|
|
1555
|
+
|
|
1556
|
+
var formFieldInputs = [];
|
|
1557
|
+
|
|
1558
|
+
switch (this.usernameAlias) {
|
|
1559
|
+
case 'email':
|
|
1560
|
+
formFieldInputs.push({
|
|
1561
|
+
type: 'email',
|
|
1562
|
+
required: true,
|
|
1563
|
+
handleInputChange: this.handleFormFieldInputChange('email'),
|
|
1564
|
+
inputProps: {
|
|
1565
|
+
'data-test': 'sign-in-email-input',
|
|
1566
|
+
autocomplete: 'username'
|
|
1567
|
+
}
|
|
1568
|
+
});
|
|
1569
|
+
break;
|
|
1570
|
+
|
|
1571
|
+
case 'phone_number':
|
|
1572
|
+
formFieldInputs.push({
|
|
1573
|
+
type: 'phone_number',
|
|
1574
|
+
required: true,
|
|
1575
|
+
handleInputChange: this.handleFormFieldInputChange('phone_number'),
|
|
1576
|
+
inputProps: {
|
|
1577
|
+
'data-test': 'sign-in-phone-number-input',
|
|
1578
|
+
autocomplete: 'username'
|
|
1579
|
+
}
|
|
1580
|
+
});
|
|
1581
|
+
break;
|
|
1582
|
+
|
|
1583
|
+
case 'username':
|
|
1584
|
+
default:
|
|
1585
|
+
formFieldInputs.push({
|
|
1586
|
+
type: 'username',
|
|
1587
|
+
required: true,
|
|
1588
|
+
handleInputChange: this.handleFormFieldInputChange('username'),
|
|
1589
|
+
inputProps: {
|
|
1590
|
+
'data-test': 'sign-in-username-input',
|
|
1591
|
+
autocomplete: 'username'
|
|
1592
|
+
}
|
|
1593
|
+
});
|
|
1594
|
+
break;
|
|
1595
|
+
}
|
|
1596
|
+
|
|
1597
|
+
formFieldInputs.push({
|
|
1598
|
+
type: 'password',
|
|
1599
|
+
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", {
|
|
1600
|
+
variant: "anchor",
|
|
1601
|
+
onClick: function onClick() {
|
|
1602
|
+
return _this.handleAuthStateChange(_auth_types_78df304e_js__WEBPACK_IMPORTED_MODULE_2__["A"].ForgotPassword);
|
|
1603
|
+
},
|
|
1604
|
+
"data-test": "sign-in-forgot-password-link"
|
|
1605
|
+
}, _aws_amplify_core__WEBPACK_IMPORTED_MODULE_1__["I18n"].get(_Translations_108d469f_js__WEBPACK_IMPORTED_MODULE_4__["T"].RESET_PASSWORD_TEXT))),
|
|
1606
|
+
required: true,
|
|
1607
|
+
handleInputChange: this.handleFormFieldInputChange('password'),
|
|
1608
|
+
inputProps: {
|
|
1609
|
+
'data-test': 'sign-in-password-input'
|
|
1610
|
+
}
|
|
1611
|
+
});
|
|
1612
|
+
this.newFormFields = __spreadArrays(formFieldInputs);
|
|
1613
|
+
};
|
|
1614
|
+
|
|
1615
|
+
class_5.prototype.buildFormFields = function () {
|
|
1616
|
+
var _this = this;
|
|
1617
|
+
|
|
1618
|
+
if (this.formFields.length === 0) {
|
|
1619
|
+
this.buildDefaultFormFields();
|
|
1620
|
+
} else {
|
|
1621
|
+
var newFields_3 = [];
|
|
1622
|
+
this.formFields.forEach(function (field) {
|
|
1623
|
+
var newField = Object.assign({}, field); // TODO: handle hint better
|
|
1624
|
+
|
|
1625
|
+
if (newField.type === 'password') {
|
|
1626
|
+
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
|
+
variant: "anchor",
|
|
1628
|
+
onClick: function onClick() {
|
|
1629
|
+
return _this.handleAuthStateChange(_auth_types_78df304e_js__WEBPACK_IMPORTED_MODULE_2__["A"].ForgotPassword);
|
|
1630
|
+
},
|
|
1631
|
+
"data-test": "sign-in-forgot-password-link"
|
|
1632
|
+
}, _aws_amplify_core__WEBPACK_IMPORTED_MODULE_1__["I18n"].get(_Translations_108d469f_js__WEBPACK_IMPORTED_MODULE_4__["T"].RESET_PASSWORD_TEXT))) : newField['hint'];
|
|
1633
|
+
}
|
|
1634
|
+
|
|
1635
|
+
newField['handleInputChange'] = function (event) {
|
|
1636
|
+
return _this.handleFormFieldInputWithCallback(event, field);
|
|
1637
|
+
};
|
|
1638
|
+
|
|
1639
|
+
_this.setFieldValue(newField, _this.signInAttributes);
|
|
1640
|
+
|
|
1641
|
+
newFields_3.push(newField);
|
|
1642
|
+
});
|
|
1643
|
+
this.newFormFields = newFields_3;
|
|
1644
|
+
}
|
|
1645
|
+
};
|
|
1646
|
+
|
|
1647
|
+
class_5.prototype.setFieldValue = function (field, formAttributes) {
|
|
1648
|
+
switch (field.type) {
|
|
1649
|
+
case 'username':
|
|
1650
|
+
case 'email':
|
|
1651
|
+
if (field.value === undefined) {
|
|
1652
|
+
formAttributes.userInput = '';
|
|
1653
|
+
} else {
|
|
1654
|
+
formAttributes.userInput = field.value;
|
|
1655
|
+
}
|
|
1656
|
+
|
|
1657
|
+
break;
|
|
1658
|
+
|
|
1659
|
+
case 'phone_number':
|
|
1660
|
+
if (field.dialCode) {
|
|
1661
|
+
this.phoneNumber.countryDialCodeValue = field.dialCode;
|
|
1662
|
+
}
|
|
1663
|
+
|
|
1664
|
+
this.phoneNumber.phoneNumberValue = field.value;
|
|
1665
|
+
break;
|
|
1666
|
+
|
|
1667
|
+
case 'password':
|
|
1668
|
+
if (field.value === undefined) {
|
|
1669
|
+
formAttributes.password = '';
|
|
1670
|
+
} else {
|
|
1671
|
+
formAttributes.password = field.value;
|
|
1672
|
+
}
|
|
1673
|
+
|
|
1674
|
+
break;
|
|
1675
|
+
}
|
|
1676
|
+
};
|
|
1677
|
+
|
|
1678
|
+
class_5.prototype.render = function () {
|
|
1679
|
+
var _this = this;
|
|
1680
|
+
|
|
1681
|
+
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
|
+
headerText: _aws_amplify_core__WEBPACK_IMPORTED_MODULE_1__["I18n"].get(this.headerText),
|
|
1683
|
+
handleSubmit: this.handleSubmit,
|
|
1684
|
+
testDataPrefix: 'sign-in'
|
|
1685
|
+
}, Object(_index_83f2275b_js__WEBPACK_IMPORTED_MODULE_0__["h"])("div", {
|
|
1686
|
+
slot: "subtitle"
|
|
1687
|
+
}, Object(_index_83f2275b_js__WEBPACK_IMPORTED_MODULE_0__["h"])("slot", {
|
|
1688
|
+
name: "header-subtitle"
|
|
1689
|
+
})), Object(_index_83f2275b_js__WEBPACK_IMPORTED_MODULE_0__["h"])("slot", {
|
|
1690
|
+
name: "federated-buttons"
|
|
1691
|
+
}, Object(_index_83f2275b_js__WEBPACK_IMPORTED_MODULE_0__["h"])("amplify-federated-buttons", {
|
|
1692
|
+
handleAuthStateChange: this.handleAuthStateChange,
|
|
1693
|
+
federated: this.federated
|
|
1694
|
+
})), !Object(_aws_amplify_core__WEBPACK_IMPORTED_MODULE_1__["isEmpty"])(this.federated) && Object(_index_83f2275b_js__WEBPACK_IMPORTED_MODULE_0__["h"])("amplify-strike", null, "or"), Object(_index_83f2275b_js__WEBPACK_IMPORTED_MODULE_0__["h"])("amplify-auth-fields", {
|
|
1695
|
+
formFields: this.newFormFields
|
|
1696
|
+
}), Object(_index_83f2275b_js__WEBPACK_IMPORTED_MODULE_0__["h"])("div", {
|
|
1697
|
+
slot: "amplify-form-section-footer",
|
|
1698
|
+
"class": "sign-in-form-footer"
|
|
1699
|
+
}, Object(_index_83f2275b_js__WEBPACK_IMPORTED_MODULE_0__["h"])("slot", {
|
|
1700
|
+
name: "footer"
|
|
1701
|
+
}, !this.hideSignUp && Object(_index_83f2275b_js__WEBPACK_IMPORTED_MODULE_0__["h"])("slot", {
|
|
1702
|
+
name: "secondary-footer-content"
|
|
1703
|
+
}, Object(_index_83f2275b_js__WEBPACK_IMPORTED_MODULE_0__["h"])("span", null, _aws_amplify_core__WEBPACK_IMPORTED_MODULE_1__["I18n"].get(_Translations_108d469f_js__WEBPACK_IMPORTED_MODULE_4__["T"].NO_ACCOUNT_TEXT), ' ', Object(_index_83f2275b_js__WEBPACK_IMPORTED_MODULE_0__["h"])("amplify-button", {
|
|
1704
|
+
variant: "anchor",
|
|
1705
|
+
onClick: function onClick() {
|
|
1706
|
+
return _this.handleAuthStateChange(_auth_types_78df304e_js__WEBPACK_IMPORTED_MODULE_2__["A"].SignUp);
|
|
1707
|
+
},
|
|
1708
|
+
"data-test": "sign-in-create-account-link"
|
|
1709
|
+
}, _aws_amplify_core__WEBPACK_IMPORTED_MODULE_1__["I18n"].get(_Translations_108d469f_js__WEBPACK_IMPORTED_MODULE_4__["T"].CREATE_ACCOUNT_TEXT)))), Object(_index_83f2275b_js__WEBPACK_IMPORTED_MODULE_0__["h"])("div", {
|
|
1710
|
+
"class": this.hideSignUp ? 'full-width-footer-content' : ''
|
|
1711
|
+
}, Object(_index_83f2275b_js__WEBPACK_IMPORTED_MODULE_0__["h"])("slot", {
|
|
1712
|
+
name: "primary-footer-content"
|
|
1713
|
+
}, Object(_index_83f2275b_js__WEBPACK_IMPORTED_MODULE_0__["h"])("amplify-button", {
|
|
1714
|
+
type: "submit",
|
|
1715
|
+
disabled: this.loading,
|
|
1716
|
+
"data-test": "sign-in-sign-in-button"
|
|
1717
|
+
}, 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
|
+
};
|
|
1719
|
+
|
|
1720
|
+
Object.defineProperty(class_5, "watchers", {
|
|
1721
|
+
get: function get() {
|
|
1722
|
+
return {
|
|
1723
|
+
"formFields": ["formFieldsHandler"]
|
|
1724
|
+
};
|
|
1725
|
+
},
|
|
1726
|
+
enumerable: false,
|
|
1727
|
+
configurable: true
|
|
1728
|
+
});
|
|
1729
|
+
return class_5;
|
|
1730
|
+
}();
|
|
1731
|
+
|
|
1732
|
+
AmplifySignIn.style = amplifySignInCss;
|
|
1733
|
+
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 () {
|
|
1738
|
+
function class_6(hostRef) {
|
|
1739
|
+
var _this = this;
|
|
1740
|
+
|
|
1741
|
+
Object(_index_83f2275b_js__WEBPACK_IMPORTED_MODULE_0__["r"])(this, hostRef);
|
|
1742
|
+
/** Fires when sign up form is submitted */
|
|
1743
|
+
|
|
1744
|
+
this.handleSubmit = function (event) {
|
|
1745
|
+
return _this.signUp(event);
|
|
1746
|
+
};
|
|
1747
|
+
/** Override for handling the Auth.SignUp API call */
|
|
1748
|
+
|
|
1749
|
+
|
|
1750
|
+
this.handleSignUp = function (params) {
|
|
1751
|
+
return _this.authSignUp(params);
|
|
1752
|
+
};
|
|
1753
|
+
/** Used for header text in sign up component */
|
|
1754
|
+
|
|
1755
|
+
|
|
1756
|
+
this.headerText = _Translations_108d469f_js__WEBPACK_IMPORTED_MODULE_4__["T"].SIGN_UP_HEADER_TEXT;
|
|
1757
|
+
/** Used for the submit button text in sign up component */
|
|
1758
|
+
|
|
1759
|
+
this.submitButtonText = _Translations_108d469f_js__WEBPACK_IMPORTED_MODULE_4__["T"].SIGN_UP_SUBMIT_BUTTON_TEXT;
|
|
1760
|
+
/** Used for the submit button text in sign up component */
|
|
1761
|
+
|
|
1762
|
+
this.haveAccountText = _Translations_108d469f_js__WEBPACK_IMPORTED_MODULE_4__["T"].SIGN_UP_HAVE_ACCOUNT_TEXT;
|
|
1763
|
+
/** Text used for the sign in hyperlink */
|
|
1764
|
+
|
|
1765
|
+
this.signInText = _Translations_108d469f_js__WEBPACK_IMPORTED_MODULE_4__["T"].SIGN_IN_TEXT;
|
|
1766
|
+
/**
|
|
1767
|
+
* Form fields allows you to utilize our pre-built components such as username field, code field, password field, email field, etc.
|
|
1768
|
+
* by passing an array of strings that you would like the order of the form to be in. If you need more customization, such as changing
|
|
1769
|
+
* text for a label or adjust a placeholder, you can follow the structure below in order to do just that.
|
|
1770
|
+
* ```
|
|
1771
|
+
* [
|
|
1772
|
+
* {
|
|
1773
|
+
* type: string,
|
|
1774
|
+
* label: string,
|
|
1775
|
+
* placeholder: string,
|
|
1776
|
+
* hint: string | Functional Component | null,
|
|
1777
|
+
* required: boolean
|
|
1778
|
+
* }
|
|
1779
|
+
* ]
|
|
1780
|
+
* ```
|
|
1781
|
+
*/
|
|
1782
|
+
|
|
1783
|
+
this.formFields = [];
|
|
1784
|
+
/** Auth state change handler for this component
|
|
1785
|
+
* e.g. SignIn -> 'Create Account' link -> SignUp
|
|
1786
|
+
*/
|
|
1787
|
+
// prettier-ignore
|
|
1788
|
+
|
|
1789
|
+
this.handleAuthStateChange = _helpers_14fcb50c_js__WEBPACK_IMPORTED_MODULE_6__["d"];
|
|
1790
|
+
/** Username Alias is used to setup authentication with `username`, `email` or `phone_number` */
|
|
1791
|
+
|
|
1792
|
+
this.usernameAlias = 'username'; // private userInput: string | PhoneNumberInterface;
|
|
1793
|
+
|
|
1794
|
+
this.newFormFields = [];
|
|
1795
|
+
this.phoneNumber = {
|
|
1796
|
+
countryDialCodeValue: _constants_c8ecaa24_js__WEBPACK_IMPORTED_MODULE_5__["g"],
|
|
1797
|
+
phoneNumberValue: null
|
|
1798
|
+
};
|
|
1799
|
+
this.loading = false;
|
|
1800
|
+
this.signUpAttributes = {
|
|
1801
|
+
username: '',
|
|
1802
|
+
password: '',
|
|
1803
|
+
attributes: {}
|
|
1804
|
+
};
|
|
1805
|
+
}
|
|
1806
|
+
|
|
1807
|
+
class_6.prototype.handleFormFieldInputChange = function (fieldType) {
|
|
1808
|
+
var _this = this;
|
|
1809
|
+
|
|
1810
|
+
switch (fieldType) {
|
|
1811
|
+
case 'username':
|
|
1812
|
+
return function (event) {
|
|
1813
|
+
return _this.signUpAttributes.username = event.target.value;
|
|
1814
|
+
};
|
|
1815
|
+
|
|
1816
|
+
case 'password':
|
|
1817
|
+
return function (event) {
|
|
1818
|
+
return _this.signUpAttributes.password = event.target.value;
|
|
1819
|
+
};
|
|
1820
|
+
|
|
1821
|
+
case 'email':
|
|
1822
|
+
return function (event) {
|
|
1823
|
+
return _this.signUpAttributes.attributes.email = event.target.value;
|
|
1824
|
+
};
|
|
1825
|
+
|
|
1826
|
+
case 'phone_number':
|
|
1827
|
+
return function (event) {
|
|
1828
|
+
return Object(_helpers_14fcb50c_js__WEBPACK_IMPORTED_MODULE_6__["h"])(event, _this.phoneNumber);
|
|
1829
|
+
};
|
|
1830
|
+
|
|
1831
|
+
default:
|
|
1832
|
+
return function (event) {
|
|
1833
|
+
return _this.signUpAttributes.attributes[fieldType] = event.target.value;
|
|
1834
|
+
};
|
|
1835
|
+
}
|
|
1836
|
+
};
|
|
1837
|
+
|
|
1838
|
+
class_6.prototype.handleFormFieldInputWithCallback = function (event, field) {
|
|
1839
|
+
var fnToCall = field['handleInputChange'] ? field['handleInputChange'] : function (event, cb) {
|
|
1840
|
+
cb(event);
|
|
1841
|
+
};
|
|
1842
|
+
var callback = this.handleFormFieldInputChange(field.type);
|
|
1843
|
+
fnToCall(event, callback.bind(this));
|
|
1844
|
+
};
|
|
1845
|
+
|
|
1846
|
+
class_6.prototype.authSignUp = function (params) {
|
|
1847
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
1848
|
+
var data;
|
|
1849
|
+
return __generator(this, function (_a) {
|
|
1850
|
+
switch (_a.label) {
|
|
1851
|
+
case 0:
|
|
1852
|
+
return [4
|
|
1853
|
+
/*yield*/
|
|
1854
|
+
, _aws_amplify_auth__WEBPACK_IMPORTED_MODULE_3__["Auth"].signUp(params)];
|
|
1855
|
+
|
|
1856
|
+
case 1:
|
|
1857
|
+
data = _a.sent();
|
|
1858
|
+
|
|
1859
|
+
if (!data) {
|
|
1860
|
+
throw new Error(_Translations_108d469f_js__WEBPACK_IMPORTED_MODULE_4__["T"].SIGN_UP_FAILED);
|
|
1861
|
+
}
|
|
1862
|
+
|
|
1863
|
+
return [2
|
|
1864
|
+
/*return*/
|
|
1865
|
+
, data];
|
|
1866
|
+
}
|
|
1867
|
+
});
|
|
1868
|
+
});
|
|
1869
|
+
};
|
|
1870
|
+
|
|
1871
|
+
class_6.prototype.assignPhoneNumberToSignUpAttributes = function () {
|
|
1872
|
+
if (this.phoneNumber.phoneNumberValue) {
|
|
1873
|
+
try {
|
|
1874
|
+
this.signUpAttributes.attributes.phone_number = Object(_helpers_14fcb50c_js__WEBPACK_IMPORTED_MODULE_6__["b"])(this.phoneNumber);
|
|
1875
|
+
} catch (error) {
|
|
1876
|
+
Object(_helpers_14fcb50c_js__WEBPACK_IMPORTED_MODULE_6__["a"])(error);
|
|
1877
|
+
}
|
|
1878
|
+
}
|
|
1879
|
+
};
|
|
1880
|
+
|
|
1881
|
+
class_6.prototype.assignUserNameAliasToSignUpAttributes = function () {
|
|
1882
|
+
switch (this.usernameAlias) {
|
|
1883
|
+
case 'email':
|
|
1884
|
+
case 'phone_number':
|
|
1885
|
+
this.signUpAttributes.username = this.signUpAttributes.attributes[this.usernameAlias];
|
|
1886
|
+
break;
|
|
1887
|
+
}
|
|
1888
|
+
};
|
|
1889
|
+
|
|
1890
|
+
class_6.prototype.assignFormInputToSignUpAttributes = function () {
|
|
1891
|
+
this.assignPhoneNumberToSignUpAttributes();
|
|
1892
|
+
this.assignUserNameAliasToSignUpAttributes();
|
|
1893
|
+
};
|
|
1894
|
+
|
|
1895
|
+
class_6.prototype.validateSignUpAttributes = function () {
|
|
1896
|
+
if (!this.signUpAttributes.username) {
|
|
1897
|
+
if (this.usernameAlias === _auth_types_78df304e_js__WEBPACK_IMPORTED_MODULE_2__["U"].email) {
|
|
1898
|
+
throw new Error(_Translations_108d469f_js__WEBPACK_IMPORTED_MODULE_4__["T"].EMPTY_EMAIL);
|
|
1899
|
+
} else if (this.usernameAlias === _auth_types_78df304e_js__WEBPACK_IMPORTED_MODULE_2__["U"].phone_number) {
|
|
1900
|
+
throw new Error(_Translations_108d469f_js__WEBPACK_IMPORTED_MODULE_4__["T"].EMPTY_PHONE);
|
|
1901
|
+
} else {
|
|
1902
|
+
throw new Error(_Translations_108d469f_js__WEBPACK_IMPORTED_MODULE_4__["T"].EMPTY_USERNAME);
|
|
1903
|
+
}
|
|
1904
|
+
}
|
|
1905
|
+
|
|
1906
|
+
if (this.signUpAttributes.username.indexOf(' ') >= 0) {
|
|
1907
|
+
throw new Error(_Translations_108d469f_js__WEBPACK_IMPORTED_MODULE_4__["T"].USERNAME_REMOVE_WHITESPACE);
|
|
1908
|
+
}
|
|
1909
|
+
|
|
1910
|
+
if (this.signUpAttributes.password !== this.signUpAttributes.password.trim()) {
|
|
1911
|
+
throw new Error(_Translations_108d469f_js__WEBPACK_IMPORTED_MODULE_4__["T"].PASSWORD_REMOVE_WHITESPACE);
|
|
1912
|
+
}
|
|
1913
|
+
}; // TODO: Add validation
|
|
1914
|
+
// TODO: Prefix
|
|
1915
|
+
|
|
1916
|
+
|
|
1917
|
+
class_6.prototype.signUp = function (event) {
|
|
1918
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
1919
|
+
var data, signUpAttrs, error_8;
|
|
1920
|
+
return __generator(this, function (_a) {
|
|
1921
|
+
switch (_a.label) {
|
|
1922
|
+
case 0:
|
|
1923
|
+
if (event) {
|
|
1924
|
+
event.preventDefault();
|
|
1925
|
+
}
|
|
1926
|
+
|
|
1927
|
+
if (!_aws_amplify_auth__WEBPACK_IMPORTED_MODULE_3__["Auth"] || typeof _aws_amplify_auth__WEBPACK_IMPORTED_MODULE_3__["Auth"].signUp !== 'function') {
|
|
1928
|
+
throw new Error(_constants_c8ecaa24_js__WEBPACK_IMPORTED_MODULE_5__["N"]);
|
|
1929
|
+
}
|
|
1930
|
+
|
|
1931
|
+
this.loading = true;
|
|
1932
|
+
this.assignFormInputToSignUpAttributes();
|
|
1933
|
+
_a.label = 1;
|
|
1934
|
+
|
|
1935
|
+
case 1:
|
|
1936
|
+
_a.trys.push([1, 6, 7, 8]);
|
|
1937
|
+
|
|
1938
|
+
this.validateSignUpAttributes();
|
|
1939
|
+
return [4
|
|
1940
|
+
/*yield*/
|
|
1941
|
+
, this.handleSignUp(this.signUpAttributes)];
|
|
1942
|
+
|
|
1943
|
+
case 2:
|
|
1944
|
+
data = _a.sent();
|
|
1945
|
+
if (!data.userConfirmed) return [3
|
|
1946
|
+
/*break*/
|
|
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
|
+
|
|
1952
|
+
case 3:
|
|
1953
|
+
_a.sent();
|
|
1954
|
+
|
|
1955
|
+
return [3
|
|
1956
|
+
/*break*/
|
|
1957
|
+
, 5];
|
|
1958
|
+
|
|
1959
|
+
case 4:
|
|
1960
|
+
signUpAttrs = Object.assign({}, this.signUpAttributes);
|
|
1961
|
+
this.handleAuthStateChange(_auth_types_78df304e_js__WEBPACK_IMPORTED_MODULE_2__["A"].ConfirmSignUp, Object.assign(Object.assign({}, data.user), {
|
|
1962
|
+
signUpAttrs: signUpAttrs
|
|
1963
|
+
}));
|
|
1964
|
+
_a.label = 5;
|
|
1965
|
+
|
|
1966
|
+
case 5:
|
|
1967
|
+
return [3
|
|
1968
|
+
/*break*/
|
|
1969
|
+
, 8];
|
|
1970
|
+
|
|
1971
|
+
case 6:
|
|
1972
|
+
error_8 = _a.sent();
|
|
1973
|
+
Object(_helpers_14fcb50c_js__WEBPACK_IMPORTED_MODULE_6__["a"])(error_8);
|
|
1974
|
+
return [3
|
|
1975
|
+
/*break*/
|
|
1976
|
+
, 8];
|
|
1977
|
+
|
|
1978
|
+
case 7:
|
|
1979
|
+
this.loading = false;
|
|
1980
|
+
return [7
|
|
1981
|
+
/*endfinally*/
|
|
1982
|
+
];
|
|
1983
|
+
|
|
1984
|
+
case 8:
|
|
1985
|
+
return [2
|
|
1986
|
+
/*return*/
|
|
1987
|
+
];
|
|
1988
|
+
}
|
|
1989
|
+
});
|
|
1990
|
+
});
|
|
1991
|
+
};
|
|
1992
|
+
|
|
1993
|
+
class_6.prototype.buildDefaultFormFields = function () {
|
|
1994
|
+
switch (this.usernameAlias) {
|
|
1995
|
+
case 'email':
|
|
1996
|
+
this.newFormFields = [{
|
|
1997
|
+
type: 'email',
|
|
1998
|
+
placeholder: _aws_amplify_core__WEBPACK_IMPORTED_MODULE_1__["I18n"].get(_Translations_108d469f_js__WEBPACK_IMPORTED_MODULE_4__["T"].SIGN_UP_EMAIL_PLACEHOLDER),
|
|
1999
|
+
required: true,
|
|
2000
|
+
handleInputChange: this.handleFormFieldInputChange('email'),
|
|
2001
|
+
inputProps: {
|
|
2002
|
+
'data-test': 'sign-up-email-input',
|
|
2003
|
+
autocomplete: 'username'
|
|
2004
|
+
}
|
|
2005
|
+
}, {
|
|
2006
|
+
type: 'password',
|
|
2007
|
+
placeholder: _aws_amplify_core__WEBPACK_IMPORTED_MODULE_1__["I18n"].get(_Translations_108d469f_js__WEBPACK_IMPORTED_MODULE_4__["T"].SIGN_UP_PASSWORD_PLACEHOLDER),
|
|
2008
|
+
required: true,
|
|
2009
|
+
handleInputChange: this.handleFormFieldInputChange('password'),
|
|
2010
|
+
inputProps: {
|
|
2011
|
+
'data-test': 'sign-up-password-input',
|
|
2012
|
+
autocomplete: 'new-password'
|
|
2013
|
+
}
|
|
2014
|
+
}, {
|
|
2015
|
+
type: 'phone_number',
|
|
2016
|
+
required: true,
|
|
2017
|
+
handleInputChange: this.handleFormFieldInputChange('phone_number'),
|
|
2018
|
+
inputProps: {
|
|
2019
|
+
'data-test': 'sign-up-phone-number-input',
|
|
2020
|
+
autocomplete: 'tel-national'
|
|
2021
|
+
}
|
|
2022
|
+
}];
|
|
2023
|
+
break;
|
|
2024
|
+
|
|
2025
|
+
case 'phone_number':
|
|
2026
|
+
this.newFormFields = [{
|
|
2027
|
+
type: 'phone_number',
|
|
2028
|
+
required: true,
|
|
2029
|
+
handleInputChange: this.handleFormFieldInputChange('phone_number'),
|
|
2030
|
+
inputProps: {
|
|
2031
|
+
'data-test': 'sign-up-phone-number-input',
|
|
2032
|
+
autocomplete: 'username'
|
|
2033
|
+
}
|
|
2034
|
+
}, {
|
|
2035
|
+
type: 'password',
|
|
2036
|
+
placeholder: _aws_amplify_core__WEBPACK_IMPORTED_MODULE_1__["I18n"].get(_Translations_108d469f_js__WEBPACK_IMPORTED_MODULE_4__["T"].SIGN_UP_PASSWORD_PLACEHOLDER),
|
|
2037
|
+
required: true,
|
|
2038
|
+
handleInputChange: this.handleFormFieldInputChange('password'),
|
|
2039
|
+
inputProps: {
|
|
2040
|
+
'data-test': 'sign-up-password-input',
|
|
2041
|
+
autocomplete: 'new-password'
|
|
2042
|
+
}
|
|
2043
|
+
}, {
|
|
2044
|
+
type: 'email',
|
|
2045
|
+
placeholder: _aws_amplify_core__WEBPACK_IMPORTED_MODULE_1__["I18n"].get(_Translations_108d469f_js__WEBPACK_IMPORTED_MODULE_4__["T"].SIGN_UP_EMAIL_PLACEHOLDER),
|
|
2046
|
+
required: true,
|
|
2047
|
+
handleInputChange: this.handleFormFieldInputChange('email'),
|
|
2048
|
+
inputProps: {
|
|
2049
|
+
'data-test': 'sign-up-email-input',
|
|
2050
|
+
autocomplete: 'email'
|
|
2051
|
+
}
|
|
2052
|
+
}];
|
|
2053
|
+
break;
|
|
2054
|
+
|
|
2055
|
+
case 'username':
|
|
2056
|
+
default:
|
|
2057
|
+
this.newFormFields = [{
|
|
2058
|
+
type: 'username',
|
|
2059
|
+
placeholder: _aws_amplify_core__WEBPACK_IMPORTED_MODULE_1__["I18n"].get(_Translations_108d469f_js__WEBPACK_IMPORTED_MODULE_4__["T"].SIGN_UP_USERNAME_PLACEHOLDER),
|
|
2060
|
+
required: true,
|
|
2061
|
+
handleInputChange: this.handleFormFieldInputChange('username'),
|
|
2062
|
+
inputProps: {
|
|
2063
|
+
'data-test': 'sign-up-username-input',
|
|
2064
|
+
autocomplete: 'username'
|
|
2065
|
+
}
|
|
2066
|
+
}, {
|
|
2067
|
+
type: 'password',
|
|
2068
|
+
placeholder: _aws_amplify_core__WEBPACK_IMPORTED_MODULE_1__["I18n"].get(_Translations_108d469f_js__WEBPACK_IMPORTED_MODULE_4__["T"].SIGN_UP_PASSWORD_PLACEHOLDER),
|
|
2069
|
+
required: true,
|
|
2070
|
+
handleInputChange: this.handleFormFieldInputChange('password'),
|
|
2071
|
+
inputProps: {
|
|
2072
|
+
'data-test': 'sign-up-password-input',
|
|
2073
|
+
autocomplete: 'new-password'
|
|
2074
|
+
}
|
|
2075
|
+
}, {
|
|
2076
|
+
type: 'email',
|
|
2077
|
+
placeholder: _aws_amplify_core__WEBPACK_IMPORTED_MODULE_1__["I18n"].get(_Translations_108d469f_js__WEBPACK_IMPORTED_MODULE_4__["T"].SIGN_UP_EMAIL_PLACEHOLDER),
|
|
2078
|
+
required: true,
|
|
2079
|
+
handleInputChange: this.handleFormFieldInputChange('email'),
|
|
2080
|
+
inputProps: {
|
|
2081
|
+
'data-test': 'sign-up-email-input'
|
|
2082
|
+
}
|
|
2083
|
+
}, {
|
|
2084
|
+
type: 'phone_number',
|
|
2085
|
+
required: true,
|
|
2086
|
+
handleInputChange: this.handleFormFieldInputChange('phone_number'),
|
|
2087
|
+
inputProps: {
|
|
2088
|
+
'data-test': 'sign-up-phone-number-input'
|
|
2089
|
+
}
|
|
2090
|
+
}];
|
|
2091
|
+
break;
|
|
2092
|
+
}
|
|
2093
|
+
};
|
|
2094
|
+
|
|
2095
|
+
class_6.prototype.buildFormFields = function () {
|
|
2096
|
+
var _this = this;
|
|
2097
|
+
|
|
2098
|
+
if (this.formFields.length === 0) {
|
|
2099
|
+
this.buildDefaultFormFields();
|
|
2100
|
+
} else {
|
|
2101
|
+
var newFields_4 = [];
|
|
2102
|
+
this.formFields.forEach(function (field) {
|
|
2103
|
+
var newField = Object.assign({}, field);
|
|
2104
|
+
|
|
2105
|
+
newField['handleInputChange'] = function (event) {
|
|
2106
|
+
return _this.handleFormFieldInputWithCallback(event, field);
|
|
2107
|
+
};
|
|
2108
|
+
|
|
2109
|
+
_this.setFieldValue(field, _this.signUpAttributes);
|
|
2110
|
+
|
|
2111
|
+
newFields_4.push(newField);
|
|
2112
|
+
});
|
|
2113
|
+
this.newFormFields = newFields_4;
|
|
2114
|
+
}
|
|
2115
|
+
};
|
|
2116
|
+
|
|
2117
|
+
class_6.prototype.setFieldValue = function (field, formAttributes) {
|
|
2118
|
+
switch (field.type) {
|
|
2119
|
+
case 'username':
|
|
2120
|
+
if (field.value === undefined) {
|
|
2121
|
+
formAttributes.username = '';
|
|
2122
|
+
} else {
|
|
2123
|
+
formAttributes.username = field.value;
|
|
2124
|
+
}
|
|
2125
|
+
|
|
2126
|
+
break;
|
|
2127
|
+
|
|
2128
|
+
case 'password':
|
|
2129
|
+
if (field.value === undefined) {
|
|
2130
|
+
formAttributes.password = '';
|
|
2131
|
+
} else {
|
|
2132
|
+
formAttributes.password = field.value;
|
|
2133
|
+
}
|
|
2134
|
+
|
|
2135
|
+
break;
|
|
2136
|
+
|
|
2137
|
+
case 'email':
|
|
2138
|
+
formAttributes.attributes.email = field.value;
|
|
2139
|
+
break;
|
|
2140
|
+
|
|
2141
|
+
case 'phone_number':
|
|
2142
|
+
if (field.dialCode) {
|
|
2143
|
+
this.phoneNumber.countryDialCodeValue = field.dialCode;
|
|
2144
|
+
}
|
|
2145
|
+
|
|
2146
|
+
this.phoneNumber.phoneNumberValue = field.value;
|
|
2147
|
+
break;
|
|
2148
|
+
|
|
2149
|
+
default:
|
|
2150
|
+
formAttributes.attributes[field.type] = field.value;
|
|
2151
|
+
break;
|
|
2152
|
+
}
|
|
2153
|
+
};
|
|
2154
|
+
|
|
2155
|
+
class_6.prototype.componentWillLoad = function () {
|
|
2156
|
+
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
|
+
Object(_helpers_14fcb50c_js__WEBPACK_IMPORTED_MODULE_6__["c"])(this.usernameAlias);
|
|
2158
|
+
this.buildFormFields();
|
|
2159
|
+
};
|
|
2160
|
+
|
|
2161
|
+
class_6.prototype.formFieldsHandler = function () {
|
|
2162
|
+
this.buildFormFields();
|
|
2163
|
+
};
|
|
2164
|
+
|
|
2165
|
+
class_6.prototype.render = function () {
|
|
2166
|
+
var _this = this;
|
|
2167
|
+
|
|
2168
|
+
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
|
+
headerText: _aws_amplify_core__WEBPACK_IMPORTED_MODULE_1__["I18n"].get(this.headerText),
|
|
2170
|
+
handleSubmit: this.handleSubmit,
|
|
2171
|
+
testDataPrefix: 'sign-up'
|
|
2172
|
+
}, Object(_index_83f2275b_js__WEBPACK_IMPORTED_MODULE_0__["h"])("div", {
|
|
2173
|
+
slot: "subtitle"
|
|
2174
|
+
}, Object(_index_83f2275b_js__WEBPACK_IMPORTED_MODULE_0__["h"])("slot", {
|
|
2175
|
+
name: "header-subtitle"
|
|
2176
|
+
})), Object(_index_83f2275b_js__WEBPACK_IMPORTED_MODULE_0__["h"])("amplify-auth-fields", {
|
|
2177
|
+
formFields: this.newFormFields
|
|
2178
|
+
}), Object(_index_83f2275b_js__WEBPACK_IMPORTED_MODULE_0__["h"])("div", {
|
|
2179
|
+
"class": "sign-up-form-footer",
|
|
2180
|
+
slot: "amplify-form-section-footer"
|
|
2181
|
+
}, Object(_index_83f2275b_js__WEBPACK_IMPORTED_MODULE_0__["h"])("slot", {
|
|
2182
|
+
name: "footer"
|
|
2183
|
+
}, Object(_index_83f2275b_js__WEBPACK_IMPORTED_MODULE_0__["h"])("slot", {
|
|
2184
|
+
name: "secondary-footer-content"
|
|
2185
|
+
}, Object(_index_83f2275b_js__WEBPACK_IMPORTED_MODULE_0__["h"])("span", null, _aws_amplify_core__WEBPACK_IMPORTED_MODULE_1__["I18n"].get(this.haveAccountText), ' ', Object(_index_83f2275b_js__WEBPACK_IMPORTED_MODULE_0__["h"])("amplify-button", {
|
|
2186
|
+
variant: "anchor",
|
|
2187
|
+
onClick: function onClick() {
|
|
2188
|
+
return _this.handleAuthStateChange(_auth_types_78df304e_js__WEBPACK_IMPORTED_MODULE_2__["A"].SignIn);
|
|
2189
|
+
},
|
|
2190
|
+
"data-test": "sign-up-sign-in-link"
|
|
2191
|
+
}, _aws_amplify_core__WEBPACK_IMPORTED_MODULE_1__["I18n"].get(this.signInText)))), Object(_index_83f2275b_js__WEBPACK_IMPORTED_MODULE_0__["h"])("slot", {
|
|
2192
|
+
name: "primary-footer-content"
|
|
2193
|
+
}, Object(_index_83f2275b_js__WEBPACK_IMPORTED_MODULE_0__["h"])("amplify-button", {
|
|
2194
|
+
type: "submit",
|
|
2195
|
+
"data-test": "sign-up-create-account-button",
|
|
2196
|
+
disabled: this.loading
|
|
2197
|
+
}, 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
|
+
};
|
|
2199
|
+
|
|
2200
|
+
Object.defineProperty(class_6, "watchers", {
|
|
2201
|
+
get: function get() {
|
|
2202
|
+
return {
|
|
2203
|
+
"formFields": ["formFieldsHandler"]
|
|
2204
|
+
};
|
|
2205
|
+
},
|
|
2206
|
+
enumerable: false,
|
|
2207
|
+
configurable: true
|
|
2208
|
+
});
|
|
2209
|
+
return class_6;
|
|
2210
|
+
}();
|
|
2211
|
+
|
|
2212
|
+
AmplifySignUp.style = amplifySignUpCss;
|
|
2213
|
+
var logger$2 = new _aws_amplify_core__WEBPACK_IMPORTED_MODULE_1__["Logger"]('AmplifyVerifyContact');
|
|
2214
|
+
|
|
2215
|
+
var AmplifyVerifyContact =
|
|
2216
|
+
/** @class */
|
|
2217
|
+
function () {
|
|
2218
|
+
function class_7(hostRef) {
|
|
2219
|
+
Object(_index_83f2275b_js__WEBPACK_IMPORTED_MODULE_0__["r"])(this, hostRef);
|
|
2220
|
+
/** Authentication state handler */
|
|
2221
|
+
|
|
2222
|
+
this.handleAuthStateChange = _helpers_14fcb50c_js__WEBPACK_IMPORTED_MODULE_6__["d"];
|
|
2223
|
+
this.loading = false;
|
|
2224
|
+
}
|
|
2225
|
+
|
|
2226
|
+
class_7.prototype.componentWillLoad = function () {
|
|
2227
|
+
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
|
+
};
|
|
2229
|
+
|
|
2230
|
+
class_7.prototype.handleSubmit = function (event) {
|
|
2231
|
+
event.preventDefault();
|
|
2232
|
+
this.verifyAttr ? this.submit(this.code) : this.verify(this.contact);
|
|
2233
|
+
};
|
|
2234
|
+
|
|
2235
|
+
class_7.prototype.submit = function (code) {
|
|
2236
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
2237
|
+
var attr, data, error_9;
|
|
2238
|
+
return __generator(this, function (_a) {
|
|
2239
|
+
switch (_a.label) {
|
|
2240
|
+
case 0:
|
|
2241
|
+
attr = this.verifyAttr;
|
|
2242
|
+
|
|
2243
|
+
if (!_aws_amplify_auth__WEBPACK_IMPORTED_MODULE_3__["Auth"] || typeof _aws_amplify_auth__WEBPACK_IMPORTED_MODULE_3__["Auth"].verifyCurrentUserAttributeSubmit !== 'function') {
|
|
2244
|
+
throw new Error(_constants_c8ecaa24_js__WEBPACK_IMPORTED_MODULE_5__["N"]);
|
|
2245
|
+
}
|
|
2246
|
+
|
|
2247
|
+
this.loading = true;
|
|
2248
|
+
_a.label = 1;
|
|
2249
|
+
|
|
2250
|
+
case 1:
|
|
2251
|
+
_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
|
+
|
|
2257
|
+
case 2:
|
|
2258
|
+
data = _a.sent();
|
|
2259
|
+
logger$2.debug(data);
|
|
2260
|
+
this.handleAuthStateChange(_auth_types_78df304e_js__WEBPACK_IMPORTED_MODULE_2__["A"].SignedIn, this.user);
|
|
2261
|
+
this.verifyAttr = null;
|
|
2262
|
+
return [3
|
|
2263
|
+
/*break*/
|
|
2264
|
+
, 5];
|
|
2265
|
+
|
|
2266
|
+
case 3:
|
|
2267
|
+
error_9 = _a.sent();
|
|
2268
|
+
Object(_helpers_14fcb50c_js__WEBPACK_IMPORTED_MODULE_6__["a"])(error_9);
|
|
2269
|
+
logger$2.error(error_9);
|
|
2270
|
+
return [3
|
|
2271
|
+
/*break*/
|
|
2272
|
+
, 5];
|
|
2273
|
+
|
|
2274
|
+
case 4:
|
|
2275
|
+
this.loading = false;
|
|
2276
|
+
return [7
|
|
2277
|
+
/*endfinally*/
|
|
2278
|
+
];
|
|
2279
|
+
|
|
2280
|
+
case 5:
|
|
2281
|
+
return [2
|
|
2282
|
+
/*return*/
|
|
2283
|
+
];
|
|
2284
|
+
}
|
|
2285
|
+
});
|
|
2286
|
+
});
|
|
2287
|
+
};
|
|
2288
|
+
|
|
2289
|
+
class_7.prototype.verify = function (contact) {
|
|
2290
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
2291
|
+
var data, error_10;
|
|
2292
|
+
return __generator(this, function (_a) {
|
|
2293
|
+
switch (_a.label) {
|
|
2294
|
+
case 0:
|
|
2295
|
+
if (!contact) {
|
|
2296
|
+
logger$2.error('Neither Email nor Phone Number selected');
|
|
2297
|
+
return [2
|
|
2298
|
+
/*return*/
|
|
2299
|
+
];
|
|
2300
|
+
}
|
|
2301
|
+
|
|
2302
|
+
if (!_aws_amplify_auth__WEBPACK_IMPORTED_MODULE_3__["Auth"] || typeof _aws_amplify_auth__WEBPACK_IMPORTED_MODULE_3__["Auth"].verifyCurrentUserAttribute !== 'function') {
|
|
2303
|
+
throw new Error(_constants_c8ecaa24_js__WEBPACK_IMPORTED_MODULE_5__["N"]);
|
|
2304
|
+
}
|
|
2305
|
+
|
|
2306
|
+
this.loading = true;
|
|
2307
|
+
_a.label = 1;
|
|
2308
|
+
|
|
2309
|
+
case 1:
|
|
2310
|
+
_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
|
+
|
|
2316
|
+
case 2:
|
|
2317
|
+
data = _a.sent();
|
|
2318
|
+
logger$2.debug(data);
|
|
2319
|
+
this.verifyAttr = contact;
|
|
2320
|
+
return [3
|
|
2321
|
+
/*break*/
|
|
2322
|
+
, 5];
|
|
2323
|
+
|
|
2324
|
+
case 3:
|
|
2325
|
+
error_10 = _a.sent();
|
|
2326
|
+
Object(_helpers_14fcb50c_js__WEBPACK_IMPORTED_MODULE_6__["a"])(error_10);
|
|
2327
|
+
logger$2.error(error_10);
|
|
2328
|
+
return [3
|
|
2329
|
+
/*break*/
|
|
2330
|
+
, 5];
|
|
2331
|
+
|
|
2332
|
+
case 4:
|
|
2333
|
+
this.loading = false;
|
|
2334
|
+
return [7
|
|
2335
|
+
/*endfinally*/
|
|
2336
|
+
];
|
|
2337
|
+
|
|
2338
|
+
case 5:
|
|
2339
|
+
return [2
|
|
2340
|
+
/*return*/
|
|
2341
|
+
];
|
|
2342
|
+
}
|
|
2343
|
+
});
|
|
2344
|
+
});
|
|
2345
|
+
};
|
|
2346
|
+
|
|
2347
|
+
class_7.prototype.handleInputChange = function (event) {
|
|
2348
|
+
var inputName = event.target.name;
|
|
2349
|
+
|
|
2350
|
+
if (inputName === 'code') {
|
|
2351
|
+
this.code = event.target.value;
|
|
2352
|
+
} else if (inputName === 'contact') {
|
|
2353
|
+
this.contact = event.target.value;
|
|
2354
|
+
}
|
|
2355
|
+
};
|
|
2356
|
+
|
|
2357
|
+
class_7.prototype.renderSubmit = function () {
|
|
2358
|
+
var _this = this;
|
|
2359
|
+
|
|
2360
|
+
return Object(_index_83f2275b_js__WEBPACK_IMPORTED_MODULE_0__["h"])("div", null, Object(_index_83f2275b_js__WEBPACK_IMPORTED_MODULE_0__["h"])("amplify-input", {
|
|
2361
|
+
inputProps: {
|
|
2362
|
+
autocomplete: 'off',
|
|
2363
|
+
'data-test': 'verify-contact-code-input'
|
|
2364
|
+
},
|
|
2365
|
+
name: "code",
|
|
2366
|
+
placeholder: _aws_amplify_core__WEBPACK_IMPORTED_MODULE_1__["I18n"].get(_Translations_108d469f_js__WEBPACK_IMPORTED_MODULE_4__["T"].CODE_PLACEHOLDER),
|
|
2367
|
+
handleInputChange: function handleInputChange(event) {
|
|
2368
|
+
return _this.handleInputChange(event);
|
|
2369
|
+
}
|
|
2370
|
+
}));
|
|
2371
|
+
};
|
|
2372
|
+
|
|
2373
|
+
class_7.prototype.renderVerify = function () {
|
|
2374
|
+
var _this = this;
|
|
2375
|
+
|
|
2376
|
+
var user = this.user;
|
|
2377
|
+
|
|
2378
|
+
if (!user) {
|
|
2379
|
+
logger$2.debug('No user to verify');
|
|
2380
|
+
return null;
|
|
2381
|
+
}
|
|
2382
|
+
|
|
2383
|
+
var unverified = user.unverified;
|
|
2384
|
+
|
|
2385
|
+
if (!unverified) {
|
|
2386
|
+
logger$2.debug('Unverified variable does not exist on user');
|
|
2387
|
+
return null;
|
|
2388
|
+
}
|
|
2389
|
+
|
|
2390
|
+
var email = unverified.email,
|
|
2391
|
+
phone_number = unverified.phone_number;
|
|
2392
|
+
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
|
+
label: _aws_amplify_core__WEBPACK_IMPORTED_MODULE_1__["I18n"].get(_Translations_108d469f_js__WEBPACK_IMPORTED_MODULE_4__["T"].VERIFY_CONTACT_EMAIL_LABEL),
|
|
2394
|
+
key: "email",
|
|
2395
|
+
name: "contact",
|
|
2396
|
+
value: "email",
|
|
2397
|
+
handleInputChange: function handleInputChange(event) {
|
|
2398
|
+
return _this.handleInputChange(event);
|
|
2399
|
+
},
|
|
2400
|
+
inputProps: {
|
|
2401
|
+
'data-test': 'verify-contact-email-radio'
|
|
2402
|
+
}
|
|
2403
|
+
}), phone_number && Object(_index_83f2275b_js__WEBPACK_IMPORTED_MODULE_0__["h"])("amplify-radio-button", {
|
|
2404
|
+
label: _aws_amplify_core__WEBPACK_IMPORTED_MODULE_1__["I18n"].get(_Translations_108d469f_js__WEBPACK_IMPORTED_MODULE_4__["T"].VERIFY_CONTACT_PHONE_LABEL),
|
|
2405
|
+
key: "phone_number",
|
|
2406
|
+
name: "contact",
|
|
2407
|
+
value: "phone_number",
|
|
2408
|
+
handleInputChange: function handleInputChange(event) {
|
|
2409
|
+
return _this.handleInputChange(event);
|
|
2410
|
+
},
|
|
2411
|
+
inputProps: {
|
|
2412
|
+
'data-test': 'verify-contact-phone-number-radio'
|
|
2413
|
+
}
|
|
2414
|
+
}));
|
|
2415
|
+
};
|
|
2416
|
+
|
|
2417
|
+
class_7.prototype.render = function () {
|
|
2418
|
+
var _this = this;
|
|
2419
|
+
|
|
2420
|
+
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
|
+
handleSubmit: function handleSubmit(event) {
|
|
2422
|
+
return _this.handleSubmit(event);
|
|
2423
|
+
},
|
|
2424
|
+
headerText: _aws_amplify_core__WEBPACK_IMPORTED_MODULE_1__["I18n"].get(_Translations_108d469f_js__WEBPACK_IMPORTED_MODULE_4__["T"].VERIFY_CONTACT_HEADER_TEXT),
|
|
2425
|
+
loading: this.loading,
|
|
2426
|
+
secondaryFooterContent: Object(_index_83f2275b_js__WEBPACK_IMPORTED_MODULE_0__["h"])("span", null, Object(_index_83f2275b_js__WEBPACK_IMPORTED_MODULE_0__["h"])("amplify-button", {
|
|
2427
|
+
variant: "anchor",
|
|
2428
|
+
onClick: function onClick() {
|
|
2429
|
+
return _this.handleAuthStateChange(_auth_types_78df304e_js__WEBPACK_IMPORTED_MODULE_2__["A"].SignedIn, _this.user);
|
|
2430
|
+
},
|
|
2431
|
+
"data-test": "verify-contact-skip-link"
|
|
2432
|
+
}, _aws_amplify_core__WEBPACK_IMPORTED_MODULE_1__["I18n"].get(_Translations_108d469f_js__WEBPACK_IMPORTED_MODULE_4__["T"].SKIP))),
|
|
2433
|
+
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
|
+
}, this.verifyAttr ? this.renderSubmit() : this.renderVerify()));
|
|
2435
|
+
};
|
|
2436
|
+
|
|
2437
|
+
return class_7;
|
|
406
2438
|
}();
|
|
407
2439
|
|
|
408
|
-
AmplifyAuthenticator.style = amplifyAuthenticatorCss;
|
|
409
2440
|
|
|
410
2441
|
|
|
411
2442
|
/***/ }),
|