@swype-org/react-sdk 0.1.85 → 0.1.86
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/dist/index.cjs +20 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +9 -1
- package/dist/index.d.ts +9 -1
- package/dist/index.js +20 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -321,6 +321,13 @@ declare function fetchAuthorizationSession(apiBaseUrl: string, sessionId: string
|
|
|
321
321
|
* POST /v1/users/config/passkey
|
|
322
322
|
*/
|
|
323
323
|
declare function registerPasskey(apiBaseUrl: string, token: string, credentialId: string, publicKey: string): Promise<void>;
|
|
324
|
+
/**
|
|
325
|
+
* Reports passkey activity (verification) to update the last_active
|
|
326
|
+
* timestamp server-side. Fire-and-forget — callers should not block on
|
|
327
|
+
* the result.
|
|
328
|
+
* PATCH /v1/users/config/passkey
|
|
329
|
+
*/
|
|
330
|
+
declare function reportPasskeyActivity(apiBaseUrl: string, token: string, credentialId: string): Promise<void>;
|
|
324
331
|
/**
|
|
325
332
|
* Fetches the authenticated user's config, including passkey status.
|
|
326
333
|
* GET /v1/users/config
|
|
@@ -355,11 +362,12 @@ declare const api_fetchTransfer: typeof fetchTransfer;
|
|
|
355
362
|
declare const api_fetchUserConfig: typeof fetchUserConfig;
|
|
356
363
|
declare const api_registerPasskey: typeof registerPasskey;
|
|
357
364
|
declare const api_reportActionCompletion: typeof reportActionCompletion;
|
|
365
|
+
declare const api_reportPasskeyActivity: typeof reportPasskeyActivity;
|
|
358
366
|
declare const api_signTransfer: typeof signTransfer;
|
|
359
367
|
declare const api_updateUserConfig: typeof updateUserConfig;
|
|
360
368
|
declare const api_updateUserConfigBySession: typeof updateUserConfigBySession;
|
|
361
369
|
declare namespace api {
|
|
362
|
-
export { type api_CreateTransferParams as CreateTransferParams, api_createTransfer as createTransfer, api_fetchAccounts as fetchAccounts, api_fetchAuthorizationSession as fetchAuthorizationSession, api_fetchChains as fetchChains, api_fetchMerchantPublicKey as fetchMerchantPublicKey, api_fetchProviders as fetchProviders, api_fetchTransfer as fetchTransfer, api_fetchUserConfig as fetchUserConfig, api_registerPasskey as registerPasskey, api_reportActionCompletion as reportActionCompletion, api_signTransfer as signTransfer, api_updateUserConfig as updateUserConfig, api_updateUserConfigBySession as updateUserConfigBySession };
|
|
370
|
+
export { type api_CreateTransferParams as CreateTransferParams, api_createTransfer as createTransfer, api_fetchAccounts as fetchAccounts, api_fetchAuthorizationSession as fetchAuthorizationSession, api_fetchChains as fetchChains, api_fetchMerchantPublicKey as fetchMerchantPublicKey, api_fetchProviders as fetchProviders, api_fetchTransfer as fetchTransfer, api_fetchUserConfig as fetchUserConfig, api_registerPasskey as registerPasskey, api_reportActionCompletion as reportActionCompletion, api_reportPasskeyActivity as reportPasskeyActivity, api_signTransfer as signTransfer, api_updateUserConfig as updateUserConfig, api_updateUserConfigBySession as updateUserConfigBySession };
|
|
363
371
|
}
|
|
364
372
|
|
|
365
373
|
interface SwypePaymentProps {
|
package/dist/index.d.ts
CHANGED
|
@@ -321,6 +321,13 @@ declare function fetchAuthorizationSession(apiBaseUrl: string, sessionId: string
|
|
|
321
321
|
* POST /v1/users/config/passkey
|
|
322
322
|
*/
|
|
323
323
|
declare function registerPasskey(apiBaseUrl: string, token: string, credentialId: string, publicKey: string): Promise<void>;
|
|
324
|
+
/**
|
|
325
|
+
* Reports passkey activity (verification) to update the last_active
|
|
326
|
+
* timestamp server-side. Fire-and-forget — callers should not block on
|
|
327
|
+
* the result.
|
|
328
|
+
* PATCH /v1/users/config/passkey
|
|
329
|
+
*/
|
|
330
|
+
declare function reportPasskeyActivity(apiBaseUrl: string, token: string, credentialId: string): Promise<void>;
|
|
324
331
|
/**
|
|
325
332
|
* Fetches the authenticated user's config, including passkey status.
|
|
326
333
|
* GET /v1/users/config
|
|
@@ -355,11 +362,12 @@ declare const api_fetchTransfer: typeof fetchTransfer;
|
|
|
355
362
|
declare const api_fetchUserConfig: typeof fetchUserConfig;
|
|
356
363
|
declare const api_registerPasskey: typeof registerPasskey;
|
|
357
364
|
declare const api_reportActionCompletion: typeof reportActionCompletion;
|
|
365
|
+
declare const api_reportPasskeyActivity: typeof reportPasskeyActivity;
|
|
358
366
|
declare const api_signTransfer: typeof signTransfer;
|
|
359
367
|
declare const api_updateUserConfig: typeof updateUserConfig;
|
|
360
368
|
declare const api_updateUserConfigBySession: typeof updateUserConfigBySession;
|
|
361
369
|
declare namespace api {
|
|
362
|
-
export { type api_CreateTransferParams as CreateTransferParams, api_createTransfer as createTransfer, api_fetchAccounts as fetchAccounts, api_fetchAuthorizationSession as fetchAuthorizationSession, api_fetchChains as fetchChains, api_fetchMerchantPublicKey as fetchMerchantPublicKey, api_fetchProviders as fetchProviders, api_fetchTransfer as fetchTransfer, api_fetchUserConfig as fetchUserConfig, api_registerPasskey as registerPasskey, api_reportActionCompletion as reportActionCompletion, api_signTransfer as signTransfer, api_updateUserConfig as updateUserConfig, api_updateUserConfigBySession as updateUserConfigBySession };
|
|
370
|
+
export { type api_CreateTransferParams as CreateTransferParams, api_createTransfer as createTransfer, api_fetchAccounts as fetchAccounts, api_fetchAuthorizationSession as fetchAuthorizationSession, api_fetchChains as fetchChains, api_fetchMerchantPublicKey as fetchMerchantPublicKey, api_fetchProviders as fetchProviders, api_fetchTransfer as fetchTransfer, api_fetchUserConfig as fetchUserConfig, api_registerPasskey as registerPasskey, api_reportActionCompletion as reportActionCompletion, api_reportPasskeyActivity as reportPasskeyActivity, api_signTransfer as signTransfer, api_updateUserConfig as updateUserConfig, api_updateUserConfigBySession as updateUserConfigBySession };
|
|
363
371
|
}
|
|
364
372
|
|
|
365
373
|
interface SwypePaymentProps {
|
package/dist/index.js
CHANGED
|
@@ -164,6 +164,7 @@ __export(api_exports, {
|
|
|
164
164
|
fetchUserConfig: () => fetchUserConfig,
|
|
165
165
|
registerPasskey: () => registerPasskey,
|
|
166
166
|
reportActionCompletion: () => reportActionCompletion,
|
|
167
|
+
reportPasskeyActivity: () => reportPasskeyActivity,
|
|
167
168
|
signTransfer: () => signTransfer,
|
|
168
169
|
updateUserConfig: () => updateUserConfig,
|
|
169
170
|
updateUserConfigBySession: () => updateUserConfigBySession
|
|
@@ -286,6 +287,17 @@ async function registerPasskey(apiBaseUrl, token, credentialId, publicKey) {
|
|
|
286
287
|
});
|
|
287
288
|
if (!res.ok) await throwApiError(res);
|
|
288
289
|
}
|
|
290
|
+
async function reportPasskeyActivity(apiBaseUrl, token, credentialId) {
|
|
291
|
+
const res = await fetch(`${apiBaseUrl}/v1/users/config/passkey`, {
|
|
292
|
+
method: "PATCH",
|
|
293
|
+
headers: {
|
|
294
|
+
"Content-Type": "application/json",
|
|
295
|
+
Authorization: `Bearer ${token}`
|
|
296
|
+
},
|
|
297
|
+
body: JSON.stringify({ credentialId })
|
|
298
|
+
});
|
|
299
|
+
if (!res.ok) await throwApiError(res);
|
|
300
|
+
}
|
|
289
301
|
async function fetchUserConfig(apiBaseUrl, token) {
|
|
290
302
|
const res = await fetch(`${apiBaseUrl}/v1/users/config`, {
|
|
291
303
|
headers: { Authorization: `Bearer ${token}` }
|
|
@@ -5049,6 +5061,8 @@ function SwypePaymentInner({
|
|
|
5049
5061
|
if (matched) {
|
|
5050
5062
|
setActiveCredentialId(matched);
|
|
5051
5063
|
window.localStorage.setItem(ACTIVE_CREDENTIAL_STORAGE_KEY, matched);
|
|
5064
|
+
reportPasskeyActivity(apiBaseUrl, token, matched).catch(() => {
|
|
5065
|
+
});
|
|
5052
5066
|
await restoreOrDeposit(matched, token);
|
|
5053
5067
|
return;
|
|
5054
5068
|
}
|
|
@@ -5581,6 +5595,11 @@ function SwypePaymentInner({
|
|
|
5581
5595
|
if (matched) {
|
|
5582
5596
|
setActiveCredentialId(matched);
|
|
5583
5597
|
window.localStorage.setItem(ACTIVE_CREDENTIAL_STORAGE_KEY, matched);
|
|
5598
|
+
const token = await getAccessToken();
|
|
5599
|
+
if (token) {
|
|
5600
|
+
reportPasskeyActivity(apiBaseUrl, token, matched).catch(() => {
|
|
5601
|
+
});
|
|
5602
|
+
}
|
|
5584
5603
|
setStep("login");
|
|
5585
5604
|
} else {
|
|
5586
5605
|
setStep("create-passkey");
|
|
@@ -5590,7 +5609,7 @@ function SwypePaymentInner({
|
|
|
5590
5609
|
} finally {
|
|
5591
5610
|
setVerifyingPasskeyPopup(false);
|
|
5592
5611
|
}
|
|
5593
|
-
}, [knownCredentialIds]);
|
|
5612
|
+
}, [knownCredentialIds, getAccessToken, apiBaseUrl]);
|
|
5594
5613
|
const handleSelectProvider = useCallback((providerId) => {
|
|
5595
5614
|
setSelectedProviderId(providerId);
|
|
5596
5615
|
setSelectedAccountId(null);
|