@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.
Files changed (200) hide show
  1. package/dist/KitProvider.d.ts +11 -0
  2. package/dist/KitProvider.js +1 -1
  3. package/dist/_internal/activity/driver/index.d.ts +3 -0
  4. package/dist/_internal/activity/driver/index.js +1 -0
  5. package/dist/_internal/drivers/stridge/index.d.ts +2 -1
  6. package/dist/_internal/drivers/stridge/index.js +1 -1
  7. package/dist/_internal/drivers/stridge-mock/index.d.ts +2 -1
  8. package/dist/_internal/drivers/stridge-mock/index.js +1 -1
  9. package/dist/activity/compound/index.d.ts +19 -0
  10. package/dist/activity/compound/index.js +1 -0
  11. package/dist/activity/dialog/index.d.ts +3 -0
  12. package/dist/activity/dialog/index.js +1 -0
  13. package/dist/activity/widgets/index.d.ts +4 -0
  14. package/dist/activity/widgets/index.js +1 -0
  15. package/dist/deposit/compound/index.d.ts +9 -9
  16. package/dist/deposit/widgets/index.d.ts +3 -3
  17. package/dist/deposit/widgets/index.js +1 -1
  18. package/dist/drivers/stridge/createStridgeActivityDriver.d.ts +44 -0
  19. package/dist/drivers/stridge/createStridgeActivityDriver.js +1 -0
  20. package/dist/drivers/stridge/createStridgeDepositDriver.js +1 -1
  21. package/dist/drivers/stridge/createStridgeWithdrawDriver.js +1 -1
  22. package/dist/drivers/stridge-mock/createStridgeMockActivityDriver.d.ts +44 -0
  23. package/dist/drivers/stridge-mock/createStridgeMockActivityDriver.js +1 -0
  24. package/dist/drivers/stridge-mock/createStridgeMockDriver.d.ts +0 -2
  25. package/dist/drivers/stridge-mock/createStridgeMockDriver.js +1 -1
  26. package/dist/drivers/stridge-mock/createStridgeMockWithdrawDriver.d.ts +1 -2
  27. package/dist/drivers/stridge-mock/createStridgeMockWithdrawDriver.js +1 -1
  28. package/dist/drivers/stridge-mock/fixtures.js +1 -1
  29. package/dist/flows/activity/compound/ActivityFlow.d.ts +46 -0
  30. package/dist/flows/activity/compound/ActivityFlow.js +1 -0
  31. package/dist/flows/activity/compound/components/Boundary.d.ts +29 -0
  32. package/dist/flows/activity/compound/components/Boundary.js +1 -0
  33. package/dist/flows/activity/compound/components/Steps.d.ts +24 -0
  34. package/dist/flows/activity/compound/components/Steps.js +1 -0
  35. package/dist/flows/activity/dialog/ActivityDialog.d.ts +38 -0
  36. package/dist/flows/activity/dialog/ActivityDialog.js +1 -0
  37. package/dist/flows/activity/dialog/ActivityFlowBoundary.d.ts +1 -0
  38. package/dist/flows/activity/dialog/ActivityFlowBoundary.js +1 -0
  39. package/dist/flows/activity/driver/context.d.ts +38 -0
  40. package/dist/flows/activity/driver/context.js +1 -0
  41. package/dist/flows/activity/driver/types.d.ts +58 -0
  42. package/dist/flows/activity/orchestrator/controller.d.ts +11 -0
  43. package/dist/flows/activity/orchestrator/controller.js +1 -0
  44. package/dist/flows/activity/orchestrator/index.d.ts +4 -0
  45. package/dist/flows/activity/orchestrator/index.js +1 -0
  46. package/dist/flows/activity/orchestrator/reducer.d.ts +1 -0
  47. package/dist/flows/activity/orchestrator/reducer.js +1 -0
  48. package/dist/flows/activity/orchestrator/types.d.ts +71 -0
  49. package/dist/flows/activity/orchestrator/useActivity.d.ts +94 -0
  50. package/dist/flows/activity/orchestrator/useActivity.js +1 -0
  51. package/dist/flows/activity/widgets/ActivityDetail.d.ts +41 -0
  52. package/dist/flows/activity/widgets/ActivityDetail.js +1 -0
  53. package/dist/flows/activity/widgets/ActivityList.d.ts +38 -0
  54. package/dist/flows/activity/widgets/ActivityList.js +1 -0
  55. package/dist/flows/activity/widgets/useStandaloneActivitySource.js +1 -0
  56. package/dist/flows/deposit/dialog/DepositBootstrapErrorState.js +1 -1
  57. package/dist/flows/deposit/dialog/DepositDialog.js +1 -1
  58. package/dist/flows/deposit/driver/transformers/settlementToPayload.js +1 -1
  59. package/dist/flows/deposit/driver/types.d.ts +1 -38
  60. package/dist/flows/deposit/orchestrator/controller.js +1 -1
  61. package/dist/flows/deposit/orchestrator/reducer.js +1 -1
  62. package/dist/flows/deposit/orchestrator/types.d.ts +43 -29
  63. package/dist/flows/deposit/widgets/{activity-history/DepositHistoryDetail.d.ts → activity/DepositActivityDetail.d.ts} +11 -11
  64. package/dist/flows/deposit/widgets/activity/DepositActivityDetail.js +1 -0
  65. package/dist/flows/deposit/widgets/activity/DepositActivityList.d.ts +38 -0
  66. package/dist/flows/deposit/widgets/activity/DepositActivityList.js +1 -0
  67. package/dist/flows/deposit/widgets/activity/index.d.ts +2 -0
  68. package/dist/flows/deposit/widgets/activity/index.js +1 -0
  69. package/dist/flows/deposit/widgets/activity/useDepositActivitySource.js +1 -0
  70. package/dist/flows/deposit/widgets/amount-entry/AmountEntry.js +1 -1
  71. package/dist/flows/deposit/widgets/asset-picker/AssetPicker.js +1 -1
  72. package/dist/flows/deposit/widgets/confirm-deposit/ConfirmDeposit.js +1 -1
  73. package/dist/flows/deposit/widgets/deposit/Deposit.js +1 -1
  74. package/dist/flows/deposit/widgets/deposit/compound/components/Header.d.ts +7 -6
  75. package/dist/flows/deposit/widgets/deposit/compound/components/Header.js +1 -1
  76. package/dist/flows/deposit/widgets/deposit-status-banner/DepositStatusBanner.js +1 -1
  77. package/dist/flows/deposit/widgets/error-state/ErrorState.js +1 -1
  78. package/dist/flows/deposit/widgets/processing-state/ProcessingState.js +1 -1
  79. package/dist/flows/deposit/widgets/transfer-crypto/compound/components/Header.d.ts +4 -3
  80. package/dist/flows/deposit/widgets/transfer-crypto/compound/components/Header.js +1 -1
  81. package/dist/flows/withdraw/dialog/WithdrawDialog.js +1 -1
  82. package/dist/flows/withdraw/driver/types.d.ts +0 -34
  83. package/dist/flows/withdraw/orchestrator/controller.js +1 -1
  84. package/dist/flows/withdraw/orchestrator/reducer.js +1 -1
  85. package/dist/flows/withdraw/orchestrator/types.d.ts +44 -30
  86. package/dist/flows/withdraw/widgets/{activity-history/WithdrawHistoryDetail.d.ts → activity/WithdrawActivityDetail.d.ts} +11 -11
  87. package/dist/flows/withdraw/widgets/activity/WithdrawActivityDetail.js +1 -0
  88. package/dist/flows/withdraw/widgets/activity/WithdrawActivityList.d.ts +36 -0
  89. package/dist/flows/withdraw/widgets/activity/WithdrawActivityList.js +1 -0
  90. package/dist/flows/withdraw/widgets/activity/index.d.ts +2 -0
  91. package/dist/flows/withdraw/widgets/activity/index.js +1 -0
  92. package/dist/flows/withdraw/widgets/activity/useWithdrawActivitySource.js +1 -0
  93. package/dist/flows/withdraw/widgets/withdraw-form/compound/components/Body.d.ts +7 -6
  94. package/dist/flows/withdraw/widgets/withdraw-form/compound/components/Header.d.ts +4 -4
  95. package/dist/flows/withdraw/widgets/withdraw-form/compound/components/Header.js +1 -1
  96. package/dist/format/index.d.ts +2 -1
  97. package/dist/format/index.js +1 -1
  98. package/dist/i18n/locales/ar.js +1 -1
  99. package/dist/i18n/locales/es.js +1 -1
  100. package/dist/i18n/locales/source-keys.d.ts +1 -1
  101. package/dist/icons/index.d.ts +2 -2
  102. package/dist/icons/index.js +1 -1
  103. package/dist/index.d.ts +8 -2
  104. package/dist/index.js +1 -1
  105. package/dist/package.js +1 -1
  106. package/dist/shared/format/formatSmartRelative.d.ts +25 -0
  107. package/dist/shared/format/formatSmartRelative.js +1 -0
  108. package/dist/shared/format/formatUsd.js +1 -1
  109. package/dist/shared/icons/{HistoryIcon.d.ts → ActivityIcon.d.ts} +4 -4
  110. package/dist/shared/icons/{HistoryIcon.js → ActivityIcon.js} +1 -1
  111. package/dist/shared/orchestrator/activityOpenInput.d.ts +21 -0
  112. package/dist/shared/orchestrator/createActivityReducers.js +1 -0
  113. package/dist/shared/orchestrator/index.d.ts +2 -0
  114. package/dist/shared/orchestrator/index.js +1 -1
  115. package/dist/shared/orchestrator/resolveActivityEntry.d.ts +1 -0
  116. package/dist/shared/orchestrator/resolveActivityEntry.js +1 -0
  117. package/dist/shared/ui/Card/Card.d.ts +12 -9
  118. package/dist/shared/ui/Card/Card.js +1 -1
  119. package/dist/shared/ui/Card/Card.styles.js +1 -1
  120. package/dist/shared/ui/SelectableTile/SelectableTile.d.ts +1 -1
  121. package/dist/shared/widgets/activity/ActivityTrigger.js +1 -0
  122. package/dist/shared/widgets/{activity-history → activity}/ActivityTrigger.styles.js +1 -1
  123. package/dist/shared/widgets/activity/adapters/settlementToWidgetProps.js +1 -0
  124. package/dist/shared/widgets/activity/compound/Activity.d.ts +95 -0
  125. package/dist/shared/widgets/activity/compound/Activity.js +1 -0
  126. package/dist/shared/widgets/activity/compound/Activity.slots.d.ts +22 -0
  127. package/dist/shared/widgets/activity/compound/Activity.slots.js +1 -0
  128. package/dist/shared/widgets/activity/compound/Activity.styles.js +1 -0
  129. package/dist/shared/widgets/{activity-history/compound/ActivityHistoryDetail.d.ts → activity/compound/ActivityDetail.d.ts} +24 -17
  130. package/dist/shared/widgets/activity/compound/ActivityDetail.js +1 -0
  131. package/dist/shared/widgets/activity/compound/Row.slots.d.ts +21 -0
  132. package/dist/shared/widgets/activity/compound/Row.slots.js +1 -0
  133. package/dist/shared/widgets/activity/compound/Row.styles.js +1 -0
  134. package/dist/shared/widgets/{activity-history/compound/components/HistoryHeader.d.ts → activity/compound/components/ActivityHeader.d.ts} +8 -8
  135. package/dist/shared/widgets/activity/compound/components/ActivityHeader.js +1 -0
  136. package/dist/shared/widgets/{activity-history → activity}/compound/components/Empty.d.ts +3 -3
  137. package/dist/shared/widgets/activity/compound/components/Empty.js +1 -0
  138. package/dist/shared/widgets/{activity-history → activity}/compound/components/ErrorView.d.ts +7 -7
  139. package/dist/shared/widgets/activity/compound/components/ErrorView.js +1 -0
  140. package/dist/shared/widgets/activity/compound/components/List.d.ts +23 -0
  141. package/dist/shared/widgets/activity/compound/components/List.js +1 -0
  142. package/dist/shared/widgets/{activity-history → activity}/compound/components/Row.d.ts +13 -16
  143. package/dist/shared/widgets/activity/compound/components/Row.js +1 -0
  144. package/dist/shared/widgets/activity/compound/components/StatusPip.js +1 -0
  145. package/dist/shared/widgets/activity/compound/context.d.ts +95 -0
  146. package/dist/shared/widgets/activity/compound/context.js +1 -0
  147. package/dist/shared/widgets/activity/compound/index.d.ts +8 -0
  148. package/dist/shared/widgets/activity/compound/index.js +1 -0
  149. package/dist/shared/widgets/activity/payloads.d.ts +108 -0
  150. package/dist/shared/widgets/activity/transformers/activityResponseToPayload.js +1 -0
  151. package/dist/shared/widgets/amount-entry/compound/components/Header.d.ts +1 -1
  152. package/dist/shared/widgets/amount-entry/compound/types.d.ts +2 -3
  153. package/dist/shared/widgets/asset-picker/compound/components/Header.d.ts +1 -1
  154. package/dist/shared/widgets/asset-picker/compound/types.d.ts +2 -2
  155. package/dist/stridge/StridgeProvider.d.ts +10 -6
  156. package/dist/stridge/StridgeProvider.js +1 -1
  157. package/dist/stridge/stubs.js +1 -1
  158. package/dist/styles/index.css +4 -0
  159. package/dist/withdraw/compound/index.d.ts +6 -6
  160. package/dist/withdraw/widgets/index.d.ts +3 -3
  161. package/dist/withdraw/widgets/index.js +1 -1
  162. package/package.json +14 -6
  163. package/dist/activity-history/compound/index.d.ts +0 -9
  164. package/dist/activity-history/compound/index.js +0 -1
  165. package/dist/flows/deposit/widgets/activity-history/DepositHistoryDetail.js +0 -1
  166. package/dist/flows/deposit/widgets/activity-history/DepositHistoryList.d.ts +0 -38
  167. package/dist/flows/deposit/widgets/activity-history/DepositHistoryList.js +0 -1
  168. package/dist/flows/deposit/widgets/activity-history/index.d.ts +0 -2
  169. package/dist/flows/deposit/widgets/activity-history/index.js +0 -1
  170. package/dist/flows/deposit/widgets/activity-history/useDepositActivityHistorySource.js +0 -1
  171. package/dist/flows/withdraw/widgets/activity-history/WithdrawHistoryDetail.js +0 -1
  172. package/dist/flows/withdraw/widgets/activity-history/WithdrawHistoryList.d.ts +0 -36
  173. package/dist/flows/withdraw/widgets/activity-history/WithdrawHistoryList.js +0 -1
  174. package/dist/flows/withdraw/widgets/activity-history/index.d.ts +0 -2
  175. package/dist/flows/withdraw/widgets/activity-history/index.js +0 -1
  176. package/dist/flows/withdraw/widgets/activity-history/useWithdrawActivityHistorySource.js +0 -1
  177. package/dist/shared/widgets/activity-history/ActivityTrigger.js +0 -1
  178. package/dist/shared/widgets/activity-history/adapters/settlementToWidgetProps.js +0 -1
  179. package/dist/shared/widgets/activity-history/compound/ActivityHistory.d.ts +0 -95
  180. package/dist/shared/widgets/activity-history/compound/ActivityHistory.js +0 -1
  181. package/dist/shared/widgets/activity-history/compound/ActivityHistory.slots.d.ts +0 -22
  182. package/dist/shared/widgets/activity-history/compound/ActivityHistory.slots.js +0 -1
  183. package/dist/shared/widgets/activity-history/compound/ActivityHistory.styles.js +0 -1
  184. package/dist/shared/widgets/activity-history/compound/ActivityHistoryDetail.js +0 -1
  185. package/dist/shared/widgets/activity-history/compound/Row.slots.d.ts +0 -21
  186. package/dist/shared/widgets/activity-history/compound/Row.slots.js +0 -1
  187. package/dist/shared/widgets/activity-history/compound/Row.styles.js +0 -1
  188. package/dist/shared/widgets/activity-history/compound/components/Empty.js +0 -1
  189. package/dist/shared/widgets/activity-history/compound/components/ErrorView.js +0 -1
  190. package/dist/shared/widgets/activity-history/compound/components/HistoryHeader.js +0 -1
  191. package/dist/shared/widgets/activity-history/compound/components/List.d.ts +0 -23
  192. package/dist/shared/widgets/activity-history/compound/components/List.js +0 -1
  193. package/dist/shared/widgets/activity-history/compound/components/Row.js +0 -1
  194. package/dist/shared/widgets/activity-history/compound/components/StatusPip.js +0 -1
  195. package/dist/shared/widgets/activity-history/compound/context.d.ts +0 -79
  196. package/dist/shared/widgets/activity-history/compound/context.js +0 -1
  197. package/dist/shared/widgets/activity-history/payloads.d.ts +0 -81
  198. package/dist/shared/widgets/activity-history/transformers/historyResponseToPayload.js +0 -1
  199. /package/dist/shared/widgets/{activity-history → activity}/index.js +0 -0
  200. /package/dist/shared/widgets/{activity-history → activity}/transformers/resolveDirection.js +0 -0
@@ -1,23 +0,0 @@
1
- import * as _$react_jsx_runtime0 from "react/jsx-runtime";
2
-
3
- //#region src/shared/widgets/activity-history/compound/components/List.d.ts
4
- /**
5
- * List body for the activity surface. Reads the `history` entity from
6
- * {@link useActivityHistorySource} 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 ActivityHistoryErrorView} with a retry button.
12
- * - `ready` with zero rows → {@link ActivityHistoryEmpty}.
13
- *
14
- * Recurring updates land via the controller-mounted `watchHistory` watcher (mounted on entry
15
- * to `historyList` / `historyDetail`, 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 ActivityHistoryList(): _$react_jsx_runtime0.JSX.Element;
22
- //#endregion
23
- export { ActivityHistoryList };
@@ -1 +0,0 @@
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_HISTORY_SLOTS as n}from"../ActivityHistory.slots.js";import{styles as r}from"../ActivityHistory.styles.js";import{ActivityHistoryEmpty as i}from"./Empty.js";import{ActivityHistoryErrorView as a}from"./ErrorView.js";import{useActivityHistorySource as o}from"../context.js";import{ActivityHistoryRow 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=o(`ActivityHistory.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(a,{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(i,{})}):l(e.Body,{"data-stridge-slot":n.body,...d.props(r.body,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 ActivityHistoryList};
@@ -1 +0,0 @@
1
- "use client";import{ChevronRightIcon as e}from"../../../../icons/ChevronRightIcon.js";import"../../../../../icons/index.js";import{SelectableTile as t}from"../../../../ui/SelectableTile/SelectableTile.js";import"../../../../ui/SelectableTile/index.js";import{text as n}from"../../../../ui/Text/Text.js";import"../../../../ui/Text/index.js";import{TokenLogo as r}from"../../../../ui/TokenLogo/TokenLogo.js";import"../../../../ui/TokenLogo/index.js";import{ACTIVITY_HISTORY_ROW_SLOTS as i}from"../Row.slots.js";import{styles as a}from"../Row.styles.js";import{StatusPip as o}from"./StatusPip.js";import{jsx as s,jsxs as c}from"react/jsx-runtime";import*as l from"@stylexjs/stylex";function u({payload:u,onSelect:d}){return c(t,{shape:`card`,interactive:`navigation`,"data-stridge-slot":i.root,"aria-label":u.ariaLabel,onClick:()=>d(u.id),...l.props(a.rowLayout),children:[c(`span`,{"data-stridge-slot":i.leading,...l.props(a.leading),children:[s(r,{symbol:u.assetSymbol,...u.chainId===void 0?{}:{chainId:u.chainId},...u.assetLogoUrl===void 0?{}:{logoUrl:u.assetLogoUrl},...u.chainLogoUrl===void 0?{}:{chainLogoUrl:u.chainLogoUrl},size:44,hideChainBadge:!0}),s(o,{kind:u.status.kind})]}),c(`span`,{"data-stridge-slot":i.text,...l.props(a.text),children:[s(n.span,{size:`sm`,fontWeight:`semibold`,leading:`tight`,color:`default`,"data-stridge-slot":i.title,...l.props(a.title),children:u.title}),s(n.span,{size:`xs`,fontWeight:`medium`,leading:`tight`,color:`subdued`,"data-stridge-slot":i.date,...l.props(a.date),children:u.formattedDate.formatted})]}),c(`span`,{"data-stridge-slot":i.trailing,...l.props(a.trailing),children:[s(n.span,{size:`sm`,fontWeight:`semibold`,leading:`tight`,color:`default`,"data-stridge-slot":i.amount,children:u.formattedAmount.formatted}),s(e,{"aria-hidden":!0,"data-stridge-slot":i.chevron,...l.props(a.chevron)})]})]})}export{u as ActivityHistoryRow};
@@ -1 +0,0 @@
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_HISTORY_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};
@@ -1,79 +0,0 @@
1
- import { Entity } from "../../../driver/types.js";
2
- import { ActivityHistoryPayload } 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-history/compound/context.d.ts
8
- /**
9
- * Source of truth handed to `<ActivityHistory>` and `<ActivityHistoryDetail>` from whichever
10
- * dialog (deposit / withdraw) mounts them. Each dialog assembles this value once from its own
11
- * snapshot + actions and wraps the activity-history step body in
12
- * `<ActivityHistorySourceProvider 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 `historyList` and `historyDetail` as separate
16
- * state names; the dialog's step router mounts {@link ActivityHistory} for the list step and
17
- * {@link ActivityHistoryDetail} 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 ActivityHistorySourceProvider}
22
- * @see {@link useActivityHistorySource}
23
- */
24
- interface ActivityHistorySourceValue {
25
- /**
26
- * The driver's `history` entity. Same shape on both flows (`DepositSnapshot["history"]`
27
- * and `WithdrawSnapshot["history"]` 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<ActivityHistoryPayload, ReadonlyArray<GatewayUdaDto>, GatewayPollResponse>;
32
- /**
33
- * Trigger a fresh one-shot fetch. Wired by each dialog to `driver.refreshHistory(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
- * `watchHistory` 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 `historyList` to `historyDetail` 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 (`historyDetail → historyList → source`). The compound renders the chevron in
48
- * both the list step's header AND inside the detail step's header composition.
49
- */
50
- back: () => void;
51
- /**
52
- * Selected settlement id when the dialog is mounting the detail step. Carried so the
53
- * `<ActivityHistoryDetail>` compound can look up the matching `GatewaySettlementDto`
54
- * inside `entity.raw[].settlements[]` and feed it to {@link
55
- * import("../adapters").settlementToWidgetProps}. Absent when the list wrapper supplies
56
- * the source value.
57
- */
58
- settlementId?: string;
59
- /**
60
- * Context the detail compound's adapter passes to {@link
61
- * import("#/flows/deposit/driver/transformers").settlementToPayload}. Each dialog
62
- * assembles this from its own driver snapshot — deposit reads `wallet`, `brand`, the
63
- * driver's explorers map; withdraw reads its equivalents. Carrying the resolved context
64
- * here keeps the compound flow-agnostic.
65
- */
66
- settlementContext: SettlementPayloadContext;
67
- }
68
- /**
69
- * Provider for {@link ActivityHistorySourceValue}. Each dialog mounts one above its
70
- * activity-history step body — see `DepositDialog` / `WithdrawDialog`.
71
- */
72
- declare const ActivityHistorySourceProvider: _$react.Provider<ActivityHistorySourceValue | null>;
73
- /**
74
- * Read the active {@link ActivityHistorySourceValue}. Throws when called outside an
75
- * `<ActivityHistorySourceProvider>`.
76
- */
77
- declare function useActivityHistorySource(consumer: string): ActivityHistorySourceValue;
78
- //#endregion
79
- export { ActivityHistorySourceProvider, ActivityHistorySourceValue, useActivityHistorySource };
@@ -1 +0,0 @@
1
- "use client";import{createContext as e,use as t}from"react";const n=e(null);n.displayName=`ActivityHistorySourceContext`;const r=n.Provider;function i(e){let r=t(n);if(!r)throw Error(`${e} must be rendered inside <ActivityHistorySourceProvider>. Mount the provider above <ActivityHistory> with the value derived from the flow's snapshot + actions — see DepositDialog / WithdrawDialog for the canonical wiring.`);return r}export{r as ActivityHistorySourceProvider,i as useActivityHistorySource};
@@ -1,81 +0,0 @@
1
- import { FormattedField } from "../../format/types.js";
2
- //#region src/shared/widgets/activity-history/payloads.d.ts
3
- /**
4
- * Which flow produced the settlement — `"deposit"` for UDAs whose destination is the connected
5
- * wallet, `"withdraw"` for UDAs whose source is the brand-currency balance the user is cashing
6
- * out from. Discriminated by `uda.metadata.kit_flow` when present, with an address-comparison
7
- * fallback for legacy UDAs that pre-date the metadata convention.
8
- */
9
- type ActivityHistoryDirection = "deposit" | "withdraw";
10
- /**
11
- * Lifecycle bucket for a single settlement row. Maps onto the kit's existing settlement-status
12
- * model (`pending → succeeded → failed`) but flattens it to the 3-value set the row renders
13
- * against — the inline status indicator picks an icon from this discriminator alone.
14
- */
15
- type ActivityHistoryStatusType = "pending" | "completed" | "failed";
16
- /**
17
- * Wrapper carrying the lifecycle bucket plus room for future status-scoped metadata (e.g. a
18
- * settlement-level `failureKind` tag the row could surface). Kept separate from
19
- * {@link ActivityHistoryStatusType} so the discriminator string stays stable as the shape grows.
20
- */
21
- interface ActivityHistoryStatus {
22
- kind: ActivityHistoryStatusType;
23
- }
24
- /**
25
- * One settlement row in the activity history list. Pre-formatted by the driver's transformer —
26
- * widgets render directly from these fields and never re-format inputs themselves.
27
- *
28
- * Detail-view rendering happens off the entity's `raw: ReadonlyArray<GatewayUdaDto>` slot: the
29
- * row carries `udaId` + `id` so the detail component can locate the matching
30
- * `GatewaySettlementDto` and feed it back through {@link
31
- * import("#/flows/deposit/driver/transformers").settlementToPayload} to produce a full
32
- * `SuccessStateProps` / `ErrorStateProps` / pending payload at display time.
33
- */
34
- interface ActivityHistoryRowPayload {
35
- /** Settlement id — unique within the multi-UDA envelope. The detail lookup keys on this. */
36
- id: string;
37
- /** Parent UDA id — settlements nest inside UDAs; the detail walker scans `udas[].settlements[]`. */
38
- udaId: string;
39
- /** Flow that produced this settlement. Drives the title prefix and the accessible label. */
40
- direction: ActivityHistoryDirection;
41
- /** Lifecycle bucket. Drives the inline status indicator (spinner / red-X / none). */
42
- status: ActivityHistoryStatus;
43
- /** Localized action+status string (e.g. `"Deposit completed"`, `"Withdrawal in progress"`). */
44
- title: string;
45
- /**
46
- * USD-formatted amount for this row. For deposits this is the credited receive amount; for
47
- * withdrawals the source send amount. The widget renders `formatted` verbatim.
48
- */
49
- formattedAmount: FormattedField<number>;
50
- /**
51
- * Settlement `updated_at` (unix-ms in `value`). `formatted` is the smart-relative form for
52
- * settlements younger than 7 days, otherwise an absolute date — both follow the active Lingui
53
- * locale.
54
- */
55
- formattedDate: FormattedField<number>;
56
- /** Destination asset symbol — what the leading {@link import("#/shared/ui").TokenLogo} renders. */
57
- assetSymbol: string;
58
- /** Resolved token icon URL, when known. */
59
- assetLogoUrl?: string;
60
- /** EIP-155 chain id of the destination chain. */
61
- chainId?: number;
62
- /** Human-readable destination network name (e.g. `"Ethereum"`, `"BSC"`). */
63
- chainName?: string;
64
- /** Resolved chain glyph URL — overlaid in the corner of the asset logo. */
65
- chainLogoUrl?: string;
66
- /**
67
- * Accessible label rendered as the row's `aria-label`. Encodes direction + amount + date
68
- * because the leading icon does not carry direction.
69
- */
70
- ariaLabel: string;
71
- }
72
- /**
73
- * Entity payload for the owner-scoped activity surface. Backed by the multi-UDA envelope from
74
- * `GET /gateway/{owner}`; `rows` is sorted newest-first and capped at 20 entries per fetch.
75
- */
76
- interface ActivityHistoryPayload {
77
- /** Newest-first row payloads, capped at 20 per fetch. */
78
- rows: ReadonlyArray<ActivityHistoryRowPayload>;
79
- }
80
- //#endregion
81
- export { ActivityHistoryDirection, ActivityHistoryPayload, ActivityHistoryRowPayload, ActivityHistoryStatus, ActivityHistoryStatusType };
@@ -1 +0,0 @@
1
- import{parseIsoMs as e}from"../../../../flows/shared/transformers/parseIsoMs.js";import{formatTimestamp as t}from"../../../format/formatTimestamp.js";import{formatTokenAmount as n}from"../../../format/formatTokenAmount.js";import{formatUsd as r}from"../../../format/formatUsd.js";import{resolveDirection as i}from"./resolveDirection.js";function a(e,t){let n=t.now??Date.now(),r=t.ownerAddress.toLowerCase(),i=[];for(let t of e.udas)for(let e of t.settlements)i.push({settlement:e,uda:t});i.sort((e,t)=>e.settlement.updated_at===t.settlement.updated_at?0:e.settlement.updated_at<t.settlement.updated_at?1:-1);let a=[];for(let{settlement:e,uda:s}of i.slice(0,20))a.push(o(e,s,t,n,r));return{rows:a}}function o(t,n,r,a,o){let u=i(n,o),d=s(t.status),f=c(u,d.kind,r.i18n),p=l(t,n,u,r.i18n),g=e(t.updated_at)??e(t.created_at)??a,_={value:g,formatted:m(g,a,r.i18n)},v=h(u,p.formatted,_.formatted,r.i18n),y=n.destination.eip155_id?Number(n.destination.eip155_id):void 0,b=y===void 0?void 0:r.chainLogoFor?.(y),x=t.to?.logo??void 0;return{id:t.id,udaId:n.uda_id,direction:u,status:d,title:f,formattedAmount:p,formattedDate:_,assetSymbol:n.destination.asset_symbol,...x?{assetLogoUrl:x}:{},...y===void 0?{}:{chainId:y},...n.destination.network_name?{chainName:n.destination.network_name}:{},...b?{chainLogoUrl:b}:{},ariaLabel:v}}function s(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 c(e,t,n){return e===`deposit`?t===`completed`?n._({id:`Deposit completed`,message:`Deposit completed`}):t===`failed`?n._({id:`Deposit failed`,message:`Deposit failed`}):n._({id:`Deposit in progress`,message:`Deposit in progress`}):t===`completed`?n._({id:`Withdrawal completed`,message:`Withdrawal completed`}):t===`failed`?n._({id:`Withdrawal failed`,message:`Withdrawal failed`}):n._({id:`Withdrawal in progress`,message:`Withdrawal in progress`})}function l(e,t,i,a){let o=i===`deposit`?e.to:e.from,s=o?.amount_usd;if(s){let e=Number.parseFloat(s);if(Number.isFinite(e))return{value:e,formatted:r(e,a)}}let c=t.destination.asset_decimals,l=u(o,c),d=t.destination.asset_symbol;return{value:l,formatted:`${n(l,a,{maxDecimals:c})} ${d}`}}function u(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}const d=6e4,f=36e5,p=864e5;function m(e,n,r){let i=n-e;if(i<d)return r._({id:`Just now`,message:`Just now`});let a=new Intl.RelativeTimeFormat(r.locale,{numeric:`auto`});if(i<f){let e=Math.floor(i/d);return a.format(-e,`minute`)}if(i<p){let e=Math.floor(i/f);return a.format(-e,`hour`)}let o=Math.floor(i/p);return o===1?r._({id:`Yesterday`,message:`Yesterday`}):o<7?a.format(-o,`day`):t(e,r)}function h(e,t,n,r){return e===`deposit`?r._({id:`Deposit of {amount}, {date}`,message:`Deposit of {amount}, {date}`,values:{amount:t,date:n}}):r._({id:`Withdrawal of {amount}, {date}`,message:`Withdrawal of {amount}, {date}`,values:{amount:t,date:n}})}export{a as historyResponseToPayload};