@inappstory/slide-api 0.1.28 → 0.1.30

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
@@ -54,7 +54,14 @@ type ProductCart = {
54
54
  priceCurrency: string;
55
55
  };
56
56
 
57
+ type AnimationDescriptor = {
58
+ cb: () => void;
59
+ timerId?: number;
60
+ timeout: number;
61
+ needResume?: boolean;
62
+ };
57
63
  interface IAnimation {
64
+ animations: AnimationDescriptor[];
58
65
  init(slide: HTMLElement, animate?: boolean): void;
59
66
  start(slide: HTMLElement, animate?: boolean): void | ((isStop: boolean) => () => void);
60
67
  stop(slide: HTMLElement, animate?: boolean): void;
@@ -70,6 +77,54 @@ declare const enum TIMELINE_ACTION {
70
77
  BEFORE_START = "before_start"
71
78
  }
72
79
 
80
+ type WidgetTimerOptions = WidgetOptionsBase & {
81
+ layers: Array<HTMLElement>;
82
+ };
83
+
84
+ declare class WidgetTimer extends WidgetBase<WidgetTimerOptions> {
85
+ static DEFAULTS: WidgetTimerOptions;
86
+ static widgetClassName: string;
87
+ private model;
88
+ private endTimeMs;
89
+ private timerRenderer;
90
+ private timerGroup;
91
+ private timerInit;
92
+ private rafId;
93
+ private effects;
94
+ private abortController;
95
+ private readonly layers;
96
+ constructor(element: HTMLElement, options: Partial<WidgetTimerOptions>, widgetCallbacks: WidgetCallbacks, widgetDeps: WidgetDeps);
97
+ isDone(): boolean;
98
+ private fillEffects;
99
+ private mountTimerGroup;
100
+ private createTimerModel;
101
+ private setTimerEndTime;
102
+ onStart(): void;
103
+ onStop(): void;
104
+ onPause(): void;
105
+ onResume(): void;
106
+ onRefreshUserData(localData: Record<string, any>): void;
107
+ private reset;
108
+ private update;
109
+ private complete;
110
+ private getCurrentTime;
111
+ private updateEffects;
112
+ private resetEffects;
113
+ private hideElement;
114
+ private showElement;
115
+ private doCompletitionAction;
116
+ private getMaxCardAnimationsDelay;
117
+ private waitCardAnimationsEnd;
118
+ static api: {
119
+ widgetClassName: string;
120
+ onRefreshUserData: typeof WidgetBase.onRefreshUserData;
121
+ init: (element: HTMLElement, layers: Array<HTMLElement>, localData: Record<string, any>, widgetCallbacks: WidgetCallbacks, widgetDeps: WidgetDeps) => void;
122
+ onStart: (element: HTMLElement) => void;
123
+ onStop: (element: HTMLElement) => void;
124
+ click: (element: HTMLElement) => boolean;
125
+ };
126
+ }
127
+
73
128
  type WidgetBarcodeOptions = WidgetOptionsBase;
74
129
 
75
130
  declare class WidgetBarcode extends WidgetBase<WidgetBarcodeOptions> {
@@ -716,6 +771,7 @@ declare class WidgetRate extends WidgetBase<WidgetRateOptions> {
716
771
  private readonly submitToStores;
717
772
  private readonly submitToStoresMin;
718
773
  private readonly submitToStoresMax;
774
+ private readonly hasSubmitButton;
719
775
  private readonly showDialogOnLowRate;
720
776
  private readonly showDialogueMin;
721
777
  private readonly showDialogueMax;
@@ -723,19 +779,32 @@ declare class WidgetRate extends WidgetBase<WidgetRateOptions> {
723
779
  private answerSelectDuration;
724
780
  private elementRect;
725
781
  constructor(element: HTMLElement, options: Partial<WidgetRateOptions>, widgetCallbacks: WidgetCallbacks, widgetDeps: WidgetDeps);
782
+ onStart(): void;
783
+ onStop(): void;
726
784
  /**
727
785
  * Start or restart widget
728
786
  * @param localData
729
787
  */
730
788
  onRefreshUserData(localData: Record<string, any>): void;
731
- private _statEventRateUsAnswer;
732
- private _selectStar;
733
- private _clearSelectedStar;
789
+ private sendStatistic;
790
+ private resetState;
734
791
  private selectStar;
735
- setUserText(text: string): void;
736
792
  private completeWidget;
793
+ private saveLocalData;
794
+ private markWidgetCompleted;
795
+ private saveStarSelection;
737
796
  isDone(): boolean;
738
797
  slideRateIsDone(): boolean;
798
+ private handleSubmit;
799
+ private getCompletionAction;
800
+ private submitToAppStores;
801
+ private openUserDialog;
802
+ onUserDialogComplete(userText: string): void;
803
+ private showToast;
804
+ private showSubmitButton;
805
+ private hideSubmitButton;
806
+ private fillStars;
807
+ private clearStars;
739
808
  static api: {
740
809
  widgetClassName: string;
741
810
  onRefreshUserData: typeof WidgetBase.onRefreshUserData;
@@ -956,6 +1025,7 @@ interface ILayoutApi {
956
1025
  get widgetVoteApi(): typeof WidgetVote.api | undefined;
957
1026
  get widgetProductsApi(): typeof WidgetProducts.api | undefined;
958
1027
  get widgetTooltipApi(): typeof WidgetTooltip.api | undefined;
1028
+ get widgetTimerApi(): typeof WidgetTimer.api | undefined;
959
1029
  get VideoPlayer(): typeof Player | undefined;
960
1030
  }
961
1031
 
package/dist/index.d.ts CHANGED
@@ -54,7 +54,14 @@ type ProductCart = {
54
54
  priceCurrency: string;
55
55
  };
56
56
 
57
+ type AnimationDescriptor = {
58
+ cb: () => void;
59
+ timerId?: number;
60
+ timeout: number;
61
+ needResume?: boolean;
62
+ };
57
63
  interface IAnimation {
64
+ animations: AnimationDescriptor[];
58
65
  init(slide: HTMLElement, animate?: boolean): void;
59
66
  start(slide: HTMLElement, animate?: boolean): void | ((isStop: boolean) => () => void);
60
67
  stop(slide: HTMLElement, animate?: boolean): void;
@@ -70,6 +77,54 @@ declare const enum TIMELINE_ACTION {
70
77
  BEFORE_START = "before_start"
71
78
  }
72
79
 
80
+ type WidgetTimerOptions = WidgetOptionsBase & {
81
+ layers: Array<HTMLElement>;
82
+ };
83
+
84
+ declare class WidgetTimer extends WidgetBase<WidgetTimerOptions> {
85
+ static DEFAULTS: WidgetTimerOptions;
86
+ static widgetClassName: string;
87
+ private model;
88
+ private endTimeMs;
89
+ private timerRenderer;
90
+ private timerGroup;
91
+ private timerInit;
92
+ private rafId;
93
+ private effects;
94
+ private abortController;
95
+ private readonly layers;
96
+ constructor(element: HTMLElement, options: Partial<WidgetTimerOptions>, widgetCallbacks: WidgetCallbacks, widgetDeps: WidgetDeps);
97
+ isDone(): boolean;
98
+ private fillEffects;
99
+ private mountTimerGroup;
100
+ private createTimerModel;
101
+ private setTimerEndTime;
102
+ onStart(): void;
103
+ onStop(): void;
104
+ onPause(): void;
105
+ onResume(): void;
106
+ onRefreshUserData(localData: Record<string, any>): void;
107
+ private reset;
108
+ private update;
109
+ private complete;
110
+ private getCurrentTime;
111
+ private updateEffects;
112
+ private resetEffects;
113
+ private hideElement;
114
+ private showElement;
115
+ private doCompletitionAction;
116
+ private getMaxCardAnimationsDelay;
117
+ private waitCardAnimationsEnd;
118
+ static api: {
119
+ widgetClassName: string;
120
+ onRefreshUserData: typeof WidgetBase.onRefreshUserData;
121
+ init: (element: HTMLElement, layers: Array<HTMLElement>, localData: Record<string, any>, widgetCallbacks: WidgetCallbacks, widgetDeps: WidgetDeps) => void;
122
+ onStart: (element: HTMLElement) => void;
123
+ onStop: (element: HTMLElement) => void;
124
+ click: (element: HTMLElement) => boolean;
125
+ };
126
+ }
127
+
73
128
  type WidgetBarcodeOptions = WidgetOptionsBase;
74
129
 
75
130
  declare class WidgetBarcode extends WidgetBase<WidgetBarcodeOptions> {
@@ -716,6 +771,7 @@ declare class WidgetRate extends WidgetBase<WidgetRateOptions> {
716
771
  private readonly submitToStores;
717
772
  private readonly submitToStoresMin;
718
773
  private readonly submitToStoresMax;
774
+ private readonly hasSubmitButton;
719
775
  private readonly showDialogOnLowRate;
720
776
  private readonly showDialogueMin;
721
777
  private readonly showDialogueMax;
@@ -723,19 +779,32 @@ declare class WidgetRate extends WidgetBase<WidgetRateOptions> {
723
779
  private answerSelectDuration;
724
780
  private elementRect;
725
781
  constructor(element: HTMLElement, options: Partial<WidgetRateOptions>, widgetCallbacks: WidgetCallbacks, widgetDeps: WidgetDeps);
782
+ onStart(): void;
783
+ onStop(): void;
726
784
  /**
727
785
  * Start or restart widget
728
786
  * @param localData
729
787
  */
730
788
  onRefreshUserData(localData: Record<string, any>): void;
731
- private _statEventRateUsAnswer;
732
- private _selectStar;
733
- private _clearSelectedStar;
789
+ private sendStatistic;
790
+ private resetState;
734
791
  private selectStar;
735
- setUserText(text: string): void;
736
792
  private completeWidget;
793
+ private saveLocalData;
794
+ private markWidgetCompleted;
795
+ private saveStarSelection;
737
796
  isDone(): boolean;
738
797
  slideRateIsDone(): boolean;
798
+ private handleSubmit;
799
+ private getCompletionAction;
800
+ private submitToAppStores;
801
+ private openUserDialog;
802
+ onUserDialogComplete(userText: string): void;
803
+ private showToast;
804
+ private showSubmitButton;
805
+ private hideSubmitButton;
806
+ private fillStars;
807
+ private clearStars;
739
808
  static api: {
740
809
  widgetClassName: string;
741
810
  onRefreshUserData: typeof WidgetBase.onRefreshUserData;
@@ -956,6 +1025,7 @@ interface ILayoutApi {
956
1025
  get widgetVoteApi(): typeof WidgetVote.api | undefined;
957
1026
  get widgetProductsApi(): typeof WidgetProducts.api | undefined;
958
1027
  get widgetTooltipApi(): typeof WidgetTooltip.api | undefined;
1028
+ get widgetTimerApi(): typeof WidgetTimer.api | undefined;
959
1029
  get VideoPlayer(): typeof Player | undefined;
960
1030
  }
961
1031