@turnkey/sdk-react 0.0.1 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +11 -0
- package/dist/contexts/TurnkeyContext.d.ts +4 -4
- package/dist/contexts/TurnkeyContext.d.ts.map +1 -1
- package/dist/contexts/TurnkeyContext.js +15 -15
- package/dist/contexts/TurnkeyContext.js.map +1 -1
- package/dist/contexts/TurnkeyContext.mjs +16 -16
- package/dist/contexts/TurnkeyContext.mjs.map +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# @turnkey/sdk-react
|
|
2
2
|
|
|
3
|
+
## 0.1.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- Ready for 0.1.0
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies
|
|
12
|
+
- @turnkey/sdk-browser@0.1.0
|
|
13
|
+
|
|
3
14
|
## 0.0.1
|
|
4
15
|
|
|
5
16
|
Initial (experimental) release! This is an alpha release and subject to change.
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { ReactNode } from "react";
|
|
2
|
-
import {
|
|
2
|
+
import { Turnkey, TurnkeyIframeClient, TurnkeyPasskeyClient, TurnkeySDKBrowserConfig } from "@turnkey/sdk-browser";
|
|
3
3
|
export interface TurnkeyClientType {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
turnkey: Turnkey | undefined;
|
|
5
|
+
iframeClient: TurnkeyIframeClient | undefined;
|
|
6
|
+
passkeyClient: TurnkeyPasskeyClient | undefined;
|
|
7
7
|
}
|
|
8
8
|
export declare const TurnkeyContext: import("react").Context<TurnkeyClientType>;
|
|
9
9
|
interface TurnkeyProviderProps {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TurnkeyContext.d.ts","sourceRoot":"","sources":["../../src/contexts/TurnkeyContext.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAA8C,MAAM,OAAO,CAAC;AAC9E,OAAO,EACL,
|
|
1
|
+
{"version":3,"file":"TurnkeyContext.d.ts","sourceRoot":"","sources":["../../src/contexts/TurnkeyContext.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAA8C,MAAM,OAAO,CAAC;AAC9E,OAAO,EACL,OAAO,EACP,mBAAmB,EACnB,oBAAoB,EACpB,uBAAuB,EACxB,MAAM,sBAAsB,CAAC;AAE9B,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,OAAO,GAAG,SAAS,CAAC;IAC7B,YAAY,EAAE,mBAAmB,GAAG,SAAS,CAAC;IAC9C,aAAa,EAAE,oBAAoB,GAAG,SAAS,CAAC;CACjD;AAED,eAAO,MAAM,cAAc,4CAIzB,CAAC;AAEH,UAAU,oBAAoB;IAC5B,QAAQ,EAAE,SAAS,CAAC;IACpB,MAAM,EAAE,uBAAuB,CAAC;CACjC;AAED,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,oBAAoB,CA8C1D,CAAC"}
|
|
@@ -5,32 +5,32 @@ var react = require('react');
|
|
|
5
5
|
var sdkBrowser = require('@turnkey/sdk-browser');
|
|
6
6
|
|
|
7
7
|
const TurnkeyContext = react.createContext({
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
turnkey: undefined,
|
|
9
|
+
passkeyClient: undefined,
|
|
10
|
+
iframeClient: undefined,
|
|
11
11
|
});
|
|
12
12
|
const TurnkeyProvider = ({ config, children, }) => {
|
|
13
|
-
const [
|
|
14
|
-
const [
|
|
15
|
-
const [
|
|
13
|
+
const [turnkey, setTurnkey] = react.useState(undefined);
|
|
14
|
+
const [passkeyClient, setPasskeyClient] = react.useState(undefined);
|
|
15
|
+
const [iframeClient, setIframeClient] = react.useState(undefined);
|
|
16
16
|
const iframeInit = react.useRef(false);
|
|
17
|
-
const TurnkeyIframeContainerId = "turnkey-
|
|
17
|
+
const TurnkeyIframeContainerId = "turnkey-default-iframe-container-id";
|
|
18
18
|
react.useEffect(() => {
|
|
19
19
|
(async () => {
|
|
20
20
|
if (!iframeInit.current) {
|
|
21
21
|
iframeInit.current = true;
|
|
22
|
-
const
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
const
|
|
26
|
-
|
|
22
|
+
const newTurnkey = new sdkBrowser.Turnkey(config);
|
|
23
|
+
setTurnkey(newTurnkey);
|
|
24
|
+
setPasskeyClient(newTurnkey.passkeyClient());
|
|
25
|
+
const newIframeClient = await newTurnkey.iframeClient(document.getElementById(TurnkeyIframeContainerId));
|
|
26
|
+
setIframeClient(newIframeClient);
|
|
27
27
|
}
|
|
28
28
|
})();
|
|
29
29
|
}, []);
|
|
30
30
|
return (jsxRuntime.jsxs(TurnkeyContext.Provider, { value: {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
31
|
+
turnkey,
|
|
32
|
+
passkeyClient,
|
|
33
|
+
iframeClient,
|
|
34
34
|
}, children: [children, jsxRuntime.jsx("div", { className: "", id: TurnkeyIframeContainerId, style: { display: "none" } })] }));
|
|
35
35
|
};
|
|
36
36
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TurnkeyContext.js","sources":["../../src/contexts/TurnkeyContext.tsx"],"sourcesContent":[null],"names":["createContext","useState","useRef","useEffect","
|
|
1
|
+
{"version":3,"file":"TurnkeyContext.js","sources":["../../src/contexts/TurnkeyContext.tsx"],"sourcesContent":[null],"names":["createContext","useState","useRef","useEffect","Turnkey","_jsxs","_jsx"],"mappings":";;;;;;AAcO,MAAM,cAAc,GAAGA,mBAAa,CAAoB;AAC7D,IAAA,OAAO,EAAE,SAAS;AAClB,IAAA,aAAa,EAAE,SAAS;AACxB,IAAA,YAAY,EAAE,SAAS;AACxB,CAAA,EAAE;AAOU,MAAA,eAAe,GAAmC,CAAC,EAC9D,MAAM,EACN,QA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
|
|
1
1
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
2
|
import { createContext, useState, useRef, useEffect } from 'react';
|
|
3
|
-
import {
|
|
3
|
+
import { Turnkey } from '@turnkey/sdk-browser';
|
|
4
4
|
|
|
5
5
|
const TurnkeyContext = createContext({
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
turnkey: undefined,
|
|
7
|
+
passkeyClient: undefined,
|
|
8
|
+
iframeClient: undefined,
|
|
9
9
|
});
|
|
10
10
|
const TurnkeyProvider = ({ config, children, }) => {
|
|
11
|
-
const [
|
|
12
|
-
const [
|
|
13
|
-
const [
|
|
11
|
+
const [turnkey, setTurnkey] = useState(undefined);
|
|
12
|
+
const [passkeyClient, setPasskeyClient] = useState(undefined);
|
|
13
|
+
const [iframeClient, setIframeClient] = useState(undefined);
|
|
14
14
|
const iframeInit = useRef(false);
|
|
15
|
-
const TurnkeyIframeContainerId = "turnkey-
|
|
15
|
+
const TurnkeyIframeContainerId = "turnkey-default-iframe-container-id";
|
|
16
16
|
useEffect(() => {
|
|
17
17
|
(async () => {
|
|
18
18
|
if (!iframeInit.current) {
|
|
19
19
|
iframeInit.current = true;
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
const
|
|
24
|
-
|
|
20
|
+
const newTurnkey = new Turnkey(config);
|
|
21
|
+
setTurnkey(newTurnkey);
|
|
22
|
+
setPasskeyClient(newTurnkey.passkeyClient());
|
|
23
|
+
const newIframeClient = await newTurnkey.iframeClient(document.getElementById(TurnkeyIframeContainerId));
|
|
24
|
+
setIframeClient(newIframeClient);
|
|
25
25
|
}
|
|
26
26
|
})();
|
|
27
27
|
}, []);
|
|
28
28
|
return (jsxs(TurnkeyContext.Provider, { value: {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
29
|
+
turnkey,
|
|
30
|
+
passkeyClient,
|
|
31
|
+
iframeClient,
|
|
32
32
|
}, children: [children, jsx("div", { className: "", id: TurnkeyIframeContainerId, style: { display: "none" } })] }));
|
|
33
33
|
};
|
|
34
34
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TurnkeyContext.mjs","sources":["../../src/contexts/TurnkeyContext.tsx"],"sourcesContent":[null],"names":["_jsxs","_jsx"],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"TurnkeyContext.mjs","sources":["../../src/contexts/TurnkeyContext.tsx"],"sourcesContent":[null],"names":["_jsxs","_jsx"],"mappings":";;;;AAcO,MAAM,cAAc,GAAG,aAAa,CAAoB;AAC7D,IAAA,OAAO,EAAE,SAAS;AAClB,IAAA,aAAa,EAAE,SAAS;AACxB,IAAA,YAAY,EAAE,SAAS;AACxB,CAAA,EAAE;AAOU,MAAA,eAAe,GAAmC,CAAC,EAC9D,MAAM,EACN,QAAQ,GACT,KAAI;IACH,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,QAAQ,CAAsB,SAAS,CAAC,CAAC;IACvE,MAAM,CAAC,aAAa,EAAE,gBAAgB,CAAC,GAAG,QAAQ,CAEhD,SAAS,CAAC,CAAC;IACb,MAAM,CAAC,YAAY,EAAE,eAAe,CAAC,GAAG,QAAQ,CAE9C,SAAS,CAAC,CAAC;AACb,IAAA,MAAM,UAAU,GAAG,MAAM,CAAU,KAAK,CAAC,CAAC;IAE1C,MAAM,wBAAwB,GAAG,qCAAqC,CAAC;IAEvE,SAAS,CAAC,MAAK;QACb,CAAC,YAAW;AACV,YAAA,IAAI,CAAC,UAAU,CAAC,OAAO,EAAE;AACvB,gBAAA,UAAU,CAAC,OAAO,GAAG,IAAI,CAAC;AAC1B,gBAAA,MAAM,UAAU,GAAG,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;gBACvC,UAAU,CAAC,UAAU,CAAC,CAAC;AACvB,gBAAA,gBAAgB,CAAC,UAAU,CAAC,aAAa,EAAE,CAAC,CAAC;AAC7C,gBAAA,MAAM,eAAe,GAAG,MAAM,UAAU,CAAC,YAAY,CACnD,QAAQ,CAAC,cAAc,CAAC,wBAAwB,CAAC,CAClD,CAAC;gBACF,eAAe,CAAC,eAAe,CAAC,CAAC;AAClC,aAAA;SACF,GAAG,CAAC;KACN,EAAE,EAAE,CAAC,CAAC;AAEP,IAAA,QACEA,IAAC,CAAA,cAAc,CAAC,QAAQ,EAAA,EACtB,KAAK,EAAE;YACL,OAAO;YACP,aAAa;YACb,YAAY;SACb,EAEA,QAAA,EAAA,CAAA,QAAQ,EACTC,GACE,CAAA,KAAA,EAAA,EAAA,SAAS,EAAC,EAAE,EACZ,EAAE,EAAE,wBAAwB,EAC5B,KAAK,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,EAAA,CAC1B,CACsB,EAAA,CAAA,EAC1B;AACJ;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@turnkey/sdk-react",
|
|
3
|
-
"version": "0.0
|
|
3
|
+
"version": "0.1.0",
|
|
4
4
|
"main": "./dist/index.js",
|
|
5
5
|
"module": "./dist/index.mjs",
|
|
6
6
|
"exports": {
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"access": "public"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@turnkey/sdk-browser": "0.0
|
|
41
|
+
"@turnkey/sdk-browser": "0.1.0"
|
|
42
42
|
},
|
|
43
43
|
"peerDependencies": {
|
|
44
44
|
"react": "^16.8.0 || ^17.0.0 || ^18.0.0"
|