@aws-amplify/ui-angular 2.0.7 → 2.0.11

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.
@@ -88,26 +88,31 @@
88
88
  AuthenticatorService.prototype.startMachine = function (_b) {
89
89
  var _this = this;
90
90
  var initialState = _b.initialState, loginMechanisms = _b.loginMechanisms, services = _b.services, signUpAttributes = _b.signUpAttributes, socialProviders = _b.socialProviders;
91
- var machine = ui.createAuthenticatorMachine({
92
- initialState: initialState,
93
- loginMechanisms: loginMechanisms,
94
- services: services,
95
- signUpAttributes: signUpAttributes,
96
- socialProviders: socialProviders,
91
+ var machine = ui.createAuthenticatorMachine();
92
+ var authService = xstate.interpret(machine).start();
93
+ authService.send({
94
+ type: 'INIT',
95
+ data: {
96
+ initialState: initialState,
97
+ loginMechanisms: loginMechanisms,
98
+ socialProviders: socialProviders,
99
+ signUpAttributes: signUpAttributes,
100
+ services: services,
101
+ },
97
102
  });
98
- var authService = xstate.interpret(machine, {
99
- devTools: process.env.NODE_ENV === 'development',
100
- }).start();
101
- this._subscription = authService.subscribe(function (state) {
103
+ this._machineSubscription = authService.subscribe(function (state) {
102
104
  _this._authState = state;
103
105
  _this._facade = ui.getServiceContextFacade(state);
104
106
  });
107
+ this._hubSubscription = ui.listenToAuthHub(authService.send);
105
108
  this._sendEventAliases = ui.getSendEventAliases(authService.send);
106
109
  this._authService = authService;
107
110
  };
108
111
  AuthenticatorService.prototype.ngOnDestroy = function () {
109
- if (this._subscription)
110
- this._subscription.unsubscribe();
112
+ if (this._machineSubscription)
113
+ this._machineSubscription.unsubscribe();
114
+ if (this._hubSubscription)
115
+ this._hubSubscription();
111
116
  };
112
117
  Object.defineProperty(AuthenticatorService.prototype, "error", {
113
118
  /**
@@ -703,7 +708,7 @@
703
708
  ForceNewPasswordComponent.decorators = [
704
709
  { type: i0.Component, args: [{
705
710
  selector: 'amplify-force-new-password',
706
- template: "<div data-amplify-container>\n <form data-amplify-form (submit)=\"onSubmit($event)\" (input)=\"onInput($event)\">\n <fieldset\n class=\"amplify-flex\"\n style=\"flex-direction: column\"\n data-amplify-fieldset\n [disabled]=\"authenticator.isPending\"\n >\n <amplify-slot name=\"force-new-password-header\" [context]=\"context\">\n <h3 class=\"amplify-heading\">{{ this.headerText }}</h3>\n </amplify-slot>\n <amplify-form-field\n name=\"password\"\n type=\"password\"\n autocomplete=\"new-password\"\n ></amplify-form-field>\n\n <amplify-form-field\n name=\"confirm_password\"\n label=\"Confirm Password\"\n type=\"password\"\n autocomplete=\"new-password\"\n ></amplify-form-field>\n\n <button amplify-button variation=\"primary\" fullWidth=\"true\" type=\"submit\">\n {{ changePasswordText }}\n </button>\n\n <button\n amplify-button\n size=\"small\"\n variation=\"link\"\n fontWeight=\"normal\"\n fullWidth=\"true\"\n (click)=\"authenticator.toSignIn()\"\n >\n {{ backToSignInText }}\n </button>\n <amplify-error *ngIf=\"authenticator.error\">\n {{ authenticator.error }}\n </amplify-error>\n </fieldset>\n <amplify-slot name=\"force-new-password-footer\" [context]=\"context\">\n </amplify-slot>\n </form>\n</div>\n"
711
+ template: "<div data-amplify-container>\n <form data-amplify-form (submit)=\"onSubmit($event)\" (input)=\"onInput($event)\">\n <fieldset\n class=\"amplify-flex\"\n style=\"flex-direction: column\"\n data-amplify-fieldset\n [disabled]=\"authenticator.isPending\"\n >\n <amplify-slot name=\"force-new-password-header\" [context]=\"context\">\n <h3 class=\"amplify-heading\">{{ this.headerText }}</h3>\n </amplify-slot>\n <amplify-form-field\n name=\"password\"\n type=\"password\"\n autocomplete=\"new-password\"\n ></amplify-form-field>\n\n <amplify-form-field\n name=\"confirm_password\"\n label=\"Confirm Password\"\n type=\"password\"\n autocomplete=\"new-password\"\n ></amplify-form-field>\n <amplify-slot name=\"force-new-form-fields\" [context]=\"context\">\n <amplify-force-new-password-form-fields></amplify-force-new-password-form-fields>\n </amplify-slot>\n\n <button amplify-button variation=\"primary\" fullWidth=\"true\" type=\"submit\">\n {{ changePasswordText }}\n </button>\n\n <button\n amplify-button\n size=\"small\"\n variation=\"link\"\n fontWeight=\"normal\"\n fullWidth=\"true\"\n (click)=\"authenticator.toSignIn()\"\n >\n {{ backToSignInText }}\n </button>\n <amplify-error *ngIf=\"authenticator.error\">\n {{ authenticator.error }}\n </amplify-error>\n </fieldset>\n <amplify-slot name=\"force-new-password-footer\" [context]=\"context\">\n </amplify-slot>\n </form>\n</div>\n"
707
712
  },] }
708
713
  ];
709
714
  ForceNewPasswordComponent.ctorParameters = function () { return [
@@ -714,6 +719,34 @@
714
719
  headerText: [{ type: i0.Input }]
715
720
  };
716
721
 
722
+ var ForceNewPasswordFormFieldsComponent = /** @class */ (function () {
723
+ function ForceNewPasswordFormFieldsComponent(authenticator) {
724
+ this.authenticator = authenticator;
725
+ }
726
+ ForceNewPasswordFormFieldsComponent.prototype.ngOnInit = function () {
727
+ var state = this.authenticator.authState;
728
+ var actorContext = ui.getActorContext(state);
729
+ var requiredAttributes = actorContext.requiredAttributes;
730
+ this.fieldNames = requiredAttributes.filter(function (fieldName) {
731
+ var hasDefaultField = !!ui.authInputAttributes[fieldName];
732
+ if (!hasDefaultField) {
733
+ console.debug("Authenticator does not have a default implementation for " + fieldName + ". Customize Authenticator.SignUp.FormFields to add your own.");
734
+ }
735
+ return hasDefaultField;
736
+ });
737
+ };
738
+ return ForceNewPasswordFormFieldsComponent;
739
+ }());
740
+ ForceNewPasswordFormFieldsComponent.decorators = [
741
+ { type: i0.Component, args: [{
742
+ selector: 'amplify-force-new-password-form-fields',
743
+ template: "<div class=\"amplify-flex\" style=\"flex-direction: column\" data-amplify-fieldset>\n <ng-container *ngFor=\"let field of fieldNames\">\n <amplify-form-field\n [name]=\"field\"\n [labelHidden]=\"false\"\n ></amplify-form-field>\n </ng-container>\n</div>\n"
744
+ },] }
745
+ ];
746
+ ForceNewPasswordFormFieldsComponent.ctorParameters = function () { return [
747
+ { type: AuthenticatorService }
748
+ ]; };
749
+
717
750
  var getAttributeMap = function () { return ui.authInputAttributes; };
718
751
 
719
752
  /**
@@ -741,11 +774,6 @@
741
774
  var state = this.authenticator.authState;
742
775
  var country_code = ui.getActorContext(state).country_code;
743
776
  this.defaultCountryCode = country_code;
744
- // TODO: remove this side-effect
745
- this.authenticator.updateForm({
746
- name: 'country_code',
747
- value: country_code,
748
- });
749
777
  }
750
778
  };
751
779
  Object.defineProperty(FormFieldComponent.prototype, "attributeMap", {
@@ -1804,6 +1832,7 @@
1804
1832
  FederatedSignInButtonComponent,
1805
1833
  FederatedSignInComponent,
1806
1834
  ForceNewPasswordComponent,
1835
+ ForceNewPasswordFormFieldsComponent,
1807
1836
  FormFieldComponent,
1808
1837
  PasswordFieldComponent,
1809
1838
  PhoneNumberFieldComponent,
@@ -1825,6 +1854,7 @@
1825
1854
  AuthenticatorComponent,
1826
1855
  CheckboxComponent,
1827
1856
  SignUpFormFieldsComponent,
1857
+ ForceNewPasswordFormFieldsComponent,
1828
1858
  TextFieldComponent,
1829
1859
  ],
1830
1860
  },] }
@@ -1853,6 +1883,7 @@
1853
1883
  exports.FederatedSignInButtonComponent = FederatedSignInButtonComponent;
1854
1884
  exports.FederatedSignInComponent = FederatedSignInComponent;
1855
1885
  exports.ForceNewPasswordComponent = ForceNewPasswordComponent;
1886
+ exports.ForceNewPasswordFormFieldsComponent = ForceNewPasswordFormFieldsComponent;
1856
1887
  exports.FormFieldComponent = FormFieldComponent;
1857
1888
  exports.PasswordFieldComponent = PasswordFieldComponent;
1858
1889
  exports.PhoneNumberFieldComponent = PhoneNumberFieldComponent;
@@ -1870,6 +1901,7 @@
1870
1901
  exports.getAttributeMap = getAttributeMap;
1871
1902
  exports["ɵa"] = AmplifySlotComponent;
1872
1903
  exports["ɵb"] = AuthenticatorComponent;
1904
+ exports["ɵba"] = VerifyUserComponent;
1873
1905
  exports["ɵc"] = ButtonComponent;
1874
1906
  exports["ɵd"] = CheckboxComponent;
1875
1907
  exports["ɵe"] = ConfirmResetPasswordComponent;
@@ -1880,20 +1912,20 @@
1880
1912
  exports["ɵj"] = FederatedSignInButtonComponent;
1881
1913
  exports["ɵk"] = FederatedSignInComponent;
1882
1914
  exports["ɵl"] = ForceNewPasswordComponent;
1883
- exports["ɵm"] = FormFieldComponent;
1884
- exports["ɵn"] = PasswordFieldComponent;
1885
- exports["ɵo"] = PhoneNumberFieldComponent;
1886
- exports["ɵp"] = ResetPasswordComponent;
1887
- exports["ɵq"] = SelectComponent;
1888
- exports["ɵr"] = SetupTotpComponent;
1889
- exports["ɵs"] = SignInComponent;
1890
- exports["ɵt"] = SignUpComponent;
1891
- exports["ɵu"] = SignUpFormFieldsComponent;
1892
- exports["ɵv"] = TabItemComponent;
1893
- exports["ɵw"] = TabsComponent;
1894
- exports["ɵx"] = TextFieldComponent;
1895
- exports["ɵy"] = UserNameAliasComponent;
1896
- exports["ɵz"] = VerifyUserComponent;
1915
+ exports["ɵm"] = ForceNewPasswordFormFieldsComponent;
1916
+ exports["ɵn"] = FormFieldComponent;
1917
+ exports["ɵo"] = PasswordFieldComponent;
1918
+ exports["ɵp"] = PhoneNumberFieldComponent;
1919
+ exports["ɵq"] = ResetPasswordComponent;
1920
+ exports["ɵr"] = SelectComponent;
1921
+ exports["ɵs"] = SetupTotpComponent;
1922
+ exports["ɵt"] = SignInComponent;
1923
+ exports["ɵu"] = SignUpComponent;
1924
+ exports["ɵv"] = SignUpFormFieldsComponent;
1925
+ exports["ɵw"] = TabItemComponent;
1926
+ exports["ɵx"] = TabsComponent;
1927
+ exports["ɵy"] = TextFieldComponent;
1928
+ exports["ɵz"] = UserNameAliasComponent;
1897
1929
 
1898
1930
  Object.defineProperty(exports, '__esModule', { value: true });
1899
1931