@oanda/labs-sentiment-widget 1.0.69 → 1.0.71
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 +540 -0
- package/dist/main/SentimentWidget/SentimentWidget.js +4 -2
- package/dist/main/SentimentWidget/SentimentWidget.js.map +1 -1
- package/dist/main/SentimentWidget/Widget.js +9 -2
- package/dist/main/SentimentWidget/Widget.js.map +1 -1
- package/dist/main/SentimentWidget/render.js +4 -2
- package/dist/main/SentimentWidget/render.js.map +1 -1
- package/dist/main/SentimentWidget/types.js.map +1 -1
- package/dist/module/SentimentWidget/SentimentWidget.js +4 -2
- package/dist/module/SentimentWidget/SentimentWidget.js.map +1 -1
- package/dist/module/SentimentWidget/Widget.js +9 -2
- package/dist/module/SentimentWidget/Widget.js.map +1 -1
- package/dist/module/SentimentWidget/render.js +4 -2
- package/dist/module/SentimentWidget/render.js.map +1 -1
- package/dist/module/SentimentWidget/types.js.map +1 -1
- package/dist/types/SentimentWidget/SentimentWidget.d.ts +1 -1
- package/dist/types/SentimentWidget/Widget.d.ts +1 -1
- package/dist/types/SentimentWidget/types.d.ts +2 -0
- package/package.json +3 -3
- package/src/SentimentWidget/SentimentWidget.tsx +6 -2
- package/src/SentimentWidget/Widget.tsx +12 -1
- package/src/SentimentWidget/render.tsx +4 -1
- package/src/SentimentWidget/types.ts +2 -0
- package/test/Tool.test.tsx +3 -0
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,546 @@
|
|
|
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.71 (2024-01-18)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
## 1.0.70 (2024-01-17)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
## 1.0.69 (2024-01-17)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
## 1.0.68 (2024-01-15)
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
## 1.0.67 (2024-01-15)
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
## 1.0.66 (2024-01-12)
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
## 1.0.65 (2024-01-11)
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
## 1.0.64 (2024-01-11)
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
## 1.0.63 (2024-01-11)
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
## 1.0.62 (2024-01-10)
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
## 1.0.61 (2024-01-09)
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
## 1.0.60 (2024-01-05)
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
## 1.0.59 (2023-12-27)
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
## 1.0.58 (2023-12-22)
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
## 1.0.57 (2023-12-22)
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
## 1.0.56 (2023-12-21)
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
## 1.0.55 (2023-12-19)
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
## 1.0.54 (2023-12-15)
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
## 1.0.53 (2023-12-13)
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
## 1.0.52 (2023-12-13)
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
## 1.0.51 (2023-12-07)
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
## 1.0.50 (2023-12-04)
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
## 1.0.49 (2023-12-01)
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
## 1.0.48 (2023-12-01)
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
## 1.0.47 (2023-11-29)
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
## 1.0.46 (2023-11-28)
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
## 1.0.45 (2023-11-23)
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
## 1.0.44 (2023-11-22)
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
## 1.0.43 (2023-11-15)
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
## 1.0.42 (2023-11-10)
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
## 1.0.41 (2023-11-03)
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
## 1.0.40 (2023-11-02)
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
## 1.0.39 (2023-11-02)
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
## 1.0.38 (2023-10-26)
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
## 1.0.37 (2023-10-26)
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
## 1.0.36 (2023-10-25)
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
## 1.0.35 (2023-10-24)
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
## 1.0.34 (2023-10-23)
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
## 1.0.33 (2023-10-23)
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
## 1.0.32 (2023-10-23)
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
## 1.0.31 (2023-10-20)
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
## 1.0.30 (2023-10-19)
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
## 1.0.29 (2023-10-19)
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
## 1.0.28 (2023-10-19)
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
## 1.0.27 (2023-10-18)
|
|
183
|
+
|
|
184
|
+
|
|
185
|
+
|
|
186
|
+
## 1.0.26 (2023-10-18)
|
|
187
|
+
|
|
188
|
+
|
|
189
|
+
|
|
190
|
+
## 1.0.25 (2023-10-17)
|
|
191
|
+
|
|
192
|
+
|
|
193
|
+
|
|
194
|
+
## 1.0.24 (2023-10-13)
|
|
195
|
+
|
|
196
|
+
|
|
197
|
+
|
|
198
|
+
## 1.0.23 (2023-10-13)
|
|
199
|
+
|
|
200
|
+
|
|
201
|
+
|
|
202
|
+
## 1.0.22 (2023-10-11)
|
|
203
|
+
|
|
204
|
+
|
|
205
|
+
|
|
206
|
+
## 1.0.21 (2023-10-10)
|
|
207
|
+
|
|
208
|
+
|
|
209
|
+
|
|
210
|
+
## 1.0.20 (2023-10-06)
|
|
211
|
+
|
|
212
|
+
|
|
213
|
+
|
|
214
|
+
## 1.0.19 (2023-10-06)
|
|
215
|
+
|
|
216
|
+
|
|
217
|
+
|
|
218
|
+
## 1.0.18 (2023-10-05)
|
|
219
|
+
|
|
220
|
+
|
|
221
|
+
|
|
222
|
+
## 1.0.17 (2023-10-04)
|
|
223
|
+
|
|
224
|
+
|
|
225
|
+
|
|
226
|
+
## 1.0.16 (2023-10-04)
|
|
227
|
+
|
|
228
|
+
|
|
229
|
+
|
|
230
|
+
## 1.0.15 (2023-10-04)
|
|
231
|
+
|
|
232
|
+
|
|
233
|
+
|
|
234
|
+
## 1.0.14 (2023-10-03)
|
|
235
|
+
|
|
236
|
+
|
|
237
|
+
|
|
238
|
+
## 1.0.13 (2023-10-03)
|
|
239
|
+
|
|
240
|
+
|
|
241
|
+
|
|
242
|
+
## 1.0.12 (2023-10-03)
|
|
243
|
+
|
|
244
|
+
|
|
245
|
+
|
|
246
|
+
## 1.0.11 (2023-10-02)
|
|
247
|
+
|
|
248
|
+
|
|
249
|
+
|
|
250
|
+
## 1.0.10 (2023-09-29)
|
|
251
|
+
|
|
252
|
+
|
|
253
|
+
|
|
254
|
+
## 1.0.9 (2023-09-28)
|
|
255
|
+
|
|
256
|
+
|
|
257
|
+
|
|
258
|
+
## 1.0.8 (2023-09-27)
|
|
259
|
+
|
|
260
|
+
|
|
261
|
+
|
|
262
|
+
## 1.0.7 (2023-09-26)
|
|
263
|
+
|
|
264
|
+
|
|
265
|
+
|
|
266
|
+
## 1.0.6 (2023-09-21)
|
|
267
|
+
|
|
268
|
+
|
|
269
|
+
|
|
270
|
+
## 1.0.5 (2023-09-13)
|
|
271
|
+
|
|
272
|
+
**Note:** Version bump only for package @oanda/labs-sentiment-widget
|
|
273
|
+
|
|
274
|
+
|
|
275
|
+
|
|
276
|
+
|
|
277
|
+
|
|
278
|
+
## 1.0.70 (2024-01-17)
|
|
279
|
+
|
|
280
|
+
|
|
281
|
+
|
|
282
|
+
## 1.0.69 (2024-01-17)
|
|
283
|
+
|
|
284
|
+
|
|
285
|
+
|
|
286
|
+
## 1.0.68 (2024-01-15)
|
|
287
|
+
|
|
288
|
+
|
|
289
|
+
|
|
290
|
+
## 1.0.67 (2024-01-15)
|
|
291
|
+
|
|
292
|
+
|
|
293
|
+
|
|
294
|
+
## 1.0.66 (2024-01-12)
|
|
295
|
+
|
|
296
|
+
|
|
297
|
+
|
|
298
|
+
## 1.0.65 (2024-01-11)
|
|
299
|
+
|
|
300
|
+
|
|
301
|
+
|
|
302
|
+
## 1.0.64 (2024-01-11)
|
|
303
|
+
|
|
304
|
+
|
|
305
|
+
|
|
306
|
+
## 1.0.63 (2024-01-11)
|
|
307
|
+
|
|
308
|
+
|
|
309
|
+
|
|
310
|
+
## 1.0.62 (2024-01-10)
|
|
311
|
+
|
|
312
|
+
|
|
313
|
+
|
|
314
|
+
## 1.0.61 (2024-01-09)
|
|
315
|
+
|
|
316
|
+
|
|
317
|
+
|
|
318
|
+
## 1.0.60 (2024-01-05)
|
|
319
|
+
|
|
320
|
+
|
|
321
|
+
|
|
322
|
+
## 1.0.59 (2023-12-27)
|
|
323
|
+
|
|
324
|
+
|
|
325
|
+
|
|
326
|
+
## 1.0.58 (2023-12-22)
|
|
327
|
+
|
|
328
|
+
|
|
329
|
+
|
|
330
|
+
## 1.0.57 (2023-12-22)
|
|
331
|
+
|
|
332
|
+
|
|
333
|
+
|
|
334
|
+
## 1.0.56 (2023-12-21)
|
|
335
|
+
|
|
336
|
+
|
|
337
|
+
|
|
338
|
+
## 1.0.55 (2023-12-19)
|
|
339
|
+
|
|
340
|
+
|
|
341
|
+
|
|
342
|
+
## 1.0.54 (2023-12-15)
|
|
343
|
+
|
|
344
|
+
|
|
345
|
+
|
|
346
|
+
## 1.0.53 (2023-12-13)
|
|
347
|
+
|
|
348
|
+
|
|
349
|
+
|
|
350
|
+
## 1.0.52 (2023-12-13)
|
|
351
|
+
|
|
352
|
+
|
|
353
|
+
|
|
354
|
+
## 1.0.51 (2023-12-07)
|
|
355
|
+
|
|
356
|
+
|
|
357
|
+
|
|
358
|
+
## 1.0.50 (2023-12-04)
|
|
359
|
+
|
|
360
|
+
|
|
361
|
+
|
|
362
|
+
## 1.0.49 (2023-12-01)
|
|
363
|
+
|
|
364
|
+
|
|
365
|
+
|
|
366
|
+
## 1.0.48 (2023-12-01)
|
|
367
|
+
|
|
368
|
+
|
|
369
|
+
|
|
370
|
+
## 1.0.47 (2023-11-29)
|
|
371
|
+
|
|
372
|
+
|
|
373
|
+
|
|
374
|
+
## 1.0.46 (2023-11-28)
|
|
375
|
+
|
|
376
|
+
|
|
377
|
+
|
|
378
|
+
## 1.0.45 (2023-11-23)
|
|
379
|
+
|
|
380
|
+
|
|
381
|
+
|
|
382
|
+
## 1.0.44 (2023-11-22)
|
|
383
|
+
|
|
384
|
+
|
|
385
|
+
|
|
386
|
+
## 1.0.43 (2023-11-15)
|
|
387
|
+
|
|
388
|
+
|
|
389
|
+
|
|
390
|
+
## 1.0.42 (2023-11-10)
|
|
391
|
+
|
|
392
|
+
|
|
393
|
+
|
|
394
|
+
## 1.0.41 (2023-11-03)
|
|
395
|
+
|
|
396
|
+
|
|
397
|
+
|
|
398
|
+
## 1.0.40 (2023-11-02)
|
|
399
|
+
|
|
400
|
+
|
|
401
|
+
|
|
402
|
+
## 1.0.39 (2023-11-02)
|
|
403
|
+
|
|
404
|
+
|
|
405
|
+
|
|
406
|
+
## 1.0.38 (2023-10-26)
|
|
407
|
+
|
|
408
|
+
|
|
409
|
+
|
|
410
|
+
## 1.0.37 (2023-10-26)
|
|
411
|
+
|
|
412
|
+
|
|
413
|
+
|
|
414
|
+
## 1.0.36 (2023-10-25)
|
|
415
|
+
|
|
416
|
+
|
|
417
|
+
|
|
418
|
+
## 1.0.35 (2023-10-24)
|
|
419
|
+
|
|
420
|
+
|
|
421
|
+
|
|
422
|
+
## 1.0.34 (2023-10-23)
|
|
423
|
+
|
|
424
|
+
|
|
425
|
+
|
|
426
|
+
## 1.0.33 (2023-10-23)
|
|
427
|
+
|
|
428
|
+
|
|
429
|
+
|
|
430
|
+
## 1.0.32 (2023-10-23)
|
|
431
|
+
|
|
432
|
+
|
|
433
|
+
|
|
434
|
+
## 1.0.31 (2023-10-20)
|
|
435
|
+
|
|
436
|
+
|
|
437
|
+
|
|
438
|
+
## 1.0.30 (2023-10-19)
|
|
439
|
+
|
|
440
|
+
|
|
441
|
+
|
|
442
|
+
## 1.0.29 (2023-10-19)
|
|
443
|
+
|
|
444
|
+
|
|
445
|
+
|
|
446
|
+
## 1.0.28 (2023-10-19)
|
|
447
|
+
|
|
448
|
+
|
|
449
|
+
|
|
450
|
+
## 1.0.27 (2023-10-18)
|
|
451
|
+
|
|
452
|
+
|
|
453
|
+
|
|
454
|
+
## 1.0.26 (2023-10-18)
|
|
455
|
+
|
|
456
|
+
|
|
457
|
+
|
|
458
|
+
## 1.0.25 (2023-10-17)
|
|
459
|
+
|
|
460
|
+
|
|
461
|
+
|
|
462
|
+
## 1.0.24 (2023-10-13)
|
|
463
|
+
|
|
464
|
+
|
|
465
|
+
|
|
466
|
+
## 1.0.23 (2023-10-13)
|
|
467
|
+
|
|
468
|
+
|
|
469
|
+
|
|
470
|
+
## 1.0.22 (2023-10-11)
|
|
471
|
+
|
|
472
|
+
|
|
473
|
+
|
|
474
|
+
## 1.0.21 (2023-10-10)
|
|
475
|
+
|
|
476
|
+
|
|
477
|
+
|
|
478
|
+
## 1.0.20 (2023-10-06)
|
|
479
|
+
|
|
480
|
+
|
|
481
|
+
|
|
482
|
+
## 1.0.19 (2023-10-06)
|
|
483
|
+
|
|
484
|
+
|
|
485
|
+
|
|
486
|
+
## 1.0.18 (2023-10-05)
|
|
487
|
+
|
|
488
|
+
|
|
489
|
+
|
|
490
|
+
## 1.0.17 (2023-10-04)
|
|
491
|
+
|
|
492
|
+
|
|
493
|
+
|
|
494
|
+
## 1.0.16 (2023-10-04)
|
|
495
|
+
|
|
496
|
+
|
|
497
|
+
|
|
498
|
+
## 1.0.15 (2023-10-04)
|
|
499
|
+
|
|
500
|
+
|
|
501
|
+
|
|
502
|
+
## 1.0.14 (2023-10-03)
|
|
503
|
+
|
|
504
|
+
|
|
505
|
+
|
|
506
|
+
## 1.0.13 (2023-10-03)
|
|
507
|
+
|
|
508
|
+
|
|
509
|
+
|
|
510
|
+
## 1.0.12 (2023-10-03)
|
|
511
|
+
|
|
512
|
+
|
|
513
|
+
|
|
514
|
+
## 1.0.11 (2023-10-02)
|
|
515
|
+
|
|
516
|
+
|
|
517
|
+
|
|
518
|
+
## 1.0.10 (2023-09-29)
|
|
519
|
+
|
|
520
|
+
|
|
521
|
+
|
|
522
|
+
## 1.0.9 (2023-09-28)
|
|
523
|
+
|
|
524
|
+
|
|
525
|
+
|
|
526
|
+
## 1.0.8 (2023-09-27)
|
|
527
|
+
|
|
528
|
+
|
|
529
|
+
|
|
530
|
+
## 1.0.7 (2023-09-26)
|
|
531
|
+
|
|
532
|
+
|
|
533
|
+
|
|
534
|
+
## 1.0.6 (2023-09-21)
|
|
535
|
+
|
|
536
|
+
|
|
537
|
+
|
|
538
|
+
## 1.0.5 (2023-09-13)
|
|
539
|
+
|
|
540
|
+
**Note:** Version bump only for package @oanda/labs-sentiment-widget
|
|
541
|
+
|
|
542
|
+
|
|
543
|
+
|
|
544
|
+
|
|
545
|
+
|
|
6
546
|
## 1.0.69 (2024-01-17)
|
|
7
547
|
|
|
8
548
|
|
|
@@ -18,7 +18,8 @@ const SentimentWidget = _ref => {
|
|
|
18
18
|
division,
|
|
19
19
|
instrument,
|
|
20
20
|
locale,
|
|
21
|
-
theme
|
|
21
|
+
theme,
|
|
22
|
+
includeDescriptionLabels
|
|
22
23
|
} = _ref;
|
|
23
24
|
const client = new _client.ApolloClient({
|
|
24
25
|
uri: graphqlUrl,
|
|
@@ -33,7 +34,8 @@ const SentimentWidget = _ref => {
|
|
|
33
34
|
client: client
|
|
34
35
|
}, instrument ? _react.default.createElement(_Widget.Widget, {
|
|
35
36
|
division: division,
|
|
36
|
-
instrument: instrument
|
|
37
|
+
instrument: instrument,
|
|
38
|
+
includeDescriptionLabels: includeDescriptionLabels
|
|
37
39
|
}) : _react.default.createElement(_Tool.Tool, {
|
|
38
40
|
division: division
|
|
39
41
|
}))));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SentimentWidget.js","names":["_react","_interopRequireDefault","require","_client","_monoI18n","_labsWidgetCommon","_Widget","_Tool","_translations","obj","__esModule","default","SentimentWidget","_ref","graphqlUrl","division","instrument","locale","theme","client","ApolloClient","uri","cache","InMemoryCache","createElement","ThemeProvider","LocaleProvider","getLocale","translations","ApolloProvider","Widget","Tool","exports"],"sources":["../../../src/SentimentWidget/SentimentWidget.tsx"],"sourcesContent":["import React from 'react';\nimport { ApolloClient, InMemoryCache, ApolloProvider } from '@apollo/client';\nimport { LocaleProvider } from '@oanda/mono-i18n';\nimport { ThemeProvider, getLocale } from '@oanda/labs-widget-common';\nimport { Widget } from './Widget';\nimport { Tool } from './Tool';\nimport { SentimentConfig } from './types';\nimport { translations } from '../translations';\n\nconst SentimentWidget = ({\n graphqlUrl, division, instrument, locale, theme,\n}: SentimentConfig) => {\n const client = new ApolloClient({\n uri: graphqlUrl,\n cache: new InMemoryCache(),\n });\n\n return (\n <ThemeProvider theme={theme}>\n <LocaleProvider locale={getLocale(locale)} translations={translations}>\n <ApolloProvider client={client}>\n {instrument ? (\n <Widget
|
|
1
|
+
{"version":3,"file":"SentimentWidget.js","names":["_react","_interopRequireDefault","require","_client","_monoI18n","_labsWidgetCommon","_Widget","_Tool","_translations","obj","__esModule","default","SentimentWidget","_ref","graphqlUrl","division","instrument","locale","theme","includeDescriptionLabels","client","ApolloClient","uri","cache","InMemoryCache","createElement","ThemeProvider","LocaleProvider","getLocale","translations","ApolloProvider","Widget","Tool","exports"],"sources":["../../../src/SentimentWidget/SentimentWidget.tsx"],"sourcesContent":["import React from 'react';\nimport { ApolloClient, InMemoryCache, ApolloProvider } from '@apollo/client';\nimport { LocaleProvider } from '@oanda/mono-i18n';\nimport { ThemeProvider, getLocale } from '@oanda/labs-widget-common';\nimport { Widget } from './Widget';\nimport { Tool } from './Tool';\nimport { SentimentConfig } from './types';\nimport { translations } from '../translations';\n\nconst SentimentWidget = ({\n graphqlUrl, division, instrument, locale, theme, includeDescriptionLabels,\n}: SentimentConfig) => {\n const client = new ApolloClient({\n uri: graphqlUrl,\n cache: new InMemoryCache(),\n });\n\n return (\n <ThemeProvider theme={theme}>\n <LocaleProvider locale={getLocale(locale)} translations={translations}>\n <ApolloProvider client={client}>\n {instrument ? (\n <Widget\n division={division}\n instrument={instrument}\n includeDescriptionLabels={includeDescriptionLabels}\n />\n ) : (\n <Tool division={division} />\n )}\n </ApolloProvider>\n </LocaleProvider>\n </ThemeProvider>\n );\n};\n\nexport { SentimentWidget };\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AACA,IAAAG,iBAAA,GAAAH,OAAA;AACA,IAAAI,OAAA,GAAAJ,OAAA;AACA,IAAAK,KAAA,GAAAL,OAAA;AAEA,IAAAM,aAAA,GAAAN,OAAA;AAA+C,SAAAD,uBAAAQ,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAE/C,MAAMG,eAAe,GAAGC,IAAA,IAED;EAAA,IAFE;IACvBC,UAAU;IAAEC,QAAQ;IAAEC,UAAU;IAAEC,MAAM;IAAEC,KAAK;IAAEC;EAClC,CAAC,GAAAN,IAAA;EAChB,MAAMO,MAAM,GAAG,IAAIC,oBAAY,CAAC;IAC9BC,GAAG,EAAER,UAAU;IACfS,KAAK,EAAE,IAAIC,qBAAa,CAAC;EAC3B,CAAC,CAAC;EAEF,OACExB,MAAA,CAAAW,OAAA,CAAAc,aAAA,CAACpB,iBAAA,CAAAqB,aAAa;IAACR,KAAK,EAAEA;EAAM,GAC1BlB,MAAA,CAAAW,OAAA,CAAAc,aAAA,CAACrB,SAAA,CAAAuB,cAAc;IAACV,MAAM,EAAE,IAAAW,2BAAS,EAACX,MAAM,CAAE;IAACY,YAAY,EAAEA;EAAa,GACpE7B,MAAA,CAAAW,OAAA,CAAAc,aAAA,CAACtB,OAAA,CAAA2B,cAAc;IAACV,MAAM,EAAEA;EAAO,GAC5BJ,UAAU,GACThB,MAAA,CAAAW,OAAA,CAAAc,aAAA,CAACnB,OAAA,CAAAyB,MAAM;IACLhB,QAAQ,EAAEA,QAAS;IACnBC,UAAU,EAAEA,UAAW;IACvBG,wBAAwB,EAAEA;EAAyB,CACpD,CAAC,GAEFnB,MAAA,CAAAW,OAAA,CAAAc,aAAA,CAAClB,KAAA,CAAAyB,IAAI;IAACjB,QAAQ,EAAEA;EAAS,CAAE,CAEf,CACF,CACH,CAAC;AAEpB,CAAC;AAACkB,OAAA,CAAArB,eAAA,GAAAA,eAAA"}
|
|
@@ -15,7 +15,8 @@ const Widget = _ref => {
|
|
|
15
15
|
var _data$sentiment;
|
|
16
16
|
let {
|
|
17
17
|
instrument,
|
|
18
|
-
division
|
|
18
|
+
division,
|
|
19
|
+
includeDescriptionLabels = false
|
|
19
20
|
} = _ref;
|
|
20
21
|
const {
|
|
21
22
|
loading,
|
|
@@ -40,7 +41,13 @@ const Widget = _ref => {
|
|
|
40
41
|
return _react.default.createElement(_react.default.Fragment, null, _react.default.createElement("div", {
|
|
41
42
|
"data-testid": "sentiment-widget",
|
|
42
43
|
className: "lw-border lw-border-solid lw-border-border-primary lw-bg-bg-primary lw-p-4 lw-text-sm lw-tracking-normal lw-text-text-primary"
|
|
43
|
-
}, _react.default.createElement("div", {
|
|
44
|
+
}, includeDescriptionLabels && _react.default.createElement("div", {
|
|
45
|
+
className: "lw-mb-2 lw-flex lw-justify-between lw-font-semibold"
|
|
46
|
+
}, _react.default.createElement("span", {
|
|
47
|
+
className: "lw-ml-[7.5rem] lw-uppercase md:lw-ml-40"
|
|
48
|
+
}, lang('net_short')), _react.default.createElement("span", {
|
|
49
|
+
className: "lw-text-right lw-uppercase md:lw-mr-10"
|
|
50
|
+
}, lang('net_long'))), _react.default.createElement("div", {
|
|
44
51
|
className: "lw-flex lw-items-center lw-justify-between"
|
|
45
52
|
}, _react.default.createElement("div", {
|
|
46
53
|
className: "lw-w-[120px] lw-shrink-0"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Widget.js","names":["_react","_interopRequireDefault","require","_labsWidgetCommon","_monoI18n","_client","_getInstrumentSentiment","_constant","obj","__esModule","default","Widget","_ref","_data$sentiment","instrument","division","loading","data","error","useQuery","getInstrumentSentiment","variables","name","fetchPolicy","lang","useLocale","displayName","sentiment","updatedAt","isError","shortPercent","longPercent","undefined","createElement","Fragment","className","Loader","size","LoaderSize","md","Truncate","maxWidth","tooltipId","INSTRUMENT_TOOLTIP_ID","text","Sentiment","withError","isLoading","height","SentimentHeight","Error","InfoBox","concat","formatUpdatedTimestamp","EMPTY_VALUE","exports"],"sources":["../../../src/SentimentWidget/Widget.tsx"],"sourcesContent":["import React from 'react';\nimport {\n Sentiment, SentimentHeight, Error, Loader, LoaderSize, Truncate, InfoBox, formatUpdatedTimestamp,\n} from '@oanda/labs-widget-common';\nimport { useLocale } from '@oanda/mono-i18n';\nimport { useQuery } from '@apollo/client';\nimport { getInstrumentSentiment } from '../gql/getInstrumentSentiment';\nimport { SentimentWidgetConfig } from './types';\nimport { GetInstrumentSentimentQuery, GetInstrumentSentimentQueryVariables } from '../gql/types/graphql';\nimport { EMPTY_VALUE, INSTRUMENT_TOOLTIP_ID } from '../constant';\n\nconst Widget = ({
|
|
1
|
+
{"version":3,"file":"Widget.js","names":["_react","_interopRequireDefault","require","_labsWidgetCommon","_monoI18n","_client","_getInstrumentSentiment","_constant","obj","__esModule","default","Widget","_ref","_data$sentiment","instrument","division","includeDescriptionLabels","loading","data","error","useQuery","getInstrumentSentiment","variables","name","fetchPolicy","lang","useLocale","displayName","sentiment","updatedAt","isError","shortPercent","longPercent","undefined","createElement","Fragment","className","Loader","size","LoaderSize","md","Truncate","maxWidth","tooltipId","INSTRUMENT_TOOLTIP_ID","text","Sentiment","withError","isLoading","height","SentimentHeight","Error","InfoBox","concat","formatUpdatedTimestamp","EMPTY_VALUE","exports"],"sources":["../../../src/SentimentWidget/Widget.tsx"],"sourcesContent":["import React from 'react';\nimport {\n Sentiment, SentimentHeight, Error, Loader, LoaderSize, Truncate, InfoBox, formatUpdatedTimestamp,\n} from '@oanda/labs-widget-common';\nimport { useLocale } from '@oanda/mono-i18n';\nimport { useQuery } from '@apollo/client';\nimport { getInstrumentSentiment } from '../gql/getInstrumentSentiment';\nimport { SentimentWidgetConfig } from './types';\nimport { GetInstrumentSentimentQuery, GetInstrumentSentimentQueryVariables } from '../gql/types/graphql';\nimport { EMPTY_VALUE, INSTRUMENT_TOOLTIP_ID } from '../constant';\n\nconst Widget = ({\n instrument,\n division,\n includeDescriptionLabels = false,\n}: SentimentWidgetConfig) => {\n const { loading, data, error } = useQuery<\n GetInstrumentSentimentQuery,\n GetInstrumentSentimentQueryVariables\n >(getInstrumentSentiment, {\n variables: {\n name: instrument,\n division,\n },\n fetchPolicy: 'cache-and-network',\n });\n\n const { lang } = useLocale();\n\n const { displayName, sentiment, updatedAt } = data?.sentiment?.[0] || {};\n\n const isError = error\n || (sentiment?.shortPercent === 0 && sentiment?.longPercent === 0)\n || sentiment?.shortPercent === undefined\n || sentiment?.longPercent === undefined;\n\n return (\n <>\n <div data-testid=\"sentiment-widget\" className=\"lw-border lw-border-solid lw-border-border-primary lw-bg-bg-primary lw-p-4 lw-text-sm lw-tracking-normal lw-text-text-primary\">\n {includeDescriptionLabels\n && (\n <div className=\"lw-mb-2 lw-flex lw-justify-between lw-font-semibold\">\n <span className=\"lw-ml-[7.5rem] lw-uppercase md:lw-ml-40\">{lang('net_short')}</span>\n <span className=\"lw-text-right lw-uppercase md:lw-mr-10\">{lang('net_long')}</span>\n </div>\n )}\n <div className=\"lw-flex lw-items-center lw-justify-between\">\n <div className=\"lw-w-[120px] lw-shrink-0\">\n {loading && <Loader size={LoaderSize.md} />}\n {!loading && !isError && (\n <Truncate\n maxWidth={120}\n tooltipId={INSTRUMENT_TOOLTIP_ID}\n className=\"lw-pr-2 lw-font-sans lw-text-sm lw-font-bold\"\n text={displayName || '\\u2014'}\n />\n )}\n </div>\n <Sentiment\n withError={false}\n isLoading={loading}\n height={SentimentHeight.md}\n sentiment={sentiment}\n />\n </div>\n\n {!loading && isError && <Error />}\n </div>\n {!isError && updatedAt && (\n <div className=\"lw-mt-2 lw-h-8\">\n <InfoBox text={`${lang('last_updated')}: ${formatUpdatedTimestamp(updatedAt, lang('today')) || EMPTY_VALUE}`} />\n </div>\n )}\n </>\n );\n};\n\nexport { Widget };\n"],"mappings":"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"}
|
|
@@ -22,14 +22,16 @@ if (sentimentParamsElements.length > 0) {
|
|
|
22
22
|
const {
|
|
23
23
|
instrument,
|
|
24
24
|
division,
|
|
25
|
-
locale
|
|
25
|
+
locale,
|
|
26
|
+
includeDescriptionLabels
|
|
26
27
|
} = JSON.parse(params);
|
|
27
28
|
(0, _reactDom.render)(_react.default.createElement(_SentimentWidget.SentimentWidget, {
|
|
28
29
|
graphqlUrl: graphqlUrl,
|
|
29
30
|
division: division,
|
|
30
31
|
instrument: instrument,
|
|
31
32
|
locale: locale,
|
|
32
|
-
theme: mode
|
|
33
|
+
theme: mode,
|
|
34
|
+
includeDescriptionLabels: includeDescriptionLabels
|
|
33
35
|
}), element);
|
|
34
36
|
});
|
|
35
37
|
} else {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"render.js","names":["_react","_interopRequireDefault","require","_reactDom","_SentimentWidget","obj","__esModule","default","graphqlUrl","configGraphQl","division","configDivision","instrument","configInstrument","renderElementId","configRenderElementId","locale","configLocale","window","sentimentWidgetConfig","widgetsConfig","sentimentParamsElements","document","querySelectorAll","length","forEach","element","params","getAttribute","mode","JSON","parse","render","createElement","SentimentWidget","theme","getElementById"],"sources":["../../../src/SentimentWidget/render.tsx"],"sourcesContent":["import React from 'react';\nimport { render } from 'react-dom';\nimport { Theme } from '@oanda/labs-widget-common';\nimport { SentimentWidget } from './SentimentWidget';\n\nconst {\n graphqlUrl: configGraphQl,\n division: configDivision,\n instrument: configInstrument,\n renderElementId: configRenderElementId,\n locale: configLocale,\n} = window.sentimentWidgetConfig || {};\n\nconst {\n graphqlUrl,\n} = window.widgetsConfig || {};\n\nconst sentimentParamsElements = document.querySelectorAll('div[data-sentiment-params]');\n\nif (sentimentParamsElements.length > 0) {\n sentimentParamsElements.forEach((element) => {\n const params = element.getAttribute('data-sentiment-params');\n const mode = element.getAttribute('data-mode');\n const {
|
|
1
|
+
{"version":3,"file":"render.js","names":["_react","_interopRequireDefault","require","_reactDom","_SentimentWidget","obj","__esModule","default","graphqlUrl","configGraphQl","division","configDivision","instrument","configInstrument","renderElementId","configRenderElementId","locale","configLocale","window","sentimentWidgetConfig","widgetsConfig","sentimentParamsElements","document","querySelectorAll","length","forEach","element","params","getAttribute","mode","includeDescriptionLabels","JSON","parse","render","createElement","SentimentWidget","theme","getElementById"],"sources":["../../../src/SentimentWidget/render.tsx"],"sourcesContent":["import React from 'react';\nimport { render } from 'react-dom';\nimport { Theme } from '@oanda/labs-widget-common';\nimport { SentimentWidget } from './SentimentWidget';\n\nconst {\n graphqlUrl: configGraphQl,\n division: configDivision,\n instrument: configInstrument,\n renderElementId: configRenderElementId,\n locale: configLocale,\n} = window.sentimentWidgetConfig || {};\n\nconst {\n graphqlUrl,\n} = window.widgetsConfig || {};\n\nconst sentimentParamsElements = document.querySelectorAll('div[data-sentiment-params]');\n\nif (sentimentParamsElements.length > 0) {\n sentimentParamsElements.forEach((element) => {\n const params = element.getAttribute('data-sentiment-params');\n const mode = element.getAttribute('data-mode');\n const {\n instrument, division, locale, includeDescriptionLabels,\n } = JSON.parse(params as string);\n\n render(\n <SentimentWidget\n graphqlUrl={graphqlUrl}\n division={division}\n instrument={instrument}\n locale={locale}\n theme={mode as Theme}\n includeDescriptionLabels={includeDescriptionLabels}\n />,\n element,\n );\n });\n} else {\n render(\n <SentimentWidget\n graphqlUrl={configGraphQl}\n division={configDivision}\n instrument={configInstrument}\n locale={configLocale}\n />,\n document.getElementById(configRenderElementId),\n );\n}\n"],"mappings":";;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AAEA,IAAAE,gBAAA,GAAAF,OAAA;AAAoD,SAAAD,uBAAAI,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAEpD,MAAM;EACJG,UAAU,EAAEC,aAAa;EACzBC,QAAQ,EAAEC,cAAc;EACxBC,UAAU,EAAEC,gBAAgB;EAC5BC,eAAe,EAAEC,qBAAqB;EACtCC,MAAM,EAAEC;AACV,CAAC,GAAGC,MAAM,CAACC,qBAAqB,IAAI,CAAC,CAAC;AAEtC,MAAM;EACJX;AACF,CAAC,GAAGU,MAAM,CAACE,aAAa,IAAI,CAAC,CAAC;AAE9B,MAAMC,uBAAuB,GAAGC,QAAQ,CAACC,gBAAgB,CAAC,4BAA4B,CAAC;AAEvF,IAAIF,uBAAuB,CAACG,MAAM,GAAG,CAAC,EAAE;EACtCH,uBAAuB,CAACI,OAAO,CAAEC,OAAO,IAAK;IAC3C,MAAMC,MAAM,GAAGD,OAAO,CAACE,YAAY,CAAC,uBAAuB,CAAC;IAC5D,MAAMC,IAAI,GAAGH,OAAO,CAACE,YAAY,CAAC,WAAW,CAAC;IAC9C,MAAM;MACJhB,UAAU;MAAEF,QAAQ;MAAEM,MAAM;MAAEc;IAChC,CAAC,GAAGC,IAAI,CAACC,KAAK,CAACL,MAAgB,CAAC;IAEhC,IAAAM,gBAAM,EACJjC,MAAA,CAAAO,OAAA,CAAA2B,aAAA,CAAC9B,gBAAA,CAAA+B,eAAe;MACd3B,UAAU,EAAEA,UAAW;MACvBE,QAAQ,EAAEA,QAAS;MACnBE,UAAU,EAAEA,UAAW;MACvBI,MAAM,EAAEA,MAAO;MACfoB,KAAK,EAAEP,IAAc;MACrBC,wBAAwB,EAAEA;IAAyB,CACpD,CAAC,EACFJ,OACF,CAAC;EACH,CAAC,CAAC;AACJ,CAAC,MAAM;EACL,IAAAO,gBAAM,EACJjC,MAAA,CAAAO,OAAA,CAAA2B,aAAA,CAAC9B,gBAAA,CAAA+B,eAAe;IACd3B,UAAU,EAAEC,aAAc;IAC1BC,QAAQ,EAAEC,cAAe;IACzBC,UAAU,EAAEC,gBAAiB;IAC7BG,MAAM,EAAEC;EAAa,CACtB,CAAC,EACFK,QAAQ,CAACe,cAAc,CAACtB,qBAAqB,CAC/C,CAAC;AACH"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","names":[],"sources":["../../../src/SentimentWidget/types.ts"],"sourcesContent":["import { Locale } from '@oanda/mono-i18n';\nimport { Theme } from '@oanda/labs-widget-common';\nimport { Division } from '../gql/types/graphql';\n\nexport interface SentimentConfig {\n graphqlUrl: string;\n division: Division;\n instrument?: string;\n locale: Locale;\n theme?: Theme;\n}\nexport interface SentimentWrapperConfig extends SentimentConfig {\n renderElementId: string;\n}\nexport interface SentimentWidgetConfig {\n division: Division;\n instrument: string;\n}\n\nexport interface SentimentToolConfig {\n division: Division;\n}\n"],"mappings":""}
|
|
1
|
+
{"version":3,"file":"types.js","names":[],"sources":["../../../src/SentimentWidget/types.ts"],"sourcesContent":["import { Locale } from '@oanda/mono-i18n';\nimport { Theme } from '@oanda/labs-widget-common';\nimport { Division } from '../gql/types/graphql';\n\nexport interface SentimentConfig {\n graphqlUrl: string;\n division: Division;\n instrument?: string;\n locale: Locale;\n theme?: Theme;\n includeDescriptionLabels?: boolean;\n}\nexport interface SentimentWrapperConfig extends SentimentConfig {\n renderElementId: string;\n}\nexport interface SentimentWidgetConfig {\n division: Division;\n instrument: string;\n includeDescriptionLabels?: boolean;\n}\n\nexport interface SentimentToolConfig {\n division: Division;\n}\n"],"mappings":""}
|
|
@@ -11,7 +11,8 @@ const SentimentWidget = _ref => {
|
|
|
11
11
|
division,
|
|
12
12
|
instrument,
|
|
13
13
|
locale,
|
|
14
|
-
theme
|
|
14
|
+
theme,
|
|
15
|
+
includeDescriptionLabels
|
|
15
16
|
} = _ref;
|
|
16
17
|
const client = new ApolloClient({
|
|
17
18
|
uri: graphqlUrl,
|
|
@@ -26,7 +27,8 @@ const SentimentWidget = _ref => {
|
|
|
26
27
|
client: client
|
|
27
28
|
}, instrument ? React.createElement(Widget, {
|
|
28
29
|
division: division,
|
|
29
|
-
instrument: instrument
|
|
30
|
+
instrument: instrument,
|
|
31
|
+
includeDescriptionLabels: includeDescriptionLabels
|
|
30
32
|
}) : React.createElement(Tool, {
|
|
31
33
|
division: division
|
|
32
34
|
}))));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SentimentWidget.js","names":["React","ApolloClient","InMemoryCache","ApolloProvider","LocaleProvider","ThemeProvider","getLocale","Widget","Tool","translations","SentimentWidget","_ref","graphqlUrl","division","instrument","locale","theme","client","uri","cache","createElement"],"sources":["../../../src/SentimentWidget/SentimentWidget.tsx"],"sourcesContent":["import React from 'react';\nimport { ApolloClient, InMemoryCache, ApolloProvider } from '@apollo/client';\nimport { LocaleProvider } from '@oanda/mono-i18n';\nimport { ThemeProvider, getLocale } from '@oanda/labs-widget-common';\nimport { Widget } from './Widget';\nimport { Tool } from './Tool';\nimport { SentimentConfig } from './types';\nimport { translations } from '../translations';\n\nconst SentimentWidget = ({\n graphqlUrl, division, instrument, locale, theme,\n}: SentimentConfig) => {\n const client = new ApolloClient({\n uri: graphqlUrl,\n cache: new InMemoryCache(),\n });\n\n return (\n <ThemeProvider theme={theme}>\n <LocaleProvider locale={getLocale(locale)} translations={translations}>\n <ApolloProvider client={client}>\n {instrument ? (\n <Widget
|
|
1
|
+
{"version":3,"file":"SentimentWidget.js","names":["React","ApolloClient","InMemoryCache","ApolloProvider","LocaleProvider","ThemeProvider","getLocale","Widget","Tool","translations","SentimentWidget","_ref","graphqlUrl","division","instrument","locale","theme","includeDescriptionLabels","client","uri","cache","createElement"],"sources":["../../../src/SentimentWidget/SentimentWidget.tsx"],"sourcesContent":["import React from 'react';\nimport { ApolloClient, InMemoryCache, ApolloProvider } from '@apollo/client';\nimport { LocaleProvider } from '@oanda/mono-i18n';\nimport { ThemeProvider, getLocale } from '@oanda/labs-widget-common';\nimport { Widget } from './Widget';\nimport { Tool } from './Tool';\nimport { SentimentConfig } from './types';\nimport { translations } from '../translations';\n\nconst SentimentWidget = ({\n graphqlUrl, division, instrument, locale, theme, includeDescriptionLabels,\n}: SentimentConfig) => {\n const client = new ApolloClient({\n uri: graphqlUrl,\n cache: new InMemoryCache(),\n });\n\n return (\n <ThemeProvider theme={theme}>\n <LocaleProvider locale={getLocale(locale)} translations={translations}>\n <ApolloProvider client={client}>\n {instrument ? (\n <Widget\n division={division}\n instrument={instrument}\n includeDescriptionLabels={includeDescriptionLabels}\n />\n ) : (\n <Tool division={division} />\n )}\n </ApolloProvider>\n </LocaleProvider>\n </ThemeProvider>\n );\n};\n\nexport { SentimentWidget };\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,YAAY,EAAEC,aAAa,EAAEC,cAAc,QAAQ,gBAAgB;AAC5E,SAASC,cAAc,QAAQ,kBAAkB;AACjD,SAASC,aAAa,EAAEC,SAAS,QAAQ,2BAA2B;AACpE,SAASC,MAAM,QAAQ,UAAU;AACjC,SAASC,IAAI,QAAQ,QAAQ;AAE7B,SAASC,YAAY,QAAQ,iBAAiB;AAE9C,MAAMC,eAAe,GAAGC,IAAA,IAED;EAAA,IAFE;IACvBC,UAAU;IAAEC,QAAQ;IAAEC,UAAU;IAAEC,MAAM;IAAEC,KAAK;IAAEC;EAClC,CAAC,GAAAN,IAAA;EAChB,MAAMO,MAAM,GAAG,IAAIjB,YAAY,CAAC;IAC9BkB,GAAG,EAAEP,UAAU;IACfQ,KAAK,EAAE,IAAIlB,aAAa,CAAC;EAC3B,CAAC,CAAC;EAEF,OACEF,KAAA,CAAAqB,aAAA,CAAChB,aAAa;IAACW,KAAK,EAAEA;EAAM,GAC1BhB,KAAA,CAAAqB,aAAA,CAACjB,cAAc;IAACW,MAAM,EAAET,SAAS,CAACS,MAAM,CAAE;IAACN,YAAY,EAAEA;EAAa,GACpET,KAAA,CAAAqB,aAAA,CAAClB,cAAc;IAACe,MAAM,EAAEA;EAAO,GAC5BJ,UAAU,GACTd,KAAA,CAAAqB,aAAA,CAACd,MAAM;IACLM,QAAQ,EAAEA,QAAS;IACnBC,UAAU,EAAEA,UAAW;IACvBG,wBAAwB,EAAEA;EAAyB,CACpD,CAAC,GAEFjB,KAAA,CAAAqB,aAAA,CAACb,IAAI;IAACK,QAAQ,EAAEA;EAAS,CAAE,CAEf,CACF,CACH,CAAC;AAEpB,CAAC;AAED,SAASH,eAAe"}
|
|
@@ -8,7 +8,8 @@ const Widget = _ref => {
|
|
|
8
8
|
var _data$sentiment;
|
|
9
9
|
let {
|
|
10
10
|
instrument,
|
|
11
|
-
division
|
|
11
|
+
division,
|
|
12
|
+
includeDescriptionLabels = false
|
|
12
13
|
} = _ref;
|
|
13
14
|
const {
|
|
14
15
|
loading,
|
|
@@ -33,7 +34,13 @@ const Widget = _ref => {
|
|
|
33
34
|
return React.createElement(React.Fragment, null, React.createElement("div", {
|
|
34
35
|
"data-testid": "sentiment-widget",
|
|
35
36
|
className: "lw-border lw-border-solid lw-border-border-primary lw-bg-bg-primary lw-p-4 lw-text-sm lw-tracking-normal lw-text-text-primary"
|
|
36
|
-
}, React.createElement("div", {
|
|
37
|
+
}, includeDescriptionLabels && React.createElement("div", {
|
|
38
|
+
className: "lw-mb-2 lw-flex lw-justify-between lw-font-semibold"
|
|
39
|
+
}, React.createElement("span", {
|
|
40
|
+
className: "lw-ml-[7.5rem] lw-uppercase md:lw-ml-40"
|
|
41
|
+
}, lang('net_short')), React.createElement("span", {
|
|
42
|
+
className: "lw-text-right lw-uppercase md:lw-mr-10"
|
|
43
|
+
}, lang('net_long'))), React.createElement("div", {
|
|
37
44
|
className: "lw-flex lw-items-center lw-justify-between"
|
|
38
45
|
}, React.createElement("div", {
|
|
39
46
|
className: "lw-w-[120px] lw-shrink-0"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Widget.js","names":["React","Sentiment","SentimentHeight","Error","Loader","LoaderSize","Truncate","InfoBox","formatUpdatedTimestamp","useLocale","useQuery","getInstrumentSentiment","EMPTY_VALUE","INSTRUMENT_TOOLTIP_ID","Widget","_ref","_data$sentiment","instrument","division","loading","data","error","variables","name","fetchPolicy","lang","displayName","sentiment","updatedAt","isError","shortPercent","longPercent","undefined","createElement","Fragment","className","size","md","maxWidth","tooltipId","text","withError","isLoading","height","concat"],"sources":["../../../src/SentimentWidget/Widget.tsx"],"sourcesContent":["import React from 'react';\nimport {\n Sentiment, SentimentHeight, Error, Loader, LoaderSize, Truncate, InfoBox, formatUpdatedTimestamp,\n} from '@oanda/labs-widget-common';\nimport { useLocale } from '@oanda/mono-i18n';\nimport { useQuery } from '@apollo/client';\nimport { getInstrumentSentiment } from '../gql/getInstrumentSentiment';\nimport { SentimentWidgetConfig } from './types';\nimport { GetInstrumentSentimentQuery, GetInstrumentSentimentQueryVariables } from '../gql/types/graphql';\nimport { EMPTY_VALUE, INSTRUMENT_TOOLTIP_ID } from '../constant';\n\nconst Widget = ({
|
|
1
|
+
{"version":3,"file":"Widget.js","names":["React","Sentiment","SentimentHeight","Error","Loader","LoaderSize","Truncate","InfoBox","formatUpdatedTimestamp","useLocale","useQuery","getInstrumentSentiment","EMPTY_VALUE","INSTRUMENT_TOOLTIP_ID","Widget","_ref","_data$sentiment","instrument","division","includeDescriptionLabels","loading","data","error","variables","name","fetchPolicy","lang","displayName","sentiment","updatedAt","isError","shortPercent","longPercent","undefined","createElement","Fragment","className","size","md","maxWidth","tooltipId","text","withError","isLoading","height","concat"],"sources":["../../../src/SentimentWidget/Widget.tsx"],"sourcesContent":["import React from 'react';\nimport {\n Sentiment, SentimentHeight, Error, Loader, LoaderSize, Truncate, InfoBox, formatUpdatedTimestamp,\n} from '@oanda/labs-widget-common';\nimport { useLocale } from '@oanda/mono-i18n';\nimport { useQuery } from '@apollo/client';\nimport { getInstrumentSentiment } from '../gql/getInstrumentSentiment';\nimport { SentimentWidgetConfig } from './types';\nimport { GetInstrumentSentimentQuery, GetInstrumentSentimentQueryVariables } from '../gql/types/graphql';\nimport { EMPTY_VALUE, INSTRUMENT_TOOLTIP_ID } from '../constant';\n\nconst Widget = ({\n instrument,\n division,\n includeDescriptionLabels = false,\n}: SentimentWidgetConfig) => {\n const { loading, data, error } = useQuery<\n GetInstrumentSentimentQuery,\n GetInstrumentSentimentQueryVariables\n >(getInstrumentSentiment, {\n variables: {\n name: instrument,\n division,\n },\n fetchPolicy: 'cache-and-network',\n });\n\n const { lang } = useLocale();\n\n const { displayName, sentiment, updatedAt } = data?.sentiment?.[0] || {};\n\n const isError = error\n || (sentiment?.shortPercent === 0 && sentiment?.longPercent === 0)\n || sentiment?.shortPercent === undefined\n || sentiment?.longPercent === undefined;\n\n return (\n <>\n <div data-testid=\"sentiment-widget\" className=\"lw-border lw-border-solid lw-border-border-primary lw-bg-bg-primary lw-p-4 lw-text-sm lw-tracking-normal lw-text-text-primary\">\n {includeDescriptionLabels\n && (\n <div className=\"lw-mb-2 lw-flex lw-justify-between lw-font-semibold\">\n <span className=\"lw-ml-[7.5rem] lw-uppercase md:lw-ml-40\">{lang('net_short')}</span>\n <span className=\"lw-text-right lw-uppercase md:lw-mr-10\">{lang('net_long')}</span>\n </div>\n )}\n <div className=\"lw-flex lw-items-center lw-justify-between\">\n <div className=\"lw-w-[120px] lw-shrink-0\">\n {loading && <Loader size={LoaderSize.md} />}\n {!loading && !isError && (\n <Truncate\n maxWidth={120}\n tooltipId={INSTRUMENT_TOOLTIP_ID}\n className=\"lw-pr-2 lw-font-sans lw-text-sm lw-font-bold\"\n text={displayName || '\\u2014'}\n />\n )}\n </div>\n <Sentiment\n withError={false}\n isLoading={loading}\n height={SentimentHeight.md}\n sentiment={sentiment}\n />\n </div>\n\n {!loading && isError && <Error />}\n </div>\n {!isError && updatedAt && (\n <div className=\"lw-mt-2 lw-h-8\">\n <InfoBox text={`${lang('last_updated')}: ${formatUpdatedTimestamp(updatedAt, lang('today')) || EMPTY_VALUE}`} />\n </div>\n )}\n </>\n );\n};\n\nexport { Widget };\n"],"mappings":"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"}
|
|
@@ -19,14 +19,16 @@ if (sentimentParamsElements.length > 0) {
|
|
|
19
19
|
const {
|
|
20
20
|
instrument,
|
|
21
21
|
division,
|
|
22
|
-
locale
|
|
22
|
+
locale,
|
|
23
|
+
includeDescriptionLabels
|
|
23
24
|
} = JSON.parse(params);
|
|
24
25
|
render(React.createElement(SentimentWidget, {
|
|
25
26
|
graphqlUrl: graphqlUrl,
|
|
26
27
|
division: division,
|
|
27
28
|
instrument: instrument,
|
|
28
29
|
locale: locale,
|
|
29
|
-
theme: mode
|
|
30
|
+
theme: mode,
|
|
31
|
+
includeDescriptionLabels: includeDescriptionLabels
|
|
30
32
|
}), element);
|
|
31
33
|
});
|
|
32
34
|
} else {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"render.js","names":["React","render","SentimentWidget","graphqlUrl","configGraphQl","division","configDivision","instrument","configInstrument","renderElementId","configRenderElementId","locale","configLocale","window","sentimentWidgetConfig","widgetsConfig","sentimentParamsElements","document","querySelectorAll","length","forEach","element","params","getAttribute","mode","JSON","parse","createElement","theme","getElementById"],"sources":["../../../src/SentimentWidget/render.tsx"],"sourcesContent":["import React from 'react';\nimport { render } from 'react-dom';\nimport { Theme } from '@oanda/labs-widget-common';\nimport { SentimentWidget } from './SentimentWidget';\n\nconst {\n graphqlUrl: configGraphQl,\n division: configDivision,\n instrument: configInstrument,\n renderElementId: configRenderElementId,\n locale: configLocale,\n} = window.sentimentWidgetConfig || {};\n\nconst {\n graphqlUrl,\n} = window.widgetsConfig || {};\n\nconst sentimentParamsElements = document.querySelectorAll('div[data-sentiment-params]');\n\nif (sentimentParamsElements.length > 0) {\n sentimentParamsElements.forEach((element) => {\n const params = element.getAttribute('data-sentiment-params');\n const mode = element.getAttribute('data-mode');\n const {
|
|
1
|
+
{"version":3,"file":"render.js","names":["React","render","SentimentWidget","graphqlUrl","configGraphQl","division","configDivision","instrument","configInstrument","renderElementId","configRenderElementId","locale","configLocale","window","sentimentWidgetConfig","widgetsConfig","sentimentParamsElements","document","querySelectorAll","length","forEach","element","params","getAttribute","mode","includeDescriptionLabels","JSON","parse","createElement","theme","getElementById"],"sources":["../../../src/SentimentWidget/render.tsx"],"sourcesContent":["import React from 'react';\nimport { render } from 'react-dom';\nimport { Theme } from '@oanda/labs-widget-common';\nimport { SentimentWidget } from './SentimentWidget';\n\nconst {\n graphqlUrl: configGraphQl,\n division: configDivision,\n instrument: configInstrument,\n renderElementId: configRenderElementId,\n locale: configLocale,\n} = window.sentimentWidgetConfig || {};\n\nconst {\n graphqlUrl,\n} = window.widgetsConfig || {};\n\nconst sentimentParamsElements = document.querySelectorAll('div[data-sentiment-params]');\n\nif (sentimentParamsElements.length > 0) {\n sentimentParamsElements.forEach((element) => {\n const params = element.getAttribute('data-sentiment-params');\n const mode = element.getAttribute('data-mode');\n const {\n instrument, division, locale, includeDescriptionLabels,\n } = JSON.parse(params as string);\n\n render(\n <SentimentWidget\n graphqlUrl={graphqlUrl}\n division={division}\n instrument={instrument}\n locale={locale}\n theme={mode as Theme}\n includeDescriptionLabels={includeDescriptionLabels}\n />,\n element,\n );\n });\n} else {\n render(\n <SentimentWidget\n graphqlUrl={configGraphQl}\n division={configDivision}\n instrument={configInstrument}\n locale={configLocale}\n />,\n document.getElementById(configRenderElementId),\n );\n}\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,MAAM,QAAQ,WAAW;AAElC,SAASC,eAAe,QAAQ,mBAAmB;AAEnD,MAAM;EACJC,UAAU,EAAEC,aAAa;EACzBC,QAAQ,EAAEC,cAAc;EACxBC,UAAU,EAAEC,gBAAgB;EAC5BC,eAAe,EAAEC,qBAAqB;EACtCC,MAAM,EAAEC;AACV,CAAC,GAAGC,MAAM,CAACC,qBAAqB,IAAI,CAAC,CAAC;AAEtC,MAAM;EACJX;AACF,CAAC,GAAGU,MAAM,CAACE,aAAa,IAAI,CAAC,CAAC;AAE9B,MAAMC,uBAAuB,GAAGC,QAAQ,CAACC,gBAAgB,CAAC,4BAA4B,CAAC;AAEvF,IAAIF,uBAAuB,CAACG,MAAM,GAAG,CAAC,EAAE;EACtCH,uBAAuB,CAACI,OAAO,CAAEC,OAAO,IAAK;IAC3C,MAAMC,MAAM,GAAGD,OAAO,CAACE,YAAY,CAAC,uBAAuB,CAAC;IAC5D,MAAMC,IAAI,GAAGH,OAAO,CAACE,YAAY,CAAC,WAAW,CAAC;IAC9C,MAAM;MACJhB,UAAU;MAAEF,QAAQ;MAAEM,MAAM;MAAEc;IAChC,CAAC,GAAGC,IAAI,CAACC,KAAK,CAACL,MAAgB,CAAC;IAEhCrB,MAAM,CACJD,KAAA,CAAA4B,aAAA,CAAC1B,eAAe;MACdC,UAAU,EAAEA,UAAW;MACvBE,QAAQ,EAAEA,QAAS;MACnBE,UAAU,EAAEA,UAAW;MACvBI,MAAM,EAAEA,MAAO;MACfkB,KAAK,EAAEL,IAAc;MACrBC,wBAAwB,EAAEA;IAAyB,CACpD,CAAC,EACFJ,OACF,CAAC;EACH,CAAC,CAAC;AACJ,CAAC,MAAM;EACLpB,MAAM,CACJD,KAAA,CAAA4B,aAAA,CAAC1B,eAAe;IACdC,UAAU,EAAEC,aAAc;IAC1BC,QAAQ,EAAEC,cAAe;IACzBC,UAAU,EAAEC,gBAAiB;IAC7BG,MAAM,EAAEC;EAAa,CACtB,CAAC,EACFK,QAAQ,CAACa,cAAc,CAACpB,qBAAqB,CAC/C,CAAC;AACH"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","names":[],"sources":["../../../src/SentimentWidget/types.ts"],"sourcesContent":["import { Locale } from '@oanda/mono-i18n';\nimport { Theme } from '@oanda/labs-widget-common';\nimport { Division } from '../gql/types/graphql';\n\nexport interface SentimentConfig {\n graphqlUrl: string;\n division: Division;\n instrument?: string;\n locale: Locale;\n theme?: Theme;\n}\nexport interface SentimentWrapperConfig extends SentimentConfig {\n renderElementId: string;\n}\nexport interface SentimentWidgetConfig {\n division: Division;\n instrument: string;\n}\n\nexport interface SentimentToolConfig {\n division: Division;\n}\n"],"mappings":""}
|
|
1
|
+
{"version":3,"file":"types.js","names":[],"sources":["../../../src/SentimentWidget/types.ts"],"sourcesContent":["import { Locale } from '@oanda/mono-i18n';\nimport { Theme } from '@oanda/labs-widget-common';\nimport { Division } from '../gql/types/graphql';\n\nexport interface SentimentConfig {\n graphqlUrl: string;\n division: Division;\n instrument?: string;\n locale: Locale;\n theme?: Theme;\n includeDescriptionLabels?: boolean;\n}\nexport interface SentimentWrapperConfig extends SentimentConfig {\n renderElementId: string;\n}\nexport interface SentimentWidgetConfig {\n division: Division;\n instrument: string;\n includeDescriptionLabels?: boolean;\n}\n\nexport interface SentimentToolConfig {\n division: Division;\n}\n"],"mappings":""}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { SentimentConfig } from './types';
|
|
3
|
-
declare const SentimentWidget: ({ graphqlUrl, division, instrument, locale, theme, }: SentimentConfig) => JSX.Element;
|
|
3
|
+
declare const SentimentWidget: ({ graphqlUrl, division, instrument, locale, theme, includeDescriptionLabels, }: SentimentConfig) => JSX.Element;
|
|
4
4
|
export { SentimentWidget };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { SentimentWidgetConfig } from './types';
|
|
3
|
-
declare const Widget: ({ instrument, division }: SentimentWidgetConfig) => JSX.Element;
|
|
3
|
+
declare const Widget: ({ instrument, division, includeDescriptionLabels, }: SentimentWidgetConfig) => JSX.Element;
|
|
4
4
|
export { Widget };
|
|
@@ -7,6 +7,7 @@ export interface SentimentConfig {
|
|
|
7
7
|
instrument?: string;
|
|
8
8
|
locale: Locale;
|
|
9
9
|
theme?: Theme;
|
|
10
|
+
includeDescriptionLabels?: boolean;
|
|
10
11
|
}
|
|
11
12
|
export interface SentimentWrapperConfig extends SentimentConfig {
|
|
12
13
|
renderElementId: string;
|
|
@@ -14,6 +15,7 @@ export interface SentimentWrapperConfig extends SentimentConfig {
|
|
|
14
15
|
export interface SentimentWidgetConfig {
|
|
15
16
|
division: Division;
|
|
16
17
|
instrument: string;
|
|
18
|
+
includeDescriptionLabels?: boolean;
|
|
17
19
|
}
|
|
18
20
|
export interface SentimentToolConfig {
|
|
19
21
|
division: Division;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oanda/labs-sentiment-widget",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.71",
|
|
4
4
|
"description": "Labs Sentiment Widget",
|
|
5
5
|
"main": "dist/main/index.js",
|
|
6
6
|
"module": "dist/module/index.js",
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"license": "UNLICENSED",
|
|
14
14
|
"dependencies": {
|
|
15
15
|
"@apollo/client": "3.7.17",
|
|
16
|
-
"@oanda/labs-widget-common": "^1.0.
|
|
16
|
+
"@oanda/labs-widget-common": "^1.0.71",
|
|
17
17
|
"@oanda/mono-i18n": "9.0.0",
|
|
18
18
|
"classnames": "2.3.2",
|
|
19
19
|
"graphql": "16.7.1"
|
|
@@ -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": "cec7ba5744ff5ccdd32d0240300b6895c094cb8b"
|
|
26
26
|
}
|
|
@@ -8,7 +8,7 @@ import { SentimentConfig } from './types';
|
|
|
8
8
|
import { translations } from '../translations';
|
|
9
9
|
|
|
10
10
|
const SentimentWidget = ({
|
|
11
|
-
graphqlUrl, division, instrument, locale, theme,
|
|
11
|
+
graphqlUrl, division, instrument, locale, theme, includeDescriptionLabels,
|
|
12
12
|
}: SentimentConfig) => {
|
|
13
13
|
const client = new ApolloClient({
|
|
14
14
|
uri: graphqlUrl,
|
|
@@ -20,7 +20,11 @@ const SentimentWidget = ({
|
|
|
20
20
|
<LocaleProvider locale={getLocale(locale)} translations={translations}>
|
|
21
21
|
<ApolloProvider client={client}>
|
|
22
22
|
{instrument ? (
|
|
23
|
-
<Widget
|
|
23
|
+
<Widget
|
|
24
|
+
division={division}
|
|
25
|
+
instrument={instrument}
|
|
26
|
+
includeDescriptionLabels={includeDescriptionLabels}
|
|
27
|
+
/>
|
|
24
28
|
) : (
|
|
25
29
|
<Tool division={division} />
|
|
26
30
|
)}
|
|
@@ -9,7 +9,11 @@ import { SentimentWidgetConfig } from './types';
|
|
|
9
9
|
import { GetInstrumentSentimentQuery, GetInstrumentSentimentQueryVariables } from '../gql/types/graphql';
|
|
10
10
|
import { EMPTY_VALUE, INSTRUMENT_TOOLTIP_ID } from '../constant';
|
|
11
11
|
|
|
12
|
-
const Widget = ({
|
|
12
|
+
const Widget = ({
|
|
13
|
+
instrument,
|
|
14
|
+
division,
|
|
15
|
+
includeDescriptionLabels = false,
|
|
16
|
+
}: SentimentWidgetConfig) => {
|
|
13
17
|
const { loading, data, error } = useQuery<
|
|
14
18
|
GetInstrumentSentimentQuery,
|
|
15
19
|
GetInstrumentSentimentQueryVariables
|
|
@@ -33,6 +37,13 @@ const Widget = ({ instrument, division }: SentimentWidgetConfig) => {
|
|
|
33
37
|
return (
|
|
34
38
|
<>
|
|
35
39
|
<div data-testid="sentiment-widget" className="lw-border lw-border-solid lw-border-border-primary lw-bg-bg-primary lw-p-4 lw-text-sm lw-tracking-normal lw-text-text-primary">
|
|
40
|
+
{includeDescriptionLabels
|
|
41
|
+
&& (
|
|
42
|
+
<div className="lw-mb-2 lw-flex lw-justify-between lw-font-semibold">
|
|
43
|
+
<span className="lw-ml-[7.5rem] lw-uppercase md:lw-ml-40">{lang('net_short')}</span>
|
|
44
|
+
<span className="lw-text-right lw-uppercase md:lw-mr-10">{lang('net_long')}</span>
|
|
45
|
+
</div>
|
|
46
|
+
)}
|
|
36
47
|
<div className="lw-flex lw-items-center lw-justify-between">
|
|
37
48
|
<div className="lw-w-[120px] lw-shrink-0">
|
|
38
49
|
{loading && <Loader size={LoaderSize.md} />}
|
|
@@ -21,7 +21,9 @@ if (sentimentParamsElements.length > 0) {
|
|
|
21
21
|
sentimentParamsElements.forEach((element) => {
|
|
22
22
|
const params = element.getAttribute('data-sentiment-params');
|
|
23
23
|
const mode = element.getAttribute('data-mode');
|
|
24
|
-
const {
|
|
24
|
+
const {
|
|
25
|
+
instrument, division, locale, includeDescriptionLabels,
|
|
26
|
+
} = JSON.parse(params as string);
|
|
25
27
|
|
|
26
28
|
render(
|
|
27
29
|
<SentimentWidget
|
|
@@ -30,6 +32,7 @@ if (sentimentParamsElements.length > 0) {
|
|
|
30
32
|
instrument={instrument}
|
|
31
33
|
locale={locale}
|
|
32
34
|
theme={mode as Theme}
|
|
35
|
+
includeDescriptionLabels={includeDescriptionLabels}
|
|
33
36
|
/>,
|
|
34
37
|
element,
|
|
35
38
|
);
|
|
@@ -8,6 +8,7 @@ export interface SentimentConfig {
|
|
|
8
8
|
instrument?: string;
|
|
9
9
|
locale: Locale;
|
|
10
10
|
theme?: Theme;
|
|
11
|
+
includeDescriptionLabels?: boolean;
|
|
11
12
|
}
|
|
12
13
|
export interface SentimentWrapperConfig extends SentimentConfig {
|
|
13
14
|
renderElementId: string;
|
|
@@ -15,6 +16,7 @@ export interface SentimentWrapperConfig extends SentimentConfig {
|
|
|
15
16
|
export interface SentimentWidgetConfig {
|
|
16
17
|
division: Division;
|
|
17
18
|
instrument: string;
|
|
19
|
+
includeDescriptionLabels?: boolean;
|
|
18
20
|
}
|
|
19
21
|
|
|
20
22
|
export interface SentimentToolConfig {
|
package/test/Tool.test.tsx
CHANGED
|
@@ -26,6 +26,7 @@ const mocks = [
|
|
|
26
26
|
longPercent: 87.67,
|
|
27
27
|
shortPercent: 12.33,
|
|
28
28
|
},
|
|
29
|
+
updatedAt: '2023-12-02T10:00:08.509215576Z',
|
|
29
30
|
},
|
|
30
31
|
{
|
|
31
32
|
name: 'AUD/CAD',
|
|
@@ -34,6 +35,7 @@ const mocks = [
|
|
|
34
35
|
longPercent: 85.74,
|
|
35
36
|
shortPercent: 14.26,
|
|
36
37
|
},
|
|
38
|
+
updatedAt: '2023-12-02T10:00:08.509215576Z',
|
|
37
39
|
},
|
|
38
40
|
{
|
|
39
41
|
name: 'EUR/USD',
|
|
@@ -42,6 +44,7 @@ const mocks = [
|
|
|
42
44
|
longPercent: 74.8,
|
|
43
45
|
shortPercent: 25.2,
|
|
44
46
|
},
|
|
47
|
+
updatedAt: '2023-12-02T10:00:08.509215576Z',
|
|
45
48
|
}],
|
|
46
49
|
},
|
|
47
50
|
},
|