@oanda/labs-currency-power-balance-widget 1.0.111 → 1.0.112
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/CHANGELOG.md +452 -0
- package/dist/main/CurrencyPowerBalanceWidget/ChartWithData.js +3 -4
- package/dist/main/CurrencyPowerBalanceWidget/ChartWithData.js.map +1 -1
- package/dist/main/CurrencyPowerBalanceWidget/CurrencyPowerBalance.js +12 -17
- package/dist/main/CurrencyPowerBalanceWidget/CurrencyPowerBalance.js.map +1 -1
- package/dist/main/CurrencyPowerBalanceWidget/Main.js +1 -1
- package/dist/main/CurrencyPowerBalanceWidget/Main.js.map +1 -1
- package/dist/main/CurrencyPowerBalanceWidget/components/Chart/Chart.js +1 -1
- package/dist/main/CurrencyPowerBalanceWidget/components/Chart/Chart.js.map +1 -1
- package/dist/main/CurrencyPowerBalanceWidget/components/TimeUnitSwitch/TimeUnitSwitch.js +3 -4
- package/dist/main/CurrencyPowerBalanceWidget/components/TimeUnitSwitch/TimeUnitSwitch.js.map +1 -1
- package/dist/module/CurrencyPowerBalanceWidget/ChartWithData.js +3 -3
- package/dist/module/CurrencyPowerBalanceWidget/ChartWithData.js.map +1 -1
- package/dist/module/CurrencyPowerBalanceWidget/CurrencyPowerBalance.js +14 -19
- package/dist/module/CurrencyPowerBalanceWidget/CurrencyPowerBalance.js.map +1 -1
- package/dist/module/CurrencyPowerBalanceWidget/Main.js +3 -3
- package/dist/module/CurrencyPowerBalanceWidget/Main.js.map +1 -1
- package/dist/module/CurrencyPowerBalanceWidget/components/Chart/Chart.js +3 -3
- package/dist/module/CurrencyPowerBalanceWidget/components/Chart/Chart.js.map +1 -1
- package/dist/module/CurrencyPowerBalanceWidget/components/TimeUnitSwitch/TimeUnitSwitch.js +3 -3
- package/dist/module/CurrencyPowerBalanceWidget/components/TimeUnitSwitch/TimeUnitSwitch.js.map +1 -1
- package/package.json +3 -3
- package/src/CurrencyPowerBalanceWidget/ChartWithData.tsx +3 -3
- package/src/CurrencyPowerBalanceWidget/CurrencyPowerBalance.tsx +16 -20
- package/src/CurrencyPowerBalanceWidget/Main.tsx +3 -3
- package/src/CurrencyPowerBalanceWidget/components/Chart/Chart.tsx +3 -3
- package/src/CurrencyPowerBalanceWidget/components/TimeUnitSwitch/TimeUnitSwitch.tsx +3 -3
- package/test/Main.test.tsx +11 -11
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,458 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## 1.0.112 (2024-12-11)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
## 1.0.172 (2024-11-29)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
## 1.0.171 (2024-11-28)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
## 1.0.170 (2024-11-28)
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
## 1.0.169 (2024-11-20)
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
## 1.0.168 (2024-11-19)
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
## 1.0.167 (2024-10-14)
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
## 1.0.166 (2024-10-07)
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
## 1.0.165 (2024-10-03)
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
## 1.0.164 (2024-09-26)
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
## 1.0.163 (2024-09-18)
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
## 1.0.162 (2024-09-12)
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
## 1.0.161 (2024-09-11)
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
## 1.0.160 (2024-09-10)
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
## 1.0.159 (2024-09-09)
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
## 1.0.158 (2024-09-04)
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
## 1.0.157 (2024-09-04)
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
## 1.0.156 (2024-09-02)
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
## 1.0.155 (2024-08-29)
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
## 1.0.154 (2024-08-29)
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
## 1.0.153 (2024-08-23)
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
## 1.0.152 (2024-08-23)
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
## 1.0.151 (2024-08-20)
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
## 1.0.150 (2024-08-19)
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
## 1.0.149 (2024-08-07)
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
## 1.0.148 (2024-08-01)
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
## 1.0.147 (2024-08-01)
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
## 1.0.146 (2024-07-26)
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
## 1.0.145 (2024-07-25)
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
## 1.0.144 (2024-07-22)
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
## 1.0.143 (2024-07-19)
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
## 1.0.142 (2024-07-16)
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
## 1.0.141 (2024-07-16)
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
## 1.0.140 (2024-07-12)
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
## 1.0.139 (2024-07-12)
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
## 1.0.138 (2024-07-10)
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
## 1.0.137 (2024-07-05)
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
## 1.0.136 (2024-07-03)
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
## 1.0.135 (2024-07-03)
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
## 1.0.134 (2024-07-03)
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
## 1.0.133 (2024-06-28)
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
## 1.0.132 (2024-06-27)
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
## 1.0.131 (2024-06-27)
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
## 1.0.130 (2024-06-26)
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
## 1.0.129 (2024-06-17)
|
|
183
|
+
|
|
184
|
+
|
|
185
|
+
|
|
186
|
+
## 1.0.128 (2024-06-17)
|
|
187
|
+
|
|
188
|
+
|
|
189
|
+
|
|
190
|
+
## 1.0.127 (2024-06-10)
|
|
191
|
+
|
|
192
|
+
|
|
193
|
+
|
|
194
|
+
## 1.0.126 (2024-05-29)
|
|
195
|
+
|
|
196
|
+
|
|
197
|
+
|
|
198
|
+
## 1.0.125 (2024-05-29)
|
|
199
|
+
|
|
200
|
+
|
|
201
|
+
|
|
202
|
+
## 1.0.124 (2024-05-29)
|
|
203
|
+
|
|
204
|
+
|
|
205
|
+
|
|
206
|
+
## 1.0.123 (2024-05-28)
|
|
207
|
+
|
|
208
|
+
|
|
209
|
+
|
|
210
|
+
## 1.0.122 (2024-05-27)
|
|
211
|
+
|
|
212
|
+
|
|
213
|
+
|
|
214
|
+
## 1.0.121 (2024-05-27)
|
|
215
|
+
|
|
216
|
+
|
|
217
|
+
|
|
218
|
+
## 1.0.120 (2024-05-24)
|
|
219
|
+
|
|
220
|
+
|
|
221
|
+
|
|
222
|
+
## 1.0.119 (2024-05-17)
|
|
223
|
+
|
|
224
|
+
|
|
225
|
+
|
|
226
|
+
## 1.0.118 (2024-05-09)
|
|
227
|
+
|
|
228
|
+
|
|
229
|
+
|
|
230
|
+
## 1.0.117 (2024-05-07)
|
|
231
|
+
|
|
232
|
+
|
|
233
|
+
|
|
234
|
+
## 1.0.116 (2024-04-23)
|
|
235
|
+
|
|
236
|
+
|
|
237
|
+
|
|
238
|
+
## 1.0.115 (2024-04-22)
|
|
239
|
+
|
|
240
|
+
|
|
241
|
+
|
|
242
|
+
## 1.0.114 (2024-04-19)
|
|
243
|
+
|
|
244
|
+
|
|
245
|
+
|
|
246
|
+
## 1.0.113 (2024-04-19)
|
|
247
|
+
|
|
248
|
+
|
|
249
|
+
|
|
250
|
+
## 1.0.112 (2024-04-15)
|
|
251
|
+
|
|
252
|
+
|
|
253
|
+
|
|
254
|
+
## 1.0.111 (2024-04-11)
|
|
255
|
+
|
|
256
|
+
|
|
257
|
+
|
|
258
|
+
## 1.0.110 (2024-04-05)
|
|
259
|
+
|
|
260
|
+
|
|
261
|
+
|
|
262
|
+
## 1.0.109 (2024-04-05)
|
|
263
|
+
|
|
264
|
+
|
|
265
|
+
|
|
266
|
+
## 1.0.108 (2024-04-04)
|
|
267
|
+
|
|
268
|
+
|
|
269
|
+
|
|
270
|
+
## 1.0.107 (2024-04-03)
|
|
271
|
+
|
|
272
|
+
|
|
273
|
+
|
|
274
|
+
## 1.0.106 (2024-03-29)
|
|
275
|
+
|
|
276
|
+
|
|
277
|
+
|
|
278
|
+
## 1.0.105 (2024-03-28)
|
|
279
|
+
|
|
280
|
+
|
|
281
|
+
|
|
282
|
+
## 1.0.104 (2024-03-21)
|
|
283
|
+
|
|
284
|
+
|
|
285
|
+
|
|
286
|
+
## 1.0.103 (2024-03-20)
|
|
287
|
+
|
|
288
|
+
|
|
289
|
+
|
|
290
|
+
## 1.0.102 (2024-03-20)
|
|
291
|
+
|
|
292
|
+
|
|
293
|
+
|
|
294
|
+
## 1.0.101 (2024-03-13)
|
|
295
|
+
|
|
296
|
+
|
|
297
|
+
|
|
298
|
+
## 1.0.100 (2024-03-12)
|
|
299
|
+
|
|
300
|
+
|
|
301
|
+
|
|
302
|
+
## 1.0.99 (2024-03-11)
|
|
303
|
+
|
|
304
|
+
|
|
305
|
+
|
|
306
|
+
## 1.0.98 (2024-03-07)
|
|
307
|
+
|
|
308
|
+
|
|
309
|
+
|
|
310
|
+
## 1.0.97 (2024-03-06)
|
|
311
|
+
|
|
312
|
+
|
|
313
|
+
|
|
314
|
+
## 1.0.96 (2024-03-06)
|
|
315
|
+
|
|
316
|
+
|
|
317
|
+
|
|
318
|
+
## 1.0.95 (2024-03-04)
|
|
319
|
+
|
|
320
|
+
|
|
321
|
+
|
|
322
|
+
## 1.0.94 (2024-02-29)
|
|
323
|
+
|
|
324
|
+
|
|
325
|
+
|
|
326
|
+
## 1.0.93 (2024-02-28)
|
|
327
|
+
|
|
328
|
+
|
|
329
|
+
|
|
330
|
+
## 1.0.92 (2024-02-28)
|
|
331
|
+
|
|
332
|
+
|
|
333
|
+
|
|
334
|
+
## 1.0.91 (2024-02-23)
|
|
335
|
+
|
|
336
|
+
|
|
337
|
+
|
|
338
|
+
## 1.0.90 (2024-02-23)
|
|
339
|
+
|
|
340
|
+
|
|
341
|
+
|
|
342
|
+
## 1.0.89 (2024-02-21)
|
|
343
|
+
|
|
344
|
+
|
|
345
|
+
|
|
346
|
+
## 1.0.88 (2024-02-21)
|
|
347
|
+
|
|
348
|
+
|
|
349
|
+
|
|
350
|
+
## 1.0.87 (2024-02-20)
|
|
351
|
+
|
|
352
|
+
|
|
353
|
+
|
|
354
|
+
## 1.0.86 (2024-02-20)
|
|
355
|
+
|
|
356
|
+
|
|
357
|
+
|
|
358
|
+
## 1.0.85 (2024-02-13)
|
|
359
|
+
|
|
360
|
+
|
|
361
|
+
|
|
362
|
+
## 1.0.84 (2024-02-13)
|
|
363
|
+
|
|
364
|
+
|
|
365
|
+
|
|
366
|
+
## 1.0.83 (2024-02-09)
|
|
367
|
+
|
|
368
|
+
|
|
369
|
+
|
|
370
|
+
## 1.0.82 (2024-02-05)
|
|
371
|
+
|
|
372
|
+
|
|
373
|
+
|
|
374
|
+
## 1.0.81 (2024-02-05)
|
|
375
|
+
|
|
376
|
+
|
|
377
|
+
|
|
378
|
+
## 1.0.80 (2024-02-05)
|
|
379
|
+
|
|
380
|
+
|
|
381
|
+
|
|
382
|
+
## 1.0.79 (2024-02-05)
|
|
383
|
+
|
|
384
|
+
|
|
385
|
+
|
|
386
|
+
## 1.0.78 (2024-01-30)
|
|
387
|
+
|
|
388
|
+
|
|
389
|
+
|
|
390
|
+
## 1.0.77 (2024-01-25)
|
|
391
|
+
|
|
392
|
+
|
|
393
|
+
|
|
394
|
+
## 1.0.76 (2024-01-25)
|
|
395
|
+
|
|
396
|
+
|
|
397
|
+
|
|
398
|
+
## 1.0.75 (2024-01-22)
|
|
399
|
+
|
|
400
|
+
|
|
401
|
+
|
|
402
|
+
## 1.0.74 (2024-01-22)
|
|
403
|
+
|
|
404
|
+
|
|
405
|
+
|
|
406
|
+
## 1.0.73 (2024-01-22)
|
|
407
|
+
|
|
408
|
+
|
|
409
|
+
|
|
410
|
+
## 1.0.72 (2024-01-19)
|
|
411
|
+
|
|
412
|
+
|
|
413
|
+
|
|
414
|
+
## 1.0.71 (2024-01-18)
|
|
415
|
+
|
|
416
|
+
|
|
417
|
+
|
|
418
|
+
## 1.0.70 (2024-01-17)
|
|
419
|
+
|
|
420
|
+
|
|
421
|
+
|
|
422
|
+
## 1.0.69 (2024-01-17)
|
|
423
|
+
|
|
424
|
+
|
|
425
|
+
|
|
426
|
+
## 1.0.68 (2024-01-15)
|
|
427
|
+
|
|
428
|
+
|
|
429
|
+
|
|
430
|
+
## 1.0.67 (2024-01-15)
|
|
431
|
+
|
|
432
|
+
|
|
433
|
+
|
|
434
|
+
## 1.0.66 (2024-01-12)
|
|
435
|
+
|
|
436
|
+
|
|
437
|
+
|
|
438
|
+
## 1.0.65 (2024-01-11)
|
|
439
|
+
|
|
440
|
+
|
|
441
|
+
|
|
442
|
+
## 1.0.64 (2024-01-11)
|
|
443
|
+
|
|
444
|
+
|
|
445
|
+
|
|
446
|
+
## 1.0.63 (2024-01-11)
|
|
447
|
+
|
|
448
|
+
|
|
449
|
+
|
|
450
|
+
## 1.0.62 (2024-01-10)
|
|
451
|
+
|
|
452
|
+
**Note:** Version bump only for package @oanda/labs-currency-power-balance-widget
|
|
453
|
+
|
|
454
|
+
|
|
455
|
+
|
|
456
|
+
|
|
457
|
+
|
|
6
458
|
## 1.0.111 (2024-11-29)
|
|
7
459
|
|
|
8
460
|
|
|
@@ -4,15 +4,14 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.ChartWithData = void 0;
|
|
7
|
-
var _react =
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
8
|
var _client = require("@apollo/client");
|
|
9
9
|
var _monoI18n = require("@oanda/mono-i18n");
|
|
10
10
|
var _labsWidgetCommon = require("@oanda/labs-widget-common");
|
|
11
11
|
var _Chart = require("./components/Chart");
|
|
12
12
|
var _constants = require("./constants");
|
|
13
13
|
var _getCurrencyPowerBalance = require("../gql/getCurrencyPowerBalance");
|
|
14
|
-
function
|
|
15
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
14
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
16
15
|
const ChartWithData = _ref => {
|
|
17
16
|
let {
|
|
18
17
|
timeUnit,
|
|
@@ -20,7 +19,7 @@ const ChartWithData = _ref => {
|
|
|
20
19
|
} = _ref;
|
|
21
20
|
const {
|
|
22
21
|
size
|
|
23
|
-
} = (0,
|
|
22
|
+
} = (0, _labsWidgetCommon.useLayoutProvider)();
|
|
24
23
|
const isDesktop = size === _labsWidgetCommon.Size.DESKTOP;
|
|
25
24
|
const {
|
|
26
25
|
lang
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChartWithData.js","names":["_react","
|
|
1
|
+
{"version":3,"file":"ChartWithData.js","names":["_react","_interopRequireDefault","require","_client","_monoI18n","_labsWidgetCommon","_Chart","_constants","_getCurrencyPowerBalance","e","__esModule","default","ChartWithData","_ref","timeUnit","currencies","size","useLayoutProvider","isDesktop","Size","DESKTOP","lang","useLocale","loading","data","error","useQuery","getCurrencyPowerBalance","variables","fetchPolicy","showError","currencyPowerBalance","length","createElement","Fragment","className","Spinner","SpinnerSize","lg","Chart","values","ChartError","Tooltip","id","CURRENCY_POWER_BALANCE_TOOLTIP_ID","LastUpdated","timestamp","updatedAt","labelCallback","exports"],"sources":["../../../src/CurrencyPowerBalanceWidget/ChartWithData.tsx"],"sourcesContent":["import React from 'react';\nimport { useQuery } from '@apollo/client';\nimport { useLocale } from '@oanda/mono-i18n';\nimport {\n ChartError, Spinner, SpinnerSize, useLayoutProvider, Tooltip, Size,\n LastUpdated,\n} from '@oanda/labs-widget-common';\nimport { Chart } from './components/Chart';\nimport { CURRENCY_POWER_BALANCE_TOOLTIP_ID } from './constants';\nimport { getCurrencyPowerBalance } from '../gql/getCurrencyPowerBalance';\nimport { ChartWithDataProps } from './types';\nimport { GetCurrencyPowerBalanceQuery, GetCurrencyPowerBalanceQueryVariables } from '../gql/types/graphql';\n\nconst ChartWithData = ({ timeUnit, currencies }: ChartWithDataProps) => {\n const { size } = useLayoutProvider();\n const isDesktop = size === Size.DESKTOP;\n const { lang } = useLocale();\n const { loading, data, error } = useQuery<\n GetCurrencyPowerBalanceQuery,\n GetCurrencyPowerBalanceQueryVariables\n >(getCurrencyPowerBalance, {\n variables: {\n timeUnit,\n },\n fetchPolicy: 'cache-and-network',\n });\n\n const showError = data?.currencyPowerBalance?.length === 0 || error\n || (currencies && (currencies.length === 0 || currencies.length === 1));\n\n return (\n <>\n {loading\n && (\n <div className=\"lw-mb-[50px] lw-flex lw-h-[375px] lw-w-full lw-items-center lw-border lw-border-solid lw-border-border-primary\">\n <Spinner size={SpinnerSize.lg} />\n </div>\n )}\n {!loading && !showError && (\n <Chart values={data?.currencyPowerBalance!} timeUnit={timeUnit} currencies={currencies} />\n )}\n {!loading && showError && (\n <div className=\"lw-flex lw-h-[375px] lw-w-full lw-items-center lw-border lw-border-solid lw-border-border-primary\">\n <ChartError />\n </div>\n )}\n {isDesktop && <Tooltip id={CURRENCY_POWER_BALANCE_TOOLTIP_ID} />}\n <div className=\"lw-mt-2 lw-h-8\">\n {!loading && !showError && (\n <LastUpdated\n timestamp={data?.currencyPowerBalance![0]?.updatedAt}\n labelCallback={lang}\n />\n )}\n </div>\n </>\n );\n};\n\nexport { ChartWithData };\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAF,OA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ACrB9B,MAAA,CAAAW,OAAA,CAAAsB,aAAA,CAAC3B,MAAA,CAAAiC,KAAK;IAACC,MAAM,EAAEhB,IAAI,EAAEO,oBAAsB;IAACjB,QAAQ,EAAEA,QAAS;IAACC,UAAU,EAAEA;EAAW,CAAE,CAC1F,EACA,CAACQ,OAAO,IAAIO,SAAS,IACpB9B,MAAA,CAAAW,OAAA,CAAAsB,aAAA;IAAKE,SAAS,EAAC;EAAmG,GAChHnC,MAAA,CAAAW,OAAA,CAAAsB,aAAA,CAAC5B,iBAAA,CAAAoC,UAAU,MAAE,CACV,CACN,EACAvB,SAAS,IAAIlB,MAAA,CAAAW,OAAA,CAAAsB,aAAA,CAAC5B,iBAAA,CAAAqC,OAAO;IAACC,EAAE,EAAEC;EAAkC,CAAE,CAAC,EAChE5C,MAAA,CAAAW,OAAA,CAAAsB,aAAA;IAAKE,SAAS,EAAC;EAAgB,GAC5B,CAACZ,OAAO,IAAI,CAACO,SAAS,IACrB9B,MAAA,CAAAW,OAAA,CAAAsB,aAAA,CAAC5B,iBAAA,CAAAwC,WAAW;IACVC,SAAS,EAAEtB,IAAI,EAAEO,oBAAoB,CAAE,CAAC,CAAC,EAAEgB,SAAU;IACrDC,aAAa,EAAE3B;EAAK,CACrB,CAEA,CACL,CAAC;AAEP,CAAC;AAAC4B,OAAA,CAAArC,aAAA,GAAAA,aAAA","ignoreList":[]}
|
|
@@ -7,7 +7,6 @@ exports.CurrencyPowerBalance = void 0;
|
|
|
7
7
|
var _react = _interopRequireDefault(require("react"));
|
|
8
8
|
var _client = require("@apollo/client");
|
|
9
9
|
var _labsWidgetCommon = require("@oanda/labs-widget-common");
|
|
10
|
-
var _monoI18n = require("@oanda/mono-i18n");
|
|
11
10
|
var _Main = require("./Main");
|
|
12
11
|
var _translations = require("../translations");
|
|
13
12
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
@@ -25,23 +24,19 @@ const CurrencyPowerBalance = _ref => {
|
|
|
25
24
|
uri: graphqlUrl,
|
|
26
25
|
cache: new _client.InMemoryCache()
|
|
27
26
|
});
|
|
28
|
-
return _react.default.createElement(_labsWidgetCommon.
|
|
27
|
+
return _react.default.createElement(_labsWidgetCommon.WidgetProvider, {
|
|
28
|
+
locale: locale,
|
|
29
|
+
translations: _translations.translations,
|
|
30
|
+
client: client,
|
|
29
31
|
theme: theme
|
|
30
|
-
}, _react.default.createElement(
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
}
|
|
38
|
-
Component: _react.default.createElement(_Main.Main, {
|
|
39
|
-
timeUnit: timeUnit,
|
|
40
|
-
currencies: currencies
|
|
41
|
-
}),
|
|
42
|
-
logoLink,
|
|
43
|
-
linkArea: 'logo'
|
|
44
|
-
}))));
|
|
32
|
+
}, _react.default.createElement(_labsWidgetCommon.WidgetWrapper, {
|
|
33
|
+
logoLink: logoLink,
|
|
34
|
+
linkArea: "logo",
|
|
35
|
+
isParamError: isParamError
|
|
36
|
+
}, _react.default.createElement(_Main.Main, {
|
|
37
|
+
timeUnit: timeUnit,
|
|
38
|
+
currencies: currencies
|
|
39
|
+
})));
|
|
45
40
|
};
|
|
46
41
|
exports.CurrencyPowerBalance = CurrencyPowerBalance;
|
|
47
42
|
//# sourceMappingURL=CurrencyPowerBalance.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CurrencyPowerBalance.js","names":["_react","_interopRequireDefault","require","_client","_labsWidgetCommon","
|
|
1
|
+
{"version":3,"file":"CurrencyPowerBalance.js","names":["_react","_interopRequireDefault","require","_client","_labsWidgetCommon","_Main","_translations","e","__esModule","default","CurrencyPowerBalance","_ref","graphqlUrl","theme","locale","timeUnit","currencies","isParamError","logoLink","client","ApolloClient","uri","cache","InMemoryCache","createElement","WidgetProvider","translations","WidgetWrapper","linkArea","Main","exports"],"sources":["../../../src/CurrencyPowerBalanceWidget/CurrencyPowerBalance.tsx"],"sourcesContent":["import React from 'react';\nimport { ApolloClient, InMemoryCache } from '@apollo/client';\nimport { WidgetProvider, WidgetWrapper } from '@oanda/labs-widget-common';\nimport { Main } from './Main';\nimport { CurrencyPowerBalanceConfig } from './types';\nimport { translations } from '../translations';\n\nconst CurrencyPowerBalance = ({\n graphqlUrl, theme, locale, timeUnit, currencies, isParamError, logoLink,\n}: CurrencyPowerBalanceConfig) => {\n const client = new ApolloClient({\n uri: graphqlUrl,\n cache: new InMemoryCache(),\n });\n\n return (\n <WidgetProvider\n locale={locale}\n translations={translations}\n client={client}\n theme={theme}\n >\n <WidgetWrapper\n logoLink={logoLink}\n linkArea=\"logo\"\n isParamError={isParamError}\n >\n <Main timeUnit={timeUnit} currencies={currencies} />\n </WidgetWrapper>\n </WidgetProvider>\n );\n};\n\nexport { CurrencyPowerBalance };\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,iBAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AAEA,IAAAI,aAAA,GAAAJ,OAAA;AAA+C,SAAAD,uBAAAM,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAE/C,MAAMG,oBAAoB,GAAGC,IAAA,IAEK;EAAA,IAFJ;IAC5BC,UAAU;IAAEC,KAAK;IAAEC,MAAM;IAAEC,QAAQ;IAAEC,UAAU;IAAEC,YAAY;IAAEC;EACrC,CAAC,GAAAP,IAAA;EAC3B,MAAMQ,MAAM,GAAG,IAAIC,oBAAY,CAAC;IAC9BC,GAAG,EAAET,UAAU;IACfU,KAAK,EAAE,IAAIC,qBAAa,CAAC;EAC3B,CAAC,CAAC;EAEF,OACEvB,MAAA,CAAAS,OAAA,CAAAe,aAAA,CAACpB,iBAAA,CAAAqB,cAAc;IACbX,MAAM,EAAEA,MAAO;IACfY,YAAY,EAAEA,0BAAa;IAC3BP,MAAM,EAAEA,MAAO;IACfN,KAAK,EAAEA;EAAM,GAEbb,MAAA,CAAAS,OAAA,CAAAe,aAAA,CAACpB,iBAAA,CAAAuB,aAAa;IACZT,QAAQ,EAAEA,QAAS;IACnBU,QAAQ,EAAC,MAAM;IACfX,YAAY,EAAEA;EAAa,GAE3BjB,MAAA,CAAAS,OAAA,CAAAe,aAAA,CAACnB,KAAA,CAAAwB,IAAI;IAACd,QAAQ,EAAEA,QAAS;IAACC,UAAU,EAAEA;EAAW,CAAE,CACtC,CACD,CAAC;AAErB,CAAC;AAACc,OAAA,CAAApB,oBAAA,GAAAA,oBAAA","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Main.js","names":["_react","_interopRequireWildcard","require","_labsWidgetCommon","_monoI18n","_graphql","_TimeUnitSwitch","_config","_ChartWithData","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","Main","_ref","timeUnit","currencies","size","
|
|
1
|
+
{"version":3,"file":"Main.js","names":["_react","_interopRequireWildcard","require","_labsWidgetCommon","_monoI18n","_graphql","_TimeUnitSwitch","_config","_ChartWithData","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","Main","_ref","timeUnit","currencies","size","useLayoutProvider","lang","useLocale","selectedTimeUnit","setSelectedTimeUnit","useState","CurrencyPowerBalanceTimeUnit","CurrentDay","createElement","Fragment","className","timeUnitConfig","filter","_ref2","value","map","_ref3","tooltipLabel","label","key","translationKey","count","TimeUnitSwitch","selected","callback","options","ChartWithData","exports"],"sources":["../../../src/CurrencyPowerBalanceWidget/Main.tsx"],"sourcesContent":["import React, { useState } from 'react';\nimport { useLayoutProvider } from '@oanda/labs-widget-common';\nimport { useLocale } from '@oanda/mono-i18n';\nimport { CurrencyPowerBalanceTimeUnit } from '../gql/types/graphql';\nimport { TimeUnitSwitch } from './components/TimeUnitSwitch';\nimport { timeUnitConfig } from './config';\nimport { ChartWithData } from './ChartWithData';\nimport { MainProps } from './types';\n\nconst Main = ({ timeUnit, currencies }: MainProps) => {\n const { size } = useLayoutProvider();\n const { lang } = useLocale();\n const [selectedTimeUnit, setSelectedTimeUnit] = useState(\n timeUnit || CurrencyPowerBalanceTimeUnit.CurrentDay,\n );\n return (\n <>\n {size && (\n <div\n data-testid=\"currency-power-balance-wrapper\"\n className=\"lw-flex lw-flex-col lw-text-sm lw-tracking-normal\"\n >\n {timeUnit && currencies ? (\n <>\n {timeUnitConfig\n .filter(({ value }) => value === selectedTimeUnit)\n .map(({ tooltipLabel, label }) => (\n <div data-testid=\"time-unit-label\" key={label} className=\"lw-mb-6 lw-flex lw-justify-center lw-font-sans lw-text-lg lw-font-bold\">\n {tooltipLabel ? <span>{`${lang(tooltipLabel!.translationKey, { count: tooltipLabel!.count })}`}</span> : <span>{`${lang(label)}`}</span>}\n </div>\n ))}\n </>\n ) : (\n <TimeUnitSwitch\n selected={selectedTimeUnit}\n callback={setSelectedTimeUnit}\n options={timeUnitConfig}\n />\n )}\n <ChartWithData\n timeUnit={selectedTimeUnit}\n currencies={timeUnit && currencies}\n />\n </div>\n )}\n </>\n );\n};\n\nexport { Main };\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,iBAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,eAAA,GAAAJ,OAAA;AACA,IAAAK,OAAA,GAAAL,OAAA;AACA,IAAAM,cAAA,GAAAN,OAAA;AAAgD,SAAAO,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,G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AAEM,gBAAiB;IAC3BL,UAAU,EAAED,QAAQ,IAAIC;EAAW,CACpC,CACE,CAEP,CAAC;AAEP,CAAC;AAAC6B,OAAA,CAAAhC,IAAA,GAAAA,IAAA","ignoreList":[]}
|
|
@@ -32,7 +32,7 @@ const Chart = _ref => {
|
|
|
32
32
|
const {
|
|
33
33
|
isDark,
|
|
34
34
|
size
|
|
35
|
-
} = (0,
|
|
35
|
+
} = (0, _labsWidgetCommon.useLayoutProvider)();
|
|
36
36
|
const isDesktop = size === _labsWidgetCommon.Size.DESKTOP;
|
|
37
37
|
const isMobile = size === _labsWidgetCommon.Size.MOBILE;
|
|
38
38
|
const echartRef = (0, _react.useRef)(null);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Chart.js","names":["_react","_interopRequireWildcard","require","_core","_interopRequireDefault","echarts","_charts","_renderers","_components","_labsWidgetCommon","_monoI18n","_constants","_options","e","__esModule","default","_getRequireWildcardCache","WeakMap","r","t","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","use","GridSimpleComponent","GraphicComponent","TooltipComponent","LegendPlainComponent","LineChart","CanvasRenderer","MarkLineComponent","registerTheme","getChartTheme","Theme","Dark","Light","Chart","_ref","values","timeUnit","currencies","lang","useLocale","isDark","size","
|
|
1
|
+
{"version":3,"file":"Chart.js","names":["_react","_interopRequireWildcard","require","_core","_interopRequireDefault","echarts","_charts","_renderers","_components","_labsWidgetCommon","_monoI18n","_constants","_options","e","__esModule","default","_getRequireWildcardCache","WeakMap","r","t","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","use","GridSimpleComponent","GraphicComponent","TooltipComponent","LegendPlainComponent","LineChart","CanvasRenderer","MarkLineComponent","registerTheme","getChartTheme","Theme","Dark","Light","Chart","_ref","values","timeUnit","currencies","lang","useLocale","isDark","size","useLayoutProvider","isDesktop","Size","DESKTOP","isMobile","MOBILE","echartRef","useRef","chartData","filter","_ref2","currency","includes","useEffect","current","echartInstance","getEchartsInstance","setOption","getResponsiveOption","createElement","ref","theme","style","height","CHART_HEIGHT","width","option","getOption","exports"],"sources":["../../../../../src/CurrencyPowerBalanceWidget/components/Chart/Chart.tsx"],"sourcesContent":["import React, { useRef, useEffect } from 'react';\nimport ReactEChartsCore from 'echarts-for-react/lib/core';\nimport * as echarts from 'echarts/core';\nimport { LineChart } from 'echarts/charts';\nimport { CanvasRenderer } from 'echarts/renderers';\nimport {\n GridSimpleComponent, GraphicComponent, TooltipComponent, LegendPlainComponent, MarkLineComponent,\n} from 'echarts/components';\nimport {\n Theme, useLayoutProvider, getChartTheme, Size,\n} from '@oanda/labs-widget-common';\nimport { useLocale } from '@oanda/mono-i18n';\nimport {\n CHART_HEIGHT,\n} from './options/constants';\nimport { getResponsiveOption, getOption } from './options';\nimport { ChartProps } from './types';\n\necharts.use([\n GridSimpleComponent,\n GraphicComponent,\n TooltipComponent,\n LegendPlainComponent,\n LineChart,\n CanvasRenderer,\n MarkLineComponent,\n]);\n\necharts.registerTheme('dark_theme', getChartTheme(Theme.Dark));\necharts.registerTheme('light_theme', getChartTheme(Theme.Light));\n\nconst Chart = ({ values, timeUnit, currencies }: ChartProps) => {\n const { lang } = useLocale();\n const { isDark, size } = useLayoutProvider();\n const isDesktop = size === Size.DESKTOP;\n const isMobile = size === Size.MOBILE;\n\n const echartRef = useRef(null);\n\n const chartData = currencies\n ? values.filter(({ currency }) => currencies.includes(currency))\n : values;\n\n useEffect(() => {\n if (echartRef.current) {\n // @ts-ignore\n const echartInstance = echartRef.current.getEchartsInstance() as echarts.EChartsType;\n\n echartInstance.setOption(\n getResponsiveOption(isDesktop, isMobile, isDark),\n );\n }\n }, [echartRef, isDesktop, isMobile, isDark]);\n\n return (\n <ReactEChartsCore\n echarts={echarts}\n ref={echartRef}\n theme={isDark ? 'dark_theme' : 'light_theme'}\n style={{\n height: `${CHART_HEIGHT}px`,\n width: '100%',\n }}\n option={getOption(chartData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A,IAAC;MAAEC;IAAS,CAAC,GAAAD,KAAA;IAAA,OAAKf,UAAU,CAACiB,QAAQ,CAACD,QAAQ,CAAC;EAAA,EAAC,GAC9DlB,MAAM;EAEV,IAAAoB,gBAAS,EAAC,MAAM;IACd,IAAIP,SAAS,CAACQ,OAAO,EAAE;MAErB,MAAMC,cAAc,GAAGT,SAAS,CAACQ,OAAO,CAACE,kBAAkB,CAAC,CAAwB;MAEpFD,cAAc,CAACE,SAAS,CACtB,IAAAC,4BAAmB,EAACjB,SAAS,EAAEG,QAAQ,EAAEN,MAAM,CACjD,CAAC;IACH;EACF,CAAC,EAAE,CAACQ,SAAS,EAAEL,SAAS,EAAEG,QAAQ,EAAEN,MAAM,CAAC,CAAC;EAE5C,OACErD,MAAA,CAAAe,OAAA,CAAA2D,aAAA,CAACvE,KAAA,CAAAY,OAAgB;IACfV,OAAO,EAAEA,OAAQ;IACjBsE,GAAG,EAAEd,SAAU;IACfe,KAAK,EAAEvB,MAAM,GAAG,YAAY,GAAG,aAAc;IAC7CwB,KAAK,EAAE;MACLC,MAAM,EAAE,GAAGC,uBAAY,IAAI;MAC3BC,KAAK,EAAE;IACT,CAAE;IACFC,MAAM,EAAE,IAAAC,kBAAS,EAACnB,SAAS,EAAEd,QAAQ,EAAEI,MAAM,EAAEF,IAAI;EAAE,CACtD,CAAC;AAEN,CAAC;AAACgC,OAAA,CAAArC,KAAA,GAAAA,KAAA","ignoreList":[]}
|
|
@@ -4,13 +4,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.TimeUnitSwitch = void 0;
|
|
7
|
-
var _react =
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
8
|
var _labsWidgetCommon = require("@oanda/labs-widget-common");
|
|
9
9
|
var _monoI18n = require("@oanda/mono-i18n");
|
|
10
10
|
var _constants = require("../../constants");
|
|
11
11
|
var _TimeUnitSelect = require("./TimeUnitSelect");
|
|
12
|
-
function
|
|
13
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
12
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
14
13
|
const TimeUnitSwitch = _ref => {
|
|
15
14
|
let {
|
|
16
15
|
selected,
|
|
@@ -22,7 +21,7 @@ const TimeUnitSwitch = _ref => {
|
|
|
22
21
|
} = (0, _monoI18n.useLocale)();
|
|
23
22
|
const {
|
|
24
23
|
size
|
|
25
|
-
} = (0,
|
|
24
|
+
} = (0, _labsWidgetCommon.useLayoutProvider)();
|
|
26
25
|
const isDesktop = size === _labsWidgetCommon.Size.DESKTOP;
|
|
27
26
|
const handleButtonClick = e => {
|
|
28
27
|
callback(e.currentTarget.value);
|
package/dist/main/CurrencyPowerBalanceWidget/components/TimeUnitSwitch/TimeUnitSwitch.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TimeUnitSwitch.js","names":["_react","
|
|
1
|
+
{"version":3,"file":"TimeUnitSwitch.js","names":["_react","_interopRequireDefault","require","_labsWidgetCommon","_monoI18n","_constants","_TimeUnitSelect","e","__esModule","default","TimeUnitSwitch","_ref","selected","options","callback","lang","useLocale","size","useLayoutProvider","isDesktop","Size","DESKTOP","handleButtonClick","currentTarget","value","createElement","Fragment","className","map","_ref2","label","tooltipLabel","tooltip","translationKey","count","buttonLabel","Button","key","ButtonSize","full","variant","ButtonVariant","primary","secondary","onClick","CURRENCY_POWER_BALANCE_TOOLTIP_ID","TimeUnitSelect","exports"],"sources":["../../../../../src/CurrencyPowerBalanceWidget/components/TimeUnitSwitch/TimeUnitSwitch.tsx"],"sourcesContent":["import React from 'react';\nimport {\n Button, ButtonSize, ButtonVariant, useLayoutProvider, Size,\n} from '@oanda/labs-widget-common';\nimport { useLocale } from '@oanda/mono-i18n';\nimport { TimeUnitSwitchProps } from './types';\nimport { CurrencyPowerBalanceTimeUnit } from '../../../gql/types/graphql';\nimport { CURRENCY_POWER_BALANCE_TOOLTIP_ID } from '../../constants';\nimport { TimeUnitSelect } from './TimeUnitSelect';\n\nconst TimeUnitSwitch = ({\n selected, options, callback,\n}: TimeUnitSwitchProps) => {\n const { lang } = useLocale();\n const { size } = useLayoutProvider();\n const isDesktop = size === Size.DESKTOP;\n\n const handleButtonClick = (e: React.SyntheticEvent<HTMLButtonElement>) => {\n callback(e.currentTarget.value as CurrencyPowerBalanceTimeUnit);\n };\n\n return (\n <>\n {isDesktop\n ? (\n <div data-testid=\"time-unit-switch\" className=\"lw-mb-6 lw-flex lw-gap-1 lw-self-end\">\n {options.map(({ value, label, tooltipLabel }) => {\n const tooltip = tooltipLabel\n ? lang(tooltipLabel.translationKey, { count: tooltipLabel.count })\n : tooltipLabel;\n const buttonLabel = lang(label);\n\n return (\n <Button\n key={value}\n size={ButtonSize.full}\n variant={selected === value\n ? ButtonVariant.primary\n : ButtonVariant.secondary}\n onClick={handleButtonClick}\n value={value}\n data-tooltip-id={CURRENCY_POWER_BALANCE_TOOLTIP_ID}\n data-tooltip-content={tooltip}\n >\n {buttonLabel}\n </Button>\n );\n })}\n </div>\n )\n : (\n <TimeUnitSelect\n selected={selected}\n callback={callback}\n options={options}\n />\n )}\n </>\n );\n};\n\nexport { TimeUnitSwitch };\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,iBAAA,GAAAD,OAAA;AAGA,IAAAE,SAAA,GAAAF,OAAA;AAGA,IAAAG,UAAA,GAAAH,OAAA;AACA,IAAAI,eAA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a,CAACC,OAAO,GACrBD,+BAAa,CAACE,SAAU;MAC5BC,OAAO,EAAEtB,iBAAkB;MAC3BE,KAAK,EAAEA,KAAM;MACb,mBAAiBqB,4CAAkC;MACnD,wBAAsBb;IAAQ,GAE7BG,WACK,CAAC;EAEb,CAAC,CACE,CAAC,GAGNnC,MAAA,CAAAS,OAAA,CAAAgB,aAAA,CAACnB,eAAA,CAAAwC,cAAc;IACblC,QAAQ,EAAEA,QAAS;IACnBE,QAAQ,EAAEA,QAAS;IACnBD,OAAO,EAAEA;EAAQ,CAClB,CAEL,CAAC;AAEP,CAAC;AAACkC,OAAA,CAAArC,cAAA,GAAAA,cAAA","ignoreList":[]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import React
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import { useQuery } from '@apollo/client';
|
|
3
3
|
import { useLocale } from '@oanda/mono-i18n';
|
|
4
|
-
import { ChartError, Spinner, SpinnerSize,
|
|
4
|
+
import { ChartError, Spinner, SpinnerSize, useLayoutProvider, Tooltip, Size, LastUpdated } from '@oanda/labs-widget-common';
|
|
5
5
|
import { Chart } from './components/Chart';
|
|
6
6
|
import { CURRENCY_POWER_BALANCE_TOOLTIP_ID } from './constants';
|
|
7
7
|
import { getCurrencyPowerBalance } from '../gql/getCurrencyPowerBalance';
|
|
@@ -12,7 +12,7 @@ const ChartWithData = _ref => {
|
|
|
12
12
|
} = _ref;
|
|
13
13
|
const {
|
|
14
14
|
size
|
|
15
|
-
} =
|
|
15
|
+
} = useLayoutProvider();
|
|
16
16
|
const isDesktop = size === Size.DESKTOP;
|
|
17
17
|
const {
|
|
18
18
|
lang
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChartWithData.js","names":["React","
|
|
1
|
+
{"version":3,"file":"ChartWithData.js","names":["React","useQuery","useLocale","ChartError","Spinner","SpinnerSize","useLayoutProvider","Tooltip","Size","LastUpdated","Chart","CURRENCY_POWER_BALANCE_TOOLTIP_ID","getCurrencyPowerBalance","ChartWithData","_ref","timeUnit","currencies","size","isDesktop","DESKTOP","lang","loading","data","error","variables","fetchPolicy","showError","currencyPowerBalance","length","createElement","Fragment","className","lg","values","id","timestamp","updatedAt","labelCallback"],"sources":["../../../src/CurrencyPowerBalanceWidget/ChartWithData.tsx"],"sourcesContent":["import React from 'react';\nimport { useQuery } from '@apollo/client';\nimport { useLocale } from '@oanda/mono-i18n';\nimport {\n ChartError, Spinner, SpinnerSize, useLayoutProvider, Tooltip, Size,\n LastUpdated,\n} from '@oanda/labs-widget-common';\nimport { Chart } from './components/Chart';\nimport { CURRENCY_POWER_BALANCE_TOOLTIP_ID } from './constants';\nimport { getCurrencyPowerBalance } from '../gql/getCurrencyPowerBalance';\nimport { ChartWithDataProps } from './types';\nimport { GetCurrencyPowerBalanceQuery, GetCurrencyPowerBalanceQueryVariables } from '../gql/types/graphql';\n\nconst ChartWithData = ({ timeUnit, currencies }: ChartWithDataProps) => {\n const { size } = useLayoutProvider();\n const isDesktop = size === Size.DESKTOP;\n const { lang } = useLocale();\n const { loading, data, error } = useQuery<\n GetCurrencyPowerBalanceQuery,\n GetCurrencyPowerBalanceQueryVariables\n >(getCurrencyPowerBalance, {\n variables: {\n timeUnit,\n },\n fetchPolicy: 'cache-and-network',\n });\n\n const showError = data?.currencyPowerBalance?.length === 0 || error\n || (currencies && (currencies.length === 0 || currencies.length === 1));\n\n return (\n <>\n {loading\n && (\n <div className=\"lw-mb-[50px] lw-flex lw-h-[375px] lw-w-full lw-items-center lw-border lw-border-solid lw-border-border-primary\">\n <Spinner size={SpinnerSize.lg} />\n </div>\n )}\n {!loading && !showError && (\n <Chart values={data?.currencyPowerBalance!} timeUnit={timeUnit} currencies={currencies} />\n )}\n {!loading && showError && (\n <div className=\"lw-flex lw-h-[375px] lw-w-full lw-items-center lw-border lw-border-solid lw-border-border-primary\">\n <ChartError />\n </div>\n )}\n {isDesktop && <Tooltip id={CURRENCY_POWER_BALANCE_TOOLTIP_ID} />}\n <div className=\"lw-mt-2 lw-h-8\">\n {!loading && !showError && (\n <LastUpdated\n timestamp={data?.currencyPowerBalance![0]?.updatedAt}\n labelCallback={lang}\n />\n )}\n </div>\n </>\n );\n};\n\nexport { ChartWithData };\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,QAAQ,QAAQ,gBAAgB;AACzC,SAASC,SAAS,QAAQ,kBAAkB;AAC5C,SACEC,UAAU,EAAEC,OAAO,EAAEC,WAAW,EAAEC,iBAAiB,EAAEC,OAAO,EAAEC,IAAI,EAClEC,WAAW,QACN,2BAA2B;AAClC,SAASC,KAAK,QAAQ,oBAAoB;AAC1C,SAASC,iCAAiC,QAAQ,aAAa;AAC/D,SAASC,uBAAuB,QAAQ,gCAAgC;AAIxE,MAAMC,aAAa,GAAGC,IAAA,IAAkD;EAAA,IAAjD;IAAEC,QAAQ;IAAEC;EAA+B,CAAC,GAAAF,IAAA;EACjE,MAAM;IAAEG;EAAK,CAAC,GAAGX,iBAAiB,CAAC,CAAC;EACpC,MAAMY,SAAS,GAAGD,IAAI,KAAKT,IAAI,CAACW,OAAO;EACvC,MAAM;IAAEC;EAAK,CAAC,GAAGlB,SAAS,CAAC,CAAC;EAC5B,MAAM;IAAEmB,OAAO;IAAEC,IAAI;IAAEC;EAAM,CAAC,GAAGtB,QAAQ,CAGvCW,uBAAuB,EAAE;IACzBY,SAAS,EAAE;MACTT;IACF,CAAC;IACDU,WAAW,EAAE;EACf,CAAC,CAAC;EAEF,MAAMC,SAAS,GAAGJ,IAAI,EAAEK,oBAAoB,EAAEC,MAAM,KAAK,CAAC,IAAIL,KAAK,IAC7DP,UAAU,KAAKA,UAAU,CAACY,MAAM,KAAK,CAAC,IAAIZ,UAAU,CAACY,MAAM,KAAK,CAAC,CAAE;EAEzE,OACE5B,KAAA,CAAA6B,aAAA,CAAA7B,KAAA,CAAA8B,QAAA,QACGT,OAAO,IAERrB,KAAA,CAAA6B,aAAA;IAAKE,SAAS,EAAC;EAAgH,GAC7H/B,KAAA,CAAA6B,aAAA,CAACzB,OAAO;IAACa,IAAI,EAAEZ,WAAW,CAAC2B;EAAG,CAAE,CAC7B,CACJ,EACA,CAACX,OAAO,IAAI,CAACK,SAAS,IACrB1B,KAAA,CAAA6B,aAAA,CAACnB,KAAK;IAACuB,MAAM,EAAEX,IAAI,EAAEK,oBAAsB;IAACZ,QAAQ,EAAEA,QAAS;IAACC,UAAU,EAAEA;EAAW,CAAE,CAC1F,EACA,CAACK,OAAO,IAAIK,SAAS,IACpB1B,KAAA,CAAA6B,aAAA;IAAKE,SAAS,EAAC;EAAmG,GAChH/B,KAAA,CAAA6B,aAAA,CAAC1B,UAAU,MAAE,CACV,CACN,EACAe,SAAS,IAAIlB,KAAA,CAAA6B,aAAA,CAACtB,OAAO;IAAC2B,EAAE,EAAEvB;EAAkC,CAAE,CAAC,EAChEX,KAAA,CAAA6B,aAAA;IAAKE,SAAS,EAAC;EAAgB,GAC5B,CAACV,OAAO,IAAI,CAACK,SAAS,IACrB1B,KAAA,CAAA6B,aAAA,CAACpB,WAAW;IACV0B,SAAS,EAAEb,IAAI,EAAEK,oBAAoB,CAAE,CAAC,CAAC,EAAES,SAAU;IACrDC,aAAa,EAAEjB;EAAK,CACrB,CAEA,CACL,CAAC;AAEP,CAAC;AAED,SAASP,aAAa","ignoreList":[]}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { ApolloClient, InMemoryCache
|
|
3
|
-
import {
|
|
4
|
-
import { LocaleProvider } from '@oanda/mono-i18n';
|
|
2
|
+
import { ApolloClient, InMemoryCache } from '@apollo/client';
|
|
3
|
+
import { WidgetProvider, WidgetWrapper } from '@oanda/labs-widget-common';
|
|
5
4
|
import { Main } from './Main';
|
|
6
5
|
import { translations } from '../translations';
|
|
7
6
|
const CurrencyPowerBalance = _ref => {
|
|
@@ -18,23 +17,19 @@ const CurrencyPowerBalance = _ref => {
|
|
|
18
17
|
uri: graphqlUrl,
|
|
19
18
|
cache: new InMemoryCache()
|
|
20
19
|
});
|
|
21
|
-
return React.createElement(
|
|
20
|
+
return React.createElement(WidgetProvider, {
|
|
21
|
+
locale: locale,
|
|
22
|
+
translations: translations,
|
|
23
|
+
client: client,
|
|
22
24
|
theme: theme
|
|
23
|
-
}, React.createElement(
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
}
|
|
31
|
-
Component: React.createElement(Main, {
|
|
32
|
-
timeUnit: timeUnit,
|
|
33
|
-
currencies: currencies
|
|
34
|
-
}),
|
|
35
|
-
logoLink,
|
|
36
|
-
linkArea: 'logo'
|
|
37
|
-
}))));
|
|
25
|
+
}, React.createElement(WidgetWrapper, {
|
|
26
|
+
logoLink: logoLink,
|
|
27
|
+
linkArea: "logo",
|
|
28
|
+
isParamError: isParamError
|
|
29
|
+
}, React.createElement(Main, {
|
|
30
|
+
timeUnit: timeUnit,
|
|
31
|
+
currencies: currencies
|
|
32
|
+
})));
|
|
38
33
|
};
|
|
39
34
|
export { CurrencyPowerBalance };
|
|
40
35
|
//# sourceMappingURL=CurrencyPowerBalance.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CurrencyPowerBalance.js","names":["React","ApolloClient","InMemoryCache","
|
|
1
|
+
{"version":3,"file":"CurrencyPowerBalance.js","names":["React","ApolloClient","InMemoryCache","WidgetProvider","WidgetWrapper","Main","translations","CurrencyPowerBalance","_ref","graphqlUrl","theme","locale","timeUnit","currencies","isParamError","logoLink","client","uri","cache","createElement","linkArea"],"sources":["../../../src/CurrencyPowerBalanceWidget/CurrencyPowerBalance.tsx"],"sourcesContent":["import React from 'react';\nimport { ApolloClient, InMemoryCache } from '@apollo/client';\nimport { WidgetProvider, WidgetWrapper } from '@oanda/labs-widget-common';\nimport { Main } from './Main';\nimport { CurrencyPowerBalanceConfig } from './types';\nimport { translations } from '../translations';\n\nconst CurrencyPowerBalance = ({\n graphqlUrl, theme, locale, timeUnit, currencies, isParamError, logoLink,\n}: CurrencyPowerBalanceConfig) => {\n const client = new ApolloClient({\n uri: graphqlUrl,\n cache: new InMemoryCache(),\n });\n\n return (\n <WidgetProvider\n locale={locale}\n translations={translations}\n client={client}\n theme={theme}\n >\n <WidgetWrapper\n logoLink={logoLink}\n linkArea=\"logo\"\n isParamError={isParamError}\n >\n <Main timeUnit={timeUnit} currencies={currencies} />\n </WidgetWrapper>\n </WidgetProvider>\n );\n};\n\nexport { CurrencyPowerBalance };\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,YAAY,EAAEC,aAAa,QAAQ,gBAAgB;AAC5D,SAASC,cAAc,EAAEC,aAAa,QAAQ,2BAA2B;AACzE,SAASC,IAAI,QAAQ,QAAQ;AAE7B,SAASC,YAAY,QAAQ,iBAAiB;AAE9C,MAAMC,oBAAoB,GAAGC,IAAA,IAEK;EAAA,IAFJ;IAC5BC,UAAU;IAAEC,KAAK;IAAEC,MAAM;IAAEC,QAAQ;IAAEC,UAAU;IAAEC,YAAY;IAAEC;EACrC,CAAC,GAAAP,IAAA;EAC3B,MAAMQ,MAAM,GAAG,IAAIf,YAAY,CAAC;IAC9BgB,GAAG,EAAER,UAAU;IACfS,KAAK,EAAE,IAAIhB,aAAa,CAAC;EAC3B,CAAC,CAAC;EAEF,OACEF,KAAA,CAAAmB,aAAA,CAAChB,cAAc;IACbQ,MAAM,EAAEA,MAAO;IACfL,YAAY,EAAEA,YAAa;IAC3BU,MAAM,EAAEA,MAAO;IACfN,KAAK,EAAEA;EAAM,GAEbV,KAAA,CAAAmB,aAAA,CAACf,aAAa;IACZW,QAAQ,EAAEA,QAAS;IACnBK,QAAQ,EAAC,MAAM;IACfN,YAAY,EAAEA;EAAa,GAE3Bd,KAAA,CAAAmB,aAAA,CAACd,IAAI;IAACO,QAAQ,EAAEA,QAAS;IAACC,UAAU,EAAEA;EAAW,CAAE,CACtC,CACD,CAAC;AAErB,CAAC;AAED,SAASN,oBAAoB","ignoreList":[]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import React, {
|
|
2
|
-
import {
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import { useLayoutProvider } from '@oanda/labs-widget-common';
|
|
3
3
|
import { useLocale } from '@oanda/mono-i18n';
|
|
4
4
|
import { CurrencyPowerBalanceTimeUnit } from '../gql/types/graphql';
|
|
5
5
|
import { TimeUnitSwitch } from './components/TimeUnitSwitch';
|
|
@@ -12,7 +12,7 @@ const Main = _ref => {
|
|
|
12
12
|
} = _ref;
|
|
13
13
|
const {
|
|
14
14
|
size
|
|
15
|
-
} =
|
|
15
|
+
} = useLayoutProvider();
|
|
16
16
|
const {
|
|
17
17
|
lang
|
|
18
18
|
} = useLocale();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Main.js","names":["React","
|
|
1
|
+
{"version":3,"file":"Main.js","names":["React","useState","useLayoutProvider","useLocale","CurrencyPowerBalanceTimeUnit","TimeUnitSwitch","timeUnitConfig","ChartWithData","Main","_ref","timeUnit","currencies","size","lang","selectedTimeUnit","setSelectedTimeUnit","CurrentDay","createElement","Fragment","className","filter","_ref2","value","map","_ref3","tooltipLabel","label","key","translationKey","count","selected","callback","options"],"sources":["../../../src/CurrencyPowerBalanceWidget/Main.tsx"],"sourcesContent":["import React, { useState } from 'react';\nimport { useLayoutProvider } from '@oanda/labs-widget-common';\nimport { useLocale } from '@oanda/mono-i18n';\nimport { CurrencyPowerBalanceTimeUnit } from '../gql/types/graphql';\nimport { TimeUnitSwitch } from './components/TimeUnitSwitch';\nimport { timeUnitConfig } from './config';\nimport { ChartWithData } from './ChartWithData';\nimport { MainProps } from './types';\n\nconst Main = ({ timeUnit, currencies }: MainProps) => {\n const { size } = useLayoutProvider();\n const { lang } = useLocale();\n const [selectedTimeUnit, setSelectedTimeUnit] = useState(\n timeUnit || CurrencyPowerBalanceTimeUnit.CurrentDay,\n );\n return (\n <>\n {size && (\n <div\n data-testid=\"currency-power-balance-wrapper\"\n className=\"lw-flex lw-flex-col lw-text-sm lw-tracking-normal\"\n >\n {timeUnit && currencies ? (\n <>\n {timeUnitConfig\n .filter(({ value }) => value === selectedTimeUnit)\n .map(({ tooltipLabel, label }) => (\n <div data-testid=\"time-unit-label\" key={label} className=\"lw-mb-6 lw-flex lw-justify-center lw-font-sans lw-text-lg lw-font-bold\">\n {tooltipLabel ? <span>{`${lang(tooltipLabel!.translationKey, { count: tooltipLabel!.count })}`}</span> : <span>{`${lang(label)}`}</span>}\n </div>\n ))}\n </>\n ) : (\n <TimeUnitSwitch\n selected={selectedTimeUnit}\n callback={setSelectedTimeUnit}\n options={timeUnitConfig}\n />\n )}\n <ChartWithData\n timeUnit={selectedTimeUnit}\n currencies={timeUnit && currencies}\n />\n </div>\n )}\n </>\n );\n};\n\nexport { Main };\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,QAAQ,QAAQ,OAAO;AACvC,SAASC,iBAAiB,QAAQ,2BAA2B;AAC7D,SAASC,SAAS,QAAQ,kBAAkB;AAC5C,SAASC,4BAA4B,QAAQ,sBAAsB;AACnE,SAASC,cAAc,QAAQ,6BAA6B;AAC5D,SAASC,cAAc,QAAQ,UAAU;AACzC,SAASC,aAAa,QAAQ,iBAAiB;AAG/C,MAAMC,IAAI,GAAGC,IAAA,IAAyC;EAAA,IAAxC;IAAEC,QAAQ;IAAEC;EAAsB,CAAC,GAAAF,IAAA;EAC/C,MAAM;IAAEG;EAAK,CAAC,GAAGV,iBAAiB,CAAC,CAAC;EACpC,MAAM;IAAEW;EAAK,CAAC,GAAGV,SAAS,CAAC,CAAC;EAC5B,MAAM,CAACW,gBAAgB,EAAEC,mBAAmB,CAAC,GAAGd,QAAQ,CACtDS,QAAQ,IAAIN,4BAA4B,CAACY,UAC3C,CAAC;EACD,OACEhB,KAAA,CAAAiB,aAAA,CAAAjB,KAAA,CAAAkB,QAAA,QACGN,IAAI,IACHZ,KAAA,CAAAiB,aAAA;IACE,eAAY,gCAAgC;IAC5CE,SAAS,EAAC;EAAmD,GAE5DT,QAAQ,IAAIC,UAAU,GACrBX,KAAA,CAAAiB,aAAA,CAAAjB,KAAA,CAAAkB,QAAA,QACGZ,cAAc,CACZc,MAAM,CAACC,KAAA;IAAA,IAAC;MAAEC;IAAM,CAAC,GAAAD,KAAA;IAAA,OAAKC,KAAK,KAAKR,gBAAgB;EAAA,EAAC,CACjDS,GAAG,CAACC,KAAA;IAAA,IAAC;MAAEC,YAAY;MAAEC;IAAM,CAAC,GAAAF,KAAA;IAAA,OAC3BxB,KAAA,CAAAiB,aAAA;MAAK,eAAY,iBAAiB;MAACU,GAAG,EAAED,KAAM;MAACP,SAAS,EAAC;IAAwE,GAC9HM,YAAY,GAAGzB,KAAA,CAAAiB,aAAA,eAAO,GAAGJ,IAAI,CAACY,YAAY,CAAEG,cAAc,EAAE;MAAEC,KAAK,EAAEJ,YAAY,CAAEI;IAAM,CAAC,CAAC,EAAS,CAAC,GAAG7B,KAAA,CAAAiB,aAAA,eAAO,GAAGJ,IAAI,CAACa,KAAK,CAAC,EAAS,CACpI,CAAC;EAAA,CACP,CACH,CAAC,GAEH1B,KAAA,CAAAiB,aAAA,CAACZ,cAAc;IACbyB,QAAQ,EAAEhB,gBAAiB;IAC3BiB,QAAQ,EAAEhB,mBAAoB;IAC9BiB,OAAO,EAAE1B;EAAe,CACzB,CACF,EACDN,KAAA,CAAAiB,aAAA,CAACV,aAAa;IACZG,QAAQ,EAAEI,gBAAiB;IAC3BH,UAAU,EAAED,QAAQ,IAAIC;EAAW,CACpC,CACE,CAEP,CAAC;AAEP,CAAC;AAED,SAASH,IAAI","ignoreList":[]}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import React, { useRef, useEffect
|
|
1
|
+
import React, { useRef, useEffect } from 'react';
|
|
2
2
|
import ReactEChartsCore from 'echarts-for-react/lib/core';
|
|
3
3
|
import * as echarts from 'echarts/core';
|
|
4
4
|
import { LineChart } from 'echarts/charts';
|
|
5
5
|
import { CanvasRenderer } from 'echarts/renderers';
|
|
6
6
|
import { GridSimpleComponent, GraphicComponent, TooltipComponent, LegendPlainComponent, MarkLineComponent } from 'echarts/components';
|
|
7
|
-
import { Theme,
|
|
7
|
+
import { Theme, useLayoutProvider, getChartTheme, Size } from '@oanda/labs-widget-common';
|
|
8
8
|
import { useLocale } from '@oanda/mono-i18n';
|
|
9
9
|
import { CHART_HEIGHT } from './options/constants';
|
|
10
10
|
import { getResponsiveOption, getOption } from './options';
|
|
@@ -23,7 +23,7 @@ const Chart = _ref => {
|
|
|
23
23
|
const {
|
|
24
24
|
isDark,
|
|
25
25
|
size
|
|
26
|
-
} =
|
|
26
|
+
} = useLayoutProvider();
|
|
27
27
|
const isDesktop = size === Size.DESKTOP;
|
|
28
28
|
const isMobile = size === Size.MOBILE;
|
|
29
29
|
const echartRef = useRef(null);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Chart.js","names":["React","useRef","useEffect","
|
|
1
|
+
{"version":3,"file":"Chart.js","names":["React","useRef","useEffect","ReactEChartsCore","echarts","LineChart","CanvasRenderer","GridSimpleComponent","GraphicComponent","TooltipComponent","LegendPlainComponent","MarkLineComponent","Theme","useLayoutProvider","getChartTheme","Size","useLocale","CHART_HEIGHT","getResponsiveOption","getOption","use","registerTheme","Dark","Light","Chart","_ref","values","timeUnit","currencies","lang","isDark","size","isDesktop","DESKTOP","isMobile","MOBILE","echartRef","chartData","filter","_ref2","currency","includes","current","echartInstance","getEchartsInstance","setOption","createElement","ref","theme","style","height","width","option"],"sources":["../../../../../src/CurrencyPowerBalanceWidget/components/Chart/Chart.tsx"],"sourcesContent":["import React, { useRef, useEffect } from 'react';\nimport ReactEChartsCore from 'echarts-for-react/lib/core';\nimport * as echarts from 'echarts/core';\nimport { LineChart } from 'echarts/charts';\nimport { CanvasRenderer } from 'echarts/renderers';\nimport {\n GridSimpleComponent, GraphicComponent, TooltipComponent, LegendPlainComponent, MarkLineComponent,\n} from 'echarts/components';\nimport {\n Theme, useLayoutProvider, getChartTheme, Size,\n} from '@oanda/labs-widget-common';\nimport { useLocale } from '@oanda/mono-i18n';\nimport {\n CHART_HEIGHT,\n} from './options/constants';\nimport { getResponsiveOption, getOption } from './options';\nimport { ChartProps } from './types';\n\necharts.use([\n GridSimpleComponent,\n GraphicComponent,\n TooltipComponent,\n LegendPlainComponent,\n LineChart,\n CanvasRenderer,\n MarkLineComponent,\n]);\n\necharts.registerTheme('dark_theme', getChartTheme(Theme.Dark));\necharts.registerTheme('light_theme', getChartTheme(Theme.Light));\n\nconst Chart = ({ values, timeUnit, currencies }: ChartProps) => {\n const { lang } = useLocale();\n const { isDark, size } = useLayoutProvider();\n const isDesktop = size === Size.DESKTOP;\n const isMobile = size === Size.MOBILE;\n\n const echartRef = useRef(null);\n\n const chartData = currencies\n ? values.filter(({ currency }) => currencies.includes(currency))\n : values;\n\n useEffect(() => {\n if (echartRef.current) {\n // @ts-ignore\n const echartInstance = echartRef.current.getEchartsInstance() as echarts.EChartsType;\n\n echartInstance.setOption(\n getResponsiveOption(isDesktop, isMobile, isDark),\n );\n }\n }, [echartRef, isDesktop, isMobile, isDark]);\n\n return (\n <ReactEChartsCore\n echarts={echarts}\n ref={echartRef}\n theme={isDark ? 'dark_theme' : 'light_theme'}\n style={{\n height: `${CHART_HEIGHT}px`,\n width: '100%',\n }}\n option={getOption(chartData, timeUnit, isDark, lang)}\n />\n );\n};\n\nexport { Chart };\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,MAAM,EAAEC,SAAS,QAAQ,OAAO;AAChD,OAAOC,gBAAgB,MAAM,4BAA4B;AACzD,OAAO,KAAKC,OAAO,MAAM,cAAc;AACvC,SAASC,SAAS,QAAQ,gBAAgB;AAC1C,SAASC,cAAc,QAAQ,mBAAmB;AAClD,SACEC,mBAAmB,EAAEC,gBAAgB,EAAEC,gBAAgB,EAAEC,oBAAoB,EAAEC,iBAAiB,QAC3F,oBAAoB;AAC3B,SACEC,KAAK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AAkB,CAAC,CAAwB;MAEpFD,cAAc,CAACE,SAAS,CACtB3B,mBAAmB,CAACc,SAAS,EAAEE,QAAQ,EAAEJ,MAAM,CACjD,CAAC;IACH;EACF,CAAC,EAAE,CAACM,SAAS,EAAEJ,SAAS,EAAEE,QAAQ,EAAEJ,MAAM,CAAC,CAAC;EAE5C,OACE9B,KAAA,CAAA8C,aAAA,CAAC3C,gBAAgB;IACfC,OAAO,EAAEA,OAAQ;IACjB2C,GAAG,EAAEX,SAAU;IACfY,KAAK,EAAElB,MAAM,GAAG,YAAY,GAAG,aAAc;IAC7CmB,KAAK,EAAE;MACLC,MAAM,EAAE,GAAGjC,YAAY,IAAI;MAC3BkC,KAAK,EAAE;IACT,CAAE;IACFC,MAAM,EAAEjC,SAAS,CAACkB,SAAS,EAAEV,QAAQ,EAAEG,MAAM,EAAED,IAAI;EAAE,CACtD,CAAC;AAEN,CAAC;AAED,SAASL,KAAK","ignoreList":[]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import React
|
|
2
|
-
import { Button, ButtonSize, ButtonVariant,
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Button, ButtonSize, ButtonVariant, useLayoutProvider, Size } from '@oanda/labs-widget-common';
|
|
3
3
|
import { useLocale } from '@oanda/mono-i18n';
|
|
4
4
|
import { CURRENCY_POWER_BALANCE_TOOLTIP_ID } from '../../constants';
|
|
5
5
|
import { TimeUnitSelect } from './TimeUnitSelect';
|
|
@@ -14,7 +14,7 @@ const TimeUnitSwitch = _ref => {
|
|
|
14
14
|
} = useLocale();
|
|
15
15
|
const {
|
|
16
16
|
size
|
|
17
|
-
} =
|
|
17
|
+
} = useLayoutProvider();
|
|
18
18
|
const isDesktop = size === Size.DESKTOP;
|
|
19
19
|
const handleButtonClick = e => {
|
|
20
20
|
callback(e.currentTarget.value);
|
package/dist/module/CurrencyPowerBalanceWidget/components/TimeUnitSwitch/TimeUnitSwitch.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TimeUnitSwitch.js","names":["React","
|
|
1
|
+
{"version":3,"file":"TimeUnitSwitch.js","names":["React","Button","ButtonSize","ButtonVariant","useLayoutProvider","Size","useLocale","CURRENCY_POWER_BALANCE_TOOLTIP_ID","TimeUnitSelect","TimeUnitSwitch","_ref","selected","options","callback","lang","size","isDesktop","DESKTOP","handleButtonClick","e","currentTarget","value","createElement","Fragment","className","map","_ref2","label","tooltipLabel","tooltip","translationKey","count","buttonLabel","key","full","variant","primary","secondary","onClick"],"sources":["../../../../../src/CurrencyPowerBalanceWidget/components/TimeUnitSwitch/TimeUnitSwitch.tsx"],"sourcesContent":["import React from 'react';\nimport {\n Button, ButtonSize, ButtonVariant, useLayoutProvider, Size,\n} from '@oanda/labs-widget-common';\nimport { useLocale } from '@oanda/mono-i18n';\nimport { TimeUnitSwitchProps } from './types';\nimport { CurrencyPowerBalanceTimeUnit } from '../../../gql/types/graphql';\nimport { CURRENCY_POWER_BALANCE_TOOLTIP_ID } from '../../constants';\nimport { TimeUnitSelect } from './TimeUnitSelect';\n\nconst TimeUnitSwitch = ({\n selected, options, callback,\n}: TimeUnitSwitchProps) => {\n const { lang } = useLocale();\n const { size } = useLayoutProvider();\n const isDesktop = size === Size.DESKTOP;\n\n const handleButtonClick = (e: React.SyntheticEvent<HTMLButtonElement>) => {\n callback(e.currentTarget.value as CurrencyPowerBalanceTimeUnit);\n };\n\n return (\n <>\n {isDesktop\n ? (\n <div data-testid=\"time-unit-switch\" className=\"lw-mb-6 lw-flex lw-gap-1 lw-self-end\">\n {options.map(({ value, label, tooltipLabel }) => {\n const tooltip = tooltipLabel\n ? lang(tooltipLabel.translationKey, { count: tooltipLabel.count })\n : tooltipLabel;\n const buttonLabel = lang(label);\n\n return (\n <Button\n key={value}\n size={ButtonSize.full}\n variant={selected === value\n ? ButtonVariant.primary\n : ButtonVariant.secondary}\n onClick={handleButtonClick}\n value={value}\n data-tooltip-id={CURRENCY_POWER_BALANCE_TOOLTIP_ID}\n data-tooltip-content={tooltip}\n >\n {buttonLabel}\n </Button>\n );\n })}\n </div>\n )\n : (\n <TimeUnitSelect\n selected={selected}\n callback={callback}\n options={options}\n />\n )}\n </>\n );\n};\n\nexport { TimeUnitSwitch };\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SACEC,MAAM,EAAEC,UAAU,EAAEC,aAAa,EAAEC,iBAAiB,EAAEC,IAAI,QACrD,2BAA2B;AAClC,SAASC,SAAS,QAAQ,kBAAkB;AAG5C,SAASC,iCAAiC,QAAQ,iBAAiB;AACnE,SAASC,cAAc,QAAQ,kBAAkB;AAEjD,MAAMC,cAAc,GAAGC,IAAA,IAEI;EAAA,IAFH;IACtBC,QAAQ;IAAEC,OAAO;IAAEC;EACA,CAAC,GAAAH,IAAA;EACpB,MAAM;IAAEI;EAAK,CAAC,GAAGR,SAAS,CAAC,CAAC;EAC5B,MAAM;IAAES;EAAK,CAAC,GAAGX,iBAAiB,CAAC,CAAC;EACpC,MAAMY,SAAS,GAAGD,IAAI,KAAKV,IAAI,CAACY,OAAO;EAEvC,MAAMC,iBAAiB,GAAIC,CAA0C,IAAK;IACxEN,QAAQ,CAACM,CAAC,CAACC,aAAa,CAACC,KAAqC,CAAC;EACjE,CAAC;EAED,OACErB,KAAA,CAAAsB,aAAA,CAAAtB,KAAA,CAAAuB,QAAA,QACGP,SAAS,GAENhB,KAAA,CAAAsB,aAAA;IAAK,eAAY,kBAAkB;IAACE,SAAS,EAAC;EAAsC,GACjFZ,OAAO,CAACa,GAAG,CAACC,KAAA,IAAoC;IAAA,IAAnC;MAAEL,KAAK;MAAEM,KAAK;MAAEC;IAAa,CAAC,GAAAF,KAAA;IAC1C,MAAMG,OAAO,GAAGD,YAAY,GACxBd,IAAI,CAACc,YAAY,CAACE,cAAc,EAAE;MAAEC,KAAK,EAAEH,YAAY,CAACG;IAAM,CAAC,CAAC,GAChEH,YAAY;IAChB,MAAMI,WAAW,GAAGlB,IAAI,CAACa,KAAK,CAAC;IAE/B,OACE3B,KAAA,CAAAsB,aAAA,CAACrB,MAAM;MACLgC,GAAG,EAAEZ,KAAM;MACXN,IAAI,EAAEb,UAAU,CAACgC,IAAK;MACtBC,OAAO,EAAExB,QAAQ,KAAKU,KAAK,GACvBlB,aAAa,CAACiC,OAAO,GACrBjC,aAAa,CAACkC,SAAU;MAC5BC,OAAO,EAAEpB,iBAAkB;MAC3BG,KAAK,EAAEA,KAAM;MACb,mBAAiBd,iCAAkC;MACnD,wBAAsBsB;IAAQ,GAE7BG,WACK,CAAC;EAEb,CAAC,CACE,CAAC,GAGNhC,KAAA,CAAAsB,aAAA,CAACd,cAAc;IACbG,QAAQ,EAAEA,QAAS;IACnBE,QAAQ,EAAEA,QAAS;IACnBD,OAAO,EAAEA;EAAQ,CAClB,CAEL,CAAC;AAEP,CAAC;AAED,SAASH,cAAc","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oanda/labs-currency-power-balance-widget",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.112",
|
|
4
4
|
"description": "Labs Currency Power Balance Widget",
|
|
5
5
|
"main": "dist/main/index.js",
|
|
6
6
|
"module": "dist/module/index.js",
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"author": "OANDA",
|
|
13
13
|
"license": "UNLICENSED",
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"@oanda/labs-widget-common": "^1.0.
|
|
15
|
+
"@oanda/labs-widget-common": "^1.0.173",
|
|
16
16
|
"@oanda/mono-i18n": "10.0.1",
|
|
17
17
|
"echarts": "5.5.0",
|
|
18
18
|
"echarts-for-react": "3.0.2",
|
|
@@ -22,5 +22,5 @@
|
|
|
22
22
|
"@graphql-codegen/cli": "5.0.0",
|
|
23
23
|
"@graphql-codegen/client-preset": "4.1.0"
|
|
24
24
|
},
|
|
25
|
-
"gitHead": "
|
|
25
|
+
"gitHead": "67a7801f99f0bab94dd6067a102761f51de786c1"
|
|
26
26
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import React
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import { useQuery } from '@apollo/client';
|
|
3
3
|
import { useLocale } from '@oanda/mono-i18n';
|
|
4
4
|
import {
|
|
5
|
-
ChartError, Spinner, SpinnerSize,
|
|
5
|
+
ChartError, Spinner, SpinnerSize, useLayoutProvider, Tooltip, Size,
|
|
6
6
|
LastUpdated,
|
|
7
7
|
} from '@oanda/labs-widget-common';
|
|
8
8
|
import { Chart } from './components/Chart';
|
|
@@ -12,7 +12,7 @@ import { ChartWithDataProps } from './types';
|
|
|
12
12
|
import { GetCurrencyPowerBalanceQuery, GetCurrencyPowerBalanceQueryVariables } from '../gql/types/graphql';
|
|
13
13
|
|
|
14
14
|
const ChartWithData = ({ timeUnit, currencies }: ChartWithDataProps) => {
|
|
15
|
-
const { size } =
|
|
15
|
+
const { size } = useLayoutProvider();
|
|
16
16
|
const isDesktop = size === Size.DESKTOP;
|
|
17
17
|
const { lang } = useLocale();
|
|
18
18
|
const { loading, data, error } = useQuery<
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { ApolloClient, InMemoryCache
|
|
3
|
-
import {
|
|
4
|
-
ChartError, ThemeProvider, getLocale, renderComponent,
|
|
5
|
-
} from '@oanda/labs-widget-common';
|
|
6
|
-
import { LocaleProvider } from '@oanda/mono-i18n';
|
|
2
|
+
import { ApolloClient, InMemoryCache } from '@apollo/client';
|
|
3
|
+
import { WidgetProvider, WidgetWrapper } from '@oanda/labs-widget-common';
|
|
7
4
|
import { Main } from './Main';
|
|
8
5
|
import { CurrencyPowerBalanceConfig } from './types';
|
|
9
6
|
import { translations } from '../translations';
|
|
@@ -17,21 +14,20 @@ const CurrencyPowerBalance = ({
|
|
|
17
14
|
});
|
|
18
15
|
|
|
19
16
|
return (
|
|
20
|
-
<
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
</ThemeProvider>
|
|
17
|
+
<WidgetProvider
|
|
18
|
+
locale={locale}
|
|
19
|
+
translations={translations}
|
|
20
|
+
client={client}
|
|
21
|
+
theme={theme}
|
|
22
|
+
>
|
|
23
|
+
<WidgetWrapper
|
|
24
|
+
logoLink={logoLink}
|
|
25
|
+
linkArea="logo"
|
|
26
|
+
isParamError={isParamError}
|
|
27
|
+
>
|
|
28
|
+
<Main timeUnit={timeUnit} currencies={currencies} />
|
|
29
|
+
</WidgetWrapper>
|
|
30
|
+
</WidgetProvider>
|
|
35
31
|
);
|
|
36
32
|
};
|
|
37
33
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import React, {
|
|
2
|
-
import {
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import { useLayoutProvider } from '@oanda/labs-widget-common';
|
|
3
3
|
import { useLocale } from '@oanda/mono-i18n';
|
|
4
4
|
import { CurrencyPowerBalanceTimeUnit } from '../gql/types/graphql';
|
|
5
5
|
import { TimeUnitSwitch } from './components/TimeUnitSwitch';
|
|
@@ -8,7 +8,7 @@ import { ChartWithData } from './ChartWithData';
|
|
|
8
8
|
import { MainProps } from './types';
|
|
9
9
|
|
|
10
10
|
const Main = ({ timeUnit, currencies }: MainProps) => {
|
|
11
|
-
const { size } =
|
|
11
|
+
const { size } = useLayoutProvider();
|
|
12
12
|
const { lang } = useLocale();
|
|
13
13
|
const [selectedTimeUnit, setSelectedTimeUnit] = useState(
|
|
14
14
|
timeUnit || CurrencyPowerBalanceTimeUnit.CurrentDay,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useRef, useEffect
|
|
1
|
+
import React, { useRef, useEffect } from 'react';
|
|
2
2
|
import ReactEChartsCore from 'echarts-for-react/lib/core';
|
|
3
3
|
import * as echarts from 'echarts/core';
|
|
4
4
|
import { LineChart } from 'echarts/charts';
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
GridSimpleComponent, GraphicComponent, TooltipComponent, LegendPlainComponent, MarkLineComponent,
|
|
8
8
|
} from 'echarts/components';
|
|
9
9
|
import {
|
|
10
|
-
Theme,
|
|
10
|
+
Theme, useLayoutProvider, getChartTheme, Size,
|
|
11
11
|
} from '@oanda/labs-widget-common';
|
|
12
12
|
import { useLocale } from '@oanda/mono-i18n';
|
|
13
13
|
import {
|
|
@@ -31,7 +31,7 @@ echarts.registerTheme('light_theme', getChartTheme(Theme.Light));
|
|
|
31
31
|
|
|
32
32
|
const Chart = ({ values, timeUnit, currencies }: ChartProps) => {
|
|
33
33
|
const { lang } = useLocale();
|
|
34
|
-
const { isDark, size } =
|
|
34
|
+
const { isDark, size } = useLayoutProvider();
|
|
35
35
|
const isDesktop = size === Size.DESKTOP;
|
|
36
36
|
const isMobile = size === Size.MOBILE;
|
|
37
37
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import React
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import {
|
|
3
|
-
Button, ButtonSize, ButtonVariant,
|
|
3
|
+
Button, ButtonSize, ButtonVariant, useLayoutProvider, Size,
|
|
4
4
|
} from '@oanda/labs-widget-common';
|
|
5
5
|
import { useLocale } from '@oanda/mono-i18n';
|
|
6
6
|
import { TimeUnitSwitchProps } from './types';
|
|
@@ -12,7 +12,7 @@ const TimeUnitSwitch = ({
|
|
|
12
12
|
selected, options, callback,
|
|
13
13
|
}: TimeUnitSwitchProps) => {
|
|
14
14
|
const { lang } = useLocale();
|
|
15
|
-
const { size } =
|
|
15
|
+
const { size } = useLayoutProvider();
|
|
16
16
|
const isDesktop = size === Size.DESKTOP;
|
|
17
17
|
|
|
18
18
|
const handleButtonClick = (e: React.SyntheticEvent<HTMLButtonElement>) => {
|
package/test/Main.test.tsx
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
import React from 'react';
|
|
5
5
|
import { render } from '@testing-library/react';
|
|
6
6
|
import { MockedProvider } from '@apollo/client/testing';
|
|
7
|
-
import {
|
|
7
|
+
import { MockLayoutProvider, Size } from '@oanda/labs-widget-common';
|
|
8
8
|
import { Main } from '../src/CurrencyPowerBalanceWidget/Main';
|
|
9
9
|
import { mockResponse } from './responsesMocks';
|
|
10
10
|
import { CurrencyPowerBalanceTimeUnit } from '../src/gql/types/graphql';
|
|
@@ -13,9 +13,9 @@ describe('Main component', () => {
|
|
|
13
13
|
it('should render tool desktop view', async () => {
|
|
14
14
|
const { findByTestId, getByTestId, queryByTestId } = render(
|
|
15
15
|
<MockedProvider mocks={mockResponse}>
|
|
16
|
-
<
|
|
16
|
+
<MockLayoutProvider>
|
|
17
17
|
<Main />
|
|
18
|
-
</
|
|
18
|
+
</MockLayoutProvider>
|
|
19
19
|
</MockedProvider>,
|
|
20
20
|
);
|
|
21
21
|
|
|
@@ -26,9 +26,9 @@ describe('Main component', () => {
|
|
|
26
26
|
it('should render widget desktop view', async () => {
|
|
27
27
|
const { findByTestId, getByTestId, queryByTestId } = render(
|
|
28
28
|
<MockedProvider mocks={mockResponse}>
|
|
29
|
-
<
|
|
29
|
+
<MockLayoutProvider>
|
|
30
30
|
<Main timeUnit={CurrencyPowerBalanceTimeUnit.CurrentDay} currencies={['USD', 'EUR']} />
|
|
31
|
-
</
|
|
31
|
+
</MockLayoutProvider>
|
|
32
32
|
</MockedProvider>,
|
|
33
33
|
);
|
|
34
34
|
|
|
@@ -39,9 +39,9 @@ describe('Main component', () => {
|
|
|
39
39
|
it('should render tool desktop view when timeUnit missing for widget', async () => {
|
|
40
40
|
const { findByTestId, getByTestId, queryByTestId } = render(
|
|
41
41
|
<MockedProvider mocks={mockResponse}>
|
|
42
|
-
<
|
|
42
|
+
<MockLayoutProvider>
|
|
43
43
|
<Main currencies={['USD', 'EUR']} />
|
|
44
|
-
</
|
|
44
|
+
</MockLayoutProvider>
|
|
45
45
|
</MockedProvider>,
|
|
46
46
|
);
|
|
47
47
|
|
|
@@ -52,9 +52,9 @@ describe('Main component', () => {
|
|
|
52
52
|
it('should render tool desktop view when currencies missing for widget', async () => {
|
|
53
53
|
const { findByTestId, getByTestId, queryByTestId } = render(
|
|
54
54
|
<MockedProvider mocks={mockResponse}>
|
|
55
|
-
<
|
|
55
|
+
<MockLayoutProvider>
|
|
56
56
|
<Main timeUnit={CurrencyPowerBalanceTimeUnit.CurrentDay} />
|
|
57
|
-
</
|
|
57
|
+
</MockLayoutProvider>
|
|
58
58
|
</MockedProvider>,
|
|
59
59
|
);
|
|
60
60
|
|
|
@@ -65,9 +65,9 @@ describe('Main component', () => {
|
|
|
65
65
|
it('should render tool mobile view', async () => {
|
|
66
66
|
const { findByTestId, getByTestId, queryByTestId } = render(
|
|
67
67
|
<MockedProvider mocks={mockResponse}>
|
|
68
|
-
<
|
|
68
|
+
<MockLayoutProvider size={Size.MOBILE}>
|
|
69
69
|
<Main />
|
|
70
|
-
</
|
|
70
|
+
</MockLayoutProvider>
|
|
71
71
|
</MockedProvider>,
|
|
72
72
|
);
|
|
73
73
|
|