@tivio/sdk-react 2.1.4 → 2.1.5
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +2 -0
- package/dist/components/hooks/usePurchaseSubscription.d.ts +2 -7
- package/dist/components/hooks/useTransactionPayment.d.ts +2 -7
- package/dist/index.js +1 -1
- package/dist/services/sentry.d.ts +1 -1
- package/dist/types.d.ts +2 -10
- package/env +0 -0
- package/package.json +5 -7
- package/scripts/build_dev.sh +3 -0
- package/scripts/build_prod.sh +3 -0
- package/scripts/start.sh +3 -0
- package/coverage/clover.xml +0 -113
- package/coverage/lcov-report/base.css +0 -224
- package/coverage/lcov-report/block-navigation.js +0 -79
- package/coverage/lcov-report/favicon.png +0 -0
- package/coverage/lcov-report/index.html +0 -126
- package/coverage/lcov-report/prettify.css +0 -1
- package/coverage/lcov-report/prettify.js +0 -2
- package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
- package/coverage/lcov-report/sorter.js +0 -170
- package/coverage/lcov-report/src/components/TivioProvider.tsx.html +0 -227
- package/coverage/lcov-report/src/components/TivioWidget.tsx.html +0 -203
- package/coverage/lcov-report/src/components/TivioWidgetError.tsx.html +0 -122
- package/coverage/lcov-report/src/components/TivioWidgetLoader.tsx.html +0 -116
- package/coverage/lcov-report/src/components/index.html +0 -156
- package/coverage/lcov-report/src/conf.ts.html +0 -239
- package/coverage/lcov-report/src/index.html +0 -111
- package/coverage/lcov-report/src/services/bundleLoader.ts.html +0 -698
- package/coverage/lcov-report/src/services/dependencyResolver.ts.html +0 -212
- package/coverage/lcov-report/src/services/index.html +0 -141
- package/coverage/lcov-report/src/services/logger.ts.html +0 -365
- package/coverage/lcov-report/src/services/packageLoader.ts.html +0 -194
- package/coverage/lcov-report/src/services/pubSub.ts.html +0 -242
- package/coverage/lcov-report/src/services/settings.ts.html +0 -218
- package/coverage/lcov-report/src/setupTests.ts.html +0 -158
- package/coverage/lcov.info +0 -175
@@ -1,242 +0,0 @@
|
|
1
|
-
|
2
|
-
<!doctype html>
|
3
|
-
<html lang="en">
|
4
|
-
|
5
|
-
<head>
|
6
|
-
<title>Code coverage report for src/services/pubSub.ts</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/services</a> pubSub.ts</h1>
|
23
|
-
<div class='clearfix'>
|
24
|
-
|
25
|
-
<div class='fl pad1y space-right2'>
|
26
|
-
<span class="strong">45.45% </span>
|
27
|
-
<span class="quiet">Statements</span>
|
28
|
-
<span class='fraction'>10/22</span>
|
29
|
-
</div>
|
30
|
-
|
31
|
-
|
32
|
-
<div class='fl pad1y space-right2'>
|
33
|
-
<span class="strong">12.5% </span>
|
34
|
-
<span class="quiet">Branches</span>
|
35
|
-
<span class='fraction'>1/8</span>
|
36
|
-
</div>
|
37
|
-
|
38
|
-
|
39
|
-
<div class='fl pad1y space-right2'>
|
40
|
-
<span class="strong">28.57% </span>
|
41
|
-
<span class="quiet">Functions</span>
|
42
|
-
<span class='fraction'>2/7</span>
|
43
|
-
</div>
|
44
|
-
|
45
|
-
|
46
|
-
<div class='fl pad1y space-right2'>
|
47
|
-
<span class="strong">42.11% </span>
|
48
|
-
<span class="quiet">Lines</span>
|
49
|
-
<span class='fraction'>8/19</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 low'></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>
|
110
|
-
<a name='L51'></a><a href='#L51'>51</a>
|
111
|
-
<a name='L52'></a><a href='#L52'>52</a>
|
112
|
-
<a name='L53'></a><a href='#L53'>53</a>
|
113
|
-
<a name='L54'></a><a href='#L54'>54</a>
|
114
|
-
<a name='L55'></a><a href='#L55'>55</a></td><td class="line-coverage quiet"><span class="cline-any cline-neutral"> </span>
|
115
|
-
<span class="cline-any cline-neutral"> </span>
|
116
|
-
<span class="cline-any cline-neutral"> </span>
|
117
|
-
<span class="cline-any cline-neutral"> </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-neutral"> </span>
|
126
|
-
<span class="cline-any cline-yes">1x</span>
|
127
|
-
<span class="cline-any cline-yes">1x</span>
|
128
|
-
<span class="cline-any cline-neutral"> </span>
|
129
|
-
<span class="cline-any cline-yes">1x</span>
|
130
|
-
<span class="cline-any cline-neutral"> </span>
|
131
|
-
<span class="cline-any cline-no"> </span>
|
132
|
-
<span class="cline-any cline-no"> </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-no"> </span>
|
137
|
-
<span class="cline-any cline-no"> </span>
|
138
|
-
<span class="cline-any cline-no"> </span>
|
139
|
-
<span class="cline-any cline-neutral"> </span>
|
140
|
-
<span class="cline-any cline-no"> </span>
|
141
|
-
<span class="cline-any cline-neutral"> </span>
|
142
|
-
<span class="cline-any cline-no"> </span>
|
143
|
-
<span class="cline-any cline-no"> </span>
|
144
|
-
<span class="cline-any cline-no"> </span>
|
145
|
-
<span class="cline-any cline-no"> </span>
|
146
|
-
<span class="cline-any cline-no"> </span>
|
147
|
-
<span class="cline-any cline-neutral"> </span>
|
148
|
-
<span class="cline-any cline-neutral"> </span>
|
149
|
-
<span class="cline-any cline-neutral"> </span>
|
150
|
-
<span class="cline-any cline-neutral"> </span>
|
151
|
-
<span class="cline-any cline-neutral"> </span>
|
152
|
-
<span class="cline-any cline-neutral"> </span>
|
153
|
-
<span class="cline-any cline-neutral"> </span>
|
154
|
-
<span class="cline-any cline-neutral"> </span>
|
155
|
-
<span class="cline-any cline-neutral"> </span>
|
156
|
-
<span class="cline-any cline-yes">1x</span>
|
157
|
-
<span class="cline-any cline-neutral"> </span>
|
158
|
-
<span class="cline-any cline-neutral"> </span>
|
159
|
-
<span class="cline-any cline-neutral"> </span>
|
160
|
-
<span class="cline-any cline-neutral"> </span>
|
161
|
-
<span class="cline-any cline-yes">1x</span>
|
162
|
-
<span class="cline-any cline-yes">1x</span>
|
163
|
-
<span class="cline-any cline-yes">1x</span>
|
164
|
-
<span class="cline-any cline-neutral"> </span>
|
165
|
-
<span class="cline-any cline-neutral"> </span>
|
166
|
-
<span class="cline-any cline-yes">1x</span>
|
167
|
-
<span class="cline-any cline-neutral"> </span>
|
168
|
-
<span class="cline-any cline-neutral"> </span></td><td class="text"><pre class="prettyprint lang-js">/**
|
169
|
-
* Copyright (c) 2021, nangu.TV, a.s. All rights reserved.
|
170
|
-
* nangu.TV, a.s PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
|
171
|
-
*/
|
172
|
-
|
173
|
-
/**
|
174
|
-
* Export Tivio Events API
|
175
|
-
*/
|
176
|
-
|
177
|
-
import { Empty } from '../types'
|
178
|
-
import { PubSub, Events } from '../pubSub.types'
|
179
|
-
|
180
|
-
export const createPubSub = (): PubSub => {
|
181
|
-
const subs = new Map<string, { id: number, onMessage: Function }[]>()
|
182
|
-
|
183
|
-
return ({
|
184
|
-
publish: <span class="fstat-no" title="function not covered" ><K extends keyof Events>(e</span>ventName: K, payload: Events[K]) => {
|
185
|
-
<span class="cstat-no" title="statement not covered" > subs.get(eventName)?.forEach(<span class="fstat-no" title="function not covered" >({</span> onMessage }) => {</span>
|
186
|
-
<span class="cstat-no" title="statement not covered" > onMessage(payload)</span>
|
187
|
-
})
|
188
|
-
},
|
189
|
-
subscribe: <span class="fstat-no" title="function not covered" ><K extends keyof Events>(t</span>riggerName: K, onMessage: (data: Events[K]) => Empty) => {
|
190
|
-
const id = <span class="cstat-no" title="statement not covered" >new Date().getTime()</span>
|
191
|
-
<span class="cstat-no" title="statement not covered" > if (!subs.has(triggerName)) {</span>
|
192
|
-
<span class="cstat-no" title="statement not covered" > subs.set(triggerName, [])</span>
|
193
|
-
}
|
194
|
-
<span class="cstat-no" title="statement not covered" > subs.get(triggerName)!.push({ id, onMessage })</span>
|
195
|
-
|
196
|
-
<span class="cstat-no" title="statement not covered" > return <span class="fstat-no" title="function not covered" >() =</span>> {</span>
|
197
|
-
const eventSubs = <span class="cstat-no" title="statement not covered" >subs.get(triggerName) ?? []</span>
|
198
|
-
const idx = <span class="cstat-no" title="statement not covered" >eventSubs.findIndex(<span class="fstat-no" title="function not covered" >(i</span>tem) => <span class="cstat-no" title="statement not covered" >item.id === id)</span></span>
|
199
|
-
<span class="cstat-no" title="statement not covered" > if (idx !== -1) {</span>
|
200
|
-
<span class="cstat-no" title="statement not covered" > eventSubs.splice(idx, 1)</span>
|
201
|
-
}
|
202
|
-
}
|
203
|
-
},
|
204
|
-
})
|
205
|
-
}
|
206
|
-
|
207
|
-
/**
|
208
|
-
* Singleton instance
|
209
|
-
*/
|
210
|
-
let pubSubInstance: PubSub | null = null
|
211
|
-
|
212
|
-
/**
|
213
|
-
* Share singleton instance
|
214
|
-
*/
|
215
|
-
export const getPubSub = () => {
|
216
|
-
<span class="missing-if-branch" title="else path not taken" >E</span>if (pubSubInstance === null) {
|
217
|
-
pubSubInstance = createPubSub()
|
218
|
-
}
|
219
|
-
|
220
|
-
return pubSubInstance
|
221
|
-
}
|
222
|
-
</pre></td></tr></table></pre>
|
223
|
-
|
224
|
-
<div class='push'></div><!-- for sticky footer -->
|
225
|
-
</div><!-- /wrapper -->
|
226
|
-
<div class='footer quiet pad2 space-top1 center small'>
|
227
|
-
Code coverage generated by
|
228
|
-
<a href="https://istanbul.js.org/" target="_blank">istanbul</a>
|
229
|
-
at Fri Apr 30 2021 12:16:39 GMT+0200 (Central European Summer Time)
|
230
|
-
</div>
|
231
|
-
</div>
|
232
|
-
<script src="../../prettify.js"></script>
|
233
|
-
<script>
|
234
|
-
window.onload = function () {
|
235
|
-
prettyPrint();
|
236
|
-
};
|
237
|
-
</script>
|
238
|
-
<script src="../../sorter.js"></script>
|
239
|
-
<script src="../../block-navigation.js"></script>
|
240
|
-
</body>
|
241
|
-
</html>
|
242
|
-
|
@@ -1,218 +0,0 @@
|
|
1
|
-
|
2
|
-
<!doctype html>
|
3
|
-
<html lang="en">
|
4
|
-
|
5
|
-
<head>
|
6
|
-
<title>Code coverage report for src/services/settings.ts</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/services</a> settings.ts</h1>
|
23
|
-
<div class='clearfix'>
|
24
|
-
|
25
|
-
<div class='fl pad1y space-right2'>
|
26
|
-
<span class="strong">35.71% </span>
|
27
|
-
<span class="quiet">Statements</span>
|
28
|
-
<span class='fraction'>5/14</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">33.33% </span>
|
41
|
-
<span class="quiet">Functions</span>
|
42
|
-
<span class='fraction'>1/3</span>
|
43
|
-
</div>
|
44
|
-
|
45
|
-
|
46
|
-
<div class='fl pad1y space-right2'>
|
47
|
-
<span class="strong">30.77% </span>
|
48
|
-
<span class="quiet">Lines</span>
|
49
|
-
<span class='fraction'>4/13</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 low'></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></td><td class="line-coverage quiet"><span class="cline-any cline-neutral"> </span>
|
107
|
-
<span class="cline-any cline-neutral"> </span>
|
108
|
-
<span class="cline-any cline-neutral"> </span>
|
109
|
-
<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-neutral"> </span>
|
115
|
-
<span class="cline-any cline-neutral"> </span>
|
116
|
-
<span class="cline-any cline-neutral"> </span>
|
117
|
-
<span class="cline-any cline-neutral"> </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-yes">1x</span>
|
124
|
-
<span class="cline-any cline-yes">12x</span>
|
125
|
-
<span class="cline-any cline-neutral"> </span>
|
126
|
-
<span class="cline-any cline-neutral"> </span>
|
127
|
-
<span class="cline-any cline-neutral"> </span>
|
128
|
-
<span class="cline-any cline-yes">12x</span>
|
129
|
-
<span class="cline-any cline-neutral"> </span>
|
130
|
-
<span class="cline-any cline-yes">12x</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-no"> </span>
|
138
|
-
<span class="cline-any cline-no"> </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>
|
143
|
-
<span class="cline-any cline-no"> </span>
|
144
|
-
<span class="cline-any cline-no"> </span>
|
145
|
-
<span class="cline-any cline-no"> </span>
|
146
|
-
<span class="cline-any cline-neutral"> </span>
|
147
|
-
<span class="cline-any cline-no"> </span>
|
148
|
-
<span class="cline-any cline-neutral"> </span>
|
149
|
-
<span class="cline-any cline-neutral"> </span>
|
150
|
-
<span class="cline-any cline-neutral"> </span>
|
151
|
-
<span class="cline-any cline-neutral"> </span>
|
152
|
-
<span class="cline-any cline-neutral"> </span></td><td class="text"><pre class="prettyprint lang-js">/**
|
153
|
-
* Copyright (c) 2021, nangu.TV, a.s. All rights reserved.
|
154
|
-
* nangu.TV, a.s PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
|
155
|
-
*/
|
156
|
-
|
157
|
-
/**
|
158
|
-
* The settings can be called before Tivio is loaded.
|
159
|
-
* So this package is responsible for settings from the beginning of the life cycle.
|
160
|
-
*/
|
161
|
-
|
162
|
-
import type { InternalConf } from '../conf'
|
163
|
-
|
164
|
-
export type Settings = {
|
165
|
-
onSetUser: (handler: (userId: string, userPayload: unknown) => void) => void
|
166
|
-
setUser: (userId: string, userPayload: unknown) => void
|
167
|
-
}
|
168
|
-
|
169
|
-
export const createSettings = (conf: InternalConf) => {
|
170
|
-
let setUserHandler: ((userId: string, userPayload: unknown) => void | Promise<void>) | null = null
|
171
|
-
let value: {
|
172
|
-
userId: string
|
173
|
-
userPayload: unknown
|
174
|
-
} | null = null
|
175
|
-
|
176
|
-
return ({
|
177
|
-
onSetUser: <span class="fstat-no" title="function not covered" >(h</span>andler: (userId: string, userPayload: unknown) => void) => {
|
178
|
-
<span class="cstat-no" title="statement not covered" > if (typeof handler !== 'function') {</span>
|
179
|
-
<span class="cstat-no" title="statement not covered" > conf.logger?.exception('Tivio Bundle setUser handler must be a function')</span>
|
180
|
-
} else {
|
181
|
-
<span class="cstat-no" title="statement not covered" > setUserHandler = handler</span>
|
182
|
-
|
183
|
-
<span class="cstat-no" title="statement not covered" > if (value !== null) {</span>
|
184
|
-
<span class="cstat-no" title="statement not covered" > handler(value.userId, value.userPayload)</span>
|
185
|
-
}
|
186
|
-
}
|
187
|
-
},
|
188
|
-
setUser: <span class="fstat-no" title="function not covered" >(u</span>serId: string, userPayload: unknown) => {
|
189
|
-
<span class="cstat-no" title="statement not covered" > if (typeof setUserHandler === 'function') {</span>
|
190
|
-
<span class="cstat-no" title="statement not covered" > value = null</span>
|
191
|
-
<span class="cstat-no" title="statement not covered" > setUserHandler(userId, userPayload)</span>
|
192
|
-
} else {
|
193
|
-
<span class="cstat-no" title="statement not covered" > value = { userId, userPayload }</span>
|
194
|
-
}
|
195
|
-
},
|
196
|
-
})
|
197
|
-
}
|
198
|
-
</pre></td></tr></table></pre>
|
199
|
-
|
200
|
-
<div class='push'></div><!-- for sticky footer -->
|
201
|
-
</div><!-- /wrapper -->
|
202
|
-
<div class='footer quiet pad2 space-top1 center small'>
|
203
|
-
Code coverage generated by
|
204
|
-
<a href="https://istanbul.js.org/" target="_blank">istanbul</a>
|
205
|
-
at Thu May 06 2021 13:19:37 GMT+0200 (Central European Summer Time)
|
206
|
-
</div>
|
207
|
-
</div>
|
208
|
-
<script src="../../prettify.js"></script>
|
209
|
-
<script>
|
210
|
-
window.onload = function () {
|
211
|
-
prettyPrint();
|
212
|
-
};
|
213
|
-
</script>
|
214
|
-
<script src="../../sorter.js"></script>
|
215
|
-
<script src="../../block-navigation.js"></script>
|
216
|
-
</body>
|
217
|
-
</html>
|
218
|
-
|
@@ -1,158 +0,0 @@
|
|
1
|
-
|
2
|
-
<!doctype html>
|
3
|
-
<html lang="en">
|
4
|
-
|
5
|
-
<head>
|
6
|
-
<title>Code coverage report for src/setupTests.ts</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</a> setupTests.ts</h1>
|
23
|
-
<div class='clearfix'>
|
24
|
-
|
25
|
-
<div class='fl pad1y space-right2'>
|
26
|
-
<span class="strong">100% </span>
|
27
|
-
<span class="quiet">Statements</span>
|
28
|
-
<span class='fraction'>8/8</span>
|
29
|
-
</div>
|
30
|
-
|
31
|
-
|
32
|
-
<div class='fl pad1y space-right2'>
|
33
|
-
<span class="strong">100% </span>
|
34
|
-
<span class="quiet">Branches</span>
|
35
|
-
<span class='fraction'>0/0</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'>0/0</span>
|
43
|
-
</div>
|
44
|
-
|
45
|
-
|
46
|
-
<div class='fl pad1y space-right2'>
|
47
|
-
<span class="strong">100% </span>
|
48
|
-
<span class="quiet">Lines</span>
|
49
|
-
<span class='fraction'>8/8</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 high'></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></td><td class="line-coverage quiet"><span class="cline-any cline-yes">1x</span>
|
87
|
-
<span class="cline-any cline-neutral"> </span>
|
88
|
-
<span class="cline-any cline-neutral"> </span>
|
89
|
-
<span class="cline-any cline-yes">1x</span>
|
90
|
-
<span class="cline-any cline-yes">1x</span>
|
91
|
-
<span class="cline-any cline-yes">1x</span>
|
92
|
-
<span class="cline-any cline-yes">1x</span>
|
93
|
-
<span class="cline-any cline-neutral"> </span>
|
94
|
-
<span class="cline-any cline-yes">1x</span>
|
95
|
-
<span class="cline-any cline-neutral"> </span>
|
96
|
-
<span class="cline-any cline-yes">1x</span>
|
97
|
-
<span class="cline-any cline-neutral"> </span>
|
98
|
-
<span class="cline-any cline-neutral"> </span>
|
99
|
-
<span class="cline-any cline-neutral"> </span>
|
100
|
-
<span class="cline-any cline-neutral"> </span>
|
101
|
-
<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-neutral"> </span>
|
107
|
-
<span class="cline-any cline-neutral"> </span>
|
108
|
-
<span class="cline-any cline-yes">1x</span>
|
109
|
-
<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></td><td class="text"><pre class="prettyprint lang-js">import fetchMock, { GlobalWithFetchMock } from 'jest-fetch-mock'
|
113
|
-
|
114
|
-
// eslint-disable-next-line
|
115
|
-
const customGlobal: GlobalWithFetchMock = (global as any) as GlobalWithFetchMock
|
116
|
-
customGlobal.fetch = fetchMock
|
117
|
-
customGlobal.fetchMock = customGlobal.fetch
|
118
|
-
fetchMock.enableMocks()
|
119
|
-
|
120
|
-
export const fetch = fetchMock
|
121
|
-
|
122
|
-
export const loggerMock = {
|
123
|
-
error: console.error,
|
124
|
-
info: console.info,
|
125
|
-
warn: console.warn,
|
126
|
-
debug: console.debug,
|
127
|
-
|
128
|
-
// eslint-disable-next-line
|
129
|
-
exception: /* istanbul ignore next */ (error: any) => {
|
130
|
-
throw new Error(error)
|
131
|
-
},
|
132
|
-
}
|
133
|
-
|
134
|
-
export const pubSubMock = {
|
135
|
-
publish: jest.fn(),
|
136
|
-
subscribe: jest.fn(),
|
137
|
-
}
|
138
|
-
</pre></td></tr></table></pre>
|
139
|
-
|
140
|
-
<div class='push'></div><!-- for sticky footer -->
|
141
|
-
</div><!-- /wrapper -->
|
142
|
-
<div class='footer quiet pad2 space-top1 center small'>
|
143
|
-
Code coverage generated by
|
144
|
-
<a href="https://istanbul.js.org/" target="_blank">istanbul</a>
|
145
|
-
at Thu May 06 2021 13:19:37 GMT+0200 (Central European Summer Time)
|
146
|
-
</div>
|
147
|
-
</div>
|
148
|
-
<script src="../prettify.js"></script>
|
149
|
-
<script>
|
150
|
-
window.onload = function () {
|
151
|
-
prettyPrint();
|
152
|
-
};
|
153
|
-
</script>
|
154
|
-
<script src="../sorter.js"></script>
|
155
|
-
<script src="../block-navigation.js"></script>
|
156
|
-
</body>
|
157
|
-
</html>
|
158
|
-
|