@swype-org/react-sdk 0.1.224 → 0.1.225
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 +16 -16
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -4
- package/dist/index.d.ts +3 -4
- package/dist/index.js +16 -16
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -453,8 +453,7 @@ declare function fetchGuestPreauthAccount(apiBaseUrl: string, guestToken: string
|
|
|
453
453
|
hasPasskey: boolean;
|
|
454
454
|
walletAddress: string | null;
|
|
455
455
|
} | null>;
|
|
456
|
-
declare function
|
|
457
|
-
guestToken: string;
|
|
456
|
+
declare function setAccountOwner(apiBaseUrl: string, accessToken: string, accountId: string, guestSessionToken: string, body: {
|
|
458
457
|
credentialId: string;
|
|
459
458
|
publicKey: string;
|
|
460
459
|
}): Promise<{
|
|
@@ -468,7 +467,6 @@ type api_CreateGuestTransferParams = CreateGuestTransferParams;
|
|
|
468
467
|
type api_CreateTransferParams = CreateTransferParams;
|
|
469
468
|
type api_GuestBalanceOption = GuestBalanceOption;
|
|
470
469
|
type api_GuestTransferResult = GuestTransferResult;
|
|
471
|
-
declare const api_claimAccount: typeof claimAccount;
|
|
472
470
|
declare const api_createAccount: typeof createAccount;
|
|
473
471
|
declare const api_createAccountAuthorizationSession: typeof createAccountAuthorizationSession;
|
|
474
472
|
declare const api_createGuestTransfer: typeof createGuestTransfer;
|
|
@@ -488,13 +486,14 @@ declare const api_getTransferByGuestToken: typeof getTransferByGuestToken;
|
|
|
488
486
|
declare const api_registerPasskey: typeof registerPasskey;
|
|
489
487
|
declare const api_reportActionCompletion: typeof reportActionCompletion;
|
|
490
488
|
declare const api_reportPasskeyActivity: typeof reportPasskeyActivity;
|
|
489
|
+
declare const api_setAccountOwner: typeof setAccountOwner;
|
|
491
490
|
declare const api_setTransferSender: typeof setTransferSender;
|
|
492
491
|
declare const api_signGuestTransfer: typeof signGuestTransfer;
|
|
493
492
|
declare const api_signTransfer: typeof signTransfer;
|
|
494
493
|
declare const api_updateUserConfig: typeof updateUserConfig;
|
|
495
494
|
declare const api_updateUserConfigBySession: typeof updateUserConfigBySession;
|
|
496
495
|
declare namespace api {
|
|
497
|
-
export { type api_CreateAccountParams as CreateAccountParams, type api_CreateGuestTransferParams as CreateGuestTransferParams, type api_CreateTransferParams as CreateTransferParams, type api_GuestBalanceOption as GuestBalanceOption, type api_GuestTransferResult as GuestTransferResult,
|
|
496
|
+
export { type api_CreateAccountParams as CreateAccountParams, type api_CreateGuestTransferParams as CreateGuestTransferParams, type api_CreateTransferParams as CreateTransferParams, type api_GuestBalanceOption as GuestBalanceOption, type api_GuestTransferResult as GuestTransferResult, api_createAccount as createAccount, api_createAccountAuthorizationSession as createAccountAuthorizationSession, api_createGuestTransfer as createGuestTransfer, api_createTransfer as createTransfer, api_fetchAccount as fetchAccount, api_fetchAccounts as fetchAccounts, api_fetchAuthorizationSession as fetchAuthorizationSession, api_fetchChains as fetchChains, api_fetchGuestPreauthAccount as fetchGuestPreauthAccount, api_fetchGuestTransferBalances as fetchGuestTransferBalances, api_fetchMerchantPublicKey as fetchMerchantPublicKey, api_fetchProviders as fetchProviders, api_fetchTransfer as fetchTransfer, api_fetchUserConfig as fetchUserConfig, api_getGuestTransfer as getGuestTransfer, api_getTransferByGuestToken as getTransferByGuestToken, api_registerPasskey as registerPasskey, api_reportActionCompletion as reportActionCompletion, api_reportPasskeyActivity as reportPasskeyActivity, api_setAccountOwner as setAccountOwner, api_setTransferSender as setTransferSender, api_signGuestTransfer as signGuestTransfer, api_signTransfer as signTransfer, api_updateUserConfig as updateUserConfig, api_updateUserConfigBySession as updateUserConfigBySession };
|
|
498
497
|
}
|
|
499
498
|
|
|
500
499
|
interface BlinkPaymentProps {
|
package/dist/index.d.ts
CHANGED
|
@@ -453,8 +453,7 @@ declare function fetchGuestPreauthAccount(apiBaseUrl: string, guestToken: string
|
|
|
453
453
|
hasPasskey: boolean;
|
|
454
454
|
walletAddress: string | null;
|
|
455
455
|
} | null>;
|
|
456
|
-
declare function
|
|
457
|
-
guestToken: string;
|
|
456
|
+
declare function setAccountOwner(apiBaseUrl: string, accessToken: string, accountId: string, guestSessionToken: string, body: {
|
|
458
457
|
credentialId: string;
|
|
459
458
|
publicKey: string;
|
|
460
459
|
}): Promise<{
|
|
@@ -468,7 +467,6 @@ type api_CreateGuestTransferParams = CreateGuestTransferParams;
|
|
|
468
467
|
type api_CreateTransferParams = CreateTransferParams;
|
|
469
468
|
type api_GuestBalanceOption = GuestBalanceOption;
|
|
470
469
|
type api_GuestTransferResult = GuestTransferResult;
|
|
471
|
-
declare const api_claimAccount: typeof claimAccount;
|
|
472
470
|
declare const api_createAccount: typeof createAccount;
|
|
473
471
|
declare const api_createAccountAuthorizationSession: typeof createAccountAuthorizationSession;
|
|
474
472
|
declare const api_createGuestTransfer: typeof createGuestTransfer;
|
|
@@ -488,13 +486,14 @@ declare const api_getTransferByGuestToken: typeof getTransferByGuestToken;
|
|
|
488
486
|
declare const api_registerPasskey: typeof registerPasskey;
|
|
489
487
|
declare const api_reportActionCompletion: typeof reportActionCompletion;
|
|
490
488
|
declare const api_reportPasskeyActivity: typeof reportPasskeyActivity;
|
|
489
|
+
declare const api_setAccountOwner: typeof setAccountOwner;
|
|
491
490
|
declare const api_setTransferSender: typeof setTransferSender;
|
|
492
491
|
declare const api_signGuestTransfer: typeof signGuestTransfer;
|
|
493
492
|
declare const api_signTransfer: typeof signTransfer;
|
|
494
493
|
declare const api_updateUserConfig: typeof updateUserConfig;
|
|
495
494
|
declare const api_updateUserConfigBySession: typeof updateUserConfigBySession;
|
|
496
495
|
declare namespace api {
|
|
497
|
-
export { type api_CreateAccountParams as CreateAccountParams, type api_CreateGuestTransferParams as CreateGuestTransferParams, type api_CreateTransferParams as CreateTransferParams, type api_GuestBalanceOption as GuestBalanceOption, type api_GuestTransferResult as GuestTransferResult,
|
|
496
|
+
export { type api_CreateAccountParams as CreateAccountParams, type api_CreateGuestTransferParams as CreateGuestTransferParams, type api_CreateTransferParams as CreateTransferParams, type api_GuestBalanceOption as GuestBalanceOption, type api_GuestTransferResult as GuestTransferResult, api_createAccount as createAccount, api_createAccountAuthorizationSession as createAccountAuthorizationSession, api_createGuestTransfer as createGuestTransfer, api_createTransfer as createTransfer, api_fetchAccount as fetchAccount, api_fetchAccounts as fetchAccounts, api_fetchAuthorizationSession as fetchAuthorizationSession, api_fetchChains as fetchChains, api_fetchGuestPreauthAccount as fetchGuestPreauthAccount, api_fetchGuestTransferBalances as fetchGuestTransferBalances, api_fetchMerchantPublicKey as fetchMerchantPublicKey, api_fetchProviders as fetchProviders, api_fetchTransfer as fetchTransfer, api_fetchUserConfig as fetchUserConfig, api_getGuestTransfer as getGuestTransfer, api_getTransferByGuestToken as getTransferByGuestToken, api_registerPasskey as registerPasskey, api_reportActionCompletion as reportActionCompletion, api_reportPasskeyActivity as reportPasskeyActivity, api_setAccountOwner as setAccountOwner, api_setTransferSender as setTransferSender, api_signGuestTransfer as signGuestTransfer, api_signTransfer as signTransfer, api_updateUserConfig as updateUserConfig, api_updateUserConfigBySession as updateUserConfigBySession };
|
|
498
497
|
}
|
|
499
498
|
|
|
500
499
|
interface BlinkPaymentProps {
|
package/dist/index.js
CHANGED
|
@@ -456,7 +456,6 @@ async function waitForTransactionReceipt(config, parameters) {
|
|
|
456
456
|
// src/api.ts
|
|
457
457
|
var api_exports = {};
|
|
458
458
|
__export(api_exports, {
|
|
459
|
-
claimAccount: () => claimAccount,
|
|
460
459
|
createAccount: () => createAccount,
|
|
461
460
|
createAccountAuthorizationSession: () => createAccountAuthorizationSession,
|
|
462
461
|
createGuestTransfer: () => createGuestTransfer,
|
|
@@ -476,6 +475,7 @@ __export(api_exports, {
|
|
|
476
475
|
registerPasskey: () => registerPasskey,
|
|
477
476
|
reportActionCompletion: () => reportActionCompletion,
|
|
478
477
|
reportPasskeyActivity: () => reportPasskeyActivity,
|
|
478
|
+
setAccountOwner: () => setAccountOwner,
|
|
479
479
|
setTransferSender: () => setTransferSender,
|
|
480
480
|
signGuestTransfer: () => signGuestTransfer,
|
|
481
481
|
signTransfer: () => signTransfer,
|
|
@@ -773,12 +773,13 @@ async function fetchGuestPreauthAccount(apiBaseUrl, guestToken) {
|
|
|
773
773
|
if (!res.ok) await throwApiError(res);
|
|
774
774
|
return await res.json();
|
|
775
775
|
}
|
|
776
|
-
async function
|
|
777
|
-
const res = await fetch(`${apiBaseUrl}/v1/accounts/${accountId}/
|
|
778
|
-
method: "
|
|
776
|
+
async function setAccountOwner(apiBaseUrl, accessToken, accountId, guestSessionToken, body) {
|
|
777
|
+
const res = await fetch(`${apiBaseUrl}/v1/accounts/${accountId}/owner`, {
|
|
778
|
+
method: "PUT",
|
|
779
779
|
headers: {
|
|
780
780
|
"Content-Type": "application/json",
|
|
781
|
-
"Authorization": `Bearer ${accessToken}
|
|
781
|
+
"Authorization": `Bearer ${accessToken}`,
|
|
782
|
+
"x-guest-session-token": guestSessionToken
|
|
782
783
|
},
|
|
783
784
|
body: JSON.stringify(body)
|
|
784
785
|
});
|
|
@@ -2214,7 +2215,7 @@ function paymentReducer(state, action) {
|
|
|
2214
2215
|
guestPreauthAccountId: action.accountId,
|
|
2215
2216
|
step: "login"
|
|
2216
2217
|
};
|
|
2217
|
-
case "
|
|
2218
|
+
case "ACCOUNT_OWNER_SET":
|
|
2218
2219
|
return {
|
|
2219
2220
|
...state,
|
|
2220
2221
|
guestPreauthAccountId: null,
|
|
@@ -8324,22 +8325,21 @@ function usePaymentEffects(deps) {
|
|
|
8324
8325
|
cancelled = true;
|
|
8325
8326
|
};
|
|
8326
8327
|
}, [state.step, state.guestSessionToken, state.guestPreauthAccountId, apiBaseUrl, dispatch]);
|
|
8327
|
-
const
|
|
8328
|
+
const settingOwnerRef = useRef(false);
|
|
8328
8329
|
useEffect(() => {
|
|
8329
8330
|
if (!state.guestPreauthAccountId) return;
|
|
8330
8331
|
if (!state.activeCredentialId) return;
|
|
8331
8332
|
if (!state.activePublicKey) return;
|
|
8332
8333
|
if (!authenticated) return;
|
|
8333
8334
|
if (!state.guestSessionToken) return;
|
|
8334
|
-
if (
|
|
8335
|
-
|
|
8335
|
+
if (settingOwnerRef.current) return;
|
|
8336
|
+
settingOwnerRef.current = true;
|
|
8336
8337
|
let cancelled = false;
|
|
8337
|
-
const
|
|
8338
|
+
const setOwner = async () => {
|
|
8338
8339
|
try {
|
|
8339
8340
|
const token = await getAccessTokenRef.current();
|
|
8340
8341
|
if (!token || cancelled) return;
|
|
8341
|
-
await
|
|
8342
|
-
guestToken: state.guestSessionToken,
|
|
8342
|
+
await setAccountOwner(apiBaseUrl, token, state.guestPreauthAccountId, state.guestSessionToken, {
|
|
8343
8343
|
credentialId: state.activeCredentialId,
|
|
8344
8344
|
publicKey: state.activePublicKey
|
|
8345
8345
|
});
|
|
@@ -8349,19 +8349,19 @@ function usePaymentEffects(deps) {
|
|
|
8349
8349
|
} catch {
|
|
8350
8350
|
}
|
|
8351
8351
|
if (cancelled) return;
|
|
8352
|
-
dispatch({ type: "
|
|
8352
|
+
dispatch({ type: "ACCOUNT_OWNER_SET" });
|
|
8353
8353
|
} catch (err) {
|
|
8354
8354
|
if (cancelled) return;
|
|
8355
8355
|
captureException(err);
|
|
8356
8356
|
dispatch({
|
|
8357
8357
|
type: "SET_ERROR",
|
|
8358
|
-
error: err instanceof Error ? err.message : "Failed to
|
|
8358
|
+
error: err instanceof Error ? err.message : "Failed to set account owner"
|
|
8359
8359
|
});
|
|
8360
8360
|
} finally {
|
|
8361
|
-
|
|
8361
|
+
settingOwnerRef.current = false;
|
|
8362
8362
|
}
|
|
8363
8363
|
};
|
|
8364
|
-
|
|
8364
|
+
setOwner();
|
|
8365
8365
|
return () => {
|
|
8366
8366
|
cancelled = true;
|
|
8367
8367
|
};
|