@inappstory/slide-api 0.0.22 → 0.0.24

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
@@ -493,6 +493,90 @@ declare class WidgetPollLayers extends WidgetBase<WidgetPollLayersOptions> {
493
493
  select: (element: HTMLElement) => boolean;
494
494
  };
495
495
  }
496
+ type WidgetProductsOptions = WidgetOptionsBase;
497
+ type OfferModel = {
498
+ id: number;
499
+ offerId: string;
500
+ name?: string;
501
+ description?: string;
502
+ price?: string;
503
+ oldPrice?: string;
504
+ currency?: string;
505
+ availability: number; // * 0 - OUT_OF_STOCK * 1 - IN_STOCK * 2 - PREORDER * 3 - BACKORDER
506
+ adult?: boolean;
507
+ coverUrl?: string;
508
+ url?: string;
509
+ };
510
+ /**
511
+ * adult: null
512
+ * availability: 1
513
+ * coverUrl: "https://cdn.test.inappstory.com/np/file/cf/wb/wc/vcaji5clqon3nkwdwle3cjz63x.jpg?k=KgAAAAAAAAACAQ"
514
+ * currency: "RUR"
515
+ * description: "Непромокаемый комбинезон - дождевик детский Муссон"
516
+ * id: 204
517
+ * name: "Непромокаемый комбинезон - дождевик детский \"Муссон\""
518
+ * offerId: "10125"
519
+ * oldPrice: null
520
+ * price: "2690.0000"
521
+ * url: "http://www.songnomik.ru/products/detskaya-odezhda-optom-dlya-novorozhdennyh/detskie-kombinezony-optom/2166483.html"
522
+ */
523
+ declare class WidgetProducts extends WidgetBase<WidgetProductsOptions> {
524
+ static DEFAULTS: WidgetProductsOptions;
525
+ static widgetClassName: string;
526
+ private readonly captionView;
527
+ private readonly linkTarget;
528
+ private readonly msgNetworkError;
529
+ private readonly msgServiceError;
530
+ private swipeGestureDetector;
531
+ private isClickCapturedByWidget;
532
+ private readonly isScreenSupportsTouch;
533
+ constructor(element: HTMLElement, options: Partial<WidgetProductsOptions>);
534
+ /**
535
+ * Start or restart widget
536
+ * @param localData
537
+ */
538
+ onRefreshUserData(localData: Record<string, any>): void;
539
+ onStart(): void;
540
+ private isTransparentElement;
541
+ private _statEventWidgetClick;
542
+ private _statEventWidgetOpen;
543
+ private _statEventWidgetCardClick;
544
+ fetchProducts(): Promise<{
545
+ message: string;
546
+ models: Array<OfferModel>;
547
+ }>;
548
+ private cacheOffersMediaResources;
549
+ private revokeOffersMediaResources;
550
+ private initSwipeGestureDetector;
551
+ private productsView;
552
+ private isOpen;
553
+ get isForcePaused(): boolean;
554
+ private currentModels;
555
+ openProductsView(): Promise<void>;
556
+ closeProductsView(): void;
557
+ private createCardView;
558
+ private createScrollView;
559
+ private createProductsView;
560
+ private scrollViewRef;
561
+ private getScrollLeft;
562
+ private getScrollViewportWidth;
563
+ private setScrollLeft;
564
+ private createScrollControls;
565
+ getIsClickCapturedByWidget(): boolean;
566
+ private destroy;
567
+ onStop(): void;
568
+ static api: {
569
+ widgetClassName: string;
570
+ onRefreshUserData: typeof WidgetBase.onRefreshUserData;
571
+ init: (element: HTMLElement, localData?: Record<string, any>) => void;
572
+ onStart: (element: HTMLElement) => void;
573
+ onStop: (element: HTMLElement) => void;
574
+ click: (element: HTMLElement) => boolean;
575
+ isClickCapturedByWidget: (element: HTMLElement) => boolean;
576
+ isForcePaused: (element: HTMLElement) => boolean;
577
+ onHandleBackpress: (element: HTMLElement) => boolean;
578
+ };
579
+ }
496
580
  type WidgetQuestOptions = WidgetOptionsBase;
497
581
  declare class WidgetQuest extends WidgetBase<WidgetQuestOptions> {
498
582
  static DEFAULTS: WidgetQuestOptions;
@@ -503,6 +587,7 @@ declare class WidgetQuest extends WidgetBase<WidgetQuestOptions> {
503
587
  private readonly isWidget;
504
588
  private readonly slideCount;
505
589
  private readonly nonFinalSlide;
590
+ private readonly slideDisabledNavigation;
506
591
  private readonly finalSlide;
507
592
  constructor(element: HTMLElement, options: Partial<WidgetQuestOptions>);
508
593
  /**
@@ -756,7 +841,7 @@ interface SDKApi {
756
841
  getCardServerData(cardId: number): Record<string, any> | null;
757
842
  getSlideDuration(cardId: number, slideIndex: number): number | null;
758
843
  showNextSlide(duration: number): void;
759
- sendStatisticEvent(name: string, data: Record<string, string | number | Array<string | number>>, devPayload?: Record<string, string | number | Array<string | number>>): void;
844
+ sendStatisticEvent(name: string, data: Record<string, string | number | Array<string | number>>, devPayload?: Record<string, string | number | Array<string | number>>, forceEnableStatisticV2?: boolean): void;
760
845
  getCardLocalData(): Promise<Record<string, any>>;
761
846
  isExistsShowLayer(): boolean;
762
847
  showLayer(index: number): void;
@@ -801,6 +886,10 @@ interface SDKApi {
801
886
  cardResumedCallback(currentTime: number | null): void;
802
887
  startDisabledTimeline(cardId: number, slideIndex: number): void;
803
888
  getCardFonts(): Array<FontDTO>;
889
+ disableVerticalSwipeGesture(): void;
890
+ enableVerticalSwipeGesture(): void;
891
+ disableBackpress(): void;
892
+ enableBackpress(): void;
804
893
  }
805
894
  declare class WidgetsService {
806
895
  private _env;
@@ -875,8 +964,12 @@ declare class WidgetBase<WidgetOptions extends WidgetOptionsBase> {
875
964
  static getStatisticEventBaseFieldsShortForm(cardId: number, slideIndex: number): StatisticEventBaseFieldsShortForm;
876
965
  get statisticEventBaseFieldsFullForm(): StatisticEventBaseFieldsFullForm;
877
966
  static getStatisticEventBaseFieldsFullForm(cardId: number, cardType: CARD_TYPE, slideIndex: number): StatisticEventBaseFieldsFullForm;
878
- static sendStatisticEventToApp(name: string, data: Record<string, string | number | Array<string | number>>, devPayload?: Record<string, string | number | Array<string | number>>): void;
879
- sendStatisticEventToApp(name: string, data: Record<string, string | number | Array<string | number>>, devPayload?: Record<string, string | number | Array<string | number>>): void;
967
+ static sendStatisticEventToApp(name: string, data: Record<string, string | number | Array<string | number>>, devPayload?: Record<string, string | number | Array<string | number>>, options?: {
968
+ forceEnableStatisticV2?: boolean;
969
+ }): void;
970
+ sendStatisticEventToApp(name: string, data: Record<string, string | number | Array<string | number>>, devPayload?: Record<string, string | number | Array<string | number>>, options?: {
971
+ forceEnableStatisticV2?: boolean;
972
+ }): void;
880
973
  startDisabledTimeline(): void;
881
974
  protected _showLayer(layers: Array<HTMLElement>, selectIndex: number, withStatEvent?: boolean): void;
882
975
  protected _statEventLayoutShow(layoutIndex: number): void;
@@ -914,7 +1007,7 @@ interface SDKInterface {
914
1007
  /**
915
1008
  * From native sdk, do`t implement in web|react-sdk
916
1009
  */
917
- sendStatisticEvent(name: string, data: Record<string, string | number | Array<string | number>>, devPayload?: Record<string, string | number | Array<string | number>>): void;
1010
+ sendStatisticEvent(name: string, data: Record<string, string | number | Array<string | number>>, devPayload?: Record<string, string | number | Array<string | number>>, forceEnableStatisticV2?: boolean): void;
918
1011
  getCardLocalData(): Promise<Record<string, any>>;
919
1012
  setCardLocalData(keyValue: Record<string, any>, sendToServer: boolean): void;
920
1013
  showLayer(index: number): void;
@@ -1018,6 +1111,14 @@ interface SDKInterface {
1018
1111
  * @param text
1019
1112
  */
1020
1113
  showToast(text: string): void;
1114
+ /**
1115
+ * Stop react on any detected vertical swipe gesture
1116
+ */
1117
+ disableVerticalSwipeGesture(): void;
1118
+ /**
1119
+ * Continue to react on any vertical swipe gesture
1120
+ */
1121
+ enableVerticalSwipeGesture(): void;
1021
1122
  }
1022
1123
  type WidgetCopyApi = typeof WidgetCopy.api;
1023
1124
  type WidgetDataInputApi = typeof WidgetDataInput.api;
@@ -1034,6 +1135,7 @@ type WidgetShareApi = typeof WidgetShare.api;
1034
1135
  type WidgetTestApi = typeof WidgetTest.api;
1035
1136
  type WidgetVoteApi = typeof WidgetVote.api;
1036
1137
  type WidgetBarcodeApi = typeof WidgetBarcode.api;
1138
+ type WidgetProductsApi = typeof WidgetProducts.api;
1037
1139
  type SlideApi = {
1038
1140
  Animation: IAnimation;
1039
1141
  WidgetCopy: WidgetCopyApi;
@@ -1051,7 +1153,8 @@ type SlideApi = {
1051
1153
  WidgetTest: WidgetTestApi;
1052
1154
  WidgetVote: WidgetVoteApi;
1053
1155
  WidgetBarcode: WidgetBarcodeApi;
1156
+ WidgetProducts: WidgetProductsApi;
1054
1157
  };
1055
1158
  declare const getSlideApi: (_sdkInterface: SDKInterface) => SlideApi;
1056
1159
  export { getSlideApi, Widgets };
1057
- export type { SDKInterface, SlideApi, WidgetCopyApi, WidgetDataInputApi, WidgetDateCountdownApi, WidgetMultiSlideApi, WidgetPollApi, WidgetPollLayersApi, WidgetQuestApi, WidgetQuizApi, WidgetQuizGroupedApi, WidgetRangeSliderApi, WidgetRateApi, WidgetShareApi, WidgetTestApi, WidgetVoteApi, WidgetBarcodeApi, IAnimation, WidgetsSharedDataMap, WidgetRangeSliderSharedData, WidgetPollSharedData, WidgetVoteSharedData, FontDTO };
1160
+ export type { SDKInterface, SlideApi, WidgetCopyApi, WidgetDataInputApi, WidgetDateCountdownApi, WidgetMultiSlideApi, WidgetPollApi, WidgetPollLayersApi, WidgetQuestApi, WidgetQuizApi, WidgetQuizGroupedApi, WidgetRangeSliderApi, WidgetRateApi, WidgetShareApi, WidgetTestApi, WidgetVoteApi, WidgetBarcodeApi, WidgetProductsApi, IAnimation, WidgetsSharedDataMap, WidgetRangeSliderSharedData, WidgetPollSharedData, WidgetVoteSharedData, FontDTO };
package/dist/index.d.ts CHANGED
@@ -493,6 +493,90 @@ declare class WidgetPollLayers extends WidgetBase<WidgetPollLayersOptions> {
493
493
  select: (element: HTMLElement) => boolean;
494
494
  };
495
495
  }
496
+ type WidgetProductsOptions = WidgetOptionsBase;
497
+ type OfferModel = {
498
+ id: number;
499
+ offerId: string;
500
+ name?: string;
501
+ description?: string;
502
+ price?: string;
503
+ oldPrice?: string;
504
+ currency?: string;
505
+ availability: number; // * 0 - OUT_OF_STOCK * 1 - IN_STOCK * 2 - PREORDER * 3 - BACKORDER
506
+ adult?: boolean;
507
+ coverUrl?: string;
508
+ url?: string;
509
+ };
510
+ /**
511
+ * adult: null
512
+ * availability: 1
513
+ * coverUrl: "https://cdn.test.inappstory.com/np/file/cf/wb/wc/vcaji5clqon3nkwdwle3cjz63x.jpg?k=KgAAAAAAAAACAQ"
514
+ * currency: "RUR"
515
+ * description: "Непромокаемый комбинезон - дождевик детский Муссон"
516
+ * id: 204
517
+ * name: "Непромокаемый комбинезон - дождевик детский \"Муссон\""
518
+ * offerId: "10125"
519
+ * oldPrice: null
520
+ * price: "2690.0000"
521
+ * url: "http://www.songnomik.ru/products/detskaya-odezhda-optom-dlya-novorozhdennyh/detskie-kombinezony-optom/2166483.html"
522
+ */
523
+ declare class WidgetProducts extends WidgetBase<WidgetProductsOptions> {
524
+ static DEFAULTS: WidgetProductsOptions;
525
+ static widgetClassName: string;
526
+ private readonly captionView;
527
+ private readonly linkTarget;
528
+ private readonly msgNetworkError;
529
+ private readonly msgServiceError;
530
+ private swipeGestureDetector;
531
+ private isClickCapturedByWidget;
532
+ private readonly isScreenSupportsTouch;
533
+ constructor(element: HTMLElement, options: Partial<WidgetProductsOptions>);
534
+ /**
535
+ * Start or restart widget
536
+ * @param localData
537
+ */
538
+ onRefreshUserData(localData: Record<string, any>): void;
539
+ onStart(): void;
540
+ private isTransparentElement;
541
+ private _statEventWidgetClick;
542
+ private _statEventWidgetOpen;
543
+ private _statEventWidgetCardClick;
544
+ fetchProducts(): Promise<{
545
+ message: string;
546
+ models: Array<OfferModel>;
547
+ }>;
548
+ private cacheOffersMediaResources;
549
+ private revokeOffersMediaResources;
550
+ private initSwipeGestureDetector;
551
+ private productsView;
552
+ private isOpen;
553
+ get isForcePaused(): boolean;
554
+ private currentModels;
555
+ openProductsView(): Promise<void>;
556
+ closeProductsView(): void;
557
+ private createCardView;
558
+ private createScrollView;
559
+ private createProductsView;
560
+ private scrollViewRef;
561
+ private getScrollLeft;
562
+ private getScrollViewportWidth;
563
+ private setScrollLeft;
564
+ private createScrollControls;
565
+ getIsClickCapturedByWidget(): boolean;
566
+ private destroy;
567
+ onStop(): void;
568
+ static api: {
569
+ widgetClassName: string;
570
+ onRefreshUserData: typeof WidgetBase.onRefreshUserData;
571
+ init: (element: HTMLElement, localData?: Record<string, any>) => void;
572
+ onStart: (element: HTMLElement) => void;
573
+ onStop: (element: HTMLElement) => void;
574
+ click: (element: HTMLElement) => boolean;
575
+ isClickCapturedByWidget: (element: HTMLElement) => boolean;
576
+ isForcePaused: (element: HTMLElement) => boolean;
577
+ onHandleBackpress: (element: HTMLElement) => boolean;
578
+ };
579
+ }
496
580
  type WidgetQuestOptions = WidgetOptionsBase;
497
581
  declare class WidgetQuest extends WidgetBase<WidgetQuestOptions> {
498
582
  static DEFAULTS: WidgetQuestOptions;
@@ -503,6 +587,7 @@ declare class WidgetQuest extends WidgetBase<WidgetQuestOptions> {
503
587
  private readonly isWidget;
504
588
  private readonly slideCount;
505
589
  private readonly nonFinalSlide;
590
+ private readonly slideDisabledNavigation;
506
591
  private readonly finalSlide;
507
592
  constructor(element: HTMLElement, options: Partial<WidgetQuestOptions>);
508
593
  /**
@@ -756,7 +841,7 @@ interface SDKApi {
756
841
  getCardServerData(cardId: number): Record<string, any> | null;
757
842
  getSlideDuration(cardId: number, slideIndex: number): number | null;
758
843
  showNextSlide(duration: number): void;
759
- sendStatisticEvent(name: string, data: Record<string, string | number | Array<string | number>>, devPayload?: Record<string, string | number | Array<string | number>>): void;
844
+ sendStatisticEvent(name: string, data: Record<string, string | number | Array<string | number>>, devPayload?: Record<string, string | number | Array<string | number>>, forceEnableStatisticV2?: boolean): void;
760
845
  getCardLocalData(): Promise<Record<string, any>>;
761
846
  isExistsShowLayer(): boolean;
762
847
  showLayer(index: number): void;
@@ -801,6 +886,10 @@ interface SDKApi {
801
886
  cardResumedCallback(currentTime: number | null): void;
802
887
  startDisabledTimeline(cardId: number, slideIndex: number): void;
803
888
  getCardFonts(): Array<FontDTO>;
889
+ disableVerticalSwipeGesture(): void;
890
+ enableVerticalSwipeGesture(): void;
891
+ disableBackpress(): void;
892
+ enableBackpress(): void;
804
893
  }
805
894
  declare class WidgetsService {
806
895
  private _env;
@@ -875,8 +964,12 @@ declare class WidgetBase<WidgetOptions extends WidgetOptionsBase> {
875
964
  static getStatisticEventBaseFieldsShortForm(cardId: number, slideIndex: number): StatisticEventBaseFieldsShortForm;
876
965
  get statisticEventBaseFieldsFullForm(): StatisticEventBaseFieldsFullForm;
877
966
  static getStatisticEventBaseFieldsFullForm(cardId: number, cardType: CARD_TYPE, slideIndex: number): StatisticEventBaseFieldsFullForm;
878
- static sendStatisticEventToApp(name: string, data: Record<string, string | number | Array<string | number>>, devPayload?: Record<string, string | number | Array<string | number>>): void;
879
- sendStatisticEventToApp(name: string, data: Record<string, string | number | Array<string | number>>, devPayload?: Record<string, string | number | Array<string | number>>): void;
967
+ static sendStatisticEventToApp(name: string, data: Record<string, string | number | Array<string | number>>, devPayload?: Record<string, string | number | Array<string | number>>, options?: {
968
+ forceEnableStatisticV2?: boolean;
969
+ }): void;
970
+ sendStatisticEventToApp(name: string, data: Record<string, string | number | Array<string | number>>, devPayload?: Record<string, string | number | Array<string | number>>, options?: {
971
+ forceEnableStatisticV2?: boolean;
972
+ }): void;
880
973
  startDisabledTimeline(): void;
881
974
  protected _showLayer(layers: Array<HTMLElement>, selectIndex: number, withStatEvent?: boolean): void;
882
975
  protected _statEventLayoutShow(layoutIndex: number): void;
@@ -914,7 +1007,7 @@ interface SDKInterface {
914
1007
  /**
915
1008
  * From native sdk, do`t implement in web|react-sdk
916
1009
  */
917
- sendStatisticEvent(name: string, data: Record<string, string | number | Array<string | number>>, devPayload?: Record<string, string | number | Array<string | number>>): void;
1010
+ sendStatisticEvent(name: string, data: Record<string, string | number | Array<string | number>>, devPayload?: Record<string, string | number | Array<string | number>>, forceEnableStatisticV2?: boolean): void;
918
1011
  getCardLocalData(): Promise<Record<string, any>>;
919
1012
  setCardLocalData(keyValue: Record<string, any>, sendToServer: boolean): void;
920
1013
  showLayer(index: number): void;
@@ -1018,6 +1111,14 @@ interface SDKInterface {
1018
1111
  * @param text
1019
1112
  */
1020
1113
  showToast(text: string): void;
1114
+ /**
1115
+ * Stop react on any detected vertical swipe gesture
1116
+ */
1117
+ disableVerticalSwipeGesture(): void;
1118
+ /**
1119
+ * Continue to react on any vertical swipe gesture
1120
+ */
1121
+ enableVerticalSwipeGesture(): void;
1021
1122
  }
1022
1123
  type WidgetCopyApi = typeof WidgetCopy.api;
1023
1124
  type WidgetDataInputApi = typeof WidgetDataInput.api;
@@ -1034,6 +1135,7 @@ type WidgetShareApi = typeof WidgetShare.api;
1034
1135
  type WidgetTestApi = typeof WidgetTest.api;
1035
1136
  type WidgetVoteApi = typeof WidgetVote.api;
1036
1137
  type WidgetBarcodeApi = typeof WidgetBarcode.api;
1138
+ type WidgetProductsApi = typeof WidgetProducts.api;
1037
1139
  type SlideApi = {
1038
1140
  Animation: IAnimation;
1039
1141
  WidgetCopy: WidgetCopyApi;
@@ -1051,7 +1153,8 @@ type SlideApi = {
1051
1153
  WidgetTest: WidgetTestApi;
1052
1154
  WidgetVote: WidgetVoteApi;
1053
1155
  WidgetBarcode: WidgetBarcodeApi;
1156
+ WidgetProducts: WidgetProductsApi;
1054
1157
  };
1055
1158
  declare const getSlideApi: (_sdkInterface: SDKInterface) => SlideApi;
1056
1159
  export { getSlideApi, Widgets };
1057
- export type { SDKInterface, SlideApi, WidgetCopyApi, WidgetDataInputApi, WidgetDateCountdownApi, WidgetMultiSlideApi, WidgetPollApi, WidgetPollLayersApi, WidgetQuestApi, WidgetQuizApi, WidgetQuizGroupedApi, WidgetRangeSliderApi, WidgetRateApi, WidgetShareApi, WidgetTestApi, WidgetVoteApi, WidgetBarcodeApi, IAnimation, WidgetsSharedDataMap, WidgetRangeSliderSharedData, WidgetPollSharedData, WidgetVoteSharedData, FontDTO };
1160
+ export type { SDKInterface, SlideApi, WidgetCopyApi, WidgetDataInputApi, WidgetDateCountdownApi, WidgetMultiSlideApi, WidgetPollApi, WidgetPollLayersApi, WidgetQuestApi, WidgetQuizApi, WidgetQuizGroupedApi, WidgetRangeSliderApi, WidgetRateApi, WidgetShareApi, WidgetTestApi, WidgetVoteApi, WidgetBarcodeApi, WidgetProductsApi, IAnimation, WidgetsSharedDataMap, WidgetRangeSliderSharedData, WidgetPollSharedData, WidgetVoteSharedData, FontDTO };