@fanfare-io/fanfare-sdk-solid 0.12.0 → 0.14.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.
@@ -1,4 +1,3 @@
1
1
  export { CheckoutProcessingPanel } from './checkout-processing-panel';
2
2
  export { PaymentCollectionPanel } from './payment-collection-panel';
3
3
  export { ReceiptPanel } from './receipt-panel';
4
- export { ReservationCheckoutPanel } from './reservation-checkout-panel';
@@ -1,8 +1,7 @@
1
1
  import { JSX } from 'solid-js';
2
2
  import { PaymentCollectionSlotProps } from '../widgets/experience-widget';
3
3
  /**
4
- * Default payment-collection panel for pre-auth distributions, rendered both when the consumer is
5
- * about to enter and when a failed authorization leaves a retry open.
4
+ * Default payment-collection panel for pre-auth entry/re-entry and grant-keyed at-end checkout.
6
5
  *
7
6
  * The hold amount is rendered from the view's own figure — the client never derives one.
8
7
  *
@@ -1,11 +1,18 @@
1
- import { ReservationPaymentAffordance } from '@fanfare-io/fanfare-sdk-core/experiences';
1
+ import { SequenceView } from '@fanfare-io/fanfare-sdk-core/experiences';
2
2
  import { Stripe, StripeConstructor, StripeElementStyle } from '@stripe/stripe-js';
3
+ /** How a granted win settles, as the granted views carry it. */
4
+ type GrantedSettlement = Extract<SequenceView, {
5
+ phase: "granted";
6
+ }>["settlement"];
3
7
  /**
4
8
  * The wire block a checkout-capable view carries, reached through the adapter's declared
5
9
  * dependency on `fanfare-sdk-core` rather than the contracts package: core re-exports the contract
6
- * types so adapter modules never resolve `@fanfare-io/fanfare-sdk-contracts` directly.
10
+ * types so adapter modules never resolve `@fanfare-io/fanfare-sdk-contracts` directly. Core names
11
+ * the shape only within the arms that carry it, so it is read back off one of them.
7
12
  */
8
- type PaymentProviderConfig = NonNullable<ReservationPaymentAffordance["paymentProvider"]>;
13
+ type PaymentProviderConfig = NonNullable<Extract<GrantedSettlement, {
14
+ mode: "at_end";
15
+ }>["paymentProvider"]>;
9
16
  declare global {
10
17
  interface Window {
11
18
  Stripe?: StripeConstructor;
@@ -62,8 +69,8 @@ export declare function deriveStripeCardStyle(root: HTMLElement): StripeElementS
62
69
  *
63
70
  * `null` means no usable Stripe client configuration reached this view. On a checkout-capable arm
64
71
  * that has exactly one cause — the configuration read failed — because the processor discriminator
65
- * is the `processor` field (reserved) or `checkoutMode` (enterable), never the presence of this
66
- * block. The condition is transient and retryable.
72
+ * is the settlement's `processor`/`mode` pair (granted) or `checkoutMode` (enterable), never the
73
+ * presence of this block. The condition is transient and retryable.
67
74
  */
68
75
  export declare function resolveStripeClientConfig(source: PaymentProviderConfig | undefined): StripeClientConfig | null;
69
76
  /** Test-only seam over every memo this module holds. Never exported from an adapter's public entry. */
@@ -2,9 +2,9 @@ import { JSX } from 'solid-js';
2
2
  export interface GrantedPanelProps {
3
3
  label: JSX.Element;
4
4
  fallbackMessage: JSX.Element;
5
- ctaLabel: JSX.Element;
5
+ ctaLabel?: JSX.Element;
6
6
  expiresAt?: Date;
7
- onCtaClick: () => void;
7
+ onCtaClick?: () => void;
8
8
  class?: string;
9
9
  className?: string;
10
10
  }
@@ -11,4 +11,4 @@ export { EndedModule, type EndedModuleProps } from './ended-module';
11
11
  export { ErrorView, type ErrorViewProps } from './error-view';
12
12
  export { GrantedPanel, type GrantedPanelProps } from './granted-panel';
13
13
  export { JourneyGate, type JourneyGateProps, type JourneyGateStage } from './journey-gate';
14
- export { OutcomePanel, type OutcomePanelProps } from './outcome-panel';
14
+ export { OutcomePanel, type OutcomeAction, type OutcomePanelProps } from './outcome-panel';
@@ -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,6 +23,8 @@ 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
  class?: string;
18
29
  className?: string;
19
30
  }
@@ -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>;
@@ -21,6 +22,8 @@ export interface AuctionModuleProps {
21
22
  checkoutUrl?: string;
22
23
  onCheckoutClick?: () => void;
23
24
  outcomeReason?: OutcomeReason;
25
+ /** Host-provided action shown on the terminal panel. */
26
+ outcomeAction?: OutcomeAction;
24
27
  onReenter?: () => Promise<void>;
25
28
  isReentering?: boolean;
26
29
  class?: string;
@@ -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
  display$?: ReadableAtom<DrawDisplayState>;
@@ -16,6 +17,8 @@ export interface DrawModuleProps {
16
17
  checkoutUrl?: string;
17
18
  onCheckoutClick?: () => void;
18
19
  outcomeReason?: OutcomeReason;
20
+ /** Host-provided action shown on the terminal panel. */
21
+ outcomeAction?: OutcomeAction;
19
22
  onReenter?: () => Promise<void>;
20
23
  isReentering?: boolean;
21
24
  class?: string;
@@ -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,6 +18,8 @@ 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
  class?: string;
@@ -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,6 +18,8 @@ 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
  class?: string;
@@ -3,3 +3,4 @@ export { InfoPanel, type InfoPanelProps } from './info-panel';
3
3
  export { normalizeOutcomeReason, normalizeSequenceOutcomeReason, type OutcomeReason } from './outcome-reason';
4
4
  export { PanelHeading, type PanelHeadingProps, type PanelHeadingVariant } from './panel-heading';
5
5
  export { PanelBody, PanelFooter, PanelLayout, type PanelBodyProps, type PanelFooterProps, type PanelLayoutProps, } from './panel-layout';
6
+ export { StageSteps, type StageStep, type StageStepStatus, type StageStepsProps } from './stage-steps';
@@ -0,0 +1,10 @@
1
+ import { JSX } from 'solid-js';
2
+ export type StageStepStatus = "done" | "active" | "pending";
3
+ export interface StageStep {
4
+ label: string;
5
+ status: StageStepStatus;
6
+ }
7
+ export interface StageStepsProps extends JSX.HTMLAttributes<HTMLDivElement> {
8
+ steps: readonly StageStep[];
9
+ }
10
+ export declare function StageSteps(props: StageStepsProps): JSX.Element;
@@ -1,9 +1,11 @@
1
1
  import { BotMitigationState, RoutingChallenge } from '@fanfare-io/fanfare-sdk-core/challenges';
2
- import { CheckoutNextAction, CheckoutProcessor, FanfareCheckoutResult, JourneyHandle, JourneySnapshot, JourneyView, PaymentInput, PaymentMethodSummary, ReservationPaymentAffordance, SequenceView } from '@fanfare-io/fanfare-sdk-core/experiences';
2
+ import { SDKEvents } from '@fanfare-io/fanfare-sdk-core/events';
3
+ import { CheckoutNextAction, FanfareCheckoutResult, JourneyHandle, JourneySnapshot, JourneyView, PaymentInput, PaymentMethodSummary, SequenceView } from '@fanfare-io/fanfare-sdk-core/experiences';
3
4
  import { BrandTheme } from '@fanfare-io/fanfare-sdk-core/theme';
4
5
  import { JSX } from 'solid-js';
5
6
  import { WidgetVariant } from '../../theme';
6
7
  import { AuthInputMode } from '../auth/auth-input';
8
+ import { OutcomeAction } from '../compositions/outcome-panel';
7
9
  type ParticipationType = "queue" | "draw" | "auction" | "timed_release" | "appointment";
8
10
  type EnterableSlotSequence = Extract<SequenceView, {
9
11
  phase: "enterable";
@@ -16,6 +18,8 @@ type ParticipatingSlotSequence = Extract<SequenceView, {
16
18
  type GrantedSlotSequence = Extract<SequenceView, {
17
19
  phase: "granted";
18
20
  }>;
21
+ /** How a granted win settles: who consumes the grant, and whether money has already moved for it. */
22
+ type GrantedSettlement = GrantedSlotSequence["settlement"];
19
23
  export interface SlotProps {
20
24
  snapshot: JourneySnapshot | null;
21
25
  view: JourneyView | null;
@@ -59,22 +63,17 @@ export interface GrantedSlotProps extends SlotProps {
59
63
  grant?: string;
60
64
  expiresAt?: number;
61
65
  }
62
- export interface PaymentCollectionSlotProps extends SlotProps {
63
- preAuthAmount: string;
64
- preAuthCurrencyCode: string;
66
+ interface PaymentCollectionBaseSlotProps extends SlotProps {
65
67
  savedPaymentMethods: PaymentMethodSummary[];
66
- /** Rejects on a recoverable payment failure (e.g. a declined card) — the panel owns recovery UI for its own submit. */
68
+ /** Submits pre-auth entry or confirms at-end checkout; rejects when the panel should keep recovery UI mounted. */
67
69
  onEnter: (paymentInput: PaymentInput) => Promise<void>;
68
70
  isEntering: boolean;
69
- /** "enter" collects payment before first entry; "reenter" collects payment to retry after a failed or expired authorization hold. */
70
- intent: "enter" | "reenter";
71
71
  /**
72
- * Client configuration for the processor authorizing this entry, as the server supplied it.
73
- * Carried by the enterable arm only a retry is offered from an ended view, which holds no
74
- * configuration.
72
+ * Client configuration for the internal processor, as the server supplied it. Carried by the
73
+ * enterable pre-auth and granted at-end arms; an ended retry holds no configuration.
75
74
  */
76
75
  paymentProvider?: PaymentProviderConfig;
77
- /** Present while the processor is waiting on an out-of-band action; re-submitting entry resolves it. */
76
+ /** Present while the internal processor is waiting on an out-of-band action. */
78
77
  pendingAction?: CheckoutNextAction;
79
78
  /**
80
79
  * Re-reads the consumer's journeys from the server so a provider configuration that was missing
@@ -83,35 +82,22 @@ export interface PaymentCollectionSlotProps extends SlotProps {
83
82
  */
84
83
  onRetryPaymentConfig?: () => Promise<void>;
85
84
  }
85
+ export type PaymentCollectionSlotProps = PaymentCollectionBaseSlotProps & ({
86
+ intent: "checkout";
87
+ onResume: () => Promise<void>;
88
+ } | {
89
+ intent: "enter" | "reenter";
90
+ preAuthAmount: string;
91
+ preAuthCurrencyCode: string;
92
+ onResume?: never;
93
+ });
86
94
  /**
87
- * The processor's client configuration block, named through the affordance that carries it: core
88
- * re-exports the affordance but not the contract's own name for this shape.
95
+ * The processor's client configuration block, named through an arm that carries it: core names the
96
+ * shape only within those arms, not as a standalone export.
89
97
  */
90
- type PaymentProviderConfig = NonNullable<ReservationPaymentAffordance["paymentProvider"]>;
91
- export interface ReservationCheckoutSlotProps extends SlotProps {
92
- reservation: {
93
- token: string;
94
- expiresAt: number;
95
- };
96
- savedPaymentMethods: PaymentMethodSummary[];
97
- /** Which processor executes this reservation's payment leg; narrow before rendering processor-specific UI. */
98
- processor: CheckoutProcessor;
99
- /** Client configuration for the processor settling this reservation, as the server supplied it. */
100
- paymentProvider?: PaymentProviderConfig;
101
- /** Present while the processor is waiting on an out-of-band action; complete it, then call `onResume`. */
102
- pendingAction?: CheckoutNextAction;
103
- /** Rejects on a recoverable payment failure (e.g. a declined card) — the panel owns recovery UI for its own submit. */
104
- onConfirm: (paymentInput: PaymentInput) => Promise<void>;
105
- /** Re-submits the paused checkout after `pendingAction` has been completed. Idempotent server-side. */
106
- onResume: () => Promise<void>;
107
- isConfirming: boolean;
108
- /**
109
- * Re-reads the consumer's journeys from the server so a provider configuration that was missing
110
- * or unreadable at render can arrive. This is the panel's only recovery when `paymentProvider` is
111
- * absent — the value is a prop, so nothing the panel does to its own state can produce it.
112
- */
113
- onRetryPaymentConfig?: () => Promise<void>;
114
- }
98
+ type PaymentProviderConfig = NonNullable<Extract<GrantedSettlement, {
99
+ mode: "at_end";
100
+ }>["paymentProvider"]>;
115
101
  export type CheckoutProcessingSlotProps = SlotProps;
116
102
  /**
117
103
  * A Fanfare-managed payment is terminal: it produces a receipt, never an admission credential. The
@@ -137,7 +123,8 @@ export interface EndedSlotProps extends SlotProps {
137
123
  }
138
124
  export interface ErrorSlotProps extends SlotProps {
139
125
  error: string;
140
- onRetry: () => void;
126
+ /** Absent when the refusal cannot be cleared by retrying — render no retry affordance. */
127
+ onRetry?: () => void;
141
128
  }
142
129
  export interface LoadingSlotProps extends SlotProps {
143
130
  /** Stage-specific message (e.g. routing). `undefined` for generic loading — show just a spinner. */
@@ -161,13 +148,18 @@ export interface ExperienceWidgetSlots {
161
148
  participating?: (props: ParticipatingSlotProps) => JSX.Element;
162
149
  granted?: (props: GrantedSlotProps) => JSX.Element;
163
150
  paymentCollection?: (props: PaymentCollectionSlotProps) => JSX.Element;
164
- reservationCheckout?: (props: ReservationCheckoutSlotProps) => JSX.Element;
151
+ /** Rendered by the at-end checkout surface while a collected payment is settling. */
165
152
  checkoutProcessing?: (props: CheckoutProcessingSlotProps) => JSX.Element;
166
153
  receipt?: (props: ReceiptSlotProps) => JSX.Element;
167
154
  expired?: (props: ExpiredSlotProps) => JSX.Element;
168
155
  ended?: (props: EndedSlotProps) => JSX.Element;
169
156
  error?: (props: ErrorSlotProps) => JSX.Element;
170
157
  }
158
+ /**
159
+ * Surface the widget is mounted on, named through the bus payload that carries it: core
160
+ * re-exports the event map but not the contract's own name for this shape.
161
+ */
162
+ type BeaconPageType = SDKEvents["experience:widget-mounted"]["pageType"];
171
163
  export interface ExperienceRenderProps {
172
164
  journey: JourneyHandle | null;
173
165
  view: JourneyView | null;
@@ -184,14 +176,22 @@ export interface ExperienceWidgetProps {
184
176
  theme?: BrandTheme;
185
177
  variant?: WidgetVariant;
186
178
  slots?: ExperienceWidgetSlots;
179
+ /**
180
+ * Surface this widget renders on, carried on the `experience:widget-mounted` announcement.
181
+ * Defaults to `embed`, the merchant-page case; Fanfare-hosted drop pages pass `hosted`.
182
+ */
183
+ pageType?: BeaconPageType;
187
184
  children?: (props: ExperienceRenderProps) => JSX.Element;
188
185
  checkoutUrl?: string;
186
+ /**
187
+ * Action offered on terminal panels (not selected, sold out, closed), such as
188
+ * a link back to what is still available. Omit to show none.
189
+ */
190
+ endedAction?: OutcomeAction;
189
191
  onJourneyChange?: (snapshot: JourneySnapshot) => void;
190
192
  onGranted?: (grant: string) => void;
191
- /** Called when a Fanfare-managed checkout completes (pre-auth capture or post-win reservation checkout) */
193
+ /** Called when a Fanfare-managed checkout completes */
192
194
  onFanfareCheckout?: (result: FanfareCheckoutResult) => void;
193
- /** Called when the consumer wins a `post_win` distribution and must complete checkout before `expiresAt` */
194
- onReserved?: (expiresAt: number) => void;
195
195
  onError?: (error: Error) => void;
196
196
  class?: string;
197
197
  className?: string;
@@ -6,6 +6,6 @@
6
6
  *
7
7
  * @packageDocumentation
8
8
  */
9
- export { ExperienceWidget, type AccessCodeSlotProps, type AuthSlotProps, type ChallengeSlotProps, type CheckoutProcessingSlotProps, type EndedSlotProps, type EnterableSlotProps, type ErrorSlotProps, type ExperienceRenderProps, type ExperienceWidgetProps, type ExperienceWidgetSlots, type ExpiredSlotProps, type GrantedSlotProps, type LoadingSlotProps, type ParticipatingSlotProps, type PaymentCollectionSlotProps, type ReceiptSlotProps, type ReservationCheckoutSlotProps, type SlotProps, type StartSlotProps, type UpcomingSlotProps, type WaitlistSlotProps, } from './experience-widget';
9
+ export { ExperienceWidget, type AccessCodeSlotProps, type AuthSlotProps, type ChallengeSlotProps, type CheckoutProcessingSlotProps, type EndedSlotProps, type EnterableSlotProps, type ErrorSlotProps, type ExperienceRenderProps, type ExperienceWidgetProps, type ExperienceWidgetSlots, type ExpiredSlotProps, type GrantedSlotProps, type LoadingSlotProps, type ParticipatingSlotProps, type PaymentCollectionSlotProps, type ReceiptSlotProps, type SlotProps, type StartSlotProps, type UpcomingSlotProps, type WaitlistSlotProps, } from './experience-widget';
10
10
  export { LoadingView, StartView, UpcomingModule, WaitlistView, type LoadingViewProps, type StartViewProps, type UpcomingModuleProps, type WaitlistViewProps, } from '../internal';
11
11
  export { AppointmentModule, AuctionModule, DrawModule, QueueModule, TimedReleaseModule, type AppointmentModuleProps, type AuctionModuleProps, type DrawModuleProps, type QueueModuleProps, type TimedReleaseModuleProps, } from '../internal';
package/dist/index.d.ts CHANGED
@@ -21,11 +21,11 @@ export type { InfoPanelProps, OutcomeReason, PanelBodyProps, PanelFooterProps, P
21
21
  export { AccessCodeForm, ChallengeGate, EndedModule, ErrorView, GrantedPanel, OutcomePanel, } from './components/compositions';
22
22
  export type { AccessCodeFormProps, ChallengeGateProps, EndedModuleProps, ErrorViewProps, GrantedPanelProps, OutcomePanelProps, } from './components/compositions';
23
23
  export { ExperienceWidget } from './components/widgets';
24
- export type { AccessCodeSlotProps, AuthSlotProps, ChallengeSlotProps, CheckoutProcessingSlotProps, EndedSlotProps, EnterableSlotProps, ErrorSlotProps, ExperienceRenderProps, ExperienceWidgetProps, ExperienceWidgetSlots, ExpiredSlotProps, GrantedSlotProps, LoadingSlotProps, ParticipatingSlotProps, PaymentCollectionSlotProps, ReceiptSlotProps, ReservationCheckoutSlotProps, SlotProps, StartSlotProps, UpcomingSlotProps, WaitlistSlotProps, } from './components/widgets';
25
- export { CheckoutProcessingPanel, PaymentCollectionPanel, ReceiptPanel, ReservationCheckoutPanel, } from './components/checkout';
24
+ export type { AccessCodeSlotProps, AuthSlotProps, ChallengeSlotProps, CheckoutProcessingSlotProps, EndedSlotProps, EnterableSlotProps, ErrorSlotProps, ExperienceRenderProps, ExperienceWidgetProps, ExperienceWidgetSlots, ExpiredSlotProps, GrantedSlotProps, LoadingSlotProps, ParticipatingSlotProps, PaymentCollectionSlotProps, ReceiptSlotProps, SlotProps, StartSlotProps, UpcomingSlotProps, WaitlistSlotProps, } from './components/widgets';
25
+ export { CheckoutProcessingPanel, PaymentCollectionPanel, ReceiptPanel } from './components/checkout';
26
26
  export { LoadingView, StartView, UpcomingModule, WaitlistView } from './components/widgets';
27
27
  export type { LoadingViewProps, StartViewProps, UpcomingModuleProps, WaitlistViewProps } from './components/widgets';
28
- export { AuctionModule, DrawModule, QueueModule, TimedReleaseModule } from './components/widgets';
29
- export type { AuctionModuleProps, DrawModuleProps, QueueModuleProps, TimedReleaseModuleProps, } from './components/widgets';
28
+ export { AppointmentModule, AuctionModule, DrawModule, QueueModule, TimedReleaseModule } from './components/widgets';
29
+ export type { AppointmentModuleProps, AuctionModuleProps, DrawModuleProps, QueueModuleProps, TimedReleaseModuleProps, } from './components/widgets';
30
30
  export * from './styles';
31
31
  export { registerWebComponents } from './register';