@stridge/kit 0.1.0-alpha.27 → 0.1.0-alpha.29

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.
@@ -1,4 +1,5 @@
1
1
  import { DepositDriver } from "./flows/deposit/driver/types.js";
2
+ import { DepositMethodsConfig } from "./flows/deposit/orchestrator/types.js";
2
3
  import { WithdrawDriver } from "./flows/withdraw/driver/types.js";
3
4
  import { KitScope } from "./scope/KitScope.js";
4
5
  import { KitI18nConfig } from "./shared/i18n/createKitI18n.js";
@@ -47,6 +48,7 @@ declare function KitProvider({
47
48
  i18n,
48
49
  direction,
49
50
  deposit,
51
+ depositMethods,
50
52
  withdraw,
51
53
  storage,
52
54
  storageNamespace,
@@ -70,6 +72,14 @@ declare namespace KitProvider {
70
72
  * `@stridge/kit/deposit/dialog` read from it.
71
73
  */
72
74
  deposit?: DepositDriver;
75
+ /**
76
+ * Per-method host disable lever for the deposit-method picker. Lets the host mark Wallet
77
+ * or Transfer Crypto unavailable for the current user (embedded-wallet hosts, KYC gates,
78
+ * regional restrictions, …) without removing the option from the picker. Surfaced as a
79
+ * natively disabled tile with the optional `disabledHint` rendered inline as the meta
80
+ * line below the title.
81
+ */
82
+ depositMethods?: DepositMethodsConfig;
73
83
  /**
74
84
  * Host-supplied {@link WithdrawDriver} — source of reactive data + imperative actions for
75
85
  * the withdraw flow. When supplied, the provider mounts the withdraw driver context and
@@ -1 +1 @@
1
- "use client";import{KitStorageProvider as e}from"./storage/context.js";import"./storage/index.js";import{DepositDriverProvider as t}from"./flows/deposit/driver/context.js";import{getLocaleDirection as n}from"./shared/i18n/getLocaleDirection.js";import{KitI18nProvider as r}from"./shared/i18n/KitI18nProvider.js";import"./i18n/index.js";import{GatewayController as i}from"./flows/deposit/orchestrator/controller.js";import{WithdrawBindingsProvider as a}from"./flows/withdraw/bindings/WithdrawBindings.js";import"./flows/withdraw/bindings/index.js";import{WithdrawDriverProvider as o}from"./flows/withdraw/driver/context.js";import{WithdrawControllerProvider as s}from"./flows/withdraw/orchestrator/controller.js";import{KitScope as c}from"./scope/KitScope.js";import"./scope/index.js";import{SupportConfigContext as l}from"./shared/support/SupportConfigContext.js";import{useMemo as u}from"react";import{jsx as d}from"react/jsx-runtime";import{LazyMotion as f,domMax as p}from"motion/react";function m({children:m,i18n:h,direction:g,deposit:_,withdraw:v,storage:y,storageNamespace:b,support:x,merchantContext:S,attribution:C=`visible`,...w}){let T=n(h?.locale),E=m;v&&(E=d(a,{children:d(o,{driver:v,children:d(s,{children:E})})})),_&&(E=d(t,{driver:_,children:d(i,{children:E})}));let D=u(()=>({config:x,merchantContext:S??null}),[x,S]),O=x!==void 0||S!==void 0,k=d(r,{locale:h?.locale,messages:h?.messages,children:d(c,{...w,direction:g??T,locale:h?.locale,attribution:C,children:d(e,{storage:y,namespace:b,children:E})})});return d(f,{features:p,children:O?d(l.Provider,{value:D,children:k}):k})}export{m as KitProvider};
1
+ "use client";import{KitStorageProvider as e}from"./storage/context.js";import"./storage/index.js";import{DepositDriverProvider as t}from"./flows/deposit/driver/context.js";import{getLocaleDirection as n}from"./shared/i18n/getLocaleDirection.js";import{KitI18nProvider as r}from"./shared/i18n/KitI18nProvider.js";import"./i18n/index.js";import{GatewayController as i}from"./flows/deposit/orchestrator/controller.js";import{WithdrawBindingsProvider as a}from"./flows/withdraw/bindings/WithdrawBindings.js";import"./flows/withdraw/bindings/index.js";import{WithdrawDriverProvider as o}from"./flows/withdraw/driver/context.js";import{WithdrawControllerProvider as s}from"./flows/withdraw/orchestrator/controller.js";import{KitScope as c}from"./scope/KitScope.js";import"./scope/index.js";import{SupportConfigContext as l}from"./shared/support/SupportConfigContext.js";import{useMemo as u}from"react";import{jsx as d}from"react/jsx-runtime";import{LazyMotion as f,domMax as p}from"motion/react";function m({children:m,i18n:h,direction:g,deposit:_,depositMethods:v,withdraw:y,storage:b,storageNamespace:x,support:S,merchantContext:C,attribution:w=`visible`,...T}){let E=n(h?.locale),D=m;y&&(D=d(a,{children:d(o,{driver:y,children:d(s,{children:D})})})),_&&(D=d(t,{driver:_,children:d(i,{methodsConfig:v,children:D})}));let O=u(()=>({config:S,merchantContext:C??null}),[S,C]),k=S!==void 0||C!==void 0,A=d(r,{locale:h?.locale,messages:h?.messages,children:d(c,{...T,direction:g??E,locale:h?.locale,attribution:w,children:d(e,{storage:b,namespace:x,children:D})})});return d(f,{features:p,children:k?d(l.Provider,{value:O,children:A}):A})}export{m as KitProvider};
@@ -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 d(b)}function C(){return x().state}function w(){return x().effectiveState}function T(){return x().actions}function E({children:t}){let n=e(),[r,a]=h(c,s),o=O(r,a,n);k(r,a,n),A(r,a,n);let l=i(r),u=D(r,a,n,o);return _(b,{value:m(()=>({state:r,effectiveState:l,dispatch:a,controller:u,actions:o}),[r,l,u,o]),children:t})}function D(e,t,n,r){let i=g(n);i.current=n;let a=f(e=>{if(!e)return t({type:`OPEN`,input:void 0}),!0;if(e.method===`transfer`)return t({type:`OPEN`,input:{method:`transfer`}}),!0;if(e.method===`wallet`&&e.assetId!==void 0){let n=l(i.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]),o=f(()=>{t({type:`CLOSE`})},[t]);return m(()=>({open:a,close:o,actions:r}),[a,o,r])}function O(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=M(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 k(e,t,r){p(()=>{if(e.name!==`confirmDeposit`||e.ctx.phase.kind!==`loading`&&e.ctx.phase.kind!==`regenerating`)return;let i=new AbortController,a=j(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 A(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 j(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 M(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{E as GatewayController,x as useControllerContext,T as useDepositActions,w as useDepositEffectiveState,C as useDepositState,S as useOptionalControllerContext};
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 };
@@ -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 i}from"../../../../shared/icons/QrCodeIcon.js";import{WalletIcon as a}from"../../../../shared/icons/WalletIcon.js";import"../../../../icons/index.js";import{DialogShell as o}from"../../../../shared/dialog/DialogShell.js";import{Image as s}from"../../../../shared/ui/Image/Image.js";import{Skeleton as c}from"../../../../shared/ui/Skeleton/Skeleton.js";import"../../../../shared/ui/Skeleton/index.js";import{TokenLogo as l}from"../../../../shared/ui/TokenLogo/TokenLogo.js";import"../../../../shared/ui/TokenLogo/index.js";import"../../../../ui/index.js";import{Deposit as u}from"./compound/Deposit.js";import"./compound/index.js";import{useMemo as d}from"react";import{jsx as f,jsxs as p}from"react/jsx-runtime";const m={width:18,height:18,"aria-hidden":!0};function h(o){let s=e(),l=r().name,{selectMethod:h}=n(),{_}=t(),v=s.wallet,y=v.status===`ready`||v.status===`stale`?v.payload:void 0,b=y!==void 0,x=s.brand,S=x.status===`ready`||x.status===`stale`?x.payload:void 0,C=s.addresses,w=C.status===`ready`||C.status===`stale`?C.payload:[],T=s.balances.status===`error`,E=!y?.balanceTotalUsd?.formatted&&!T,D=!!s.brand,O=S?.name?_({id:`ogD_nm`,message:`Deposit to {0}`,values:{0:S.name}}):void 0,k=d(()=>g(w),[w]),A=d(()=>{let e=b?y?.balanceTotalUsd?.formatted?y.balanceTotalUsd.formatted:T?void 0:f(c,{width:56,height:12}):_({id:`5AApJw`,message:`Connect a wallet to continue`}),t=[{id:`wallet`,title:_({id:`sb9Y58`,message:`Wallet`}),icon:f(a,{...m}),...y?{titleAdornment:y.address.formatted}:{},meta:e,recommended:!0,disabled:!b||E,onSelect:()=>h(`wallet`)}];return D&&t.push({id:`transfer`,title:_({id:`3dqPLT`,message:`Transfer Crypto`}),icon:f(i,{...m}),meta:[_({id:`qtoOYG`,message:`No limit`}),_({id:`D79cZK`,message:`Instant`})],...k?{trailing:k}:{},onSelect:()=>h(`transfer`)}),t},[y,T,E,b,D,k,h,_]);return l===`deposit`?p(u,{...o,...O?{title:O}:{},methods:A,children:[f(u.Header,{}),f(u.Body,{children:f(u.Methods,{})})]}):null}function g(e){if(e.length!==0)return f(s.Group,{max:4,overflow:Math.max(0,e.length-4),size:`md`,children:e.map(e=>f(l,{isNative:!0,symbol:e.networkName,...e.eip155Id?{chainId:Number(e.eip155Id)}:{},...e.chainLogoUrl?{logoUrl:e.chainLogoUrl}:{},hideChainBadge:!0},e.eip155Id??e.networkName))})}function _({open:e,defaultOpen:t,onOpenChange:n,trigger:r,...i}){return f(o,{open:e,defaultOpen:t,onOpenChange:n,trigger:r,children:f(h,{...i})})}(function(e){e.Dialog=_})(h||={});export{h as Deposit};
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":a,"data-stridge-slot":r.method,"data-recommended":m||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};
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 in a half-opacity inert state — used for
40
- * "coming soon" methods. The row stays in the list for discoverability
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
  }
@@ -1,7 +1,7 @@
1
1
  import { TxRef } from "../../../shared/driver/types.js";
2
+ import { FailureInfo } from "../../../shared/orchestrator/types.js";
2
3
  import { WithdrawalQuotePayload, WithdrawalSettlementFailurePayload, WithdrawalSettlementPendingPayload, WithdrawalSettlementSuccessPayload } from "../driver/payloads.js";
3
4
  import { PrepareWithdrawalInput } from "../driver/types.js";
4
- import { FailureInfo } from "../../../shared/orchestrator/types.js";
5
5
  import { WithdrawStateName, WithdrawSubmitCallback } from "../orchestrator/types.js";
6
6
  import { WithdrawBalanceInput, WithdrawSuggestedRecipient } from "../bindings/WithdrawBindings.js";
7
7
  import { WithdrawFormEventCallbacks } from "./WithdrawDialogEventsContext.js";
@@ -1,8 +1,7 @@
1
1
  import { TxRef } from "../../../shared/driver/types.js";
2
+ import { FailureInfo } from "../../../shared/orchestrator/types.js";
2
3
  import { WithdrawalQuotePayload } from "../driver/payloads.js";
3
4
  import { WithdrawPreparation } from "../driver/types.js";
4
- import { FailureInfo } from "../../../shared/orchestrator/types.js";
5
-
6
5
  //#region src/flows/withdraw/orchestrator/types.d.ts
7
6
  /**
8
7
  * Form values captured at submit time. The orchestrator carries this snapshot through every
package/dist/index.d.ts CHANGED
@@ -1,6 +1,8 @@
1
1
  import { TxRef } from "./shared/driver/types.js";
2
2
  import { DepositSnapshot } from "./flows/deposit/driver/types.js";
3
3
  import { useDepositSnapshot } from "./flows/deposit/driver/context.js";
4
+ import { FailureInfo } from "./shared/orchestrator/types.js";
5
+ import { DepositActions, DepositController, DepositMethod, DepositMethodConfig, DepositMethodsConfig, DepositState, DepositStateName, OpenInput } from "./flows/deposit/orchestrator/types.js";
4
6
  import { ChainType, isValidAddressForChainType, isValidEvmAddress, isValidTronAddress, toChainType } from "./shared/chains/index.js";
5
7
  import { WithdrawSnapshot } from "./flows/withdraw/driver/types.js";
6
8
  import { useWithdrawSnapshot } from "./flows/withdraw/driver/context.js";
@@ -12,8 +14,6 @@ import { createLocalStorageAdapter, createMemoryStorageAdapter, createSessionSto
12
14
  import { createKitStorage } from "./storage/createKitStorage.js";
13
15
  import { DEFAULT_KIT_STORAGE_NAMESPACE, KitStorageProvider, useKitStorage, useKitStorageValue } from "./storage/context.js";
14
16
  import { StridgeEnvironment } from "./drivers/stridge/types.js";
15
- import { FailureInfo } from "./shared/orchestrator/types.js";
16
- import { DepositActions, DepositController, DepositMethod, DepositState, DepositStateName, OpenInput } from "./flows/deposit/orchestrator/types.js";
17
17
  import { WithdrawActions, WithdrawController, WithdrawState, WithdrawStateName, WithdrawSubmitActions, WithdrawSubmitCallback, WithdrawSubmitInput, WithdrawalFormSnapshot } from "./flows/withdraw/orchestrator/types.js";
18
18
  import { WithdrawBalanceInput, WithdrawBindings, WithdrawSuggestedRecipient, useWithdrawBindings } from "./flows/withdraw/bindings/WithdrawBindings.js";
19
19
  import { ChainLogoMeta } from "./shared/utils/logos/chains.js";
@@ -25,5 +25,5 @@ import { useDeposit, useOptionalDeposit } from "./flows/deposit/orchestrator/use
25
25
  import { useWithdrawState } from "./flows/withdraw/orchestrator/controller.js";
26
26
  import { useOptionalWithdraw, useWithdraw } from "./flows/withdraw/orchestrator/useWithdraw.js";
27
27
  import { useOptionalStridge, useStridge } from "./stridge/StridgeContext.js";
28
- import { StridgeAppearance, StridgeAsset, StridgeDepositDestination, StridgeDepositFlowConfig, StridgeFlowOwner, StridgeProvider, StridgeStorageConfig, StridgeWithdrawFlowConfig } from "./stridge/StridgeProvider.js";
29
- export { type BannerAckBucket, type ChainLogoInput, type ChainLogoMeta, type ChainType, DEFAULT_KIT_STORAGE_NAMESPACE, type DepositActions, type DepositController, type DepositMethod, type OpenInput as DepositOpenInput, type DepositSnapshot, type DepositState, type DepositStateName, type FailureInfo, type IntercomMerchantContext, KitPortalScope, KitStorageProvider, type LogosNamespace, type StridgeAppearance, type StridgeAsset, type StridgeDepositDestination, type StridgeDepositFlowConfig, type StridgeEnvironment, type StridgeFlowOwner, StridgeProvider, type StridgeStorageConfig, type StridgeWithdrawFlowConfig, type SupportConfig, type SupportOpenContext, type TokenLogoInput, type TxRef, type WithdrawActions, type WithdrawBalanceInput, type WithdrawBindings, type WithdrawController, type WithdrawSnapshot, type WithdrawState, type WithdrawStateName, type WithdrawSubmitActions, type WithdrawSubmitCallback, type WithdrawSubmitInput, type WithdrawSuggestedRecipient, type WithdrawalFormSnapshot, bannerAckStorageKey, bucketFromSettlement, createKitStorage, createLocalStorageAdapter, createMemoryStorageAdapter, createSessionStorageAdapter, isValidAddressForChainType, isValidEvmAddress, isValidTronAddress, logos, resolveStorageAdapter, toChainType, useBannerAck, useBannerAckForSettlement, useDeposit, useDepositSnapshot, useDepositState, useKitConfig, useKitStorage, useKitStorageValue, useOptionalDeposit, useOptionalStridge, useOptionalWithdraw, useStridge, useWithdraw, useWithdrawBindings, useWithdrawSnapshot, useWithdrawState };
28
+ import { StridgeAppearance, StridgeAsset, StridgeDepositDestination, StridgeDepositFlowConfig, StridgeDepositMethodConfig, StridgeDepositMethodsConfig, StridgeFlowOwner, StridgeProvider, StridgeStorageConfig, StridgeWithdrawFlowConfig } from "./stridge/StridgeProvider.js";
29
+ export { type BannerAckBucket, type ChainLogoInput, type ChainLogoMeta, type ChainType, DEFAULT_KIT_STORAGE_NAMESPACE, type DepositActions, type DepositController, type DepositMethod, type DepositMethodConfig, type DepositMethodsConfig, type OpenInput as DepositOpenInput, type DepositSnapshot, type DepositState, type DepositStateName, type FailureInfo, type IntercomMerchantContext, KitPortalScope, KitStorageProvider, type LogosNamespace, type StridgeAppearance, type StridgeAsset, type StridgeDepositDestination, type StridgeDepositFlowConfig, type StridgeDepositMethodConfig, type StridgeDepositMethodsConfig, type StridgeEnvironment, type StridgeFlowOwner, StridgeProvider, type StridgeStorageConfig, type StridgeWithdrawFlowConfig, type SupportConfig, type SupportOpenContext, type TokenLogoInput, type TxRef, type WithdrawActions, type WithdrawBalanceInput, type WithdrawBindings, type WithdrawController, type WithdrawSnapshot, type WithdrawState, type WithdrawStateName, type WithdrawSubmitActions, type WithdrawSubmitCallback, type WithdrawSubmitInput, type WithdrawSuggestedRecipient, type WithdrawalFormSnapshot, bannerAckStorageKey, bucketFromSettlement, createKitStorage, createLocalStorageAdapter, createMemoryStorageAdapter, createSessionStorageAdapter, isValidAddressForChainType, isValidEvmAddress, isValidTronAddress, logos, resolveStorageAdapter, toChainType, useBannerAck, useBannerAckForSettlement, useDeposit, useDepositSnapshot, useDepositState, useKitConfig, useKitStorage, useKitStorageValue, useOptionalDeposit, useOptionalStridge, useOptionalWithdraw, useStridge, useWithdraw, useWithdrawBindings, useWithdrawSnapshot, useWithdrawState };
package/dist/package.js CHANGED
@@ -1 +1 @@
1
- var e=`0.1.0-alpha.27`;export{e as version};
1
+ var e=`0.1.0-alpha.29`;export{e as version};
@@ -1,3 +1,4 @@
1
+ import { DepositMethodConfig, DepositMethodsConfig } from "../flows/deposit/orchestrator/types.js";
1
2
  import { KitI18nConfig } from "../shared/i18n/createKitI18n.js";
2
3
  import { SupportConfig } from "../shared/support/types.js";
3
4
  import { StridgeEnvironment } from "../drivers/stridge/types.js";
@@ -71,7 +72,44 @@ interface StridgeDepositFlowConfig {
71
72
  * and webhook payloads. Treat as untrusted display data.
72
73
  */
73
74
  metadata?: Record<string, unknown>;
75
+ /**
76
+ * Per-method host disable lever for the deposit-method picker. The kit ships no built-in
77
+ * inference (embedded-wallet detection, KYC tier, region, …) — the host decides eligibility
78
+ * and passes `{ disabled: true, disabledHint: "…" }` per method. Disabled tiles stay in the
79
+ * picker (preserves "I can see my options" UX), render natively disabled, and show
80
+ * `disabledHint` inline as the tile's meta line — replacing the address+balance reading on
81
+ * the wallet tile and the `"No limit · Instant"` reading on the transfer tile so the
82
+ * explanation is unmissable. Omitting the field keeps both methods enabled.
83
+ *
84
+ * @example
85
+ * ```tsx
86
+ * <StridgeProvider
87
+ * flows={{
88
+ * deposit: {
89
+ * destination: { address: treasuryAddress },
90
+ * methods: {
91
+ * wallet: isEmbeddedWallet
92
+ * ? { disabled: true, disabledHint: "Use Transfer Crypto, or connect an external wallet to pay from a wallet balance." }
93
+ * : undefined,
94
+ * },
95
+ * },
96
+ * }}
97
+ * >
98
+ * ```
99
+ */
100
+ methods?: StridgeDepositMethodsConfig;
74
101
  }
102
+ /**
103
+ * Host-supplied disable lever for a single payment method on the deposit-method picker. Identical
104
+ * shape to the kit-internal {@link DepositMethodConfig} — re-exported under a Stridge-prefixed
105
+ * name so all `flows.deposit.*` types live alongside the provider.
106
+ */
107
+ type StridgeDepositMethodConfig = DepositMethodConfig;
108
+ /**
109
+ * Per-method host configuration for the deposit picker. Omitting a method keeps default behavior.
110
+ * Re-export of {@link DepositMethodsConfig} under a Stridge-prefixed name.
111
+ */
112
+ type StridgeDepositMethodsConfig = DepositMethodsConfig;
75
113
  /**
76
114
  * Per-flow withdraw tuning.
77
115
  */
@@ -239,4 +277,4 @@ declare function StridgeProvider({
239
277
  children
240
278
  }: StridgeProvider.Props): _$react_jsx_runtime0.JSX.Element;
241
279
  //#endregion
242
- export { StridgeAppearance, StridgeAsset, StridgeDepositDestination, StridgeDepositFlowConfig, StridgeFlowOwner, StridgeProvider, StridgeStorageConfig, StridgeWithdrawFlowConfig };
280
+ export { StridgeAppearance, StridgeAsset, StridgeDepositDestination, StridgeDepositFlowConfig, StridgeDepositMethodConfig, StridgeDepositMethodsConfig, StridgeFlowOwner, StridgeProvider, StridgeStorageConfig, StridgeWithdrawFlowConfig };
@@ -1 +1 @@
1
- "use client";import{createKitI18n as e}from"../shared/i18n/createKitI18n.js";import"../i18n/index.js";import{StridgeContext as t}from"./StridgeContext.js";import{createStridgeDepositDriver as n}from"../drivers/stridge/createStridgeDepositDriver.js";import{createStridgeWithdrawDriver as r}from"../drivers/stridge/createStridgeWithdrawDriver.js";import"../_internal/drivers/stridge/index.js";import{KitProvider as i}from"../KitProvider.js";import{resolveSupport as a}from"../shared/support/resolveSupport.js";import{useIntercomMerchantContext as o}from"../shared/support/useIntercomMerchantContext.js";import{useMerchantContext as s}from"../shared/support/useMerchantContext.js";import"../shared/support/index.js";import{useOptionalWagmi as c}from"./optionalWagmi.js";import{createStubDepositDriver as l,createStubWithdrawDriver as u}from"./stubs.js";import{useMemo as d,useRef as f,useSyncExternalStore as p}from"react";import{jsx as m}from"react/jsx-runtime";function h({gatewayKey:h,environment:g,asset:_,flows:v,appearance:y,i18n:b,storage:x,dev:S,support:C,className:w,children:T}){if(!v.deposit&&!v.withdraw)throw Error("<StridgeProvider /> requires at least one of `flows.deposit` or `flows.withdraw`.");if(!_)throw Error("<StridgeProvider /> requires `asset: { networkId, symbol }`.");let{config:E,address:D}=c(),O=d(()=>e(b??{}),[b?.locale,b?.messages]),k=f(O);k.current=O;let A=_.networkId,j=_.symbol,M=v.deposit,N=v.withdraw,P=M?.owner?.address??D??S?.userAddressOverride,F=N?.owner.address,I=d(()=>{if(!(!M||!P))return n({userAddress:P,projectKey:h,destination:{network_id:A,asset_symbol:j,to_address:M.destination.address},wagmiConfig:E,getI18n:()=>k.current,...g?{environment:g}:{},...M.minDepositUsd===void 0?{}:{minDepositUsd:M.minDepositUsd},...M.metadata?{metadata:M.metadata}:{}})},[M,P,h,g,A,j,E]),L=d(()=>l(),[]),R=M?I??L:void 0,z=d(()=>{if(!(!N||!F))return r({userAddress:F,projectKey:h,currency:{networkId:A,assetSymbol:j},wagmiConfig:E,getI18n:()=>k.current,...g?{environment:g}:{},...N.metadata?{metadata:N.metadata}:{}})},[N,F,h,g,A,j,E]),B=d(()=>u(),[]),V=N?z??B:void 0,H=I??z,U=p(e=>H?.subscribe(e)??(()=>{}),()=>{if(I){let e=I.getSnapshot();return e.brand.status===`ready`&&e.target.status===`ready`}return z?z.getSnapshot().receiveOptions.status===`ready`:!1},()=>!1),W=P??F,G=s({gatewayKey:h,environment:g??`production`,assetChain:A,assetSymbol:j,...W?{userAddress:W}:{},...I?{depositDriver:I}:{}});return o(a(C).kind===`stridge`?G:null),m(t,{value:d(()=>({isReady:U,driver:I}),[U,I]),children:m(i,{theme:y?.theme,accent:y?.accent,radius:y?.radius,direction:y?.direction,attribution:y?.attribution,i18n:b,storage:x?.driver,storageNamespace:x?.namespace,className:w,support:C,merchantContext:G,...R?{deposit:R}:{},...V?{withdraw:V}:{},children:T})})}export{h as StridgeProvider};
1
+ "use client";import{createKitI18n as e}from"../shared/i18n/createKitI18n.js";import"../i18n/index.js";import{StridgeContext as t}from"./StridgeContext.js";import{createStridgeDepositDriver as n}from"../drivers/stridge/createStridgeDepositDriver.js";import{createStridgeWithdrawDriver as r}from"../drivers/stridge/createStridgeWithdrawDriver.js";import"../_internal/drivers/stridge/index.js";import{KitProvider as i}from"../KitProvider.js";import{resolveSupport as a}from"../shared/support/resolveSupport.js";import{useIntercomMerchantContext as o}from"../shared/support/useIntercomMerchantContext.js";import{useMerchantContext as s}from"../shared/support/useMerchantContext.js";import"../shared/support/index.js";import{useOptionalWagmi as c}from"./optionalWagmi.js";import{createStubDepositDriver as l,createStubWithdrawDriver as u}from"./stubs.js";import{useMemo as d,useRef as f,useSyncExternalStore as p}from"react";import{jsx as m}from"react/jsx-runtime";function h({gatewayKey:h,environment:g,asset:_,flows:v,appearance:y,i18n:b,storage:x,dev:S,support:C,className:w,children:T}){if(!v.deposit&&!v.withdraw)throw Error("<StridgeProvider /> requires at least one of `flows.deposit` or `flows.withdraw`.");if(!_)throw Error("<StridgeProvider /> requires `asset: { networkId, symbol }`.");let{config:E,address:D}=c(),O=d(()=>e(b??{}),[b?.locale,b?.messages]),k=f(O);k.current=O;let A=_.networkId,j=_.symbol,M=v.deposit,N=v.withdraw,P=M?.owner?.address??D??S?.userAddressOverride,F=N?.owner.address,I=d(()=>{if(!(!M||!P))return n({userAddress:P,projectKey:h,destination:{network_id:A,asset_symbol:j,to_address:M.destination.address},wagmiConfig:E,getI18n:()=>k.current,...g?{environment:g}:{},...M.minDepositUsd===void 0?{}:{minDepositUsd:M.minDepositUsd},...M.metadata?{metadata:M.metadata}:{}})},[M,P,h,g,A,j,E]),L=d(()=>l(),[]),R=M?I??L:void 0,z=d(()=>{if(!(!N||!F))return r({userAddress:F,projectKey:h,currency:{networkId:A,assetSymbol:j},wagmiConfig:E,getI18n:()=>k.current,...g?{environment:g}:{},...N.metadata?{metadata:N.metadata}:{}})},[N,F,h,g,A,j,E]),B=d(()=>u(),[]),V=N?z??B:void 0,H=I??z,U=p(e=>H?.subscribe(e)??(()=>{}),()=>{if(I){let e=I.getSnapshot();return e.brand.status===`ready`&&e.target.status===`ready`}return z?z.getSnapshot().receiveOptions.status===`ready`:!1},()=>!1),W=P??F,G=s({gatewayKey:h,environment:g??`production`,assetChain:A,assetSymbol:j,...W?{userAddress:W}:{},...I?{depositDriver:I}:{}});return o(a(C).kind===`stridge`?G:null),m(t,{value:d(()=>({isReady:U,driver:I}),[U,I]),children:m(i,{theme:y?.theme,accent:y?.accent,radius:y?.radius,direction:y?.direction,attribution:y?.attribution,i18n:b,storage:x?.driver,storageNamespace:x?.namespace,className:w,support:C,merchantContext:G,...R?{deposit:R}:{},...M?.methods?{depositMethods:M.methods}:{},...V?{withdraw:V}:{},children:T})})}export{h as StridgeProvider};
package/dist/types.d.ts CHANGED
@@ -1,14 +1,14 @@
1
1
  import { Entity, SettlementFailureKind, TxRef } from "./shared/driver/types.js";
2
2
  import { AcceptedAssetPayload, AddressItemPayload, AssetPayload, BalanceItemPayload, BrandPayload, ChainPayload, QuoteBreakdownPayload, QuotePayload, QuoteRoutePayload, SettlementFailurePayload, SettlementPayload, SettlementPendingPayload, SettlementSuccessPayload, SourceWalletPayload, TargetPayload, WalletInfo, WalletPayload } from "./flows/deposit/driver/payloads.js";
3
3
  import { DepositSnapshot } from "./flows/deposit/driver/types.js";
4
+ import { FailureInfo } from "./shared/orchestrator/types.js";
5
+ import { ConfirmDepositPhase, DepositActions, DepositController, DepositMethod, DepositState, DepositStateName, GatewayEvent, OpenInput, ResolvedOpenInput, RetryTargetSpec } from "./flows/deposit/orchestrator/types.js";
4
6
  import { ReceiveOptionDto, ReceiveOptionsResponse, WithdrawableBalanceDto, WithdrawableBalancesResponse, WithdrawalQuoteDto, WithdrawalQuoteResponse, WithdrawalSettlementDto, WithdrawalSettlementResponse } from "./flows/withdraw/driver/dto.js";
5
7
  import { ReceiveChainPayload, ReceiveTokenOptionPayload, WithdrawableBalanceItemPayload, WithdrawalQuoteBreakdownPayload, WithdrawalQuotePayload, WithdrawalReceiveAssetPayload, WithdrawalSettlementFailurePayload, WithdrawalSettlementPayload, WithdrawalSettlementPendingPayload, WithdrawalSettlementSuccessPayload } from "./flows/withdraw/driver/payloads.js";
6
8
  import { WithdrawSnapshot } from "./flows/withdraw/driver/types.js";
7
9
  import { KitConfig, KitDirection, KitRadius, KitTarget, KitTheme } from "./scope/context.js";
8
10
  import { KitStorageAdapter, KitStoragePersistence } from "./storage/types.js";
9
11
  import { KitStorage } from "./storage/createKitStorage.js";
10
- import { FailureInfo } from "./shared/orchestrator/types.js";
11
- import { ConfirmDepositPhase, DepositActions, DepositController, DepositMethod, DepositState, DepositStateName, GatewayEvent, OpenInput, ResolvedOpenInput, RetryTargetSpec } from "./flows/deposit/orchestrator/types.js";
12
12
  import { WithdrawActions, WithdrawController, WithdrawEvent, WithdrawState, WithdrawStateName, WithdrawSubmitActions, WithdrawSubmitCallback, WithdrawSubmitInput, WithdrawalFormSnapshot } from "./flows/withdraw/orchestrator/types.js";
13
13
  import { WithdrawBalanceInput, WithdrawBindings, WithdrawSuggestedRecipient } from "./flows/withdraw/bindings/WithdrawBindings.js";
14
14
  import { BannerAckBucket } from "./banners/useBannerAck.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stridge/kit",
3
- "version": "0.1.0-alpha.27",
3
+ "version": "0.1.0-alpha.29",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "files": [