@fanfare-io/fanfare-sdk-react 0.12.0 → 0.13.0

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.
@@ -10,6 +10,6 @@ export { JourneyGate, type JourneyGateProps, type JourneyGateStage } from './jou
10
10
  export { ChallengeGate, type ChallengeGateProps } from './challenge-gate';
11
11
  export { AccessCodeForm, type AccessCodeFormProps } from './access-code-form';
12
12
  export { GrantedPanel, type GrantedPanelProps } from './granted-panel';
13
- export { OutcomePanel, type OutcomePanelProps } from './outcome-panel';
13
+ export { OutcomePanel, type OutcomeAction, type OutcomePanelProps } from './outcome-panel';
14
14
  export { EndedModule, type EndedModuleProps } from './ended-module';
15
15
  export { ErrorView, type ErrorViewProps } from './error-view';
@@ -4,6 +4,15 @@ import { OutcomeReason } from '../module';
4
4
  * (e.g. the expired re-enter button label) so each module shows terminology
5
5
  * appropriate to its mechanism rather than queue-specific copy.
6
6
  */
7
+ /**
8
+ * A host-provided action for a terminal panel, such as "See what's still
9
+ * available" after a loss. The widget renders it as a secondary button; the
10
+ * host decides where it leads.
11
+ */
12
+ export interface OutcomeAction {
13
+ label: string;
14
+ onClick: () => void;
15
+ }
7
16
  export type ParticipationType = "queue" | "draw" | "auction" | "timed_release" | "appointment";
8
17
  export interface OutcomePanelProps {
9
18
  outcomeReason: OutcomeReason;
@@ -14,9 +23,11 @@ export interface OutcomePanelProps {
14
23
  participationType?: ParticipationType;
15
24
  onReenter?: () => Promise<void>;
16
25
  isReentering?: boolean;
26
+ /** Secondary action offered once the outcome is final. */
27
+ action?: OutcomeAction;
17
28
  className?: string;
18
29
  }
19
- export declare function OutcomePanel({ outcomeReason, participationType, onReenter, isReentering, className, }: OutcomePanelProps): import("react/jsx-runtime").JSX.Element;
30
+ export declare function OutcomePanel({ outcomeReason, participationType, onReenter, isReentering, action, className, }: OutcomePanelProps): import("react/jsx-runtime").JSX.Element;
20
31
  export declare namespace OutcomePanel {
21
32
  var displayName: string;
22
33
  }
@@ -13,6 +13,8 @@ export { PanelHeading } from './panel-heading';
13
13
  export type { PanelHeadingProps, PanelHeadingVariant } from './panel-heading';
14
14
  export { InfoPanel } from './info-panel';
15
15
  export type { InfoPanelProps } from './info-panel';
16
+ export { StageSteps } from './stage-steps';
17
+ export type { StageStep, StageStepStatus, StageStepsProps } from './stage-steps';
16
18
  export { AlertPanel } from './alert-panel';
17
19
  export type { AlertPanelProps } from './alert-panel';
18
20
  export { normalizeOutcomeReason, normalizeSequenceOutcomeReason } from './outcome-reason';
@@ -0,0 +1,26 @@
1
+ /**
2
+ * StageSteps
3
+ *
4
+ * A row of named stages for a phase whose end time is unknown. Completed
5
+ * stages read solid, the active stage pulses and its connector flows toward
6
+ * the next, and pending stages stay outlined. It communicates where the
7
+ * consumer is in a process without implying a percentage or a deadline.
8
+ *
9
+ * <StageSteps
10
+ * steps={[
11
+ * { label: "You're in", status: "done" },
12
+ * { label: "Drawing", status: "active" },
13
+ * { label: "Results", status: "pending" },
14
+ * ]}
15
+ * />
16
+ */
17
+ import * as React from "react";
18
+ export type StageStepStatus = "done" | "active" | "pending";
19
+ export interface StageStep {
20
+ label: string;
21
+ status: StageStepStatus;
22
+ }
23
+ export interface StageStepsProps extends React.HTMLAttributes<HTMLDivElement> {
24
+ steps: readonly StageStep[];
25
+ }
26
+ export declare const StageSteps: React.ForwardRefExoticComponent<StageStepsProps & React.RefAttributes<HTMLDivElement>>;
@@ -2,6 +2,7 @@ import { BotMitigationState, RoutingChallenge } from '@fanfare-io/fanfare-sdk-co
2
2
  import { CheckoutNextAction, CheckoutProcessor, FanfareCheckoutResult, JourneyHandle, JourneySnapshot, JourneyView, PaymentInput, PaymentMethodSummary, ReservationPaymentAffordance, SequenceView } from '@fanfare-io/fanfare-sdk-core/experiences';
3
3
  import { BrandTheme, WidgetVariant } from '../../theme';
4
4
  import { AuthInputMode } from '../auth/auth-input';
5
+ import { OutcomeAction } from '../compositions/outcome-panel';
5
6
  import * as React from "react";
6
7
  type ParticipationType = "queue" | "draw" | "auction" | "timed_release" | "appointment";
7
8
  type EnterableSlotSequence = Extract<SequenceView, {
@@ -137,7 +138,8 @@ export interface EndedSlotProps extends SlotProps {
137
138
  }
138
139
  export interface ErrorSlotProps extends SlotProps {
139
140
  error: string;
140
- onRetry: () => void;
141
+ /** Absent when the refusal cannot be cleared by retrying — render no retry affordance. */
142
+ onRetry?: () => void;
141
143
  }
142
144
  export interface LoadingSlotProps extends SlotProps {
143
145
  /** Stage-specific message (e.g. routing). `undefined` for generic loading — show just a spinner. */
@@ -197,6 +199,11 @@ export interface ExperienceWidgetProps {
197
199
  children?: (props: ExperienceRenderProps) => React.ReactNode;
198
200
  /** Checkout URL for granted state */
199
201
  checkoutUrl?: string;
202
+ /**
203
+ * Action offered on terminal panels (not selected, sold out, closed), such as
204
+ * a link back to what is still available. Omit to show none.
205
+ */
206
+ endedAction?: OutcomeAction;
200
207
  /** Called when journey state changes */
201
208
  onJourneyChange?: (snapshot: JourneySnapshot) => void;
202
209
  /** Called when the journey receives a grant */
@@ -210,7 +217,7 @@ export interface ExperienceWidgetProps {
210
217
  /** Additional class name */
211
218
  className?: string;
212
219
  }
213
- export declare function ExperienceWidget({ experienceId, autoStart, accessCode, autoEnterWaitlist, theme, variant, slots, children, checkoutUrl, onJourneyChange, onGranted, onFanfareCheckout, onReserved, onError, className, }: ExperienceWidgetProps): import("react/jsx-runtime").JSX.Element;
220
+ export declare function ExperienceWidget({ experienceId, autoStart, accessCode, autoEnterWaitlist, theme, variant, slots, children, checkoutUrl, endedAction, onJourneyChange, onGranted, onFanfareCheckout, onReserved, onError, className, }: ExperienceWidgetProps): import("react/jsx-runtime").JSX.Element;
214
221
  export declare namespace ExperienceWidget {
215
222
  var displayName: string;
216
223
  }
@@ -1,5 +1,6 @@
1
1
  import { AuctionDisplayState } from '@fanfare-io/fanfare-sdk-core/internals';
2
2
  import { ReadableAtom } from 'nanostores';
3
+ import { OutcomeAction } from '../../compositions/outcome-panel';
3
4
  import { OutcomeReason } from '../../module';
4
5
  export interface AuctionModuleProps {
5
6
  display$?: ReadableAtom<AuctionDisplayState>;
@@ -23,11 +24,13 @@ export interface AuctionModuleProps {
23
24
  checkoutUrl?: string;
24
25
  onCheckoutClick?: () => void;
25
26
  outcomeReason?: OutcomeReason;
27
+ /** Host-provided action shown on the terminal panel. */
28
+ outcomeAction?: OutcomeAction;
26
29
  onReenter?: () => Promise<void>;
27
30
  isReentering?: boolean;
28
31
  className?: string;
29
32
  }
30
- export declare function AuctionModule({ display$, fallbackState, sequencePhase, canEnter, canLeave, onEnter, onLeave, onBid, isEntering, isLeaving, countdownTo, defaultBidAmount, currencyCode, locale, grant: _grant, expiresAt, checkoutUrl, onCheckoutClick, outcomeReason, onReenter, isReentering, className, }: AuctionModuleProps): import("react/jsx-runtime").JSX.Element | null;
33
+ export declare function AuctionModule({ display$, fallbackState, sequencePhase, canEnter, canLeave, onEnter, onLeave, onBid, isEntering, isLeaving, countdownTo, defaultBidAmount, currencyCode, locale, grant: _grant, expiresAt, checkoutUrl, onCheckoutClick, outcomeReason, outcomeAction, onReenter, isReentering, className, }: AuctionModuleProps): import("react/jsx-runtime").JSX.Element | null;
31
34
  export declare namespace AuctionModule {
32
35
  var displayName: string;
33
36
  }
@@ -1,5 +1,6 @@
1
1
  import { DrawDisplayState } from '@fanfare-io/fanfare-sdk-core/internals';
2
2
  import { ReadableAtom } from 'nanostores';
3
+ import { OutcomeAction } from '../../compositions/outcome-panel';
3
4
  import { OutcomeReason } from '../../module';
4
5
  export interface DrawModuleProps {
5
6
  /** Reactive display state atom from the journey */
@@ -30,6 +31,8 @@ export interface DrawModuleProps {
30
31
  onCheckoutClick?: () => void;
31
32
  /** Denial reason (denied) */
32
33
  outcomeReason?: OutcomeReason;
34
+ /** Host-provided action shown on the terminal panel. */
35
+ outcomeAction?: OutcomeAction;
33
36
  /** Re-enter handler (denied with reason="expired") */
34
37
  onReenter?: () => Promise<void>;
35
38
  /** Whether re-entering is in progress */
@@ -37,7 +40,7 @@ export interface DrawModuleProps {
37
40
  /** Additional class name */
38
41
  className?: string;
39
42
  }
40
- export declare function DrawModule({ display$, sequencePhase, canEnter, canLeave, onEnter, onLeave, isEntering, isLeaving, countdownTo, grant: _grant, expiresAt, checkoutUrl, onCheckoutClick, outcomeReason, onReenter, isReentering, className, }: DrawModuleProps): import("react/jsx-runtime").JSX.Element | null;
43
+ export declare function DrawModule({ display$, sequencePhase, canEnter, canLeave, onEnter, onLeave, isEntering, isLeaving, countdownTo, grant: _grant, expiresAt, checkoutUrl, onCheckoutClick, outcomeReason, outcomeAction, onReenter, isReentering, className, }: DrawModuleProps): import("react/jsx-runtime").JSX.Element | null;
41
44
  export declare namespace DrawModule {
42
45
  var displayName: string;
43
46
  }
@@ -1,5 +1,6 @@
1
1
  import { QueueDisplayState } from '@fanfare-io/fanfare-sdk-core/internals';
2
2
  import { ReadableAtom } from 'nanostores';
3
+ import { OutcomeAction } from '../../compositions/outcome-panel';
3
4
  import { OutcomeReason } from '../../module';
4
5
  export interface QueueModuleProps {
5
6
  display$?: ReadableAtom<QueueDisplayState>;
@@ -17,11 +18,13 @@ export interface QueueModuleProps {
17
18
  checkoutUrl?: string;
18
19
  onCheckoutClick?: () => void;
19
20
  outcomeReason?: OutcomeReason;
21
+ /** Host-provided action shown on the terminal panel. */
22
+ outcomeAction?: OutcomeAction;
20
23
  onReenter?: () => Promise<void>;
21
24
  isReentering?: boolean;
22
25
  className?: string;
23
26
  }
24
- export declare function QueueModule({ display$, sequencePhase, canEnter, canLeave, onEnter, onLeave, isEntering, isLeaving, closeAt, grant: _grant, expiresAt, checkoutUrl, onCheckoutClick, outcomeReason, onReenter, isReentering, className, }: QueueModuleProps): import("react/jsx-runtime").JSX.Element | null;
27
+ export declare function QueueModule({ display$, sequencePhase, canEnter, canLeave, onEnter, onLeave, isEntering, isLeaving, closeAt, grant: _grant, expiresAt, checkoutUrl, onCheckoutClick, outcomeReason, outcomeAction, onReenter, isReentering, className, }: QueueModuleProps): import("react/jsx-runtime").JSX.Element | null;
25
28
  export declare namespace QueueModule {
26
29
  var displayName: string;
27
30
  }
@@ -1,5 +1,6 @@
1
1
  import { TimedReleaseDisplayState } from '@fanfare-io/fanfare-sdk-core/internals';
2
2
  import { ReadableAtom } from 'nanostores';
3
+ import { OutcomeAction } from '../../compositions/outcome-panel';
3
4
  import { OutcomeReason } from '../../module';
4
5
  export interface TimedReleaseModuleProps {
5
6
  display$?: ReadableAtom<TimedReleaseDisplayState>;
@@ -17,11 +18,13 @@ export interface TimedReleaseModuleProps {
17
18
  grant?: string;
18
19
  expiresAt?: number | Date;
19
20
  outcomeReason?: OutcomeReason;
21
+ /** Host-provided action shown on the terminal panel. */
22
+ outcomeAction?: OutcomeAction;
20
23
  onReenter?: () => Promise<void>;
21
24
  isReentering?: boolean;
22
25
  className?: string;
23
26
  }
24
- export declare function TimedReleaseModule({ display$, sequencePhase, canEnter, canLeave, onEnter, onLeave, onComplete, isEntering, isLeaving, countdownTo, checkoutUrl, onCheckoutClick, grant: _grant, expiresAt, outcomeReason, onReenter, isReentering, className, }: TimedReleaseModuleProps): import("react/jsx-runtime").JSX.Element | null;
27
+ export declare function TimedReleaseModule({ display$, sequencePhase, canEnter, canLeave, onEnter, onLeave, onComplete, isEntering, isLeaving, countdownTo, checkoutUrl, onCheckoutClick, grant: _grant, expiresAt, outcomeReason, outcomeAction, onReenter, isReentering, className, }: TimedReleaseModuleProps): import("react/jsx-runtime").JSX.Element | null;
25
28
  export declare namespace TimedReleaseModule {
26
29
  var displayName: string;
27
30
  }