@stridge/kit 0.1.0-alpha.51 → 0.1.0-alpha.53
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 +9 -2
- package/dist/index.js +1 -1
- package/dist/package.js +1 -1
- package/dist/scope/KitScope.d.ts +9 -0
- package/dist/scope/KitScope.js +1 -1
- package/dist/scope/context.d.ts +7 -0
- 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/presentation/index.js +1 -0
- package/dist/shared/presentation/types.d.ts +30 -0
- package/dist/shared/presentation/types.js +1 -0
- package/dist/shared/presentation/useResolvedSurfaceKind.js +1 -0
- package/dist/shared/ui/AdaptiveSurface/AdaptiveSurface.d.ts +52 -0
- package/dist/shared/ui/AdaptiveSurface/AdaptiveSurface.js +1 -0
- package/dist/shared/ui/AdaptiveSurface/index.d.ts +2 -0
- package/dist/shared/ui/AdaptiveSurface/index.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/Dialog/Dialog.d.ts +10 -8
- package/dist/shared/ui/Dialog/Dialog.js +1 -1
- package/dist/shared/ui/Drawer/Drawer.d.ts +135 -0
- package/dist/shared/ui/Drawer/Drawer.js +1 -0
- package/dist/shared/ui/Drawer/Drawer.slots.d.ts +19 -0
- package/dist/shared/ui/Drawer/Drawer.slots.js +1 -0
- package/dist/shared/ui/Drawer/Drawer.styles.js +1 -0
- package/dist/shared/ui/Drawer/index.d.ts +2 -0
- package/dist/shared/ui/Drawer/index.js +1 -0
- package/dist/shared/ui/SelectableTile/SelectableTile.d.ts +1 -1
- package/dist/shared/ui/surfaceContext.d.ts +9 -0
- package/dist/shared/ui/surfaceContext.js +1 -0
- 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 +89 -0
- package/dist/types.d.ts +2 -1
- package/dist/ui/index.d.ts +5 -1
- package/dist/ui/index.js +1 -1
- 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
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import * as _$react_jsx_runtime0 from "react/jsx-runtime";
|
|
2
2
|
|
|
3
|
-
//#region src/shared/widgets/activity
|
|
3
|
+
//#region src/shared/widgets/activity/compound/components/ActivityHeader.d.ts
|
|
4
4
|
interface Props {
|
|
5
5
|
/**
|
|
6
6
|
* Optional override for the title. Defaults to `t\`Activity\`` for the list view; detail
|
|
7
|
-
* views pass
|
|
7
|
+
* views pass a per-state title (e.g. `t\`Deposit in progress\``, `t\`Withdrawal failed\``).
|
|
8
8
|
*/
|
|
9
9
|
title?: string;
|
|
10
10
|
/**
|
|
@@ -22,18 +22,18 @@ interface Props {
|
|
|
22
22
|
*
|
|
23
23
|
* Mounted by both the List view and the Detail view's per-payload compound — the chevron
|
|
24
24
|
* routes `actions.back()` through the source context, which the FSM disambiguates via the
|
|
25
|
-
* active state name (`
|
|
25
|
+
* active state name (`activityDetail → activityList → source`).
|
|
26
26
|
*/
|
|
27
|
-
declare function
|
|
27
|
+
declare function ActivityListHeader({
|
|
28
28
|
title,
|
|
29
29
|
onBack
|
|
30
30
|
}: Props): _$react_jsx_runtime0.JSX.Element;
|
|
31
31
|
/**
|
|
32
|
-
* Public `<
|
|
32
|
+
* Public `<Activity.Header>` part — thin wrapper around {@link ActivityListHeader}
|
|
33
33
|
* that reads `back` from the source context so hosts get a zero-prop part to drop into list
|
|
34
|
-
* compositions. The peer detail compound mounts `<
|
|
34
|
+
* compositions. The peer detail compound mounts `<Activity.ListHeader>` itself with an
|
|
35
35
|
* explicit title and back handler.
|
|
36
36
|
*/
|
|
37
|
-
declare function
|
|
37
|
+
declare function ActivityHeader(): _$react_jsx_runtime0.JSX.Element;
|
|
38
38
|
//#endregion
|
|
39
|
-
export {
|
|
39
|
+
export { ActivityHeader, ActivityListHeader };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import{useLingui as e}from"../../../../i18n/useLingui.js";import"../../../../../i18n/index.js";import{ChevronLeftIcon as t}from"../../../../icons/ChevronLeftIcon.js";import"../../../../../icons/index.js";import{IconButton as n}from"../../../../ui/IconButton/IconButton.js";import"../../../../ui/IconButton/index.js";import{Dialog as r}from"../../../../ui/Dialog/Dialog.js";import"../../../../ui/Dialog/index.js";import{Card as i}from"../../../../ui/Card/Card.js";import"../../../../ui/Card/index.js";import{text as a}from"../../../../ui/Text/Text.js";import"../../../../ui/Text/index.js";import{ACTIVITY_SLOTS as o}from"../Activity.slots.js";import{styles as s}from"../Activity.styles.js";import{useActivitySource as c}from"../context.js";import{jsx as l,jsxs as u}from"react/jsx-runtime";import*as d from"@stylexjs/stylex";function f({title:c,onBack:f}){let{_:p}=e(),m=c??p({id:`XJOV1Y`,message:`Activity`});return u(i.Header,{"data-stridge-slot":o.header,...d.props(s.header),children:[u(`div`,{...d.props(s.headerLeft),children:[typeof f==`function`?l(n,{"aria-label":p({id:`iH8pgl`,message:`Back`}),onClick:f,children:l(t,{"aria-hidden":!0,...d.props(s.backIcon)})}):null,l(a.span,{size:`base`,fontWeight:`semibold`,leading:`tight`,tracking:`tight`,style:{margin:0},children:m})]}),l(`div`,{...d.props(s.headerRight),children:l(r.CloseButton,{})})]})}function p(){return l(f,{onBack:c(`Activity.Header`).back})}export{p as ActivityHeader,f as ActivityListHeader};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as _$react_jsx_runtime0 from "react/jsx-runtime";
|
|
2
2
|
|
|
3
|
-
//#region src/shared/widgets/activity
|
|
3
|
+
//#region src/shared/widgets/activity/compound/components/Empty.d.ts
|
|
4
4
|
/**
|
|
5
5
|
* Empty-state body for the activity surface. Reached when the gateway's poll returned an
|
|
6
6
|
* empty UDA list for the connected owner — typically a brand-new wallet that hasn't deposited
|
|
@@ -10,6 +10,6 @@ import * as _$react_jsx_runtime0 from "react/jsx-runtime";
|
|
|
10
10
|
*
|
|
11
11
|
* @internal
|
|
12
12
|
*/
|
|
13
|
-
declare function
|
|
13
|
+
declare function ActivityEmpty(): _$react_jsx_runtime0.JSX.Element;
|
|
14
14
|
//#endregion
|
|
15
|
-
export {
|
|
15
|
+
export { ActivityEmpty };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import{useLingui as e}from"../../../../i18n/useLingui.js";import"../../../../../i18n/index.js";import{ClockIcon as t}from"../../../../icons/ClockIcon.js";import"../../../../../icons/index.js";import{text as n}from"../../../../ui/Text/Text.js";import"../../../../ui/Text/index.js";import{ACTIVITY_SLOTS as r}from"../Activity.slots.js";import{styles as i}from"../Activity.styles.js";import{jsx as a,jsxs as o}from"react/jsx-runtime";import*as s from"@stylexjs/stylex";function c(){let{_:c}=e();return o(`div`,{"data-stridge-slot":r.empty,...s.props(i.empty),children:[a(t,{"aria-hidden":!0,"data-stridge-slot":r.emptyIcon,...s.props(i.emptyIcon)}),a(n.span,{size:`base`,fontWeight:`semibold`,color:`default`,children:c({id:`aXFOuf`,message:`No activity yet`})}),a(n.span,{size:`sm`,fontWeight:`medium`,color:`subdued`,children:c({id:`Xzw7uC`,message:`Your deposits and withdrawals will appear here.`})})]})}export{c as ActivityEmpty};
|
package/dist/shared/widgets/{activity-history → activity}/compound/components/ErrorView.d.ts
RENAMED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as _$react_jsx_runtime0 from "react/jsx-runtime";
|
|
2
2
|
|
|
3
|
-
//#region src/shared/widgets/activity
|
|
4
|
-
interface
|
|
3
|
+
//#region src/shared/widgets/activity/compound/components/ErrorView.d.ts
|
|
4
|
+
interface ActivityErrorViewProps {
|
|
5
5
|
/**
|
|
6
6
|
* Retry handler. Wired by the List to fire a fresh `refresh(signal)` against the source
|
|
7
7
|
* context — the entity transitions back through `loading → ready | error`.
|
|
@@ -12,15 +12,15 @@ interface ActivityHistoryErrorViewProps {
|
|
|
12
12
|
* Initial-error body for the activity surface. Rendered only when the first fetch failed
|
|
13
13
|
* AND the entity has no prior payload to fall back to (status `error` from `idle | loading`).
|
|
14
14
|
* Refresh failures while a payload is already cached are silent — the entity stays `stale`
|
|
15
|
-
* and the next controller-driven `
|
|
15
|
+
* and the next controller-driven `watchActivity` tick retries; that branch never reaches this
|
|
16
16
|
* component.
|
|
17
17
|
*
|
|
18
18
|
* @internal
|
|
19
|
-
* @see {@link
|
|
19
|
+
* @see {@link ActivityList} for the entity-status branching that decides when this
|
|
20
20
|
* renders vs the silent stale-while-revalidate path.
|
|
21
21
|
*/
|
|
22
|
-
declare function
|
|
22
|
+
declare function ActivityErrorView({
|
|
23
23
|
onRetry
|
|
24
|
-
}:
|
|
24
|
+
}: ActivityErrorViewProps): _$react_jsx_runtime0.JSX.Element;
|
|
25
25
|
//#endregion
|
|
26
|
-
export {
|
|
26
|
+
export { ActivityErrorView };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import{useLingui as e}from"../../../../i18n/useLingui.js";import"../../../../../i18n/index.js";import{AlertIcon as t}from"../../../../icons/AlertIcon.js";import"../../../../../icons/index.js";import{Button as n}from"../../../../ui/Button/Button.js";import"../../../../ui/Button/index.js";import{Alert as r}from"../../../../ui/Alert/Alert.js";import"../../../../ui/Alert/index.js";import{ACTIVITY_SLOTS as i}from"../Activity.slots.js";import{styles as a}from"../Activity.styles.js";import{jsx as o,jsxs as s}from"react/jsx-runtime";import*as c from"@stylexjs/stylex";function l({onRetry:l}){let{_:u}=e();return s(`div`,{"data-stridge-slot":i.error,...c.props(a.error),children:[o(r,{variant:`danger`,icon:o(t,{}),children:u({id:`B-4zEC`,message:`Couldn't load activity. Please try again.`})}),o(`div`,{...c.props(a.retryRow),children:o(n,{type:`button`,variant:`secondary`,size:`sm`,onClick:l,"data-stridge-slot":i.retry,children:u({id:`KDw4GX`,message:`Try again`})})})]})}export{l as ActivityErrorView};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import * as _$react_jsx_runtime0 from "react/jsx-runtime";
|
|
2
|
+
|
|
3
|
+
//#region src/shared/widgets/activity/compound/components/List.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* List body for the activity surface. Reads the `activity` entity from
|
|
6
|
+
* {@link useActivitySource} and branches on status:
|
|
7
|
+
*
|
|
8
|
+
* - `idle | loading` (cold path, no prior payload) → skeleton × 4.
|
|
9
|
+
* - `ready | stale` → rows. `stale` keeps the prior list rendered while a refresh is in
|
|
10
|
+
* flight so the user never sees an empty pause. The refresh is silent — no spinner.
|
|
11
|
+
* - `error` (cold path) → {@link ActivityErrorView} with a retry button.
|
|
12
|
+
* - `ready` with zero rows → {@link ActivityEmpty}.
|
|
13
|
+
*
|
|
14
|
+
* Recurring updates land via the controller-mounted `watchActivity` watcher (mounted on entry
|
|
15
|
+
* to `activityList` / `activityDetail`, with adaptive cadence — short while any row is
|
|
16
|
+
* `pending`, long once all rows are terminal). The widget itself is a pure reader; the only
|
|
17
|
+
* imperative surface left here is the retry button, which fires `source.refresh(signal)` once.
|
|
18
|
+
*
|
|
19
|
+
* @internal
|
|
20
|
+
*/
|
|
21
|
+
declare function ActivityList(): _$react_jsx_runtime0.JSX.Element;
|
|
22
|
+
//#endregion
|
|
23
|
+
export { ActivityList };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import{Card as e}from"../../../../ui/Card/Card.js";import"../../../../ui/Card/index.js";import{Skeleton as t}from"../../../../ui/Skeleton/Skeleton.js";import"../../../../ui/Skeleton/index.js";import{ACTIVITY_SLOTS as n}from"../Activity.slots.js";import{styles as r}from"../Activity.styles.js";import{useActivitySource as i}from"../context.js";import{ActivityEmpty as a}from"./Empty.js";import{ActivityErrorView as o}from"./ErrorView.js";import{ActivityRow as s}from"./Row.js";import{useRef as c}from"react";import{jsx as l,jsxs as u}from"react/jsx-runtime";import*as d from"@stylexjs/stylex";const f=[`skeleton-1`,`skeleton-2`,`skeleton-3`,`skeleton-4`];function p(){let t=i(`Activity.List`),u=c(null),f=c(t.refresh);f.current=t.refresh;let p=t.entity;if(p.status===`error`)return l(e.Body,{"data-stridge-slot":n.body,...d.props(r.body),children:l(o,{onRetry:()=>{u.current?.abort();let e=new AbortController;u.current=e,f.current(e.signal)}})});if(p.status===`idle`||p.status===`loading`)return l(e.Body,{"data-stridge-slot":n.body,...d.props(r.body),"aria-busy":`true`,"aria-live":`polite`,children:l(g,{})});let _=p.payload.rows;return _.length===0?l(e.Body,{"data-stridge-slot":n.body,...d.props(r.body),children:l(a,{})}):l(e.Body,{"data-stridge-slot":n.body,...d.props(r.body,r.bodyCap,r.bodyEnter),children:l(`ul`,{"data-stridge-slot":n.list,style:m,children:_.map(e=>l(`li`,{style:h,children:l(s,{payload:e,onSelect:t.selectSettlement})},`${e.udaId}:${e.id}`))})})}const m={display:`flex`,flexDirection:`column`,gap:`var(--stridge-kit-space-2)`,listStyle:`none`,marginBlock:0,marginInline:0,paddingBlock:0,paddingInline:0},h={listStyle:`none`};function g(){return l(`div`,{"data-stridge-slot":n.skeleton,children:f.map(e=>u(`div`,{"data-stridge-slot":n.skeletonRow,...d.props(r.skeletonRow),children:[l(t,{width:44,height:44,radius:999}),u(`div`,{...d.props(r.skeletonText),children:[l(t,{width:`60%`,height:14}),l(t,{width:`40%`,height:12})]}),l(t,{width:56,height:14})]},e))})}export{p as ActivityList};
|
|
@@ -1,32 +1,29 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ActivityRowPayload } from "../../payloads.js";
|
|
2
2
|
import * as _$react_jsx_runtime0 from "react/jsx-runtime";
|
|
3
3
|
|
|
4
|
-
//#region src/shared/widgets/activity
|
|
4
|
+
//#region src/shared/widgets/activity/compound/components/Row.d.ts
|
|
5
5
|
/**
|
|
6
|
-
* Props the row needs to render
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* context so the FSM can transition into the detail view.
|
|
6
|
+
* Props the row needs to render. The payload carries *raw* numeric / identity slots — the row
|
|
7
|
+
* formats every visible string itself via `useLingui()` so locale flips take effect on the
|
|
8
|
+
* same React commit (mirrors deposit's `AmountEntry.tsx` / `ConfirmDeposit.tsx` pattern).
|
|
10
9
|
*/
|
|
11
10
|
interface Props {
|
|
12
11
|
/**
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
* the leading {@link TokenLogo} resolves against.
|
|
12
|
+
* Raw row payload from the driver's transformer. Carries amount value + kind, asset
|
|
13
|
+
* identity, and updated-at timestamp; the row component formats them inline per render.
|
|
16
14
|
*/
|
|
17
|
-
payload:
|
|
15
|
+
payload: ActivityRowPayload;
|
|
18
16
|
/**
|
|
19
17
|
* Row click handler. Receives the settlement id from the payload; the parent compound
|
|
20
|
-
* forwards it to {@link import("../context").
|
|
18
|
+
* forwards it to {@link import("../context").ActivitySourceValue.selectSettlement}.
|
|
21
19
|
*/
|
|
22
20
|
onSelect: (settlementId: string) => void;
|
|
23
21
|
}
|
|
24
22
|
/**
|
|
25
23
|
* Public alias for {@link Props}. Preserved as the externally visible name so the
|
|
26
|
-
* compound's `index.ts` and the API-extractor snapshot keep referencing
|
|
27
|
-
* `ActivityHistoryRowProps`.
|
|
24
|
+
* compound's `index.ts` and the API-extractor snapshot keep referencing `ActivityRowProps`.
|
|
28
25
|
*/
|
|
29
|
-
type
|
|
26
|
+
type ActivityRowProps = Props;
|
|
30
27
|
/**
|
|
31
28
|
* One row of the activity surface — leading asset glyph (with corner status pip), title +
|
|
32
29
|
* date stack, trailing amount + chevron. Composes
|
|
@@ -46,9 +43,9 @@ type ActivityHistoryRowProps = Props;
|
|
|
46
43
|
* {@link TokenLogo}'s built-in chain badge is therefore disabled via `hideChainBadge` and
|
|
47
44
|
* the {@link StatusPip} renders inside the row's leading slot instead.
|
|
48
45
|
*/
|
|
49
|
-
declare function
|
|
46
|
+
declare function ActivityRow({
|
|
50
47
|
payload,
|
|
51
48
|
onSelect
|
|
52
49
|
}: Props): _$react_jsx_runtime0.JSX.Element;
|
|
53
50
|
//#endregion
|
|
54
|
-
export {
|
|
51
|
+
export { ActivityRow, ActivityRowProps };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import{useLingui as e}from"../../../../i18n/useLingui.js";import"../../../../../i18n/index.js";import{formatSmartRelative as t}from"../../../../format/formatSmartRelative.js";import{formatTokenAmount as n}from"../../../../format/formatTokenAmount.js";import{formatUsd as r}from"../../../../format/formatUsd.js";import{ChevronRightIcon as i}from"../../../../icons/ChevronRightIcon.js";import"../../../../../icons/index.js";import{SelectableTile as a}from"../../../../ui/SelectableTile/SelectableTile.js";import"../../../../ui/SelectableTile/index.js";import{text as o}from"../../../../ui/Text/Text.js";import"../../../../ui/Text/index.js";import{TokenLogo as s}from"../../../../ui/TokenLogo/TokenLogo.js";import"../../../../ui/TokenLogo/index.js";import{ACTIVITY_ROW_SLOTS as c}from"../Row.slots.js";import{styles as l}from"../Row.styles.js";import{StatusPip as u}from"./StatusPip.js";import{jsx as d,jsxs as f}from"react/jsx-runtime";import*as p from"@stylexjs/stylex";function m({payload:m,onSelect:g}){let{_,i18n:v}=e(),y={depositCompleted:_({id:`3kg1gB`,message:`Deposit completed`}),depositFailed:_({id:`i-4Fbp`,message:`Deposit failed`}),depositInProgress:_({id:`Cs44l6`,message:`Deposit in progress`}),withdrawalCompleted:_({id:`jKZO-R`,message:`Withdrawal completed`}),withdrawalFailed:_({id:`KTNWsg`,message:`Withdrawal failed`}),withdrawalInProgress:_({id:`6yS5kL`,message:`Withdrawal in progress`})},b=h(m.direction,m.status.kind,y),x=m.amount.kind===`usd`?r(m.amount.value,v):`${n(m.amount.value,v,{maxDecimals:m.assetDecimals})} ${m.assetSymbol}`,S=t(m.updatedAtMs,Date.now(),v),C=m.direction===`deposit`?_({id:`hBIHD-`,message:`Deposit of {amount}, {date}`,values:{amount:x,date:S}}):_({id:`Rm325-`,message:`Withdrawal of {amount}, {date}`,values:{amount:x,date:S}});return f(a,{shape:`card`,interactive:`navigation`,"data-stridge-slot":c.root,"aria-label":C,onClick:()=>g(m.id),...p.props(l.rowLayout),children:[f(`span`,{"data-stridge-slot":c.leading,...p.props(l.leading),children:[d(s,{symbol:m.assetSymbol,...m.chainId===void 0?{}:{chainId:m.chainId},...m.assetLogoUrl===void 0?{}:{logoUrl:m.assetLogoUrl},...m.chainLogoUrl===void 0?{}:{chainLogoUrl:m.chainLogoUrl},size:44,hideChainBadge:!0}),d(u,{kind:m.status.kind})]}),f(`span`,{"data-stridge-slot":c.text,...p.props(l.text),children:[d(o.span,{size:`sm`,fontWeight:`semibold`,leading:`tight`,color:`default`,"data-stridge-slot":c.title,...p.props(l.title),children:b}),d(o.span,{size:`xs`,fontWeight:`medium`,leading:`tight`,color:`subdued`,"data-stridge-slot":c.date,...p.props(l.date),children:S})]}),f(`span`,{"data-stridge-slot":c.trailing,...p.props(l.trailing),children:[d(o.span,{size:`sm`,fontWeight:`semibold`,leading:`tight`,color:`default`,"data-stridge-slot":c.amount,children:x}),d(i,{"aria-hidden":!0,"data-stridge-slot":c.chevron,...p.props(l.chevron)})]})]})}function h(e,t,n){return e===`deposit`?t===`completed`?n.depositCompleted:t===`failed`?n.depositFailed:n.depositInProgress:t===`completed`?n.withdrawalCompleted:t===`failed`?n.withdrawalFailed:n.withdrawalInProgress}export{m as ActivityRow};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import{CheckIcon as e}from"../../../../icons/CheckIcon.js";import{LoaderIcon as t}from"../../../../icons/LoaderIcon.js";import{XIcon as n}from"../../../../icons/XIcon.js";import"../../../../../icons/index.js";import{ACTIVITY_ROW_SLOTS as r}from"../Row.slots.js";import{styles as i}from"../Row.styles.js";import{jsx as a}from"react/jsx-runtime";import*as o from"@stylexjs/stylex";function s({kind:s}){let c=s===`completed`?i.statusPipCompleted:s===`failed`?i.statusPipFailed:i.statusPipPending;return a(`span`,{"data-stridge-slot":r.statusPip,...o.props(i.statusPip,c),children:s===`completed`?a(e,{"aria-hidden":!0,...o.props(i.statusPipIcon)}):s===`failed`?a(n,{"aria-hidden":!0,...o.props(i.statusPipIcon)}):a(t,{"aria-hidden":!0,...o.props(i.statusPipSpinner)})})}export{s as StatusPip};
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { Entity } from "../../../driver/types.js";
|
|
2
|
+
import { ActivityPayload } from "../payloads.js";
|
|
3
|
+
import { SettlementPayloadContext } from "../../../../flows/deposit/driver/transformers/settlementToPayload.js";
|
|
4
|
+
import * as _$react from "react";
|
|
5
|
+
import { GatewayPollResponse, GatewayUdaDto } from "@stridge/sdk";
|
|
6
|
+
|
|
7
|
+
//#region src/shared/widgets/activity/compound/context.d.ts
|
|
8
|
+
/**
|
|
9
|
+
* Source of truth handed to `<Activity>` and `<ActivityDetail>` from whichever
|
|
10
|
+
* dialog (deposit / withdraw) mounts them. Each dialog assembles this value once from its own
|
|
11
|
+
* snapshot + actions and wraps the activity step body in
|
|
12
|
+
* `<ActivitySourceProvider value={…}>`. The compound stays flow-agnostic — it reads
|
|
13
|
+
* the entity and the imperative actions from this single value.
|
|
14
|
+
*
|
|
15
|
+
* View routing is external: the FSM now exposes `activityList` and `activityDetail` as separate
|
|
16
|
+
* state names; the dialog's step router mounts {@link Activity} for the list step and
|
|
17
|
+
* {@link ActivityDetail} for the detail step. Each orchestrated wrapper supplies the
|
|
18
|
+
* source value with the slots its step needs (the list wrapper omits `settlementId`; the
|
|
19
|
+
* detail wrapper sets it).
|
|
20
|
+
*
|
|
21
|
+
* @see {@link ActivitySourceProvider}
|
|
22
|
+
* @see {@link useActivitySource}
|
|
23
|
+
*/
|
|
24
|
+
interface ActivitySourceValue {
|
|
25
|
+
/**
|
|
26
|
+
* The driver's `activity` entity. Same shape on both flows (`DepositSnapshot["activity"]`
|
|
27
|
+
* and `WithdrawSnapshot["activity"]` are structurally identical — both back onto the
|
|
28
|
+
* multi-UDA envelope from `GET /gateway/{owner}`). Status discriminator drives the
|
|
29
|
+
* compound's branch (idle / loading → skeleton; ready / stale → rows; error → retry).
|
|
30
|
+
*/
|
|
31
|
+
entity: Entity<ActivityPayload, ReadonlyArray<GatewayUdaDto>, GatewayPollResponse>;
|
|
32
|
+
/**
|
|
33
|
+
* Trigger a fresh one-shot fetch. Wired by each dialog to `driver.refreshActivity(signal)`.
|
|
34
|
+
* The compound calls this from the error-view retry button; each call passes an
|
|
35
|
+
* `AbortSignal` the compound owns so it can cancel mid-fetch on rapid re-clicks. Recurring
|
|
36
|
+
* updates while the list is visible land separately via the controller-mounted
|
|
37
|
+
* `watchActivity` watcher — this callback is not the steady-state polling surface.
|
|
38
|
+
*/
|
|
39
|
+
refresh: (signal: AbortSignal) => void;
|
|
40
|
+
/**
|
|
41
|
+
* Dispatch a row selection. Wired to `actions.selectSettlement(id)` — the FSM transitions
|
|
42
|
+
* from `activityList` to `activityDetail` carrying the selected `settlementId`.
|
|
43
|
+
*/
|
|
44
|
+
selectSettlement: (settlementId: string) => void;
|
|
45
|
+
/**
|
|
46
|
+
* Back chevron handler. Wired to `actions.back()` — the FSM disambiguates via the current
|
|
47
|
+
* state name (`activityDetail → activityList → source`). The compound renders the chevron in
|
|
48
|
+
* both the list step's header AND inside the detail step's header composition.
|
|
49
|
+
*
|
|
50
|
+
* Optional. The per-flow source-bridge hook omits `back` when the active state's
|
|
51
|
+
* `backTarget.kind === "closed"` (imperative direct-entry — no source step to restore), so
|
|
52
|
+
* the header renders without a chevron. The user dismisses via the dialog's `X`.
|
|
53
|
+
*/
|
|
54
|
+
back?: () => void;
|
|
55
|
+
/**
|
|
56
|
+
* Recovery fallback the detail compound invokes when the selected settlement has aged off
|
|
57
|
+
* the envelope (rare race — host calls `useActivity().open({ settlementId })`, then the
|
|
58
|
+
* background watcher tick lands a fresh response without that row). The compound prefers
|
|
59
|
+
* {@link back} when present; this slot only fires on direct-entry detail where `back` is
|
|
60
|
+
* undefined and the user would otherwise stare at an empty body until they hit `X`.
|
|
61
|
+
*
|
|
62
|
+
* Optional. The deposit / withdraw bridges always supply `back`, so they leave this unset.
|
|
63
|
+
* The standalone activity bridge wires it to a "re-open list" dispatch — `useActivity().open()`
|
|
64
|
+
* with no args — which the standalone reducer re-targets to `activityList` from `activityDetail`.
|
|
65
|
+
*/
|
|
66
|
+
onLookupMiss?: () => void;
|
|
67
|
+
/**
|
|
68
|
+
* Selected settlement id when the dialog is mounting the detail step. Carried so the
|
|
69
|
+
* `<ActivityDetail>` compound can look up the matching `GatewaySettlementDto`
|
|
70
|
+
* inside `entity.raw[].settlements[]` and feed it to {@link
|
|
71
|
+
* import("../adapters").settlementToWidgetProps}. Absent when the list wrapper supplies
|
|
72
|
+
* the source value.
|
|
73
|
+
*/
|
|
74
|
+
settlementId?: string;
|
|
75
|
+
/**
|
|
76
|
+
* Context the detail compound's adapter passes to {@link
|
|
77
|
+
* import("#/flows/deposit/driver/transformers").settlementToPayload}. Each dialog
|
|
78
|
+
* assembles this from its own driver snapshot — deposit reads `wallet`, `brand`, the
|
|
79
|
+
* driver's explorers map; withdraw reads its equivalents. Carrying the resolved context
|
|
80
|
+
* here keeps the compound flow-agnostic.
|
|
81
|
+
*/
|
|
82
|
+
settlementContext: SettlementPayloadContext;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Provider for {@link ActivitySourceValue}. Each dialog mounts one above its
|
|
86
|
+
* activity step body — see `DepositDialog` / `WithdrawDialog`.
|
|
87
|
+
*/
|
|
88
|
+
declare const ActivitySourceProvider: _$react.Provider<ActivitySourceValue | null>;
|
|
89
|
+
/**
|
|
90
|
+
* Read the active {@link ActivitySourceValue}. Throws when called outside an
|
|
91
|
+
* `<ActivitySourceProvider>`.
|
|
92
|
+
*/
|
|
93
|
+
declare function useActivitySource(consumer: string): ActivitySourceValue;
|
|
94
|
+
//#endregion
|
|
95
|
+
export { ActivitySourceProvider, ActivitySourceValue, useActivitySource };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import{createContext as e,use as t}from"react";const n=e(null);n.displayName=`ActivitySourceContext`;const r=n.Provider;function i(e){let r=t(n);if(!r)throw Error(`${e} must be rendered inside <ActivitySourceProvider>. Mount the provider above <Activity> with the value derived from the flow's snapshot + actions — see DepositDialog / WithdrawDialog for the canonical wiring.`);return r}export{r as ActivitySourceProvider,i as useActivitySource};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ActivityAmount, ActivityPayload, ActivityRowPayload } from "../payloads.js";
|
|
2
|
+
import { ActivityHeader, ActivityListHeader } from "./components/ActivityHeader.js";
|
|
3
|
+
import { ActivityRowProps } from "./components/Row.js";
|
|
4
|
+
import { Activity } from "./Activity.js";
|
|
5
|
+
import { ACTIVITY_SLOTS, ActivitySlot } from "./Activity.slots.js";
|
|
6
|
+
import { ActivityDetail } from "./ActivityDetail.js";
|
|
7
|
+
import { ActivitySourceProvider, ActivitySourceValue, useActivitySource } from "./context.js";
|
|
8
|
+
import { ACTIVITY_ROW_SLOTS, ActivityRowSlot } from "./Row.slots.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"./Activity.slots.js";import"./context.js";import"./components/ActivityHeader.js";import"./Row.slots.js";import"./Activity.js";import"./ActivityDetail.js";
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
//#region src/shared/widgets/activity/payloads.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Which flow produced the settlement — `"deposit"` for UDAs whose destination is the connected
|
|
4
|
+
* wallet, `"withdraw"` for UDAs whose source is the brand-currency balance the user is cashing
|
|
5
|
+
* out from. Discriminated by `uda.metadata.kit_flow` when present, with an address-comparison
|
|
6
|
+
* fallback for legacy UDAs that pre-date the metadata convention.
|
|
7
|
+
*/
|
|
8
|
+
type ActivityDirection = "deposit" | "withdraw";
|
|
9
|
+
/**
|
|
10
|
+
* Lifecycle bucket for a single settlement row. Maps onto the kit's existing settlement-status
|
|
11
|
+
* model (`pending → succeeded → failed`) but flattens it to the 3-value set the row renders
|
|
12
|
+
* against — the inline status indicator picks an icon from this discriminator alone.
|
|
13
|
+
*/
|
|
14
|
+
type ActivityStatusType = "pending" | "completed" | "failed";
|
|
15
|
+
/**
|
|
16
|
+
* Wrapper carrying the lifecycle bucket plus room for future status-scoped metadata (e.g. a
|
|
17
|
+
* settlement-level `failureKind` tag the row could surface). Kept separate from
|
|
18
|
+
* {@link ActivityStatusType} so the discriminator string stays stable as the shape grows.
|
|
19
|
+
*/
|
|
20
|
+
interface ActivityStatus {
|
|
21
|
+
kind: ActivityStatusType;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Discriminated row amount. Carries the raw numeric value plus the formatter the component
|
|
25
|
+
* layer should run against it:
|
|
26
|
+
*
|
|
27
|
+
* - `usd` — render via `formatUsd(value, i18n)`.
|
|
28
|
+
* - `token` — render via `formatTokenAmount(value, i18n, { maxDecimals: assetDecimals })` and
|
|
29
|
+
* append the row's `assetSymbol`.
|
|
30
|
+
*
|
|
31
|
+
* Kept raw (not pre-formatted) so the row component re-formats on every render, matching the
|
|
32
|
+
* `t\`…\`` translation cadence used by deposit / withdraw chrome — locale flips and time-based
|
|
33
|
+
* formatters (e.g. `Intl.RelativeTimeFormat`) take effect on the same React commit instead of
|
|
34
|
+
* waiting for the next driver poll.
|
|
35
|
+
*/
|
|
36
|
+
type ActivityAmount = {
|
|
37
|
+
value: number;
|
|
38
|
+
kind: "usd";
|
|
39
|
+
} | {
|
|
40
|
+
value: number;
|
|
41
|
+
kind: "token";
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
* One settlement row in the activity list. Pre-shaped — but never pre-formatted — by
|
|
45
|
+
* the driver's transformer. The row component owns string formatting; it calls Lingui's
|
|
46
|
+
* `useLingui()` for the active locale and threads the result through `formatUsd` /
|
|
47
|
+
* `formatTokenAmount` / `formatSmartRelative` / `t\`…\`` per-render. That mirrors the
|
|
48
|
+
* deposit/withdraw widget pattern (see `AmountEntry.tsx`, `ConfirmDeposit.tsx`) and avoids the
|
|
49
|
+
* "row strings stuck in old locale until next fetch" lag that pre-formatted payloads exhibit.
|
|
50
|
+
*
|
|
51
|
+
* Detail-view rendering happens off the entity's `raw: ReadonlyArray<GatewayUdaDto>` slot: the
|
|
52
|
+
* row carries `udaId` + `id` so the detail component can locate the matching
|
|
53
|
+
* `GatewaySettlementDto` and feed it back through {@link
|
|
54
|
+
* import("#/flows/deposit/driver/transformers").settlementToPayload} to produce a full
|
|
55
|
+
* `SuccessStateProps` / `ErrorStateProps` / pending payload at display time.
|
|
56
|
+
*/
|
|
57
|
+
interface ActivityRowPayload {
|
|
58
|
+
/** Settlement id — unique within the multi-UDA envelope. The detail lookup keys on this. */
|
|
59
|
+
id: string;
|
|
60
|
+
/** Parent UDA id — settlements nest inside UDAs; the detail walker scans `udas[].settlements[]`. */
|
|
61
|
+
udaId: string;
|
|
62
|
+
/** Flow that produced this settlement. Drives the title prefix and the accessible label. */
|
|
63
|
+
direction: ActivityDirection;
|
|
64
|
+
/** Lifecycle bucket. Drives the inline status indicator (spinner / red-X / none). */
|
|
65
|
+
status: ActivityStatus;
|
|
66
|
+
/**
|
|
67
|
+
* Discriminated amount. For deposits this is the credited receive leg; for withdrawals it
|
|
68
|
+
* is the source send leg. The row component formats this through the active locale.
|
|
69
|
+
*/
|
|
70
|
+
amount: ActivityAmount;
|
|
71
|
+
/** Settlement `updated_at` as unix-ms. The row component formats this via smart-relative. */
|
|
72
|
+
updatedAtMs: number;
|
|
73
|
+
/** Destination asset symbol — what the leading {@link import("#/shared/ui").TokenLogo} renders. */
|
|
74
|
+
assetSymbol: string;
|
|
75
|
+
/** Destination asset decimals — caps the token-amount formatter precision when `amount.kind === "token"`. */
|
|
76
|
+
assetDecimals: number;
|
|
77
|
+
/** Resolved token icon URL, when known. */
|
|
78
|
+
assetLogoUrl?: string;
|
|
79
|
+
/** EIP-155 chain id of the destination chain. */
|
|
80
|
+
chainId?: number;
|
|
81
|
+
/** Human-readable destination network name (e.g. `"Ethereum"`, `"BSC"`). */
|
|
82
|
+
chainName?: string;
|
|
83
|
+
/**
|
|
84
|
+
* Resolved chain glyph URL — overlaid in the corner of the asset logo. Resolved at the
|
|
85
|
+
* driver layer from the cached `Gateway.assets()` catalog because the lookup map lives in
|
|
86
|
+
* the driver closure; not locale-dependent, so component-layer re-derivation is unnecessary.
|
|
87
|
+
*/
|
|
88
|
+
chainLogoUrl?: string;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Entity payload for the owner-scoped activity surface. Backed by the multi-UDA envelope from
|
|
92
|
+
* `GET /gateway/{owner}`; `rows` is sorted newest-first and capped at 20 entries per fetch.
|
|
93
|
+
*/
|
|
94
|
+
interface ActivityPayload {
|
|
95
|
+
/** Newest-first row payloads, capped at 20 per fetch. */
|
|
96
|
+
rows: ReadonlyArray<ActivityRowPayload>;
|
|
97
|
+
/**
|
|
98
|
+
* Merchant brand label echoed back on `uda.metadata.brand_name` (server-injected per-merchant
|
|
99
|
+
* at `gateway/start` time, constant across the merchant's UDAs). Extracted from the first UDA
|
|
100
|
+
* whose metadata carries a non-empty value. Threaded by activity source hooks into
|
|
101
|
+
* `settlementContext.brandName` so deposit detail rows render the merchant brand as the
|
|
102
|
+
* destination label; withdraw detail rows suppress it inside
|
|
103
|
+
* `settlementToWidgetProps` so they keep showing the recipient address.
|
|
104
|
+
*/
|
|
105
|
+
brandName?: string;
|
|
106
|
+
}
|
|
107
|
+
//#endregion
|
|
108
|
+
export { ActivityAmount, ActivityDirection, ActivityPayload, ActivityRowPayload, ActivityStatus, ActivityStatusType };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{parseIsoMs as e}from"../../../../flows/shared/transformers/parseIsoMs.js";import{resolveDirection as t}from"./resolveDirection.js";function n(e,t){let n=t.ownerAddress.toLowerCase(),a=[];for(let t of e.udas)for(let e of t.settlements)a.push({settlement:e,uda:t});a.sort((e,t)=>e.settlement.updated_at===t.settlement.updated_at?0:e.settlement.updated_at<t.settlement.updated_at?1:-1);let o=[];for(let{settlement:e,uda:r}of a.slice(0,20))o.push(i(e,r,t,n));let s=r(e.udas);return{rows:o,...s?{brandName:s}:{}}}function r(e){for(let t of e){let e=t.metadata?.brand_name;if(typeof e!=`string`)continue;let n=e.trim();if(n.length>0)return n}}function i(n,r,i,s){let c=t(r,s),l=a(n.status),u=o(n,r),d=e(n.updated_at)??e(n.created_at)??Date.now(),f=r.destination.eip155_id?Number(r.destination.eip155_id):void 0,p=f===void 0?void 0:i.chainLogoFor?.(f),m=n.to?.logo??void 0;return{id:n.id,udaId:r.uda_id,direction:c,status:l,amount:u,updatedAtMs:d,assetSymbol:r.destination.asset_symbol,assetDecimals:r.destination.asset_decimals,...m?{assetLogoUrl:m}:{},...f===void 0?{}:{chainId:f},...r.destination.network_name?{chainName:r.destination.network_name}:{},...p?{chainLogoUrl:p}:{}}}function a(e){switch(e){case`created`:case`routing`:return{kind:`pending`};case`completed`:return{kind:`completed`};case`failed`:return{kind:`failed`};default:return{kind:`pending`}}}function o(e,t){let n=e.to,r=e.from,i=n?.amount_usd??r?.amount_usd;if(i){let e=Number.parseFloat(i);if(Number.isFinite(e))return{value:e,kind:`usd`}}let a=t.destination.asset_decimals;return{value:s(n,a),kind:`token`}}function s(e,t){if(!e)return 0;if(e.amount){let t=Number.parseFloat(e.amount);if(Number.isFinite(t)&&t>=0)return t}if(e.raw_amount){let n=e.raw_amount;try{let e=BigInt(n);if(t===0)return Number(e);let r=10n**BigInt(t),i=e/r,a=(e%r).toString().padStart(t,`0`);return Number(`${i}.${a}`)}catch{return 0}}return 0}export{n as activityResponseToPayload};
|
|
@@ -8,7 +8,7 @@ import * as _$react_jsx_runtime0 from "react/jsx-runtime";
|
|
|
8
8
|
* widget is mounted inside `Dialog.Content`.
|
|
9
9
|
*
|
|
10
10
|
* Optional `trailing` slot — Renders before the close X (e.g. the
|
|
11
|
-
* activity
|
|
11
|
+
* activity icon). Defaults to the root's `headerTrailing`; pass
|
|
12
12
|
* `trailing: null` to force the slot empty even when the root supplies a node.
|
|
13
13
|
*/
|
|
14
14
|
declare function AmountEntryHeader({
|
|
@@ -44,8 +44,7 @@ interface AmountEntryProps {
|
|
|
44
44
|
sendToken: AmountEntryToken;
|
|
45
45
|
/**
|
|
46
46
|
* Destination token rendered on the right side of the FlowPill, and
|
|
47
|
-
* surfaced as the title fallback (`Deposit ${symbol}`
|
|
48
|
-
* when `<KitProvider brandName="…">` is configured).
|
|
47
|
+
* surfaced as the title fallback (`Deposit ${symbol}`).
|
|
49
48
|
*/
|
|
50
49
|
receiveToken: AmountEntryToken;
|
|
51
50
|
/**
|
|
@@ -136,7 +135,7 @@ interface AmountEntryProps {
|
|
|
136
135
|
/**
|
|
137
136
|
* Optional trailing-edge chrome rendered next to the `<Dialog.CloseButton />` inside
|
|
138
137
|
* `AmountEntry.Header`. Use this slot to attach flow-specific affordances such as the
|
|
139
|
-
* activity
|
|
138
|
+
* activity trigger. Per-Header `trailing` overrides this root-level prop; pass
|
|
140
139
|
* `trailing: null` on the Header to force the slot empty.
|
|
141
140
|
*/
|
|
142
141
|
headerTrailing?: ReactNode;
|
|
@@ -12,7 +12,7 @@ import * as _$react_jsx_runtime0 from "react/jsx-runtime";
|
|
|
12
12
|
* null` to force the chevron hidden even when the root supplies one.
|
|
13
13
|
*
|
|
14
14
|
* Optional `trailing` slot — Renders before the close X (e.g. the
|
|
15
|
-
* activity
|
|
15
|
+
* activity icon). Defaults to the root's `headerTrailing`; pass
|
|
16
16
|
* `trailing: null` to force the slot empty even when the root supplies a node.
|
|
17
17
|
*/
|
|
18
18
|
declare function AssetPickerHeader({
|
|
@@ -5,7 +5,7 @@ import { OnchainBalanceResponse, OnchainTokenDto } from "@stridge/sdk";
|
|
|
5
5
|
//#region src/shared/widgets/asset-picker/compound/types.d.ts
|
|
6
6
|
/**
|
|
7
7
|
* Destination token surfaced through context. The Header uses it to generate the default modal title
|
|
8
|
-
* (e.g. `"Deposit USDC"
|
|
8
|
+
* (e.g. `"Deposit USDC"`).
|
|
9
9
|
*/
|
|
10
10
|
interface AssetPickerToken {
|
|
11
11
|
/**
|
|
@@ -147,7 +147,7 @@ interface AssetPickerProps {
|
|
|
147
147
|
/**
|
|
148
148
|
* Optional trailing-edge chrome rendered next to the `<Dialog.CloseButton />` inside
|
|
149
149
|
* `AssetPicker.Header`. Use this slot to attach flow-specific affordances such as the
|
|
150
|
-
* activity
|
|
150
|
+
* activity trigger. Per-Header `trailing` overrides this root-level prop; pass
|
|
151
151
|
* `trailing: null` on the Header to force the slot empty.
|
|
152
152
|
*/
|
|
153
153
|
headerTrailing?: ReactNode;
|
|
@@ -160,12 +160,16 @@ interface StridgeStorageConfig {
|
|
|
160
160
|
namespace?: string;
|
|
161
161
|
}
|
|
162
162
|
/**
|
|
163
|
-
* Eager-bootstrap opt-in. Set on `<StridgeProvider prefetch={…}>` to fire the driver `arm()`
|
|
164
|
-
* mount instead of waiting for `useDeposit().open()` / `usePrefetchDeposit()`
|
|
165
|
-
* shapes:
|
|
163
|
+
* Eager-bootstrap opt-in. Set on `<StridgeProvider prefetch={…}>` to fire the driver `arm()`
|
|
164
|
+
* at mount instead of waiting for `useDeposit().open()` / `usePrefetchDeposit()` (or the
|
|
165
|
+
* activity equivalents) to do it. Two shapes:
|
|
166
166
|
*
|
|
167
|
-
* - `true` — arm every enabled flow at mount.
|
|
168
|
-
* - `("deposit" | "withdraw")[]` — arm only the listed
|
|
167
|
+
* - `true` — arm every enabled flow at mount, including the activity driver.
|
|
168
|
+
* - `("deposit" | "withdraw" | "activity")[]` — arm only the listed surfaces. Activity may be
|
|
169
|
+
* listed alone (for hosts that mount only `<ActivityDialog>` — a `deposit` or `withdraw` flow
|
|
170
|
+
* is still configured so the activity owner resolves) or paired with a flow. Listing
|
|
171
|
+
* `"deposit"` or `"withdraw"` implicitly arms `"activity"` too — the activity surface is
|
|
172
|
+
* cross-flow content and any per-flow prefetch implies its envelope is wanted.
|
|
169
173
|
*
|
|
170
174
|
* Default is unset (no eager arm). Reach for this only when the host KNOWS the dialog will
|
|
171
175
|
* open (e.g. a checkout page whose entire purpose is the gateway widget). The default trade —
|
|
@@ -173,7 +177,7 @@ interface StridgeStorageConfig {
|
|
|
173
177
|
* other integration; flipping the prop "just to be safe" re-creates the eager-load problem at
|
|
174
178
|
* a different layer.
|
|
175
179
|
*/
|
|
176
|
-
type StridgePrefetchConfig = true | ReadonlyArray<"deposit" | "withdraw">;
|
|
180
|
+
type StridgePrefetchConfig = true | ReadonlyArray<"deposit" | "withdraw" | "activity">;
|
|
177
181
|
declare namespace StridgeProvider {
|
|
178
182
|
interface Props {
|
|
179
183
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{StridgeEventsContext as e}from"../events/context.js";import{createKitI18n as t}from"../shared/i18n/createKitI18n.js";import"../i18n/index.js";import{createStridgeCatalog as n}from"../drivers/stridge/catalog.js";import{
|
|
1
|
+
"use client";import{StridgeEventsContext as e}from"../events/context.js";import{createKitI18n as t}from"../shared/i18n/createKitI18n.js";import"../i18n/index.js";import{createStridgeCatalog as n}from"../drivers/stridge/catalog.js";import{createStridgeActivityDriver as r}from"../drivers/stridge/createStridgeActivityDriver.js";import{createStridgeDepositDriver as i}from"../drivers/stridge/createStridgeDepositDriver.js";import{createStridgeWithdrawDriver as a}from"../drivers/stridge/createStridgeWithdrawDriver.js";import"../_internal/drivers/stridge/index.js";import{createBus as ee}from"../events/bus/createBus.js";import{createFlowIdRegistry as te}from"../events/bus/flowIdRegistry.js";import{createMetadataStore as o}from"../events/bus/metadata.js";import"../events/bus/index.js";import{KitProvider as s}from"../KitProvider.js";import{resolveMerchantLink as c}from"../shared/merchant-link/resolveMerchantLink.js";import"../shared/merchant-link/index.js";import{useIntercomMerchantContext as l}from"../shared/support/useIntercomMerchantContext.js";import{useMerchantContext as u}from"../shared/support/useMerchantContext.js";import"../shared/support/index.js";import{useDeepMemo as d}from"../shared/utils/useDeepMemo.js";import{ConnectWalletContext as f}from"../shared/wallet/ConnectWalletContext.js";import{DepositOwnerContext as p}from"./depositOwner.js";import{useOptionalWagmi as m}from"./optionalWagmi.js";import{createStubDepositDriver as h,createStubWithdrawDriver as g}from"./stubs.js";import{useEffect as _,useMemo as v,useRef as y}from"react";import{jsx as b}from"react/jsx-runtime";function x({gatewayKey:x,environment:S,asset:C,flows:w,appearance:T,i18n:E,storage:D,dev:O,support:k,terms:ne,prefetch:A,connectWallet:j,className:re,children:ie}){if(!w.deposit&&!w.withdraw)throw Error("<StridgeProvider /> requires at least one of `flows.deposit` or `flows.withdraw`.");if(!C)throw Error("<StridgeProvider /> requires `asset: { networkId, symbol }`.");let{config:M,address:N}=m(),P=v(()=>t(E??{}),[E?.locale,E?.messages]),F=y(P);F.current=P;let I=d(C),L=d(w.deposit),R=d(w.withdraw),z=I.networkId,B=I.symbol,V=L?.owner?.address??N??O?.userAddressOverride,H=R?.owner.address,U=v(()=>n({projectKey:x,...S?{environment:S}:{}}),[x,S]),W=v(()=>{if(!(!L||!V))return i({userAddress:V,projectKey:x,destination:{network_id:z,asset_symbol:B,to_address:L.destination.address},wagmiConfig:M,catalog:U,getI18n:()=>F.current,...S?{environment:S}:{},...L.minAmountUsd===void 0?{}:{minAmountUsd:L.minAmountUsd},...L.maxAmountUsd===void 0?{}:{maxAmountUsd:L.maxAmountUsd},...L.metadata?{metadata:L.metadata}:{}})},[L,V,x,S,z,B,M,U]),G=v(()=>h(),[]),K=L?W??G:void 0,q=v(()=>{if(!(!R||!H))return a({userAddress:H,projectKey:x,currency:{networkId:z,assetSymbol:B},wagmiConfig:M,catalog:U,getI18n:()=>F.current,...S?{environment:S}:{},...R.minAmountUsd===void 0?{}:{minAmountUsd:R.minAmountUsd},...R.maxAmountUsd===void 0?{}:{maxAmountUsd:R.maxAmountUsd},...R.metadata?{metadata:R.metadata}:{}})},[R,H,x,S,z,B,M,U]),J=v(()=>g(),[]),Y=R?q??J:void 0,X=(L?V:void 0)??(R?H:void 0),Z=v(()=>{if(X)return r({userAddress:X,projectKey:x,catalog:U,...S?{environment:S}:{}})},[X,x,S,U]);_(()=>{if(!A)return;let e=A===!0||A.includes(`deposit`),t=A===!0||A.includes(`withdraw`),n=A===!0||A.includes(`activity`)||e||t;e&&W?.arm(),t&&q?.arm(),n&&Z?.arm()},[A,W,q,Z]);let ae=v(()=>L?{resolved:V!==void 0}:null,[L,V]),oe=v(()=>j?{onClick:j.onClick,...j.label===void 0?{}:{label:j.label}}:null,[j?.onClick,j?.label]),Q=V??H,$=u({gatewayKey:x,environment:S??`production`,assetChain:z,assetSymbol:B,...Q?{userAddress:Q}:{},...W?{depositDriver:W}:{}});return l(c(k?{url:k.url,onSelect:k.onOpen}:void 0).kind===`default`?$:null),b(e,{value:v(()=>({bus:ee(),flowIds:te(),metadata:o()}),[]),children:b(f,{value:oe,children:b(p,{value:ae,children:b(s,{theme:T?.theme,accent:T?.accent,radius:T?.radius,direction:T?.direction,attribution:T?.attribution,i18n:E,storage:D?.driver,storageNamespace:D?.namespace,className:re,support:k,merchantContext:$,terms:ne,...K?{deposit:K}:{},...L?.methods?{depositMethods:L.methods}:{},...Y?{withdraw:Y}:{},...Z?{activity:Z}:{},children:ie})})})})}export{x as StridgeProvider};
|
package/dist/stridge/stubs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=Object.freeze({status:`idle`}),t=Object.freeze({brand:e,target:e,addresses:e,balances:e,quote:e,settlement:e,wallet:e,
|
|
1
|
+
const e=Object.freeze({status:`idle`}),t=Object.freeze({brand:e,target:e,addresses:e,balances:e,quote:e,settlement:e,wallet:e,activity:e}),n=Object.freeze({withdrawableBalances:e,receiveOptions:e,quote:e,settlement:e,activity:e}),r=()=>{};function i(){if(typeof DOMException==`function`)return new DOMException(`Aborted`,`AbortError`);let e=Error(`Aborted`);return e.name=`AbortError`,e}function a(e){return new Promise((t,n)=>{if(e.aborted){n(i());return}e.addEventListener(`abort`,()=>n(i()),{once:!0})})}function o(){return{getSnapshot:()=>t,subscribe:()=>r,arm:()=>{},requestQuote:(e,t)=>a(t),submitDeposit:(e,t)=>a(t),watchSettlement:()=>{},fetchActiveSettlement:async()=>null}}function s(){return{getSnapshot:()=>n,subscribe:()=>r,arm:()=>{},requestQuote:(e,t)=>a(t),prepareWithdrawal:(e,t)=>a(t),watchSettlement:()=>{}}}export{o as createStubDepositDriver,s as createStubWithdrawDriver};
|