@getspot/spot-widget 2.0.0 → 2.0.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/CHANGELOG.md +6 -0
- package/README.md +206 -19
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -327,35 +327,222 @@ Use the production environment for live applications:
|
|
|
327
327
|
}
|
|
328
328
|
```
|
|
329
329
|
|
|
330
|
+
|
|
331
|
+
|
|
330
332
|
## API Reference
|
|
331
333
|
|
|
332
334
|
This package exports the following types and interfaces:
|
|
333
335
|
|
|
334
336
|
### Interfaces
|
|
335
337
|
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
338
|
+
#### ApiConfig
|
|
339
|
+
|
|
340
|
+
```typescript
|
|
341
|
+
export interface ApiConfig {
|
|
342
|
+
environment: 'sandbox' | 'production' | 'local';
|
|
343
|
+
partnerId: string;
|
|
344
|
+
customEndpoint?: string;
|
|
345
|
+
}
|
|
346
|
+
```
|
|
347
|
+
|
|
348
|
+
#### QuoteMetadata
|
|
349
|
+
|
|
350
|
+
```typescript
|
|
351
|
+
export interface QuoteMetadata {
|
|
352
|
+
segment?: string;
|
|
353
|
+
operator?: string;
|
|
354
|
+
channel?: string;
|
|
355
|
+
consumerId?: string;
|
|
356
|
+
}
|
|
357
|
+
```
|
|
358
|
+
|
|
359
|
+
#### CartInfo
|
|
360
|
+
|
|
361
|
+
```typescript
|
|
362
|
+
export interface CartInfo {
|
|
363
|
+
cartId: string;
|
|
364
|
+
cartName: string;
|
|
365
|
+
currencyCode: 'USD' | 'CAD' | 'AUD';
|
|
366
|
+
metadata?: QuoteMetadata;
|
|
367
|
+
isPartialPayment?: boolean;
|
|
368
|
+
}
|
|
369
|
+
```
|
|
370
|
+
|
|
371
|
+
#### QuoteItem
|
|
372
|
+
|
|
373
|
+
```typescript
|
|
374
|
+
export interface QuoteItem {
|
|
375
|
+
productPrice: number;
|
|
376
|
+
productType: 'Pass' | 'Trip' | 'Registration';
|
|
377
|
+
productDuration: 'Daily' | 'Seasonal' | 'Trip' | 'Event';
|
|
378
|
+
productId: string;
|
|
379
|
+
cartId: string;
|
|
380
|
+
cartName: string;
|
|
381
|
+
productName: string;
|
|
382
|
+
participantDescription?: string;
|
|
383
|
+
eventType: string;
|
|
384
|
+
currencyCode: 'USD' | 'CAD' | 'AUD';
|
|
385
|
+
startDate: string;
|
|
386
|
+
endDate: string;
|
|
387
|
+
partnerRiskEnd?: Date;
|
|
388
|
+
metadata?: QuoteMetadata;
|
|
389
|
+
isPartialPayment?: boolean;
|
|
390
|
+
hostCountry?: string;
|
|
391
|
+
hostCountryState?: string;
|
|
392
|
+
destinations?: string[];
|
|
393
|
+
dob?: string;
|
|
394
|
+
}
|
|
395
|
+
```
|
|
396
|
+
|
|
397
|
+
#### BatchQuoteRequest
|
|
398
|
+
|
|
399
|
+
```typescript
|
|
400
|
+
export interface BatchQuoteRequest {
|
|
401
|
+
cartInfo: CartInfo;
|
|
402
|
+
items: BatchQuoteItem[];
|
|
403
|
+
}
|
|
404
|
+
```
|
|
405
|
+
|
|
406
|
+
#### QualifyingReason
|
|
407
|
+
|
|
408
|
+
```typescript
|
|
409
|
+
export interface QualifyingReason {
|
|
410
|
+
rank: number;
|
|
411
|
+
name?: string;
|
|
412
|
+
benefitType?: {
|
|
413
|
+
name: string;
|
|
414
|
+
};
|
|
415
|
+
}
|
|
416
|
+
```
|
|
417
|
+
|
|
418
|
+
#### PayoutScheduleItem
|
|
419
|
+
|
|
420
|
+
```typescript
|
|
421
|
+
export interface PayoutScheduleItem {
|
|
422
|
+
text: string;
|
|
423
|
+
percent: string | number;
|
|
424
|
+
amount: number;
|
|
425
|
+
}
|
|
426
|
+
```
|
|
427
|
+
|
|
428
|
+
#### Communication
|
|
429
|
+
|
|
430
|
+
```typescript
|
|
431
|
+
export interface Communication {
|
|
432
|
+
name: string;
|
|
433
|
+
description: string;
|
|
434
|
+
bulletPoints: string[];
|
|
435
|
+
yesOptionText: string;
|
|
436
|
+
noOptionText: string;
|
|
437
|
+
legalDisclaimer: string;
|
|
438
|
+
termsAndConditionsUrl: string;
|
|
439
|
+
paymentTerms?: string;
|
|
440
|
+
}
|
|
441
|
+
```
|
|
442
|
+
|
|
443
|
+
#### Quote
|
|
444
|
+
|
|
445
|
+
```typescript
|
|
446
|
+
export interface Quote {
|
|
447
|
+
id: string;
|
|
448
|
+
cartItemId?: string;
|
|
449
|
+
spotPrice: number;
|
|
450
|
+
currencyCode: string;
|
|
451
|
+
communication: Communication;
|
|
452
|
+
payoutSchedule: PayoutScheduleItem[];
|
|
453
|
+
qualifyingReasons?: QualifyingReason[];
|
|
454
|
+
coveredItems?: string[];
|
|
455
|
+
originalQuotes?: Quote[];
|
|
456
|
+
}
|
|
457
|
+
```
|
|
458
|
+
|
|
459
|
+
#### ApiResponse
|
|
460
|
+
|
|
461
|
+
```typescript
|
|
462
|
+
export interface ApiResponse {
|
|
463
|
+
status: 'QUOTE_AVAILABLE' | 'QUOTES_AVAILABLE' | 'NO_MATCHING_QUOTE';
|
|
464
|
+
data?: Quote;
|
|
465
|
+
quotes?: Quote[];
|
|
466
|
+
totalSpotPrice?: number;
|
|
467
|
+
spotPrice?: number;
|
|
468
|
+
currencyCode?: string;
|
|
469
|
+
communication?: Communication;
|
|
470
|
+
payoutSchedule?: PayoutScheduleItem[];
|
|
471
|
+
coveredItems?: string[];
|
|
472
|
+
}
|
|
473
|
+
```
|
|
474
|
+
|
|
475
|
+
#### SelectionData
|
|
476
|
+
|
|
477
|
+
```typescript
|
|
478
|
+
export interface SelectionData {
|
|
479
|
+
status: 'QUOTE_ACCEPTED' | 'QUOTE_DECLINED';
|
|
480
|
+
spotPrice?: number;
|
|
481
|
+
quoteId?: string;
|
|
482
|
+
selection?: string;
|
|
483
|
+
batchQuoteDetails?: Array<{
|
|
484
|
+
quoteId: string;
|
|
485
|
+
productPrice: number;
|
|
486
|
+
cartItemId: string;
|
|
487
|
+
}>;
|
|
488
|
+
}
|
|
489
|
+
```
|
|
490
|
+
|
|
491
|
+
#### Callbacks
|
|
492
|
+
|
|
493
|
+
```typescript
|
|
494
|
+
export interface Callbacks {
|
|
495
|
+
onOptIn?: (data: SelectionData) => void;
|
|
496
|
+
onOptOut?: (data: SelectionData) => void;
|
|
497
|
+
onQuoteRetrieved?: (quote: Quote) => void;
|
|
498
|
+
onError?: (error: { message: string; status?: number; responseBody?: any }) => void;
|
|
499
|
+
noMatchingQuote?: (data: { status: string; data: QuoteRequestData }) => void;
|
|
500
|
+
}
|
|
501
|
+
```
|
|
502
|
+
|
|
503
|
+
#### Theme
|
|
504
|
+
|
|
505
|
+
```typescript
|
|
506
|
+
export interface Theme {
|
|
507
|
+
[key: string]: string;
|
|
508
|
+
}
|
|
509
|
+
```
|
|
510
|
+
|
|
511
|
+
#### SpotWidgetOptions
|
|
512
|
+
|
|
513
|
+
```typescript
|
|
514
|
+
export interface SpotWidgetOptions {
|
|
515
|
+
location?: string | HTMLElement;
|
|
516
|
+
showTable?: boolean;
|
|
517
|
+
optInSelected?: boolean;
|
|
518
|
+
apiConfig: ApiConfig;
|
|
519
|
+
quoteRequestData: QuoteRequestData;
|
|
520
|
+
callbacks?: Callbacks;
|
|
521
|
+
theme?: Theme;
|
|
522
|
+
isPartialPayment?: boolean;
|
|
523
|
+
}
|
|
524
|
+
```
|
|
525
|
+
|
|
526
|
+
#### ElementOptions
|
|
527
|
+
|
|
528
|
+
```typescript
|
|
529
|
+
export interface ElementOptions {
|
|
530
|
+
text?: string;
|
|
531
|
+
className?: string;
|
|
532
|
+
parent?: HTMLElement;
|
|
533
|
+
innerHTML?: string;
|
|
534
|
+
href?: string;
|
|
535
|
+
target?: string;
|
|
536
|
+
}
|
|
537
|
+
```
|
|
353
538
|
|
|
354
539
|
### Type Aliases
|
|
355
540
|
|
|
356
|
-
|
|
541
|
+
#### QuoteRequestData
|
|
357
542
|
|
|
358
|
-
|
|
543
|
+
```typescript
|
|
544
|
+
export type QuoteRequestData = QuoteItem | BatchQuoteRequest;
|
|
545
|
+
```
|
|
359
546
|
|
|
360
547
|
## Framework Integration
|
|
361
548
|
|