@tivio/sdk-react 4.4.0 → 4.5.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/README.md CHANGED
@@ -6,6 +6,12 @@ settings in the administration of Tivio Studio while having the freedom to build
6
6
 
7
7
  ## Changelog
8
8
 
9
+ * v4.5.0
10
+ * minor: extend PurchaseEndpointPayload type with purchase previousStatus and newStatus fields
11
+
12
+ * v4.4.1
13
+ * patch: added waitForTags param in useSearch hook for videos
14
+
9
15
  * v4.4.0
10
16
  * minor: PrimaryButton component props type set to any for now
11
17
  * patch: isPurchasableAsVoucher added to PurchasableMonetization
package/README.md.bak CHANGED
@@ -6,6 +6,12 @@ settings in the administration of Tivio Studio while having the freedom to build
6
6
 
7
7
  ## Changelog
8
8
 
9
+ * v4.5.0
10
+ * minor: extend PurchaseEndpointPayload type with purchase previousStatus and newStatus fields
11
+
12
+ * v4.4.1
13
+ * patch: added waitForTags param in useSearch hook for videos
14
+
9
15
  * v4.4.0
10
16
  * minor: PrimaryButton component props type set to any for now
11
17
  * patch: isPurchasableAsVoucher added to PurchasableMonetization
package/dist/index.d.ts CHANGED
@@ -209,6 +209,7 @@ export declare type BannerProps = {
209
209
  borderRadius?: string | number;
210
210
  buttonText?: string;
211
211
  onButtonClick?: () => void;
212
+ numberOfLines?: number;
212
213
  };
213
214
 
214
215
  /**
@@ -299,6 +300,36 @@ export declare type CmpConfig = 'default' | 'debug' | 'none';
299
300
  */
300
301
  export declare type Config = SdkReactConfig;
301
302
 
303
+ /**
304
+ * @public
305
+ */
306
+ export declare interface ConfirmationOverlayContextState {
307
+ isOpen: boolean;
308
+ payload: ConfirmationOverlayPayload | null;
309
+ closeOverlay: () => void;
310
+ openOverlay: (payload: ConfirmationOverlayPayload) => void;
311
+ confirmAction: () => void;
312
+ }
313
+
314
+ /**
315
+ * @public
316
+ */
317
+ export declare type ConfirmationOverlayPayload = SuccessConfirmationOverlayPayload | WarningConfirmationOverlayPayload;
318
+
319
+ /**
320
+ * @public
321
+ */
322
+ export declare interface ConfirmationOverlayPayloadBase {
323
+ title?: string;
324
+ caption?: string;
325
+ onClose?: () => void;
326
+ onConfirm?: () => void;
327
+ /**
328
+ * If configured, then overlay is automatically confirmed after this time.
329
+ */
330
+ automaticConfirmDelayMs?: number;
331
+ }
332
+
302
333
  /**
303
334
  * @public
304
335
  * @TODO move somewhere else
@@ -544,9 +575,10 @@ export declare interface IndexedUser extends IndexedObject {
544
575
  * @public
545
576
  */
546
577
  export declare interface IndexedVideo extends IndexedObject {
547
- organizationPath?: string;
578
+ assets: any;
579
+ organizationPath: string;
548
580
  tagPaths?: string[];
549
- created: Date;
581
+ created: Date | string;
550
582
  isDraft: boolean;
551
583
  type: VideoType;
552
584
  contentType?: VideoContentType;
@@ -727,6 +759,11 @@ declare interface Logger {
727
759
  */
728
760
  declare type LoggerArgs = any[];
729
761
 
762
+ export declare enum LoginRedirect {
763
+ PAYMENT = "payment",
764
+ VOUCHER = "voucher"
765
+ }
766
+
730
767
  /**
731
768
  * @public
732
769
  */
@@ -780,6 +817,14 @@ export declare enum MONETIZATION_FREQUENCY {
780
817
  ANNUALLY = "ANNUALLY"
781
818
  }
782
819
 
820
+ /**
821
+ * @public
822
+ */
823
+ export declare interface MonetizationActions {
824
+ selectMonetization: (monetization: PurchasableMonetization) => void;
825
+ errors: string[];
826
+ }
827
+
783
828
  /**
784
829
  * @public
785
830
  */
@@ -878,6 +923,7 @@ declare type OrderByDirection = 'desc' | 'asc';
878
923
  * @public
879
924
  */
880
925
  export declare interface Organization {
926
+ userProfileConfiguration: any;
881
927
  }
882
928
 
883
929
  /**
@@ -1291,6 +1337,14 @@ export declare type PurchaseEndpointPayload = {
1291
1337
  * True if delayed payment is confirmed but not charged yet, undefined in all other cases.
1292
1338
  */
1293
1339
  isDelayedPayment?: boolean;
1340
+ /**
1341
+ * Purchase status before change.
1342
+ */
1343
+ previousStatus: PurchaseStatus;
1344
+ /**
1345
+ * Purchase status after change.
1346
+ */
1347
+ newStatus: PurchaseStatus;
1294
1348
  };
1295
1349
  /**
1296
1350
  * Information about the monetization which has been bought by this purchase. Monetization definition may change in time so information provided here
@@ -1528,15 +1582,27 @@ export declare type RemoteProviderProps = {
1528
1582
  * @public
1529
1583
  */
1530
1584
  export declare interface RouterOverrides {
1585
+ getVideoDetailPath: (videoIdOrUrlName: string) => string;
1586
+ getSeriesDetailPath: (tagId: string) => string;
1587
+ getTagPath: (tagId: string) => string;
1588
+ getLoginPath: () => string;
1589
+ getRegistrationPath: () => string;
1590
+ getLivePlayerPath: (tvChannelId: string) => string;
1591
+ getVodPlayerPath: (videoIdOrUrlName: string) => string;
1592
+ getHomePath: (screens: ScreenConfig[]) => string;
1531
1593
  goToVideoDetailPage: (videoIdOrUrlName: string) => void;
1532
1594
  goToSeriesDetailPage: (tagId: string) => void;
1533
1595
  goToTagPage: (tagId: string) => void;
1534
- goToLoginPage: () => void;
1596
+ goToLoginPage: (options?: {
1597
+ manual?: boolean;
1598
+ origin?: LoginRedirect;
1599
+ }) => void;
1535
1600
  goToRegistrationPage: () => void;
1536
1601
  goBack: () => void;
1537
1602
  goLivePlayer: (tvChannelId: string) => void;
1538
1603
  goVodPlayer: (videoIdOrUrlName: string) => void;
1539
- goToHome: () => void;
1604
+ goToHome: (user?: any, activeUserProfileId?: string) => void;
1605
+ goToRoute: (route: string) => void;
1540
1606
  }
1541
1607
 
1542
1608
  /**
@@ -1544,6 +1610,9 @@ export declare interface RouterOverrides {
1544
1610
  */
1545
1611
  export declare interface RouterOverridesContextState {
1546
1612
  routerOverrides: RouterOverrides;
1613
+ Link: React_2.ComponentType<{
1614
+ href?: string;
1615
+ }>;
1547
1616
  }
1548
1617
 
1549
1618
  /**
@@ -1579,6 +1648,7 @@ declare interface RowBase {
1579
1648
  assets: Assets;
1580
1649
  type: ScreenRowType;
1581
1650
  isLiveRow: boolean;
1651
+ numberOfLines?: number;
1582
1652
  }
1583
1653
 
1584
1654
  /**
@@ -1674,6 +1744,11 @@ export { Screen_2 as Screen }
1674
1744
  export declare type ScreenConfig = {
1675
1745
  id: string;
1676
1746
  name: string;
1747
+ route?: string;
1748
+ showForUserProfileType?: {
1749
+ kids: boolean;
1750
+ adults: boolean;
1751
+ };
1677
1752
  };
1678
1753
 
1679
1754
  /**
@@ -1861,11 +1936,20 @@ declare type SubscriptionInfo = {
1861
1936
  frequency: string;
1862
1937
  };
1863
1938
 
1939
+ /**
1940
+ * @public
1941
+ */
1942
+ export declare interface SuccessConfirmationOverlayPayload extends ConfirmationOverlayPayloadBase {
1943
+ type: 'success';
1944
+ confirmButtonText?: string;
1945
+ }
1946
+
1864
1947
  /**
1865
1948
  * @public
1866
1949
  */
1867
1950
  export declare interface Tag extends RowItem {
1868
1951
  id: string;
1952
+ itemType: ROW_ITEM_TYPES.TAG;
1869
1953
  tagId: string;
1870
1954
  type?: string | null;
1871
1955
  metadata?: any[];
@@ -1890,7 +1974,6 @@ export declare type TileProps = {
1890
1974
  cover: string;
1891
1975
  bottomLabel: string;
1892
1976
  bottomLabelAreaHeight: number;
1893
- bottomLabelTextLinesCount: number;
1894
1977
  innerLabel: string;
1895
1978
  duration: string;
1896
1979
  price: string | null;
@@ -1910,6 +1993,7 @@ export declare type TileProps = {
1910
1993
  */
1911
1994
  containerMargin?: number | string;
1912
1995
  created?: Date;
1996
+ numberOfLines?: number;
1913
1997
  };
1914
1998
 
1915
1999
  /**
@@ -2013,7 +2097,8 @@ export declare interface TivioConfig {
2013
2097
  language: LangCode;
2014
2098
  debug?: boolean;
2015
2099
  verbose?: boolean;
2016
- firebaseApp?: any;
2100
+ firebaseApp?: any | null;
2101
+ firestore?: any | null;
2017
2102
  currency: Currency;
2018
2103
  /**
2019
2104
  * Configuration for GDPR consent collection (CMP)
@@ -2127,6 +2212,10 @@ export declare type TivioInternalComponents = {
2127
2212
  videoIdOrUrlName: string;
2128
2213
  }>;
2129
2214
  WebSeriesDetailScreen: React_2.ComponentType<WebSeriesDetailScreenProps>;
2215
+ WebConfirmationOverlay: React_2.ComponentType;
2216
+ UserProfilesOverlay: React_2.ComponentType<{
2217
+ onClose: (selectedProfileId: string) => void;
2218
+ }>;
2130
2219
  };
2131
2220
 
2132
2221
  /**
@@ -2135,6 +2224,9 @@ export declare type TivioInternalComponents = {
2135
2224
  export declare type TivioInternalHooks = {
2136
2225
  useMonetizationsSelectOverlay: () => MonetizationsSelectOverlayState;
2137
2226
  useQerkoOverlay: () => QerkoOverlayState;
2227
+ useConfirmationOverlay: () => ConfirmationOverlayContextState;
2228
+ useMonetizationActions: () => MonetizationActions;
2229
+ useCancelSubscriptions: () => UseCancelSubscriptionsResult;
2138
2230
  usePurchasesWithVideos: () => {
2139
2231
  purchases: Purchase[];
2140
2232
  };
@@ -2163,6 +2255,7 @@ export declare type TivioInternalHooks = {
2163
2255
  isInitialized: boolean;
2164
2256
  isSignedIn: boolean;
2165
2257
  };
2258
+ useOrganization: () => Organization | null;
2166
2259
  };
2167
2260
 
2168
2261
  /**
@@ -2184,7 +2277,10 @@ export declare type TivioInternalProviders = {
2184
2277
  * @deprecated not used in our app, can be removed when no sdk in production uses it
2185
2278
  */
2186
2279
  OrganizationSubscriptionsContextProvider: React_2.ComponentType;
2187
- RouterOverridesContextProvider: React_2.ComponentType<RouterOverridesContextState>;
2280
+ RouterOverridesContextProvider: React_2.ComponentType<{
2281
+ state: RouterOverridesContextState;
2282
+ }>;
2283
+ ConfirmationOverlayContextProvider: React_2.ComponentType;
2188
2284
  };
2189
2285
 
2190
2286
  /**
@@ -2407,10 +2503,10 @@ export declare type TvAppProps = {
2407
2503
  * @public
2408
2504
  */
2409
2505
  export declare interface TvChannel extends RowItem {
2410
- name: string;
2411
2506
  id: string;
2507
+ itemType: ROW_ITEM_TYPES.TV_CHANNEL;
2508
+ name: string;
2412
2509
  path: string;
2413
- itemType: ROW_ITEM_TYPES;
2414
2510
  country?: string;
2415
2511
  filters: string[];
2416
2512
  logo?: string;
@@ -2424,6 +2520,7 @@ export declare interface TvChannel extends RowItem {
2424
2520
  purchasableMonetization: any | null;
2425
2521
  price: number;
2426
2522
  cover: string;
2523
+ isPlayable: boolean;
2427
2524
  }
2428
2525
 
2429
2526
  /**
@@ -2517,6 +2614,15 @@ export declare type UseCancelSubscription = (subscriptionId: string) => {
2517
2614
  */
2518
2615
  export declare const useCancelSubscription: UseCancelSubscription;
2519
2616
 
2617
+ /**
2618
+ * @public
2619
+ */
2620
+ export declare interface UseCancelSubscriptionsResult {
2621
+ cancelSubscriptions: (subscriptionIds: string[]) => Promise<void>;
2622
+ cancellationInfos: QerkoCancellationInfo[];
2623
+ errors: string[];
2624
+ }
2625
+
2520
2626
  /**
2521
2627
  * @public
2522
2628
  */
@@ -2633,8 +2739,13 @@ export declare type User = {
2633
2739
  * Returns "active" (non-expired) subscription purchases
2634
2740
  */
2635
2741
  purchasedSubscriptions: Purchase[];
2742
+ /**
2743
+ * Returns last expired subscription which user can renew or undefined
2744
+ */
2745
+ extendableSubscription?: Purchase;
2636
2746
  isPurchasesInitialized: boolean;
2637
2747
  isSignedIn: boolean;
2748
+ isReady: boolean;
2638
2749
  email?: string;
2639
2750
  type?: UserType;
2640
2751
  photoURL: string | null;
@@ -2642,6 +2753,10 @@ export declare type User = {
2642
2753
  authUserId?: string;
2643
2754
  favorites: any[];
2644
2755
  watchedPositions: any[];
2756
+ profiles: any[];
2757
+ activeUserProfileId: string | null;
2758
+ createUserProfile: (request: any) => Promise<void>;
2759
+ setActiveUserProfileId: (id: string) => void;
2645
2760
  };
2646
2761
 
2647
2762
  /**
@@ -2668,7 +2783,7 @@ export declare enum UserType {
2668
2783
  /**
2669
2784
  * @public
2670
2785
  */
2671
- export declare type UseSearch = <T extends ALGOLIA_INDEX_NAME>(indexName: T, options?: UseSearchOptions) => {
2786
+ export declare type UseSearch = <T extends ALGOLIA_INDEX_NAME>(indexName: T, options?: UseSearchOptions<T>) => {
2672
2787
  search: (query: string) => void;
2673
2788
  pagination: Omit<PaginationInterface<UseSearchResult<T>>, 'loading'> | null;
2674
2789
  error: Error | null;
@@ -2687,14 +2802,25 @@ export declare const useSearch: UseSearch;
2687
2802
  /**
2688
2803
  * @public
2689
2804
  */
2690
- export declare type UseSearchOptions = PaginationOptions & Partial<{
2691
- minQueryLength: number;
2692
- }>;
2805
+ export declare type UseSearchOptions<T extends ALGOLIA_INDEX_NAME = any> = PaginationOptions & {
2806
+ minQueryLength?: number;
2807
+ } & (T extends ALGOLIA_INDEX_NAME.VIDEOS | ALGOLIA_INDEX_NAME.VIDEOSDESC ? UseSearchVideoOptions : {});
2808
+
2809
+ /**
2810
+ * @public
2811
+ */
2812
+ export declare type UseSearchResult<T extends ALGOLIA_INDEX_NAME> = T extends ALGOLIA_INDEX_NAME.VIDEOS | ALGOLIA_INDEX_NAME.VIDEOSDESC ? Video : T extends ALGOLIA_INDEX_NAME.TAGS ? Tag : T extends ALGOLIA_INDEX_NAME.TV_CHANNELS ? TvChannel : unknown;
2693
2813
 
2694
2814
  /**
2695
2815
  * @public
2696
2816
  */
2697
- export declare type UseSearchResult<T extends ALGOLIA_INDEX_NAME> = T extends ALGOLIA_INDEX_NAME.VIDEOS ? Video : T extends ALGOLIA_INDEX_NAME.TAGS ? Tag : T extends ALGOLIA_INDEX_NAME.TV_CHANNELS ? TvChannel : unknown;
2817
+ export declare type UseSearchVideoOptions = {
2818
+ /**
2819
+ * If true video tags are awaited before loading is over.
2820
+ * Otherwise, only videos are awaited.
2821
+ */
2822
+ waitForTags?: boolean;
2823
+ };
2698
2824
 
2699
2825
  /**
2700
2826
  * @public
@@ -2824,6 +2950,7 @@ export declare enum VastProvider {
2824
2950
  */
2825
2951
  export declare interface Video extends RowItem {
2826
2952
  id: string;
2953
+ itemType: ROW_ITEM_TYPES.VIDEO;
2827
2954
  /**
2828
2955
  * @deprecated use assets instead
2829
2956
  */
@@ -2984,6 +3111,15 @@ declare type Voucher = {
2984
3111
  voucherInfo: SubscriptionInfo | TransactionInfo;
2985
3112
  };
2986
3113
 
3114
+ /**
3115
+ * @public
3116
+ */
3117
+ export declare interface WarningConfirmationOverlayPayload extends ConfirmationOverlayPayloadBase {
3118
+ type: 'warning';
3119
+ confirmButtonText?: string;
3120
+ closeButtonText?: string;
3121
+ }
3122
+
2987
3123
  /**
2988
3124
  * @public
2989
3125
  */