@clerk/expo 2.19.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.
- package/LICENSE +21 -0
- package/README.md +74 -0
- package/dist/cache/MemoryTokenCache.d.ts +3 -0
- package/dist/cache/MemoryTokenCache.d.ts.map +1 -0
- package/dist/cache/MemoryTokenCache.js +44 -0
- package/dist/cache/MemoryTokenCache.js.map +1 -0
- package/dist/cache/ResourceCache.d.ts +6 -0
- package/dist/cache/ResourceCache.d.ts.map +1 -0
- package/dist/cache/ResourceCache.js +84 -0
- package/dist/cache/ResourceCache.js.map +1 -0
- package/dist/cache/dummy-data/client-resource.d.ts +3 -0
- package/dist/cache/dummy-data/client-resource.d.ts.map +1 -0
- package/dist/cache/dummy-data/client-resource.js +157 -0
- package/dist/cache/dummy-data/client-resource.js.map +1 -0
- package/dist/cache/dummy-data/environment-resource.d.ts +3 -0
- package/dist/cache/dummy-data/environment-resource.d.ts.map +1 -0
- package/dist/cache/dummy-data/environment-resource.js +260 -0
- package/dist/cache/dummy-data/environment-resource.js.map +1 -0
- package/dist/cache/dummy-data/index.d.ts +3 -0
- package/dist/cache/dummy-data/index.d.ts.map +1 -0
- package/dist/cache/dummy-data/index.js +32 -0
- package/dist/cache/dummy-data/index.js.map +1 -0
- package/dist/cache/index.d.ts +5 -0
- package/dist/cache/index.d.ts.map +1 -0
- package/dist/cache/index.js +44 -0
- package/dist/cache/index.js.map +1 -0
- package/dist/cache/types.d.ts +18 -0
- package/dist/cache/types.d.ts.map +1 -0
- package/dist/cache/types.js +17 -0
- package/dist/cache/types.js.map +1 -0
- package/dist/components/controlComponents.d.ts +2 -0
- package/dist/components/controlComponents.d.ts.map +1 -0
- package/dist/components/controlComponents.js +37 -0
- package/dist/components/controlComponents.js.map +1 -0
- package/dist/components/index.d.ts +2 -0
- package/dist/components/index.d.ts.map +1 -0
- package/dist/components/index.js +23 -0
- package/dist/components/index.js.map +1 -0
- package/dist/errorThrower.d.ts +3 -0
- package/dist/errorThrower.d.ts.map +1 -0
- package/dist/errorThrower.js +30 -0
- package/dist/errorThrower.js.map +1 -0
- package/dist/experimental.d.ts +2 -0
- package/dist/experimental.d.ts.map +1 -0
- package/dist/experimental.js +17 -0
- package/dist/experimental.js.map +1 -0
- package/dist/global.d.js +2 -0
- package/dist/global.d.js.map +1 -0
- package/dist/hooks/index.d.ts +6 -0
- package/dist/hooks/index.d.ts.map +1 -0
- package/dist/hooks/index.js +56 -0
- package/dist/hooks/index.js.map +1 -0
- package/dist/hooks/useAuth.d.ts +3 -0
- package/dist/hooks/useAuth.d.ts.map +1 -0
- package/dist/hooks/useAuth.js +50 -0
- package/dist/hooks/useAuth.js.map +1 -0
- package/dist/hooks/useOAuth.d.ts +25 -0
- package/dist/hooks/useOAuth.d.ts.map +1 -0
- package/dist/hooks/useOAuth.js +104 -0
- package/dist/hooks/useOAuth.js.map +1 -0
- package/dist/hooks/useSSO.d.ts +23 -0
- package/dist/hooks/useSSO.d.ts.map +1 -0
- package/dist/hooks/useSSO.js +105 -0
- package/dist/hooks/useSSO.js.map +1 -0
- package/dist/hooks/useSignInWithApple.d.ts +50 -0
- package/dist/hooks/useSignInWithApple.d.ts.map +1 -0
- package/dist/hooks/useSignInWithApple.ios.d.ts +51 -0
- package/dist/hooks/useSignInWithApple.ios.d.ts.map +1 -0
- package/dist/hooks/useSignInWithApple.ios.js +117 -0
- package/dist/hooks/useSignInWithApple.ios.js.map +1 -0
- package/dist/hooks/useSignInWithApple.js +39 -0
- package/dist/hooks/useSignInWithApple.js.map +1 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +52 -0
- package/dist/index.js.map +1 -0
- package/dist/legacy.d.ts +2 -0
- package/dist/legacy.d.ts.map +1 -0
- package/dist/legacy.js +31 -0
- package/dist/legacy.js.map +1 -0
- package/dist/local-credentials/index.d.ts +2 -0
- package/dist/local-credentials/index.d.ts.map +1 -0
- package/dist/local-credentials/index.js +29 -0
- package/dist/local-credentials/index.js.map +1 -0
- package/dist/local-credentials/useLocalCredentials/index.d.ts +2 -0
- package/dist/local-credentials/useLocalCredentials/index.d.ts.map +1 -0
- package/dist/local-credentials/useLocalCredentials/index.js +29 -0
- package/dist/local-credentials/useLocalCredentials/index.js.map +1 -0
- package/dist/local-credentials/useLocalCredentials/shared.d.ts +24 -0
- package/dist/local-credentials/useLocalCredentials/shared.d.ts.map +1 -0
- package/dist/local-credentials/useLocalCredentials/shared.js +37 -0
- package/dist/local-credentials/useLocalCredentials/shared.js.map +1 -0
- package/dist/local-credentials/useLocalCredentials/useLocalCredentials.d.ts +7 -0
- package/dist/local-credentials/useLocalCredentials/useLocalCredentials.d.ts.map +1 -0
- package/dist/local-credentials/useLocalCredentials/useLocalCredentials.js +195 -0
- package/dist/local-credentials/useLocalCredentials/useLocalCredentials.js.map +1 -0
- package/dist/local-credentials/useLocalCredentials/useLocalCredentials.web.d.ts +3 -0
- package/dist/local-credentials/useLocalCredentials/useLocalCredentials.web.d.ts.map +1 -0
- package/dist/local-credentials/useLocalCredentials/useLocalCredentials.web.js +32 -0
- package/dist/local-credentials/useLocalCredentials/useLocalCredentials.web.js.map +1 -0
- package/dist/passkeys/index.d.ts +3 -0
- package/dist/passkeys/index.d.ts.map +1 -0
- package/dist/passkeys/index.js +29 -0
- package/dist/passkeys/index.js.map +1 -0
- package/dist/polyfills/base64Polyfill.d.ts +2 -0
- package/dist/polyfills/base64Polyfill.d.ts.map +1 -0
- package/dist/polyfills/base64Polyfill.js +10 -0
- package/dist/polyfills/base64Polyfill.js.map +1 -0
- package/dist/polyfills/index.d.ts +3 -0
- package/dist/polyfills/index.d.ts.map +1 -0
- package/dist/polyfills/index.js +4 -0
- package/dist/polyfills/index.js.map +1 -0
- package/dist/provider/ClerkProvider.d.ts +32 -0
- package/dist/provider/ClerkProvider.d.ts.map +1 -0
- package/dist/provider/ClerkProvider.js +85 -0
- package/dist/provider/ClerkProvider.js.map +1 -0
- package/dist/provider/singleton/createClerkInstance.d.ts +9 -0
- package/dist/provider/singleton/createClerkInstance.d.ts.map +1 -0
- package/dist/provider/singleton/createClerkInstance.js +167 -0
- package/dist/provider/singleton/createClerkInstance.js.map +1 -0
- package/dist/provider/singleton/index.d.ts +2 -0
- package/dist/provider/singleton/index.d.ts.map +1 -0
- package/dist/provider/singleton/index.js +23 -0
- package/dist/provider/singleton/index.js.map +1 -0
- package/dist/provider/singleton/singleton.d.ts +25 -0
- package/dist/provider/singleton/singleton.d.ts.map +1 -0
- package/dist/provider/singleton/singleton.js +34 -0
- package/dist/provider/singleton/singleton.js.map +1 -0
- package/dist/provider/singleton/singleton.web.d.ts +11 -0
- package/dist/provider/singleton/singleton.web.d.ts.map +1 -0
- package/dist/provider/singleton/singleton.web.js +36 -0
- package/dist/provider/singleton/singleton.web.js.map +1 -0
- package/dist/provider/singleton/types.d.ts +26 -0
- package/dist/provider/singleton/types.d.ts.map +1 -0
- package/dist/provider/singleton/types.js +17 -0
- package/dist/provider/singleton/types.js.map +1 -0
- package/dist/resource-cache/index.d.ts +2 -0
- package/dist/resource-cache/index.d.ts.map +1 -0
- package/dist/resource-cache/index.js +29 -0
- package/dist/resource-cache/index.js.map +1 -0
- package/dist/resource-cache/resource-cache.d.ts +17 -0
- package/dist/resource-cache/resource-cache.d.ts.map +1 -0
- package/dist/resource-cache/resource-cache.js +154 -0
- package/dist/resource-cache/resource-cache.js.map +1 -0
- package/dist/secure-store/index.d.ts +6 -0
- package/dist/secure-store/index.d.ts.map +1 -0
- package/dist/secure-store/index.js +30 -0
- package/dist/secure-store/index.js.map +1 -0
- package/dist/token-cache/index.d.ts +16 -0
- package/dist/token-cache/index.d.ts.map +1 -0
- package/dist/token-cache/index.js +66 -0
- package/dist/token-cache/index.js.map +1 -0
- package/dist/utils/errors.d.ts +2 -0
- package/dist/utils/errors.d.ts.map +1 -0
- package/dist/utils/errors.js +30 -0
- package/dist/utils/errors.js.map +1 -0
- package/dist/utils/index.d.ts +3 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +25 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/runtime.d.ts +10 -0
- package/dist/utils/runtime.d.ts.map +1 -0
- package/dist/utils/runtime.js +47 -0
- package/dist/utils/runtime.js.map +1 -0
- package/dist/web/index.d.ts +3 -0
- package/dist/web/index.d.ts.map +1 -0
- package/dist/web/index.js +25 -0
- package/dist/web/index.js.map +1 -0
- package/dist/web/uiComponents.d.ts +18 -0
- package/dist/web/uiComponents.d.ts.map +1 -0
- package/dist/web/uiComponents.js +88 -0
- package/dist/web/uiComponents.js.map +1 -0
- package/package.json +138 -0
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var passkeys_exports = {};
|
|
20
|
+
__export(passkeys_exports, {
|
|
21
|
+
passkeys: () => import_expo_passkeys.passkeys
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(passkeys_exports);
|
|
24
|
+
var import_expo_passkeys = require("@clerk/expo-passkeys");
|
|
25
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
26
|
+
0 && (module.exports = {
|
|
27
|
+
passkeys
|
|
28
|
+
});
|
|
29
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/passkeys/index.ts"],"sourcesContent":["import { passkeys } from '@clerk/expo-passkeys';\n\nexport { passkeys };\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,2BAAyB;","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base64Polyfill.d.ts","sourceRoot":"","sources":["../../src/polyfills/base64Polyfill.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var import_base_64 = require("base-64");
|
|
3
|
+
var import_utils = require("../utils");
|
|
4
|
+
if (!global.btoa || (0, import_utils.isHermes)()) {
|
|
5
|
+
global.btoa = import_base_64.encode;
|
|
6
|
+
}
|
|
7
|
+
if (!global.atob || (0, import_utils.isHermes)()) {
|
|
8
|
+
global.atob = import_base_64.decode;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=base64Polyfill.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/polyfills/base64Polyfill.ts"],"sourcesContent":["import { decode, encode } from 'base-64';\n\nimport { isHermes } from '../utils';\n\n// See Default Expo 51 engine Hermes' issue: https://github.com/facebook/hermes/issues/1379\nif (!global.btoa || isHermes()) {\n global.btoa = encode;\n}\n\n// See Default Expo 51 engine Hermes' issue: https://github.com/facebook/hermes/issues/1379\nif (!global.atob || isHermes()) {\n global.atob = decode;\n}\n"],"mappings":";AAAA,qBAA+B;AAE/B,mBAAyB;AAGzB,IAAI,CAAC,OAAO,YAAQ,uBAAS,GAAG;AAC9B,SAAO,OAAO;AAChB;AAGA,IAAI,CAAC,OAAO,YAAQ,uBAAS,GAAG;AAC9B,SAAO,OAAO;AAChB;","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/polyfills/index.ts"],"names":[],"mappings":"AAAA,OAAO,gCAAgC,CAAC;AACxC,OAAO,kBAAkB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/polyfills/index.ts"],"sourcesContent":["import 'react-native-url-polyfill/auto';\nimport './base64Polyfill';\n"],"mappings":";AAAA,kBAAO;AACP,4BAAO;","names":[]}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import '../polyfills';
|
|
2
|
+
import { ClerkProvider as ClerkReactProvider } from '@clerk/react';
|
|
3
|
+
import type { Without } from '@clerk/shared/types';
|
|
4
|
+
import type { TokenCache } from '../cache/types';
|
|
5
|
+
import type { BuildClerkOptions } from './singleton/types';
|
|
6
|
+
export type ClerkProviderProps = Without<React.ComponentProps<typeof ClerkReactProvider>, 'publishableKey'> & {
|
|
7
|
+
/**
|
|
8
|
+
* Used to override the default EXPO_PUBLIC_CLERK_PUBLISHABLE_KEY env variable if needed.
|
|
9
|
+
* This is optional for Expo as the ClerkProvider will automatically use the EXPO_PUBLIC_CLERK_PUBLISHABLE_KEY env variable if it exists.
|
|
10
|
+
*/
|
|
11
|
+
publishableKey?: string;
|
|
12
|
+
/**
|
|
13
|
+
* The token cache is used to persist the active user's session token. Clerk stores this token in memory by default, however it is recommended to use a token cache for production applications.
|
|
14
|
+
* @see https://clerk.com/docs/quickstarts/expo#configure-the-token-cache-with-expo
|
|
15
|
+
*/
|
|
16
|
+
tokenCache?: TokenCache;
|
|
17
|
+
/**
|
|
18
|
+
* Note: Passkey support in Expo is currently in a limited rollout phase.
|
|
19
|
+
* If you're interested in using this feature, please contact us for early access or additional details.
|
|
20
|
+
*
|
|
21
|
+
* @experimental This API is experimental and may change at any moment.
|
|
22
|
+
*/
|
|
23
|
+
__experimental_passkeys?: BuildClerkOptions['__experimental_passkeys'];
|
|
24
|
+
/**
|
|
25
|
+
* This cache is used to store the resources that Clerk fetches from the server when the network is offline.
|
|
26
|
+
*
|
|
27
|
+
* @experimental This API is experimental and may change at any moment.
|
|
28
|
+
*/
|
|
29
|
+
__experimental_resourceCache?: BuildClerkOptions['__experimental_resourceCache'];
|
|
30
|
+
};
|
|
31
|
+
export declare function ClerkProvider(props: ClerkProviderProps): JSX.Element;
|
|
32
|
+
//# sourceMappingURL=ClerkProvider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ClerkProvider.d.ts","sourceRoot":"","sources":["../../src/provider/ClerkProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,cAAc,CAAC;AAEtB,OAAO,EAAE,aAAa,IAAI,kBAAkB,EAAE,MAAM,cAAc,CAAC;AACnE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAGnD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAGjD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAE3D,MAAM,MAAM,kBAAkB,GAAG,OAAO,CAAC,KAAK,CAAC,cAAc,CAAC,OAAO,kBAAkB,CAAC,EAAE,gBAAgB,CAAC,GAAG;IAC5G;;;OAGG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB;;;OAGG;IACH,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB;;;;;OAKG;IACH,uBAAuB,CAAC,EAAE,iBAAiB,CAAC,yBAAyB,CAAC,CAAC;IACvE;;;;OAIG;IACH,4BAA4B,CAAC,EAAE,iBAAiB,CAAC,8BAA8B,CAAC,CAAC;CAClF,CAAC;AAOF,wBAAgB,aAAa,CAAC,KAAK,EAAE,kBAAkB,GAAG,GAAG,CAAC,OAAO,CA6CpE"}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var ClerkProvider_exports = {};
|
|
30
|
+
__export(ClerkProvider_exports, {
|
|
31
|
+
ClerkProvider: () => ClerkProvider
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(ClerkProvider_exports);
|
|
34
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
35
|
+
var import_polyfills = require("../polyfills");
|
|
36
|
+
var import_react = require("@clerk/react");
|
|
37
|
+
var WebBrowser = __toESM(require("expo-web-browser"));
|
|
38
|
+
var import_runtime = require("../utils/runtime");
|
|
39
|
+
var import_singleton = require("./singleton");
|
|
40
|
+
const SDK_METADATA = {
|
|
41
|
+
name: "@clerk/expo",
|
|
42
|
+
version: "2.19.0"
|
|
43
|
+
};
|
|
44
|
+
function ClerkProvider(props) {
|
|
45
|
+
const {
|
|
46
|
+
children,
|
|
47
|
+
tokenCache,
|
|
48
|
+
publishableKey,
|
|
49
|
+
__experimental_passkeys,
|
|
50
|
+
experimental,
|
|
51
|
+
__experimental_resourceCache,
|
|
52
|
+
...rest
|
|
53
|
+
} = props;
|
|
54
|
+
const pk = publishableKey || process.env.EXPO_PUBLIC_CLERK_PUBLISHABLE_KEY || process.env.CLERK_PUBLISHABLE_KEY || "";
|
|
55
|
+
if ((0, import_runtime.isWeb)()) {
|
|
56
|
+
WebBrowser.maybeCompleteAuthSession();
|
|
57
|
+
}
|
|
58
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
59
|
+
import_react.ClerkProvider,
|
|
60
|
+
{
|
|
61
|
+
...rest,
|
|
62
|
+
publishableKey: pk,
|
|
63
|
+
sdkMetadata: SDK_METADATA,
|
|
64
|
+
Clerk: (0, import_runtime.isNative)() ? (0, import_singleton.getClerkInstance)({
|
|
65
|
+
publishableKey: pk,
|
|
66
|
+
tokenCache,
|
|
67
|
+
__experimental_passkeys,
|
|
68
|
+
__experimental_resourceCache
|
|
69
|
+
}) : null,
|
|
70
|
+
standardBrowser: !(0, import_runtime.isNative)(),
|
|
71
|
+
experimental: {
|
|
72
|
+
...experimental,
|
|
73
|
+
// force the rethrowOfflineNetworkErrors flag to true if the asyncStorage is provided
|
|
74
|
+
rethrowOfflineNetworkErrors: !!__experimental_resourceCache || (experimental == null ? void 0 : experimental.rethrowOfflineNetworkErrors)
|
|
75
|
+
},
|
|
76
|
+
children
|
|
77
|
+
},
|
|
78
|
+
pk
|
|
79
|
+
);
|
|
80
|
+
}
|
|
81
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
82
|
+
0 && (module.exports = {
|
|
83
|
+
ClerkProvider
|
|
84
|
+
});
|
|
85
|
+
//# sourceMappingURL=ClerkProvider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/provider/ClerkProvider.tsx"],"sourcesContent":["import '../polyfills';\n\nimport { ClerkProvider as ClerkReactProvider } from '@clerk/react';\nimport type { Without } from '@clerk/shared/types';\nimport * as WebBrowser from 'expo-web-browser';\n\nimport type { TokenCache } from '../cache/types';\nimport { isNative, isWeb } from '../utils/runtime';\nimport { getClerkInstance } from './singleton';\nimport type { BuildClerkOptions } from './singleton/types';\n\nexport type ClerkProviderProps = Without<React.ComponentProps<typeof ClerkReactProvider>, 'publishableKey'> & {\n /**\n * Used to override the default EXPO_PUBLIC_CLERK_PUBLISHABLE_KEY env variable if needed.\n * This is optional for Expo as the ClerkProvider will automatically use the EXPO_PUBLIC_CLERK_PUBLISHABLE_KEY env variable if it exists.\n */\n publishableKey?: string;\n /**\n * The token cache is used to persist the active user's session token. Clerk stores this token in memory by default, however it is recommended to use a token cache for production applications.\n * @see https://clerk.com/docs/quickstarts/expo#configure-the-token-cache-with-expo\n */\n tokenCache?: TokenCache;\n /**\n * Note: Passkey support in Expo is currently in a limited rollout phase.\n * If you're interested in using this feature, please contact us for early access or additional details.\n *\n * @experimental This API is experimental and may change at any moment.\n */\n __experimental_passkeys?: BuildClerkOptions['__experimental_passkeys'];\n /**\n * This cache is used to store the resources that Clerk fetches from the server when the network is offline.\n *\n * @experimental This API is experimental and may change at any moment.\n */\n __experimental_resourceCache?: BuildClerkOptions['__experimental_resourceCache'];\n};\n\nconst SDK_METADATA = {\n name: PACKAGE_NAME,\n version: PACKAGE_VERSION,\n};\n\nexport function ClerkProvider(props: ClerkProviderProps): JSX.Element {\n const {\n children,\n tokenCache,\n publishableKey,\n __experimental_passkeys,\n experimental,\n __experimental_resourceCache,\n ...rest\n } = props;\n const pk = publishableKey || process.env.EXPO_PUBLIC_CLERK_PUBLISHABLE_KEY || process.env.CLERK_PUBLISHABLE_KEY || '';\n\n if (isWeb()) {\n // This is needed in order for useOAuth to work correctly on web.\n WebBrowser.maybeCompleteAuthSession();\n }\n\n return (\n <ClerkReactProvider\n // Force reset the state when the provided key changes, this ensures that the provider does not retain stale state.\n // See JS-598 for additional context.\n key={pk}\n {...rest}\n publishableKey={pk}\n sdkMetadata={SDK_METADATA}\n Clerk={\n isNative()\n ? getClerkInstance({\n publishableKey: pk,\n tokenCache,\n __experimental_passkeys,\n __experimental_resourceCache,\n })\n : null\n }\n standardBrowser={!isNative()}\n experimental={{\n ...experimental,\n // force the rethrowOfflineNetworkErrors flag to true if the asyncStorage is provided\n rethrowOfflineNetworkErrors: !!__experimental_resourceCache || experimental?.rethrowOfflineNetworkErrors,\n }}\n >\n {children}\n </ClerkReactProvider>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AA4DI;AA5DJ,uBAAO;AAEP,mBAAoD;AAEpD,iBAA4B;AAG5B,qBAAgC;AAChC,uBAAiC;AA6BjC,MAAM,eAAe;AAAA,EACnB,MAAM;AAAA,EACN,SAAS;AACX;AAEO,SAAS,cAAc,OAAwC;AACpE,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,GAAG;AAAA,EACL,IAAI;AACJ,QAAM,KAAK,kBAAkB,QAAQ,IAAI,qCAAqC,QAAQ,IAAI,yBAAyB;AAEnH,UAAI,sBAAM,GAAG;AAEX,eAAW,yBAAyB;AAAA,EACtC;AAEA,SACE;AAAA,IAAC,aAAAA;AAAA,IAAA;AAAA,MAIE,GAAG;AAAA,MACJ,gBAAgB;AAAA,MAChB,aAAa;AAAA,MACb,WACE,yBAAS,QACL,mCAAiB;AAAA,QACf,gBAAgB;AAAA,QAChB;AAAA,QACA;AAAA,QACA;AAAA,MACF,CAAC,IACD;AAAA,MAEN,iBAAiB,KAAC,yBAAS;AAAA,MAC3B,cAAc;AAAA,QACZ,GAAG;AAAA;AAAA,QAEH,6BAA6B,CAAC,CAAC,iCAAgC,6CAAc;AAAA,MAC/E;AAAA,MAEC;AAAA;AAAA,IArBI;AAAA,EAsBP;AAEJ;","names":["ClerkReactProvider"]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type Clerk } from '@clerk/clerk-js/headless';
|
|
2
|
+
import type { BrowserClerk, HeadlessBrowserClerk } from '@clerk/react';
|
|
3
|
+
import type { BuildClerkOptions } from './types';
|
|
4
|
+
/**
|
|
5
|
+
* @deprecated Use `getClerkInstance()` instead. `Clerk` will be removed in the next major version.
|
|
6
|
+
*/
|
|
7
|
+
export declare let clerk: HeadlessBrowserClerk | BrowserClerk;
|
|
8
|
+
export declare function createClerkInstance(ClerkClass: typeof Clerk): (options?: BuildClerkOptions) => HeadlessBrowserClerk | BrowserClerk;
|
|
9
|
+
//# sourceMappingURL=createClerkInstance.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createClerkInstance.d.ts","sourceRoot":"","sources":["../../../src/provider/singleton/createClerkInstance.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,KAAK,EAAuB,MAAM,0BAA0B,CAAC;AAC3E,OAAO,KAAK,EAAE,YAAY,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAqBvE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAIjD;;GAEG;AACH,eAAO,IAAI,KAAK,EAAE,oBAAoB,GAAG,YAAY,CAAC;AAGtD,wBAAgB,mBAAmB,CAAC,UAAU,EAAE,OAAO,KAAK,IAClD,UAAU,iBAAiB,KAAG,oBAAoB,GAAG,YAAY,CA4J1E"}
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var createClerkInstance_exports = {};
|
|
30
|
+
__export(createClerkInstance_exports, {
|
|
31
|
+
clerk: () => clerk,
|
|
32
|
+
createClerkInstance: () => createClerkInstance
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(createClerkInstance_exports);
|
|
35
|
+
var import_headless = require("@clerk/clerk-js/headless");
|
|
36
|
+
var import_error = require("@clerk/shared/error");
|
|
37
|
+
var import_react_native = require("react-native");
|
|
38
|
+
var import_package = __toESM(require("../../../package.json"));
|
|
39
|
+
var import_cache = require("../../cache");
|
|
40
|
+
var import_MemoryTokenCache = require("../../cache/MemoryTokenCache");
|
|
41
|
+
var import_errorThrower = require("../../errorThrower");
|
|
42
|
+
var import_utils = require("../../utils");
|
|
43
|
+
const KEY = "__clerk_client_jwt";
|
|
44
|
+
let clerk;
|
|
45
|
+
let __internal_clerk;
|
|
46
|
+
function createClerkInstance(ClerkClass) {
|
|
47
|
+
return (options) => {
|
|
48
|
+
var _a;
|
|
49
|
+
const {
|
|
50
|
+
publishableKey = process.env.EXPO_PUBLIC_CLERK_PUBLISHABLE_KEY || process.env.CLERK_PUBLISHABLE_KEY || "",
|
|
51
|
+
tokenCache = import_MemoryTokenCache.MemoryTokenCache,
|
|
52
|
+
__experimental_resourceCache: createResourceCache
|
|
53
|
+
} = options || {};
|
|
54
|
+
if (!__internal_clerk && !publishableKey) {
|
|
55
|
+
import_errorThrower.errorThrower.throwMissingPublishableKeyError();
|
|
56
|
+
}
|
|
57
|
+
const hasKeyChanged = __internal_clerk && !!publishableKey && publishableKey !== __internal_clerk.publishableKey;
|
|
58
|
+
if (!__internal_clerk || hasKeyChanged) {
|
|
59
|
+
if (hasKeyChanged) {
|
|
60
|
+
(_a = tokenCache.clearToken) == null ? void 0 : _a.call(tokenCache, KEY);
|
|
61
|
+
}
|
|
62
|
+
const getToken = tokenCache.getToken;
|
|
63
|
+
const saveToken = tokenCache.saveToken;
|
|
64
|
+
__internal_clerk = clerk = new ClerkClass(publishableKey);
|
|
65
|
+
if (import_react_native.Platform.OS === "ios" || import_react_native.Platform.OS === "android") {
|
|
66
|
+
__internal_clerk.__internal_createPublicCredentials = (publicKeyCredential) => {
|
|
67
|
+
var _a2, _b;
|
|
68
|
+
return ((_a2 = options == null ? void 0 : options.__experimental_passkeys) == null ? void 0 : _a2.create) ? (_b = options == null ? void 0 : options.__experimental_passkeys) == null ? void 0 : _b.create(publicKeyCredential) : import_errorThrower.errorThrower.throw("create() for passkeys is missing");
|
|
69
|
+
};
|
|
70
|
+
__internal_clerk.__internal_getPublicCredentials = ({
|
|
71
|
+
publicKeyOptions
|
|
72
|
+
}) => {
|
|
73
|
+
var _a2, _b;
|
|
74
|
+
return ((_a2 = options == null ? void 0 : options.__experimental_passkeys) == null ? void 0 : _a2.get) ? (_b = options == null ? void 0 : options.__experimental_passkeys) == null ? void 0 : _b.get({ publicKeyOptions }) : import_errorThrower.errorThrower.throw("get() for passkeys is missing");
|
|
75
|
+
};
|
|
76
|
+
__internal_clerk.__internal_isWebAuthnSupported = () => {
|
|
77
|
+
var _a2, _b;
|
|
78
|
+
return ((_a2 = options == null ? void 0 : options.__experimental_passkeys) == null ? void 0 : _a2.isSupported) ? (_b = options == null ? void 0 : options.__experimental_passkeys) == null ? void 0 : _b.isSupported() : import_errorThrower.errorThrower.throw("isSupported() for passkeys is missing");
|
|
79
|
+
};
|
|
80
|
+
__internal_clerk.__internal_isWebAuthnAutofillSupported = () => {
|
|
81
|
+
var _a2, _b;
|
|
82
|
+
return ((_a2 = options == null ? void 0 : options.__experimental_passkeys) == null ? void 0 : _a2.isAutoFillSupported) ? (_b = options == null ? void 0 : options.__experimental_passkeys) == null ? void 0 : _b.isAutoFillSupported() : import_errorThrower.errorThrower.throw("isSupported() for passkeys is missing");
|
|
83
|
+
};
|
|
84
|
+
__internal_clerk.__internal_isWebAuthnPlatformAuthenticatorSupported = () => {
|
|
85
|
+
return Promise.resolve(true);
|
|
86
|
+
};
|
|
87
|
+
if (createResourceCache) {
|
|
88
|
+
const retryInitilizeResourcesFromFAPI = async () => {
|
|
89
|
+
const isClerkNetworkError = (err) => (0, import_headless.isClerkRuntimeError)(err) && err.code === "network_error";
|
|
90
|
+
try {
|
|
91
|
+
await (__internal_clerk == null ? void 0 : __internal_clerk.__internal_reloadInitialResources());
|
|
92
|
+
} catch (err) {
|
|
93
|
+
if (isClerkNetworkError(err) || !(0, import_error.is4xxError)(err)) {
|
|
94
|
+
const timeout = isClerkNetworkError(err) ? 2e3 : 1e4;
|
|
95
|
+
setTimeout(() => void retryInitilizeResourcesFromFAPI(), timeout);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
import_cache.EnvironmentResourceCache.init({ publishableKey, storage: createResourceCache });
|
|
100
|
+
import_cache.ClientResourceCache.init({ publishableKey, storage: createResourceCache });
|
|
101
|
+
import_cache.SessionJWTCache.init({ publishableKey, storage: createResourceCache });
|
|
102
|
+
__internal_clerk.addListener(({ client }) => {
|
|
103
|
+
var _a2;
|
|
104
|
+
const environment = __internal_clerk == null ? void 0 : __internal_clerk.__unstable__environment;
|
|
105
|
+
if (environment) {
|
|
106
|
+
void import_cache.EnvironmentResourceCache.save(environment.__internal_toSnapshot());
|
|
107
|
+
}
|
|
108
|
+
if (client) {
|
|
109
|
+
void import_cache.ClientResourceCache.save(client.__internal_toSnapshot());
|
|
110
|
+
if (client.lastActiveSessionId) {
|
|
111
|
+
const currentSession = client.signedInSessions.find((s) => s.id === client.lastActiveSessionId);
|
|
112
|
+
const token = (_a2 = currentSession == null ? void 0 : currentSession.lastActiveToken) == null ? void 0 : _a2.getRawString();
|
|
113
|
+
if (token) {
|
|
114
|
+
void import_cache.SessionJWTCache.save(token);
|
|
115
|
+
}
|
|
116
|
+
} else {
|
|
117
|
+
void import_cache.SessionJWTCache.remove();
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
});
|
|
121
|
+
__internal_clerk.__internal_getCachedResources = async () => {
|
|
122
|
+
let environment = await import_cache.EnvironmentResourceCache.load();
|
|
123
|
+
let client = await import_cache.ClientResourceCache.load();
|
|
124
|
+
if (!environment || !client) {
|
|
125
|
+
environment = import_cache.DUMMY_CLERK_ENVIRONMENT_RESOURCE;
|
|
126
|
+
client = import_cache.DUMMY_CLERK_CLIENT_RESOURCE;
|
|
127
|
+
setTimeout(() => void retryInitilizeResourcesFromFAPI(), 3e3);
|
|
128
|
+
}
|
|
129
|
+
return { client, environment };
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
__internal_clerk.__unstable__onBeforeRequest(async (requestInit) => {
|
|
134
|
+
var _a2;
|
|
135
|
+
requestInit.credentials = "omit";
|
|
136
|
+
(_a2 = requestInit.url) == null ? void 0 : _a2.searchParams.append("_is_native", "1");
|
|
137
|
+
const jwt = await getToken(KEY);
|
|
138
|
+
requestInit.headers.set("authorization", jwt || "");
|
|
139
|
+
if ((0, import_utils.isNative)()) {
|
|
140
|
+
requestInit.headers.set("x-mobile", "1");
|
|
141
|
+
requestInit.headers.set("x-expo-sdk-version", import_package.default.version);
|
|
142
|
+
}
|
|
143
|
+
});
|
|
144
|
+
let nativeApiErrorShown = false;
|
|
145
|
+
__internal_clerk.__unstable__onAfterResponse(async (_, response) => {
|
|
146
|
+
var _a2, _b, _c;
|
|
147
|
+
const authHeader = response.headers.get("authorization");
|
|
148
|
+
if (authHeader) {
|
|
149
|
+
await saveToken(KEY, authHeader);
|
|
150
|
+
}
|
|
151
|
+
if (!nativeApiErrorShown && ((_c = (_b = (_a2 = response.payload) == null ? void 0 : _a2.errors) == null ? void 0 : _b[0]) == null ? void 0 : _c.code) === "native_api_disabled") {
|
|
152
|
+
console.error(
|
|
153
|
+
"The Native API is disabled for this instance.\nGo to Clerk Dashboard > Configure > Native applications to enable it.\nOr, navigate here: https://dashboard.clerk.com/last-active?path=native-applications"
|
|
154
|
+
);
|
|
155
|
+
nativeApiErrorShown = true;
|
|
156
|
+
}
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
return __internal_clerk;
|
|
160
|
+
};
|
|
161
|
+
}
|
|
162
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
163
|
+
0 && (module.exports = {
|
|
164
|
+
clerk,
|
|
165
|
+
createClerkInstance
|
|
166
|
+
});
|
|
167
|
+
//# sourceMappingURL=createClerkInstance.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/provider/singleton/createClerkInstance.ts"],"sourcesContent":["import type { FapiRequestInit, FapiResponse } from '@clerk/clerk-js/dist/types/core/fapiClient';\nimport { type Clerk, isClerkRuntimeError } from '@clerk/clerk-js/headless';\nimport type { BrowserClerk, HeadlessBrowserClerk } from '@clerk/react';\nimport { is4xxError } from '@clerk/shared/error';\nimport type {\n ClientJSONSnapshot,\n EnvironmentJSONSnapshot,\n PublicKeyCredentialCreationOptionsWithoutExtensions,\n PublicKeyCredentialRequestOptionsWithoutExtensions,\n} from '@clerk/shared/types';\nimport { Platform } from 'react-native';\n\nimport packageJson from '../../../package.json';\nimport {\n ClientResourceCache,\n DUMMY_CLERK_CLIENT_RESOURCE,\n DUMMY_CLERK_ENVIRONMENT_RESOURCE,\n EnvironmentResourceCache,\n SessionJWTCache,\n} from '../../cache';\nimport { MemoryTokenCache } from '../../cache/MemoryTokenCache';\nimport { errorThrower } from '../../errorThrower';\nimport { isNative } from '../../utils';\nimport type { BuildClerkOptions } from './types';\n\nconst KEY = '__clerk_client_jwt';\n\n/**\n * @deprecated Use `getClerkInstance()` instead. `Clerk` will be removed in the next major version.\n */\nexport let clerk: HeadlessBrowserClerk | BrowserClerk;\nlet __internal_clerk: HeadlessBrowserClerk | BrowserClerk | undefined;\n\nexport function createClerkInstance(ClerkClass: typeof Clerk) {\n return (options?: BuildClerkOptions): HeadlessBrowserClerk | BrowserClerk => {\n const {\n publishableKey = process.env.EXPO_PUBLIC_CLERK_PUBLISHABLE_KEY || process.env.CLERK_PUBLISHABLE_KEY || '',\n tokenCache = MemoryTokenCache,\n __experimental_resourceCache: createResourceCache,\n } = options || {};\n\n if (!__internal_clerk && !publishableKey) {\n errorThrower.throwMissingPublishableKeyError();\n }\n\n // Support \"hot-swapping\" the Clerk instance at runtime. See JS-598 for additional details.\n const hasKeyChanged = __internal_clerk && !!publishableKey && publishableKey !== __internal_clerk.publishableKey;\n\n if (!__internal_clerk || hasKeyChanged) {\n if (hasKeyChanged) {\n tokenCache.clearToken?.(KEY);\n }\n\n const getToken = tokenCache.getToken;\n const saveToken = tokenCache.saveToken;\n __internal_clerk = clerk = new ClerkClass(publishableKey);\n\n if (Platform.OS === 'ios' || Platform.OS === 'android') {\n // @ts-expect-error - This is an internal API\n __internal_clerk.__internal_createPublicCredentials = (\n publicKeyCredential: PublicKeyCredentialCreationOptionsWithoutExtensions,\n ) => {\n return options?.__experimental_passkeys?.create\n ? options?.__experimental_passkeys?.create(publicKeyCredential)\n : errorThrower.throw('create() for passkeys is missing');\n };\n\n // @ts-expect-error - This is an internal API\n __internal_clerk.__internal_getPublicCredentials = ({\n publicKeyOptions,\n }: {\n publicKeyOptions: PublicKeyCredentialRequestOptionsWithoutExtensions;\n }) => {\n return options?.__experimental_passkeys?.get\n ? options?.__experimental_passkeys?.get({ publicKeyOptions })\n : errorThrower.throw('get() for passkeys is missing');\n };\n // @ts-expect-error - This is an internal API\n __internal_clerk.__internal_isWebAuthnSupported = () => {\n return options?.__experimental_passkeys?.isSupported\n ? options?.__experimental_passkeys?.isSupported()\n : errorThrower.throw('isSupported() for passkeys is missing');\n };\n\n // @ts-expect-error - This is an internal API\n __internal_clerk.__internal_isWebAuthnAutofillSupported = () => {\n return options?.__experimental_passkeys?.isAutoFillSupported\n ? options?.__experimental_passkeys?.isAutoFillSupported()\n : errorThrower.throw('isSupported() for passkeys is missing');\n };\n\n // @ts-expect-error - This is an internal API\n __internal_clerk.__internal_isWebAuthnPlatformAuthenticatorSupported = () => {\n return Promise.resolve(true);\n };\n\n if (createResourceCache) {\n const retryInitilizeResourcesFromFAPI = async () => {\n const isClerkNetworkError = (err: unknown) => isClerkRuntimeError(err) && err.code === 'network_error';\n try {\n await __internal_clerk?.__internal_reloadInitialResources();\n } catch (err) {\n // Retry after 3 seconds if the error is a network error or a 5xx error\n if (isClerkNetworkError(err) || !is4xxError(err)) {\n // Retry after 2 seconds if the error is a network error\n // Retry after 10 seconds if the error is a 5xx FAPI error\n const timeout = isClerkNetworkError(err) ? 2000 : 10000;\n setTimeout(() => void retryInitilizeResourcesFromFAPI(), timeout);\n }\n }\n };\n\n EnvironmentResourceCache.init({ publishableKey, storage: createResourceCache });\n ClientResourceCache.init({ publishableKey, storage: createResourceCache });\n SessionJWTCache.init({ publishableKey, storage: createResourceCache });\n\n __internal_clerk.addListener(({ client }) => {\n // @ts-expect-error - This is an internal API\n const environment = __internal_clerk?.__unstable__environment as EnvironmentResource;\n if (environment) {\n void EnvironmentResourceCache.save(environment.__internal_toSnapshot());\n }\n\n if (client) {\n void ClientResourceCache.save(client.__internal_toSnapshot());\n if (client.lastActiveSessionId) {\n const currentSession = client.signedInSessions.find(s => s.id === client.lastActiveSessionId);\n const token = currentSession?.lastActiveToken?.getRawString();\n if (token) {\n void SessionJWTCache.save(token);\n }\n } else {\n void SessionJWTCache.remove();\n }\n }\n });\n\n __internal_clerk.__internal_getCachedResources = async (): Promise<{\n client: ClientJSONSnapshot | null;\n environment: EnvironmentJSONSnapshot | null;\n }> => {\n let environment = await EnvironmentResourceCache.load();\n let client = await ClientResourceCache.load();\n if (!environment || !client) {\n environment = DUMMY_CLERK_ENVIRONMENT_RESOURCE;\n client = DUMMY_CLERK_CLIENT_RESOURCE;\n setTimeout(() => void retryInitilizeResourcesFromFAPI(), 3000);\n }\n return { client, environment };\n };\n }\n }\n\n // @ts-expect-error - This is an internal API\n __internal_clerk.__unstable__onBeforeRequest(async (requestInit: FapiRequestInit) => {\n // https://reactnative.dev/docs/0.61/network#known-issues-with-fetch-and-cookie-based-authentication\n requestInit.credentials = 'omit';\n\n // Instructs the backend to parse the api token from the Authorization header.\n requestInit.url?.searchParams.append('_is_native', '1');\n\n const jwt = await getToken(KEY);\n (requestInit.headers as Headers).set('authorization', jwt || '');\n\n // Instructs the backend that the request is from a mobile device.\n // Some iOS devices have an empty user-agent, so we can't rely on that.\n if (isNative()) {\n (requestInit.headers as Headers).set('x-mobile', '1');\n (requestInit.headers as Headers).set('x-expo-sdk-version', packageJson.version);\n }\n });\n\n let nativeApiErrorShown = false;\n // @ts-expect-error - This is an internal API\n __internal_clerk.__unstable__onAfterResponse(async (_: FapiRequestInit, response: FapiResponse<unknown>) => {\n const authHeader = response.headers.get('authorization');\n if (authHeader) {\n await saveToken(KEY, authHeader);\n }\n\n if (!nativeApiErrorShown && response.payload?.errors?.[0]?.code === 'native_api_disabled') {\n console.error(\n 'The Native API is disabled for this instance.\\nGo to Clerk Dashboard > Configure > Native applications to enable it.\\nOr, navigate here: https://dashboard.clerk.com/last-active?path=native-applications',\n );\n nativeApiErrorShown = true;\n }\n });\n }\n return __internal_clerk;\n };\n}\n"],"mappings":"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","names":["_a","packageJson"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/provider/singleton/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __copyProps = (to, from, except, desc) => {
|
|
7
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
+
for (let key of __getOwnPropNames(from))
|
|
9
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
+
}
|
|
12
|
+
return to;
|
|
13
|
+
};
|
|
14
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
15
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
16
|
+
var singleton_exports = {};
|
|
17
|
+
module.exports = __toCommonJS(singleton_exports);
|
|
18
|
+
__reExport(singleton_exports, require("./singleton"), module.exports);
|
|
19
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
20
|
+
0 && (module.exports = {
|
|
21
|
+
...require("./singleton")
|
|
22
|
+
});
|
|
23
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/provider/singleton/index.ts"],"sourcesContent":["export * from './singleton';\n"],"mappings":";;;;;;;;;;;;;;;AAAA;AAAA;AAAA,8BAAc,wBAAd;","names":[]}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @deprecated Use `getClerkInstance()` instead. `Clerk` will be removed in the next major version.
|
|
3
|
+
*/
|
|
4
|
+
export { clerk } from './createClerkInstance';
|
|
5
|
+
/**
|
|
6
|
+
* Access or create a Clerk instance outside of React. If you are using it in Expo Web then it will only access the existing instance from `window.Clerk`
|
|
7
|
+
* @example
|
|
8
|
+
* import { ClerkProvider, getClerkInstance } from "@clerk/expo"
|
|
9
|
+
*
|
|
10
|
+
* const clerkInstance = getClerkInstance({ publishableKey: 'xxxx' })
|
|
11
|
+
*
|
|
12
|
+
* // Always pass the `publishableKey` to `ClerkProvider`
|
|
13
|
+
* <ClerkProvider publishableKey={'xxxx'}>
|
|
14
|
+
* ...
|
|
15
|
+
* </ClerkProvider>
|
|
16
|
+
*
|
|
17
|
+
* // Somewhere in your code, outside of React you can do
|
|
18
|
+
* const token = await clerkInstance.session?.getToken();
|
|
19
|
+
* fetch('http://example.com/', {headers: {Authorization: token })
|
|
20
|
+
*
|
|
21
|
+
* @throws MissingPublishableKeyError publishableKey is missing and Clerk has not been initialized yet
|
|
22
|
+
* @returns HeadlessBrowserClerk | BrowserClerk
|
|
23
|
+
*/
|
|
24
|
+
export declare const getClerkInstance: (options?: import("./types").BuildClerkOptions) => import("@clerk/react").HeadlessBrowserClerk | import("@clerk/react").BrowserClerk;
|
|
25
|
+
//# sourceMappingURL=singleton.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"singleton.d.ts","sourceRoot":"","sources":["../../../src/provider/singleton/singleton.ts"],"names":[],"mappings":"AAIA;;GAEG;AACH,OAAO,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAE9C;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,gBAAgB,sIAA6B,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var singleton_exports = {};
|
|
20
|
+
__export(singleton_exports, {
|
|
21
|
+
clerk: () => import_createClerkInstance2.clerk,
|
|
22
|
+
getClerkInstance: () => getClerkInstance
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(singleton_exports);
|
|
25
|
+
var import_headless = require("@clerk/clerk-js/headless");
|
|
26
|
+
var import_createClerkInstance = require("./createClerkInstance");
|
|
27
|
+
var import_createClerkInstance2 = require("./createClerkInstance");
|
|
28
|
+
const getClerkInstance = (0, import_createClerkInstance.createClerkInstance)(import_headless.Clerk);
|
|
29
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
30
|
+
0 && (module.exports = {
|
|
31
|
+
clerk,
|
|
32
|
+
getClerkInstance
|
|
33
|
+
});
|
|
34
|
+
//# sourceMappingURL=singleton.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/provider/singleton/singleton.ts"],"sourcesContent":["import { Clerk } from '@clerk/clerk-js/headless';\n\nimport { createClerkInstance } from './createClerkInstance';\n\n/**\n * @deprecated Use `getClerkInstance()` instead. `Clerk` will be removed in the next major version.\n */\nexport { clerk } from './createClerkInstance';\n\n/**\n * Access or create a Clerk instance outside of React. If you are using it in Expo Web then it will only access the existing instance from `window.Clerk`\n * @example\n * import { ClerkProvider, getClerkInstance } from \"@clerk/expo\"\n *\n * const clerkInstance = getClerkInstance({ publishableKey: 'xxxx' })\n *\n * // Always pass the `publishableKey` to `ClerkProvider`\n * <ClerkProvider publishableKey={'xxxx'}>\n * ...\n * </ClerkProvider>\n *\n * // Somewhere in your code, outside of React you can do\n * const token = await clerkInstance.session?.getToken();\n * fetch('http://example.com/', {headers: {Authorization: token })\n *\n * @throws MissingPublishableKeyError publishableKey is missing and Clerk has not been initialized yet\n * @returns HeadlessBrowserClerk | BrowserClerk\n */\nexport const getClerkInstance = createClerkInstance(Clerk);\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,sBAAsB;AAEtB,iCAAoC;AAKpC,IAAAA,8BAAsB;AAqBf,MAAM,uBAAmB,gDAAoB,qBAAK;","names":["import_createClerkInstance"]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { BrowserClerk, HeadlessBrowserClerk } from '@clerk/react';
|
|
2
|
+
import type { BuildClerkOptions } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* @deprecated Use `getClerkInstance()` instead. `Clerk` will be removed in the next major version.
|
|
5
|
+
*/
|
|
6
|
+
export declare const clerk: import("@clerk/clerk-js/headless").Clerk | undefined;
|
|
7
|
+
/**
|
|
8
|
+
* No need to use options here as we are not creating a new instance of Clerk, we are just getting the existing instance from the window
|
|
9
|
+
*/
|
|
10
|
+
export declare const getClerkInstance: (_options?: BuildClerkOptions) => HeadlessBrowserClerk | BrowserClerk | undefined;
|
|
11
|
+
//# sourceMappingURL=singleton.web.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"singleton.web.d.ts","sourceRoot":"","sources":["../../../src/provider/singleton/singleton.web.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAEvE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAEjD;;GAEG;AACH,eAAO,MAAM,KAAK,sDAA4B,CAAC;AAE/C;;GAEG;AACH,eAAO,MAAM,gBAAgB,GAAI,WAAW,iBAAiB,KAAG,oBAAoB,GAAG,YAAY,GAAG,SAC3E,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var singleton_web_exports = {};
|
|
20
|
+
__export(singleton_web_exports, {
|
|
21
|
+
clerk: () => clerk,
|
|
22
|
+
getClerkInstance: () => getClerkInstance
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(singleton_web_exports);
|
|
25
|
+
var _a;
|
|
26
|
+
const clerk = (_a = globalThis == null ? void 0 : globalThis.window) == null ? void 0 : _a.Clerk;
|
|
27
|
+
const getClerkInstance = (_options) => {
|
|
28
|
+
var _a2;
|
|
29
|
+
return (_a2 = globalThis == null ? void 0 : globalThis.window) == null ? void 0 : _a2.Clerk;
|
|
30
|
+
};
|
|
31
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
32
|
+
0 && (module.exports = {
|
|
33
|
+
clerk,
|
|
34
|
+
getClerkInstance
|
|
35
|
+
});
|
|
36
|
+
//# sourceMappingURL=singleton.web.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/provider/singleton/singleton.web.ts"],"sourcesContent":["import type { BrowserClerk, HeadlessBrowserClerk } from '@clerk/react';\n\nimport type { BuildClerkOptions } from './types';\n\n/**\n * @deprecated Use `getClerkInstance()` instead. `Clerk` will be removed in the next major version.\n */\nexport const clerk = globalThis?.window?.Clerk;\n\n/**\n * No need to use options here as we are not creating a new instance of Clerk, we are just getting the existing instance from the window\n */\nexport const getClerkInstance = (_options?: BuildClerkOptions): HeadlessBrowserClerk | BrowserClerk | undefined =>\n globalThis?.window?.Clerk;\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAOO,MAAM,SAAQ,8CAAY,WAAZ,mBAAoB;AAKlC,MAAM,mBAAmB,CAAC,aAA+E;AAZhH,MAAAA;AAaE,UAAAA,MAAA,yCAAY,WAAZ,gBAAAA,IAAoB;AAAA;","names":["_a"]}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { CredentialReturn, PublicKeyCredentialCreationOptionsWithoutExtensions, PublicKeyCredentialRequestOptionsWithoutExtensions, PublicKeyCredentialWithAuthenticatorAssertionResponse, PublicKeyCredentialWithAuthenticatorAttestationResponse } from '@clerk/shared/types';
|
|
2
|
+
import type { TokenCache } from '../../cache/types';
|
|
3
|
+
export interface IStorage {
|
|
4
|
+
set: (key: string, value: string) => Promise<void>;
|
|
5
|
+
get: (key: string) => Promise<string | null>;
|
|
6
|
+
}
|
|
7
|
+
export type BuildClerkOptions = {
|
|
8
|
+
publishableKey?: string;
|
|
9
|
+
tokenCache?: TokenCache;
|
|
10
|
+
/**
|
|
11
|
+
* Note: Passkey support in Expo is currently in a limited rollout phase.
|
|
12
|
+
* If you're interested in using this feature, please contact us for early access or additional details.
|
|
13
|
+
*
|
|
14
|
+
* @experimental This API is experimental and may change at any moment.
|
|
15
|
+
*/
|
|
16
|
+
__experimental_passkeys?: {
|
|
17
|
+
get: ({ publicKeyOptions, }: {
|
|
18
|
+
publicKeyOptions: PublicKeyCredentialRequestOptionsWithoutExtensions;
|
|
19
|
+
}) => Promise<CredentialReturn<PublicKeyCredentialWithAuthenticatorAssertionResponse>>;
|
|
20
|
+
create: (publicKeyCredential: PublicKeyCredentialCreationOptionsWithoutExtensions) => Promise<CredentialReturn<PublicKeyCredentialWithAuthenticatorAttestationResponse>>;
|
|
21
|
+
isSupported: () => boolean;
|
|
22
|
+
isAutoFillSupported: () => Promise<boolean>;
|
|
23
|
+
};
|
|
24
|
+
__experimental_resourceCache?: () => IStorage;
|
|
25
|
+
};
|
|
26
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/provider/singleton/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,gBAAgB,EAChB,mDAAmD,EACnD,kDAAkD,EAClD,qDAAqD,EACrD,uDAAuD,EACxD,MAAM,qBAAqB,CAAC;AAE7B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAEpD,MAAM,WAAW,QAAQ;IACvB,GAAG,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACnD,GAAG,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;CAC9C;AAED,MAAM,MAAM,iBAAiB,GAAG;IAC9B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB;;;;;OAKG;IACH,uBAAuB,CAAC,EAAE;QACxB,GAAG,EAAE,CAAC,EACJ,gBAAgB,GACjB,EAAE;YACD,gBAAgB,EAAE,kDAAkD,CAAC;SACtE,KAAK,OAAO,CAAC,gBAAgB,CAAC,qDAAqD,CAAC,CAAC,CAAC;QACvF,MAAM,EAAE,CACN,mBAAmB,EAAE,mDAAmD,KACrE,OAAO,CAAC,gBAAgB,CAAC,uDAAuD,CAAC,CAAC,CAAC;QACxF,WAAW,EAAE,MAAM,OAAO,CAAC;QAC3B,mBAAmB,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,CAAC;KAC7C,CAAC;IACF,4BAA4B,CAAC,EAAE,MAAM,QAAQ,CAAC;CAC/C,CAAC"}
|