@swype-org/react-sdk 0.1.84 → 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 +232 -48
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +33 -3
- package/dist/index.d.ts +33 -3
- package/dist/index.js +231 -49
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -199,7 +199,7 @@ interface UserConfig {
|
|
|
199
199
|
/** Theme mode */
|
|
200
200
|
type ThemeMode = 'light' | 'dark';
|
|
201
201
|
/** Steps in the payment flow */
|
|
202
|
-
type PaymentStep = 'login' | 'otp-verify' | 'create-passkey' | 'wallet-picker' | 'open-wallet' | 'confirm-sign' | 'deposit' | 'low-balance' | 'processing' | 'select-source' | 'success';
|
|
202
|
+
type PaymentStep = 'login' | 'otp-verify' | 'create-passkey' | 'verify-passkey' | 'wallet-picker' | 'open-wallet' | 'confirm-sign' | 'deposit' | 'low-balance' | 'processing' | 'select-source' | 'success';
|
|
203
203
|
/** User-selected advanced settings for chain/asset override */
|
|
204
204
|
interface AdvancedSettings {
|
|
205
205
|
/** Override asset (e.g. 'USDC', 'USDT'). Null = let backend decide. */
|
|
@@ -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 {
|
|
@@ -453,8 +461,30 @@ declare function createPasskeyViaPopup(options: PasskeyPopupOptions, existingCre
|
|
|
453
461
|
credentialId: string;
|
|
454
462
|
publicKey: string;
|
|
455
463
|
}>;
|
|
464
|
+
interface PasskeyVerifyPopupOptions {
|
|
465
|
+
credentialIds: string[];
|
|
466
|
+
rpId: string;
|
|
467
|
+
/** Populated by `findDevicePasskeyViaPopup`; not set by callers. */
|
|
468
|
+
channelId?: string;
|
|
469
|
+
}
|
|
470
|
+
/**
|
|
471
|
+
* Opens a same-origin pop-up window on the Swype domain to check whether
|
|
472
|
+
* any of the given passkey credential IDs exist on this device.
|
|
473
|
+
*
|
|
474
|
+
* Used as a fallback when Safari blocks `navigator.credentials.get()`
|
|
475
|
+
* inside a cross-origin iframe. The popup runs on the Swype domain where
|
|
476
|
+
* the rpId matches, so WebAuthn works.
|
|
477
|
+
*
|
|
478
|
+
* Must be called from a user-gesture handler (e.g. button click) to
|
|
479
|
+
* avoid the browser's pop-up blocker.
|
|
480
|
+
*
|
|
481
|
+
* @returns The matching credential ID, or `null` if none matched or the
|
|
482
|
+
* popup was closed before completing.
|
|
483
|
+
*/
|
|
484
|
+
declare function findDevicePasskeyViaPopup(options: PasskeyVerifyPopupOptions): Promise<string | null>;
|
|
456
485
|
|
|
457
486
|
type AccessTokenGetter = () => Promise<string | null | undefined>;
|
|
487
|
+
declare function resolvePasskeyRpId(): string;
|
|
458
488
|
/**
|
|
459
489
|
* Creates a WebAuthn passkey credential.
|
|
460
490
|
* Used for upfront passkey registration before the authorization flow.
|
|
@@ -726,4 +756,4 @@ interface AdvancedSourceScreenProps {
|
|
|
726
756
|
}
|
|
727
757
|
declare function AdvancedSourceScreen({ choices, selectedChainName, selectedTokenSymbol, onSelectSource, onBack, }: AdvancedSourceScreenProps): react_jsx_runtime.JSX.Element;
|
|
728
758
|
|
|
729
|
-
export { type Account, type ActionExecutionResult, type AdvancedSettings, AdvancedSourceScreen, type Amount, type AuthorizationAction, type AuthorizationSession, type AuthorizationSessionDetail, type Chain, CreatePasskeyScreen, type Destination, type ErrorResponse, IconCircle, InfoBanner, type ListResponse, type MerchantAuthorization, type MerchantPublicKey, OutlineButton, PasskeyIframeBlockedError, type PaymentStep, PoweredByFooter, PrimaryButton, type Provider, ScreenHeader, ScreenLayout, SelectSourceScreen, SettingsMenu, SetupScreen, type SourceOption, type SourceSelection, type SourceType, Spinner, type StepItem, StepList, SwypePayment, type SwypePaymentProps, SwypeProvider, type SwypeProviderProps, type ThemeMode, type ThemeTokens, type TokenBalance, type Transfer, type TransferDestination, type UserConfig, type Wallet, type WalletSource, type WalletToken, buildPasskeyPopupOptions, createPasskeyCredential, createPasskeyViaPopup, darkTheme, deviceHasPasskey, findDevicePasskey, getTheme, lightTheme, api as swypeApi, useAuthorizationExecutor, useSwypeConfig, useSwypeDepositAmount, useTransferPolling, useTransferSigning };
|
|
759
|
+
export { type Account, type ActionExecutionResult, type AdvancedSettings, AdvancedSourceScreen, type Amount, type AuthorizationAction, type AuthorizationSession, type AuthorizationSessionDetail, type Chain, CreatePasskeyScreen, type Destination, type ErrorResponse, IconCircle, InfoBanner, type ListResponse, type MerchantAuthorization, type MerchantPublicKey, OutlineButton, PasskeyIframeBlockedError, type PaymentStep, PoweredByFooter, PrimaryButton, type Provider, ScreenHeader, ScreenLayout, SelectSourceScreen, SettingsMenu, SetupScreen, type SourceOption, type SourceSelection, type SourceType, Spinner, type StepItem, StepList, SwypePayment, type SwypePaymentProps, SwypeProvider, type SwypeProviderProps, type ThemeMode, type ThemeTokens, type TokenBalance, type Transfer, type TransferDestination, type UserConfig, type Wallet, type WalletSource, type WalletToken, buildPasskeyPopupOptions, createPasskeyCredential, createPasskeyViaPopup, darkTheme, deviceHasPasskey, findDevicePasskey, findDevicePasskeyViaPopup, getTheme, lightTheme, resolvePasskeyRpId, api as swypeApi, useAuthorizationExecutor, useSwypeConfig, useSwypeDepositAmount, useTransferPolling, useTransferSigning };
|
package/dist/index.d.ts
CHANGED
|
@@ -199,7 +199,7 @@ interface UserConfig {
|
|
|
199
199
|
/** Theme mode */
|
|
200
200
|
type ThemeMode = 'light' | 'dark';
|
|
201
201
|
/** Steps in the payment flow */
|
|
202
|
-
type PaymentStep = 'login' | 'otp-verify' | 'create-passkey' | 'wallet-picker' | 'open-wallet' | 'confirm-sign' | 'deposit' | 'low-balance' | 'processing' | 'select-source' | 'success';
|
|
202
|
+
type PaymentStep = 'login' | 'otp-verify' | 'create-passkey' | 'verify-passkey' | 'wallet-picker' | 'open-wallet' | 'confirm-sign' | 'deposit' | 'low-balance' | 'processing' | 'select-source' | 'success';
|
|
203
203
|
/** User-selected advanced settings for chain/asset override */
|
|
204
204
|
interface AdvancedSettings {
|
|
205
205
|
/** Override asset (e.g. 'USDC', 'USDT'). Null = let backend decide. */
|
|
@@ -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 {
|
|
@@ -453,8 +461,30 @@ declare function createPasskeyViaPopup(options: PasskeyPopupOptions, existingCre
|
|
|
453
461
|
credentialId: string;
|
|
454
462
|
publicKey: string;
|
|
455
463
|
}>;
|
|
464
|
+
interface PasskeyVerifyPopupOptions {
|
|
465
|
+
credentialIds: string[];
|
|
466
|
+
rpId: string;
|
|
467
|
+
/** Populated by `findDevicePasskeyViaPopup`; not set by callers. */
|
|
468
|
+
channelId?: string;
|
|
469
|
+
}
|
|
470
|
+
/**
|
|
471
|
+
* Opens a same-origin pop-up window on the Swype domain to check whether
|
|
472
|
+
* any of the given passkey credential IDs exist on this device.
|
|
473
|
+
*
|
|
474
|
+
* Used as a fallback when Safari blocks `navigator.credentials.get()`
|
|
475
|
+
* inside a cross-origin iframe. The popup runs on the Swype domain where
|
|
476
|
+
* the rpId matches, so WebAuthn works.
|
|
477
|
+
*
|
|
478
|
+
* Must be called from a user-gesture handler (e.g. button click) to
|
|
479
|
+
* avoid the browser's pop-up blocker.
|
|
480
|
+
*
|
|
481
|
+
* @returns The matching credential ID, or `null` if none matched or the
|
|
482
|
+
* popup was closed before completing.
|
|
483
|
+
*/
|
|
484
|
+
declare function findDevicePasskeyViaPopup(options: PasskeyVerifyPopupOptions): Promise<string | null>;
|
|
456
485
|
|
|
457
486
|
type AccessTokenGetter = () => Promise<string | null | undefined>;
|
|
487
|
+
declare function resolvePasskeyRpId(): string;
|
|
458
488
|
/**
|
|
459
489
|
* Creates a WebAuthn passkey credential.
|
|
460
490
|
* Used for upfront passkey registration before the authorization flow.
|
|
@@ -726,4 +756,4 @@ interface AdvancedSourceScreenProps {
|
|
|
726
756
|
}
|
|
727
757
|
declare function AdvancedSourceScreen({ choices, selectedChainName, selectedTokenSymbol, onSelectSource, onBack, }: AdvancedSourceScreenProps): react_jsx_runtime.JSX.Element;
|
|
728
758
|
|
|
729
|
-
export { type Account, type ActionExecutionResult, type AdvancedSettings, AdvancedSourceScreen, type Amount, type AuthorizationAction, type AuthorizationSession, type AuthorizationSessionDetail, type Chain, CreatePasskeyScreen, type Destination, type ErrorResponse, IconCircle, InfoBanner, type ListResponse, type MerchantAuthorization, type MerchantPublicKey, OutlineButton, PasskeyIframeBlockedError, type PaymentStep, PoweredByFooter, PrimaryButton, type Provider, ScreenHeader, ScreenLayout, SelectSourceScreen, SettingsMenu, SetupScreen, type SourceOption, type SourceSelection, type SourceType, Spinner, type StepItem, StepList, SwypePayment, type SwypePaymentProps, SwypeProvider, type SwypeProviderProps, type ThemeMode, type ThemeTokens, type TokenBalance, type Transfer, type TransferDestination, type UserConfig, type Wallet, type WalletSource, type WalletToken, buildPasskeyPopupOptions, createPasskeyCredential, createPasskeyViaPopup, darkTheme, deviceHasPasskey, findDevicePasskey, getTheme, lightTheme, api as swypeApi, useAuthorizationExecutor, useSwypeConfig, useSwypeDepositAmount, useTransferPolling, useTransferSigning };
|
|
759
|
+
export { type Account, type ActionExecutionResult, type AdvancedSettings, AdvancedSourceScreen, type Amount, type AuthorizationAction, type AuthorizationSession, type AuthorizationSessionDetail, type Chain, CreatePasskeyScreen, type Destination, type ErrorResponse, IconCircle, InfoBanner, type ListResponse, type MerchantAuthorization, type MerchantPublicKey, OutlineButton, PasskeyIframeBlockedError, type PaymentStep, PoweredByFooter, PrimaryButton, type Provider, ScreenHeader, ScreenLayout, SelectSourceScreen, SettingsMenu, SetupScreen, type SourceOption, type SourceSelection, type SourceType, Spinner, type StepItem, StepList, SwypePayment, type SwypePaymentProps, SwypeProvider, type SwypeProviderProps, type ThemeMode, type ThemeTokens, type TokenBalance, type Transfer, type TransferDestination, type UserConfig, type Wallet, type WalletSource, type WalletToken, buildPasskeyPopupOptions, createPasskeyCredential, createPasskeyViaPopup, darkTheme, deviceHasPasskey, findDevicePasskey, findDevicePasskeyViaPopup, getTheme, lightTheme, resolvePasskeyRpId, api as swypeApi, useAuthorizationExecutor, useSwypeConfig, useSwypeDepositAmount, useTransferPolling, useTransferSigning };
|