@tickean/checkout-js 0.2.0 → 0.2.12
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 +17 -2
- package/dist/index.d.mts +201 -5
- package/dist/index.d.ts +201 -5
- package/dist/index.js +4057 -192
- package/dist/index.mjs +4062 -179
- package/package.json +6 -3
package/README.md
CHANGED
|
@@ -2,13 +2,28 @@
|
|
|
2
2
|
|
|
3
3
|
Framework-agnostic TypeScript client for Tickean Headless Checkout.
|
|
4
4
|
|
|
5
|
+
Current version: **0.2.12**.
|
|
6
|
+
|
|
5
7
|
## APIs
|
|
6
8
|
|
|
7
|
-
- `createTickean(options)` — low-level client
|
|
9
|
+
- `createTickean(options)` — low-level client
|
|
8
10
|
- `createCheckoutController(options)` — state machine with cart, quote debounce, OTP, purchase+payment, persistence, telemetry
|
|
11
|
+
- `tickean.exchangeRecovery({ code })` — abandon-cart recovery (`POST /v1/checkout/recovery/exchange`)
|
|
12
|
+
- `resumeCode` option on the controller — exchange + rehydrate on init
|
|
9
13
|
|
|
10
14
|
## Phases
|
|
11
15
|
|
|
12
16
|
`initializing` → `browsing` → `quoting` → `verifying_buyer` → `ready_to_purchase` → `purchasing` → `requires_action` | `processing` → `completed` | `failed` | `expired`
|
|
13
17
|
|
|
14
|
-
|
|
18
|
+
## Recovery example
|
|
19
|
+
|
|
20
|
+
```ts
|
|
21
|
+
const controller = createCheckoutController({
|
|
22
|
+
publishableKey: "pk_live_...",
|
|
23
|
+
eventSlug: "mi-evento",
|
|
24
|
+
returnUrl: "https://tusitio.com/checkout/",
|
|
25
|
+
resumeCode: new URLSearchParams(location.search).get("resume") || undefined,
|
|
26
|
+
});
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
See [Reanudar sesión](../../docs/readme/18-session-resume.md) and the repository root README for monorepo build/test commands.
|
package/dist/index.d.mts
CHANGED
|
@@ -67,6 +67,23 @@ type CheckoutSession = {
|
|
|
67
67
|
nextAction?: NextAction;
|
|
68
68
|
returnUrl?: string | null;
|
|
69
69
|
};
|
|
70
|
+
type PromotionNxM = {
|
|
71
|
+
enabled?: boolean;
|
|
72
|
+
buyQty?: number;
|
|
73
|
+
payQty?: number;
|
|
74
|
+
label?: string;
|
|
75
|
+
startsAt?: string;
|
|
76
|
+
endsAt?: string;
|
|
77
|
+
};
|
|
78
|
+
type QuantityDiscount = {
|
|
79
|
+
enabled?: boolean;
|
|
80
|
+
type?: "SECOND_UNIT_PERCENT" | "NTH_UNIT_PERCENT" | string;
|
|
81
|
+
targetUnit?: number;
|
|
82
|
+
percentOff?: number;
|
|
83
|
+
label?: string;
|
|
84
|
+
startsAt?: string;
|
|
85
|
+
endsAt?: string;
|
|
86
|
+
};
|
|
70
87
|
type PublicShowOption = {
|
|
71
88
|
id: string;
|
|
72
89
|
name?: string;
|
|
@@ -74,15 +91,20 @@ type PublicShowOption = {
|
|
|
74
91
|
price: number;
|
|
75
92
|
currency?: string;
|
|
76
93
|
stock?: number;
|
|
94
|
+
sold?: number;
|
|
95
|
+
reserved?: number;
|
|
96
|
+
availableStock?: number;
|
|
77
97
|
maxPerPurchase?: number;
|
|
78
98
|
optionType?: string;
|
|
79
99
|
accessScope?: string;
|
|
80
100
|
coveredShowIds?: string[];
|
|
81
101
|
passIssuanceMode?: "PER_DAY" | "SINGLE_PASS";
|
|
82
102
|
catalogVisibility?: "PUBLIC" | "PROMO_GATED";
|
|
83
|
-
promotionNxM?:
|
|
84
|
-
quantityDiscount?:
|
|
103
|
+
promotionNxM?: PromotionNxM | null;
|
|
104
|
+
quantityDiscount?: QuantityDiscount | null;
|
|
85
105
|
status?: string;
|
|
106
|
+
/** Present on options returned via promo unlock. */
|
|
107
|
+
showId?: string;
|
|
86
108
|
};
|
|
87
109
|
type PublicShow = {
|
|
88
110
|
id: string;
|
|
@@ -91,6 +113,32 @@ type PublicShow = {
|
|
|
91
113
|
endDate?: string;
|
|
92
114
|
showOptions: PublicShowOption[];
|
|
93
115
|
};
|
|
116
|
+
type RegistrationQuestion = {
|
|
117
|
+
id: string;
|
|
118
|
+
type?: string;
|
|
119
|
+
label?: string;
|
|
120
|
+
required?: boolean;
|
|
121
|
+
options?: string[];
|
|
122
|
+
};
|
|
123
|
+
type RegistrationSettings = {
|
|
124
|
+
maxAttendeesPerPurchase?: number;
|
|
125
|
+
requireAttendeeEmail?: boolean;
|
|
126
|
+
requireAttendeePhone?: boolean;
|
|
127
|
+
terms?: {
|
|
128
|
+
required?: boolean;
|
|
129
|
+
label?: string | null;
|
|
130
|
+
pdfUrl?: string | null;
|
|
131
|
+
} | null;
|
|
132
|
+
questions?: RegistrationQuestion[];
|
|
133
|
+
};
|
|
134
|
+
type PurchaseAttendee = {
|
|
135
|
+
showOptionId: string;
|
|
136
|
+
firstName?: string;
|
|
137
|
+
lastName?: string;
|
|
138
|
+
email?: string;
|
|
139
|
+
phone?: string;
|
|
140
|
+
termsAccepted?: boolean;
|
|
141
|
+
};
|
|
94
142
|
type PublicEvent = {
|
|
95
143
|
id: string;
|
|
96
144
|
slug: string;
|
|
@@ -99,6 +147,9 @@ type PublicEvent = {
|
|
|
99
147
|
images?: unknown[];
|
|
100
148
|
location?: unknown;
|
|
101
149
|
availablePaymentMethods?: string[];
|
|
150
|
+
hasPromoGatedShowOptions?: boolean;
|
|
151
|
+
collectAttendeeData?: boolean;
|
|
152
|
+
registrationSettings?: RegistrationSettings | null;
|
|
102
153
|
organization?: {
|
|
103
154
|
id?: string;
|
|
104
155
|
slug?: string;
|
|
@@ -111,11 +162,37 @@ type CartItem = {
|
|
|
111
162
|
showOptionId: string;
|
|
112
163
|
amount: number;
|
|
113
164
|
};
|
|
165
|
+
type QuotePricingLine = {
|
|
166
|
+
showOptionId?: string;
|
|
167
|
+
quantity?: number;
|
|
168
|
+
baseUnitPrice?: number;
|
|
169
|
+
lineTotal?: number;
|
|
170
|
+
codeDiscountAmount?: number;
|
|
171
|
+
codeDiscountedUnits?: number;
|
|
172
|
+
};
|
|
173
|
+
type QuotePricingBreakdown = {
|
|
174
|
+
subtotalBase?: number;
|
|
175
|
+
promotionDiscountTotal?: number;
|
|
176
|
+
codeDiscountTotal?: number;
|
|
177
|
+
serviceCharge?: number;
|
|
178
|
+
total?: number;
|
|
179
|
+
lines?: QuotePricingLine[];
|
|
180
|
+
};
|
|
181
|
+
type QuoteDiscountCode = {
|
|
182
|
+
code?: string;
|
|
183
|
+
discountType?: "PERCENT" | "FIXED" | string;
|
|
184
|
+
value?: number;
|
|
185
|
+
amountApplied?: number;
|
|
186
|
+
benefitKind?: string;
|
|
187
|
+
allowedShowOptionIds?: string[];
|
|
188
|
+
applicationMode?: string;
|
|
189
|
+
};
|
|
114
190
|
type QuoteResult = {
|
|
115
191
|
valid: boolean;
|
|
116
192
|
totalPrice: number;
|
|
117
|
-
pricingBreakdown?: unknown;
|
|
118
|
-
discountCode?: unknown;
|
|
193
|
+
pricingBreakdown?: QuotePricingBreakdown | unknown;
|
|
194
|
+
discountCode?: QuoteDiscountCode | unknown;
|
|
195
|
+
message?: string;
|
|
119
196
|
unlockedShowOptionIds?: string[];
|
|
120
197
|
unlockedShowOptions?: PublicShowOption[];
|
|
121
198
|
};
|
|
@@ -200,6 +277,25 @@ declare function createTickean(options: CreateTickeanOptions): {
|
|
|
200
277
|
eventSlug: string;
|
|
201
278
|
returnUrl?: string;
|
|
202
279
|
}): Promise<CheckoutSession>;
|
|
280
|
+
exchangeRecovery(params: {
|
|
281
|
+
code: string;
|
|
282
|
+
}): Promise<{
|
|
283
|
+
sessionId: string;
|
|
284
|
+
sessionToken: string;
|
|
285
|
+
expiresAt: string;
|
|
286
|
+
suggestedStep?: string | number;
|
|
287
|
+
event: PublicEvent;
|
|
288
|
+
capabilities?: Record<string, boolean>;
|
|
289
|
+
cart: CartItem[];
|
|
290
|
+
discountCode?: string | null;
|
|
291
|
+
buyer?: Buyer | null;
|
|
292
|
+
buyerVerified?: boolean;
|
|
293
|
+
purchase?: PurchaseResult["purchase"] | null;
|
|
294
|
+
payment?: PaymentResult | null;
|
|
295
|
+
nextAction?: NextAction;
|
|
296
|
+
shoppingCartReference?: string | null;
|
|
297
|
+
phase?: string;
|
|
298
|
+
}>;
|
|
203
299
|
getSession(): Promise<CheckoutSession>;
|
|
204
300
|
getCatalog(): Promise<PublicEvent>;
|
|
205
301
|
quote(params: {
|
|
@@ -207,6 +303,17 @@ declare function createTickean(options: CreateTickeanOptions): {
|
|
|
207
303
|
discountCode?: string;
|
|
208
304
|
showId?: string;
|
|
209
305
|
}): Promise<QuoteResult>;
|
|
306
|
+
lookupBuyer(params: {
|
|
307
|
+
phone: string;
|
|
308
|
+
}): Promise<{
|
|
309
|
+
exists: boolean;
|
|
310
|
+
buyer?: {
|
|
311
|
+
id: string;
|
|
312
|
+
phone: string;
|
|
313
|
+
name?: string;
|
|
314
|
+
email?: string;
|
|
315
|
+
};
|
|
316
|
+
}>;
|
|
210
317
|
sendOtp(params: {
|
|
211
318
|
phone: string;
|
|
212
319
|
channel?: string;
|
|
@@ -226,6 +333,7 @@ declare function createTickean(options: CreateTickeanOptions): {
|
|
|
226
333
|
expectedTotal?: number;
|
|
227
334
|
shoppingCartReference?: string;
|
|
228
335
|
idempotencyKey?: string;
|
|
336
|
+
attendees?: PurchaseAttendee[];
|
|
229
337
|
}): Promise<PurchaseResult>;
|
|
230
338
|
createPayment(params: {
|
|
231
339
|
orderId: string;
|
|
@@ -296,6 +404,9 @@ type CheckoutAction = {
|
|
|
296
404
|
} | {
|
|
297
405
|
type: "SET_EVENT";
|
|
298
406
|
event: PublicEvent;
|
|
407
|
+
} | {
|
|
408
|
+
type: "MERGE_UNLOCKED_OPTIONS";
|
|
409
|
+
options: PublicShowOption[];
|
|
299
410
|
} | {
|
|
300
411
|
type: "PURCHASE_START";
|
|
301
412
|
} | {
|
|
@@ -310,6 +421,8 @@ type CheckoutAction = {
|
|
|
310
421
|
type: "SET_NEXT_ACTION";
|
|
311
422
|
nextAction: NextAction;
|
|
312
423
|
payment?: PaymentResult | null;
|
|
424
|
+
} | {
|
|
425
|
+
type: "RESET_PAYMENT_FLOW";
|
|
313
426
|
} | {
|
|
314
427
|
type: "PROCESSING";
|
|
315
428
|
} | {
|
|
@@ -332,6 +445,8 @@ declare function checkoutReducer(state: CheckoutState, action: CheckoutAction):
|
|
|
332
445
|
type CreateCheckoutControllerOptions = CreateTickeanOptions & {
|
|
333
446
|
eventSlug: string;
|
|
334
447
|
returnUrl?: string;
|
|
448
|
+
/** Abandonment recovery code from `?resume=` deep link. */
|
|
449
|
+
resumeCode?: string;
|
|
335
450
|
quoteDebounceMs?: number;
|
|
336
451
|
persistence?: PersistenceAdapter | false;
|
|
337
452
|
persistenceKey?: string;
|
|
@@ -344,6 +459,25 @@ declare function createCheckoutController(options: CreateCheckoutControllerOptio
|
|
|
344
459
|
eventSlug: string;
|
|
345
460
|
returnUrl?: string;
|
|
346
461
|
}): Promise<CheckoutSession>;
|
|
462
|
+
exchangeRecovery(params: {
|
|
463
|
+
code: string;
|
|
464
|
+
}): Promise<{
|
|
465
|
+
sessionId: string;
|
|
466
|
+
sessionToken: string;
|
|
467
|
+
expiresAt: string;
|
|
468
|
+
suggestedStep?: string | number;
|
|
469
|
+
event: PublicEvent;
|
|
470
|
+
capabilities?: Record<string, boolean>;
|
|
471
|
+
cart: CartItem[];
|
|
472
|
+
discountCode?: string | null;
|
|
473
|
+
buyer?: Buyer | null;
|
|
474
|
+
buyerVerified?: boolean;
|
|
475
|
+
purchase?: PurchaseResult["purchase"] | null;
|
|
476
|
+
payment?: PaymentResult | null;
|
|
477
|
+
nextAction?: NextAction;
|
|
478
|
+
shoppingCartReference?: string | null;
|
|
479
|
+
phase?: string;
|
|
480
|
+
}>;
|
|
347
481
|
getSession(): Promise<CheckoutSession>;
|
|
348
482
|
getCatalog(): Promise<PublicEvent>;
|
|
349
483
|
quote(params: {
|
|
@@ -351,6 +485,17 @@ declare function createCheckoutController(options: CreateCheckoutControllerOptio
|
|
|
351
485
|
discountCode?: string;
|
|
352
486
|
showId?: string;
|
|
353
487
|
}): Promise<QuoteResult>;
|
|
488
|
+
lookupBuyer(params: {
|
|
489
|
+
phone: string;
|
|
490
|
+
}): Promise<{
|
|
491
|
+
exists: boolean;
|
|
492
|
+
buyer?: {
|
|
493
|
+
id: string;
|
|
494
|
+
phone: string;
|
|
495
|
+
name?: string;
|
|
496
|
+
email?: string;
|
|
497
|
+
};
|
|
498
|
+
}>;
|
|
354
499
|
sendOtp(params: {
|
|
355
500
|
phone: string;
|
|
356
501
|
channel?: string;
|
|
@@ -370,6 +515,7 @@ declare function createCheckoutController(options: CreateCheckoutControllerOptio
|
|
|
370
515
|
expectedTotal?: number;
|
|
371
516
|
shoppingCartReference?: string;
|
|
372
517
|
idempotencyKey?: string;
|
|
518
|
+
attendees?: PurchaseAttendee[];
|
|
373
519
|
}): Promise<PurchaseResult>;
|
|
374
520
|
createPayment(params: {
|
|
375
521
|
orderId: string;
|
|
@@ -397,6 +543,15 @@ declare function createCheckoutController(options: CreateCheckoutControllerOptio
|
|
|
397
543
|
setCartItem: (showOptionId: string, amount: number) => void;
|
|
398
544
|
setCart: (cart: CartItem[]) => void;
|
|
399
545
|
applyDiscountCode: (code: string) => Promise<QuoteResult>;
|
|
546
|
+
lookupBuyer: (phone: string) => Promise<{
|
|
547
|
+
exists: boolean;
|
|
548
|
+
buyer?: {
|
|
549
|
+
id: string;
|
|
550
|
+
phone: string;
|
|
551
|
+
name?: string;
|
|
552
|
+
email?: string;
|
|
553
|
+
};
|
|
554
|
+
}>;
|
|
400
555
|
sendOtp: (phone: string, channel?: string) => Promise<void>;
|
|
401
556
|
verifyOtp: (params: {
|
|
402
557
|
phone: string;
|
|
@@ -410,11 +565,13 @@ declare function createCheckoutController(options: CreateCheckoutControllerOptio
|
|
|
410
565
|
discountCode?: string;
|
|
411
566
|
showId?: string;
|
|
412
567
|
idempotencyKey?: string;
|
|
568
|
+
attendees?: PurchaseAttendee[];
|
|
413
569
|
}) => Promise<{
|
|
414
570
|
purchaseId: string;
|
|
415
571
|
payment: PaymentResult;
|
|
416
572
|
nextAction: NextAction;
|
|
417
573
|
}>;
|
|
574
|
+
changePaymentMethod: () => void;
|
|
418
575
|
confirmPayment: (params?: {
|
|
419
576
|
paymentId?: string;
|
|
420
577
|
confirmationToken?: string;
|
|
@@ -443,4 +600,43 @@ declare function createEventEmitterTelemetry(listeners?: TelemetryListener[]): T
|
|
|
443
600
|
subscribe(listener: TelemetryListener): () => void;
|
|
444
601
|
};
|
|
445
602
|
|
|
446
|
-
|
|
603
|
+
type PaymentSocketSnapshot = {
|
|
604
|
+
purchaseId?: string;
|
|
605
|
+
orderId?: string;
|
|
606
|
+
paymentId?: string;
|
|
607
|
+
status?: string;
|
|
608
|
+
amount?: number;
|
|
609
|
+
currency?: string;
|
|
610
|
+
};
|
|
611
|
+
type PaymentSocketWatchHandle = {
|
|
612
|
+
promise: Promise<PaymentSocketSnapshot>;
|
|
613
|
+
dispose: () => void;
|
|
614
|
+
get connected(): boolean;
|
|
615
|
+
};
|
|
616
|
+
/**
|
|
617
|
+
* Join the legacy cart payment room (same as ecommerce) and resolve when
|
|
618
|
+
* payment:confirmed arrives. HTTP polling remains the fallback.
|
|
619
|
+
*/
|
|
620
|
+
declare function watchPaymentSocket(params: {
|
|
621
|
+
apiBaseUrl: string;
|
|
622
|
+
shoppingCartReference: string;
|
|
623
|
+
purchaseId?: string;
|
|
624
|
+
signal?: AbortSignal;
|
|
625
|
+
timeoutMs?: number;
|
|
626
|
+
}): PaymentSocketWatchHandle;
|
|
627
|
+
|
|
628
|
+
/**
|
|
629
|
+
* Navigate the top-level browsing context (breaks out of iframes).
|
|
630
|
+
* Used for Mercado Pago hosted checkout so payment is not trapped in embeds.
|
|
631
|
+
*/
|
|
632
|
+
declare function navigateTopLevel(url: string): void;
|
|
633
|
+
declare function resolveRedirectUrl(params: {
|
|
634
|
+
nextAction?: {
|
|
635
|
+
type: string;
|
|
636
|
+
url?: string;
|
|
637
|
+
} | null;
|
|
638
|
+
redirectUrl?: string | null;
|
|
639
|
+
initPoint?: string | null;
|
|
640
|
+
}): string | null;
|
|
641
|
+
|
|
642
|
+
export { type Buyer, type CartItem, type CheckoutAction, type CheckoutController, type CheckoutPhase, type CheckoutSession, type CheckoutState, type CheckoutTransport, type CreateCheckoutControllerOptions, type CreateTickeanOptions, type NextAction, type PaymentResult, type PaymentSocketSnapshot, type PaymentSocketWatchHandle, type PaymentStatusResult, type PersistedCheckoutState, type PersistenceAdapter, type PromotionNxM, type PublicEvent, type PublicShow, type PublicShowOption, type PurchaseAttendee, type PurchaseResult, type QuantityDiscount, type QuoteDiscountCode, type QuotePricingBreakdown, type QuotePricingLine, type QuoteResult, type RegistrationQuestion, type RegistrationSettings, type TelemetryAdapter, type TelemetryEvent, type TelemetryListener, type TickeanClient, TickeanError, type TickeanErrorPayload, checkoutReducer, createCheckoutController, createEventEmitterTelemetry, createInitialState, createMemoryPersistence, createNoopTelemetry, createSessionStoragePersistence, createTickean, navigateTopLevel, resolveRedirectUrl, watchPaymentSocket };
|
package/dist/index.d.ts
CHANGED
|
@@ -67,6 +67,23 @@ type CheckoutSession = {
|
|
|
67
67
|
nextAction?: NextAction;
|
|
68
68
|
returnUrl?: string | null;
|
|
69
69
|
};
|
|
70
|
+
type PromotionNxM = {
|
|
71
|
+
enabled?: boolean;
|
|
72
|
+
buyQty?: number;
|
|
73
|
+
payQty?: number;
|
|
74
|
+
label?: string;
|
|
75
|
+
startsAt?: string;
|
|
76
|
+
endsAt?: string;
|
|
77
|
+
};
|
|
78
|
+
type QuantityDiscount = {
|
|
79
|
+
enabled?: boolean;
|
|
80
|
+
type?: "SECOND_UNIT_PERCENT" | "NTH_UNIT_PERCENT" | string;
|
|
81
|
+
targetUnit?: number;
|
|
82
|
+
percentOff?: number;
|
|
83
|
+
label?: string;
|
|
84
|
+
startsAt?: string;
|
|
85
|
+
endsAt?: string;
|
|
86
|
+
};
|
|
70
87
|
type PublicShowOption = {
|
|
71
88
|
id: string;
|
|
72
89
|
name?: string;
|
|
@@ -74,15 +91,20 @@ type PublicShowOption = {
|
|
|
74
91
|
price: number;
|
|
75
92
|
currency?: string;
|
|
76
93
|
stock?: number;
|
|
94
|
+
sold?: number;
|
|
95
|
+
reserved?: number;
|
|
96
|
+
availableStock?: number;
|
|
77
97
|
maxPerPurchase?: number;
|
|
78
98
|
optionType?: string;
|
|
79
99
|
accessScope?: string;
|
|
80
100
|
coveredShowIds?: string[];
|
|
81
101
|
passIssuanceMode?: "PER_DAY" | "SINGLE_PASS";
|
|
82
102
|
catalogVisibility?: "PUBLIC" | "PROMO_GATED";
|
|
83
|
-
promotionNxM?:
|
|
84
|
-
quantityDiscount?:
|
|
103
|
+
promotionNxM?: PromotionNxM | null;
|
|
104
|
+
quantityDiscount?: QuantityDiscount | null;
|
|
85
105
|
status?: string;
|
|
106
|
+
/** Present on options returned via promo unlock. */
|
|
107
|
+
showId?: string;
|
|
86
108
|
};
|
|
87
109
|
type PublicShow = {
|
|
88
110
|
id: string;
|
|
@@ -91,6 +113,32 @@ type PublicShow = {
|
|
|
91
113
|
endDate?: string;
|
|
92
114
|
showOptions: PublicShowOption[];
|
|
93
115
|
};
|
|
116
|
+
type RegistrationQuestion = {
|
|
117
|
+
id: string;
|
|
118
|
+
type?: string;
|
|
119
|
+
label?: string;
|
|
120
|
+
required?: boolean;
|
|
121
|
+
options?: string[];
|
|
122
|
+
};
|
|
123
|
+
type RegistrationSettings = {
|
|
124
|
+
maxAttendeesPerPurchase?: number;
|
|
125
|
+
requireAttendeeEmail?: boolean;
|
|
126
|
+
requireAttendeePhone?: boolean;
|
|
127
|
+
terms?: {
|
|
128
|
+
required?: boolean;
|
|
129
|
+
label?: string | null;
|
|
130
|
+
pdfUrl?: string | null;
|
|
131
|
+
} | null;
|
|
132
|
+
questions?: RegistrationQuestion[];
|
|
133
|
+
};
|
|
134
|
+
type PurchaseAttendee = {
|
|
135
|
+
showOptionId: string;
|
|
136
|
+
firstName?: string;
|
|
137
|
+
lastName?: string;
|
|
138
|
+
email?: string;
|
|
139
|
+
phone?: string;
|
|
140
|
+
termsAccepted?: boolean;
|
|
141
|
+
};
|
|
94
142
|
type PublicEvent = {
|
|
95
143
|
id: string;
|
|
96
144
|
slug: string;
|
|
@@ -99,6 +147,9 @@ type PublicEvent = {
|
|
|
99
147
|
images?: unknown[];
|
|
100
148
|
location?: unknown;
|
|
101
149
|
availablePaymentMethods?: string[];
|
|
150
|
+
hasPromoGatedShowOptions?: boolean;
|
|
151
|
+
collectAttendeeData?: boolean;
|
|
152
|
+
registrationSettings?: RegistrationSettings | null;
|
|
102
153
|
organization?: {
|
|
103
154
|
id?: string;
|
|
104
155
|
slug?: string;
|
|
@@ -111,11 +162,37 @@ type CartItem = {
|
|
|
111
162
|
showOptionId: string;
|
|
112
163
|
amount: number;
|
|
113
164
|
};
|
|
165
|
+
type QuotePricingLine = {
|
|
166
|
+
showOptionId?: string;
|
|
167
|
+
quantity?: number;
|
|
168
|
+
baseUnitPrice?: number;
|
|
169
|
+
lineTotal?: number;
|
|
170
|
+
codeDiscountAmount?: number;
|
|
171
|
+
codeDiscountedUnits?: number;
|
|
172
|
+
};
|
|
173
|
+
type QuotePricingBreakdown = {
|
|
174
|
+
subtotalBase?: number;
|
|
175
|
+
promotionDiscountTotal?: number;
|
|
176
|
+
codeDiscountTotal?: number;
|
|
177
|
+
serviceCharge?: number;
|
|
178
|
+
total?: number;
|
|
179
|
+
lines?: QuotePricingLine[];
|
|
180
|
+
};
|
|
181
|
+
type QuoteDiscountCode = {
|
|
182
|
+
code?: string;
|
|
183
|
+
discountType?: "PERCENT" | "FIXED" | string;
|
|
184
|
+
value?: number;
|
|
185
|
+
amountApplied?: number;
|
|
186
|
+
benefitKind?: string;
|
|
187
|
+
allowedShowOptionIds?: string[];
|
|
188
|
+
applicationMode?: string;
|
|
189
|
+
};
|
|
114
190
|
type QuoteResult = {
|
|
115
191
|
valid: boolean;
|
|
116
192
|
totalPrice: number;
|
|
117
|
-
pricingBreakdown?: unknown;
|
|
118
|
-
discountCode?: unknown;
|
|
193
|
+
pricingBreakdown?: QuotePricingBreakdown | unknown;
|
|
194
|
+
discountCode?: QuoteDiscountCode | unknown;
|
|
195
|
+
message?: string;
|
|
119
196
|
unlockedShowOptionIds?: string[];
|
|
120
197
|
unlockedShowOptions?: PublicShowOption[];
|
|
121
198
|
};
|
|
@@ -200,6 +277,25 @@ declare function createTickean(options: CreateTickeanOptions): {
|
|
|
200
277
|
eventSlug: string;
|
|
201
278
|
returnUrl?: string;
|
|
202
279
|
}): Promise<CheckoutSession>;
|
|
280
|
+
exchangeRecovery(params: {
|
|
281
|
+
code: string;
|
|
282
|
+
}): Promise<{
|
|
283
|
+
sessionId: string;
|
|
284
|
+
sessionToken: string;
|
|
285
|
+
expiresAt: string;
|
|
286
|
+
suggestedStep?: string | number;
|
|
287
|
+
event: PublicEvent;
|
|
288
|
+
capabilities?: Record<string, boolean>;
|
|
289
|
+
cart: CartItem[];
|
|
290
|
+
discountCode?: string | null;
|
|
291
|
+
buyer?: Buyer | null;
|
|
292
|
+
buyerVerified?: boolean;
|
|
293
|
+
purchase?: PurchaseResult["purchase"] | null;
|
|
294
|
+
payment?: PaymentResult | null;
|
|
295
|
+
nextAction?: NextAction;
|
|
296
|
+
shoppingCartReference?: string | null;
|
|
297
|
+
phase?: string;
|
|
298
|
+
}>;
|
|
203
299
|
getSession(): Promise<CheckoutSession>;
|
|
204
300
|
getCatalog(): Promise<PublicEvent>;
|
|
205
301
|
quote(params: {
|
|
@@ -207,6 +303,17 @@ declare function createTickean(options: CreateTickeanOptions): {
|
|
|
207
303
|
discountCode?: string;
|
|
208
304
|
showId?: string;
|
|
209
305
|
}): Promise<QuoteResult>;
|
|
306
|
+
lookupBuyer(params: {
|
|
307
|
+
phone: string;
|
|
308
|
+
}): Promise<{
|
|
309
|
+
exists: boolean;
|
|
310
|
+
buyer?: {
|
|
311
|
+
id: string;
|
|
312
|
+
phone: string;
|
|
313
|
+
name?: string;
|
|
314
|
+
email?: string;
|
|
315
|
+
};
|
|
316
|
+
}>;
|
|
210
317
|
sendOtp(params: {
|
|
211
318
|
phone: string;
|
|
212
319
|
channel?: string;
|
|
@@ -226,6 +333,7 @@ declare function createTickean(options: CreateTickeanOptions): {
|
|
|
226
333
|
expectedTotal?: number;
|
|
227
334
|
shoppingCartReference?: string;
|
|
228
335
|
idempotencyKey?: string;
|
|
336
|
+
attendees?: PurchaseAttendee[];
|
|
229
337
|
}): Promise<PurchaseResult>;
|
|
230
338
|
createPayment(params: {
|
|
231
339
|
orderId: string;
|
|
@@ -296,6 +404,9 @@ type CheckoutAction = {
|
|
|
296
404
|
} | {
|
|
297
405
|
type: "SET_EVENT";
|
|
298
406
|
event: PublicEvent;
|
|
407
|
+
} | {
|
|
408
|
+
type: "MERGE_UNLOCKED_OPTIONS";
|
|
409
|
+
options: PublicShowOption[];
|
|
299
410
|
} | {
|
|
300
411
|
type: "PURCHASE_START";
|
|
301
412
|
} | {
|
|
@@ -310,6 +421,8 @@ type CheckoutAction = {
|
|
|
310
421
|
type: "SET_NEXT_ACTION";
|
|
311
422
|
nextAction: NextAction;
|
|
312
423
|
payment?: PaymentResult | null;
|
|
424
|
+
} | {
|
|
425
|
+
type: "RESET_PAYMENT_FLOW";
|
|
313
426
|
} | {
|
|
314
427
|
type: "PROCESSING";
|
|
315
428
|
} | {
|
|
@@ -332,6 +445,8 @@ declare function checkoutReducer(state: CheckoutState, action: CheckoutAction):
|
|
|
332
445
|
type CreateCheckoutControllerOptions = CreateTickeanOptions & {
|
|
333
446
|
eventSlug: string;
|
|
334
447
|
returnUrl?: string;
|
|
448
|
+
/** Abandonment recovery code from `?resume=` deep link. */
|
|
449
|
+
resumeCode?: string;
|
|
335
450
|
quoteDebounceMs?: number;
|
|
336
451
|
persistence?: PersistenceAdapter | false;
|
|
337
452
|
persistenceKey?: string;
|
|
@@ -344,6 +459,25 @@ declare function createCheckoutController(options: CreateCheckoutControllerOptio
|
|
|
344
459
|
eventSlug: string;
|
|
345
460
|
returnUrl?: string;
|
|
346
461
|
}): Promise<CheckoutSession>;
|
|
462
|
+
exchangeRecovery(params: {
|
|
463
|
+
code: string;
|
|
464
|
+
}): Promise<{
|
|
465
|
+
sessionId: string;
|
|
466
|
+
sessionToken: string;
|
|
467
|
+
expiresAt: string;
|
|
468
|
+
suggestedStep?: string | number;
|
|
469
|
+
event: PublicEvent;
|
|
470
|
+
capabilities?: Record<string, boolean>;
|
|
471
|
+
cart: CartItem[];
|
|
472
|
+
discountCode?: string | null;
|
|
473
|
+
buyer?: Buyer | null;
|
|
474
|
+
buyerVerified?: boolean;
|
|
475
|
+
purchase?: PurchaseResult["purchase"] | null;
|
|
476
|
+
payment?: PaymentResult | null;
|
|
477
|
+
nextAction?: NextAction;
|
|
478
|
+
shoppingCartReference?: string | null;
|
|
479
|
+
phase?: string;
|
|
480
|
+
}>;
|
|
347
481
|
getSession(): Promise<CheckoutSession>;
|
|
348
482
|
getCatalog(): Promise<PublicEvent>;
|
|
349
483
|
quote(params: {
|
|
@@ -351,6 +485,17 @@ declare function createCheckoutController(options: CreateCheckoutControllerOptio
|
|
|
351
485
|
discountCode?: string;
|
|
352
486
|
showId?: string;
|
|
353
487
|
}): Promise<QuoteResult>;
|
|
488
|
+
lookupBuyer(params: {
|
|
489
|
+
phone: string;
|
|
490
|
+
}): Promise<{
|
|
491
|
+
exists: boolean;
|
|
492
|
+
buyer?: {
|
|
493
|
+
id: string;
|
|
494
|
+
phone: string;
|
|
495
|
+
name?: string;
|
|
496
|
+
email?: string;
|
|
497
|
+
};
|
|
498
|
+
}>;
|
|
354
499
|
sendOtp(params: {
|
|
355
500
|
phone: string;
|
|
356
501
|
channel?: string;
|
|
@@ -370,6 +515,7 @@ declare function createCheckoutController(options: CreateCheckoutControllerOptio
|
|
|
370
515
|
expectedTotal?: number;
|
|
371
516
|
shoppingCartReference?: string;
|
|
372
517
|
idempotencyKey?: string;
|
|
518
|
+
attendees?: PurchaseAttendee[];
|
|
373
519
|
}): Promise<PurchaseResult>;
|
|
374
520
|
createPayment(params: {
|
|
375
521
|
orderId: string;
|
|
@@ -397,6 +543,15 @@ declare function createCheckoutController(options: CreateCheckoutControllerOptio
|
|
|
397
543
|
setCartItem: (showOptionId: string, amount: number) => void;
|
|
398
544
|
setCart: (cart: CartItem[]) => void;
|
|
399
545
|
applyDiscountCode: (code: string) => Promise<QuoteResult>;
|
|
546
|
+
lookupBuyer: (phone: string) => Promise<{
|
|
547
|
+
exists: boolean;
|
|
548
|
+
buyer?: {
|
|
549
|
+
id: string;
|
|
550
|
+
phone: string;
|
|
551
|
+
name?: string;
|
|
552
|
+
email?: string;
|
|
553
|
+
};
|
|
554
|
+
}>;
|
|
400
555
|
sendOtp: (phone: string, channel?: string) => Promise<void>;
|
|
401
556
|
verifyOtp: (params: {
|
|
402
557
|
phone: string;
|
|
@@ -410,11 +565,13 @@ declare function createCheckoutController(options: CreateCheckoutControllerOptio
|
|
|
410
565
|
discountCode?: string;
|
|
411
566
|
showId?: string;
|
|
412
567
|
idempotencyKey?: string;
|
|
568
|
+
attendees?: PurchaseAttendee[];
|
|
413
569
|
}) => Promise<{
|
|
414
570
|
purchaseId: string;
|
|
415
571
|
payment: PaymentResult;
|
|
416
572
|
nextAction: NextAction;
|
|
417
573
|
}>;
|
|
574
|
+
changePaymentMethod: () => void;
|
|
418
575
|
confirmPayment: (params?: {
|
|
419
576
|
paymentId?: string;
|
|
420
577
|
confirmationToken?: string;
|
|
@@ -443,4 +600,43 @@ declare function createEventEmitterTelemetry(listeners?: TelemetryListener[]): T
|
|
|
443
600
|
subscribe(listener: TelemetryListener): () => void;
|
|
444
601
|
};
|
|
445
602
|
|
|
446
|
-
|
|
603
|
+
type PaymentSocketSnapshot = {
|
|
604
|
+
purchaseId?: string;
|
|
605
|
+
orderId?: string;
|
|
606
|
+
paymentId?: string;
|
|
607
|
+
status?: string;
|
|
608
|
+
amount?: number;
|
|
609
|
+
currency?: string;
|
|
610
|
+
};
|
|
611
|
+
type PaymentSocketWatchHandle = {
|
|
612
|
+
promise: Promise<PaymentSocketSnapshot>;
|
|
613
|
+
dispose: () => void;
|
|
614
|
+
get connected(): boolean;
|
|
615
|
+
};
|
|
616
|
+
/**
|
|
617
|
+
* Join the legacy cart payment room (same as ecommerce) and resolve when
|
|
618
|
+
* payment:confirmed arrives. HTTP polling remains the fallback.
|
|
619
|
+
*/
|
|
620
|
+
declare function watchPaymentSocket(params: {
|
|
621
|
+
apiBaseUrl: string;
|
|
622
|
+
shoppingCartReference: string;
|
|
623
|
+
purchaseId?: string;
|
|
624
|
+
signal?: AbortSignal;
|
|
625
|
+
timeoutMs?: number;
|
|
626
|
+
}): PaymentSocketWatchHandle;
|
|
627
|
+
|
|
628
|
+
/**
|
|
629
|
+
* Navigate the top-level browsing context (breaks out of iframes).
|
|
630
|
+
* Used for Mercado Pago hosted checkout so payment is not trapped in embeds.
|
|
631
|
+
*/
|
|
632
|
+
declare function navigateTopLevel(url: string): void;
|
|
633
|
+
declare function resolveRedirectUrl(params: {
|
|
634
|
+
nextAction?: {
|
|
635
|
+
type: string;
|
|
636
|
+
url?: string;
|
|
637
|
+
} | null;
|
|
638
|
+
redirectUrl?: string | null;
|
|
639
|
+
initPoint?: string | null;
|
|
640
|
+
}): string | null;
|
|
641
|
+
|
|
642
|
+
export { type Buyer, type CartItem, type CheckoutAction, type CheckoutController, type CheckoutPhase, type CheckoutSession, type CheckoutState, type CheckoutTransport, type CreateCheckoutControllerOptions, type CreateTickeanOptions, type NextAction, type PaymentResult, type PaymentSocketSnapshot, type PaymentSocketWatchHandle, type PaymentStatusResult, type PersistedCheckoutState, type PersistenceAdapter, type PromotionNxM, type PublicEvent, type PublicShow, type PublicShowOption, type PurchaseAttendee, type PurchaseResult, type QuantityDiscount, type QuoteDiscountCode, type QuotePricingBreakdown, type QuotePricingLine, type QuoteResult, type RegistrationQuestion, type RegistrationSettings, type TelemetryAdapter, type TelemetryEvent, type TelemetryListener, type TickeanClient, TickeanError, type TickeanErrorPayload, checkoutReducer, createCheckoutController, createEventEmitterTelemetry, createInitialState, createMemoryPersistence, createNoopTelemetry, createSessionStoragePersistence, createTickean, navigateTopLevel, resolveRedirectUrl, watchPaymentSocket };
|