@stridge/kit 0.1.0-alpha.44 → 0.1.0-alpha.45

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.
Files changed (56) hide show
  1. package/dist/flows/deposit/dialog/DepositDialog.d.ts +9 -4
  2. package/dist/flows/deposit/dialog/DepositDialog.js +1 -1
  3. package/dist/flows/deposit/widgets/amount-entry/AmountEntry.d.ts +31 -4
  4. package/dist/flows/deposit/widgets/amount-entry/AmountEntry.js +1 -1
  5. package/dist/flows/deposit/widgets/asset-picker/AssetPicker.d.ts +22 -4
  6. package/dist/flows/deposit/widgets/asset-picker/AssetPicker.js +1 -1
  7. package/dist/flows/deposit/widgets/confirm-deposit/ConfirmDeposit.d.ts +37 -4
  8. package/dist/flows/deposit/widgets/confirm-deposit/ConfirmDeposit.js +1 -1
  9. package/dist/flows/deposit/widgets/deposit/Deposit.d.ts +33 -4
  10. package/dist/flows/deposit/widgets/deposit/Deposit.js +1 -1
  11. package/dist/flows/deposit/widgets/deposit/compound/Deposit.d.ts +14 -0
  12. package/dist/flows/deposit/widgets/deposit/compound/Deposit.js +1 -1
  13. package/dist/flows/deposit/widgets/deposit/compound/components/Boundary.d.ts +29 -0
  14. package/dist/flows/deposit/widgets/deposit/compound/components/Boundary.js +1 -0
  15. package/dist/flows/deposit/widgets/deposit/compound/components/Guards.d.ts +28 -0
  16. package/dist/flows/deposit/widgets/deposit/compound/components/Guards.js +1 -0
  17. package/dist/flows/deposit/widgets/deposit-status-banner/DepositStatusBanner.d.ts +34 -1
  18. package/dist/flows/deposit/widgets/deposit-status-banner/DepositStatusBanner.js +1 -1
  19. package/dist/flows/deposit/widgets/error-state/ErrorState.d.ts +39 -4
  20. package/dist/flows/deposit/widgets/error-state/ErrorState.js +1 -1
  21. package/dist/flows/deposit/widgets/processing-state/ProcessingState.d.ts +30 -4
  22. package/dist/flows/deposit/widgets/processing-state/ProcessingState.js +1 -1
  23. package/dist/flows/deposit/widgets/success-state/SuccessState.d.ts +38 -4
  24. package/dist/flows/deposit/widgets/success-state/SuccessState.js +1 -1
  25. package/dist/flows/deposit/widgets/transfer-crypto/TransferCrypto.d.ts +34 -3
  26. package/dist/flows/deposit/widgets/transfer-crypto/TransferCrypto.js +1 -1
  27. package/dist/flows/withdraw/dialog/WithdrawDialog.js +1 -1
  28. package/dist/flows/withdraw/widgets/withdraw/compound/Withdraw.d.ts +15 -0
  29. package/dist/flows/withdraw/widgets/withdraw/compound/Withdraw.js +1 -1
  30. package/dist/flows/withdraw/widgets/withdraw/compound/components/Boundary.d.ts +29 -0
  31. package/dist/flows/withdraw/widgets/withdraw/compound/components/Boundary.js +1 -0
  32. package/dist/flows/withdraw/widgets/withdraw/compound/components/Guards.d.ts +25 -0
  33. package/dist/flows/withdraw/widgets/withdraw/compound/components/Guards.js +1 -0
  34. package/dist/flows/withdraw/widgets/withdraw-error/WithdrawError.d.ts +45 -2
  35. package/dist/flows/withdraw/widgets/withdraw-error/WithdrawError.js +1 -1
  36. package/dist/flows/withdraw/widgets/withdraw-form/WithdrawForm.d.ts +29 -1
  37. package/dist/flows/withdraw/widgets/withdraw-form/WithdrawForm.js +1 -1
  38. package/dist/flows/withdraw/widgets/withdraw-in-progress/WithdrawInProgress.d.ts +37 -2
  39. package/dist/flows/withdraw/widgets/withdraw-in-progress/WithdrawInProgress.js +1 -1
  40. package/dist/flows/withdraw/widgets/withdraw-success/WithdrawSuccess.d.ts +46 -2
  41. package/dist/flows/withdraw/widgets/withdraw-success/WithdrawSuccess.js +1 -1
  42. package/dist/package.js +1 -1
  43. package/dist/shared/widgets/amount-entry/compound/AmountEntry.d.ts +4 -1
  44. package/dist/shared/widgets/amount-entry/compound/AmountEntry.js +1 -1
  45. package/dist/shared/widgets/amount-entry/compound/AmountEntry.slots.d.ts +1 -0
  46. package/dist/shared/widgets/amount-entry/compound/AmountEntry.slots.js +1 -1
  47. package/dist/shared/widgets/amount-entry/compound/AmountEntry.styles.js +1 -1
  48. package/dist/shared/widgets/amount-entry/compound/components/Notice.d.ts +7 -0
  49. package/dist/shared/widgets/amount-entry/compound/components/Notice.js +1 -0
  50. package/dist/shared/widgets/amount-entry/compound/types.d.ts +12 -1
  51. package/dist/shared/widgets/error-state/compound/components/MoreDetails.d.ts +1 -1
  52. package/dist/shared/widgets/error-state/compound/components/MoreDetails.js +1 -1
  53. package/dist/shared/widgets/success-state/compound/components/MoreDetails.d.ts +1 -1
  54. package/dist/shared/widgets/success-state/compound/components/MoreDetails.js +1 -1
  55. package/dist/styles/index.css +4 -0
  56. package/package.json +1 -1
@@ -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
- * Each widget gates rendering on its own FSM state, so the dialog stacks them and only one
12
- * renders content per state. Skip the dialog entirely for fully custom UI — render against
13
- * `useDeposit()` / `useDepositState()` / `useDepositSnapshot()` directly.
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
- /** Forwarded to the dialog's internal {@link GatewayKitBoundary} for crash reporting. */
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{useDepositOwnerContext as i}from"../../../stridge/depositOwner.js";import{Dialog as a}from"../../../shared/ui/Dialog/Dialog.js";import"../../../shared/ui/Dialog/index.js";import{Deposit as o}from"../widgets/deposit/compound/Deposit.js";import"../widgets/deposit/compound/index.js";import{AmountEntry as s}from"../widgets/amount-entry/AmountEntry.js";import"../widgets/amount-entry/index.js";import{AssetPicker as c}from"../widgets/asset-picker/AssetPicker.js";import"../widgets/asset-picker/index.js";import{ConfirmDeposit as l}from"../widgets/confirm-deposit/ConfirmDeposit.js";import"../widgets/confirm-deposit/index.js";import{Deposit as u}from"../widgets/deposit/Deposit.js";import"../widgets/deposit/index.js";import{DepositStatusBanner as d}from"../widgets/deposit-status-banner/DepositStatusBanner.js";import"../widgets/deposit-status-banner/index.js";import{ErrorState as f}from"../widgets/error-state/ErrorState.js";import"../widgets/error-state/index.js";import{ProcessingState as p}from"../widgets/processing-state/ProcessingState.js";import"../widgets/processing-state/index.js";import{SuccessState as m}from"../widgets/success-state/SuccessState.js";import"../widgets/success-state/index.js";import{TransferCrypto as h}from"../widgets/transfer-crypto/TransferCrypto.js";import"../widgets/transfer-crypto/index.js";import{LoadingState as g}from"../../../shared/dialog/LoadingState.js";import{GatewayKitBoundary as _}from"../../../shared/error-handling/components/GatewayKitBoundary.js";import"../../../shared/error-handling/index.js";import{DepositBootstrapErrorState as v}from"./DepositBootstrapErrorState.js";import{WalletRequiredState as y}from"./WalletRequiredState.js";import{jsx as b,jsxs as x}from"react/jsx-runtime";const S=new Set([`deposit`,`assetPicker`,`amountEntry`,`confirmDeposit`,`transferCrypto`]);function C({container:C,metadata:w,onError:T}={}){let{state:E,effectiveState:D,controller:O}=t(),k=e(),A=i(),j=E.name!==`closed`;n({state:E,settlement:k.settlement,quote:k.quote,metadata:w}),r();let M=D,N=A!==null&&!A.resolved&&S.has(M.name),P=!N&&k.target.status===`error`&&S.has(M.name),F=!N&&!P&&(k.target.status===`loading`||k.target.status===`idle`)&&S.has(M.name);return b(a,{open:j,onOpenChange:e=>{e||O.close()},children:b(a.Content,{container:C,children:x(_,{onError:T,onReset:O.close,children:[N?b(y,{}):P?b(v,{}):F?b(g,{slot:`deposit`}):x(o.Steps,{children:[b(o.Step,{name:`deposit`,children:b(u,{})}),b(o.Step,{name:`assetPicker`,children:b(c,{})}),b(o.Step,{name:`amountEntry`,children:b(s,{})}),b(o.Step,{name:`confirmDeposit`,children:b(l,{})}),b(o.Step,{name:`transferCrypto`,children:b(h,{})}),b(o.Step,{name:`processing`,children:b(p,{})}),b(o.Step,{name:`success`,children:b(m,{})}),b(o.Step,{name:`error`,children:b(f,{})})]}),b(d,{})]})})})}export{C as DepositDialog};
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,5 +1,12 @@
1
1
  import { DialogShellControls } from "../../../../shared/dialog/DialogShell.js";
2
- import { ComponentProps } from "react";
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
- declare function AmountEntry(props: ComponentProps<"div">): _$react_jsx_runtime0.JSX.Element | null;
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 a}from"../../orchestrator/controller.js";import{formatTokenAmount as o}from"../../../../shared/format/formatTokenAmount.js";import{useKitEmitter as s}from"../../../../events/emit/useKitEmitter.js";import"../../../../events/emit/index.js";import{DialogShell as c}from"../../../../shared/dialog/DialogShell.js";import{text as l}from"../../../../shared/ui/Text/Text.js";import"../../../../shared/ui/Text/index.js";import{AmountEntry as u}from"../../../../shared/widgets/amount-entry/compound/AmountEntry.js";import"../../../../shared/widgets/amount-entry/compound/index.js";import{toAssetDescriptor as d}from"../../../../shared/widgets/asset-descriptor.js";import{effectiveMaxUsd as f,resolveFooterIntent as p}from"./footerIntent.js";import{useEffect as m,useRef as h,useState as g}from"react";import{jsx as _,jsxs as v}from"react/jsx-runtime";import{AnimatePresence as y,m as b}from"motion/react";const x=[.16,1,.3,1],S={enter:{opacity:0,height:0},center:{opacity:1,height:`auto`,transition:{duration:.22,ease:x}},exit:{opacity:0,height:0,transition:{duration:.18,ease:x}}},C={enter:{opacity:0,filter:`blur(6px)`},center:{opacity:1,filter:`blur(0px)`,transition:{duration:.2,ease:x}},exit:{opacity:0,filter:`blur(6px)`,transition:{duration:.16,ease:x}}},w=[{value:`25`,label:`25%`},{value:`50`,label:`50%`},{value:`75`,label:`75%`},{value:`max`,label:`Max`}];function T(n){let c=e(),l=a(),{confirmAmount:y,back:b}=i(),{_:x}=r(),S=t(),C=c.target,T=C.status===`ready`||C.status===`stale`?C.payload:void 0,O=l.name===`amountEntry`?l.ctx.asset:void 0,k=O?.amountUsd?.value??0,A=T?.minAmountUsd?.value,j=T?.minAmountUsd?.formatted,M=T?.maxAmountUsd?.value,N=T?.maxAmountUsd?.formatted,P=f(k,M),F=O?.priceUsd,[I,L]=g(A??null),[R,z]=g(),B=s(),V=e=>{B({type:`deposit.amount.changed`,flow:`deposit`,tier:`ui`,payload:{raw:e===null?``:String(e),numeric:e}})},H=h(void 0),U=O?`${O.eip155Id??``}:${O.address??``}`:void 0;m(()=>{U&&H.current!==U&&(H.current=U,typeof A==`number`&&(L(A),z(void 0)))},[U,A]);let W=e=>{z(e);let t=e===`max`?1:Number.parseInt(e,10)/100;if(Number.isFinite(t)){let n=P*t;L(n),V(n),e===`max`&&B({type:`deposit.max.clicked`,flow:`deposit`,tier:`ui`,payload:{}})}},G=e=>{L(e),z(void 0),V(e)},K=p({amount:I,...A===void 0?{}:{minAmountUsd:A},...M===void 0?{}:{maxAmountUsd:M},walletBalanceUsd:k}),q=()=>{if(K===`aboveBalance`||K===`aboveCap`){L(P),z(`max`);return}if(K===`belowMin`&&typeof A==`number`){L(A),z(void 0);return}I!==null&&y(F&&F>0?I/F:I)};if(l.name!==`amountEntry`||!O||!T)return null;let J=l.ctx.backTarget===`closed`?void 0:b,Y=d(O)??{symbol:O.symbol},X=d(T)??{symbol:T.symbol},Z=`${o((I??0)/1,S,{maxDecimals:5})} ${T.symbol}`,Q=E(K,{updateOrder:x({id:`bOZXx5`,message:`Update order`}),depositMax:x({id:`9cCjMJ`,message:`Deposit max balance`})});return v(u,{...n,amount:I,sendToken:Y,receiveToken:X,max:P,...A===void 0?{}:{min:A},onAmountChange:G,...J?{onBack:J}:{},subLineAmount:Z,presets:w,...R===void 0?{}:{activePreset:R},onPresetSelect:W,...Q===void 0?{}:{footerLabel:Q},onContinue:q,children:[_(u.Header,{}),v(u.Body,{children:[_(u.Hero,{}),_(u.Pills,{}),_(u.Flow,{}),_(D,{intent:K,formattedCap:N,formattedMin:j})]}),_(u.Footer,{})]})}function E(e,t){if(e===`aboveCap`||e===`belowMin`)return t.updateOrder;if(e===`aboveBalance`)return t.depositMax}function D({intent:e,formattedCap:t,formattedMin:r}){let i=null;return e===`aboveCap`&&t?i={kind:`aboveCap`,node:_(n,{id:`-I_tc5`,message:`Max {formattedCap}`,values:{formattedCap:t}})}:e===`aboveBalance`?i={kind:`aboveBalance`,node:_(n,{id:`znqB4T`,message:`Insufficient balance`})}:e===`belowMin`&&r&&(i={kind:`belowMin`,node:_(n,{id:`3eKjkO`,message:`{formattedMin} minimum deposit`,values:{formattedMin:r}})}),_(y,{initial:!1,children:i?_(b.div,{variants:S,initial:`enter`,animate:`center`,exit:`exit`,style:{overflow:`hidden`},children:_(y,{initial:!1,mode:`wait`,children:_(b.div,{variants:C,initial:`enter`,animate:`center`,exit:`exit`,children:_(l.p,{size:`sm`,color:`subdued`,className:`AmountEntry__noticeStyles.root x2b8uid x1vvogim`,"data-style-src":`@stridge/kit:src/flows/deposit/widgets/amount-entry/AmountEntry.tsx:19`,children:i.node})},i.kind)})},`notice-slot`):null})}function O({open:e,defaultOpen:t,onOpenChange:n,trigger:r,...i}){return _(c,{open:e,defaultOpen:t,onOpenChange:n,trigger:r,children:_(T,{...i})})}(function(e){e.Dialog=O})(T||={});export{T as AmountEntry};
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 { ComponentProps } from "react";
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
- declare function AssetPicker(props: ComponentProps<"div">): _$react_jsx_runtime0.JSX.Element | null;
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{jsx as s,jsxs as c}from"react/jsx-runtime";function l(r){let l=e(),f=n(),{confirmAsset:p,back:m}=t(),[h,g]=o(void 0),_=l.balances,v=_.status===`ready`||_.status===`stale`?_.payload:[],y=a(()=>v.map(u),[v]),b=a(()=>(e=>e!==void 0&&y.some(t=>t.id===e&&!t.disabled))(h)?h:y.find(e=>!e.disabled)?.id,[h,y]),x=l.target,S=x.status===`ready`||x.status===`stale`?x.payload:void 0;if(f.name!==`assetPicker`)return null;let C=f.ctx.backTarget===`closed`?void 0:m,w=()=>{if(!b)return;let e=v.find(e=>d(e)===b);e&&p(e)};return c(i,{...r,...S?{token:{symbol:S.symbol}}:{},...b?{selectedId:b}:{},onSelect:g,assets:y,...C?{onBack:C}:{},onContinue:w,children:[s(i.Header,{}),s(i.Body,{children:s(i.List,{})}),s(i.Footer,{})]})}function u(e){let t=d(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 d(e){return e.eip155Id?`${e.eip155Id}:${e.address||`native`}`:e.symbol.toLowerCase()}function f({open:e,defaultOpen:t,onOpenChange:n,trigger:i,...a}){return s(r,{open:e,defaultOpen:t,onOpenChange:n,trigger:i,children:s(l,{...a})})}(function(e){e.Dialog=f})(l||={});export{l as AssetPicker};
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 { ComponentProps } from "react";
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(props: ComponentProps<"div">): _$react_jsx_runtime0.JSX.Element | null;
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{jsx as f,jsxs as p}from"react/jsx-runtime";function m(o){let l=e(),m=i(),_=a(),{confirmDeposit:y,back:b}=r(),{_:x}=n(),S=t(),C=c(),w=()=>{C({type:`deposit.confirm.clicked`,flow:`deposit`,tier:`ui`,payload:{}}),y()},T=l.quote,E=m.name===`confirmDeposit`?m.ctx.phase:void 0,D=l.target,O=l.wallet,k=_.name===`confirmDeposit`&&_.ctx.phase.kind===`ready`,A=d({expiresAt:E?.kind===`ready`?E.quoteExpiresAt:void 0,enabled:k});if(!E)return null;let j=E.kind===`loading`||E.kind===`regenerating`,M=g(l,D,O,S),N=v(l,{routeLabel:x({id:`rT8e1f`,message:`Route`}),networkCostLabel:x({id:`bZnukT`,message:`Network cost`}),priceImpactLabel:x({id:`kH6wUX`,message:`Price impact`}),maxSlippageLabel:x({id:`SZRUQ4`,message:`Max slippage`})}),P=`$0.00`;if(T.status===`ready`||T.status===`stale`)P=T.payload.heroAmountUsd.formatted;else if(_.name===`confirmDeposit`){let e=_.ctx.asset,t=_.ctx.amount,n=e?.priceUsd;P=s(typeof n==`number`&&Number.isFinite(n)&&n>0?t*n:t,S)}let F=T.status===`ready`||T.status===`stale`?T.payload.quoteTotalSeconds:30,I=A,L=h(E),R=E.kind===`failed`?E.failure:void 0,z=E.kind===`regenerating`?E.notice:void 0,B=D.status===`ready`||D.status===`stale`?D.payload:void 0,V=l.brand.status===`ready`||l.brand.status===`stale`?l.brand.payload:void 0,H=B&&V?.name?x({id:`zbtijb`,message:`Deposit {0} to {1}`,values:{0:B.symbol,1:V.name}}):void 0;return p(u,{...o,transfer:M,breakdown:N,heroAmountUsd:P,loading:j,phase:L,...z?{notice:z}:{},...R?{error:{message:R.reason,...R.code?{code:R.code}:{}}}:{},...I===void 0?{}:{quoteSeconds:I},quoteTotalSeconds:F,...H?{headerTitle:H}:{},onBack:b,onConfirm:w,children:[f(u.Header,{}),p(u.Body,{children:[f(u.Hero,{}),f(u.Meta,{}),f(u.Amounts,{}),f(u.Breakdown,{}),f(u.Disclaimer,{})]}),f(u.Footer,{})]})}function h(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 g(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?_(u):{symbol:`—`},receiveAmount:a?a.receiveAmount.formatted:`0`,receiveToken:d?_(d):{symbol:s?.symbol??`—`}}}function _(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 v(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 y({open:e,defaultOpen:t,onOpenChange:n,trigger:r,...i}){return f(l,{open:e,defaultOpen:t,onOpenChange:n,trigger:r,children:f(m,{...i})})}(function(e){e.Dialog=y})(m||={});export{m as ConfirmDeposit};
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 { ComponentProps } from "react";
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
- declare function Deposit(props: ComponentProps<"div">): _$react_jsx_runtime0.JSX.Element | null;
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{jsx as p,jsxs as m}from"react/jsx-runtime";const h={width:18,height:18,"aria-hidden":!0};function g(s){let c=e(),u=r().name,{selectMethod:g}=n(),v=i(),{_:y}=t(),b=c.wallet,x=b.status===`ready`||b.status===`stale`?b.payload:void 0,S=x!==void 0,C=c.brand,w=C.status===`ready`||C.status===`stale`?C.payload:void 0,T=c.addresses,E=T.status===`ready`||T.status===`stale`?T.payload:[],D=c.balances.status===`error`,O=!x?.balanceTotalUsd?.formatted&&!D,k=!!c.brand,A=w?.name?y({id:`ogD_nm`,message:`Deposit to {0}`,values:{0:w.name}}):void 0,j=f(()=>_(E),[E]),M=v?.wallet,N=v?.transfer,P=f(()=>{let e=!S||O,t=M?.disabled??!1,n=e||t,r=t?M?.disabledHint:void 0,i=(()=>{if(t)return r;if(!S)return y({id:`5AApJw`,message:`Connect a wallet to continue`});if(x?.balanceTotalUsd?.formatted)return x.balanceTotalUsd.formatted;if(!D)return p(l,{width:56,height:12})})(),s=[{id:`wallet`,title:y({id:`sb9Y58`,message:`Wallet`}),icon:p(o,{...h}),...x&&!t?{titleAdornment:x.address.formatted}:{},...i===void 0?{}:{meta:i},recommended:!0,disabled:n,onSelect:n?void 0:()=>g(`wallet`)}];if(k){let e=N?.disabled??!1,t=e?N?.disabledHint:void 0,n=e?t:[y({id:`qtoOYG`,message:`No limit`}),y({id:`D79cZK`,message:`Instant`})];s.push({id:`transfer`,title:y({id:`3dqPLT`,message:`Transfer Crypto`}),icon:p(a,{...h}),...n===void 0?{}:{meta:n},...j?{trailing:j}:{},disabled:e,onSelect:e?void 0:()=>g(`transfer`)})}return s},[x,D,O,S,k,j,M,N,g,y]);return u===`deposit`?m(d,{...s,...A?{title:A}:{},methods:P,children:[p(d.Header,{}),p(d.Body,{children:p(d.Methods,{})})]}):null}function _(e){if(e.length!==0)return p(c.Group,{max:4,overflow:Math.max(0,e.length-4),size:`md`,children:e.map(e=>p(u,{isNative:!0,symbol:e.networkName,...e.eip155Id?{chainId:Number(e.eip155Id)}:{},...e.chainLogoUrl?{logoUrl:e.chainLogoUrl}:{},hideChainBadge:!0},e.eip155Id??e.networkName))})}function v({open:e,defaultOpen:t,onOpenChange:n,trigger:r,...i}){return p(s,{open:e,defaultOpen:t,onOpenChange:n,trigger:r,children:p(g,{...i})})}(function(e){e.Dialog=v})(g||={});export{g as Deposit};
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{DepositContext as a}from"./context.js";import{DEPOSIT_SLOTS as o}from"./Deposit.slots.js";import{styles as s}from"./Deposit.styles.js";import{DepositHeader as c}from"./components/Header.js";import{DepositMethod as l}from"./components/Method.js";import{DepositMethods as u}from"./components/Methods.js";import{DepositSteps as d}from"./components/Steps.js";import{useMemo as f}from"react";import{jsx as p}from"react/jsx-runtime";import*as m from"@stylexjs/stylex";const h=[];function g(e){let{title:t,methodsLabel:n,methods:c=h,children:l}=e,u=f(()=>({title:t,methodsLabel:n,methods:c}),[t,n,c]);return p(a.Provider,{value:u,children:p(r.Provider,{children:p(i,{"data-stridge-slot":o.root,...m.props(s.root),children:l})})})}function _(e){return p(t.Body,{"data-stridge-slot":o.body,...e})}function v({open:t,defaultOpen:n,onOpenChange:r,trigger:i,children:a,...o}){return p(e,{open:t,defaultOpen:n,onOpenChange:r,trigger:i,children:p(g,{...o,children:a})})}(function(e){e.Header=c,e.Body=_,e.Methods=u,e.Method=l,e.Dialog=v,e.Steps=d,e.Step=n})(g||={});export{g as Deposit};
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
- declare function DepositStatusBanner(): _$react_jsx_runtime0.JSX.Element;
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 };
@@ -1 +1 @@
1
- "use client";import{bucketFromSettlement as e,useBannerAckForSettlement as t}from"../../../../banners/useBannerAck.js";import"../../../../banners/index.js";import{useDepositSnapshot as n}from"../../driver/context.js";import{useLingui as r}from"../../../../shared/i18n/useLingui.js";import"../../../../i18n/index.js";import{useDepositActions as i,useDepositState as a}from"../../orchestrator/controller.js";import{stepRendersSettlement as o}from"../../orchestrator/steps.js";import{DepositStatusBanner as s}from"./compound/DepositStatusBanner.js";import"./compound/index.js";import{useEffect as c,useState as l}from"react";import{jsx as u,jsxs as d}from"react/jsx-runtime";import{AnimatePresence as f}from"motion/react";function p(){let s=n(),l=a().name,{resumeToProcessing:d,resumeToSuccess:p,resumeToError:h}=i(),{_}=r(),v=s.settlement,y=v.status===`ready`||v.status===`stale`?v.payload:void 0,{acked:b,ack:x}=t(y),S=(l===`success`||l===`error`)&&e(y)?.bucket===`terminal`;c(()=>{S&&!b&&x()},[S,b,x]);let C=y!==void 0&&!b&&!o(l);function w(e){return()=>{x(),e()}}return u(f,{children:C&&y?u(m,{payload:y,brandName:s.brand.status===`ready`||s.brand.status===`stale`?s.brand.payload.name:void 0,onDismiss:x,onResumeToProcessing:()=>d(`wallet`,g(y)),onResumeToSuccess:w(()=>p(`wallet`,g(y))),onResumeToError:w(()=>h(g(y))),labels:{completed:_({id:`3kg1gB`,message:`Deposit completed`}),didntComplete:_({id:`Rxjdjn`,message:`Deposit didn't complete`}),receivedProcessing:_({id:`junZX6`,message:`Deposit received and processing…`}),creditedToBrand:e=>_({id:`IRogzB`,message:`Your deposit has been credited to {brand}.`,values:{brand:e}}),creditedToAccount:_({id:`9JHY2T`,message:`Your deposit has been credited to your account.`}),fundsSafe:_({id:`Z1WbO6`,message:`Funds are safe on the source chain — contact support to recover.`}),willBeCreditedToBrand:e=>_({id:`TG4WOd`,message:`Your deposit will be credited to {brand}.`,values:{brand:e}}),willBeCreditedToAccount:_({id:`Offl0a`,message:`Your deposit will be credited to your account.`})}},`banner`):null})}function m({payload:e,brandName:t,onDismiss:n,onResumeToProcessing:r,onResumeToSuccess:i,onResumeToError:a,labels:o}){let[c,f]=l(!1),p=()=>f(e=>!e),m=e.kind,g={symbol:e.creditedAsset.symbol,...e.creditedAsset.address?{address:e.creditedAsset.address}:{},...e.creditedAsset.isNative===void 0?{}:{isNative:e.creditedAsset.isNative},...e.creditedAsset.assetLogoUrl?{logoUrl:e.creditedAsset.assetLogoUrl}:{}},_=m===`succeeded`?o.completed:m===`failed`?o.didntComplete:o.receivedProcessing,v=m===`succeeded`?t?o.creditedToBrand(t):o.creditedToAccount:m===`failed`?o.fundsSafe:t?o.willBeCreditedToBrand(t):o.willBeCreditedToAccount,y=h(e),b=e.kind===`succeeded`&&e.completionTx?{hash:e.completionTx.hash.formatted,...e.completionTx.explorerUrl?{explorerUrl:e.completionTx.explorerUrl}:{}}:void 0,x=e.kind===`succeeded`||e.kind===`failed`?e.submittedAt.formatted:void 0,S=e.kind===`succeeded`?e.filledAt.formatted:void 0,C=m===`succeeded`?i:m===`failed`?a:r;return d(s,{kind:m,asset:g,headline:_,subline:v,expanded:c,onToggleExpanded:p,onDismiss:n,...y?{depositTx:y}:{},...b?{completionTx:b}:{},...x===void 0?{}:{submittedAt:x},...S===void 0?{}:{filledAt:S},onPrimaryAction:C,children:[d(s.Body,{children:[u(s.Hero,{}),u(s.Close,{})]}),d(s.Details,{children:[u(s.DepositTxRow,{}),u(s.CompletionTxRow,{}),u(s.SubmittedAtRow,{}),u(s.FilledAtRow,{})]}),d(s.Footer,{children:[u(s.Toggle,{}),u(s.PrimaryAction,{})]})]})}function h(e){if(e.kind===`succeeded`)return{hash:e.depositTx.hash.formatted,...e.depositTx.explorerUrl?{explorerUrl:e.depositTx.explorerUrl}:{}};if(e.kind===`failed`||e.txHash)return{hash:e.txHash.formatted,...e.txExplorerUrl?{explorerUrl:e.txExplorerUrl}:{}}}function g(e){return e.kind===`succeeded`?{hash:e.depositTx.hash.value,...e.depositTx.explorerUrl?{explorerUrl:e.depositTx.explorerUrl}:{}}:e.kind===`failed`?{hash:e.txHash.value,...e.txExplorerUrl?{explorerUrl:e.txExplorerUrl}:{}}:{hash:e.txHash?.value??``,...e.txExplorerUrl?{explorerUrl:e.txExplorerUrl}:{}}}export{p as DepositStatusBanner};
1
+ "use client";import{bucketFromSettlement as e,useBannerAckForSettlement as t}from"../../../../banners/useBannerAck.js";import"../../../../banners/index.js";import{useDepositSnapshot as n}from"../../driver/context.js";import{useLingui as r}from"../../../../shared/i18n/useLingui.js";import"../../../../i18n/index.js";import{useDepositActions as i,useDepositState as a}from"../../orchestrator/controller.js";import{stepRendersSettlement as o}from"../../orchestrator/steps.js";import{DepositStatusBanner as s}from"./compound/DepositStatusBanner.js";import"./compound/index.js";import{useEffect as c,useState as l}from"react";import{Fragment as u,jsx as d,jsxs as f}from"react/jsx-runtime";import{AnimatePresence as p}from"motion/react";function m({children:s}={}){let l=n(),u=a().name,{resumeToProcessing:f,resumeToSuccess:m,resumeToError:g}=i(),{_:v}=r(),y=l.settlement,b=y.status===`ready`||y.status===`stale`?y.payload:void 0,{acked:x,ack:S}=t(b),C=(u===`success`||u===`error`)&&e(b)?.bucket===`terminal`;c(()=>{C&&!x&&S()},[C,x,S]);let w=b!==void 0&&!x&&!o(u);function T(e){return()=>{S(),e()}}return d(p,{children:w&&b?d(h,{payload:b,brandName:l.brand.status===`ready`||l.brand.status===`stale`?l.brand.payload.name:void 0,onDismiss:S,onResumeToProcessing:()=>f(`wallet`,_(b)),onResumeToSuccess:T(()=>m(`wallet`,_(b))),onResumeToError:T(()=>g(_(b))),labels:{completed:v({id:`3kg1gB`,message:`Deposit completed`}),didntComplete:v({id:`Rxjdjn`,message:`Deposit didn't complete`}),receivedProcessing:v({id:`junZX6`,message:`Deposit received and processing…`}),creditedToBrand:e=>v({id:`IRogzB`,message:`Your deposit has been credited to {brand}.`,values:{brand:e}}),creditedToAccount:v({id:`9JHY2T`,message:`Your deposit has been credited to your account.`}),fundsSafe:v({id:`Z1WbO6`,message:`Funds are safe on the source chain — contact support to recover.`}),willBeCreditedToBrand:e=>v({id:`TG4WOd`,message:`Your deposit will be credited to {brand}.`,values:{brand:e}}),willBeCreditedToAccount:v({id:`Offl0a`,message:`Your deposit will be credited to your account.`})},children:s},`banner`):null})}function h({payload:e,brandName:t,onDismiss:n,onResumeToProcessing:r,onResumeToSuccess:i,onResumeToError:a,labels:o,children:c}){let[p,m]=l(!1),h=()=>m(e=>!e),_=e.kind,v={symbol:e.creditedAsset.symbol,...e.creditedAsset.address?{address:e.creditedAsset.address}:{},...e.creditedAsset.isNative===void 0?{}:{isNative:e.creditedAsset.isNative},...e.creditedAsset.assetLogoUrl?{logoUrl:e.creditedAsset.assetLogoUrl}:{}},y=_===`succeeded`?o.completed:_===`failed`?o.didntComplete:o.receivedProcessing,b=_===`succeeded`?t?o.creditedToBrand(t):o.creditedToAccount:_===`failed`?o.fundsSafe:t?o.willBeCreditedToBrand(t):o.willBeCreditedToAccount,x=g(e),S=e.kind===`succeeded`&&e.completionTx?{hash:e.completionTx.hash.formatted,...e.completionTx.explorerUrl?{explorerUrl:e.completionTx.explorerUrl}:{}}:void 0,C=e.kind===`succeeded`||e.kind===`failed`?e.submittedAt.formatted:void 0,w=e.kind===`succeeded`?e.filledAt.formatted:void 0,T=_===`succeeded`?i:_===`failed`?a:r;return d(s,{kind:_,asset:v,headline:y,subline:b,expanded:p,onToggleExpanded:h,onDismiss:n,...x?{depositTx:x}:{},...S?{completionTx:S}:{},...C===void 0?{}:{submittedAt:C},...w===void 0?{}:{filledAt:w},onPrimaryAction:T,children:c??f(u,{children:[f(s.Body,{children:[d(s.Hero,{}),d(s.Close,{})]}),f(s.Details,{children:[d(s.DepositTxRow,{}),d(s.CompletionTxRow,{}),d(s.SubmittedAtRow,{}),d(s.FilledAtRow,{})]}),f(s.Footer,{children:[d(s.Toggle,{}),d(s.PrimaryAction,{})]})]})})}function g(e){if(e.kind===`succeeded`)return{hash:e.depositTx.hash.formatted,...e.depositTx.explorerUrl?{explorerUrl:e.depositTx.explorerUrl}:{}};if(e.kind===`failed`||e.txHash)return{hash:e.txHash.formatted,...e.txExplorerUrl?{explorerUrl:e.txExplorerUrl}:{}}}function _(e){return e.kind===`succeeded`?{hash:e.depositTx.hash.value,...e.depositTx.explorerUrl?{explorerUrl:e.depositTx.explorerUrl}:{}}:e.kind===`failed`?{hash:e.txHash.value,...e.txExplorerUrl?{explorerUrl:e.txExplorerUrl}:{}}:{hash:e.txHash?.value??``,...e.txExplorerUrl?{explorerUrl:e.txExplorerUrl}:{}}}(function(e){e.Body=s.Body,e.Hero=s.Hero,e.Close=s.Close,e.Details=s.Details,e.DepositTxRow=s.DepositTxRow,e.CompletionTxRow=s.CompletionTxRow,e.SubmittedAtRow=s.SubmittedAtRow,e.FilledAtRow=s.FilledAtRow,e.Footer=s.Footer,e.Toggle=s.Toggle,e.PrimaryAction=s.PrimaryAction})(m||={});export{m as DepositStatusBanner};