@getspot/spot-widget 2.0.0 → 2.1.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/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @getspot/spot-widget
2
2
 
3
+ ## 2.1.0
4
+
5
+ ### Minor Changes
6
+
7
+ - bdef1ee: logoposition flag and other enhancements
8
+
9
+ ## 2.0.1
10
+
11
+ ### Patch Changes
12
+
13
+ - ccc78eb: Fix npm docs generation for interfaces and types
14
+
3
15
  ## 2.0.0
4
16
 
5
17
  ### Major Changes
package/README.md CHANGED
@@ -327,35 +327,227 @@ 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
- - [ApiConfig](docs/interfaces/ApiConfig.md)
337
- - [ApiError](docs/interfaces/ApiError.md)
338
- - [ApiResponse](docs/interfaces/ApiResponse.md)
339
- - [BatchQuoteItem](docs/interfaces/BatchQuoteItem.md)
340
- - [BatchQuoteRequest](docs/interfaces/BatchQuoteRequest.md)
341
- - [Callbacks](docs/interfaces/Callbacks.md)
342
- - [CartInfo](docs/interfaces/CartInfo.md)
343
- - [Communication](docs/interfaces/Communication.md)
344
- - [ElementOptions](docs/interfaces/ElementOptions.md)
345
- - [PayoutScheduleItem](docs/interfaces/PayoutScheduleItem.md)
346
- - [QualifyingReason](docs/interfaces/QualifyingReason.md)
347
- - [Quote](docs/interfaces/Quote.md)
348
- - [QuoteItem](docs/interfaces/QuoteItem.md)
349
- - [QuoteMetadata](docs/interfaces/QuoteMetadata.md)
350
- - [SelectionData](docs/interfaces/SelectionData.md)
351
- - [SpotWidgetOptions](docs/interfaces/SpotWidgetOptions.md)
352
- - [Theme](docs/interfaces/Theme.md)
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: {
499
+ message: string;
500
+ status?: number;
501
+ responseBody?: any;
502
+ }) => void;
503
+ noMatchingQuote?: (data: { status: string; data: QuoteRequestData }) => void;
504
+ }
505
+ ```
506
+
507
+ #### Theme
508
+
509
+ ```typescript
510
+ export interface Theme {
511
+ [key: string]: string;
512
+ }
513
+ ```
514
+
515
+ #### SpotWidgetOptions
516
+
517
+ ```typescript
518
+ export interface SpotWidgetOptions {
519
+ location?: string | HTMLElement;
520
+ showTable?: boolean;
521
+ optInSelected?: boolean;
522
+ logoPosition?: "bottom-right" | "top-right";
523
+ apiConfig: ApiConfig;
524
+ quoteRequestData: QuoteRequestData;
525
+ callbacks?: Callbacks;
526
+ theme?: Theme;
527
+ isPartialPayment?: boolean;
528
+ }
529
+ ```
530
+
531
+ #### ElementOptions
532
+
533
+ ```typescript
534
+ export interface ElementOptions {
535
+ text?: string;
536
+ className?: string;
537
+ parent?: HTMLElement;
538
+ innerHTML?: string;
539
+ href?: string;
540
+ target?: string;
541
+ }
542
+ ```
353
543
 
354
544
  ### Type Aliases
355
545
 
356
- - [QuoteRequestData](docs/type-aliases/QuoteRequestData.md)
546
+ #### QuoteRequestData
357
547
 
358
- > **📚 Full API Documentation**: See [docs/](docs/) for detailed documentation of all types and interfaces.
548
+ ```typescript
549
+ export type QuoteRequestData = QuoteItem | BatchQuoteRequest;
550
+ ```
359
551
 
360
552
  ## Framework Integration
361
553
 
package/dist/index.d.ts CHANGED
@@ -8,18 +8,22 @@ declare class SpotWidget {
8
8
  private errorEl?;
9
9
  private quote?;
10
10
  private _onResize;
11
+ private _resizeObserver?;
11
12
  constructor(options?: Partial<SpotWidgetOptions>);
12
13
  private _init;
13
14
  private _renderWidget;
14
15
  private _updateLayout;
16
+ private _shouldUseDesktopLayout;
17
+ private _setupResizeObserver;
18
+ private _resizeTimeout?;
15
19
  private _setupOptionListeners;
16
20
  showSelectionError(): void;
17
21
  hideSelectionError(): void;
18
22
  validateSelection(): boolean;
19
- updateQuote(newQuoteRequestData: SpotWidgetOptions['quoteRequestData']): Promise<boolean>;
23
+ updateQuote(newQuoteRequestData: SpotWidgetOptions["quoteRequestData"]): Promise<boolean>;
20
24
  getSelection(): SelectionData | null;
21
25
  destroy(): void;
22
26
  }
23
27
  export default SpotWidget;
24
- export type { SpotWidgetOptions, SelectionData, Quote, ApiConfig, QuoteRequestData, QuoteItem, BatchQuoteItem, BatchQuoteRequest, CartInfo, QualifyingReason, PayoutScheduleItem, Communication, ApiResponse, ApiError, ElementOptions, QuoteMetadata, Callbacks, Theme } from './types.js';
28
+ export type { SpotWidgetOptions, SelectionData, Quote, ApiConfig, QuoteRequestData, QuoteItem, BatchQuoteItem, BatchQuoteRequest, CartInfo, QualifyingReason, PayoutScheduleItem, Communication, ApiResponse, ApiError, ElementOptions, QuoteMetadata, Callbacks, Theme, } from "./types.js";
25
29
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,iBAAiB,EAAS,aAAa,EAAqB,MAAM,YAAY,CAAC;AAkB7F,cAAM,UAAU;IACd,OAAO,CAAC,OAAO,CAAoB;IACnC,OAAO,CAAC,IAAI,CAAc;IAC1B,OAAO,CAAC,gBAAgB,CAAgB;IACxC,OAAO,CAAC,SAAS,CAAC,CAAc;IAChC,OAAO,CAAC,cAAc,CAAC,CAAc;IACrC,OAAO,CAAC,OAAO,CAAC,CAAc;IAC9B,OAAO,CAAC,KAAK,CAAC,CAAQ;IACtB,OAAO,CAAC,SAAS,CAAa;gBAElB,OAAO,GAAE,OAAO,CAAC,iBAAiB,CAAM;YAqBtC,KAAK;IAgFnB,OAAO,CAAC,aAAa;IAiDrB,OAAO,CAAC,aAAa;IAUrB,OAAO,CAAC,qBAAqB;IA6F7B,kBAAkB,IAAI,IAAI;IAgB1B,kBAAkB,IAAI,IAAI;IAM1B,iBAAiB,IAAI,OAAO;IAgBtB,WAAW,CAAC,mBAAmB,EAAE,iBAAiB,CAAC,kBAAkB,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC;IAqE/F,YAAY,IAAI,aAAa,GAAG,IAAI;IAiCpC,OAAO,IAAI,IAAI;CAMhB;AAED,eAAe,UAAU,CAAC;AAC1B,YAAY,EACV,iBAAiB,EACjB,aA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