@fanfare-io/fanfare-sdk-contracts 0.14.0 → 0.16.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/auction.d.ts CHANGED
@@ -1,12 +1,84 @@
1
1
  import { InferOutput } from 'valibot';
2
2
  import * as v from "valibot";
3
- export declare const AuctionBidderStateResponseSchema: v.LooseObjectSchema<{
4
- readonly status: v.PicklistSchema<["NOT_BID", "BIDDING", "WINNING", "OUTBID", "WON", "LOST"], undefined>;
5
- readonly lastBidAmount: v.NullishSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, undefined>]>, undefined>;
3
+ export declare const AuctionLiveSchema: v.VariantSchema<"auctionType", [v.StrictObjectSchema<{
4
+ readonly auctionType: v.LiteralSchema<"english", undefined>;
5
+ readonly highestBid: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, undefined>]>, undefined>;
6
+ readonly minNextBid: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, undefined>]>;
7
+ readonly bidCount: v.NumberSchema<undefined>;
8
+ readonly effectiveSettleAt: v.StringSchema<undefined>;
9
+ readonly closeAt: v.NullableSchema<v.StringSchema<undefined>, undefined>;
10
+ readonly autoExtended: v.BooleanSchema<undefined>;
11
+ readonly reserveMet: v.BooleanSchema<undefined>;
12
+ readonly ended: v.BooleanSchema<undefined>;
13
+ }, undefined>, v.StrictObjectSchema<{
14
+ readonly auctionType: v.LiteralSchema<"dutch", undefined>;
15
+ readonly currentPrice: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, undefined>]>;
16
+ readonly remainingQuantity: v.NumberSchema<undefined>;
17
+ readonly totalQuantity: v.NumberSchema<undefined>;
18
+ readonly nextDropAt: v.NullableSchema<v.StringSchema<undefined>, undefined>;
19
+ readonly floorPrice: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, undefined>]>, undefined>;
20
+ readonly settleAt: v.StringSchema<undefined>;
21
+ readonly ended: v.BooleanSchema<undefined>;
22
+ }, undefined>], undefined>;
23
+ export type AuctionLive = InferOutput<typeof AuctionLiveSchema>;
24
+ /**
25
+ * The auction configuration read. These fifteen fields are an authored projection of the auction
26
+ * row: checkout and operator fields never leave the server on this endpoint, so a key outside this
27
+ * set is a contract drift, not an addition to tolerate.
28
+ */
29
+ export declare const AuctionDetailsResponseSchema: v.StrictObjectSchema<{
30
+ readonly id: v.StringSchema<undefined>;
31
+ readonly timeZone: v.StringSchema<undefined>;
32
+ readonly settleAt: v.StringSchema<undefined>;
33
+ readonly currencyCode: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>]>;
34
+ readonly auctionType: v.PicklistSchema<["english", "dutch"], undefined>;
35
+ readonly openAt: v.NullishSchema<v.StringSchema<undefined>, undefined>;
36
+ readonly closeAt: v.NullishSchema<v.StringSchema<undefined>, undefined>;
37
+ readonly reservePrice: v.NullishSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, undefined>]>, undefined>;
38
+ readonly minBidIncrement: v.NullishSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, undefined>]>, undefined>;
39
+ readonly startPrice: v.NullishSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, undefined>]>, undefined>;
40
+ readonly floorPrice: v.NullishSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, undefined>]>, undefined>;
41
+ readonly priceDropAmount: v.NullishSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, undefined>]>, undefined>;
42
+ readonly autoExtendSeconds: v.NullishSchema<v.NumberSchema<undefined>, undefined>;
43
+ readonly priceDropIntervalSeconds: v.NullishSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>]>, undefined>;
44
+ readonly quantity: v.NullishSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>]>, undefined>;
45
+ }, undefined>;
46
+ export type AuctionDetailsResponse = InferOutput<typeof AuctionDetailsResponseSchema>;
47
+ export declare const AuctionBidderStateResponseSchema: v.StrictObjectSchema<{
48
+ readonly status: v.PicklistSchema<["NOT_BID", "WINNING", "OUTBID", "WON", "LOST"], undefined>;
49
+ readonly lastBidAmount: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, undefined>]>, undefined>;
6
50
  readonly winningBidAmount: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, undefined>]>, undefined>;
7
51
  readonly bidCount: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
8
52
  readonly admissionGrant: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
53
+ readonly expiresAt: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
54
+ readonly selection: v.OptionalSchema<v.ObjectSchema<{
55
+ readonly productId: v.StringSchema<undefined>;
56
+ readonly variantId: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
57
+ }, undefined>, undefined>;
58
+ readonly standing: v.OptionalSchema<v.PicklistSchema<["unreserved", "reserved", "completed", "expired"], undefined>, undefined>;
59
+ readonly releaseClass: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
60
+ readonly outcome: v.OptionalSchema<v.PicklistSchema<["completed", "expired"], undefined>, undefined>;
9
61
  readonly degraded: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
62
+ readonly live: v.VariantSchema<"auctionType", [v.StrictObjectSchema<{
63
+ readonly auctionType: v.LiteralSchema<"english", undefined>;
64
+ readonly highestBid: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, undefined>]>, undefined>;
65
+ readonly minNextBid: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, undefined>]>;
66
+ readonly bidCount: v.NumberSchema<undefined>;
67
+ readonly effectiveSettleAt: v.StringSchema<undefined>;
68
+ readonly closeAt: v.NullableSchema<v.StringSchema<undefined>, undefined>;
69
+ readonly autoExtended: v.BooleanSchema<undefined>;
70
+ readonly reserveMet: v.BooleanSchema<undefined>;
71
+ readonly ended: v.BooleanSchema<undefined>;
72
+ }, undefined>, v.StrictObjectSchema<{
73
+ readonly auctionType: v.LiteralSchema<"dutch", undefined>;
74
+ readonly currentPrice: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, undefined>]>;
75
+ readonly remainingQuantity: v.NumberSchema<undefined>;
76
+ readonly totalQuantity: v.NumberSchema<undefined>;
77
+ readonly nextDropAt: v.NullableSchema<v.StringSchema<undefined>, undefined>;
78
+ readonly floorPrice: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, undefined>]>, undefined>;
79
+ readonly settleAt: v.StringSchema<undefined>;
80
+ readonly ended: v.BooleanSchema<undefined>;
81
+ }, undefined>], undefined>;
10
82
  }, undefined>;
11
83
  export type AuctionBidderStateResponse = InferOutput<typeof AuctionBidderStateResponseSchema>;
12
84
  export declare const AuctionHighestBidResponseSchema: v.LooseObjectSchema<{
package/dist/auction.js CHANGED
@@ -1,24 +1,78 @@
1
- import * as o from "valibot";
2
- const e = o.string(), t = o.pipe(e, o.regex(/^\d{1,12}(\.\d{1,8})?$/)), n = o.picklist(["NOT_BID", "BIDDING", "WINNING", "OUTBID", "WON", "LOST"]), s = o.looseObject({
3
- status: n,
4
- lastBidAmount: o.nullish(t),
5
- winningBidAmount: o.optional(t),
6
- bidCount: o.optional(o.number()),
7
- admissionGrant: o.optional(e),
8
- // The bid is committed, but a post-commit effect (event fan-out, credential mint) did not
9
- // complete on this request. The standing is authoritative; a later status read reconciles
10
- // whatever the effect would have projected.
11
- degraded: o.optional(o.boolean())
12
- }), a = o.looseObject({
13
- amount: t
14
- }), i = o.looseObject({
15
- amount: t,
16
- timestamp: e,
17
- isHighest: o.boolean()
18
- }), c = o.array(i);
1
+ import * as e from "valibot";
2
+ const t = e.string(), n = e.pipe(t, e.regex(/^\d{1,12}(\.\d{1,8})?$/)), i = e.picklist(["NOT_BID", "WINNING", "OUTBID", "WON", "LOST"]), o = e.object({
3
+ productId: t,
4
+ variantId: e.optional(t)
5
+ }), l = e.strictObject({
6
+ auctionType: e.literal("english"),
7
+ highestBid: e.nullable(n),
8
+ minNextBid: n,
9
+ bidCount: e.number(),
10
+ effectiveSettleAt: t,
11
+ closeAt: e.nullable(t),
12
+ autoExtended: e.boolean(),
13
+ reserveMet: e.boolean(),
14
+ ended: e.boolean()
15
+ }), s = e.strictObject({
16
+ auctionType: e.literal("dutch"),
17
+ currentPrice: n,
18
+ remainingQuantity: e.number(),
19
+ totalQuantity: e.number(),
20
+ nextDropAt: e.nullable(t),
21
+ floorPrice: e.nullable(n),
22
+ settleAt: t,
23
+ ended: e.boolean()
24
+ }), c = e.variant("auctionType", [l, s]), r = e.strictObject({
25
+ id: t,
26
+ timeZone: t,
27
+ settleAt: t,
28
+ currencyCode: e.pipe(t, e.nonEmpty()),
29
+ auctionType: e.picklist(["english", "dutch"]),
30
+ openAt: e.nullish(t),
31
+ closeAt: e.nullish(t),
32
+ reservePrice: e.nullish(n),
33
+ minBidIncrement: e.nullish(n),
34
+ startPrice: e.nullish(n),
35
+ floorPrice: e.nullish(n),
36
+ priceDropAmount: e.nullish(n),
37
+ autoExtendSeconds: e.nullish(e.number()),
38
+ priceDropIntervalSeconds: e.nullish(e.pipe(e.number(), e.integer())),
39
+ quantity: e.nullish(e.pipe(e.number(), e.integer()))
40
+ }), u = e.strictObject({
41
+ status: i,
42
+ lastBidAmount: e.optional(n),
43
+ winningBidAmount: e.optional(n),
44
+ bidCount: e.optional(e.number()),
45
+ admissionGrant: e.optional(t),
46
+ // WON: the grant's continuation deadline, as the admission register holds it.
47
+ expiresAt: e.optional(t),
48
+ // WON: the product the win is bound to.
49
+ selection: e.optional(o),
50
+ // WON: the admission register's standing for this win, and the recorded cause when it is
51
+ // `expired`. `outcome` is the terminal result derived from that standing — a WON bidder whose
52
+ // admission was paid reads `completed`, one whose window closed reads `expired`.
53
+ standing: e.optional(e.picklist(["unreserved", "reserved", "completed", "expired"])),
54
+ releaseClass: e.optional(t),
55
+ outcome: e.optional(e.picklist(["completed", "expired"])),
56
+ // The bid is committed, but the credential mint did not complete on this request, or the
57
+ // register could not be read to resolve the outcome. The standing is authoritative; a later
58
+ // status read reconciles whatever was left unresolved. Event fan-out failures do not raise it:
59
+ // publication runs after the commit, and a failed one is recovered by the sweep.
60
+ degraded: e.optional(e.boolean()),
61
+ // Every display fact the surface needs to render this auction, so a bidder-state read is the
62
+ // only request a live auction surface makes per tick.
63
+ live: c
64
+ }), p = e.looseObject({
65
+ amount: n
66
+ }), a = e.looseObject({
67
+ amount: n,
68
+ timestamp: t,
69
+ isHighest: e.boolean()
70
+ }), d = e.array(a);
19
71
  export {
20
- i as AuctionBidHistoryItemResponseSchema,
21
- c as AuctionBidHistoryResponseSchema,
22
- s as AuctionBidderStateResponseSchema,
23
- a as AuctionHighestBidResponseSchema
72
+ a as AuctionBidHistoryItemResponseSchema,
73
+ d as AuctionBidHistoryResponseSchema,
74
+ u as AuctionBidderStateResponseSchema,
75
+ r as AuctionDetailsResponseSchema,
76
+ p as AuctionHighestBidResponseSchema,
77
+ c as AuctionLiveSchema
24
78
  };
package/dist/beacon.d.ts CHANGED
@@ -2982,7 +2982,7 @@ export declare const SequenceEndedEventSchema: v.SchemaWithPipe<readonly [v.Obje
2982
2982
  eventName: "sequenceEnded";
2983
2983
  eventProperties?: {
2984
2984
  distributionType?: "queue" | "draw" | "auction" | "timed_release" | "appointment" | undefined;
2985
- outcome?: "completed" | "closed" | "denied" | "left" | "won" | "lost" | "cancelled" | "no_show" | "expired" | undefined;
2985
+ outcome?: "completed" | "expired" | "closed" | "denied" | "left" | "won" | "lost" | "cancelled" | "no_show" | undefined;
2986
2986
  denialReason?: "ended" | "not_queued" | "not_entered" | "missing_distribution" | "not_participating" | "floor_unsold" | "QUEUE_CLOSED" | "DRAW_CLOSED" | "DRAW_COMPLETED" | "RELEASE_CLOSED" | "BOT_DETECTED" | "VALIDATION_LIMIT_REACHED" | "ORDER_LIMIT_EXCEEDED" | "ADMISSION_EXPIRED" | "TOKEN_EXPIRED" | "NO_SELECTABLE_PRODUCT" | "STOCK_CONSTRAINED" | undefined;
2987
2987
  postalCode?: string | undefined;
2988
2988
  timezone?: string | undefined;
@@ -5922,7 +5922,7 @@ export declare const BeaconEventSchema: v.UnionSchema<[v.SchemaWithPipe<readonly
5922
5922
  eventName: "sequenceEnded";
5923
5923
  eventProperties?: {
5924
5924
  distributionType?: "queue" | "draw" | "auction" | "timed_release" | "appointment" | undefined;
5925
- outcome?: "completed" | "closed" | "denied" | "left" | "won" | "lost" | "cancelled" | "no_show" | "expired" | undefined;
5925
+ outcome?: "completed" | "expired" | "closed" | "denied" | "left" | "won" | "lost" | "cancelled" | "no_show" | undefined;
5926
5926
  denialReason?: "ended" | "not_queued" | "not_entered" | "missing_distribution" | "not_participating" | "floor_unsold" | "QUEUE_CLOSED" | "DRAW_CLOSED" | "DRAW_COMPLETED" | "RELEASE_CLOSED" | "BOT_DETECTED" | "VALIDATION_LIMIT_REACHED" | "ORDER_LIMIT_EXCEEDED" | "ADMISSION_EXPIRED" | "TOKEN_EXPIRED" | "NO_SELECTABLE_PRODUCT" | "STOCK_CONSTRAINED" | undefined;
5927
5927
  postalCode?: string | undefined;
5928
5928
  timezone?: string | undefined;
package/dist/bridge.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import { DistributionType, SequenceOutcomeType } from './consumer-me';
2
+ import { SelectionChoice, SelectionDraft } from './selection';
2
3
  /**
3
4
  * Name of the DOM `CustomEvent` dispatched whenever the journey's projected
4
5
  * state changes.
@@ -15,6 +16,45 @@ export declare const FANFARE_STATE_CHANGE_EVENT: "fanfare:state-change";
15
16
  * recognise.
16
17
  */
17
18
  export declare const BRIDGE_EVENT_VERSION = 1;
19
+ /**
20
+ * Name of the DOM `CustomEvent` dispatched whenever the consumer's product
21
+ * selection changes.
22
+ *
23
+ * A separate event from {@link FANFARE_STATE_CHANGE_EVENT}, with its own
24
+ * version: a selection moves under a state that has not changed, and a page
25
+ * listening for one has no reason to receive the other.
26
+ */
27
+ export declare const FANFARE_SELECTION_CHANGE_EVENT: "fanfare:selection-change";
28
+ /**
29
+ * Version of the {@link FanfareSelectionChangeDetail} payload.
30
+ *
31
+ * Versioned independently of {@link BRIDGE_EVENT_VERSION}: the two payloads
32
+ * break on their own schedules.
33
+ */
34
+ export declare const SELECTION_BRIDGE_EVENT_VERSION: 1;
35
+ /** `detail` of a {@link FANFARE_SELECTION_CHANGE_EVENT} event. */
36
+ export interface FanfareSelectionChangeDetail {
37
+ /** Payload version; compare against `1` and ignore unrecognised versions. */
38
+ version: 1;
39
+ experienceId: string;
40
+ sequenceId: string;
41
+ /** The consumer's local pick; may lead, equal, or lag `committed`. */
42
+ draft: SelectionDraft;
43
+ /** The server-committed pair, or null before any pin. */
44
+ committed: SelectionChoice | null;
45
+ /** Qualifies `committed`; null iff `committed` is null. */
46
+ resolution: "chosen" | "assigned" | "auto" | null;
47
+ /** Stable per widget instance; `seq` is monotonic within it and restarts with it. */
48
+ emitterId: string;
49
+ seq: number;
50
+ }
51
+ /**
52
+ * The DOM event carrying a {@link FanfareSelectionChangeDetail}.
53
+ *
54
+ * Used to narrow inside a listener — `(e as FanfareSelectionChangeEvent).detail` —
55
+ * because no global event-map augmentation ships with this package.
56
+ */
57
+ export type FanfareSelectionChangeEvent = CustomEvent<FanfareSelectionChangeDetail>;
18
58
  /** Fields every payload arm carries, whatever the journey stage. */
19
59
  interface FanfareStateChangeBase {
20
60
  /** Payload version; compare against `1` and ignore unrecognised versions. */
package/dist/bridge.js CHANGED
@@ -1,5 +1,7 @@
1
- const E = "fanfare:state-change", t = 1;
1
+ const E = "fanfare:state-change", N = 1, _ = "fanfare:selection-change", n = 1;
2
2
  export {
3
- t as BRIDGE_EVENT_VERSION,
4
- E as FANFARE_STATE_CHANGE_EVENT
3
+ N as BRIDGE_EVENT_VERSION,
4
+ _ as FANFARE_SELECTION_CHANGE_EVENT,
5
+ E as FANFARE_STATE_CHANGE_EVENT,
6
+ n as SELECTION_BRIDGE_EVENT_VERSION
5
7
  };