Skip to content
Docs
Reference

Interface: ElementsConnector

Interface: ElementsConnector in @ticketlayer/live.

@ticketlayer/live


@ticketlayer/live / index / ElementsConnector

Defined in: elements.ts:58

Methods#

closeModal()#

closeModal(): void;

Defined in: elements.ts:215

Returns#

void


emit()#

emit(event: string, payload?: unknown): void;

Defined in: elements.ts:212

Put a UI intent on the bus, for elements that talk to each other without the DOM (ui:* only: state events are the client's to announce).

Parameters#

ParameterType
eventstring
payload?unknown

Returns#

void


event()#

event(eventId: string): {
  openModal: void;
};

Defined in: elements.ts:213

Parameters#

ParameterType
eventIdstring

Returns#

{
  openModal: void;
}
openModal()
openModal(options?: ModalOptions): void;
Parameters
ParameterType
options?ModalOptions
Returns

void


getAuthManager()#

getAuthManager(): {
  authenticated: boolean;
  customer: unknown;
  exchange: Promise<unknown>;
  logout: Promise<void>;
  requestMagicLink: Promise<unknown>;
};

Defined in: elements.ts:189

Magic-link sign-in (tl-login, tl-my-orders). Never sees a password.

Returns#

authenticated
readonly authenticated: boolean;
customer
readonly customer: unknown;
exchange()
exchange(proof: 
  | string
  | {
  code: string;
  email?: string;
  phone?: string;
  type: "magic_link";
}): Promise<unknown>;

A bare string is a code on its own: the long token a sign-in link carries. A typed 6-digit code goes as a magic_link proof with the email (or phone) it was sent to, which the API requires with one.

Parameters
ParameterType
proof| string | { code: string; email?: string; phone?: string; type: "magic_link"; }
Returns

Promise<unknown>

logout()
logout(): Promise<void>;
Returns

Promise<void>

requestMagicLink(contact: {
  email?: string;
  phone?: string;
}): Promise<unknown>;
Parameters
ParameterType
contact{ email?: string; phone?: string; }
contact.email?string
contact.phone?string
Returns

Promise<unknown>


getCartManager()#

getCartManager(): {
  addGiftCard: Promise<unknown>;
  addItem: Promise<unknown>;
  addItems: Promise<unknown>;
  applyCode: Promise<unknown>;
  choose: Promise<unknown>;
  get: Promise<unknown>;
  holders: Promise<unknown>;
  off: void;
  on: () => void;
  options: Promise<unknown>;
  quote: Promise<unknown>;
  releaseSeat: Promise<unknown>;
  removeCode: Promise<unknown>;
  removeGiftCard: Promise<unknown>;
  removeItem: Promise<unknown>;
  reserveSeat: Promise<unknown>;
  reserveSeats: Promise<unknown>;
  setHolders: Promise<unknown>;
  setSeatType: Promise<unknown>;
};

Defined in: elements.ts:93

Returns#

addGiftCard()
addGiftCard(choice: GiftCardChoice): Promise<unknown>;

Put a gift card in the cart (tl-gift-card-shop, P9); resolves with the cart.

Parameters
ParameterType
choiceGiftCardChoice
Returns

Promise<unknown>

addItem()
addItem(
   ticketTypeId: string, 
   quantity: number, 
   occurrenceId: string
): Promise<unknown>;
Parameters
ParameterType
ticketTypeIdstring
quantitynumber
occurrenceIdstring
Returns

Promise<unknown>

addItems()
addItems(items: {
  occurrenceId: string;
  quantity: number;
  ticketTypeId: string;
}[]): Promise<unknown>;
Parameters
ParameterType
items{ occurrenceId: string; quantity: number; ticketTypeId: string; }[]
Returns

Promise<unknown>

applyCode()
applyCode(code: string): Promise<unknown>;

Apply a code to the cart (tl-promo-code), making one if there is none; resolves with the cart.

Parameters
ParameterType
codestring
Returns

Promise<unknown>

choose()
choose(choices: CartChoices): Promise<unknown>;

Choose delivery and payment; resolves with the re-priced quote. cart:quoting goes out first and cart:quoted after, on this manager's bus and the client's.

Parameters
ParameterType
choicesCartChoices
Returns

Promise<unknown>

get()
get(): Promise<unknown>;
Returns

Promise<unknown>

holders()
holders(): Promise<unknown>;

Who each unit is for, and where each add-on goes (tl-checkout-holders, P8); null with no cart.

Returns

Promise<unknown>

off()
off(event: string, cb: (data: unknown) => void): void;
Parameters
ParameterType
eventstring
cb(data: unknown) => void
Returns

void

on()
on(event: string, cb: (data: unknown) => void): () => void;
Parameters
ParameterType
eventstring
cb(data: unknown) => void
Returns

() => void

options()
options(): Promise<unknown>;

The delivery and payment methods the cart can choose, each with what it adds and why an unavailable one is not (tl-delivery-picker, tl-payment-picker; TKT-655). Null when there is no cart.

Returns

Promise<unknown>

quote()
quote(): Promise<unknown>;

The cart priced with the choices made so far (tl-checkout-summary); also published as cart:quoted.

Returns

Promise<unknown>

releaseSeat()
releaseSeat(occurrenceId: string, seat: number): Promise<unknown>;

Give a held seat back.

Parameters
ParameterType
occurrenceIdstring
seatnumber
Returns

Promise<unknown>

removeCode()
removeCode(codeId: string): Promise<unknown>;

Take a code off the cart by its codeId; resolves with the cart.

Parameters
ParameterType
codeIdstring
Returns

Promise<unknown>

removeGiftCard()
removeGiftCard(giftCardId: string): Promise<unknown>;

Take a gift card out of the cart by its id; resolves with the cart.

Parameters
ParameterType
giftCardIdstring
Returns

Promise<unknown>

removeItem()
removeItem(itemId: string): Promise<unknown>;
Parameters
ParameterType
itemIdstring
Returns

Promise<unknown>

reserveSeat()
reserveSeat(
   occurrenceId: string, 
   seat: number, 
   ticketTypeId?: string
): Promise<unknown>;

Reserve one seat by its index in the venue plan version, on the category's default ticket type unless one is named (a tap reserves). Rejects with the typed seat errors (code SEAT_UNAVAILABLE, SINGLE_SEAT_GAP, PLAN_VERSION_CHANGED, SEAT_LIMIT), which the bus hears as well.

Parameters
ParameterType
occurrenceIdstring
seatnumber
ticketTypeId?string
Returns

Promise<unknown>

reserveSeats()
reserveSeats(
   occurrenceId: string, 
   seats: number[], 
   ticketTypeId?: string
): Promise<unknown>;

Reserve several seats in one write, all or none: a best available option. The refusals are reserveSeat's.

Parameters
ParameterType
occurrenceIdstring
seatsnumber[]
ticketTypeId?string
Returns

Promise<unknown>

setHolders()
setHolders(plan: CartHolderPlan): Promise<unknown>;

Name holders and place add-ons (tl-checkout-holders, P8); resolves with the holders as saved.

Parameters
ParameterType
planCartHolderPlan
Returns

Promise<unknown>

setSeatType()
setSeatType(
   occurrenceId: string, 
   seat: number, 
   ticketTypeId: string
): Promise<unknown>;

Change a held seat's ticket type, keeping the reservation.

Parameters
ParameterType
occurrenceIdstring
seatnumber
ticketTypeIdstring
Returns

Promise<unknown>


getConciergeManager()#

getConciergeManager(): {
  send: Promise<ConciergeResponse>;
};

Defined in: elements.ts:205

Live's Concierge routes, as a transport (tl-concierge, tl-concierge-slot). Only /v1/concierge/*; anything else is refused before it is sent.

Returns#

{
  send: Promise<ConciergeResponse>;
}
send()
send(request: ConciergeRequest): Promise<ConciergeResponse>;
Parameters
ParameterType
requestConciergeRequest
Returns

Promise<ConciergeResponse>


getEventsManager()#

getEventsManager(): {
  get: Promise<unknown>;
  getOffers: Promise<OccurrenceOffers>;
  getTicketTypes: Promise<unknown[]>;
  list: Promise<{
     items: unknown[];
  }>;
};

Defined in: elements.ts:80

Returns#

get()
get(eventId: string): Promise<unknown>;
Parameters
ParameterType
eventIdstring
Returns

Promise<unknown>

getOffers()
getOffers(eventId: string, occurrenceId: string): Promise<OccurrenceOffers>;

One occurrence as the offers engine evaluated it for this buyer (TKT-324): its availability, its ticketTypes in the shape getTicketTypes gives them, and its lockedTicketTypes, locked prices with how to unlock them. Kept out of getTicketTypes so an element written before locked prices existed never offers one as buyable.

Parameters
ParameterType
eventIdstring
occurrenceIdstring
Returns

Promise<OccurrenceOffers>

getTicketTypes()
getTicketTypes(eventId: string, occurrenceId: string): Promise<unknown[]>;
Parameters
ParameterType
eventIdstring
occurrenceIdstring
Returns

Promise<unknown[]>

list()
list(options?: {
  category?: string;
  limit?: number;
}): Promise<{
  items: unknown[];
}>;
Parameters
ParameterType
options?{ category?: string; limit?: number; }
options.category?string
options.limit?number
Returns

Promise<{ items: unknown[]; }>


getOrdersManager()#

getOrdersManager(): {
  activateWristband: Promise<unknown>;
  assignAddOn: Promise<unknown>;
  get: Promise<unknown>;
  holder: Promise<unknown>;
  holderLink: Promise<unknown>;
  holders: Promise<unknown>;
  mine: Promise<unknown>;
  nameHolder: Promise<unknown>;
  requestRefund: Promise<unknown>;
  ticketPdf: Promise<Blob>;
  useHolderLink: Promise<void>;
};

Defined in: elements.ts:150

Returns#

activateWristband()
activateWristband(
   orderId: string, 
   slotId: string, 
   uid: string
): Promise<unknown>;

Activate a posted wristband by the UID read from it (tl-wristband-activate); resolves with its encoding.

Parameters
ParameterType
orderIdstring
slotIdstring
uidstring
Returns

Promise<unknown>

assignAddOn()
assignAddOn(orderId: string, assignment: AddOnAssignment): Promise<unknown>;

Put an add-on on a holder, or move it; resolves with the holders.

Parameters
ParameterType
orderIdstring
assignmentAddOnAssignment
Returns

Promise<unknown>

get()
get(orderId: string): Promise<unknown>;
Parameters
ParameterType
orderIdstring
Returns

Promise<unknown>

holder()
holder(orderId: string, slotId: string): Promise<unknown>;

One holder: the booker for any, a named guest for themselves (tl-holder-pass).

Parameters
ParameterType
orderIdstring
slotIdstring
Returns

Promise<unknown>

holderLink(orderId: string, slotId: string): Promise<unknown>;

Send to guest: the booker mints one holder's own link (tl-booking-holders); resolves with its token.

Parameters
ParameterType
orderIdstring
slotIdstring
Returns

Promise<unknown>

holders()
holders(orderId: string): Promise<unknown>;

Manage my booking (tl-booking-holders, tl-booking-pass, P8): the booking's holders.

Parameters
ParameterType
orderIdstring
Returns

Promise<unknown>

mine()
mine(): Promise<unknown>;
Returns

Promise<unknown>

nameHolder()
nameHolder(
   orderId: string, 
   slotId: string, 
   input: HolderNameInput
): Promise<unknown>;

Name one of the booking's holders; resolves with the holders.

Parameters
ParameterType
orderIdstring
slotIdstring
inputHolderNameInput
Returns

Promise<unknown>

requestRefund()
requestRefund(orderId: string, request: RefundRequestInput): Promise<unknown>;

Ask for a refund or exchange, and where the money goes (tl-refund-request, P9).

Parameters
ParameterType
orderIdstring
requestRefundRequestInput
Returns

Promise<unknown>

ticketPdf()
ticketPdf(orderId: string, passId: string): Promise<Blob>;
Parameters
ParameterType
orderIdstring
passIdstring
Returns

Promise<Blob>

useHolderLink(orderId: string, holderAccessToken: string): Promise<void>;

Open a booking as the named guest whose link the page was given (tl-holder-pass).

Parameters
ParameterType
orderIdstring
holderAccessTokenstring
Returns

Promise<void>


getSeatingManager()#

getSeatingManager(): ElementsSeatingManager;

Defined in: elements.ts:149

The seat map (TKT-462): the pointer, the decoded files and the availability. The seat map token stays inside the client: nothing this returns carries it.

Returns#

ElementsSeatingManager


getStoredValueManager()#

getStoredValueManager(): {
  applyCredit: Promise<TenderView>;
  applyGiftCard: Promise<TenderView>;
  balance: Promise<unknown>;
  credit: Promise<unknown>;
  creditActivity: Promise<unknown>;
  products: Promise<unknown>;
  removeTender: void;
  tenders: TenderView[];
};

Defined in: elements.ts:177

Account credit and gift cards (P9): what is on sale, what is on a card, the buyer's credit, and the tenders held at checkout until the order is paid (tenders:changed on the bus). A gift card's code goes to the API and into the held tender's private memory, and is never handed back.

Returns#

applyCredit()
applyCredit(storedValueAccountId: string): Promise<TenderView>;
Parameters
ParameterType
storedValueAccountIdstring
Returns

Promise<TenderView>

applyGiftCard()
applyGiftCard(code: string): Promise<TenderView>;
Parameters
ParameterType
codestring
Returns

Promise<TenderView>

balance()
balance(code: string): Promise<unknown>;
Parameters
ParameterType
codestring
Returns

Promise<unknown>

credit()
credit(): Promise<unknown>;
Returns

Promise<unknown>

creditActivity()
creditActivity(storedValueAccountId: string, page?: {
  cursor?: string;
  limit?: number;
}): Promise<unknown>;

A page of one credit balance's activity (tl-my-credit); nextCursor pages on.

Parameters
ParameterType
storedValueAccountIdstring
page?{ cursor?: string; limit?: number; }
page.cursor?string
page.limit?number
Returns

Promise<unknown>

products()
products(): Promise<unknown>;
Returns

Promise<unknown>

removeTender()
removeTender(tenderId: string): void;
Parameters
ParameterType
tenderIdstring
Returns

void

tenders()
tenders(): TenderView[];
Returns

TenderView[]


getTheme()#

getTheme(): Promise<unknown>;

Defined in: elements.ts:71

The channel's theme document (brand, design and the token sections), read once per page and shared by every element that asks. Null when it could not be read.

Returns#

Promise<unknown>


mountCheckout()?#

optional mountCheckout(
   container: HTMLElement, 
   handlers: CheckoutFrameHandlers, 
   options?: CheckoutFrameOptions
): () => void;

Defined in: elements.ts:79

Mount the hosted checkout into container, filling it, and hear what it says; returns the teardown. Only on a page where this client opens the checkout in a frame (checkout: { mode: 'modal' }); where the host handles checkout itself (HBO navigates to /checkout) it is absent, and an element hands the buyer to that host instead.

Parameters#

ParameterType
containerHTMLElement
handlersCheckoutFrameHandlers
options?CheckoutFrameOptions

Returns#

() => void


off()#

off(event: string, cb: (data: unknown) => void): void;

Defined in: elements.ts:207

Parameters#

ParameterType
eventstring
cb(data: unknown) => void

Returns#

void


on()#

on(event: string, cb: (data: unknown) => void): () => void;

Defined in: elements.ts:206

Parameters#

ParameterType
eventstring
cb(data: unknown) => void

Returns#

() => void


themeReady()#

themeReady(): Promise<void>;

Defined in: elements.ts:65

Settles once the channel's theme has been applied to the page, or has failed to load, or is not going to be applied. An element holds its skeleton until then (for a capped time), so a buyer sees it arrive in the channel's brand rather than in the defaults first. Never rejects.

Returns#

Promise<void>

Properties#

checkout#

checkout: {
  closeModal: void;
  openModal: void;
};

Defined in: elements.ts:214

closeModal()#

closeModal(): void;
Returns

void

openModal()#

openModal(options?: ModalOptions): void;
Parameters
ParameterType
options?ModalOptions
Returns

void