@fanfare-io/fanfare-sdk-solid 0.19.0 → 0.20.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/README.md +18 -8
- package/dist/components/compositions/granted-panel.d.ts +51 -1
- package/dist/components/internal/auction-module.d.ts +26 -1
- package/dist/components/internal/draw-module.d.ts +34 -2
- package/dist/components/internal/queue-module.d.ts +22 -1
- package/dist/components/internal/selection/index.d.ts +1 -1
- package/dist/components/internal/selection/selection-branches.d.ts +69 -0
- package/dist/components/internal/selection/selection-summary.d.ts +6 -0
- package/dist/components/internal/timed-release-module.d.ts +32 -2
- package/dist/components/widgets/experience-widget.d.ts +9 -1
- package/dist/components/widgets/index.d.ts +1 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.js +5394 -4015
- package/dist/lib/selection-display.d.ts +19 -1
- package/dist/lib/selection-errors.d.ts +8 -0
- package/dist/styles/base.css +1 -1
- package/package.json +6 -6
package/README.md
CHANGED
|
@@ -42,10 +42,10 @@ Solid applications can use `FanfareProvider`, `ExperienceWidget`, and `useExperi
|
|
|
42
42
|
|
|
43
43
|
## Selection
|
|
44
44
|
|
|
45
|
-
Some experiences capture which product and variant a consumer gets.
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
45
|
+
Some experiences capture which product and variant a consumer gets. `ExperienceWidget` renders that
|
|
46
|
+
flow itself on a granted sequence — the pick, a mystery grant's reveal, the wait for an assignment
|
|
47
|
+
and the locked summary — and the package also exports the two building blocks of the picker for you
|
|
48
|
+
to compose in a granted slot instead.
|
|
49
49
|
|
|
50
50
|
- `ProductSelector` — loads a catalogue through its `loadOptions` callback, renders the product
|
|
51
51
|
rows, the chosen product's option chips and the resolved variant, and reports a complete
|
|
@@ -63,10 +63,20 @@ Selection is configured per sequence, under either checkout arrangement. With me
|
|
|
63
63
|
(`external`) checkout the pick is the host's to cart: the slot that composed `ProductSelector` holds
|
|
64
64
|
the resolved `{ productId, variantId }` pair and the catalogue it came from, and carries it into its
|
|
65
65
|
own checkout. With Fanfare (`internal`) checkout the granted panel continues into Fanfare's own
|
|
66
|
-
checkout instead, under both checkout modes, `at_end` and `pre_auth`. Entry-time picking
|
|
67
|
-
|
|
68
|
-
`
|
|
69
|
-
|
|
66
|
+
checkout instead, under both checkout modes, `at_end` and `pre_auth`. Entry-time picking is live:
|
|
67
|
+
when the server declares that a draw, timed release or auction bid needs a product choice before
|
|
68
|
+
entry, the module renders the picker and `enter` / `bid` carry the pair. A host reaching the view
|
|
69
|
+
directly checks `"loadSelectionOptions" in view` for the required arm and reads
|
|
70
|
+
`view.selection.required` for display. On the widget-rendered flow the hand-off arrives through
|
|
71
|
+
`onCheckoutClick(details?: SelectionCheckoutDetails)`: the pick the grant settled on, with the
|
|
72
|
+
catalogue product and variant behind it whenever the widget has loaded them. For external checkout,
|
|
73
|
+
use their `externalReference` identities when provided, rather than reconstructing identity from
|
|
74
|
+
handles, SKUs or display options. Shopify references identify the product and real variant even
|
|
75
|
+
when the default variant has empty option values. Handle absent references before starting checkout;
|
|
76
|
+
these fields require a compatible backend and SDK release. Returning a rejected promise returns the consumer
|
|
77
|
+
to the CTA with generic inline copy, so a hand-off that never happened is never reported as started.
|
|
78
|
+
Every local pick-surface transition is also announced on the widget root as a bubbling, composed
|
|
79
|
+
`fanfare:selection-change` event.
|
|
70
80
|
|
|
71
81
|
Three integration tiers, in increasing specificity:
|
|
72
82
|
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
+
import { ClaimableSettlement, PreAuthSettlement } from '@fanfare-io/fanfare-sdk-core/experiences';
|
|
2
|
+
import { GrantedSelection, SelectionChoice, SelectionDraft, SelectionOptions } from '@fanfare-io/fanfare-sdk-core/selections';
|
|
1
3
|
import { JSX } from 'solid-js';
|
|
4
|
+
import { SelectionCheckoutDetails, SelectionDisplay } from '../../lib/selection-display';
|
|
2
5
|
export interface GrantedPanelProps {
|
|
3
6
|
label: JSX.Element;
|
|
4
7
|
fallbackMessage: JSX.Element;
|
|
@@ -10,9 +13,56 @@ export interface GrantedPanelProps {
|
|
|
10
13
|
* payment countdown states what the consumer owes, so a synthesised one is worse than none.
|
|
11
14
|
*/
|
|
12
15
|
detail?: JSX.Element;
|
|
13
|
-
|
|
16
|
+
/**
|
|
17
|
+
* Activated by the checkout CTA, carrying the pick the grant settled on and the catalogue
|
|
18
|
+
* objects behind it whenever this panel has loaded them.
|
|
19
|
+
*/
|
|
20
|
+
onCtaClick?: (details?: SelectionCheckoutDetails) => void | Promise<void>;
|
|
14
21
|
class?: string;
|
|
15
22
|
className?: string;
|
|
23
|
+
/** Granted-state selection: drives the pick, reveal, wait and summary states. */
|
|
24
|
+
selection?: GrantedSelection | null;
|
|
25
|
+
/**
|
|
26
|
+
* How the win settles. Selects the confirm label and which affordance sits beneath a resolved
|
|
27
|
+
* summary; absent leaves the CTA exactly as the caller wired it.
|
|
28
|
+
*/
|
|
29
|
+
settlement?: ClaimableSettlement | PreAuthSettlement;
|
|
30
|
+
/**
|
|
31
|
+
* Parent binds the view's option loader; fetch-on-open only. Must be referentially stable — a
|
|
32
|
+
* new identity re-fetches the catalogue.
|
|
33
|
+
*/
|
|
34
|
+
loadSelectionOptions?: () => Promise<SelectionOptions>;
|
|
35
|
+
/**
|
|
36
|
+
* Parent binds the view's selection submit; resolves when the pin is written and rejects on
|
|
37
|
+
* failure — the panel keys its pick UI on settle and shows the failure through `selectError`.
|
|
38
|
+
*
|
|
39
|
+
* The promise must resolve only once the journey atom carries the new selection: the pick
|
|
40
|
+
* surface collapses on the `selection` prop flip, so a promise that settles ahead of the atom
|
|
41
|
+
* re-enables the confirm control over a pick that has already been taken.
|
|
42
|
+
*/
|
|
43
|
+
onConfirmSelection?: (choice: SelectionChoice) => Promise<void>;
|
|
44
|
+
/**
|
|
45
|
+
* Reports every local pick-surface transition, product-only drafts included, so the widget can
|
|
46
|
+
* emit the page-bridge selection-change event; `onConfirmSelection` stays the only settled-pair
|
|
47
|
+
* channel.
|
|
48
|
+
*/
|
|
49
|
+
onDraftChange?: (draft: SelectionDraft) => void;
|
|
50
|
+
/** Heading copy for the pick state; the generic selection title stands when absent. */
|
|
51
|
+
selectionTitle?: JSX.Element;
|
|
52
|
+
/** Helper copy under the pick heading; a reveal supplies its own prompt when absent. */
|
|
53
|
+
selectionDescription?: JSX.Element;
|
|
54
|
+
/**
|
|
55
|
+
* Display strings for the resolved summary. Absent on a consumer-chosen resolution renders no
|
|
56
|
+
* summary at all: a locked line with no item detail states less than nothing.
|
|
57
|
+
*/
|
|
58
|
+
selectionDisplay?: SelectionDisplay | null;
|
|
59
|
+
/**
|
|
60
|
+
* Locked copy for a resolved summary; modules pass "checkout" once checkout has started. Passing
|
|
61
|
+
* it also freezes the pick: the summary reads out locked with this reason and offers no change.
|
|
62
|
+
*/
|
|
63
|
+
selectionLockedReason?: "checkout" | "final";
|
|
64
|
+
/** Inline error from the parent's selection submit. */
|
|
65
|
+
selectError?: string | null;
|
|
16
66
|
}
|
|
17
67
|
export declare function GrantedPanel(props: GrantedPanelProps): JSX.Element;
|
|
18
68
|
export declare namespace GrantedPanel {
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { AuctionBidInput, AuctionConsumerStatus } from '@fanfare-io/fanfare-sdk-core/auctions';
|
|
2
|
+
import { ClaimableSettlement, PreAuthSettlement } from '@fanfare-io/fanfare-sdk-core/experiences';
|
|
2
3
|
import { AuctionDisplayState } from '@fanfare-io/fanfare-sdk-core/internals';
|
|
4
|
+
import { GrantedSelection, SelectionChoice, SelectionDraft, SelectionOptions } from '@fanfare-io/fanfare-sdk-core/selections';
|
|
3
5
|
import { ReadableAtom } from 'nanostores';
|
|
6
|
+
import { SelectionCheckoutDetails } from '../../lib/selection-display';
|
|
4
7
|
import { OutcomeAction } from '../compositions/outcome-panel';
|
|
5
8
|
import { OutcomeReason } from '../module';
|
|
6
9
|
export interface AuctionModuleProps {
|
|
@@ -27,7 +30,29 @@ export interface AuctionModuleProps {
|
|
|
27
30
|
*/
|
|
28
31
|
auctionType?: "english" | "dutch";
|
|
29
32
|
checkoutUrl?: string;
|
|
30
|
-
|
|
33
|
+
/**
|
|
34
|
+
* Activating the checkout CTA. Receives the pick the grant settled on, with the catalogue
|
|
35
|
+
* objects behind it, whenever the panel has loaded the catalogue that carries them.
|
|
36
|
+
*/
|
|
37
|
+
onCheckoutClick?: (details?: SelectionCheckoutDetails) => void | Promise<void>;
|
|
38
|
+
/** Granted-state selection arm; drives the panel's pick, reveal and summary states. */
|
|
39
|
+
grantedSelection?: GrantedSelection;
|
|
40
|
+
/** How the win settles; selects the granted confirm label and payment affordance. */
|
|
41
|
+
settlement?: ClaimableSettlement | PreAuthSettlement;
|
|
42
|
+
/** The auction captures a product choice on the entering bid, so the bid surface renders a picker. */
|
|
43
|
+
selectionRequired?: boolean;
|
|
44
|
+
/** Bound by the widget against the journey; must be referentially stable. */
|
|
45
|
+
loadSelectionOptions?: () => Promise<SelectionOptions>;
|
|
46
|
+
/** The pair the standing bid was placed for; present, it is read back instead of offered again. */
|
|
47
|
+
lockedSelection?: SelectionChoice | null;
|
|
48
|
+
/** Submits the granted pick or re-pick. */
|
|
49
|
+
onSelect?: (choice: SelectionChoice) => Promise<void>;
|
|
50
|
+
/** Every local pick-surface transition, product-only drafts included; feeds the page-bridge event. */
|
|
51
|
+
onDraftChange?: (draft: SelectionDraft) => void;
|
|
52
|
+
/** Locked copy for a resolved granted summary; "checkout" once checkout has started. */
|
|
53
|
+
selectionLockedReason?: "checkout" | "final";
|
|
54
|
+
/** Already-translated selection failure from the widget, rendered beside the acting control. */
|
|
55
|
+
selectError?: string | null;
|
|
31
56
|
outcomeReason?: OutcomeReason;
|
|
32
57
|
/** Host-provided action shown on the terminal panel. */
|
|
33
58
|
outcomeAction?: OutcomeAction;
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
+
import { ClaimableSettlement, PreAuthSettlement } from '@fanfare-io/fanfare-sdk-core/experiences';
|
|
1
2
|
import { DrawDisplayState } from '@fanfare-io/fanfare-sdk-core/internals';
|
|
3
|
+
import { GrantedSelection, SelectionAvailability, SelectionChoice, SelectionDraft, SelectionOptions } from '@fanfare-io/fanfare-sdk-core/selections';
|
|
2
4
|
import { ReadableAtom } from 'nanostores';
|
|
5
|
+
import { SelectionCheckoutDetails } from '../../lib/selection-display';
|
|
3
6
|
import { OutcomeAction } from '../compositions/outcome-panel';
|
|
4
7
|
import { OutcomeReason } from '../module';
|
|
5
8
|
export interface DrawModuleProps {
|
|
@@ -7,7 +10,8 @@ export interface DrawModuleProps {
|
|
|
7
10
|
sequencePhase: "enterable" | "participating" | "settling" | "granted" | "ended";
|
|
8
11
|
canEnter: boolean;
|
|
9
12
|
canLeave: boolean;
|
|
10
|
-
|
|
13
|
+
/** Enter action handler; carries the entry pick on a selection-bearing draw. */
|
|
14
|
+
onEnter: (selection?: SelectionChoice) => Promise<void>;
|
|
11
15
|
onLeave: () => Promise<void>;
|
|
12
16
|
isEntering: boolean;
|
|
13
17
|
isLeaving: boolean;
|
|
@@ -15,7 +19,35 @@ export interface DrawModuleProps {
|
|
|
15
19
|
grant?: string;
|
|
16
20
|
expiresAt?: number | Date;
|
|
17
21
|
checkoutUrl?: string;
|
|
18
|
-
|
|
22
|
+
/**
|
|
23
|
+
* Activating the checkout CTA. Receives the pick the grant settled on, with the catalogue
|
|
24
|
+
* objects behind it, whenever the panel has loaded the catalogue that carries them.
|
|
25
|
+
*/
|
|
26
|
+
onCheckoutClick?: (details?: SelectionCheckoutDetails) => void | Promise<void>;
|
|
27
|
+
/** Granted-state selection arm; drives the panel's pick, reveal and summary states. */
|
|
28
|
+
grantedSelection?: GrantedSelection;
|
|
29
|
+
/** How the win settles; selects the granted confirm label and payment affordance. */
|
|
30
|
+
settlement?: ClaimableSettlement | PreAuthSettlement;
|
|
31
|
+
/** The draw captures a product choice at entry, so the entry branch renders the picker. */
|
|
32
|
+
selectionRequired?: boolean;
|
|
33
|
+
/** Bound by the widget against the journey; must be referentially stable. */
|
|
34
|
+
loadSelectionOptions?: () => Promise<SelectionOptions>;
|
|
35
|
+
/** The choice already recorded for this entry, shown while the consumer waits. */
|
|
36
|
+
recordedSelection?: SelectionChoice | null;
|
|
37
|
+
/** Live availability of the recorded pick, so a sold-out choice is said rather than discovered. */
|
|
38
|
+
selectionAvailability?: SelectionAvailability;
|
|
39
|
+
/** Submits a changed choice while waiting. */
|
|
40
|
+
onSelectionChange?: (choice: SelectionChoice) => Promise<void>;
|
|
41
|
+
/** Submits the granted pick or re-pick. */
|
|
42
|
+
onSelect?: (choice: SelectionChoice) => Promise<void>;
|
|
43
|
+
/** Every local pick-surface transition, product-only drafts included; feeds the page-bridge event. */
|
|
44
|
+
onDraftChange?: (draft: SelectionDraft) => void;
|
|
45
|
+
/** Locked copy for a resolved granted summary; "checkout" once checkout has started. */
|
|
46
|
+
selectionLockedReason?: "checkout" | "final";
|
|
47
|
+
/** Already-translated selection failure from the widget, rendered beside the acting control. */
|
|
48
|
+
selectError?: string | null;
|
|
49
|
+
/** The refusal code behind `selectError`; a stock refusal refetches the catalogue once. */
|
|
50
|
+
selectErrorCode?: string | null;
|
|
19
51
|
outcomeReason?: OutcomeReason;
|
|
20
52
|
/** Host-provided action shown on the terminal panel. */
|
|
21
53
|
outcomeAction?: OutcomeAction;
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
+
import { ClaimableSettlement, PreAuthSettlement } from '@fanfare-io/fanfare-sdk-core/experiences';
|
|
1
2
|
import { QueueDisplayState } from '@fanfare-io/fanfare-sdk-core/internals';
|
|
3
|
+
import { GrantedSelection, SelectionChoice, SelectionDraft, SelectionOptions } from '@fanfare-io/fanfare-sdk-core/selections';
|
|
2
4
|
import { ReadableAtom } from 'nanostores';
|
|
5
|
+
import { SelectionCheckoutDetails } from '../../lib/selection-display';
|
|
3
6
|
import { OutcomeAction } from '../compositions/outcome-panel';
|
|
4
7
|
import { OutcomeReason } from '../module';
|
|
5
8
|
export interface QueueModuleProps {
|
|
@@ -16,7 +19,25 @@ export interface QueueModuleProps {
|
|
|
16
19
|
grant?: string;
|
|
17
20
|
expiresAt?: number | Date;
|
|
18
21
|
checkoutUrl?: string;
|
|
19
|
-
|
|
22
|
+
/**
|
|
23
|
+
* Activating the checkout CTA. Receives the pick the grant settled on, with the catalogue
|
|
24
|
+
* objects behind it, whenever the panel has loaded the catalogue that carries them.
|
|
25
|
+
*/
|
|
26
|
+
onCheckoutClick?: (details?: SelectionCheckoutDetails) => void | Promise<void>;
|
|
27
|
+
/** Granted-state selection arm; drives the panel's pick, reveal and summary states. */
|
|
28
|
+
grantedSelection?: GrantedSelection;
|
|
29
|
+
/** How the win settles; selects the granted confirm label and payment affordance. */
|
|
30
|
+
settlement?: ClaimableSettlement | PreAuthSettlement;
|
|
31
|
+
/** Bound by the widget against the journey; must be referentially stable. */
|
|
32
|
+
loadSelectionOptions?: () => Promise<SelectionOptions>;
|
|
33
|
+
/** Submits the granted pick or re-pick. */
|
|
34
|
+
onSelect?: (choice: SelectionChoice) => Promise<void>;
|
|
35
|
+
/** Every local pick-surface transition, product-only drafts included; feeds the page-bridge event. */
|
|
36
|
+
onDraftChange?: (draft: SelectionDraft) => void;
|
|
37
|
+
/** Locked copy for a resolved granted summary; "checkout" once checkout has started. */
|
|
38
|
+
selectionLockedReason?: "checkout" | "final";
|
|
39
|
+
/** Already-translated selection failure from the widget, rendered beside the acting control. */
|
|
40
|
+
selectError?: string | null;
|
|
20
41
|
outcomeReason?: OutcomeReason;
|
|
21
42
|
/** Host-provided action shown on the terminal panel. */
|
|
22
43
|
outcomeAction?: OutcomeAction;
|
|
@@ -9,5 +9,5 @@
|
|
|
9
9
|
*/
|
|
10
10
|
export { ProductSelector } from './product-selector';
|
|
11
11
|
export type { ProductSelectorHandle, ProductSelectorProps } from './product-selector';
|
|
12
|
-
export { SelectionSummary } from './selection-summary';
|
|
12
|
+
export { SELECTION_LOCKED_COPY, SelectionSummary } from './selection-summary';
|
|
13
13
|
export type { SelectionLockedReason, SelectionSummaryProps } from './selection-summary';
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { GrantedSelection, SelectionAvailability, SelectionChoice, SelectionDraft, SelectionOptions } from '@fanfare-io/fanfare-sdk-core/selections';
|
|
2
|
+
import { JSX } from 'solid-js';
|
|
3
|
+
import { ProductSelectorHandle } from './product-selector';
|
|
4
|
+
/** Widened so a selection-bearing panel stacks its rows instead of clipping them at the card cap. */
|
|
5
|
+
export declare const SELECTION_PANEL_CLASS = "ff:max-h-none ff:overflow-visible";
|
|
6
|
+
/** The granted-arm selection props every distribution module threads into its granted panel. */
|
|
7
|
+
export interface GrantedPickProps {
|
|
8
|
+
grantedSelection?: GrantedSelection;
|
|
9
|
+
loadSelectionOptions?: () => Promise<SelectionOptions>;
|
|
10
|
+
onSelect?: (choice: SelectionChoice) => Promise<void>;
|
|
11
|
+
selectionLockedReason?: "checkout" | "final";
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Whether the granted panel can still open a pick surface, which is the only place the panel's
|
|
15
|
+
* height cap may be lifted — the Confirm control below an open picker has to stay reachable.
|
|
16
|
+
*
|
|
17
|
+
* Reads its fields on call, so a module passes its own props object and gets a live answer.
|
|
18
|
+
*/
|
|
19
|
+
export declare function grantedPickReachable(props: GrantedPickProps): boolean;
|
|
20
|
+
export interface EntrySelectionSurfaceProps {
|
|
21
|
+
/** Fetch-on-open; must be referentially stable — a new identity re-fetches the catalogue. */
|
|
22
|
+
loadOptions(): Promise<SelectionOptions>;
|
|
23
|
+
/** Already-translated heading above the picker. */
|
|
24
|
+
title: JSX.Element;
|
|
25
|
+
/** The consumer's current complete pair, or null while the pick is incomplete. */
|
|
26
|
+
onDraftSelection(choice: SelectionChoice | null): void;
|
|
27
|
+
onOptionsLoaded(options: SelectionOptions): void;
|
|
28
|
+
/** Every local transition, product-only drafts included; feeds the page-bridge event. */
|
|
29
|
+
onDraftChange?(draft: SelectionDraft): void;
|
|
30
|
+
/** Set by the CTA when it was clicked on an incomplete pick. */
|
|
31
|
+
missingChoice: boolean;
|
|
32
|
+
selectError?: string | null;
|
|
33
|
+
disabled?: boolean;
|
|
34
|
+
/** Receives the picker's imperative handle, so the CTA can move focus into an incomplete pick. */
|
|
35
|
+
ref?: (handle: ProductSelectorHandle) => void;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* The entry picker: statically present in the branch, with no open or collapse of its own.
|
|
39
|
+
*
|
|
40
|
+
* The CTA below it stays enabled with no choice made, so the consumer finds out what is missing
|
|
41
|
+
* by acting rather than by a control that refuses to be pressed.
|
|
42
|
+
*/
|
|
43
|
+
export declare function EntrySelectionSurface(props: EntrySelectionSurfaceProps): JSX.Element;
|
|
44
|
+
export declare namespace EntrySelectionSurface {
|
|
45
|
+
var displayName: string;
|
|
46
|
+
}
|
|
47
|
+
export interface RecordedSelectionSurfaceProps {
|
|
48
|
+
choice: SelectionChoice;
|
|
49
|
+
availability?: SelectionAvailability;
|
|
50
|
+
loadOptions?: () => Promise<SelectionOptions>;
|
|
51
|
+
/** Submits the new pair; rejects when the server refuses, which keeps the picker open. */
|
|
52
|
+
onSelectionChange?: (choice: SelectionChoice) => Promise<void>;
|
|
53
|
+
/** Options already in memory from a pick made earlier in this mount. */
|
|
54
|
+
loadedOptions: SelectionOptions | null;
|
|
55
|
+
onOptionsLoaded(options: SelectionOptions): void;
|
|
56
|
+
/** Every local transition, product-only drafts included; feeds the page-bridge event. */
|
|
57
|
+
onDraftChange?(draft: SelectionDraft): void;
|
|
58
|
+
selectError?: string | null;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* The recorded pick and its re-pick, for a consumer already waiting on a result.
|
|
62
|
+
*
|
|
63
|
+
* A fresh mount has no catalogue in memory and makes no request for one: the summary states the
|
|
64
|
+
* pick generically rather than spending an entrant's request budget on prettier names.
|
|
65
|
+
*/
|
|
66
|
+
export declare function RecordedSelectionSurface(props: RecordedSelectionSurfaceProps): JSX.Element;
|
|
67
|
+
export declare namespace RecordedSelectionSurface {
|
|
68
|
+
var displayName: string;
|
|
69
|
+
}
|
|
@@ -17,6 +17,12 @@ export interface SelectionSummaryProps {
|
|
|
17
17
|
class?: string;
|
|
18
18
|
className?: string;
|
|
19
19
|
}
|
|
20
|
+
/** The locked-state sentence each reason reads out, so a caller never states it a second time. */
|
|
21
|
+
export declare const SELECTION_LOCKED_COPY: {
|
|
22
|
+
readonly checkout: "selection.locked.checkout";
|
|
23
|
+
readonly final: "selection.locked.final";
|
|
24
|
+
readonly bid: "selection.locked.bid";
|
|
25
|
+
};
|
|
20
26
|
/**
|
|
21
27
|
* A compact read-out of a pick that has already been captured.
|
|
22
28
|
*
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
+
import { ClaimableSettlement, PreAuthSettlement } from '@fanfare-io/fanfare-sdk-core/experiences';
|
|
1
2
|
import { TimedReleaseDisplayState } from '@fanfare-io/fanfare-sdk-core/internals';
|
|
3
|
+
import { GrantedSelection, SelectionAvailability, SelectionChoice, SelectionDraft, SelectionOptions } from '@fanfare-io/fanfare-sdk-core/selections';
|
|
2
4
|
import { ReadableAtom } from 'nanostores';
|
|
5
|
+
import { SelectionCheckoutDetails } from '../../lib/selection-display';
|
|
3
6
|
import { OutcomeAction } from '../compositions/outcome-panel';
|
|
4
7
|
import { OutcomeReason } from '../module';
|
|
5
8
|
export interface TimedReleaseModuleProps {
|
|
@@ -7,14 +10,41 @@ export interface TimedReleaseModuleProps {
|
|
|
7
10
|
sequencePhase: "enterable" | "participating" | "granted" | "ended";
|
|
8
11
|
canEnter: boolean;
|
|
9
12
|
canLeave: boolean;
|
|
10
|
-
|
|
13
|
+
/** Enter action handler; carries the entry pick on a selection-bearing release. */
|
|
14
|
+
onEnter: (selection?: SelectionChoice) => Promise<void>;
|
|
11
15
|
onLeave: () => Promise<void>;
|
|
12
16
|
onComplete?: () => Promise<void>;
|
|
13
17
|
isEntering: boolean;
|
|
14
18
|
isLeaving: boolean;
|
|
15
19
|
countdownTo?: Date;
|
|
16
20
|
checkoutUrl?: string;
|
|
17
|
-
|
|
21
|
+
/**
|
|
22
|
+
* Activating the checkout CTA. Receives the pick the grant settled on, with the catalogue
|
|
23
|
+
* objects behind it, whenever the panel has loaded the catalogue that carries them.
|
|
24
|
+
*/
|
|
25
|
+
onCheckoutClick?: (details?: SelectionCheckoutDetails) => void | Promise<void>;
|
|
26
|
+
/** Granted-state selection arm; drives the panel's pick, reveal and summary states. */
|
|
27
|
+
grantedSelection?: GrantedSelection;
|
|
28
|
+
/** How the win settles; selects the granted confirm label and payment affordance. */
|
|
29
|
+
settlement?: ClaimableSettlement | PreAuthSettlement;
|
|
30
|
+
/** The release captures a product choice at entry, so the entry branch renders the picker. */
|
|
31
|
+
selectionRequired?: boolean;
|
|
32
|
+
/** Bound by the widget against the journey; must be referentially stable. */
|
|
33
|
+
loadSelectionOptions?: () => Promise<SelectionOptions>;
|
|
34
|
+
/** The choice already recorded for this entry. */
|
|
35
|
+
recordedSelection?: SelectionChoice | null;
|
|
36
|
+
/** Live availability of the recorded pick. */
|
|
37
|
+
selectionAvailability?: SelectionAvailability;
|
|
38
|
+
/** Submits the granted pick or re-pick. */
|
|
39
|
+
onSelect?: (choice: SelectionChoice) => Promise<void>;
|
|
40
|
+
/** Every local pick-surface transition, product-only drafts included; feeds the page-bridge event. */
|
|
41
|
+
onDraftChange?: (draft: SelectionDraft) => void;
|
|
42
|
+
/** Locked copy for a resolved granted summary; "checkout" once checkout has started. */
|
|
43
|
+
selectionLockedReason?: "checkout" | "final";
|
|
44
|
+
/** Already-translated selection failure from the widget, rendered beside the acting control. */
|
|
45
|
+
selectError?: string | null;
|
|
46
|
+
/** The refusal code behind `selectError`; a stock refusal refetches the catalogue once. */
|
|
47
|
+
selectErrorCode?: string | null;
|
|
18
48
|
grant?: string;
|
|
19
49
|
expiresAt?: number | Date;
|
|
20
50
|
outcomeReason?: OutcomeReason;
|
|
@@ -3,11 +3,12 @@ import { SDKEvents } from '@fanfare-io/fanfare-sdk-core/events';
|
|
|
3
3
|
import { CheckoutNextAction, FanfareCheckoutResult, JourneyHandle, JourneySnapshot, JourneyView, PaymentInput, PaymentMethodSummary, SequenceView } from '@fanfare-io/fanfare-sdk-core/experiences';
|
|
4
4
|
import { BrandTheme } from '@fanfare-io/fanfare-sdk-core/theme';
|
|
5
5
|
import { JSX } from 'solid-js';
|
|
6
|
+
import { SelectionCheckoutDetails } from '../../lib/selection-display';
|
|
6
7
|
import { WidgetVariant } from '../../theme';
|
|
7
8
|
import { AuthInputMode } from '../auth/auth-input';
|
|
8
9
|
import { OutcomeAction } from '../compositions/outcome-panel';
|
|
9
10
|
type ParticipationType = "queue" | "draw" | "auction" | "timed_release" | "appointment";
|
|
10
|
-
type EnterableSlotSequence = Extract<SequenceView, {
|
|
11
|
+
export type EnterableSlotSequence = Extract<SequenceView, {
|
|
11
12
|
phase: "enterable";
|
|
12
13
|
mechanism: ParticipationType;
|
|
13
14
|
}>;
|
|
@@ -183,6 +184,13 @@ export interface ExperienceWidgetProps {
|
|
|
183
184
|
pageType?: BeaconPageType;
|
|
184
185
|
children?: (props: ExperienceRenderProps) => JSX.Element;
|
|
185
186
|
checkoutUrl?: string;
|
|
187
|
+
/**
|
|
188
|
+
* Called when the consumer activates the granted checkout CTA, with the pick the grant settled
|
|
189
|
+
* on and the catalogue objects behind it whenever the widget has loaded them. Takes precedence
|
|
190
|
+
* over `checkoutUrl`. A rejected promise returns the consumer to the CTA with generic inline
|
|
191
|
+
* copy, so a hand-off that never happened is not reported as started.
|
|
192
|
+
*/
|
|
193
|
+
onCheckoutClick?: (details?: SelectionCheckoutDetails) => void | Promise<void>;
|
|
186
194
|
/**
|
|
187
195
|
* Action offered on terminal panels (not selected, sold out, closed), such as
|
|
188
196
|
* a link back to what is still available. Omit to show none.
|
|
@@ -9,3 +9,4 @@
|
|
|
9
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';
|
|
12
|
+
export type { EnterableSlotSequence } from './experience-widget';
|
package/dist/index.d.ts
CHANGED
|
@@ -22,12 +22,13 @@ export { AccessCodeForm, ChallengeGate, EndedModule, ErrorView, GrantedPanel, Ou
|
|
|
22
22
|
export type { AccessCodeFormProps, ChallengeGateProps, EndedModuleProps, ErrorViewProps, GrantedPanelProps, OutcomePanelProps, } from './components/compositions';
|
|
23
23
|
export { ProductSelector, SelectionSummary } from './components/internal/selection';
|
|
24
24
|
export type { ProductSelectorHandle, ProductSelectorProps, SelectionLockedReason, SelectionSummaryProps, } from './components/internal/selection';
|
|
25
|
+
export type { SelectionCheckoutDetails } from './lib/selection-display';
|
|
25
26
|
export { ExperienceWidget } from './components/widgets';
|
|
26
27
|
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';
|
|
27
28
|
export { CheckoutProcessingPanel, PaymentCollectionPanel, ReceiptPanel } from './components/checkout';
|
|
28
29
|
export { LoadingView, StartView, UpcomingModule, WaitlistView } from './components/widgets';
|
|
29
30
|
export type { LoadingViewProps, StartViewProps, UpcomingModuleProps, WaitlistViewProps } from './components/widgets';
|
|
30
31
|
export { AppointmentModule, AuctionModule, DrawModule, QueueModule, TimedReleaseModule } from './components/widgets';
|
|
31
|
-
export type { AppointmentModuleProps, AuctionModuleProps, DrawModuleProps, QueueModuleProps, TimedReleaseModuleProps, } from './components/widgets';
|
|
32
|
+
export type { AppointmentModuleProps, AuctionModuleProps, DrawModuleProps, EnterableSlotSequence, QueueModuleProps, TimedReleaseModuleProps, } from './components/widgets';
|
|
32
33
|
export * from './styles';
|
|
33
34
|
export { registerWebComponents } from './register';
|