@inappstory/slide-api 0.0.20 → 0.0.22

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.d.cts CHANGED
@@ -58,7 +58,12 @@ declare class WidgetRangeSlider extends WidgetBase<WidgetRangeSliderOptions> {
58
58
  * @param options
59
59
  */
60
60
  constructor(element: HTMLElement, options: Partial<WidgetRangeSliderOptions>);
61
+ /**
62
+ * Start or restart widget
63
+ * @param localData
64
+ */
61
65
  onRefreshUserData(localData: Record<string, any>): void;
66
+ onStop(): void;
62
67
  private _statEventInputSave;
63
68
  click(): boolean;
64
69
  private completeWidget;
@@ -86,6 +91,8 @@ declare class WidgetRangeSlider extends WidgetBase<WidgetRangeSliderOptions> {
86
91
  onRefreshUserData: typeof WidgetBase.onRefreshUserData;
87
92
  init: (element: HTMLElement, localData?: Record<string, any>) => void;
88
93
  initWidget: (element: HTMLElement, localData?: Record<string, any>) => void;
94
+ onStart: (element: HTMLElement) => void;
95
+ onStop: (element: HTMLElement) => void;
89
96
  click: (element: HTMLElement) => boolean;
90
97
  isClickCapturedBySlider: (element: HTMLElement) => boolean;
91
98
  };
@@ -127,6 +134,10 @@ declare class WidgetPoll extends WidgetBase<WidgetPollOptions> {
127
134
  * @param options
128
135
  */
129
136
  constructor(element: HTMLElement, options: Partial<WidgetPollOptions>);
137
+ /**
138
+ * Start or restart widget
139
+ * @param localData
140
+ */
130
141
  onRefreshUserData(localData: Record<string, any>): void;
131
142
  private _statEventPollAnswer;
132
143
  private _statEventInputSave;
@@ -145,6 +156,8 @@ declare class WidgetPoll extends WidgetBase<WidgetPollOptions> {
145
156
  onRefreshUserData: typeof WidgetBase.onRefreshUserData;
146
157
  init: (element: HTMLElement, localData?: Record<string, any>) => void;
147
158
  initWidget: (element: HTMLElement, localData?: Record<string, any>) => void;
159
+ onStart: (element: HTMLElement) => void;
160
+ onStop: (element: HTMLElement) => void;
148
161
  select: (element: HTMLElement) => boolean;
149
162
  slidePollIsDone: (element: HTMLElement) => boolean;
150
163
  setUserData: (id: string, text: string) => void;
@@ -176,6 +189,10 @@ declare class WidgetVote extends WidgetBase<WidgetVoteOptions> {
176
189
  */
177
190
  constructor(element: HTMLElement, options: Partial<WidgetVoteOptions>);
178
191
  private _initFromLocalData;
192
+ /**
193
+ * Start or restart widget
194
+ * @param localData
195
+ */
179
196
  onRefreshUserData(localData: Record<string, any>): void;
180
197
  private _clearSelectedVariants;
181
198
  private _statEventVoteVariant;
@@ -202,6 +219,8 @@ declare class WidgetVote extends WidgetBase<WidgetVoteOptions> {
202
219
  init: (element: HTMLElement, localData?: Record<string, any>) => void;
203
220
  fallbackInitOnMultiSlide: (element: HTMLElement, localData?: Record<string, any>) => void;
204
221
  initWidget: (element: HTMLElement, localData?: Record<string, any>) => void;
222
+ onStart: (element: HTMLElement) => void;
223
+ onStop: (element: HTMLElement) => void;
205
224
  select: (element: HTMLElement) => boolean;
206
225
  click: (element: HTMLElement) => boolean;
207
226
  slideVoteIsDone: (element: HTMLElement) => boolean;
@@ -265,12 +284,19 @@ declare class WidgetBarcode extends WidgetBase<WidgetBarcodeOptions> {
265
284
  private readonly msgTryAgain;
266
285
  private readonly msgBarcodeRenderError;
267
286
  constructor(element: HTMLElement, options: Partial<WidgetBarcodeOptions>);
287
+ /**
288
+ * Start or restart widget
289
+ * @param localData
290
+ */
268
291
  onRefreshUserData(localData: Record<string, any>): void;
292
+ onStart(): void;
269
293
  private isTransparentElement;
270
294
  private renderCodeView;
271
295
  private formatCaptionText;
272
296
  private renderCaptionView;
273
297
  private changeCaptionViewText;
298
+ private getPromotionalCodeFromLocalData;
299
+ private initPromotionalCodeFromLocalData;
274
300
  private fetchPromoCode;
275
301
  getStateValue(): number | null;
276
302
  getIsPromotionalCode(): boolean;
@@ -285,6 +311,8 @@ declare class WidgetBarcode extends WidgetBase<WidgetBarcodeOptions> {
285
311
  onRefreshUserData: typeof WidgetBase.onRefreshUserData;
286
312
  init: (element: HTMLElement, localData?: Record<string, any>) => void;
287
313
  initWidget: (nodeList: Iterable<HTMLElement>, localData?: Record<string, any>) => void;
314
+ onStart: (element: HTMLElement) => void;
315
+ onStop: (element: HTMLElement) => void;
288
316
  click: (element: HTMLElement) => boolean;
289
317
  };
290
318
  }
@@ -304,9 +332,16 @@ declare class WidgetCopy extends WidgetBase<WidgetCopyOptions> {
304
332
  private readonly resultLayer;
305
333
  private readonly resultLayerGeometry;
306
334
  constructor(element: HTMLElement, options: Partial<WidgetCopyOptions>);
335
+ /**
336
+ * Start or restart widget
337
+ * @param localData
338
+ */
307
339
  onRefreshUserData(localData: Record<string, any>): void;
340
+ onStart(): void;
308
341
  private isTransparentElement;
309
342
  private changeText;
343
+ private getPromotionalCodeFromLocalData;
344
+ private initPromotionalCodeFromLocalData;
310
345
  private fetchPromoCode;
311
346
  getStateValue(): number | null;
312
347
  getIsPromotionalCode(): boolean;
@@ -321,6 +356,8 @@ declare class WidgetCopy extends WidgetBase<WidgetCopyOptions> {
321
356
  onRefreshUserData: typeof WidgetBase.onRefreshUserData;
322
357
  init: (element: HTMLElement, localData?: Record<string, any>) => void;
323
358
  initWidget: (nodeList: Iterable<HTMLElement>, localData?: Record<string, any>) => void;
359
+ onStart: (element: HTMLElement) => void;
360
+ onStop: (element: HTMLElement) => void;
324
361
  click: (element: HTMLElement) => boolean;
325
362
  };
326
363
  }
@@ -344,7 +381,12 @@ declare class WidgetDataInput extends WidgetBase<WidgetDataInputOptions> {
344
381
  * @param options
345
382
  */
346
383
  constructor(element: HTMLElement, options: Partial<WidgetDataInputOptions>);
384
+ /**
385
+ * Start or restart widget
386
+ * @param localData
387
+ */
347
388
  onRefreshUserData(localData: Record<string, any>): void;
389
+ private getTextFromLocalData;
348
390
  private _statEventFocusIn;
349
391
  private _statEventInputSave;
350
392
  isDone(): boolean;
@@ -357,6 +399,8 @@ declare class WidgetDataInput extends WidgetBase<WidgetDataInputOptions> {
357
399
  onRefreshUserData: typeof WidgetBase.onRefreshUserData;
358
400
  init: (element: HTMLElement, localData?: Record<string, any>) => void;
359
401
  initWidget: (nodeList: Iterable<HTMLElement>, localData?: Record<string, any>) => void;
402
+ onStart: (element: HTMLElement) => void;
403
+ onStop: (element: HTMLElement) => void;
360
404
  click: (element: HTMLElement) => boolean;
361
405
  setUserData: (id: string, text: string) => void;
362
406
  };
@@ -368,11 +412,11 @@ declare class WidgetDateCountdown extends WidgetBase<WidgetDateCountdownOptions>
368
412
  static DEFAULTS: WidgetDateCountdownOptions;
369
413
  static widgetClassName: string;
370
414
  private label;
371
- private layers;
415
+ private readonly layers;
372
416
  private messages;
373
- private timestampSeconds;
374
- private diff;
375
- private timerInited;
417
+ private readonly timestampMs;
418
+ private readonly diff;
419
+ private timerInit;
376
420
  private pendingUpdate;
377
421
  private firstGroup1;
378
422
  private firstGroup2;
@@ -384,9 +428,15 @@ declare class WidgetDateCountdown extends WidgetBase<WidgetDateCountdownOptions>
384
428
  private thirdGroup2;
385
429
  private thirdGroupCaption;
386
430
  constructor(element: HTMLElement, options: Partial<WidgetDateCountdownOptions>);
431
+ /**
432
+ * Start or restart widget
433
+ * @param localData
434
+ */
387
435
  onRefreshUserData(localData: Record<string, any>): void;
388
- private pause;
389
- private resume;
436
+ onPause(): void;
437
+ onResume(): void;
438
+ onStart(): void;
439
+ onStop(): void;
390
440
  private initTimer;
391
441
  private updateTimer;
392
442
  private _asDuration;
@@ -396,6 +446,8 @@ declare class WidgetDateCountdown extends WidgetBase<WidgetDateCountdownOptions>
396
446
  onRefreshUserData: typeof WidgetBase.onRefreshUserData;
397
447
  init: (element: HTMLElement, layers: Array<HTMLElement>, localData?: Record<string, any>) => void;
398
448
  initWidget: (nodeList: Iterable<HTMLElement>, layers: Array<HTMLElement>, localData?: Record<string, any>) => void;
449
+ onStart: (element: HTMLElement) => void;
450
+ onStop: (element: HTMLElement) => void;
399
451
  onPause: (element: HTMLElement) => void;
400
452
  onResume: (element: HTMLElement) => void;
401
453
  pause: (nodeList: Iterable<HTMLElement>) => void;
@@ -414,11 +466,15 @@ declare class WidgetPollLayers extends WidgetBase<WidgetPollLayersOptions> {
414
466
  static DEFAULTS: WidgetPollLayersOptions;
415
467
  static widgetClassName: string;
416
468
  private label;
417
- private variants;
469
+ private readonly variants;
418
470
  private variantsTexts;
419
471
  private selectedVariant;
420
- private layers;
472
+ private readonly layers;
421
473
  constructor(element: HTMLElement, options: Partial<WidgetPollLayersOptions>);
474
+ /**
475
+ * Start or restart widget
476
+ * @param localData
477
+ */
422
478
  onRefreshUserData(localData: Record<string, any>): void;
423
479
  private _statEventPollVariant;
424
480
  private _selectVariant;
@@ -432,6 +488,8 @@ declare class WidgetPollLayers extends WidgetBase<WidgetPollLayersOptions> {
432
488
  onRefreshUserData: typeof WidgetBase.onRefreshUserData;
433
489
  init: (element: HTMLElement, layers: Array<HTMLElement>, localData?: Record<string, any>) => void;
434
490
  initWidget: (element: HTMLElement, layers: Array<HTMLElement>, localData?: Record<string, any>) => void;
491
+ onStart: (element: HTMLElement) => void;
492
+ onStop: (element: HTMLElement) => void;
435
493
  select: (element: HTMLElement) => boolean;
436
494
  };
437
495
  }
@@ -447,6 +505,10 @@ declare class WidgetQuest extends WidgetBase<WidgetQuestOptions> {
447
505
  private readonly nonFinalSlide;
448
506
  private readonly finalSlide;
449
507
  constructor(element: HTMLElement, options: Partial<WidgetQuestOptions>);
508
+ /**
509
+ * Start or restart widget
510
+ * @param localData
511
+ */
450
512
  onRefreshUserData(localData: Record<string, any>): void;
451
513
  private setCardSessionValue;
452
514
  private getCardSessionValue;
@@ -468,6 +530,8 @@ declare class WidgetQuest extends WidgetBase<WidgetQuestOptions> {
468
530
  onRefreshUserData: typeof WidgetBase.onRefreshUserData;
469
531
  init: (element: HTMLElement, localData?: Record<string, any>) => Promise<boolean>;
470
532
  initWidget: (element: HTMLElement, localData?: Record<string, any>) => Promise<boolean>;
533
+ onStart: (element: HTMLElement) => void;
534
+ onStop: (element: HTMLElement) => void;
471
535
  select: (element: HTMLElement) => boolean;
472
536
  slideTestIsDone: (element: HTMLElement) => boolean;
473
537
  handleRouteClick: (element: HTMLElement, event: {
@@ -482,11 +546,15 @@ type WidgetQuizOptions = WidgetOptionsBase;
482
546
  declare class WidgetQuiz extends WidgetBase<WidgetQuizOptions> {
483
547
  static DEFAULTS: WidgetQuizOptions;
484
548
  static widgetClassName: string;
485
- private question;
486
- private answers;
487
- private questionCount;
549
+ private readonly question;
550
+ private readonly answers;
551
+ private readonly questionCount;
488
552
  private selectedAnswer;
489
553
  constructor(element: HTMLElement, options: Partial<WidgetQuizOptions>);
554
+ /**
555
+ * Start or restart widget
556
+ * @param localData
557
+ */
490
558
  onRefreshUserData(localData: Record<string, any>): void;
491
559
  private _selectAnswer;
492
560
  private _clearAnswerSelection;
@@ -499,6 +567,8 @@ declare class WidgetQuiz extends WidgetBase<WidgetQuizOptions> {
499
567
  onRefreshUserData: typeof WidgetBase.onRefreshUserData;
500
568
  init: (element: HTMLElement, localData?: Record<string, any>) => void;
501
569
  initWidget: (element: HTMLElement, localData?: Record<string, any>) => void;
570
+ onStart: (element: HTMLElement) => void;
571
+ onStop: (element: HTMLElement) => void;
502
572
  select: (element: HTMLElement) => boolean;
503
573
  slideQuizIsDone: (element: HTMLElement) => boolean;
504
574
  };
@@ -512,9 +582,9 @@ declare class WidgetQuizGrouped extends WidgetBase<WidgetQuizGroupedOptions> {
512
582
  localData: {};
513
583
  };
514
584
  static widgetClassName: string;
515
- private question;
516
- private answers;
517
- private questionCount;
585
+ private readonly question;
586
+ private readonly answers;
587
+ private readonly questionCount;
518
588
  private selectedAnswer;
519
589
  /**
520
590
  * @throws Error
@@ -522,6 +592,10 @@ declare class WidgetQuizGrouped extends WidgetBase<WidgetQuizGroupedOptions> {
522
592
  * @param options
523
593
  */
524
594
  constructor(element: HTMLElement, options: Partial<WidgetQuizGroupedOptions>);
595
+ /**
596
+ * Start or restart widget
597
+ * @param localData
598
+ */
525
599
  onRefreshUserData(localData: Record<string, any>): void;
526
600
  private _selectAnswer;
527
601
  private _clearAnswerSelection;
@@ -535,6 +609,8 @@ declare class WidgetQuizGrouped extends WidgetBase<WidgetQuizGroupedOptions> {
535
609
  onRefreshUserData: typeof WidgetBase.onRefreshUserData;
536
610
  init: (element: HTMLElement, localData?: Record<string, any>) => void;
537
611
  initWidget: (element: HTMLElement, localData?: Record<string, any>) => void;
612
+ onStart: (element: HTMLElement) => void;
613
+ onStop: (element: HTMLElement) => void;
538
614
  select: (element: HTMLElement) => boolean;
539
615
  slideQuizIsDone: (element: HTMLElement) => boolean;
540
616
  };
@@ -556,6 +632,10 @@ declare class WidgetRate extends WidgetBase<WidgetRateOptions> {
556
632
  private answerSelectDuration;
557
633
  private elementRect;
558
634
  constructor(element: HTMLElement, options: Partial<WidgetRateOptions>);
635
+ /**
636
+ * Start or restart widget
637
+ * @param localData
638
+ */
559
639
  onRefreshUserData(localData: Record<string, any>): void;
560
640
  private _statEventRateUsAnswer;
561
641
  private _selectStar;
@@ -571,6 +651,8 @@ declare class WidgetRate extends WidgetBase<WidgetRateOptions> {
571
651
  onRefreshUserData: typeof WidgetBase.onRefreshUserData;
572
652
  init: (element: HTMLElement, localData?: Record<string, any>) => void;
573
653
  initWidget: (nodeList: Iterable<HTMLElement>, localData?: Record<string, any>) => void;
654
+ onStart: (element: HTMLElement) => void;
655
+ onStop: (element: HTMLElement) => void;
574
656
  select: (element: HTMLElement) => boolean;
575
657
  slidePollIsDone: (element: HTMLElement) => boolean;
576
658
  setUserData: (id: string, text: string) => void;
@@ -582,12 +664,16 @@ type WidgetShareOptions = WidgetOptionsBase & {
582
664
  declare class WidgetShare extends WidgetBase<WidgetShareOptions> {
583
665
  static DEFAULTS: WidgetShareOptions;
584
666
  static widgetClassName: string;
585
- private layers;
586
- private shareType;
587
- private shareTarget;
588
- private withLayer;
667
+ private readonly layers;
668
+ private readonly shareType;
669
+ private readonly shareTarget;
670
+ private readonly withLayer;
589
671
  private btnDisabled;
590
672
  constructor(element: HTMLElement, options: Partial<WidgetShareOptions>);
673
+ /**
674
+ * Start or restart widget
675
+ * @param localData
676
+ */
591
677
  onRefreshUserData(localData: Record<string, any>): void;
592
678
  private _statEventShare;
593
679
  private share;
@@ -599,6 +685,8 @@ declare class WidgetShare extends WidgetBase<WidgetShareOptions> {
599
685
  onRefreshUserData: typeof WidgetBase.onRefreshUserData;
600
686
  init: (element: HTMLElement, layers: Array<HTMLElement>, localData?: Record<string, any>) => void;
601
687
  initWidget: (nodeList: Iterable<HTMLElement>, layers: Array<HTMLElement>, localData?: Record<string, any>) => void;
688
+ onStart: (element: HTMLElement) => void;
689
+ onStop: (element: HTMLElement) => void;
602
690
  click: (element: HTMLElement) => void;
603
691
  complete: (id: string, isSuccess: boolean) => void;
604
692
  };
@@ -608,20 +696,26 @@ declare class WidgetTest extends WidgetBase<WidgetTestOptions> {
608
696
  static DEFAULTS: WidgetTestOptions;
609
697
  static widgetClassName: string;
610
698
  private label;
611
- private variants;
612
- private testCount;
699
+ private readonly variants;
700
+ private readonly testCount;
613
701
  private selectedAnswer;
614
- private withTimeToAnswer;
615
- private answerTimeout;
616
- private tick;
617
- private cancelTick;
702
+ private readonly withTimeToAnswer;
703
+ private readonly answerTimeout;
704
+ private readonly tick;
705
+ private readonly cancelTick;
618
706
  private animationFrameId;
619
707
  private startTimerAt;
620
708
  private timeLeft;
621
709
  private timeLeftDefault;
622
710
  private timeline;
623
711
  constructor(element: HTMLElement, options: Partial<WidgetTestOptions>);
712
+ /**
713
+ * Start or restart widget
714
+ * @param localData
715
+ */
624
716
  onRefreshUserData(localData: Record<string, any>): void;
717
+ onStart(): void;
718
+ onStop(): void;
625
719
  private _statEventVoteAnswer;
626
720
  private _selectAnswer;
627
721
  selectAnswer(answer: HTMLElement): boolean;
@@ -637,6 +731,8 @@ declare class WidgetTest extends WidgetBase<WidgetTestOptions> {
637
731
  onRefreshUserData: typeof WidgetBase.onRefreshUserData;
638
732
  init: (element: HTMLElement, localData?: Record<string, any>) => void;
639
733
  initWidget: (element: HTMLElement, localData?: Record<string, any>) => void;
734
+ onStart: (element: HTMLElement) => void;
735
+ onStop: (element: HTMLElement) => void;
640
736
  select: (element: HTMLElement) => boolean;
641
737
  slideTestIsDone: (element: HTMLElement) => boolean;
642
738
  slideTestWithTimer: (element: HTMLElement) => boolean;
@@ -749,8 +845,19 @@ declare class WidgetBase<WidgetOptions extends WidgetOptionsBase> {
749
845
  protected localData: Record<string, any>;
750
846
  protected firstOpenTime: number;
751
847
  protected id: string;
848
+ startReadyPromise: Promise<void>;
849
+ private startReadyResolve;
752
850
  constructor(element: HTMLElement, options: Partial<WidgetOptions>, elementIdGetter?: (element: HTMLElement) => string, slideGetter?: (element: HTMLElement) => HTMLElement);
851
+ private resetStartReadyPromise;
852
+ /**
853
+ * Start or restart widget
854
+ * @param localData
855
+ */
753
856
  onRefreshUserData(localData: Record<string, any>): void;
857
+ onStart(): void;
858
+ onStop(): void;
859
+ onPause(): void;
860
+ onResume(): void;
754
861
  static widgetCacheKey: string;
755
862
  static widgetClassName: string;
756
863
  static getInstance<Widget extends WidgetBase<WidgetOptions>, WidgetOptions extends WidgetOptionsBase>(element: HTMLElement): Widget | undefined;
@@ -771,7 +878,7 @@ declare class WidgetBase<WidgetOptions extends WidgetOptionsBase> {
771
878
  static sendStatisticEventToApp(name: string, data: Record<string, string | number | Array<string | number>>, devPayload?: Record<string, string | number | Array<string | number>>): void;
772
879
  sendStatisticEventToApp(name: string, data: Record<string, string | number | Array<string | number>>, devPayload?: Record<string, string | number | Array<string | number>>): void;
773
880
  startDisabledTimeline(): void;
774
- protected _showLayout(layers: Array<HTMLElement>, selectIndex: number, withStatEvent?: boolean): void;
881
+ protected _showLayer(layers: Array<HTMLElement>, selectIndex: number, withStatEvent?: boolean): void;
775
882
  protected _statEventLayoutShow(layoutIndex: number): void;
776
883
  /** @deprecated */
777
884
  static refreshUserData<Widget extends WidgetBase<WidgetOptions>, WidgetOptions extends WidgetOptionsBase>(nodes: NodeListOf<HTMLElement>, localData?: Record<string, any>): void;