@tivio/sdk-react 2.1.0 → 2.1.1-alpha1
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +3 -0
- package/coverage/clover.xml +113 -0
- package/coverage/lcov-report/base.css +224 -0
- package/coverage/lcov-report/block-navigation.js +79 -0
- package/coverage/lcov-report/favicon.png +0 -0
- package/coverage/lcov-report/index.html +126 -0
- package/coverage/lcov-report/prettify.css +1 -0
- package/coverage/lcov-report/prettify.js +2 -0
- package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
- package/coverage/lcov-report/sorter.js +170 -0
- package/coverage/lcov-report/src/components/TivioProvider.tsx.html +227 -0
- package/coverage/lcov-report/src/components/TivioWidget.tsx.html +203 -0
- package/coverage/lcov-report/src/components/TivioWidgetError.tsx.html +122 -0
- package/coverage/lcov-report/src/components/TivioWidgetLoader.tsx.html +116 -0
- package/coverage/lcov-report/src/components/index.html +156 -0
- package/coverage/lcov-report/src/conf.ts.html +239 -0
- package/coverage/lcov-report/src/index.html +111 -0
- package/coverage/lcov-report/src/services/bundleLoader.ts.html +698 -0
- package/coverage/lcov-report/src/services/dependencyResolver.ts.html +212 -0
- package/coverage/lcov-report/src/services/index.html +141 -0
- package/coverage/lcov-report/src/services/logger.ts.html +365 -0
- package/coverage/lcov-report/src/services/packageLoader.ts.html +194 -0
- package/coverage/lcov-report/src/services/pubSub.ts.html +242 -0
- package/coverage/lcov-report/src/services/settings.ts.html +218 -0
- package/coverage/lcov-report/src/setupTests.ts.html +158 -0
- package/coverage/lcov.info +175 -0
- package/dist/index.js +1 -1
- package/package.json +5 -4
- package/scripts/prepublish.ts +16 -0
@@ -0,0 +1,170 @@
|
|
1
|
+
/* eslint-disable */
|
2
|
+
var addSorting = (function() {
|
3
|
+
'use strict';
|
4
|
+
var cols,
|
5
|
+
currentSort = {
|
6
|
+
index: 0,
|
7
|
+
desc: false
|
8
|
+
};
|
9
|
+
|
10
|
+
// returns the summary table element
|
11
|
+
function getTable() {
|
12
|
+
return document.querySelector('.coverage-summary');
|
13
|
+
}
|
14
|
+
// returns the thead element of the summary table
|
15
|
+
function getTableHeader() {
|
16
|
+
return getTable().querySelector('thead tr');
|
17
|
+
}
|
18
|
+
// returns the tbody element of the summary table
|
19
|
+
function getTableBody() {
|
20
|
+
return getTable().querySelector('tbody');
|
21
|
+
}
|
22
|
+
// returns the th element for nth column
|
23
|
+
function getNthColumn(n) {
|
24
|
+
return getTableHeader().querySelectorAll('th')[n];
|
25
|
+
}
|
26
|
+
|
27
|
+
// loads all columns
|
28
|
+
function loadColumns() {
|
29
|
+
var colNodes = getTableHeader().querySelectorAll('th'),
|
30
|
+
colNode,
|
31
|
+
cols = [],
|
32
|
+
col,
|
33
|
+
i;
|
34
|
+
|
35
|
+
for (i = 0; i < colNodes.length; i += 1) {
|
36
|
+
colNode = colNodes[i];
|
37
|
+
col = {
|
38
|
+
key: colNode.getAttribute('data-col'),
|
39
|
+
sortable: !colNode.getAttribute('data-nosort'),
|
40
|
+
type: colNode.getAttribute('data-type') || 'string'
|
41
|
+
};
|
42
|
+
cols.push(col);
|
43
|
+
if (col.sortable) {
|
44
|
+
col.defaultDescSort = col.type === 'number';
|
45
|
+
colNode.innerHTML =
|
46
|
+
colNode.innerHTML + '<span class="sorter"></span>';
|
47
|
+
}
|
48
|
+
}
|
49
|
+
return cols;
|
50
|
+
}
|
51
|
+
// attaches a data attribute to every tr element with an object
|
52
|
+
// of data values keyed by column name
|
53
|
+
function loadRowData(tableRow) {
|
54
|
+
var tableCols = tableRow.querySelectorAll('td'),
|
55
|
+
colNode,
|
56
|
+
col,
|
57
|
+
data = {},
|
58
|
+
i,
|
59
|
+
val;
|
60
|
+
for (i = 0; i < tableCols.length; i += 1) {
|
61
|
+
colNode = tableCols[i];
|
62
|
+
col = cols[i];
|
63
|
+
val = colNode.getAttribute('data-value');
|
64
|
+
if (col.type === 'number') {
|
65
|
+
val = Number(val);
|
66
|
+
}
|
67
|
+
data[col.key] = val;
|
68
|
+
}
|
69
|
+
return data;
|
70
|
+
}
|
71
|
+
// loads all row data
|
72
|
+
function loadData() {
|
73
|
+
var rows = getTableBody().querySelectorAll('tr'),
|
74
|
+
i;
|
75
|
+
|
76
|
+
for (i = 0; i < rows.length; i += 1) {
|
77
|
+
rows[i].data = loadRowData(rows[i]);
|
78
|
+
}
|
79
|
+
}
|
80
|
+
// sorts the table using the data for the ith column
|
81
|
+
function sortByIndex(index, desc) {
|
82
|
+
var key = cols[index].key,
|
83
|
+
sorter = function(a, b) {
|
84
|
+
a = a.data[key];
|
85
|
+
b = b.data[key];
|
86
|
+
return a < b ? -1 : a > b ? 1 : 0;
|
87
|
+
},
|
88
|
+
finalSorter = sorter,
|
89
|
+
tableBody = document.querySelector('.coverage-summary tbody'),
|
90
|
+
rowNodes = tableBody.querySelectorAll('tr'),
|
91
|
+
rows = [],
|
92
|
+
i;
|
93
|
+
|
94
|
+
if (desc) {
|
95
|
+
finalSorter = function(a, b) {
|
96
|
+
return -1 * sorter(a, b);
|
97
|
+
};
|
98
|
+
}
|
99
|
+
|
100
|
+
for (i = 0; i < rowNodes.length; i += 1) {
|
101
|
+
rows.push(rowNodes[i]);
|
102
|
+
tableBody.removeChild(rowNodes[i]);
|
103
|
+
}
|
104
|
+
|
105
|
+
rows.sort(finalSorter);
|
106
|
+
|
107
|
+
for (i = 0; i < rows.length; i += 1) {
|
108
|
+
tableBody.appendChild(rows[i]);
|
109
|
+
}
|
110
|
+
}
|
111
|
+
// removes sort indicators for current column being sorted
|
112
|
+
function removeSortIndicators() {
|
113
|
+
var col = getNthColumn(currentSort.index),
|
114
|
+
cls = col.className;
|
115
|
+
|
116
|
+
cls = cls.replace(/ sorted$/, '').replace(/ sorted-desc$/, '');
|
117
|
+
col.className = cls;
|
118
|
+
}
|
119
|
+
// adds sort indicators for current column being sorted
|
120
|
+
function addSortIndicators() {
|
121
|
+
getNthColumn(currentSort.index).className += currentSort.desc
|
122
|
+
? ' sorted-desc'
|
123
|
+
: ' sorted';
|
124
|
+
}
|
125
|
+
// adds event listeners for all sorter widgets
|
126
|
+
function enableUI() {
|
127
|
+
var i,
|
128
|
+
el,
|
129
|
+
ithSorter = function ithSorter(i) {
|
130
|
+
var col = cols[i];
|
131
|
+
|
132
|
+
return function() {
|
133
|
+
var desc = col.defaultDescSort;
|
134
|
+
|
135
|
+
if (currentSort.index === i) {
|
136
|
+
desc = !currentSort.desc;
|
137
|
+
}
|
138
|
+
sortByIndex(i, desc);
|
139
|
+
removeSortIndicators();
|
140
|
+
currentSort.index = i;
|
141
|
+
currentSort.desc = desc;
|
142
|
+
addSortIndicators();
|
143
|
+
};
|
144
|
+
};
|
145
|
+
for (i = 0; i < cols.length; i += 1) {
|
146
|
+
if (cols[i].sortable) {
|
147
|
+
// add the click event handler on the th so users
|
148
|
+
// dont have to click on those tiny arrows
|
149
|
+
el = getNthColumn(i).querySelector('.sorter').parentElement;
|
150
|
+
if (el.addEventListener) {
|
151
|
+
el.addEventListener('click', ithSorter(i));
|
152
|
+
} else {
|
153
|
+
el.attachEvent('onclick', ithSorter(i));
|
154
|
+
}
|
155
|
+
}
|
156
|
+
}
|
157
|
+
}
|
158
|
+
// adds sorting functionality to the UI
|
159
|
+
return function() {
|
160
|
+
if (!getTable()) {
|
161
|
+
return;
|
162
|
+
}
|
163
|
+
cols = loadColumns();
|
164
|
+
loadData();
|
165
|
+
addSortIndicators();
|
166
|
+
enableUI();
|
167
|
+
};
|
168
|
+
})();
|
169
|
+
|
170
|
+
window.addEventListener('load', addSorting);
|
@@ -0,0 +1,227 @@
|
|
1
|
+
|
2
|
+
<!doctype html>
|
3
|
+
<html lang="en">
|
4
|
+
|
5
|
+
<head>
|
6
|
+
<title>Code coverage report for src/components/TivioProvider.tsx</title>
|
7
|
+
<meta charset="utf-8" />
|
8
|
+
<link rel="stylesheet" href="../../prettify.css" />
|
9
|
+
<link rel="stylesheet" href="../../base.css" />
|
10
|
+
<link rel="shortcut icon" type="image/x-icon" href="../../favicon.png" />
|
11
|
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
12
|
+
<style type='text/css'>
|
13
|
+
.coverage-summary .sorter {
|
14
|
+
background-image: url(../../sort-arrow-sprite.png);
|
15
|
+
}
|
16
|
+
</style>
|
17
|
+
</head>
|
18
|
+
|
19
|
+
<body>
|
20
|
+
<div class='wrapper'>
|
21
|
+
<div class='pad1'>
|
22
|
+
<h1><a href="../../index.html">All files</a> / <a href="index.html">src/components</a> TivioProvider.tsx</h1>
|
23
|
+
<div class='clearfix'>
|
24
|
+
|
25
|
+
<div class='fl pad1y space-right2'>
|
26
|
+
<span class="strong">52.94% </span>
|
27
|
+
<span class="quiet">Statements</span>
|
28
|
+
<span class='fraction'>9/17</span>
|
29
|
+
</div>
|
30
|
+
|
31
|
+
|
32
|
+
<div class='fl pad1y space-right2'>
|
33
|
+
<span class="strong">0% </span>
|
34
|
+
<span class="quiet">Branches</span>
|
35
|
+
<span class='fraction'>0/6</span>
|
36
|
+
</div>
|
37
|
+
|
38
|
+
|
39
|
+
<div class='fl pad1y space-right2'>
|
40
|
+
<span class="strong">0% </span>
|
41
|
+
<span class="quiet">Functions</span>
|
42
|
+
<span class='fraction'>0/2</span>
|
43
|
+
</div>
|
44
|
+
|
45
|
+
|
46
|
+
<div class='fl pad1y space-right2'>
|
47
|
+
<span class="strong">46.67% </span>
|
48
|
+
<span class="quiet">Lines</span>
|
49
|
+
<span class='fraction'>7/15</span>
|
50
|
+
</div>
|
51
|
+
|
52
|
+
|
53
|
+
</div>
|
54
|
+
<p class="quiet">
|
55
|
+
Press <em>n</em> or <em>j</em> to go to the next uncovered block, <em>b</em>, <em>p</em> or <em>k</em> for the previous block.
|
56
|
+
</p>
|
57
|
+
</div>
|
58
|
+
<div class='status-line medium'></div>
|
59
|
+
<pre><table class="coverage">
|
60
|
+
<tr><td class="line-count quiet"><a name='L1'></a><a href='#L1'>1</a>
|
61
|
+
<a name='L2'></a><a href='#L2'>2</a>
|
62
|
+
<a name='L3'></a><a href='#L3'>3</a>
|
63
|
+
<a name='L4'></a><a href='#L4'>4</a>
|
64
|
+
<a name='L5'></a><a href='#L5'>5</a>
|
65
|
+
<a name='L6'></a><a href='#L6'>6</a>
|
66
|
+
<a name='L7'></a><a href='#L7'>7</a>
|
67
|
+
<a name='L8'></a><a href='#L8'>8</a>
|
68
|
+
<a name='L9'></a><a href='#L9'>9</a>
|
69
|
+
<a name='L10'></a><a href='#L10'>10</a>
|
70
|
+
<a name='L11'></a><a href='#L11'>11</a>
|
71
|
+
<a name='L12'></a><a href='#L12'>12</a>
|
72
|
+
<a name='L13'></a><a href='#L13'>13</a>
|
73
|
+
<a name='L14'></a><a href='#L14'>14</a>
|
74
|
+
<a name='L15'></a><a href='#L15'>15</a>
|
75
|
+
<a name='L16'></a><a href='#L16'>16</a>
|
76
|
+
<a name='L17'></a><a href='#L17'>17</a>
|
77
|
+
<a name='L18'></a><a href='#L18'>18</a>
|
78
|
+
<a name='L19'></a><a href='#L19'>19</a>
|
79
|
+
<a name='L20'></a><a href='#L20'>20</a>
|
80
|
+
<a name='L21'></a><a href='#L21'>21</a>
|
81
|
+
<a name='L22'></a><a href='#L22'>22</a>
|
82
|
+
<a name='L23'></a><a href='#L23'>23</a>
|
83
|
+
<a name='L24'></a><a href='#L24'>24</a>
|
84
|
+
<a name='L25'></a><a href='#L25'>25</a>
|
85
|
+
<a name='L26'></a><a href='#L26'>26</a>
|
86
|
+
<a name='L27'></a><a href='#L27'>27</a>
|
87
|
+
<a name='L28'></a><a href='#L28'>28</a>
|
88
|
+
<a name='L29'></a><a href='#L29'>29</a>
|
89
|
+
<a name='L30'></a><a href='#L30'>30</a>
|
90
|
+
<a name='L31'></a><a href='#L31'>31</a>
|
91
|
+
<a name='L32'></a><a href='#L32'>32</a>
|
92
|
+
<a name='L33'></a><a href='#L33'>33</a>
|
93
|
+
<a name='L34'></a><a href='#L34'>34</a>
|
94
|
+
<a name='L35'></a><a href='#L35'>35</a>
|
95
|
+
<a name='L36'></a><a href='#L36'>36</a>
|
96
|
+
<a name='L37'></a><a href='#L37'>37</a>
|
97
|
+
<a name='L38'></a><a href='#L38'>38</a>
|
98
|
+
<a name='L39'></a><a href='#L39'>39</a>
|
99
|
+
<a name='L40'></a><a href='#L40'>40</a>
|
100
|
+
<a name='L41'></a><a href='#L41'>41</a>
|
101
|
+
<a name='L42'></a><a href='#L42'>42</a>
|
102
|
+
<a name='L43'></a><a href='#L43'>43</a>
|
103
|
+
<a name='L44'></a><a href='#L44'>44</a>
|
104
|
+
<a name='L45'></a><a href='#L45'>45</a>
|
105
|
+
<a name='L46'></a><a href='#L46'>46</a>
|
106
|
+
<a name='L47'></a><a href='#L47'>47</a>
|
107
|
+
<a name='L48'></a><a href='#L48'>48</a>
|
108
|
+
<a name='L49'></a><a href='#L49'>49</a>
|
109
|
+
<a name='L50'></a><a href='#L50'>50</a></td><td class="line-coverage quiet"><span class="cline-any cline-neutral"> </span>
|
110
|
+
<span class="cline-any cline-neutral"> </span>
|
111
|
+
<span class="cline-any cline-neutral"> </span>
|
112
|
+
<span class="cline-any cline-neutral"> </span>
|
113
|
+
<span class="cline-any cline-neutral"> </span>
|
114
|
+
<span class="cline-any cline-yes">1x</span>
|
115
|
+
<span class="cline-any cline-neutral"> </span>
|
116
|
+
<span class="cline-any cline-yes">1x</span>
|
117
|
+
<span class="cline-any cline-yes">1x</span>
|
118
|
+
<span class="cline-any cline-neutral"> </span>
|
119
|
+
<span class="cline-any cline-neutral"> </span>
|
120
|
+
<span class="cline-any cline-neutral"> </span>
|
121
|
+
<span class="cline-any cline-neutral"> </span>
|
122
|
+
<span class="cline-any cline-neutral"> </span>
|
123
|
+
<span class="cline-any cline-neutral"> </span>
|
124
|
+
<span class="cline-any cline-neutral"> </span>
|
125
|
+
<span class="cline-any cline-yes">1x</span>
|
126
|
+
<span class="cline-any cline-yes">1x</span>
|
127
|
+
<span class="cline-any cline-neutral"> </span>
|
128
|
+
<span class="cline-any cline-yes">1x</span>
|
129
|
+
<span class="cline-any cline-neutral"> </span>
|
130
|
+
<span class="cline-any cline-neutral"> </span>
|
131
|
+
<span class="cline-any cline-neutral"> </span>
|
132
|
+
<span class="cline-any cline-no"> </span>
|
133
|
+
<span class="cline-any cline-no"> </span>
|
134
|
+
<span class="cline-any cline-neutral"> </span>
|
135
|
+
<span class="cline-any cline-no"> </span>
|
136
|
+
<span class="cline-any cline-neutral"> </span>
|
137
|
+
<span class="cline-any cline-neutral"> </span>
|
138
|
+
<span class="cline-any cline-neutral"> </span>
|
139
|
+
<span class="cline-any cline-neutral"> </span>
|
140
|
+
<span class="cline-any cline-neutral"> </span>
|
141
|
+
<span class="cline-any cline-neutral"> </span>
|
142
|
+
<span class="cline-any cline-no"> </span>
|
143
|
+
<span class="cline-any cline-neutral"> </span>
|
144
|
+
<span class="cline-any cline-neutral"> </span>
|
145
|
+
<span class="cline-any cline-neutral"> </span>
|
146
|
+
<span class="cline-any cline-neutral"> </span>
|
147
|
+
<span class="cline-any cline-neutral"> </span>
|
148
|
+
<span class="cline-any cline-neutral"> </span>
|
149
|
+
<span class="cline-any cline-yes">1x</span>
|
150
|
+
<span class="cline-any cline-no"> </span>
|
151
|
+
<span class="cline-any cline-neutral"> </span>
|
152
|
+
<span class="cline-any cline-no"> </span>
|
153
|
+
<span class="cline-any cline-no"> </span>
|
154
|
+
<span class="cline-any cline-neutral"> </span>
|
155
|
+
<span class="cline-any cline-neutral"> </span>
|
156
|
+
<span class="cline-any cline-no"> </span>
|
157
|
+
<span class="cline-any cline-neutral"> </span>
|
158
|
+
<span class="cline-any cline-neutral"> </span></td><td class="text"><pre class="prettyprint lang-js">/**
|
159
|
+
* Copyright (c) 2021, nangu.TV, a.s. All rights reserved.
|
160
|
+
* nangu.TV, a.s PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
|
161
|
+
*/
|
162
|
+
|
163
|
+
import React, { FunctionComponentElement, useContext } from 'react'
|
164
|
+
|
165
|
+
import { createInternalConf } from '../conf'
|
166
|
+
import { createUseRemoteBundle, RemoteBundleState } from '../services/bundleLoader'
|
167
|
+
import type { Conf } from '../types'
|
168
|
+
|
169
|
+
export type TivioProviderProps = {
|
170
|
+
children: React.ReactNode
|
171
|
+
conf: Conf
|
172
|
+
}
|
173
|
+
|
174
|
+
const useRemoteBundle = createUseRemoteBundle()
|
175
|
+
const TivioContext = React.createContext<RemoteBundleState | null>(null)
|
176
|
+
|
177
|
+
export const TivioProvider = <span class="fstat-no" title="function not covered" >({</span>
|
178
|
+
children,
|
179
|
+
conf,
|
180
|
+
}: TivioProviderProps): FunctionComponentElement<TivioProviderProps> => {
|
181
|
+
const _conf = <span class="cstat-no" title="statement not covered" >createInternalConf(conf)</span>
|
182
|
+
const bundleState = <span class="cstat-no" title="statement not covered" >useRemoteBundle(_conf)</span>
|
183
|
+
|
184
|
+
const content = <span class="cstat-no" title="statement not covered" >bundleState?.state === 'ready' && bundleState.components ?</span>
|
185
|
+
(
|
186
|
+
<bundleState.components.Provider language={_conf.language}>
|
187
|
+
{children}
|
188
|
+
</bundleState.components.Provider>
|
189
|
+
) : children
|
190
|
+
|
191
|
+
<span class="cstat-no" title="statement not covered" > return (</span>
|
192
|
+
<TivioContext.Provider value={bundleState}>
|
193
|
+
{content}
|
194
|
+
</TivioContext.Provider>
|
195
|
+
)
|
196
|
+
}
|
197
|
+
|
198
|
+
export const useTivioData = <span class="fstat-no" title="function not covered" >(): RemoteBundleState =</span>> {
|
199
|
+
const context = <span class="cstat-no" title="statement not covered" >useContext(TivioContext)</span>
|
200
|
+
|
201
|
+
<span class="cstat-no" title="statement not covered" > if (context === null) {</span>
|
202
|
+
<span class="cstat-no" title="statement not covered" > throw new Error('useTivioData must be inside TivioProvider')</span>
|
203
|
+
}
|
204
|
+
|
205
|
+
<span class="cstat-no" title="statement not covered" > return context</span>
|
206
|
+
}
|
207
|
+
</pre></td></tr></table></pre>
|
208
|
+
|
209
|
+
<div class='push'></div><!-- for sticky footer -->
|
210
|
+
</div><!-- /wrapper -->
|
211
|
+
<div class='footer quiet pad2 space-top1 center small'>
|
212
|
+
Code coverage generated by
|
213
|
+
<a href="https://istanbul.js.org/" target="_blank">istanbul</a>
|
214
|
+
at Fri Apr 30 2021 12:16:39 GMT+0200 (Central European Summer Time)
|
215
|
+
</div>
|
216
|
+
</div>
|
217
|
+
<script src="../../prettify.js"></script>
|
218
|
+
<script>
|
219
|
+
window.onload = function () {
|
220
|
+
prettyPrint();
|
221
|
+
};
|
222
|
+
</script>
|
223
|
+
<script src="../../sorter.js"></script>
|
224
|
+
<script src="../../block-navigation.js"></script>
|
225
|
+
</body>
|
226
|
+
</html>
|
227
|
+
|
@@ -0,0 +1,203 @@
|
|
1
|
+
|
2
|
+
<!doctype html>
|
3
|
+
<html lang="en">
|
4
|
+
|
5
|
+
<head>
|
6
|
+
<title>Code coverage report for src/components/TivioWidget.tsx</title>
|
7
|
+
<meta charset="utf-8" />
|
8
|
+
<link rel="stylesheet" href="../../prettify.css" />
|
9
|
+
<link rel="stylesheet" href="../../base.css" />
|
10
|
+
<link rel="shortcut icon" type="image/x-icon" href="../../favicon.png" />
|
11
|
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
12
|
+
<style type='text/css'>
|
13
|
+
.coverage-summary .sorter {
|
14
|
+
background-image: url(../../sort-arrow-sprite.png);
|
15
|
+
}
|
16
|
+
</style>
|
17
|
+
</head>
|
18
|
+
|
19
|
+
<body>
|
20
|
+
<div class='wrapper'>
|
21
|
+
<div class='pad1'>
|
22
|
+
<h1><a href="../../index.html">All files</a> / <a href="index.html">src/components</a> TivioWidget.tsx</h1>
|
23
|
+
<div class='clearfix'>
|
24
|
+
|
25
|
+
<div class='fl pad1y space-right2'>
|
26
|
+
<span class="strong">73.33% </span>
|
27
|
+
<span class="quiet">Statements</span>
|
28
|
+
<span class='fraction'>11/15</span>
|
29
|
+
</div>
|
30
|
+
|
31
|
+
|
32
|
+
<div class='fl pad1y space-right2'>
|
33
|
+
<span class="strong">55.56% </span>
|
34
|
+
<span class="quiet">Branches</span>
|
35
|
+
<span class='fraction'>5/9</span>
|
36
|
+
</div>
|
37
|
+
|
38
|
+
|
39
|
+
<div class='fl pad1y space-right2'>
|
40
|
+
<span class="strong">100% </span>
|
41
|
+
<span class="quiet">Functions</span>
|
42
|
+
<span class='fraction'>1/1</span>
|
43
|
+
</div>
|
44
|
+
|
45
|
+
|
46
|
+
<div class='fl pad1y space-right2'>
|
47
|
+
<span class="strong">73.33% </span>
|
48
|
+
<span class="quiet">Lines</span>
|
49
|
+
<span class='fraction'>11/15</span>
|
50
|
+
</div>
|
51
|
+
|
52
|
+
|
53
|
+
</div>
|
54
|
+
<p class="quiet">
|
55
|
+
Press <em>n</em> or <em>j</em> to go to the next uncovered block, <em>b</em>, <em>p</em> or <em>k</em> for the previous block.
|
56
|
+
</p>
|
57
|
+
</div>
|
58
|
+
<div class='status-line medium'></div>
|
59
|
+
<pre><table class="coverage">
|
60
|
+
<tr><td class="line-count quiet"><a name='L1'></a><a href='#L1'>1</a>
|
61
|
+
<a name='L2'></a><a href='#L2'>2</a>
|
62
|
+
<a name='L3'></a><a href='#L3'>3</a>
|
63
|
+
<a name='L4'></a><a href='#L4'>4</a>
|
64
|
+
<a name='L5'></a><a href='#L5'>5</a>
|
65
|
+
<a name='L6'></a><a href='#L6'>6</a>
|
66
|
+
<a name='L7'></a><a href='#L7'>7</a>
|
67
|
+
<a name='L8'></a><a href='#L8'>8</a>
|
68
|
+
<a name='L9'></a><a href='#L9'>9</a>
|
69
|
+
<a name='L10'></a><a href='#L10'>10</a>
|
70
|
+
<a name='L11'></a><a href='#L11'>11</a>
|
71
|
+
<a name='L12'></a><a href='#L12'>12</a>
|
72
|
+
<a name='L13'></a><a href='#L13'>13</a>
|
73
|
+
<a name='L14'></a><a href='#L14'>14</a>
|
74
|
+
<a name='L15'></a><a href='#L15'>15</a>
|
75
|
+
<a name='L16'></a><a href='#L16'>16</a>
|
76
|
+
<a name='L17'></a><a href='#L17'>17</a>
|
77
|
+
<a name='L18'></a><a href='#L18'>18</a>
|
78
|
+
<a name='L19'></a><a href='#L19'>19</a>
|
79
|
+
<a name='L20'></a><a href='#L20'>20</a>
|
80
|
+
<a name='L21'></a><a href='#L21'>21</a>
|
81
|
+
<a name='L22'></a><a href='#L22'>22</a>
|
82
|
+
<a name='L23'></a><a href='#L23'>23</a>
|
83
|
+
<a name='L24'></a><a href='#L24'>24</a>
|
84
|
+
<a name='L25'></a><a href='#L25'>25</a>
|
85
|
+
<a name='L26'></a><a href='#L26'>26</a>
|
86
|
+
<a name='L27'></a><a href='#L27'>27</a>
|
87
|
+
<a name='L28'></a><a href='#L28'>28</a>
|
88
|
+
<a name='L29'></a><a href='#L29'>29</a>
|
89
|
+
<a name='L30'></a><a href='#L30'>30</a>
|
90
|
+
<a name='L31'></a><a href='#L31'>31</a>
|
91
|
+
<a name='L32'></a><a href='#L32'>32</a>
|
92
|
+
<a name='L33'></a><a href='#L33'>33</a>
|
93
|
+
<a name='L34'></a><a href='#L34'>34</a>
|
94
|
+
<a name='L35'></a><a href='#L35'>35</a>
|
95
|
+
<a name='L36'></a><a href='#L36'>36</a>
|
96
|
+
<a name='L37'></a><a href='#L37'>37</a>
|
97
|
+
<a name='L38'></a><a href='#L38'>38</a>
|
98
|
+
<a name='L39'></a><a href='#L39'>39</a>
|
99
|
+
<a name='L40'></a><a href='#L40'>40</a>
|
100
|
+
<a name='L41'></a><a href='#L41'>41</a>
|
101
|
+
<a name='L42'></a><a href='#L42'>42</a></td><td class="line-coverage quiet"><span class="cline-any cline-neutral"> </span>
|
102
|
+
<span class="cline-any cline-neutral"> </span>
|
103
|
+
<span class="cline-any cline-neutral"> </span>
|
104
|
+
<span class="cline-any cline-neutral"> </span>
|
105
|
+
<span class="cline-any cline-neutral"> </span>
|
106
|
+
<span class="cline-any cline-yes">2x</span>
|
107
|
+
<span class="cline-any cline-neutral"> </span>
|
108
|
+
<span class="cline-any cline-yes">2x</span>
|
109
|
+
<span class="cline-any cline-yes">2x</span>
|
110
|
+
<span class="cline-any cline-neutral"> </span>
|
111
|
+
<span class="cline-any cline-neutral"> </span>
|
112
|
+
<span class="cline-any cline-yes">2x</span>
|
113
|
+
<span class="cline-any cline-yes">1x</span>
|
114
|
+
<span class="cline-any cline-no"> </span>
|
115
|
+
<span class="cline-any cline-neutral"> </span>
|
116
|
+
<span class="cline-any cline-neutral"> </span>
|
117
|
+
<span class="cline-any cline-yes">1x</span>
|
118
|
+
<span class="cline-any cline-neutral"> </span>
|
119
|
+
<span class="cline-any cline-yes">1x</span>
|
120
|
+
<span class="cline-any cline-yes">1x</span>
|
121
|
+
<span class="cline-any cline-neutral"> </span>
|
122
|
+
<span class="cline-any cline-yes">1x</span>
|
123
|
+
<span class="cline-any cline-neutral"> </span>
|
124
|
+
<span class="cline-any cline-no"> </span>
|
125
|
+
<span class="cline-any cline-neutral"> </span>
|
126
|
+
<span class="cline-any cline-no"> </span>
|
127
|
+
<span class="cline-any cline-neutral"> </span>
|
128
|
+
<span class="cline-any cline-yes">1x</span>
|
129
|
+
<span class="cline-any cline-no"> </span>
|
130
|
+
<span class="cline-any cline-neutral"> </span>
|
131
|
+
<span class="cline-any cline-neutral"> </span>
|
132
|
+
<span class="cline-any cline-yes">1x</span>
|
133
|
+
<span class="cline-any cline-neutral"> </span>
|
134
|
+
<span class="cline-any cline-neutral"> </span>
|
135
|
+
<span class="cline-any cline-neutral"> </span>
|
136
|
+
<span class="cline-any cline-neutral"> </span>
|
137
|
+
<span class="cline-any cline-neutral"> </span>
|
138
|
+
<span class="cline-any cline-neutral"> </span>
|
139
|
+
<span class="cline-any cline-neutral"> </span>
|
140
|
+
<span class="cline-any cline-neutral"> </span>
|
141
|
+
<span class="cline-any cline-neutral"> </span>
|
142
|
+
<span class="cline-any cline-neutral"> </span></td><td class="text"><pre class="prettyprint lang-js">/**
|
143
|
+
* Copyright (c) 2021, nangu.TV, a.s. All rights reserved.
|
144
|
+
* nangu.TV, a.s PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
|
145
|
+
*/
|
146
|
+
|
147
|
+
import React, { ElementType } from 'react'
|
148
|
+
|
149
|
+
import { useTivioData } from './TivioProvider'
|
150
|
+
import { TivioWidgetError } from './TivioWidgetError'
|
151
|
+
import type { TivioWidgetProps, TivioWidgetRef } from '../types'
|
152
|
+
|
153
|
+
export const TivioWidget = React.forwardRef<TivioWidgetRef, TivioWidgetProps>((props: TivioWidgetProps, ref) => {
|
154
|
+
<span class="missing-if-branch" title="if path not taken" >I</span>if (typeof props.id !== 'string' || !props.id.length) {
|
155
|
+
<span class="cstat-no" title="statement not covered" > return (<TivioWidgetError error="TivioWidget must have a mandatory property 'id'." />)</span>
|
156
|
+
}
|
157
|
+
|
158
|
+
const { state, error, components, conf } = useTivioData()
|
159
|
+
|
160
|
+
const ErrorComponent = conf.ErrorComponent as ElementType
|
161
|
+
const LoaderComponent = conf.LoaderComponent as ElementType
|
162
|
+
|
163
|
+
switch (state) {
|
164
|
+
<span class="branch-0 cbranch-no" title="branch not covered" > case 'error':</span>
|
165
|
+
<span class="cstat-no" title="statement not covered" > return (<ErrorComponent error={error} />)</span>
|
166
|
+
<span class="branch-1 cbranch-no" title="branch not covered" > case 'loading':</span>
|
167
|
+
<span class="cstat-no" title="statement not covered" > return (<LoaderComponent />)</span>
|
168
|
+
case 'ready':
|
169
|
+
<span class="missing-if-branch" title="if path not taken" >I</span>if (!components) {
|
170
|
+
<span class="cstat-no" title="statement not covered" > return null</span>
|
171
|
+
}
|
172
|
+
|
173
|
+
return (
|
174
|
+
<components.Widget
|
175
|
+
id={props.id}
|
176
|
+
ref={ref as React.MutableRefObject<TivioWidgetRef>}
|
177
|
+
onEnabled={props.onEnabled}
|
178
|
+
onBlur={props.onBlur}
|
179
|
+
/>
|
180
|
+
)
|
181
|
+
}
|
182
|
+
})
|
183
|
+
</pre></td></tr></table></pre>
|
184
|
+
|
185
|
+
<div class='push'></div><!-- for sticky footer -->
|
186
|
+
</div><!-- /wrapper -->
|
187
|
+
<div class='footer quiet pad2 space-top1 center small'>
|
188
|
+
Code coverage generated by
|
189
|
+
<a href="https://istanbul.js.org/" target="_blank">istanbul</a>
|
190
|
+
at Fri Apr 30 2021 12:16:39 GMT+0200 (Central European Summer Time)
|
191
|
+
</div>
|
192
|
+
</div>
|
193
|
+
<script src="../../prettify.js"></script>
|
194
|
+
<script>
|
195
|
+
window.onload = function () {
|
196
|
+
prettyPrint();
|
197
|
+
};
|
198
|
+
</script>
|
199
|
+
<script src="../../sorter.js"></script>
|
200
|
+
<script src="../../block-navigation.js"></script>
|
201
|
+
</body>
|
202
|
+
</html>
|
203
|
+
|