@stridge/kit 0.1.0-alpha.44 → 0.1.0-alpha.46
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/drivers/stridge/internal/pollOnce.js +1 -1
- package/dist/drivers/stridge-mock/fixtures.d.ts +1 -1
- package/dist/flows/deposit/dialog/DepositDialog.d.ts +9 -4
- package/dist/flows/deposit/dialog/DepositDialog.js +1 -1
- package/dist/flows/deposit/driver/types.d.ts +3 -3
- package/dist/flows/deposit/widgets/amount-entry/AmountEntry.d.ts +31 -4
- package/dist/flows/deposit/widgets/amount-entry/AmountEntry.js +1 -1
- package/dist/flows/deposit/widgets/asset-picker/AssetPicker.d.ts +22 -4
- package/dist/flows/deposit/widgets/asset-picker/AssetPicker.js +1 -1
- package/dist/flows/deposit/widgets/confirm-deposit/ConfirmDeposit.d.ts +37 -4
- package/dist/flows/deposit/widgets/confirm-deposit/ConfirmDeposit.js +1 -1
- package/dist/flows/deposit/widgets/deposit/Deposit.d.ts +33 -4
- package/dist/flows/deposit/widgets/deposit/Deposit.js +1 -1
- package/dist/flows/deposit/widgets/deposit/compound/Deposit.d.ts +14 -0
- package/dist/flows/deposit/widgets/deposit/compound/Deposit.js +1 -1
- package/dist/flows/deposit/widgets/deposit/compound/components/Boundary.d.ts +29 -0
- package/dist/flows/deposit/widgets/deposit/compound/components/Boundary.js +1 -0
- package/dist/flows/deposit/widgets/deposit/compound/components/Guards.d.ts +28 -0
- package/dist/flows/deposit/widgets/deposit/compound/components/Guards.js +1 -0
- package/dist/flows/deposit/widgets/deposit-status-banner/DepositStatusBanner.d.ts +34 -1
- package/dist/flows/deposit/widgets/deposit-status-banner/DepositStatusBanner.js +1 -1
- package/dist/flows/deposit/widgets/deposit-status-banner/compound/types.d.ts +5 -5
- package/dist/flows/deposit/widgets/error-state/ErrorState.d.ts +39 -4
- package/dist/flows/deposit/widgets/error-state/ErrorState.js +1 -1
- package/dist/flows/deposit/widgets/processing-state/ProcessingState.d.ts +30 -4
- package/dist/flows/deposit/widgets/processing-state/ProcessingState.js +1 -1
- package/dist/flows/deposit/widgets/success-state/SuccessState.d.ts +38 -4
- package/dist/flows/deposit/widgets/success-state/SuccessState.js +1 -1
- package/dist/flows/deposit/widgets/transfer-crypto/TransferCrypto.d.ts +34 -3
- package/dist/flows/deposit/widgets/transfer-crypto/TransferCrypto.js +1 -1
- package/dist/flows/withdraw/dialog/WithdrawDialog.js +1 -1
- package/dist/flows/withdraw/driver/dto.d.ts +6 -5
- package/dist/flows/withdraw/widgets/withdraw/compound/Withdraw.d.ts +15 -0
- package/dist/flows/withdraw/widgets/withdraw/compound/Withdraw.js +1 -1
- package/dist/flows/withdraw/widgets/withdraw/compound/components/Boundary.d.ts +29 -0
- package/dist/flows/withdraw/widgets/withdraw/compound/components/Boundary.js +1 -0
- package/dist/flows/withdraw/widgets/withdraw/compound/components/Guards.d.ts +25 -0
- package/dist/flows/withdraw/widgets/withdraw/compound/components/Guards.js +1 -0
- package/dist/flows/withdraw/widgets/withdraw-error/WithdrawError.d.ts +45 -2
- package/dist/flows/withdraw/widgets/withdraw-error/WithdrawError.js +1 -1
- package/dist/flows/withdraw/widgets/withdraw-form/WithdrawForm.d.ts +29 -1
- package/dist/flows/withdraw/widgets/withdraw-form/WithdrawForm.js +1 -1
- package/dist/flows/withdraw/widgets/withdraw-in-progress/WithdrawInProgress.d.ts +37 -2
- package/dist/flows/withdraw/widgets/withdraw-in-progress/WithdrawInProgress.js +1 -1
- package/dist/flows/withdraw/widgets/withdraw-success/WithdrawSuccess.d.ts +46 -2
- package/dist/flows/withdraw/widgets/withdraw-success/WithdrawSuccess.js +1 -1
- package/dist/package.js +1 -1
- package/dist/shared/widgets/amount-entry/compound/AmountEntry.d.ts +4 -1
- package/dist/shared/widgets/amount-entry/compound/AmountEntry.js +1 -1
- package/dist/shared/widgets/amount-entry/compound/AmountEntry.slots.d.ts +1 -0
- package/dist/shared/widgets/amount-entry/compound/AmountEntry.slots.js +1 -1
- package/dist/shared/widgets/amount-entry/compound/AmountEntry.styles.js +1 -1
- package/dist/shared/widgets/amount-entry/compound/components/Notice.d.ts +7 -0
- package/dist/shared/widgets/amount-entry/compound/components/Notice.js +1 -0
- package/dist/shared/widgets/amount-entry/compound/types.d.ts +12 -1
- package/dist/shared/widgets/error-state/compound/components/MoreDetails.d.ts +1 -1
- package/dist/shared/widgets/error-state/compound/components/MoreDetails.js +1 -1
- package/dist/shared/widgets/processing-state/compound/types.d.ts +4 -3
- package/dist/shared/widgets/success-state/compound/components/MoreDetails.d.ts +1 -1
- package/dist/shared/widgets/success-state/compound/components/MoreDetails.js +1 -1
- package/dist/shared/widgets/success-state/compound/types.d.ts +5 -5
- package/dist/styles/index.css +4 -0
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
async function e(e,
|
|
1
|
+
async function e(e,n,r,i){try{return t((await e.gateway.poll(n,{...r?{network_id:r.network_id,to_address:r.to_address,asset_symbol:r.asset_symbol}:{},signal:i})).udas,r)}catch(e){if(i.aborted)throw e;if(e.statusCode===404)return null;throw e}}function t(e,t){if(e.length===0)return null;if(!t)return e[0]??null;let n=t.to_address.toLowerCase(),r=t.asset_symbol.toUpperCase();return e.find(e=>e.destination.network_id===t.network_id&&(e.destination.asset_symbol??``).toUpperCase()===r&&(e.destination.address??``).toLowerCase()===n)??null}export{e as pollOnce};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { SettlementFailureKind } from "../../shared/driver/types.js";
|
|
2
2
|
import { AddressItemPayload, BalanceItemPayload, BrandPayload, QuotePayload, SettlementFailurePayload, SettlementPayload, SettlementPendingPayload, SettlementSuccessPayload, TargetPayload, WalletInfo, WalletPayload } from "../../flows/deposit/driver/payloads.js";
|
|
3
3
|
import { I18n } from "@lingui/core";
|
|
4
|
-
import { DepositAddressDto,
|
|
4
|
+
import { DepositAddressDto, GatewaySettlementDto, GatewayStartResponse, GatewayUdaDto, OnchainBalanceResponse, QuoteResponse, SupportedAssetDto, SupportedAssetsResponse } from "@stridge/sdk";
|
|
5
5
|
|
|
6
6
|
//#region src/drivers/stridge-mock/fixtures.d.ts
|
|
7
7
|
/**
|
|
@@ -8,9 +8,11 @@ import * as _$react_jsx_runtime0 from "react/jsx-runtime";
|
|
|
8
8
|
* bound to the controller's `state.name !== "closed"`, so the dialog appears / disappears
|
|
9
9
|
* automatically as descendants call `useDeposit().open()` / `.close()`.
|
|
10
10
|
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
11
|
+
* The dialog is a pure composition of compound parts — `<Deposit.Boundary>` for crash
|
|
12
|
+
* recovery, `<Deposit.Guards>` for the wallet-required / bootstrap-fatal / bootstrap-loading
|
|
13
|
+
* cascade, `<Deposit.Steps>` for FSM-driven screen routing, and `<DepositStatusBanner />` for
|
|
14
|
+
* the inline settlement banner. Each piece is independently overrideable via the compound
|
|
15
|
+
* surface; this is the canonical shape integrators can copy verbatim.
|
|
14
16
|
*
|
|
15
17
|
* Lifecycle observability is delivered by the unified event bus exported from
|
|
16
18
|
* `@stridge/kit/events`. The dialog itself takes no `on*` callback props — subscribe via
|
|
@@ -37,7 +39,10 @@ declare namespace DepositDialog {
|
|
|
37
39
|
* the terminal event. The kit does not validate or normalise the shape.
|
|
38
40
|
*/
|
|
39
41
|
metadata?: Record<string, unknown>;
|
|
40
|
-
/**
|
|
42
|
+
/**
|
|
43
|
+
* Forwarded to the dialog's internal `<Deposit.Boundary>` for crash reporting. The
|
|
44
|
+
* boundary's `onReset` is wired automatically through `useDeposit().close()`.
|
|
45
|
+
*/
|
|
41
46
|
onError?: (error: Error, errorInfo: ErrorInfo) => void;
|
|
42
47
|
}
|
|
43
48
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{useDepositSnapshot as e}from"../driver/context.js";import{useControllerContext as t}from"../orchestrator/controller.js";import{useDepositEmissions as n}from"../../../events/emit/useDepositEmissions.js";import"../../../events/emit/index.js";import{useIntercomShutdownOnUnmount as r}from"../../../shared/support/useIntercomShutdownOnUnmount.js";import"../../../shared/support/index.js";import{
|
|
1
|
+
"use client";import{useDepositSnapshot as e}from"../driver/context.js";import{useControllerContext as t}from"../orchestrator/controller.js";import{useDepositEmissions as n}from"../../../events/emit/useDepositEmissions.js";import"../../../events/emit/index.js";import{useIntercomShutdownOnUnmount as r}from"../../../shared/support/useIntercomShutdownOnUnmount.js";import"../../../shared/support/index.js";import{Dialog as i}from"../../../shared/ui/Dialog/Dialog.js";import"../../../shared/ui/Dialog/index.js";import{Deposit as a}from"../widgets/deposit/compound/Deposit.js";import"../widgets/deposit/compound/index.js";import{AmountEntry as o}from"../widgets/amount-entry/AmountEntry.js";import"../widgets/amount-entry/index.js";import{AssetPicker as s}from"../widgets/asset-picker/AssetPicker.js";import"../widgets/asset-picker/index.js";import{ConfirmDeposit as c}from"../widgets/confirm-deposit/ConfirmDeposit.js";import"../widgets/confirm-deposit/index.js";import{Deposit as l}from"../widgets/deposit/Deposit.js";import"../widgets/deposit/index.js";import{DepositStatusBanner as u}from"../widgets/deposit-status-banner/DepositStatusBanner.js";import"../widgets/deposit-status-banner/index.js";import{ErrorState as d}from"../widgets/error-state/ErrorState.js";import"../widgets/error-state/index.js";import{ProcessingState as f}from"../widgets/processing-state/ProcessingState.js";import"../widgets/processing-state/index.js";import{SuccessState as p}from"../widgets/success-state/SuccessState.js";import"../widgets/success-state/index.js";import{TransferCrypto as m}from"../widgets/transfer-crypto/TransferCrypto.js";import"../widgets/transfer-crypto/index.js";import{jsx as h,jsxs as g}from"react/jsx-runtime";function _({container:_,metadata:v,onError:y}={}){let{state:b,controller:x}=t(),S=e(),C=b.name!==`closed`;return n({state:b,settlement:S.settlement,quote:S.quote,metadata:v}),r(),h(i,{open:C,onOpenChange:e=>{e||x.close()},children:h(i.Content,{container:_,children:g(a.Boundary,{...y?{onError:y}:{},children:[h(a.Guards,{children:g(a.Steps,{children:[h(a.Step,{name:`deposit`,children:h(l,{})}),h(a.Step,{name:`assetPicker`,children:h(s,{})}),h(a.Step,{name:`amountEntry`,children:h(o,{})}),h(a.Step,{name:`confirmDeposit`,children:h(c,{})}),h(a.Step,{name:`transferCrypto`,children:h(m,{})}),h(a.Step,{name:`processing`,children:h(f,{})}),h(a.Step,{name:`success`,children:h(p,{})}),h(a.Step,{name:`error`,children:h(d,{})})]})}),h(u,{})]})})})}export{_ as DepositDialog};
|
|
@@ -1,6 +1,6 @@
|
|
|
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 "./payloads.js";
|
|
3
|
-
import { DepositAddressDto,
|
|
3
|
+
import { DepositAddressDto, GatewaySettlementDto, GatewayStartResponse, GatewayUdaDto, OnchainBalanceResponse, QuoteResponse, SupportedAssetDto, SupportedAssetsResponse } from "@stridge/sdk";
|
|
4
4
|
|
|
5
5
|
//#region src/flows/deposit/driver/types.d.ts
|
|
6
6
|
/**
|
|
@@ -39,7 +39,7 @@ interface DepositSnapshot {
|
|
|
39
39
|
* the payload (`pending` / `succeeded` / `failed`) drives whether `<ProcessingState>`,
|
|
40
40
|
* `<SuccessState>`, or `<ErrorState>` is shown.
|
|
41
41
|
*/
|
|
42
|
-
settlement: Entity<SettlementPayload, GatewaySettlementDto,
|
|
42
|
+
settlement: Entity<SettlementPayload, GatewaySettlementDto, GatewayUdaDto>;
|
|
43
43
|
/**
|
|
44
44
|
* Connected-wallet identity. `idle` when no wallet is connected; `ready` once the host has
|
|
45
45
|
* supplied an address. The `payload.address.formatted` field is the canonical
|
|
@@ -107,7 +107,7 @@ type FetchActiveSettlementInput = Record<string, never>;
|
|
|
107
107
|
interface SettlementSnapshot {
|
|
108
108
|
payload: SettlementPayload;
|
|
109
109
|
raw: GatewaySettlementDto;
|
|
110
|
-
response:
|
|
110
|
+
response: GatewayUdaDto;
|
|
111
111
|
}
|
|
112
112
|
/**
|
|
113
113
|
* Unified driver contract. A `DepositDriver` is the single host-supplied source of both reactive
|
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
import { DialogShellControls } from "../../../../shared/dialog/DialogShell.js";
|
|
2
|
-
import {
|
|
2
|
+
import { AmountEntryBodyProps } from "../../../../shared/widgets/amount-entry/compound/types.js";
|
|
3
|
+
import { AmountEntryFlow } from "../../../../shared/widgets/amount-entry/compound/components/Flow.js";
|
|
4
|
+
import { AmountEntryFooter } from "../../../../shared/widgets/amount-entry/compound/components/Footer.js";
|
|
5
|
+
import { AmountEntryHeader } from "../../../../shared/widgets/amount-entry/compound/components/Header.js";
|
|
6
|
+
import { AmountEntryHero } from "../../../../shared/widgets/amount-entry/compound/components/Hero/Hero.js";
|
|
7
|
+
import { AmountEntryNotice } from "../../../../shared/widgets/amount-entry/compound/components/Notice.js";
|
|
8
|
+
import { AmountEntryPills } from "../../../../shared/widgets/amount-entry/compound/components/Pills.js";
|
|
9
|
+
import { ComponentProps, ReactNode } from "react";
|
|
3
10
|
import * as _$react_jsx_runtime0 from "react/jsx-runtime";
|
|
4
11
|
|
|
5
12
|
//#region src/flows/deposit/widgets/amount-entry/AmountEntry.d.ts
|
|
@@ -18,7 +25,20 @@ import * as _$react_jsx_runtime0 from "react/jsx-runtime";
|
|
|
18
25
|
* CTA flips to "Update order" and clicking auto-snaps the amount up to the floor. The widget
|
|
19
26
|
* also prefills the entry to the floor on first render so the user starts at a valid amount.
|
|
20
27
|
*/
|
|
21
|
-
|
|
28
|
+
interface AmountEntryOwnProps {
|
|
29
|
+
/**
|
|
30
|
+
* Optional custom composition. Defaults to `<Header />` + `<Body><Hero /><Pills /><Flow />`
|
|
31
|
+
* + validation-notice slot `</Body>` + `<Footer />`. Pass children to interleave your own
|
|
32
|
+
* elements between compound parts. Note — the default composition embeds a runtime-driven
|
|
33
|
+
* `<NoticeSlot />` that surfaces validation hints (min / max / insufficient-balance); custom
|
|
34
|
+
* children replace it entirely.
|
|
35
|
+
*/
|
|
36
|
+
children?: ReactNode;
|
|
37
|
+
}
|
|
38
|
+
declare function AmountEntry({
|
|
39
|
+
children,
|
|
40
|
+
...props
|
|
41
|
+
}: ComponentProps<"div"> & AmountEntryOwnProps): _$react_jsx_runtime0.JSX.Element | null;
|
|
22
42
|
declare function AmountEntryDialog({
|
|
23
43
|
open,
|
|
24
44
|
defaultOpen,
|
|
@@ -27,9 +47,16 @@ declare function AmountEntryDialog({
|
|
|
27
47
|
...rootProps
|
|
28
48
|
}: AmountEntry.DialogProps): _$react_jsx_runtime0.JSX.Element;
|
|
29
49
|
declare namespace AmountEntry {
|
|
30
|
-
type Props = ComponentProps<"div"
|
|
31
|
-
type DialogProps = ComponentProps<"div"> & DialogShellControls;
|
|
50
|
+
type Props = ComponentProps<"div"> & AmountEntryOwnProps;
|
|
51
|
+
type DialogProps = ComponentProps<"div"> & DialogShellControls & AmountEntryOwnProps;
|
|
32
52
|
const Dialog: typeof AmountEntryDialog;
|
|
53
|
+
const Header: typeof AmountEntryHeader;
|
|
54
|
+
const Body: (props: AmountEntryBodyProps) => _$react_jsx_runtime0.JSX.Element;
|
|
55
|
+
const Hero: typeof AmountEntryHero;
|
|
56
|
+
const Pills: typeof AmountEntryPills;
|
|
57
|
+
const Flow: typeof AmountEntryFlow;
|
|
58
|
+
const Footer: typeof AmountEntryFooter;
|
|
59
|
+
const Notice: typeof AmountEntryNotice;
|
|
33
60
|
}
|
|
34
61
|
//#endregion
|
|
35
62
|
export { AmountEntry };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{useDepositSnapshot as e}from"../../driver/context.js";import{useKitI18n as t}from"../../../../shared/i18n/useKitI18n.js";import{Trans as n}from"../../../../shared/i18n/Trans.js";import{useLingui as r}from"../../../../shared/i18n/useLingui.js";import"../../../../i18n/index.js";import{useDepositActions as i,useDepositEffectiveState as
|
|
1
|
+
"use client";import{useDepositSnapshot as e}from"../../driver/context.js";import{useKitI18n as t}from"../../../../shared/i18n/useKitI18n.js";import{Trans as n}from"../../../../shared/i18n/Trans.js";import{useLingui as r}from"../../../../shared/i18n/useLingui.js";import"../../../../i18n/index.js";import{useDepositActions as i,useDepositEffectiveState as ee}from"../../orchestrator/controller.js";import{formatTokenAmount as a}from"../../../../shared/format/formatTokenAmount.js";import{useKitEmitter as o}from"../../../../events/emit/useKitEmitter.js";import"../../../../events/emit/index.js";import{DialogShell as s}from"../../../../shared/dialog/DialogShell.js";import{AmountEntry as c}from"../../../../shared/widgets/amount-entry/compound/AmountEntry.js";import"../../../../shared/widgets/amount-entry/compound/index.js";import{toAssetDescriptor as l}from"../../../../shared/widgets/asset-descriptor.js";import{effectiveMaxUsd as u,resolveFooterIntent as d}from"./footerIntent.js";import{useEffect as f,useRef as p,useState as m}from"react";import{Fragment as h,jsx as g,jsxs as _}from"react/jsx-runtime";const v=[{value:`25`,label:`25%`},{value:`50`,label:`50%`},{value:`75`,label:`75%`},{value:`max`,label:`Max`}];function y({children:n,...s}){let y=e(),S=ee(),{confirmAmount:C,back:w}=i(),{_:T}=r(),E=t(),D=y.target,O=D.status===`ready`||D.status===`stale`?D.payload:void 0,k=S.name===`amountEntry`?S.ctx.asset:void 0,A=k?.amountUsd?.value??0,j=O?.minAmountUsd?.value,M=O?.minAmountUsd?.formatted,N=O?.maxAmountUsd?.value,P=O?.maxAmountUsd?.formatted,F=u(A,N),I=k?.priceUsd,[L,R]=m(j??null),[z,B]=m(),V=o(),H=e=>{V({type:`deposit.amount.changed`,flow:`deposit`,tier:`ui`,payload:{raw:e===null?``:String(e),numeric:e}})},U=p(void 0),W=k?`${k.eip155Id??``}:${k.address??``}`:void 0;f(()=>{W&&U.current!==W&&(U.current=W,typeof j==`number`&&(R(j),B(void 0)))},[W,j]);let G=e=>{B(e);let t=e===`max`?1:Number.parseInt(e,10)/100;if(Number.isFinite(t)){let n=F*t;R(n),H(n),e===`max`&&V({type:`deposit.max.clicked`,flow:`deposit`,tier:`ui`,payload:{}})}},K=e=>{R(e),B(void 0),H(e)},q=d({amount:L,...j===void 0?{}:{minAmountUsd:j},...N===void 0?{}:{maxAmountUsd:N},walletBalanceUsd:A}),J=()=>{if(q===`aboveBalance`||q===`aboveCap`){R(F),B(`max`);return}if(q===`belowMin`&&typeof j==`number`){R(j),B(void 0);return}L!==null&&C(I&&I>0?L/I:L)};if(S.name!==`amountEntry`||!k||!O)return null;let Y=S.ctx.backTarget===`closed`?void 0:w,X=l(k)??{symbol:k.symbol},Z=l(O)??{symbol:O.symbol},Q=`${a((L??0)/1,E,{maxDecimals:5})} ${O.symbol}`,$=b(q,{updateOrder:T({id:`bOZXx5`,message:`Update order`}),depositMax:T({id:`9cCjMJ`,message:`Deposit max balance`})}),te=x(q,P,M);return g(c,{...s,amount:L,sendToken:X,receiveToken:Z,max:F,...j===void 0?{}:{min:j},onAmountChange:K,...Y?{onBack:Y}:{},subLineAmount:Q,presets:v,...z===void 0?{}:{activePreset:z},onPresetSelect:G,...$===void 0?{}:{footerLabel:$},onContinue:J,notice:te,children:n??_(h,{children:[g(c.Header,{}),_(c.Body,{children:[g(c.Hero,{}),g(c.Pills,{}),g(c.Flow,{}),g(c.Notice,{})]}),g(c.Footer,{})]})})}function b(e,t){if(e===`aboveCap`||e===`belowMin`)return t.updateOrder;if(e===`aboveBalance`)return t.depositMax}function x(e,t,r){if(e===`aboveCap`&&t)return g(n,{id:`-I_tc5`,message:`Max {formattedCap}`,values:{formattedCap:t}});if(e===`aboveBalance`)return g(n,{id:`znqB4T`,message:`Insufficient balance`});if(e===`belowMin`&&r)return g(n,{id:`3eKjkO`,message:`{formattedMin} minimum deposit`,values:{formattedMin:r}})}function S({open:e,defaultOpen:t,onOpenChange:n,trigger:r,...i}){return g(s,{open:e,defaultOpen:t,onOpenChange:n,trigger:r,children:g(y,{...i})})}(function(e){e.Dialog=S,e.Header=c.Header,e.Body=c.Body,e.Hero=c.Hero,e.Pills=c.Pills,e.Flow=c.Flow,e.Footer=c.Footer,e.Notice=c.Notice})(y||={});export{y as AmountEntry};
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import { DialogShellControls } from "../../../../shared/dialog/DialogShell.js";
|
|
2
|
-
import {
|
|
2
|
+
import { AssetPickerBodyProps } from "../../../../shared/widgets/asset-picker/compound/types.js";
|
|
3
|
+
import { AssetPickerFooter } from "../../../../shared/widgets/asset-picker/compound/components/Footer.js";
|
|
4
|
+
import { AssetPickerHeader } from "../../../../shared/widgets/asset-picker/compound/components/Header.js";
|
|
5
|
+
import { AssetPickerList } from "../../../../shared/widgets/asset-picker/compound/components/List.js";
|
|
6
|
+
import { ComponentProps, ReactNode } from "react";
|
|
3
7
|
import * as _$react_jsx_runtime0 from "react/jsx-runtime";
|
|
4
8
|
|
|
5
9
|
//#region src/flows/deposit/widgets/asset-picker/AssetPicker.d.ts
|
|
@@ -8,7 +12,17 @@ import * as _$react_jsx_runtime0 from "react/jsx-runtime";
|
|
|
8
12
|
* entity and the destination header title from `target`. Owns the selected-id state locally and
|
|
9
13
|
* routes the footer Continue through orchestrator's `confirmAsset`.
|
|
10
14
|
*/
|
|
11
|
-
|
|
15
|
+
interface AssetPickerOwnProps {
|
|
16
|
+
/**
|
|
17
|
+
* Optional custom composition. Defaults to `<Header />` + `<Body><List /></Body>` + `<Footer />`.
|
|
18
|
+
* Pass children to interleave your own elements between compound parts.
|
|
19
|
+
*/
|
|
20
|
+
children?: ReactNode;
|
|
21
|
+
}
|
|
22
|
+
declare function AssetPicker({
|
|
23
|
+
children,
|
|
24
|
+
...props
|
|
25
|
+
}: ComponentProps<"div"> & AssetPickerOwnProps): _$react_jsx_runtime0.JSX.Element | null;
|
|
12
26
|
declare function AssetPickerDialog({
|
|
13
27
|
open,
|
|
14
28
|
defaultOpen,
|
|
@@ -17,9 +31,13 @@ declare function AssetPickerDialog({
|
|
|
17
31
|
...rootProps
|
|
18
32
|
}: AssetPicker.DialogProps): _$react_jsx_runtime0.JSX.Element;
|
|
19
33
|
declare namespace AssetPicker {
|
|
20
|
-
type Props = ComponentProps<"div"
|
|
21
|
-
type DialogProps = ComponentProps<"div"> & DialogShellControls;
|
|
34
|
+
type Props = ComponentProps<"div"> & AssetPickerOwnProps;
|
|
35
|
+
type DialogProps = ComponentProps<"div"> & DialogShellControls & AssetPickerOwnProps;
|
|
22
36
|
const Dialog: typeof AssetPickerDialog;
|
|
37
|
+
const Header: typeof AssetPickerHeader;
|
|
38
|
+
const Body: (props: AssetPickerBodyProps) => _$react_jsx_runtime0.JSX.Element;
|
|
39
|
+
const List: typeof AssetPickerList;
|
|
40
|
+
const Footer: typeof AssetPickerFooter;
|
|
23
41
|
}
|
|
24
42
|
//#endregion
|
|
25
43
|
export { AssetPicker };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{useDepositSnapshot as e}from"../../driver/context.js";import{useDepositActions as t,useDepositEffectiveState as n}from"../../orchestrator/controller.js";import{DialogShell as r}from"../../../../shared/dialog/DialogShell.js";import{AssetPicker as i}from"../../../../shared/widgets/asset-picker/compound/AssetPicker.js";import"../../../../shared/widgets/asset-picker/compound/index.js";import{useMemo as a,useState as o}from"react";import{
|
|
1
|
+
"use client";import{useDepositSnapshot as e}from"../../driver/context.js";import{useDepositActions as t,useDepositEffectiveState as n}from"../../orchestrator/controller.js";import{DialogShell as r}from"../../../../shared/dialog/DialogShell.js";import{AssetPicker as i}from"../../../../shared/widgets/asset-picker/compound/AssetPicker.js";import"../../../../shared/widgets/asset-picker/compound/index.js";import{useMemo as a,useState as o}from"react";import{Fragment as s,jsx as c,jsxs as l}from"react/jsx-runtime";const u=l(s,{children:[c(i.Header,{}),c(i.Body,{children:c(i.List,{})}),c(i.Footer,{})]});function d({children:r,...s}){let l=e(),d=n(),{confirmAsset:m,back:h}=t(),[g,_]=o(void 0),v=l.balances,y=v.status===`ready`||v.status===`stale`?v.payload:[],b=a(()=>y.map(f),[y]),x=a(()=>(e=>e!==void 0&&b.some(t=>t.id===e&&!t.disabled))(g)?g:b.find(e=>!e.disabled)?.id,[g,b]),S=l.target,C=S.status===`ready`||S.status===`stale`?S.payload:void 0;if(d.name!==`assetPicker`)return null;let w=d.ctx.backTarget===`closed`?void 0:h,T=()=>{if(!x)return;let e=y.find(e=>p(e)===x);e&&m(e)};return c(i,{...s,...C?{token:{symbol:C.symbol}}:{},...x?{selectedId:x}:{},onSelect:_,assets:b,...w?{onBack:w}:{},onContinue:T,children:r??u})}function f(e){let t=p(e),n=`${e.amount.formatted} ${e.symbol}`,r=e.amountUsd?.formatted??`—`;return{id:t,symbol:e.symbol,chain:e.networkName,balance:e.amount.value,balanceFormatted:n,fiatFormatted:r,...e.eip155Id?{chainId:Number(e.eip155Id)}:{},...e.address?{contractAddress:e.address}:{},isNative:e.isNative,...e.assetLogoUrl?{logoUrl:e.assetLogoUrl}:{},...e.chainLogoUrl?{chainLogoUrl:e.chainLogoUrl}:{},decimals:e.decimals,...e.priceUsd===void 0?{}:{priceUsd:e.priceUsd},...e.lowBalance?{lowBalance:!0}:{},...e.disabled?{disabled:!0}:{}}}function p(e){return e.eip155Id?`${e.eip155Id}:${e.address||`native`}`:e.symbol.toLowerCase()}function m({open:e,defaultOpen:t,onOpenChange:n,trigger:i,...a}){return c(r,{open:e,defaultOpen:t,onOpenChange:n,trigger:i,children:c(d,{...a})})}(function(e){e.Dialog=m,e.Header=i.Header,e.Body=i.Body,e.List=i.List,e.Footer=i.Footer})(d||={});export{d as AssetPicker};
|
|
@@ -1,8 +1,25 @@
|
|
|
1
1
|
import { DialogShellControls } from "../../../../shared/dialog/DialogShell.js";
|
|
2
|
-
import {
|
|
2
|
+
import { ConfirmTransferBodyProps } from "../../../../shared/widgets/confirm-transfer/compound/types.js";
|
|
3
|
+
import { ConfirmTransferAmounts } from "../../../../shared/widgets/confirm-transfer/compound/components/Amounts.js";
|
|
4
|
+
import { ConfirmTransferBreakdown } from "../../../../shared/widgets/confirm-transfer/compound/components/Breakdown.js";
|
|
5
|
+
import { ConfirmTransferDisclaimer } from "../../../../shared/widgets/confirm-transfer/compound/components/Disclaimer.js";
|
|
6
|
+
import { ConfirmTransferFooter } from "../../../../shared/widgets/confirm-transfer/compound/components/Footer.js";
|
|
7
|
+
import { ConfirmTransferHeader } from "../../../../shared/widgets/confirm-transfer/compound/components/Header.js";
|
|
8
|
+
import { ConfirmTransferHero } from "../../../../shared/widgets/confirm-transfer/compound/components/Hero.js";
|
|
9
|
+
import { ConfirmTransferMeta } from "../../../../shared/widgets/confirm-transfer/compound/components/Meta.js";
|
|
10
|
+
import { ComponentProps, ReactNode } from "react";
|
|
3
11
|
import * as _$react_jsx_runtime0 from "react/jsx-runtime";
|
|
4
12
|
|
|
5
13
|
//#region src/flows/deposit/widgets/confirm-deposit/ConfirmDeposit.d.ts
|
|
14
|
+
interface ConfirmDepositOwnProps {
|
|
15
|
+
/**
|
|
16
|
+
* Optional custom composition. When omitted, the canonical default composition renders —
|
|
17
|
+
* `<Header />` + `<Body>` containing `<Hero />` `<Meta />` `<Amounts />` `<Breakdown />`
|
|
18
|
+
* `<Disclaimer />` + `<Footer />`. Pass children to interleave your own elements between
|
|
19
|
+
* compound parts, drop parts you don't want, or replace the composition entirely.
|
|
20
|
+
*/
|
|
21
|
+
children?: ReactNode;
|
|
22
|
+
}
|
|
6
23
|
/**
|
|
7
24
|
* Orchestrated `ConfirmDeposit` widget. Reads the driver's `quote` entity for the transfer
|
|
8
25
|
* payload + breakdown + hero amount, the driver's `brand` entity for the title brand, the FSM's
|
|
@@ -14,7 +31,10 @@ import * as _$react_jsx_runtime0 from "react/jsx-runtime";
|
|
|
14
31
|
* USD figure (`amount × asset.priceUsd`) so the user doesn't see `$0` flash before the
|
|
15
32
|
* round-trip completes.
|
|
16
33
|
*/
|
|
17
|
-
declare function ConfirmDeposit(
|
|
34
|
+
declare function ConfirmDeposit({
|
|
35
|
+
children,
|
|
36
|
+
...props
|
|
37
|
+
}: ComponentProps<"div"> & ConfirmDepositOwnProps): _$react_jsx_runtime0.JSX.Element | null;
|
|
18
38
|
declare function ConfirmDepositDialog({
|
|
19
39
|
open,
|
|
20
40
|
defaultOpen,
|
|
@@ -23,9 +43,22 @@ declare function ConfirmDepositDialog({
|
|
|
23
43
|
...rootProps
|
|
24
44
|
}: ConfirmDeposit.DialogProps): _$react_jsx_runtime0.JSX.Element;
|
|
25
45
|
declare namespace ConfirmDeposit {
|
|
26
|
-
type Props = ComponentProps<"div"
|
|
27
|
-
type DialogProps = ComponentProps<"div"> & DialogShellControls;
|
|
46
|
+
type Props = ComponentProps<"div"> & ConfirmDepositOwnProps;
|
|
47
|
+
type DialogProps = ComponentProps<"div"> & DialogShellControls & ConfirmDepositOwnProps;
|
|
28
48
|
const Dialog: typeof ConfirmDepositDialog;
|
|
49
|
+
/**
|
|
50
|
+
* Compound sub-parts exposed off the orchestrated widget so consumers can compose without
|
|
51
|
+
* importing the headless compound separately. Identity-equal to the parts on
|
|
52
|
+
* {@link ConfirmTransfer} from `@stridge/kit/deposit/compound`.
|
|
53
|
+
*/
|
|
54
|
+
const Header: typeof ConfirmTransferHeader;
|
|
55
|
+
const Body: (props: ConfirmTransferBodyProps) => _$react_jsx_runtime0.JSX.Element;
|
|
56
|
+
const Hero: typeof ConfirmTransferHero;
|
|
57
|
+
const Meta: typeof ConfirmTransferMeta;
|
|
58
|
+
const Amounts: typeof ConfirmTransferAmounts;
|
|
59
|
+
const Breakdown: typeof ConfirmTransferBreakdown;
|
|
60
|
+
const Disclaimer: typeof ConfirmTransferDisclaimer;
|
|
61
|
+
const Footer: typeof ConfirmTransferFooter;
|
|
29
62
|
}
|
|
30
63
|
//#endregion
|
|
31
64
|
export { ConfirmDeposit };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{useDepositSnapshot as e}from"../../driver/context.js";import{useKitI18n as t}from"../../../../shared/i18n/useKitI18n.js";import{useLingui as n}from"../../../../shared/i18n/useLingui.js";import"../../../../i18n/index.js";import{useDepositActions as r,useDepositEffectiveState as i,useDepositState as a}from"../../orchestrator/controller.js";import{formatDurationCoarse as o}from"../../../../shared/format/formatDurationCoarse.js";import{formatUsd as s}from"../../../../shared/format/formatUsd.js";import{useKitEmitter as c}from"../../../../events/emit/useKitEmitter.js";import"../../../../events/emit/index.js";import{DialogShell as l}from"../../../../shared/dialog/DialogShell.js";import{ConfirmTransfer as u}from"../../../../shared/widgets/confirm-transfer/compound/ConfirmTransfer.js";import"../../../../shared/widgets/confirm-transfer/compound/index.js";import{useQuoteCountdown as d}from"../../../../shared/quote/useQuoteCountdown.js";import"../../../../shared/quote/index.js";import{
|
|
1
|
+
"use client";import{useDepositSnapshot as e}from"../../driver/context.js";import{useKitI18n as t}from"../../../../shared/i18n/useKitI18n.js";import{useLingui as n}from"../../../../shared/i18n/useLingui.js";import"../../../../i18n/index.js";import{useDepositActions as r,useDepositEffectiveState as i,useDepositState as a}from"../../orchestrator/controller.js";import{formatDurationCoarse as o}from"../../../../shared/format/formatDurationCoarse.js";import{formatUsd as s}from"../../../../shared/format/formatUsd.js";import{useKitEmitter as c}from"../../../../events/emit/useKitEmitter.js";import"../../../../events/emit/index.js";import{DialogShell as l}from"../../../../shared/dialog/DialogShell.js";import{ConfirmTransfer as u}from"../../../../shared/widgets/confirm-transfer/compound/ConfirmTransfer.js";import"../../../../shared/widgets/confirm-transfer/compound/index.js";import{useQuoteCountdown as d}from"../../../../shared/quote/useQuoteCountdown.js";import"../../../../shared/quote/index.js";import{Fragment as f,jsx as p,jsxs as m}from"react/jsx-runtime";const h=m(f,{children:[p(u.Header,{}),m(u.Body,{children:[p(u.Hero,{}),p(u.Meta,{}),p(u.Amounts,{}),p(u.Breakdown,{}),p(u.Disclaimer,{})]}),p(u.Footer,{})]});function g({children:o,...l}){let f=e(),m=i(),g=a(),{confirmDeposit:y,back:x}=r(),{_:S}=n(),C=t(),w=c(),T=()=>{w({type:`deposit.confirm.clicked`,flow:`deposit`,tier:`ui`,payload:{}}),y()},E=f.quote,D=m.name===`confirmDeposit`?m.ctx.phase:void 0,O=f.target,k=f.wallet,A=g.name===`confirmDeposit`&&g.ctx.phase.kind===`ready`,j=d({expiresAt:D?.kind===`ready`?D.quoteExpiresAt:void 0,enabled:A});if(!D)return null;let M=D.kind===`loading`||D.kind===`regenerating`,N=v(f,O,k,C),P=b(f,{routeLabel:S({id:`rT8e1f`,message:`Route`}),networkCostLabel:S({id:`bZnukT`,message:`Network cost`}),priceImpactLabel:S({id:`kH6wUX`,message:`Price impact`}),maxSlippageLabel:S({id:`SZRUQ4`,message:`Max slippage`})}),F=`$0.00`;if(E.status===`ready`||E.status===`stale`)F=E.payload.heroAmountUsd.formatted;else if(g.name===`confirmDeposit`){let e=g.ctx.asset,t=g.ctx.amount,n=e?.priceUsd;F=s(typeof n==`number`&&Number.isFinite(n)&&n>0?t*n:t,C)}let I=E.status===`ready`||E.status===`stale`?E.payload.quoteTotalSeconds:30,L=j,R=_(D),z=D.kind===`failed`?D.failure:void 0,B=D.kind===`regenerating`?D.notice:void 0,V=O.status===`ready`||O.status===`stale`?O.payload:void 0,H=f.brand.status===`ready`||f.brand.status===`stale`?f.brand.payload:void 0,U=V&&H?.name?S({id:`zbtijb`,message:`Deposit {0} to {1}`,values:{0:V.symbol,1:H.name}}):void 0;return p(u,{...l,transfer:N,breakdown:P,heroAmountUsd:F,loading:M,phase:R,...B?{notice:B}:{},...z?{error:{message:z.reason,...z.code?{code:z.code}:{}}}:{},...L===void 0?{}:{quoteSeconds:L},quoteTotalSeconds:I,...U?{headerTitle:U}:{},onBack:x,onConfirm:T,children:o??h})}function _(e){switch(e.kind){case`loading`:return`loading`;case`ready`:return`ready`;case`regenerating`:return`regenerating`;case`submitting`:return`submitting`;case`failed`:return`error`}}function v(e,t,n,r){let i=e.quote,a=i.status===`ready`||i.status===`stale`?i.payload:void 0,s=t.status===`ready`||t.status===`stale`?t.payload:void 0,c=n.status===`ready`||n.status===`stale`?n.payload:void 0,l=e.brand.status===`ready`||e.brand.status===`stale`?e.brand.payload:void 0,u=a?.sendAsset,d=a?.receiveAsset??s,f=l?.name?`${l.name} Account`:`Account`,p=a?.etaSeconds===void 0?`—`:o(a.etaSeconds*1e3,r);return{sourceLabel:c?`Wallet (${c.address.formatted})`:`Wallet`,destinationLabel:f,eta:p,sendAmount:a?a.sendAmount.formatted:`0`,sendToken:u?y(u):{symbol:`—`},receiveAmount:a?a.receiveAmount.formatted:`0`,receiveToken:d?y(d):{symbol:s?.symbol??`—`}}}function y(e){return{symbol:e.symbol,...e.chainId===void 0?{}:{chainId:e.chainId},...e.address?{address:e.address}:{},...e.isNative===void 0?{}:{isNative:e.isNative},...e.assetLogoUrl?{logoUrl:e.assetLogoUrl}:{}}}function b(e,t){let n=e.quote,r=n.status===`ready`||n.status===`stale`?n.payload:void 0;if(!r?.breakdown)return{};let i=r.breakdown,a={};return i.selectedRoute&&(a.selectedRoute={label:t.routeLabel,value:i.selectedRoute.label}),i.networkCost&&(a.networkCost={label:t.networkCostLabel,valueUsd:i.networkCost.formatted}),i.priceImpact&&(a.priceImpact={label:t.priceImpactLabel,valuePercent:i.priceImpact.formatted}),i.maxSlippage&&(a.maxSlippage={label:t.maxSlippageLabel,valuePercent:i.maxSlippage.value.formatted,auto:i.maxSlippage.auto}),a}function x({open:e,defaultOpen:t,onOpenChange:n,trigger:r,...i}){return p(l,{open:e,defaultOpen:t,onOpenChange:n,trigger:r,children:p(g,{...i})})}(function(e){e.Dialog=x,e.Header=u.Header,e.Body=u.Body,e.Hero=u.Hero,e.Meta=u.Meta,e.Amounts=u.Amounts,e.Breakdown=u.Breakdown,e.Disclaimer=u.Disclaimer,e.Footer=u.Footer})(g||={});export{g as ConfirmDeposit};
|
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
import { DialogShellControls } from "../../../../shared/dialog/DialogShell.js";
|
|
2
|
-
import {
|
|
2
|
+
import { DepositBodyProps } from "./compound/types.js";
|
|
3
|
+
import { DepositHeader } from "./compound/components/Header.js";
|
|
4
|
+
import { DepositMethod } from "./compound/components/Method.js";
|
|
5
|
+
import { DepositMethods } from "./compound/components/Methods.js";
|
|
6
|
+
import { DepositSteps } from "./compound/components/Steps.js";
|
|
7
|
+
import { Deposit as Deposit$1 } from "./compound/Deposit.js";
|
|
8
|
+
import { ComponentProps, ReactNode } from "react";
|
|
3
9
|
import * as _$react_jsx_runtime0 from "react/jsx-runtime";
|
|
4
10
|
|
|
5
11
|
//#region src/flows/deposit/widgets/deposit/Deposit.d.ts
|
|
@@ -13,7 +19,19 @@ import * as _$react_jsx_runtime0 from "react/jsx-runtime";
|
|
|
13
19
|
* bar while `wallet.balanceTotalUsd` resolves, and the Transfer Crypto tile's chain stack is
|
|
14
20
|
* driven by whatever rows the driver has surfaced so far.
|
|
15
21
|
*/
|
|
16
|
-
|
|
22
|
+
interface DepositOwnProps {
|
|
23
|
+
/**
|
|
24
|
+
* Optional custom composition. When omitted, the canonical default composition renders —
|
|
25
|
+
* `<Header />` + `<Body>` containing `<Methods />`. Pass children to interleave your own
|
|
26
|
+
* elements between compound parts, drop parts you don't want, or replace the composition
|
|
27
|
+
* entirely.
|
|
28
|
+
*/
|
|
29
|
+
children?: ReactNode;
|
|
30
|
+
}
|
|
31
|
+
declare function Deposit({
|
|
32
|
+
children,
|
|
33
|
+
...props
|
|
34
|
+
}: ComponentProps<"div"> & DepositOwnProps): _$react_jsx_runtime0.JSX.Element | null;
|
|
17
35
|
declare function DepositDialog({
|
|
18
36
|
open,
|
|
19
37
|
defaultOpen,
|
|
@@ -22,9 +40,20 @@ declare function DepositDialog({
|
|
|
22
40
|
...rootProps
|
|
23
41
|
}: Deposit.DialogProps): _$react_jsx_runtime0.JSX.Element;
|
|
24
42
|
declare namespace Deposit {
|
|
25
|
-
type Props = ComponentProps<"div"
|
|
26
|
-
type DialogProps = ComponentProps<"div"> & DialogShellControls;
|
|
43
|
+
type Props = ComponentProps<"div"> & DepositOwnProps;
|
|
44
|
+
type DialogProps = ComponentProps<"div"> & DialogShellControls & DepositOwnProps;
|
|
27
45
|
const Dialog: typeof DepositDialog;
|
|
46
|
+
/**
|
|
47
|
+
* Compound sub-parts aliased on the orchestrated widget so consumers can compose without
|
|
48
|
+
* importing the headless compound separately. Identity-equal to the parts on the compound
|
|
49
|
+
* exported from `@stridge/kit/deposit/compound`.
|
|
50
|
+
*/
|
|
51
|
+
const Header: typeof DepositHeader;
|
|
52
|
+
const Body: (props: DepositBodyProps) => _$react_jsx_runtime0.JSX.Element;
|
|
53
|
+
const Methods: typeof DepositMethods;
|
|
54
|
+
const Method: typeof DepositMethod;
|
|
55
|
+
const Steps: typeof DepositSteps;
|
|
56
|
+
const Step: typeof Deposit$1.Step;
|
|
28
57
|
}
|
|
29
58
|
//#endregion
|
|
30
59
|
export { Deposit };
|
|
@@ -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,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{
|
|
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{Fragment as p,jsx as m,jsxs as h}from"react/jsx-runtime";const g={width:18,height:18,"aria-hidden":!0},_=h(p,{children:[m(d.Header,{}),m(d.Body,{children:m(d.Methods,{})})]});function v({children:s,...c}){let u=e(),p=r().name,{selectMethod:h}=n(),v=i(),{_:b}=t(),x=u.wallet,S=x.status===`ready`||x.status===`stale`?x.payload:void 0,C=S!==void 0,w=u.brand,T=w.status===`ready`||w.status===`stale`?w.payload:void 0,E=u.addresses,D=E.status===`ready`||E.status===`stale`?E.payload:[],O=u.balances.status===`error`,k=!S?.balanceTotalUsd?.formatted&&!O,A=!!u.brand,j=T?.name?b({id:`ogD_nm`,message:`Deposit to {0}`,values:{0:T.name}}):void 0,M=f(()=>y(D),[D]),N=v?.wallet,P=v?.transfer,F=f(()=>{let e=!C||k,t=N?.disabled??!1,n=e||t,r=t?N?.disabledHint:void 0,i=(()=>{if(t)return r;if(!C)return b({id:`5AApJw`,message:`Connect a wallet to continue`});if(S?.balanceTotalUsd?.formatted)return S.balanceTotalUsd.formatted;if(!O)return m(l,{width:56,height:12})})(),s=[{id:`wallet`,title:b({id:`sb9Y58`,message:`Wallet`}),icon:m(o,{...g}),...S&&!t?{titleAdornment:S.address.formatted}:{},...i===void 0?{}:{meta:i},recommended:!0,disabled:n,onSelect:n?void 0:()=>h(`wallet`)}];if(A){let e=P?.disabled??!1,t=e?P?.disabledHint:void 0,n=e?t:[b({id:`qtoOYG`,message:`No limit`}),b({id:`D79cZK`,message:`Instant`})];s.push({id:`transfer`,title:b({id:`3dqPLT`,message:`Transfer Crypto`}),icon:m(a,{...g}),...n===void 0?{}:{meta:n},...M?{trailing:M}:{},disabled:e,onSelect:e?void 0:()=>h(`transfer`)})}return s},[S,O,k,C,A,M,N,P,h,b]);return p===`deposit`?m(d,{...c,...j?{title:j}:{},methods:F,children:s??_}):null}function y(e){if(e.length!==0)return m(c.Group,{max:4,overflow:Math.max(0,e.length-4),size:`md`,children:e.map(e=>m(u,{isNative:!0,symbol:e.networkName,...e.eip155Id?{chainId:Number(e.eip155Id)}:{},...e.chainLogoUrl?{logoUrl:e.chainLogoUrl}:{},hideChainBadge:!0},e.eip155Id??e.networkName))})}function b({open:e,defaultOpen:t,onOpenChange:n,trigger:r,...i}){return m(s,{open:e,defaultOpen:t,onOpenChange:n,trigger:r,children:m(v,{...i})})}(function(e){e.Dialog=b,e.Header=d.Header,e.Body=d.Body,e.Methods=d.Methods,e.Method=d.Method,e.Steps=d.Steps,e.Step=d.Step})(v||={});export{v as Deposit};
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { DepositStateName } from "../../../orchestrator/types.js";
|
|
2
|
+
import { DepositBoundary, Props } from "./components/Boundary.js";
|
|
3
|
+
import { DepositGuards, Props as Props$1 } from "./components/Guards.js";
|
|
2
4
|
import { DepositBodyProps, DepositDialogProps, DepositHeaderProps, DepositMethodProps, DepositMethodsProps, DepositProps } from "./types.js";
|
|
3
5
|
import { DepositHeader } from "./components/Header.js";
|
|
4
6
|
import { DepositMethod } from "./components/Method.js";
|
|
@@ -53,6 +55,8 @@ declare namespace Deposit {
|
|
|
53
55
|
type DialogProps = DepositDialogProps;
|
|
54
56
|
type StepsProps = DepositStepsProps;
|
|
55
57
|
type StepProps = DepositStepProps;
|
|
58
|
+
type GuardsProps = Props$1;
|
|
59
|
+
type BoundaryProps = Props;
|
|
56
60
|
const Header: typeof DepositHeader;
|
|
57
61
|
const Body: typeof DepositBody;
|
|
58
62
|
const Methods: typeof DepositMethods;
|
|
@@ -64,6 +68,16 @@ declare namespace Deposit {
|
|
|
64
68
|
* matched step's `children` are rendered, every other branch is dropped.
|
|
65
69
|
*/
|
|
66
70
|
const Step: (props: DepositStepProps) => null;
|
|
71
|
+
/**
|
|
72
|
+
* Bootstrap-cascade guard. Wraps step content with three gates (wallet-required,
|
|
73
|
+
* bootstrap-fatal, bootstrap-loading); renders the matching gate panel or children.
|
|
74
|
+
*/
|
|
75
|
+
const Guards: typeof DepositGuards;
|
|
76
|
+
/**
|
|
77
|
+
* Error-boundary part. Wires the kit's `GatewayKitBoundary` with deposit-flow recovery —
|
|
78
|
+
* `onReset` calls `useDeposit().close()` internally; `onError` is host-supplied.
|
|
79
|
+
*/
|
|
80
|
+
const Boundary: typeof DepositBoundary;
|
|
67
81
|
}
|
|
68
82
|
//#endregion
|
|
69
83
|
export { Deposit };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{DialogShell as e}from"../../../../../shared/dialog/DialogShell.js";import{Card as t}from"../../../../../shared/ui/Card/Card.js";import{Step as n}from"../../../../../shared/ui/Steps/Steps.js";import"../../../../../shared/ui/Steps/index.js";import{Tooltip as r}from"../../../../../shared/ui/Tooltip/Tooltip.js";import"../../../../../shared/ui/Tooltip/index.js";import"../../../../../ui/index.js";import{Frame as i}from"../../../../../shared/dialog/Frame.js";import{
|
|
1
|
+
"use client";import{DialogShell as e}from"../../../../../shared/dialog/DialogShell.js";import{Card as t}from"../../../../../shared/ui/Card/Card.js";import{Step as n}from"../../../../../shared/ui/Steps/Steps.js";import"../../../../../shared/ui/Steps/index.js";import{Tooltip as r}from"../../../../../shared/ui/Tooltip/Tooltip.js";import"../../../../../shared/ui/Tooltip/index.js";import"../../../../../ui/index.js";import{Frame as i}from"../../../../../shared/dialog/Frame.js";import{DepositBoundary as a}from"./components/Boundary.js";import{DepositGuards as o}from"./components/Guards.js";import{DepositContext as s}from"./context.js";import{DEPOSIT_SLOTS as c}from"./Deposit.slots.js";import{styles as l}from"./Deposit.styles.js";import{DepositHeader as u}from"./components/Header.js";import{DepositMethod as d}from"./components/Method.js";import{DepositMethods as f}from"./components/Methods.js";import{DepositSteps as p}from"./components/Steps.js";import{useMemo as m}from"react";import{jsx as h}from"react/jsx-runtime";import*as g from"@stylexjs/stylex";const _=[];function v(e){let{title:t,methodsLabel:n,methods:a=_,children:o}=e,u=m(()=>({title:t,methodsLabel:n,methods:a}),[t,n,a]);return h(s.Provider,{value:u,children:h(r.Provider,{children:h(i,{"data-stridge-slot":c.root,...g.props(l.root),children:o})})})}function y(e){return h(t.Body,{"data-stridge-slot":c.body,...e})}function b({open:t,defaultOpen:n,onOpenChange:r,trigger:i,children:a,...o}){return h(e,{open:t,defaultOpen:n,onOpenChange:r,trigger:i,children:h(v,{...o,children:a})})}(function(e){e.Header=u,e.Body=y,e.Methods=f,e.Method=d,e.Dialog=b,e.Steps=p,e.Step=n,e.Guards=o,e.Boundary=a})(v||={});export{v as Deposit};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { ErrorInfo, ReactNode } from "react";
|
|
2
|
+
import * as _$react_jsx_runtime0 from "react/jsx-runtime";
|
|
3
|
+
|
|
4
|
+
//#region src/flows/deposit/widgets/deposit/compound/components/Boundary.d.ts
|
|
5
|
+
interface Props {
|
|
6
|
+
children: ReactNode;
|
|
7
|
+
/**
|
|
8
|
+
* Replaces the kit's default crash fallback. Compose `GatewayKitErrorCard` parts to keep
|
|
9
|
+
* kit styling, or render your own JSX for a fully custom recovery surface.
|
|
10
|
+
*/
|
|
11
|
+
fallback?: ReactNode;
|
|
12
|
+
/**
|
|
13
|
+
* Fires once per caught render error. Pipe to your analytics or error-reporting pipeline
|
|
14
|
+
* (Sentry, Datadog, etc.) — the boundary itself only logs to `console.error` in development.
|
|
15
|
+
*/
|
|
16
|
+
onError?: (error: Error, errorInfo: ErrorInfo) => void;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Error-boundary part for the deposit flow. Wraps children with the kit's `GatewayKitBoundary`
|
|
20
|
+
* and pipes the recovery action through `useDeposit().close()` so a crash returns the user to a
|
|
21
|
+
* clean state. `onError` is host-supplied; `onReset` is wired internally.
|
|
22
|
+
*/
|
|
23
|
+
declare function DepositBoundary({
|
|
24
|
+
children,
|
|
25
|
+
fallback,
|
|
26
|
+
onError
|
|
27
|
+
}: Props): _$react_jsx_runtime0.JSX.Element;
|
|
28
|
+
//#endregion
|
|
29
|
+
export { DepositBoundary, Props };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import{useDepositActions as e}from"../../../../orchestrator/controller.js";import{GatewayKitBoundary as t}from"../../../../../../shared/error-handling/components/GatewayKitBoundary.js";import"../../../../../../shared/error-handling/index.js";import{jsx as n}from"react/jsx-runtime";function r({children:r,fallback:i,onError:a}){let{close:o}=e();return n(t,{...a?{onError:a}:{},...i===void 0?{}:{fallback:i},onReset:o,children:r})}export{r as DepositBoundary};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
import * as _$react_jsx_runtime0 from "react/jsx-runtime";
|
|
3
|
+
|
|
4
|
+
//#region src/flows/deposit/widgets/deposit/compound/components/Guards.d.ts
|
|
5
|
+
interface Props {
|
|
6
|
+
children: ReactNode;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Bootstrap-cascade guard. Wraps the step content with three gates, in priority order:
|
|
10
|
+
*
|
|
11
|
+
* - **Wallet required** — `<StridgeProvider>` couldn't resolve a deposit owner from any of
|
|
12
|
+
* `flows.deposit.owner` / wagmi / `dev.userAddressOverride`. Routes to a "Connect a wallet"
|
|
13
|
+
* panel. BYO-driver hosts using `<KitProvider>` directly skip this gate entirely (no
|
|
14
|
+
* owner-context provider above).
|
|
15
|
+
* - **Bootstrap fatal** — `gateway/start` landed in `error`. The dependent steps lose the
|
|
16
|
+
* data they would render against; route to a recovery card.
|
|
17
|
+
* - **Bootstrap loading** — `gateway/start` is in flight (`idle` / `loading`). Surface a
|
|
18
|
+
* centered spinner inside the same frame instead of empty step chrome.
|
|
19
|
+
*
|
|
20
|
+
* When none of the gates fire, renders the children unchanged. Terminal FSM steps
|
|
21
|
+
* (`processing` / `success` / `error`) also fall through because their data comes from
|
|
22
|
+
* `settlement`, not bootstrap.
|
|
23
|
+
*/
|
|
24
|
+
declare function DepositGuards({
|
|
25
|
+
children
|
|
26
|
+
}: Props): _$react_jsx_runtime0.JSX.Element;
|
|
27
|
+
//#endregion
|
|
28
|
+
export { DepositGuards, Props };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import{useDepositSnapshot as e}from"../../../../driver/context.js";import{useDepositEffectiveState as t}from"../../../../orchestrator/controller.js";import{useDepositOwnerContext as n}from"../../../../../../stridge/depositOwner.js";import{DepositBootstrapErrorState as r}from"../../../../dialog/DepositBootstrapErrorState.js";import{WalletRequiredState as i}from"../../../../dialog/WalletRequiredState.js";import{LoadingState as a}from"../../../../../../shared/dialog/LoadingState.js";import{Fragment as o,jsx as s}from"react/jsx-runtime";const c=new Set([`deposit`,`assetPicker`,`amountEntry`,`confirmDeposit`,`transferCrypto`]);function l({children:l}){let u=t(),d=e(),f=n(),p=c.has(u.name);return f!==null&&!f.resolved&&p?s(i,{}):d.target.status===`error`&&p?s(r,{}):(d.target.status===`loading`||d.target.status===`idle`)&&p?s(a,{slot:`deposit`}):s(o,{children:l})}export{l as DepositGuards};
|
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
import { DepositStatusBannerBody } from "./compound/components/Body.js";
|
|
2
|
+
import { DepositStatusBannerClose } from "./compound/components/Close.js";
|
|
3
|
+
import { DepositStatusBannerDetails } from "./compound/components/Details.js";
|
|
4
|
+
import { DepositStatusBannerFooter } from "./compound/components/Footer.js";
|
|
5
|
+
import { DepositStatusBannerHero } from "./compound/components/Hero.js";
|
|
6
|
+
import { DepositStatusBannerPrimaryAction } from "./compound/components/PrimaryAction.js";
|
|
7
|
+
import { DepositStatusBannerCompletionTxRow, DepositStatusBannerDepositTxRow, DepositStatusBannerFilledAtRow, DepositStatusBannerSubmittedAtRow } from "./compound/components/Rows.js";
|
|
8
|
+
import { DepositStatusBannerToggle } from "./compound/components/Toggle.js";
|
|
9
|
+
import { ReactNode } from "react";
|
|
1
10
|
import * as _$react_jsx_runtime0 from "react/jsx-runtime";
|
|
2
11
|
|
|
3
12
|
//#region src/flows/deposit/widgets/deposit-status-banner/DepositStatusBanner.d.ts
|
|
@@ -22,6 +31,30 @@ import * as _$react_jsx_runtime0 from "react/jsx-runtime";
|
|
|
22
31
|
* still carries the terminal payload. `processing` is deliberately NOT auto-acked — an
|
|
23
32
|
* in-flight deposit should still re-surface its banner on reopen.
|
|
24
33
|
*/
|
|
25
|
-
|
|
34
|
+
interface DepositStatusBannerProps {
|
|
35
|
+
/**
|
|
36
|
+
* Optional custom composition rendered inside the banner shell. Defaults to `<Body><Hero />
|
|
37
|
+
* <Close /></Body>` + `<Details>…tx rows…</Details>` + `<Footer><Toggle /><PrimaryAction />
|
|
38
|
+
* </Footer>`. Pass children to interleave your own elements between parts.
|
|
39
|
+
*/
|
|
40
|
+
children?: ReactNode;
|
|
41
|
+
}
|
|
42
|
+
declare function DepositStatusBanner({
|
|
43
|
+
children
|
|
44
|
+
}?: DepositStatusBannerProps): _$react_jsx_runtime0.JSX.Element;
|
|
45
|
+
declare namespace DepositStatusBanner {
|
|
46
|
+
type Props = DepositStatusBannerProps;
|
|
47
|
+
const Body: typeof DepositStatusBannerBody;
|
|
48
|
+
const Hero: typeof DepositStatusBannerHero;
|
|
49
|
+
const Close: typeof DepositStatusBannerClose;
|
|
50
|
+
const Details: typeof DepositStatusBannerDetails;
|
|
51
|
+
const DepositTxRow: typeof DepositStatusBannerDepositTxRow;
|
|
52
|
+
const CompletionTxRow: typeof DepositStatusBannerCompletionTxRow;
|
|
53
|
+
const SubmittedAtRow: typeof DepositStatusBannerSubmittedAtRow;
|
|
54
|
+
const FilledAtRow: typeof DepositStatusBannerFilledAtRow;
|
|
55
|
+
const Footer: typeof DepositStatusBannerFooter;
|
|
56
|
+
const Toggle: typeof DepositStatusBannerToggle;
|
|
57
|
+
const PrimaryAction: typeof DepositStatusBannerPrimaryAction;
|
|
58
|
+
}
|
|
26
59
|
//#endregion
|
|
27
60
|
export { DepositStatusBanner };
|