@swype-org/react-sdk 0.2.223 → 0.2.226

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.d.cts CHANGED
@@ -500,6 +500,13 @@ interface CreateAccountParams {
500
500
  nickname?: string;
501
501
  paymentIntent?: {
502
502
  merchantAuthorization: MerchantAuthorization;
503
+ /**
504
+ * Optional user-entered amount (USD) from the SDK's amount-entry screen.
505
+ * Forwarded to the backend so the resulting session's `paymentIntent`
506
+ * reflects the user's amount before `auth-app` opens. Only applied
507
+ * server-side when the merchant payload's `amount` is `null`.
508
+ */
509
+ amount?: number;
503
510
  };
504
511
  }
505
512
  declare function createAccount(apiBaseUrl: string, token: string, params: CreateAccountParams): Promise<Account>;
@@ -508,6 +515,13 @@ interface CreateAccountAuthorizationSessionOptions {
508
515
  chainId?: number;
509
516
  paymentIntent?: {
510
517
  merchantAuthorization: MerchantAuthorization;
518
+ /**
519
+ * Optional user-entered amount (USD) from the SDK's amount-entry screen.
520
+ * Forwarded to the backend so the resulting session's `paymentIntent`
521
+ * reflects the user's amount before `auth-app` opens. Only applied
522
+ * server-side when the merchant payload's `amount` is `null`.
523
+ */
524
+ amount?: number;
511
525
  };
512
526
  }
513
527
  declare function createAccountAuthorizationSession(apiBaseUrl: string, token: string, accountId: string, credentialId: string, options?: CreateAccountAuthorizationSessionOptions): Promise<AuthorizationSession>;
@@ -605,6 +619,20 @@ declare function updateUserConfig(apiBaseUrl: string, token: string, config: {
605
619
  * PATCH /v1/authorization-sessions/{id}
606
620
  */
607
621
  declare function setAuthorizationSessionProvider(apiBaseUrl: string, sessionId: string, providerId: string): Promise<AuthorizationSessionDetail>;
622
+ /**
623
+ * Overlays a user-entered amount onto an existing authorization session's
624
+ * `paymentIntent.transferRequest.amount`. Used by the host SDK after a
625
+ * session has been created when the user changes the deposit amount (e.g.
626
+ * backs out of the wallet picker and edits the amount).
627
+ *
628
+ * No bearer token — the session id is the credential. Only honored when
629
+ * the merchant deferred the amount on the original signed payload; the
630
+ * server returns the (unchanged) session as a 200 no-op when the merchant
631
+ * fixed the amount.
632
+ *
633
+ * PATCH /v1/authorization-sessions/{id}/payment-intent
634
+ */
635
+ declare function setAuthorizationSessionPaymentIntentAmount(apiBaseUrl: string, sessionId: string, amount: number): Promise<AuthorizationSessionDetail>;
608
636
  /**
609
637
  * Updates default allowance for the authorization session.
610
638
  * PATCH /v1/authorization-sessions/{id}/user-config
@@ -709,6 +737,7 @@ declare const api_probeActionCompletion: typeof probeActionCompletion;
709
737
  declare const api_registerPasskey: typeof registerPasskey;
710
738
  declare const api_reportActionCompletion: typeof reportActionCompletion;
711
739
  declare const api_reportPasskeyActivity: typeof reportPasskeyActivity;
740
+ declare const api_setAuthorizationSessionPaymentIntentAmount: typeof setAuthorizationSessionPaymentIntentAmount;
712
741
  declare const api_setAuthorizationSessionProvider: typeof setAuthorizationSessionProvider;
713
742
  declare const api_setTransferSource: typeof setTransferSource;
714
743
  declare const api_signTransfer: typeof signTransfer;
@@ -716,7 +745,7 @@ declare const api_updateUserConfig: typeof updateUserConfig;
716
745
  declare const api_updateUserConfigBySession: typeof updateUserConfigBySession;
717
746
  declare const api_waitForActionTransactionReceipt: typeof waitForActionTransactionReceipt;
718
747
  declare namespace api {
719
- export { type api_ActionTransactionReceiptWaitResult as ActionTransactionReceiptWaitResult, type api_BridgeCall as BridgeCall, type api_CreateAccountAuthorizationSessionOptions as CreateAccountAuthorizationSessionOptions, type api_CreateAccountParams as CreateAccountParams, type api_CreateManualTransferParams as CreateManualTransferParams, type api_CreateTransferParams as CreateTransferParams, type api_FetchManualTransferSourcesParams as FetchManualTransferSourcesParams, type api_ProbeActionCompletionResult as ProbeActionCompletionResult, type api_TransferQuote as TransferQuote, api_createAccount as createAccount, api_createAccountAuthorizationSession as createAccountAuthorizationSession, api_createManualTransfer as createManualTransfer, api_createTransfer as createTransfer, api_fetchAccount as fetchAccount, api_fetchAccounts as fetchAccounts, api_fetchAuthorizationSession as fetchAuthorizationSession, api_fetchAuthorizationSessionByToken as fetchAuthorizationSessionByToken, api_fetchChains as fetchChains, api_fetchManualTransferSession as fetchManualTransferSession, api_fetchManualTransferSources as fetchManualTransferSources, api_fetchMerchantPublicKey as fetchMerchantPublicKey, api_fetchProviders as fetchProviders, api_fetchTransfer as fetchTransfer, api_fetchUserConfig as fetchUserConfig, api_postTransferQuote as postTransferQuote, api_probeActionCompletion as probeActionCompletion, api_registerPasskey as registerPasskey, api_reportActionCompletion as reportActionCompletion, api_reportPasskeyActivity as reportPasskeyActivity, api_setAuthorizationSessionProvider as setAuthorizationSessionProvider, api_setTransferSource as setTransferSource, api_signTransfer as signTransfer, api_updateUserConfig as updateUserConfig, api_updateUserConfigBySession as updateUserConfigBySession, api_waitForActionTransactionReceipt as waitForActionTransactionReceipt };
748
+ export { type api_ActionTransactionReceiptWaitResult as ActionTransactionReceiptWaitResult, type api_BridgeCall as BridgeCall, type api_CreateAccountAuthorizationSessionOptions as CreateAccountAuthorizationSessionOptions, type api_CreateAccountParams as CreateAccountParams, type api_CreateManualTransferParams as CreateManualTransferParams, type api_CreateTransferParams as CreateTransferParams, type api_FetchManualTransferSourcesParams as FetchManualTransferSourcesParams, type api_ProbeActionCompletionResult as ProbeActionCompletionResult, type api_TransferQuote as TransferQuote, api_createAccount as createAccount, api_createAccountAuthorizationSession as createAccountAuthorizationSession, api_createManualTransfer as createManualTransfer, api_createTransfer as createTransfer, api_fetchAccount as fetchAccount, api_fetchAccounts as fetchAccounts, api_fetchAuthorizationSession as fetchAuthorizationSession, api_fetchAuthorizationSessionByToken as fetchAuthorizationSessionByToken, api_fetchChains as fetchChains, api_fetchManualTransferSession as fetchManualTransferSession, api_fetchManualTransferSources as fetchManualTransferSources, api_fetchMerchantPublicKey as fetchMerchantPublicKey, api_fetchProviders as fetchProviders, api_fetchTransfer as fetchTransfer, api_fetchUserConfig as fetchUserConfig, api_postTransferQuote as postTransferQuote, api_probeActionCompletion as probeActionCompletion, api_registerPasskey as registerPasskey, api_reportActionCompletion as reportActionCompletion, api_reportPasskeyActivity as reportPasskeyActivity, api_setAuthorizationSessionPaymentIntentAmount as setAuthorizationSessionPaymentIntentAmount, api_setAuthorizationSessionProvider as setAuthorizationSessionProvider, api_setTransferSource as setTransferSource, api_signTransfer as signTransfer, api_updateUserConfig as updateUserConfig, api_updateUserConfigBySession as updateUserConfigBySession, api_waitForActionTransactionReceipt as waitForActionTransactionReceipt };
720
749
  }
721
750
 
722
751
  interface BlinkPaymentProps {
@@ -748,7 +777,7 @@ interface SelectSourceChainChoice {
748
777
  }[];
749
778
  }
750
779
 
751
- type ScreenName = 'loading' | 'manual-transfer' | 'login' | 'success' | 'processing' | 'confirm-sign' | 'select-source' | 'setup' | 'open-wallet' | 'setup-deposit' | 'passkey-ready' | 'wallet-picker' | 'token-picker' | 'guest-source-picker' | 'amount-too-low' | 'deposit' | 'deposit-options';
780
+ type ScreenName = 'loading' | 'manual-transfer' | 'login' | 'success' | 'processing' | 'confirm-sign' | 'select-source' | 'setup' | 'open-wallet' | 'setup-deposit' | 'passkey-ready' | 'wallet-picker' | 'token-picker' | 'guest-source-picker' | 'amount-too-low' | 'enter-amount' | 'deposit' | 'deposit-options';
752
781
  interface MobileFlowState {
753
782
  deeplinkUri: string;
754
783
  providerId: string | null;
@@ -813,6 +842,8 @@ type PaymentPhase = {
813
842
  } | {
814
843
  step: 'amount-too-low';
815
844
  minAmountUsd: number;
845
+ } | {
846
+ step: 'enter-amount';
816
847
  };
817
848
  declare function screenForPhase(phase: PaymentPhase): ScreenName;
818
849
 
@@ -1386,6 +1417,13 @@ interface PaymentState {
1386
1417
  * options screen.
1387
1418
  */
1388
1419
  enableFullWidget: boolean;
1420
+ /**
1421
+ * When true, gate every other fresh phase on the user entering an amount
1422
+ * inside the hosted flow. Initialized from `depositAmount == null` and
1423
+ * cleared by `FINALIZE_AMOUNT` (user tapped Continue) or by `SYNC_AMOUNT`
1424
+ * when the host later supplies a non-empty amount.
1425
+ */
1426
+ requireAmountEntry: boolean;
1389
1427
  }
1390
1428
  interface InitialStateConfig {
1391
1429
  depositAmount: number | null;
@@ -1436,6 +1474,18 @@ interface StepHandlers {
1436
1474
  onLogin: () => void;
1437
1475
  onCancelLogin: () => void;
1438
1476
  onSetDepositAmount: (amount: number) => void;
1477
+ /**
1478
+ * Update the in-flow amount-entry value (string display). Called by
1479
+ * EnterAmountScreen on every keypress / preset tap. The view-model wires
1480
+ * pure helpers (`enterAmountInput.ts`) into this handler so the component
1481
+ * itself stays presentational.
1482
+ */
1483
+ onAmountInput: (value: string) => void;
1484
+ /**
1485
+ * Commit the in-flow amount-entry value and clear `requireAmountEntry`.
1486
+ * Routes the user past the EnterAmountScreen back into the normal flow.
1487
+ */
1488
+ onFinalizeAmount: () => void;
1439
1489
  onSetDepositToken: (symbol: string, chainName: string, walletId?: string, tokenAddress?: string, chainId?: number) => void;
1440
1490
  onConfirmSetupDeposit: () => void | Promise<void>;
1441
1491
  }
@@ -1456,7 +1506,17 @@ interface StepRendererFlowProps {
1456
1506
  merchantName?: string;
1457
1507
  onBack?: () => void;
1458
1508
  onDismiss?: () => void;
1509
+ /** Merchant-fixed depositAmount, or `null` for the hosted EnterAmountScreen flow. */
1459
1510
  depositAmount: number | null;
1511
+ /**
1512
+ * Effective deposit amount = `parseAmount(state.amount) ?? depositAmount`.
1513
+ * View models should read this for display so the user's typed value from
1514
+ * `EnterAmountScreen` propagates through `deposit`, `setup-deposit`,
1515
+ * `processing`, and `token-picker` screens. `depositAmount` is retained
1516
+ * separately for "did the merchant fix this?" semantics (e.g.
1517
+ * `AmountTooLowScreen.canRetry`).
1518
+ */
1519
+ effectiveDepositAmount: number | null;
1460
1520
  minTransferAmountUsd: number;
1461
1521
  /** Needed to render ManualTransferFlow when phase is manual-transfer. */
1462
1522
  destination: Destination;
package/dist/index.d.ts CHANGED
@@ -500,6 +500,13 @@ interface CreateAccountParams {
500
500
  nickname?: string;
501
501
  paymentIntent?: {
502
502
  merchantAuthorization: MerchantAuthorization;
503
+ /**
504
+ * Optional user-entered amount (USD) from the SDK's amount-entry screen.
505
+ * Forwarded to the backend so the resulting session's `paymentIntent`
506
+ * reflects the user's amount before `auth-app` opens. Only applied
507
+ * server-side when the merchant payload's `amount` is `null`.
508
+ */
509
+ amount?: number;
503
510
  };
504
511
  }
505
512
  declare function createAccount(apiBaseUrl: string, token: string, params: CreateAccountParams): Promise<Account>;
@@ -508,6 +515,13 @@ interface CreateAccountAuthorizationSessionOptions {
508
515
  chainId?: number;
509
516
  paymentIntent?: {
510
517
  merchantAuthorization: MerchantAuthorization;
518
+ /**
519
+ * Optional user-entered amount (USD) from the SDK's amount-entry screen.
520
+ * Forwarded to the backend so the resulting session's `paymentIntent`
521
+ * reflects the user's amount before `auth-app` opens. Only applied
522
+ * server-side when the merchant payload's `amount` is `null`.
523
+ */
524
+ amount?: number;
511
525
  };
512
526
  }
513
527
  declare function createAccountAuthorizationSession(apiBaseUrl: string, token: string, accountId: string, credentialId: string, options?: CreateAccountAuthorizationSessionOptions): Promise<AuthorizationSession>;
@@ -605,6 +619,20 @@ declare function updateUserConfig(apiBaseUrl: string, token: string, config: {
605
619
  * PATCH /v1/authorization-sessions/{id}
606
620
  */
607
621
  declare function setAuthorizationSessionProvider(apiBaseUrl: string, sessionId: string, providerId: string): Promise<AuthorizationSessionDetail>;
622
+ /**
623
+ * Overlays a user-entered amount onto an existing authorization session's
624
+ * `paymentIntent.transferRequest.amount`. Used by the host SDK after a
625
+ * session has been created when the user changes the deposit amount (e.g.
626
+ * backs out of the wallet picker and edits the amount).
627
+ *
628
+ * No bearer token — the session id is the credential. Only honored when
629
+ * the merchant deferred the amount on the original signed payload; the
630
+ * server returns the (unchanged) session as a 200 no-op when the merchant
631
+ * fixed the amount.
632
+ *
633
+ * PATCH /v1/authorization-sessions/{id}/payment-intent
634
+ */
635
+ declare function setAuthorizationSessionPaymentIntentAmount(apiBaseUrl: string, sessionId: string, amount: number): Promise<AuthorizationSessionDetail>;
608
636
  /**
609
637
  * Updates default allowance for the authorization session.
610
638
  * PATCH /v1/authorization-sessions/{id}/user-config
@@ -709,6 +737,7 @@ declare const api_probeActionCompletion: typeof probeActionCompletion;
709
737
  declare const api_registerPasskey: typeof registerPasskey;
710
738
  declare const api_reportActionCompletion: typeof reportActionCompletion;
711
739
  declare const api_reportPasskeyActivity: typeof reportPasskeyActivity;
740
+ declare const api_setAuthorizationSessionPaymentIntentAmount: typeof setAuthorizationSessionPaymentIntentAmount;
712
741
  declare const api_setAuthorizationSessionProvider: typeof setAuthorizationSessionProvider;
713
742
  declare const api_setTransferSource: typeof setTransferSource;
714
743
  declare const api_signTransfer: typeof signTransfer;
@@ -716,7 +745,7 @@ declare const api_updateUserConfig: typeof updateUserConfig;
716
745
  declare const api_updateUserConfigBySession: typeof updateUserConfigBySession;
717
746
  declare const api_waitForActionTransactionReceipt: typeof waitForActionTransactionReceipt;
718
747
  declare namespace api {
719
- export { type api_ActionTransactionReceiptWaitResult as ActionTransactionReceiptWaitResult, type api_BridgeCall as BridgeCall, type api_CreateAccountAuthorizationSessionOptions as CreateAccountAuthorizationSessionOptions, type api_CreateAccountParams as CreateAccountParams, type api_CreateManualTransferParams as CreateManualTransferParams, type api_CreateTransferParams as CreateTransferParams, type api_FetchManualTransferSourcesParams as FetchManualTransferSourcesParams, type api_ProbeActionCompletionResult as ProbeActionCompletionResult, type api_TransferQuote as TransferQuote, api_createAccount as createAccount, api_createAccountAuthorizationSession as createAccountAuthorizationSession, api_createManualTransfer as createManualTransfer, api_createTransfer as createTransfer, api_fetchAccount as fetchAccount, api_fetchAccounts as fetchAccounts, api_fetchAuthorizationSession as fetchAuthorizationSession, api_fetchAuthorizationSessionByToken as fetchAuthorizationSessionByToken, api_fetchChains as fetchChains, api_fetchManualTransferSession as fetchManualTransferSession, api_fetchManualTransferSources as fetchManualTransferSources, api_fetchMerchantPublicKey as fetchMerchantPublicKey, api_fetchProviders as fetchProviders, api_fetchTransfer as fetchTransfer, api_fetchUserConfig as fetchUserConfig, api_postTransferQuote as postTransferQuote, api_probeActionCompletion as probeActionCompletion, api_registerPasskey as registerPasskey, api_reportActionCompletion as reportActionCompletion, api_reportPasskeyActivity as reportPasskeyActivity, api_setAuthorizationSessionProvider as setAuthorizationSessionProvider, api_setTransferSource as setTransferSource, api_signTransfer as signTransfer, api_updateUserConfig as updateUserConfig, api_updateUserConfigBySession as updateUserConfigBySession, api_waitForActionTransactionReceipt as waitForActionTransactionReceipt };
748
+ export { type api_ActionTransactionReceiptWaitResult as ActionTransactionReceiptWaitResult, type api_BridgeCall as BridgeCall, type api_CreateAccountAuthorizationSessionOptions as CreateAccountAuthorizationSessionOptions, type api_CreateAccountParams as CreateAccountParams, type api_CreateManualTransferParams as CreateManualTransferParams, type api_CreateTransferParams as CreateTransferParams, type api_FetchManualTransferSourcesParams as FetchManualTransferSourcesParams, type api_ProbeActionCompletionResult as ProbeActionCompletionResult, type api_TransferQuote as TransferQuote, api_createAccount as createAccount, api_createAccountAuthorizationSession as createAccountAuthorizationSession, api_createManualTransfer as createManualTransfer, api_createTransfer as createTransfer, api_fetchAccount as fetchAccount, api_fetchAccounts as fetchAccounts, api_fetchAuthorizationSession as fetchAuthorizationSession, api_fetchAuthorizationSessionByToken as fetchAuthorizationSessionByToken, api_fetchChains as fetchChains, api_fetchManualTransferSession as fetchManualTransferSession, api_fetchManualTransferSources as fetchManualTransferSources, api_fetchMerchantPublicKey as fetchMerchantPublicKey, api_fetchProviders as fetchProviders, api_fetchTransfer as fetchTransfer, api_fetchUserConfig as fetchUserConfig, api_postTransferQuote as postTransferQuote, api_probeActionCompletion as probeActionCompletion, api_registerPasskey as registerPasskey, api_reportActionCompletion as reportActionCompletion, api_reportPasskeyActivity as reportPasskeyActivity, api_setAuthorizationSessionPaymentIntentAmount as setAuthorizationSessionPaymentIntentAmount, api_setAuthorizationSessionProvider as setAuthorizationSessionProvider, api_setTransferSource as setTransferSource, api_signTransfer as signTransfer, api_updateUserConfig as updateUserConfig, api_updateUserConfigBySession as updateUserConfigBySession, api_waitForActionTransactionReceipt as waitForActionTransactionReceipt };
720
749
  }
721
750
 
722
751
  interface BlinkPaymentProps {
@@ -748,7 +777,7 @@ interface SelectSourceChainChoice {
748
777
  }[];
749
778
  }
750
779
 
751
- type ScreenName = 'loading' | 'manual-transfer' | 'login' | 'success' | 'processing' | 'confirm-sign' | 'select-source' | 'setup' | 'open-wallet' | 'setup-deposit' | 'passkey-ready' | 'wallet-picker' | 'token-picker' | 'guest-source-picker' | 'amount-too-low' | 'deposit' | 'deposit-options';
780
+ type ScreenName = 'loading' | 'manual-transfer' | 'login' | 'success' | 'processing' | 'confirm-sign' | 'select-source' | 'setup' | 'open-wallet' | 'setup-deposit' | 'passkey-ready' | 'wallet-picker' | 'token-picker' | 'guest-source-picker' | 'amount-too-low' | 'enter-amount' | 'deposit' | 'deposit-options';
752
781
  interface MobileFlowState {
753
782
  deeplinkUri: string;
754
783
  providerId: string | null;
@@ -813,6 +842,8 @@ type PaymentPhase = {
813
842
  } | {
814
843
  step: 'amount-too-low';
815
844
  minAmountUsd: number;
845
+ } | {
846
+ step: 'enter-amount';
816
847
  };
817
848
  declare function screenForPhase(phase: PaymentPhase): ScreenName;
818
849
 
@@ -1386,6 +1417,13 @@ interface PaymentState {
1386
1417
  * options screen.
1387
1418
  */
1388
1419
  enableFullWidget: boolean;
1420
+ /**
1421
+ * When true, gate every other fresh phase on the user entering an amount
1422
+ * inside the hosted flow. Initialized from `depositAmount == null` and
1423
+ * cleared by `FINALIZE_AMOUNT` (user tapped Continue) or by `SYNC_AMOUNT`
1424
+ * when the host later supplies a non-empty amount.
1425
+ */
1426
+ requireAmountEntry: boolean;
1389
1427
  }
1390
1428
  interface InitialStateConfig {
1391
1429
  depositAmount: number | null;
@@ -1436,6 +1474,18 @@ interface StepHandlers {
1436
1474
  onLogin: () => void;
1437
1475
  onCancelLogin: () => void;
1438
1476
  onSetDepositAmount: (amount: number) => void;
1477
+ /**
1478
+ * Update the in-flow amount-entry value (string display). Called by
1479
+ * EnterAmountScreen on every keypress / preset tap. The view-model wires
1480
+ * pure helpers (`enterAmountInput.ts`) into this handler so the component
1481
+ * itself stays presentational.
1482
+ */
1483
+ onAmountInput: (value: string) => void;
1484
+ /**
1485
+ * Commit the in-flow amount-entry value and clear `requireAmountEntry`.
1486
+ * Routes the user past the EnterAmountScreen back into the normal flow.
1487
+ */
1488
+ onFinalizeAmount: () => void;
1439
1489
  onSetDepositToken: (symbol: string, chainName: string, walletId?: string, tokenAddress?: string, chainId?: number) => void;
1440
1490
  onConfirmSetupDeposit: () => void | Promise<void>;
1441
1491
  }
@@ -1456,7 +1506,17 @@ interface StepRendererFlowProps {
1456
1506
  merchantName?: string;
1457
1507
  onBack?: () => void;
1458
1508
  onDismiss?: () => void;
1509
+ /** Merchant-fixed depositAmount, or `null` for the hosted EnterAmountScreen flow. */
1459
1510
  depositAmount: number | null;
1511
+ /**
1512
+ * Effective deposit amount = `parseAmount(state.amount) ?? depositAmount`.
1513
+ * View models should read this for display so the user's typed value from
1514
+ * `EnterAmountScreen` propagates through `deposit`, `setup-deposit`,
1515
+ * `processing`, and `token-picker` screens. `depositAmount` is retained
1516
+ * separately for "did the merchant fix this?" semantics (e.g.
1517
+ * `AmountTooLowScreen.canRetry`).
1518
+ */
1519
+ effectiveDepositAmount: number | null;
1460
1520
  minTransferAmountUsd: number;
1461
1521
  /** Needed to render ManualTransferFlow when phase is manual-transfer. */
1462
1522
  destination: Destination;