@swype-org/react-sdk 0.1.26 → 0.1.28
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 +93 -121
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +24 -11
- package/dist/index.d.ts +24 -11
- package/dist/index.js +94 -123
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -297,8 +297,16 @@ interface SwypePaymentProps {
|
|
|
297
297
|
* wallet extensions are unavailable.
|
|
298
298
|
*/
|
|
299
299
|
useWalletConnector?: boolean;
|
|
300
|
+
/**
|
|
301
|
+
* Caller-supplied UUID v4 used as the transfer ID for idempotency.
|
|
302
|
+
*
|
|
303
|
+
* When provided, the transfer is created with this ID instead of a
|
|
304
|
+
* randomly generated one. This allows callers to safely retry the payment
|
|
305
|
+
* flow without creating duplicate transfers.
|
|
306
|
+
*/
|
|
307
|
+
idempotencyKey?: string;
|
|
300
308
|
}
|
|
301
|
-
declare function SwypePayment({ destination, onComplete, onError, useWalletConnector, }: SwypePaymentProps): react_jsx_runtime.JSX.Element | null;
|
|
309
|
+
declare function SwypePayment({ destination, onComplete, onError, useWalletConnector, idempotencyKey, }: SwypePaymentProps): react_jsx_runtime.JSX.Element | null;
|
|
302
310
|
|
|
303
311
|
type AccessTokenGetter = () => Promise<string | null | undefined>;
|
|
304
312
|
/**
|
|
@@ -320,17 +328,20 @@ declare function createPasskeyCredential(params: {
|
|
|
320
328
|
publicKey: string;
|
|
321
329
|
}>;
|
|
322
330
|
/**
|
|
323
|
-
*
|
|
324
|
-
*
|
|
325
|
-
*
|
|
326
|
-
* Uses `navigator.credentials.get()` with a throwaway challenge and a short
|
|
327
|
-
* timeout. If the authenticator responds, the device has the key. If it
|
|
328
|
-
* throws (NotAllowedError, timeout, etc.), the device does not.
|
|
329
|
-
*
|
|
330
|
-
* @param credentialId - Base64-encoded WebAuthn credential ID from the server.
|
|
331
|
-
* @returns `true` if the device can authenticate with this credential.
|
|
331
|
+
* @deprecated Use {@link findDevicePasskey} instead, which checks all
|
|
332
|
+
* credentials in a single WebAuthn call.
|
|
332
333
|
*/
|
|
333
334
|
declare function deviceHasPasskey(credentialId: string): Promise<boolean>;
|
|
335
|
+
/**
|
|
336
|
+
* Determines which (if any) of the given server-registered passkeys exists on
|
|
337
|
+
* the current device. All credential IDs are passed in a single
|
|
338
|
+
* `navigator.credentials.get()` call so the browser shows at most one prompt
|
|
339
|
+
* and the platform authenticator automatically selects the matching key.
|
|
340
|
+
*
|
|
341
|
+
* @param credentialIds - Base64-encoded WebAuthn credential IDs from the server.
|
|
342
|
+
* @returns The matching credential ID, or `null` if none are on this device.
|
|
343
|
+
*/
|
|
344
|
+
declare function findDevicePasskey(credentialIds: string[]): Promise<string | null>;
|
|
334
345
|
interface UseTransferPollingResult {
|
|
335
346
|
transfer: Transfer | null;
|
|
336
347
|
error: string | null;
|
|
@@ -413,6 +424,8 @@ declare function fetchProviders(apiBaseUrl: string, token: string): Promise<Prov
|
|
|
413
424
|
declare function fetchChains(apiBaseUrl: string, token: string): Promise<Chain[]>;
|
|
414
425
|
declare function fetchAccounts(apiBaseUrl: string, token: string, credentialId: string): Promise<Account[]>;
|
|
415
426
|
interface CreateTransferParams {
|
|
427
|
+
/** Caller-supplied UUID v4 for idempotency. If omitted, a random UUID is generated. */
|
|
428
|
+
id?: string;
|
|
416
429
|
credentialId: string;
|
|
417
430
|
sourceType: SourceType;
|
|
418
431
|
sourceId: string;
|
|
@@ -473,4 +486,4 @@ declare namespace api {
|
|
|
473
486
|
export { type api_CreateTransferParams as CreateTransferParams, api_createTransfer as createTransfer, api_fetchAccounts as fetchAccounts, api_fetchAuthorizationSession as fetchAuthorizationSession, api_fetchChains as fetchChains, 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 };
|
|
474
487
|
}
|
|
475
488
|
|
|
476
|
-
export { type Account, type ActionExecutionResult, type AdvancedSettings, type Amount, type AuthorizationAction, type AuthorizationSession, type AuthorizationSessionDetail, type Chain, type Destination, type ErrorResponse, type ListResponse, type PaymentStep, type Provider, type SourceOption, type SourceSelection, type SourceType, SwypePayment, type SwypePaymentProps, SwypeProvider, type SwypeProviderProps, type ThemeMode, type ThemeTokens, type TokenBalance, type Transfer, type TransferDestination, type UserConfig, type Wallet, type WalletSource, type WalletToken, createPasskeyCredential, darkTheme, deviceHasPasskey, getTheme, lightTheme, api as swypeApi, useAuthorizationExecutor, useSwypeConfig, useSwypeDepositAmount, useTransferPolling, useTransferSigning };
|
|
489
|
+
export { type Account, type ActionExecutionResult, type AdvancedSettings, type Amount, type AuthorizationAction, type AuthorizationSession, type AuthorizationSessionDetail, type Chain, type Destination, type ErrorResponse, type ListResponse, type PaymentStep, type Provider, type SourceOption, type SourceSelection, type SourceType, SwypePayment, type SwypePaymentProps, SwypeProvider, type SwypeProviderProps, type ThemeMode, type ThemeTokens, type TokenBalance, type Transfer, type TransferDestination, type UserConfig, type Wallet, type WalletSource, type WalletToken, createPasskeyCredential, darkTheme, deviceHasPasskey, findDevicePasskey, getTheme, lightTheme, api as swypeApi, useAuthorizationExecutor, useSwypeConfig, useSwypeDepositAmount, useTransferPolling, useTransferSigning };
|
package/dist/index.d.ts
CHANGED
|
@@ -297,8 +297,16 @@ interface SwypePaymentProps {
|
|
|
297
297
|
* wallet extensions are unavailable.
|
|
298
298
|
*/
|
|
299
299
|
useWalletConnector?: boolean;
|
|
300
|
+
/**
|
|
301
|
+
* Caller-supplied UUID v4 used as the transfer ID for idempotency.
|
|
302
|
+
*
|
|
303
|
+
* When provided, the transfer is created with this ID instead of a
|
|
304
|
+
* randomly generated one. This allows callers to safely retry the payment
|
|
305
|
+
* flow without creating duplicate transfers.
|
|
306
|
+
*/
|
|
307
|
+
idempotencyKey?: string;
|
|
300
308
|
}
|
|
301
|
-
declare function SwypePayment({ destination, onComplete, onError, useWalletConnector, }: SwypePaymentProps): react_jsx_runtime.JSX.Element | null;
|
|
309
|
+
declare function SwypePayment({ destination, onComplete, onError, useWalletConnector, idempotencyKey, }: SwypePaymentProps): react_jsx_runtime.JSX.Element | null;
|
|
302
310
|
|
|
303
311
|
type AccessTokenGetter = () => Promise<string | null | undefined>;
|
|
304
312
|
/**
|
|
@@ -320,17 +328,20 @@ declare function createPasskeyCredential(params: {
|
|
|
320
328
|
publicKey: string;
|
|
321
329
|
}>;
|
|
322
330
|
/**
|
|
323
|
-
*
|
|
324
|
-
*
|
|
325
|
-
*
|
|
326
|
-
* Uses `navigator.credentials.get()` with a throwaway challenge and a short
|
|
327
|
-
* timeout. If the authenticator responds, the device has the key. If it
|
|
328
|
-
* throws (NotAllowedError, timeout, etc.), the device does not.
|
|
329
|
-
*
|
|
330
|
-
* @param credentialId - Base64-encoded WebAuthn credential ID from the server.
|
|
331
|
-
* @returns `true` if the device can authenticate with this credential.
|
|
331
|
+
* @deprecated Use {@link findDevicePasskey} instead, which checks all
|
|
332
|
+
* credentials in a single WebAuthn call.
|
|
332
333
|
*/
|
|
333
334
|
declare function deviceHasPasskey(credentialId: string): Promise<boolean>;
|
|
335
|
+
/**
|
|
336
|
+
* Determines which (if any) of the given server-registered passkeys exists on
|
|
337
|
+
* the current device. All credential IDs are passed in a single
|
|
338
|
+
* `navigator.credentials.get()` call so the browser shows at most one prompt
|
|
339
|
+
* and the platform authenticator automatically selects the matching key.
|
|
340
|
+
*
|
|
341
|
+
* @param credentialIds - Base64-encoded WebAuthn credential IDs from the server.
|
|
342
|
+
* @returns The matching credential ID, or `null` if none are on this device.
|
|
343
|
+
*/
|
|
344
|
+
declare function findDevicePasskey(credentialIds: string[]): Promise<string | null>;
|
|
334
345
|
interface UseTransferPollingResult {
|
|
335
346
|
transfer: Transfer | null;
|
|
336
347
|
error: string | null;
|
|
@@ -413,6 +424,8 @@ declare function fetchProviders(apiBaseUrl: string, token: string): Promise<Prov
|
|
|
413
424
|
declare function fetchChains(apiBaseUrl: string, token: string): Promise<Chain[]>;
|
|
414
425
|
declare function fetchAccounts(apiBaseUrl: string, token: string, credentialId: string): Promise<Account[]>;
|
|
415
426
|
interface CreateTransferParams {
|
|
427
|
+
/** Caller-supplied UUID v4 for idempotency. If omitted, a random UUID is generated. */
|
|
428
|
+
id?: string;
|
|
416
429
|
credentialId: string;
|
|
417
430
|
sourceType: SourceType;
|
|
418
431
|
sourceId: string;
|
|
@@ -473,4 +486,4 @@ declare namespace api {
|
|
|
473
486
|
export { type api_CreateTransferParams as CreateTransferParams, api_createTransfer as createTransfer, api_fetchAccounts as fetchAccounts, api_fetchAuthorizationSession as fetchAuthorizationSession, api_fetchChains as fetchChains, 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 };
|
|
474
487
|
}
|
|
475
488
|
|
|
476
|
-
export { type Account, type ActionExecutionResult, type AdvancedSettings, type Amount, type AuthorizationAction, type AuthorizationSession, type AuthorizationSessionDetail, type Chain, type Destination, type ErrorResponse, type ListResponse, type PaymentStep, type Provider, type SourceOption, type SourceSelection, type SourceType, SwypePayment, type SwypePaymentProps, SwypeProvider, type SwypeProviderProps, type ThemeMode, type ThemeTokens, type TokenBalance, type Transfer, type TransferDestination, type UserConfig, type Wallet, type WalletSource, type WalletToken, createPasskeyCredential, darkTheme, deviceHasPasskey, getTheme, lightTheme, api as swypeApi, useAuthorizationExecutor, useSwypeConfig, useSwypeDepositAmount, useTransferPolling, useTransferSigning };
|
|
489
|
+
export { type Account, type ActionExecutionResult, type AdvancedSettings, type Amount, type AuthorizationAction, type AuthorizationSession, type AuthorizationSessionDetail, type Chain, type Destination, type ErrorResponse, type ListResponse, type PaymentStep, type Provider, type SourceOption, type SourceSelection, type SourceType, SwypePayment, type SwypePaymentProps, SwypeProvider, type SwypeProviderProps, type ThemeMode, type ThemeTokens, type TokenBalance, type Transfer, type TransferDestination, type UserConfig, type Wallet, type WalletSource, type WalletToken, createPasskeyCredential, darkTheme, deviceHasPasskey, findDevicePasskey, getTheme, lightTheme, api as swypeApi, useAuthorizationExecutor, useSwypeConfig, useSwypeDepositAmount, useTransferPolling, useTransferSigning };
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createContext, useRef, useState, useCallback, useMemo, useContext
|
|
1
|
+
import { createContext, useRef, useEffect, useState, useCallback, useMemo, useContext } from 'react';
|
|
2
2
|
import { PrivyProvider, usePrivy } from '@privy-io/react-auth';
|
|
3
3
|
import { createConfig, http, WagmiProvider, useConfig, useConnect, useSwitchChain } from 'wagmi';
|
|
4
4
|
import { mainnet, arbitrum, base } from 'wagmi/chains';
|
|
@@ -74,6 +74,26 @@ var wagmiConfig = createConfig({
|
|
|
74
74
|
[base.id]: http()
|
|
75
75
|
}
|
|
76
76
|
});
|
|
77
|
+
var PRIVY_MODAL_CENTER_CSS = `
|
|
78
|
+
@media (max-width: 440px) {
|
|
79
|
+
#privy-dialog [data-headlessui-state] {
|
|
80
|
+
position: static !important;
|
|
81
|
+
bottom: auto !important;
|
|
82
|
+
margin: auto !important;
|
|
83
|
+
width: 360px !important;
|
|
84
|
+
max-width: calc(100vw - 32px) !important;
|
|
85
|
+
box-shadow: 0px 8px 36px rgba(55, 65, 81, 0.15) !important;
|
|
86
|
+
border-radius: var(--privy-border-radius-lg) !important;
|
|
87
|
+
transform: none !important;
|
|
88
|
+
transition: opacity 100ms ease-in !important;
|
|
89
|
+
}
|
|
90
|
+
#privy-dialog [data-headlessui-state].entering,
|
|
91
|
+
#privy-dialog [data-headlessui-state].leaving {
|
|
92
|
+
opacity: 0 !important;
|
|
93
|
+
transform: none !important;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
`;
|
|
77
97
|
var SwypeContext = createContext(null);
|
|
78
98
|
function SwypeProvider({
|
|
79
99
|
apiBaseUrl,
|
|
@@ -84,6 +104,15 @@ function SwypeProvider({
|
|
|
84
104
|
if (!queryClientRef.current) {
|
|
85
105
|
queryClientRef.current = new QueryClient();
|
|
86
106
|
}
|
|
107
|
+
useEffect(() => {
|
|
108
|
+
const style = document.createElement("style");
|
|
109
|
+
style.setAttribute("data-swype", "privy-modal-center");
|
|
110
|
+
style.textContent = PRIVY_MODAL_CENTER_CSS;
|
|
111
|
+
document.head.appendChild(style);
|
|
112
|
+
return () => {
|
|
113
|
+
style.remove();
|
|
114
|
+
};
|
|
115
|
+
}, []);
|
|
87
116
|
const [depositAmount, setDepositAmountRaw] = useState(null);
|
|
88
117
|
const setDepositAmount = useCallback((amount) => {
|
|
89
118
|
setDepositAmountRaw(amount);
|
|
@@ -187,7 +216,7 @@ async function fetchAccounts(apiBaseUrl, token, credentialId) {
|
|
|
187
216
|
}
|
|
188
217
|
async function createTransfer(apiBaseUrl, token, params) {
|
|
189
218
|
const body = {
|
|
190
|
-
id: crypto.randomUUID(),
|
|
219
|
+
id: params.id ?? crypto.randomUUID(),
|
|
191
220
|
credentialId: params.credentialId,
|
|
192
221
|
sources: [{ [params.sourceType]: params.sourceId }],
|
|
193
222
|
destinations: [
|
|
@@ -784,6 +813,11 @@ async function createPasskeyCredential(params) {
|
|
|
784
813
|
};
|
|
785
814
|
}
|
|
786
815
|
async function deviceHasPasskey(credentialId) {
|
|
816
|
+
const found = await findDevicePasskey([credentialId]);
|
|
817
|
+
return found != null;
|
|
818
|
+
}
|
|
819
|
+
async function findDevicePasskey(credentialIds) {
|
|
820
|
+
if (credentialIds.length === 0) return null;
|
|
787
821
|
try {
|
|
788
822
|
const challenge = new Uint8Array(32);
|
|
789
823
|
crypto.getRandomValues(challenge);
|
|
@@ -792,17 +826,18 @@ async function deviceHasPasskey(credentialId) {
|
|
|
792
826
|
publicKey: {
|
|
793
827
|
challenge,
|
|
794
828
|
rpId: resolvePasskeyRpId(),
|
|
795
|
-
allowCredentials:
|
|
829
|
+
allowCredentials: credentialIds.map((id) => ({
|
|
796
830
|
type: "public-key",
|
|
797
|
-
id: base64ToBytes(
|
|
798
|
-
}
|
|
831
|
+
id: base64ToBytes(id)
|
|
832
|
+
})),
|
|
799
833
|
userVerification: "discouraged",
|
|
800
834
|
timeout: 3e4
|
|
801
835
|
}
|
|
802
836
|
});
|
|
803
|
-
|
|
837
|
+
if (!assertion) return null;
|
|
838
|
+
return toBase64(assertion.rawId);
|
|
804
839
|
} catch {
|
|
805
|
-
return
|
|
840
|
+
return null;
|
|
806
841
|
}
|
|
807
842
|
}
|
|
808
843
|
function useTransferPolling(intervalMs = 3e3) {
|
|
@@ -2167,7 +2202,8 @@ function SwypePayment({
|
|
|
2167
2202
|
destination,
|
|
2168
2203
|
onComplete,
|
|
2169
2204
|
onError,
|
|
2170
|
-
useWalletConnector
|
|
2205
|
+
useWalletConnector,
|
|
2206
|
+
idempotencyKey
|
|
2171
2207
|
}) {
|
|
2172
2208
|
const { apiBaseUrl, tokens, depositAmount } = useSwypeConfig();
|
|
2173
2209
|
const { ready, authenticated, user, login, logout, getAccessToken } = usePrivy();
|
|
@@ -2234,20 +2270,20 @@ function SwypePayment({
|
|
|
2234
2270
|
}
|
|
2235
2271
|
return;
|
|
2236
2272
|
}
|
|
2237
|
-
|
|
2238
|
-
|
|
2239
|
-
|
|
2240
|
-
|
|
2241
|
-
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
|
|
2246
|
-
|
|
2247
|
-
|
|
2273
|
+
if (cancelled) return;
|
|
2274
|
+
const credentialIds = allPasskeys.map((p) => p.credentialId);
|
|
2275
|
+
const matched = await findDevicePasskey(credentialIds);
|
|
2276
|
+
if (cancelled) return;
|
|
2277
|
+
if (matched) {
|
|
2278
|
+
setActiveCredentialId(matched);
|
|
2279
|
+
window.localStorage.setItem(ACTIVE_CREDENTIAL_STORAGE_KEY, matched);
|
|
2280
|
+
if (depositAmount != null && depositAmount > 0) {
|
|
2281
|
+
setStep("ready");
|
|
2282
|
+
} else {
|
|
2283
|
+
setStep("enter-amount");
|
|
2248
2284
|
}
|
|
2285
|
+
return;
|
|
2249
2286
|
}
|
|
2250
|
-
if (cancelled) return;
|
|
2251
2287
|
setStep("register-passkey");
|
|
2252
2288
|
} catch {
|
|
2253
2289
|
if (!cancelled) {
|
|
@@ -2481,6 +2517,7 @@ function SwypePayment({
|
|
|
2481
2517
|
}
|
|
2482
2518
|
}
|
|
2483
2519
|
const t = await createTransfer(apiBaseUrl, token, {
|
|
2520
|
+
id: idempotencyKey,
|
|
2484
2521
|
credentialId: activeCredentialId,
|
|
2485
2522
|
sourceType: effectiveSourceType,
|
|
2486
2523
|
sourceId: effectiveSourceId,
|
|
@@ -3022,7 +3059,7 @@ function SwypePayment({
|
|
|
3022
3059
|
]
|
|
3023
3060
|
}
|
|
3024
3061
|
),
|
|
3025
|
-
/* @__PURE__ */
|
|
3062
|
+
/* @__PURE__ */ jsx(
|
|
3026
3063
|
"div",
|
|
3027
3064
|
{
|
|
3028
3065
|
style: {
|
|
@@ -3035,74 +3072,39 @@ function SwypePayment({
|
|
|
3035
3072
|
border: `1px solid ${tokens.border}`,
|
|
3036
3073
|
lineHeight: 1.7
|
|
3037
3074
|
},
|
|
3038
|
-
children:
|
|
3039
|
-
|
|
3040
|
-
|
|
3041
|
-
{
|
|
3042
|
-
|
|
3043
|
-
|
|
3044
|
-
|
|
3045
|
-
|
|
3046
|
-
|
|
3047
|
-
|
|
3048
|
-
|
|
3049
|
-
|
|
3050
|
-
|
|
3051
|
-
|
|
3052
|
-
|
|
3053
|
-
|
|
3054
|
-
|
|
3055
|
-
|
|
3056
|
-
|
|
3057
|
-
|
|
3058
|
-
|
|
3059
|
-
|
|
3060
|
-
|
|
3061
|
-
|
|
3062
|
-
|
|
3063
|
-
|
|
3064
|
-
|
|
3065
|
-
style: { display: "flex", justifyContent: "space-between" },
|
|
3066
|
-
children: [
|
|
3067
|
-
/* @__PURE__ */ jsx("span", { children: "Token" }),
|
|
3068
|
-
/* @__PURE__ */ jsx("span", { style: { fontWeight: 600 }, children: destination.token.symbol })
|
|
3069
|
-
]
|
|
3070
|
-
}
|
|
3071
|
-
),
|
|
3072
|
-
/* @__PURE__ */ jsxs(
|
|
3073
|
-
"div",
|
|
3074
|
-
{
|
|
3075
|
-
style: {
|
|
3076
|
-
display: "flex",
|
|
3077
|
-
justifyContent: "space-between",
|
|
3078
|
-
alignItems: "center"
|
|
3079
|
-
},
|
|
3080
|
-
children: [
|
|
3081
|
-
/* @__PURE__ */ jsx("span", { children: "From" }),
|
|
3082
|
-
noAccounts ? /* @__PURE__ */ jsx("span", { style: { fontWeight: 500, color: tokens.textMuted }, children: "New account" }) : /* @__PURE__ */ jsx(
|
|
3083
|
-
AccountDropdown,
|
|
3084
|
-
{
|
|
3085
|
-
accounts,
|
|
3086
|
-
selectedAccountId,
|
|
3087
|
-
selectedWalletId,
|
|
3088
|
-
onSelect: (id) => {
|
|
3089
|
-
setSelectedAccountId(id);
|
|
3090
|
-
setSelectedWalletId(null);
|
|
3091
|
-
setConnectingNewAccount(false);
|
|
3092
|
-
setSelectedProviderId(null);
|
|
3093
|
-
},
|
|
3094
|
-
onWalletSelect: (accountId, walletId) => {
|
|
3095
|
-
setSelectedAccountId(accountId);
|
|
3096
|
-
setSelectedWalletId(walletId);
|
|
3097
|
-
setConnectingNewAccount(false);
|
|
3098
|
-
setSelectedProviderId(null);
|
|
3099
|
-
}
|
|
3075
|
+
children: /* @__PURE__ */ jsx(
|
|
3076
|
+
"div",
|
|
3077
|
+
{
|
|
3078
|
+
style: {
|
|
3079
|
+
display: "flex",
|
|
3080
|
+
justifyContent: "space-between",
|
|
3081
|
+
alignItems: "center"
|
|
3082
|
+
},
|
|
3083
|
+
children: noAccounts ? /* @__PURE__ */ jsx(Fragment, {}) : /* @__PURE__ */ jsxs("div", { children: [
|
|
3084
|
+
/* @__PURE__ */ jsx("span", { children: "From" }),
|
|
3085
|
+
/* @__PURE__ */ jsx(
|
|
3086
|
+
AccountDropdown,
|
|
3087
|
+
{
|
|
3088
|
+
accounts,
|
|
3089
|
+
selectedAccountId,
|
|
3090
|
+
selectedWalletId,
|
|
3091
|
+
onSelect: (id) => {
|
|
3092
|
+
setSelectedAccountId(id);
|
|
3093
|
+
setSelectedWalletId(null);
|
|
3094
|
+
setConnectingNewAccount(false);
|
|
3095
|
+
setSelectedProviderId(null);
|
|
3096
|
+
},
|
|
3097
|
+
onWalletSelect: (accountId, walletId) => {
|
|
3098
|
+
setSelectedAccountId(accountId);
|
|
3099
|
+
setSelectedWalletId(walletId);
|
|
3100
|
+
setConnectingNewAccount(false);
|
|
3101
|
+
setSelectedProviderId(null);
|
|
3100
3102
|
}
|
|
3101
|
-
|
|
3102
|
-
|
|
3103
|
-
}
|
|
3104
|
-
|
|
3105
|
-
|
|
3103
|
+
}
|
|
3104
|
+
)
|
|
3105
|
+
] })
|
|
3106
|
+
}
|
|
3107
|
+
)
|
|
3106
3108
|
}
|
|
3107
3109
|
),
|
|
3108
3110
|
noAccounts && /* @__PURE__ */ jsxs("div", { style: { marginBottom: "16px" }, children: [
|
|
@@ -3368,10 +3370,9 @@ function SwypePayment({
|
|
|
3368
3370
|
}
|
|
3369
3371
|
};
|
|
3370
3372
|
const regMsg = getRegistrationMessage();
|
|
3371
|
-
|
|
3372
|
-
|
|
3373
|
-
const statusLabel = creatingTransfer ? "Creating
|
|
3374
|
-
const statusDescription = creatingTransfer ? "Setting up your transfer..." : mobileFlow ? "Complete the authorization in your wallet app, then return here." : authExecutor.executing && regMsg.description ? regMsg.description : authExecutor.executing ? "Complete the wallet prompts to authorize this payment." : transferSigning.signing ? "Waiting for backend to prepare your transfer payload..." : polling.isPolling ? "Your payment is being processed. This usually takes a few moments." : "Hang tight...";
|
|
3373
|
+
getDisplayTransferStatus(polling.transfer, transfer);
|
|
3374
|
+
getTransferIdSuffix(polling.transfer, transfer);
|
|
3375
|
+
const statusLabel = creatingTransfer ? "Creating Transfer" : mobileFlow ? "Waiting for Authorization" : authExecutor.executing && regMsg.label ? regMsg.label : authExecutor.executing ? "Authorizing" : transferSigning.signing ? "Sending transfer" : polling.isPolling ? "Transfer Sent" : "Please wait...";
|
|
3375
3376
|
return /* @__PURE__ */ jsx("div", { style: cardStyle, children: /* @__PURE__ */ jsxs("div", { style: { textAlign: "center", padding: "16px 0" }, children: [
|
|
3376
3377
|
/* @__PURE__ */ jsx(Spinner, { size: 48 }),
|
|
3377
3378
|
/* @__PURE__ */ jsx(
|
|
@@ -3385,36 +3386,6 @@ function SwypePayment({
|
|
|
3385
3386
|
children: statusLabel
|
|
3386
3387
|
}
|
|
3387
3388
|
),
|
|
3388
|
-
/* @__PURE__ */ jsx(
|
|
3389
|
-
"p",
|
|
3390
|
-
{
|
|
3391
|
-
style: {
|
|
3392
|
-
fontSize: "0.85rem",
|
|
3393
|
-
color: tokens.textSecondary,
|
|
3394
|
-
margin: 0,
|
|
3395
|
-
lineHeight: 1.5
|
|
3396
|
-
},
|
|
3397
|
-
children: statusDescription
|
|
3398
|
-
}
|
|
3399
|
-
),
|
|
3400
|
-
/* @__PURE__ */ jsxs(
|
|
3401
|
-
"p",
|
|
3402
|
-
{
|
|
3403
|
-
style: {
|
|
3404
|
-
marginTop: "12px",
|
|
3405
|
-
marginBottom: 0,
|
|
3406
|
-
fontSize: "0.8rem",
|
|
3407
|
-
color: tokens.textSecondary
|
|
3408
|
-
},
|
|
3409
|
-
children: [
|
|
3410
|
-
"Current status: ",
|
|
3411
|
-
/* @__PURE__ */ jsx("strong", { style: { color: tokens.text }, children: transferStatus }),
|
|
3412
|
-
" \xB7 ",
|
|
3413
|
-
"Transfer: ",
|
|
3414
|
-
/* @__PURE__ */ jsx("span", { style: { color: tokens.textMuted }, children: transferIdSuffix })
|
|
3415
|
-
]
|
|
3416
|
-
}
|
|
3417
|
-
),
|
|
3418
3389
|
polling.error && /* @__PURE__ */ jsxs(
|
|
3419
3390
|
"p",
|
|
3420
3391
|
{
|
|
@@ -3580,6 +3551,6 @@ function SwypePayment({
|
|
|
3580
3551
|
return null;
|
|
3581
3552
|
}
|
|
3582
3553
|
|
|
3583
|
-
export { SwypePayment, SwypeProvider, createPasskeyCredential, darkTheme, deviceHasPasskey, getTheme, lightTheme, api_exports as swypeApi, useAuthorizationExecutor, useSwypeConfig, useSwypeDepositAmount, useTransferPolling, useTransferSigning };
|
|
3554
|
+
export { SwypePayment, SwypeProvider, createPasskeyCredential, darkTheme, deviceHasPasskey, findDevicePasskey, getTheme, lightTheme, api_exports as swypeApi, useAuthorizationExecutor, useSwypeConfig, useSwypeDepositAmount, useTransferPolling, useTransferSigning };
|
|
3584
3555
|
//# sourceMappingURL=index.js.map
|
|
3585
3556
|
//# sourceMappingURL=index.js.map
|