@tivio/sdk-react 9.1.0 → 9.1.2

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.
@@ -1,8 +1,10 @@
1
1
  import { ComponentType } from 'react';
2
+ import type dayjs from 'dayjs';
2
3
  import { DocumentReference } from '@firebase/firestore-types';
4
+ import type duration from 'dayjs/plugin/duration';
3
5
  import firebase from '@firebase/app-types';
4
6
  import { FunctionComponentElement } from 'react';
5
- import { GeoPoint } from '@firebase/firestore-types';
7
+ import type { GeoPoint } from '@firebase/firestore-types';
6
8
  import { OperatingSystem } from 'detect-browser';
7
9
  import type { PaletteType } from '@material-ui/core';
8
10
  import { default as React_2 } from 'react';
@@ -487,6 +489,7 @@ export declare interface BannerProps {
487
489
  hoverable: boolean;
488
490
  height: number;
489
491
  cover?: string | null;
492
+ created?: Date | null;
490
493
  overlay: boolean;
491
494
  price: string;
492
495
  borderRadius?: string | number;
@@ -871,12 +874,12 @@ export declare const createPubSub: () => PubSub;
871
874
  * Fetch & load CommonJS remote module.
872
875
  * @public
873
876
  */
874
- export declare const createRemotePackageLoader: () => (secret: string, conf: InternalConfig) => Promise<TivioBundle>;
877
+ export declare const createRemotePackageLoader: () => (secret: string, conf: InternalConfig, checkBundleCharCount?: boolean) => Promise<TivioBundle>;
875
878
 
876
879
  /**
877
880
  * @public
878
881
  */
879
- export declare const createUseRemoteBundle: () => (conf: InternalConfig) => RemoteBundleState;
882
+ export declare const createUseRemoteBundle: () => (conf: InternalConfig, checkBundleCharCount?: boolean) => RemoteBundleState;
880
883
 
881
884
  export declare interface CreateUserPayload {
882
885
  displayName?: string;
@@ -950,7 +953,9 @@ export declare enum CustomerId {
950
953
  VIRTUAL_CHANNEL_VIDEOS = "VIRTUAL_CHANNEL_VIDEOS",
951
954
  VOJTA_ZIZKA = "VOJTA_ZIZKA",
952
955
  LIGA_NARUBY = "LIGA_NARUBY",
953
- VIC_NEZ_SI_MYSLITE = "VIC_NEZ_SI_MYSLITE"
956
+ VIC_NEZ_SI_MYSLITE = "VIC_NEZ_SI_MYSLITE",
957
+ ZIMAK = "ZIMAK",
958
+ TYDENIK_HOROSKOPU = "TYDENIK_HOROSKOPU"
954
959
  }
955
960
 
956
961
  /**
@@ -1192,6 +1197,23 @@ export declare type DeviceInfo = ArrisDeviceInfo | ReactNativeDeviceInfo;
1192
1197
  */
1193
1198
  export declare type DeviceOs = OperatingSystem | 'Tizen' | 'webOS' | 'Arris' | 'Android TV' | 'tvOS';
1194
1199
 
1200
+ /**
1201
+ * Window object with Didomi SDK properties.
1202
+ */
1203
+ export declare interface DidomiWindow {
1204
+ didomiEventListeners: Array<{
1205
+ event: string;
1206
+ listener: () => void;
1207
+ }>;
1208
+ /**
1209
+ * The window.didomiOnReady callbacks are called after the SDK
1210
+ * is initialized and has loaded its configuration.
1211
+ *
1212
+ * https://developers.didomi.io/cmp/web-sdk/reference/api
1213
+ */
1214
+ didomiOnReady: (() => void)[];
1215
+ }
1216
+
1195
1217
  /**
1196
1218
  * @public
1197
1219
  */
@@ -1261,6 +1283,8 @@ export declare interface Duration {
1261
1283
  value: number;
1262
1284
  }
1263
1285
 
1286
+ declare type DurationUnit = duration.DurationUnitType & ('day' | 'week' | 'month' | 'year');
1287
+
1264
1288
  /**
1265
1289
  * @public
1266
1290
  */
@@ -1269,6 +1293,14 @@ export declare enum DurationUnits {
1269
1293
  MONTH = "month"
1270
1294
  }
1271
1295
 
1296
+ /**
1297
+ * Duration field using dayjs duration
1298
+ */
1299
+ export declare interface DurationWithUnit {
1300
+ value: number;
1301
+ unit: DurationUnit;
1302
+ }
1303
+
1272
1304
  /**
1273
1305
  * @public
1274
1306
  */
@@ -1411,7 +1443,7 @@ export declare type ExternalTvConfig = {
1411
1443
  * @throws if fetch fails
1412
1444
  * @public
1413
1445
  */
1414
- export declare const fetchBundle: (secret: string, conf: InternalConfig) => Promise<string>;
1446
+ export declare const fetchBundle: (secret: string, conf: InternalConfig, checkBundleCharCount?: boolean) => Promise<string>;
1415
1447
 
1416
1448
  /**
1417
1449
  * Copyright (c) 2021, nangu.TV, a.s. All rights reserved.
@@ -1875,7 +1907,7 @@ export declare type ItemComponent = RowItemComponent | BannerItemComponent;
1875
1907
  /**
1876
1908
  * @public
1877
1909
  */
1878
- export declare type ItemInRow = Tag | Video | TvChannel | Advertisement | Application | Article;
1910
+ export declare type ItemInRow = Tag | Video | TvChannel | Advertisement | Application | Article | Series;
1879
1911
 
1880
1912
  /**
1881
1913
  * @public
@@ -2285,19 +2317,84 @@ export declare type NonAdSourceType = Exclude<SourceType, SourceType.ADVERTISEME
2285
2317
  declare interface Notification_2 {
2286
2318
  id: string;
2287
2319
  name: string;
2288
- targeting: UserGroup;
2320
+ targeting: NotificationTargeting | null;
2289
2321
  templateId: string;
2290
2322
  thumbnailUrl?: string;
2291
- triggerType: TriggerType;
2323
+ triggerType: NotificationTriggerType;
2324
+ scheduleTime?: Date;
2292
2325
  status?: NotificationStatus;
2326
+ substitutions: NotificationSubstitution[];
2293
2327
  }
2294
2328
  export { Notification_2 as Notification }
2295
2329
 
2330
+ export declare interface NotificationDuration {
2331
+ value: number;
2332
+ unit: dayjs.ManipulateType;
2333
+ }
2334
+
2335
+ export declare type NotificationFilterType = NotificationFirestoreFilterType | NotificationSurveyFilterType | NotificationLastActivityFilterType;
2336
+
2337
+ export declare type NotificationFirestoreFilterType = NotificationSubscriptionFilterType | NotificationMembershipFilterType;
2338
+
2339
+ export declare interface NotificationLastActivity {
2340
+ value: number;
2341
+ unit: 'DAY' | 'WEEK' | 'MONTH';
2342
+ }
2343
+
2344
+ export declare interface NotificationLastActivityFilterType {
2345
+ type: 'lastActivity';
2346
+ value: NotificationLastActivity;
2347
+ }
2348
+
2349
+ export declare interface NotificationMembershipFilterType {
2350
+ type: 'membership';
2351
+ value: {
2352
+ membershipId: string;
2353
+ isActive: boolean;
2354
+ };
2355
+ }
2356
+
2296
2357
  export declare enum NotificationStatus {
2358
+ AUTOMATIC = "automatic",
2359
+ DRAFT = "draft",
2297
2360
  PLANNED = "planned",
2298
- SENT = "sent"
2361
+ SENT = "sent",
2362
+ WAITING = "waiting",
2363
+ RUNNING = "running"
2364
+ }
2365
+
2366
+ export declare interface NotificationSubscriptionFilterType {
2367
+ type: 'subscription';
2368
+ value: {
2369
+ subscriptionId: string;
2370
+ isActive: boolean;
2371
+ };
2372
+ }
2373
+
2374
+ export declare interface NotificationSubstitution {
2375
+ key: string;
2376
+ value: string;
2377
+ }
2378
+
2379
+ export declare interface NotificationSurveyFilterType {
2380
+ type: 'survey';
2381
+ value: {
2382
+ ageFrom: number;
2383
+ ageTo?: number;
2384
+ gender: 'm' | 'f' | 'all';
2385
+ };
2299
2386
  }
2300
2387
 
2388
+ export declare interface NotificationTargeting {
2389
+ monetizationId: string;
2390
+ membershipId: string;
2391
+ isActive: boolean;
2392
+ from?: Date;
2393
+ to?: Date;
2394
+ }
2395
+
2396
+ export declare type NotificationTriggerType = 'scheduled' | 'manual' | 'purchaseStatusChange' | 'duration' | 'userRegistration';
2397
+
2301
2398
  /**
2302
2399
  * @public
2303
2400
  */
@@ -2360,6 +2457,10 @@ export declare interface Organization {
2360
2457
  profilePhoto: string | null;
2361
2458
  }
2362
2459
 
2460
+ export declare interface OrganizationInterface {
2461
+ allowedSignInProviders: SignInProvider[];
2462
+ }
2463
+
2363
2464
  /**
2364
2465
  * If Tivio PlayerWrapper is an interception layer, it should allow the pass-through
2365
2466
  * of not just Tivio source types but any other source types that the 3rd party app may be using.
@@ -2766,6 +2867,7 @@ export declare interface PlayerInterface {
2766
2867
  */
2767
2868
  getNativeImaAdUrl?: () => string | null;
2768
2869
  lastQuality?: number | null;
2870
+ getQualities?: () => Track[];
2769
2871
  /**
2770
2872
  * Attribute indicating that the video is to be played "inline"
2771
2873
  * https://developer.mozilla.org/en-US/docs/Web/HTML/Element/video#playsinline
@@ -2930,6 +3032,7 @@ export declare interface PlayerWrapper {
2930
3032
  changeVolumeBy: (volume: number) => void;
2931
3033
  setMuted: (muted: boolean) => void;
2932
3034
  toggleMuted: () => void;
3035
+ getQualities: () => Track[];
2933
3036
  }
2934
3037
 
2935
3038
  /**
@@ -3080,7 +3183,8 @@ export declare enum PurchaseDocumentGateway {
3080
3183
  'comgate' = "comgate",
3081
3184
  'tivio' = "tivio",
3082
3185
  'patreon' = "patreon",
3083
- 'paypal' = "paypal"
3186
+ 'paypal' = "paypal",
3187
+ 'unknown' = "unknown"
3084
3188
  }
3085
3189
 
3086
3190
  /**
@@ -3094,6 +3198,17 @@ export declare type PurchaseEndpointPayload = {
3094
3198
  * Information about the purchase which changes status to PAID.
3095
3199
  */
3096
3200
  purchase: {
3201
+ /**
3202
+ * See {@link LocationField["city"]["cityName"]} type.
3203
+ */
3204
+ cityName?: string;
3205
+ /**
3206
+ * See {@link LocationField["geoPoint"]} type. Here it is serialized from Firebase.GeoPoint type.
3207
+ */
3208
+ geoPoint?: {
3209
+ latitude: number;
3210
+ longitude: number;
3211
+ };
3097
3212
  /**
3098
3213
  * Two-letter upper-case continent code.
3099
3214
  */
@@ -3108,7 +3223,7 @@ export declare type PurchaseEndpointPayload = {
3108
3223
  */
3109
3224
  expiration?: number;
3110
3225
  /**
3111
- * If purchase was made outside of standard Tivio payment method (e.g PayPal), this is its ID.
3226
+ * Paypal Id, Qerko Id or Voucher Id based on the gateway.
3112
3227
  */
3113
3228
  externalId?: string;
3114
3229
  /**
@@ -3562,6 +3677,7 @@ export declare interface RouterOverrides {
3562
3677
  goToRecommendedFromOrganizationRow: (screenId: string, rowId: string) => void;
3563
3678
  goToMagentaMomentsPage: (voucher?: string) => void;
3564
3679
  goToVoucherRedeemPage: () => void;
3680
+ updateParams: (params: URLSearchParams) => void;
3565
3681
  }
3566
3682
 
3567
3683
  /**
@@ -3605,7 +3721,8 @@ export declare enum ROW_ITEM_TYPES {
3605
3721
  TAG = "TAG",
3606
3722
  TV_CHANNEL = "TV_CHANNEL",
3607
3723
  ADVERTISEMENT = "ADVERTISEMENT",
3608
- ARTICLE = "ARTICLE"
3724
+ ARTICLE = "ARTICLE",
3725
+ SERIES = "SERIES"
3609
3726
  }
3610
3727
 
3611
3728
  /**
@@ -3809,6 +3926,10 @@ export declare type ScalableAsset = {
3809
3926
  */
3810
3927
  export declare type Scale = '@1' | '@2' | '@3';
3811
3928
 
3929
+ export declare interface ScheduleNotificationRequest {
3930
+ notificationPath: string;
3931
+ }
3932
+
3812
3933
  /**
3813
3934
  * @public
3814
3935
  */
@@ -3928,6 +4049,35 @@ export declare interface SendFinalizeRegistrationEmailPayload {
3928
4049
  authUserId: string;
3929
4050
  }
3930
4051
 
4052
+ export declare interface SendTivioTemplateEmailRequest {
4053
+ notificationId: string;
4054
+ organizationId: string;
4055
+ testEmailAddress?: string;
4056
+ }
4057
+
4058
+ /**
4059
+ * @public
4060
+ */
4061
+ export declare interface Series extends RowItem, MonetizableItem, ReactableContent {
4062
+ id: string;
4063
+ itemType: ROW_ITEM_TYPES.SERIES;
4064
+ cover: string;
4065
+ organizationId?: string;
4066
+ /**
4067
+ * Only used for non migrated series
4068
+ */
4069
+ originalSeriesTagRef?: any;
4070
+ ref: DocumentReference<any>;
4071
+ availableSeasons: AvailableSeason[];
4072
+ actors?: DocumentReference<any>[];
4073
+ }
4074
+
4075
+ export declare interface SeriesTileSpecificData {
4076
+ organizationId: string;
4077
+ assets?: AssetsField;
4078
+ availableSeasons: AvailableSeason[];
4079
+ }
4080
+
3931
4081
  /**
3932
4082
  * Used for entities, that can be global (e.g. asset presets, tag types).
3933
4083
  * Non-global is stored under organizations (in sub-collection), and shown for organization's users and super-admin.
@@ -3953,6 +4103,11 @@ export declare const setUser: (userId: string | null, payload?: UserPayload) =>
3953
4103
  */
3954
4104
  export declare const showGdprConsentPreferences: () => Promise<void>;
3955
4105
 
4106
+ /**
4107
+ * @public
4108
+ */
4109
+ export declare type SignInProvider = 'google' | 'patreon' | 'apple';
4110
+
3956
4111
  export declare enum SocialNetworks {
3957
4112
  FACEBOOK = 0,
3958
4113
  INSTAGRAM = 1,
@@ -4074,6 +4229,18 @@ export declare type SubscribeToItemsInRowOptions = Partial<{
4074
4229
  */
4075
4230
  export declare type SubscribeToRowsInScreen = (screenId: string, cb: (error: Error | null, data: PaginationInterface<Row> | null) => void, options?: PaginationOptions) => Disposer_2;
4076
4231
 
4232
+ /**
4233
+ * @public
4234
+ */
4235
+ export declare type SubscribeToSeriesEpisodes = (seriesRef: any, cb: (error: Error | null, data: PaginationInterface<Video> | null) => void, options?: SubscribeToSeriesEpisodesOptions) => Disposer_2;
4236
+
4237
+ /**
4238
+ * @public
4239
+ */
4240
+ export declare type SubscribeToSeriesEpisodesOptions = Omit<SubscribeToItemsInRowOptions, 'orderBy'> & {
4241
+ orderBy?: OrderBy<TaggedVideosOrderByField>[];
4242
+ };
4243
+
4077
4244
  /**
4078
4245
  * @public
4079
4246
  */
@@ -4120,6 +4287,11 @@ export declare interface Tag extends RowItem {
4120
4287
  removeFromFavorites: () => void;
4121
4288
  cover: string;
4122
4289
  getApplicationName: () => string | undefined;
4290
+ seriesRef?: DocumentReference<any>;
4291
+ fetchData: () => Promise<void>;
4292
+ getSeriesEntity: (path: string) => Promise<Series>;
4293
+ ref: DocumentReference<any>;
4294
+ seriesEntity: Series | null;
4123
4295
  }
4124
4296
 
4125
4297
  export declare interface TagAvailableSeasonsFieldType extends TagMetadataFieldDefinition {
@@ -4192,6 +4364,8 @@ export declare interface TagTranslationFieldType extends TagMetadataFieldDefinit
4192
4364
  value: Translation;
4193
4365
  }
4194
4366
 
4367
+ export declare type TemplateSubstitutionType = 'text' | 'html' | 'image' | 'video';
4368
+
4195
4369
  export declare type Tier = {
4196
4370
  attributes: {
4197
4371
  amount_cents: number;
@@ -4217,7 +4391,7 @@ export declare interface TileApplicationData {
4217
4391
  profilePhoto?: string;
4218
4392
  }
4219
4393
 
4220
- export declare interface TileData<ItemSpecificData = VideoTileSpecificData | TvChannelTileSpecificData | TagTileSpecificData | ArticleTileSpecificData> {
4394
+ export declare interface TileData<ItemSpecificData = VideoTileSpecificData | TvChannelTileSpecificData | TagTileSpecificData | ArticleTileSpecificData | SeriesTileSpecificData> {
4221
4395
  /**
4222
4396
  * Tile item ID.
4223
4397
  */
@@ -4934,12 +5108,13 @@ export declare interface TopWatchItem {
4934
5108
  * @public
4935
5109
  * Video track
4936
5110
  */
4937
- declare interface Track {
5111
+ export declare interface Track {
4938
5112
  id: number;
4939
5113
  /**
4940
5114
  * e.g. 480, 720, 1080
4941
5115
  */
4942
5116
  height: number;
5117
+ width: number;
4943
5118
  active: boolean;
4944
5119
  language: LangCode;
4945
5120
  }
@@ -4960,8 +5135,6 @@ export declare type Translation = {
4960
5135
  [key in LangCode]?: string;
4961
5136
  };
4962
5137
 
4963
- export declare type TriggerType = 'scheduled' | 'manual';
4964
-
4965
5138
  /**
4966
5139
  * @public
4967
5140
  */
@@ -5339,7 +5512,7 @@ export declare type User = {
5339
5512
  * Returns last expired subscription which user can renew or undefined
5340
5513
  */
5341
5514
  extendableSubscription?: Purchase;
5342
- getPurchasedVideos: () => Video[];
5515
+ getPurchasedVideos: () => unknown[];
5343
5516
  getOneTimePurchases: () => Purchase[];
5344
5517
  isPurchasesInitialized: boolean;
5345
5518
  isSignedIn: boolean;
@@ -5572,6 +5745,9 @@ export declare type VastApiFramework = string | 'VPAID' | null;
5572
5745
  */
5573
5746
  export declare enum VastProvider {
5574
5747
  CNC_PREBID = "cnc-prebid",
5748
+ CNC_STARGAZE_PREROLL_1 = "cnc-stargaze-preroll-1",
5749
+ CNC_STARGAZE_PREROLL_2 = "cnc-stargaze-preroll-2",
5750
+ CNC_STARGAZE_MIDROLL = "cnc-stargaze-midroll",
5575
5751
  ETARGET_PREBID = "etarget-prebid",
5576
5752
  FALLBACK_HLS = "fallback-hls",
5577
5753
  FALLBACK_MP4 = "fallback",
@@ -5684,6 +5860,8 @@ export declare interface Video extends RowItem, MonetizableItem, ReactableConten
5684
5860
  setApplicationData: (applicationData: RowItemApplicationData) => void;
5685
5861
  linkedVideosInNotLoaded: () => boolean | undefined;
5686
5862
  initApplication: () => Promise<void>;
5863
+ init: () => Promise<void>;
5864
+ progress?: number;
5687
5865
  }
5688
5866
 
5689
5867
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tivio/sdk-react",
3
- "version": "9.1.0",
3
+ "version": "9.1.2",
4
4
  "main": "dist/index.js",
5
5
  "typings": "dist/index.d.ts",
6
6
  "source": "src/index.ts",
@@ -18,7 +18,7 @@
18
18
  "release:minor": "yarn release -r=minor",
19
19
  "release:major": "yarn release -r=major",
20
20
  "start": "yarn ts-node ./scripts/start.ts",
21
- "test": "jest --config=./jest.config.js --coverage",
21
+ "test": "yarn jest --config=./jest.config.js",
22
22
  "clean": "rm -rf dist",
23
23
  "prepublishOnly": "yarn && yarn build:prod && yarn ts-node ./scripts/prepublish.ts",
24
24
  "postpublish": "yarn ts-node ./scripts/postpublish.ts",
@@ -34,7 +34,7 @@
34
34
  "@material-ui/core": "^4.11.2",
35
35
  "@material-ui/icons": "^4.11.2",
36
36
  "@sentry/browser": "^6.1.0",
37
- "@tivio/common": "1.1.122",
37
+ "@tivio/common": "1.1.125",
38
38
  "dayjs": "^1.11.0",
39
39
  "es7-object-polyfill": "^1.0.1",
40
40
  "firebase": "8.10.1",
@@ -50,11 +50,10 @@
50
50
  "devDependencies": {
51
51
  "@microsoft/api-extractor": "^7.39.1",
52
52
  "@testing-library/jest-dom": "^5.11.9",
53
- "@testing-library/react": "^11.2.3",
54
- "@testing-library/react-hooks": "^5.0.3",
53
+ "@testing-library/react": "^15.0.2",
55
54
  "@testing-library/user-event": "^12.1.10",
56
55
  "@tivio/types": "*",
57
- "@types/jest": "^26.0.24",
56
+ "@types/jest": "^27.5.2",
58
57
  "@types/node": "^12.0.0",
59
58
  "@types/node-fetch": "^2.5.8",
60
59
  "@types/react": "^18.0.28",
@@ -68,15 +67,15 @@
68
67
  "dotenv": "^9.0.0",
69
68
  "eslint": "^7.19.0",
70
69
  "fork-ts-checker-webpack-plugin": "^7.0.0",
71
- "jest": "^26.6.0",
72
- "jest-cli": "^26.6.0",
70
+ "jest": "^27.5.1",
71
+ "jest-cli": "^27.5.1",
73
72
  "jest-fetch-mock": "^3.0.3",
74
73
  "node-fetch": "^2.6.1",
75
74
  "react": "^18.2.0",
76
75
  "react-dom": "^18.2.0",
77
76
  "stream-browserify": "^3.0.0",
78
77
  "timers-browserify": "^2.0.12",
79
- "ts-jest": "^26.5.6",
78
+ "ts-jest": "^27.1.5",
80
79
  "ts-node": "^10.9.1",
81
80
  "typescript": "^5",
82
81
  "web-vitals": "^1.0.1",