@aws-amplify/auth 4.3.10 → 4.3.11-in-app-messaging.48

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aws-amplify/auth",
3
- "version": "4.3.10",
3
+ "version": "4.3.11-in-app-messaging.48+72e99b94a",
4
4
  "description": "Auth category of aws-amplify",
5
5
  "main": "./lib/index.js",
6
6
  "module": "./lib-esm/index.js",
@@ -41,9 +41,9 @@
41
41
  },
42
42
  "homepage": "https://aws-amplify.github.io/",
43
43
  "dependencies": {
44
- "@aws-amplify/cache": "4.0.22",
45
- "@aws-amplify/core": "4.3.2",
46
- "amazon-cognito-identity-js": "5.2.0",
44
+ "@aws-amplify/cache": "4.0.23-in-app-messaging.48+72e99b94a",
45
+ "@aws-amplify/core": "4.3.3-in-app-messaging.48+72e99b94a",
46
+ "amazon-cognito-identity-js": "5.2.1-in-app-messaging.58+72e99b94a",
47
47
  "crypto-js": "^4.1.1"
48
48
  },
49
49
  "devDependencies": {
@@ -95,5 +95,5 @@
95
95
  ],
96
96
  "testSequencer": "./testSequencer.js"
97
97
  },
98
- "gitHead": "1af0b6a2589b42ed378540fc51c06171eea1fa8e"
98
+ "gitHead": "72e99b94afc8408ee2079b09897303b84ab5f15a"
99
99
  }
package/src/Auth.ts CHANGED
@@ -773,7 +773,7 @@ export class AuthClass {
773
773
  */
774
774
  public async setPreferredMFA(
775
775
  user: CognitoUser | any,
776
- mfaMethod: 'TOTP' | 'SMS' | 'NOMFA'
776
+ mfaMethod: 'TOTP' | 'SMS' | 'NOMFA' | 'SMS_MFA' | 'SOFTWARE_TOKEN_MFA'
777
777
  ): Promise<string> {
778
778
  const clientMetadata = this._config.clientMetadata; // TODO: verify behavior if this is override during signIn
779
779
 
@@ -785,13 +785,15 @@ export class AuthClass {
785
785
  let totpMfaSettings = null;
786
786
 
787
787
  switch (mfaMethod) {
788
- case 'TOTP' || 'SOFTWARE_TOKEN_MFA':
788
+ case 'TOTP':
789
+ case 'SOFTWARE_TOKEN_MFA':
789
790
  totpMfaSettings = {
790
791
  PreferredMfa: true,
791
792
  Enabled: true,
792
793
  };
793
794
  break;
794
- case 'SMS' || 'SMS_MFA':
795
+ case 'SMS':
796
+ case 'SMS_MFA':
795
797
  smsMfaSettings = {
796
798
  PreferredMfa: true,
797
799
  Enabled: true,
@@ -22,7 +22,7 @@ export default async callback => {
22
22
 
23
23
  let Linking: any;
24
24
  let AppState: any;
25
-
25
+ let subscription;
26
26
  try {
27
27
  ({ Linking, AppState } = require('react-native'));
28
28
  } catch (error) {
@@ -36,8 +36,15 @@ export default async callback => {
36
36
  callback({ url });
37
37
  });
38
38
 
39
- Linking.removeEventListener('url', handler);
40
- Linking.addEventListener('url', handler);
39
+ // Handles backward compatibility. removeEventListener is only available on RN versions before 0.65.
40
+ if (Linking.removeEventListener === typeof 'function') {
41
+ Linking.removeEventListener('url', handler);
42
+ Linking.addEventListener('url', handler);
43
+ } else {
44
+ // remove() method is only available on RN v0.65+.
45
+ subscription?.remove?.();
46
+ subscription = Linking.addEventListener('url', handler);
47
+ }
41
48
  AppState.addEventListener('change', async newAppState => {
42
49
  if (newAppState === 'active') {
43
50
  const initialUrl = await Linking.getInitialURL();