@fanfare-io/fanfare-sdk-solid 0.13.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.
- package/dist/components/checkout/index.d.ts +0 -1
- package/dist/components/checkout/payment-collection-panel.d.ts +1 -2
- package/dist/components/checkout/stripe-client.d.ts +12 -5
- package/dist/components/compositions/granted-panel.d.ts +2 -2
- package/dist/components/widgets/experience-widget.d.ts +35 -42
- package/dist/components/widgets/index.d.ts +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2665 -2923
- package/package.json +5 -5
- package/dist/components/checkout/reservation-checkout-panel.d.ts +0 -18
|
@@ -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
|
|
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 {
|
|
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<
|
|
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`
|
|
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
|
|
5
|
+
ctaLabel?: JSX.Element;
|
|
6
6
|
expiresAt?: Date;
|
|
7
|
-
onCtaClick
|
|
7
|
+
onCtaClick?: () => void;
|
|
8
8
|
class?: string;
|
|
9
9
|
className?: string;
|
|
10
10
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { BotMitigationState, RoutingChallenge } from '@fanfare-io/fanfare-sdk-core/challenges';
|
|
2
|
-
import {
|
|
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';
|
|
@@ -17,6 +18,8 @@ type ParticipatingSlotSequence = Extract<SequenceView, {
|
|
|
17
18
|
type GrantedSlotSequence = Extract<SequenceView, {
|
|
18
19
|
phase: "granted";
|
|
19
20
|
}>;
|
|
21
|
+
/** How a granted win settles: who consumes the grant, and whether money has already moved for it. */
|
|
22
|
+
type GrantedSettlement = GrantedSlotSequence["settlement"];
|
|
20
23
|
export interface SlotProps {
|
|
21
24
|
snapshot: JourneySnapshot | null;
|
|
22
25
|
view: JourneyView | null;
|
|
@@ -60,22 +63,17 @@ export interface GrantedSlotProps extends SlotProps {
|
|
|
60
63
|
grant?: string;
|
|
61
64
|
expiresAt?: number;
|
|
62
65
|
}
|
|
63
|
-
|
|
64
|
-
preAuthAmount: string;
|
|
65
|
-
preAuthCurrencyCode: string;
|
|
66
|
+
interface PaymentCollectionBaseSlotProps extends SlotProps {
|
|
66
67
|
savedPaymentMethods: PaymentMethodSummary[];
|
|
67
|
-
/**
|
|
68
|
+
/** Submits pre-auth entry or confirms at-end checkout; rejects when the panel should keep recovery UI mounted. */
|
|
68
69
|
onEnter: (paymentInput: PaymentInput) => Promise<void>;
|
|
69
70
|
isEntering: boolean;
|
|
70
|
-
/** "enter" collects payment before first entry; "reenter" collects payment to retry after a failed or expired authorization hold. */
|
|
71
|
-
intent: "enter" | "reenter";
|
|
72
71
|
/**
|
|
73
|
-
* Client configuration for the processor
|
|
74
|
-
*
|
|
75
|
-
* 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.
|
|
76
74
|
*/
|
|
77
75
|
paymentProvider?: PaymentProviderConfig;
|
|
78
|
-
/** Present while the processor is waiting on an out-of-band action
|
|
76
|
+
/** Present while the internal processor is waiting on an out-of-band action. */
|
|
79
77
|
pendingAction?: CheckoutNextAction;
|
|
80
78
|
/**
|
|
81
79
|
* Re-reads the consumer's journeys from the server so a provider configuration that was missing
|
|
@@ -84,35 +82,22 @@ export interface PaymentCollectionSlotProps extends SlotProps {
|
|
|
84
82
|
*/
|
|
85
83
|
onRetryPaymentConfig?: () => Promise<void>;
|
|
86
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
|
+
});
|
|
87
94
|
/**
|
|
88
|
-
* The processor's client configuration block, named through
|
|
89
|
-
*
|
|
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.
|
|
90
97
|
*/
|
|
91
|
-
type PaymentProviderConfig = NonNullable<
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
token: string;
|
|
95
|
-
expiresAt: number;
|
|
96
|
-
};
|
|
97
|
-
savedPaymentMethods: PaymentMethodSummary[];
|
|
98
|
-
/** Which processor executes this reservation's payment leg; narrow before rendering processor-specific UI. */
|
|
99
|
-
processor: CheckoutProcessor;
|
|
100
|
-
/** Client configuration for the processor settling this reservation, as the server supplied it. */
|
|
101
|
-
paymentProvider?: PaymentProviderConfig;
|
|
102
|
-
/** Present while the processor is waiting on an out-of-band action; complete it, then call `onResume`. */
|
|
103
|
-
pendingAction?: CheckoutNextAction;
|
|
104
|
-
/** Rejects on a recoverable payment failure (e.g. a declined card) — the panel owns recovery UI for its own submit. */
|
|
105
|
-
onConfirm: (paymentInput: PaymentInput) => Promise<void>;
|
|
106
|
-
/** Re-submits the paused checkout after `pendingAction` has been completed. Idempotent server-side. */
|
|
107
|
-
onResume: () => Promise<void>;
|
|
108
|
-
isConfirming: boolean;
|
|
109
|
-
/**
|
|
110
|
-
* Re-reads the consumer's journeys from the server so a provider configuration that was missing
|
|
111
|
-
* or unreadable at render can arrive. This is the panel's only recovery when `paymentProvider` is
|
|
112
|
-
* absent — the value is a prop, so nothing the panel does to its own state can produce it.
|
|
113
|
-
*/
|
|
114
|
-
onRetryPaymentConfig?: () => Promise<void>;
|
|
115
|
-
}
|
|
98
|
+
type PaymentProviderConfig = NonNullable<Extract<GrantedSettlement, {
|
|
99
|
+
mode: "at_end";
|
|
100
|
+
}>["paymentProvider"]>;
|
|
116
101
|
export type CheckoutProcessingSlotProps = SlotProps;
|
|
117
102
|
/**
|
|
118
103
|
* A Fanfare-managed payment is terminal: it produces a receipt, never an admission credential. The
|
|
@@ -163,13 +148,18 @@ export interface ExperienceWidgetSlots {
|
|
|
163
148
|
participating?: (props: ParticipatingSlotProps) => JSX.Element;
|
|
164
149
|
granted?: (props: GrantedSlotProps) => JSX.Element;
|
|
165
150
|
paymentCollection?: (props: PaymentCollectionSlotProps) => JSX.Element;
|
|
166
|
-
|
|
151
|
+
/** Rendered by the at-end checkout surface while a collected payment is settling. */
|
|
167
152
|
checkoutProcessing?: (props: CheckoutProcessingSlotProps) => JSX.Element;
|
|
168
153
|
receipt?: (props: ReceiptSlotProps) => JSX.Element;
|
|
169
154
|
expired?: (props: ExpiredSlotProps) => JSX.Element;
|
|
170
155
|
ended?: (props: EndedSlotProps) => JSX.Element;
|
|
171
156
|
error?: (props: ErrorSlotProps) => JSX.Element;
|
|
172
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"];
|
|
173
163
|
export interface ExperienceRenderProps {
|
|
174
164
|
journey: JourneyHandle | null;
|
|
175
165
|
view: JourneyView | null;
|
|
@@ -186,6 +176,11 @@ export interface ExperienceWidgetProps {
|
|
|
186
176
|
theme?: BrandTheme;
|
|
187
177
|
variant?: WidgetVariant;
|
|
188
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;
|
|
189
184
|
children?: (props: ExperienceRenderProps) => JSX.Element;
|
|
190
185
|
checkoutUrl?: string;
|
|
191
186
|
/**
|
|
@@ -195,10 +190,8 @@ export interface ExperienceWidgetProps {
|
|
|
195
190
|
endedAction?: OutcomeAction;
|
|
196
191
|
onJourneyChange?: (snapshot: JourneySnapshot) => void;
|
|
197
192
|
onGranted?: (grant: string) => void;
|
|
198
|
-
/** Called when a Fanfare-managed checkout completes
|
|
193
|
+
/** Called when a Fanfare-managed checkout completes */
|
|
199
194
|
onFanfareCheckout?: (result: FanfareCheckoutResult) => void;
|
|
200
|
-
/** Called when the consumer wins a `post_win` distribution and must complete checkout before `expiresAt` */
|
|
201
|
-
onReserved?: (expiresAt: number) => void;
|
|
202
195
|
onError?: (error: Error) => void;
|
|
203
196
|
class?: string;
|
|
204
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
|
|
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,8 +21,8 @@ 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,
|
|
25
|
-
export { CheckoutProcessingPanel, PaymentCollectionPanel, ReceiptPanel
|
|
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
28
|
export { AppointmentModule, AuctionModule, DrawModule, QueueModule, TimedReleaseModule } from './components/widgets';
|