@aws-amplify/ui-react-native 2.0.7 → 2.1.0

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.
@@ -1,4 +1,4 @@
1
1
  export { default as Authenticator } from './Authenticator';
2
2
  export { AuthenticatorProps, WithAuthenticatorOptions } from './types';
3
+ export { useAuthenticator, UseAuthenticator } from './useAuthenticator';
3
4
  export { default as withAuthenticator } from './withAuthenticator';
4
- export { useAuthenticator, UseAuthenticator } from '@aws-amplify/ui-react-core';
@@ -1,4 +1,3 @@
1
1
  export { default as Authenticator } from './Authenticator';
2
+ export { useAuthenticator } from './useAuthenticator';
2
3
  export { default as withAuthenticator } from './withAuthenticator';
3
- // re-export shared `Authenticator` exports
4
- export { useAuthenticator } from '@aws-amplify/ui-react-core';
@@ -0,0 +1,4 @@
1
+ export { UseAuthenticator } from '@aws-amplify/ui-react-core';
2
+ import { useAuthenticator as _useAuthenticator, UseAuthenticator } from '@aws-amplify/ui-react-core';
3
+ type UseAuthenticatorSelector = Parameters<typeof _useAuthenticator>[0];
4
+ export declare function useAuthenticator(selector?: UseAuthenticatorSelector): UseAuthenticator;
@@ -0,0 +1,18 @@
1
+ import { signOut as _signOut } from 'aws-amplify/auth';
2
+ import { useAuthenticator as _useAuthenticator, } from '@aws-amplify/ui-react-core';
3
+ // wrap and re-export `useAuthenticator` to replace state machine `signOut` with
4
+ // `aws-amplify/auth` version due to iOS specifc requirements for federated sign
5
+ // out handling with JS. On iOS sign out, JS prmnpts the end user with a native
6
+ // Alert requesting confirmation of sign out, if the end user cancels they will
7
+ // have already been signed out of the state machine, but will still be
8
+ // authenticated on the JS singleton
9
+ // input utility function to prevent breaking changes in consumers.
10
+ // State machine sign out handling does not pass input to underlying `signOut`
11
+ // call; replicate that behavior here
12
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
13
+ const signOut = (data) => {
14
+ _signOut();
15
+ };
16
+ export function useAuthenticator(selector) {
17
+ return { ..._useAuthenticator(selector), signOut };
18
+ }
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const VERSION = "2.0.7";
1
+ export declare const VERSION = "2.1.0";
package/dist/version.js CHANGED
@@ -1 +1 @@
1
- export const VERSION = '2.0.7';
1
+ export const VERSION = '2.1.0';
@@ -3,11 +3,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.useAuthenticator = exports.withAuthenticator = exports.Authenticator = void 0;
6
+ exports.withAuthenticator = exports.useAuthenticator = exports.Authenticator = void 0;
7
7
  var Authenticator_1 = require("./Authenticator");
8
8
  Object.defineProperty(exports, "Authenticator", { enumerable: true, get: function () { return __importDefault(Authenticator_1).default; } });
9
+ var useAuthenticator_1 = require("./useAuthenticator");
10
+ Object.defineProperty(exports, "useAuthenticator", { enumerable: true, get: function () { return useAuthenticator_1.useAuthenticator; } });
9
11
  var withAuthenticator_1 = require("./withAuthenticator");
10
12
  Object.defineProperty(exports, "withAuthenticator", { enumerable: true, get: function () { return __importDefault(withAuthenticator_1).default; } });
11
- // re-export shared `Authenticator` exports
12
- var ui_react_core_1 = require("@aws-amplify/ui-react-core");
13
- Object.defineProperty(exports, "useAuthenticator", { enumerable: true, get: function () { return ui_react_core_1.useAuthenticator; } });
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useAuthenticator = void 0;
4
+ const auth_1 = require("aws-amplify/auth");
5
+ const ui_react_core_1 = require("@aws-amplify/ui-react-core");
6
+ // wrap and re-export `useAuthenticator` to replace state machine `signOut` with
7
+ // `aws-amplify/auth` version due to iOS specifc requirements for federated sign
8
+ // out handling with JS. On iOS sign out, JS prmnpts the end user with a native
9
+ // Alert requesting confirmation of sign out, if the end user cancels they will
10
+ // have already been signed out of the state machine, but will still be
11
+ // authenticated on the JS singleton
12
+ // input utility function to prevent breaking changes in consumers.
13
+ // State machine sign out handling does not pass input to underlying `signOut`
14
+ // call; replicate that behavior here
15
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
16
+ const signOut = (data) => {
17
+ (0, auth_1.signOut)();
18
+ };
19
+ function useAuthenticator(selector) {
20
+ return { ...(0, ui_react_core_1.useAuthenticator)(selector), signOut };
21
+ }
22
+ exports.useAuthenticator = useAuthenticator;
package/lib/version.js CHANGED
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VERSION = void 0;
4
- exports.VERSION = '2.0.7';
4
+ exports.VERSION = '2.1.0';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aws-amplify/ui-react-native",
3
- "version": "2.0.7",
3
+ "version": "2.1.0",
4
4
  "main": "lib/index.js",
5
5
  "module": "dist/index.js",
6
6
  "react-native": "src/index.ts",
@@ -29,13 +29,13 @@
29
29
  "react-native-safe-area-context": "^4.7.3"
30
30
  },
31
31
  "dependencies": {
32
- "@aws-amplify/ui": "6.0.6",
33
- "@aws-amplify/ui-react-core": "3.0.6",
34
- "@aws-amplify/ui-react-core-notifications": "2.0.6"
32
+ "@aws-amplify/ui": "6.0.8",
33
+ "@aws-amplify/ui-react-core": "3.0.8",
34
+ "@aws-amplify/ui-react-core-notifications": "2.0.8"
35
35
  },
36
36
  "peerDependencies": {
37
37
  "aws-amplify": "^6.0.2",
38
- "react-native": "^0.70 || ^0.71 || ^0.72",
38
+ "react-native": "^0.70 || ^0.71 || ^0.72 || ^0.73",
39
39
  "react-native-safe-area-context": "^4.2.5"
40
40
  },
41
41
  "files": [
@@ -1,6 +1,4 @@
1
1
  export { default as Authenticator } from './Authenticator';
2
2
  export { AuthenticatorProps, WithAuthenticatorOptions } from './types';
3
+ export { useAuthenticator, UseAuthenticator } from './useAuthenticator';
3
4
  export { default as withAuthenticator } from './withAuthenticator';
4
-
5
- // re-export shared `Authenticator` exports
6
- export { useAuthenticator, UseAuthenticator } from '@aws-amplify/ui-react-core';
@@ -0,0 +1,34 @@
1
+ // re-export `UseAuthenticator` export
2
+ export { UseAuthenticator } from '@aws-amplify/ui-react-core';
3
+
4
+ import { signOut as _signOut } from 'aws-amplify/auth';
5
+ import { AuthEventData } from '@aws-amplify/ui';
6
+
7
+ import {
8
+ useAuthenticator as _useAuthenticator,
9
+ UseAuthenticator,
10
+ } from '@aws-amplify/ui-react-core';
11
+
12
+ // wrap and re-export `useAuthenticator` to replace state machine `signOut` with
13
+ // `aws-amplify/auth` version due to iOS specifc requirements for federated sign
14
+ // out handling with JS. On iOS sign out, JS prmnpts the end user with a native
15
+ // Alert requesting confirmation of sign out, if the end user cancels they will
16
+ // have already been signed out of the state machine, but will still be
17
+ // authenticated on the JS singleton
18
+
19
+ // input utility function to prevent breaking changes in consumers.
20
+ // State machine sign out handling does not pass input to underlying `signOut`
21
+ // call; replicate that behavior here
22
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
23
+ const signOut = (data?: AuthEventData) => {
24
+ _signOut();
25
+ };
26
+
27
+ // selector utility type to prevent breaking type changes in consumers
28
+ type UseAuthenticatorSelector = Parameters<typeof _useAuthenticator>[0];
29
+
30
+ export function useAuthenticator(
31
+ selector?: UseAuthenticatorSelector
32
+ ): UseAuthenticator {
33
+ return { ..._useAuthenticator(selector), signOut };
34
+ }
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const VERSION = '2.0.7';
1
+ export const VERSION = '2.1.0';