@oanda/labs-currency-cross-table 1.0.95 → 1.0.96
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 +388 -0
- package/dist/main/CurrencyCrossTableWidget/Main.js +2 -2
- package/dist/main/CurrencyCrossTableWidget/Main.js.map +1 -1
- package/dist/main/CurrencyCrossTableWidget/ValidationWrapper.js +1 -2
- package/dist/main/CurrencyCrossTableWidget/ValidationWrapper.js.map +1 -1
- package/dist/main/CurrencyCrossTableWidget/components/CellWithData.js +4 -4
- package/dist/main/CurrencyCrossTableWidget/components/CellWithData.js.map +1 -1
- package/dist/main/CurrencyCrossTableWidget/utils.js +3 -4
- package/dist/main/CurrencyCrossTableWidget/utils.js.map +1 -1
- package/dist/main/gql/types/fragment-masking.js +2 -3
- package/dist/main/gql/types/fragment-masking.js.map +1 -1
- package/dist/main/gql/types/gql.js +1 -2
- package/dist/main/gql/types/gql.js.map +1 -1
- package/dist/main/gql/validateInstruments.js +11 -3
- package/dist/main/gql/validateInstruments.js.map +1 -1
- package/dist/module/CurrencyCrossTableWidget/Main.js +2 -2
- package/dist/module/CurrencyCrossTableWidget/Main.js.map +1 -1
- package/dist/module/CurrencyCrossTableWidget/ValidationWrapper.js +1 -2
- package/dist/module/CurrencyCrossTableWidget/ValidationWrapper.js.map +1 -1
- package/dist/module/CurrencyCrossTableWidget/components/CellWithData.js +4 -4
- package/dist/module/CurrencyCrossTableWidget/components/CellWithData.js.map +1 -1
- package/dist/module/CurrencyCrossTableWidget/utils.js +3 -4
- package/dist/module/CurrencyCrossTableWidget/utils.js.map +1 -1
- package/dist/module/gql/types/fragment-masking.js +2 -3
- package/dist/module/gql/types/fragment-masking.js.map +1 -1
- package/dist/module/gql/types/gql.js +1 -2
- package/dist/module/gql/types/gql.js.map +1 -1
- package/dist/module/gql/validateInstruments.js +11 -3
- package/dist/module/gql/validateInstruments.js.map +1 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,394 @@
|
|
|
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.96 (2026-01-07)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
## 1.0.244 (2026-01-02)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
## 1.0.243 (2025-12-30)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
## 1.0.242 (2025-12-16)
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
## 1.0.241 (2025-12-16)
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
## 1.0.240 (2025-12-15)
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
## 1.0.239 (2025-12-12)
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
## 1.0.238 (2025-12-11)
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
## 1.0.237 (2025-12-09)
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
## 1.0.236 (2025-12-05)
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
## 1.0.235 (2025-12-04)
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
## 1.0.234 (2025-11-27)
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
## 1.0.233 (2025-11-27)
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
## 1.0.232 (2025-11-27)
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
## 1.0.231 (2025-11-07)
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
## 1.0.230 (2025-11-05)
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
## 1.0.229 (2025-11-05)
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
## 1.0.228 (2025-11-05)
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
## 1.0.227 (2025-10-31)
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
## 1.0.226 (2025-10-29)
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
## 1.0.225 (2025-10-09)
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
## 1.0.224 (2025-09-29)
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
## 1.0.223 (2025-09-29)
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
## 1.0.222 (2025-09-17)
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
## 1.0.221 (2025-09-11)
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
## 1.0.220 (2025-09-09)
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
## 1.0.219 (2025-09-02)
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
## 1.0.218 (2025-09-01)
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
## 1.0.217 (2025-08-25)
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
## 1.0.216 (2025-08-18)
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
## 1.0.215 (2025-08-18)
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
## 1.0.214 (2025-08-14)
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
## 1.0.213 (2025-08-12)
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
## 1.0.212 (2025-08-05)
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
## 1.0.211 (2025-08-05)
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
## 1.0.210 (2025-07-31)
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
## 1.0.209 (2025-07-31)
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
## 1.0.208 (2025-07-24)
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
## 1.0.207 (2025-07-18)
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
## 1.0.206 (2025-07-18)
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
## 1.0.205 (2025-07-17)
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
## 1.0.204 (2025-07-09)
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
## 1.0.203 (2025-06-16)
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
## 1.0.202 (2025-06-04)
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
## 1.0.201 (2025-06-02)
|
|
183
|
+
|
|
184
|
+
|
|
185
|
+
|
|
186
|
+
## 1.0.200 (2025-05-30)
|
|
187
|
+
|
|
188
|
+
|
|
189
|
+
|
|
190
|
+
## 1.0.199 (2025-05-29)
|
|
191
|
+
|
|
192
|
+
|
|
193
|
+
|
|
194
|
+
## 1.0.198 (2025-05-26)
|
|
195
|
+
|
|
196
|
+
|
|
197
|
+
|
|
198
|
+
## 1.0.197 (2025-05-23)
|
|
199
|
+
|
|
200
|
+
|
|
201
|
+
|
|
202
|
+
## 1.0.196 (2025-05-22)
|
|
203
|
+
|
|
204
|
+
|
|
205
|
+
|
|
206
|
+
## 1.0.195 (2025-05-21)
|
|
207
|
+
|
|
208
|
+
|
|
209
|
+
|
|
210
|
+
## 1.0.194 (2025-05-21)
|
|
211
|
+
|
|
212
|
+
|
|
213
|
+
|
|
214
|
+
## 1.0.193 (2025-05-15)
|
|
215
|
+
|
|
216
|
+
|
|
217
|
+
|
|
218
|
+
## 1.0.192 (2025-05-14)
|
|
219
|
+
|
|
220
|
+
|
|
221
|
+
|
|
222
|
+
## 1.0.191 (2025-04-30)
|
|
223
|
+
|
|
224
|
+
|
|
225
|
+
|
|
226
|
+
## 1.0.190 (2025-04-28)
|
|
227
|
+
|
|
228
|
+
|
|
229
|
+
|
|
230
|
+
## 1.0.189 (2025-04-23)
|
|
231
|
+
|
|
232
|
+
|
|
233
|
+
|
|
234
|
+
## 1.0.188 (2025-04-22)
|
|
235
|
+
|
|
236
|
+
|
|
237
|
+
|
|
238
|
+
## 1.0.187 (2025-04-18)
|
|
239
|
+
|
|
240
|
+
|
|
241
|
+
|
|
242
|
+
## 1.0.186 (2025-04-10)
|
|
243
|
+
|
|
244
|
+
|
|
245
|
+
|
|
246
|
+
## 1.0.185 (2025-04-09)
|
|
247
|
+
|
|
248
|
+
|
|
249
|
+
|
|
250
|
+
## 1.0.184 (2025-04-08)
|
|
251
|
+
|
|
252
|
+
|
|
253
|
+
|
|
254
|
+
## 1.0.183 (2025-04-04)
|
|
255
|
+
|
|
256
|
+
|
|
257
|
+
|
|
258
|
+
## 1.0.182 (2025-03-21)
|
|
259
|
+
|
|
260
|
+
|
|
261
|
+
|
|
262
|
+
## 1.0.181 (2025-03-13)
|
|
263
|
+
|
|
264
|
+
|
|
265
|
+
|
|
266
|
+
## 1.0.180 (2025-01-30)
|
|
267
|
+
|
|
268
|
+
|
|
269
|
+
|
|
270
|
+
## 1.0.179 (2025-01-29)
|
|
271
|
+
|
|
272
|
+
|
|
273
|
+
|
|
274
|
+
## 1.0.178 (2025-01-12)
|
|
275
|
+
|
|
276
|
+
|
|
277
|
+
|
|
278
|
+
## 1.0.177 (2025-01-10)
|
|
279
|
+
|
|
280
|
+
|
|
281
|
+
|
|
282
|
+
## 1.0.176 (2025-01-10)
|
|
283
|
+
|
|
284
|
+
|
|
285
|
+
|
|
286
|
+
## 1.0.175 (2025-01-08)
|
|
287
|
+
|
|
288
|
+
|
|
289
|
+
|
|
290
|
+
## 1.0.174 (2024-12-16)
|
|
291
|
+
|
|
292
|
+
|
|
293
|
+
|
|
294
|
+
## 1.0.173 (2024-12-11)
|
|
295
|
+
|
|
296
|
+
|
|
297
|
+
|
|
298
|
+
## 1.0.172 (2024-11-29)
|
|
299
|
+
|
|
300
|
+
|
|
301
|
+
|
|
302
|
+
## 1.0.171 (2024-11-28)
|
|
303
|
+
|
|
304
|
+
|
|
305
|
+
|
|
306
|
+
## 1.0.170 (2024-11-28)
|
|
307
|
+
|
|
308
|
+
|
|
309
|
+
|
|
310
|
+
## 1.0.169 (2024-11-20)
|
|
311
|
+
|
|
312
|
+
|
|
313
|
+
|
|
314
|
+
## 1.0.168 (2024-11-19)
|
|
315
|
+
|
|
316
|
+
|
|
317
|
+
|
|
318
|
+
## 1.0.167 (2024-10-14)
|
|
319
|
+
|
|
320
|
+
|
|
321
|
+
|
|
322
|
+
## 1.0.166 (2024-10-07)
|
|
323
|
+
|
|
324
|
+
|
|
325
|
+
|
|
326
|
+
## 1.0.165 (2024-10-03)
|
|
327
|
+
|
|
328
|
+
|
|
329
|
+
|
|
330
|
+
## 1.0.164 (2024-09-26)
|
|
331
|
+
|
|
332
|
+
|
|
333
|
+
|
|
334
|
+
## 1.0.163 (2024-09-18)
|
|
335
|
+
|
|
336
|
+
|
|
337
|
+
|
|
338
|
+
## 1.0.162 (2024-09-12)
|
|
339
|
+
|
|
340
|
+
|
|
341
|
+
|
|
342
|
+
## 1.0.161 (2024-09-11)
|
|
343
|
+
|
|
344
|
+
|
|
345
|
+
|
|
346
|
+
## 1.0.160 (2024-09-10)
|
|
347
|
+
|
|
348
|
+
|
|
349
|
+
|
|
350
|
+
## 1.0.159 (2024-09-09)
|
|
351
|
+
|
|
352
|
+
|
|
353
|
+
|
|
354
|
+
## 1.0.158 (2024-09-04)
|
|
355
|
+
|
|
356
|
+
|
|
357
|
+
|
|
358
|
+
## 1.0.157 (2024-09-04)
|
|
359
|
+
|
|
360
|
+
|
|
361
|
+
|
|
362
|
+
## 1.0.156 (2024-09-02)
|
|
363
|
+
|
|
364
|
+
|
|
365
|
+
|
|
366
|
+
## 1.0.155 (2024-08-29)
|
|
367
|
+
|
|
368
|
+
|
|
369
|
+
|
|
370
|
+
## 1.0.154 (2024-08-29)
|
|
371
|
+
|
|
372
|
+
|
|
373
|
+
|
|
374
|
+
## 1.0.153 (2024-08-23)
|
|
375
|
+
|
|
376
|
+
|
|
377
|
+
|
|
378
|
+
## 1.0.152 (2024-08-23)
|
|
379
|
+
|
|
380
|
+
|
|
381
|
+
|
|
382
|
+
## 1.0.151 (2024-08-20)
|
|
383
|
+
|
|
384
|
+
|
|
385
|
+
|
|
386
|
+
## 1.0.150 (2024-08-19)
|
|
387
|
+
|
|
388
|
+
**Note:** Version bump only for package @oanda/labs-currency-cross-table
|
|
389
|
+
|
|
390
|
+
|
|
391
|
+
|
|
392
|
+
|
|
393
|
+
|
|
6
394
|
## 1.0.95 (2026-01-02)
|
|
7
395
|
|
|
8
396
|
|
|
@@ -45,11 +45,11 @@ const Main = _ref => {
|
|
|
45
45
|
hovered: currency === selectedCurrency,
|
|
46
46
|
label: currency
|
|
47
47
|
}), arr.map(pair => _react.default.createElement(_react.Fragment, {
|
|
48
|
-
key:
|
|
48
|
+
key: `${currency}_${pair}`
|
|
49
49
|
}, currency !== pair ? _react.default.createElement(_components.CellWithData, {
|
|
50
50
|
currency: currency,
|
|
51
51
|
division: division,
|
|
52
|
-
isValid: validInstruments.includes(
|
|
52
|
+
isValid: validInstruments.includes(`${currency}${(0, _utils.divisionMapper)(division)}${pair}`),
|
|
53
53
|
pair: pair,
|
|
54
54
|
setSelectedCurrency: setSelectedCurrency,
|
|
55
55
|
setSelectedPair: setSelectedPair,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Main.js","names":["_labsWidgetCommon","require","_react","_interopRequireWildcard","_components","_utils","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","Main","_ref","currencies","validInstruments","division","selectedCurrency","setSelectedCurrency","useState","selectedPair","setSelectedPair","target","setQuery","useLiveRatesQuery","useEffect","instruments","createElement","className","TextCell","sticky","map","pair","key","hovered","label","currency","index","arr","Fragment","
|
|
1
|
+
{"version":3,"file":"Main.js","names":["_labsWidgetCommon","require","_react","_interopRequireWildcard","_components","_utils","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","Main","_ref","currencies","validInstruments","division","selectedCurrency","setSelectedCurrency","useState","selectedPair","setSelectedPair","target","setQuery","useLiveRatesQuery","useEffect","instruments","createElement","className","TextCell","sticky","map","pair","key","hovered","label","currency","index","arr","Fragment","CellWithData","isValid","includes","divisionMapper","emptyIndicator","exports"],"sources":["../../../src/CurrencyCrossTableWidget/Main.tsx"],"sourcesContent":["import { useLiveRatesQuery } from '@oanda/labs-widget-common';\nimport React, { Fragment, useEffect, useState } from 'react';\n\nimport { CellWithData, TextCell } from './components';\nimport type { MainProps } from './types';\nimport { divisionMapper } from './utils';\n\nconst Main = ({ currencies, validInstruments, division }: MainProps) => {\n const [selectedCurrency, setSelectedCurrency] = useState('');\n const [selectedPair, setSelectedPair] = useState('');\n const { target, setQuery } = useLiveRatesQuery();\n\n useEffect(() => {\n setQuery({ instruments: validInstruments });\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, validInstruments);\n\n return (\n <div\n className=\"lw-w-full lw-overflow-x-auto lw-overflow-y-hidden lw-border lw-border-b-0 lw-border-solid lw-border-border-primary\"\n data-testid=\"currency-cross-table-wrapper\"\n >\n <div className=\"lw-flex lw-w-max lw-min-w-full\">\n <TextCell sticky />\n {currencies.map((pair) => (\n <TextCell key={pair} hovered={pair === selectedPair} label={pair} />\n ))}\n </div>\n {currencies.map((currency, index, arr) => (\n <div key={currency} className=\"lw-flex lw-w-max lw-min-w-full\">\n <TextCell\n sticky\n hovered={currency === selectedCurrency}\n label={currency}\n />\n {arr.map((pair) => (\n <Fragment key={`${currency}_${pair}`}>\n {currency !== pair ? (\n <CellWithData\n currency={currency}\n division={division}\n isValid={validInstruments.includes(\n `${currency}${divisionMapper(division)}${pair}`\n )}\n pair={pair}\n setSelectedCurrency={setSelectedCurrency}\n setSelectedPair={setSelectedPair}\n target={target}\n />\n ) : (\n <TextCell emptyIndicator />\n )}\n </Fragment>\n ))}\n </div>\n ))}\n </div>\n );\n};\n\nexport { Main };\n"],"mappings":";;;;;;AAAA,IAAAA,iBAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAC,uBAAA,CAAAF,OAAA;AAEA,IAAAG,WAAA,GAAAH,OAAA;AAEA,IAAAI,MAAA,GAAAJ,OAAA;AAAyC,SAAAE,wBAAAG,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAL,uBAAA,YAAAA,CAAAG,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,MAAAM,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAC,OAAA,EAAAV,CAAA,iBAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,SAAAQ,CAAA,MAAAF,CAAA,GAAAL,CAAA,GAAAG,CAAA,GAAAD,CAAA,QAAAG,CAAA,CAAAK,GAAA,CAAAX,CAAA,UAAAM,CAAA,CAAAM,GAAA,CAAAZ,CAAA,GAAAM,CAAA,CAAAO,GAAA,CAAAb,CAAA,EAAAQ,CAAA,gBAAAP,CAAA,IAAAD,CAAA,gBAAAC,CAAA,OAAAa,cAAA,CAAAC,IAAA,CAAAf,CAAA,EAAAC,CAAA,OAAAM,CAAA,IAAAD,CAAA,GAAAU,MAAA,CAAAC,cAAA,KA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AC,EACLlB,UAAU,CAACiB,GAAG,CAAC,CAACK,QAAQ,EAAEC,KAAK,EAAEC,GAAG,KACnCjD,MAAA,CAAAc,OAAA,CAAAwB,aAAA;IAAKM,GAAG,EAAEG,QAAS;IAACR,SAAS,EAAC;EAAgC,GAC5DvC,MAAA,CAAAc,OAAA,CAAAwB,aAAA,CAACpC,WAAA,CAAAsC,QAAQ;IACPC,MAAM;IACNI,OAAO,EAAEE,QAAQ,KAAKnB,gBAAiB;IACvCkB,KAAK,EAAEC;EAAS,CACjB,CAAC,EACDE,GAAG,CAACP,GAAG,CAAEC,IAAI,IACZ3C,MAAA,CAAAc,OAAA,CAAAwB,aAAA,CAACtC,MAAA,CAAAkD,QAAQ;IAACN,GAAG,EAAE,GAAGG,QAAQ,IAAIJ,IAAI;EAAG,GAClCI,QAAQ,KAAKJ,IAAI,GAChB3C,MAAA,CAAAc,OAAA,CAAAwB,aAAA,CAACpC,WAAA,CAAAiD,YAAY;IACXJ,QAAQ,EAAEA,QAAS;IACnBpB,QAAQ,EAAEA,QAAS;IACnByB,OAAO,EAAE1B,gBAAgB,CAAC2B,QAAQ,CAChC,GAAGN,QAAQ,GAAG,IAAAO,qBAAc,EAAC3B,QAAQ,CAAC,GAAGgB,IAAI,EAC/C,CAAE;IACFA,IAAI,EAAEA,IAAK;IACXd,mBAAmB,EAAEA,mBAAoB;IACzCG,eAAe,EAAEA,eAAgB;IACjCC,MAAM,EAAEA;EAAO,CAChB,CAAC,GAEFjC,MAAA,CAAAc,OAAA,CAAAwB,aAAA,CAACpC,WAAA,CAAAsC,QAAQ;IAACe,cAAc;EAAA,CAAE,CAEpB,CACX,CACE,CACN,CACE,CAAC;AAEV,CAAC;AAACC,OAAA,CAAAjC,IAAA,GAAAA,IAAA","ignoreList":[]}
|
|
@@ -13,7 +13,6 @@ var _Main = require("./Main");
|
|
|
13
13
|
var _utils = require("./utils");
|
|
14
14
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
15
15
|
const ValidationWrapper = _ref => {
|
|
16
|
-
var _data$resolveInstrume;
|
|
17
16
|
let {
|
|
18
17
|
currencies,
|
|
19
18
|
division,
|
|
@@ -31,7 +30,7 @@ const ValidationWrapper = _ref => {
|
|
|
31
30
|
fetchPolicy: 'network-only',
|
|
32
31
|
errorPolicy: 'all'
|
|
33
32
|
});
|
|
34
|
-
const validInstruments = data
|
|
33
|
+
const validInstruments = data?.resolveInstrumentsByDivision?.map(instrument => instrument.name);
|
|
35
34
|
const showError = !(0, _utils.validCurrencies)(currencies) || isParamError || error || !validInstruments || validInstruments.length === 0;
|
|
36
35
|
return _react.default.createElement(_react.default.Fragment, null, _react.default.createElement("div", {
|
|
37
36
|
className: "lw-flex lw-w-full lw-text-sm lw-tracking-normal lw-text-text-primary"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ValidationWrapper.js","names":["_client","require","_labsWidgetCommon","_classnames","_interopRequireDefault","_react","_validateInstruments","_Main","_utils","e","__esModule","default","ValidationWrapper","_ref","
|
|
1
|
+
{"version":3,"file":"ValidationWrapper.js","names":["_client","require","_labsWidgetCommon","_classnames","_interopRequireDefault","_react","_validateInstruments","_Main","_utils","e","__esModule","default","ValidationWrapper","_ref","currencies","division","isParamError","instruments","currenciesToInstruments","data","error","useSuspenseQuery","validateInstruments","variables","fetchPolicy","errorPolicy","validInstruments","resolveInstrumentsByDivision","map","instrument","name","showError","validCurrencies","length","createElement","Fragment","className","Main","classnames","ChartError","exports"],"sources":["../../../src/CurrencyCrossTableWidget/ValidationWrapper.tsx"],"sourcesContent":["import { useSuspenseQuery } from '@apollo/client';\nimport { ChartError } from '@oanda/labs-widget-common';\nimport classnames from 'classnames';\nimport React from 'react';\n\nimport type {\n ValidateInstrumentsQuery,\n ValidateInstrumentsQueryVariables,\n} from '../gql/types/graphql';\nimport { validateInstruments } from '../gql/validateInstruments';\nimport { Main } from './Main';\nimport type { ValidationWrapperProps } from './types';\nimport { currenciesToInstruments, validCurrencies } from './utils';\n\nconst ValidationWrapper = ({\n currencies,\n division,\n isParamError,\n}: ValidationWrapperProps) => {\n const instruments = currenciesToInstruments(currencies, division);\n\n const { data, error } = useSuspenseQuery<\n ValidateInstrumentsQuery,\n ValidateInstrumentsQueryVariables\n >(validateInstruments, {\n variables: {\n instruments,\n division,\n },\n fetchPolicy: 'network-only',\n errorPolicy: 'all',\n });\n\n const validInstruments = data?.resolveInstrumentsByDivision?.map(\n (instrument) => instrument.name\n );\n const showError =\n !validCurrencies(currencies) ||\n isParamError ||\n error ||\n !validInstruments ||\n validInstruments.length === 0;\n\n return (\n <>\n <div className=\"lw-flex lw-w-full lw-text-sm lw-tracking-normal lw-text-text-primary\">\n {!showError && (\n <Main\n currencies={currencies}\n division={division}\n validInstruments={validInstruments}\n />\n )}\n {showError && (\n <div\n className={classnames(\n 'lw-flex lw-h-[250px] lw-w-full lw-items-center lw-border lw-border-solid lw-border-border-primary'\n )}\n >\n <ChartError />\n </div>\n )}\n </div>\n </>\n );\n};\n\nexport { ValidationWrapper };\n"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,iBAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,MAAA,GAAAD,sBAAA,CAAAH,OAAA;AAMA,IAAAK,oBAAA,GAAAL,OAAA;AACA,IAAAM,KAAA,GAAAN,OAAA;AAEA,IAAAO,MAAA,GAAAP,OAAA;AAAmE,SAAAG,uBAAAK,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAEnE,MAAMG,iBAAiB,GAAGC,IAAA,IAII;EAAA,IAJH;IACzBC,UAAU;IACVC,QAAQ;IACRC;EACsB,CAAC,GAAAH,IAAA;EACvB,MAAMI,WAAW,GAAG,IAAAC,8BAAuB,EAACJ,UAAU,EAAEC,QAAQ,CAAC;EAEjE,MAAM;IAAEI,IAAI;IAAEC;EAAM,CAAC,GAAG,IAAAC,wBAAgB,EAGtCC,wCAAmB,EAAE;IACrBC,SAAS,EAAE;MACTN,WAAW;MACXF;IACF,CAAC;IACDS,WAAW,EAAE,cAAc;IAC3BC,WAAW,EAAE;EACf,CAAC,CAAC;EAEF,MAAMC,gBAAgB,GAAGP,IAAI,EAAEQ,4BAA4B,EAAEC,GAAG,CAC7DC,UAAU,IAAKA,UAAU,CAACC,IAC7B,CAAC;EACD,MAAMC,SAAS,GACb,CAAC,IAAAC,sBAAe,EAAClB,UAAU,CAAC,IAC5BE,YAAY,IACZI,KAAK,IACL,CAACM,gBAAgB,IACjBA,gBAAgB,CAACO,MAAM,KAAK,CAAC;EAE/B,OACE5B,MAAA,CAAAM,OAAA,CAAAuB,aAAA,CAAA7B,MAAA,CAAAM,OAAA,CAAAwB,QAAA,QACE9B,MAAA,CAAAM,OAAA,CAAAuB,aAAA;IAAKE,SAAS,EAAC;EAAsE,GAClF,CAACL,SAAS,IACT1B,MAAA,CAAAM,OAAA,CAAAuB,aAAA,CAAC3B,KAAA,CAAA8B,IAAI;IACHvB,UAAU,EAAEA,UAAW;IACvBC,QAAQ,EAAEA,QAAS;IACnBW,gBAAgB,EAAEA;EAAiB,CACpC,CACF,EACAK,SAAS,IACR1B,MAAA,CAAAM,OAAA,CAAAuB,aAAA;IACEE,SAAS,EAAE,IAAAE,mBAAU,EACnB,mGACF;EAAE,GAEFjC,MAAA,CAAAM,OAAA,CAAAuB,aAAA,CAAChC,iBAAA,CAAAqC,UAAU,MAAE,CACV,CAEJ,CACL,CAAC;AAEP,CAAC;AAACC,OAAA,CAAA5B,iBAAA,GAAAA,iBAAA","ignoreList":[]}
|
|
@@ -19,8 +19,8 @@ const CellWithData = _ref => {
|
|
|
19
19
|
setSelectedCurrency,
|
|
20
20
|
setSelectedPair
|
|
21
21
|
} = _ref;
|
|
22
|
-
const instrument =
|
|
23
|
-
const instrumentForUpdates = isValid ? instrument :
|
|
22
|
+
const instrument = `${currency}${(0, _utils.divisionMapper)(division)}${pair}`;
|
|
23
|
+
const instrumentForUpdates = isValid ? instrument : `${pair}${(0, _utils.divisionMapper)(division)}${currency}`;
|
|
24
24
|
const {
|
|
25
25
|
update,
|
|
26
26
|
error: liveRatesError
|
|
@@ -28,7 +28,7 @@ const CellWithData = _ref => {
|
|
|
28
28
|
const [hovered, setHovered] = (0, _react.useState)(false);
|
|
29
29
|
const prevBuyPrice = (0, _react.useRef)();
|
|
30
30
|
const [priceMovement, setPriceMovement] = (0, _react.useState)();
|
|
31
|
-
const checkLoading = () => !liveRatesError &&
|
|
31
|
+
const checkLoading = () => !liveRatesError && update?.ask === undefined;
|
|
32
32
|
const handleMouseEnter = () => {
|
|
33
33
|
setHovered(true);
|
|
34
34
|
setSelectedCurrency(currency);
|
|
@@ -63,7 +63,7 @@ const CellWithData = _ref => {
|
|
|
63
63
|
}, _react.default.createElement(_labsWidgetCommon.Price, {
|
|
64
64
|
movementIndicator: "background",
|
|
65
65
|
priceMovement: priceMovement
|
|
66
|
-
}, _react.default.createElement("span", null, (0, _utils.getBuyPrice)(update
|
|
66
|
+
}, _react.default.createElement("span", null, (0, _utils.getBuyPrice)(update?.ask, !isValid).toFixed(currency === 'JPY' && !isValid ? 6 : update?.displayPrecision))));
|
|
67
67
|
};
|
|
68
68
|
exports.CellWithData = CellWithData;
|
|
69
69
|
//# sourceMappingURL=CellWithData.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CellWithData.js","names":["_labsWidgetCommon","require","_react","_interopRequireWildcard","_utils","_Cell","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","CellWithData","_ref","currency","pair","isValid","target","division","setSelectedCurrency","setSelectedPair","instrument","
|
|
1
|
+
{"version":3,"file":"CellWithData.js","names":["_labsWidgetCommon","require","_react","_interopRequireWildcard","_utils","_Cell","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","CellWithData","_ref","currency","pair","isValid","target","division","setSelectedCurrency","setSelectedPair","instrument","divisionMapper","instrumentForUpdates","update","error","liveRatesError","useLiveRatesMessage","hovered","setHovered","useState","prevBuyPrice","useRef","priceMovement","setPriceMovement","checkLoading","ask","undefined","handleMouseEnter","handleMouseLeave","useEffect","displayPrecision","movement","getPriceMovement","previous","current","isReversed","createElement","Cell","isError","isLoading","mouseEnterHandler","mouseLeaveHandler","Price","movementIndicator","getBuyPrice","toFixed","exports"],"sources":["../../../../src/CurrencyCrossTableWidget/components/CellWithData.tsx"],"sourcesContent":["import { Price, useLiveRatesMessage } from '@oanda/labs-widget-common';\nimport React, { useEffect, useRef, useState } from 'react';\n\nimport { divisionMapper, getBuyPrice, getPriceMovement } from '../utils';\nimport { Cell } from './Cell';\nimport type { CellWithDataProps } from './types';\n\nconst CellWithData = ({\n currency,\n pair,\n isValid,\n target,\n division,\n setSelectedCurrency,\n setSelectedPair,\n}: CellWithDataProps) => {\n const instrument = `${currency}${divisionMapper(division)}${pair}`;\n const instrumentForUpdates = isValid\n ? instrument\n : `${pair}${divisionMapper(division)}${currency}`;\n\n const { update, error: liveRatesError } = useLiveRatesMessage(\n instrumentForUpdates,\n target\n );\n\n const [hovered, setHovered] = useState(false);\n const prevBuyPrice = useRef<number>();\n const [priceMovement, setPriceMovement] = useState<number | undefined>();\n\n const checkLoading = () => !liveRatesError && update?.ask === undefined;\n\n const handleMouseEnter = () => {\n setHovered(true);\n setSelectedCurrency(currency);\n setSelectedPair(pair);\n };\n\n const handleMouseLeave = () => {\n setHovered(false);\n setSelectedCurrency('');\n setSelectedPair('');\n };\n\n useEffect(() => {\n if (!update) return;\n\n const { ask, displayPrecision } = update;\n const movement = getPriceMovement({\n previous: prevBuyPrice.current,\n update: ask,\n displayPrecision: currency === 'JPY' && !isValid ? 6 : displayPrecision,\n isReversed: !isValid,\n });\n\n prevBuyPrice.current = ask;\n setPriceMovement(movement);\n }, [isValid, update, currency]);\n\n return (\n <Cell\n hovered={hovered}\n isError={!!liveRatesError}\n isLoading={checkLoading()}\n mouseEnterHandler={handleMouseEnter}\n mouseLeaveHandler={handleMouseLeave}\n >\n <Price movementIndicator=\"background\" priceMovement={priceMovement}>\n <span>\n {getBuyPrice(update?.ask, !isValid).toFixed(\n currency === 'JPY' && !isValid ? 6 : update?.displayPrecision\n )}\n </span>\n </Price>\n </Cell>\n );\n};\n\nexport { CellWithData };\n"],"mappings":";;;;;;AAAA,IAAAA,iBAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAC,uBAAA,CAAAF,OAAA;AAEA,IAAAG,MAAA,GAAAH,OAAA;AACA,IAAAI,KAAA,GAAAJ,OAAA;AAA8B,SAAAE,wBAAAG,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAL,uBAAA,YAAAA,CAAAG,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,MAAAM,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAC,OAAA,EAAAV,CAAA,iBAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,SAAAQ,CAAA,MAAAF,CAAA,GAAAL,CAAA,GAAAG,CAAA,GAAAD,CAAA,QAAAG,CAAA,CAAAK,GAAA,CAAAX,CAAA,UAAAM,CAAA,CAAAM,GAAA,CAAAZ,CAAA,GAAAM,CAAA,CAAAO,GAAA,CAAAb,CAAA,EAAAQ,CAAA,gBAAAP,CAAA,IAAAD,CAAA,gBAAAC,CAAA,OAAAa,cAAA,CAAAC,IAAA,CAAAf,CAAA,EAAAC,CAAA,OAAAM,CAAA,IAAAD,CAAA,GAAAU,MAAA,CAAAC,cAAA,KAAAD,MAAA,CAAAE,wBAAA,CAAAlB,CAAA,EAAAC,CAAA,OAAAM,CAAA,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,CAAA7C,YAAA,GAAAA,YAAA","ignoreList":[]}
|
|
@@ -12,21 +12,20 @@ exports.divisionMapper = divisionMapper;
|
|
|
12
12
|
const currenciesToInstruments = (currencies, division) => {
|
|
13
13
|
const pairs = currencies.reduce((acc, cV, index, array) => {
|
|
14
14
|
const unique = array.filter((_item, idx) => index !== idx);
|
|
15
|
-
return [...acc, ...unique.map(el =>
|
|
15
|
+
return [...acc, ...unique.map(el => `${cV}${divisionMapper(division)}${el}`)];
|
|
16
16
|
}, []);
|
|
17
17
|
return pairs;
|
|
18
18
|
};
|
|
19
19
|
exports.currenciesToInstruments = currenciesToInstruments;
|
|
20
20
|
const getPriceMovement = _ref => {
|
|
21
|
-
var _getBuyPrice, _getBuyPrice2;
|
|
22
21
|
let {
|
|
23
22
|
previous,
|
|
24
23
|
update,
|
|
25
24
|
displayPrecision,
|
|
26
25
|
isReversed
|
|
27
26
|
} = _ref;
|
|
28
|
-
const roundedPrevious =
|
|
29
|
-
const roundedUpdate =
|
|
27
|
+
const roundedPrevious = getBuyPrice(previous, isReversed)?.toFixed(displayPrecision);
|
|
28
|
+
const roundedUpdate = getBuyPrice(update, isReversed)?.toFixed(displayPrecision);
|
|
30
29
|
if (roundedPrevious === roundedUpdate || update === undefined || previous === undefined) {
|
|
31
30
|
return 0;
|
|
32
31
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","names":["_constant","require","validCurrencies","currencies","every","currency","MAJOR_CURRENCIES","includes","exports","divisionMapper","division","currenciesToInstruments","pairs","reduce","acc","cV","index","array","unique","filter","_item","idx","map","el","
|
|
1
|
+
{"version":3,"file":"utils.js","names":["_constant","require","validCurrencies","currencies","every","currency","MAJOR_CURRENCIES","includes","exports","divisionMapper","division","currenciesToInstruments","pairs","reduce","acc","cV","index","array","unique","filter","_item","idx","map","el","getPriceMovement","_ref","previous","update","displayPrecision","isReversed","roundedPrevious","getBuyPrice","toFixed","roundedUpdate","undefined","price"],"sources":["../../../src/CurrencyCrossTableWidget/utils.ts"],"sourcesContent":["import type { Division } from '../gql/types/graphql';\nimport { MAJOR_CURRENCIES } from './constant';\n\nconst validCurrencies = (currencies: string[]) =>\n currencies.every((currency) => MAJOR_CURRENCIES.includes(currency));\n\nconst divisionMapper = (division: Division) => (division === 'OGM' ? '' : '_');\n\nconst currenciesToInstruments = (currencies: string[], division: Division) => {\n const pairs = currencies.reduce((acc, cV, index, array) => {\n const unique = array.filter((_item, idx) => index !== idx);\n\n return [\n ...acc,\n ...unique.map((el) => `${cV}${divisionMapper(division)}${el}`),\n ];\n }, [] as string[]);\n\n return pairs;\n};\n\nconst getPriceMovement = ({\n previous,\n update,\n displayPrecision,\n isReversed,\n}: {\n previous?: number;\n update?: number;\n displayPrecision?: number;\n isReversed: boolean;\n}) => {\n const roundedPrevious = getBuyPrice(previous, isReversed)?.toFixed(\n displayPrecision\n );\n const roundedUpdate = getBuyPrice(update, isReversed)?.toFixed(\n displayPrecision\n );\n\n if (\n roundedPrevious === roundedUpdate ||\n update === undefined ||\n previous === undefined\n ) {\n return 0;\n }\n\n return roundedUpdate > roundedPrevious ? 1 : -1;\n};\n\nconst getBuyPrice = (price: number | undefined, isReversed: boolean) => {\n if (price === undefined) return 0;\n\n return isReversed ? 1 / price : price;\n};\n\nexport {\n currenciesToInstruments,\n divisionMapper,\n getBuyPrice,\n getPriceMovement,\n validCurrencies,\n};\n"],"mappings":";;;;;;AACA,IAAAA,SAAA,GAAAC,OAAA;AAEA,MAAMC,eAAe,GAAIC,UAAoB,IAC3CA,UAAU,CAACC,KAAK,CAAEC,QAAQ,IAAKC,0BAAgB,CAACC,QAAQ,CAACF,QAAQ,CAAC,CAAC;AAACG,OAAA,CAAAN,eAAA,GAAAA,eAAA;AAEtE,MAAMO,cAAc,GAAIC,QAAkB,IAAMA,QAAQ,KAAK,KAAK,GAAG,EAAE,GAAG,GAAI;AAACF,OAAA,CAAAC,cAAA,GAAAA,cAAA;AAE/E,MAAME,uBAAuB,GAAGA,CAAC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;AACvC,CAAC;AAAC3B,OAAA,CAAAuB,WAAA,GAAAA,WAAA","ignoreList":[]}
|
|
@@ -13,11 +13,10 @@ function makeFragmentData(data, _fragment) {
|
|
|
13
13
|
return data;
|
|
14
14
|
}
|
|
15
15
|
function isFragmentReady(queryNode, fragmentNode, data) {
|
|
16
|
-
|
|
17
|
-
const deferredFields = (_meta__ = queryNode.__meta__) === null || _meta__ === void 0 ? void 0 : _meta__.deferredFields;
|
|
16
|
+
const deferredFields = queryNode.__meta__?.deferredFields;
|
|
18
17
|
if (!deferredFields) return true;
|
|
19
18
|
const fragDef = fragmentNode.definitions[0];
|
|
20
|
-
const fragName = fragDef
|
|
19
|
+
const fragName = fragDef?.name?.value;
|
|
21
20
|
const fields = fragName && deferredFields[fragName] || [];
|
|
22
21
|
return fields.length > 0 && fields.every(field => data && field in data);
|
|
23
22
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fragment-masking.js","names":["useFragment","_documentNode","fragmentType","makeFragmentData","data","_fragment","isFragmentReady","queryNode","fragmentNode","
|
|
1
|
+
{"version":3,"file":"fragment-masking.js","names":["useFragment","_documentNode","fragmentType","makeFragmentData","data","_fragment","isFragmentReady","queryNode","fragmentNode","deferredFields","__meta__","fragDef","definitions","fragName","name","value","fields","length","every","field"],"sources":["../../../../src/gql/types/fragment-masking.ts"],"sourcesContent":["import {\n ResultOf,\n DocumentTypeDecoration,\n TypedDocumentNode,\n} from '@graphql-typed-document-node/core';\nimport { FragmentDefinitionNode } from 'graphql';\nimport { Incremental } from './graphql';\n\nexport type FragmentType<\n TDocumentType extends DocumentTypeDecoration<any, any>,\n> =\n TDocumentType extends DocumentTypeDecoration<infer TType, any>\n ? [TType] extends [{ ' $fragmentName'?: infer TKey }]\n ? TKey extends string\n ? { ' $fragmentRefs'?: { [key in TKey]: TType } }\n : never\n : never\n : never;\n\n// return non-nullable if `fragmentType` is non-nullable\nexport function useFragment<TType>(\n _documentNode: DocumentTypeDecoration<TType, any>,\n fragmentType: FragmentType<DocumentTypeDecoration<TType, any>>\n): TType;\n// return nullable if `fragmentType` is nullable\nexport function useFragment<TType>(\n _documentNode: DocumentTypeDecoration<TType, any>,\n fragmentType:\n | FragmentType<DocumentTypeDecoration<TType, any>>\n | null\n | undefined\n): TType | null | undefined;\n// return array of non-nullable if `fragmentType` is array of non-nullable\nexport function useFragment<TType>(\n _documentNode: DocumentTypeDecoration<TType, any>,\n fragmentType: ReadonlyArray<FragmentType<DocumentTypeDecoration<TType, any>>>\n): ReadonlyArray<TType>;\n// return array of nullable if `fragmentType` is array of nullable\nexport function useFragment<TType>(\n _documentNode: DocumentTypeDecoration<TType, any>,\n fragmentType:\n | ReadonlyArray<FragmentType<DocumentTypeDecoration<TType, any>>>\n | null\n | undefined\n): ReadonlyArray<TType> | null | undefined;\nexport function useFragment<TType>(\n _documentNode: DocumentTypeDecoration<TType, any>,\n fragmentType:\n | FragmentType<DocumentTypeDecoration<TType, any>>\n | ReadonlyArray<FragmentType<DocumentTypeDecoration<TType, any>>>\n | null\n | undefined\n): TType | ReadonlyArray<TType> | null | undefined {\n return fragmentType as any;\n}\n\nexport function makeFragmentData<\n F extends DocumentTypeDecoration<any, any>,\n FT extends ResultOf<F>,\n>(data: FT, _fragment: F): FragmentType<F> {\n return data as FragmentType<F>;\n}\nexport function isFragmentReady<TQuery, TFrag>(\n queryNode: DocumentTypeDecoration<TQuery, any>,\n fragmentNode: TypedDocumentNode<TFrag>,\n data:\n | FragmentType<TypedDocumentNode<Incremental<TFrag>, any>>\n | null\n | undefined\n): data is FragmentType<typeof fragmentNode> {\n const deferredFields = (\n queryNode as {\n __meta__?: { deferredFields: Record<string, (keyof TFrag)[]> };\n }\n ).__meta__?.deferredFields;\n\n if (!deferredFields) return true;\n\n const fragDef = fragmentNode.definitions[0] as\n | FragmentDefinitionNode\n | undefined;\n const fragName = fragDef?.name?.value;\n\n const fields = (fragName && deferredFields[fragName]) || [];\n return fields.length > 0 && fields.every((field) => data && field in data);\n}\n"],"mappings":";;;;;;;;AA6CO,SAASA,WAAWA,CACzBC,aAAiD,EACjDC,YAIa,EACoC;EACjD,OAAOA,YAAY;AACrB;AAEO,SAASC,gBAAgBA,CAG9BC,IAAQ,EAAEC,SAAY,EAAmB;EACzC,OAAOD,IAAI;AACb;AACO,SAASE,eAAeA,CAC7BC,SAA8C,EAC9CC,YAAsC,EACtCJ,IAGa,EAC8B;EAC3C,MAAMK,cAAc,GAClBF,SAAS,CAGTG,QAAQ,EAAED,cAAc;EAE1B,IAAI,CAACA,cAAc,EAAE,OAAO,IAAI;EAEhC,MAAME,OAAO,GAAGH,YAAY,CAACI,WAAW,CAAC,CAAC,CAE7B;EACb,MAAMC,QAAQ,GAAGF,OAAO,EAAEG,IAAI,EAAEC,KAAK;EAErC,MAAMC,MAAM,GAAIH,QAAQ,IAAIJ,cAAc,CAACI,QAAQ,CAAC,IAAK,EAAE;EAC3D,OAAOG,MAAM,CAACC,MAAM,GAAG,CAAC,IAAID,MAAM,CAACE,KAAK,CAAEC,KAAK,IAAKf,IAAI,IAAIe,KAAK,IAAIf,IAAI,CAAC;AAC5E","ignoreList":[]}
|
|
@@ -10,7 +10,6 @@ const documents = {
|
|
|
10
10
|
'\n query validateInstruments($instruments: [String]!, $division: Division!) {\n resolveInstrumentsByDivision(instruments: $instruments, division: $division) {\n name\n displayName\n }\n }\n': types.ValidateInstrumentsDocument
|
|
11
11
|
};
|
|
12
12
|
function graphql(source) {
|
|
13
|
-
|
|
14
|
-
return (_source = documents[source]) !== null && _source !== void 0 ? _source : {};
|
|
13
|
+
return documents[source] ?? {};
|
|
15
14
|
}
|
|
16
15
|
//# sourceMappingURL=gql.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gql.js","names":["types","_interopRequireWildcard","require","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","documents","ValidateInstrumentsDocument","graphql","source"
|
|
1
|
+
{"version":3,"file":"gql.js","names":["types","_interopRequireWildcard","require","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","documents","ValidateInstrumentsDocument","graphql","source"],"sources":["../../../../src/gql/types/gql.ts"],"sourcesContent":["/* eslint-disable */\nimport * as types from './graphql';\nimport { TypedDocumentNode as DocumentNode } from '@graphql-typed-document-node/core';\n\n/**\n * Map of all GraphQL operations in the project.\n *\n * This map has several performance disadvantages:\n * 1. It is not tree-shakeable, so it will include all operations in the project.\n * 2. It is not minifiable, so the string of a GraphQL query will be multiple times inside the bundle.\n * 3. It does not support dead code elimination, so it will add unused operations.\n *\n * Therefore it is highly recommended to use the babel or swc plugin for production.\n */\nconst documents = {\n '\\n query validateInstruments($instruments: [String]!, $division: Division!) {\\n resolveInstrumentsByDivision(instruments: $instruments, division: $division) {\\n name\\n displayName\\n }\\n }\\n':\n types.ValidateInstrumentsDocument,\n};\n\n/**\n * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.\n *\n *\n * @example\n * ```ts\n * const query = graphql(`query GetUser($id: ID!) { user(id: $id) { name } }`);\n * ```\n *\n * The query argument is unknown!\n * Please regenerate the types.\n */\nexport function graphql(source: string): unknown;\n\n/**\n * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.\n */\nexport function graphql(\n source: '\\n query validateInstruments($instruments: [String]!, $division: Division!) {\\n resolveInstrumentsByDivision(instruments: $instruments, division: $division) {\\n name\\n displayName\\n }\\n }\\n'\n): (typeof documents)['\\n query validateInstruments($instruments: [String]!, $division: Division!) {\\n resolveInstrumentsByDivision(instruments: $instruments, division: $division) {\\n name\\n displayName\\n }\\n }\\n'];\n\nexport function graphql(source: string) {\n return (documents as any)[source] ?? {};\n}\n\nexport type DocumentType<TDocumentNode extends DocumentNode<any, any>> =\n TDocumentNode extends DocumentNode<infer TType, any> ? TType : never;\n"],"mappings":";;;;;;AACA,IAAAA,KAAA,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
|
6
6
|
exports.validateInstruments = void 0;
|
|
7
7
|
var _client = require("@apollo/client");
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
const validateInstruments = exports.validateInstruments = (0, _client.gql)`
|
|
9
|
+
query validateInstruments($instruments: [String]!, $division: Division!) {
|
|
10
|
+
resolveInstrumentsByDivision(
|
|
11
|
+
instruments: $instruments
|
|
12
|
+
division: $division
|
|
13
|
+
) {
|
|
14
|
+
name
|
|
15
|
+
displayName
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
`;
|
|
11
19
|
//# sourceMappingURL=validateInstruments.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validateInstruments.js","names":["_client","require","
|
|
1
|
+
{"version":3,"file":"validateInstruments.js","names":["_client","require","validateInstruments","exports","gql"],"sources":["../../../src/gql/validateInstruments.ts"],"sourcesContent":["import { gql } from '@apollo/client';\n\nexport const validateInstruments = gql`\n query validateInstruments($instruments: [String]!, $division: Division!) {\n resolveInstrumentsByDivision(\n instruments: $instruments\n division: $division\n ) {\n name\n displayName\n }\n }\n`;\n"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AAEO,MAAMC,mBAAmB,GAAAC,OAAA,CAAAD,mBAAA,GAAG,IAAAE,WAAG;AACtC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC","ignoreList":[]}
|
|
@@ -38,11 +38,11 @@ const Main = _ref => {
|
|
|
38
38
|
hovered: currency === selectedCurrency,
|
|
39
39
|
label: currency
|
|
40
40
|
}), arr.map(pair => React.createElement(Fragment, {
|
|
41
|
-
key:
|
|
41
|
+
key: `${currency}_${pair}`
|
|
42
42
|
}, currency !== pair ? React.createElement(CellWithData, {
|
|
43
43
|
currency: currency,
|
|
44
44
|
division: division,
|
|
45
|
-
isValid: validInstruments.includes(
|
|
45
|
+
isValid: validInstruments.includes(`${currency}${divisionMapper(division)}${pair}`),
|
|
46
46
|
pair: pair,
|
|
47
47
|
setSelectedCurrency: setSelectedCurrency,
|
|
48
48
|
setSelectedPair: setSelectedPair,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Main.js","names":["useLiveRatesQuery","React","Fragment","useEffect","useState","CellWithData","TextCell","divisionMapper","Main","_ref","currencies","validInstruments","division","selectedCurrency","setSelectedCurrency","selectedPair","setSelectedPair","target","setQuery","instruments","createElement","className","sticky","map","pair","key","hovered","label","currency","index","arr","
|
|
1
|
+
{"version":3,"file":"Main.js","names":["useLiveRatesQuery","React","Fragment","useEffect","useState","CellWithData","TextCell","divisionMapper","Main","_ref","currencies","validInstruments","division","selectedCurrency","setSelectedCurrency","selectedPair","setSelectedPair","target","setQuery","instruments","createElement","className","sticky","map","pair","key","hovered","label","currency","index","arr","isValid","includes","emptyIndicator"],"sources":["../../../src/CurrencyCrossTableWidget/Main.tsx"],"sourcesContent":["import { useLiveRatesQuery } from '@oanda/labs-widget-common';\nimport React, { Fragment, useEffect, useState } from 'react';\n\nimport { CellWithData, TextCell } from './components';\nimport type { MainProps } from './types';\nimport { divisionMapper } from './utils';\n\nconst Main = ({ currencies, validInstruments, division }: MainProps) => {\n const [selectedCurrency, setSelectedCurrency] = useState('');\n const [selectedPair, setSelectedPair] = useState('');\n const { target, setQuery } = useLiveRatesQuery();\n\n useEffect(() => {\n setQuery({ instruments: validInstruments });\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, validInstruments);\n\n return (\n <div\n className=\"lw-w-full lw-overflow-x-auto lw-overflow-y-hidden lw-border lw-border-b-0 lw-border-solid lw-border-border-primary\"\n data-testid=\"currency-cross-table-wrapper\"\n >\n <div className=\"lw-flex lw-w-max lw-min-w-full\">\n <TextCell sticky />\n {currencies.map((pair) => (\n <TextCell key={pair} hovered={pair === selectedPair} label={pair} />\n ))}\n </div>\n {currencies.map((currency, index, arr) => (\n <div key={currency} className=\"lw-flex lw-w-max lw-min-w-full\">\n <TextCell\n sticky\n hovered={currency === selectedCurrency}\n label={currency}\n />\n {arr.map((pair) => (\n <Fragment key={`${currency}_${pair}`}>\n {currency !== pair ? (\n <CellWithData\n currency={currency}\n division={division}\n isValid={validInstruments.includes(\n `${currency}${divisionMapper(division)}${pair}`\n )}\n pair={pair}\n setSelectedCurrency={setSelectedCurrency}\n setSelectedPair={setSelectedPair}\n target={target}\n />\n ) : (\n <TextCell emptyIndicator />\n )}\n </Fragment>\n ))}\n </div>\n ))}\n </div>\n );\n};\n\nexport { Main };\n"],"mappings":"AAAA,SAASA,iBAAiB,QAAQ,2BAA2B;AAC7D,OAAOC,KAAK,IAAIC,QAAQ,EAAEC,SAAS,EAAEC,QAAQ,QAAQ,OAAO;AAE5D,SAASC,YAAY,EAAEC,QAAQ,QAAQ,cAAc;AAErD,SAASC,cAAc,QAAQ,SAAS;AAExC,MAAMC,IAAI,GAAGC,IAAA,IAA2D;EAAA,IAA1D;IAAEC,UAAU;IAAEC,gBAAgB;IAAEC;EAAoB,CAAC,GAAAH,IAAA;EACjE,MAAM,CAACI,gBAAgB,EAAEC,mBAAmB,CAAC,GAAGV,QAAQ,CAAC,EAAE,CAAC;EAC5D,MAAM,CAACW,YAAY,EAAEC,eAAe,CAAC,GAAGZ,QAAQ,CAAC,EAAE,CAAC;EACpD,MAAM;IAAEa,MAAM;IAAEC;EAAS,CAAC,GAAGlB,iBAAiB,CAAC,CAAC;EAEhDG,SAAS,CAAC,MAAM;IACde,QAAQ,CAAC;MAAEC,WAAW,EAAER;IAAiB,CAAC,CAAC;EAE7C,CAAC,EAAEA,gBAAgB,CAAC;EAEpB,OACEV,KAAA,CAAAmB,aAAA;IACEC,SAAS,EAAC,oHAAoH;IAC9H,eAAY;EAA8B,GAE1CpB,KAAA,CAAAmB,aAAA;IAAKC,SAAS,EAAC;EAAgC,GAC7CpB,KAAA,CAAAmB,aAAA,CAACd,QAAQ;IAACgB,MAAM;EAAA,CAAE,CAAC,EAClBZ,UAAU,CAACa,GAAG,CAAEC,IAAI,IACnBvB,KAAA,CAAAmB,aAAA,CAACd,QAAQ;IAACmB,GAAG,EAAED,IAAK;IAACE,OAAO,EAAEF,IAAI,KAAKT,YAAa;IAACY,KAAK,EAAEH;EAAK,CAAE,CACpE,CACE,CAAC,EACLd,UAAU,CAACa,GAAG,CAAC,CAACK,QAAQ,EAAEC,KAAK,EAAEC,GAAG,KACnC7B,KAAA,CAAAmB,aAAA;IAAKK,GAAG,EAAEG,QAAS;IAACP,SAAS,EAAC;EAAgC,GAC5DpB,KAAA,CAAAmB,aAAA,CAACd,QAAQ;IACPgB,MAAM;IACNI,OAAO,EAAEE,QAAQ,KAAKf,gBAAiB;IACvCc,KAAK,EAAEC;EAAS,CACjB,CAAC,EACDE,GAAG,CAACP,GAAG,CAAEC,IAAI,IACZvB,KAAA,CAAAmB,aAAA,CAAClB,QAAQ;IAACuB,GAAG,EAAE,GAAGG,QAAQ,IAAIJ,IAAI;EAAG,GAClCI,QAAQ,KAAKJ,IAAI,GAChBvB,KAAA,CAAAmB,aAAA,CAACf,YAAY;IACXuB,QAAQ,EAAEA,QAAS;IACnBhB,QAAQ,EAAEA,QAAS;IACnBmB,OAAO,EAAEpB,gBAAgB,CAACqB,QAAQ,CAChC,GAAGJ,QAAQ,GAAGrB,cAAc,CAACK,QAAQ,CAAC,GAAGY,IAAI,EAC/C,CAAE;IACFA,IAAI,EAAEA,IAAK;IACXV,mBAAmB,EAAEA,mBAAoB;IACzCE,eAAe,EAAEA,eAAgB;IACjCC,MAAM,EAAEA;EAAO,CAChB,CAAC,GAEFhB,KAAA,CAAAmB,aAAA,CAACd,QAAQ;IAAC2B,cAAc;EAAA,CAAE,CAEpB,CACX,CACE,CACN,CACE,CAAC;AAEV,CAAC;AAED,SAASzB,IAAI","ignoreList":[]}
|
|
@@ -6,7 +6,6 @@ import { validateInstruments } from '../gql/validateInstruments';
|
|
|
6
6
|
import { Main } from './Main';
|
|
7
7
|
import { currenciesToInstruments, validCurrencies } from './utils';
|
|
8
8
|
const ValidationWrapper = _ref => {
|
|
9
|
-
var _data$resolveInstrume;
|
|
10
9
|
let {
|
|
11
10
|
currencies,
|
|
12
11
|
division,
|
|
@@ -24,7 +23,7 @@ const ValidationWrapper = _ref => {
|
|
|
24
23
|
fetchPolicy: 'network-only',
|
|
25
24
|
errorPolicy: 'all'
|
|
26
25
|
});
|
|
27
|
-
const validInstruments = data
|
|
26
|
+
const validInstruments = data?.resolveInstrumentsByDivision?.map(instrument => instrument.name);
|
|
28
27
|
const showError = !validCurrencies(currencies) || isParamError || error || !validInstruments || validInstruments.length === 0;
|
|
29
28
|
return React.createElement(React.Fragment, null, React.createElement("div", {
|
|
30
29
|
className: "lw-flex lw-w-full lw-text-sm lw-tracking-normal lw-text-text-primary"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ValidationWrapper.js","names":["useSuspenseQuery","ChartError","classnames","React","validateInstruments","Main","currenciesToInstruments","validCurrencies","ValidationWrapper","_ref","
|
|
1
|
+
{"version":3,"file":"ValidationWrapper.js","names":["useSuspenseQuery","ChartError","classnames","React","validateInstruments","Main","currenciesToInstruments","validCurrencies","ValidationWrapper","_ref","currencies","division","isParamError","instruments","data","error","variables","fetchPolicy","errorPolicy","validInstruments","resolveInstrumentsByDivision","map","instrument","name","showError","length","createElement","Fragment","className"],"sources":["../../../src/CurrencyCrossTableWidget/ValidationWrapper.tsx"],"sourcesContent":["import { useSuspenseQuery } from '@apollo/client';\nimport { ChartError } from '@oanda/labs-widget-common';\nimport classnames from 'classnames';\nimport React from 'react';\n\nimport type {\n ValidateInstrumentsQuery,\n ValidateInstrumentsQueryVariables,\n} from '../gql/types/graphql';\nimport { validateInstruments } from '../gql/validateInstruments';\nimport { Main } from './Main';\nimport type { ValidationWrapperProps } from './types';\nimport { currenciesToInstruments, validCurrencies } from './utils';\n\nconst ValidationWrapper = ({\n currencies,\n division,\n isParamError,\n}: ValidationWrapperProps) => {\n const instruments = currenciesToInstruments(currencies, division);\n\n const { data, error } = useSuspenseQuery<\n ValidateInstrumentsQuery,\n ValidateInstrumentsQueryVariables\n >(validateInstruments, {\n variables: {\n instruments,\n division,\n },\n fetchPolicy: 'network-only',\n errorPolicy: 'all',\n });\n\n const validInstruments = data?.resolveInstrumentsByDivision?.map(\n (instrument) => instrument.name\n );\n const showError =\n !validCurrencies(currencies) ||\n isParamError ||\n error ||\n !validInstruments ||\n validInstruments.length === 0;\n\n return (\n <>\n <div className=\"lw-flex lw-w-full lw-text-sm lw-tracking-normal lw-text-text-primary\">\n {!showError && (\n <Main\n currencies={currencies}\n division={division}\n validInstruments={validInstruments}\n />\n )}\n {showError && (\n <div\n className={classnames(\n 'lw-flex lw-h-[250px] lw-w-full lw-items-center lw-border lw-border-solid lw-border-border-primary'\n )}\n >\n <ChartError />\n </div>\n )}\n </div>\n </>\n );\n};\n\nexport { ValidationWrapper };\n"],"mappings":"AAAA,SAASA,gBAAgB,QAAQ,gBAAgB;AACjD,SAASC,UAAU,QAAQ,2BAA2B;AACtD,OAAOC,UAAU,MAAM,YAAY;AACnC,OAAOC,KAAK,MAAM,OAAO;AAMzB,SAASC,mBAAmB,QAAQ,4BAA4B;AAChE,SAASC,IAAI,QAAQ,QAAQ;AAE7B,SAASC,uBAAuB,EAAEC,eAAe,QAAQ,SAAS;AAElE,MAAMC,iBAAiB,GAAGC,IAAA,IAII;EAAA,IAJH;IACzBC,UAAU;IACVC,QAAQ;IACRC;EACsB,CAAC,GAAAH,IAAA;EACvB,MAAMI,WAAW,GAAGP,uBAAuB,CAACI,UAAU,EAAEC,QAAQ,CAAC;EAEjE,MAAM;IAAEG,IAAI;IAAEC;EAAM,CAAC,GAAGf,gBAAgB,CAGtCI,mBAAmB,EAAE;IACrBY,SAAS,EAAE;MACTH,WAAW;MACXF;IACF,CAAC;IACDM,WAAW,EAAE,cAAc;IAC3BC,WAAW,EAAE;EACf,CAAC,CAAC;EAEF,MAAMC,gBAAgB,GAAGL,IAAI,EAAEM,4BAA4B,EAAEC,GAAG,CAC7DC,UAAU,IAAKA,UAAU,CAACC,IAC7B,CAAC;EACD,MAAMC,SAAS,GACb,CAACjB,eAAe,CAACG,UAAU,CAAC,IAC5BE,YAAY,IACZG,KAAK,IACL,CAACI,gBAAgB,IACjBA,gBAAgB,CAACM,MAAM,KAAK,CAAC;EAE/B,OACEtB,KAAA,CAAAuB,aAAA,CAAAvB,KAAA,CAAAwB,QAAA,QACExB,KAAA,CAAAuB,aAAA;IAAKE,SAAS,EAAC;EAAsE,GAClF,CAACJ,SAAS,IACTrB,KAAA,CAAAuB,aAAA,CAACrB,IAAI;IACHK,UAAU,EAAEA,UAAW;IACvBC,QAAQ,EAAEA,QAAS;IACnBQ,gBAAgB,EAAEA;EAAiB,CACpC,CACF,EACAK,SAAS,IACRrB,KAAA,CAAAuB,aAAA;IACEE,SAAS,EAAE1B,UAAU,CACnB,mGACF;EAAE,GAEFC,KAAA,CAAAuB,aAAA,CAACzB,UAAU,MAAE,CACV,CAEJ,CACL,CAAC;AAEP,CAAC;AAED,SAASO,iBAAiB","ignoreList":[]}
|
|
@@ -12,8 +12,8 @@ const CellWithData = _ref => {
|
|
|
12
12
|
setSelectedCurrency,
|
|
13
13
|
setSelectedPair
|
|
14
14
|
} = _ref;
|
|
15
|
-
const instrument =
|
|
16
|
-
const instrumentForUpdates = isValid ? instrument :
|
|
15
|
+
const instrument = `${currency}${divisionMapper(division)}${pair}`;
|
|
16
|
+
const instrumentForUpdates = isValid ? instrument : `${pair}${divisionMapper(division)}${currency}`;
|
|
17
17
|
const {
|
|
18
18
|
update,
|
|
19
19
|
error: liveRatesError
|
|
@@ -21,7 +21,7 @@ const CellWithData = _ref => {
|
|
|
21
21
|
const [hovered, setHovered] = useState(false);
|
|
22
22
|
const prevBuyPrice = useRef();
|
|
23
23
|
const [priceMovement, setPriceMovement] = useState();
|
|
24
|
-
const checkLoading = () => !liveRatesError &&
|
|
24
|
+
const checkLoading = () => !liveRatesError && update?.ask === undefined;
|
|
25
25
|
const handleMouseEnter = () => {
|
|
26
26
|
setHovered(true);
|
|
27
27
|
setSelectedCurrency(currency);
|
|
@@ -56,7 +56,7 @@ const CellWithData = _ref => {
|
|
|
56
56
|
}, React.createElement(Price, {
|
|
57
57
|
movementIndicator: "background",
|
|
58
58
|
priceMovement: priceMovement
|
|
59
|
-
}, React.createElement("span", null, getBuyPrice(update
|
|
59
|
+
}, React.createElement("span", null, getBuyPrice(update?.ask, !isValid).toFixed(currency === 'JPY' && !isValid ? 6 : update?.displayPrecision))));
|
|
60
60
|
};
|
|
61
61
|
export { CellWithData };
|
|
62
62
|
//# sourceMappingURL=CellWithData.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CellWithData.js","names":["Price","useLiveRatesMessage","React","useEffect","useRef","useState","divisionMapper","getBuyPrice","getPriceMovement","Cell","CellWithData","_ref","currency","pair","isValid","target","division","setSelectedCurrency","setSelectedPair","instrument","
|
|
1
|
+
{"version":3,"file":"CellWithData.js","names":["Price","useLiveRatesMessage","React","useEffect","useRef","useState","divisionMapper","getBuyPrice","getPriceMovement","Cell","CellWithData","_ref","currency","pair","isValid","target","division","setSelectedCurrency","setSelectedPair","instrument","instrumentForUpdates","update","error","liveRatesError","hovered","setHovered","prevBuyPrice","priceMovement","setPriceMovement","checkLoading","ask","undefined","handleMouseEnter","handleMouseLeave","displayPrecision","movement","previous","current","isReversed","createElement","isError","isLoading","mouseEnterHandler","mouseLeaveHandler","movementIndicator","toFixed"],"sources":["../../../../src/CurrencyCrossTableWidget/components/CellWithData.tsx"],"sourcesContent":["import { Price, useLiveRatesMessage } from '@oanda/labs-widget-common';\nimport React, { useEffect, useRef, useState } from 'react';\n\nimport { divisionMapper, getBuyPrice, getPriceMovement } from '../utils';\nimport { Cell } from './Cell';\nimport type { CellWithDataProps } from './types';\n\nconst CellWithData = ({\n currency,\n pair,\n isValid,\n target,\n division,\n setSelectedCurrency,\n setSelectedPair,\n}: CellWithDataProps) => {\n const instrument = `${currency}${divisionMapper(division)}${pair}`;\n const instrumentForUpdates = isValid\n ? instrument\n : `${pair}${divisionMapper(division)}${currency}`;\n\n const { update, error: liveRatesError } = useLiveRatesMessage(\n instrumentForUpdates,\n target\n );\n\n const [hovered, setHovered] = useState(false);\n const prevBuyPrice = useRef<number>();\n const [priceMovement, setPriceMovement] = useState<number | undefined>();\n\n const checkLoading = () => !liveRatesError && update?.ask === undefined;\n\n const handleMouseEnter = () => {\n setHovered(true);\n setSelectedCurrency(currency);\n setSelectedPair(pair);\n };\n\n const handleMouseLeave = () => {\n setHovered(false);\n setSelectedCurrency('');\n setSelectedPair('');\n };\n\n useEffect(() => {\n if (!update) return;\n\n const { ask, displayPrecision } = update;\n const movement = getPriceMovement({\n previous: prevBuyPrice.current,\n update: ask,\n displayPrecision: currency === 'JPY' && !isValid ? 6 : displayPrecision,\n isReversed: !isValid,\n });\n\n prevBuyPrice.current = ask;\n setPriceMovement(movement);\n }, [isValid, update, currency]);\n\n return (\n <Cell\n hovered={hovered}\n isError={!!liveRatesError}\n isLoading={checkLoading()}\n mouseEnterHandler={handleMouseEnter}\n mouseLeaveHandler={handleMouseLeave}\n >\n <Price movementIndicator=\"background\" priceMovement={priceMovement}>\n <span>\n {getBuyPrice(update?.ask, !isValid).toFixed(\n currency === 'JPY' && !isValid ? 6 : update?.displayPrecision\n )}\n </span>\n </Price>\n </Cell>\n );\n};\n\nexport { CellWithData };\n"],"mappings":"AAAA,SAASA,KAAK,EAAEC,mBAAmB,QAAQ,2BAA2B;AACtE,OAAOC,KAAK,IAAIC,SAAS,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,OAAO;AAE1D,SAASC,cAAc,EAAEC,WAAW,EAAEC,gBAAgB,QAAQ,UAAU;AACxE,SAASC,IAAI,QAAQ,QAAQ;AAG7B,MAAMC,YAAY,GAAGC,IAAA,IAQI;EAAA,IARH;IACpBC,QAAQ;IACRC,IAAI;IACJC,OAAO;IACPC,MAAM;IACNC,QAAQ;IACRC,mBAAmB;IACnBC;EACiB,CAAC,GAAAP,IAAA;EAClB,MAAMQ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,EAAE,CAACxB;IACf,CAAC,CAAC;IAEFY,YAAY,CAACW,OAAO,GAAGP,GAAG;IAC1BF,gBAAgB,CAACO,QAAQ,CAAC;EAC5B,CAAC,EAAE,CAACrB,OAAO,EAAEO,MAAM,EAAET,QAAQ,CAAC,CAAC;EAE/B,OACEV,KAAA,CAAAqC,aAAA,CAAC9B,IAAI;IACHe,OAAO,EAAEA,OAAQ;IACjBgB,OAAO,EAAE,CAAC,CAACjB,cAAe;IAC1BkB,SAAS,EAAEZ,YAAY,CAAC,CAAE;IAC1Ba,iBAAiB,EAAEV,gBAAiB;IACpCW,iBAAiB,EAAEV;EAAiB,GAEpC/B,KAAA,CAAAqC,aAAA,CAACvC,KAAK;IAAC4C,iBAAiB,EAAC,YAAY;IAACjB,aAAa,EAAEA;EAAc,GACjEzB,KAAA,CAAAqC,aAAA,eACGhC,WAAW,CAACc,MAAM,EAAES,GAAG,EAAE,CAAChB,OAAO,CAAC,CAAC+B,OAAO,CACzCjC,QAAQ,KAAK,KAAK,IAAI,CAACE,OAAO,GAAG,CAAC,GAAGO,MAAM,EAAEa,gBAC/C,CACI,CACD,CACH,CAAC;AAEX,CAAC;AAED,SAASxB,YAAY","ignoreList":[]}
|
|
@@ -4,20 +4,19 @@ const divisionMapper = division => division === 'OGM' ? '' : '_';
|
|
|
4
4
|
const currenciesToInstruments = (currencies, division) => {
|
|
5
5
|
const pairs = currencies.reduce((acc, cV, index, array) => {
|
|
6
6
|
const unique = array.filter((_item, idx) => index !== idx);
|
|
7
|
-
return [...acc, ...unique.map(el =>
|
|
7
|
+
return [...acc, ...unique.map(el => `${cV}${divisionMapper(division)}${el}`)];
|
|
8
8
|
}, []);
|
|
9
9
|
return pairs;
|
|
10
10
|
};
|
|
11
11
|
const getPriceMovement = _ref => {
|
|
12
|
-
var _getBuyPrice, _getBuyPrice2;
|
|
13
12
|
let {
|
|
14
13
|
previous,
|
|
15
14
|
update,
|
|
16
15
|
displayPrecision,
|
|
17
16
|
isReversed
|
|
18
17
|
} = _ref;
|
|
19
|
-
const roundedPrevious =
|
|
20
|
-
const roundedUpdate =
|
|
18
|
+
const roundedPrevious = getBuyPrice(previous, isReversed)?.toFixed(displayPrecision);
|
|
19
|
+
const roundedUpdate = getBuyPrice(update, isReversed)?.toFixed(displayPrecision);
|
|
21
20
|
if (roundedPrevious === roundedUpdate || update === undefined || previous === undefined) {
|
|
22
21
|
return 0;
|
|
23
22
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","names":["MAJOR_CURRENCIES","validCurrencies","currencies","every","currency","includes","divisionMapper","division","currenciesToInstruments","pairs","reduce","acc","cV","index","array","unique","filter","_item","idx","map","el","
|
|
1
|
+
{"version":3,"file":"utils.js","names":["MAJOR_CURRENCIES","validCurrencies","currencies","every","currency","includes","divisionMapper","division","currenciesToInstruments","pairs","reduce","acc","cV","index","array","unique","filter","_item","idx","map","el","getPriceMovement","_ref","previous","update","displayPrecision","isReversed","roundedPrevious","getBuyPrice","toFixed","roundedUpdate","undefined","price"],"sources":["../../../src/CurrencyCrossTableWidget/utils.ts"],"sourcesContent":["import type { Division } from '../gql/types/graphql';\nimport { MAJOR_CURRENCIES } from './constant';\n\nconst validCurrencies = (currencies: string[]) =>\n currencies.every((currency) => MAJOR_CURRENCIES.includes(currency));\n\nconst divisionMapper = (division: Division) => (division === 'OGM' ? '' : '_');\n\nconst currenciesToInstruments = (currencies: string[], division: Division) => {\n const pairs = currencies.reduce((acc, cV, index, array) => {\n const unique = array.filter((_item, idx) => index !== idx);\n\n return [\n ...acc,\n ...unique.map((el) => `${cV}${divisionMapper(division)}${el}`),\n ];\n }, [] as string[]);\n\n return pairs;\n};\n\nconst getPriceMovement = ({\n previous,\n update,\n displayPrecision,\n isReversed,\n}: {\n previous?: number;\n update?: number;\n displayPrecision?: number;\n isReversed: boolean;\n}) => {\n const roundedPrevious = getBuyPrice(previous, isReversed)?.toFixed(\n displayPrecision\n );\n const roundedUpdate = getBuyPrice(update, isReversed)?.toFixed(\n displayPrecision\n );\n\n if (\n roundedPrevious === roundedUpdate ||\n update === undefined ||\n previous === undefined\n ) {\n return 0;\n }\n\n return roundedUpdate > roundedPrevious ? 1 : -1;\n};\n\nconst getBuyPrice = (price: number | undefined, isReversed: boolean) => {\n if (price === undefined) return 0;\n\n return isReversed ? 1 / price : price;\n};\n\nexport {\n currenciesToInstruments,\n divisionMapper,\n getBuyPrice,\n getPriceMovement,\n validCurrencies,\n};\n"],"mappings":"AACA,SAASA,gBAAgB,QAAQ,YAAY;AAE7C,MAAMC,eAAe,GAAIC,UAAoB,IAC3CA,UAAU,CAACC,KAAK,CAAEC,QAAQ,IAAKJ,gBAAgB,CAACK,QAAQ,CAACD,QAAQ,CAAC,CAAC;AAErE,MAAME,cAAc,GAAIC,QAAkB,IAAMA,QAAQ,KAAK,KAAK,GAAG,EAAE,GAAG,GAAI;AAE9E,MAAMC,uBAAuB,GAAGA,CAACN,UAAoB,EAAEK,QAAkB,KAAK;EAC5E,MAAME,KAAK,GAAGP,UAAU,CAACQ,MAAM,CAAC,CAACC,GAAG,EAAEC,EAAE,EAAEC,KAAK,EAAEC,KAAK,KAAK;IACzD,MAAMC,MAAM,GAAGD,KAAK,CAACE,MAAM,CAAC,CAACC,KAAK,EAAEC,GAAG,KAAKL,KAAK,KAAKK,GAAG,CAAC;IAE1D,OAAO,CACL,GAAGP,GAAG,EACN,GAAGI,MAAM,CAACI,GAAG,CAAEC,EAAE,IAAK,GAAGR,EAAE,GAAGN,cAAc,CAACC,QAAQ,CAAC,GAAGa,EAAE,EAAE,CAAC,CAC/D;EACH,CAAC,EAAE,EAAc,CAAC;EAElB,OAAOX,KAAK;AACd,CAAC;AAED,MAAMY,gBAAgB,GAAGC,IAAA,IAUnB;EAAA,IAVoB;IACxBC,QAAQ;IACRC,MAAM;IACNC,gBAAgB;IAChBC;EAMF,CAAC,GAAAJ,IAAA;EACC,MAAMK,eAAe,GAAGC,WAAW,CAACL,QAAQ,EAAEG,UAAU,CAAC,EAAEG,OAAO,CAChEJ,gBACF,CAAC;EACD,MAAMK,aAAa,GAAGF,WAAW,CAACJ,MAAM,EAAEE,UAAU,CAAC,EAAEG,OAAO,CAC5DJ,gBACF,CAAC;EAED,IACEE,eAAe,KAAKG,aAAa,IACjCN,MAAM,KAAKO,SAAS,IACpBR,QAAQ,KAAKQ,SAAS,EACtB;IACA,OAAO,CAAC;EACV;EAEA,OAAOD,aAAa,GAAGH,eAAe,GAAG,CAAC,GAAG,CAAC,CAAC;AACjD,CAAC;AAED,MAAMC,WAAW,GAAGA,CAACI,KAAyB,EAAEN,UAAmB,KAAK;EACtE,IAAIM,KAAK,KAAKD,SAAS,EAAE,OAAO,CAAC;EAEjC,OAAOL,UAAU,GAAG,CAAC,GAAGM,KAAK,GAAGA,KAAK;AACvC,CAAC;AAED,SACExB,uBAAuB,EACvBF,cAAc,EACdsB,WAAW,EACXP,gBAAgB,EAChBpB,eAAe","ignoreList":[]}
|
|
@@ -5,11 +5,10 @@ export function makeFragmentData(data, _fragment) {
|
|
|
5
5
|
return data;
|
|
6
6
|
}
|
|
7
7
|
export function isFragmentReady(queryNode, fragmentNode, data) {
|
|
8
|
-
|
|
9
|
-
const deferredFields = (_meta__ = queryNode.__meta__) === null || _meta__ === void 0 ? void 0 : _meta__.deferredFields;
|
|
8
|
+
const deferredFields = queryNode.__meta__?.deferredFields;
|
|
10
9
|
if (!deferredFields) return true;
|
|
11
10
|
const fragDef = fragmentNode.definitions[0];
|
|
12
|
-
const fragName = fragDef
|
|
11
|
+
const fragName = fragDef?.name?.value;
|
|
13
12
|
const fields = fragName && deferredFields[fragName] || [];
|
|
14
13
|
return fields.length > 0 && fields.every(field => data && field in data);
|
|
15
14
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fragment-masking.js","names":["useFragment","_documentNode","fragmentType","makeFragmentData","data","_fragment","isFragmentReady","queryNode","fragmentNode","
|
|
1
|
+
{"version":3,"file":"fragment-masking.js","names":["useFragment","_documentNode","fragmentType","makeFragmentData","data","_fragment","isFragmentReady","queryNode","fragmentNode","deferredFields","__meta__","fragDef","definitions","fragName","name","value","fields","length","every","field"],"sources":["../../../../src/gql/types/fragment-masking.ts"],"sourcesContent":["import {\n ResultOf,\n DocumentTypeDecoration,\n TypedDocumentNode,\n} from '@graphql-typed-document-node/core';\nimport { FragmentDefinitionNode } from 'graphql';\nimport { Incremental } from './graphql';\n\nexport type FragmentType<\n TDocumentType extends DocumentTypeDecoration<any, any>,\n> =\n TDocumentType extends DocumentTypeDecoration<infer TType, any>\n ? [TType] extends [{ ' $fragmentName'?: infer TKey }]\n ? TKey extends string\n ? { ' $fragmentRefs'?: { [key in TKey]: TType } }\n : never\n : never\n : never;\n\n// return non-nullable if `fragmentType` is non-nullable\nexport function useFragment<TType>(\n _documentNode: DocumentTypeDecoration<TType, any>,\n fragmentType: FragmentType<DocumentTypeDecoration<TType, any>>\n): TType;\n// return nullable if `fragmentType` is nullable\nexport function useFragment<TType>(\n _documentNode: DocumentTypeDecoration<TType, any>,\n fragmentType:\n | FragmentType<DocumentTypeDecoration<TType, any>>\n | null\n | undefined\n): TType | null | undefined;\n// return array of non-nullable if `fragmentType` is array of non-nullable\nexport function useFragment<TType>(\n _documentNode: DocumentTypeDecoration<TType, any>,\n fragmentType: ReadonlyArray<FragmentType<DocumentTypeDecoration<TType, any>>>\n): ReadonlyArray<TType>;\n// return array of nullable if `fragmentType` is array of nullable\nexport function useFragment<TType>(\n _documentNode: DocumentTypeDecoration<TType, any>,\n fragmentType:\n | ReadonlyArray<FragmentType<DocumentTypeDecoration<TType, any>>>\n | null\n | undefined\n): ReadonlyArray<TType> | null | undefined;\nexport function useFragment<TType>(\n _documentNode: DocumentTypeDecoration<TType, any>,\n fragmentType:\n | FragmentType<DocumentTypeDecoration<TType, any>>\n | ReadonlyArray<FragmentType<DocumentTypeDecoration<TType, any>>>\n | null\n | undefined\n): TType | ReadonlyArray<TType> | null | undefined {\n return fragmentType as any;\n}\n\nexport function makeFragmentData<\n F extends DocumentTypeDecoration<any, any>,\n FT extends ResultOf<F>,\n>(data: FT, _fragment: F): FragmentType<F> {\n return data as FragmentType<F>;\n}\nexport function isFragmentReady<TQuery, TFrag>(\n queryNode: DocumentTypeDecoration<TQuery, any>,\n fragmentNode: TypedDocumentNode<TFrag>,\n data:\n | FragmentType<TypedDocumentNode<Incremental<TFrag>, any>>\n | null\n | undefined\n): data is FragmentType<typeof fragmentNode> {\n const deferredFields = (\n queryNode as {\n __meta__?: { deferredFields: Record<string, (keyof TFrag)[]> };\n }\n ).__meta__?.deferredFields;\n\n if (!deferredFields) return true;\n\n const fragDef = fragmentNode.definitions[0] as\n | FragmentDefinitionNode\n | undefined;\n const fragName = fragDef?.name?.value;\n\n const fields = (fragName && deferredFields[fragName]) || [];\n return fields.length > 0 && fields.every((field) => data && field in data);\n}\n"],"mappings":"AA6CA,OAAO,SAASA,WAAWA,CACzBC,aAAiD,EACjDC,YAIa,EACoC;EACjD,OAAOA,YAAY;AACrB;AAEA,OAAO,SAASC,gBAAgBA,CAG9BC,IAAQ,EAAEC,SAAY,EAAmB;EACzC,OAAOD,IAAI;AACb;AACA,OAAO,SAASE,eAAeA,CAC7BC,SAA8C,EAC9CC,YAAsC,EACtCJ,IAGa,EAC8B;EAC3C,MAAMK,cAAc,GAClBF,SAAS,CAGTG,QAAQ,EAAED,cAAc;EAE1B,IAAI,CAACA,cAAc,EAAE,OAAO,IAAI;EAEhC,MAAME,OAAO,GAAGH,YAAY,CAACI,WAAW,CAAC,CAAC,CAE7B;EACb,MAAMC,QAAQ,GAAGF,OAAO,EAAEG,IAAI,EAAEC,KAAK;EAErC,MAAMC,MAAM,GAAIH,QAAQ,IAAIJ,cAAc,CAACI,QAAQ,CAAC,IAAK,EAAE;EAC3D,OAAOG,MAAM,CAACC,MAAM,GAAG,CAAC,IAAID,MAAM,CAACE,KAAK,CAAEC,KAAK,IAAKf,IAAI,IAAIe,KAAK,IAAIf,IAAI,CAAC;AAC5E","ignoreList":[]}
|
|
@@ -3,7 +3,6 @@ const documents = {
|
|
|
3
3
|
'\n query validateInstruments($instruments: [String]!, $division: Division!) {\n resolveInstrumentsByDivision(instruments: $instruments, division: $division) {\n name\n displayName\n }\n }\n': types.ValidateInstrumentsDocument
|
|
4
4
|
};
|
|
5
5
|
export function graphql(source) {
|
|
6
|
-
|
|
7
|
-
return (_source = documents[source]) !== null && _source !== void 0 ? _source : {};
|
|
6
|
+
return documents[source] ?? {};
|
|
8
7
|
}
|
|
9
8
|
//# sourceMappingURL=gql.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gql.js","names":["types","documents","ValidateInstrumentsDocument","graphql","source"
|
|
1
|
+
{"version":3,"file":"gql.js","names":["types","documents","ValidateInstrumentsDocument","graphql","source"],"sources":["../../../../src/gql/types/gql.ts"],"sourcesContent":["/* eslint-disable */\nimport * as types from './graphql';\nimport { TypedDocumentNode as DocumentNode } from '@graphql-typed-document-node/core';\n\n/**\n * Map of all GraphQL operations in the project.\n *\n * This map has several performance disadvantages:\n * 1. It is not tree-shakeable, so it will include all operations in the project.\n * 2. It is not minifiable, so the string of a GraphQL query will be multiple times inside the bundle.\n * 3. It does not support dead code elimination, so it will add unused operations.\n *\n * Therefore it is highly recommended to use the babel or swc plugin for production.\n */\nconst documents = {\n '\\n query validateInstruments($instruments: [String]!, $division: Division!) {\\n resolveInstrumentsByDivision(instruments: $instruments, division: $division) {\\n name\\n displayName\\n }\\n }\\n':\n types.ValidateInstrumentsDocument,\n};\n\n/**\n * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.\n *\n *\n * @example\n * ```ts\n * const query = graphql(`query GetUser($id: ID!) { user(id: $id) { name } }`);\n * ```\n *\n * The query argument is unknown!\n * Please regenerate the types.\n */\nexport function graphql(source: string): unknown;\n\n/**\n * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.\n */\nexport function graphql(\n source: '\\n query validateInstruments($instruments: [String]!, $division: Division!) {\\n resolveInstrumentsByDivision(instruments: $instruments, division: $division) {\\n name\\n displayName\\n }\\n }\\n'\n): (typeof documents)['\\n query validateInstruments($instruments: [String]!, $division: Division!) {\\n resolveInstrumentsByDivision(instruments: $instruments, division: $division) {\\n name\\n displayName\\n }\\n }\\n'];\n\nexport function graphql(source: string) {\n return (documents as any)[source] ?? {};\n}\n\nexport type DocumentType<TDocumentNode extends DocumentNode<any, any>> =\n TDocumentNode extends DocumentNode<infer TType, any> ? TType : never;\n"],"mappings":"AACA,OAAO,KAAKA,KAAK,MAAM,WAAW;AAalC,MAAMC,SAAS,GAAG;EAChB,iNAAiN,EAC/MD,KAAK,CAACE;AACV,CAAC;AAuBD,OAAO,SAASC,OAAOA,CAACC,MAAc,EAAE;EACtC,OAAQH,SAAS,CAASG,MAAM,CAAC,IAAI,CAAC,CAAC;AACzC","ignoreList":[]}
|
|
@@ -1,5 +1,13 @@
|
|
|
1
|
-
var _templateObject;
|
|
2
|
-
function _taggedTemplateLiteral(e, t) { return t || (t = e.slice(0)), Object.freeze(Object.defineProperties(e, { raw: { value: Object.freeze(t) } })); }
|
|
3
1
|
import { gql } from '@apollo/client';
|
|
4
|
-
export const validateInstruments = gql
|
|
2
|
+
export const validateInstruments = gql`
|
|
3
|
+
query validateInstruments($instruments: [String]!, $division: Division!) {
|
|
4
|
+
resolveInstrumentsByDivision(
|
|
5
|
+
instruments: $instruments
|
|
6
|
+
division: $division
|
|
7
|
+
) {
|
|
8
|
+
name
|
|
9
|
+
displayName
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
`;
|
|
5
13
|
//# sourceMappingURL=validateInstruments.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validateInstruments.js","names":["gql","validateInstruments"
|
|
1
|
+
{"version":3,"file":"validateInstruments.js","names":["gql","validateInstruments"],"sources":["../../../src/gql/validateInstruments.ts"],"sourcesContent":["import { gql } from '@apollo/client';\n\nexport const validateInstruments = gql`\n query validateInstruments($instruments: [String]!, $division: Division!) {\n resolveInstrumentsByDivision(\n instruments: $instruments\n division: $division\n ) {\n name\n displayName\n }\n }\n`;\n"],"mappings":"AAAA,SAASA,GAAG,QAAQ,gBAAgB;AAEpC,OAAO,MAAMC,mBAAmB,GAAGD,GAAG;AACtC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oanda/labs-currency-cross-table",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.96",
|
|
4
4
|
"description": "Labs Currency Cross Table",
|
|
5
5
|
"main": "dist/main/index.js",
|
|
6
6
|
"module": "dist/module/index.js",
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"author": "OANDA",
|
|
14
14
|
"license": "UNLICENSED",
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@oanda/labs-widget-common": "^1.0.
|
|
16
|
+
"@oanda/labs-widget-common": "^1.0.245",
|
|
17
17
|
"@oanda/mono-i18n": "10.0.1",
|
|
18
18
|
"graphql": "16.8.1"
|
|
19
19
|
},
|
|
@@ -21,5 +21,5 @@
|
|
|
21
21
|
"@graphql-codegen/cli": "5.0.0",
|
|
22
22
|
"@graphql-codegen/client-preset": "4.1.0"
|
|
23
23
|
},
|
|
24
|
-
"gitHead": "
|
|
24
|
+
"gitHead": "688bf7bf93110e0714926f15f6ae0ca04e2dc9af"
|
|
25
25
|
}
|