@aws-amplify/rtn-web-browser 1.0.1-unstable.cfbde4c.0 → 1.0.1
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/android/build.gradle +1 -1
- package/dist/cjs/apis/index.js +9 -0
- package/dist/cjs/apis/index.js.map +1 -0
- package/{lib → dist/cjs}/apis/openAuthSessionAsync.js +3 -2
- package/dist/cjs/apis/openAuthSessionAsync.js.map +1 -0
- package/dist/cjs/constants.js +14 -0
- package/dist/cjs/constants.js.map +1 -0
- package/dist/cjs/index.js +10 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/nativeModule.js +17 -0
- package/dist/cjs/nativeModule.js.map +1 -0
- package/dist/cjs/types/index.js +8 -0
- package/dist/cjs/types/index.js.map +1 -0
- package/{lib/types.js → dist/cjs/types/native.js} +3 -2
- package/dist/cjs/types/native.js.map +1 -0
- package/dist/esm/apis/index.d.ts +1 -0
- package/dist/esm/apis/index.mjs +2 -0
- package/dist/esm/apis/index.mjs.map +1 -0
- package/{lib-esm/apis/openAuthSessionAsync.js → dist/esm/apis/openAuthSessionAsync.mjs} +7 -4
- package/dist/esm/apis/openAuthSessionAsync.mjs.map +1 -0
- package/dist/esm/constants.d.ts +2 -0
- package/dist/esm/constants.mjs +13 -0
- package/dist/esm/constants.mjs.map +1 -0
- package/{lib → dist/esm}/index.d.ts +3 -2
- package/dist/esm/index.mjs +8 -0
- package/dist/esm/index.mjs.map +1 -0
- package/dist/esm/nativeModule.d.ts +4 -0
- package/dist/esm/nativeModule.mjs +16 -0
- package/dist/esm/nativeModule.mjs.map +1 -0
- package/dist/esm/types/index.d.ts +1 -0
- package/dist/esm/types/index.mjs +2 -0
- package/dist/esm/types/index.mjs.map +1 -0
- package/{lib-esm/types.d.ts → dist/esm/types/native.d.ts} +3 -2
- package/dist/esm/types/native.mjs +2 -0
- package/dist/esm/types/native.mjs.map +1 -0
- package/package.json +15 -16
- package/src/apis/index.ts +4 -0
- package/src/constants.ts +11 -0
- package/src/index.ts +4 -7
- package/src/nativeModule.ts +4 -7
- package/{lib-esm/types.js → src/types/index.ts} +2 -2
- package/src/{types.ts → types/native.ts} +4 -2
- package/lib/apis/openAuthSessionAsync.d.ts +0 -1
- package/lib/apis/openAuthSessionAsync.js.map +0 -1
- package/lib/index.js +0 -13
- package/lib/index.js.map +0 -1
- package/lib/nativeModule.d.ts +0 -2
- package/lib/nativeModule.js +0 -18
- package/lib/nativeModule.js.map +0 -1
- package/lib/types.d.ts +0 -3
- package/lib/types.js.map +0 -1
- package/lib-esm/apis/openAuthSessionAsync.js.map +0 -1
- package/lib-esm/index.d.ts +0 -4
- package/lib-esm/index.js +0 -10
- package/lib-esm/index.js.map +0 -1
- package/lib-esm/nativeModule.d.ts +0 -2
- package/lib-esm/nativeModule.js +0 -15
- package/lib-esm/nativeModule.js.map +0 -1
- package/lib-esm/types.js.map +0 -1
- /package/{lib-esm → dist/esm}/apis/openAuthSessionAsync.d.ts +0 -0
package/android/build.gradle
CHANGED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
4
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.openAuthSessionAsync = void 0;
|
|
7
|
+
var openAuthSessionAsync_1 = require("./openAuthSessionAsync");
|
|
8
|
+
Object.defineProperty(exports, "openAuthSessionAsync", { enumerable: true, get: function () { return openAuthSessionAsync_1.openAuthSessionAsync; } });
|
|
9
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/apis/index.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.openAuthSessionAsync = void 0;\nvar openAuthSessionAsync_1 = require(\"./openAuthSessionAsync\");\nObject.defineProperty(exports, \"openAuthSessionAsync\", { enumerable: true, get: function () { return openAuthSessionAsync_1.openAuthSessionAsync; } });\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9D,OAAO,CAAC,oBAAoB,GAAG,KAAK,CAAC,CAAC;AACtC,IAAI,sBAAsB,GAAG,OAAO,CAAC,wBAAwB,CAAC,CAAC;AAC/D,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,sBAAsB,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,YAAY,EAAE,OAAO,sBAAsB,CAAC,oBAAoB,CAAC,EAAE,EAAE,CAAC;;"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
2
3
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
4
|
// SPDX-License-Identifier: Apache-2.0
|
|
4
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -65,4 +66,4 @@ const getRedirectPromise = (redirectUrls) => new Promise(resolve => {
|
|
|
65
66
|
}
|
|
66
67
|
});
|
|
67
68
|
});
|
|
68
|
-
//# sourceMappingURL=openAuthSessionAsync.js.map
|
|
69
|
+
//# sourceMappingURL=openAuthSessionAsync.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"openAuthSessionAsync.js","sources":["../../../src/apis/openAuthSessionAsync.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.openAuthSessionAsync = void 0;\nconst react_native_1 = require(\"react-native\");\nconst nativeModule_1 = require(\"../nativeModule\");\nlet appStateListener;\nlet redirectListener;\nconst openAuthSessionAsync = async (url, redirectUrls, prefersEphemeralSession) => {\n // enforce HTTPS\n const httpsUrl = url.replace('http://', 'https://');\n if (react_native_1.Platform.OS === 'ios') {\n return openAuthSessionIOS(httpsUrl, redirectUrls, prefersEphemeralSession);\n }\n if (react_native_1.Platform.OS === 'android') {\n return openAuthSessionAndroid(httpsUrl, redirectUrls);\n }\n};\nexports.openAuthSessionAsync = openAuthSessionAsync;\nconst openAuthSessionIOS = async (url, redirectUrls, prefersEphemeralSession = false) => {\n const redirectUrl = redirectUrls.find(\n // take the first non-web url as the deeplink\n item => !item.startsWith('https://') && !item.startsWith('http://'));\n return nativeModule_1.nativeModule.openAuthSessionAsync(url, redirectUrl, prefersEphemeralSession);\n};\nconst openAuthSessionAndroid = async (url, redirectUrls) => {\n try {\n const [redirectUrl] = await Promise.all([\n Promise.race([\n // wait for app to redirect, resulting in a redirectUrl\n getRedirectPromise(redirectUrls),\n // wait for app to return some other way, resulting in null\n getAppStatePromise(),\n ]),\n // open chrome tab\n nativeModule_1.nativeModule.openAuthSessionAsync(url),\n ]);\n return redirectUrl;\n }\n finally {\n appStateListener?.remove();\n redirectListener?.remove();\n appStateListener = undefined;\n redirectListener = undefined;\n }\n};\nconst getAppStatePromise = () => new Promise(resolve => {\n appStateListener = react_native_1.AppState.addEventListener('change', nextAppState => {\n // if current state is null, the change is from initialization\n if (react_native_1.AppState.currentState === null) {\n return;\n }\n if (nextAppState === 'active') {\n appStateListener?.remove();\n appStateListener = undefined;\n resolve(null);\n }\n });\n});\nconst getRedirectPromise = (redirectUrls) => new Promise(resolve => {\n redirectListener = react_native_1.Linking.addEventListener('url', event => {\n if (redirectUrls.some(url => event.url.startsWith(url))) {\n resolve(event.url);\n }\n });\n});\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9D,OA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CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,EAAE;AACjE,YAAY,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;AAC/B,SAAS;AACT,KAAK,CAAC,CAAC;AACP,CAAC,CAAC;;"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.LINKING_ERROR = exports.PACKAGE_NAME = void 0;
|
|
5
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
6
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
7
|
+
const react_native_1 = require("react-native");
|
|
8
|
+
// General
|
|
9
|
+
exports.PACKAGE_NAME = '@aws-amplify/rtn-web-browser';
|
|
10
|
+
exports.LINKING_ERROR = `The ${exports.PACKAGE_NAME} package doesn't seem to be linked. Make sure: \n\n` +
|
|
11
|
+
react_native_1.Platform.select({ ios: "- You have run 'pod install'\n", default: '' }) +
|
|
12
|
+
'- You rebuilt the app after installing the package\n' +
|
|
13
|
+
'- You are not using Expo Go\n';
|
|
14
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sources":["../../src/constants.ts"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.LINKING_ERROR = exports.PACKAGE_NAME = void 0;\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nconst react_native_1 = require(\"react-native\");\n// General\nexports.PACKAGE_NAME = '@aws-amplify/rtn-web-browser';\nexports.LINKING_ERROR = `The ${exports.PACKAGE_NAME} package doesn't seem to be linked. Make sure: \\n\\n` +\n react_native_1.Platform.select({ ios: \"- You have run 'pod install'\\n\", default: '' }) +\n '- You rebuilt the app after installing the package\\n' +\n '- You are not using Expo Go\\n';\n"],"names":[],"mappings":";;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9D,OAAO,CAAC,aAAa,GAAG,OAAO,CAAC,YAAY,GAAG,KAAK,CAAC,CAAC;AACtD;AACA;AACA,MAAM,cAAc,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;AAC/C;AACA,OAAO,CAAC,YAAY,GAAG,8BAA8B,CAAC;AACtD,OAAO,CAAC,aAAa,GAAG,CAAC,IAAI,EAAE,OAAO,CAAC,YAAY,CAAC,mDAAmD,CAAC;AACxG,IAAI,cAAc,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,GAAG,EAAE,gCAAgC,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;AAC1F,IAAI,sDAAsD;AAC1D,IAAI,+BAA+B;;"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
4
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.module = void 0;
|
|
7
|
+
const apis_1 = require("./apis");
|
|
8
|
+
const module$1 = { openAuthSessionAsync: apis_1.openAuthSessionAsync };
|
|
9
|
+
exports.module = module$1;
|
|
10
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../src/index.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.module = void 0;\nconst apis_1 = require(\"./apis\");\nconst module = { openAuthSessionAsync: apis_1.openAuthSessionAsync };\nexports.module = module;\n"],"names":["module"],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9D,OAAO,CAAC,MAAM,GAAG,KAAK,CAAC,CAAC;AACxB,MAAM,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;AACjC,MAAMA,QAAM,GAAG,EAAE,oBAAoB,EAAE,MAAM,CAAC,oBAAoB,EAAE,CAAC;AACrE,OAAO,CAAC,MAAM,GAAGA,QAAM;;"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
4
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.nativeEventEmitter = exports.nativeModule = void 0;
|
|
7
|
+
const react_native_1 = require("react-native");
|
|
8
|
+
const constants_1 = require("./constants");
|
|
9
|
+
exports.nativeModule = react_native_1.NativeModules.AmplifyRTNWebBrowser
|
|
10
|
+
? react_native_1.NativeModules.AmplifyRTNWebBrowser
|
|
11
|
+
: new Proxy({}, {
|
|
12
|
+
get() {
|
|
13
|
+
throw new Error(constants_1.LINKING_ERROR);
|
|
14
|
+
},
|
|
15
|
+
});
|
|
16
|
+
exports.nativeEventEmitter = new react_native_1.NativeEventEmitter(exports.nativeModule);
|
|
17
|
+
//# sourceMappingURL=nativeModule.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nativeModule.js","sources":["../../src/nativeModule.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.nativeEventEmitter = exports.nativeModule = void 0;\nconst react_native_1 = require(\"react-native\");\nconst constants_1 = require(\"./constants\");\nexports.nativeModule = react_native_1.NativeModules.AmplifyRTNWebBrowser\n ? react_native_1.NativeModules.AmplifyRTNWebBrowser\n : new Proxy({}, {\n get() {\n throw new Error(constants_1.LINKING_ERROR);\n },\n });\nexports.nativeEventEmitter = new react_native_1.NativeEventEmitter(exports.nativeModule);\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9D,OAAO,CAAC,kBAAkB,GAAG,OAAO,CAAC,YAAY,GAAG,KAAK,CAAC,CAAC;AAC3D,MAAM,cAAc,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;AAC/C,MAAM,WAAW,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC;AAC3C,OAAO,CAAC,YAAY,GAAG,cAAc,CAAC,aAAa,CAAC,oBAAoB;AACxE,MAAM,cAAc,CAAC,aAAa,CAAC,oBAAoB;AACvD,MAAM,IAAI,KAAK,CAAC,EAAE,EAAE;AACpB,QAAQ,GAAG,GAAG;AACd,YAAY,MAAM,IAAI,KAAK,CAAC,WAAW,CAAC,aAAa,CAAC,CAAC;AACvD,SAAS;AACT,KAAK,CAAC,CAAC;AACP,OAAO,CAAC,kBAAkB,GAAG,IAAI,cAAc,CAAC,kBAAkB,CAAC,OAAO,CAAC,YAAY,CAAC;;"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
4
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const tslib_1 = require("tslib");
|
|
7
|
+
tslib_1.__exportStar(require("./native"), exports);
|
|
8
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/types/index.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst tslib_1 = require(\"tslib\");\ntslib_1.__exportStar(require(\"./native\"), exports);\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9D,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;AACjC,OAAO,CAAC,YAAY,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE,OAAO,CAAC;;"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
2
3
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
4
|
// SPDX-License-Identifier: Apache-2.0
|
|
4
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
//# sourceMappingURL=
|
|
6
|
+
//# sourceMappingURL=native.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"native.js","sources":["../../../src/types/native.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { openAuthSessionAsync } from './openAuthSessionAsync';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
+
import { Platform, AppState, Linking } from 'react-native';
|
|
2
|
+
import { nativeModule } from '../nativeModule.mjs';
|
|
3
|
+
|
|
1
4
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
5
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
import { AppState, Linking, Platform, } from 'react-native';
|
|
4
|
-
import { nativeModule } from '../nativeModule';
|
|
5
6
|
let appStateListener;
|
|
6
7
|
let redirectListener;
|
|
7
|
-
|
|
8
|
+
const openAuthSessionAsync = async (url, redirectUrls, prefersEphemeralSession) => {
|
|
8
9
|
// enforce HTTPS
|
|
9
10
|
const httpsUrl = url.replace('http://', 'https://');
|
|
10
11
|
if (Platform.OS === 'ios') {
|
|
@@ -61,4 +62,6 @@ const getRedirectPromise = (redirectUrls) => new Promise(resolve => {
|
|
|
61
62
|
}
|
|
62
63
|
});
|
|
63
64
|
});
|
|
64
|
-
|
|
65
|
+
|
|
66
|
+
export { openAuthSessionAsync };
|
|
67
|
+
//# sourceMappingURL=openAuthSessionAsync.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"openAuthSessionAsync.mjs","sources":["../../../src/apis/openAuthSessionAsync.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { AppState, Linking, Platform, } from 'react-native';\nimport { nativeModule } from '../nativeModule';\nlet appStateListener;\nlet redirectListener;\nexport const openAuthSessionAsync = async (url, redirectUrls, prefersEphemeralSession) => {\n // enforce HTTPS\n const httpsUrl = url.replace('http://', 'https://');\n if (Platform.OS === 'ios') {\n return openAuthSessionIOS(httpsUrl, redirectUrls, prefersEphemeralSession);\n }\n if (Platform.OS === 'android') {\n return openAuthSessionAndroid(httpsUrl, redirectUrls);\n }\n};\nconst openAuthSessionIOS = async (url, redirectUrls, prefersEphemeralSession = false) => {\n const redirectUrl = redirectUrls.find(\n // take the first non-web url as the deeplink\n item => !item.startsWith('https://') && !item.startsWith('http://'));\n return nativeModule.openAuthSessionAsync(url, redirectUrl, prefersEphemeralSession);\n};\nconst openAuthSessionAndroid = async (url, redirectUrls) => {\n try {\n const [redirectUrl] = await Promise.all([\n Promise.race([\n // wait for app to redirect, resulting in a redirectUrl\n getRedirectPromise(redirectUrls),\n // wait for app to return some other way, resulting in null\n getAppStatePromise(),\n ]),\n // open chrome tab\n nativeModule.openAuthSessionAsync(url),\n ]);\n return redirectUrl;\n }\n finally {\n appStateListener?.remove();\n redirectListener?.remove();\n appStateListener = undefined;\n redirectListener = undefined;\n }\n};\nconst getAppStatePromise = () => new Promise(resolve => {\n appStateListener = AppState.addEventListener('change', nextAppState => {\n // if current state is null, the change is from initialization\n if (AppState.currentState === null) {\n return;\n }\n if (nextAppState === 'active') {\n appStateListener?.remove();\n appStateListener = undefined;\n resolve(null);\n }\n });\n});\nconst getRedirectPromise = (redirectUrls) => new Promise(resolve => {\n redirectListener = Linking.addEventListener('url', event => {\n if (redirectUrls.some(url => event.url.startsWith(url))) {\n resolve(event.url);\n }\n });\n});\n"],"names":[],"mappings":";;;AAAA;AACA;AAGA,IAAI,gBAAgB,CAAC;AACrB,IAAI,gBAAgB,CAAC;AACT,MAAC,oBAAoB,GAAG,OAAO,GAAG,EAAE,YAAY,EAAE,uBAAuB,KAAK;AAC1F;AACA,IAAI,MAAM,QAAQ,GAAG,GAAG,CAAC,OAAO,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC;AACxD,IAAI,IAAI,QAAQ,CAAC,EAAE,KAAK,KAAK,EAAE;AAC/B,QAAQ,OAAO,kBAAkB,CAAC,QAAQ,EAAE,YAAY,EAAE,uBAAuB,CAAC,CAAC;AACnF,KAAK;AACL,IAAI,IAAI,QAAQ,CAAC,EAAE,KAAK,SAAS,EAAE;AACnC,QAAQ,OAAO,sBAAsB,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAC;AAC9D,KAAK;AACL,EAAE;AACF,MAAM,kBAAkB,GAAG,OAAO,GAAG,EAAE,YAAY,EAAE,uBAAuB,GAAG,KAAK,KAAK;AACzF,IAAI,MAAM,WAAW,GAAG,YAAY,CAAC,IAAI;AACzC;AACA,IAAI,IAAI,IAAI,CAAC,IAAI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KAAK,CAAC,CAAC;AACP,CAAC,CAAC,CAAC;AACH,MAAM,kBAAkB,GAAG,CAAC,YAAY,KAAK,IAAI,OAAO,CAAC,OAAO,IAAI;AACpE,IAAI,gBAAgB,GAAG,OAAO,CAAC,gBAAgB,CAAC,KAAK,EAAE,KAAK,IAAI;AAChE,QAAQ,IAAI,YAAY,CAAC,IAAI,CAAC,GAAG,IAAI,KAAK,CAAC,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,EAAE;AACjE,YAAY,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;AAC/B,SAAS;AACT,KAAK,CAAC,CAAC;AACP,CAAC,CAAC;;;;"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Platform } from 'react-native';
|
|
2
|
+
|
|
3
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
4
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
// General
|
|
6
|
+
const PACKAGE_NAME = '@aws-amplify/rtn-web-browser';
|
|
7
|
+
const LINKING_ERROR = `The ${PACKAGE_NAME} package doesn't seem to be linked. Make sure: \n\n` +
|
|
8
|
+
Platform.select({ ios: "- You have run 'pod install'\n", default: '' }) +
|
|
9
|
+
'- You rebuilt the app after installing the package\n' +
|
|
10
|
+
'- You are not using Expo Go\n';
|
|
11
|
+
|
|
12
|
+
export { LINKING_ERROR, PACKAGE_NAME };
|
|
13
|
+
//# sourceMappingURL=constants.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.mjs","sources":["../../src/constants.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { Platform } from 'react-native';\n// General\nexport const PACKAGE_NAME = '@aws-amplify/rtn-web-browser';\nexport const LINKING_ERROR = `The ${PACKAGE_NAME} package doesn't seem to be linked. Make sure: \\n\\n` +\n Platform.select({ ios: \"- You have run 'pod install'\\n\", default: '' }) +\n '- You rebuilt the app after installing the package\\n' +\n '- You are not using Expo Go\\n';\n"],"names":[],"mappings":";;AAAA;AACA;AAEA;AACY,MAAC,YAAY,GAAG,+BAA+B;AAC/C,MAAC,aAAa,GAAG,CAAC,IAAI,EAAE,YAAY,CAAC,mDAAmD,CAAC;AACrG,IAAI,QAAQ,CAAC,MAAM,CAAC,EAAE,GAAG,EAAE,gCAAgC,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;AAC3E,IAAI,sDAAsD;AAC1D,IAAI;;;;"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
declare const
|
|
1
|
+
declare const module: {
|
|
2
2
|
openAuthSessionAsync: (url: string, redirectUrls: string[], prefersEphemeralSession?: boolean | undefined) => Promise<string | null | undefined>;
|
|
3
3
|
};
|
|
4
|
-
export
|
|
4
|
+
export type WebBrowserModule = typeof module;
|
|
5
|
+
export { module };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { openAuthSessionAsync } from './apis/openAuthSessionAsync.mjs';
|
|
2
|
+
|
|
3
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
4
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
const module = { openAuthSessionAsync };
|
|
6
|
+
|
|
7
|
+
export { module };
|
|
8
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../../src/index.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { openAuthSessionAsync } from './apis';\nconst module = { openAuthSessionAsync };\nexport { module };\n"],"names":[],"mappings":";;AAAA;AACA;AAEK,MAAC,MAAM,GAAG,EAAE,oBAAoB;;;;"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { NativeModules, NativeEventEmitter } from 'react-native';
|
|
2
|
+
import { LINKING_ERROR } from './constants.mjs';
|
|
3
|
+
|
|
4
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
5
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
6
|
+
const nativeModule = NativeModules.AmplifyRTNWebBrowser
|
|
7
|
+
? NativeModules.AmplifyRTNWebBrowser
|
|
8
|
+
: new Proxy({}, {
|
|
9
|
+
get() {
|
|
10
|
+
throw new Error(LINKING_ERROR);
|
|
11
|
+
},
|
|
12
|
+
});
|
|
13
|
+
const nativeEventEmitter = new NativeEventEmitter(nativeModule);
|
|
14
|
+
|
|
15
|
+
export { nativeEventEmitter, nativeModule };
|
|
16
|
+
//# sourceMappingURL=nativeModule.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nativeModule.mjs","sources":["../../src/nativeModule.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { NativeModules, NativeEventEmitter } from 'react-native';\nimport { LINKING_ERROR } from './constants';\nexport const nativeModule = NativeModules.AmplifyRTNWebBrowser\n ? NativeModules.AmplifyRTNWebBrowser\n : new Proxy({}, {\n get() {\n throw new Error(LINKING_ERROR);\n },\n });\nexport const nativeEventEmitter = new NativeEventEmitter(nativeModule);\n"],"names":[],"mappings":";;;AAAA;AACA;AAGY,MAAC,YAAY,GAAG,aAAa,CAAC,oBAAoB;AAC9D,MAAM,aAAa,CAAC,oBAAoB;AACxC,MAAM,IAAI,KAAK,CAAC,EAAE,EAAE;AACpB,QAAQ,GAAG,GAAG;AACd,YAAY,MAAM,IAAI,KAAK,CAAC,aAAa,CAAC,CAAC;AAC3C,SAAS;AACT,KAAK,EAAE;AACK,MAAC,kBAAkB,GAAG,IAAI,kBAAkB,CAAC,YAAY;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './native';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import { NativeModule } from 'react-native';
|
|
2
|
+
export interface WebBrowserNativeModule extends NativeModule {
|
|
2
3
|
openAuthSessionAsync: (url: string, redirectUrl?: string, prefersEphemeralSession?: boolean) => Promise<string | null>;
|
|
3
|
-
}
|
|
4
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"native.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
package/package.json
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aws-amplify/rtn-web-browser",
|
|
3
|
-
"version": "1.0.1
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "React Native module for aws-amplify web browser",
|
|
5
|
-
"main": "./
|
|
6
|
-
"module": "./
|
|
7
|
-
"
|
|
5
|
+
"main": "./dist/cjs/index.js",
|
|
6
|
+
"module": "./dist/esm/index.mjs",
|
|
7
|
+
"react-native": "./src/index.ts",
|
|
8
|
+
"typings": "./dist/esm/index.d.ts",
|
|
8
9
|
"sideEffects": false,
|
|
9
10
|
"publishConfig": {
|
|
10
11
|
"access": "public"
|
|
@@ -13,24 +14,22 @@
|
|
|
13
14
|
"test": "tslint 'src/**/*.ts'",
|
|
14
15
|
"test:android": "./android/gradlew test -p ./android",
|
|
15
16
|
"build-with-test": "npm run clean && npm test && tsc",
|
|
16
|
-
"build:cjs": "
|
|
17
|
-
"build:
|
|
18
|
-
"build:
|
|
19
|
-
"build
|
|
20
|
-
"
|
|
21
|
-
"clean": "rimraf lib-esm lib dist",
|
|
17
|
+
"build:esm-cjs": "rollup -c rollup.config.mjs",
|
|
18
|
+
"build:cjs:watch": "rimraf dist/cjs && tsc -m commonjs --outDir dist/cjs --watch",
|
|
19
|
+
"build:esm:watch": "rimraf dist/esm && tsc -m esnext --outDir dist/esm --watch",
|
|
20
|
+
"build": "npm run clean && npm run build:esm-cjs",
|
|
21
|
+
"clean": "rimraf dist lib lib-esm",
|
|
22
22
|
"format": "echo \"Not implemented\"",
|
|
23
23
|
"lint": "tslint 'src/**/*.ts' && npm run ts-coverage",
|
|
24
24
|
"ts-coverage": "typescript-coverage-report -p ./tsconfig.build.json -t 88.21"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
|
+
"@rollup/plugin-typescript": "11.1.5",
|
|
27
28
|
"@types/react-native": "0.70.0",
|
|
28
29
|
"react-native": "0.72.3",
|
|
30
|
+
"rollup": "3.29.4",
|
|
29
31
|
"typescript": "5.1.6"
|
|
30
32
|
},
|
|
31
|
-
"react-native": {
|
|
32
|
-
"./lib/index": "./lib-esm/index.js"
|
|
33
|
-
},
|
|
34
33
|
"repository": {
|
|
35
34
|
"type": "git",
|
|
36
35
|
"url": "https://github.com/aws-amplify/amplify-js.git"
|
|
@@ -45,9 +44,9 @@
|
|
|
45
44
|
"Amplify*.podspec",
|
|
46
45
|
"android",
|
|
47
46
|
"ios",
|
|
48
|
-
"
|
|
49
|
-
"
|
|
47
|
+
"dist/cjs",
|
|
48
|
+
"dist/esm",
|
|
50
49
|
"src"
|
|
51
50
|
],
|
|
52
|
-
"gitHead": "
|
|
51
|
+
"gitHead": "f1408db3f570c4a18ada40cecbe7e68a0b31f1fe"
|
|
53
52
|
}
|
package/src/constants.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
import { Platform } from 'react-native';
|
|
4
|
+
|
|
5
|
+
// General
|
|
6
|
+
export const PACKAGE_NAME = '@aws-amplify/rtn-web-browser';
|
|
7
|
+
export const LINKING_ERROR =
|
|
8
|
+
`The ${PACKAGE_NAME} package doesn't seem to be linked. Make sure: \n\n` +
|
|
9
|
+
Platform.select({ ios: "- You have run 'pod install'\n", default: '' }) +
|
|
10
|
+
'- You rebuilt the app after installing the package\n' +
|
|
11
|
+
'- You are not using Expo Go\n';
|
package/src/index.ts
CHANGED
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
|
|
4
|
-
import { openAuthSessionAsync } from './apis
|
|
5
|
-
import { nativeModule } from './nativeModule';
|
|
4
|
+
import { openAuthSessionAsync } from './apis';
|
|
6
5
|
|
|
7
|
-
const
|
|
8
|
-
...nativeModule,
|
|
9
|
-
openAuthSessionAsync,
|
|
10
|
-
};
|
|
6
|
+
const module = { openAuthSessionAsync };
|
|
11
7
|
|
|
12
|
-
export
|
|
8
|
+
export type WebBrowserModule = typeof module;
|
|
9
|
+
export { module };
|
package/src/nativeModule.ts
CHANGED
|
@@ -1,15 +1,10 @@
|
|
|
1
1
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
|
|
4
|
-
import { NativeModules,
|
|
4
|
+
import { NativeModules, NativeEventEmitter } from 'react-native';
|
|
5
|
+
import { LINKING_ERROR } from './constants';
|
|
5
6
|
import { WebBrowserNativeModule } from './types';
|
|
6
7
|
|
|
7
|
-
const LINKING_ERROR =
|
|
8
|
-
`The package '@aws-amplify/rtn-web-browser' doesn't seem to be linked. Make sure: \n\n` +
|
|
9
|
-
Platform.select({ ios: "- You have run 'pod install'\n", default: '' }) +
|
|
10
|
-
'- You rebuilt the app after installing the package\n' +
|
|
11
|
-
'- You are not using Expo Go\n';
|
|
12
|
-
|
|
13
8
|
export const nativeModule: WebBrowserNativeModule =
|
|
14
9
|
NativeModules.AmplifyRTNWebBrowser
|
|
15
10
|
? NativeModules.AmplifyRTNWebBrowser
|
|
@@ -21,3 +16,5 @@ export const nativeModule: WebBrowserNativeModule =
|
|
|
21
16
|
},
|
|
22
17
|
}
|
|
23
18
|
);
|
|
19
|
+
|
|
20
|
+
export const nativeEventEmitter = new NativeEventEmitter(nativeModule);
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
import { NativeModule } from 'react-native';
|
|
5
|
+
|
|
6
|
+
export interface WebBrowserNativeModule extends NativeModule {
|
|
5
7
|
openAuthSessionAsync: (
|
|
6
8
|
url: string,
|
|
7
9
|
redirectUrl?: string,
|
|
8
10
|
prefersEphemeralSession?: boolean
|
|
9
11
|
) => Promise<string | null>;
|
|
10
|
-
}
|
|
12
|
+
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const openAuthSessionAsync: (url: string, redirectUrls: string[], prefersEphemeralSession?: boolean) => Promise<string | null | undefined>;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"openAuthSessionAsync.js","sourceRoot":"","sources":["../../src/apis/openAuthSessionAsync.ts"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;;;AAEtC,+CAKsB;AACtB,kDAA+C;AAE/C,IAAI,gBAAqD,CAAC;AAC1D,IAAI,gBAAqD,CAAC;AAEnD,MAAM,oBAAoB,GAAG,KAAK,EACxC,GAAW,EACX,YAAsB,EACtB,uBAAiC,EAChC,EAAE;IACH,gBAAgB;IAChB,MAAM,QAAQ,GAAG,GAAG,CAAC,OAAO,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC;IACpD,IAAI,uBAAQ,CAAC,EAAE,KAAK,KAAK,EAAE;QAC1B,OAAO,kBAAkB,CAAC,QAAQ,EAAE,YAAY,EAAE,uBAAuB,CAAC,CAAC;KAC3E;IAED,IAAI,uBAAQ,CAAC,EAAE,KAAK,SAAS,EAAE;QAC9B,OAAO,sBAAsB,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAC;KACtD;AACF,CAAC,CAAC;AAdW,QAAA,oBAAoB,wBAc/B;AAEF,MAAM,kBA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AE,CAAC;YAC3B,gBAAgB,GAAG,SAAS,CAAC;YAC7B,OAAO,CAAC,IAAI,CAAC,CAAC;SACd;IACF,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC,CAAC;AAEJ,MAAM,kBAAkB,GAAG,CAAC,YAAsB,EAAmB,EAAE,CACtE,IAAI,OAAO,CAAC,OAAO,CAAC,EAAE;IACrB,gBAAgB,GAAG,sBAAO,CAAC,gBAAgB,CAAC,KAAK,EAAE,KAAK,CAAC,EAAE;QAC1D,IAAI,YAAY,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,EAAE;YACxD,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;SACnB;IACF,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC,CAAC"}
|
package/lib/index.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
4
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
exports.AmplifyRTNWebBrowser = void 0;
|
|
6
|
-
const openAuthSessionAsync_1 = require("./apis/openAuthSessionAsync");
|
|
7
|
-
const nativeModule_1 = require("./nativeModule");
|
|
8
|
-
const mergedModule = {
|
|
9
|
-
...nativeModule_1.nativeModule,
|
|
10
|
-
openAuthSessionAsync: openAuthSessionAsync_1.openAuthSessionAsync,
|
|
11
|
-
};
|
|
12
|
-
exports.AmplifyRTNWebBrowser = mergedModule;
|
|
13
|
-
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;;;AAEtC,sEAAmE;AACnE,iDAA8C;AAE9C,MAAM,YAAY,GAAG;IACpB,GAAG,2BAAY;IACf,oBAAoB,EAApB,2CAAoB;CACpB,CAAC;AAEuB,4CAAoB"}
|
package/lib/nativeModule.d.ts
DELETED
package/lib/nativeModule.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
4
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
exports.nativeModule = void 0;
|
|
6
|
-
const react_native_1 = require("react-native");
|
|
7
|
-
const LINKING_ERROR = `The package '@aws-amplify/rtn-web-browser' doesn't seem to be linked. Make sure: \n\n` +
|
|
8
|
-
react_native_1.Platform.select({ ios: "- You have run 'pod install'\n", default: '' }) +
|
|
9
|
-
'- You rebuilt the app after installing the package\n' +
|
|
10
|
-
'- You are not using Expo Go\n';
|
|
11
|
-
exports.nativeModule = react_native_1.NativeModules.AmplifyRTNWebBrowser
|
|
12
|
-
? react_native_1.NativeModules.AmplifyRTNWebBrowser
|
|
13
|
-
: new Proxy({}, {
|
|
14
|
-
get() {
|
|
15
|
-
throw new Error(LINKING_ERROR);
|
|
16
|
-
},
|
|
17
|
-
});
|
|
18
|
-
//# sourceMappingURL=nativeModule.js.map
|
package/lib/nativeModule.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"nativeModule.js","sourceRoot":"","sources":["../src/nativeModule.ts"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;;;AAEtC,+CAAuD;AAGvD,MAAM,aAAa,GAClB,uFAAuF;IACvF,uBAAQ,CAAC,MAAM,CAAC,EAAE,GAAG,EAAE,gCAAgC,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;IACvE,sDAAsD;IACtD,+BAA+B,CAAC;AAEpB,QAAA,YAAY,GACxB,4BAAa,CAAC,oBAAoB;IACjC,CAAC,CAAC,4BAAa,CAAC,oBAAoB;IACpC,CAAC,CAAC,IAAI,KAAK,CACT,EAAE,EACF;QACC,GAAG;YACF,MAAM,IAAI,KAAK,CAAC,aAAa,CAAC,CAAC;QAChC,CAAC;KACD,CACA,CAAC"}
|
package/lib/types.d.ts
DELETED
package/lib/types.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"openAuthSessionAsync.js","sourceRoot":"","sources":["../../src/apis/openAuthSessionAsync.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAEtC,OAAO,EACN,QAAQ,EACR,OAAO,EAEP,QAAQ,GACR,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C,IAAI,gBAAqD,CAAC;AAC1D,IAAI,gBAAqD,CAAC;AAE1D,MAAM,CAAC,MAAM,oBAAoB,GAAG,KAAK,EACxC,GAAW,EACX,YAAsB,EACtB,uBAAiC,EAChC,EAAE;IACH,gBAAgB;IAChB,MAAM,QAAQ,GAAG,GAAG,CAAC,OAAO,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC;IACpD,IAAI,QAAQ,CAAC,EAAE,KAAK,KAAK,EAAE;QAC1B,OAAO,kBAAkB,CAAC,QAAQ,EAAE,YAAY,EAAE,uBAAuB,CAAC,CAAC;KAC3E;IAED,IAAI,QAAQ,CAAC,EAAE,KAAK,SAAS,EAAE;QAC9B,OAAO,sBAAsB,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAC;KACtD;AACF,CAAC,CAAC;AAEF,MAAM,kBAAkB,GAAG,KAAK,EAC/B,GAAW,EACX,YAAsB,EACtB,0BAAmC,KAAK,EACvC,EAAE;IACH,MAAM,WAAW,GAAG,YAAY,CAAC,IAAI;IACpC,6CAA6C;IAC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,MAAM,kBAAkB,GAAG,CAAC,YAAsB,EAAmB,EAAE,CACtE,IAAI,OAAO,CAAC,OAAO,CAAC,EAAE;IACrB,gBAAgB,GAAG,OAAO,CAAC,gBAAgB,CAAC,KAAK,EAAE,KAAK,CAAC,EAAE;QAC1D,IAAI,YAAY,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,EAAE;YACxD,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;SACnB;IACF,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC,CAAC"}
|
package/lib-esm/index.d.ts
DELETED
package/lib-esm/index.js
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
import { openAuthSessionAsync } from './apis/openAuthSessionAsync';
|
|
4
|
-
import { nativeModule } from './nativeModule';
|
|
5
|
-
const mergedModule = {
|
|
6
|
-
...nativeModule,
|
|
7
|
-
openAuthSessionAsync,
|
|
8
|
-
};
|
|
9
|
-
export { mergedModule as AmplifyRTNWebBrowser };
|
|
10
|
-
//# sourceMappingURL=index.js.map
|
package/lib-esm/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAEtC,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AACnE,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C,MAAM,YAAY,GAAG;IACpB,GAAG,YAAY;IACf,oBAAoB;CACpB,CAAC;AAEF,OAAO,EAAE,YAAY,IAAI,oBAAoB,EAAE,CAAC"}
|
package/lib-esm/nativeModule.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
import { NativeModules, Platform } from 'react-native';
|
|
4
|
-
const LINKING_ERROR = `The package '@aws-amplify/rtn-web-browser' doesn't seem to be linked. Make sure: \n\n` +
|
|
5
|
-
Platform.select({ ios: "- You have run 'pod install'\n", default: '' }) +
|
|
6
|
-
'- You rebuilt the app after installing the package\n' +
|
|
7
|
-
'- You are not using Expo Go\n';
|
|
8
|
-
export const nativeModule = NativeModules.AmplifyRTNWebBrowser
|
|
9
|
-
? NativeModules.AmplifyRTNWebBrowser
|
|
10
|
-
: new Proxy({}, {
|
|
11
|
-
get() {
|
|
12
|
-
throw new Error(LINKING_ERROR);
|
|
13
|
-
},
|
|
14
|
-
});
|
|
15
|
-
//# sourceMappingURL=nativeModule.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"nativeModule.js","sourceRoot":"","sources":["../src/nativeModule.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAEtC,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAGvD,MAAM,aAAa,GAClB,uFAAuF;IACvF,QAAQ,CAAC,MAAM,CAAC,EAAE,GAAG,EAAE,gCAAgC,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;IACvE,sDAAsD;IACtD,+BAA+B,CAAC;AAEjC,MAAM,CAAC,MAAM,YAAY,GACxB,aAAa,CAAC,oBAAoB;IACjC,CAAC,CAAC,aAAa,CAAC,oBAAoB;IACpC,CAAC,CAAC,IAAI,KAAK,CACT,EAAE,EACF;QACC,GAAG;YACF,MAAM,IAAI,KAAK,CAAC,aAAa,CAAC,CAAC;QAChC,CAAC;KACD,CACA,CAAC"}
|
package/lib-esm/types.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC"}
|
|
File without changes
|