@reactoo/watchtogether-sdk-js 2.8.4 → 2.8.6

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reactoo/watchtogether-sdk-js",
3
- "version": "2.8.4",
3
+ "version": "2.8.6",
4
4
  "description": "Javascript SDK for Reactoo",
5
5
  "main": "dist/watchtogether-sdk.min.js",
6
6
  "module": "dist/watchtogether-sdk.min.js",
package/src/index.js CHANGED
@@ -10,6 +10,7 @@ import user from './models/user';
10
10
  import asset from "./models/asset";
11
11
  import system from "./models/system"
12
12
  import iot from './models/iot'
13
+ import liveBarn from './models/live-barn';
13
14
  import * as utils from './models/utils';
14
15
 
15
16
  function WatchTogether(modules = {}, instanceType, debug, playerFactory, providerAuth) {
@@ -38,6 +39,7 @@ function WatchTogether(modules = {}, instanceType, debug, playerFactory, provide
38
39
  this.asset = {...asset.call(this)};
39
40
  this.system = {...system.call(this)}
40
41
  this.iot = {...iot.call(this)};
42
+ this.liveBarn = {...liveBarn.call(this)};
41
43
  this.utils = utils;
42
44
  }
43
45
 
@@ -110,6 +110,11 @@ let asset = function() {
110
110
  createStreamAsset: (id, title, streamType, regionalPreference, ingestType, source, profile) => {
111
111
  return this.__privates.auth.__client
112
112
  .then(client => client.apis.asset.publishAsset({id}, {requestBody: {assetType: 'stream', title, stream: {streamType, regionalPreference, ingestType, source, profile}}}));
113
+ },
114
+
115
+ createHighlightAsset: (id, title, roomIds, highlight = {}) => {
116
+ return this.__privates.auth.__client
117
+ .then(client => client.apis.asset.publishAsset({id}, {requestBody: {assetType: 'highlight',...(roomIds ? {roomIds} : {}), title, highlight}}));
113
118
  }
114
119
  }
115
120
  };
@@ -90,6 +90,13 @@ let auth = function () {
90
90
  .then(client => client.apis.auth.confirmForgotPassword({},{requestBody:{password, confirmationCode, username}}))
91
91
  },
92
92
 
93
+ changePassword: (oldPassword, password) => {
94
+ const accessToken = localStorage.getItem(this.__privates.auth.ACCESS_TOKEN);
95
+
96
+ return this.__privates.auth.__client
97
+ .then(client => client.apis.auth.changePassword({},{requestBody:{oldPassword, password, accessToken}}))
98
+ },
99
+
93
100
  socialAuth: (data = {}) => {
94
101
  return this.__privates.auth.__client
95
102
  .then(client => client.apis.auth.socialAuth(data))
@@ -0,0 +1,85 @@
1
+ 'use strict';
2
+
3
+ import {chunkArray} from "./utils";
4
+
5
+ let liveBarn = function() {
6
+ return {
7
+ getLiveBarnSurfaceList: ({fulltextPhrase, comingSoon, online, countries, sports, surfaceStatus, feedModes, cities, provinces, venues, ids, size, startKey, sort} = {}) => {
8
+ return chunkArray(ids, 50)
9
+ .reduce((promiseChain, idsChunk) => {
10
+ return promiseChain.then(chainResponse => {
11
+ const apiParams = {
12
+ ...(fulltextPhrase && {fulltextPhrase}),
13
+ ...(comingSoon && {comingSoon}),
14
+ ...(online && {online}),
15
+ ...(countries && {countries}),
16
+ ...(sports && {sports}),
17
+ ...(surfaceStatus && {surfaceStatus}),
18
+ ...(feedModes && {feedModes}),
19
+ ...(cities && {cities}),
20
+ ...(provinces && {provinces}),
21
+ ...(venues && {venues}),
22
+ ...(idsChunk?.length && {ids: idsChunk.join(',')}),
23
+ ...(size && !ids?.length && {size}),
24
+ ...(startKey && {startKey}),
25
+ ...(sort && {sort}),
26
+ };
27
+ return this.__privates.auth.__client
28
+ .then(client => client.apis.livebarn.getLiveBarnSurfaceList(apiParams))
29
+ .then(response => ids?.length ? ({
30
+ data: {
31
+ items: [...chainResponse.data.items, ...response.data.items],
32
+ size: chainResponse.data.size + response.data.size,
33
+ startKey: null,
34
+ },
35
+ }) : response);
36
+ });
37
+ }, Promise.resolve({data: {items: [], size: 0, startKey: null}}));
38
+ },
39
+ getLiveBarnSurfaceById: (id) => {
40
+ return this.__privates.auth.__client
41
+ .then(client => client.apis.livebarn.getLiveBarnSurfaceById({id}));
42
+ },
43
+ getLiveBarnVenueList: ({fulltextPhrase, comingSoon, online, countries, sports, surfaceStatus, feedModes, cities, provinces, venueStatus, postalCode, uuid, surfaces, ids, size, startKey, sort} = {}) => {
44
+ return chunkArray(ids, 50)
45
+ .reduce((promiseChain, idsChunk) => {
46
+ return promiseChain.then(chainResponse => {
47
+ const apiParams = {
48
+ ...(fulltextPhrase && {fulltextPhrase}),
49
+ ...(comingSoon && {comingSoon}),
50
+ ...(online && {online}),
51
+ ...(countries && {countries}),
52
+ ...(sports && {sports}),
53
+ ...(surfaceStatus && {surfaceStatus}),
54
+ ...(feedModes && {feedModes}),
55
+ ...(cities && {cities}),
56
+ ...(provinces && {provinces}),
57
+ ...(venueStatus && {venueStatus}),
58
+ ...(postalCode && {postalCode}),
59
+ ...(uuid && {uuid}),
60
+ ...(surfaces && {surfaces}),
61
+ ...(idsChunk?.length && {ids: idsChunk.join(',')}),
62
+ ...(size && !ids?.length && {size}),
63
+ ...(startKey && {startKey}),
64
+ ...(sort && {sort}),
65
+ };
66
+ return this.__privates.auth.__client
67
+ .then(client => client.apis.livebarn.getLiveBarnVenueList(apiParams))
68
+ .then(response => ids?.length ? ({
69
+ data: {
70
+ items: [...chainResponse.data.items, ...response.data.items],
71
+ size: chainResponse.data.size + response.data.size,
72
+ startKey: null,
73
+ },
74
+ }) : response);
75
+ });
76
+ }, Promise.resolve({data: {items: [], size: 0, startKey: null}}));
77
+ },
78
+ getLiveBarnVenueById: (id) => {
79
+ return this.__privates.auth.__client
80
+ .then(client => client.apis.livebarn.getLiveBarnVenueById({id}));
81
+ },
82
+ };
83
+ };
84
+
85
+ export default liveBarn;
File without changes