@24i/bigscreen-sdk 1.0.7-alpha.2161 → 1.0.7

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": "@24i/bigscreen-sdk",
3
- "version": "1.0.7-alpha.2161",
3
+ "version": "1.0.7",
4
4
  "description": "SmartApps BIGscreen SDK monorepo",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -38,7 +38,7 @@
38
38
  "homepage": "https://github.com/24i/smartapps-bigscreen-sdk#readme",
39
39
  "dependencies": {
40
40
  "@24i/player-base": "6.10.0",
41
- "@24i/smartapps-datalayer": "3.0.3",
41
+ "@24i/smartapps-datalayer": "3.0.5-alpha.965",
42
42
  "@sentry/browser": "^7.12.1",
43
43
  "@types/gtag.js": "^0.0.12",
44
44
  "@types/prop-types": "^15.7.5",
@@ -85,29 +85,45 @@ export class DataManager implements IDataManager {
85
85
  }
86
86
 
87
87
  // TODO: Wait for fixes from @thepretiso before looking at this.
88
+ /* eslint-disable complexity */
88
89
  // eslint-disable-next-line sonarjs/cognitive-complexity
89
90
  private getRangesMissingFromDataInRange([start, end]: DataRange) {
90
91
  const rangesLength = this.dataRanges.length;
92
+ const cellSize = TIMELINE_WIDTHS_TO_FETCH * this.timelineWidthMs;
91
93
  if (this.dataRanges.length === 0) return [[start, end]] as DataRange[];
92
94
  const firstRangeFrom = this.dataRanges[0][START];
95
+ const firstRangeTo = this.dataRanges[0][END];
93
96
  if (end <= firstRangeFrom) return [[start, end]] as DataRange[];
94
- if (start < firstRangeFrom && end <= this.dataRanges[0][END]) {
97
+ if (start < firstRangeFrom && end <= firstRangeTo) {
95
98
  return [
96
- [firstRangeFrom - TIMELINE_WIDTHS_TO_FETCH * this.timelineWidthMs, firstRangeFrom],
99
+ [firstRangeFrom - cellSize, firstRangeFrom],
97
100
  ] as DataRange[];
98
101
  }
102
+ const lastRangeFrom = this.dataRanges[rangesLength - 1][START];
99
103
  const lastRangeTo = this.dataRanges[rangesLength - 1][END];
100
104
  if (end > lastRangeTo && start <= lastRangeTo) {
101
105
  return [
102
- [lastRangeTo, lastRangeTo + TIMELINE_WIDTHS_TO_FETCH * this.timelineWidthMs],
106
+ [lastRangeTo, lastRangeTo + cellSize],
107
+ ] as DataRange[];
108
+ }
109
+ if (start >= lastRangeTo && end >= lastRangeTo && start - lastRangeTo >= cellSize) {
110
+ return [
111
+ [start, end],
103
112
  ] as DataRange[];
104
113
  }
105
114
  const ranges: DataRange[] = [];
106
115
  let newRange: DataRange = [start, end];
107
116
  for (let i = 0; i < rangesLength; i++) {
108
117
  const [rangeFrom, rangeTo] = this.dataRanges[i];
109
- // eslint-disable-next-line no-continue
110
- if (start >= rangeTo) continue;
118
+ if (start >= rangeTo) {
119
+ if (start - rangeTo <= cellSize) {
120
+ newRange[START] = rangeTo;
121
+ } else {
122
+ const newStart = lastRangeFrom - cellSize;
123
+ newRange[START] = newStart;
124
+ }
125
+ continue;
126
+ }
111
127
  if (start < rangeFrom) {
112
128
  if (end <= rangeFrom) {
113
129
  if (newRange[START] !== newRange[END]) ranges.push(newRange);