@seatlayer/js 0.106.2 → 0.108.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/index.cjs +14 -14
- package/dist/index.d.cts +28 -0
- package/dist/index.d.ts +28 -0
- package/dist/index.js +19 -19
- package/package.json +2 -2
package/dist/index.d.cts
CHANGED
|
@@ -276,6 +276,8 @@ declare function createBuyerAccessContext(options: {
|
|
|
276
276
|
* a genuinely revoked one (typed terminal state, never a reconnect loop);
|
|
277
277
|
* - liveness by ping/pong only. Silence is normal and carries no information
|
|
278
278
|
* (protocol doc §5) — a quiet socket is never treated as a dead one;
|
|
279
|
+
* - wake on return: one `resume` frame when the buyer comes back to the page
|
|
280
|
+
* (see {@link WAKE_FRAME});
|
|
279
281
|
* - a polling fallback for a network that will not upgrade at all (see
|
|
280
282
|
* {@link FALLBACK_AFTER_FAILED_UPGRADES}).
|
|
281
283
|
*/
|
|
@@ -372,6 +374,11 @@ interface BuyerRealtimeOptions {
|
|
|
372
374
|
poll?: () => void | Promise<void>;
|
|
373
375
|
/** The client just fell back to polling. The count beacon is sent anyway. */
|
|
374
376
|
onFallbackPolling?: () => void;
|
|
377
|
+
/** The hold this buyer owns, if any. Told to the server on every open, so
|
|
378
|
+
* this socket alone hears when that hold is booked (a `hold` frame). */
|
|
379
|
+
heldHoldId?: () => string | null;
|
|
380
|
+
/** The server says the hold this socket watches changed state (`booked`). */
|
|
381
|
+
onHoldState?: (holdId: string, state: string) => void;
|
|
375
382
|
/** Test seam. Defaults to the global WebSocket. */
|
|
376
383
|
socketFactory?: (url: string, protocols: string[]) => WebSocket;
|
|
377
384
|
/** Test seam for the keepalive/backoff timers. */
|
|
@@ -380,6 +387,8 @@ interface BuyerRealtimeOptions {
|
|
|
380
387
|
declare class BuyerRealtimeClient {
|
|
381
388
|
private readonly opts;
|
|
382
389
|
private ws;
|
|
390
|
+
/** The hold this socket has told the server it owns. */
|
|
391
|
+
private watched;
|
|
383
392
|
private stopped;
|
|
384
393
|
private attempt;
|
|
385
394
|
private reconnectTimer;
|
|
@@ -404,6 +413,9 @@ declare class BuyerRealtimeClient {
|
|
|
404
413
|
/** Armed only while the socket cannot upgrade. See FALLBACK_AFTER_FAILED_UPGRADES. */
|
|
405
414
|
private pollTimer;
|
|
406
415
|
private fellBack;
|
|
416
|
+
private lastWake;
|
|
417
|
+
private lastInput;
|
|
418
|
+
private detachWake;
|
|
407
419
|
constructor(options: BuyerRealtimeOptions);
|
|
408
420
|
/** True while availability is being read on a timer instead of the socket. */
|
|
409
421
|
get polling(): boolean;
|
|
@@ -416,6 +428,12 @@ declare class BuyerRealtimeClient {
|
|
|
416
428
|
/** Restart after the host re-authorized a revoked buyer (`refreshAccess()`). */
|
|
417
429
|
restart(): void;
|
|
418
430
|
private connect;
|
|
431
|
+
/**
|
|
432
|
+
* Tell the server this socket owns `holdId`, so it alone is told when that
|
|
433
|
+
* hold is booked. Only on an open socket: every open repeats it for the
|
|
434
|
+
* current hold, so nothing is queued and nothing reconnects to send it.
|
|
435
|
+
*/
|
|
436
|
+
watchHold(holdId: string | null): void;
|
|
419
437
|
private handleFrame;
|
|
420
438
|
/** The server answered our resume; cancel the fallback resync. */
|
|
421
439
|
private answered;
|
|
@@ -430,6 +448,14 @@ declare class BuyerRealtimeClient {
|
|
|
430
448
|
*/
|
|
431
449
|
private startPolling;
|
|
432
450
|
private stopPolling;
|
|
451
|
+
private now;
|
|
452
|
+
/**
|
|
453
|
+
* Listen for the buyer coming back. Outside a real DOM (SSR, a stubbed
|
|
454
|
+
* `document`) it attaches nothing, and the socket behaves as before.
|
|
455
|
+
*/
|
|
456
|
+
private attachWake;
|
|
457
|
+
/** Send one wake frame on the open socket, if the window allows. */
|
|
458
|
+
private wake;
|
|
433
459
|
/**
|
|
434
460
|
* Liveness is ping/pong, and only ping/pong. A socket that receives nothing
|
|
435
461
|
* for minutes is the normal, correct state for a narrowly-scoped buyer on a
|
|
@@ -4733,6 +4759,8 @@ declare class SeatPicker implements GaPromptPicker {
|
|
|
4733
4759
|
* on a different path, which nulls this.hold first).
|
|
4734
4760
|
*/
|
|
4735
4761
|
private detectBooked;
|
|
4762
|
+
/** The owner's socket says this hold was booked: settle it as a wire `booked` once did. */
|
|
4763
|
+
private settleBookedHold;
|
|
4736
4764
|
/**
|
|
4737
4765
|
* Say that the seats were lost, and make sure nothing says otherwise.
|
|
4738
4766
|
*
|
package/dist/index.d.ts
CHANGED
|
@@ -276,6 +276,8 @@ declare function createBuyerAccessContext(options: {
|
|
|
276
276
|
* a genuinely revoked one (typed terminal state, never a reconnect loop);
|
|
277
277
|
* - liveness by ping/pong only. Silence is normal and carries no information
|
|
278
278
|
* (protocol doc §5) — a quiet socket is never treated as a dead one;
|
|
279
|
+
* - wake on return: one `resume` frame when the buyer comes back to the page
|
|
280
|
+
* (see {@link WAKE_FRAME});
|
|
279
281
|
* - a polling fallback for a network that will not upgrade at all (see
|
|
280
282
|
* {@link FALLBACK_AFTER_FAILED_UPGRADES}).
|
|
281
283
|
*/
|
|
@@ -372,6 +374,11 @@ interface BuyerRealtimeOptions {
|
|
|
372
374
|
poll?: () => void | Promise<void>;
|
|
373
375
|
/** The client just fell back to polling. The count beacon is sent anyway. */
|
|
374
376
|
onFallbackPolling?: () => void;
|
|
377
|
+
/** The hold this buyer owns, if any. Told to the server on every open, so
|
|
378
|
+
* this socket alone hears when that hold is booked (a `hold` frame). */
|
|
379
|
+
heldHoldId?: () => string | null;
|
|
380
|
+
/** The server says the hold this socket watches changed state (`booked`). */
|
|
381
|
+
onHoldState?: (holdId: string, state: string) => void;
|
|
375
382
|
/** Test seam. Defaults to the global WebSocket. */
|
|
376
383
|
socketFactory?: (url: string, protocols: string[]) => WebSocket;
|
|
377
384
|
/** Test seam for the keepalive/backoff timers. */
|
|
@@ -380,6 +387,8 @@ interface BuyerRealtimeOptions {
|
|
|
380
387
|
declare class BuyerRealtimeClient {
|
|
381
388
|
private readonly opts;
|
|
382
389
|
private ws;
|
|
390
|
+
/** The hold this socket has told the server it owns. */
|
|
391
|
+
private watched;
|
|
383
392
|
private stopped;
|
|
384
393
|
private attempt;
|
|
385
394
|
private reconnectTimer;
|
|
@@ -404,6 +413,9 @@ declare class BuyerRealtimeClient {
|
|
|
404
413
|
/** Armed only while the socket cannot upgrade. See FALLBACK_AFTER_FAILED_UPGRADES. */
|
|
405
414
|
private pollTimer;
|
|
406
415
|
private fellBack;
|
|
416
|
+
private lastWake;
|
|
417
|
+
private lastInput;
|
|
418
|
+
private detachWake;
|
|
407
419
|
constructor(options: BuyerRealtimeOptions);
|
|
408
420
|
/** True while availability is being read on a timer instead of the socket. */
|
|
409
421
|
get polling(): boolean;
|
|
@@ -416,6 +428,12 @@ declare class BuyerRealtimeClient {
|
|
|
416
428
|
/** Restart after the host re-authorized a revoked buyer (`refreshAccess()`). */
|
|
417
429
|
restart(): void;
|
|
418
430
|
private connect;
|
|
431
|
+
/**
|
|
432
|
+
* Tell the server this socket owns `holdId`, so it alone is told when that
|
|
433
|
+
* hold is booked. Only on an open socket: every open repeats it for the
|
|
434
|
+
* current hold, so nothing is queued and nothing reconnects to send it.
|
|
435
|
+
*/
|
|
436
|
+
watchHold(holdId: string | null): void;
|
|
419
437
|
private handleFrame;
|
|
420
438
|
/** The server answered our resume; cancel the fallback resync. */
|
|
421
439
|
private answered;
|
|
@@ -430,6 +448,14 @@ declare class BuyerRealtimeClient {
|
|
|
430
448
|
*/
|
|
431
449
|
private startPolling;
|
|
432
450
|
private stopPolling;
|
|
451
|
+
private now;
|
|
452
|
+
/**
|
|
453
|
+
* Listen for the buyer coming back. Outside a real DOM (SSR, a stubbed
|
|
454
|
+
* `document`) it attaches nothing, and the socket behaves as before.
|
|
455
|
+
*/
|
|
456
|
+
private attachWake;
|
|
457
|
+
/** Send one wake frame on the open socket, if the window allows. */
|
|
458
|
+
private wake;
|
|
433
459
|
/**
|
|
434
460
|
* Liveness is ping/pong, and only ping/pong. A socket that receives nothing
|
|
435
461
|
* for minutes is the normal, correct state for a narrowly-scoped buyer on a
|
|
@@ -4733,6 +4759,8 @@ declare class SeatPicker implements GaPromptPicker {
|
|
|
4733
4759
|
* on a different path, which nulls this.hold first).
|
|
4734
4760
|
*/
|
|
4735
4761
|
private detectBooked;
|
|
4762
|
+
/** The owner's socket says this hold was booked: settle it as a wire `booked` once did. */
|
|
4763
|
+
private settleBookedHold;
|
|
4736
4764
|
/**
|
|
4737
4765
|
* Say that the seats were lost, and make sure nothing says otherwise.
|
|
4738
4766
|
*
|