@oanda/labs-sentiment-widget 1.0.79 → 1.0.81

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 CHANGED
@@ -3,6 +3,626 @@
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.81 (2024-02-05)
7
+
8
+
9
+
10
+ ## 1.0.80 (2024-02-05)
11
+
12
+
13
+
14
+ ## 1.0.79 (2024-02-05)
15
+
16
+
17
+
18
+ ## 1.0.78 (2024-01-30)
19
+
20
+
21
+
22
+ ## 1.0.77 (2024-01-25)
23
+
24
+
25
+
26
+ ## 1.0.76 (2024-01-25)
27
+
28
+
29
+
30
+ ## 1.0.75 (2024-01-22)
31
+
32
+
33
+
34
+ ## 1.0.74 (2024-01-22)
35
+
36
+
37
+
38
+ ## 1.0.73 (2024-01-22)
39
+
40
+
41
+
42
+ ## 1.0.72 (2024-01-19)
43
+
44
+
45
+
46
+ ## 1.0.71 (2024-01-18)
47
+
48
+
49
+
50
+ ## 1.0.70 (2024-01-17)
51
+
52
+
53
+
54
+ ## 1.0.69 (2024-01-17)
55
+
56
+
57
+
58
+ ## 1.0.68 (2024-01-15)
59
+
60
+
61
+
62
+ ## 1.0.67 (2024-01-15)
63
+
64
+
65
+
66
+ ## 1.0.66 (2024-01-12)
67
+
68
+
69
+
70
+ ## 1.0.65 (2024-01-11)
71
+
72
+
73
+
74
+ ## 1.0.64 (2024-01-11)
75
+
76
+
77
+
78
+ ## 1.0.63 (2024-01-11)
79
+
80
+
81
+
82
+ ## 1.0.62 (2024-01-10)
83
+
84
+
85
+
86
+ ## 1.0.61 (2024-01-09)
87
+
88
+
89
+
90
+ ## 1.0.60 (2024-01-05)
91
+
92
+
93
+
94
+ ## 1.0.59 (2023-12-27)
95
+
96
+
97
+
98
+ ## 1.0.58 (2023-12-22)
99
+
100
+
101
+
102
+ ## 1.0.57 (2023-12-22)
103
+
104
+
105
+
106
+ ## 1.0.56 (2023-12-21)
107
+
108
+
109
+
110
+ ## 1.0.55 (2023-12-19)
111
+
112
+
113
+
114
+ ## 1.0.54 (2023-12-15)
115
+
116
+
117
+
118
+ ## 1.0.53 (2023-12-13)
119
+
120
+
121
+
122
+ ## 1.0.52 (2023-12-13)
123
+
124
+
125
+
126
+ ## 1.0.51 (2023-12-07)
127
+
128
+
129
+
130
+ ## 1.0.50 (2023-12-04)
131
+
132
+
133
+
134
+ ## 1.0.49 (2023-12-01)
135
+
136
+
137
+
138
+ ## 1.0.48 (2023-12-01)
139
+
140
+
141
+
142
+ ## 1.0.47 (2023-11-29)
143
+
144
+
145
+
146
+ ## 1.0.46 (2023-11-28)
147
+
148
+
149
+
150
+ ## 1.0.45 (2023-11-23)
151
+
152
+
153
+
154
+ ## 1.0.44 (2023-11-22)
155
+
156
+
157
+
158
+ ## 1.0.43 (2023-11-15)
159
+
160
+
161
+
162
+ ## 1.0.42 (2023-11-10)
163
+
164
+
165
+
166
+ ## 1.0.41 (2023-11-03)
167
+
168
+
169
+
170
+ ## 1.0.40 (2023-11-02)
171
+
172
+
173
+
174
+ ## 1.0.39 (2023-11-02)
175
+
176
+
177
+
178
+ ## 1.0.38 (2023-10-26)
179
+
180
+
181
+
182
+ ## 1.0.37 (2023-10-26)
183
+
184
+
185
+
186
+ ## 1.0.36 (2023-10-25)
187
+
188
+
189
+
190
+ ## 1.0.35 (2023-10-24)
191
+
192
+
193
+
194
+ ## 1.0.34 (2023-10-23)
195
+
196
+
197
+
198
+ ## 1.0.33 (2023-10-23)
199
+
200
+
201
+
202
+ ## 1.0.32 (2023-10-23)
203
+
204
+
205
+
206
+ ## 1.0.31 (2023-10-20)
207
+
208
+
209
+
210
+ ## 1.0.30 (2023-10-19)
211
+
212
+
213
+
214
+ ## 1.0.29 (2023-10-19)
215
+
216
+
217
+
218
+ ## 1.0.28 (2023-10-19)
219
+
220
+
221
+
222
+ ## 1.0.27 (2023-10-18)
223
+
224
+
225
+
226
+ ## 1.0.26 (2023-10-18)
227
+
228
+
229
+
230
+ ## 1.0.25 (2023-10-17)
231
+
232
+
233
+
234
+ ## 1.0.24 (2023-10-13)
235
+
236
+
237
+
238
+ ## 1.0.23 (2023-10-13)
239
+
240
+
241
+
242
+ ## 1.0.22 (2023-10-11)
243
+
244
+
245
+
246
+ ## 1.0.21 (2023-10-10)
247
+
248
+
249
+
250
+ ## 1.0.20 (2023-10-06)
251
+
252
+
253
+
254
+ ## 1.0.19 (2023-10-06)
255
+
256
+
257
+
258
+ ## 1.0.18 (2023-10-05)
259
+
260
+
261
+
262
+ ## 1.0.17 (2023-10-04)
263
+
264
+
265
+
266
+ ## 1.0.16 (2023-10-04)
267
+
268
+
269
+
270
+ ## 1.0.15 (2023-10-04)
271
+
272
+
273
+
274
+ ## 1.0.14 (2023-10-03)
275
+
276
+
277
+
278
+ ## 1.0.13 (2023-10-03)
279
+
280
+
281
+
282
+ ## 1.0.12 (2023-10-03)
283
+
284
+
285
+
286
+ ## 1.0.11 (2023-10-02)
287
+
288
+
289
+
290
+ ## 1.0.10 (2023-09-29)
291
+
292
+
293
+
294
+ ## 1.0.9 (2023-09-28)
295
+
296
+
297
+
298
+ ## 1.0.8 (2023-09-27)
299
+
300
+
301
+
302
+ ## 1.0.7 (2023-09-26)
303
+
304
+
305
+
306
+ ## 1.0.6 (2023-09-21)
307
+
308
+
309
+
310
+ ## 1.0.5 (2023-09-13)
311
+
312
+ **Note:** Version bump only for package @oanda/labs-sentiment-widget
313
+
314
+
315
+
316
+
317
+
318
+ ## 1.0.80 (2024-02-05)
319
+
320
+
321
+
322
+ ## 1.0.79 (2024-02-05)
323
+
324
+
325
+
326
+ ## 1.0.78 (2024-01-30)
327
+
328
+
329
+
330
+ ## 1.0.77 (2024-01-25)
331
+
332
+
333
+
334
+ ## 1.0.76 (2024-01-25)
335
+
336
+
337
+
338
+ ## 1.0.75 (2024-01-22)
339
+
340
+
341
+
342
+ ## 1.0.74 (2024-01-22)
343
+
344
+
345
+
346
+ ## 1.0.73 (2024-01-22)
347
+
348
+
349
+
350
+ ## 1.0.72 (2024-01-19)
351
+
352
+
353
+
354
+ ## 1.0.71 (2024-01-18)
355
+
356
+
357
+
358
+ ## 1.0.70 (2024-01-17)
359
+
360
+
361
+
362
+ ## 1.0.69 (2024-01-17)
363
+
364
+
365
+
366
+ ## 1.0.68 (2024-01-15)
367
+
368
+
369
+
370
+ ## 1.0.67 (2024-01-15)
371
+
372
+
373
+
374
+ ## 1.0.66 (2024-01-12)
375
+
376
+
377
+
378
+ ## 1.0.65 (2024-01-11)
379
+
380
+
381
+
382
+ ## 1.0.64 (2024-01-11)
383
+
384
+
385
+
386
+ ## 1.0.63 (2024-01-11)
387
+
388
+
389
+
390
+ ## 1.0.62 (2024-01-10)
391
+
392
+
393
+
394
+ ## 1.0.61 (2024-01-09)
395
+
396
+
397
+
398
+ ## 1.0.60 (2024-01-05)
399
+
400
+
401
+
402
+ ## 1.0.59 (2023-12-27)
403
+
404
+
405
+
406
+ ## 1.0.58 (2023-12-22)
407
+
408
+
409
+
410
+ ## 1.0.57 (2023-12-22)
411
+
412
+
413
+
414
+ ## 1.0.56 (2023-12-21)
415
+
416
+
417
+
418
+ ## 1.0.55 (2023-12-19)
419
+
420
+
421
+
422
+ ## 1.0.54 (2023-12-15)
423
+
424
+
425
+
426
+ ## 1.0.53 (2023-12-13)
427
+
428
+
429
+
430
+ ## 1.0.52 (2023-12-13)
431
+
432
+
433
+
434
+ ## 1.0.51 (2023-12-07)
435
+
436
+
437
+
438
+ ## 1.0.50 (2023-12-04)
439
+
440
+
441
+
442
+ ## 1.0.49 (2023-12-01)
443
+
444
+
445
+
446
+ ## 1.0.48 (2023-12-01)
447
+
448
+
449
+
450
+ ## 1.0.47 (2023-11-29)
451
+
452
+
453
+
454
+ ## 1.0.46 (2023-11-28)
455
+
456
+
457
+
458
+ ## 1.0.45 (2023-11-23)
459
+
460
+
461
+
462
+ ## 1.0.44 (2023-11-22)
463
+
464
+
465
+
466
+ ## 1.0.43 (2023-11-15)
467
+
468
+
469
+
470
+ ## 1.0.42 (2023-11-10)
471
+
472
+
473
+
474
+ ## 1.0.41 (2023-11-03)
475
+
476
+
477
+
478
+ ## 1.0.40 (2023-11-02)
479
+
480
+
481
+
482
+ ## 1.0.39 (2023-11-02)
483
+
484
+
485
+
486
+ ## 1.0.38 (2023-10-26)
487
+
488
+
489
+
490
+ ## 1.0.37 (2023-10-26)
491
+
492
+
493
+
494
+ ## 1.0.36 (2023-10-25)
495
+
496
+
497
+
498
+ ## 1.0.35 (2023-10-24)
499
+
500
+
501
+
502
+ ## 1.0.34 (2023-10-23)
503
+
504
+
505
+
506
+ ## 1.0.33 (2023-10-23)
507
+
508
+
509
+
510
+ ## 1.0.32 (2023-10-23)
511
+
512
+
513
+
514
+ ## 1.0.31 (2023-10-20)
515
+
516
+
517
+
518
+ ## 1.0.30 (2023-10-19)
519
+
520
+
521
+
522
+ ## 1.0.29 (2023-10-19)
523
+
524
+
525
+
526
+ ## 1.0.28 (2023-10-19)
527
+
528
+
529
+
530
+ ## 1.0.27 (2023-10-18)
531
+
532
+
533
+
534
+ ## 1.0.26 (2023-10-18)
535
+
536
+
537
+
538
+ ## 1.0.25 (2023-10-17)
539
+
540
+
541
+
542
+ ## 1.0.24 (2023-10-13)
543
+
544
+
545
+
546
+ ## 1.0.23 (2023-10-13)
547
+
548
+
549
+
550
+ ## 1.0.22 (2023-10-11)
551
+
552
+
553
+
554
+ ## 1.0.21 (2023-10-10)
555
+
556
+
557
+
558
+ ## 1.0.20 (2023-10-06)
559
+
560
+
561
+
562
+ ## 1.0.19 (2023-10-06)
563
+
564
+
565
+
566
+ ## 1.0.18 (2023-10-05)
567
+
568
+
569
+
570
+ ## 1.0.17 (2023-10-04)
571
+
572
+
573
+
574
+ ## 1.0.16 (2023-10-04)
575
+
576
+
577
+
578
+ ## 1.0.15 (2023-10-04)
579
+
580
+
581
+
582
+ ## 1.0.14 (2023-10-03)
583
+
584
+
585
+
586
+ ## 1.0.13 (2023-10-03)
587
+
588
+
589
+
590
+ ## 1.0.12 (2023-10-03)
591
+
592
+
593
+
594
+ ## 1.0.11 (2023-10-02)
595
+
596
+
597
+
598
+ ## 1.0.10 (2023-09-29)
599
+
600
+
601
+
602
+ ## 1.0.9 (2023-09-28)
603
+
604
+
605
+
606
+ ## 1.0.8 (2023-09-27)
607
+
608
+
609
+
610
+ ## 1.0.7 (2023-09-26)
611
+
612
+
613
+
614
+ ## 1.0.6 (2023-09-21)
615
+
616
+
617
+
618
+ ## 1.0.5 (2023-09-13)
619
+
620
+ **Note:** Version bump only for package @oanda/labs-sentiment-widget
621
+
622
+
623
+
624
+
625
+
6
626
  ## 1.0.79 (2024-02-05)
7
627
 
8
628
 
@@ -19,7 +19,8 @@ const SentimentWidget = _ref => {
19
19
  instrument,
20
20
  locale,
21
21
  theme,
22
- includeDescriptionLabels
22
+ includeDescriptionLabels,
23
+ isParamError
23
24
  } = _ref;
24
25
  const client = new _client.ApolloClient({
25
26
  uri: graphqlUrl,
@@ -32,13 +33,15 @@ const SentimentWidget = _ref => {
32
33
  translations: _translations.translations
33
34
  }, _react.default.createElement(_client.ApolloProvider, {
34
35
  client: client
35
- }, instrument ? _react.default.createElement(_Widget.Widget, {
36
+ }, isParamError ? _react.default.createElement("div", {
37
+ className: "lw-flex lw-h-[425px] lw-w-full lw-items-center lw-border lw-border-solid lw-border-border-primary"
38
+ }, _react.default.createElement(_labsWidgetCommon.ChartError, null)) : _react.default.createElement(_react.default.Fragment, null, instrument ? _react.default.createElement(_Widget.Widget, {
36
39
  division: division,
37
40
  instrument: instrument,
38
41
  includeDescriptionLabels: includeDescriptionLabels
39
42
  }) : _react.default.createElement(_Tool.Tool, {
40
43
  division: division
41
- }))));
44
+ })))));
42
45
  };
43
46
  exports.SentimentWidget = SentimentWidget;
44
47
  //# sourceMappingURL=SentimentWidget.js.map
@@ -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","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"}
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","isParamError","client","ApolloClient","uri","cache","InMemoryCache","createElement","ThemeProvider","LocaleProvider","getLocale","translations","ApolloProvider","className","ChartError","Fragment","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 { ChartError, 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, isParamError,\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 {isParamError ? (\n <div className=\"lw-flex lw-h-[425px] lw-w-full lw-items-center lw-border lw-border-solid lw-border-border-primary\">\n <ChartError />\n </div>\n ) : (\n <>\n {instrument ? (\n <Widget\n division={division}\n instrument={instrument}\n includeDescriptionLabels={includeDescriptionLabels}\n />\n ) : (\n <Tool division={division} />\n )}\n </>\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,wBAAwB;IAAEC;EAC5D,CAAC,GAAAP,IAAA;EAChB,MAAMQ,MAAM,GAAG,IAAIC,oBAAY,CAAC;IAC9BC,GAAG,EAAET,UAAU;IACfU,KAAK,EAAE,IAAIC,qBAAa,CAAC;EAC3B,CAAC,CAAC;EAEF,OACEzB,MAAA,CAAAW,OAAA,CAAAe,aAAA,CAACrB,iBAAA,CAAAsB,aAAa;IAACT,KAAK,EAAEA;EAAM,GAC1BlB,MAAA,CAAAW,OAAA,CAAAe,aAAA,CAACtB,SAAA,CAAAwB,cAAc;IAACX,MAAM,EAAE,IAAAY,2BAAS,EAACZ,MAAM,CAAE;IAACa,YAAY,EAAEA;EAAa,GACpE9B,MAAA,CAAAW,OAAA,CAAAe,aAAA,CAACvB,OAAA,CAAA4B,cAAc;IAACV,MAAM,EAAEA;EAAO,GAC5BD,YAAY,GACXpB,MAAA,CAAAW,OAAA,CAAAe,aAAA;IAAKM,SAAS,EAAC;EAAmG,GAChHhC,MAAA,CAAAW,OAAA,CAAAe,aAAA,CAACrB,iBAAA,CAAA4B,UAAU,MAAE,CACV,CAAC,GAENjC,MAAA,CAAAW,OAAA,CAAAe,aAAA,CAAA1B,MAAA,CAAAW,OAAA,CAAAuB,QAAA,QACGlB,UAAU,GACThB,MAAA,CAAAW,OAAA,CAAAe,aAAA,CAACpB,OAAA,CAAA6B,MAAM;IACLpB,QAAQ,EAAEA,QAAS;IACnBC,UAAU,EAAEA,UAAW;IACvBG,wBAAwB,EAAEA;EAAyB,CACpD,CAAC,GAEFnB,MAAA,CAAAW,OAAA,CAAAe,aAAA,CAACnB,KAAA,CAAA6B,IAAI;IAACrB,QAAQ,EAAEA;EAAS,CAAE,CAE7B,CAEU,CACF,CACH,CAAC;AAEpB,CAAC;AAACsB,OAAA,CAAAzB,eAAA,GAAAA,eAAA"}
@@ -2,7 +2,9 @@
2
2
 
3
3
  var _react = _interopRequireDefault(require("react"));
4
4
  var _reactDom = require("react-dom");
5
+ var _labsWidgetCommon = require("@oanda/labs-widget-common");
5
6
  var _SentimentWidget = require("./SentimentWidget");
7
+ var _graphql = require("../gql/types/graphql");
6
8
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
7
9
  const {
8
10
  graphqlUrl: configGraphQl,
@@ -25,13 +27,28 @@ if (sentimentParamsElements.length > 0) {
25
27
  locale,
26
28
  includeDescriptionLabels
27
29
  } = JSON.parse(params);
30
+ const isParamError = (0, _labsWidgetCommon.validateToolParams)({
31
+ division,
32
+ locale,
33
+ graphqlUrl
34
+ }, [{
35
+ name: 'locale',
36
+ valueCheck: value => value.split('-')[0] === 'en' || value.split('-')[0] === 'zh'
37
+ }, {
38
+ name: 'division',
39
+ valueCheck: value => Object.values(_graphql.Division).includes(value)
40
+ }, {
41
+ name: 'graphqlUrl',
42
+ valueCheck: value => !!value
43
+ }]);
28
44
  (0, _reactDom.render)(_react.default.createElement(_SentimentWidget.SentimentWidget, {
29
45
  graphqlUrl: graphqlUrl,
30
46
  division: division,
31
47
  instrument: instrument,
32
48
  locale: locale,
33
49
  theme: mode,
34
- includeDescriptionLabels: includeDescriptionLabels
50
+ includeDescriptionLabels: includeDescriptionLabels,
51
+ isParamError: isParamError
35
52
  }), element);
36
53
  });
37
54
  } 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","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
+ {"version":3,"file":"render.js","names":["_react","_interopRequireDefault","require","_reactDom","_labsWidgetCommon","_SentimentWidget","_graphql","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","isParamError","validateToolParams","name","valueCheck","value","split","Object","values","Division","includes","render","createElement","SentimentWidget","theme","getElementById"],"sources":["../../../src/SentimentWidget/render.tsx"],"sourcesContent":["import React from 'react';\nimport { render } from 'react-dom';\nimport { Theme, validateToolParams } from '@oanda/labs-widget-common';\nimport { SentimentWidget } from './SentimentWidget';\nimport { Division } from '../gql/types/graphql';\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 const isParamError = validateToolParams({ division, locale, graphqlUrl }, [\n {\n name: 'locale',\n valueCheck: (value) => value.split('-')[0] === 'en' || value.split('-')[0] === 'zh',\n }, {\n name: 'division',\n valueCheck: (value) => Object.values(Division).includes(value),\n }, {\n name: 'graphqlUrl',\n valueCheck: (value) => !!value,\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 isParamError={isParamError}\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;AACA,IAAAE,iBAAA,GAAAF,OAAA;AACA,IAAAG,gBAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AAAgD,SAAAD,uBAAAM,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAEhD,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,MAAMM,YAAY,GAAG,IAAAC,oCAAkB,EAAC;MAAExB,QAAQ;MAAEM,MAAM;MAAER;IAAW,CAAC,EAAE,CACxE;MACE2B,IAAI,EAAE,QAAQ;MACdC,UAAU,EAAGC,KAAK,IAAKA,KAAK,CAACC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,IAAI,IAAID,KAAK,CAACC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK;IACjF,CAAC,EAAE;MACDH,IAAI,EAAE,UAAU;MAChBC,UAAU,EAAGC,KAAK,IAAKE,MAAM,CAACC,MAAM,CAACC,iBAAQ,CAAC,CAACC,QAAQ,CAACL,KAAK;IAC/D,CAAC,EAAE;MACDF,IAAI,EAAE,YAAY;MAClBC,UAAU,EAAGC,KAAK,IAAK,CAAC,CAACA;IAC3B,CAAC,CAAC,CAAC;IACL,IAAAM,gBAAM,EACJ7C,MAAA,CAAAS,OAAA,CAAAqC,aAAA,CAACzC,gBAAA,CAAA0C,eAAe;MACdrC,UAAU,EAAEA,UAAW;MACvBE,QAAQ,EAAEA,QAAS;MACnBE,UAAU,EAAEA,UAAW;MACvBI,MAAM,EAAEA,MAAO;MACf8B,KAAK,EAAEjB,IAAc;MACrBC,wBAAwB,EAAEA,wBAAyB;MACnDG,YAAY,EAAEA;IAAa,CAC5B,CAAC,EACFP,OACF,CAAC;EACH,CAAC,CAAC;AACJ,CAAC,MAAM;EACL,IAAAiB,gBAAM,EACJ7C,MAAA,CAAAS,OAAA,CAAAqC,aAAA,CAACzC,gBAAA,CAAA0C,eAAe;IACdrC,UAAU,EAAEC,aAAc;IAC1BC,QAAQ,EAAEC,cAAe;IACzBC,UAAU,EAAEC,gBAAiB;IAC7BG,MAAM,EAAEC;EAAa,CACtB,CAAC,EACFK,QAAQ,CAACyB,cAAc,CAAChC,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 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
+ {"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 isParamError?: 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,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import { ApolloClient, InMemoryCache, ApolloProvider } from '@apollo/client';
3
3
  import { LocaleProvider } from '@oanda/mono-i18n';
4
- import { ThemeProvider, getLocale } from '@oanda/labs-widget-common';
4
+ import { ChartError, ThemeProvider, getLocale } from '@oanda/labs-widget-common';
5
5
  import { Widget } from './Widget';
6
6
  import { Tool } from './Tool';
7
7
  import { translations } from '../translations';
@@ -12,7 +12,8 @@ const SentimentWidget = _ref => {
12
12
  instrument,
13
13
  locale,
14
14
  theme,
15
- includeDescriptionLabels
15
+ includeDescriptionLabels,
16
+ isParamError
16
17
  } = _ref;
17
18
  const client = new ApolloClient({
18
19
  uri: graphqlUrl,
@@ -25,13 +26,15 @@ const SentimentWidget = _ref => {
25
26
  translations: translations
26
27
  }, React.createElement(ApolloProvider, {
27
28
  client: client
28
- }, instrument ? React.createElement(Widget, {
29
+ }, isParamError ? React.createElement("div", {
30
+ className: "lw-flex lw-h-[425px] lw-w-full lw-items-center lw-border lw-border-solid lw-border-border-primary"
31
+ }, React.createElement(ChartError, null)) : React.createElement(React.Fragment, null, instrument ? React.createElement(Widget, {
29
32
  division: division,
30
33
  instrument: instrument,
31
34
  includeDescriptionLabels: includeDescriptionLabels
32
35
  }) : React.createElement(Tool, {
33
36
  division: division
34
- }))));
37
+ })))));
35
38
  };
36
39
  export { SentimentWidget };
37
40
  //# sourceMappingURL=SentimentWidget.js.map
@@ -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","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"}
1
+ {"version":3,"file":"SentimentWidget.js","names":["React","ApolloClient","InMemoryCache","ApolloProvider","LocaleProvider","ChartError","ThemeProvider","getLocale","Widget","Tool","translations","SentimentWidget","_ref","graphqlUrl","division","instrument","locale","theme","includeDescriptionLabels","isParamError","client","uri","cache","createElement","className","Fragment"],"sources":["../../../src/SentimentWidget/SentimentWidget.tsx"],"sourcesContent":["import React from 'react';\nimport { ApolloClient, InMemoryCache, ApolloProvider } from '@apollo/client';\nimport { LocaleProvider } from '@oanda/mono-i18n';\nimport { ChartError, 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, isParamError,\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 {isParamError ? (\n <div className=\"lw-flex lw-h-[425px] lw-w-full lw-items-center lw-border lw-border-solid lw-border-border-primary\">\n <ChartError />\n </div>\n ) : (\n <>\n {instrument ? (\n <Widget\n division={division}\n instrument={instrument}\n includeDescriptionLabels={includeDescriptionLabels}\n />\n ) : (\n <Tool division={division} />\n )}\n </>\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,UAAU,EAAEC,aAAa,EAAEC,SAAS,QAAQ,2BAA2B;AAChF,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,wBAAwB;IAAEC;EAC5D,CAAC,GAAAP,IAAA;EAChB,MAAMQ,MAAM,GAAG,IAAInB,YAAY,CAAC;IAC9BoB,GAAG,EAAER,UAAU;IACfS,KAAK,EAAE,IAAIpB,aAAa,CAAC;EAC3B,CAAC,CAAC;EAEF,OACEF,KAAA,CAAAuB,aAAA,CAACjB,aAAa;IAACW,KAAK,EAAEA;EAAM,GAC1BjB,KAAA,CAAAuB,aAAA,CAACnB,cAAc;IAACY,MAAM,EAAET,SAAS,CAACS,MAAM,CAAE;IAACN,YAAY,EAAEA;EAAa,GACpEV,KAAA,CAAAuB,aAAA,CAACpB,cAAc;IAACiB,MAAM,EAAEA;EAAO,GAC5BD,YAAY,GACXnB,KAAA,CAAAuB,aAAA;IAAKC,SAAS,EAAC;EAAmG,GAChHxB,KAAA,CAAAuB,aAAA,CAAClB,UAAU,MAAE,CACV,CAAC,GAENL,KAAA,CAAAuB,aAAA,CAAAvB,KAAA,CAAAyB,QAAA,QACGV,UAAU,GACTf,KAAA,CAAAuB,aAAA,CAACf,MAAM;IACLM,QAAQ,EAAEA,QAAS;IACnBC,UAAU,EAAEA,UAAW;IACvBG,wBAAwB,EAAEA;EAAyB,CACpD,CAAC,GAEFlB,KAAA,CAAAuB,aAAA,CAACd,IAAI;IAACK,QAAQ,EAAEA;EAAS,CAAE,CAE7B,CAEU,CACF,CACH,CAAC;AAEpB,CAAC;AAED,SAASH,eAAe"}
@@ -1,6 +1,8 @@
1
1
  import React from 'react';
2
2
  import { render } from 'react-dom';
3
+ import { validateToolParams } from '@oanda/labs-widget-common';
3
4
  import { SentimentWidget } from './SentimentWidget';
5
+ import { Division } from '../gql/types/graphql';
4
6
  const {
5
7
  graphqlUrl: configGraphQl,
6
8
  division: configDivision,
@@ -22,13 +24,28 @@ if (sentimentParamsElements.length > 0) {
22
24
  locale,
23
25
  includeDescriptionLabels
24
26
  } = JSON.parse(params);
27
+ const isParamError = validateToolParams({
28
+ division,
29
+ locale,
30
+ graphqlUrl
31
+ }, [{
32
+ name: 'locale',
33
+ valueCheck: value => value.split('-')[0] === 'en' || value.split('-')[0] === 'zh'
34
+ }, {
35
+ name: 'division',
36
+ valueCheck: value => Object.values(Division).includes(value)
37
+ }, {
38
+ name: 'graphqlUrl',
39
+ valueCheck: value => !!value
40
+ }]);
25
41
  render(React.createElement(SentimentWidget, {
26
42
  graphqlUrl: graphqlUrl,
27
43
  division: division,
28
44
  instrument: instrument,
29
45
  locale: locale,
30
46
  theme: mode,
31
- includeDescriptionLabels: includeDescriptionLabels
47
+ includeDescriptionLabels: includeDescriptionLabels,
48
+ isParamError: isParamError
32
49
  }), element);
33
50
  });
34
51
  } 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","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
+ {"version":3,"file":"render.js","names":["React","render","validateToolParams","SentimentWidget","Division","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","isParamError","name","valueCheck","value","split","Object","values","includes","createElement","theme","getElementById"],"sources":["../../../src/SentimentWidget/render.tsx"],"sourcesContent":["import React from 'react';\nimport { render } from 'react-dom';\nimport { Theme, validateToolParams } from '@oanda/labs-widget-common';\nimport { SentimentWidget } from './SentimentWidget';\nimport { Division } from '../gql/types/graphql';\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 const isParamError = validateToolParams({ division, locale, graphqlUrl }, [\n {\n name: 'locale',\n valueCheck: (value) => value.split('-')[0] === 'en' || value.split('-')[0] === 'zh',\n }, {\n name: 'division',\n valueCheck: (value) => Object.values(Division).includes(value),\n }, {\n name: 'graphqlUrl',\n valueCheck: (value) => !!value,\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 isParamError={isParamError}\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;AAClC,SAAgBC,kBAAkB,QAAQ,2BAA2B;AACrE,SAASC,eAAe,QAAQ,mBAAmB;AACnD,SAASC,QAAQ,QAAQ,sBAAsB;AAE/C,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;IAEhC,MAAMM,YAAY,GAAG5B,kBAAkB,CAAC;MAAEK,QAAQ;MAAEM,MAAM;MAAER;IAAW,CAAC,EAAE,CACxE;MACE0B,IAAI,EAAE,QAAQ;MACdC,UAAU,EAAGC,KAAK,IAAKA,KAAK,CAACC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,IAAI,IAAID,KAAK,CAACC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK;IACjF,CAAC,EAAE;MACDH,IAAI,EAAE,UAAU;MAChBC,UAAU,EAAGC,KAAK,IAAKE,MAAM,CAACC,MAAM,CAAChC,QAAQ,CAAC,CAACiC,QAAQ,CAACJ,KAAK;IAC/D,CAAC,EAAE;MACDF,IAAI,EAAE,YAAY;MAClBC,UAAU,EAAGC,KAAK,IAAK,CAAC,CAACA;IAC3B,CAAC,CAAC,CAAC;IACLhC,MAAM,CACJD,KAAA,CAAAsC,aAAA,CAACnC,eAAe;MACdE,UAAU,EAAEA,UAAW;MACvBE,QAAQ,EAAEA,QAAS;MACnBE,UAAU,EAAEA,UAAW;MACvBI,MAAM,EAAEA,MAAO;MACf0B,KAAK,EAAEb,IAAc;MACrBC,wBAAwB,EAAEA,wBAAyB;MACnDG,YAAY,EAAEA;IAAa,CAC5B,CAAC,EACFP,OACF,CAAC;EACH,CAAC,CAAC;AACJ,CAAC,MAAM;EACLtB,MAAM,CACJD,KAAA,CAAAsC,aAAA,CAACnC,eAAe;IACdE,UAAU,EAAEC,aAAc;IAC1BC,QAAQ,EAAEC,cAAe;IACzBC,UAAU,EAAEC,gBAAiB;IAC7BG,MAAM,EAAEC;EAAa,CACtB,CAAC,EACFK,QAAQ,CAACqB,cAAc,CAAC5B,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 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
+ {"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 isParamError?: 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, includeDescriptionLabels, }: SentimentConfig) => JSX.Element;
3
+ declare const SentimentWidget: ({ graphqlUrl, division, instrument, locale, theme, includeDescriptionLabels, isParamError, }: SentimentConfig) => JSX.Element;
4
4
  export { SentimentWidget };
@@ -8,6 +8,7 @@ export interface SentimentConfig {
8
8
  locale: Locale;
9
9
  theme?: Theme;
10
10
  includeDescriptionLabels?: boolean;
11
+ isParamError?: boolean;
11
12
  }
12
13
  export interface SentimentWrapperConfig extends SentimentConfig {
13
14
  renderElementId: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oanda/labs-sentiment-widget",
3
- "version": "1.0.79",
3
+ "version": "1.0.81",
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.79",
16
+ "@oanda/labs-widget-common": "^1.0.81",
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": "e3c25377e179d6516e6fea1cc130868381275824"
25
+ "gitHead": "58765ade5f8cd4e5aa4150c54ea45b7e8d772bd3"
26
26
  }
@@ -1,14 +1,14 @@
1
1
  import React from 'react';
2
2
  import { ApolloClient, InMemoryCache, ApolloProvider } from '@apollo/client';
3
3
  import { LocaleProvider } from '@oanda/mono-i18n';
4
- import { ThemeProvider, getLocale } from '@oanda/labs-widget-common';
4
+ import { ChartError, ThemeProvider, getLocale } from '@oanda/labs-widget-common';
5
5
  import { Widget } from './Widget';
6
6
  import { Tool } from './Tool';
7
7
  import { SentimentConfig } from './types';
8
8
  import { translations } from '../translations';
9
9
 
10
10
  const SentimentWidget = ({
11
- graphqlUrl, division, instrument, locale, theme, includeDescriptionLabels,
11
+ graphqlUrl, division, instrument, locale, theme, includeDescriptionLabels, isParamError,
12
12
  }: SentimentConfig) => {
13
13
  const client = new ApolloClient({
14
14
  uri: graphqlUrl,
@@ -19,14 +19,22 @@ const SentimentWidget = ({
19
19
  <ThemeProvider theme={theme}>
20
20
  <LocaleProvider locale={getLocale(locale)} translations={translations}>
21
21
  <ApolloProvider client={client}>
22
- {instrument ? (
23
- <Widget
24
- division={division}
25
- instrument={instrument}
26
- includeDescriptionLabels={includeDescriptionLabels}
27
- />
22
+ {isParamError ? (
23
+ <div className="lw-flex lw-h-[425px] lw-w-full lw-items-center lw-border lw-border-solid lw-border-border-primary">
24
+ <ChartError />
25
+ </div>
28
26
  ) : (
29
- <Tool division={division} />
27
+ <>
28
+ {instrument ? (
29
+ <Widget
30
+ division={division}
31
+ instrument={instrument}
32
+ includeDescriptionLabels={includeDescriptionLabels}
33
+ />
34
+ ) : (
35
+ <Tool division={division} />
36
+ )}
37
+ </>
30
38
  )}
31
39
  </ApolloProvider>
32
40
  </LocaleProvider>
@@ -1,7 +1,8 @@
1
1
  import React from 'react';
2
2
  import { render } from 'react-dom';
3
- import { Theme } from '@oanda/labs-widget-common';
3
+ import { Theme, validateToolParams } from '@oanda/labs-widget-common';
4
4
  import { SentimentWidget } from './SentimentWidget';
5
+ import { Division } from '../gql/types/graphql';
5
6
 
6
7
  const {
7
8
  graphqlUrl: configGraphQl,
@@ -25,6 +26,17 @@ if (sentimentParamsElements.length > 0) {
25
26
  instrument, division, locale, includeDescriptionLabels,
26
27
  } = JSON.parse(params as string);
27
28
 
29
+ const isParamError = validateToolParams({ division, locale, graphqlUrl }, [
30
+ {
31
+ name: 'locale',
32
+ valueCheck: (value) => value.split('-')[0] === 'en' || value.split('-')[0] === 'zh',
33
+ }, {
34
+ name: 'division',
35
+ valueCheck: (value) => Object.values(Division).includes(value),
36
+ }, {
37
+ name: 'graphqlUrl',
38
+ valueCheck: (value) => !!value,
39
+ }]);
28
40
  render(
29
41
  <SentimentWidget
30
42
  graphqlUrl={graphqlUrl}
@@ -33,6 +45,7 @@ if (sentimentParamsElements.length > 0) {
33
45
  locale={locale}
34
46
  theme={mode as Theme}
35
47
  includeDescriptionLabels={includeDescriptionLabels}
48
+ isParamError={isParamError}
36
49
  />,
37
50
  element,
38
51
  );
@@ -9,6 +9,7 @@ export interface SentimentConfig {
9
9
  locale: Locale;
10
10
  theme?: Theme;
11
11
  includeDescriptionLabels?: boolean;
12
+ isParamError?: boolean;
12
13
  }
13
14
  export interface SentimentWrapperConfig extends SentimentConfig {
14
15
  renderElementId: string;