@turnkey/sdk-react 3.0.1 → 3.0.2
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 +7 -0
- package/README.md +1 -0
- package/dist/components/auth/Auth.d.ts.map +1 -1
- package/dist/components/auth/Auth.js +13 -5
- package/dist/components/auth/Auth.js.map +1 -1
- package/dist/components/auth/Auth.mjs +46 -32
- package/dist/components/auth/Auth.mjs.map +1 -1
- package/dist/components/auth/OtpVerification.d.ts +1 -1
- package/dist/components/auth/OtpVerification.d.ts.map +1 -1
- package/dist/components/auth/OtpVerification.js +1 -1
- package/dist/components/auth/OtpVerification.js.map +1 -1
- package/dist/components/auth/OtpVerification.mjs +1 -1
- package/dist/components/auth/OtpVerification.mjs.map +1 -1
- package/dist/hooks/use-session.d.ts.map +1 -1
- package/dist/hooks/use-session.js +3 -2
- package/dist/hooks/use-session.js.map +1 -1
- package/dist/hooks/use-session.mjs +2 -1
- package/dist/hooks/use-session.mjs.map +1 -1
- package/dist/hooks/use-turnkey.d.ts.map +1 -1
- package/dist/hooks/use-turnkey.js +1 -0
- package/dist/hooks/use-turnkey.js.map +1 -1
- package/dist/hooks/use-turnkey.mjs +1 -0
- package/dist/hooks/use-turnkey.mjs.map +1 -1
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# @turnkey/sdk-react
|
|
2
2
|
|
|
3
|
+
## 3.0.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- faa757c: Patch EWK custom session lengths - previously not working as intended (defaulted to 15 minute sessions only) and fix the following useLocalStorage issue when compiling: [Error: useLocalStorage is a client-only hook]
|
|
8
|
+
- a8bd73b: Fix issue with EWK where suborgs were being created on failed fetches
|
|
9
|
+
|
|
3
10
|
## 3.0.1
|
|
4
11
|
|
|
5
12
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Auth.d.ts","sourceRoot":"","sources":["../../../src/components/auth/Auth.tsx"],"names":[],"mappings":"AAGA,OAAO,KAA8B,MAAM,OAAO,CAAC;AAcnD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAoC1D,UAAU,SAAS;IACjB,aAAa,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IACnC,OAAO,EAAE,CAAC,YAAY,EAAE,MAAM,KAAK,IAAI,CAAC;IACxC,UAAU,EAAE;QACV,YAAY,EAAE,OAAO,CAAC;QACtB,cAAc,EAAE,OAAO,CAAC;QACxB,YAAY,EAAE,OAAO,CAAC;QACtB,YAAY,EAAE,OAAO,CAAC;QACtB,eAAe,EAAE,OAAO,CAAC;QACzB,aAAa,EAAE,OAAO,CAAC;QACvB,oBAAoB,CAAC,EAAE,MAAM,CAAC;QAC9B,cAAc,CAAC,EAAE,MAAM,CAAC;QACxB,aAAa,CAAC,EAAE,MAAM,CAAC;QACvB,gBAAgB,CAAC,EAAE,MAAM,CAAC;KAC3B,CAAC;IACF,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,cAAc,CAAC,EAAE,aAAa,EAAE,CAAC;CAClC;AAED,QAAA,MAAM,IAAI,EAAE,KAAK,CAAC,EAAE,CAAC,SAAS,
|
|
1
|
+
{"version":3,"file":"Auth.d.ts","sourceRoot":"","sources":["../../../src/components/auth/Auth.tsx"],"names":[],"mappings":"AAGA,OAAO,KAA8B,MAAM,OAAO,CAAC;AAcnD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAoC1D,UAAU,SAAS;IACjB,aAAa,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IACnC,OAAO,EAAE,CAAC,YAAY,EAAE,MAAM,KAAK,IAAI,CAAC;IACxC,UAAU,EAAE;QACV,YAAY,EAAE,OAAO,CAAC;QACtB,cAAc,EAAE,OAAO,CAAC;QACxB,YAAY,EAAE,OAAO,CAAC;QACtB,YAAY,EAAE,OAAO,CAAC;QACtB,eAAe,EAAE,OAAO,CAAC;QACzB,aAAa,EAAE,OAAO,CAAC;QACvB,oBAAoB,CAAC,EAAE,MAAM,CAAC;QAC9B,cAAc,CAAC,EAAE,MAAM,CAAC;QACxB,aAAa,CAAC,EAAE,MAAM,CAAC;QACvB,gBAAgB,CAAC,EAAE,MAAM,CAAC;KAC3B,CAAC;IACF,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,cAAc,CAAC,EAAE,aAAa,EAAE,CAAC;CAClC;AAED,QAAA,MAAM,IAAI,EAAE,KAAK,CAAC,EAAE,CAAC,SAAS,CA2lB7B,CAAC;AAEF,eAAe,IAAI,CAAC"}
|
|
@@ -110,6 +110,7 @@ const Auth = ({
|
|
|
110
110
|
});
|
|
111
111
|
if (!getVerifiedSuborgsResponse || !getVerifiedSuborgsResponse.organizationIds) {
|
|
112
112
|
onError(constants.authErrors.suborg.fetchFailed);
|
|
113
|
+
return null;
|
|
113
114
|
}
|
|
114
115
|
suborgId = getVerifiedSuborgsResponse?.organizationIds[0];
|
|
115
116
|
} else {
|
|
@@ -119,6 +120,7 @@ const Auth = ({
|
|
|
119
120
|
});
|
|
120
121
|
if (!getSuborgsResponse || !getSuborgsResponse.organizationIds) {
|
|
121
122
|
onError(constants.authErrors.suborg.fetchFailed);
|
|
123
|
+
return null;
|
|
122
124
|
}
|
|
123
125
|
suborgId = getSuborgsResponse?.organizationIds[0];
|
|
124
126
|
}
|
|
@@ -138,10 +140,10 @@ const Auth = ({
|
|
|
138
140
|
}
|
|
139
141
|
return suborgId;
|
|
140
142
|
};
|
|
141
|
-
const handleAuthSuccess = async credentialBundle => {
|
|
143
|
+
const handleAuthSuccess = async (credentialBundle, expirationSeconds) => {
|
|
142
144
|
if (credentialBundle) {
|
|
143
145
|
await authIframeClient.injectCredentialBundle(credentialBundle);
|
|
144
|
-
await authIframeClient.loginWithAuthBundle(credentialBundle);
|
|
146
|
+
await authIframeClient.loginWithAuthBundle(credentialBundle, expirationSeconds);
|
|
145
147
|
await onAuthSuccess();
|
|
146
148
|
}
|
|
147
149
|
};
|
|
@@ -193,10 +195,13 @@ const Auth = ({
|
|
|
193
195
|
}
|
|
194
196
|
const sessionResponse = await passkeyClient?.createReadWriteSession({
|
|
195
197
|
targetPublicKey: authIframeClient?.iframePublicKey,
|
|
198
|
+
...(authConfig.sessionLengthSeconds !== undefined && {
|
|
199
|
+
expirationSeconds: authConfig.sessionLengthSeconds.toString()
|
|
200
|
+
}),
|
|
196
201
|
organizationId: turnkey$1?.config.defaultOrganizationId ?? process.env.NEXT_PUBLIC_ORGANIZATION_ID
|
|
197
202
|
});
|
|
198
203
|
if (sessionResponse?.credentialBundle) {
|
|
199
|
-
await handleAuthSuccess(sessionResponse.credentialBundle);
|
|
204
|
+
await handleAuthSuccess(sessionResponse.credentialBundle, authConfig.sessionLengthSeconds?.toString());
|
|
200
205
|
} else {
|
|
201
206
|
setPasskeySignupError(constants.authErrors.passkey.loginFailed);
|
|
202
207
|
}
|
|
@@ -208,10 +213,13 @@ const Auth = ({
|
|
|
208
213
|
try {
|
|
209
214
|
const sessionResponse = await passkeyClient?.createReadWriteSession({
|
|
210
215
|
targetPublicKey: authIframeClient?.iframePublicKey,
|
|
216
|
+
...(authConfig.sessionLengthSeconds !== undefined && {
|
|
217
|
+
expirationSeconds: authConfig.sessionLengthSeconds.toString()
|
|
218
|
+
}),
|
|
211
219
|
organizationId: turnkey$1?.config.defaultOrganizationId ?? process.env.NEXT_PUBLIC_ORGANIZATION_ID
|
|
212
220
|
});
|
|
213
221
|
if (sessionResponse?.credentialBundle) {
|
|
214
|
-
await handleAuthSuccess(sessionResponse.credentialBundle);
|
|
222
|
+
await handleAuthSuccess(sessionResponse.credentialBundle, authConfig.sessionLengthSeconds?.toString());
|
|
215
223
|
} else {
|
|
216
224
|
constants.authErrors.passkey.loginFailed;
|
|
217
225
|
}
|
|
@@ -253,7 +261,7 @@ const Auth = ({
|
|
|
253
261
|
sessionLengthSeconds: authConfig.sessionLengthSeconds
|
|
254
262
|
});
|
|
255
263
|
if (oauthResponse && oauthResponse.token) {
|
|
256
|
-
await handleAuthSuccess(oauthResponse.token);
|
|
264
|
+
await handleAuthSuccess(oauthResponse.token, authConfig.sessionLengthSeconds?.toString());
|
|
257
265
|
} else {
|
|
258
266
|
onError(constants.authErrors.oauth.loginFailed);
|
|
259
267
|
}
|