@stridge/kit 0.1.0-alpha.53 → 0.1.0-alpha.55
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/activity/dialog/index.d.ts +2 -1
- package/dist/activity/widgets/index.d.ts +2 -1
- package/dist/deposit/dialog/index.d.ts +2 -1
- package/dist/deposit/widgets/index.d.ts +2 -1
- package/dist/events/bus/flowIdRegistry.d.ts +1 -1
- package/dist/events/bus/flowIdRegistry.js +1 -1
- package/dist/events/bus/metadata.js +1 -1
- package/dist/events/emit/index.js +1 -1
- package/dist/events/emit/useActivityEmissions.js +1 -0
- package/dist/events/index.d.ts +2 -1
- package/dist/events/types/activity.d.ts +53 -0
- package/dist/events/types/deposit.d.ts +1 -1
- package/dist/events/types/envelope.d.ts +4 -4
- package/dist/events/types/index.d.ts +2 -1
- package/dist/flows/activity/dialog/ActivityDialog.d.ts +18 -1
- package/dist/flows/activity/dialog/ActivityDialog.js +1 -1
- package/dist/flows/deposit/dialog/DepositDialog.d.ts +10 -1
- package/dist/flows/deposit/dialog/DepositDialog.js +1 -1
- package/dist/flows/withdraw/dialog/WithdrawDialog.d.ts +10 -1
- package/dist/flows/withdraw/dialog/WithdrawDialog.js +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/package.js +1 -1
- package/dist/shared/dialog/DialogShell.d.ts +21 -6
- package/dist/shared/dialog/DialogShell.js +1 -1
- package/dist/shared/dialog/StepTransition.js +1 -1
- package/dist/shared/presentation/useResolvedSurfaceKind.js +1 -1
- package/dist/shared/ui/AdaptiveSurface/AdaptiveSurface.js +1 -1
- package/dist/shared/ui/Drawer/Drawer.styles.js +1 -1
- package/dist/stridge/StridgeProvider.d.ts +8 -0
- package/dist/stridge/StridgeProvider.js +1 -1
- package/dist/styles/index.css +15 -0
- package/dist/withdraw/dialog/index.d.ts +2 -1
- package/package.json +1 -1
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Presentation, PresentationConfig, PresentationMode } from "../../shared/presentation/types.js";
|
|
1
2
|
import { ActivityBoundary, Props } from "../../flows/activity/compound/components/Boundary.js";
|
|
2
3
|
import { ActivityDialog } from "../../flows/activity/dialog/ActivityDialog.js";
|
|
3
|
-
export { ActivityDialog, ActivityBoundary as ActivityFlowBoundary, type Props as ActivityFlowBoundaryProps };
|
|
4
|
+
export { ActivityDialog, ActivityBoundary as ActivityFlowBoundary, type Props as ActivityFlowBoundaryProps, type Presentation, type PresentationConfig, type PresentationMode };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
+
import { Presentation, PresentationConfig, PresentationMode } from "../../shared/presentation/types.js";
|
|
1
2
|
import { DialogShell, DialogShellControls, DialogShellProps } from "../../shared/dialog/DialogShell.js";
|
|
2
3
|
import { ActivityDetail } from "../../flows/activity/widgets/ActivityDetail.js";
|
|
3
4
|
import { ActivityList } from "../../flows/activity/widgets/ActivityList.js";
|
|
4
|
-
export { ActivityDetail, ActivityList, DialogShell, type DialogShellControls, type DialogShellProps };
|
|
5
|
+
export { ActivityDetail, ActivityList, DialogShell, type DialogShellControls, type DialogShellProps, type Presentation, type PresentationConfig, type PresentationMode };
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
+
import { Presentation, PresentationConfig, PresentationMode } from "../../shared/presentation/types.js";
|
|
1
2
|
import { DepositDialog } from "../../flows/deposit/dialog/DepositDialog.js";
|
|
2
|
-
export { DepositDialog };
|
|
3
|
+
export { DepositDialog, type Presentation, type PresentationConfig, type PresentationMode };
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Presentation, PresentationConfig, PresentationMode } from "../../shared/presentation/types.js";
|
|
1
2
|
import { DialogShell, DialogShellControls, DialogShellProps } from "../../shared/dialog/DialogShell.js";
|
|
2
3
|
import { DepositActivityDetail } from "../../flows/deposit/widgets/activity/DepositActivityDetail.js";
|
|
3
4
|
import { DepositActivityList } from "../../flows/deposit/widgets/activity/DepositActivityList.js";
|
|
@@ -10,4 +11,4 @@ import { ErrorState } from "../../flows/deposit/widgets/error-state/ErrorState.j
|
|
|
10
11
|
import { ProcessingState } from "../../flows/deposit/widgets/processing-state/ProcessingState.js";
|
|
11
12
|
import { SuccessState } from "../../flows/deposit/widgets/success-state/SuccessState.js";
|
|
12
13
|
import { TransferCrypto } from "../../flows/deposit/widgets/transfer-crypto/TransferCrypto.js";
|
|
13
|
-
export { AmountEntry, AssetPicker, ConfirmDeposit, Deposit, DepositActivityDetail, DepositActivityList, DepositStatusBanner, DialogShell, type DialogShellControls, type DialogShellProps, ErrorState, ProcessingState, SuccessState, TransferCrypto };
|
|
14
|
+
export { AmountEntry, AssetPicker, ConfirmDeposit, Deposit, DepositActivityDetail, DepositActivityList, DepositStatusBanner, DialogShell, type DialogShellControls, type DialogShellProps, ErrorState, type Presentation, type PresentationConfig, type PresentationMode, ProcessingState, SuccessState, TransferCrypto };
|
|
@@ -12,6 +12,6 @@
|
|
|
12
12
|
* without subscribing to the bus.
|
|
13
13
|
*/
|
|
14
14
|
/** Flow types eligible for a `flowId`. `kit` is excluded — `kit:*` events carry `flowId: null`. */
|
|
15
|
-
type FlowIdKey = "deposit" | "withdraw";
|
|
15
|
+
type FlowIdKey = "deposit" | "withdraw" | "activity";
|
|
16
16
|
//#endregion
|
|
17
17
|
export { FlowIdKey };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz`;function t(){let t=``,n=typeof globalThis<`u`?globalThis.crypto:void 0;if(n?.getRandomValues){let r=new Uint8Array(10);n.getRandomValues(r);for(let n=0;n<10;n+=1)t+=e[(r[n]??0)%62];return t}for(let n=0;n<10;n+=1)t+=e[Math.floor(Math.random()*62)];return t}function n(){let e={deposit:null,withdraw:null},n={deposit:new Set,withdraw:new Set};function r(e){for(let t of n[e])try{t()}catch(t){console.error(`[stridge/kit] flowId listener for "${e}" threw:`,t)}}return{open(n){e[n]!==null&&process.env.NODE_ENV!==`production`&&console.warn(`[stridge/kit] minted a new "${n}" flowId while a previous session was still active — the previous flowId is being discarded. This usually means the kit emitted opened twice without an intervening terminal/cancelled event.`);let i=t();return e[n]=i,r(n),i},close(t){e[t]!==null&&(e[t]=null,r(t))},current(t){return e[t]},subscribe(e,t){return n[e].add(t),()=>{n[e].delete(t)}}}}export{n as createFlowIdRegistry};
|
|
1
|
+
const e=`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz`;function t(){let t=``,n=typeof globalThis<`u`?globalThis.crypto:void 0;if(n?.getRandomValues){let r=new Uint8Array(10);n.getRandomValues(r);for(let n=0;n<10;n+=1)t+=e[(r[n]??0)%62];return t}for(let n=0;n<10;n+=1)t+=e[Math.floor(Math.random()*62)];return t}function n(){let e={deposit:null,withdraw:null,activity:null},n={deposit:new Set,withdraw:new Set,activity:new Set};function r(e){for(let t of n[e])try{t()}catch(t){console.error(`[stridge/kit] flowId listener for "${e}" threw:`,t)}}return{open(n){e[n]!==null&&process.env.NODE_ENV!==`production`&&console.warn(`[stridge/kit] minted a new "${n}" flowId while a previous session was still active — the previous flowId is being discarded. This usually means the kit emitted opened twice without an intervening terminal/cancelled event.`);let i=t();return e[n]=i,r(n),i},close(t){e[t]!==null&&(e[t]=null,r(t))},current(t){return e[t]},subscribe(e,t){return n[e].add(t),()=>{n[e].delete(t)}}}}export{n as createFlowIdRegistry};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=Object.freeze({});function t(){let t={deposit:e,withdraw:e};return{snapshot(n,r){if(!r||Object.keys(r).length===0){t[n]=e;return}t[n]=Object.freeze({...r})},read(e){return t[e]},clear(n){t[n]=e}}}export{t as createMetadataStore};
|
|
1
|
+
const e=Object.freeze({});function t(){let t={deposit:e,withdraw:e,activity:e};return{snapshot(n,r){if(!r||Object.keys(r).length===0){t[n]=e;return}t[n]=Object.freeze({...r})},read(e){return t[e]},clear(n){t[n]=e}}}export{t as createMetadataStore};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./mapFailure.js";import"./useDepositEmissions.js";import"./useKitEmitter.js";import"./useWithdrawEmissions.js";
|
|
1
|
+
import"./mapFailure.js";import"./useActivityEmissions.js";import"./useDepositEmissions.js";import"./useKitEmitter.js";import"./useWithdrawEmissions.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import{StridgeEventsContext as e}from"../context.js";import{closeFlowSession as t,openFlowSession as n,publishEvent as r}from"../publish.js";import{use as i,useEffect as a,useRef as o}from"react";function s(t){let n=i(e),r=o(t.metadata);r.current=t.metadata;let s=o(t.state);a(()=>{let e=s.current;s.current=t.state,n&&e!==t.state&&c(n,e,t.state,r.current)})}function c(e,i,a,o){if(i.name===a.name){i.name===`activityDetail`&&a.name===`activityDetail`&&i.ctx.settlementId!==a.ctx.settlementId&&l(e,a);return}i.name===`closed`&&n(e,`activity`,o,{type:`activity.opened`,flow:`activity`,tier:`ui`,payload:{atStep:a.name}}),r(e,{type:`activity.step.changed`,flow:`activity`,tier:`ui`,payload:{from:i.name,to:a.name}}),a.name===`activityDetail`&&l(e,a),a.name===`closed`&&t(e,`activity`,{type:`activity.closed`,flow:`activity`,tier:`ui`,payload:{atStep:i.name}})}function l(e,t){r(e,{type:`activity.settlement.selected`,flow:`activity`,tier:`ui`,payload:{settlementId:t.ctx.settlementId,via:t.ctx.viaList?`list`:`direct`}})}export{s as useActivityEmissions};
|
package/dist/events/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { FlowIdKey } from "./bus/flowIdRegistry.js";
|
|
2
2
|
import { useCurrentFlowId } from "./hooks/useCurrentFlowId.js";
|
|
3
3
|
import { FailureCode, FailurePayloadBase, StridgeEventBase, StridgeEventFlow, StridgeEventTier } from "./types/envelope.js";
|
|
4
|
+
import { ActivityClosedEvent, ActivityEvent, ActivityOpenedEvent, ActivitySelectionVia, ActivitySettlementSelectedEvent, ActivityStepChangedEvent, ActivityUiEvent } from "./types/activity.js";
|
|
4
5
|
import { DepositAmountChangedEvent, DepositAmountSubmittedEvent, DepositAssetClickedEvent, DepositBackClickedEvent, DepositCancelPhase, DepositCancelledEvent, DepositClosedEvent, DepositConfirmClickedEvent, DepositEvent, DepositFlowEvent, DepositMaxClickedEvent, DepositMethodClickedEvent, DepositOpenedEvent, DepositQuoteExpiredEvent, DepositQuoteFailedEvent, DepositQuoteRequestInput, DepositQuoteRequestedEvent, DepositQuoteResolvedEvent, DepositSettlementFailedEvent, DepositSettlementFailurePayload, DepositSettlementProgressedEvent, DepositSettlementResumedEvent, DepositSettlementSucceededEvent, DepositStepChangedEvent, DepositSubmissionBroadcastEvent, DepositSubmissionConfirmedEvent, DepositSubmissionDeclinedEvent, DepositSubmissionFailedEvent, DepositTransferAddressCopiedEvent, DepositTransferChainChangedEvent, DepositTransferTokenChangedEvent, DepositUiEvent } from "./types/deposit.js";
|
|
5
6
|
import { KitEvent, KitSupportClickedEvent, KitTermsClickedEvent } from "./types/kit.js";
|
|
6
7
|
import { WithdrawAmountChangedEvent, WithdrawBreakdownClickedEvent, WithdrawCancelPhase, WithdrawCancelledEvent, WithdrawClosedEvent, WithdrawEvent, WithdrawFlowEvent, WithdrawMaxClickedEvent, WithdrawOpenedEvent, WithdrawQuoteExpiredEvent, WithdrawQuoteFailedEvent, WithdrawQuoteRequestedEvent, WithdrawQuoteResolvedEvent, WithdrawReceiveChainChangedEvent, WithdrawReceiveTokenChangedEvent, WithdrawRecipientChangedEvent, WithdrawSettlementFailedEvent, WithdrawSettlementFailurePayload, WithdrawSettlementProgressedEvent, WithdrawSettlementSucceededEvent, WithdrawStepChangedEvent, WithdrawSubmissionBroadcastEvent, WithdrawSubmissionConfirmedEvent, WithdrawSubmissionDeclinedEvent, WithdrawSubmissionFailedEvent, WithdrawSubmitClickedEvent, WithdrawUiEvent } from "./types/withdraw.js";
|
|
@@ -11,4 +12,4 @@ import { PublicStridgeEventBus, useStridgeEventBus } from "./hooks/useStridgeEve
|
|
|
11
12
|
import { useStridgeEvents } from "./hooks/useStridgeEvents.js";
|
|
12
13
|
import { useStridgeFlowEvent } from "./hooks/useStridgeFlowEvent.js";
|
|
13
14
|
import { useStridgeFlowEvents } from "./hooks/useStridgeFlowEvents.js";
|
|
14
|
-
export { type DepositAmountChangedEvent, type DepositAmountSubmittedEvent, type DepositAssetClickedEvent, type DepositBackClickedEvent, type DepositCancelPhase, type DepositCancelledEvent, type DepositClosedEvent, type DepositConfirmClickedEvent, type DepositEvent, type DepositFlowEvent, type DepositMaxClickedEvent, type DepositMethodClickedEvent, type DepositOpenedEvent, type DepositQuoteExpiredEvent, type DepositQuoteFailedEvent, type DepositQuoteRequestInput, type DepositQuoteRequestedEvent, type DepositQuoteResolvedEvent, type DepositSettlementFailedEvent, type DepositSettlementFailurePayload, type DepositSettlementProgressedEvent, type DepositSettlementResumedEvent, type DepositSettlementSucceededEvent, type DepositStepChangedEvent, type DepositSubmissionBroadcastEvent, type DepositSubmissionConfirmedEvent, type DepositSubmissionDeclinedEvent, type DepositSubmissionFailedEvent, type DepositTransferAddressCopiedEvent, type DepositTransferChainChangedEvent, type DepositTransferTokenChangedEvent, type DepositUiEvent, type EventHandler, type FailureCode, type FailurePayloadBase, type FlowEvent, type FlowEventType, type FlowIdKey, type KitEvent, type KitSupportClickedEvent, type KitTermsClickedEvent, type PublicStridgeEventBus, type StridgeEvent, type StridgeEventBase, type StridgeEventFlow, type StridgeEventTier, type StridgeEventType, type UiEvent, type UiEventType, type WithdrawAmountChangedEvent, type WithdrawBreakdownClickedEvent, type WithdrawCancelPhase, type WithdrawCancelledEvent, type WithdrawClosedEvent, type WithdrawEvent, type WithdrawFlowEvent, type WithdrawMaxClickedEvent, type WithdrawOpenedEvent, type WithdrawQuoteExpiredEvent, type WithdrawQuoteFailedEvent, type WithdrawQuoteRequestedEvent, type WithdrawQuoteResolvedEvent, type WithdrawReceiveChainChangedEvent, type WithdrawReceiveTokenChangedEvent, type WithdrawRecipientChangedEvent, type WithdrawSettlementFailedEvent, type WithdrawSettlementFailurePayload, type WithdrawSettlementProgressedEvent, type WithdrawSettlementSucceededEvent, type WithdrawStepChangedEvent, type WithdrawSubmissionBroadcastEvent, type WithdrawSubmissionConfirmedEvent, type WithdrawSubmissionDeclinedEvent, type WithdrawSubmissionFailedEvent, type WithdrawSubmitClickedEvent, type WithdrawUiEvent, useCurrentFlowId, useStridgeEvent, useStridgeEventBus, useStridgeEvents, useStridgeFlowEvent, useStridgeFlowEvents };
|
|
15
|
+
export { type ActivityClosedEvent, type ActivityEvent, type ActivityOpenedEvent, type ActivitySelectionVia, type ActivitySettlementSelectedEvent, type ActivityStepChangedEvent, type ActivityUiEvent, type DepositAmountChangedEvent, type DepositAmountSubmittedEvent, type DepositAssetClickedEvent, type DepositBackClickedEvent, type DepositCancelPhase, type DepositCancelledEvent, type DepositClosedEvent, type DepositConfirmClickedEvent, type DepositEvent, type DepositFlowEvent, type DepositMaxClickedEvent, type DepositMethodClickedEvent, type DepositOpenedEvent, type DepositQuoteExpiredEvent, type DepositQuoteFailedEvent, type DepositQuoteRequestInput, type DepositQuoteRequestedEvent, type DepositQuoteResolvedEvent, type DepositSettlementFailedEvent, type DepositSettlementFailurePayload, type DepositSettlementProgressedEvent, type DepositSettlementResumedEvent, type DepositSettlementSucceededEvent, type DepositStepChangedEvent, type DepositSubmissionBroadcastEvent, type DepositSubmissionConfirmedEvent, type DepositSubmissionDeclinedEvent, type DepositSubmissionFailedEvent, type DepositTransferAddressCopiedEvent, type DepositTransferChainChangedEvent, type DepositTransferTokenChangedEvent, type DepositUiEvent, type EventHandler, type FailureCode, type FailurePayloadBase, type FlowEvent, type FlowEventType, type FlowIdKey, type KitEvent, type KitSupportClickedEvent, type KitTermsClickedEvent, type PublicStridgeEventBus, type StridgeEvent, type StridgeEventBase, type StridgeEventFlow, type StridgeEventTier, type StridgeEventType, type UiEvent, type UiEventType, type WithdrawAmountChangedEvent, type WithdrawBreakdownClickedEvent, type WithdrawCancelPhase, type WithdrawCancelledEvent, type WithdrawClosedEvent, type WithdrawEvent, type WithdrawFlowEvent, type WithdrawMaxClickedEvent, type WithdrawOpenedEvent, type WithdrawQuoteExpiredEvent, type WithdrawQuoteFailedEvent, type WithdrawQuoteRequestedEvent, type WithdrawQuoteResolvedEvent, type WithdrawReceiveChainChangedEvent, type WithdrawReceiveTokenChangedEvent, type WithdrawRecipientChangedEvent, type WithdrawSettlementFailedEvent, type WithdrawSettlementFailurePayload, type WithdrawSettlementProgressedEvent, type WithdrawSettlementSucceededEvent, type WithdrawStepChangedEvent, type WithdrawSubmissionBroadcastEvent, type WithdrawSubmissionConfirmedEvent, type WithdrawSubmissionDeclinedEvent, type WithdrawSubmissionFailedEvent, type WithdrawSubmitClickedEvent, type WithdrawUiEvent, useCurrentFlowId, useStridgeEvent, useStridgeEventBus, useStridgeEvents, useStridgeFlowEvent, useStridgeFlowEvents };
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { ActivityStateName } from "../../flows/activity/orchestrator/types.js";
|
|
2
|
+
import { StridgeEventBase } from "./envelope.js";
|
|
3
|
+
|
|
4
|
+
//#region src/events/types/activity.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* How the user reached a settlement detail view. `"list"` — tapped a row on the activity list.
|
|
7
|
+
* `"direct"` — entered the detail imperatively via `useActivity().open({ settlementId })` /
|
|
8
|
+
* `open({ txHash })`, without an intervening list (URL deep-link, push-notification handler).
|
|
9
|
+
*/
|
|
10
|
+
type ActivitySelectionVia = "list" | "direct";
|
|
11
|
+
/**
|
|
12
|
+
* Activity surface transitioned from `closed` to an open step. Mints the `flowId` and snapshots
|
|
13
|
+
* `metadata`. `payload.atStep` is the step it opened on — `"activityList"` for `open()`,
|
|
14
|
+
* `"activityDetail"` for a resolved direct-entry (`open({ settlementId })`).
|
|
15
|
+
*/
|
|
16
|
+
type ActivityOpenedEvent = StridgeEventBase<"activity.opened", "activity", "ui", {
|
|
17
|
+
atStep: ActivityStateName;
|
|
18
|
+
}>;
|
|
19
|
+
/**
|
|
20
|
+
* Activity surface returned to `closed`. `payload.atStep` is the step it was on at close time.
|
|
21
|
+
* Terminal event for the activity session — the `flowId` is retired after this fires.
|
|
22
|
+
*/
|
|
23
|
+
type ActivityClosedEvent = StridgeEventBase<"activity.closed", "activity", "ui", {
|
|
24
|
+
atStep: ActivityStateName;
|
|
25
|
+
}>;
|
|
26
|
+
/**
|
|
27
|
+
* Logical step transition within the activity surface (list ↔ detail, including back-presses).
|
|
28
|
+
* Brackets the session with the `closed` pseudo-step on open / close, mirroring
|
|
29
|
+
* `deposit.step.changed` / `withdraw.step.changed`. Same-step `ctx` shifts don't fire this.
|
|
30
|
+
*/
|
|
31
|
+
type ActivityStepChangedEvent = StridgeEventBase<"activity.step.changed", "activity", "ui", {
|
|
32
|
+
from: ActivityStateName;
|
|
33
|
+
to: ActivityStateName;
|
|
34
|
+
}>;
|
|
35
|
+
/**
|
|
36
|
+
* User opened a settlement's detail view — by tapping a list row (`via: "list"`) or by
|
|
37
|
+
* imperative direct-entry (`via: "direct"`). Fires on every entry into `activityDetail`,
|
|
38
|
+
* including a pivot from one settlement's detail straight to another's.
|
|
39
|
+
*/
|
|
40
|
+
type ActivitySettlementSelectedEvent = StridgeEventBase<"activity.settlement.selected", "activity", "ui", {
|
|
41
|
+
settlementId: string;
|
|
42
|
+
via: ActivitySelectionVia;
|
|
43
|
+
}>;
|
|
44
|
+
/** Union of every `activity.*` `ui:*` event. */
|
|
45
|
+
type ActivityUiEvent = ActivityOpenedEvent | ActivityClosedEvent | ActivityStepChangedEvent | ActivitySettlementSelectedEvent;
|
|
46
|
+
/**
|
|
47
|
+
* Union of every `activity.*` event regardless of tier. Activity is UI-only today, so this
|
|
48
|
+
* equals {@link ActivityUiEvent} — the alias is kept for symmetry with `DepositEvent` /
|
|
49
|
+
* `WithdrawEvent` and so a future flow-tier variant has a home.
|
|
50
|
+
*/
|
|
51
|
+
type ActivityEvent = ActivityUiEvent;
|
|
52
|
+
//#endregion
|
|
53
|
+
export { ActivityClosedEvent, ActivityEvent, ActivityOpenedEvent, ActivitySelectionVia, ActivitySettlementSelectedEvent, ActivityStepChangedEvent, ActivityUiEvent };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { SettlementFailureKind, TxRef } from "../../shared/driver/types.js";
|
|
2
2
|
import { BalanceItemPayload, QuotePayload, SettlementPendingPayload, SettlementSuccessPayload } from "../../flows/deposit/driver/payloads.js";
|
|
3
3
|
import { DepositMethod, DepositStateName, ResolvedOpenInput } from "../../flows/deposit/orchestrator/types.js";
|
|
4
|
-
import { TransferCryptoChain, TransferCryptoToken } from "../../flows/deposit/widgets/transfer-crypto/compound/types.js";
|
|
5
4
|
import { FailurePayloadBase, StridgeEventBase } from "./envelope.js";
|
|
5
|
+
import { TransferCryptoChain, TransferCryptoToken } from "../../flows/deposit/widgets/transfer-crypto/compound/types.js";
|
|
6
6
|
|
|
7
7
|
//#region src/events/types/deposit.d.ts
|
|
8
8
|
/**
|
|
@@ -47,9 +47,9 @@
|
|
|
47
47
|
* - `timestamp` — `Date.now()` at emit; wall-clock, not `performance.now()`, because
|
|
48
48
|
* consumers want it for logging/funnels.
|
|
49
49
|
* - `flowId` — session correlation id. Minted at `<flow>.opened`, retired after the terminal
|
|
50
|
-
* event (`*.settlement.succeeded` / `*.settlement.failed` / `*.cancelled`
|
|
51
|
-
*
|
|
52
|
-
* context to belong to).
|
|
50
|
+
* event (`*.settlement.succeeded` / `*.settlement.failed` / `*.cancelled`, or `activity.closed`
|
|
51
|
+
* for the read-only activity surface which has no settlement). Always `string` for `flow:*`
|
|
52
|
+
* and `ui:*` events; `null` for `kit:*` events (which have no flow context to belong to).
|
|
53
53
|
* - `payload` — event-specific data, always an object even when single-field, so future
|
|
54
54
|
* fields can be added non-breakingly.
|
|
55
55
|
* - `metadata` — consumer-attached, snapshotted at `<flow>.opened` and frozen for the
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
* bikeshed without paying for itself.
|
|
66
66
|
*/
|
|
67
67
|
/** Flow identifier — one per orchestrator family, plus `"kit"` for flow-less provider events. */
|
|
68
|
-
type StridgeEventFlow = "deposit" | "withdraw" | "kit";
|
|
68
|
+
type StridgeEventFlow = "deposit" | "withdraw" | "activity" | "kit";
|
|
69
69
|
/** Delivery tier — see envelope JSDoc for the rule. */
|
|
70
70
|
type StridgeEventTier = "flow" | "ui";
|
|
71
71
|
/**
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { FailureCode, FailurePayloadBase, StridgeEventBase, StridgeEventFlow, StridgeEventTier } from "./envelope.js";
|
|
2
|
+
import { ActivityClosedEvent, ActivityEvent, ActivityOpenedEvent, ActivitySelectionVia, ActivitySettlementSelectedEvent, ActivityStepChangedEvent, ActivityUiEvent } from "./activity.js";
|
|
2
3
|
import { DepositAmountChangedEvent, DepositAmountSubmittedEvent, DepositAssetClickedEvent, DepositBackClickedEvent, DepositCancelPhase, DepositCancelledEvent, DepositClosedEvent, DepositConfirmClickedEvent, DepositEvent, DepositFlowEvent, DepositMaxClickedEvent, DepositMethodClickedEvent, DepositOpenedEvent, DepositQuoteExpiredEvent, DepositQuoteFailedEvent, DepositQuoteRequestInput, DepositQuoteRequestedEvent, DepositQuoteResolvedEvent, DepositSettlementFailedEvent, DepositSettlementFailurePayload, DepositSettlementProgressedEvent, DepositSettlementResumedEvent, DepositSettlementSucceededEvent, DepositStepChangedEvent, DepositSubmissionBroadcastEvent, DepositSubmissionConfirmedEvent, DepositSubmissionDeclinedEvent, DepositSubmissionFailedEvent, DepositTransferAddressCopiedEvent, DepositTransferChainChangedEvent, DepositTransferTokenChangedEvent, DepositUiEvent } from "./deposit.js";
|
|
3
4
|
import { KitEvent, KitSupportClickedEvent, KitTermsClickedEvent } from "./kit.js";
|
|
4
5
|
import { WithdrawAmountChangedEvent, WithdrawBreakdownClickedEvent, WithdrawCancelPhase, WithdrawCancelledEvent, WithdrawClosedEvent, WithdrawEvent, WithdrawFlowEvent, WithdrawMaxClickedEvent, WithdrawOpenedEvent, WithdrawQuoteExpiredEvent, WithdrawQuoteFailedEvent, WithdrawQuoteRequestedEvent, WithdrawQuoteResolvedEvent, WithdrawReceiveChainChangedEvent, WithdrawReceiveTokenChangedEvent, WithdrawRecipientChangedEvent, WithdrawSettlementFailedEvent, WithdrawSettlementFailurePayload, WithdrawSettlementProgressedEvent, WithdrawSettlementSucceededEvent, WithdrawStepChangedEvent, WithdrawSubmissionBroadcastEvent, WithdrawSubmissionConfirmedEvent, WithdrawSubmissionDeclinedEvent, WithdrawSubmissionFailedEvent, WithdrawSubmitClickedEvent, WithdrawUiEvent } from "./withdraw.js";
|
|
@@ -17,7 +18,7 @@ type FlowEvent = DepositFlowEvent | WithdrawFlowEvent;
|
|
|
17
18
|
* belong to a deposit/withdraw flow). Does NOT include `flow:*` events — for the firehose
|
|
18
19
|
* union, use {@link StridgeEvent}.
|
|
19
20
|
*/
|
|
20
|
-
type UiEvent = DepositUiEvent | WithdrawUiEvent | KitEvent;
|
|
21
|
+
type UiEvent = DepositUiEvent | WithdrawUiEvent | ActivityUiEvent | KitEvent;
|
|
21
22
|
/**
|
|
22
23
|
* Firehose union — every event the kit ever emits. Equivalent to `FlowEvent | UiEvent`.
|
|
23
24
|
* What `useStridgeEvents` hands to its handler.
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Presentation } from "../../../shared/presentation/types.js";
|
|
1
2
|
import { ErrorInfo } from "react";
|
|
2
3
|
import * as _$react_jsx_runtime0 from "react/jsx-runtime";
|
|
3
4
|
|
|
@@ -16,7 +17,9 @@ import * as _$react_jsx_runtime0 from "react/jsx-runtime";
|
|
|
16
17
|
*/
|
|
17
18
|
declare function ActivityDialog({
|
|
18
19
|
container,
|
|
19
|
-
onError
|
|
20
|
+
onError,
|
|
21
|
+
presentation,
|
|
22
|
+
metadata
|
|
20
23
|
}?: ActivityDialog.Props): _$react_jsx_runtime0.JSX.Element;
|
|
21
24
|
declare namespace ActivityDialog {
|
|
22
25
|
interface Props {
|
|
@@ -32,6 +35,20 @@ declare namespace ActivityDialog {
|
|
|
32
35
|
* `useActivity().close()`.
|
|
33
36
|
*/
|
|
34
37
|
onError?: (error: Error, errorInfo: ErrorInfo) => void;
|
|
38
|
+
/**
|
|
39
|
+
* Consumer-attached metadata that rides along on every bus event emitted from this
|
|
40
|
+
* dialog's session. Snapshotted at `activity.opened` and frozen for the session — mid-flow
|
|
41
|
+
* prop changes are ignored to keep correlation consistent. The kit does not validate or
|
|
42
|
+
* normalise the shape. See `@stridge/kit/events`.
|
|
43
|
+
*/
|
|
44
|
+
metadata?: Record<string, unknown>;
|
|
45
|
+
/**
|
|
46
|
+
* Per-dialog surface override. `"auto"` (default) renders a centred dialog on wide
|
|
47
|
+
* containers and a bottom-sheet drawer below the breakpoint; `"dialog"` / `"drawer"`
|
|
48
|
+
* force one surface. Pass `{ mode, breakpoint }` to tune the px threshold (default 600).
|
|
49
|
+
* Wins over the provider's `appearance.presentation`; omit to inherit it.
|
|
50
|
+
*/
|
|
51
|
+
presentation?: Presentation;
|
|
35
52
|
}
|
|
36
53
|
}
|
|
37
54
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{useActivityControllerContext as e}from"../orchestrator/controller.js";import"../orchestrator/index.js";import{
|
|
1
|
+
"use client";import{useActivityControllerContext as e}from"../orchestrator/controller.js";import"../orchestrator/index.js";import{useActivityEmissions as t}from"../../../events/emit/useActivityEmissions.js";import"../../../events/emit/index.js";import{useIntercomShutdownOnUnmount as n}from"../../../shared/support/useIntercomShutdownOnUnmount.js";import"../../../shared/support/index.js";import{AdaptiveSurface as r}from"../../../shared/ui/AdaptiveSurface/AdaptiveSurface.js";import"../../../shared/ui/AdaptiveSurface/index.js";import{ActivityFlow as i}from"../compound/ActivityFlow.js";import"../../../activity/compound/index.js";import{ActivityDetail as a}from"../widgets/ActivityDetail.js";import{ActivityList as o}from"../widgets/ActivityList.js";import"../../../activity/widgets/index.js";import{jsx as s,jsxs as c}from"react/jsx-runtime";function l({container:l,onError:u,presentation:d,metadata:f}={}){let{state:p,controller:m}=e(),h=p.name!==`closed`;return t({state:p,metadata:f}),n(),s(r,{open:h,onOpenChange:e=>{e||m.close()},container:l,...d?{presentation:d}:{},children:s(i.Boundary,{...u?{onError:u}:{},children:c(i.Steps,{children:[s(i.Step,{name:`activityList`,children:s(o,{})}),s(i.Step,{name:`activityDetail`,children:s(a,{})})]})})})}export{l as ActivityDialog};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Presentation } from "../../../shared/presentation/types.js";
|
|
1
2
|
import { ErrorInfo } from "react";
|
|
2
3
|
import * as _$react_jsx_runtime0 from "react/jsx-runtime";
|
|
3
4
|
|
|
@@ -22,7 +23,8 @@ import * as _$react_jsx_runtime0 from "react/jsx-runtime";
|
|
|
22
23
|
declare function DepositDialog({
|
|
23
24
|
container,
|
|
24
25
|
metadata,
|
|
25
|
-
onError
|
|
26
|
+
onError,
|
|
27
|
+
presentation
|
|
26
28
|
}?: DepositDialog.Props): _$react_jsx_runtime0.JSX.Element;
|
|
27
29
|
declare namespace DepositDialog {
|
|
28
30
|
interface Props {
|
|
@@ -44,6 +46,13 @@ declare namespace DepositDialog {
|
|
|
44
46
|
* boundary's `onReset` is wired automatically through `useDeposit().close()`.
|
|
45
47
|
*/
|
|
46
48
|
onError?: (error: Error, errorInfo: ErrorInfo) => void;
|
|
49
|
+
/**
|
|
50
|
+
* Per-dialog surface override. `"auto"` (default) renders a centred dialog on wide
|
|
51
|
+
* containers and a bottom-sheet drawer below the breakpoint; `"dialog"` / `"drawer"`
|
|
52
|
+
* force one surface. Pass `{ mode, breakpoint }` to tune the px threshold (default 600).
|
|
53
|
+
* Wins over the provider's `appearance.presentation`; omit to inherit it.
|
|
54
|
+
*/
|
|
55
|
+
presentation?: Presentation;
|
|
47
56
|
}
|
|
48
57
|
}
|
|
49
58
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{useDepositSnapshot as e}from"../driver/context.js";import{useControllerContext as t}from"../orchestrator/controller.js";import{useDepositEmissions as n}from"../../../events/emit/useDepositEmissions.js";import"../../../events/emit/index.js";import{useIntercomShutdownOnUnmount as r}from"../../../shared/support/useIntercomShutdownOnUnmount.js";import"../../../shared/support/index.js";import{
|
|
1
|
+
"use client";import{useDepositSnapshot as e}from"../driver/context.js";import{useControllerContext as t}from"../orchestrator/controller.js";import{useDepositEmissions as n}from"../../../events/emit/useDepositEmissions.js";import"../../../events/emit/index.js";import{useIntercomShutdownOnUnmount as r}from"../../../shared/support/useIntercomShutdownOnUnmount.js";import"../../../shared/support/index.js";import{AdaptiveSurface as i}from"../../../shared/ui/AdaptiveSurface/AdaptiveSurface.js";import"../../../shared/ui/AdaptiveSurface/index.js";import{Deposit as a}from"../widgets/deposit/compound/Deposit.js";import"../widgets/deposit/compound/index.js";import{DepositActivityDetail as o}from"../widgets/activity/DepositActivityDetail.js";import{DepositActivityList as s}from"../widgets/activity/DepositActivityList.js";import"../widgets/activity/index.js";import{AmountEntry as c}from"../widgets/amount-entry/AmountEntry.js";import"../widgets/amount-entry/index.js";import{AssetPicker as l}from"../widgets/asset-picker/AssetPicker.js";import"../widgets/asset-picker/index.js";import{ConfirmDeposit as u}from"../widgets/confirm-deposit/ConfirmDeposit.js";import"../widgets/confirm-deposit/index.js";import{Deposit as d}from"../widgets/deposit/Deposit.js";import"../widgets/deposit/index.js";import{DepositStatusBanner as f}from"../widgets/deposit-status-banner/DepositStatusBanner.js";import"../widgets/deposit-status-banner/index.js";import{ErrorState as p}from"../widgets/error-state/ErrorState.js";import"../widgets/error-state/index.js";import{ProcessingState as m}from"../widgets/processing-state/ProcessingState.js";import"../widgets/processing-state/index.js";import{SuccessState as h}from"../widgets/success-state/SuccessState.js";import"../widgets/success-state/index.js";import{TransferCrypto as g}from"../widgets/transfer-crypto/TransferCrypto.js";import"../widgets/transfer-crypto/index.js";import{jsx as _,jsxs as v}from"react/jsx-runtime";function y({container:y,metadata:b,onError:x,presentation:S}={}){let{state:C,controller:w}=t(),T=e(),E=C.name!==`closed`;return n({state:C,settlement:T.settlement,quote:T.quote,metadata:b}),r(),_(i,{open:E,onOpenChange:e=>{e||w.close()},container:y,...S?{presentation:S}:{},children:v(a.Boundary,{...x?{onError:x}:{},children:[_(a.Guards,{children:v(a.Steps,{children:[_(a.Step,{name:`deposit`,children:_(d,{})}),_(a.Step,{name:`assetPicker`,children:_(l,{})}),_(a.Step,{name:`amountEntry`,children:_(c,{})}),_(a.Step,{name:`confirmDeposit`,children:_(u,{})}),_(a.Step,{name:`transferCrypto`,children:_(g,{})}),_(a.Step,{name:`processing`,children:_(m,{})}),_(a.Step,{name:`success`,children:_(h,{})}),_(a.Step,{name:`error`,children:_(p,{})}),_(a.Step,{name:`activityList`,children:_(s,{})}),_(a.Step,{name:`activityDetail`,children:_(o,{})})]})}),_(f,{})]})})}export{y as DepositDialog};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Presentation } from "../../../shared/presentation/types.js";
|
|
1
2
|
import { WithdrawSubmitCallback } from "../orchestrator/types.js";
|
|
2
3
|
import { WithdrawBalanceInput, WithdrawSuggestedRecipient } from "../bindings/WithdrawBindings.js";
|
|
3
4
|
import { ErrorInfo } from "react";
|
|
@@ -23,7 +24,8 @@ declare function WithdrawDialog({
|
|
|
23
24
|
onError,
|
|
24
25
|
balance,
|
|
25
26
|
onSubmit,
|
|
26
|
-
suggestedRecipient
|
|
27
|
+
suggestedRecipient,
|
|
28
|
+
presentation
|
|
27
29
|
}?: WithdrawDialog.Props): _$react_jsx_runtime0.JSX.Element;
|
|
28
30
|
declare namespace WithdrawDialog {
|
|
29
31
|
interface Props {
|
|
@@ -61,6 +63,13 @@ declare namespace WithdrawDialog {
|
|
|
61
63
|
* explicit address you trust the user wants to fill with. Omit to hide the chip.
|
|
62
64
|
*/
|
|
63
65
|
suggestedRecipient?: WithdrawSuggestedRecipient;
|
|
66
|
+
/**
|
|
67
|
+
* Per-dialog surface override. `"auto"` (default) renders a centred dialog on wide
|
|
68
|
+
* containers and a bottom-sheet drawer below the breakpoint; `"dialog"` / `"drawer"`
|
|
69
|
+
* force one surface. Pass `{ mode, breakpoint }` to tune the px threshold (default 600).
|
|
70
|
+
* Wins over the provider's `appearance.presentation`; omit to inherit it.
|
|
71
|
+
*/
|
|
72
|
+
presentation?: Presentation;
|
|
64
73
|
}
|
|
65
74
|
}
|
|
66
75
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{useWithdrawBindings as e}from"../bindings/WithdrawBindings.js";import"../bindings/index.js";import{useWithdrawSnapshot as t}from"../driver/context.js";import{useWithdrawState as n}from"../orchestrator/controller.js";import{useWithdraw as r}from"../orchestrator/useWithdraw.js";import"../orchestrator/index.js";import{useWithdrawEmissions as i}from"../../../events/emit/useWithdrawEmissions.js";import"../../../events/emit/index.js";import{useIntercomShutdownOnUnmount as a}from"../../../shared/support/useIntercomShutdownOnUnmount.js";import"../../../shared/support/index.js";import{
|
|
1
|
+
"use client";import{useWithdrawBindings as e}from"../bindings/WithdrawBindings.js";import"../bindings/index.js";import{useWithdrawSnapshot as t}from"../driver/context.js";import{useWithdrawState as n}from"../orchestrator/controller.js";import{useWithdraw as r}from"../orchestrator/useWithdraw.js";import"../orchestrator/index.js";import{useWithdrawEmissions as i}from"../../../events/emit/useWithdrawEmissions.js";import"../../../events/emit/index.js";import{useIntercomShutdownOnUnmount as a}from"../../../shared/support/useIntercomShutdownOnUnmount.js";import"../../../shared/support/index.js";import{AdaptiveSurface as o}from"../../../shared/ui/AdaptiveSurface/AdaptiveSurface.js";import"../../../shared/ui/AdaptiveSurface/index.js";import{Withdraw as s}from"../widgets/withdraw/compound/Withdraw.js";import"../../../withdraw/compound/index.js";import{WithdrawActivityDetail as c}from"../widgets/activity/WithdrawActivityDetail.js";import{WithdrawActivityList as l}from"../widgets/activity/WithdrawActivityList.js";import{WithdrawError as u}from"../widgets/withdraw-error/WithdrawError.js";import{WithdrawForm as d}from"../widgets/withdraw-form/WithdrawForm.js";import{WithdrawInProgress as f}from"../widgets/withdraw-in-progress/WithdrawInProgress.js";import{WithdrawSuccess as p}from"../widgets/withdraw-success/WithdrawSuccess.js";import"../../../withdraw/widgets/index.js";import{jsx as m,jsxs as h}from"react/jsx-runtime";function g({container:g,metadata:_,onError:v,balance:y,onSubmit:b,suggestedRecipient:x,presentation:S}={}){let C=n(),{close:w}=r(),T=t(),E=C.name!==`closed`;return i({state:C,settlement:T.settlement,quote:T.quote,metadata:_}),a(),e({...y===void 0?{}:{balance:y},...b?{onSubmit:b}:{},...x?{suggestedRecipient:x}:{}}),m(o,{open:E,onOpenChange:e=>e?void 0:w(),container:g,...S?{presentation:S}:{},children:m(s.Boundary,{...v?{onError:v}:{},children:m(s.Guards,{children:h(s.Steps,{children:[m(s.Step,{name:`form`,children:m(d,{})}),m(s.Step,{name:`inProgress`,children:m(f,{})}),m(s.Step,{name:`success`,children:m(p,{})}),m(s.Step,{name:`error`,children:m(u,{})}),m(s.Step,{name:`activityList`,children:m(l,{})}),m(s.Step,{name:`activityDetail`,children:m(c,{})})]})})})})}export{g as WithdrawDialog};
|
package/dist/index.d.ts
CHANGED
|
@@ -22,6 +22,7 @@ import { useActivitySnapshot } from "./flows/activity/driver/context.js";
|
|
|
22
22
|
import { StridgeEnvironment } from "./drivers/stridge/types.js";
|
|
23
23
|
import { FlowIdKey } from "./events/bus/flowIdRegistry.js";
|
|
24
24
|
import { useCurrentFlowId } from "./events/hooks/useCurrentFlowId.js";
|
|
25
|
+
import { ActivityActions, ActivityController, ActivityState, ActivityStateName } from "./flows/activity/orchestrator/types.js";
|
|
25
26
|
import { WithdrawActions, WithdrawController, WithdrawState, WithdrawStateName, WithdrawSubmitActions, WithdrawSubmitCallback, WithdrawSubmitInput, WithdrawalFormSnapshot } from "./flows/withdraw/orchestrator/types.js";
|
|
26
27
|
import { FlowEvent, StridgeEvent, UiEvent } from "./events/types/index.js";
|
|
27
28
|
import { useStridgeEvent } from "./events/hooks/useStridgeEvent.js";
|
|
@@ -29,7 +30,6 @@ import { PublicStridgeEventBus, useStridgeEventBus } from "./events/hooks/useStr
|
|
|
29
30
|
import { useStridgeEvents } from "./events/hooks/useStridgeEvents.js";
|
|
30
31
|
import { useStridgeFlowEvent } from "./events/hooks/useStridgeFlowEvent.js";
|
|
31
32
|
import { useStridgeFlowEvents } from "./events/hooks/useStridgeFlowEvents.js";
|
|
32
|
-
import { ActivityActions, ActivityController, ActivityState, ActivityStateName } from "./flows/activity/orchestrator/types.js";
|
|
33
33
|
import { useActivityState } from "./flows/activity/orchestrator/controller.js";
|
|
34
34
|
import { useActivity, useOptionalActivity, useOptionalPrefetchActivity, usePrefetchActivity } from "./flows/activity/orchestrator/useActivity.js";
|
|
35
35
|
import { WithdrawBalanceInput, WithdrawBindings, WithdrawSuggestedRecipient, useWithdrawBindings } from "./flows/withdraw/bindings/WithdrawBindings.js";
|
package/dist/package.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var e=`0.1.0-alpha.
|
|
1
|
+
var e=`0.1.0-alpha.55`;export{e as version};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Presentation } from "../presentation/types.js";
|
|
1
2
|
import { ReactElement, ReactNode } from "react";
|
|
2
3
|
import * as _$react_jsx_runtime0 from "react/jsx-runtime";
|
|
3
4
|
|
|
@@ -22,18 +23,30 @@ interface DialogShellControls {
|
|
|
22
23
|
}
|
|
23
24
|
interface DialogShellProps extends DialogShellControls {
|
|
24
25
|
/**
|
|
25
|
-
*
|
|
26
|
-
*
|
|
26
|
+
* Element the surface portals into. Defaults to `document.body`. Doubles as the measured
|
|
27
|
+
* containing block for `"auto"` presentation — the dialog-vs-drawer breakpoint is measured
|
|
28
|
+
* against this element's width when supplied, else the viewport.
|
|
29
|
+
*/
|
|
30
|
+
container?: HTMLElement | null;
|
|
31
|
+
/**
|
|
32
|
+
* Surface override forwarded to {@link AdaptiveSurface}. Falls back to the provider's
|
|
33
|
+
* `appearance.presentation`, then `"auto"`. Omit to inherit the provider default.
|
|
34
|
+
*/
|
|
35
|
+
presentation?: Presentation;
|
|
36
|
+
/**
|
|
37
|
+
* Widget JSX rendered inside the surface. Each widget detects the
|
|
38
|
+
* surface context and swaps to its bare frame, so the same
|
|
27
39
|
* composition that works inline as `Card variant="frame"` paints
|
|
28
40
|
* the same surface chrome here.
|
|
29
41
|
*/
|
|
30
42
|
children?: ReactNode;
|
|
31
43
|
}
|
|
32
44
|
/**
|
|
33
|
-
* Pre-composed dialog shell for a kit widget. Wraps
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
45
|
+
* Pre-composed dialog shell for a kit widget. Wraps {@link AdaptiveSurface}
|
|
46
|
+
* so consumers don't re-stitch the surface primitives every time they want
|
|
47
|
+
* to open a widget in a modal. The surface is responsive — a centred dialog
|
|
48
|
+
* on wide containers, a bottom-sheet drawer below the breakpoint — and the
|
|
49
|
+
* widget renders its bare frame inside either via the shared surface context.
|
|
37
50
|
*
|
|
38
51
|
* Each widget also exposes a typed `.Dialog` form (`Deposit.Dialog`,
|
|
39
52
|
* `AssetPicker.Dialog`, …) that wraps this shell and forwards the
|
|
@@ -57,6 +70,8 @@ declare function DialogShell({
|
|
|
57
70
|
defaultOpen,
|
|
58
71
|
onOpenChange,
|
|
59
72
|
trigger,
|
|
73
|
+
container,
|
|
74
|
+
presentation,
|
|
60
75
|
children
|
|
61
76
|
}: DialogShellProps): _$react_jsx_runtime0.JSX.Element;
|
|
62
77
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{
|
|
1
|
+
"use client";import{AdaptiveSurface as e}from"../ui/AdaptiveSurface/AdaptiveSurface.js";import"../ui/AdaptiveSurface/index.js";import{jsx as t}from"react/jsx-runtime";function n({open:n,defaultOpen:r,onOpenChange:i,trigger:a,container:o,presentation:s,children:c}){return t(e,{open:n,defaultOpen:r,onOpenChange:i,...a?{trigger:a}:{},container:o,...s?{presentation:s}:{},children:c})}export{n as DialogShell};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{useEffect as e,useLayoutEffect as t,useRef as n}from"react";import{jsx as r}from"react/jsx-runtime";import{AnimatePresence as i,m as a}from"motion/react";const o=[.3,0,.06,1],s={enter:e=>({opacity:0,x:e>=0?16:-16,filter:`blur(6px)`}),center:{opacity:1,x:0,filter:`blur(0px)`,transition:{duration:.22,delay:.12,ease:o}},exit:e=>({opacity:0,x:e>=0?-16:16,filter:`blur(6px)`,transition:{duration:.14,ease:o}})};function c({stateKey:o,children:c}){let l=n([]),u=n(null),d=l.current,f=d[d.length-1],p=0;o!==f&&(p=d.indexOf(o)>=0?-1:1);let m=n(null),h=n(o),g=n(null),_=n(null);return e(()=>{let e=l.current;if(e[e.length-1]===o)return;let t=e.indexOf(o);l.current=t>=0?e.slice(0,t+1):[...e,o]},[o]),t(()=>{let e=u.current;if(!e)return;let t=e.getBoundingClientRect().height;if(h.current===o){m.current=
|
|
1
|
+
"use client";import{useEffect as e,useLayoutEffect as t,useRef as n}from"react";import{jsx as r}from"react/jsx-runtime";import{AnimatePresence as i,m as a}from"motion/react";const o=[.3,0,.06,1],s={enter:e=>({opacity:0,x:e>=0?16:-16,filter:`blur(6px)`}),center:{opacity:1,x:0,filter:`blur(0px)`,transition:{duration:.22,delay:.12,ease:o}},exit:e=>({opacity:0,x:e>=0?-16:16,filter:`blur(6px)`,transition:{duration:.14,ease:o}})};function c({stateKey:o,children:c}){let l=n([]),u=n(null),d=l.current,f=d[d.length-1],p=0;o!==f&&(p=d.indexOf(o)>=0?-1:1);let m=n(null),h=n(o),g=n(null),_=n(null);return e(()=>{let e=l.current;if(e[e.length-1]===o)return;let t=e.indexOf(o);l.current=t>=0?e.slice(0,t+1):[...e,o]},[o]),t(()=>{let e=u.current;if(!e)return;let t=Array.from(e.children).find(e=>e instanceof HTMLElement&&getComputedStyle(e).position!==`absolute`),n=t?t.scrollHeight:e.getBoundingClientRect().height;if(h.current===o){m.current=n;return}let r=m.current;if(h.current=o,m.current=n,r===null||r===n||document.visibilityState===`hidden`)return;let i=e.style.transition;e.style.transition=`none`,e.style.height=`${r}px`,e.offsetHeight,e.style.transition=i,_.current!==null&&window.cancelAnimationFrame(_.current),_.current=window.requestAnimationFrame(()=>{_.current=null,u.current&&(u.current.style.height=`${n}px`)}),g.current!==null&&window.clearTimeout(g.current),g.current=window.setTimeout(()=>{g.current=null;let e=u.current;e&&(e.style.height=``)},320)}),e(()=>{let e=()=>{if(document.visibilityState!==`hidden`)return;_.current!==null&&(window.cancelAnimationFrame(_.current),_.current=null),g.current!==null&&(window.clearTimeout(g.current),g.current=null);let e=u.current;e&&(e.style.height=``)};return document.addEventListener(`visibilitychange`,e),()=>{document.removeEventListener(`visibilitychange`,e),g.current!==null&&(window.clearTimeout(g.current),g.current=null),_.current!==null&&(window.cancelAnimationFrame(_.current),_.current=null)}},[]),r(`div`,{ref:u,style:{position:`relative`,overflow:`hidden`,transition:`height 260ms cubic-bezier(0.3, 0, 0.06, 1)`,flex:`0 1 auto`,minHeight:0,display:`flex`,flexDirection:`column`},children:r(i,{mode:`popLayout`,custom:p,initial:!1,children:r(a.div,{custom:p,variants:s,initial:`enter`,animate:`center`,exit:`exit`,tabIndex:-1,style:{display:`flex`,flexDirection:`column`,flex:`1 1 auto`,minHeight:0,outline:`none`},children:c},o)})})}export{c as StepTransition};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{resolvePresentation as e}from"./types.js";import{useEffect as t,useLayoutEffect as n,useState as r}from"react";const i=typeof window>`u`?t:n;function a(e){
|
|
1
|
+
"use client";import{resolvePresentation as e}from"./types.js";import{useEffect as t,useLayoutEffect as n,useState as r}from"react";const i=typeof window>`u`?t:n;function a(e){if(typeof window>`u`)return null;let t=e?e.getBoundingClientRect().width:document.documentElement.clientWidth;return t>0?t:null}function o({container:t,presentation:n}){let{mode:o,breakpoint:s}=e(n),[c,l]=r(`dialog`);return i(()=>{if(o!==`auto`)return;let e=()=>{let e=a(t);l(e!==null&&e<s?`drawer`:`dialog`)};if(e(),t){if(typeof ResizeObserver>`u`)return;let n=new ResizeObserver(e);return n.observe(t),()=>n.disconnect()}if(!(typeof window>`u`))return window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[o,s,t]),o===`auto`?c:o}export{o as useResolvedSurfaceKind};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{useKitConfig as e}from"../../../scope/context.js";import{
|
|
1
|
+
"use client";import{useKitConfig as e}from"../../../scope/context.js";import{useResolvedSurfaceKind as t}from"../../presentation/useResolvedSurfaceKind.js";import"../../presentation/index.js";import{Dialog as n}from"../Dialog/Dialog.js";import"../Dialog/index.js";import{Drawer as r}from"../Drawer/Drawer.js";import"../Drawer/index.js";import{jsx as i,jsxs as a}from"react/jsx-runtime";function o({open:o,defaultOpen:s,onOpenChange:c,trigger:l,container:u,presentation:d,children:f}){let p=e();return t({container:u,presentation:d??p.presentation})===`drawer`?a(r,{open:o,defaultOpen:s,onOpenChange:c,children:[l?i(r.Trigger,{render:l}):null,i(r.Content,{container:u,children:f})]}):a(n,{open:o,defaultOpen:s,onOpenChange:c,children:[l?i(n.Trigger,{render:l}):null,i(n.Content,{container:u,children:f})]})}export{o as AdaptiveSurface};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e={overlay:{"Drawer__styles.overlay":`Drawer__styles.overlay`,"position-kVAEAm":`xixxii4`,"inset-kpwlN0":`x10a8y8t`,"zIndex-kY2c9j":`xg4qres`,"backgroundColor-kWkggS":`xyxldge`,"opacity-kSiTet":`x1hc1fzr`,"transitionProperty-k1ekBW":`x19991ni`,"transitionDuration-kIyJzY":`x1s4mzch`,"transitionTimingFunction-kAMwcw":`x1xv5090`,":is([data-starting-style], [data-ending-style])_opacity-kdD3Bq":`x1i2unn7`,"@media (prefers-reduced-motion: reduce)_transitionProperty-kXHXEI":`x4wkmsb`,"@media (prefers-reduced-motion: reduce)_transitionDuration-k6CgDc":`x12w9bfk`,$$css:`@stridge/kit:src/shared/ui/Drawer/Drawer.styles.ts:9`},viewport:{"Drawer__styles.viewport":`Drawer__styles.viewport`,"position-kVAEAm":`xixxii4`,"insetBlock-kYYq5F":`x10no89f`,"insetInline-kkqhue":`x17y0mx6`,"zIndex-kY2c9j":`x51lqrf`,"display-k1xSpc":`x78zum5`,"flexDirection-kXwgrk":`xdt5ytf`,"justifyContent-kjj79g":`x13a6bvl`,"alignItems-kGNEyG":`
|
|
1
|
+
const e={overlay:{"Drawer__styles.overlay":`Drawer__styles.overlay`,"position-kVAEAm":`xixxii4`,"inset-kpwlN0":`x10a8y8t`,"zIndex-kY2c9j":`xg4qres`,"backgroundColor-kWkggS":`xyxldge`,"opacity-kSiTet":`x1hc1fzr`,"transitionProperty-k1ekBW":`x19991ni`,"transitionDuration-kIyJzY":`x1s4mzch`,"transitionTimingFunction-kAMwcw":`x1xv5090`,":is([data-starting-style], [data-ending-style])_opacity-kdD3Bq":`x1i2unn7`,"@media (prefers-reduced-motion: reduce)_transitionProperty-kXHXEI":`x4wkmsb`,"@media (prefers-reduced-motion: reduce)_transitionDuration-k6CgDc":`x12w9bfk`,$$css:`@stridge/kit:src/shared/ui/Drawer/Drawer.styles.ts:9`},viewport:{"Drawer__styles.viewport":`Drawer__styles.viewport`,"position-kVAEAm":`xixxii4`,"insetBlock-kYYq5F":`x10no89f`,"insetInline-kkqhue":`x17y0mx6`,"zIndex-kY2c9j":`x51lqrf`,"display-k1xSpc":`x78zum5`,"flexDirection-kXwgrk":`xdt5ytf`,"justifyContent-kjj79g":`x13a6bvl`,"alignItems-kGNEyG":`x6s0dn4`,"pointerEvents-kfzvcC":`x47corl`,$$css:`@stridge/kit:src/shared/ui/Drawer/Drawer.styles.ts:34`},content:{"Drawer__styles.content":`Drawer__styles.content`,"pointerEvents-kfzvcC":`x67bb7w`,"display-k1xSpc":`x78zum5`,"flexDirection-kXwgrk":`xdt5ytf`,"width-kzqmXN":`xh8yej3`,"maxWidth-ks0D6T":`x1qvtwti`,"minHeight-kAzted":`x2lwn1j`,"maxHeight-kskxy":`x96tae4`,"borderStartStartRadius-krdFHd":`x8htq0b`,"borderStartEndRadius-kfmiAY":`x1af6ir8`,"borderTopWidth-kEafiO":`x178xt8z`,"borderInlineWidth-kjGldf":`x1l0rsgs`,"borderBottomWidth-kt9PQ7":`x1qhh985`,"borderStyle-ksu8eU":`x1y0btm7`,"borderColor-kVAM5u":`x1aqcfi1`,"backgroundColor-kWkggS":`x3cgcfv`,"color-kMwMTN":`xzn0pkc`,"boxShadow-kGVxlE":`xa2vu2y`,"fontFamily-kMv6JI":`xlaww2m`,"outline-kI3sdo":`x1a2a7pz`,"overflow-kVQacm":`x7giv3`,"transform-k3aq6I":`xacbhai`,"transitionProperty-k1ekBW":`x11xpdln`,"transitionDuration-kIyJzY":`x1s4mzch`,"transitionTimingFunction-kAMwcw":`xr4whw6`,":is([data-starting-style], [data-ending-style])_transform-koVVf4":`xjvuu2i`,"[data-swiping]_transitionDuration-kRUqrN":`xsqp3co`,"@media (prefers-reduced-motion: reduce)_transitionProperty-kXHXEI":`x4wkmsb`,"@media (prefers-reduced-motion: reduce)_transitionDuration-k6CgDc":`x12w9bfk`,$$css:`@stridge/kit:src/shared/ui/Drawer/Drawer.styles.ts:61`},handle:{"Drawer__styles.handle":`Drawer__styles.handle`,"flexShrink-kmuXW":`x2lah0s`,"width-kzqmXN":`x19k59d4`,"height-kZKoxP":`xl3s093`,"marginInline-kUOVxO":`xvueqy4`,"marginTop-keoZOQ":`xq9mr0s`,"marginBottom-k1K539":`x1782xsq`,"borderRadius-kaIpWk":`x1npxkrn`,"backgroundColor-kWkggS":`x1p0xf7o`,$$css:`@stridge/kit:src/shared/ui/Drawer/Drawer.styles.ts:101`},header:{"Drawer__styles.header":`Drawer__styles.header`,"display-k1xSpc":`x78zum5`,"flexDirection-kXwgrk":`x1q0g3np`,"alignItems-kGNEyG":`x6s0dn4`,"flexShrink-kmuXW":`x2lah0s`,"paddingTop-kLKAdn":`x1cnzs8`,"paddingInlineEnd-kwRFfy":`x1o5r3ls`,"paddingBottom-kGO01o":`x1hhzuzn`,"paddingInlineStart-kZCmMZ":`xz7312c`,"borderBottomWidth-kt9PQ7":`xso031l`,"borderBottomStyle-kfdmCh":`x1q0q8m5`,"borderBottomColor-kL6WhQ":`x188r5k3`,$$css:`@stridge/kit:src/shared/ui/Drawer/Drawer.styles.ts:112`},body:{"Drawer__styles.body":`Drawer__styles.body`,"display-k1xSpc":`x78zum5`,"flexDirection-kXwgrk":`xdt5ytf`,"flex-kUk6DE":`x12lumcd`,"minHeight-kAzted":`x2lwn1j`,$$css:`@stridge/kit:src/shared/ui/Drawer/Drawer.styles.ts:126`},bodyScrollArea:{"Drawer__styles.bodyScrollArea":`Drawer__styles.bodyScrollArea`,"display-k1xSpc":`x78zum5`,"flexDirection-kXwgrk":`xdt5ytf`,"flex-kUk6DE":`x12lumcd`,"minHeight-kAzted":`x2lwn1j`,$$css:`@stridge/kit:src/shared/ui/Drawer/Drawer.styles.ts:132`},bodyScrollViewport:{"Drawer__styles.bodyScrollViewport":`Drawer__styles.bodyScrollViewport`,"flex-kUk6DE":`x845mor`,"minHeight-kAzted":`x2lwn1j`,"width-kzqmXN":`xh8yej3`,"maxWidth-ks0D6T":`x193iq5w`,"height-kZKoxP":`xt7dq6l`,"maxHeight-kskxy":`xmz0i5r`,"overflowX-kXHlph":`x6ikm8r`,"overflowY-kORKVm":`x1odjw0f`,$$css:`@stridge/kit:src/shared/ui/Drawer/Drawer.styles.ts:138`},bodyInner:{"Drawer__styles.bodyInner":`Drawer__styles.bodyInner`,"boxSizing-kB7OPa":`x9f619`,"width-kzqmXN":`xh8yej3`,"maxWidth-ks0D6T":`x193iq5w`,"minWidth-k7Eaqz":`xeuugli`,"paddingTop-kLKAdn":`x1h03h88`,"paddingBottom-kGO01o":`xfvigk`,"paddingInlineStart-kZCmMZ":`xz7312c`,"paddingInlineEnd-kwRFfy":`x1o5r3ls`,$$css:`@stridge/kit:src/shared/ui/Drawer/Drawer.styles.ts:148`},footer:{"Drawer__styles.footer":`Drawer__styles.footer`,"display-k1xSpc":`x78zum5`,"flexDirection-kXwgrk":`x1q0g3np`,"alignItems-kGNEyG":`x6s0dn4`,"flexShrink-kmuXW":`x2lah0s`,"borderTopWidth-kEafiO":`x178xt8z`,"borderTopStyle-kPef9Z":`x13fuv20`,"borderTopColor-kLZC3w":`x1wc9ssx`,$$css:`@stridge/kit:src/shared/ui/Drawer/Drawer.styles.ts:159`},title:{"Drawer__styles.title":`Drawer__styles.title`,"marginTop-keoZOQ":`xdj266r`,"marginBottom-k1K539":`xat24cr`,"color-kMwMTN":`xzn0pkc`,"fontFamily-kMv6JI":`xlaww2m`,"fontSize-kGuDYH":`x126f79r`,"fontWeight-k63SB2":`x1qvi77d`,"lineHeight-kLWn49":`xfh9y1j`,$$css:`@stridge/kit:src/shared/ui/Drawer/Drawer.styles.ts:168`},description:{"Drawer__styles.description":`Drawer__styles.description`,"marginTop-keoZOQ":`xdj266r`,"marginBottom-k1K539":`xat24cr`,"color-kMwMTN":`xi96bwj`,"fontFamily-kMv6JI":`xlaww2m`,"fontSize-kGuDYH":`x14qa7mu`,"lineHeight-kLWn49":`x14vj8e1`,$$css:`@stridge/kit:src/shared/ui/Drawer/Drawer.styles.ts:177`}};export{e as styles};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { DepositMethodConfig, DepositMethodsConfig } from "../flows/deposit/orchestrator/types.js";
|
|
2
|
+
import { Presentation } from "../shared/presentation/types.js";
|
|
2
3
|
import { KitI18nConfig } from "../shared/i18n/createKitI18n.js";
|
|
3
4
|
import { SupportConfig } from "../shared/support/types.js";
|
|
4
5
|
import { TermsConfig } from "../shared/terms/types.js";
|
|
@@ -130,6 +131,13 @@ interface StridgeAppearance {
|
|
|
130
131
|
* Controls the "Powered by Stridge" attribution row inside every gateway widget frame.
|
|
131
132
|
*/
|
|
132
133
|
attribution?: "visible" | "hidden";
|
|
134
|
+
/**
|
|
135
|
+
* How gateway dialogs present themselves. `"auto"` (default) renders a centred dialog on wide
|
|
136
|
+
* containers and a bottom-sheet drawer below the breakpoint; `"dialog"` / `"drawer"` force one
|
|
137
|
+
* surface. Pass `{ mode, breakpoint }` to tune the px threshold (default 600). Measured against
|
|
138
|
+
* the dialog's containing block (its portal `container`, else the viewport).
|
|
139
|
+
*/
|
|
140
|
+
presentation?: Presentation;
|
|
133
141
|
}
|
|
134
142
|
/**
|
|
135
143
|
* Development / preview-only knobs. Grouped under a single `dev` prop so production integrations
|
|
@@ -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{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};
|
|
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,presentation:T?.presentation,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/styles/index.css
CHANGED
|
@@ -66,6 +66,7 @@
|
|
|
66
66
|
--stridge-kit-z-tooltip: 1070;
|
|
67
67
|
--stridge-kit-overlay: oklch(0% 0 0 / .4);
|
|
68
68
|
--stridge-kit-dialog-width: 480px;
|
|
69
|
+
--stridge-kit-drawer-max-inline-size: var(--stridge-kit-dialog-width);
|
|
69
70
|
--stridge-kit-drawer-max-block-size: calc(100% - 2rem);
|
|
70
71
|
--stridge-kit-drawer-handle-size: 36px;
|
|
71
72
|
--stridge-kit-drawer-handle-thickness: 4px;
|
|
@@ -274,6 +275,16 @@
|
|
|
274
275
|
--stridge-kit-shadow-xl: 0 24px 56px -12px oklch(0% 0 0 / .1), 0 8px 16px -4px oklch(0% 0 0 / .06);
|
|
275
276
|
}
|
|
276
277
|
|
|
278
|
+
[data-stridge-scope] {
|
|
279
|
+
-webkit-user-select: none;
|
|
280
|
+
user-select: none;
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
[data-stridge-scope] :is(input, textarea, [contenteditable="true"]) {
|
|
284
|
+
-webkit-user-select: text;
|
|
285
|
+
user-select: text;
|
|
286
|
+
}
|
|
287
|
+
|
|
277
288
|
@stylex;
|
|
278
289
|
|
|
279
290
|
@layer priority1;
|
|
@@ -2942,6 +2953,10 @@
|
|
|
2942
2953
|
max-width: min(var(--stridge-kit-dialog-width),calc(100% - 2rem));
|
|
2943
2954
|
}
|
|
2944
2955
|
|
|
2956
|
+
.x1qvtwti {
|
|
2957
|
+
max-width: var(--stridge-kit-drawer-max-inline-size);
|
|
2958
|
+
}
|
|
2959
|
+
|
|
2945
2960
|
.x2lwn1j {
|
|
2946
2961
|
min-height: 0;
|
|
2947
2962
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
+
import { Presentation, PresentationConfig, PresentationMode } from "../../shared/presentation/types.js";
|
|
1
2
|
import { WithdrawSubmitActions, WithdrawSubmitCallback, WithdrawSubmitInput } from "../../flows/withdraw/orchestrator/types.js";
|
|
2
3
|
import { WithdrawBalanceInput, WithdrawBindings, WithdrawSuggestedRecipient } from "../../flows/withdraw/bindings/WithdrawBindings.js";
|
|
3
4
|
import { WithdrawDialog } from "../../flows/withdraw/dialog/WithdrawDialog.js";
|
|
4
|
-
export { type WithdrawBalanceInput, type WithdrawBindings, WithdrawDialog, type WithdrawSubmitActions, type WithdrawSubmitCallback, type WithdrawSubmitInput, type WithdrawSuggestedRecipient };
|
|
5
|
+
export { type Presentation, type PresentationConfig, type PresentationMode, type WithdrawBalanceInput, type WithdrawBindings, WithdrawDialog, type WithdrawSubmitActions, type WithdrawSubmitCallback, type WithdrawSubmitInput, type WithdrawSuggestedRecipient };
|