@inappstory/slide-api 0.0.22 → 0.0.23

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,83 @@ 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
+ private currentModels;
554
+ openProductsView(): Promise<void>;
555
+ closeProductsView(): void;
556
+ private createCardView;
557
+ private createScrollView;
558
+ private createProductsView;
559
+ getIsClickCapturedByWidget(): boolean;
560
+ private destroy;
561
+ onStop(): void;
562
+ static api: {
563
+ widgetClassName: string;
564
+ onRefreshUserData: typeof WidgetBase.onRefreshUserData;
565
+ init: (element: HTMLElement, localData?: Record<string, any>) => void;
566
+ onStart: (element: HTMLElement) => void;
567
+ onStop: (element: HTMLElement) => void;
568
+ click: (element: HTMLElement) => boolean;
569
+ isClickCapturedByWidget: (element: HTMLElement) => boolean;
570
+ onHandleBackpress: (element: HTMLElement) => boolean;
571
+ };
572
+ }
496
573
  type WidgetQuestOptions = WidgetOptionsBase;
497
574
  declare class WidgetQuest extends WidgetBase<WidgetQuestOptions> {
498
575
  static DEFAULTS: WidgetQuestOptions;
@@ -503,6 +580,7 @@ declare class WidgetQuest extends WidgetBase<WidgetQuestOptions> {
503
580
  private readonly isWidget;
504
581
  private readonly slideCount;
505
582
  private readonly nonFinalSlide;
583
+ private readonly slideDisabledNavigation;
506
584
  private readonly finalSlide;
507
585
  constructor(element: HTMLElement, options: Partial<WidgetQuestOptions>);
508
586
  /**
@@ -756,7 +834,7 @@ interface SDKApi {
756
834
  getCardServerData(cardId: number): Record<string, any> | null;
757
835
  getSlideDuration(cardId: number, slideIndex: number): number | null;
758
836
  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;
837
+ sendStatisticEvent(name: string, data: Record<string, string | number | Array<string | number>>, devPayload?: Record<string, string | number | Array<string | number>>, forceEnableStatisticV2?: boolean): void;
760
838
  getCardLocalData(): Promise<Record<string, any>>;
761
839
  isExistsShowLayer(): boolean;
762
840
  showLayer(index: number): void;
@@ -801,6 +879,10 @@ interface SDKApi {
801
879
  cardResumedCallback(currentTime: number | null): void;
802
880
  startDisabledTimeline(cardId: number, slideIndex: number): void;
803
881
  getCardFonts(): Array<FontDTO>;
882
+ disableVerticalSwipeGesture(): void;
883
+ enableVerticalSwipeGesture(): void;
884
+ disableBackpress(): void;
885
+ enableBackpress(): void;
804
886
  }
805
887
  declare class WidgetsService {
806
888
  private _env;
@@ -875,8 +957,12 @@ declare class WidgetBase<WidgetOptions extends WidgetOptionsBase> {
875
957
  static getStatisticEventBaseFieldsShortForm(cardId: number, slideIndex: number): StatisticEventBaseFieldsShortForm;
876
958
  get statisticEventBaseFieldsFullForm(): StatisticEventBaseFieldsFullForm;
877
959
  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;
960
+ static sendStatisticEventToApp(name: string, data: Record<string, string | number | Array<string | number>>, devPayload?: Record<string, string | number | Array<string | number>>, options?: {
961
+ forceEnableStatisticV2?: boolean;
962
+ }): void;
963
+ sendStatisticEventToApp(name: string, data: Record<string, string | number | Array<string | number>>, devPayload?: Record<string, string | number | Array<string | number>>, options?: {
964
+ forceEnableStatisticV2?: boolean;
965
+ }): void;
880
966
  startDisabledTimeline(): void;
881
967
  protected _showLayer(layers: Array<HTMLElement>, selectIndex: number, withStatEvent?: boolean): void;
882
968
  protected _statEventLayoutShow(layoutIndex: number): void;
@@ -914,7 +1000,7 @@ interface SDKInterface {
914
1000
  /**
915
1001
  * From native sdk, do`t implement in web|react-sdk
916
1002
  */
917
- sendStatisticEvent(name: string, data: Record<string, string | number | Array<string | number>>, devPayload?: Record<string, string | number | Array<string | number>>): void;
1003
+ sendStatisticEvent(name: string, data: Record<string, string | number | Array<string | number>>, devPayload?: Record<string, string | number | Array<string | number>>, forceEnableStatisticV2?: boolean): void;
918
1004
  getCardLocalData(): Promise<Record<string, any>>;
919
1005
  setCardLocalData(keyValue: Record<string, any>, sendToServer: boolean): void;
920
1006
  showLayer(index: number): void;
@@ -1018,6 +1104,14 @@ interface SDKInterface {
1018
1104
  * @param text
1019
1105
  */
1020
1106
  showToast(text: string): void;
1107
+ /**
1108
+ * Stop react on any detected vertical swipe gesture
1109
+ */
1110
+ disableVerticalSwipeGesture(): void;
1111
+ /**
1112
+ * Continue to react on any vertical swipe gesture
1113
+ */
1114
+ enableVerticalSwipeGesture(): void;
1021
1115
  }
1022
1116
  type WidgetCopyApi = typeof WidgetCopy.api;
1023
1117
  type WidgetDataInputApi = typeof WidgetDataInput.api;
@@ -1034,6 +1128,7 @@ type WidgetShareApi = typeof WidgetShare.api;
1034
1128
  type WidgetTestApi = typeof WidgetTest.api;
1035
1129
  type WidgetVoteApi = typeof WidgetVote.api;
1036
1130
  type WidgetBarcodeApi = typeof WidgetBarcode.api;
1131
+ type WidgetProductsApi = typeof WidgetProducts.api;
1037
1132
  type SlideApi = {
1038
1133
  Animation: IAnimation;
1039
1134
  WidgetCopy: WidgetCopyApi;
@@ -1051,7 +1146,8 @@ type SlideApi = {
1051
1146
  WidgetTest: WidgetTestApi;
1052
1147
  WidgetVote: WidgetVoteApi;
1053
1148
  WidgetBarcode: WidgetBarcodeApi;
1149
+ WidgetProducts: WidgetProductsApi;
1054
1150
  };
1055
1151
  declare const getSlideApi: (_sdkInterface: SDKInterface) => SlideApi;
1056
1152
  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 };
1153
+ 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,83 @@ 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
+ private currentModels;
554
+ openProductsView(): Promise<void>;
555
+ closeProductsView(): void;
556
+ private createCardView;
557
+ private createScrollView;
558
+ private createProductsView;
559
+ getIsClickCapturedByWidget(): boolean;
560
+ private destroy;
561
+ onStop(): void;
562
+ static api: {
563
+ widgetClassName: string;
564
+ onRefreshUserData: typeof WidgetBase.onRefreshUserData;
565
+ init: (element: HTMLElement, localData?: Record<string, any>) => void;
566
+ onStart: (element: HTMLElement) => void;
567
+ onStop: (element: HTMLElement) => void;
568
+ click: (element: HTMLElement) => boolean;
569
+ isClickCapturedByWidget: (element: HTMLElement) => boolean;
570
+ onHandleBackpress: (element: HTMLElement) => boolean;
571
+ };
572
+ }
496
573
  type WidgetQuestOptions = WidgetOptionsBase;
497
574
  declare class WidgetQuest extends WidgetBase<WidgetQuestOptions> {
498
575
  static DEFAULTS: WidgetQuestOptions;
@@ -503,6 +580,7 @@ declare class WidgetQuest extends WidgetBase<WidgetQuestOptions> {
503
580
  private readonly isWidget;
504
581
  private readonly slideCount;
505
582
  private readonly nonFinalSlide;
583
+ private readonly slideDisabledNavigation;
506
584
  private readonly finalSlide;
507
585
  constructor(element: HTMLElement, options: Partial<WidgetQuestOptions>);
508
586
  /**
@@ -756,7 +834,7 @@ interface SDKApi {
756
834
  getCardServerData(cardId: number): Record<string, any> | null;
757
835
  getSlideDuration(cardId: number, slideIndex: number): number | null;
758
836
  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;
837
+ sendStatisticEvent(name: string, data: Record<string, string | number | Array<string | number>>, devPayload?: Record<string, string | number | Array<string | number>>, forceEnableStatisticV2?: boolean): void;
760
838
  getCardLocalData(): Promise<Record<string, any>>;
761
839
  isExistsShowLayer(): boolean;
762
840
  showLayer(index: number): void;
@@ -801,6 +879,10 @@ interface SDKApi {
801
879
  cardResumedCallback(currentTime: number | null): void;
802
880
  startDisabledTimeline(cardId: number, slideIndex: number): void;
803
881
  getCardFonts(): Array<FontDTO>;
882
+ disableVerticalSwipeGesture(): void;
883
+ enableVerticalSwipeGesture(): void;
884
+ disableBackpress(): void;
885
+ enableBackpress(): void;
804
886
  }
805
887
  declare class WidgetsService {
806
888
  private _env;
@@ -875,8 +957,12 @@ declare class WidgetBase<WidgetOptions extends WidgetOptionsBase> {
875
957
  static getStatisticEventBaseFieldsShortForm(cardId: number, slideIndex: number): StatisticEventBaseFieldsShortForm;
876
958
  get statisticEventBaseFieldsFullForm(): StatisticEventBaseFieldsFullForm;
877
959
  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;
960
+ static sendStatisticEventToApp(name: string, data: Record<string, string | number | Array<string | number>>, devPayload?: Record<string, string | number | Array<string | number>>, options?: {
961
+ forceEnableStatisticV2?: boolean;
962
+ }): void;
963
+ sendStatisticEventToApp(name: string, data: Record<string, string | number | Array<string | number>>, devPayload?: Record<string, string | number | Array<string | number>>, options?: {
964
+ forceEnableStatisticV2?: boolean;
965
+ }): void;
880
966
  startDisabledTimeline(): void;
881
967
  protected _showLayer(layers: Array<HTMLElement>, selectIndex: number, withStatEvent?: boolean): void;
882
968
  protected _statEventLayoutShow(layoutIndex: number): void;
@@ -914,7 +1000,7 @@ interface SDKInterface {
914
1000
  /**
915
1001
  * From native sdk, do`t implement in web|react-sdk
916
1002
  */
917
- sendStatisticEvent(name: string, data: Record<string, string | number | Array<string | number>>, devPayload?: Record<string, string | number | Array<string | number>>): void;
1003
+ sendStatisticEvent(name: string, data: Record<string, string | number | Array<string | number>>, devPayload?: Record<string, string | number | Array<string | number>>, forceEnableStatisticV2?: boolean): void;
918
1004
  getCardLocalData(): Promise<Record<string, any>>;
919
1005
  setCardLocalData(keyValue: Record<string, any>, sendToServer: boolean): void;
920
1006
  showLayer(index: number): void;
@@ -1018,6 +1104,14 @@ interface SDKInterface {
1018
1104
  * @param text
1019
1105
  */
1020
1106
  showToast(text: string): void;
1107
+ /**
1108
+ * Stop react on any detected vertical swipe gesture
1109
+ */
1110
+ disableVerticalSwipeGesture(): void;
1111
+ /**
1112
+ * Continue to react on any vertical swipe gesture
1113
+ */
1114
+ enableVerticalSwipeGesture(): void;
1021
1115
  }
1022
1116
  type WidgetCopyApi = typeof WidgetCopy.api;
1023
1117
  type WidgetDataInputApi = typeof WidgetDataInput.api;
@@ -1034,6 +1128,7 @@ type WidgetShareApi = typeof WidgetShare.api;
1034
1128
  type WidgetTestApi = typeof WidgetTest.api;
1035
1129
  type WidgetVoteApi = typeof WidgetVote.api;
1036
1130
  type WidgetBarcodeApi = typeof WidgetBarcode.api;
1131
+ type WidgetProductsApi = typeof WidgetProducts.api;
1037
1132
  type SlideApi = {
1038
1133
  Animation: IAnimation;
1039
1134
  WidgetCopy: WidgetCopyApi;
@@ -1051,7 +1146,8 @@ type SlideApi = {
1051
1146
  WidgetTest: WidgetTestApi;
1052
1147
  WidgetVote: WidgetVoteApi;
1053
1148
  WidgetBarcode: WidgetBarcodeApi;
1149
+ WidgetProducts: WidgetProductsApi;
1054
1150
  };
1055
1151
  declare const getSlideApi: (_sdkInterface: SDKInterface) => SlideApi;
1056
1152
  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 };
1153
+ 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 };