@stridge/kit 0.1.0-alpha.3 → 0.1.0-alpha.30
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/README.md +22 -6
- package/dist/KitProvider.d.ts +29 -0
- package/dist/KitProvider.js +1 -1
- package/dist/_internal/withdraw/driver/index.d.ts +2 -2
- package/dist/deposit/compound/index.d.ts +2 -2
- package/dist/drivers/stridge/createStridgeDepositDriver.js +1 -1
- package/dist/drivers/stridge/createStridgeWithdrawDriver.d.ts +10 -12
- package/dist/drivers/stridge/createStridgeWithdrawDriver.js +1 -1
- package/dist/drivers/stridge/internal/metadata.js +1 -1
- package/dist/drivers/stridge/types.d.ts +7 -4
- package/dist/drivers/stridge-mock/createStridgeMockWithdrawDriver.d.ts +3 -3
- package/dist/drivers/stridge-mock/createStridgeMockWithdrawDriver.js +1 -1
- package/dist/drivers/stridge-mock/fixtures.d.ts +7 -5
- package/dist/drivers/stridge-mock/fixtures.js +1 -1
- package/dist/flows/deposit/dialog/DepositDialog.js +1 -1
- package/dist/flows/deposit/orchestrator/controller.js +1 -1
- package/dist/flows/deposit/orchestrator/types.d.ts +30 -1
- package/dist/flows/deposit/orchestrator/useDeposit.d.ts +18 -1
- package/dist/flows/deposit/orchestrator/useDeposit.js +1 -1
- package/dist/flows/deposit/widgets/deposit/Deposit.js +1 -1
- package/dist/flows/deposit/widgets/deposit/compound/components/Method.d.ts +6 -0
- package/dist/flows/deposit/widgets/deposit/compound/components/Method.js +1 -1
- package/dist/flows/deposit/widgets/deposit/compound/types.d.ts +6 -3
- package/dist/flows/deposit/widgets/deposit-status-banner/DepositStatusBanner.d.ts +7 -0
- package/dist/flows/deposit/widgets/deposit-status-banner/DepositStatusBanner.js +1 -1
- package/dist/flows/deposit/widgets/deposit-status-banner/compound/DepositStatusBanner.js +1 -1
- package/dist/flows/deposit/widgets/deposit-status-banner/compound/components/Hero.js +1 -1
- package/dist/flows/deposit/widgets/deposit-status-banner/compound/components/PrimaryAction.js +1 -1
- package/dist/flows/deposit/widgets/processing-state/ProcessingState.js +1 -1
- package/dist/flows/deposit/widgets/transfer-crypto/compound/components/Address.js +1 -1
- package/dist/flows/deposit/widgets/transfer-crypto/compound/components/Disclosure.d.ts +2 -1
- package/dist/flows/deposit/widgets/transfer-crypto/compound/components/Disclosure.js +1 -1
- package/dist/flows/deposit/widgets/transfer-crypto/compound/components/QrCode.d.ts +4 -10
- package/dist/flows/deposit/widgets/transfer-crypto/compound/components/QrCode.js +1 -1
- package/dist/flows/shared/transformers/pickRelevantSettlement.js +1 -1
- package/dist/flows/withdraw/bindings/WithdrawBindings.d.ts +92 -0
- package/dist/flows/withdraw/bindings/WithdrawBindings.js +1 -0
- package/dist/flows/withdraw/bindings/index.d.ts +1 -0
- package/dist/flows/withdraw/bindings/index.js +1 -0
- package/dist/flows/withdraw/dialog/WithdrawDialog.d.ts +58 -12
- package/dist/flows/withdraw/dialog/WithdrawDialog.js +1 -1
- package/dist/flows/withdraw/driver/payloads.d.ts +16 -1
- package/dist/flows/withdraw/driver/transformers/settlementToWithdrawalPayload.js +1 -1
- package/dist/flows/withdraw/driver/transformers/supportedAssetsToReceiveOptionsPayload.js +1 -1
- package/dist/flows/withdraw/driver/types.d.ts +53 -11
- package/dist/flows/withdraw/orchestrator/controller.js +1 -1
- package/dist/flows/withdraw/orchestrator/index.d.ts +1 -1
- package/dist/flows/withdraw/orchestrator/reducer.js +1 -1
- package/dist/flows/withdraw/orchestrator/types.d.ts +106 -32
- package/dist/flows/withdraw/orchestrator/useWithdraw.d.ts +18 -1
- package/dist/flows/withdraw/orchestrator/useWithdraw.js +1 -1
- package/dist/flows/withdraw/widgets/withdraw-form/WithdrawForm.js +1 -1
- package/dist/flows/withdraw/widgets/withdraw-form/compound/WithdrawForm.js +1 -1
- package/dist/flows/withdraw/widgets/withdraw-form/compound/components/RecipientField.d.ts +7 -5
- package/dist/flows/withdraw/widgets/withdraw-form/compound/components/RecipientField.js +1 -1
- package/dist/flows/withdraw/widgets/withdraw-form/compound/types.d.ts +15 -5
- package/dist/flows/withdraw/widgets/withdraw-form/validation.js +1 -1
- package/dist/flows/withdraw/widgets/withdraw-in-progress/WithdrawInProgress.d.ts +2 -1
- package/dist/flows/withdraw/widgets/withdraw-in-progress/WithdrawInProgress.js +1 -1
- package/dist/i18n/index.d.ts +5 -4
- package/dist/i18n/index.js +1 -1
- package/dist/i18n/locales/ar.js +1 -1
- package/dist/i18n/locales/es.js +1 -1
- package/dist/i18n/locales/source-keys.d.ts +12 -0
- package/dist/i18n/locales/source-keys.js +0 -0
- package/dist/icons/index.d.ts +2 -1
- package/dist/icons/index.js +1 -1
- package/dist/index.d.ts +12 -8
- package/dist/index.js +1 -1
- package/dist/package.js +1 -0
- package/dist/scope/KitPortalScope.js +1 -1
- package/dist/scope/KitScope.d.ts +18 -1
- package/dist/scope/KitScope.js +1 -1
- package/dist/scope/context.d.ts +17 -1
- package/dist/scope/index.d.ts +1 -1
- package/dist/shared/attribution/Attribution.js +1 -0
- package/dist/shared/attribution/Attribution.slots.js +1 -0
- package/dist/shared/attribution/Attribution.styles.js +1 -0
- package/dist/shared/attribution/index.js +1 -0
- package/dist/shared/chains/index.d.ts +48 -29
- package/dist/shared/chains/index.js +1 -1
- package/dist/shared/constants/brand-intercom.js +1 -0
- package/dist/shared/cuer/Cuer.js +1 -0
- package/dist/shared/cuer/QrCode.js +1 -0
- package/dist/shared/cuer/index.js +1 -0
- package/dist/shared/dialog/Frame.js +1 -1
- package/dist/shared/dialog/StepTransition.js +1 -1
- package/dist/shared/driver/types.d.ts +4 -3
- package/dist/shared/i18n/KitI18nProvider.d.ts +11 -8
- package/dist/shared/i18n/KitI18nProvider.js +1 -1
- package/dist/shared/i18n/createKitI18n.d.ts +79 -16
- package/dist/shared/i18n/createKitI18n.js +1 -1
- package/dist/shared/i18n/useLingui.d.ts +11 -3
- package/dist/shared/icons/LogoIcon.d.ts +13 -0
- package/dist/shared/icons/LogoIcon.js +1 -0
- package/dist/shared/orchestrator/useSettlementWatcher.js +1 -1
- package/dist/shared/primitives/TxHashValue/TxHashValue.js +1 -1
- package/dist/shared/support/SupportButton.d.ts +1 -0
- package/dist/shared/support/SupportButton.js +1 -0
- package/dist/shared/support/SupportConfigContext.d.ts +1 -0
- package/dist/shared/support/SupportConfigContext.js +1 -0
- package/dist/shared/support/SupportLink.d.ts +1 -0
- package/dist/shared/support/SupportLink.js +1 -0
- package/dist/shared/support/SupportSpinner.d.ts +1 -0
- package/dist/shared/support/SupportSpinner.js +1 -0
- package/dist/shared/support/index.d.ts +2 -0
- package/dist/shared/support/index.js +1 -0
- package/dist/shared/support/intercom-loader.d.ts +17 -0
- package/dist/shared/support/intercom-loader.js +1 -0
- package/dist/shared/support/resolveSupport.d.ts +1 -0
- package/dist/shared/support/resolveSupport.js +1 -0
- package/dist/shared/support/types.d.ts +43 -0
- package/dist/shared/support/useIntercomMerchantContext.d.ts +27 -0
- package/dist/shared/support/useIntercomMerchantContext.js +1 -0
- package/dist/shared/support/useIntercomShutdownOnUnmount.js +1 -0
- package/dist/shared/support/useMerchantContext.d.ts +1 -0
- package/dist/shared/support/useMerchantContext.js +1 -0
- package/dist/shared/support/useSupportTrigger.js +1 -0
- package/dist/shared/terms/TermsButton.d.ts +1 -0
- package/dist/shared/terms/TermsButton.js +1 -0
- package/dist/shared/terms/TermsConfigContext.d.ts +1 -0
- package/dist/shared/terms/TermsConfigContext.js +1 -0
- package/dist/shared/terms/TermsLink.d.ts +1 -0
- package/dist/shared/terms/TermsLink.js +1 -0
- package/dist/shared/terms/index.d.ts +1 -0
- package/dist/shared/terms/index.js +1 -0
- package/dist/shared/terms/resolveTerms.d.ts +1 -0
- package/dist/shared/terms/resolveTerms.js +1 -0
- package/dist/shared/terms/types.d.ts +43 -0
- package/dist/shared/ui/Card/Card.styles.js +1 -1
- package/dist/shared/ui/Details/Details.d.ts +9 -1
- package/dist/shared/ui/Details/Details.styles.js +1 -1
- package/dist/shared/ui/Dialog/Dialog.js +1 -1
- package/dist/shared/ui/Dialog/Dialog.styles.js +1 -1
- package/dist/shared/ui/ExternalLink/ExternalLink.js +1 -1
- package/dist/shared/ui/Select/Select.js +1 -1
- package/dist/shared/ui/WalletRow/WalletRow.d.ts +1 -1
- package/dist/shared/ui/WalletRow/WalletRow.js +1 -1
- package/dist/shared/widgets/amount-entry/compound/components/Hero/Hero.js +1 -1
- package/dist/shared/widgets/amount-entry/compound/components/Hero/SwapBackdrop.js +1 -1
- package/dist/shared/widgets/confirm-transfer/compound/components/Disclaimer.d.ts +4 -3
- package/dist/shared/widgets/confirm-transfer/compound/components/Disclaimer.js +1 -1
- package/dist/shared/widgets/error-state/compound/components/AssetValue.js +1 -1
- package/dist/shared/widgets/error-state/compound/components/HelpInfo.js +1 -1
- package/dist/shared/widgets/error-state/compound/components/StatusValue.js +1 -1
- package/dist/shared/widgets/processing-state/compound/ProcessingState.d.ts +1 -5
- package/dist/shared/widgets/processing-state/compound/ProcessingState.js +1 -1
- package/dist/shared/widgets/processing-state/compound/ProcessingState.slots.d.ts +0 -1
- package/dist/shared/widgets/processing-state/compound/ProcessingState.slots.js +1 -1
- package/dist/shared/widgets/processing-state/compound/ProcessingState.styles.js +1 -1
- package/dist/shared/widgets/processing-state/compound/components/Details.d.ts +6 -1
- package/dist/shared/widgets/processing-state/compound/components/Details.js +1 -1
- package/dist/shared/widgets/processing-state/compound/components/Header.d.ts +4 -3
- package/dist/shared/widgets/processing-state/compound/components/Header.js +1 -1
- package/dist/shared/widgets/processing-state/compound/components/Hero.d.ts +11 -7
- package/dist/shared/widgets/processing-state/compound/components/Hero.js +1 -1
- package/dist/shared/widgets/processing-state/compound/components/Rows.js +1 -1
- package/dist/shared/widgets/processing-state/compound/components/StatusPill.js +1 -1
- package/dist/shared/widgets/processing-state/compound/components/splitAmount.js +1 -0
- package/dist/shared/widgets/processing-state/compound/index.d.ts +1 -1
- package/dist/shared/widgets/processing-state/compound/types.d.ts +7 -26
- package/dist/shared/widgets/success-state/compound/components/Actions.js +1 -1
- package/dist/shared/widgets/success-state/compound/components/AssetValue.js +1 -1
- package/dist/shared/widgets/success-state/compound/components/RouteValue.js +1 -1
- package/dist/shared/widgets/success-state/compound/components/StatusPill.js +1 -1
- package/dist/stridge/StridgeProvider.d.ts +147 -15
- package/dist/stridge/StridgeProvider.js +1 -1
- package/dist/stridge/optionalWagmi.js +1 -0
- package/dist/stridge/stubs.js +1 -1
- package/dist/styles/index.css +58 -12
- package/dist/types.d.ts +5 -4
- package/dist/ui/index.js +1 -1
- package/dist/withdraw/compound/index.d.ts +2 -2
- package/dist/withdraw/dialog/index.d.ts +3 -1
- package/package.json +10 -11
- package/dist/kit/package.js +0 -1
- package/dist/shared/widgets/processing-state/compound/components/Actions.d.ts +0 -17
- package/dist/shared/widgets/processing-state/compound/components/Actions.js +0 -1
- /package/dist/{utils/src/use-copy-to-clipboard.js → shared/utils/useCopyToClipboard.js} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{useDepositDriverInstance as e}from"../driver/context.js";import{useLingui as t}from"../../../shared/i18n/useLingui.js";import"../../../i18n/index.js";import{toFailure as n}from"../../../shared/orchestrator/toFailure.js";import{useDriverSettlementListener as r}from"../../../shared/orchestrator/useDriverSettlementListener.js";import{useEffectiveState as i}from"../../../shared/orchestrator/useEffectiveState.js";import{isUserRejectionFailure as a}from"../../../shared/orchestrator/userRejection.js";import{useSettlementWatcher as o}from"../../../shared/orchestrator/useSettlementWatcher.js";import"../../../shared/orchestrator/index.js";import{initialState as s,reducer as c}from"./reducer.js";import{resolveAssetById as l}from"./resolveAssetById.js";import{createContext as u,use as d,useCallback as f,useEffect as p,useMemo as m,useReducer as h,useRef as g}from"react";import{jsx as _}from"react/jsx-runtime";const v={id:`ELhVSL`,message:`Failed to submit deposit.`},y={id:`Ej5HL9`,message:`Signature declined. Please try again.`},b=u(null);b.displayName=`GatewayControllerContext`;function x(){let e=d(b);if(!e)throw Error(`useDeposit / GatewayController must be used inside <KitProvider deposit={…} />. Mount KitProvider once at the host's app root.`);return e}function S(){return x().state}function
|
|
1
|
+
"use client";import{useDepositDriverInstance as e}from"../driver/context.js";import{useLingui as t}from"../../../shared/i18n/useLingui.js";import"../../../i18n/index.js";import{toFailure as n}from"../../../shared/orchestrator/toFailure.js";import{useDriverSettlementListener as r}from"../../../shared/orchestrator/useDriverSettlementListener.js";import{useEffectiveState as i}from"../../../shared/orchestrator/useEffectiveState.js";import{isUserRejectionFailure as a}from"../../../shared/orchestrator/userRejection.js";import{useSettlementWatcher as o}from"../../../shared/orchestrator/useSettlementWatcher.js";import"../../../shared/orchestrator/index.js";import{initialState as s,reducer as c}from"./reducer.js";import{resolveAssetById as l}from"./resolveAssetById.js";import{createContext as u,use as d,useCallback as f,useEffect as p,useMemo as m,useReducer as h,useRef as g}from"react";import{jsx as _}from"react/jsx-runtime";const v={id:`ELhVSL`,message:`Failed to submit deposit.`},y={id:`Ej5HL9`,message:`Signature declined. Please try again.`},b=u(null);b.displayName=`GatewayControllerContext`;function x(){let e=d(b);if(!e)throw Error(`useDeposit / GatewayController must be used inside <KitProvider deposit={…} />. Mount KitProvider once at the host's app root.`);return e}function S(){return d(b)}const C=u(void 0);C.displayName=`DepositMethodsConfigContext`;function w(){return d(C)}function T(){return x().state}function E(){return x().effectiveState}function D(){return x().actions}function O({methodsConfig:t,children:n}){let r=e(),[a,o]=h(c,s),l=A(a,o,r);j(a,o,r),M(a,o,r);let u=i(a),d=k(a,o,r,l,t);return _(C,{value:t,children:_(b,{value:m(()=>({state:a,effectiveState:u,dispatch:o,controller:d,actions:l}),[a,u,d,l]),children:n})})}function k(e,t,n,r,i){let a=g(n);a.current=n;let o=g(i);o.current=i;let s=f(e=>{if(!e)return t({type:`OPEN`,input:void 0}),!0;if(o.current?.[e.method]?.disabled)return!1;if(e.method===`transfer`)return t({type:`OPEN`,input:{method:`transfer`}}),!0;if(e.method===`wallet`&&e.assetId!==void 0){let n=l(a.current.getSnapshot(),e.assetId);return n?(t({type:`OPEN`,input:{method:`wallet`,asset:n}}),!0):!1}return t({type:`OPEN`,input:{method:`wallet`}}),!0},[t]),c=f(()=>{t({type:`CLOSE`})},[t]);return m(()=>({open:s,close:c,actions:r}),[s,c,r])}function A(e,r,i){let o=g(e);o.current=e;let s=g(i);s.current=i;let c=g(r);c.current=r;let{i18n:l}=t(),u=g(l);u.current=l;let d=f((e,t)=>{let r=s.current,i=new AbortController,o=P(e,t);r.submitDeposit(o,i.signal).then(e=>{i.signal.aborted||c.current({type:`DEPOSIT_SUBMITTED`,tx:e})}).catch(e=>{if(i.signal.aborted)return;let t=n(e,u.current._(v));if(a(t)){c.current({type:`DEPOSIT_SIGNATURE_DECLINED`,notice:u.current._(y)});return}c.current({type:`DEPOSIT_SUBMISSION_FAILED`,failure:t})})},[]),p=f(e=>{c.current({type:`DEPOSIT_METHOD_SELECTED`,method:e})},[]),h=f(e=>{c.current({type:`ASSET_CONFIRMED`,asset:e})},[]),_=f(e=>{o.current.name===`amountEntry`&&c.current({type:`AMOUNT_CONFIRMED`,amount:e})},[]),b=f(()=>{let e=o.current;if(e.name!==`confirmDeposit`)return;let t=e.ctx.phase;if(t.kind===`failed`){c.current({type:`QUOTE_RETRY`});return}if(t.kind!==`ready`)return;let{asset:n,amount:r}=e.ctx;c.current({type:`DEPOSIT_CONFIRMED`}),d(n,r)},[d]),x=f(()=>{c.current({type:`BACK`})},[]),S=f(()=>{c.current({type:`CLOSE`})},[]),C=f(()=>{c.current({type:`SUCCESS_DONE`})},[]),w=f(()=>{c.current({type:`ERROR_TRY_AGAIN`})},[]),T=f((e,t)=>{c.current({type:`RESUME_TO_PROCESSING`,method:e,tx:t})},[]),E=f((e,t)=>{c.current({type:`RESUME_TO_SUCCESS`,method:e,tx:t})},[]),D=f(e=>{c.current({type:`RESUME_TO_ERROR`,...e?{tx:e}:{}})},[]);return m(()=>({selectMethod:p,confirmAsset:h,confirmAmount:_,confirmDeposit:b,back:x,close:S,successDone:C,tryAgain:w,resumeToProcessing:T,resumeToSuccess:E,resumeToError:D}),[p,h,_,b,x,S,C,w,T,E,D])}function j(e,t,r){p(()=>{if(e.name!==`confirmDeposit`||e.ctx.phase.kind!==`loading`&&e.ctx.phase.kind!==`regenerating`)return;let i=new AbortController,a=N(e.ctx.asset,e.ctx.amount);return r.requestQuote(a,i.signal).catch(e=>{i.signal.aborted||t({type:`QUOTE_FAILED`,failure:n(e,`Failed to fetch quote.`)})}),()=>i.abort()},[e.name,e.name===`confirmDeposit`?e.ctx.phase.kind:void 0,e.name===`confirmDeposit`?e.ctx.asset:void 0,e.name===`confirmDeposit`?e.ctx.amount:void 0,r,t]),p(()=>{if(e.name!==`confirmDeposit`||e.ctx.phase.kind!==`ready`)return;let n=e.ctx.phase.quoteExpiresAt,r=Math.max(0,n-Date.now()),i=setTimeout(()=>{t({type:`QUOTE_EXPIRED`})},r);return()=>clearTimeout(i)},[e.name,e.name===`confirmDeposit`&&e.ctx.phase.kind===`ready`?e.ctx.phase.quoteExpiresAt:void 0,t])}function M(e,t,n){let i=e.name===`processing`?e.ctx.tx:void 0;o(n,i?{tx:i}:void 0,i?.hash),p(()=>{if(e.name!==`transferCrypto`||!n.watchSourceTx)return;let t=new AbortController,r;return n.watchSourceTx({},e=>{t.signal.aborted||r||(r=new AbortController,n.watchSettlement({tx:e},()=>{},r.signal))},t.signal),()=>{t.abort(),r?.abort()}},[e.name,n]),p(()=>{if(e.name===`closed`||e.name===`transferCrypto`||e.name===`processing`||!n.fetchActiveSettlement)return;let t=new AbortController,r,i,a=!1,o=async()=>{try{let e=await n.fetchActiveSettlement({},t.signal);if(a)return;if(e&&!r&&e.payload.kind===`pending`){let t=e.payload.txHash?.value;t&&(r=new AbortController,n.watchSettlement({tx:{hash:t}},()=>{},r.signal))}}catch{}a||(i=setTimeout(o,5e3))};return o(),()=>{a=!0,t.abort(),r?.abort(),i&&clearTimeout(i)}},[e.name,n]);let a=g(e);a.current=e,r(n,e=>{a.current.name===`processing`&&(e===`succeeded`?t({type:`PROCESSING_SUCCEEDED`}):e===`failed`&&t({type:`PROCESSING_FAILED`}))});let s=g(null);p(()=>{let e=()=>{let e=n.getSnapshot(),r=a.current,i=e.quote;i.status!==s.current&&(s.current=i.status,i.status===`ready`&&r.name===`confirmDeposit`?(r.ctx.phase.kind===`loading`||r.ctx.phase.kind===`regenerating`)&&t({type:`QUOTE_RESOLVED`,expiresAt:i.payload.expiresAt}):i.status===`error`&&r.name===`confirmDeposit`&&(r.ctx.phase.kind===`loading`||r.ctx.phase.kind===`regenerating`)&&t({type:`QUOTE_FAILED`,failure:{reason:i.error.message,code:i.error.name}}))},r=n.subscribe(e);return e(),r},[n,t])}function N(e,t){let n=e.eip155Id;if(!n)throw Error(`Asset ${e.symbol} is missing eip155Id; cannot build quote input.`);return{sourceChainId:Number(n),sourceTokenAddress:e.address,sourceTokenDecimals:e.decimals,sourceTokenSymbol:e.symbol,sourceIsNative:e.isNative,amount:t,...e.priceUsd===void 0?{}:{sourcePriceUsd:e.priceUsd}}}function P(e,t){let n=e.eip155Id;if(!n)throw Error(`Asset ${e.symbol} is missing eip155Id; cannot build submit input.`);return{sourceChainId:Number(n),sourceTokenAddress:e.address,sourceTokenDecimals:e.decimals,sourceIsNative:e.isNative,amount:t}}export{O as GatewayController,x as useControllerContext,D as useDepositActions,E as useDepositEffectiveState,w as useDepositMethodsConfig,T as useDepositState,S as useOptionalControllerContext};
|
|
@@ -9,6 +9,35 @@ import { FailureInfo } from "../../../shared/orchestrator/types.js";
|
|
|
9
9
|
* (transfer-crypto → process).
|
|
10
10
|
*/
|
|
11
11
|
type DepositMethod = "wallet" | "transfer";
|
|
12
|
+
/**
|
|
13
|
+
* Host-supplied disable lever for a single payment method on the deposit-method picker. The host
|
|
14
|
+
* decides eligibility — the kit ships no per-host inference (embedded vs. external wallet,
|
|
15
|
+
* region, KYC tier, …). When `disabled` is true the tile stays in the picker (preserves
|
|
16
|
+
* discoverability), renders natively disabled, can't be selected, and shows `disabledHint` as
|
|
17
|
+
* the inline meta line below the title (also folded into the tile's accessible name so screen
|
|
18
|
+
* readers convey the reason).
|
|
19
|
+
*/
|
|
20
|
+
interface DepositMethodConfig {
|
|
21
|
+
/** When true, the method is rendered disabled and can't be selected. */
|
|
22
|
+
disabled?: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Plain-text reason shown inline as the tile's meta line — replaces the address+balance
|
|
25
|
+
* reading on the wallet tile and the `"No limit · Instant"` reading on the transfer tile so
|
|
26
|
+
* the explanation is unmissable and the auto-derived signals (which can read misleadingly,
|
|
27
|
+
* e.g. an embedded wallet's $0.00) are suppressed. Also folded into the tile's accessible
|
|
28
|
+
* name so screen readers convey it alongside the title. Ignored when `disabled` is falsy.
|
|
29
|
+
*/
|
|
30
|
+
disabledHint?: string;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Per-method host configuration for the deposit picker. Omitting a method (or the whole object)
|
|
34
|
+
* keeps default behavior; supply `{ disabled: true, disabledHint: "…" }` to mark an option as
|
|
35
|
+
* unavailable for the current user.
|
|
36
|
+
*/
|
|
37
|
+
interface DepositMethodsConfig {
|
|
38
|
+
wallet?: DepositMethodConfig;
|
|
39
|
+
transfer?: DepositMethodConfig;
|
|
40
|
+
}
|
|
12
41
|
/**
|
|
13
42
|
* Confirm-deposit phase sub-union. Drives the confirm-deposit widget's hero / footer chrome.
|
|
14
43
|
* Phase data is pure navigation; the actual quote payload comes from the driver's `quote` entity.
|
|
@@ -263,4 +292,4 @@ interface DepositActions {
|
|
|
263
292
|
resumeToError(tx?: TxRef): void;
|
|
264
293
|
}
|
|
265
294
|
//#endregion
|
|
266
|
-
export { ConfirmDepositPhase, DepositActions, DepositController, DepositMethod, DepositState, DepositStateName, GatewayEvent, OpenInput, ResolvedOpenInput, RetryTargetSpec };
|
|
295
|
+
export { ConfirmDepositPhase, DepositActions, DepositController, DepositMethod, DepositMethodConfig, DepositMethodsConfig, DepositState, DepositStateName, GatewayEvent, OpenInput, ResolvedOpenInput, RetryTargetSpec };
|
|
@@ -31,5 +31,22 @@ import { DepositController } from "./types.js";
|
|
|
31
31
|
* ```
|
|
32
32
|
*/
|
|
33
33
|
declare function useDeposit(): DepositController;
|
|
34
|
+
/**
|
|
35
|
+
* Non-throwing variant of {@link useDeposit} — returns `null` when called outside a
|
|
36
|
+
* `<KitProvider deposit={…} />`. Lets hosts mount `<StridgeProvider />` conditionally
|
|
37
|
+
* (e.g. only after a wallet is connected) without descendants crashing the moment they render
|
|
38
|
+
* before the provider exists.
|
|
39
|
+
*
|
|
40
|
+
* @example
|
|
41
|
+
* ```tsx
|
|
42
|
+
* const deposit = useOptionalDeposit();
|
|
43
|
+
* return (
|
|
44
|
+
* <button onClick={() => deposit?.open()} disabled={!deposit}>
|
|
45
|
+
* Deposit
|
|
46
|
+
* </button>
|
|
47
|
+
* );
|
|
48
|
+
* ```
|
|
49
|
+
*/
|
|
50
|
+
declare function useOptionalDeposit(): DepositController | null;
|
|
34
51
|
//#endregion
|
|
35
|
-
export { useDeposit };
|
|
52
|
+
export { useDeposit, useOptionalDeposit };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{useControllerContext as e}from"./controller.js";function
|
|
1
|
+
"use client";import{useControllerContext as e,useOptionalControllerContext as t}from"./controller.js";function n(){return e().controller}function r(){return t()?.controller??null}export{n as useDeposit,r as useOptionalDeposit};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{useDepositSnapshot as e}from"../../driver/context.js";import{useLingui as t}from"../../../../shared/i18n/useLingui.js";import"../../../../i18n/index.js";import{useDepositActions as n,useDepositEffectiveState as r}from"../../orchestrator/controller.js";import{QrCodeIcon as
|
|
1
|
+
"use client";import{useDepositSnapshot as e}from"../../driver/context.js";import{useLingui as t}from"../../../../shared/i18n/useLingui.js";import"../../../../i18n/index.js";import{useDepositActions as n,useDepositEffectiveState as r,useDepositMethodsConfig as i}from"../../orchestrator/controller.js";import{QrCodeIcon as a}from"../../../../shared/icons/QrCodeIcon.js";import{WalletIcon as o}from"../../../../shared/icons/WalletIcon.js";import"../../../../icons/index.js";import{DialogShell as s}from"../../../../shared/dialog/DialogShell.js";import{Image as c}from"../../../../shared/ui/Image/Image.js";import{Skeleton as l}from"../../../../shared/ui/Skeleton/Skeleton.js";import"../../../../shared/ui/Skeleton/index.js";import{TokenLogo as u}from"../../../../shared/ui/TokenLogo/TokenLogo.js";import"../../../../shared/ui/TokenLogo/index.js";import"../../../../ui/index.js";import{Deposit as d}from"./compound/Deposit.js";import"./compound/index.js";import{useMemo as f}from"react";import{jsx as p,jsxs as m}from"react/jsx-runtime";const h={width:18,height:18,"aria-hidden":!0};function g(s){let c=e(),u=r().name,{selectMethod:g}=n(),v=i(),{_:y}=t(),b=c.wallet,x=b.status===`ready`||b.status===`stale`?b.payload:void 0,S=x!==void 0,C=c.brand,w=C.status===`ready`||C.status===`stale`?C.payload:void 0,T=c.addresses,E=T.status===`ready`||T.status===`stale`?T.payload:[],D=c.balances.status===`error`,O=!x?.balanceTotalUsd?.formatted&&!D,k=!!c.brand,A=w?.name?y({id:`ogD_nm`,message:`Deposit to {0}`,values:{0:w.name}}):void 0,j=f(()=>_(E),[E]),M=v?.wallet,N=v?.transfer,P=f(()=>{let e=!S||O,t=M?.disabled??!1,n=e||t,r=t?M?.disabledHint:void 0,i=(()=>{if(t)return r;if(!S)return y({id:`5AApJw`,message:`Connect a wallet to continue`});if(x?.balanceTotalUsd?.formatted)return x.balanceTotalUsd.formatted;if(!D)return p(l,{width:56,height:12})})(),s=[{id:`wallet`,title:y({id:`sb9Y58`,message:`Wallet`}),icon:p(o,{...h}),...x&&!t?{titleAdornment:x.address.formatted}:{},...i===void 0?{}:{meta:i},recommended:!0,disabled:n,onSelect:n?void 0:()=>g(`wallet`)}];if(k){let e=N?.disabled??!1,t=e?N?.disabledHint:void 0,n=e?t:[y({id:`qtoOYG`,message:`No limit`}),y({id:`D79cZK`,message:`Instant`})];s.push({id:`transfer`,title:y({id:`3dqPLT`,message:`Transfer Crypto`}),icon:p(a,{...h}),...n===void 0?{}:{meta:n},...j?{trailing:j}:{},disabled:e,onSelect:e?void 0:()=>g(`transfer`)})}return s},[x,D,O,S,k,j,M,N,g,y]);return u===`deposit`?m(d,{...s,...A?{title:A}:{},methods:P,children:[p(d.Header,{}),p(d.Body,{children:p(d.Methods,{})})]}):null}function _(e){if(e.length!==0)return p(c.Group,{max:4,overflow:Math.max(0,e.length-4),size:`md`,children:e.map(e=>p(u,{isNative:!0,symbol:e.networkName,...e.eip155Id?{chainId:Number(e.eip155Id)}:{},...e.chainLogoUrl?{logoUrl:e.chainLogoUrl}:{},hideChainBadge:!0},e.eip155Id??e.networkName))})}function v({open:e,defaultOpen:t,onOpenChange:n,trigger:r,...i}){return p(s,{open:e,defaultOpen:t,onOpenChange:n,trigger:r,children:p(g,{...i})})}(function(e){e.Dialog=v})(g||={});export{g as Deposit};
|
|
@@ -17,6 +17,12 @@ import * as _$react_jsx_runtime0 from "react/jsx-runtime";
|
|
|
17
17
|
* `SelectableTile` primitive — see `ui/SelectableTile`. The row only contributes its
|
|
18
18
|
* own gap, leading-edge padding (so the recommended bar lands flush), and inner
|
|
19
19
|
* children layout.
|
|
20
|
+
*
|
|
21
|
+
* Disabled rows render natively `disabled` — the user-facing reason for the
|
|
22
|
+
* disable lives in the `meta` slot (the orchestrated `Deposit` widget maps
|
|
23
|
+
* `flows.deposit.methods.<m>.disabledHint` onto `meta` for host-gated methods).
|
|
24
|
+
* When `meta` is a string, it is also folded into the tile's accessible name so
|
|
25
|
+
* screen readers convey the reason alongside the title.
|
|
20
26
|
*/
|
|
21
27
|
declare function DepositMethod({
|
|
22
28
|
title,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{ChevronRightIcon as e}from"../../../../../../shared/icons/ChevronRightIcon.js";import"../../../../../../icons/index.js";import{SelectableTile as t}from"../../../../../../shared/ui/SelectableTile/SelectableTile.js";import"../../../../../../shared/ui/SelectableTile/index.js";import{text as n}from"../../../../../../shared/ui/Text/Text.js";import"../../../../../../ui/index.js";import{DEPOSIT_SLOTS as r}from"../Deposit.slots.js";import{styles as i}from"../Deposit.styles.js";import{Fragment as a}from"react";import{jsx as o,jsxs as s}from"react/jsx-runtime";import*as c from"@stylexjs/stylex";function l({title:a,titleAdornment:l,meta:d,icon:f,trailing:p,recommended:m=!1,disabled:h=!1,onSelect:g}){return s(t,{shape:`card`,onClick:g,disabled:h,"aria-label":
|
|
1
|
+
"use client";import{ChevronRightIcon as e}from"../../../../../../shared/icons/ChevronRightIcon.js";import"../../../../../../icons/index.js";import{SelectableTile as t}from"../../../../../../shared/ui/SelectableTile/SelectableTile.js";import"../../../../../../shared/ui/SelectableTile/index.js";import{text as n}from"../../../../../../shared/ui/Text/Text.js";import"../../../../../../ui/index.js";import{DEPOSIT_SLOTS as r}from"../Deposit.slots.js";import{styles as i}from"../Deposit.styles.js";import{Fragment as a}from"react";import{jsx as o,jsxs as s}from"react/jsx-runtime";import*as c from"@stylexjs/stylex";function l({title:a,titleAdornment:l,meta:d,icon:f,trailing:p,recommended:m=!1,disabled:h=!1,onSelect:g}){let _=h&&typeof d==`string`&&d.length>0?`${a} — ${d}`:a;return s(t,{shape:`card`,interactive:!0,onClick:h?void 0:g,disabled:h,"aria-label":_,"aria-disabled":h||void 0,"data-stridge-slot":r.method,"data-recommended":m||void 0,"data-disabled":h||void 0,...c.props(i.methodRow),children:[m?o(`span`,{"aria-hidden":!0,...c.props(i.methodRecommendedBar)}):null,o(`span`,{...c.props(i.methodIconSlot),children:f}),s(`span`,{...c.props(i.methodText),children:[s(`span`,{...c.props(i.methodTitleRow),children:[o(n.span,{size:`sm`,fontWeight:`semibold`,leading:`tight`,tracking:`tight`,truncate:!0,children:a}),l?o(n.span,{size:`xs`,leading:`tight`,tracking:`wide`,color:`subdued`,font:`mono`,style:{flexShrink:0},children:l}):null]}),d?o(u,{meta:d}):null]}),o(`span`,{...c.props(i.methodTrailing),children:p??o(e,{"aria-hidden":!0,...c.props(i.methodChevron)})})]})}function u({meta:e}){return Array.isArray(e)?o(n.span,{size:`xs`,leading:`tight`,color:`subdued`,...c.props(i.methodMeta),children:e.map((e,t)=>s(a,{children:[t>0?o(`span`,{...c.props(i.methodMetaItem),children:`·`}):null,o(n.span,{size:`xs`,leading:`tight`,fontWeight:t===0?`medium`:`normal`,color:t===0?`default`:`inherit`,...c.props(i.methodMetaItem),children:e})]},t))}):o(n.span,{size:`xs`,leading:`tight`,color:`subdued`,...c.props(i.methodMeta),children:e})}export{l as DepositMethod};
|
|
@@ -36,9 +36,12 @@ interface DepositMethodOption {
|
|
|
36
36
|
*/
|
|
37
37
|
recommended?: boolean;
|
|
38
38
|
/**
|
|
39
|
-
* When true, renders the row
|
|
40
|
-
*
|
|
41
|
-
* but click is a no-op.
|
|
39
|
+
* When true, renders the row natively disabled — used for "coming soon"
|
|
40
|
+
* methods or host-gated options. The row stays in the list for
|
|
41
|
+
* discoverability but click is a no-op. Supply the user-facing reason
|
|
42
|
+
* through the `meta` slot; when `meta` is a string, it is also folded
|
|
43
|
+
* into the tile's accessible name so screen readers convey it alongside
|
|
44
|
+
* the title.
|
|
42
45
|
*/
|
|
43
46
|
disabled?: boolean;
|
|
44
47
|
}
|
|
@@ -14,6 +14,13 @@ import * as _$react_jsx_runtime0 from "react/jsx-runtime";
|
|
|
14
14
|
* hook keys ack rows by `<txHash, bucket>` where `bucket` is `inflight` for pending and
|
|
15
15
|
* `terminal` for succeeded / failed. Acking the pending banner does NOT suppress the eventual
|
|
16
16
|
* success / failure banner for the same source-chain tx — the buckets are distinct.
|
|
17
|
+
*
|
|
18
|
+
* Reaching a terminal FSM step (`success` / `error`) auto-acks the terminal bucket: the user is
|
|
19
|
+
* looking at the full-screen outcome, so that IS the acknowledgment. Without it, the natural
|
|
20
|
+
* `processing → success` / `processing → error` progression would re-surface the banner once
|
|
21
|
+
* the dialog is closed (FSM resets to `deposit`) and reopened, because the settlement entity
|
|
22
|
+
* still carries the terminal payload. `processing` is deliberately NOT auto-acked — an
|
|
23
|
+
* in-flight deposit should still re-surface its banner on reopen.
|
|
17
24
|
*/
|
|
18
25
|
declare function DepositStatusBanner(): _$react_jsx_runtime0.JSX.Element;
|
|
19
26
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{useBannerAckForSettlement as
|
|
1
|
+
"use client";import{bucketFromSettlement as e,useBannerAckForSettlement as t}from"../../../../banners/useBannerAck.js";import"../../../../banners/index.js";import{useDepositSnapshot as n}from"../../driver/context.js";import{useLingui as r}from"../../../../shared/i18n/useLingui.js";import"../../../../i18n/index.js";import{useDepositActions as i,useDepositState as a}from"../../orchestrator/controller.js";import{stepRendersSettlement as o}from"../../orchestrator/steps.js";import{DepositStatusBanner as s}from"./compound/DepositStatusBanner.js";import"./compound/index.js";import{useEffect as c,useState as l}from"react";import{jsx as u,jsxs as d}from"react/jsx-runtime";import{AnimatePresence as f}from"motion/react";function p(){let s=n(),l=a().name,{resumeToProcessing:d,resumeToSuccess:p,resumeToError:h}=i(),{_}=r(),v=s.settlement,y=v.status===`ready`||v.status===`stale`?v.payload:void 0,{acked:b,ack:x}=t(y),S=(l===`success`||l===`error`)&&e(y)?.bucket===`terminal`;c(()=>{S&&!b&&x()},[S,b,x]);let C=y!==void 0&&!b&&!o(l);function w(e){return()=>{x(),e()}}return u(f,{children:C&&y?u(m,{payload:y,brandName:s.brand.status===`ready`||s.brand.status===`stale`?s.brand.payload.name:void 0,onDismiss:x,onResumeToProcessing:()=>d(`wallet`,g(y)),onResumeToSuccess:w(()=>p(`wallet`,g(y))),onResumeToError:w(()=>h(g(y))),labels:{completed:_({id:`3kg1gB`,message:`Deposit completed`}),didntComplete:_({id:`Rxjdjn`,message:`Deposit didn't complete`}),receivedProcessing:_({id:`junZX6`,message:`Deposit received and processing…`}),creditedToBrand:e=>_({id:`IRogzB`,message:`Your deposit has been credited to {brand}.`,values:{brand:e}}),creditedToAccount:_({id:`9JHY2T`,message:`Your deposit has been credited to your account.`}),fundsSafe:_({id:`Z1WbO6`,message:`Funds are safe on the source chain — contact support to recover.`}),willBeCreditedToBrand:e=>_({id:`TG4WOd`,message:`Your deposit will be credited to {brand}.`,values:{brand:e}}),willBeCreditedToAccount:_({id:`Offl0a`,message:`Your deposit will be credited to your account.`})}},`banner`):null})}function m({payload:e,brandName:t,onDismiss:n,onResumeToProcessing:r,onResumeToSuccess:i,onResumeToError:a,labels:o}){let[c,f]=l(!1),p=()=>f(e=>!e),m=e.kind,g={symbol:e.creditedAsset.symbol,...e.creditedAsset.address?{address:e.creditedAsset.address}:{},...e.creditedAsset.isNative===void 0?{}:{isNative:e.creditedAsset.isNative},...e.creditedAsset.assetLogoUrl?{logoUrl:e.creditedAsset.assetLogoUrl}:{}},_=m===`succeeded`?o.completed:m===`failed`?o.didntComplete:o.receivedProcessing,v=m===`succeeded`?t?o.creditedToBrand(t):o.creditedToAccount:m===`failed`?o.fundsSafe:t?o.willBeCreditedToBrand(t):o.willBeCreditedToAccount,y=h(e),b=e.kind===`succeeded`&&e.completionTx?{hash:e.completionTx.hash.formatted,...e.completionTx.explorerUrl?{explorerUrl:e.completionTx.explorerUrl}:{}}:void 0,x=e.kind===`succeeded`||e.kind===`failed`?e.submittedAt.formatted:void 0,S=e.kind===`succeeded`?e.filledAt.formatted:void 0,C=m===`succeeded`?i:m===`failed`?a:r;return d(s,{kind:m,asset:g,headline:_,subline:v,expanded:c,onToggleExpanded:p,onDismiss:n,...y?{depositTx:y}:{},...b?{completionTx:b}:{},...x===void 0?{}:{submittedAt:x},...S===void 0?{}:{filledAt:S},onPrimaryAction:C,children:[d(s.Body,{children:[u(s.Hero,{}),u(s.Close,{})]}),d(s.Details,{children:[u(s.DepositTxRow,{}),u(s.CompletionTxRow,{}),u(s.SubmittedAtRow,{}),u(s.FilledAtRow,{})]}),d(s.Footer,{children:[u(s.Toggle,{}),u(s.PrimaryAction,{})]})]})}function h(e){if(e.kind===`succeeded`)return{hash:e.depositTx.hash.formatted,...e.depositTx.explorerUrl?{explorerUrl:e.depositTx.explorerUrl}:{}};if(e.kind===`failed`||e.txHash)return{hash:e.txHash.formatted,...e.txExplorerUrl?{explorerUrl:e.txExplorerUrl}:{}}}function g(e){return e.kind===`succeeded`?{hash:e.depositTx.hash.value,...e.depositTx.explorerUrl?{explorerUrl:e.depositTx.explorerUrl}:{}}:e.kind===`failed`?{hash:e.txHash.value,...e.txExplorerUrl?{explorerUrl:e.txExplorerUrl}:{}}:{hash:e.txHash?.value??``,...e.txExplorerUrl?{explorerUrl:e.txExplorerUrl}:{}}}export{p as DepositStatusBanner};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{useLingui as e}from"../../../../../shared/i18n/useLingui.js";import"../../../../../i18n/index.js";import{useKitConfig as t}from"../../../../../scope/context.js";import{Collapsible as n}from"../../../../../shared/ui/Collapsible/Collapsible.js";import"../../../../../shared/ui/Collapsible/index.js";import{DEPOSIT_STATUS_BANNER_SLOTS as r}from"./DepositStatusBanner.slots.js";import{styles as i}from"./DepositStatusBanner.styles.js";import{DepositStatusBannerBody as a}from"./components/Body.js";import{DepositStatusBannerContext as o}from"./context.js";import{DepositStatusBannerClose as s}from"./components/Close.js";import{DepositStatusBannerDetail as c}from"./components/Detail.js";import{DepositStatusBannerDetails as l}from"./components/Details.js";import{DepositStatusBannerFooter as u}from"./components/Footer.js";import{DepositStatusBannerHero as d}from"./components/Hero.js";import{DepositStatusBannerPrimaryAction as f}from"./components/PrimaryAction.js";import{DepositStatusBannerCompletionTxRow as p,DepositStatusBannerDepositTxRow as m,DepositStatusBannerFilledAtRow as h,DepositStatusBannerSubmittedAtRow as g}from"./components/Rows.js";import{DepositStatusBannerToggle as _}from"./components/Toggle.js";import{useEffect as v,useLayoutEffect as y,useMemo as b,useRef as x}from"react";import{jsx as S}from"react/jsx-runtime";import
|
|
1
|
+
"use client";import{useLingui as e}from"../../../../../shared/i18n/useLingui.js";import"../../../../../i18n/index.js";import{useKitConfig as t}from"../../../../../scope/context.js";import{Collapsible as n}from"../../../../../shared/ui/Collapsible/Collapsible.js";import"../../../../../shared/ui/Collapsible/index.js";import{DEPOSIT_STATUS_BANNER_SLOTS as r}from"./DepositStatusBanner.slots.js";import{styles as i}from"./DepositStatusBanner.styles.js";import{DepositStatusBannerBody as a}from"./components/Body.js";import{DepositStatusBannerContext as o}from"./context.js";import{DepositStatusBannerClose as s}from"./components/Close.js";import{DepositStatusBannerDetail as c}from"./components/Detail.js";import{DepositStatusBannerDetails as l}from"./components/Details.js";import{DepositStatusBannerFooter as u}from"./components/Footer.js";import{DepositStatusBannerHero as d}from"./components/Hero.js";import{DepositStatusBannerPrimaryAction as f}from"./components/PrimaryAction.js";import{DepositStatusBannerCompletionTxRow as p,DepositStatusBannerDepositTxRow as m,DepositStatusBannerFilledAtRow as h,DepositStatusBannerSubmittedAtRow as g}from"./components/Rows.js";import{DepositStatusBannerToggle as _}from"./components/Toggle.js";import{useEffect as v,useLayoutEffect as y,useMemo as b,useRef as x}from"react";import{jsx as S}from"react/jsx-runtime";import{m as C}from"motion/react";import*as w from"@stylexjs/stylex";const T=[.16,1,.3,1],E=[.4,0,1,1];function D({kind:a,asset:s,headline:c,subline:l,expanded:u,onToggleExpanded:d,onDismiss:f,depositTx:p,completionTx:m,submittedAt:h,filledAt:g,onPrimaryAction:_,inline:D,children:O}){let{_:k}=e(),{direction:A}=t(),j=c??k(a===`succeeded`?{id:`3kg1gB`,message:`Deposit completed`}:a===`failed`?{id:`Rxjdjn`,message:`Deposit didn't complete`}:{id:`junZX6`,message:`Deposit received and processing…`}),M=l??k(a===`succeeded`?{id:`9JHY2T`,message:`Your deposit has been credited to your account.`}:a===`failed`?{id:`Z1WbO6`,message:`Funds are safe on the source chain — contact support to recover.`}:{id:`Offl0a`,message:`Your deposit will be credited to your account.`}),N=b(()=>({kind:a,asset:s,headline:j,subline:M,expanded:u,onToggleExpanded:d,onDismiss:f,depositTx:p,completionTx:m,submittedAt:h,filledAt:g,onPrimaryAction:_}),[a,s,j,M,u,d,f,p,m,h,g,_]),P=x(null),F=x(null),I=x(a),L=x(null),R=x(null);y(()=>{let e=P.current;if(!e)return;let t=e.getBoundingClientRect().height;if(I.current===a){F.current=t;return}let n=F.current;if(I.current=a,F.current=t,n===null||n===t||document.visibilityState===`hidden`)return;let r=e.style.transition;e.style.transition=`none`,e.style.height=`${n}px`,e.offsetHeight,e.style.transition=r,R.current!==null&&window.cancelAnimationFrame(R.current),R.current=window.requestAnimationFrame(()=>{R.current=null,P.current&&(P.current.style.height=`${t}px`)}),L.current!==null&&window.clearTimeout(L.current),L.current=window.setTimeout(()=>{L.current=null;let e=P.current;e&&(e.style.height=``)},320)}),v(()=>{let e=()=>{if(document.visibilityState!==`hidden`)return;R.current!==null&&(window.cancelAnimationFrame(R.current),R.current=null),L.current!==null&&(window.clearTimeout(L.current),L.current=null);let e=P.current;e&&(e.style.height=``)};return document.addEventListener(`visibilitychange`,e),()=>{document.removeEventListener(`visibilitychange`,e),L.current!==null&&(window.clearTimeout(L.current),L.current=null),R.current!==null&&(window.cancelAnimationFrame(R.current),R.current=null)}},[]);let z=D?`0%`:`-50%`;return S(o.Provider,{value:N,children:S(n,{open:u,onOpenChange:e=>{e!==u&&d()},children:S(C.div,{"data-stridge-slot":r.root,dir:A,...w.props(i.root,D&&i.rootInline),initial:{x:z,y:`100%`,opacity:0},animate:{x:z,y:`0%`,opacity:1,transition:{duration:.3,ease:T}},exit:{x:z,y:`100%`,opacity:0,transition:{duration:.22,ease:E}},children:S(`div`,{ref:P,style:{display:`flex`,flexDirection:`column`,overflow:`hidden`,transition:`height 260ms cubic-bezier(0.3, 0, 0.06, 1)`},children:O})})})})}(function(e){e.Body=a,e.Hero=d,e.Close=s,e.Details=l,e.Detail=c,e.Footer=u,e.Toggle=_,e.PrimaryAction=f,e.DepositTxRow=m,e.CompletionTxRow=p,e.SubmittedAtRow=g,e.FilledAtRow=h})(D||={});export{D as DepositStatusBanner};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{AlertIcon as e}from"../../../../../../shared/icons/AlertIcon.js";import{ArrowDownIcon as t}from"../../../../../../shared/icons/ArrowDownIcon.js";import{CheckIcon as n}from"../../../../../../shared/icons/CheckIcon.js";import"../../../../../../icons/index.js";import{TokenLogo as r}from"../../../../../../shared/ui/TokenLogo/TokenLogo.js";import"../../../../../../shared/ui/TokenLogo/index.js";import{DEPOSIT_STATUS_BANNER_SLOTS as i}from"../DepositStatusBanner.slots.js";import{styles as a}from"../DepositStatusBanner.styles.js";import{useDepositStatusBannerContext as o}from"../context.js";import{Fragment as s,jsx as c,jsxs as l}from"react/jsx-runtime";import
|
|
1
|
+
"use client";import{AlertIcon as e}from"../../../../../../shared/icons/AlertIcon.js";import{ArrowDownIcon as t}from"../../../../../../shared/icons/ArrowDownIcon.js";import{CheckIcon as n}from"../../../../../../shared/icons/CheckIcon.js";import"../../../../../../icons/index.js";import{TokenLogo as r}from"../../../../../../shared/ui/TokenLogo/TokenLogo.js";import"../../../../../../shared/ui/TokenLogo/index.js";import{DEPOSIT_STATUS_BANNER_SLOTS as i}from"../DepositStatusBanner.slots.js";import{styles as a}from"../DepositStatusBanner.styles.js";import{useDepositStatusBannerContext as o}from"../context.js";import{Fragment as s,jsx as c,jsxs as l}from"react/jsx-runtime";import{AnimatePresence as u,m as d}from"motion/react";import*as f from"@stylexjs/stylex";const p=[.16,1,.3,1],m=.22,h=.08,g=.14,_={enter:{opacity:0,y:6,filter:`blur(4px)`},center:{opacity:1,y:0,filter:`blur(0px)`,transition:{duration:m,delay:h,ease:p}},exit:{opacity:0,y:-6,filter:`blur(4px)`,transition:{duration:g,ease:p}}},v={enter:{opacity:0,scale:.6},center:{opacity:1,scale:1,transition:{duration:m,delay:h,ease:p}},exit:{opacity:0,scale:.6,transition:{duration:g,ease:p}}};function y(){let{kind:e,asset:t,headline:n,subline:p}=o(`DepositStatusBanner.Hero`);return l(s,{children:[l(`span`,{"data-stridge-slot":i.logo,...f.props(a.logo),children:[c(r,{size:32,symbol:t.symbol,...typeof t.chainId==`number`?{chainId:t.chainId}:{},...t.address?{address:t.address}:{},...t.isNative===void 0?{}:{isNative:t.isNative},...t.logoUrl?{logoUrl:t.logoUrl}:{},hideChainBadge:!0}),c(`span`,{"aria-hidden":!0,"data-stridge-slot":i.badge,...f.props(a.badge,e===`succeeded`&&a.badgeSucceeded,e===`failed`&&a.badgeFailed,e===`pending`&&a.badgePending),children:c(u,{mode:`wait`,initial:!1,children:c(d.span,{variants:v,initial:`enter`,animate:`center`,exit:`exit`,style:{display:`flex`,alignItems:`center`,justifyContent:`center`},children:c(b,{kind:e})},e)})})]}),c(`div`,{"data-stridge-slot":i.text,...f.props(a.text),children:c(u,{mode:`wait`,initial:!1,children:l(d.div,{variants:_,initial:`enter`,animate:`center`,exit:`exit`,style:{display:`flex`,flexDirection:`column`,gap:`2px`,minWidth:0},children:[c(`span`,{"data-stridge-slot":i.headline,...f.props(a.headline),children:n}),c(`span`,{"data-stridge-slot":i.subline,...f.props(a.subline),children:p})]},e)})})]})}function b({kind:r}){let i=f.props(a.badgeIcon);return c(r===`succeeded`?n:r===`failed`?e:t,{"aria-hidden":!0,...i})}export{y as DepositStatusBannerHero};
|
package/dist/flows/deposit/widgets/deposit-status-banner/compound/components/PrimaryAction.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{useLingui as e}from"../../../../../../shared/i18n/useLingui.js";import"../../../../../../i18n/index.js";import{ChevronRightIcon as t}from"../../../../../../shared/icons/ChevronRightIcon.js";import"../../../../../../icons/index.js";import{Button as n}from"../../../../../../shared/ui/Button/Button.js";import"../../../../../../shared/ui/Button/index.js";import{DEPOSIT_STATUS_BANNER_SLOTS as r}from"../DepositStatusBanner.slots.js";import{useDepositStatusBannerContext as i}from"../context.js";import{jsx as a,jsxs as o}from"react/jsx-runtime";import{AnimatePresence as s,
|
|
1
|
+
"use client";import{useLingui as e}from"../../../../../../shared/i18n/useLingui.js";import"../../../../../../i18n/index.js";import{ChevronRightIcon as t}from"../../../../../../shared/icons/ChevronRightIcon.js";import"../../../../../../icons/index.js";import{Button as n}from"../../../../../../shared/ui/Button/Button.js";import"../../../../../../shared/ui/Button/index.js";import{DEPOSIT_STATUS_BANNER_SLOTS as r}from"../DepositStatusBanner.slots.js";import{useDepositStatusBannerContext as i}from"../context.js";import{jsx as a,jsxs as o}from"react/jsx-runtime";import{AnimatePresence as s,m as c}from"motion/react";const l=[.16,1,.3,1],u={enter:{opacity:0,y:`60%`},center:{opacity:1,y:`0%`,transition:{duration:.22,ease:l}},exit:{opacity:0,y:`-60%`,transition:{duration:.18,ease:l}}};function d({onClick:l,label:d}={}){let f=i(`DepositStatusBanner.PrimaryAction`),{kind:p}=f,m=l??f.onPrimaryAction,{_:h}=e();if(!m)return null;let g=d??h(p===`succeeded`?{id:`AO44G_`,message:`View receipt`}:p===`failed`?{id:`2Eoi_a`,message:`View details`}:{id:`Oi8TiZ`,message:`View progress`}),_=d??[h({id:`Oi8TiZ`,message:`View progress`}),h({id:`AO44G_`,message:`View receipt`}),h({id:`2Eoi_a`,message:`View details`})].reduce((e,t)=>t.length>e.length?t:e);return a(n,{type:`button`,onClick:m,variant:`default`,size:`sm`,suffix:a(t,{"aria-hidden":!0}),"data-stridge-slot":r.primaryAction,children:o(`span`,{style:{position:`relative`,display:`inline-flex`,alignItems:`center`,overflow:`hidden`},children:[a(`span`,{"aria-hidden":!0,style:{visibility:`hidden`,whiteSpace:`nowrap`},children:_}),a(s,{mode:`popLayout`,initial:!1,children:a(c.span,{variants:u,initial:`enter`,animate:`center`,exit:`exit`,style:{position:`absolute`,insetInlineStart:0,insetBlockStart:0,width:`100%`,display:`inline-flex`,alignItems:`center`,justifyContent:`center`,whiteSpace:`nowrap`},children:g},g)})]})})}export{d as DepositStatusBannerPrimaryAction};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{useDepositSnapshot as e}from"../../driver/context.js";import{useLingui as t}from"../../../../shared/i18n/useLingui.js";import"../../../../i18n/index.js";import{useDepositActions as n,useDepositEffectiveState as r}from"../../orchestrator/controller.js";import{shortenAddress as i}from"../../../../shared/format/shortenAddress.js";import{DialogShell as a}from"../../../../shared/dialog/DialogShell.js";import{ProcessingState as o}from"../../../../shared/widgets/processing-state/compound/ProcessingState.js";import"../../../../shared/widgets/processing-state/compound/index.js";import{jsx as s,jsxs as c}from"react/jsx-runtime";function l(a){let l=e(),u=r(),{back:d
|
|
1
|
+
"use client";import{useDepositSnapshot as e}from"../../driver/context.js";import{useLingui as t}from"../../../../shared/i18n/useLingui.js";import"../../../../i18n/index.js";import{useDepositActions as n,useDepositEffectiveState as r}from"../../orchestrator/controller.js";import{shortenAddress as i}from"../../../../shared/format/shortenAddress.js";import{DialogShell as a}from"../../../../shared/dialog/DialogShell.js";import{ProcessingState as o}from"../../../../shared/widgets/processing-state/compound/ProcessingState.js";import"../../../../shared/widgets/processing-state/compound/index.js";import{jsx as s,jsxs as c}from"react/jsx-runtime";function l(a){let l=e(),u=r(),{back:d}=n(),{_:f}=t();if(u.name!==`processing`)return null;let p=l.settlement,m=(p.status===`ready`||p.status===`stale`)&&p.payload.kind===`pending`?p.payload:void 0,h=l.brand,g=h.status===`ready`||h.status===`stale`?h.payload.name:void 0,_=l.target,v=_.status===`ready`||_.status===`stale`?_.payload:void 0,y=l.wallet,b=y.status===`ready`||y.status===`stale`?y.payload:void 0,x=!m||m.receiveAmount.value===0,S=m?m.receiveAmount.formatted:``,C=m?.creditedAsset.symbol??v?.symbol??``,w=m?.creditedTo||g||C,T=u.ctx.tx,E=m?.txHash?.formatted??(T.hash?i(T.hash):``),D=m?.txExplorerUrl??T.explorerUrl,O=m?.sourceWallet.name??f({id:`sb9Y58`,message:`Wallet`}),k=m?.sourceWallet.address.formatted??b?.address.formatted??``,A=m?.sourceWallet.explorerUrl,j=k?{name:O,address:k,...A?{explorerUrl:A}:{}}:void 0,M=E?{hash:E,...D?{explorerUrl:D}:{}}:void 0;return c(o,{...a,amount:S,creditedAsset:{symbol:C},creditedTo:w,...x?{loading:!0}:{},onBack:d,...j?{sourceWallet:j}:{},...M?{sourceTx:M}:{},...m?.submittedAt?{submittedAt:m.submittedAt.formatted}:{},...m?.detectedAt?{detectedAt:m.detectedAt.formatted}:{},children:[s(o.Header,{}),c(o.Body,{children:[s(o.Hero,{}),s(o.StatusPill,{}),c(o.Details,{children:[s(o.SourceRow,{}),s(o.SourceTxRow,{}),s(o.SubmittedAtRow,{}),s(o.DetectedAtRow,{})]})]})]})}function u({open:e,defaultOpen:t,onOpenChange:n,trigger:r,...i}){return s(a,{open:e,defaultOpen:t,onOpenChange:n,trigger:r,children:s(l,{...i})})}(function(e){e.Dialog=u})(l||={});export{l as ProcessingState};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{useLingui as e}from"../../../../../../shared/i18n/useLingui.js";import"../../../../../../i18n/index.js";import{CopyIcon as t}from"../../../../../../shared/icons/CopyIcon.js";import{InfoIcon as n}from"../../../../../../shared/icons/InfoIcon.js";import"../../../../../../icons/index.js";import{Button as r}from"../../../../../../shared/ui/Button/Button.js";import"../../../../../../shared/ui/Button/index.js";import{Card as i}from"../../../../../../shared/ui/Card/Card.js";import{
|
|
1
|
+
"use client";import{useLingui as e}from"../../../../../../shared/i18n/useLingui.js";import"../../../../../../i18n/index.js";import{CopyIcon as t}from"../../../../../../shared/icons/CopyIcon.js";import{InfoIcon as n}from"../../../../../../shared/icons/InfoIcon.js";import"../../../../../../icons/index.js";import{Button as r}from"../../../../../../shared/ui/Button/Button.js";import"../../../../../../shared/ui/Button/index.js";import{Card as i}from"../../../../../../shared/ui/Card/Card.js";import{text as a}from"../../../../../../shared/ui/Text/Text.js";import"../../../../../../ui/index.js";import{TermsLink as o}from"../../../../../../shared/terms/TermsLink.js";import"../../../../../../shared/terms/index.js";import{useCopyToClipboard as s}from"../../../../../../shared/utils/useCopyToClipboard.js";import{useTransferCryptoContext as c}from"../context.js";import{TRANSFER_CRYPTO_SLOTS as l}from"../TransferCrypto.slots.js";import{styles as u}from"../TransferCrypto.styles.js";import{InfoTooltip as d}from"./InfoTooltip.js";import{useCallback as f}from"react";import{jsx as p,jsxs as m}from"react/jsx-runtime";import*as h from"@stylexjs/stylex";function g(){let g=c(`TransferCrypto.Address`),{_}=e(),{isCopied:v,copy:y}=s(g.depositAddress),b=_({id:`6D8qH6`,message:`Send the selected token on the selected chain to this address. Funds appear in your account once the network confirms the transfer.`}),x=f(async()=>{await y()&&g.onCopy?.(g.depositAddress)},[y,g]);return m(`div`,{"data-stridge-slot":l.address,...h.props(u.addressSection),children:[m(`div`,{...h.props(u.addressLabelRow),children:[m(a.span,{size:`meta`,fontWeight:`medium`,leading:`tight`,...h.props(u.addressLabel),children:[_({id:`pCzTTC`,message:`Your deposit address`}),p(d,{content:b,children:p(n,{"aria-hidden":!0,...h.props(u.addressLabelInfo)})})]}),p(o,{...h.props(u.termsLink),children:p(a.span,{size:`xs`,fontWeight:`medium`,leading:`tight`,color:`inherit`,children:_({id:`cGYrpE`,message:`Terms apply`})})})]}),m(i,{variant:`subdued`,dir:`ltr`,...h.props(u.addressPill),children:[p(a.span,{size:`xs`,fontWeight:`medium`,leading:`tight`,tracking:`normal`,font:`mono`,...h.props(u.addressText),children:g.depositAddress}),m(r,{variant:`secondary`,onClick:x,"aria-label":_({id:`SOVBoe`,message:`Copy deposit address`}),...h.props(u.copyButton),children:[p(t,{"aria-hidden":!0,...h.props(u.copyIcon)}),p(a.span,{size:`meta`,fontWeight:`semibold`,leading:`tight`,tracking:`tight`,color:`inherit`,children:_(v?{id:`PiH3UR`,message:`Copied!`}:{id:`he3ygx`,message:`Copy`})})]})]})]})}export{g as TransferCryptoAddress};
|
|
@@ -5,7 +5,8 @@ import * as _$react_jsx_runtime0 from "react/jsx-runtime";
|
|
|
5
5
|
/**
|
|
6
6
|
* Disclosure part — collapsible footer surfacing the rough processing-time
|
|
7
7
|
* hint as the trigger and the "Have questions?" help row inside the panel.
|
|
8
|
-
* The help row always renders and
|
|
8
|
+
* The help row always renders and opens the Stridge messenger via
|
|
9
|
+
* {@link SupportLink}.
|
|
9
10
|
*/
|
|
10
11
|
declare function TransferCryptoDisclosure({
|
|
11
12
|
defaultOpen,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{useLingui as e}from"../../../../../../shared/i18n/useLingui.js";import"../../../../../../i18n/index.js";import{ChevronDownIcon as t}from"../../../../../../shared/icons/ChevronDownIcon.js";import{CircleHelpIcon as n}from"../../../../../../shared/icons/CircleHelpIcon.js";import{ClockIcon as r}from"../../../../../../shared/icons/ClockIcon.js";import"../../../../../../icons/index.js";import{
|
|
1
|
+
"use client";import{useLingui as e}from"../../../../../../shared/i18n/useLingui.js";import"../../../../../../i18n/index.js";import{ChevronDownIcon as t}from"../../../../../../shared/icons/ChevronDownIcon.js";import{CircleHelpIcon as n}from"../../../../../../shared/icons/CircleHelpIcon.js";import{ClockIcon as r}from"../../../../../../shared/icons/ClockIcon.js";import"../../../../../../icons/index.js";import{SupportLink as i}from"../../../../../../shared/support/SupportLink.js";import"../../../../../../shared/support/index.js";import{Card as a}from"../../../../../../shared/ui/Card/Card.js";import{Collapsible as o}from"../../../../../../shared/ui/Collapsible/Collapsible.js";import"../../../../../../shared/ui/Collapsible/index.js";import{text as s}from"../../../../../../shared/ui/Text/Text.js";import"../../../../../../ui/index.js";import{TRANSFER_CRYPTO_SLOTS as c}from"../TransferCrypto.slots.js";import{styles as l}from"../TransferCrypto.styles.js";import{jsx as u,jsxs as d}from"react/jsx-runtime";import*as f from"@stylexjs/stylex";function p({defaultOpen:p=!1,open:m,onOpenChange:h,processingTime:g}){let{_}=e(),v=g??_({id:`KuqCAK`,message:`~ 2 min`});return d(o,{"data-stridge-slot":c.disclosure,defaultOpen:p,open:m,onOpenChange:h,render:u(a,{variant:`subdued`}),...f.props(l.disclosure),children:[d(o.Trigger,{render:u(`div`,{}),nativeButton:!1,...f.props(l.disclosureHeader),children:[u(r,{"aria-hidden":!0,...f.props(l.disclosureRowIcon)}),u(`div`,{...f.props(l.disclosureRowTextWithInfo),children:u(s.span,{size:`meta`,fontWeight:`medium`,leading:`tight`,children:_({id:`7evBec`,message:`Processing time: {resolvedProcessingTime}`,values:{resolvedProcessingTime:v}})})}),u(t,{"aria-hidden":!0,...f.props(l.disclosureChevron,l.disclosureHeaderChevron)})]}),u(o.Panel,{children:u(`div`,{...f.props(l.disclosurePanelInner),children:d(`div`,{...f.props(l.disclosureRow),children:[u(n,{"aria-hidden":!0,...f.props(l.disclosureRowIcon)}),d(`div`,{children:[u(s.span,{size:`meta`,fontWeight:`medium`,leading:`tight`,...f.props(l.helpQuestion),children:_({id:`QU2cIs`,message:`Have questions?`})}),u(i,{...f.props(l.helpLink),children:u(s.span,{size:`meta`,fontWeight:`medium`,leading:`tight`,color:`inherit`,children:_({id:`AWtGgd`,message:`Get help`})})})]})]})})})]})}export{p as TransferCryptoDisclosure};
|
|
@@ -5,16 +5,10 @@ import * as _$react_jsx_runtime0 from "react/jsx-runtime";
|
|
|
5
5
|
* QR code part — renders the deposit address as a QR code with the
|
|
6
6
|
* selected chain's logo punched out at the center.
|
|
7
7
|
*
|
|
8
|
-
* The
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
* grid) — `height: 36px` on the icon turned into ~175 actual pixels
|
|
13
|
-
* and the SVG ballooned. Percentages resolve correctly because they
|
|
14
|
-
* stay in the local user-unit space, so the img sizes against Cuer's
|
|
15
|
-
* arena `<foreignObject>` width/height directly. `object-fit: contain`
|
|
16
|
-
* preserves aspect ratio so chain logos with non-square viewBoxes
|
|
17
|
-
* (Ethereum is 784×1277) don't squish.
|
|
8
|
+
* The logo is rendered via `Cuer.Arena` as a native SVG `<image>` —
|
|
9
|
+
* `preserveAspectRatio="xMidYMid meet"` (the SVG equivalent of
|
|
10
|
+
* `object-fit: contain`) keeps non-square chain artwork from squishing,
|
|
11
|
+
* and the SVG coordinate system places it exactly on the QR centre.
|
|
18
12
|
*/
|
|
19
13
|
declare function TransferCryptoQrCode(): _$react_jsx_runtime0.JSX.Element;
|
|
20
14
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{resolveChainLogoChain as e}from"../../../../../../shared/utils/logos/resolveLogoSrc.js";import"../../../../../../shared/utils/logos/index.js";import{useTransferCryptoContext as t}from"../context.js";import{TRANSFER_CRYPTO_SLOTS as n}from"../TransferCrypto.slots.js";import{styles as r}from"../TransferCrypto.styles.js";import{useEffect as
|
|
1
|
+
"use client";import{resolveChainLogoChain as e}from"../../../../../../shared/utils/logos/resolveLogoSrc.js";import"../../../../../../shared/utils/logos/index.js";import{useTransferCryptoContext as t}from"../context.js";import{TRANSFER_CRYPTO_SLOTS as n}from"../TransferCrypto.slots.js";import{styles as r}from"../TransferCrypto.styles.js";import{Cuer as i}from"../../../../../../shared/cuer/Cuer.js";import"../../../../../../shared/cuer/index.js";import{useEffect as a,useState as o}from"react";import{jsx as s,jsxs as c}from"react/jsx-runtime";import*as l from"@stylexjs/stylex";function u(){let u=t(`TransferCrypto.QrCode`),d=e({...u.chain.chainId===void 0?{}:{chainId:u.chain.chainId},...u.chain.logoUrl===void 0?{}:{chainLogoUrl:u.chain.logoUrl}}),[f,p]=o(0);a(()=>{p(0)},[d.join(`|`)]);let m=d[f];return s(`div`,{"data-stridge-slot":n.qr,...l.props(r.qrFrame),children:c(i.Root,{value:u.depositAddress,size:160,...l.props(r.qrSvg),children:[s(i.Finder,{}),s(i.Cells,{}),m&&s(i.Arena,{href:m,"aria-label":u.chain.symbol,"data-stridge-slot":n.qrArena,onError:()=>{f<d.length-1&&p(f+1)}},m)]})})}export{u as TransferCryptoQrCode};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function e(e,t={}){let n=e.settlements??[],r=t.txHash?.toLowerCase()
|
|
1
|
+
function e(e,t={}){let n=e.settlements??[],r=t.txHash?.toLowerCase();if(r){let e=n.filter(e=>e.from?.tx_id?.toLowerCase()===r);return e.length===0?void 0:[...e].sort((e,t)=>(t.updated_at??``).localeCompare(e.updated_at??``))[0]}let i=t.bestMatch;if(i){let t=i.destination.recipientAddress.toLowerCase(),r=i.destination.tokenSymbol.toLowerCase(),a=new Date(i.submittedAt).toISOString(),o=i.sourceAmountBaseUnits,s=n.filter(n=>{let s=n.created_at??``;if(s&&s<a)return!1;let c=e.destination;return!(Number(c.eip155_id)!==i.destination.chainId||(c.asset_symbol??``).toLowerCase()!==r||(c.address??``).toLowerCase()!==t||o!==void 0&&n.from?.raw_amount!==o)});return s.length===0?void 0:[...s].sort((e,t)=>(t.updated_at??``).localeCompare(e.updated_at??``))[0]}let a=t.sinceIso??``,o=n.filter(e=>(e.created_at??``)>=a);if(o.length!==0)return[...o].sort((e,t)=>(t.updated_at??``).localeCompare(e.updated_at??``))[0]}export{e as pickRelevantSettlement};
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { WithdrawSubmitCallback } from "../orchestrator/types.js";
|
|
2
|
+
import { ReactNode } from "react";
|
|
3
|
+
//#region src/flows/withdraw/bindings/WithdrawBindings.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* Withdrawable balance the host surfaces to the withdraw form. Two accepted forms:
|
|
6
|
+
*
|
|
7
|
+
* - `number` — bare amount in display units (kit infers symbol from the provider-level
|
|
8
|
+
* `asset.symbol`; USD value is derived for known stablecoins or hidden otherwise).
|
|
9
|
+
* - `{ amount, amountUsd? }` — explicit amount plus optional pre-computed USD value.
|
|
10
|
+
*
|
|
11
|
+
* `undefined` represents the loading state — the kit renders a skeleton / em-dashes instead
|
|
12
|
+
* of a value.
|
|
13
|
+
*/
|
|
14
|
+
type WithdrawBalanceInput = number | {
|
|
15
|
+
amount: number;
|
|
16
|
+
amountUsd?: number;
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Trusted-recipient prefill chip surfaced next to the recipient address input. The kit no
|
|
20
|
+
* longer auto-derives a chip from `wagmi.address` — that misled users on embedded-wallet
|
|
21
|
+
* integrations, where `wagmi.address` is the integration's generated wallet rather than the
|
|
22
|
+
* user's primary self-custodial wallet. Hosts that have a verified, user-trusted address (a
|
|
23
|
+
* saved wallet on the user's profile, a KYC-bound payout destination, a whitelisted withdrawal
|
|
24
|
+
* address) pass it via {@link useWithdrawBindings} (or the `<WithdrawDialog>` prop of the same
|
|
25
|
+
* name); the chip's `aria-label` reads off `label` so the affordance is unambiguous about which
|
|
26
|
+
* address the user is filling with.
|
|
27
|
+
*/
|
|
28
|
+
interface WithdrawSuggestedRecipient {
|
|
29
|
+
/** Address that fills the recipient input when the chip is clicked. */
|
|
30
|
+
address: string;
|
|
31
|
+
/**
|
|
32
|
+
* Short human label for the chip — used as the accessible name (`aria-label`) so screen
|
|
33
|
+
* readers and click targets describe the saved address concretely (e.g. `"Saved wallet"`,
|
|
34
|
+
* `"Your verified address"`). When omitted, the chip falls back to a generic kit-default.
|
|
35
|
+
*/
|
|
36
|
+
label?: string;
|
|
37
|
+
/**
|
|
38
|
+
* Receive-side chain id this address belongs to (EIP-155 numeric). When set, the chip is
|
|
39
|
+
* surfaced only while the form's selected receive chain matches — prevents the user from
|
|
40
|
+
* one-click-filling an Ethereum address while routing to BSC, etc. When omitted, the chip
|
|
41
|
+
* is surfaced unconditionally and address-chain compatibility is the integrator's concern.
|
|
42
|
+
*/
|
|
43
|
+
chainId?: number;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Render-time inputs the host supplies to the withdraw flow. Whoever renders the withdraw UI —
|
|
47
|
+
* the kit's `<WithdrawDialog>` or a fully custom headless surface — publishes these via
|
|
48
|
+
* {@link useWithdrawBindings}. Form widgets read the display values reactively; the orchestrator's
|
|
49
|
+
* submit action reads `onSubmit` at submit time to fire the host's callback.
|
|
50
|
+
*/
|
|
51
|
+
interface WithdrawBindings {
|
|
52
|
+
/** Host-supplied source-side balance the form renders. */
|
|
53
|
+
balance?: WithdrawBalanceInput;
|
|
54
|
+
/**
|
|
55
|
+
* Host-supplied submit handler. Fired when the user submits the form (after the kit has
|
|
56
|
+
* prepared a fresh UDA target). The host calls the supplied actions to advance the FSM at
|
|
57
|
+
* the points its backend reaches the matching state.
|
|
58
|
+
*/
|
|
59
|
+
onSubmit?: WithdrawSubmitCallback;
|
|
60
|
+
/**
|
|
61
|
+
* Trusted recipient address surfaced as a prefill chip on the recipient field. See
|
|
62
|
+
* {@link WithdrawSuggestedRecipient}.
|
|
63
|
+
*/
|
|
64
|
+
suggestedRecipient?: WithdrawSuggestedRecipient;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Publish the host's render-time withdraw inputs (`balance`, `onSubmit`, `suggestedRecipient`)
|
|
68
|
+
* into the kit's withdraw scope. Call it once from whatever component renders the withdraw UI:
|
|
69
|
+
*
|
|
70
|
+
* - The kit's `<WithdrawDialog>` calls it internally with its render-time props.
|
|
71
|
+
* - A **headless** host that renders fully custom withdraw UI from `useWithdraw()` /
|
|
72
|
+
* `useWithdrawState()` / `useWithdrawSnapshot()` calls it directly — it's the supported way
|
|
73
|
+
* to wire `onSubmit` (and the optional display inputs) without mounting the dialog.
|
|
74
|
+
*
|
|
75
|
+
* Writes synchronously to the bridge ref during render so the controller's submit action always
|
|
76
|
+
* reads the latest `onSubmit`; a deferred `setState` updates the reactive state read by display
|
|
77
|
+
* widgets. Clears the bridge on unmount.
|
|
78
|
+
*
|
|
79
|
+
* @example Headless usage
|
|
80
|
+
* ```tsx
|
|
81
|
+
* useWithdrawBindings({
|
|
82
|
+
* balance: walletBalance,
|
|
83
|
+
* onSubmit: async (input, actions) => {
|
|
84
|
+
* const txHash = await backend.broadcastWithdrawal(input.depositTarget);
|
|
85
|
+
* actions.beginProcessing({ hash: txHash });
|
|
86
|
+
* },
|
|
87
|
+
* });
|
|
88
|
+
* ```
|
|
89
|
+
*/
|
|
90
|
+
declare function useWithdrawBindings(bindings: WithdrawBindings): void;
|
|
91
|
+
//#endregion
|
|
92
|
+
export { WithdrawBalanceInput, WithdrawBindings, WithdrawSuggestedRecipient, useWithdrawBindings };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import{createContext as e,use as t,useEffect as n,useMemo as r,useRef as i,useState as a}from"react";import{jsx as o}from"react/jsx-runtime";const s=e(null);s.displayName=`WithdrawBindingsContext`;function c({children:e}){let[t,n]=a({}),c=i({});return o(s,{value:r(()=>({bindings:t,setBindings:n,ref:c}),[t]),children:e})}function l(){return t(s)?.bindings??{}}function u(){let e=t(s),n=i({});return e?.ref??n}function d(e){let r=t(s),a=e.balance,o=e.onSubmit,c=e.suggestedRecipient;r&&(r.ref.current={...a===void 0?{}:{balance:a},...o?{onSubmit:o}:{},...c?{suggestedRecipient:c}:{}});let l=i(r?.setBindings);l.current=r?.setBindings;let u=i(r?.ref);u.current=r?.ref,n(()=>{let e=l.current;if(e)return e({...a===void 0?{}:{balance:a},...o?{onSubmit:o}:{},...c?{suggestedRecipient:c}:{}}),()=>{let e=l.current,t=u.current;t&&(t.current={}),e&&e({})}},[a,o,c])}export{c as WithdrawBindingsProvider,d as useWithdrawBindings,u as useWithdrawBindingsRef,l as useWithdrawBindingsValue};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import { WithdrawBalanceInput, WithdrawBindings, WithdrawSuggestedRecipient, useWithdrawBindings } from "./WithdrawBindings.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"./WithdrawBindings.js";
|