@stridge/kit 0.1.0-alpha.26 → 0.1.0-alpha.28
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/KitProvider.d.ts +9 -0
- package/dist/KitProvider.js +1 -1
- package/dist/flows/deposit/orchestrator/controller.js +1 -1
- package/dist/flows/deposit/orchestrator/types.d.ts +27 -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/Deposit.styles.js +1 -1
- package/dist/flows/deposit/widgets/deposit/compound/components/Method.d.ts +7 -0
- package/dist/flows/deposit/widgets/deposit/compound/components/Method.js +1 -1
- package/dist/flows/deposit/widgets/deposit/compound/types.d.ts +7 -0
- 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/withdraw/dialog/WithdrawDialog.d.ts +1 -1
- package/dist/flows/withdraw/orchestrator/controller.js +1 -1
- package/dist/flows/withdraw/orchestrator/index.d.ts +1 -1
- package/dist/flows/withdraw/orchestrator/types.d.ts +1 -2
- package/dist/flows/withdraw/orchestrator/useWithdraw.d.ts +18 -1
- package/dist/flows/withdraw/orchestrator/useWithdraw.js +1 -1
- package/dist/index.d.ts +6 -6
- package/dist/index.js +1 -1
- package/dist/package.js +1 -1
- package/dist/shared/dialog/StepTransition.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/stridge/StridgeProvider.d.ts +37 -1
- package/dist/stridge/StridgeProvider.js +1 -1
- package/dist/types.d.ts +2 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -47,7 +47,7 @@ import { WithdrawDialog } from "@stridge/kit/withdraw/dialog";
|
|
|
47
47
|
</StridgeProvider>;
|
|
48
48
|
```
|
|
49
49
|
|
|
50
|
-
Open or close the dialogs with `useDeposit().open()` / `useWithdraw().open()`. Headless integrators render their own UI via `useDeposit()`, `useDepositState()`, `useDepositSnapshot()` and the withdraw mirrors — the root entry ships no UI, so the headless bundle stays clean.
|
|
50
|
+
Open or close the dialogs with `useDeposit().open()` / `useWithdraw().open()`. Headless integrators render their own UI via `useDeposit()`, `useDepositState()`, `useDepositSnapshot()` and the withdraw mirrors — the root entry ships no UI, so the headless bundle stays clean. `useOptionalDeposit()` / `useOptionalWithdraw()` return `null` when called outside the provider, for hosts that mount `<StridgeProvider />` conditionally (e.g. only after a wallet is connected).
|
|
51
51
|
|
|
52
52
|
## Documentation
|
|
53
53
|
|
package/dist/KitProvider.d.ts
CHANGED
|
@@ -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,13 @@ 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
|
+
* muted tile with an optional `disabledHint` tooltip.
|
|
80
|
+
*/
|
|
81
|
+
depositMethods?: DepositMethodsConfig;
|
|
73
82
|
/**
|
|
74
83
|
* Host-supplied {@link WithdrawDriver} — source of reactive data + imperative actions for
|
|
75
84
|
* the withdraw flow. When supplied, the provider mounts the withdraw driver context and
|
package/dist/KitProvider.js
CHANGED
|
@@ -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";function
|
|
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 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,32 @@ 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) but is rendered muted, can't be selected, and surfaces `disabledHint` on
|
|
17
|
+
* hover/focus and to assistive tech.
|
|
18
|
+
*/
|
|
19
|
+
interface DepositMethodConfig {
|
|
20
|
+
/** When true, the method is rendered visually muted and can't be selected. */
|
|
21
|
+
disabled?: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Plain-text hint shown when the user hovers, focuses, or taps a disabled tile. Also folded
|
|
24
|
+
* into the tile's accessible name so screen readers convey the reason. Ignored when
|
|
25
|
+
* `disabled` is falsy.
|
|
26
|
+
*/
|
|
27
|
+
disabledHint?: string;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Per-method host configuration for the deposit picker. Omitting a method (or the whole object)
|
|
31
|
+
* keeps default behavior; supply `{ disabled: true, disabledHint: "…" }` to mark an option as
|
|
32
|
+
* unavailable for the current user.
|
|
33
|
+
*/
|
|
34
|
+
interface DepositMethodsConfig {
|
|
35
|
+
wallet?: DepositMethodConfig;
|
|
36
|
+
transfer?: DepositMethodConfig;
|
|
37
|
+
}
|
|
12
38
|
/**
|
|
13
39
|
* Confirm-deposit phase sub-union. Drives the confirm-deposit widget's hero / footer chrome.
|
|
14
40
|
* Phase data is pure navigation; the actual quote payload comes from the driver's `quote` entity.
|
|
@@ -263,4 +289,4 @@ interface DepositActions {
|
|
|
263
289
|
resumeToError(tx?: TxRef): void;
|
|
264
290
|
}
|
|
265
291
|
//#endregion
|
|
266
|
-
export { ConfirmDepositPhase, DepositActions, DepositController, DepositMethod, DepositState, DepositStateName, GatewayEvent, OpenInput, ResolvedOpenInput, RetryTargetSpec };
|
|
292
|
+
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?x?.balanceTotalUsd?.formatted?x.balanceTotalUsd.formatted:D?void 0:p(l,{width:56,height:12}):y({id:`5AApJw`,message:`Connect a wallet to continue`}),t=!S||O,n=M?.disabled??!1,r=t||n,i=n?M?.disabledHint:void 0,s=[{id:`wallet`,title:y({id:`sb9Y58`,message:`Wallet`}),icon:p(o,{...h}),...x?{titleAdornment:x.address.formatted}:{},meta:e,recommended:!0,disabled:r,...i?{disabledHint:i}:{},onSelect:r?void 0:()=>g(`wallet`)}];if(k){let e=N?.disabled??!1,t=e?N?.disabledHint:void 0;s.push({id:`transfer`,title:y({id:`3dqPLT`,message:`Transfer Crypto`}),icon:p(a,{...h}),meta:[y({id:`qtoOYG`,message:`No limit`}),y({id:`D79cZK`,message:`Instant`})],...j?{trailing:j}:{},disabled:e,...t?{disabledHint:t}:{},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};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e={root:{"Deposit__styles.root":`Deposit__styles.root`,"position-kVAEAm":`x1n2onr6`,"width-kzqmXN":`xh8yej3`,"maxWidth-ks0D6T":`x17fpy1y`,$$css:`@stridge/kit:src/flows/deposit/widgets/deposit/compound/Deposit.styles.ts:17`},header:{"Deposit__styles.header":`Deposit__styles.header`,"justifyContent-kjj79g":`x1qughib`,$$css:`@stridge/kit:src/flows/deposit/widgets/deposit/compound/Deposit.styles.ts:25`},closeIcon:{"Deposit__styles.closeIcon":`Deposit__styles.closeIcon`,"color-kMwMTN":`xdksllq`,"strokeWidth-kfJifR":`x1k315e8`,$$css:`@stridge/kit:src/flows/deposit/widgets/deposit/compound/Deposit.styles.ts:28`},section:{"Deposit__styles.section":`Deposit__styles.section`,"display-k1xSpc":`x78zum5`,"flexDirection-kXwgrk":`xdt5ytf`,"gap-kOIVth":`x883omv`,"paddingInlineEnd-kwRFfy":`x1o5r3ls`,"paddingInlineStart-kZCmMZ":`xz7312c`,$$css:`@stridge/kit:src/flows/deposit/widgets/deposit/compound/Deposit.styles.ts:33`},sectionMethods:{"Deposit__styles.sectionMethods":`Deposit__styles.sectionMethods`,"paddingTop-kLKAdn":`x1cnzs8`,"paddingBottom-kGO01o":`x1t4gjm`,$$css:`@stridge/kit:src/flows/deposit/widgets/deposit/compound/Deposit.styles.ts:40`},methodsList:{"Deposit__styles.methodsList":`Deposit__styles.methodsList`,"display-k1xSpc":`x78zum5`,"flexDirection-kXwgrk":`xdt5ytf`,"gap-kOIVth":`x167g77z`,$$css:`@stridge/kit:src/flows/deposit/widgets/deposit/compound/Deposit.styles.ts:45`},methodRow:{"Deposit__styles.methodRow":`Deposit__styles.methodRow`,"gap-kOIVth":`x1af02g3`,"paddingInlineStart-kZCmMZ":`xwn43p0`,$$css:`@stridge/kit:src/flows/deposit/widgets/deposit/compound/Deposit.styles.ts:56`},methodIconSlot:{"Deposit__styles.methodIconSlot":`Deposit__styles.methodIconSlot`,"display-k1xSpc":`x78zum5`,"alignItems-kGNEyG":`x6s0dn4`,"justifyContent-kjj79g":`xl56j7k`,"width-kzqmXN":`x14qfxbe`,"height-kZKoxP":`xc9qbxq`,"flexShrink-kmuXW":`x2lah0s`,"borderRadius-kaIpWk":`xi9trdq`,"backgroundColor-kWkggS":`xp5aqsh`,"borderWidth-kMzoRj":`xmkeg23`,"borderStyle-ksu8eU":`x1y0btm7`,"borderColor-kVAM5u":`x1bue7yx`,"color-kMwMTN":`xzn0pkc`,$$css:`@stridge/kit:src/flows/deposit/widgets/deposit/compound/Deposit.styles.ts:
|
|
1
|
+
const e={root:{"Deposit__styles.root":`Deposit__styles.root`,"position-kVAEAm":`x1n2onr6`,"width-kzqmXN":`xh8yej3`,"maxWidth-ks0D6T":`x17fpy1y`,$$css:`@stridge/kit:src/flows/deposit/widgets/deposit/compound/Deposit.styles.ts:17`},header:{"Deposit__styles.header":`Deposit__styles.header`,"justifyContent-kjj79g":`x1qughib`,$$css:`@stridge/kit:src/flows/deposit/widgets/deposit/compound/Deposit.styles.ts:25`},closeIcon:{"Deposit__styles.closeIcon":`Deposit__styles.closeIcon`,"color-kMwMTN":`xdksllq`,"strokeWidth-kfJifR":`x1k315e8`,$$css:`@stridge/kit:src/flows/deposit/widgets/deposit/compound/Deposit.styles.ts:28`},section:{"Deposit__styles.section":`Deposit__styles.section`,"display-k1xSpc":`x78zum5`,"flexDirection-kXwgrk":`xdt5ytf`,"gap-kOIVth":`x883omv`,"paddingInlineEnd-kwRFfy":`x1o5r3ls`,"paddingInlineStart-kZCmMZ":`xz7312c`,$$css:`@stridge/kit:src/flows/deposit/widgets/deposit/compound/Deposit.styles.ts:33`},sectionMethods:{"Deposit__styles.sectionMethods":`Deposit__styles.sectionMethods`,"paddingTop-kLKAdn":`x1cnzs8`,"paddingBottom-kGO01o":`x1t4gjm`,$$css:`@stridge/kit:src/flows/deposit/widgets/deposit/compound/Deposit.styles.ts:40`},methodsList:{"Deposit__styles.methodsList":`Deposit__styles.methodsList`,"display-k1xSpc":`x78zum5`,"flexDirection-kXwgrk":`xdt5ytf`,"gap-kOIVth":`x167g77z`,$$css:`@stridge/kit:src/flows/deposit/widgets/deposit/compound/Deposit.styles.ts:45`},methodRow:{"Deposit__styles.methodRow":`Deposit__styles.methodRow`,"gap-kOIVth":`x1af02g3`,"paddingInlineStart-kZCmMZ":`xwn43p0`,$$css:`@stridge/kit:src/flows/deposit/widgets/deposit/compound/Deposit.styles.ts:56`},methodRowMuted:{"Deposit__styles.methodRowMuted":`Deposit__styles.methodRowMuted`,"opacity-kSiTet":`xbyyjgo`,"cursor-kkrTdU":`x1h6gzvc`,$$css:`@stridge/kit:src/flows/deposit/widgets/deposit/compound/Deposit.styles.ts:68`},methodIconSlot:{"Deposit__styles.methodIconSlot":`Deposit__styles.methodIconSlot`,"display-k1xSpc":`x78zum5`,"alignItems-kGNEyG":`x6s0dn4`,"justifyContent-kjj79g":`xl56j7k`,"width-kzqmXN":`x14qfxbe`,"height-kZKoxP":`xc9qbxq`,"flexShrink-kmuXW":`x2lah0s`,"borderRadius-kaIpWk":`xi9trdq`,"backgroundColor-kWkggS":`xp5aqsh`,"borderWidth-kMzoRj":`xmkeg23`,"borderStyle-ksu8eU":`x1y0btm7`,"borderColor-kVAM5u":`x1bue7yx`,"color-kMwMTN":`xzn0pkc`,$$css:`@stridge/kit:src/flows/deposit/widgets/deposit/compound/Deposit.styles.ts:72`},methodText:{"Deposit__styles.methodText":`Deposit__styles.methodText`,"display-k1xSpc":`x78zum5`,"flexDirection-kXwgrk":`xdt5ytf`,"flexBasis-kCS8Yb":`x1r8uery`,"flexGrow-kzQI83":`x1iyjqo2`,"flexShrink-kmuXW":`xs83m0k`,"gap-kOIVth":`x1ed6fcf`,"minWidth-k7Eaqz":`xeuugli`,$$css:`@stridge/kit:src/flows/deposit/widgets/deposit/compound/Deposit.styles.ts:86`},methodTitleRow:{"Deposit__styles.methodTitleRow":`Deposit__styles.methodTitleRow`,"display-k1xSpc":`x78zum5`,"alignItems-kGNEyG":`x6s0dn4`,"gap-kOIVth":`x167g77z`,"minWidth-k7Eaqz":`xeuugli`,$$css:`@stridge/kit:src/flows/deposit/widgets/deposit/compound/Deposit.styles.ts:95`},methodMeta:{"Deposit__styles.methodMeta":`Deposit__styles.methodMeta`,"display-k1xSpc":`x78zum5`,"flexDirection-kXwgrk":`x1q0g3np`,"alignItems-kGNEyG":`x6s0dn4`,"gap-kOIVth":`x17d4w8g`,$$css:`@stridge/kit:src/flows/deposit/widgets/deposit/compound/Deposit.styles.ts:101`},methodMetaItem:{"Deposit__styles.methodMetaItem":`Deposit__styles.methodMetaItem`,"display-k1xSpc":`x3nfvp2`,"alignItems-kGNEyG":`x6s0dn4`,"whiteSpace-khDVqt":`xuxw1ft`,$$css:`@stridge/kit:src/flows/deposit/widgets/deposit/compound/Deposit.styles.ts:107`},methodTrailing:{"Deposit__styles.methodTrailing":`Deposit__styles.methodTrailing`,"display-k1xSpc":`x78zum5`,"alignItems-kGNEyG":`x6s0dn4`,"flexShrink-kmuXW":`x2lah0s`,$$css:`@stridge/kit:src/flows/deposit/widgets/deposit/compound/Deposit.styles.ts:112`},methodChevron:{"Deposit__styles.methodChevron":`Deposit__styles.methodChevron`,"width-kzqmXN":`x6jxa94`,"height-kZKoxP":`x1v9usgg`,"flexShrink-kmuXW":`x2lah0s`,"color-kMwMTN":`xdksllq`,"strokeWidth-kfJifR":`x1k315e8`,$$css:`@stridge/kit:src/flows/deposit/widgets/deposit/compound/Deposit.styles.ts:117`},methodRecommendedBar:{"Deposit__styles.methodRecommendedBar":`Deposit__styles.methodRecommendedBar`,"position-kVAEAm":`x10l6tqk`,"top-k87sOh":`xuivejd`,"bottom-krVfgx":`xmbx2d0`,"insetInlineStart-kLqNvP":`x1o0tod`,"width-kzqmXN":`xfo62xy`,"borderStartEndRadius-kfmiAY":`x1e4oeot`,"borderEndEndRadius-kT0f0o":`x1ui04y5`,"backgroundColor-kWkggS":`xdmxa9o`,$$css:`@stridge/kit:src/flows/deposit/widgets/deposit/compound/Deposit.styles.ts:124`}};export{e as styles};
|
|
@@ -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
|
+
* When the row is `disabled` and a `disabledHint` is supplied, the tile renders in a
|
|
22
|
+
* "soft-disabled" mode — visually muted via a local opacity rule, clicks intercepted to
|
|
23
|
+
* no-op, `aria-disabled` set for assistive tech, and the whole thing wrapped in a kit
|
|
24
|
+
* `Tooltip` so hover/focus surface the hint. The native `disabled` attribute is NOT
|
|
25
|
+
* set in that branch because `pointer-events: none` would suppress the hover trigger.
|
|
20
26
|
*/
|
|
21
27
|
declare function DepositMethod({
|
|
22
28
|
title,
|
|
@@ -26,6 +32,7 @@ declare function DepositMethod({
|
|
|
26
32
|
trailing,
|
|
27
33
|
recommended,
|
|
28
34
|
disabled,
|
|
35
|
+
disabledHint,
|
|
29
36
|
onSelect
|
|
30
37
|
}: DepositMethodProps): _$react_jsx_runtime0.JSX.Element;
|
|
31
38
|
//#endregion
|
|
@@ -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
|
|
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{Tooltip as r}from"../../../../../../shared/ui/Tooltip/Tooltip.js";import"../../../../../../shared/ui/Tooltip/index.js";import"../../../../../../ui/index.js";import{DEPOSIT_SLOTS as i}from"../Deposit.slots.js";import{styles as a}from"../Deposit.styles.js";import{Fragment as o}from"react";import{jsx as s,jsxs as c}from"react/jsx-runtime";import*as l from"@stylexjs/stylex";function u({title:o,titleAdornment:u,meta:f,icon:p,trailing:m,recommended:h=!1,disabled:g=!1,disabledHint:_,onSelect:v}){let y=g&&typeof _==`string`&&_.length>0,b=g?g?e=>{e.preventDefault()}:void 0:v,x=y?`${o} — ${_}`:o,S=c(t,{shape:`card`,onClick:b,disabled:g&&!y,"aria-label":x,"aria-disabled":g||void 0,"data-stridge-slot":i.method,"data-recommended":h||void 0,"data-disabled":g||void 0,...l.props(a.methodRow,y&&a.methodRowMuted),children:[h?s(`span`,{"aria-hidden":!0,...l.props(a.methodRecommendedBar)}):null,s(`span`,{...l.props(a.methodIconSlot),children:p}),c(`span`,{...l.props(a.methodText),children:[c(`span`,{...l.props(a.methodTitleRow),children:[s(n.span,{size:`sm`,fontWeight:`semibold`,leading:`tight`,tracking:`tight`,truncate:!0,children:o}),u?s(n.span,{size:`xs`,leading:`tight`,tracking:`wide`,color:`subdued`,font:`mono`,style:{flexShrink:0},children:u}):null]}),f?s(d,{meta:f}):null]}),s(`span`,{...l.props(a.methodTrailing),children:m??s(e,{"aria-hidden":!0,...l.props(a.methodChevron)})})]});return y?c(r.Root,{children:[s(r.Trigger,{render:S}),s(r.Content,{children:_})]}):S}function d({meta:e}){return Array.isArray(e)?s(n.span,{size:`xs`,leading:`tight`,color:`subdued`,...l.props(a.methodMeta),children:e.map((e,t)=>c(o,{children:[t>0?s(`span`,{...l.props(a.methodMetaItem),children:`·`}):null,s(n.span,{size:`xs`,leading:`tight`,fontWeight:t===0?`medium`:`normal`,color:t===0?`default`:`inherit`,...l.props(a.methodMetaItem),children:e})]},t))}):s(n.span,{size:`xs`,leading:`tight`,color:`subdued`,...l.props(a.methodMeta),children:e})}export{u as DepositMethod};
|
|
@@ -41,6 +41,13 @@ interface DepositMethodOption {
|
|
|
41
41
|
* but click is a no-op.
|
|
42
42
|
*/
|
|
43
43
|
disabled?: boolean;
|
|
44
|
+
/**
|
|
45
|
+
* Plain-text hint surfaced when the user hovers, focuses, or taps a
|
|
46
|
+
* disabled row. Rendered via the kit's `Tooltip` primitive and also
|
|
47
|
+
* folded into the tile's accessible name so screen readers convey the
|
|
48
|
+
* reason. Ignored when `disabled` is falsy.
|
|
49
|
+
*/
|
|
50
|
+
disabledHint?: string;
|
|
44
51
|
}
|
|
45
52
|
/**
|
|
46
53
|
* A single method entry passed to the `Deposit` root via the `methods`
|
|
@@ -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,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 +1 @@
|
|
|
1
|
-
"use client";import{useLingui as e}from"../../../shared/i18n/useLingui.js";import"../../../i18n/index.js";import{toFailure as t}from"../../../shared/orchestrator/toFailure.js";import{useDriverSettlementListener as n}from"../../../shared/orchestrator/useDriverSettlementListener.js";import{useEffectiveState as r}from"../../../shared/orchestrator/useEffectiveState.js";import{useSettlementWatcher as i}from"../../../shared/orchestrator/useSettlementWatcher.js";import"../../../shared/orchestrator/index.js";import{useWithdrawBindingsRef as a}from"../bindings/WithdrawBindings.js";import"../bindings/index.js";import{useWithdrawDriverInstance as o}from"../driver/context.js";import{initialState as s,reducer as c}from"./reducer.js";import{createContext as l,use as u,useCallback as d,useMemo as f,useReducer as p,useRef as m}from"react";import{jsx as h}from"react/jsx-runtime";const g={id:`ldK3jJ`,message:`Failed to submit withdrawal.`},_={id:`kUFhUv`,message:`Withdrawal failed.`},v=l(null);v.displayName=`WithdrawControllerContext`;function y(){let e=u(v);if(!e)throw Error(`useWithdraw / WithdrawControllerProvider must be used inside <KitProvider withdraw={…} />. Mount KitProvider once at the host's app root with a withdraw driver.`);return e}function b(){return y().state}function
|
|
1
|
+
"use client";import{useLingui as e}from"../../../shared/i18n/useLingui.js";import"../../../i18n/index.js";import{toFailure as t}from"../../../shared/orchestrator/toFailure.js";import{useDriverSettlementListener as n}from"../../../shared/orchestrator/useDriverSettlementListener.js";import{useEffectiveState as r}from"../../../shared/orchestrator/useEffectiveState.js";import{useSettlementWatcher as i}from"../../../shared/orchestrator/useSettlementWatcher.js";import"../../../shared/orchestrator/index.js";import{useWithdrawBindingsRef as a}from"../bindings/WithdrawBindings.js";import"../bindings/index.js";import{useWithdrawDriverInstance as o}from"../driver/context.js";import{initialState as s,reducer as c}from"./reducer.js";import{createContext as l,use as u,useCallback as d,useMemo as f,useReducer as p,useRef as m}from"react";import{jsx as h}from"react/jsx-runtime";const g={id:`ldK3jJ`,message:`Failed to submit withdrawal.`},_={id:`kUFhUv`,message:`Withdrawal failed.`},v=l(null);v.displayName=`WithdrawControllerContext`;function y(){let e=u(v);if(!e)throw Error(`useWithdraw / WithdrawControllerProvider must be used inside <KitProvider withdraw={…} />. Mount KitProvider once at the host's app root with a withdraw driver.`);return e}function b(){return u(v)}function x(){return y().state}function S(){return y().effectiveState}function C(){return y().actions}function w({children:e}){let t=o(),[n,a]=p(c,s),l=E(n,a,t),u=n.name===`inProgress`?{form:n.ctx.input,submittedAt:n.ctx.submittedAt,...n.ctx.tx?{tx:n.ctx.tx}:{}}:void 0;i(t,u,u?`${u.submittedAt}|${u.tx?.hash??``}`:void 0),D(n,a,t);let d=r(n),m=T(a,l);return h(v,{value:f(()=>({state:n,effectiveState:d,dispatch:a,controller:m,actions:l}),[n,d,m,l]),children:e})}function T(e,t){let n=d(()=>{e({type:`OPEN`})},[e]),r=d(()=>{e({type:`CLOSE`})},[e]);return f(()=>({open:n,close:r,actions:t}),[n,r,t])}function E(n,r,i){let o=m(n);o.current=n;let s=m(i);s.current=i;let c=m(r);c.current=r;let{i18n:l}=e(),u=m(l);u.current=l;let p=a(),h=d(e=>{let n=s.current;c.current({type:`SUBMIT`,input:e});let r=new AbortController,i={sourceAssetSymbol:e.sourceAssetSymbol,sourceChainId:e.sourceChainId,amount:e.amount,receiveTokenSymbol:e.receiveTokenSymbol,receiveChainId:e.receiveChainId,recipientAddress:e.recipientAddress},a={beginProcessing(e){c.current({type:`BEGIN_PROCESSING`,submittedAt:Date.now(),...e?{tx:e}:{}})},setTxHash(e){c.current({type:`SET_TX_HASH`,tx:e,submittedAt:Date.now()})},fail(e){c.current({type:`MARK_FAILED`,...e?{failure:e}:{}})},succeed(){c.current({type:`MARK_SUCCEEDED`})}};n.prepareWithdrawal(i,r.signal).then(i=>{if(r.signal.aborted)return;let o=p.current.onSubmit;if(!o){c.current({type:`SUBMIT_FAILED`,failure:t(Error(`WithdrawDialog onSubmit is missing.`),u.current._(g)),input:e});return}let s=n.getSnapshot().quote,l=s.status===`ready`||s.status===`stale`?s.payload:void 0;try{let n=o({form:e,depositTarget:i.depositTarget,correlation:i.correlation,...l?{quote:l}:{}},a,r.signal);n&&typeof n.catch==`function`&&n.catch(n=>{r.signal.aborted||c.current({type:`SUBMIT_FAILED`,failure:t(n,u.current._(g)),input:e})})}catch(n){if(r.signal.aborted)return;c.current({type:`SUBMIT_FAILED`,failure:t(n,u.current._(g)),input:e})}}).catch(n=>{r.signal.aborted||c.current({type:`SUBMIT_FAILED`,failure:t(n,u.current._(g)),input:e})})},[]),_=d(()=>{c.current({type:`CLOSE`})},[]),v=d(()=>{c.current({type:`RESET`})},[]),y=d(()=>{c.current({type:`CLEAR_NOTICE`})},[]);return f(()=>({submit:h,close:_,reset:v,clearNotice:y}),[h,_,v,y])}function D(t,r,i){let a=m(t);a.current=t;let{i18n:o}=e(),s=m(o);s.current=o,n(i,(e,t)=>{if(a.current.name===`inProgress`){if(e===`succeeded`){r({type:`SETTLEMENT_SUCCEEDED`});return}if(e===`failed`){let e=t.settlement,n=e.status===`ready`||e.status===`stale`?e.payload:null,i=n&&n.kind===`failed`?{reason:s.current._(_),code:n.failureKind}:void 0;r({type:`SETTLEMENT_FAILED`,...i?{failure:i}:{}})}}})}export{w as WithdrawControllerProvider,y as useControllerContext,b as useOptionalControllerContext,C as useWithdrawActions,S as useWithdrawEffectiveState,x as useWithdrawState};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { FailureInfo } from "../../../shared/orchestrator/types.js";
|
|
2
2
|
import { WithdrawActions, WithdrawController, WithdrawEvent, WithdrawState, WithdrawStateName, WithdrawalFormSnapshot } from "./types.js";
|
|
3
3
|
import { useWithdrawState } from "./controller.js";
|
|
4
|
-
import { useWithdraw } from "./useWithdraw.js";
|
|
4
|
+
import { useOptionalWithdraw, useWithdraw } from "./useWithdraw.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
|
|
@@ -19,5 +19,22 @@ import { WithdrawController } from "./types.js";
|
|
|
19
19
|
* ```
|
|
20
20
|
*/
|
|
21
21
|
declare function useWithdraw(): WithdrawController;
|
|
22
|
+
/**
|
|
23
|
+
* Non-throwing variant of {@link useWithdraw} — returns `null` when called outside a
|
|
24
|
+
* `<KitProvider withdraw={…} />`. Lets hosts mount `<StridgeProvider />` conditionally
|
|
25
|
+
* (e.g. only after a wallet is connected) without descendants crashing the moment they render
|
|
26
|
+
* before the provider exists.
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* ```tsx
|
|
30
|
+
* const withdraw = useOptionalWithdraw();
|
|
31
|
+
* return (
|
|
32
|
+
* <button onClick={() => withdraw?.open()} disabled={!withdraw}>
|
|
33
|
+
* Withdraw
|
|
34
|
+
* </button>
|
|
35
|
+
* );
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
38
|
+
declare function useOptionalWithdraw(): WithdrawController | null;
|
|
22
39
|
//#endregion
|
|
23
|
-
export { useWithdraw };
|
|
40
|
+
export { useOptionalWithdraw, useWithdraw };
|
|
@@ -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{r as useOptionalWithdraw,n as useWithdraw};
|
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";
|
|
@@ -21,9 +21,9 @@ import { ChainLogoInput, TokenLogoInput } from "./shared/utils/logos/types.js";
|
|
|
21
21
|
import { LogosNamespace, logos } from "./shared/utils/logos/api.js";
|
|
22
22
|
import { BannerAckBucket, bannerAckStorageKey, bucketFromSettlement, useBannerAck, useBannerAckForSettlement } from "./banners/useBannerAck.js";
|
|
23
23
|
import { useDepositState } from "./flows/deposit/orchestrator/controller.js";
|
|
24
|
-
import { useDeposit } from "./flows/deposit/orchestrator/useDeposit.js";
|
|
24
|
+
import { useDeposit, useOptionalDeposit } from "./flows/deposit/orchestrator/useDeposit.js";
|
|
25
25
|
import { useWithdrawState } from "./flows/withdraw/orchestrator/controller.js";
|
|
26
|
-
import { useWithdraw } from "./flows/withdraw/orchestrator/useWithdraw.js";
|
|
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, useOptionalStridge, 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/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{isValidAddressForChainType as e,isValidEvmAddress as t,isValidTronAddress as n,toChainType as r}from"./shared/chains/index.js";import{logos as i}from"./shared/utils/logos/api.js";import"./shared/utils/logos/index.js";import{createLocalStorageAdapter as a,createMemoryStorageAdapter as o,createSessionStorageAdapter as s,resolveStorageAdapter as c}from"./storage/adapters.js";import{createKitStorage as l}from"./storage/createKitStorage.js";import{DEFAULT_KIT_STORAGE_NAMESPACE as u,KitStorageProvider as d,useKitStorage as f,useKitStorageValue as p}from"./storage/context.js";import"./storage/index.js";import{bannerAckStorageKey as m,bucketFromSettlement as h,useBannerAck as g,useBannerAckForSettlement as _}from"./banners/useBannerAck.js";import"./banners/index.js";import{useDepositSnapshot as v}from"./flows/deposit/driver/context.js";import{useDepositState as y}from"./flows/deposit/orchestrator/controller.js";import{useDeposit as b}from"./flows/deposit/orchestrator/useDeposit.js";import{useWithdrawBindings as
|
|
1
|
+
import{isValidAddressForChainType as e,isValidEvmAddress as t,isValidTronAddress as n,toChainType as r}from"./shared/chains/index.js";import{logos as i}from"./shared/utils/logos/api.js";import"./shared/utils/logos/index.js";import{createLocalStorageAdapter as a,createMemoryStorageAdapter as o,createSessionStorageAdapter as s,resolveStorageAdapter as c}from"./storage/adapters.js";import{createKitStorage as l}from"./storage/createKitStorage.js";import{DEFAULT_KIT_STORAGE_NAMESPACE as u,KitStorageProvider as d,useKitStorage as f,useKitStorageValue as p}from"./storage/context.js";import"./storage/index.js";import{bannerAckStorageKey as m,bucketFromSettlement as h,useBannerAck as g,useBannerAckForSettlement as _}from"./banners/useBannerAck.js";import"./banners/index.js";import{useDepositSnapshot as v}from"./flows/deposit/driver/context.js";import{useDepositState as y}from"./flows/deposit/orchestrator/controller.js";import{useDeposit as b,useOptionalDeposit as x}from"./flows/deposit/orchestrator/useDeposit.js";import{useWithdrawBindings as S}from"./flows/withdraw/bindings/WithdrawBindings.js";import"./flows/withdraw/bindings/index.js";import{useWithdrawSnapshot as C}from"./flows/withdraw/driver/context.js";import{useWithdrawState as w}from"./flows/withdraw/orchestrator/controller.js";import{useOptionalWithdraw as T,useWithdraw as E}from"./flows/withdraw/orchestrator/useWithdraw.js";import"./flows/withdraw/orchestrator/index.js";import{useKitConfig as D}from"./scope/context.js";import{KitPortalScope as O}from"./scope/KitPortalScope.js";import{useOptionalStridge as k,useStridge as A}from"./stridge/StridgeContext.js";import{StridgeProvider as j}from"./stridge/StridgeProvider.js";export{u as DEFAULT_KIT_STORAGE_NAMESPACE,O as KitPortalScope,d as KitStorageProvider,j as StridgeProvider,m as bannerAckStorageKey,h as bucketFromSettlement,l as createKitStorage,a as createLocalStorageAdapter,o as createMemoryStorageAdapter,s as createSessionStorageAdapter,e as isValidAddressForChainType,t as isValidEvmAddress,n as isValidTronAddress,i as logos,c as resolveStorageAdapter,r as toChainType,g as useBannerAck,_ as useBannerAckForSettlement,b as useDeposit,v as useDepositSnapshot,y as useDepositState,D as useKitConfig,f as useKitStorage,p as useKitStorageValue,x as useOptionalDeposit,k as useOptionalStridge,T as useOptionalWithdraw,A as useStridge,E as useWithdraw,S as useWithdrawBindings,C as useWithdrawSnapshot,w as useWithdrawState};
|
package/dist/package.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var e=`0.1.0-alpha.
|
|
1
|
+
var e=`0.1.0-alpha.28`;export{e as version};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{useEffect as e,useLayoutEffect as t,useRef as n}from"react";import{jsx as r}from"react/jsx-runtime";import{AnimatePresence as i,
|
|
1
|
+
"use client";import{useEffect as e,useLayoutEffect as t,useRef as n}from"react";import{jsx as r}from"react/jsx-runtime";import{AnimatePresence as i,m as a}from"motion/react";const o=[.3,0,.06,1],s={enter:e=>({opacity:0,x:e>=0?16:-16,filter:`blur(6px)`}),center:{opacity:1,x:0,filter:`blur(0px)`,transition:{duration:.22,delay:.12,ease:o}},exit:e=>({opacity:0,x:e>=0?-16:16,filter:`blur(6px)`,transition:{duration:.14,ease:o}})};function c({stateKey:o,children:c}){let l=n([]),u=n(null),d=l.current,f=d[d.length-1],p=0;o!==f&&(p=d.indexOf(o)>=0?-1:1);let m=n(null),h=n(o),g=n(null),_=n(null);return e(()=>{let e=l.current;if(e[e.length-1]===o)return;let t=e.indexOf(o);l.current=t>=0?e.slice(0,t+1):[...e,o]},[o]),t(()=>{let e=u.current;if(!e)return;let t=e.getBoundingClientRect().height;if(h.current===o){m.current=t;return}let n=m.current;if(h.current=o,m.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,_.current!==null&&window.cancelAnimationFrame(_.current),_.current=window.requestAnimationFrame(()=>{_.current=null,u.current&&(u.current.style.height=`${t}px`)}),g.current!==null&&window.clearTimeout(g.current),g.current=window.setTimeout(()=>{g.current=null;let e=u.current;e&&(e.style.height=``)},320)}),e(()=>{let e=()=>{if(document.visibilityState!==`hidden`)return;_.current!==null&&(window.cancelAnimationFrame(_.current),_.current=null),g.current!==null&&(window.clearTimeout(g.current),g.current=null);let e=u.current;e&&(e.style.height=``)};return document.addEventListener(`visibilitychange`,e),()=>{document.removeEventListener(`visibilitychange`,e),g.current!==null&&(window.clearTimeout(g.current),g.current=null),_.current!==null&&(window.cancelAnimationFrame(_.current),_.current=null)}},[]),r(`div`,{ref:u,style:{position:`relative`,overflow:`hidden`,transition:`height 260ms cubic-bezier(0.3, 0, 0.06, 1)`,flex:`0 1 auto`,minHeight:0,display:`flex`,flexDirection:`column`},children:r(i,{mode:`popLayout`,custom:p,initial:!1,children:r(a.div,{custom:p,variants:s,initial:`enter`,animate:`center`,exit:`exit`,tabIndex:-1,style:{display:`flex`,flexDirection:`column`,flex:`1 1 auto`,minHeight:0,outline:`none`},children:c},o)})})}export{c as StepTransition};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{useLingui as e}from"../../../../../i18n/useLingui.js";import"../../../../../../i18n/index.js";import{ArrowRightLeftIcon as t}from"../../../../../icons/ArrowRightLeftIcon.js";import"../../../../../../icons/index.js";import{parseAmountInputValue as n}from"../../../../../ui/AmountInput/utils.js";import{AmountInput as r}from"../../../../../ui/AmountInput/AmountInput.js";import"../../../../../ui/AmountInput/index.js";import{AMOUNT_ENTRY_SLOTS as i}from"../../AmountEntry.slots.js";import{styles as a}from"../../AmountEntry.styles.js";import{useAmountEntryContext as o}from"../../context.js";import{detectAssetDecimals as s,formatAmountForBand as c,formatFiatLine as l,splitSubLine as u}from"./utils.js";import{StaticBand as ee}from"./StaticBand.js";import{ICON_TRANSITION as d,SWAP_TRANSITION as f,SYMBOL_TRANSITION as p,WIDTH_TRANSITION as te}from"./transitions.js";import{SwapBackdrop as m}from"./SwapBackdrop.js";import{useSwapState as h}from"./useSwapState.js";import{useCallback as g,useEffect as _,useId as v,useRef as y,useState as b}from"react";import{jsx as x,jsxs as S}from"react/jsx-runtime";import
|
|
1
|
+
"use client";import{useLingui as e}from"../../../../../i18n/useLingui.js";import"../../../../../../i18n/index.js";import{ArrowRightLeftIcon as t}from"../../../../../icons/ArrowRightLeftIcon.js";import"../../../../../../icons/index.js";import{parseAmountInputValue as n}from"../../../../../ui/AmountInput/utils.js";import{AmountInput as r}from"../../../../../ui/AmountInput/AmountInput.js";import"../../../../../ui/AmountInput/index.js";import{AMOUNT_ENTRY_SLOTS as i}from"../../AmountEntry.slots.js";import{styles as a}from"../../AmountEntry.styles.js";import{useAmountEntryContext as o}from"../../context.js";import{detectAssetDecimals as s,formatAmountForBand as c,formatFiatLine as l,splitSubLine as u}from"./utils.js";import{StaticBand as ee}from"./StaticBand.js";import{ICON_TRANSITION as d,SWAP_TRANSITION as f,SYMBOL_TRANSITION as p,WIDTH_TRANSITION as te}from"./transitions.js";import{SwapBackdrop as m}from"./SwapBackdrop.js";import{useSwapState as h}from"./useSwapState.js";import{useCallback as g,useEffect as _,useId as v,useRef as y,useState as b}from"react";import{jsx as x,jsxs as S}from"react/jsx-runtime";import{LayoutGroup as C,m as w}from"motion/react";import*as T from"@stylexjs/stylex";function E({currencySymbol:l,subLine:u,subLineAmount:E}={}){let D=o(`AmountEntry.Hero`),O=l??D.currencySymbol??`$`,k=u??D.subLine,A=E??D.subLineAmount,{_:j}=e(),M=typeof D.onAmountChange==`function`,N=v(),P=y(null),F=y(null),[I,re]=b(null);_(()=>{let e=F.current;if(!e||typeof ResizeObserver>`u`)return;let t=()=>{let t=window.getComputedStyle(e),n=(Number.parseFloat(t.paddingInlineStart)||0)+(Number.parseFloat(t.paddingInlineEnd)||0),r=e.clientWidth-n;re(e=>e===r||r<=0?e:r)};t();let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[]);let L=D.format?.maximumFractionDigits??5,R=D.format?.useGrouping!==!1,z=s(A,L),B=g((e,t)=>c(e,t,{locale:D.locale,fiatFormat:D.format,fiatMaxDecimals:L,assetDecimals:z,useGrouping:R}),[D.locale,D.format,L,z,R]),{swapped:V,isAnimating:H,onSwap:U}=h({inputRef:P,onAfterSwap:g(e=>{D.amount!==null&&K(B(D.amount,e))},[D.amount,B])}),W=D.amount===null?``:B(D.amount,V),[G,K]=b(W);_(()=>{document.activeElement!==P.current&&K(W)},[W]);let q=e=>{K(e),D.onAmountChange?.(n(e,D.locale))},J=`${N}-fiat`,Y=`${N}-asset`,X=V?Y:J,Z=V?J:Y,Q=ne({swapped:V,ctx:D,currencySymbol:O,subLineAmount:A}),$=T.props(a.heroBlock),ie=I===null?void 0:{"--stridge-amt-available-width":`${I}px`};return x(C,{id:N,children:S(`div`,{ref:F,"data-stridge-slot":i.hero,className:$.className,style:$.style,children:[S(w.div,{layoutId:X,dir:`ltr`,transition:f,...T.props(a.bigSlot),children:[x(m,{active:H}),M?S(r,{"data-stridge-slot":i.heroBand,value:G,onValueChange:q,locale:D.locale??`en-US`,maxDecimals:V?z:L,useGrouping:R,placeholder:`0`,className:T.props(a.hero).className,style:{...T.props(a.hero).style,...ie},children:[!V&&x(r.Prefix,{...T.props(a.heroCurrency),children:O}),x(r.Field,{"aria-label":V?`Amount in ${D.receiveToken.symbol}`:`Amount in ${O}`,ref:P,autoFocus:!0,...T.props(a.heroAmount)})]}):x(ee,{swapped:V,ctx:D,currencySymbol:O,assetDecimals:z})]},X),k??S(`button`,{type:`button`,dir:`ltr`,"data-stridge-slot":i.heroSwap,"aria-label":j({id:`GwkmPx`,message:`Swap displayed amount`}),"aria-pressed":V,onClick:U,...T.props(a.swapToggle),children:[x(w.span,{"aria-hidden":!0,animate:{scaleY:V?-1:1},transition:d,...T.props(a.swapIcon),children:x(t,{width:`14`,height:`14`})}),S(w.span,{layout:!0,transition:te,...T.props(a.swapTextWrap),children:[S(w.span,{layoutId:Z,transition:f,...T.props(a.swapText),children:[Q.digits,x(m,{active:H})]},Z),Q.symbol&&x(w.span,{initial:{opacity:0},animate:{opacity:1},transition:p,...T.props(a.swapSymbol),children:Q.symbol},`symbol-${Q.symbol}`)]})]})]})})}function ne({swapped:e,ctx:t,currencySymbol:n,subLineAmount:r}){if(e)return{digits:l(t.amount,n,t.locale,t.format),symbol:null};let i=u(r);return{digits:i.digits||`${t.amount??0}`,symbol:i.symbol||` ${t.receiveToken.symbol}`}}export{E as AmountEntryHero};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{styles as e}from"../../AmountEntry.styles.js";import{SWAP_TRANSITION as t}from"./transitions.js";import{jsx as n}from"react/jsx-runtime";import
|
|
1
|
+
"use client";import{styles as e}from"../../AmountEntry.styles.js";import{SWAP_TRANSITION as t}from"./transitions.js";import{jsx as n}from"react/jsx-runtime";import{m as r}from"motion/react";import*as i from"@stylexjs/stylex";function a({active:a}){return n(r.span,{"aria-hidden":!0,initial:{opacity:0},animate:{opacity:+!!a},transition:t,...i.props(e.swapBackdrop)})}export{a as SwapBackdrop};
|
|
@@ -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,42 @@ 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 visually muted, surface the hint on
|
|
80
|
+
* hover/focus, and can't be selected. Omitting the field keeps both methods enabled.
|
|
81
|
+
*
|
|
82
|
+
* @example
|
|
83
|
+
* ```tsx
|
|
84
|
+
* <StridgeProvider
|
|
85
|
+
* flows={{
|
|
86
|
+
* deposit: {
|
|
87
|
+
* destination: { address: treasuryAddress },
|
|
88
|
+
* methods: {
|
|
89
|
+
* wallet: isEmbeddedWallet
|
|
90
|
+
* ? { disabled: true, disabledHint: "Connect an external wallet to pay from your balance. Use Transfer Crypto to send funds from an exchange." }
|
|
91
|
+
* : undefined,
|
|
92
|
+
* },
|
|
93
|
+
* },
|
|
94
|
+
* }}
|
|
95
|
+
* >
|
|
96
|
+
* ```
|
|
97
|
+
*/
|
|
98
|
+
methods?: StridgeDepositMethodsConfig;
|
|
74
99
|
}
|
|
100
|
+
/**
|
|
101
|
+
* Host-supplied disable lever for a single payment method on the deposit-method picker. Identical
|
|
102
|
+
* shape to the kit-internal {@link DepositMethodConfig} — re-exported under a Stridge-prefixed
|
|
103
|
+
* name so all `flows.deposit.*` types live alongside the provider.
|
|
104
|
+
*/
|
|
105
|
+
type StridgeDepositMethodConfig = DepositMethodConfig;
|
|
106
|
+
/**
|
|
107
|
+
* Per-method host configuration for the deposit picker. Omitting a method keeps default behavior.
|
|
108
|
+
* Re-export of {@link DepositMethodsConfig} under a Stridge-prefixed name.
|
|
109
|
+
*/
|
|
110
|
+
type StridgeDepositMethodsConfig = DepositMethodsConfig;
|
|
75
111
|
/**
|
|
76
112
|
* Per-flow withdraw tuning.
|
|
77
113
|
*/
|
|
@@ -239,4 +275,4 @@ declare function StridgeProvider({
|
|
|
239
275
|
children
|
|
240
276
|
}: StridgeProvider.Props): _$react_jsx_runtime0.JSX.Element;
|
|
241
277
|
//#endregion
|
|
242
|
-
export { StridgeAppearance, StridgeAsset, StridgeDepositDestination, StridgeDepositFlowConfig, StridgeFlowOwner, StridgeProvider, StridgeStorageConfig, StridgeWithdrawFlowConfig };
|
|
278
|
+
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";
|