@stridge/kit 0.1.0-alpha.51 → 0.1.0-alpha.52
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/KitProvider.d.ts +11 -0
- package/dist/KitProvider.js +1 -1
- package/dist/_internal/activity/driver/index.d.ts +3 -0
- package/dist/_internal/activity/driver/index.js +1 -0
- package/dist/_internal/drivers/stridge/index.d.ts +2 -1
- package/dist/_internal/drivers/stridge/index.js +1 -1
- package/dist/_internal/drivers/stridge-mock/index.d.ts +2 -1
- package/dist/_internal/drivers/stridge-mock/index.js +1 -1
- package/dist/activity/compound/index.d.ts +19 -0
- package/dist/activity/compound/index.js +1 -0
- package/dist/activity/dialog/index.d.ts +3 -0
- package/dist/activity/dialog/index.js +1 -0
- package/dist/activity/widgets/index.d.ts +4 -0
- package/dist/activity/widgets/index.js +1 -0
- package/dist/deposit/compound/index.d.ts +9 -9
- package/dist/deposit/widgets/index.d.ts +3 -3
- package/dist/deposit/widgets/index.js +1 -1
- package/dist/drivers/stridge/createStridgeActivityDriver.d.ts +44 -0
- package/dist/drivers/stridge/createStridgeActivityDriver.js +1 -0
- package/dist/drivers/stridge/createStridgeDepositDriver.js +1 -1
- package/dist/drivers/stridge/createStridgeWithdrawDriver.js +1 -1
- package/dist/drivers/stridge-mock/createStridgeMockActivityDriver.d.ts +44 -0
- package/dist/drivers/stridge-mock/createStridgeMockActivityDriver.js +1 -0
- package/dist/drivers/stridge-mock/createStridgeMockDriver.d.ts +0 -2
- package/dist/drivers/stridge-mock/createStridgeMockDriver.js +1 -1
- package/dist/drivers/stridge-mock/createStridgeMockWithdrawDriver.d.ts +1 -2
- package/dist/drivers/stridge-mock/createStridgeMockWithdrawDriver.js +1 -1
- package/dist/drivers/stridge-mock/fixtures.js +1 -1
- package/dist/flows/activity/compound/ActivityFlow.d.ts +46 -0
- package/dist/flows/activity/compound/ActivityFlow.js +1 -0
- package/dist/flows/activity/compound/components/Boundary.d.ts +29 -0
- package/dist/flows/activity/compound/components/Boundary.js +1 -0
- package/dist/flows/activity/compound/components/Steps.d.ts +24 -0
- package/dist/flows/activity/compound/components/Steps.js +1 -0
- package/dist/flows/activity/dialog/ActivityDialog.d.ts +38 -0
- package/dist/flows/activity/dialog/ActivityDialog.js +1 -0
- package/dist/flows/activity/dialog/ActivityFlowBoundary.d.ts +1 -0
- package/dist/flows/activity/dialog/ActivityFlowBoundary.js +1 -0
- package/dist/flows/activity/driver/context.d.ts +38 -0
- package/dist/flows/activity/driver/context.js +1 -0
- package/dist/flows/activity/driver/types.d.ts +58 -0
- package/dist/flows/activity/orchestrator/controller.d.ts +11 -0
- package/dist/flows/activity/orchestrator/controller.js +1 -0
- package/dist/flows/activity/orchestrator/index.d.ts +4 -0
- package/dist/flows/activity/orchestrator/index.js +1 -0
- package/dist/flows/activity/orchestrator/reducer.d.ts +1 -0
- package/dist/flows/activity/orchestrator/reducer.js +1 -0
- package/dist/flows/activity/orchestrator/types.d.ts +71 -0
- package/dist/flows/activity/orchestrator/useActivity.d.ts +94 -0
- package/dist/flows/activity/orchestrator/useActivity.js +1 -0
- package/dist/flows/activity/widgets/ActivityDetail.d.ts +41 -0
- package/dist/flows/activity/widgets/ActivityDetail.js +1 -0
- package/dist/flows/activity/widgets/ActivityList.d.ts +38 -0
- package/dist/flows/activity/widgets/ActivityList.js +1 -0
- package/dist/flows/activity/widgets/useStandaloneActivitySource.js +1 -0
- package/dist/flows/deposit/dialog/DepositBootstrapErrorState.js +1 -1
- package/dist/flows/deposit/dialog/DepositDialog.js +1 -1
- package/dist/flows/deposit/driver/transformers/settlementToPayload.js +1 -1
- package/dist/flows/deposit/driver/types.d.ts +1 -38
- package/dist/flows/deposit/orchestrator/controller.js +1 -1
- package/dist/flows/deposit/orchestrator/reducer.js +1 -1
- package/dist/flows/deposit/orchestrator/types.d.ts +43 -29
- package/dist/flows/deposit/widgets/{activity-history/DepositHistoryDetail.d.ts → activity/DepositActivityDetail.d.ts} +11 -11
- package/dist/flows/deposit/widgets/activity/DepositActivityDetail.js +1 -0
- package/dist/flows/deposit/widgets/activity/DepositActivityList.d.ts +38 -0
- package/dist/flows/deposit/widgets/activity/DepositActivityList.js +1 -0
- package/dist/flows/deposit/widgets/activity/index.d.ts +2 -0
- package/dist/flows/deposit/widgets/activity/index.js +1 -0
- package/dist/flows/deposit/widgets/activity/useDepositActivitySource.js +1 -0
- package/dist/flows/deposit/widgets/amount-entry/AmountEntry.js +1 -1
- package/dist/flows/deposit/widgets/asset-picker/AssetPicker.js +1 -1
- package/dist/flows/deposit/widgets/confirm-deposit/ConfirmDeposit.js +1 -1
- package/dist/flows/deposit/widgets/deposit/Deposit.js +1 -1
- package/dist/flows/deposit/widgets/deposit/compound/components/Header.d.ts +7 -6
- package/dist/flows/deposit/widgets/deposit/compound/components/Header.js +1 -1
- package/dist/flows/deposit/widgets/deposit-status-banner/DepositStatusBanner.js +1 -1
- package/dist/flows/deposit/widgets/error-state/ErrorState.js +1 -1
- package/dist/flows/deposit/widgets/processing-state/ProcessingState.js +1 -1
- package/dist/flows/deposit/widgets/transfer-crypto/compound/components/Header.d.ts +4 -3
- package/dist/flows/deposit/widgets/transfer-crypto/compound/components/Header.js +1 -1
- package/dist/flows/withdraw/dialog/WithdrawDialog.js +1 -1
- package/dist/flows/withdraw/driver/types.d.ts +0 -34
- package/dist/flows/withdraw/orchestrator/controller.js +1 -1
- package/dist/flows/withdraw/orchestrator/reducer.js +1 -1
- package/dist/flows/withdraw/orchestrator/types.d.ts +44 -30
- package/dist/flows/withdraw/widgets/{activity-history/WithdrawHistoryDetail.d.ts → activity/WithdrawActivityDetail.d.ts} +11 -11
- package/dist/flows/withdraw/widgets/activity/WithdrawActivityDetail.js +1 -0
- package/dist/flows/withdraw/widgets/activity/WithdrawActivityList.d.ts +36 -0
- package/dist/flows/withdraw/widgets/activity/WithdrawActivityList.js +1 -0
- package/dist/flows/withdraw/widgets/activity/index.d.ts +2 -0
- package/dist/flows/withdraw/widgets/activity/index.js +1 -0
- package/dist/flows/withdraw/widgets/activity/useWithdrawActivitySource.js +1 -0
- package/dist/flows/withdraw/widgets/withdraw-form/compound/components/Body.d.ts +7 -6
- package/dist/flows/withdraw/widgets/withdraw-form/compound/components/Header.d.ts +4 -4
- package/dist/flows/withdraw/widgets/withdraw-form/compound/components/Header.js +1 -1
- package/dist/format/index.d.ts +2 -1
- package/dist/format/index.js +1 -1
- package/dist/i18n/locales/ar.js +1 -1
- package/dist/i18n/locales/es.js +1 -1
- package/dist/i18n/locales/source-keys.d.ts +1 -1
- package/dist/icons/index.d.ts +2 -2
- package/dist/icons/index.js +1 -1
- package/dist/index.d.ts +8 -2
- package/dist/index.js +1 -1
- package/dist/package.js +1 -1
- package/dist/shared/format/formatSmartRelative.d.ts +25 -0
- package/dist/shared/format/formatSmartRelative.js +1 -0
- package/dist/shared/format/formatUsd.js +1 -1
- package/dist/shared/icons/{HistoryIcon.d.ts → ActivityIcon.d.ts} +4 -4
- package/dist/shared/icons/{HistoryIcon.js → ActivityIcon.js} +1 -1
- package/dist/shared/orchestrator/activityOpenInput.d.ts +21 -0
- package/dist/shared/orchestrator/createActivityReducers.js +1 -0
- package/dist/shared/orchestrator/index.d.ts +2 -0
- package/dist/shared/orchestrator/index.js +1 -1
- package/dist/shared/orchestrator/resolveActivityEntry.d.ts +1 -0
- package/dist/shared/orchestrator/resolveActivityEntry.js +1 -0
- package/dist/shared/ui/Card/Card.d.ts +12 -9
- package/dist/shared/ui/Card/Card.js +1 -1
- package/dist/shared/ui/Card/Card.styles.js +1 -1
- package/dist/shared/ui/SelectableTile/SelectableTile.d.ts +1 -1
- package/dist/shared/widgets/activity/ActivityTrigger.js +1 -0
- package/dist/shared/widgets/{activity-history → activity}/ActivityTrigger.styles.js +1 -1
- package/dist/shared/widgets/activity/adapters/settlementToWidgetProps.js +1 -0
- package/dist/shared/widgets/activity/compound/Activity.d.ts +95 -0
- package/dist/shared/widgets/activity/compound/Activity.js +1 -0
- package/dist/shared/widgets/activity/compound/Activity.slots.d.ts +22 -0
- package/dist/shared/widgets/activity/compound/Activity.slots.js +1 -0
- package/dist/shared/widgets/activity/compound/Activity.styles.js +1 -0
- package/dist/shared/widgets/{activity-history/compound/ActivityHistoryDetail.d.ts → activity/compound/ActivityDetail.d.ts} +24 -17
- package/dist/shared/widgets/activity/compound/ActivityDetail.js +1 -0
- package/dist/shared/widgets/activity/compound/Row.slots.d.ts +21 -0
- package/dist/shared/widgets/activity/compound/Row.slots.js +1 -0
- package/dist/shared/widgets/activity/compound/Row.styles.js +1 -0
- package/dist/shared/widgets/{activity-history/compound/components/HistoryHeader.d.ts → activity/compound/components/ActivityHeader.d.ts} +8 -8
- package/dist/shared/widgets/activity/compound/components/ActivityHeader.js +1 -0
- package/dist/shared/widgets/{activity-history → activity}/compound/components/Empty.d.ts +3 -3
- package/dist/shared/widgets/activity/compound/components/Empty.js +1 -0
- package/dist/shared/widgets/{activity-history → activity}/compound/components/ErrorView.d.ts +7 -7
- package/dist/shared/widgets/activity/compound/components/ErrorView.js +1 -0
- package/dist/shared/widgets/activity/compound/components/List.d.ts +23 -0
- package/dist/shared/widgets/activity/compound/components/List.js +1 -0
- package/dist/shared/widgets/{activity-history → activity}/compound/components/Row.d.ts +13 -16
- package/dist/shared/widgets/activity/compound/components/Row.js +1 -0
- package/dist/shared/widgets/activity/compound/components/StatusPip.js +1 -0
- package/dist/shared/widgets/activity/compound/context.d.ts +95 -0
- package/dist/shared/widgets/activity/compound/context.js +1 -0
- package/dist/shared/widgets/activity/compound/index.d.ts +8 -0
- package/dist/shared/widgets/activity/compound/index.js +1 -0
- package/dist/shared/widgets/activity/payloads.d.ts +108 -0
- package/dist/shared/widgets/activity/transformers/activityResponseToPayload.js +1 -0
- package/dist/shared/widgets/amount-entry/compound/components/Header.d.ts +1 -1
- package/dist/shared/widgets/amount-entry/compound/types.d.ts +2 -3
- package/dist/shared/widgets/asset-picker/compound/components/Header.d.ts +1 -1
- package/dist/shared/widgets/asset-picker/compound/types.d.ts +2 -2
- package/dist/stridge/StridgeProvider.d.ts +10 -6
- package/dist/stridge/StridgeProvider.js +1 -1
- package/dist/stridge/stubs.js +1 -1
- package/dist/styles/index.css +4 -0
- package/dist/withdraw/compound/index.d.ts +6 -6
- package/dist/withdraw/widgets/index.d.ts +3 -3
- package/dist/withdraw/widgets/index.js +1 -1
- package/package.json +14 -6
- package/dist/activity-history/compound/index.d.ts +0 -9
- package/dist/activity-history/compound/index.js +0 -1
- package/dist/flows/deposit/widgets/activity-history/DepositHistoryDetail.js +0 -1
- package/dist/flows/deposit/widgets/activity-history/DepositHistoryList.d.ts +0 -38
- package/dist/flows/deposit/widgets/activity-history/DepositHistoryList.js +0 -1
- package/dist/flows/deposit/widgets/activity-history/index.d.ts +0 -2
- package/dist/flows/deposit/widgets/activity-history/index.js +0 -1
- package/dist/flows/deposit/widgets/activity-history/useDepositActivityHistorySource.js +0 -1
- package/dist/flows/withdraw/widgets/activity-history/WithdrawHistoryDetail.js +0 -1
- package/dist/flows/withdraw/widgets/activity-history/WithdrawHistoryList.d.ts +0 -36
- package/dist/flows/withdraw/widgets/activity-history/WithdrawHistoryList.js +0 -1
- package/dist/flows/withdraw/widgets/activity-history/index.d.ts +0 -2
- package/dist/flows/withdraw/widgets/activity-history/index.js +0 -1
- package/dist/flows/withdraw/widgets/activity-history/useWithdrawActivityHistorySource.js +0 -1
- package/dist/shared/widgets/activity-history/ActivityTrigger.js +0 -1
- package/dist/shared/widgets/activity-history/adapters/settlementToWidgetProps.js +0 -1
- package/dist/shared/widgets/activity-history/compound/ActivityHistory.d.ts +0 -95
- package/dist/shared/widgets/activity-history/compound/ActivityHistory.js +0 -1
- package/dist/shared/widgets/activity-history/compound/ActivityHistory.slots.d.ts +0 -22
- package/dist/shared/widgets/activity-history/compound/ActivityHistory.slots.js +0 -1
- package/dist/shared/widgets/activity-history/compound/ActivityHistory.styles.js +0 -1
- package/dist/shared/widgets/activity-history/compound/ActivityHistoryDetail.js +0 -1
- package/dist/shared/widgets/activity-history/compound/Row.slots.d.ts +0 -21
- package/dist/shared/widgets/activity-history/compound/Row.slots.js +0 -1
- package/dist/shared/widgets/activity-history/compound/Row.styles.js +0 -1
- package/dist/shared/widgets/activity-history/compound/components/Empty.js +0 -1
- package/dist/shared/widgets/activity-history/compound/components/ErrorView.js +0 -1
- package/dist/shared/widgets/activity-history/compound/components/HistoryHeader.js +0 -1
- package/dist/shared/widgets/activity-history/compound/components/List.d.ts +0 -23
- package/dist/shared/widgets/activity-history/compound/components/List.js +0 -1
- package/dist/shared/widgets/activity-history/compound/components/Row.js +0 -1
- package/dist/shared/widgets/activity-history/compound/components/StatusPip.js +0 -1
- package/dist/shared/widgets/activity-history/compound/context.d.ts +0 -79
- package/dist/shared/widgets/activity-history/compound/context.js +0 -1
- package/dist/shared/widgets/activity-history/payloads.d.ts +0 -81
- package/dist/shared/widgets/activity-history/transformers/historyResponseToPayload.js +0 -1
- /package/dist/shared/widgets/{activity-history → activity}/index.js +0 -0
- /package/dist/shared/widgets/{activity-history → activity}/transformers/resolveDirection.js +0 -0
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { ActivityHeader, ActivityListHeader } from "../../../shared/widgets/activity/compound/components/ActivityHeader.js";
|
|
2
|
+
import { ActivityEmpty } from "../../../shared/widgets/activity/compound/components/Empty.js";
|
|
3
|
+
import { ActivityErrorView } from "../../../shared/widgets/activity/compound/components/ErrorView.js";
|
|
4
|
+
import { ActivityList as ActivityList$1 } from "../../../shared/widgets/activity/compound/components/List.js";
|
|
5
|
+
import { ActivityRow } from "../../../shared/widgets/activity/compound/components/Row.js";
|
|
6
|
+
import { ComponentProps, ReactNode } from "react";
|
|
7
|
+
import * as _$react_jsx_runtime0 from "react/jsx-runtime";
|
|
8
|
+
|
|
9
|
+
//#region src/flows/activity/widgets/ActivityList.d.ts
|
|
10
|
+
interface ActivityListOwnProps {
|
|
11
|
+
/**
|
|
12
|
+
* Optional custom composition forwarded to the underlying `<Activity>` compound.
|
|
13
|
+
* Defaults to the compound's `<Header /> + <List />` shape.
|
|
14
|
+
*/
|
|
15
|
+
children?: ReactNode;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Orchestrated activity list wrapper for the standalone activity dialog. Bridges the activity
|
|
19
|
+
* flow's snapshot + actions + FSM state into the cross-flow `<Activity>` compound's source
|
|
20
|
+
* value. Renders `null` while the FSM is not on `activityList` — the dialog's step router only
|
|
21
|
+
* matches the active step, but the no-op guard keeps the component safe to mount in custom
|
|
22
|
+
* dialog compositions that skip the step router.
|
|
23
|
+
*/
|
|
24
|
+
declare function ActivityList({
|
|
25
|
+
children,
|
|
26
|
+
...props
|
|
27
|
+
}: ComponentProps<"div"> & ActivityListOwnProps): _$react_jsx_runtime0.JSX.Element | null;
|
|
28
|
+
declare namespace ActivityList {
|
|
29
|
+
type Props = ComponentProps<"div"> & ActivityListOwnProps;
|
|
30
|
+
const Header: typeof ActivityHeader;
|
|
31
|
+
const ListHeader: typeof ActivityListHeader;
|
|
32
|
+
const List: typeof ActivityList$1;
|
|
33
|
+
const Row: typeof ActivityRow;
|
|
34
|
+
const Empty: typeof ActivityEmpty;
|
|
35
|
+
const ErrorView: typeof ActivityErrorView;
|
|
36
|
+
}
|
|
37
|
+
//#endregion
|
|
38
|
+
export { ActivityList };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import{ActivitySourceProvider as e}from"../../../shared/widgets/activity/compound/context.js";import{Activity as t}from"../../../shared/widgets/activity/compound/Activity.js";import"../../../shared/widgets/activity/compound/index.js";import{useStandaloneActivitySource as n}from"./useStandaloneActivitySource.js";import{jsx as r}from"react/jsx-runtime";function i({children:i,...a}){let{sourceValue:o,step:s}=n();return s!==`activityList`||!o?null:r(e,{value:o,children:r(t,{...a,children:i})})}(function(e){e.Header=t.Header,e.ListHeader=t.ListHeader,e.List=t.List,e.Row=t.Row,e.Empty=t.Empty,e.ErrorView=t.ErrorView})(i||={});export{i as ActivityList};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import{useActivityDriverInstance as e,useActivitySnapshot as t}from"../driver/context.js";import{useLingui as n}from"../../../shared/i18n/useLingui.js";import"../../../i18n/index.js";import{useActivityActions as r,useActivityEffectiveState as i}from"../orchestrator/controller.js";import{useActivity as a}from"../orchestrator/useActivity.js";import"../orchestrator/index.js";import{defaultBlockExplorers as o}from"../../../shared/utils/explorers.js";import{useCallback as s,useMemo as c}from"react";function l(){let l=t(),u=e(),d=r(),f=a(),p=i(),{i18n:m}=n(),h=s(e=>{u.refreshActivity(e)},[u]),g=s(()=>{f.open()},[f]),_=p.name===`activityList`||p.name===`activityDetail`,v=p.name===`activityDetail`?p.ctx.settlementId:void 0,y=p.name===`activityDetail`&&p.ctx.viaList;return{sourceValue:c(()=>{if(!_)return null;let e=l.activity.status===`ready`||l.activity.status===`stale`?l.activity.response.owner:`0x0000000000000000000000000000000000000000`,t=l.activity.status===`ready`||l.activity.status===`stale`?l.activity.payload.brandName:void 0,n={i18n:m,sourceWallet:{name:`Wallet`,address:e},explorers:o(),...t?{brandName:t}:{}};return{entity:l.activity,refresh:h,selectSettlement:d.selectSettlement,...y?{back:d.back}:{},onLookupMiss:g,...v===void 0?{}:{settlementId:v},settlementContext:n}},[l,d,_,v,m,h,y,g]),settlementId:v,step:p.name===`activityList`?`activityList`:p.name===`activityDetail`?`activityDetail`:`other`}}export{l as useStandaloneActivitySource};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{
|
|
1
|
+
"use client";import{Trans as e}from"../../../shared/i18n/Trans.js";import{useLingui as t}from"../../../shared/i18n/useLingui.js";import"../../../i18n/index.js";import{useDepositSnapshot as n}from"../driver/context.js";import{useDepositActions as r}from"../orchestrator/controller.js";import{ChevronDownIcon as i}from"../../../shared/icons/ChevronDownIcon.js";import"../../../icons/index.js";import{Button as a}from"../../../shared/ui/Button/Button.js";import{Dialog as o}from"../../../shared/ui/Dialog/Dialog.js";import"../../../shared/ui/Dialog/index.js";import{Card as s}from"../../../shared/ui/Card/Card.js";import{Collapsible as c}from"../../../shared/ui/Collapsible/Collapsible.js";import"../../../shared/ui/Collapsible/index.js";import{text as l}from"../../../shared/ui/Text/Text.js";import"../../../ui/index.js";import{Frame as u}from"../../../shared/dialog/Frame.js";import{styles as d}from"./DepositBootstrapErrorState.styles.js";import{jsx as f,jsxs as p}from"react/jsx-runtime";import*as m from"@stylexjs/stylex";const h=process.env.NODE_ENV!==`production`;function g(){return p(`svg`,{"aria-hidden":!0,viewBox:`0 0 64 64`,xmlns:`http://www.w3.org/2000/svg`,fill:`none`,...m.props(d.heroRing),children:[f(`circle`,{cx:`32`,cy:`32`,r:`28`,strokeWidth:`2`,style:{stroke:`color-mix(in oklab, var(--stridge-kit-warning) 55%, transparent)`}}),f(`circle`,{cx:`32`,cy:`32`,r:`20`,style:{fill:`var(--stridge-kit-warning)`}}),f(`path`,{d:`M32 22V34`,strokeWidth:`2.8`,strokeLinecap:`round`,style:{stroke:`var(--stridge-kit-warning-foreground)`}}),f(`circle`,{cx:`32`,cy:`40.5`,r:`1.8`,style:{fill:`var(--stridge-kit-warning-foreground)`}})]})}function _(){let _=n(),{close:y}=r(),{_:b}=t(),x=(_.target.status===`error`?_.target.error:void 0)??(_.brand.status===`error`?_.brand.error:void 0)??(_.addresses.status===`error`?_.addresses.error:void 0),S=x?.name??`DepositBootstrapError`,C=x?.message??b({id:`3yd3IL`,message:`The deposit driver failed to load gateway configuration.`}),w=x?.stack;return p(u,{"data-stridge-slot":`deposit-bootstrap-error`,"data-testid":`deposit-bootstrap-error`,...m.props(d.root),children:[p(s.Header,{...m.props(d.header),children:[f(l.span,{size:`base`,fontWeight:`semibold`,leading:`tight`,tracking:`tight`,children:f(e,{id:`OLF0i7`,message:`Couldn't load deposit options`})}),f(o.CloseButton,{})]}),p(s.Body,{children:[p(`div`,{"data-stridge-slot":`deposit-bootstrap-error-hero`,...m.props(d.hero),children:[f(g,{}),f(l.span,{size:`lg`,fontWeight:`semibold`,leading:`tight`,tracking:`tight`,align:`center`,...m.props(d.heroHeadline),children:f(e,{id:`qQ5VJt`,message:`We can't reach the gateway right now`})}),f(l.span,{size:`sm`,leading:`normal`,align:`center`,color:`subdued`,...m.props(d.heroReason),children:f(e,{id:`02NghK`,message:`Close this dialog and try again in a moment. If the problem persists, double-check the gateway key on your integration.`})})]}),p(c,{"data-stridge-slot":`deposit-bootstrap-error-details`,...m.props(d.details),children:[p(c.Trigger,{render:f(`button`,{type:`button`}),"aria-label":b({id:`c6Bl9M`,message:`Toggle technical details`}),...m.props(d.detailsTrigger),children:[f(l.span,{size:`xs`,fontWeight:`medium`,leading:`tight`,color:`subdued`,children:f(e,{id:`69Gavs`,message:`Technical details`})}),f(i,{"aria-hidden":!0,...m.props(d.detailsChevron)})]}),f(c.Panel,{children:p(`div`,{...m.props(d.detailsPanel),children:[f(v,{label:b({id:`SlfejT`,message:`Error`}),value:S}),f(v,{label:b({id:`xDAtGP`,message:`Message`}),value:C}),h&&w?p(`div`,{...m.props(d.detailsRow),children:[f(l.span,{size:`2xs`,fontWeight:`medium`,leading:`tight`,tracking:`widest`,transform:`uppercase`,color:`subdued`,children:f(e,{id:`P9fBwv`,message:`Stack`})}),f(`pre`,{...m.props(d.stack),children:w})]}):null]})})]})]}),f(s.Footer,{...m.props(d.footer),children:f(a,{variant:`default`,size:`cta`,onClick:y,"data-stridge-slot":`deposit-bootstrap-error-close`,...m.props(d.cta),children:f(e,{id:`yz7wBu`,message:`Close`})})})]})}function v({label:e,value:t}){return p(`div`,{...m.props(d.detailsRow),children:[f(l.span,{size:`2xs`,fontWeight:`medium`,leading:`tight`,tracking:`widest`,transform:`uppercase`,color:`subdued`,children:e}),f(l.span,{size:`xs`,fontWeight:`normal`,leading:`normal`,...m.props(d.detailsValue),children:t})]})}export{_ as DepositBootstrapErrorState};
|
|
@@ -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{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{
|
|
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{DepositActivityDetail as o}from"../widgets/activity/DepositActivityDetail.js";import{DepositActivityList as s}from"../widgets/activity/DepositActivityList.js";import"../widgets/activity/index.js";import{AmountEntry as c}from"../widgets/amount-entry/AmountEntry.js";import"../widgets/amount-entry/index.js";import{AssetPicker as l}from"../widgets/asset-picker/AssetPicker.js";import"../widgets/asset-picker/index.js";import{ConfirmDeposit as u}from"../widgets/confirm-deposit/ConfirmDeposit.js";import"../widgets/confirm-deposit/index.js";import{Deposit as d}from"../widgets/deposit/Deposit.js";import"../widgets/deposit/index.js";import{DepositStatusBanner as f}from"../widgets/deposit-status-banner/DepositStatusBanner.js";import"../widgets/deposit-status-banner/index.js";import{ErrorState as p}from"../widgets/error-state/ErrorState.js";import"../widgets/error-state/index.js";import{ProcessingState as m}from"../widgets/processing-state/ProcessingState.js";import"../widgets/processing-state/index.js";import{SuccessState as h}from"../widgets/success-state/SuccessState.js";import"../widgets/success-state/index.js";import{TransferCrypto as g}from"../widgets/transfer-crypto/TransferCrypto.js";import"../widgets/transfer-crypto/index.js";import{jsx as _,jsxs as v}from"react/jsx-runtime";function y({container:y,metadata:b,onError:x}={}){let{state:S,controller:C}=t(),w=e(),T=S.name!==`closed`;return n({state:S,settlement:w.settlement,quote:w.quote,metadata:b}),r(),_(i,{open:T,onOpenChange:e=>{e||C.close()},children:_(i.Content,{container:y,children:v(a.Boundary,{...x?{onError:x}:{},children:[_(a.Guards,{children:v(a.Steps,{children:[_(a.Step,{name:`deposit`,children:_(d,{})}),_(a.Step,{name:`assetPicker`,children:_(l,{})}),_(a.Step,{name:`amountEntry`,children:_(c,{})}),_(a.Step,{name:`confirmDeposit`,children:_(u,{})}),_(a.Step,{name:`transferCrypto`,children:_(g,{})}),_(a.Step,{name:`processing`,children:_(m,{})}),_(a.Step,{name:`success`,children:_(h,{})}),_(a.Step,{name:`error`,children:_(p,{})}),_(a.Step,{name:`activityList`,children:_(s,{})}),_(a.Step,{name:`activityDetail`,children:_(o,{})})]})}),_(f,{})]})})})}export{y as DepositDialog};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{classifyFailureKind as e,classifySettlementStatus as t}from"../../../shared/transformers/classifySettlementStatus.js";import{parseDecimalSafe as n,parseSmallestUnit as r}from"../../../shared/transformers/parseSmallestUnit.js";import{parseIsoMs as i}from"../../../shared/transformers/parseIsoMs.js";import"../../../shared/transformers/pickRelevantSettlement.js";import{formatDurationCompact as a}from"../../../../shared/format/formatDurationCompact.js";import{formatTimestamp as o}from"../../../../shared/format/formatTimestamp.js";import{formatTokenAmount as s}from"../../../../shared/format/formatTokenAmount.js";import{shortenAddress as c}from"../../../../shared/format/shortenAddress.js";function l(e,n,r){let i=t(e.status);return i===`completed`?d(e,n,r):i===`failed`?f(e,n,r):u(e,n,r)}function u(e,t,n){let r=e.from,a=i(r?.confirmed_at)??i(e.created_at),l=i(r?.confirmed_at)??i(e.created_at)??Date.now(),u=m(e.to,t.destination.asset_decimals);return{kind:`pending`,sourceWallet:p(n),creditedAsset:{symbol:t.destination.asset_symbol,decimals:t.destination.asset_decimals,address:t.destination.asset_address??``,isNative:!t.destination.asset_address},creditedTo:n.brandName??t.destination.address,...r?.tx_id?{txHash:{value:r.tx_id,formatted:c(r.tx_id)},...h(r,n,r.tx_id)?{txExplorerUrl:h(r,n,r.tx_id)}:{}}:{},...a===void 0?{}:{detectedAt:{value:a,formatted:o(a,n.i18n)}},submittedAt:{value:l,formatted:o(l,n.i18n)},receiveAmount:{value:u,formatted:s(u,n.i18n,{maxDecimals:t.destination.asset_decimals})}}}function d(e,t,n){let r=e.from,l=e.to,u=i(r?.confirmed_at)??i(e.created_at)??Date.now(),d=i(l?.settled_at)??i(e.updated_at)??Date.now(),f=Math.max(0,d-u),_=m(l,t.destination.asset_decimals),v=t.destination.address;return{kind:`succeeded`,sourceWallet:p(n),destination:{...n.brandName?{name:n.brandName}:{},address:{value:v,formatted:c(v)}},creditedAsset:{symbol:t.destination.asset_symbol,decimals:t.destination.asset_decimals,address:t.destination.asset_address??``,isNative:!t.destination.asset_address},receiveAmount:{value:_,formatted:s(_,n.i18n,{maxDecimals:t.destination.asset_decimals})},routeHops:g(e),totalTime:{value:f,formatted:a(f,n.i18n)},...r?.tx_id?{depositTx:{hash:{value:r.tx_id,formatted:c(r.tx_id)},...h(r,n,r.tx_id)?{explorerUrl:h(r,n,r.tx_id)}:{}}}:{depositTx:{hash:{value:``,formatted:``}}},...l?.tx_id?{completionTx:{hash:{value:l.tx_id,formatted:c(l.tx_id)},...h(l,n,l.tx_id)?{explorerUrl:h(l,n,l.tx_id)}:{}}}:{},submittedAt:{value:u,formatted:o(u,n.i18n)},filledAt:{value:d,formatted:o(d,n.i18n)}}}function f(t,n,r){let a=t.from,l=i(a?.confirmed_at)??i(t.created_at)??Date.now(),u=i(t.updated_at)??Date.now(),d=a?.tx_id??``,f=n.destination.address;return{kind:`failed`,failureKind:e(t.error),sourceWallet:p(r),destination:{...r.brandName?{name:r.brandName}:{},address:{value:f,formatted:c(f)}},creditedAsset:{symbol:n.destination.asset_symbol,decimals:n.destination.asset_decimals,address:n.destination.asset_address??``,isNative:!n.destination.asset_address},receiveAmount:{value:0,formatted:s(0,r.i18n)},txHash:{value:d,formatted:d?c(d):``},...h(a,r,d)?{txExplorerUrl:h(a,r,d)}:{},submittedAt:{value:l,formatted:o(l,r.i18n)},failedAt:{value:u,formatted:o(u,r.i18n)}}}function p(e){return{...e.sourceWallet.name?{name:e.sourceWallet.name}:{},address:{value:e.sourceWallet.address,formatted:c(e.sourceWallet.address)},...e.sourceWallet.explorerUrl?{explorerUrl:e.sourceWallet.explorerUrl}:{}}}function m(e,t){if(!e)return 0;if(e.amount){let t=n(e.amount);if(t>0)return t}return e.raw_amount?r(e.raw_amount,t):0}function h(e,t,n){if(!e||!n)return;let r=e.eip155_id===void 0?void 0:Number(e.eip155_id);if(r===void 0||!t.explorers)return;let i=t.explorers[r];if(i)return`${i.replace(/\/+$/,``)}/tx/${n}`}function g(e){let t=e.from,n=e.to,r=e.route?.provider??``,i=[];return t?.eip155_id!==void 0&&i.push({provider:r,chainId:Number(t.eip155_id)}),n?.eip155_id!==void 0&&n.eip155_id!==t?.eip155_id&&i.push({provider:r,chainId:Number(n.eip155_id)}),i}export{l as settlementToPayload};
|
|
1
|
+
import{classifyFailureKind as e,classifySettlementStatus as t}from"../../../shared/transformers/classifySettlementStatus.js";import{parseDecimalSafe as n,parseSmallestUnit as r}from"../../../shared/transformers/parseSmallestUnit.js";import{parseIsoMs as i}from"../../../shared/transformers/parseIsoMs.js";import"../../../shared/transformers/pickRelevantSettlement.js";import{formatDurationCompact as a}from"../../../../shared/format/formatDurationCompact.js";import{formatTimestamp as o}from"../../../../shared/format/formatTimestamp.js";import{formatTokenAmount as s}from"../../../../shared/format/formatTokenAmount.js";import{shortenAddress as c}from"../../../../shared/format/shortenAddress.js";function l(e,n,r){let i=t(e.status);return i===`completed`?d(e,n,r):i===`failed`?f(e,n,r):u(e,n,r)}function u(e,t,n){let r=e.from,a=i(r?.confirmed_at)??i(e.created_at),l=i(r?.confirmed_at)??i(e.created_at)??Date.now(),u=m(e.to,t.destination.asset_decimals);return{kind:`pending`,sourceWallet:p(n),creditedAsset:{symbol:t.destination.asset_symbol,decimals:t.destination.asset_decimals,address:t.destination.asset_address??``,isNative:!t.destination.asset_address},creditedTo:n.brandName??c(t.destination.address),...r?.tx_id?{txHash:{value:r.tx_id,formatted:c(r.tx_id)},...h(r,n,r.tx_id)?{txExplorerUrl:h(r,n,r.tx_id)}:{}}:{},...a===void 0?{}:{detectedAt:{value:a,formatted:o(a,n.i18n)}},submittedAt:{value:l,formatted:o(l,n.i18n)},receiveAmount:{value:u,formatted:s(u,n.i18n,{maxDecimals:t.destination.asset_decimals})}}}function d(e,t,n){let r=e.from,l=e.to,u=i(r?.confirmed_at)??i(e.created_at)??Date.now(),d=i(l?.settled_at)??i(e.updated_at)??Date.now(),f=Math.max(0,d-u),_=m(l,t.destination.asset_decimals),v=t.destination.address;return{kind:`succeeded`,sourceWallet:p(n),destination:{...n.brandName?{name:n.brandName}:{},address:{value:v,formatted:c(v)}},creditedAsset:{symbol:t.destination.asset_symbol,decimals:t.destination.asset_decimals,address:t.destination.asset_address??``,isNative:!t.destination.asset_address},receiveAmount:{value:_,formatted:s(_,n.i18n,{maxDecimals:t.destination.asset_decimals})},routeHops:g(e),totalTime:{value:f,formatted:a(f,n.i18n)},...r?.tx_id?{depositTx:{hash:{value:r.tx_id,formatted:c(r.tx_id)},...h(r,n,r.tx_id)?{explorerUrl:h(r,n,r.tx_id)}:{}}}:{depositTx:{hash:{value:``,formatted:``}}},...l?.tx_id?{completionTx:{hash:{value:l.tx_id,formatted:c(l.tx_id)},...h(l,n,l.tx_id)?{explorerUrl:h(l,n,l.tx_id)}:{}}}:{},submittedAt:{value:u,formatted:o(u,n.i18n)},filledAt:{value:d,formatted:o(d,n.i18n)}}}function f(t,n,r){let a=t.from,l=i(a?.confirmed_at)??i(t.created_at)??Date.now(),u=i(t.updated_at)??Date.now(),d=a?.tx_id??``,f=n.destination.address;return{kind:`failed`,failureKind:e(t.error),sourceWallet:p(r),destination:{...r.brandName?{name:r.brandName}:{},address:{value:f,formatted:c(f)}},creditedAsset:{symbol:n.destination.asset_symbol,decimals:n.destination.asset_decimals,address:n.destination.asset_address??``,isNative:!n.destination.asset_address},receiveAmount:{value:0,formatted:s(0,r.i18n)},txHash:{value:d,formatted:d?c(d):``},...h(a,r,d)?{txExplorerUrl:h(a,r,d)}:{},submittedAt:{value:l,formatted:o(l,r.i18n)},failedAt:{value:u,formatted:o(u,r.i18n)}}}function p(e){return{...e.sourceWallet.name?{name:e.sourceWallet.name}:{},address:{value:e.sourceWallet.address,formatted:c(e.sourceWallet.address)},...e.sourceWallet.explorerUrl?{explorerUrl:e.sourceWallet.explorerUrl}:{}}}function m(e,t){if(!e)return 0;if(e.amount){let t=n(e.amount);if(t>0)return t}return e.raw_amount?r(e.raw_amount,t):0}function h(e,t,n){if(!e||!n)return;let r=e.eip155_id===void 0?void 0:Number(e.eip155_id);if(r===void 0||!t.explorers)return;let i=t.explorers[r];if(i)return`${i.replace(/\/+$/,``)}/tx/${n}`}function g(e){let t=e.from,n=e.to,r=e.route?.provider??``,i=[];return t?.eip155_id!==void 0&&i.push({provider:r,chainId:Number(t.eip155_id)}),n?.eip155_id!==void 0&&n.eip155_id!==t?.eip155_id&&i.push({provider:r,chainId:Number(n.eip155_id)}),i}export{l as settlementToPayload};
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { Entity, SettlementFailureKind, TxRef } from "../../../shared/driver/types.js";
|
|
2
|
-
import { ActivityHistoryPayload } from "../../../shared/widgets/activity-history/payloads.js";
|
|
3
2
|
import { AcceptedAssetPayload, AddressItemPayload, AssetPayload, BalanceItemPayload, BrandPayload, ChainPayload, QuoteBreakdownPayload, QuotePayload, QuoteRoutePayload, SettlementFailurePayload, SettlementPayload, SettlementPendingPayload, SettlementSuccessPayload, SourceWalletPayload, TargetPayload, WalletInfo, WalletPayload } from "./payloads.js";
|
|
4
|
-
import { DepositAddressDto,
|
|
3
|
+
import { DepositAddressDto, GatewaySettlementDto, GatewayStartResponse, GatewayUdaDto, OnchainBalanceResponse, QuoteResponse, SupportedAssetDto, SupportedAssetsResponse } from "@stridge/sdk";
|
|
5
4
|
|
|
6
5
|
//#region src/flows/deposit/driver/types.d.ts
|
|
7
6
|
/**
|
|
@@ -48,20 +47,6 @@ interface DepositSnapshot {
|
|
|
48
47
|
* settlement (deposit-method tile, amount-entry source pill, banner disconnected-state copy).
|
|
49
48
|
*/
|
|
50
49
|
wallet: Entity<WalletPayload, WalletInfo, WalletInfo>;
|
|
51
|
-
/**
|
|
52
|
-
* Owner-scoped recent activity. Backed by the multi-UDA envelope from `GET /gateway/{owner}`
|
|
53
|
-
* fetched without a destination filter, so the list spans both deposit-direction and
|
|
54
|
-
* withdraw-direction settlements for the connected owner. Drives the kit's in-dialog
|
|
55
|
-
* `<ActivityHistory>` surface. `idle` when no fetch has run yet; `loading` during the first
|
|
56
|
-
* fetch; `ready` / `stale` once a list has landed; `error` when the initial fetch failed and
|
|
57
|
-
* the list is empty.
|
|
58
|
-
*
|
|
59
|
-
* The entity's `raw` slot is the array of UDAs from the envelope — the detail view walks
|
|
60
|
-
* `raw[].settlements[]` to locate a settlement by id and feeds it back through
|
|
61
|
-
* {@link import("./transformers").settlementToPayload} to render full success / error /
|
|
62
|
-
* processing widgets at display time.
|
|
63
|
-
*/
|
|
64
|
-
history: Entity<ActivityHistoryPayload, ReadonlyArray<GatewayUdaDto>, GatewayPollResponse>;
|
|
65
50
|
}
|
|
66
51
|
/**
|
|
67
52
|
* Input to {@link DepositDriver.requestQuote}.
|
|
@@ -211,28 +196,6 @@ interface DepositDriver {
|
|
|
211
196
|
* method picker.
|
|
212
197
|
*/
|
|
213
198
|
fetchActiveSettlement?(input: FetchActiveSettlementInput, signal: AbortSignal): Promise<SettlementSnapshot | null>;
|
|
214
|
-
/**
|
|
215
|
-
* Owner-scoped activity refresh. Calls `GET /gateway/{owner}` without a destination tuple,
|
|
216
|
-
* collapses the multi-UDA envelope into a row payload, and updates {@link
|
|
217
|
-
* DepositSnapshot.history} in place (transitioning `idle → loading → ready`, or
|
|
218
|
-
* `ready → stale → ready` for refreshes). Used as the imperative one-shot trigger — the
|
|
219
|
-
* activity surface's error-view retry button calls this. Steady-state recurring fetches
|
|
220
|
-
* land via {@link watchHistory}. Optional — drivers that don't have a multi-UDA history
|
|
221
|
-
* concept can omit it, in which case the activity header icon is hidden.
|
|
222
|
-
*/
|
|
223
|
-
refreshHistory?(signal: AbortSignal): void;
|
|
224
|
-
/**
|
|
225
|
-
* Long-running adaptive poll of `GET /gateway/{owner}` (unfiltered). Updates
|
|
226
|
-
* {@link DepositSnapshot.history} in place every tick. Cadence adapts to the
|
|
227
|
-
* current payload — short interval while any row is `pending`, long interval
|
|
228
|
-
* once all rows are terminal. Mounted by the controller while the FSM is on
|
|
229
|
-
* `history`; aborted on transition out.
|
|
230
|
-
*
|
|
231
|
-
* Optional — drivers that don't have a multi-UDA history concept can omit
|
|
232
|
-
* it. When omitted alongside {@link refreshHistory}, the activity surface
|
|
233
|
-
* stays cold (only the initial paint, no live updates).
|
|
234
|
-
*/
|
|
235
|
-
watchHistory?(signal: AbortSignal): void;
|
|
236
199
|
}
|
|
237
200
|
//#endregion
|
|
238
201
|
export { DepositDriver, DepositSnapshot, FetchActiveSettlementInput, RequestQuoteInput, SettlementSnapshot, SubmitDepositInput, WatchSettlementInput, WatchSourceTxInput };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{
|
|
1
|
+
"use client";import{useOptionalActivityDriverInstance as e}from"../../activity/driver/context.js";import{useLingui as t}from"../../../shared/i18n/useLingui.js";import"../../../i18n/index.js";import{toFailure as n}from"../../../shared/orchestrator/toFailure.js";import{useDriverSettlementListener as r}from"../../../shared/orchestrator/useDriverSettlementListener.js";import{useEffectiveState as i}from"../../../shared/orchestrator/useEffectiveState.js";import{isUserRejectionFailure as a}from"../../../shared/orchestrator/userRejection.js";import{useSettlementWatcher as o}from"../../../shared/orchestrator/useSettlementWatcher.js";import"../../../shared/orchestrator/index.js";import{useDepositDriverInstance as s}from"../driver/context.js";import{initialState as c,reducer as l}from"./reducer.js";import{resolveAssetById as u}from"./resolveAssetById.js";import{createContext as d,use as f,useCallback as p,useEffect as m,useMemo as h,useReducer as g,useRef as _}from"react";import{jsx as v}from"react/jsx-runtime";const y={id:`ELhVSL`,message:`Failed to submit deposit.`},b={id:`Ej5HL9`,message:`Signature declined. Please try again.`},x=d(null);x.displayName=`GatewayControllerContext`;function S(){let e=f(x);if(!e)throw Error(`useDeposit / GatewayController must be used inside <KitProvider deposit={…} />. Mount KitProvider once at the host's app root.`);return e}function C(){return f(x)}const w=d(void 0);w.displayName=`DepositMethodsConfigContext`;function T(){return f(w)}function E(){return S().state}function D(){return S().effectiveState}function O(){return S().actions}function k({methodsConfig:t,children:n}){let r=s(),a=e(),[o,u]=g(l,c),d=j(o,u,r,a);M(o,u,r),N(o,u,r,a);let f=i(o),p=A(o,u,r,d,t);return v(w,{value:t,children:v(x,{value:h(()=>({state:o,effectiveState:f,dispatch:u,controller:p,actions:d}),[o,f,p,d]),children:n})})}function A(e,t,n,r,i){let a=_(n);a.current=n;let o=_(i);o.current=i;let s=p(e=>{if(!e)return a.current.arm(),t({type:`OPEN`,input:void 0}),!0;if(o.current?.[e.method]?.disabled)return!1;if(e.method===`transfer`)return a.current.arm(),t({type:`OPEN`,input:{method:`transfer`}}),!0;if(e.method===`wallet`&&e.assetId!==void 0){let n=u(a.current.getSnapshot(),e.assetId);return a.current.arm(),n?(t({type:`OPEN`,input:{method:`wallet`,asset:n}}),!0):(t({type:`OPEN`,input:{method:`wallet`}}),!0)}return a.current.arm(),t({type:`OPEN`,input:{method:`wallet`}}),!0},[t]),c=p(()=>{t({type:`CLOSE`})},[t]);return h(()=>({open:s,close:c,actions:r}),[s,c,r])}function j(e,r,i,o){let s=_(e);s.current=e;let c=_(i);c.current=i;let l=_(o);l.current=o;let u=_(r);u.current=r;let{i18n:d}=t(),f=_(d);f.current=d;let m=p((e,t)=>{let r=c.current,i=new AbortController,o=F(e,t);r.submitDeposit(o,i.signal).then(e=>{if(!i.signal.aborted){try{r.invalidateBalances?.()}catch{}try{l.current?.invalidateActivity?.()}catch{}u.current({type:`DEPOSIT_SUBMITTED`,tx:e})}}).catch(e=>{if(i.signal.aborted)return;let t=n(e,f.current._(y));if(a(t)){u.current({type:`DEPOSIT_SIGNATURE_DECLINED`,notice:f.current._(b)});return}u.current({type:`DEPOSIT_SUBMISSION_FAILED`,failure:t})})},[]),g=p(e=>{u.current({type:`DEPOSIT_METHOD_SELECTED`,method:e})},[]),v=p(e=>{u.current({type:`ASSET_CONFIRMED`,asset:e})},[]),x=p(e=>{s.current.name===`amountEntry`&&u.current({type:`AMOUNT_CONFIRMED`,amount:e})},[]),S=p(()=>{let e=s.current;if(e.name!==`confirmDeposit`)return;let t=e.ctx.phase;if(t.kind===`failed`){u.current({type:`QUOTE_RETRY`});return}if(t.kind!==`ready`)return;let{asset:n,amount:r}=e.ctx;u.current({type:`DEPOSIT_CONFIRMED`}),m(n,r)},[m]),C=p(()=>{u.current({type:`BACK`})},[]),w=p(()=>{u.current({type:`CLOSE`})},[]),T=p(()=>{u.current({type:`SUCCESS_DONE`})},[]),E=p(()=>{u.current({type:`ERROR_TRY_AGAIN`})},[]),D=p((e,t)=>{u.current({type:`RESUME_TO_PROCESSING`,method:e,tx:t})},[]),O=p((e,t)=>{u.current({type:`RESUME_TO_SUCCESS`,method:e,tx:t})},[]),k=p(e=>{u.current({type:`RESUME_TO_ERROR`,...e?{tx:e}:{}})},[]),A=p(()=>{if(l.current==null){process.env.NODE_ENV!==`production`&&console.warn("[@stridge/kit] useDepositActions().openActivity() was called but no activity driver is mounted. Wrap the host with `<KitProvider activity={…}>` (or `<StridgeProvider>` with any flow enabled) to enable the activity surface.");return}let e=s.current;e.name!==`deposit`&&e.name!==`assetPicker`&&e.name!==`amountEntry`&&e.name!==`transferCrypto`||u.current({type:`OPEN_ACTIVITY`})},[]),j=p(e=>{u.current({type:`SELECT_SETTLEMENT`,settlementId:e})},[]);return h(()=>({selectMethod:g,confirmAsset:v,confirmAmount:x,confirmDeposit:S,back:C,close:w,successDone:T,tryAgain:E,resumeToProcessing:D,resumeToSuccess:O,resumeToError:k,openActivity:A,selectSettlement:j}),[g,v,x,S,C,w,T,E,D,O,k,A,j])}function M(e,t,r){m(()=>{if(e.name!==`confirmDeposit`||e.ctx.phase.kind!==`loading`&&e.ctx.phase.kind!==`regenerating`)return;let i=new AbortController,a=P(e.ctx.asset,e.ctx.amount);return r.requestQuote(a,i.signal).catch(e=>{i.signal.aborted||t({type:`QUOTE_FAILED`,failure:n(e,`Failed to fetch quote.`)})}),()=>i.abort()},[e.name,e.name===`confirmDeposit`?e.ctx.phase.kind:void 0,e.name===`confirmDeposit`?e.ctx.asset:void 0,e.name===`confirmDeposit`?e.ctx.amount:void 0,r,t]),m(()=>{if(e.name!==`confirmDeposit`||e.ctx.phase.kind!==`ready`)return;let n=e.ctx.phase.quoteExpiresAt,r=Math.max(0,n-Date.now()),i=setTimeout(()=>{t({type:`QUOTE_EXPIRED`})},r);return()=>clearTimeout(i)},[e.name,e.name===`confirmDeposit`&&e.ctx.phase.kind===`ready`?e.ctx.phase.quoteExpiresAt:void 0,t])}function N(e,t,n,i){let a=_(i);a.current=i;let s=e.name===`processing`?e.ctx.tx:void 0;o(n,s?{tx:s}:void 0,s?.hash),m(()=>{if(e.name!==`transferCrypto`||!n.watchSourceTx)return;let t=new AbortController,r;return n.watchSourceTx({},e=>{if(!t.signal.aborted&&!r){r=new AbortController,n.watchSettlement({tx:e},()=>{},r.signal);try{a.current?.invalidateActivity?.()}catch{}}},t.signal),()=>{t.abort(),r?.abort()}},[e.name,n]);let c=e.name===`activityList`||e.name===`activityDetail`;m(()=>{if(!c||!i)return;let e=new AbortController;return i.watchActivity(e.signal),()=>e.abort()},[c,i]),m(()=>{if(e.name===`closed`||e.name===`transferCrypto`||e.name===`processing`||c||!n.fetchActiveSettlement)return;let t=new AbortController,r,i,a=!1,o=async()=>{try{let e=await n.fetchActiveSettlement({},t.signal);if(a)return;if(e&&!r&&e.payload.kind===`pending`){let t=e.payload.txHash?.value;t&&(r=new AbortController,n.watchSettlement({tx:{hash:t}},()=>{},r.signal))}}catch{}a||(i=setTimeout(o,5e3))};return o(),()=>{a=!0,t.abort(),r?.abort(),i&&clearTimeout(i)}},[e.name,c,n]);let l=_(e);l.current=e,r(n,e=>{if(e===`pending`||e===`succeeded`||e===`failed`)try{n.invalidateBalances?.()}catch{}l.current.name===`processing`&&(e===`succeeded`?t({type:`PROCESSING_SUCCEEDED`}):e===`failed`&&t({type:`PROCESSING_FAILED`}))});let u=_(null);m(()=>{let e=()=>{let e=n.getSnapshot(),r=l.current,i=e.quote;i.status!==u.current&&(u.current=i.status,i.status===`ready`&&r.name===`confirmDeposit`?(r.ctx.phase.kind===`loading`||r.ctx.phase.kind===`regenerating`)&&t({type:`QUOTE_RESOLVED`,expiresAt:i.payload.expiresAt}):i.status===`error`&&r.name===`confirmDeposit`&&(r.ctx.phase.kind===`loading`||r.ctx.phase.kind===`regenerating`)&&t({type:`QUOTE_FAILED`,failure:{reason:i.error.message,code:i.error.name}}))},r=n.subscribe(e);return e(),r},[n,t])}function P(e,t){let n=e.eip155Id;if(!n)throw Error(`Asset ${e.symbol} is missing eip155Id; cannot build quote input.`);return{sourceChainId:Number(n),sourceTokenAddress:e.address,sourceTokenDecimals:e.decimals,sourceTokenSymbol:e.symbol,sourceIsNative:e.isNative,amount:t,...e.priceUsd===void 0?{}:{sourcePriceUsd:e.priceUsd}}}function F(e,t){let n=e.eip155Id;if(!n)throw Error(`Asset ${e.symbol} is missing eip155Id; cannot build submit input.`);return{sourceChainId:Number(n),sourceTokenAddress:e.address,sourceTokenDecimals:e.decimals,sourceIsNative:e.isNative,amount:t}}export{k as GatewayController,S as useControllerContext,O as useDepositActions,D as useDepositEffectiveState,T as useDepositMethodsConfig,E as useDepositState,C as useOptionalControllerContext};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
import{createActivityReducers as e}from"../../../shared/orchestrator/createActivityReducers.js";import"../../../shared/orchestrator/index.js";const t={name:`closed`},{reduceFromActivityList:n,reduceFromActivityDetail:r}=e({activityList:e=>({name:`activityList`,ctx:{backTarget:e}}),activityDetail:(e,t,n)=>({name:`activityDetail`,ctx:{settlementId:e,backTarget:t,viaList:n}}),closed:()=>({name:`closed`}),restoreFromBackTarget:e=>m(e)});function i(e,t){if(t.type===`RESUME_TO_PROCESSING`)return e.name===`closed`?e:{name:`processing`,ctx:{method:t.method,tx:t.tx,retryTargetForFailure:{kind:`fresh`}}};if(t.type===`RESUME_TO_SUCCESS`)return e.name===`closed`?e:{name:`success`,ctx:{method:t.method,tx:t.tx}};if(t.type===`RESUME_TO_ERROR`)return e.name===`closed`?e:{name:`error`,ctx:{retryTarget:{kind:`fresh`},...t.tx?{tx:t.tx}:{}}};switch(e.name){case`closed`:return a(t);case`deposit`:return o(e,t);case`assetPicker`:return s(e,t);case`amountEntry`:return c(e,t);case`confirmDeposit`:return l(e,t);case`transferCrypto`:return u(e,t);case`processing`:return d(e,t);case`success`:return f(e,t);case`error`:return p(e,t);case`activityList`:return n(e,t);case`activityDetail`:return r(e,t);default:return g(e)}}function a(e){if(e.type!==`OPEN`)return{name:`closed`};let t=e.input;return t?t.method===`transfer`?{name:`transferCrypto`,ctx:{method:`transfer`,backTarget:`closed`}}:t.asset?{name:`amountEntry`,ctx:{method:`wallet`,asset:t.asset,backTarget:`closed`}}:{name:`assetPicker`,ctx:{method:`wallet`,backTarget:`closed`}}:{name:`deposit`,ctx:{backTarget:`closed`}}}function o(e,t){switch(t.type){case`DEPOSIT_METHOD_SELECTED`:return t.method===`wallet`?{name:`assetPicker`,ctx:{method:`wallet`,backTarget:`deposit`}}:{name:`transferCrypto`,ctx:{method:`transfer`,backTarget:`deposit`}};case`OPEN_ACTIVITY`:return{name:`activityList`,ctx:{backTarget:{kind:`deposit`,backTarget:`closed`}}};case`BACK`:case`CLOSE`:return{name:`closed`};default:return e}}function s(e,t){switch(t.type){case`ASSET_CONFIRMED`:return{name:`amountEntry`,ctx:{method:`wallet`,asset:t.asset,backTarget:`assetPicker`}};case`OPEN_ACTIVITY`:return{name:`activityList`,ctx:{backTarget:{kind:`assetPicker`,method:`wallet`,backTarget:e.ctx.backTarget}}};case`BACK`:return e.ctx.backTarget===`deposit`?{name:`deposit`,ctx:{backTarget:`closed`}}:{name:`closed`};case`CLOSE`:return{name:`closed`};default:return e}}function c(e,t){switch(t.type){case`AMOUNT_CONFIRMED`:return{name:`confirmDeposit`,ctx:{method:`wallet`,asset:e.ctx.asset,amount:t.amount,phase:{kind:`loading`},backTarget:`amountEntry`}};case`OPEN_ACTIVITY`:return{name:`activityList`,ctx:{backTarget:{kind:`amountEntry`,method:`wallet`,asset:e.ctx.asset,backTarget:e.ctx.backTarget}}};case`BACK`:return e.ctx.backTarget===`assetPicker`?{name:`assetPicker`,ctx:{method:`wallet`,backTarget:`deposit`}}:{name:`closed`};case`CLOSE`:return{name:`closed`};default:return e}}function l(e,t){let n=e.ctx.phase;switch(t.type){case`QUOTE_RESOLVED`:return n.kind===`loading`||n.kind===`regenerating`?{...e,ctx:{...e.ctx,phase:{kind:`ready`,quoteExpiresAt:t.expiresAt}}}:e;case`QUOTE_FAILED`:return n.kind===`loading`||n.kind===`regenerating`?{...e,ctx:{...e.ctx,phase:{kind:`failed`,failure:t.failure,recoverFrom:`quote`}}}:e;case`QUOTE_RETRY`:return n.kind===`failed`?{...e,ctx:{...e.ctx,phase:{kind:`loading`}}}:e;case`QUOTE_EXPIRED`:return n.kind===`ready`?{...e,ctx:{...e.ctx,phase:{kind:`regenerating`}}}:e;case`DEPOSIT_CONFIRMED`:return n.kind===`ready`?{...e,ctx:{...e.ctx,phase:{kind:`submitting`}}}:e;case`DEPOSIT_SUBMITTED`:if(n.kind===`submitting`){let n={kind:`confirmDepositReady`,method:`wallet`,asset:e.ctx.asset,amount:e.ctx.amount};return{name:`processing`,ctx:{method:`wallet`,tx:t.tx,retryTargetForFailure:n}}}return e;case`DEPOSIT_SUBMISSION_FAILED`:return n.kind===`submitting`?{...e,ctx:{...e.ctx,phase:{kind:`failed`,failure:t.failure,recoverFrom:`submission`}}}:e;case`DEPOSIT_SIGNATURE_DECLINED`:return n.kind===`submitting`?{...e,ctx:{...e.ctx,phase:{kind:`regenerating`,...t.notice?{notice:t.notice}:{}}}}:e;case`BACK`:return{name:`amountEntry`,ctx:{method:`wallet`,asset:e.ctx.asset,backTarget:`assetPicker`}};case`CLOSE`:return{name:`closed`};default:return e}}function u(e,t){switch(t.type){case`OPEN_ACTIVITY`:return{name:`activityList`,ctx:{backTarget:{kind:`transferCrypto`,method:`transfer`,backTarget:e.ctx.backTarget}}};case`BACK`:return e.ctx.backTarget===`deposit`?{name:`deposit`,ctx:{backTarget:`closed`}}:{name:`closed`};case`CLOSE`:return{name:`closed`};default:return e}}function d(e,t){switch(t.type){case`PROCESSING_SUCCEEDED`:return{name:`success`,ctx:{method:e.ctx.method,tx:e.ctx.tx}};case`PROCESSING_FAILED`:return{name:`error`,ctx:{retryTarget:e.ctx.retryTargetForFailure,tx:e.ctx.tx}};case`CLOSE`:return{name:`closed`};default:return e}}function f(e,t){return t.type===`SUCCESS_DONE`||t.type===`CLOSE`?{name:`closed`}:e}function p(e,t){return t.type===`ERROR_TRY_AGAIN`?h(e.ctx.retryTarget):t.type===`CLOSE`?{name:`closed`}:e}function m(e){return e.kind===`deposit`?{name:`deposit`,ctx:{backTarget:`closed`}}:e.kind===`assetPicker`?{name:`assetPicker`,ctx:{method:`wallet`,backTarget:e.backTarget}}:e.kind===`amountEntry`?{name:`amountEntry`,ctx:{method:`wallet`,asset:e.asset,backTarget:e.backTarget}}:{name:`transferCrypto`,ctx:{method:`transfer`,backTarget:e.backTarget}}}function h(e){return e.kind===`fresh`?{name:`deposit`,ctx:{backTarget:`closed`}}:e.kind===`transferCrypto`?{name:`transferCrypto`,ctx:{method:`transfer`,backTarget:e.backTarget}}:{name:`confirmDeposit`,ctx:{method:`wallet`,asset:e.asset,amount:e.amount,phase:{kind:`loading`},backTarget:`amountEntry`}}}function g(e){throw Error(`Unhandled state: ${JSON.stringify(e)}`)}export{t as initialState,i as reducer};
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { TxRef } from "../../../shared/driver/types.js";
|
|
2
2
|
import { BalanceItemPayload } from "../driver/payloads.js";
|
|
3
3
|
import { FailureInfo } from "../../../shared/orchestrator/types.js";
|
|
4
|
-
|
|
5
4
|
//#region src/flows/deposit/orchestrator/types.d.ts
|
|
6
5
|
/**
|
|
7
6
|
* Deposit method picked on the `Deposit` widget. `wallet` enters Path A
|
|
@@ -77,14 +76,16 @@ type RetryTargetSpec = {
|
|
|
77
76
|
kind: "fresh";
|
|
78
77
|
};
|
|
79
78
|
/**
|
|
80
|
-
* Where `BACK` lands when the user exits the activity surface. Encoded once at `
|
|
79
|
+
* Where `BACK` lands when the user exits the activity surface. Encoded once at `OPEN_ACTIVITY`
|
|
81
80
|
* time so the back chevron can restore each pre-commit source state lossless — same precedent
|
|
82
|
-
* as {@link RetryTargetSpec}, just for the
|
|
81
|
+
* as {@link RetryTargetSpec}, just for the activity-exit path instead of the error-retry path.
|
|
83
82
|
*
|
|
84
83
|
* The discriminant `kind` mirrors the source-state name. The remaining fields carry exactly the
|
|
85
|
-
* ctx slots needed to rebuild that state (method, asset, inner backTarget).
|
|
84
|
+
* ctx slots needed to rebuild that state (method, asset, inner backTarget). Direct-entry into
|
|
85
|
+
* the per-flow activity is no longer possible — that path migrated to the standalone
|
|
86
|
+
* `useActivity()` hook — so every reachable backTarget identifies a concrete source step.
|
|
86
87
|
*/
|
|
87
|
-
type
|
|
88
|
+
type ActivityBackTarget = {
|
|
88
89
|
kind: "deposit";
|
|
89
90
|
backTarget: "closed";
|
|
90
91
|
} | {
|
|
@@ -171,24 +172,28 @@ type DepositState = {
|
|
|
171
172
|
};
|
|
172
173
|
} | {
|
|
173
174
|
/**
|
|
174
|
-
* Activity
|
|
175
|
-
* `backTarget` snapshots the source state at `
|
|
175
|
+
* Activity list — reachable from any pre-commit state via the header icon.
|
|
176
|
+
* `backTarget` snapshots the source state at `OPEN_ACTIVITY` time so the back chevron
|
|
176
177
|
* can restore it lossless.
|
|
177
178
|
*/
|
|
178
|
-
name: "
|
|
179
|
+
name: "activityList";
|
|
179
180
|
ctx: {
|
|
180
|
-
backTarget:
|
|
181
|
+
backTarget: ActivityBackTarget;
|
|
181
182
|
};
|
|
182
183
|
} | {
|
|
183
184
|
/**
|
|
184
|
-
* Activity
|
|
185
|
-
* `SELECT_SETTLEMENT`. Carries the selected row's id
|
|
186
|
-
*
|
|
185
|
+
* Activity per-settlement detail — reached from `activityList` via
|
|
186
|
+
* `SELECT_SETTLEMENT`. Carries the selected row's id, the same `backTarget` so `BACK`
|
|
187
|
+
* collapses through `activityList` to the original source step, and a `viaList` flag
|
|
188
|
+
* that disambiguates "reached via the list" from "reached imperatively"; the latter
|
|
189
|
+
* skips the list interlude on `BACK`. For direct-entry into the activity surface,
|
|
190
|
+
* see {@link useActivity}.
|
|
187
191
|
*/
|
|
188
|
-
name: "
|
|
192
|
+
name: "activityDetail";
|
|
189
193
|
ctx: {
|
|
190
194
|
settlementId: string;
|
|
191
|
-
backTarget:
|
|
195
|
+
backTarget: ActivityBackTarget;
|
|
196
|
+
viaList: boolean;
|
|
192
197
|
};
|
|
193
198
|
};
|
|
194
199
|
type DepositStateName = DepositState["name"];
|
|
@@ -282,16 +287,16 @@ type GatewayEvent = {
|
|
|
282
287
|
tx?: TxRef;
|
|
283
288
|
} | {
|
|
284
289
|
/**
|
|
285
|
-
* User tapped the header
|
|
290
|
+
* User tapped the header activity icon. Legal from every pre-commit state
|
|
286
291
|
* (`deposit | assetPicker | amountEntry | transferCrypto`); ignored elsewhere. The
|
|
287
|
-
* reducer snapshots the source state into a {@link
|
|
292
|
+
* reducer snapshots the source state into a {@link ActivityBackTarget} so the back
|
|
288
293
|
* chevron can restore it lossless.
|
|
289
294
|
*/
|
|
290
|
-
type: "
|
|
295
|
+
type: "OPEN_ACTIVITY";
|
|
291
296
|
} | {
|
|
292
297
|
/**
|
|
293
|
-
* User tapped a row in the activity list. Legal only from `
|
|
294
|
-
* to `
|
|
298
|
+
* User tapped a row in the activity list. Legal only from `activityList`; transitions
|
|
299
|
+
* to `activityDetail` carrying the selected `settlementId` and the same `backTarget`,
|
|
295
300
|
* so a later `BACK` from the list step restores the original source state.
|
|
296
301
|
*/
|
|
297
302
|
type: "SELECT_SETTLEMENT";
|
|
@@ -299,8 +304,11 @@ type GatewayEvent = {
|
|
|
299
304
|
};
|
|
300
305
|
/**
|
|
301
306
|
* Public open-input variant accepted by `useDeposit().open()`. Hosts pass the small ID-based
|
|
302
|
-
* shape; the controller resolves
|
|
303
|
-
*
|
|
307
|
+
* shape; the controller resolves `assetId` against the driver's `balances` entity before
|
|
308
|
+
* dispatching. Lookup misses fall through to the asset picker — the host's click never silently
|
|
309
|
+
* no-ops.
|
|
310
|
+
*
|
|
311
|
+
* For direct-entry into the activity surface, see {@link useActivity}.
|
|
304
312
|
*/
|
|
305
313
|
type OpenInput = undefined | {
|
|
306
314
|
method: "wallet";
|
|
@@ -317,11 +325,14 @@ interface DepositController {
|
|
|
317
325
|
*
|
|
318
326
|
* - `open()` → `deposit` (method picker)
|
|
319
327
|
* - `open({ method: "wallet" })` → `assetPicker`
|
|
320
|
-
* - `open({ method: "wallet", assetId })` → `amountEntry`
|
|
328
|
+
* - `open({ method: "wallet", assetId })` → `amountEntry` when `assetId` resolves, otherwise
|
|
329
|
+
* falls through to `assetPicker`
|
|
321
330
|
* - `open({ method: "transfer" })` → `transferCrypto`
|
|
322
331
|
*
|
|
323
|
-
* Returns `false` when `
|
|
324
|
-
*
|
|
332
|
+
* Returns `false` only when the requested `method` is disabled via
|
|
333
|
+
* {@link DepositMethodsConfig}.
|
|
334
|
+
*
|
|
335
|
+
* For direct-entry into the activity surface, see {@link useActivity}.
|
|
325
336
|
*/
|
|
326
337
|
open(input?: OpenInput): boolean;
|
|
327
338
|
/** Close the deposit dialog. Idempotent. */
|
|
@@ -353,14 +364,17 @@ interface DepositActions {
|
|
|
353
364
|
/** Banner-driven jump into the error widget. */
|
|
354
365
|
resumeToError(tx?: TxRef): void;
|
|
355
366
|
/**
|
|
356
|
-
* Header-icon entry into the activity surface. Legal from
|
|
357
|
-
*
|
|
358
|
-
*
|
|
367
|
+
* Header-icon entry into the activity surface. Legal only from the pre-quote states
|
|
368
|
+
* (`deposit | assetPicker | amountEntry | transferCrypto`); ignored from `confirmDeposit`
|
|
369
|
+
* onwards and from terminal states. Snapshots the current state into a
|
|
370
|
+
* {@link ActivityBackTarget} so `back()` can restore it lossless. No-ops with a dev-mode
|
|
371
|
+
* warning when no activity driver is mounted (host wired the action without
|
|
372
|
+
* `<KitProvider activity={…}>`).
|
|
359
373
|
*/
|
|
360
|
-
|
|
374
|
+
openActivity(): void;
|
|
361
375
|
/**
|
|
362
376
|
* Open the detail view for a settlement listed on the activity surface. Legal only from
|
|
363
|
-
* `
|
|
377
|
+
* `activityList`; transitions the FSM to `activityDetail`.
|
|
364
378
|
*/
|
|
365
379
|
selectSettlement(settlementId: string): void;
|
|
366
380
|
}
|
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
import { ReactNode } from "react";
|
|
2
2
|
import * as _$react_jsx_runtime0 from "react/jsx-runtime";
|
|
3
3
|
|
|
4
|
-
//#region src/flows/deposit/widgets/activity
|
|
5
|
-
interface
|
|
4
|
+
//#region src/flows/deposit/widgets/activity/DepositActivityDetail.d.ts
|
|
5
|
+
interface DepositActivityDetailOwnProps {
|
|
6
6
|
/**
|
|
7
|
-
* Optional custom composition forwarded to the underlying `<
|
|
7
|
+
* Optional custom composition forwarded to the underlying `<ActivityDetail>`
|
|
8
8
|
* compound. Defaults to mounting all three per-kind parts; each gates internally on the
|
|
9
9
|
* resolved payload's `kind`.
|
|
10
10
|
*/
|
|
11
11
|
children?: ReactNode;
|
|
12
12
|
}
|
|
13
13
|
/**
|
|
14
|
-
* Orchestrated activity
|
|
15
|
-
* `<
|
|
16
|
-
* `Failed`) as namespace members. Renders `null` while the FSM is not on `
|
|
14
|
+
* Orchestrated activity detail wrapper for the deposit dialog. Mounts the cross-flow
|
|
15
|
+
* `<ActivityDetail>` compound and exposes per-kind parts (`Processing`, `Succeeded`,
|
|
16
|
+
* `Failed`) as namespace members. Renders `null` while the FSM is not on `activityDetail`.
|
|
17
17
|
*/
|
|
18
|
-
declare function
|
|
18
|
+
declare function DepositActivityDetail({
|
|
19
19
|
children
|
|
20
|
-
}:
|
|
21
|
-
declare namespace
|
|
22
|
-
type Props =
|
|
20
|
+
}: DepositActivityDetailOwnProps): _$react_jsx_runtime0.JSX.Element | null;
|
|
21
|
+
declare namespace DepositActivityDetail {
|
|
22
|
+
type Props = DepositActivityDetailOwnProps;
|
|
23
23
|
const Processing: ({
|
|
24
24
|
children
|
|
25
25
|
}: {
|
|
@@ -37,4 +37,4 @@ declare namespace DepositHistoryDetail {
|
|
|
37
37
|
}) => _$react_jsx_runtime0.JSX.Element | null;
|
|
38
38
|
}
|
|
39
39
|
//#endregion
|
|
40
|
-
export {
|
|
40
|
+
export { DepositActivityDetail };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import{ActivitySourceProvider as e}from"../../../../shared/widgets/activity/compound/context.js";import{ActivityDetail as t}from"../../../../shared/widgets/activity/compound/ActivityDetail.js";import"../../../../shared/widgets/activity/compound/index.js";import{useDepositActivitySource as n}from"./useDepositActivitySource.js";import{jsx as r}from"react/jsx-runtime";function i({children:i}){let{sourceValue:a,step:o}=n();return o!==`activityDetail`||!a?null:r(e,{value:a,children:r(t,{children:i})})}(function(e){e.Processing=t.Processing,e.Succeeded=t.Succeeded,e.Failed=t.Failed})(i||={});export{i as DepositActivityDetail};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { ActivityHeader, ActivityListHeader } from "../../../../shared/widgets/activity/compound/components/ActivityHeader.js";
|
|
2
|
+
import { ActivityEmpty } from "../../../../shared/widgets/activity/compound/components/Empty.js";
|
|
3
|
+
import { ActivityErrorView } from "../../../../shared/widgets/activity/compound/components/ErrorView.js";
|
|
4
|
+
import { ActivityList } from "../../../../shared/widgets/activity/compound/components/List.js";
|
|
5
|
+
import { ActivityRow } from "../../../../shared/widgets/activity/compound/components/Row.js";
|
|
6
|
+
import { ComponentProps, ReactNode } from "react";
|
|
7
|
+
import * as _$react_jsx_runtime0 from "react/jsx-runtime";
|
|
8
|
+
|
|
9
|
+
//#region src/flows/deposit/widgets/activity/DepositActivityList.d.ts
|
|
10
|
+
interface DepositActivityListOwnProps {
|
|
11
|
+
/**
|
|
12
|
+
* Optional custom composition forwarded to the underlying `<Activity>` compound.
|
|
13
|
+
* Defaults to the compound's `<Header /> + <List />` shape.
|
|
14
|
+
*/
|
|
15
|
+
children?: ReactNode;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Orchestrated activity list wrapper for the deposit dialog. Bridges the deposit
|
|
19
|
+
* flow's snapshot + actions + FSM state into the cross-flow `<Activity>` compound's
|
|
20
|
+
* source value. Renders `null` while the FSM is not on `activityList` — the dialog's step
|
|
21
|
+
* router only matches the active step, but the no-op guard keeps the component safe to mount
|
|
22
|
+
* in custom dialog compositions that skip the step router.
|
|
23
|
+
*/
|
|
24
|
+
declare function DepositActivityList({
|
|
25
|
+
children,
|
|
26
|
+
...props
|
|
27
|
+
}: ComponentProps<"div"> & DepositActivityListOwnProps): _$react_jsx_runtime0.JSX.Element | null;
|
|
28
|
+
declare namespace DepositActivityList {
|
|
29
|
+
type Props = ComponentProps<"div"> & DepositActivityListOwnProps;
|
|
30
|
+
const Header: typeof ActivityHeader;
|
|
31
|
+
const ListHeader: typeof ActivityListHeader;
|
|
32
|
+
const List: typeof ActivityList;
|
|
33
|
+
const Row: typeof ActivityRow;
|
|
34
|
+
const Empty: typeof ActivityEmpty;
|
|
35
|
+
const ErrorView: typeof ActivityErrorView;
|
|
36
|
+
}
|
|
37
|
+
//#endregion
|
|
38
|
+
export { DepositActivityList };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import{ActivitySourceProvider as e}from"../../../../shared/widgets/activity/compound/context.js";import{Activity as t}from"../../../../shared/widgets/activity/compound/Activity.js";import"../../../../shared/widgets/activity/compound/index.js";import{useDepositActivitySource as n}from"./useDepositActivitySource.js";import{jsx as r}from"react/jsx-runtime";function i({children:i,...a}){let{sourceValue:o,step:s}=n();return s!==`activityList`||!o?null:r(e,{value:o,children:r(t,{...a,children:i})})}(function(e){e.Header=t.Header,e.ListHeader=t.ListHeader,e.List=t.List,e.Row=t.Row,e.Empty=t.Empty,e.ErrorView=t.ErrorView})(i||={});export{i as DepositActivityList};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"./DepositActivityDetail.js";import"./DepositActivityList.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import{useOptionalActivityDriverInstance as e,useOptionalActivitySnapshot as t}from"../../../activity/driver/context.js";import{useLingui as n}from"../../../../shared/i18n/useLingui.js";import"../../../../i18n/index.js";import{useDepositSnapshot as r}from"../../driver/context.js";import{useDepositActions as i,useDepositEffectiveState as a}from"../../orchestrator/controller.js";import{defaultBlockExplorers as o}from"../../../../shared/utils/explorers.js";import{useCallback as s,useMemo as c}from"react";function l(){let l=r(),u=i(),d=e(),f=t(),p=a(),{i18n:m}=n(),h=s(e=>{d?.refreshActivity(e)},[d]),g=p.name===`activityList`||p.name===`activityDetail`,_=p.name===`activityDetail`?p.ctx.settlementId:void 0,v=g;return{sourceValue:c(()=>{if(!g||!f)return null;let e=l.wallet,t=f.activity,n=e.status===`ready`||e.status===`stale`?e.payload.address.value:t.status===`ready`||t.status===`stale`?t.response.owner:`0x0000000000000000000000000000000000000000`,r=t.status===`ready`||t.status===`stale`?t.payload.brandName:void 0,i=l.brand,a=i.status===`ready`||i.status===`stale`?i.payload.name:void 0,s=r??a,c={i18n:m,sourceWallet:{name:`Wallet`,address:n},explorers:o(),...s?{brandName:s}:{}};return{entity:f.activity,refresh:h,selectSettlement:u.selectSettlement,...v?{back:u.back}:{},..._===void 0?{}:{settlementId:_},settlementContext:c}},[f,l,u,g,_,m,h,v]),settlementId:_,step:p.name===`activityList`?`activityList`:p.name===`activityDetail`?`activityDetail`:`other`}}export{l as useDepositActivitySource};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{
|
|
1
|
+
"use client";import{useOptionalActivityDriverInstance as e}from"../../../activity/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{useDepositSnapshot as i}from"../../driver/context.js";import{useDepositActions as a,useDepositEffectiveState as ee}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{ActivityTrigger as l}from"../../../../shared/widgets/activity/ActivityTrigger.js";import"../../../../shared/widgets/activity/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 te}from"./footerIntent.js";import{useEffect as p,useRef as m,useState as h}from"react";import{Fragment as g,jsx as _,jsxs as v}from"react/jsx-runtime";const y=[{value:`25`,label:`25%`},{value:`50`,label:`50%`},{value:`75`,label:`75%`},{value:`max`,label:`Max`}];function b({children:n,...c}){let b=i(),C=ee(),{confirmAmount:w,back:T,openActivity:E}=a(),D=e()!==null,{_:O}=r(),k=t(),A=b.target,j=A.status===`ready`||A.status===`stale`?A.payload:void 0,M=C.name===`amountEntry`?C.ctx.asset:void 0,N=M?.amountUsd?.value??0,P=j?.minAmountUsd?.value,F=j?.minAmountUsd?.formatted,I=j?.maxAmountUsd?.value,L=j?.maxAmountUsd?.formatted,R=f(N,I),z=M?.priceUsd,[B,V]=h(P??null),[H,U]=h(),W=s(),G=e=>{W({type:`deposit.amount.changed`,flow:`deposit`,tier:`ui`,payload:{raw:e===null?``:String(e),numeric:e}})},K=m(void 0),q=M?`${M.eip155Id??``}:${M.address??``}`:void 0;p(()=>{q&&K.current!==q&&(K.current=q,typeof P==`number`&&(V(P),U(void 0)))},[q,P]);let J=e=>{U(e);let t=e===`max`?1:Number.parseInt(e,10)/100;if(Number.isFinite(t)){let n=R*t;V(n),G(n),e===`max`&&W({type:`deposit.max.clicked`,flow:`deposit`,tier:`ui`,payload:{}})}},Y=e=>{V(e),U(void 0),G(e)},X=te({amount:B,...P===void 0?{}:{minAmountUsd:P},...I===void 0?{}:{maxAmountUsd:I},walletBalanceUsd:N}),Z=()=>{if(X===`aboveBalance`||X===`aboveCap`){V(R),U(`max`);return}if(X===`belowMin`&&typeof P==`number`){V(P),U(void 0);return}B!==null&&w(z&&z>0?B/z:B)};if(C.name!==`amountEntry`||!M||!j)return null;let Q=C.ctx.backTarget===`closed`?void 0:T,ne=d(M)??{symbol:M.symbol},re=d(j)??{symbol:j.symbol},ie=`${o((B??0)/1,k,{maxDecimals:5})} ${j.symbol}`,$=x(X,{updateOrder:O({id:`bOZXx5`,message:`Update order`}),depositMax:O({id:`9cCjMJ`,message:`Deposit max balance`})}),ae=S(X,L,F);return _(u,{...c,amount:B,sendToken:ne,receiveToken:re,max:R,...P===void 0?{}:{min:P},onAmountChange:Y,...Q?{onBack:Q}:{},subLineAmount:ie,presets:y,...H===void 0?{}:{activePreset:H},onPresetSelect:J,...$===void 0?{}:{footerLabel:$},onContinue:Z,notice:ae,...D?{headerTrailing:_(l,{onOpen:E})}:{},children:n??v(g,{children:[_(u.Header,{}),v(u.Body,{children:[_(u.Hero,{}),_(u.Pills,{}),_(u.Flow,{}),_(u.Notice,{})]}),_(u.Footer,{})]})})}function x(e,t){if(e===`aboveCap`||e===`belowMin`)return t.updateOrder;if(e===`aboveBalance`)return t.depositMax}function S(e,t,r){if(e===`aboveCap`&&t)return _(n,{id:`-I_tc5`,message:`Max {formattedCap}`,values:{formattedCap:t}});if(e===`aboveBalance`)return _(n,{id:`znqB4T`,message:`Insufficient balance`});if(e===`belowMin`&&r)return _(n,{id:`3eKjkO`,message:`{formattedMin} minimum deposit`,values:{formattedMin:r}})}function C({open:e,defaultOpen:t,onOpenChange:n,trigger:r,...i}){return _(c,{open:e,defaultOpen:t,onOpenChange:n,trigger:r,children:_(b,{...i})})}(function(e){e.Dialog=C,e.Header=u.Header,e.Body=u.Body,e.Hero=u.Hero,e.Pills=u.Pills,e.Flow=u.Flow,e.Footer=u.Footer,e.Notice=u.Notice})(b||={});export{b as AmountEntry};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{
|
|
1
|
+
"use client";import{useOptionalActivityDriverInstance as e}from"../../../activity/driver/context.js";import{useDepositSnapshot as t}from"../../driver/context.js";import{useDepositActions as n,useDepositEffectiveState as r}from"../../orchestrator/controller.js";import{DialogShell as i}from"../../../../shared/dialog/DialogShell.js";import{ActivityTrigger as a}from"../../../../shared/widgets/activity/ActivityTrigger.js";import"../../../../shared/widgets/activity/index.js";import{AssetPicker as o}from"../../../../shared/widgets/asset-picker/compound/AssetPicker.js";import"../../../../shared/widgets/asset-picker/compound/index.js";import{useMemo as s,useState as c}from"react";import{Fragment as l,jsx as u,jsxs as d}from"react/jsx-runtime";const f=d(l,{children:[u(o.Header,{}),u(o.Body,{children:u(o.List,{})}),u(o.Footer,{})]});function p({children:i,...l}){let d=t(),p=r(),{confirmAsset:g,back:_,openActivity:v}=n(),y=e()!==null,[b,x]=c(void 0),S=d.balances,C=S.status===`ready`||S.status===`stale`?S.payload:[],w=s(()=>C.map(m),[C]),T=s(()=>(e=>e!==void 0&&w.some(t=>t.id===e&&!t.disabled))(b)?b:w.find(e=>!e.disabled)?.id,[b,w]),E=d.target,D=E.status===`ready`||E.status===`stale`?E.payload:void 0;if(p.name!==`assetPicker`)return null;let O=p.ctx.backTarget===`closed`?void 0:_,k=()=>{if(!T)return;let e=C.find(e=>h(e)===T);e&&g(e)};return u(o,{...l,...D?{token:{symbol:D.symbol}}:{},...T?{selectedId:T}:{},onSelect:x,assets:w,...O?{onBack:O}:{},onContinue:k,...y?{headerTrailing:u(a,{onOpen:v})}:{},children:i??f})}function m(e){let t=h(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 h(e){return e.eip155Id?`${e.eip155Id}:${e.address||`native`}`:e.symbol.toLowerCase()}function g({open:e,defaultOpen:t,onOpenChange:n,trigger:r,...a}){return u(i,{open:e,defaultOpen:t,onOpenChange:n,trigger:r,children:u(p,{...a})})}(function(e){e.Dialog=g,e.Header=o.Header,e.Body=o.Body,e.List=o.List,e.Footer=o.Footer})(p||={});export{p as AssetPicker};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{
|
|
1
|
+
"use client";import{useKitI18n as e}from"../../../../shared/i18n/useKitI18n.js";import{useLingui as t}from"../../../../shared/i18n/useLingui.js";import"../../../../i18n/index.js";import{useDepositSnapshot as n}from"../../driver/context.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=n(),m=i(),g=a(),{confirmDeposit:y,back:x}=r(),{_:S}=t(),C=e(),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 +1 @@
|
|
|
1
|
-
"use client";import{
|
|
1
|
+
"use client";import{useLingui as e}from"../../../../shared/i18n/useLingui.js";import"../../../../i18n/index.js";import{useDepositSnapshot as t}from"../../driver/context.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=t(),p=r().name,{selectMethod:h}=n(),v=i(),{_:b}=e(),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};
|