@alytegen/sdk 0.8.0 → 0.9.0-next.1
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 +54 -3
- package/dist/agent.d.ts +5 -1
- package/dist/agent.js +8 -0
- package/dist/baskets.d.ts +132 -2
- package/dist/browser.d.ts +63 -7
- package/dist/browser.js +75 -3
- package/dist/index.d.ts +1 -0
- package/dist/merchant.d.ts +43 -1
- package/dist/merchant.js +33 -0
- package/dist/types.d.ts +66 -0
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -23,7 +23,8 @@ npm install @alytegen/sdk
|
|
|
23
23
|
| `createWebhookHandler` / `verifyWebhookSignature` | webhook secret | your server | signed, at-least-once purchase events with typed dispatch |
|
|
24
24
|
| `exchangeBuyerSession` / `createBuyerClient` / `openConsent` / `openChallenge` from `@alytegen/sdk/browser` | bounded buyer bearer | partner browser/chat | isolated consent and challenge continuation, then buy/watch/list/revoke within existing authority |
|
|
25
25
|
|
|
26
|
-
The browser entry arrived in 0.4.0; 0.8.0 is the current release.
|
|
26
|
+
The browser entry arrived in 0.4.0; 0.8.0 is the current release, and `0.9.0-next` is the preview
|
|
27
|
+
(`npm install @alytegen/sdk@next`, see [Preview](#preview-090-next)). See [the chat integration](./BROWSER.md) for setup,
|
|
27
28
|
cookie-independent consent, reconnecting and handling uncertain purchases.
|
|
28
29
|
|
|
29
30
|
## Merchant: onboard in four calls
|
|
@@ -279,8 +280,9 @@ if (outcome.status === 'settled' && outcome.result.status === 'authorized'
|
|
|
279
280
|
}
|
|
280
281
|
```
|
|
281
282
|
|
|
282
|
-
A basket holds 1–20 lines from one merchant in one currency, atomically.
|
|
283
|
-
|
|
283
|
+
A basket holds 1–20 lines from one merchant in one currency, atomically. In 0.8.0 every line
|
|
284
|
+
must fit in full; the preview adds baskets that may shrink within limits you set and seat
|
|
285
|
+
requests (see [Preview](#preview-090-next)). The server enforces link rules,
|
|
284
286
|
party-size limits, add-on permission and spending caps across the whole basket.
|
|
285
287
|
The `BasketQuote` has `lines` and one `chargeMinor`; it has no single `unitPriceMinor`.
|
|
286
288
|
|
|
@@ -299,6 +301,55 @@ it creates another hold. If a buyer abandons a known unpaid basket, call
|
|
|
299
301
|
`releaseReservation(reservation.id)`; the server refuses release during payment.
|
|
300
302
|
See [`examples/agent-basket.ts`](./examples/agent-basket.ts) for a runnable example.
|
|
301
303
|
|
|
304
|
+
## Preview: 0.9.0-next
|
|
305
|
+
|
|
306
|
+
`npm install @alytegen/sdk@next`. The preview works against Alyte's development environment
|
|
307
|
+
(`https://dev.alytegen.com`); the stable environment does not run these features yet, and names
|
|
308
|
+
may still change before 0.9.0.
|
|
309
|
+
|
|
310
|
+
**Baskets that may shrink.** A line may carry `minQuantity` (fewest units worth having),
|
|
311
|
+
`required: false` (the line may be left out) and `step` (keep a multiple, e.g. `2` for pairs).
|
|
312
|
+
Alyte reserves the largest basket that fits the stock, the link rules and the buyer's
|
|
313
|
+
permission, in your line order. `reservation.lineOutcomes` lists every requested line as
|
|
314
|
+
`filled`, `reduced` or `dropped` with a `reason`; `reservation.lines` holds only what was reserved.
|
|
315
|
+
|
|
316
|
+
```ts
|
|
317
|
+
const reservation = await agent.reserveBasket({ lines: [
|
|
318
|
+
{ tierId: adultTierId, quantity: 4, minQuantity: 2, step: 2 },
|
|
319
|
+
{ tierId: parkingTierId, quantity: 1, required: false },
|
|
320
|
+
] });
|
|
321
|
+
for (const o of reservation.lineOutcomes ?? []) console.log(o.tierId, o.status, o.quantity, o.reason);
|
|
322
|
+
```
|
|
323
|
+
|
|
324
|
+
**Seat requests.** On a seated ticket type whose shop has a verified venue chart, a line may carry
|
|
325
|
+
`seatRequest` instead of exact `seats`. `limits` are enforced (`sections`, `rows`, `traits`,
|
|
326
|
+
`together`, `allowSplit`, `blockSize`); `preferences` only rank what the limits allow.
|
|
327
|
+
`blockSize: 2` (pairs only) needs `allowSplit: true`.
|
|
328
|
+
|
|
329
|
+
**Seat offers.** Reserve with `deferAllocation: true`, then `requestOffers(reservation.id)` returns
|
|
330
|
+
up to five sets of concrete seats, held for at most 60 seconds (`holdMs`, `deadline`).
|
|
331
|
+
`selectOffer(reservation.id, offerId)` puts the chosen seats on the reservation; then quote and
|
|
332
|
+
confirm as usual. One offer set is open per buyer and event; asking again replaces it. After the
|
|
333
|
+
deadline the call is refused with `seating_offer_expired`: ask for new offers, never assume the seats.
|
|
334
|
+
|
|
335
|
+
```ts
|
|
336
|
+
const held = await agent.reserveBasket({ deferAllocation: true, lines: [{ tierId, quantity: 2,
|
|
337
|
+
seatRequest: { limits: { sections: ['A'], together: true, allowSplit: false } } }] });
|
|
338
|
+
const { offers } = await agent.requestOffers(held.id, { maxOffers: 3 });
|
|
339
|
+
const reservation = await agent.selectOffer(held.id, offers[0]!.offerId);
|
|
340
|
+
```
|
|
341
|
+
|
|
342
|
+
**Browser (`@alytegen/sdk/browser`).** `buyBasket` lines take the same `minQuantity`, `required`,
|
|
343
|
+
`step` and `seatRequest`; the result adds `lineOutcomes` and, when Alyte's agent chose between
|
|
344
|
+
offers, `seatDecision`. A retry with the saved `attemptId` buys the same resolved basket or is
|
|
345
|
+
refused with `basket_result_unavailable`: show that as final, never start a new buy for it.
|
|
346
|
+
`watch` and `createWatch` take `lines` for a basket bought when it goes on sale
|
|
347
|
+
(`watchCapabilities().basketLines` says whether the server supports it).
|
|
348
|
+
|
|
349
|
+
**Merchant.** `seatingProvider.put / get / test` connect your seating system, including the
|
|
350
|
+
optional `chartUrl`, `offersUrl` and `partialAllocate`. `buyerSessions.mint` takes `eventId` and
|
|
351
|
+
`lines` to open Alyte's page on one event with a basket already filled in.
|
|
352
|
+
|
|
302
353
|
## Current API and console capabilities
|
|
303
354
|
|
|
304
355
|
SDK **0.8.0** adds:
|
package/dist/agent.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type ClientOptions } from './http.js';
|
|
2
2
|
import type { ConfirmOutcome, DiscoveredEvent, Hold, Merchant, Quote, Scheme } from './types.js';
|
|
3
|
-
import { type BasketQuote, type ConfirmReservationInput, type ConfirmReservationOutcome, type Reservation, type ReserveBasketInput } from './baskets.js';
|
|
3
|
+
import { type BasketQuote, type ConfirmReservationInput, type ConfirmReservationOutcome, type RequestSeatOffersInput, type Reservation, type ReserveBasketInput, type SeatOfferSet } from './baskets.js';
|
|
4
4
|
/**
|
|
5
5
|
* Agent buy-path client — the discover → quote → hold → confirm flow, with an
|
|
6
6
|
* agent JWT (`catalog:read` / `payments:write` scopes).
|
|
@@ -64,6 +64,10 @@ export declare class AlyteAgent {
|
|
|
64
64
|
reserveBasket(input: ReserveBasketInput): Promise<Reservation>;
|
|
65
65
|
/** Read the current basket and every line, including any reconciliation state. Requires payments:read. */
|
|
66
66
|
getReservation(reservationId: string): Promise<Reservation>;
|
|
67
|
+
/** BSR-4a · ask for held seat offers under an offer-mode reservation (max 5 offers, max 60s hold). */
|
|
68
|
+
requestOffers(reservationId: string, input?: RequestSeatOffersInput): Promise<SeatOfferSet>;
|
|
69
|
+
/** BSR-4a · choose one held seat offer and promote its seats onto the reservation before quoting/confirming. */
|
|
70
|
+
selectOffer(reservationId: string, offerId: string): Promise<Reservation>;
|
|
67
71
|
/** Lock one total for all held lines; the response retains each line's price. */
|
|
68
72
|
quoteReservation(reservationId: string): Promise<BasketQuote>;
|
|
69
73
|
/** Confirm the entire basket as one payment. Persist and reuse the same
|
package/dist/agent.js
CHANGED
|
@@ -61,6 +61,14 @@ export class AlyteAgent {
|
|
|
61
61
|
getReservation(reservationId) {
|
|
62
62
|
return this.t.request('GET', `/v1/reservations/${encodeURIComponent(reservationId)}`);
|
|
63
63
|
}
|
|
64
|
+
/** BSR-4a · ask for held seat offers under an offer-mode reservation (max 5 offers, max 60s hold). */
|
|
65
|
+
requestOffers(reservationId, input = {}) {
|
|
66
|
+
return this.t.request('POST', `/v1/reservations/${encodeURIComponent(reservationId)}/offers`, input);
|
|
67
|
+
}
|
|
68
|
+
/** BSR-4a · choose one held seat offer and promote its seats onto the reservation before quoting/confirming. */
|
|
69
|
+
selectOffer(reservationId, offerId) {
|
|
70
|
+
return this.t.request('POST', `/v1/reservations/${encodeURIComponent(reservationId)}/offers/${encodeURIComponent(offerId)}/select`, {});
|
|
71
|
+
}
|
|
64
72
|
/** Lock one total for all held lines; the response retains each line's price. */
|
|
65
73
|
quoteReservation(reservationId) {
|
|
66
74
|
return this.t.request('POST', `/v1/reservations/${encodeURIComponent(reservationId)}/quotes`, {});
|
package/dist/baskets.d.ts
CHANGED
|
@@ -1,15 +1,93 @@
|
|
|
1
1
|
import type { Hold, PaymentResult, Quote, Scheme } from './types.js';
|
|
2
|
-
|
|
2
|
+
export interface SeatRowRange {
|
|
3
|
+
from?: string;
|
|
4
|
+
to?: string;
|
|
5
|
+
exclude?: string[];
|
|
6
|
+
}
|
|
7
|
+
export interface SeatRequestLimits {
|
|
8
|
+
zones?: string[];
|
|
9
|
+
sections?: string[];
|
|
10
|
+
rows?: Record<string, SeatRowRange>;
|
|
11
|
+
traits?: {
|
|
12
|
+
require?: string[];
|
|
13
|
+
exclude?: string[];
|
|
14
|
+
};
|
|
15
|
+
together?: boolean;
|
|
16
|
+
allowSplit?: boolean;
|
|
17
|
+
blockSize?: number;
|
|
18
|
+
}
|
|
19
|
+
export interface SeatRequestPreferences {
|
|
20
|
+
zoneOrder?: string[];
|
|
21
|
+
rowPosition?: 'front' | 'middle' | 'back';
|
|
22
|
+
traits?: {
|
|
23
|
+
prefer?: string[];
|
|
24
|
+
avoid?: string[];
|
|
25
|
+
};
|
|
26
|
+
tradeoff?: 'cheaper' | 'better_seats' | 'balanced';
|
|
27
|
+
}
|
|
28
|
+
export interface SeatRequest {
|
|
29
|
+
limits: SeatRequestLimits;
|
|
30
|
+
preferences?: SeatRequestPreferences;
|
|
31
|
+
}
|
|
32
|
+
export interface AllocatedSeat {
|
|
33
|
+
seatId: string;
|
|
34
|
+
section?: string;
|
|
35
|
+
row?: string;
|
|
36
|
+
number?: string;
|
|
37
|
+
label?: string;
|
|
38
|
+
traits?: string[];
|
|
39
|
+
}
|
|
40
|
+
/** One requested tier in a basket. Repeated tiers are merged when no per-line limits/seats are given. */
|
|
3
41
|
export interface BasketLineInput {
|
|
4
42
|
tierId: string;
|
|
5
|
-
/** Whole units, 1..999 per submitted line.
|
|
43
|
+
/** Whole units, 1..999 per submitted line. */
|
|
6
44
|
quantity: number;
|
|
45
|
+
/** BSR-1 · fewest acceptable units if retained; defaults to quantity. */
|
|
46
|
+
minQuantity?: number;
|
|
47
|
+
/** BSR-1 · false permits dropping this line; defaults to true. */
|
|
48
|
+
required?: boolean;
|
|
49
|
+
/** D14 · retained quantity must be a positive multiple of step. */
|
|
50
|
+
step?: number;
|
|
51
|
+
/** SB-4b · exact chosen seat ids (provider-seated tiers only; mutually exclusive with seatRequest). */
|
|
52
|
+
seats?: string[];
|
|
53
|
+
/** BSR-3 · structured seat limits & preferences (provider-seated tiers with verified chart). */
|
|
54
|
+
seatRequest?: SeatRequest;
|
|
7
55
|
}
|
|
8
56
|
export interface ReserveBasketInput {
|
|
9
57
|
/** 1..20 lines from one merchant, in one currency. */
|
|
10
58
|
lines: BasketLineInput[];
|
|
11
59
|
scheme?: Scheme;
|
|
12
60
|
geo?: string;
|
|
61
|
+
/** BSR-4a · reserve counts without immediate seat allocation so offers can be requested first. */
|
|
62
|
+
deferAllocation?: boolean;
|
|
63
|
+
}
|
|
64
|
+
export interface RequestSeatOffersInput {
|
|
65
|
+
/** Maximum offers to return (default 3, max 5). */
|
|
66
|
+
maxOffers?: number;
|
|
67
|
+
/** Maximum hold duration in milliseconds (default 60000, max 60000). */
|
|
68
|
+
maxHoldMs?: number;
|
|
69
|
+
}
|
|
70
|
+
export interface SeatOfferLine {
|
|
71
|
+
lineNo: number;
|
|
72
|
+
tierId: string;
|
|
73
|
+
status: 'filled' | 'reduced' | 'dropped';
|
|
74
|
+
quantity: number;
|
|
75
|
+
seats: AllocatedSeat[];
|
|
76
|
+
reason?: string;
|
|
77
|
+
}
|
|
78
|
+
export interface SeatOffer {
|
|
79
|
+
offerId: string;
|
|
80
|
+
adjacency: 'together' | 'split';
|
|
81
|
+
lines: SeatOfferLine[];
|
|
82
|
+
}
|
|
83
|
+
export interface SeatOfferSet {
|
|
84
|
+
offerSetId: string;
|
|
85
|
+
reservationId: string;
|
|
86
|
+
holdMs: number;
|
|
87
|
+
deadline: string;
|
|
88
|
+
offersLimited?: boolean;
|
|
89
|
+
chartVersion?: string;
|
|
90
|
+
offers: SeatOffer[];
|
|
13
91
|
}
|
|
14
92
|
export type ReservationStatus = 'held' | 'confirmed' | 'released' | 'expired' | 'reconcile';
|
|
15
93
|
/** A reservation line is a hold; reconcile protects stock while a payment is uncertain. */
|
|
@@ -18,6 +96,9 @@ export interface ReservationLine extends Omit<Hold, 'status'> {
|
|
|
18
96
|
reservationId?: string;
|
|
19
97
|
status: ReservationStatus;
|
|
20
98
|
confirmToken?: string;
|
|
99
|
+
seats?: AllocatedSeat[];
|
|
100
|
+
/** 1-based position of this line in the reservation. */
|
|
101
|
+
lineNo?: number;
|
|
21
102
|
}
|
|
22
103
|
export interface Reservation {
|
|
23
104
|
id: string;
|
|
@@ -31,6 +112,55 @@ export interface Reservation {
|
|
|
31
112
|
expiresAt: string;
|
|
32
113
|
createdAt: string;
|
|
33
114
|
confirmToken?: string;
|
|
115
|
+
/** Every line you asked for, including dropped ones; `lines` holds only what was reserved.
|
|
116
|
+
* Present when a line carried `minQuantity`, `required: false` or `step`. */
|
|
117
|
+
lineOutcomes?: BasketLineOutcome[];
|
|
118
|
+
/** Seats held in several zones while offers are open; they are not reserved lines until an offer is selected. */
|
|
119
|
+
provisionalClaims?: ProvisionalClaim[];
|
|
120
|
+
}
|
|
121
|
+
/** Why a line was reduced or dropped. Treat an unknown value as a generic reason. */
|
|
122
|
+
export type BasketLineOutcomeReason = 'sold_out' | 'not_available' | 'shared_capacity' | 'per_purchase_limit' | 'link_rule' | 'step' | 'spend_cap' | 'addon_cap' | 'addon_not_permitted' | 'party_quantity_limit' | 'purchase_limit' | 'held_limit' | 'mandate_scope' | 'no_adjacent_seats' | 'seats_unavailable' | 'no_matching_seats' | (string & {});
|
|
123
|
+
/** What happened to one requested line of a basket that allowed a smaller result. */
|
|
124
|
+
export interface BasketLineOutcome {
|
|
125
|
+
tierId: string;
|
|
126
|
+
requestedQuantity: number;
|
|
127
|
+
minQuantity: number;
|
|
128
|
+
required: boolean;
|
|
129
|
+
/** Units reserved; 0 when dropped. */
|
|
130
|
+
quantity: number;
|
|
131
|
+
status: 'filled' | 'reduced' | 'dropped';
|
|
132
|
+
reason?: BasketLineOutcomeReason;
|
|
133
|
+
}
|
|
134
|
+
export interface ProvisionalClaim {
|
|
135
|
+
lineNo: number;
|
|
136
|
+
primaryTierId?: string;
|
|
137
|
+
tierIds: string[];
|
|
138
|
+
quantity: number;
|
|
139
|
+
status: 'held' | 'promoted' | 'released' | 'expired';
|
|
140
|
+
}
|
|
141
|
+
/** How Alyte's agent picked between held seat offers. Structured only: no free text is recorded. */
|
|
142
|
+
export interface SeatDecision {
|
|
143
|
+
version: 1;
|
|
144
|
+
chooserKind: 'rules' | 'model';
|
|
145
|
+
modelId?: string;
|
|
146
|
+
fallbackReason?: string;
|
|
147
|
+
chosenOfferId: string;
|
|
148
|
+
chosenProbability: number;
|
|
149
|
+
offerCount: number;
|
|
150
|
+
chosen: {
|
|
151
|
+
offerId: string;
|
|
152
|
+
totalPriceMinor: number;
|
|
153
|
+
currency: string;
|
|
154
|
+
adjacency: 'together' | 'split';
|
|
155
|
+
seatCount: number;
|
|
156
|
+
section?: string;
|
|
157
|
+
sectionLabel?: string;
|
|
158
|
+
row?: string;
|
|
159
|
+
traits: string[];
|
|
160
|
+
seats: AllocatedSeat[];
|
|
161
|
+
};
|
|
162
|
+
alternatives: Array<Record<string, unknown>>;
|
|
163
|
+
decidedAt: string;
|
|
34
164
|
}
|
|
35
165
|
export interface BasketQuoteLine {
|
|
36
166
|
lineNo: number;
|
package/dist/browser.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { DiscoveredEvent, PaymentResult, Scheme } from './types.js';
|
|
2
|
+
import type { BasketLineOutcome, SeatDecision, SeatRequest } from './baskets.js';
|
|
2
3
|
export { AlyteApiError } from './http.js';
|
|
3
4
|
export interface BuyerConnection {
|
|
4
5
|
bearer: string;
|
|
@@ -49,11 +50,13 @@ export interface BuyerAgent {
|
|
|
49
50
|
mandates: BuyerMandate[];
|
|
50
51
|
}
|
|
51
52
|
export interface BuyerWatch {
|
|
53
|
+
/** On a basket watch, `tierId` and `quantity` are those of its first required line; read `lines` for the basket. */
|
|
52
54
|
id: string;
|
|
53
55
|
agentId: string;
|
|
54
56
|
merchantId: string;
|
|
55
57
|
tierId: string;
|
|
56
58
|
quantity: number;
|
|
59
|
+
lines?: BuyerBasketLine[];
|
|
57
60
|
status: 'queued' | 'paused' | 'firing' | 'awaiting_sca' | 'fired' | 'failed' | 'cancelled' | 'expired';
|
|
58
61
|
result?: BuyerWatchResult;
|
|
59
62
|
expiresAt?: string;
|
|
@@ -118,10 +121,14 @@ export interface WatchInstruction {
|
|
|
118
121
|
/** Save the whole instruction (not the bearer) BEFORE sending; reuse this UUID after an uncertain response. */
|
|
119
122
|
requestId: string;
|
|
120
123
|
agentId: string;
|
|
124
|
+
/** One ticket type, or `lines` for a basket (never both). */
|
|
121
125
|
request: {
|
|
122
126
|
kind: 'ticketing';
|
|
123
127
|
tierId: string;
|
|
124
128
|
quantity: number;
|
|
129
|
+
} | {
|
|
130
|
+
kind: 'ticketing';
|
|
131
|
+
lines: BuyerBasketLine[];
|
|
125
132
|
};
|
|
126
133
|
condition: WatchCondition;
|
|
127
134
|
/** ISO-8601 with an explicit offset, e.g. 2026-11-01T12:00:00Z. */
|
|
@@ -134,23 +141,50 @@ export type BuyerPurchase = {
|
|
|
134
141
|
currency: string;
|
|
135
142
|
paymentState?: string;
|
|
136
143
|
agentName?: string;
|
|
137
|
-
|
|
144
|
+
/** Set on a basket buy: its reservation and the priced lines (integer minor units). */
|
|
145
|
+
reservationId?: string;
|
|
146
|
+
lines?: BasketPurchaseLine[];
|
|
147
|
+
} & BasketPurchaseDetail | {
|
|
138
148
|
status: 'sca_required';
|
|
139
149
|
purchaseId: string;
|
|
140
150
|
challenge: {
|
|
141
151
|
expiresAt: string;
|
|
142
152
|
};
|
|
143
|
-
} | {
|
|
153
|
+
} & BasketPurchaseDetail | {
|
|
144
154
|
status: 'sca_required';
|
|
145
155
|
purchaseId?: never;
|
|
146
156
|
challenge?: never;
|
|
147
|
-
} | {
|
|
157
|
+
} & BasketPurchaseDetail | {
|
|
148
158
|
status: 'pending';
|
|
149
159
|
purchaseId: string;
|
|
150
160
|
} | {
|
|
151
161
|
status: 'refused' | 'error';
|
|
152
162
|
outcome: unknown;
|
|
153
|
-
};
|
|
163
|
+
} & BasketPurchaseDetail;
|
|
164
|
+
/** Extra detail on a basket buy. `lineOutcomes` lists every requested line when the basket allowed a
|
|
165
|
+
* smaller result; `seatDecision` records how Alyte's agent chose between seat offers. */
|
|
166
|
+
export interface BasketPurchaseDetail {
|
|
167
|
+
lineOutcomes?: BasketLineOutcome[];
|
|
168
|
+
seatDecision?: SeatDecision;
|
|
169
|
+
}
|
|
170
|
+
/** One basket line the buyer asks for. `quantity` is the most wanted; `minQuantity`, `required: false`
|
|
171
|
+
* and `step` say how far it may shrink. `seats` (exact ids) and `seatRequest` are mutually exclusive. */
|
|
172
|
+
export interface BuyerBasketLine {
|
|
173
|
+
tierId: string;
|
|
174
|
+
quantity: number;
|
|
175
|
+
minQuantity?: number;
|
|
176
|
+
required?: boolean;
|
|
177
|
+
step?: number;
|
|
178
|
+
seats?: string[];
|
|
179
|
+
seatRequest?: SeatRequest;
|
|
180
|
+
}
|
|
181
|
+
export interface BasketPurchaseLine {
|
|
182
|
+
lineNo: number;
|
|
183
|
+
tierId: string;
|
|
184
|
+
quantity: number;
|
|
185
|
+
unitPriceMinor: number;
|
|
186
|
+
subtotalMinor: number;
|
|
187
|
+
}
|
|
154
188
|
export type BuyerPurchaseStatus = 'pending' | 'sca_required' | 'settled' | 'refused' | 'cancelled' | 'expired';
|
|
155
189
|
export interface BuyerPurchaseState {
|
|
156
190
|
authenticationRetry?: boolean;
|
|
@@ -217,17 +251,36 @@ export declare function createBuyerClient(opts: BuyerClientOptions): {
|
|
|
217
251
|
quantity: number;
|
|
218
252
|
attemptId: string;
|
|
219
253
|
}) => Promise<BuyerPurchase>;
|
|
254
|
+
/**
|
|
255
|
+
* Several ticket types (ticket + add-ons) reserved together and paid as ONE charge. All-or-nothing
|
|
256
|
+
* unless a line says how far it may shrink (`minQuantity`, `required: false`, `step`); the result's
|
|
257
|
+
* `lineOutcomes` then lists what each line got. Same attempt rule as buy(): save attemptId first and
|
|
258
|
+
* reuse it after an uncertain response. A retry buys the SAME resolved basket or is refused with
|
|
259
|
+
* `basket_result_unavailable`; a reused attemptId with other lines is refused.
|
|
260
|
+
*/
|
|
261
|
+
buyBasket: (input: {
|
|
262
|
+
agentId: string;
|
|
263
|
+
lines: BuyerBasketLine[];
|
|
264
|
+
attemptId: string;
|
|
265
|
+
}) => Promise<BuyerPurchase>;
|
|
220
266
|
/** Recover this purchase; never start a new buy after an uncertain response or a challenge. */
|
|
221
267
|
purchase: (purchaseId: string) => Promise<BuyerPurchaseState>;
|
|
222
268
|
resumePurchase: (purchaseId: string) => Promise<BuyerPurchaseState>;
|
|
223
269
|
cancelPurchase: (purchaseId: string) => Promise<BuyerPurchaseState>;
|
|
224
270
|
payment: (intentId: string) => Promise<BuyerReceipt>;
|
|
271
|
+
/** Queue one ticket type, or a basket with `lines` (never both). Ask `watchCapabilities()` for `basketLines` first. */
|
|
225
272
|
watch: (input: {
|
|
226
273
|
agentId: string;
|
|
274
|
+
expiresInDays?: number;
|
|
275
|
+
} & ({
|
|
227
276
|
tierId: string;
|
|
228
277
|
quantity: number;
|
|
229
|
-
|
|
230
|
-
}
|
|
278
|
+
lines?: never;
|
|
279
|
+
} | {
|
|
280
|
+
lines: BuyerBasketLine[];
|
|
281
|
+
tierId?: never;
|
|
282
|
+
quantity?: never;
|
|
283
|
+
})) => Promise<{
|
|
231
284
|
watch: BuyerWatch;
|
|
232
285
|
}>;
|
|
233
286
|
cancelWatch: (watchId: string) => Promise<{
|
|
@@ -237,7 +290,8 @@ export declare function createBuyerClient(opts: BuyerClientOptions): {
|
|
|
237
290
|
watchCapabilities: () => Promise<{
|
|
238
291
|
schemaVersion: 1;
|
|
239
292
|
requestKinds: string[];
|
|
240
|
-
conditions: string[];
|
|
293
|
+
conditions: string[]; /** True when watches take basket `lines`. Absent on older servers. */
|
|
294
|
+
basketLines?: boolean;
|
|
241
295
|
queuePolicy: string;
|
|
242
296
|
}>;
|
|
243
297
|
/**
|
|
@@ -297,6 +351,8 @@ export interface ConsentOptions {
|
|
|
297
351
|
tierId?: string;
|
|
298
352
|
quantity?: number;
|
|
299
353
|
lang?: string;
|
|
354
|
+
/** Accessible title for the hosted iframe (WCAG 4.1.2 / EN 301 549). Defaults to a localized title matching `lang`. */
|
|
355
|
+
title?: string;
|
|
300
356
|
/** Optional back link. Restricted to this host origin; the callback decides navigation. */
|
|
301
357
|
returnUrl?: string;
|
|
302
358
|
onNavigate?: (url: string) => void;
|
package/dist/browser.js
CHANGED
|
@@ -47,12 +47,31 @@ export function createBuyerClient(opts) {
|
|
|
47
47
|
throw new TypeError('A saved UUID attemptId is required');
|
|
48
48
|
return call('POST', `/agents/${encodeURIComponent(input.agentId)}/buy`, { tierId: input.tierId, quantity: input.quantity, attemptId: input.attemptId });
|
|
49
49
|
},
|
|
50
|
+
/**
|
|
51
|
+
* Several ticket types (ticket + add-ons) reserved together and paid as ONE charge. All-or-nothing
|
|
52
|
+
* unless a line says how far it may shrink (`minQuantity`, `required: false`, `step`); the result's
|
|
53
|
+
* `lineOutcomes` then lists what each line got. Same attempt rule as buy(): save attemptId first and
|
|
54
|
+
* reuse it after an uncertain response. A retry buys the SAME resolved basket or is refused with
|
|
55
|
+
* `basket_result_unavailable`; a reused attemptId with other lines is refused.
|
|
56
|
+
*/
|
|
57
|
+
buyBasket: (input) => {
|
|
58
|
+
if (typeof input.attemptId !== 'string' || !/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(input.attemptId))
|
|
59
|
+
throw new TypeError('A saved UUID attemptId is required');
|
|
60
|
+
return call('POST', `/agents/${encodeURIComponent(input.agentId)}/buy`, { lines: basketLines(input.lines), attemptId: input.attemptId });
|
|
61
|
+
},
|
|
50
62
|
/** Recover this purchase; never start a new buy after an uncertain response or a challenge. */
|
|
51
63
|
purchase: (purchaseId) => call('GET', `/purchases/${encodeURIComponent(purchaseId)}`),
|
|
52
64
|
resumePurchase: (purchaseId) => call('POST', `/purchases/${encodeURIComponent(purchaseId)}/resume`, {}),
|
|
53
65
|
cancelPurchase: (purchaseId) => call('POST', `/purchases/${encodeURIComponent(purchaseId)}/cancel`, {}),
|
|
54
66
|
payment: (intentId) => call('GET', `/payments/${encodeURIComponent(intentId)}`),
|
|
55
|
-
|
|
67
|
+
/** Queue one ticket type, or a basket with `lines` (never both). Ask `watchCapabilities()` for `basketLines` first. */
|
|
68
|
+
watch: (input) => {
|
|
69
|
+
if (input.lines === undefined)
|
|
70
|
+
return call('POST', '/watches', input);
|
|
71
|
+
if ('tierId' in input || 'quantity' in input)
|
|
72
|
+
throw new TypeError('A basket watch takes lines, not tierId or quantity');
|
|
73
|
+
return call('POST', '/watches', { agentId: input.agentId, lines: basketLines(input.lines), ...(input.expiresInDays !== undefined ? { expiresInDays: input.expiresInDays } : {}) });
|
|
74
|
+
},
|
|
56
75
|
cancelWatch: (watchId) => call('DELETE', `/watches/${encodeURIComponent(watchId)}`),
|
|
57
76
|
/** What this deployment enforces. Discovery only — the server still refuses anything unsupported. */
|
|
58
77
|
watchCapabilities: () => call('GET', '/watch-capabilities'),
|
|
@@ -65,6 +84,11 @@ export function createBuyerClient(opts) {
|
|
|
65
84
|
throw new TypeError('A saved UUID requestId is required');
|
|
66
85
|
if (input.condition?.kind === 'price_at_or_below' && !Number.isSafeInteger(input.condition.maxChargeMinor))
|
|
67
86
|
throw new TypeError('maxChargeMinor must be an integer in minor units');
|
|
87
|
+
if ('lines' in input.request) {
|
|
88
|
+
if ('tierId' in input.request || 'quantity' in input.request)
|
|
89
|
+
throw new TypeError('A basket watch takes lines, not tierId or quantity');
|
|
90
|
+
return call('POST', '/watch-requests', { ...input, request: { kind: input.request.kind, lines: basketLines(input.request.lines) } });
|
|
91
|
+
}
|
|
68
92
|
return call('POST', '/watch-requests', input);
|
|
69
93
|
},
|
|
70
94
|
getWatch: (watchId, init) => call('GET', `/watches/${encodeURIComponent(watchId)}`, undefined, init?.signal),
|
|
@@ -139,6 +163,30 @@ export function observeWatch(opts) {
|
|
|
139
163
|
doc?.addEventListener('visibilitychange', onVisible);
|
|
140
164
|
void tick();
|
|
141
165
|
}
|
|
166
|
+
const CONSENT_IFRAME_TITLES = {
|
|
167
|
+
en: 'Alyte consent',
|
|
168
|
+
de: 'Alyte-Einwilligung',
|
|
169
|
+
es: 'Consentimiento de Alyte',
|
|
170
|
+
fr: 'Consentement Alyte',
|
|
171
|
+
hu: 'Alyte jóváhagyás',
|
|
172
|
+
pt: 'Consentimento Alyte',
|
|
173
|
+
};
|
|
174
|
+
const CHALLENGE_IFRAME_TITLES = {
|
|
175
|
+
en: 'Alyte bank authentication',
|
|
176
|
+
de: 'Alyte-Bankauthentifizierung',
|
|
177
|
+
es: 'Autenticación bancaria de Alyte',
|
|
178
|
+
fr: 'Authentification bancaire Alyte',
|
|
179
|
+
hu: 'Alyte banki hitelesítés',
|
|
180
|
+
pt: 'Autenticação bancária Alyte',
|
|
181
|
+
};
|
|
182
|
+
function iframeTitleFor(kind, lang, override) {
|
|
183
|
+
const custom = override?.trim();
|
|
184
|
+
if (custom)
|
|
185
|
+
return custom;
|
|
186
|
+
const primary = (lang || 'en').toLowerCase().split('-')[0] || 'en';
|
|
187
|
+
const map = kind === 'challenge' ? CHALLENGE_IFRAME_TITLES : CONSENT_IFRAME_TITLES;
|
|
188
|
+
return map[primary] ?? map.en;
|
|
189
|
+
}
|
|
142
190
|
export class AlyteConsentError extends Error {
|
|
143
191
|
code;
|
|
144
192
|
constructor(code) {
|
|
@@ -182,7 +230,7 @@ export function openConsent(opts) {
|
|
|
182
230
|
}
|
|
183
231
|
return new Promise((resolve, reject) => {
|
|
184
232
|
const iframe = doc.createElement('iframe');
|
|
185
|
-
iframe.title = '
|
|
233
|
+
iframe.title = iframeTitleFor('consent', opts.lang, opts.title);
|
|
186
234
|
iframe.src = url.href;
|
|
187
235
|
iframe.referrerPolicy = 'no-referrer';
|
|
188
236
|
iframe.style.width = '100%';
|
|
@@ -287,7 +335,7 @@ export function openChallenge(opts) {
|
|
|
287
335
|
const statuses = ['pending', 'sca_required', 'settled', 'refused', 'cancelled', 'expired'];
|
|
288
336
|
return new Promise((resolve, reject) => {
|
|
289
337
|
const iframe = doc.createElement('iframe');
|
|
290
|
-
iframe.title = '
|
|
338
|
+
iframe.title = iframeTitleFor('challenge', opts.lang, opts.title);
|
|
291
339
|
iframe.src = url.href;
|
|
292
340
|
iframe.referrerPolicy = 'no-referrer';
|
|
293
341
|
iframe.style.width = '100%';
|
|
@@ -350,3 +398,27 @@ export function openChallenge(opts) {
|
|
|
350
398
|
opts.container.append(iframe);
|
|
351
399
|
});
|
|
352
400
|
}
|
|
401
|
+
const BASKET_LINE_KEYS = ['tierId', 'quantity', 'minQuantity', 'required', 'step', 'seats', 'seatRequest'];
|
|
402
|
+
/** Refused, never stripped: a mistyped field would otherwise be bought without the limit it meant to set. */
|
|
403
|
+
function basketLines(lines) {
|
|
404
|
+
if (!Array.isArray(lines) || !lines.length)
|
|
405
|
+
throw new TypeError('A basket needs at least one line');
|
|
406
|
+
return lines.map((line) => {
|
|
407
|
+
const extra = Object.keys(line).filter((k) => !BASKET_LINE_KEYS.includes(k));
|
|
408
|
+
if (extra.length)
|
|
409
|
+
throw new TypeError(`A basket line takes tierId, quantity, minQuantity, required, step, seats and seatRequest (got ${extra.join(', ')})`);
|
|
410
|
+
if (line.seats !== undefined && line.seatRequest !== undefined)
|
|
411
|
+
throw new TypeError('A basket line takes seats or seatRequest, not both');
|
|
412
|
+
for (const k of ['quantity', 'minQuantity', 'step']) {
|
|
413
|
+
if (line[k] !== undefined && !(Number.isSafeInteger(line[k]) && line[k] > 0))
|
|
414
|
+
throw new TypeError(`${k} must be a positive integer`);
|
|
415
|
+
}
|
|
416
|
+
if (line.minQuantity !== undefined && line.minQuantity > line.quantity)
|
|
417
|
+
throw new TypeError('minQuantity cannot exceed quantity');
|
|
418
|
+
const out = { tierId: line.tierId, quantity: line.quantity };
|
|
419
|
+
for (const k of ['minQuantity', 'required', 'step', 'seats', 'seatRequest'])
|
|
420
|
+
if (line[k] !== undefined)
|
|
421
|
+
out[k] = line[k];
|
|
422
|
+
return out;
|
|
423
|
+
});
|
|
424
|
+
}
|
package/dist/index.d.ts
CHANGED
|
@@ -4,4 +4,5 @@ export { AlyteApiError, type ClientOptions } from './http.js';
|
|
|
4
4
|
export { verifyWebhookSignature } from './webhookVerify.js';
|
|
5
5
|
export { handleWebhook, createWebhookHandler, type AlyteEventEnvelope, type PaymentSettled, type WatchFailed, type WatchActionRequired, type WebhookTest, type PurchaseHandlers, type OnPurchaseOptions, type WebhookResult, } from './onPurchase.js';
|
|
6
6
|
export type * from './types.js';
|
|
7
|
+
export type * from './baskets.js';
|
|
7
8
|
export type { AccessAudience, AccessDraftInput, AccessRule, AccessPreview, AccessCommitInput, MembershipProgram, MembershipEvidence } from './access.js';
|
package/dist/merchant.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type ClientOptions } from './http.js';
|
|
2
2
|
import { MerchantAccessRules, MerchantMemberships } from './access.js';
|
|
3
|
-
import type { BuyerSessionMint, CatalogMerchant, Merchant, EventItem, MerchantPspLink, Tier, TierKind, FeeBearer, Scheme, PaymentRow, WebhookEndpoint, MerchantInsights, InventoryCatalog, InventoryLocation, InventoryLocationBinding, InventoryOccurrence, InventoryPool, PurchaseLimit, PurchaseLimitReadiness, SetPurchaseLimitInput } from './types.js';
|
|
3
|
+
import type { BuyerSessionMint, CatalogMerchant, Merchant, EventItem, MerchantPspLink, Tier, TierKind, FeeBearer, Scheme, PaymentRow, WebhookEndpoint, MerchantInsights, MerchantBuyerWatchList, SeatingProvider, SeatingProviderInput, SeatingProviderTest, InventoryCatalog, InventoryLocation, InventoryLocationBinding, InventoryOccurrence, InventoryPool, PurchaseLimit, PurchaseLimitReadiness, SetPurchaseLimitInput } from './types.js';
|
|
4
4
|
/**
|
|
5
5
|
* Merchant integration client — drives the `/v1/integration/*` surface with a
|
|
6
6
|
* console-minted API token (`merchant:read` / `merchant:write` scopes; `merchant:admin` for
|
|
@@ -214,6 +214,19 @@ export declare class AlyteMerchant {
|
|
|
214
214
|
payments: PaymentRow[];
|
|
215
215
|
}>;
|
|
216
216
|
getPayment(intentId: string): Promise<unknown>;
|
|
217
|
+
/**
|
|
218
|
+
* ONE buyer's queued purchases at your shops, newest first. `buyerRef` is the `byr_…` id the
|
|
219
|
+
* buyer-session mint returned. Only your account is searched: the same buyer's purchases at
|
|
220
|
+
* another merchant never appear. `status: 'active'` (default) returns queued, paused, firing and
|
|
221
|
+
* awaiting_sca; `'all'` adds the history. Read only — cancelling stays with the buyer on Alyte's
|
|
222
|
+
* page. Lets you show a signed-in buyer their waiting agents without minting a buyer session.
|
|
223
|
+
*/
|
|
224
|
+
buyerWatches(buyerRef: string, opts?: {
|
|
225
|
+
status?: 'active' | 'all';
|
|
226
|
+
merchantId?: string;
|
|
227
|
+
limit?: number;
|
|
228
|
+
cursor?: string;
|
|
229
|
+
}): Promise<MerchantBuyerWatchList>;
|
|
217
230
|
/** Agent adoption + per-tier watch demand for a shop (counts only — the
|
|
218
231
|
* "N in line" number; never buyer identities). */
|
|
219
232
|
insights(merchantId: string): Promise<MerchantInsights>;
|
|
@@ -238,6 +251,25 @@ export declare class AlyteMerchant {
|
|
|
238
251
|
ok: boolean;
|
|
239
252
|
}>;
|
|
240
253
|
};
|
|
254
|
+
/**
|
|
255
|
+
* The shop's seating system: the URLs Alyte calls to allocate and release seats, plus the optional
|
|
256
|
+
* venue chart, seat offers and partial allocation. Every Alyte call is signed like a webhook; verify it with
|
|
257
|
+
* `verifyWebhookSignature` and the signing secret.
|
|
258
|
+
*/
|
|
259
|
+
readonly seatingProvider: {
|
|
260
|
+
/** Connect or change it (admin key). `signingSecret` is returned ONCE, on the first call or with
|
|
261
|
+
* `rotateSecret`. A changed URL or secret, or enabling `partialAllocate`, needs `test()` again. */
|
|
262
|
+
put: (merchantId: string, input: SeatingProviderInput) => Promise<{
|
|
263
|
+
seatingProvider: SeatingProvider;
|
|
264
|
+
signingSecret?: string;
|
|
265
|
+
}>;
|
|
266
|
+
get: (merchantId: string) => Promise<{
|
|
267
|
+
seatingProvider: SeatingProvider;
|
|
268
|
+
}>;
|
|
269
|
+
/** Pings every configured URL. Resolves only when all answer 2xx; otherwise throws
|
|
270
|
+
* `AlyteApiError` 409 `seating_provider_unverified` with the per-URL results in `details`. */
|
|
271
|
+
test: (merchantId: string) => Promise<SeatingProviderTest>;
|
|
272
|
+
};
|
|
241
273
|
readonly buyerSessions: {
|
|
242
274
|
/**
|
|
243
275
|
* Attest YOUR authenticated user → a single-use redeem link (15-min TTL).
|
|
@@ -252,6 +284,16 @@ export declare class AlyteMerchant {
|
|
|
252
284
|
tierId?: string;
|
|
253
285
|
/** Ticket count hint (1–10), requires tierId; permission and tier limits still govern. */
|
|
254
286
|
quantity?: number;
|
|
287
|
+
/** Open Alyte's page on this event's instruction form. Must be an event of this shop. */
|
|
288
|
+
eventId?: string;
|
|
289
|
+
/** Seed a basket for ONE event (1–20 lines, no repeated ticket type); cannot be combined with
|
|
290
|
+
* tierId/quantity. A hint only: the buyer reviews and confirms on Alyte's page. */
|
|
291
|
+
lines?: Array<{
|
|
292
|
+
tierId: string;
|
|
293
|
+
quantity: number;
|
|
294
|
+
minQuantity?: number;
|
|
295
|
+
required?: boolean;
|
|
296
|
+
}>;
|
|
255
297
|
/** Back-to-shop link, not an automatic redirect. HTTPS (local HTTP allowed);
|
|
256
298
|
* restricted to registered embed origins when configured. */
|
|
257
299
|
returnUrl?: string;
|
package/dist/merchant.js
CHANGED
|
@@ -144,6 +144,25 @@ export class AlyteMerchant {
|
|
|
144
144
|
getPayment(intentId) {
|
|
145
145
|
return this.t.request('GET', `/v1/integration/payments/${encodeURIComponent(intentId)}`);
|
|
146
146
|
}
|
|
147
|
+
/**
|
|
148
|
+
* ONE buyer's queued purchases at your shops, newest first. `buyerRef` is the `byr_…` id the
|
|
149
|
+
* buyer-session mint returned. Only your account is searched: the same buyer's purchases at
|
|
150
|
+
* another merchant never appear. `status: 'active'` (default) returns queued, paused, firing and
|
|
151
|
+
* awaiting_sca; `'all'` adds the history. Read only — cancelling stays with the buyer on Alyte's
|
|
152
|
+
* page. Lets you show a signed-in buyer their waiting agents without minting a buyer session.
|
|
153
|
+
*/
|
|
154
|
+
buyerWatches(buyerRef, opts = {}) {
|
|
155
|
+
const q = new URLSearchParams({ buyerRef });
|
|
156
|
+
if (opts.status)
|
|
157
|
+
q.set('status', opts.status);
|
|
158
|
+
if (opts.merchantId)
|
|
159
|
+
q.set('merchantId', opts.merchantId);
|
|
160
|
+
if (opts.limit)
|
|
161
|
+
q.set('limit', String(opts.limit));
|
|
162
|
+
if (opts.cursor)
|
|
163
|
+
q.set('cursor', opts.cursor);
|
|
164
|
+
return this.t.request('GET', `/v1/integration/watches?${q.toString()}`);
|
|
165
|
+
}
|
|
147
166
|
/** Agent adoption + per-tier watch demand for a shop (counts only — the
|
|
148
167
|
* "N in line" number; never buyer identities). */
|
|
149
168
|
insights(merchantId) {
|
|
@@ -160,6 +179,20 @@ export class AlyteMerchant {
|
|
|
160
179
|
/** Disable an endpoint — delivery (including queued retries) stops immediately. */
|
|
161
180
|
delete: (id) => this.t.request('DELETE', `/v1/integration/webhooks/${encodeURIComponent(id)}`),
|
|
162
181
|
};
|
|
182
|
+
/**
|
|
183
|
+
* The shop's seating system: the URLs Alyte calls to allocate and release seats, plus the optional
|
|
184
|
+
* venue chart, seat offers and partial allocation. Every Alyte call is signed like a webhook; verify it with
|
|
185
|
+
* `verifyWebhookSignature` and the signing secret.
|
|
186
|
+
*/
|
|
187
|
+
seatingProvider = {
|
|
188
|
+
/** Connect or change it (admin key). `signingSecret` is returned ONCE, on the first call or with
|
|
189
|
+
* `rotateSecret`. A changed URL or secret, or enabling `partialAllocate`, needs `test()` again. */
|
|
190
|
+
put: (merchantId, input) => this.t.request('PUT', `/v1/integration/merchants/${encodeURIComponent(merchantId)}/seating-provider`, input),
|
|
191
|
+
get: (merchantId) => this.t.request('GET', `/v1/integration/merchants/${encodeURIComponent(merchantId)}/seating-provider`),
|
|
192
|
+
/** Pings every configured URL. Resolves only when all answer 2xx; otherwise throws
|
|
193
|
+
* `AlyteApiError` 409 `seating_provider_unverified` with the per-URL results in `details`. */
|
|
194
|
+
test: (merchantId) => this.t.request('POST', `/v1/integration/merchants/${encodeURIComponent(merchantId)}/seating-provider/test`, {}),
|
|
195
|
+
};
|
|
163
196
|
buyerSessions = {
|
|
164
197
|
/**
|
|
165
198
|
* Attest YOUR authenticated user → a single-use redeem link (15-min TTL).
|
package/dist/types.d.ts
CHANGED
|
@@ -251,6 +251,32 @@ export interface WebhookEndpoint {
|
|
|
251
251
|
description?: string;
|
|
252
252
|
createdAt: string;
|
|
253
253
|
}
|
|
254
|
+
/** One buyer's queued purchase at your shops (`GET /v1/integration/watches`). */
|
|
255
|
+
export interface MerchantBuyerWatch {
|
|
256
|
+
id: string;
|
|
257
|
+
/** `firing` = being bought right now; `awaiting_sca` = waiting for the buyer's bank approval;
|
|
258
|
+
* `paused` = needs the buyer on Alyte's page. Active = queued | paused | firing | awaiting_sca. */
|
|
259
|
+
status: 'queued' | 'paused' | 'firing' | 'awaiting_sca' | 'fired' | 'failed' | 'cancelled' | 'expired';
|
|
260
|
+
merchantId: string;
|
|
261
|
+
/** The Alyte tier id, as in the integration catalogue. */
|
|
262
|
+
tierId: string;
|
|
263
|
+
/** Absent when the tier or event no longer exists. */
|
|
264
|
+
tierTitle?: string;
|
|
265
|
+
eventTitle?: string;
|
|
266
|
+
quantity: number;
|
|
267
|
+
agentId: string;
|
|
268
|
+
createdAt: string;
|
|
269
|
+
expiresAt?: string;
|
|
270
|
+
/** Why a queued purchase is waiting, as the dispatcher last decided. */
|
|
271
|
+
waitingReason?: 'access_window' | 'price_target' | 'stock' | 'whole_party' | 'purchase_limit';
|
|
272
|
+
/** When the buyer's next opening starts (with `access_window`). */
|
|
273
|
+
nextEligibleAt?: string;
|
|
274
|
+
}
|
|
275
|
+
/** A page of one buyer's queued purchases; pass `nextCursor` back as `cursor` for the next page. */
|
|
276
|
+
export interface MerchantBuyerWatchList {
|
|
277
|
+
watches: MerchantBuyerWatch[];
|
|
278
|
+
nextCursor?: string;
|
|
279
|
+
}
|
|
254
280
|
/** Agent adoption + per-tier watch demand for one shop (counts only). */
|
|
255
281
|
export interface MerchantInsights {
|
|
256
282
|
agents: {
|
|
@@ -278,3 +304,43 @@ export interface MerchantInsights {
|
|
|
278
304
|
};
|
|
279
305
|
}>;
|
|
280
306
|
}
|
|
307
|
+
/** The shop's seating-system connection. The signing secret is never part of it. */
|
|
308
|
+
export interface SeatingProvider {
|
|
309
|
+
merchantId: string;
|
|
310
|
+
allocateUrl: string;
|
|
311
|
+
releaseUrl: string;
|
|
312
|
+
/** Venue chart: enables seat requests (sections, rows, traits). */
|
|
313
|
+
chartUrl?: string;
|
|
314
|
+
/** Held seat offers the agent chooses from. */
|
|
315
|
+
offersUrl?: string;
|
|
316
|
+
/** Whether a seated basket may come back reduced or with a line dropped. */
|
|
317
|
+
partialAllocate: boolean;
|
|
318
|
+
status: 'pending' | 'verified';
|
|
319
|
+
verifiedAt?: string;
|
|
320
|
+
lastTestError?: string;
|
|
321
|
+
updatedAt: string;
|
|
322
|
+
}
|
|
323
|
+
export interface SeatingProviderInput {
|
|
324
|
+
allocateUrl: string;
|
|
325
|
+
releaseUrl: string;
|
|
326
|
+
/** `null` removes it. */
|
|
327
|
+
chartUrl?: string | null;
|
|
328
|
+
offersUrl?: string | null;
|
|
329
|
+
partialAllocate?: boolean;
|
|
330
|
+
rotateSecret?: boolean;
|
|
331
|
+
}
|
|
332
|
+
export interface SeatingProviderPing {
|
|
333
|
+
ok: boolean;
|
|
334
|
+
status?: number;
|
|
335
|
+
error?: string;
|
|
336
|
+
}
|
|
337
|
+
export interface SeatingProviderTest {
|
|
338
|
+
verified: true;
|
|
339
|
+
seatingProvider: SeatingProvider;
|
|
340
|
+
allocate: SeatingProviderPing;
|
|
341
|
+
release: SeatingProviderPing;
|
|
342
|
+
chart?: SeatingProviderPing;
|
|
343
|
+
offers?: SeatingProviderPing;
|
|
344
|
+
/** Chart problems that do not block verification (e.g. a group no ticket type can fill). */
|
|
345
|
+
chartWarnings?: string[];
|
|
346
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alytegen/sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.0-next.1",
|
|
4
4
|
"description": "Alyte client SDK \u2014 merchant integration (catalog, PSP links, buyer sessions, payments visibility) and the agent buy path (discover \u2192 quote \u2192 hold \u2192 confirm).",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -48,7 +48,8 @@
|
|
|
48
48
|
],
|
|
49
49
|
"sideEffects": false,
|
|
50
50
|
"publishConfig": {
|
|
51
|
-
"access": "public"
|
|
51
|
+
"access": "public",
|
|
52
|
+
"tag": "next"
|
|
52
53
|
},
|
|
53
54
|
"devDependencies": {
|
|
54
55
|
"@types/node": "^22.10.5",
|