@oanda/labs-spread-cost-calculator-widget 1.0.77 → 1.0.78

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.
Files changed (30) hide show
  1. package/CHANGELOG.md +316 -0
  2. package/dist/main/SpreadCostCalculatorWidget/Main.js +2 -2
  3. package/dist/main/SpreadCostCalculatorWidget/Main.js.map +1 -1
  4. package/dist/main/SpreadCostCalculatorWidget/ValidationWrapper.js +2 -3
  5. package/dist/main/SpreadCostCalculatorWidget/ValidationWrapper.js.map +1 -1
  6. package/dist/main/SpreadCostCalculatorWidget/useCalculateSpread.js +2 -2
  7. package/dist/main/SpreadCostCalculatorWidget/useCalculateSpread.js.map +1 -1
  8. package/dist/main/SpreadCostCalculatorWidget/useInstrumentChange.js +1 -1
  9. package/dist/main/SpreadCostCalculatorWidget/useInstrumentChange.js.map +1 -1
  10. package/dist/main/gql/types/fragment-masking.js +2 -3
  11. package/dist/main/gql/types/fragment-masking.js.map +1 -1
  12. package/dist/main/gql/types/gql.js +1 -2
  13. package/dist/main/gql/types/gql.js.map +1 -1
  14. package/dist/main/gql/validateInstruments.js +8 -3
  15. package/dist/main/gql/validateInstruments.js.map +1 -1
  16. package/dist/module/SpreadCostCalculatorWidget/Main.js +2 -2
  17. package/dist/module/SpreadCostCalculatorWidget/Main.js.map +1 -1
  18. package/dist/module/SpreadCostCalculatorWidget/ValidationWrapper.js +2 -3
  19. package/dist/module/SpreadCostCalculatorWidget/ValidationWrapper.js.map +1 -1
  20. package/dist/module/SpreadCostCalculatorWidget/useCalculateSpread.js +2 -2
  21. package/dist/module/SpreadCostCalculatorWidget/useCalculateSpread.js.map +1 -1
  22. package/dist/module/SpreadCostCalculatorWidget/useInstrumentChange.js +1 -1
  23. package/dist/module/SpreadCostCalculatorWidget/useInstrumentChange.js.map +1 -1
  24. package/dist/module/gql/types/fragment-masking.js +2 -3
  25. package/dist/module/gql/types/fragment-masking.js.map +1 -1
  26. package/dist/module/gql/types/gql.js +1 -2
  27. package/dist/module/gql/types/gql.js.map +1 -1
  28. package/dist/module/gql/validateInstruments.js +8 -3
  29. package/dist/module/gql/validateInstruments.js.map +1 -1
  30. package/package.json +3 -3
package/CHANGELOG.md CHANGED
@@ -3,6 +3,322 @@
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.78 (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
+ **Note:** Version bump only for package @oanda/labs-spread-cost-calculator-widget
317
+
318
+
319
+
320
+
321
+
6
322
  ## 1.0.77 (2026-01-02)
7
323
 
8
324
 
@@ -53,8 +53,8 @@ const Main = _ref => {
53
53
  (0, _react.useEffect)(() => {
54
54
  onSpreadChange({
55
55
  floatValue: initialSpread,
56
- formattedValue: (initialSpread === null || initialSpread === void 0 ? void 0 : initialSpread.toString()) || '',
57
- value: (initialSpread === null || initialSpread === void 0 ? void 0 : initialSpread.toString()) || ''
56
+ formattedValue: initialSpread?.toString() || '',
57
+ value: initialSpread?.toString() || ''
58
58
  });
59
59
  }, [initialSpread]);
60
60
  const {
@@ -1 +1 @@
1
- {"version":3,"file":"Main.js","names":["_labsWidgetCommon","require","_monoI18n","_react","_interopRequireWildcard","_useCalculateSpread","_useInstrumentChange","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","Main","_ref","instruments","size","useLayoutProvider","isDesktop","Size","DESKTOP","selectOptions","map","instrument","id","name","label","displayName","value","unitsTraded","handleValueChange","onUnitChange","increment","incrementTradedUnits","decrement","decrementTradedUnits","useNumberFormat","spread","onSpreadChange","incrementSpread","decrementSpread","step","selectedInstrument","setSelectedInstrument","pipLocation","initialSpread","loading","error","currency","useInstrumentChange","initialInstrument","useEffect","floatValue","formattedValue","toString","lang","useLocale","spreadCost","useCalculateSpread","createElement","Fragment","className","ChartError","Label","htmlFor","Select","maxHeight","options","searchPlaceholder","selectedOption","setSelectedOption","cn","NumberInput","withoutArrows","disabled","placeholder","onDecrement","onIncrement","onValueChange","exports"],"sources":["../../../src/SpreadCostCalculatorWidget/Main.tsx"],"sourcesContent":["import {\n ChartError,\n cn,\n Label,\n NumberInput,\n Select,\n Size,\n useLayoutProvider,\n useNumberFormat,\n} from '@oanda/labs-widget-common';\nimport { useLocale } from '@oanda/mono-i18n';\nimport type { FC } from 'react';\nimport React, { useEffect } from 'react';\n\nimport type { MainProps } from './types';\nimport { useCalculateSpread } from './useCalculateSpread';\nimport { useInstrumentChange } from './useInstrumentChange';\n\nconst Main: FC<MainProps> = ({ instruments }) => {\n const { size } = useLayoutProvider();\n const isDesktop = size === Size.DESKTOP;\n\n const selectOptions = instruments.map((instrument) => ({\n id: instrument.name,\n label: instrument.displayName,\n }));\n\n const {\n value: unitsTraded,\n handleValueChange: onUnitChange,\n increment: incrementTradedUnits,\n decrement: decrementTradedUnits,\n } = useNumberFormat({});\n\n const {\n value: spread,\n handleValueChange: onSpreadChange,\n increment: incrementSpread,\n decrement: decrementSpread,\n } = useNumberFormat({\n step: 0.1,\n });\n\n const {\n selectedInstrument,\n setSelectedInstrument,\n pipLocation,\n initialSpread,\n loading,\n error,\n currency,\n } = useInstrumentChange({\n initialInstrument: {\n id: instruments[0].name,\n label: instruments[0].displayName,\n },\n });\n\n useEffect(() => {\n onSpreadChange({\n floatValue: initialSpread,\n formattedValue: initialSpread?.toString() || '',\n value: initialSpread?.toString() || '',\n });\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [initialSpread]);\n\n const { lang } = useLocale();\n\n const spreadCost = useCalculateSpread({\n spread,\n unitsTraded,\n pipLocation,\n currency,\n });\n\n return (\n <>\n {error ? (\n <div className=\"lw-flex lw-h-[300px] lw-w-full lw-items-center lw-border lw-border-solid lw-border-border-primary\">\n <ChartError />\n </div>\n ) : (\n <div\n className=\"lw-mx-auto lw-flex lw-w-full lw-max-w-full lw-flex-col lw-content-center lw-justify-center lw-gap-8 lw-p-4\"\n data-testid=\"spread-cost-calculator\"\n >\n <div className=\"lw-flex lw-flex-col lw-gap-2\">\n <Label\n className=\"lw-text-text-primary\"\n htmlFor={lang('instrument')}\n >\n {lang('instrument')}\n </Label>\n <Select\n className=\"lw-grow-0\"\n maxHeight={isDesktop ? 190 : 220}\n options={selectOptions}\n searchPlaceholder={lang('search')}\n selectedOption={selectedInstrument}\n setSelectedOption={setSelectedInstrument}\n />\n </div>\n <div className=\"lw-flex lw-max-w-full lw-flex-col lw-content-center lw-justify-center lw-gap-3\">\n <div\n className={cn(\n 'lw-flex lw-max-w-full lw-flex-row lw-gap-3',\n !isDesktop && 'lw-flex-col lw-gap-8'\n )}\n >\n <NumberInput\n withoutArrows\n disabled={loading}\n label={lang('units_traded')}\n placeholder={lang('volume')}\n value={unitsTraded}\n onDecrement={decrementTradedUnits}\n onIncrement={incrementTradedUnits}\n onValueChange={onUnitChange}\n />\n <NumberInput\n disabled={loading}\n label={lang('spread')}\n placeholder={lang('pips')}\n value={spread}\n onDecrement={decrementSpread}\n onIncrement={incrementSpread}\n onValueChange={onSpreadChange}\n />\n </div>\n <div className=\"lw-pt-4 lw-text-text-primary\">\n <div>{lang('absolute_spread_cost')}</div>\n <div className=\"lw-pt-2 lw-text-3xl lw-font-bold\">\n {spreadCost}\n </div>\n </div>\n </div>\n </div>\n )}\n </>\n );\n};\n\nexport { Main };\n"],"mappings":";;;;;;AAAA,IAAAA,iBAAA,GAAAC,OAAA;AAUA,IAAAC,SAAA,GAAAD,OAAA;AAEA,IAAAE,MAAA,GAAAC,uBAAA,CAAAH,OAAA;AAGA,IAAAI,mBAAA,GAAAJ,OAAA;AACA,IAAAK,oBAAA,GAAAL,OAAA;AAA4D,SAAAG,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,C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AA;IAAKE,SAAS,EAAC;EAAkC,GAC9CJ,UACE,CACF,CACF,CACF,CAEP,CAAC;AAEP,CAAC;AAACsB,OAAA,CAAAlE,IAAA,GAAAA,IAAA","ignoreList":[]}
1
+ {"version":3,"file":"Main.js","names":["_labsWidgetCommon","require","_monoI18n","_react","_interopRequireWildcard","_useCalculateSpread","_useInstrumentChange","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","Main","_ref","instruments","size","useLayoutProvider","isDesktop","Size","DESKTOP","selectOptions","map","instrument","id","name","label","displayName","value","unitsTraded","handleValueChange","onUnitChange","increment","incrementTradedUnits","decrement","decrementTradedUnits","useNumberFormat","spread","onSpreadChange","incrementSpread","decrementSpread","step","selectedInstrument","setSelectedInstrument","pipLocation","initialSpread","loading","error","currency","useInstrumentChange","initialInstrument","useEffect","floatValue","formattedValue","toString","lang","useLocale","spreadCost","useCalculateSpread","createElement","Fragment","className","ChartError","Label","htmlFor","Select","maxHeight","options","searchPlaceholder","selectedOption","setSelectedOption","cn","NumberInput","withoutArrows","disabled","placeholder","onDecrement","onIncrement","onValueChange","exports"],"sources":["../../../src/SpreadCostCalculatorWidget/Main.tsx"],"sourcesContent":["import {\n ChartError,\n cn,\n Label,\n NumberInput,\n Select,\n Size,\n useLayoutProvider,\n useNumberFormat,\n} from '@oanda/labs-widget-common';\nimport { useLocale } from '@oanda/mono-i18n';\nimport type { FC } from 'react';\nimport React, { useEffect } from 'react';\n\nimport type { MainProps } from './types';\nimport { useCalculateSpread } from './useCalculateSpread';\nimport { useInstrumentChange } from './useInstrumentChange';\n\nconst Main: FC<MainProps> = ({ instruments }) => {\n const { size } = useLayoutProvider();\n const isDesktop = size === Size.DESKTOP;\n\n const selectOptions = instruments.map((instrument) => ({\n id: instrument.name,\n label: instrument.displayName,\n }));\n\n const {\n value: unitsTraded,\n handleValueChange: onUnitChange,\n increment: incrementTradedUnits,\n decrement: decrementTradedUnits,\n } = useNumberFormat({});\n\n const {\n value: spread,\n handleValueChange: onSpreadChange,\n increment: incrementSpread,\n decrement: decrementSpread,\n } = useNumberFormat({\n step: 0.1,\n });\n\n const {\n selectedInstrument,\n setSelectedInstrument,\n pipLocation,\n initialSpread,\n loading,\n error,\n currency,\n } = useInstrumentChange({\n initialInstrument: {\n id: instruments[0].name,\n label: instruments[0].displayName,\n },\n });\n\n useEffect(() => {\n onSpreadChange({\n floatValue: initialSpread,\n formattedValue: initialSpread?.toString() || '',\n value: initialSpread?.toString() || '',\n });\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [initialSpread]);\n\n const { lang } = useLocale();\n\n const spreadCost = useCalculateSpread({\n spread,\n unitsTraded,\n pipLocation,\n currency,\n });\n\n return (\n <>\n {error ? (\n <div className=\"lw-flex lw-h-[300px] lw-w-full lw-items-center lw-border lw-border-solid lw-border-border-primary\">\n <ChartError />\n </div>\n ) : (\n <div\n className=\"lw-mx-auto lw-flex lw-w-full lw-max-w-full lw-flex-col lw-content-center lw-justify-center lw-gap-8 lw-p-4\"\n data-testid=\"spread-cost-calculator\"\n >\n <div className=\"lw-flex lw-flex-col lw-gap-2\">\n <Label\n className=\"lw-text-text-primary\"\n htmlFor={lang('instrument')}\n >\n {lang('instrument')}\n </Label>\n <Select\n className=\"lw-grow-0\"\n maxHeight={isDesktop ? 190 : 220}\n options={selectOptions}\n searchPlaceholder={lang('search')}\n selectedOption={selectedInstrument}\n setSelectedOption={setSelectedInstrument}\n />\n </div>\n <div className=\"lw-flex lw-max-w-full lw-flex-col lw-content-center lw-justify-center lw-gap-3\">\n <div\n className={cn(\n 'lw-flex lw-max-w-full lw-flex-row lw-gap-3',\n !isDesktop && 'lw-flex-col lw-gap-8'\n )}\n >\n <NumberInput\n withoutArrows\n disabled={loading}\n label={lang('units_traded')}\n placeholder={lang('volume')}\n value={unitsTraded}\n onDecrement={decrementTradedUnits}\n onIncrement={incrementTradedUnits}\n onValueChange={onUnitChange}\n />\n <NumberInput\n disabled={loading}\n label={lang('spread')}\n placeholder={lang('pips')}\n value={spread}\n onDecrement={decrementSpread}\n onIncrement={incrementSpread}\n onValueChange={onSpreadChange}\n />\n </div>\n <div className=\"lw-pt-4 lw-text-text-primary\">\n <div>{lang('absolute_spread_cost')}</div>\n <div className=\"lw-pt-2 lw-text-3xl lw-font-bold\">\n {spreadCost}\n </div>\n </div>\n </div>\n </div>\n )}\n </>\n );\n};\n\nexport { Main };\n"],"mappings":";;;;;;AAAA,IAAAA,iBAAA,GAAAC,OAAA;AAUA,IAAAC,SAAA,GAAAD,OAAA;AAEA,IAAAE,MAAA,GAAAC,uBAAA,CAAAH,OAAA;AAGA,IAAAI,mBAAA,GAAAJ,OAAA;AACA,IAAAK,oBAAA,GAAAL,OAAA;AAA4D,SAAAG,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,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sB,OAAA,CAAAlE,IAAA,GAAAA,IAAA","ignoreList":[]}
@@ -11,7 +11,6 @@ var _validateInstruments = require("../gql/validateInstruments");
11
11
  var _Main = require("./Main");
12
12
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
13
13
  const ValidationWrapper = _ref => {
14
- var _data$mapInstrumentNa;
15
14
  let {
16
15
  division,
17
16
  instruments,
@@ -31,10 +30,10 @@ const ValidationWrapper = _ref => {
31
30
  fetchPolicy: 'network-only',
32
31
  errorPolicy: 'all'
33
32
  });
34
- const instrumentsData = (data === null || data === void 0 || (_data$mapInstrumentNa = data.mapInstrumentNames) === null || _data$mapInstrumentNa === void 0 ? void 0 : _data$mapInstrumentNa.map(instrument => ({
33
+ const instrumentsData = data?.mapInstrumentNames?.map(instrument => ({
35
34
  name: instrument.name,
36
35
  displayName: instrument.displayName
37
- }))) || [];
36
+ })) || [];
38
37
  const showError = !!error || isParamError;
39
38
  return _react.default.createElement(_react.default.Fragment, null, size && _react.default.createElement(_react.default.Fragment, null, showError ? _react.default.createElement("div", {
40
39
  className: "lw-flex lw-h-[300px] lw-w-full lw-items-center lw-border lw-border-solid lw-border-border-primary"
@@ -1 +1 @@
1
- {"version":3,"file":"ValidationWrapper.js","names":["_client","require","_labsWidgetCommon","_react","_interopRequireDefault","_validateInstruments","_Main","e","__esModule","default","ValidationWrapper","_ref","_data$mapInstrumentNa","division","instruments","isParamError","size","useLayoutProvider","data","error","useSuspenseQuery","validateInstruments","variables","fetchPolicy","errorPolicy","instrumentsData","mapInstrumentNames","map","instrument","name","displayName","showError","createElement","Fragment","className","ChartError","Main","exports"],"sources":["../../../src/SpreadCostCalculatorWidget/ValidationWrapper.tsx"],"sourcesContent":["import { useSuspenseQuery } from '@apollo/client';\nimport { ChartError, useLayoutProvider } from '@oanda/labs-widget-common';\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';\n\nconst ValidationWrapper = ({\n division,\n instruments,\n isParamError,\n}: ValidationWrapperProps) => {\n const { size } = useLayoutProvider();\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 instrumentsData =\n data?.mapInstrumentNames?.map((instrument) => ({\n name: instrument!.name,\n displayName: instrument!.displayName,\n })) || [];\n\n const showError = !!error || isParamError;\n\n return (\n <>\n {size && (\n <>\n {showError ? (\n <div className=\"lw-flex lw-h-[300px] lw-w-full lw-items-center lw-border lw-border-solid lw-border-border-primary\">\n <ChartError />\n </div>\n ) : (\n <Main instruments={instrumentsData} />\n )}\n </>\n )}\n </>\n );\n};\n\nexport { ValidationWrapper };\n"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,iBAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAC,sBAAA,CAAAH,OAAA;AAMA,IAAAI,oBAAA,GAAAJ,OAAA;AACA,IAAAK,KAAA,GAAAL,OAAA;AAA8B,SAAAG,uBAAAG,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAG9B,MAAMG,iBAAiB,GAAGC,IAAA,IAII;EAAA,IAAAC,qBAAA;EAAA,IAJH;IACzBC,QAAQ;IACRC,WAAW;IACXC;EACsB,CAAC,GAAAJ,IAAA;EACvB,MAAM;IAAEK;EAAK,CAAC,GAAG,IAAAC,mCAAiB,EAAC,CAAC;EACpC,MAAM;IAAEC,IAAI;IAAEC;EAAM,CAAC,GAAG,IAAAC,wBAAgB,EAGtCC,wCAAmB,EAAE;IACrBC,SAAS,EAAE;MACTR,WAAW;MACXD;IACF,CAAC;IACDU,WAAW,EAAE,cAAc;IAC3BC,WAAW,EAAE;EACf,CAAC,CAAC;EAEF,MAAMC,eAAe,GACnB,CAAAP,IAAI,aAAJA,IAAI,gBAAAN,qBAAA,GAAJM,IAAI,CAAEQ,kBAAkB,cAAAd,qBAAA,uBAAxBA,qBAAA,CAA0Be,GAAG,CAAEC,UAAU,KAAM;IAC7CC,IAAI,EAAED,UAAU,CAAEC,IAAI;IACtBC,WAAW,EAAEF,UAAU,CAAEE;EAC3B,CAAC,CAAC,CAAC,KAAI,EAAE;EAEX,MAAMC,SAAS,GAAG,CAAC,CAACZ,KAAK,IAAIJ,YAAY;EAEzC,OACEZ,MAAA,CAAAM,OAAA,CAAAuB,aAAA,CAAA7B,MAAA,CAAAM,OAAA,CAAAwB,QAAA,QACGjB,IAAI,IACHb,MAAA,CAAAM,OAAA,CAAAuB,aAAA,CAAA7B,MAAA,CAAAM,OAAA,CAAAwB,QAAA,QACGF,SAAS,GACR5B,MAAA,CAAAM,OAAA,CAAAuB,aAAA;IAAKE,SAAS,EAAC;EAAmG,GAChH/B,MAAA,CAAAM,OAAA,CAAAuB,aAAA,CAAC9B,iBAAA,CAAAiC,UAAU,MAAE,CACV,CAAC,GAENhC,MAAA,CAAAM,OAAA,CAAAuB,aAAA,CAAC1B,KAAA,CAAA8B,IAAI;IAACtB,WAAW,EAAEW;EAAgB,CAAE,CAEvC,CAEJ,CAAC;AAEP,CAAC;AAACY,OAAA,CAAA3B,iBAAA,GAAAA,iBAAA","ignoreList":[]}
1
+ {"version":3,"file":"ValidationWrapper.js","names":["_client","require","_labsWidgetCommon","_react","_interopRequireDefault","_validateInstruments","_Main","e","__esModule","default","ValidationWrapper","_ref","division","instruments","isParamError","size","useLayoutProvider","data","error","useSuspenseQuery","validateInstruments","variables","fetchPolicy","errorPolicy","instrumentsData","mapInstrumentNames","map","instrument","name","displayName","showError","createElement","Fragment","className","ChartError","Main","exports"],"sources":["../../../src/SpreadCostCalculatorWidget/ValidationWrapper.tsx"],"sourcesContent":["import { useSuspenseQuery } from '@apollo/client';\nimport { ChartError, useLayoutProvider } from '@oanda/labs-widget-common';\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';\n\nconst ValidationWrapper = ({\n division,\n instruments,\n isParamError,\n}: ValidationWrapperProps) => {\n const { size } = useLayoutProvider();\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 instrumentsData =\n data?.mapInstrumentNames?.map((instrument) => ({\n name: instrument!.name,\n displayName: instrument!.displayName,\n })) || [];\n\n const showError = !!error || isParamError;\n\n return (\n <>\n {size && (\n <>\n {showError ? (\n <div className=\"lw-flex lw-h-[300px] lw-w-full lw-items-center lw-border lw-border-solid lw-border-border-primary\">\n <ChartError />\n </div>\n ) : (\n <Main instruments={instrumentsData} />\n )}\n </>\n )}\n </>\n );\n};\n\nexport { ValidationWrapper };\n"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,iBAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAC,sBAAA,CAAAH,OAAA;AAMA,IAAAI,oBAAA,GAAAJ,OAAA;AACA,IAAAK,KAAA,GAAAL,OAAA;AAA8B,SAAAG,uBAAAG,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAG9B,MAAMG,iBAAiB,GAAGC,IAAA,IAII;EAAA,IAJH;IACzBC,QAAQ;IACRC,WAAW;IACXC;EACsB,CAAC,GAAAH,IAAA;EACvB,MAAM;IAAEI;EAAK,CAAC,GAAG,IAAAC,mCAAiB,EAAC,CAAC;EACpC,MAAM;IAAEC,IAAI;IAAEC;EAAM,CAAC,GAAG,IAAAC,wBAAgB,EAGtCC,wCAAmB,EAAE;IACrBC,SAAS,EAAE;MACTR,WAAW;MACXD;IACF,CAAC;IACDU,WAAW,EAAE,cAAc;IAC3BC,WAAW,EAAE;EACf,CAAC,CAAC;EAEF,MAAMC,eAAe,GACnBP,IAAI,EAAEQ,kBAAkB,EAAEC,GAAG,CAAEC,UAAU,KAAM;IAC7CC,IAAI,EAAED,UAAU,CAAEC,IAAI;IACtBC,WAAW,EAAEF,UAAU,CAAEE;EAC3B,CAAC,CAAC,CAAC,IAAI,EAAE;EAEX,MAAMC,SAAS,GAAG,CAAC,CAACZ,KAAK,IAAIJ,YAAY;EAEzC,OACEX,MAAA,CAAAM,OAAA,CAAAsB,aAAA,CAAA5B,MAAA,CAAAM,OAAA,CAAAuB,QAAA,QACGjB,IAAI,IACHZ,MAAA,CAAAM,OAAA,CAAAsB,aAAA,CAAA5B,MAAA,CAAAM,OAAA,CAAAuB,QAAA,QACGF,SAAS,GACR3B,MAAA,CAAAM,OAAA,CAAAsB,aAAA;IAAKE,SAAS,EAAC;EAAmG,GAChH9B,MAAA,CAAAM,OAAA,CAAAsB,aAAA,CAAC7B,iBAAA,CAAAgC,UAAU,MAAE,CACV,CAAC,GAEN/B,MAAA,CAAAM,OAAA,CAAAsB,aAAA,CAACzB,KAAA,CAAA6B,IAAI;IAACtB,WAAW,EAAEW;EAAgB,CAAE,CAEvC,CAEJ,CAAC;AAEP,CAAC;AAACY,OAAA,CAAA1B,iBAAA,GAAAA,iBAAA","ignoreList":[]}
@@ -20,9 +20,9 @@ const useCalculateSpread = _ref => {
20
20
  const [debouncedValue, setValue] = (0, _usehooksTs.useDebounceValue)(_constant.CELL_EMPTY_VALUE, delay);
21
21
  (0, _react.useEffect)(() => {
22
22
  const calculatedSpread = calculateAbsoluteSpreadCost(unitsTraded, spread, pipLocation);
23
- setValue(calculatedSpread ? "".concat((0, _reactNumberFormat.numericFormatter)(calculatedSpread.toString(), {
23
+ setValue(calculatedSpread ? `${(0, _reactNumberFormat.numericFormatter)(calculatedSpread.toString(), {
24
24
  thousandSeparator: ','
25
- }), " ").concat(currency) : _constant.CELL_EMPTY_VALUE);
25
+ })} ${currency}` : _constant.CELL_EMPTY_VALUE);
26
26
  }, [spread, unitsTraded, pipLocation, setValue]);
27
27
  return debouncedValue;
28
28
  };
@@ -1 +1 @@
1
- {"version":3,"file":"useCalculateSpread.js","names":["_react","require","_reactNumberFormat","_usehooksTs","_constant","calculateAbsoluteSpreadCost","unitsTraded","spread","pipLocation","undefined","Math","ceil","Number","toFixed","abs","useCalculateSpread","_ref","delay","currency","debouncedValue","setValue","useDebounceValue","CELL_EMPTY_VALUE","useEffect","calculatedSpread","concat","numericFormatter","toString","thousandSeparator","exports"],"sources":["../../../src/SpreadCostCalculatorWidget/useCalculateSpread.ts"],"sourcesContent":["import type { Voidable } from '@oanda/labs-widget-common';\nimport { useEffect } from 'react';\nimport { numericFormatter } from 'react-number-format';\nimport { useDebounceValue } from 'usehooks-ts';\n\nimport { CELL_EMPTY_VALUE } from './constant';\n\nexport interface UseCalculateSpreadInput {\n spread: Voidable<number>;\n unitsTraded: Voidable<number>;\n pipLocation: Voidable<number>;\n delay?: number;\n currency: string;\n}\n\nconst calculateAbsoluteSpreadCost = (\n unitsTraded?: number,\n spread?: number,\n pipLocation?: number\n): number | undefined =>\n unitsTraded !== undefined && spread !== undefined && pipLocation !== undefined\n ? Math.ceil(\n ((unitsTraded *\n spread *\n Number((10 ** pipLocation).toFixed(Math.abs(pipLocation)))) /\n 2) *\n 10000\n ) / 10000\n : undefined;\n\nexport const useCalculateSpread = ({\n spread,\n unitsTraded,\n pipLocation,\n delay = 350,\n currency,\n}: UseCalculateSpreadInput) => {\n const [debouncedValue, setValue] = useDebounceValue(CELL_EMPTY_VALUE, delay);\n\n useEffect(() => {\n const calculatedSpread = calculateAbsoluteSpreadCost(\n unitsTraded,\n spread,\n pipLocation\n );\n setValue(\n calculatedSpread\n ? `${numericFormatter(calculatedSpread.toString(), {\n thousandSeparator: ',',\n })} ${currency}`\n : CELL_EMPTY_VALUE\n );\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [spread, unitsTraded, pipLocation, setValue]);\n\n return debouncedValue;\n};\n"],"mappings":";;;;;;AACA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,kBAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AAEA,IAAAG,SAAA,GAAAH,OAAA;AAUA,MAAMI,2BAA2B,GAAGA,CAClCC,WAAoB,EACpBC,MAAe,EACfC,WAAoB,KAEpBF,WAAW,KAAKG,SAAS,IAAIF,MAAM,KAAKE,SAAS,IAAID,WAAW,KAAKC,SAAS,GAC1EC,IAAI,CAACC,IAAI,CACLL,WAAW,GACXC,MAAM,GACNK,MAAM,CAAC,CAAC,EAAE,IAAIJ,WAAW,EAAEK,OAAO,CAACH,IAAI,CAACI,GAAG,CAACN,WAAW,CAAC,CAAC,CAAC,GAC1D,CAAC,GACD,KACJ,CAAC,GAAG,KAAK,GACTC,SAAS;AAER,MAAMM,kBAAkB,GAAGC,IAAA,IAMH;EAAA,IANI;IACjCT,MAAM;IACND,WAAW;IACXE,WAAW;IACXS,KAAK,GAAG,GAAG;IACXC;EACuB,CAAC,GAAAF,IAAA;EACxB,MAAM,CAACG,cAAc,EAAEC,QAAQ,CAAC,GAAG,IAAAC,4BAAgB,EAACC,0BAAgB,EAAEL,KAAK,CAAC;EAE5E,IAAAM,gBAAS,EAAC,MAAM;IACd,MAAMC,gBAAgB,GAAGnB,2BAA2B,CAClDC,WAAW,EACXC,MAAM,EACNC,WACF,CAAC;IACDY,QAAQ,CACNI,gBAAgB,MAAAC,MAAA,CACT,IAAAC,mCAAgB,EAACF,gBAAgB,CAACG,QAAQ,CAAC,CAAC,EAAE;MAC/CC,iBAAiB,EAAE;IACrB,CAAC,CAAC,OAAAH,MAAA,CAAIP,QAAQ,IACdI,0BACN,CAAC;EAEH,CAAC,EAAE,CAACf,MAAM,EAAED,WAAW,EAAEE,WAAW,EAAEY,QAAQ,CAAC,CAAC;EAEhD,OAAOD,cAAc;AACvB,CAAC;AAACU,OAAA,CAAAd,kBAAA,GAAAA,kBAAA","ignoreList":[]}
1
+ {"version":3,"file":"useCalculateSpread.js","names":["_react","require","_reactNumberFormat","_usehooksTs","_constant","calculateAbsoluteSpreadCost","unitsTraded","spread","pipLocation","undefined","Math","ceil","Number","toFixed","abs","useCalculateSpread","_ref","delay","currency","debouncedValue","setValue","useDebounceValue","CELL_EMPTY_VALUE","useEffect","calculatedSpread","numericFormatter","toString","thousandSeparator","exports"],"sources":["../../../src/SpreadCostCalculatorWidget/useCalculateSpread.ts"],"sourcesContent":["import type { Voidable } from '@oanda/labs-widget-common';\nimport { useEffect } from 'react';\nimport { numericFormatter } from 'react-number-format';\nimport { useDebounceValue } from 'usehooks-ts';\n\nimport { CELL_EMPTY_VALUE } from './constant';\n\nexport interface UseCalculateSpreadInput {\n spread: Voidable<number>;\n unitsTraded: Voidable<number>;\n pipLocation: Voidable<number>;\n delay?: number;\n currency: string;\n}\n\nconst calculateAbsoluteSpreadCost = (\n unitsTraded?: number,\n spread?: number,\n pipLocation?: number\n): number | undefined =>\n unitsTraded !== undefined && spread !== undefined && pipLocation !== undefined\n ? Math.ceil(\n ((unitsTraded *\n spread *\n Number((10 ** pipLocation).toFixed(Math.abs(pipLocation)))) /\n 2) *\n 10000\n ) / 10000\n : undefined;\n\nexport const useCalculateSpread = ({\n spread,\n unitsTraded,\n pipLocation,\n delay = 350,\n currency,\n}: UseCalculateSpreadInput) => {\n const [debouncedValue, setValue] = useDebounceValue(CELL_EMPTY_VALUE, delay);\n\n useEffect(() => {\n const calculatedSpread = calculateAbsoluteSpreadCost(\n unitsTraded,\n spread,\n pipLocation\n );\n setValue(\n calculatedSpread\n ? `${numericFormatter(calculatedSpread.toString(), {\n thousandSeparator: ',',\n })} ${currency}`\n : CELL_EMPTY_VALUE\n );\n // eslint-disable-next-line react-hooks/exhaustive-deps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BAAA,GAAAA,kBAAA","ignoreList":[]}
@@ -27,7 +27,7 @@ const useInstrumentChange = _ref => {
27
27
  connectionError
28
28
  } = (0, _labsWidgetCommon.useLiveRatesMessage)(selectedInstrument.id, target);
29
29
  (0, _react.useEffect)(() => {
30
- if (selectedInstrument.id === (update === null || update === void 0 ? void 0 : update.symbol)) {
30
+ if (selectedInstrument.id === update?.symbol) {
31
31
  setPipLocation(update.pipLocation);
32
32
  setSpread(update.spread);
33
33
  setLoading(false);
@@ -1 +1 @@
1
- {"version":3,"file":"useInstrumentChange.js","names":["_labsWidgetCommon","require","_react","_utils","useInstrumentChange","_ref","initialInstrument","target","setQuery","closeQuery","useLiveRatesQuery","loading","setLoading","useState","selectedInstrument","setSelectedInstrument","pipLocation","setPipLocation","undefined","initialSpread","setSpread","currency","setCurrency","update","error","connectionError","useLiveRatesMessage","id","useEffect","symbol","spread","instruments","getInstrumentCurrency","label","exports"],"sources":["../../../src/SpreadCostCalculatorWidget/useInstrumentChange.ts"],"sourcesContent":["import type { SelectOption } from '@oanda/labs-widget-common';\nimport {\n useLiveRatesMessage,\n useLiveRatesQuery,\n} from '@oanda/labs-widget-common';\nimport { useEffect, useState } from 'react';\n\nimport { getInstrumentCurrency } from './utils';\n\nexport interface UseInstrumentChangeInput {\n initialInstrument: SelectOption;\n}\n\nexport const useInstrumentChange = ({\n initialInstrument,\n}: UseInstrumentChangeInput) => {\n const { target, setQuery, closeQuery } = useLiveRatesQuery();\n const [loading, setLoading] = useState(true);\n const [selectedInstrument, setSelectedInstrument] =\n useState(initialInstrument);\n const [pipLocation, setPipLocation] = useState<undefined | number>(undefined);\n const [initialSpread, setSpread] = useState<undefined | number>(undefined);\n const [currency, setCurrency] = useState('');\n\n const { update, error, connectionError } = useLiveRatesMessage(\n selectedInstrument.id,\n target\n );\n\n useEffect(() => {\n if (selectedInstrument.id === update?.symbol) {\n setPipLocation(update.pipLocation);\n setSpread(update.spread);\n setLoading(false);\n closeQuery();\n }\n\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [update]);\n\n useEffect(() => {\n setLoading(true);\n setQuery({ instruments: [selectedInstrument.id] });\n setCurrency(getInstrumentCurrency(selectedInstrument.label));\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [selectedInstrument.id]);\n\n return {\n selectedInstrument,\n setSelectedInstrument,\n pipLocation,\n initialSpread,\n loading,\n error: !!error || !!connectionError,\n currency,\n };\n};\n"],"mappings":";;;;;;AACA,IAAAA,iBAAA,GAAAC,OAAA;AAIA,IAAAC,MAAA,GAAAD,OAAA;AAEA,IAAAE,MAAA,GAAAF,OAAA;AAMO,MAAMG,mBAAmB,GAAGC,IAAA,IAEH;EAAA,IAFI;IAClCC;EACwB,CAAC,GAAAD,IAAA;EACzB,MAAM;IAAEE,MAAM;IAAEC,QAAQ;IAAEC;EAAW,CAAC,GAAG,IAAAC,mCAAiB,EAAC,CAAC;EAC5D,MAAM,CAACC,OAAO,EAAEC,UAAU,CAAC,GAAG,IAAAC,eAAQ,EAAC,IAAI,CAAC;EAC5C,MAAM,CAACC,kBAAkB,EAAEC,qBAAqB,CAAC,GAC/C,IAAAF,eAAQ,EAACP,iBAAiB,CAAC;EAC7B,MAAM,CAACU,WAAW,EAAEC,cAAc,CAAC,GAAG,IAAAJ,eAAQ,EAAqBK,SAAS,CAAC;EAC7E,MAAM,CAACC,aAAa,EAAEC,SAAS,CAAC,GAAG,IAAAP,eAAQ,EAAqBK,SAAS,CAAC;EAC1E,MAAM,CAACG,QAAQ,EAAEC,WAAW,CAAC,GAAG,IAAAT,eAAQ,EAAC,EAAE,CAAC;EAE5C,MAAM;IAAEU,MAAM;IAAEC,KAAK;IAAEC;EAAgB,CAAC,GAAG,IAAAC,qCAAmB,EAC5DZ,kBAAkB,CAACa,EAAE,EACrBpB,MACF,CAAC;EAED,IAAAqB,gBAAS,EAAC,MAAM;IACd,IAAId,kBAAkB,CAACa,EAAE,MAAKJ,MAAM,aAANA,MAAM,uBAANA,MAAM,CAAEM,MAAM,GAAE;MAC5CZ,cAAc,CAACM,MAAM,CAACP,WAAW,CAAC;MAClCI,SAAS,CAACG,MAAM,CAACO,MAAM,CAAC;MACxBlB,UAAU,CAAC,KAAK,CAAC;MACjBH,UAAU,CAAC,CAAC;IACd;EAGF,CAAC,EAAE,CAACc,MAAM,CAAC,CAAC;EAEZ,IAAAK,gBAAS,EAAC,MAAM;IACdhB,UAAU,CAAC,IAAI,CAAC;IAChBJ,QAAQ,CAAC;MAAEuB,WAAW,EAAE,CAACjB,kBAAkB,CAACa,EAAE;IAAE,CAAC,CAAC;IAClDL,WAAW,CAAC,IAAAU,4BAAqB,EAAClB,kBAAkB,CAACmB,KAAK,CAAC,CAAC;EAE9D,CAAC,EAAE,CAACnB,kBAAkB,CAACa,EAAE,CAAC,CAAC;EAE3B,OAAO;IACLb,kBAAkB;IAClBC,qBAAqB;IACrBC,WAAW;IACXG,aAAa;IACbR,OAAO;IACPa,KAAK,EAAE,CAAC,CAACA,KAAK,IAAI,CAAC,CAACC,eAAe;IACnCJ;EACF,CAAC;AACH,CAAC;AAACa,OAAA,CAAA9B,mBAAA,GAAAA,mBAAA","ignoreList":[]}
1
+ {"version":3,"file":"useInstrumentChange.js","names":["_labsWidgetCommon","require","_react","_utils","useInstrumentChange","_ref","initialInstrument","target","setQuery","closeQuery","useLiveRatesQuery","loading","setLoading","useState","selectedInstrument","setSelectedInstrument","pipLocation","setPipLocation","undefined","initialSpread","setSpread","currency","setCurrency","update","error","connectionError","useLiveRatesMessage","id","useEffect","symbol","spread","instruments","getInstrumentCurrency","label","exports"],"sources":["../../../src/SpreadCostCalculatorWidget/useInstrumentChange.ts"],"sourcesContent":["import type { SelectOption } from '@oanda/labs-widget-common';\nimport {\n useLiveRatesMessage,\n useLiveRatesQuery,\n} from '@oanda/labs-widget-common';\nimport { useEffect, useState } from 'react';\n\nimport { getInstrumentCurrency } from './utils';\n\nexport interface UseInstrumentChangeInput {\n initialInstrument: SelectOption;\n}\n\nexport const useInstrumentChange = ({\n initialInstrument,\n}: UseInstrumentChangeInput) => {\n const { target, setQuery, closeQuery } = useLiveRatesQuery();\n const [loading, setLoading] = useState(true);\n const [selectedInstrument, setSelectedInstrument] =\n useState(initialInstrument);\n const [pipLocation, setPipLocation] = useState<undefined | number>(undefined);\n const [initialSpread, setSpread] = useState<undefined | number>(undefined);\n const [currency, setCurrency] = useState('');\n\n const { update, error, connectionError } = useLiveRatesMessage(\n selectedInstrument.id,\n target\n );\n\n useEffect(() => {\n if (selectedInstrument.id === update?.symbol) {\n setPipLocation(update.pipLocation);\n setSpread(update.spread);\n setLoading(false);\n closeQuery();\n }\n\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [update]);\n\n useEffect(() => {\n setLoading(true);\n setQuery({ instruments: [selectedInstrument.id] });\n setCurrency(getInstrumentCurrency(selectedInstrument.label));\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [selectedInstrument.id]);\n\n return {\n selectedInstrument,\n setSelectedInstrument,\n pipLocation,\n initialSpread,\n loading,\n error: !!error || !!connectionError,\n currency,\n };\n};\n"],"mappings":";;;;;;AACA,IAAAA,iBAAA,GAAAC,OAAA;AAIA,IAAAC,MAAA,GAAAD,OAAA;AAEA,IAAAE,MAAA,GAAAF,OAAA;AAMO,MAAMG,mBAAmB,GAAGC,IAAA,IAEH;EAAA,IAFI;IAClCC;EACwB,CAAC,GAAAD,IAAA;EACzB,MAAM;IAAEE,MAAM;IAAEC,QAAQ;IAAEC;EAAW,CAAC,GAAG,IAAAC,mCAAiB,EAAC,CAAC;EAC5D,MAAM,CAACC,OAAO,EAAEC,UAAU,CAAC,GAAG,IAAAC,eAAQ,EAAC,IAAI,CAAC;EAC5C,MAAM,CAACC,kBAAkB,EAAEC,qBAAqB,CAAC,GAC/C,IAAAF,eAAQ,EAACP,iBAAiB,CAAC;EAC7B,MAAM,CAACU,WAAW,EAAEC,cAAc,CAAC,GAAG,IAAAJ,eAAQ,EAAqBK,SAAS,CAAC;EAC7E,MAAM,CAACC,aAAa,EAAEC,SAAS,CAAC,GAAG,IAAAP,eAAQ,EAAqBK,SAAS,CAAC;EAC1E,MAAM,CAACG,QAAQ,EAAEC,WAAW,CAAC,GAAG,IAAAT,eAAQ,EAAC,EAAE,CAAC;EAE5C,MAAM;IAAEU,MAAM;IAAEC,KAAK;IAAEC;EAAgB,CAAC,GAAG,IAAAC,qCAAmB,EAC5DZ,kBAAkB,CAACa,EAAE,EACrBpB,MACF,CAAC;EAED,IAAAqB,gBAAS,EAAC,MAAM;IACd,IAAId,kBAAkB,CAACa,EAAE,KAAKJ,MAAM,EAAEM,MAAM,EAAE;MAC5CZ,cAAc,CAACM,MAAM,CAACP,WAAW,CAAC;MAClCI,SAAS,CAACG,MAAM,CAACO,MAAM,CAAC;MACxBlB,UAAU,CAAC,KAAK,CAAC;MACjBH,UAAU,CAAC,CAAC;IACd;EAGF,CAAC,EAAE,CAACc,MAAM,CAAC,CAAC;EAEZ,IAAAK,gBAAS,EAAC,MAAM;IACdhB,UAAU,CAAC,IAAI,CAAC;IAChBJ,QAAQ,CAAC;MAAEuB,WAAW,EAAE,CAACjB,kBAAkB,CAACa,EAAE;IAAE,CAAC,CAAC;IAClDL,WAAW,CAAC,IAAAU,4BAAqB,EAAClB,kBAAkB,CAACmB,KAAK,CAAC,CAAC;EAE9D,CAAC,EAAE,CAACnB,kBAAkB,CAACa,EAAE,CAAC,CAAC;EAE3B,OAAO;IACLb,kBAAkB;IAClBC,qBAAqB;IACrBC,WAAW;IACXG,aAAa;IACbR,OAAO;IACPa,KAAK,EAAE,CAAC,CAACA,KAAK,IAAI,CAAC,CAACC,eAAe;IACnCJ;EACF,CAAC;AACH,CAAC;AAACa,OAAA,CAAA9B,mBAAA,GAAAA,mBAAA","ignoreList":[]}
@@ -13,11 +13,10 @@ function makeFragmentData(data, _fragment) {
13
13
  return data;
14
14
  }
15
15
  function isFragmentReady(queryNode, fragmentNode, data) {
16
- var _meta__, _fragDef$name;
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 === null || fragDef === void 0 || (_fragDef$name = fragDef.name) === null || _fragDef$name === void 0 ? void 0 : _fragDef$name.value;
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","_meta__","_fragDef$name","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;EAAA,IAAAK,OAAA,EAAAC,aAAA;EAC3C,MAAMC,cAAc,IAAAF,OAAA,GAClBF,SAAS,CAGTK,QAAQ,cAAAH,OAAA,uBAJaA,OAAA,CAIXE,cAAc;EAE1B,IAAI,CAACA,cAAc,EAAE,OAAO,IAAI;EAEhC,MAAME,OAAO,GAAGL,YAAY,CAACM,WAAW,CAAC,CAAC,CAE7B;EACb,MAAMC,QAAQ,GAAGF,OAAO,aAAPA,OAAO,gBAAAH,aAAA,GAAPG,OAAO,CAAEG,IAAI,cAAAN,aAAA,uBAAbA,aAAA,CAAeO,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,IAAKjB,IAAI,IAAIiB,KAAK,IAAIjB,IAAI,CAAC;AAC5E","ignoreList":[]}
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 mapInstrumentNames(instruments: $instruments, division: $division) {\n name\n displayName\n }\n }\n': types.ValidateInstrumentsDocument
11
11
  };
12
12
  function graphql(source) {
13
- var _source;
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","_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 mapInstrumentNames(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 mapInstrumentNames(instruments: $instruments, division: $division) {\\n name\\n displayName\\n }\\n }\\n'\n): (typeof documents)['\\n query validateInstruments($instruments: [String]!, $division: Division) {\\n mapInstrumentNames(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,GAAAC,uBAAA,CAAAC,OAAA;AAAmC,SAAAD,wBAAAE,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAJ,uBAAA,YAAAA,CAAAE,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,CAAAK,GAAA,IAAAL,CAAA,CAAAM,GAAA,IAAAP,CAAA,CAAAE,CAAA,EAAAP,CAAA,EAAAM,CAAA,IAAAC,CAAA,CAAAP,CAAA,IAAAD,CAAA,CAAAC,CAAA,WAAAO,CAAA,KAAAR,CAAA,EAAAC,CAAA;AAanC,MAAMkB,SAAS,GAAG;EAChB,sMAAsM,EACpMtB,KAAK,CAACuB;AACV,CAAC;AAuBM,SAASC,OAAOA,CAACC,MAAc,EAAE;EAAA,IAAAC,OAAA;EACtC,QAAAA,OAAA,GAAQJ,SAAS,CAASG,MAAM,CAAC,cAAAC,OAAA,cAAAA,OAAA,GAAI,CAAC,CAAC;AACzC","ignoreList":[]}
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 mapInstrumentNames(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 mapInstrumentNames(instruments: $instruments, division: $division) {\\n name\\n displayName\\n }\\n }\\n'\n): (typeof documents)['\\n query validateInstruments($instruments: [String]!, $division: Division) {\\n mapInstrumentNames(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,GAAAC,uBAAA,CAAAC,OAAA;AAAmC,SAAAD,wBAAAE,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAJ,uBAAA,YAAAA,CAAAE,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,CAAAK,GAAA,IAAAL,CAAA,CAAAM,GAAA,IAAAP,CAAA,CAAAE,CAAA,EAAAP,CAAA,EAAAM,CAAA,IAAAC,CAAA,CAAAP,CAAA,IAAAD,CAAA,CAAAC,CAAA,WAAAO,CAAA,KAAAR,CAAA,EAAAC,CAAA;AAanC,MAAMkB,SAAS,GAAG;EAChB,sMAAsM,EACpMtB,KAAK,CAACuB;AACV,CAAC;AAuBM,SAASC,OAAOA,CAACC,MAAc,EAAE;EACtC,OAAQH,SAAS,CAASG,MAAM,CAAC,IAAI,CAAC,CAAC;AACzC","ignoreList":[]}
@@ -5,7 +5,12 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.validateInstruments = void 0;
7
7
  var _client = require("@apollo/client");
8
- var _templateObject;
9
- function _taggedTemplateLiteral(e, t) { return t || (t = e.slice(0)), Object.freeze(Object.defineProperties(e, { raw: { value: Object.freeze(t) } })); }
10
- const validateInstruments = exports.validateInstruments = (0, _client.gql)(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n query validateInstruments($instruments: [String]!, $division: Division) {\n mapInstrumentNames(instruments: $instruments, division: $division) {\n name\n displayName\n }\n }\n"])));
8
+ const validateInstruments = exports.validateInstruments = (0, _client.gql)`
9
+ query validateInstruments($instruments: [String]!, $division: Division) {
10
+ mapInstrumentNames(instruments: $instruments, division: $division) {
11
+ name
12
+ displayName
13
+ }
14
+ }
15
+ `;
11
16
  //# sourceMappingURL=validateInstruments.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"validateInstruments.js","names":["_client","require","_templateObject","_taggedTemplateLiteral","e","t","slice","Object","freeze","defineProperties","raw","value","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 mapInstrumentNames(instruments: $instruments, division: $division) {\n name\n displayName\n }\n }\n`;\n"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AAAqC,IAAAC,eAAA;AAAA,SAAAC,uBAAAC,CAAA,EAAAC,CAAA,WAAAA,CAAA,KAAAA,CAAA,GAAAD,CAAA,CAAAE,KAAA,MAAAC,MAAA,CAAAC,MAAA,CAAAD,MAAA,CAAAE,gBAAA,CAAAL,CAAA,IAAAM,GAAA,IAAAC,KAAA,EAAAJ,MAAA,CAAAC,MAAA,CAAAH,CAAA;AAE9B,MAAMO,mBAAmB,GAAAC,OAAA,CAAAD,mBAAA,OAAGE,WAAG,EAAAZ,eAAA,KAAAA,eAAA,GAAAC,sBAAA,4MAOrC","ignoreList":[]}
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 mapInstrumentNames(instruments: $instruments, division: $division) {\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,CAAC","ignoreList":[]}
@@ -46,8 +46,8 @@ const Main = _ref => {
46
46
  useEffect(() => {
47
47
  onSpreadChange({
48
48
  floatValue: initialSpread,
49
- formattedValue: (initialSpread === null || initialSpread === void 0 ? void 0 : initialSpread.toString()) || '',
50
- value: (initialSpread === null || initialSpread === void 0 ? void 0 : initialSpread.toString()) || ''
49
+ formattedValue: initialSpread?.toString() || '',
50
+ value: initialSpread?.toString() || ''
51
51
  });
52
52
  }, [initialSpread]);
53
53
  const {
@@ -1 +1 @@
1
- {"version":3,"file":"Main.js","names":["ChartError","cn","Label","NumberInput","Select","Size","useLayoutProvider","useNumberFormat","useLocale","React","useEffect","useCalculateSpread","useInstrumentChange","Main","_ref","instruments","size","isDesktop","DESKTOP","selectOptions","map","instrument","id","name","label","displayName","value","unitsTraded","handleValueChange","onUnitChange","increment","incrementTradedUnits","decrement","decrementTradedUnits","spread","onSpreadChange","incrementSpread","decrementSpread","step","selectedInstrument","setSelectedInstrument","pipLocation","initialSpread","loading","error","currency","initialInstrument","floatValue","formattedValue","toString","lang","spreadCost","createElement","Fragment","className","htmlFor","maxHeight","options","searchPlaceholder","selectedOption","setSelectedOption","withoutArrows","disabled","placeholder","onDecrement","onIncrement","onValueChange"],"sources":["../../../src/SpreadCostCalculatorWidget/Main.tsx"],"sourcesContent":["import {\n ChartError,\n cn,\n Label,\n NumberInput,\n Select,\n Size,\n useLayoutProvider,\n useNumberFormat,\n} from '@oanda/labs-widget-common';\nimport { useLocale } from '@oanda/mono-i18n';\nimport type { FC } from 'react';\nimport React, { useEffect } from 'react';\n\nimport type { MainProps } from './types';\nimport { useCalculateSpread } from './useCalculateSpread';\nimport { useInstrumentChange } from './useInstrumentChange';\n\nconst Main: FC<MainProps> = ({ instruments }) => {\n const { size } = useLayoutProvider();\n const isDesktop = size === Size.DESKTOP;\n\n const selectOptions = instruments.map((instrument) => ({\n id: instrument.name,\n label: instrument.displayName,\n }));\n\n const {\n value: unitsTraded,\n handleValueChange: onUnitChange,\n increment: incrementTradedUnits,\n decrement: decrementTradedUnits,\n } = useNumberFormat({});\n\n const {\n value: spread,\n handleValueChange: onSpreadChange,\n increment: incrementSpread,\n decrement: decrementSpread,\n } = useNumberFormat({\n step: 0.1,\n });\n\n const {\n selectedInstrument,\n setSelectedInstrument,\n pipLocation,\n initialSpread,\n loading,\n error,\n currency,\n } = useInstrumentChange({\n initialInstrument: {\n id: instruments[0].name,\n label: instruments[0].displayName,\n },\n });\n\n useEffect(() => {\n onSpreadChange({\n floatValue: initialSpread,\n formattedValue: initialSpread?.toString() || '',\n value: initialSpread?.toString() || '',\n });\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [initialSpread]);\n\n const { lang } = useLocale();\n\n const spreadCost = useCalculateSpread({\n spread,\n unitsTraded,\n pipLocation,\n currency,\n });\n\n return (\n <>\n {error ? (\n <div className=\"lw-flex lw-h-[300px] lw-w-full lw-items-center lw-border lw-border-solid lw-border-border-primary\">\n <ChartError />\n </div>\n ) : (\n <div\n className=\"lw-mx-auto lw-flex lw-w-full lw-max-w-full lw-flex-col lw-content-center lw-justify-center lw-gap-8 lw-p-4\"\n data-testid=\"spread-cost-calculator\"\n >\n <div className=\"lw-flex lw-flex-col lw-gap-2\">\n <Label\n className=\"lw-text-text-primary\"\n htmlFor={lang('instrument')}\n >\n {lang('instrument')}\n </Label>\n <Select\n className=\"lw-grow-0\"\n maxHeight={isDesktop ? 190 : 220}\n options={selectOptions}\n searchPlaceholder={lang('search')}\n selectedOption={selectedInstrument}\n setSelectedOption={setSelectedInstrument}\n />\n </div>\n <div className=\"lw-flex lw-max-w-full lw-flex-col lw-content-center lw-justify-center lw-gap-3\">\n <div\n className={cn(\n 'lw-flex lw-max-w-full lw-flex-row lw-gap-3',\n !isDesktop && 'lw-flex-col lw-gap-8'\n )}\n >\n <NumberInput\n withoutArrows\n disabled={loading}\n label={lang('units_traded')}\n placeholder={lang('volume')}\n value={unitsTraded}\n onDecrement={decrementTradedUnits}\n onIncrement={incrementTradedUnits}\n onValueChange={onUnitChange}\n />\n <NumberInput\n disabled={loading}\n label={lang('spread')}\n placeholder={lang('pips')}\n value={spread}\n onDecrement={decrementSpread}\n onIncrement={incrementSpread}\n onValueChange={onSpreadChange}\n />\n </div>\n <div className=\"lw-pt-4 lw-text-text-primary\">\n <div>{lang('absolute_spread_cost')}</div>\n <div className=\"lw-pt-2 lw-text-3xl lw-font-bold\">\n {spreadCost}\n </div>\n </div>\n </div>\n </div>\n )}\n </>\n );\n};\n\nexport { Main };\n"],"mappings":"AAAA,SACEA,UAAU,EACVC,EAAE,EACFC,KAAK,EACLC,WAAW,EACXC,MAAM,EACNC,IAAI,EACJC,iBAAiB,EACjBC,eAAe,QACV,2BAA2B;AAClC,SAASC,SAAS,QAAQ,kBAAkB;AAE5C,OAAOC,KAAK,IAAIC,SAAS,QAAQ,OAAO;AAGxC,SAASC,kBAAkB,QAAQ,sBAAsB;AACzD,SAASC,mBAAmB,QAAQ,uBAAuB;AAE3D,MAAMC,IAAmB,GAAGC,IAAA,IAAqB;EAAA,IAApB;IAAEC;EAAY,CAAC,GAAAD,IAAA;EAC1C,MAAM;IAAEE;EAAK,CAAC,GAAGV,iBAAiB,CAAC,CAAC;EACpC,MAAMW,SAAS,GAAGD,IAAI,KAAKX,IAAI,CAACa,OAAO;EAEvC,MAAMC,aAAa,GAAGJ,WAAW,CAACK,GAAG,CAAEC,UAAU,KAAM;IACrDC,EAAE,EAAED,UAAU,CAACE,IAAI;IACnBC,KAAK,EAAEH,UAAU,CAACI;EACpB,CAAC,CAAC,CAAC;EAEH,MAAM;IACJC,KAAK,EAAEC,WAAW;IAClBC,iBAAiB,EAAEC,YAAY;IAC/BC,SAAS,EAAEC,oBAAoB;IAC/BC,SAAS,EAAEC;EACb,CAAC,GAAG1B,eAAe,CAAC,CAAC,CAAC,CAAC;EAEvB,MAAM;IACJmB,KAAK,EAAEQ,MAAM;IACbN,iBAAiB,EAAEO,cAAc;IACjCL,SAAS,EAAEM,eAAe;IAC1BJ,SAAS,EAAEK;EACb,CAAC,GAAG9B,eAAe,CAAC;IAClB+B,IAAI,EAAE;EACR,CAAC,CAAC;EAEF,MAAM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GAC9CH,UACE,CACF,CACF,CACF,CAEP,CAAC;AAEP,CAAC;AAED,SAAStC,IAAI","ignoreList":[]}
1
+ {"version":3,"file":"Main.js","names":["ChartError","cn","Label","NumberInput","Select","Size","useLayoutProvider","useNumberFormat","useLocale","React","useEffect","useCalculateSpread","useInstrumentChange","Main","_ref","instruments","size","isDesktop","DESKTOP","selectOptions","map","instrument","id","name","label","displayName","value","unitsTraded","handleValueChange","onUnitChange","increment","incrementTradedUnits","decrement","decrementTradedUnits","spread","onSpreadChange","incrementSpread","decrementSpread","step","selectedInstrument","setSelectedInstrument","pipLocation","initialSpread","loading","error","currency","initialInstrument","floatValue","formattedValue","toString","lang","spreadCost","createElement","Fragment","className","htmlFor","maxHeight","options","searchPlaceholder","selectedOption","setSelectedOption","withoutArrows","disabled","placeholder","onDecrement","onIncrement","onValueChange"],"sources":["../../../src/SpreadCostCalculatorWidget/Main.tsx"],"sourcesContent":["import {\n ChartError,\n cn,\n Label,\n NumberInput,\n Select,\n Size,\n useLayoutProvider,\n useNumberFormat,\n} from '@oanda/labs-widget-common';\nimport { useLocale } from '@oanda/mono-i18n';\nimport type { FC } from 'react';\nimport React, { useEffect } from 'react';\n\nimport type { MainProps } from './types';\nimport { useCalculateSpread } from './useCalculateSpread';\nimport { useInstrumentChange } from './useInstrumentChange';\n\nconst Main: FC<MainProps> = ({ instruments }) => {\n const { size } = useLayoutProvider();\n const isDesktop = size === Size.DESKTOP;\n\n const selectOptions = instruments.map((instrument) => ({\n id: instrument.name,\n label: instrument.displayName,\n }));\n\n const {\n value: unitsTraded,\n handleValueChange: onUnitChange,\n increment: incrementTradedUnits,\n decrement: decrementTradedUnits,\n } = useNumberFormat({});\n\n const {\n value: spread,\n handleValueChange: onSpreadChange,\n increment: incrementSpread,\n decrement: decrementSpread,\n } = useNumberFormat({\n step: 0.1,\n });\n\n const {\n selectedInstrument,\n setSelectedInstrument,\n pipLocation,\n initialSpread,\n loading,\n error,\n currency,\n } = useInstrumentChange({\n initialInstrument: {\n id: instruments[0].name,\n label: instruments[0].displayName,\n },\n });\n\n useEffect(() => {\n onSpreadChange({\n floatValue: initialSpread,\n formattedValue: initialSpread?.toString() || '',\n value: initialSpread?.toString() || '',\n });\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [initialSpread]);\n\n const { lang } = useLocale();\n\n const spreadCost = useCalculateSpread({\n spread,\n unitsTraded,\n pipLocation,\n currency,\n });\n\n return (\n <>\n {error ? (\n <div className=\"lw-flex lw-h-[300px] lw-w-full lw-items-center lw-border lw-border-solid lw-border-border-primary\">\n <ChartError />\n </div>\n ) : (\n <div\n className=\"lw-mx-auto lw-flex lw-w-full lw-max-w-full lw-flex-col lw-content-center lw-justify-center lw-gap-8 lw-p-4\"\n data-testid=\"spread-cost-calculator\"\n >\n <div className=\"lw-flex lw-flex-col lw-gap-2\">\n <Label\n className=\"lw-text-text-primary\"\n htmlFor={lang('instrument')}\n >\n {lang('instrument')}\n </Label>\n <Select\n className=\"lw-grow-0\"\n maxHeight={isDesktop ? 190 : 220}\n options={selectOptions}\n searchPlaceholder={lang('search')}\n selectedOption={selectedInstrument}\n setSelectedOption={setSelectedInstrument}\n />\n </div>\n <div className=\"lw-flex lw-max-w-full lw-flex-col lw-content-center lw-justify-center lw-gap-3\">\n <div\n className={cn(\n 'lw-flex lw-max-w-full lw-flex-row lw-gap-3',\n !isDesktop && 'lw-flex-col lw-gap-8'\n )}\n >\n <NumberInput\n withoutArrows\n disabled={loading}\n label={lang('units_traded')}\n placeholder={lang('volume')}\n value={unitsTraded}\n onDecrement={decrementTradedUnits}\n onIncrement={incrementTradedUnits}\n onValueChange={onUnitChange}\n />\n <NumberInput\n disabled={loading}\n label={lang('spread')}\n placeholder={lang('pips')}\n value={spread}\n onDecrement={decrementSpread}\n onIncrement={incrementSpread}\n onValueChange={onSpreadChange}\n />\n </div>\n <div className=\"lw-pt-4 lw-text-text-primary\">\n <div>{lang('absolute_spread_cost')}</div>\n <div className=\"lw-pt-2 lw-text-3xl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,EAAEpB,kBAAmB;IACnCqB,iBAAiB,EAAEpB;EAAsB,CAC1C,CACE,CAAC,EACN/B,KAAA,CAAA2C,aAAA;IAAKE,SAAS,EAAC;EAAgF,GAC7F7C,KAAA,CAAA2C,aAAA;IACEE,SAAS,EAAErD,EAAE,CACX,4CAA4C,EAC5C,CAACgB,SAAS,IAAI,sBAChB;EAAE,GAEFR,KAAA,CAAA2C,aAAA,CAACjD,WAAW;IACV0D,aAAa;IACbC,QAAQ,EAAEnB,OAAQ;IAClBnB,KAAK,EAAE0B,IAAI,CAAC,cAAc,CAAE;IAC5Ba,WAAW,EAAEb,IAAI,CAAC,QAAQ,CAAE;IAC5BxB,KAAK,EAAEC,WAAY;IACnBqC,WAAW,EAAE/B,oBAAqB;IAClCgC,WAAW,EAAElC,oBAAqB;IAClCmC,aAAa,EAAErC;EAAa,CAC7B,CAAC,EACFpB,KAAA,CAAA2C,aAAA,CAACjD,WAAW;IACV2D,QAAQ,EAAEnB,OAAQ;IAClBnB,KAAK,EAAE0B,IAAI,CAAC,QAAQ,CAAE;IACtBa,WAAW,EAAEb,IAAI,CAAC,MAAM,CAAE;IAC1BxB,KAAK,EAAEQ,MAAO;IACd8B,WAAW,EAAE3B,eAAgB;IAC7B4B,WAAW,EAAE7B,eAAgB;IAC7B8B,aAAa,EAAE/B;EAAe,CAC/B,CACE,CAAC,EACN1B,KAAA,CAAA2C,aAAA;IAAKE,SAAS,EAAC;EAA8B,GAC3C7C,KAAA,CAAA2C,aAAA,cAAMF,IAAI,CAAC,sBAAsB,CAAO,CAAC,EACzCzC,KAAA,CAAA2C,aAAA;IAAKE,SAAS,EAAC;EAAkC,GAC9CH,UACE,CACF,CACF,CACF,CAEP,CAAC;AAEP,CAAC;AAED,SAAStC,IAAI","ignoreList":[]}
@@ -4,7 +4,6 @@ import React from 'react';
4
4
  import { validateInstruments } from '../gql/validateInstruments';
5
5
  import { Main } from './Main';
6
6
  const ValidationWrapper = _ref => {
7
- var _data$mapInstrumentNa;
8
7
  let {
9
8
  division,
10
9
  instruments,
@@ -24,10 +23,10 @@ const ValidationWrapper = _ref => {
24
23
  fetchPolicy: 'network-only',
25
24
  errorPolicy: 'all'
26
25
  });
27
- const instrumentsData = (data === null || data === void 0 || (_data$mapInstrumentNa = data.mapInstrumentNames) === null || _data$mapInstrumentNa === void 0 ? void 0 : _data$mapInstrumentNa.map(instrument => ({
26
+ const instrumentsData = data?.mapInstrumentNames?.map(instrument => ({
28
27
  name: instrument.name,
29
28
  displayName: instrument.displayName
30
- }))) || [];
29
+ })) || [];
31
30
  const showError = !!error || isParamError;
32
31
  return React.createElement(React.Fragment, null, size && React.createElement(React.Fragment, null, showError ? React.createElement("div", {
33
32
  className: "lw-flex lw-h-[300px] lw-w-full lw-items-center lw-border lw-border-solid lw-border-border-primary"
@@ -1 +1 @@
1
- {"version":3,"file":"ValidationWrapper.js","names":["useSuspenseQuery","ChartError","useLayoutProvider","React","validateInstruments","Main","ValidationWrapper","_ref","_data$mapInstrumentNa","division","instruments","isParamError","size","data","error","variables","fetchPolicy","errorPolicy","instrumentsData","mapInstrumentNames","map","instrument","name","displayName","showError","createElement","Fragment","className"],"sources":["../../../src/SpreadCostCalculatorWidget/ValidationWrapper.tsx"],"sourcesContent":["import { useSuspenseQuery } from '@apollo/client';\nimport { ChartError, useLayoutProvider } from '@oanda/labs-widget-common';\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';\n\nconst ValidationWrapper = ({\n division,\n instruments,\n isParamError,\n}: ValidationWrapperProps) => {\n const { size } = useLayoutProvider();\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 instrumentsData =\n data?.mapInstrumentNames?.map((instrument) => ({\n name: instrument!.name,\n displayName: instrument!.displayName,\n })) || [];\n\n const showError = !!error || isParamError;\n\n return (\n <>\n {size && (\n <>\n {showError ? (\n <div className=\"lw-flex lw-h-[300px] lw-w-full lw-items-center lw-border lw-border-solid lw-border-border-primary\">\n <ChartError />\n </div>\n ) : (\n <Main instruments={instrumentsData} />\n )}\n </>\n )}\n </>\n );\n};\n\nexport { ValidationWrapper };\n"],"mappings":"AAAA,SAASA,gBAAgB,QAAQ,gBAAgB;AACjD,SAASC,UAAU,EAAEC,iBAAiB,QAAQ,2BAA2B;AACzE,OAAOC,KAAK,MAAM,OAAO;AAMzB,SAASC,mBAAmB,QAAQ,4BAA4B;AAChE,SAASC,IAAI,QAAQ,QAAQ;AAG7B,MAAMC,iBAAiB,GAAGC,IAAA,IAII;EAAA,IAAAC,qBAAA;EAAA,IAJH;IACzBC,QAAQ;IACRC,WAAW;IACXC;EACsB,CAAC,GAAAJ,IAAA;EACvB,MAAM;IAAEK;EAAK,CAAC,GAAGV,iBAAiB,CAAC,CAAC;EACpC,MAAM;IAAEW,IAAI;IAAEC;EAAM,CAAC,GAAGd,gBAAgB,CAGtCI,mBAAmB,EAAE;IACrBW,SAAS,EAAE;MACTL,WAAW;MACXD;IACF,CAAC;IACDO,WAAW,EAAE,cAAc;IAC3BC,WAAW,EAAE;EACf,CAAC,CAAC;EAEF,MAAMC,eAAe,GACnB,CAAAL,IAAI,aAAJA,IAAI,gBAAAL,qBAAA,GAAJK,IAAI,CAAEM,kBAAkB,cAAAX,qBAAA,uBAAxBA,qBAAA,CAA0BY,GAAG,CAAEC,UAAU,KAAM;IAC7CC,IAAI,EAAED,UAAU,CAAEC,IAAI;IACtBC,WAAW,EAAEF,UAAU,CAAEE;EAC3B,CAAC,CAAC,CAAC,KAAI,EAAE;EAEX,MAAMC,SAAS,GAAG,CAAC,CAACV,KAAK,IAAIH,YAAY;EAEzC,OACER,KAAA,CAAAsB,aAAA,CAAAtB,KAAA,CAAAuB,QAAA,QACGd,IAAI,IACHT,KAAA,CAAAsB,aAAA,CAAAtB,KAAA,CAAAuB,QAAA,QACGF,SAAS,GACRrB,KAAA,CAAAsB,aAAA;IAAKE,SAAS,EAAC;EAAmG,GAChHxB,KAAA,CAAAsB,aAAA,CAACxB,UAAU,MAAE,CACV,CAAC,GAENE,KAAA,CAAAsB,aAAA,CAACpB,IAAI;IAACK,WAAW,EAAEQ;EAAgB,CAAE,CAEvC,CAEJ,CAAC;AAEP,CAAC;AAED,SAASZ,iBAAiB","ignoreList":[]}
1
+ {"version":3,"file":"ValidationWrapper.js","names":["useSuspenseQuery","ChartError","useLayoutProvider","React","validateInstruments","Main","ValidationWrapper","_ref","division","instruments","isParamError","size","data","error","variables","fetchPolicy","errorPolicy","instrumentsData","mapInstrumentNames","map","instrument","name","displayName","showError","createElement","Fragment","className"],"sources":["../../../src/SpreadCostCalculatorWidget/ValidationWrapper.tsx"],"sourcesContent":["import { useSuspenseQuery } from '@apollo/client';\nimport { ChartError, useLayoutProvider } from '@oanda/labs-widget-common';\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';\n\nconst ValidationWrapper = ({\n division,\n instruments,\n isParamError,\n}: ValidationWrapperProps) => {\n const { size } = useLayoutProvider();\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 instrumentsData =\n data?.mapInstrumentNames?.map((instrument) => ({\n name: instrument!.name,\n displayName: instrument!.displayName,\n })) || [];\n\n const showError = !!error || isParamError;\n\n return (\n <>\n {size && (\n <>\n {showError ? (\n <div className=\"lw-flex lw-h-[300px] lw-w-full lw-items-center lw-border lw-border-solid lw-border-border-primary\">\n <ChartError />\n </div>\n ) : (\n <Main instruments={instrumentsData} />\n )}\n </>\n )}\n </>\n );\n};\n\nexport { ValidationWrapper };\n"],"mappings":"AAAA,SAASA,gBAAgB,QAAQ,gBAAgB;AACjD,SAASC,UAAU,EAAEC,iBAAiB,QAAQ,2BAA2B;AACzE,OAAOC,KAAK,MAAM,OAAO;AAMzB,SAASC,mBAAmB,QAAQ,4BAA4B;AAChE,SAASC,IAAI,QAAQ,QAAQ;AAG7B,MAAMC,iBAAiB,GAAGC,IAAA,IAII;EAAA,IAJH;IACzBC,QAAQ;IACRC,WAAW;IACXC;EACsB,CAAC,GAAAH,IAAA;EACvB,MAAM;IAAEI;EAAK,CAAC,GAAGT,iBAAiB,CAAC,CAAC;EACpC,MAAM;IAAEU,IAAI;IAAEC;EAAM,CAAC,GAAGb,gBAAgB,CAGtCI,mBAAmB,EAAE;IACrBU,SAAS,EAAE;MACTL,WAAW;MACXD;IACF,CAAC;IACDO,WAAW,EAAE,cAAc;IAC3BC,WAAW,EAAE;EACf,CAAC,CAAC;EAEF,MAAMC,eAAe,GACnBL,IAAI,EAAEM,kBAAkB,EAAEC,GAAG,CAAEC,UAAU,KAAM;IAC7CC,IAAI,EAAED,UAAU,CAAEC,IAAI;IACtBC,WAAW,EAAEF,UAAU,CAAEE;EAC3B,CAAC,CAAC,CAAC,IAAI,EAAE;EAEX,MAAMC,SAAS,GAAG,CAAC,CAACV,KAAK,IAAIH,YAAY;EAEzC,OACEP,KAAA,CAAAqB,aAAA,CAAArB,KAAA,CAAAsB,QAAA,QACGd,IAAI,IACHR,KAAA,CAAAqB,aAAA,CAAArB,KAAA,CAAAsB,QAAA,QACGF,SAAS,GACRpB,KAAA,CAAAqB,aAAA;IAAKE,SAAS,EAAC;EAAmG,GAChHvB,KAAA,CAAAqB,aAAA,CAACvB,UAAU,MAAE,CACV,CAAC,GAENE,KAAA,CAAAqB,aAAA,CAACnB,IAAI;IAACI,WAAW,EAAEQ;EAAgB,CAAE,CAEvC,CAEJ,CAAC;AAEP,CAAC;AAED,SAASX,iBAAiB","ignoreList":[]}
@@ -14,9 +14,9 @@ export const useCalculateSpread = _ref => {
14
14
  const [debouncedValue, setValue] = useDebounceValue(CELL_EMPTY_VALUE, delay);
15
15
  useEffect(() => {
16
16
  const calculatedSpread = calculateAbsoluteSpreadCost(unitsTraded, spread, pipLocation);
17
- setValue(calculatedSpread ? "".concat(numericFormatter(calculatedSpread.toString(), {
17
+ setValue(calculatedSpread ? `${numericFormatter(calculatedSpread.toString(), {
18
18
  thousandSeparator: ','
19
- }), " ").concat(currency) : CELL_EMPTY_VALUE);
19
+ })} ${currency}` : CELL_EMPTY_VALUE);
20
20
  }, [spread, unitsTraded, pipLocation, setValue]);
21
21
  return debouncedValue;
22
22
  };
@@ -1 +1 @@
1
- {"version":3,"file":"useCalculateSpread.js","names":["useEffect","numericFormatter","useDebounceValue","CELL_EMPTY_VALUE","calculateAbsoluteSpreadCost","unitsTraded","spread","pipLocation","undefined","Math","ceil","Number","toFixed","abs","useCalculateSpread","_ref","delay","currency","debouncedValue","setValue","calculatedSpread","concat","toString","thousandSeparator"],"sources":["../../../src/SpreadCostCalculatorWidget/useCalculateSpread.ts"],"sourcesContent":["import type { Voidable } from '@oanda/labs-widget-common';\nimport { useEffect } from 'react';\nimport { numericFormatter } from 'react-number-format';\nimport { useDebounceValue } from 'usehooks-ts';\n\nimport { CELL_EMPTY_VALUE } from './constant';\n\nexport interface UseCalculateSpreadInput {\n spread: Voidable<number>;\n unitsTraded: Voidable<number>;\n pipLocation: Voidable<number>;\n delay?: number;\n currency: string;\n}\n\nconst calculateAbsoluteSpreadCost = (\n unitsTraded?: number,\n spread?: number,\n pipLocation?: number\n): number | undefined =>\n unitsTraded !== undefined && spread !== undefined && pipLocation !== undefined\n ? Math.ceil(\n ((unitsTraded *\n spread *\n Number((10 ** pipLocation).toFixed(Math.abs(pipLocation)))) /\n 2) *\n 10000\n ) / 10000\n : undefined;\n\nexport const useCalculateSpread = ({\n spread,\n unitsTraded,\n pipLocation,\n delay = 350,\n currency,\n}: UseCalculateSpreadInput) => {\n const [debouncedValue, setValue] = useDebounceValue(CELL_EMPTY_VALUE, delay);\n\n useEffect(() => {\n const calculatedSpread = calculateAbsoluteSpreadCost(\n unitsTraded,\n spread,\n pipLocation\n );\n setValue(\n calculatedSpread\n ? `${numericFormatter(calculatedSpread.toString(), {\n thousandSeparator: ',',\n })} ${currency}`\n : CELL_EMPTY_VALUE\n );\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [spread, unitsTraded, pipLocation, setValue]);\n\n return debouncedValue;\n};\n"],"mappings":"AACA,SAASA,SAAS,QAAQ,OAAO;AACjC,SAASC,gBAAgB,QAAQ,qBAAqB;AACtD,SAASC,gBAAgB,QAAQ,aAAa;AAE9C,SAASC,gBAAgB,QAAQ,YAAY;AAU7C,MAAMC,2BAA2B,GAAGA,CAClCC,WAAoB,EACpBC,MAAe,EACfC,WAAoB,KAEpBF,WAAW,KAAKG,SAAS,IAAIF,MAAM,KAAKE,SAAS,IAAID,WAAW,KAAKC,SAAS,GAC1EC,IAAI,CAACC,IAAI,CACLL,WAAW,GACXC,MAAM,GACNK,MAAM,CAAC,CAAC,EAAE,IAAIJ,WAAW,EAAEK,OAAO,CAACH,IAAI,CAACI,GAAG,CAACN,WAAW,CAAC,CAAC,CAAC,GAC1D,CAAC,GACD,KACJ,CAAC,GAAG,KAAK,GACTC,SAAS;AAEf,OAAO,MAAMM,kBAAkB,GAAGC,IAAA,IAMH;EAAA,IANI;IACjCT,MAAM;IACND,WAAW;IACXE,WAAW;IACXS,KAAK,GAAG,GAAG;IACXC;EACuB,CAAC,GAAAF,IAAA;EACxB,MAAM,CAACG,cAAc,EAAEC,QAAQ,CAAC,GAAGjB,gBAAgB,CAACC,gBAAgB,EAAEa,KAAK,CAAC;EAE5EhB,SAAS,CAAC,MAAM;IACd,MAAMoB,gBAAgB,GAAGhB,2BAA2B,CAClDC,WAAW,EACXC,MAAM,EACNC,WACF,CAAC;IACDY,QAAQ,CACNC,gBAAgB,MAAAC,MAAA,CACTpB,gBAAgB,CAACmB,gBAAgB,CAACE,QAAQ,CAAC,CAAC,EAAE;MAC/CC,iBAAiB,EAAE;IACrB,CAAC,CAAC,OAAAF,MAAA,CAAIJ,QAAQ,IACdd,gBACN,CAAC;EAEH,CAAC,EAAE,CAACG,MAAM,EAAED,WAAW,EAAEE,WAAW,EAAEY,QAAQ,CAAC,CAAC;EAEhD,OAAOD,cAAc;AACvB,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"useCalculateSpread.js","names":["useEffect","numericFormatter","useDebounceValue","CELL_EMPTY_VALUE","calculateAbsoluteSpreadCost","unitsTraded","spread","pipLocation","undefined","Math","ceil","Number","toFixed","abs","useCalculateSpread","_ref","delay","currency","debouncedValue","setValue","calculatedSpread","toString","thousandSeparator"],"sources":["../../../src/SpreadCostCalculatorWidget/useCalculateSpread.ts"],"sourcesContent":["import type { Voidable } from '@oanda/labs-widget-common';\nimport { useEffect } from 'react';\nimport { numericFormatter } from 'react-number-format';\nimport { useDebounceValue } from 'usehooks-ts';\n\nimport { CELL_EMPTY_VALUE } from './constant';\n\nexport interface UseCalculateSpreadInput {\n spread: Voidable<number>;\n unitsTraded: Voidable<number>;\n pipLocation: Voidable<number>;\n delay?: number;\n currency: string;\n}\n\nconst calculateAbsoluteSpreadCost = (\n unitsTraded?: number,\n spread?: number,\n pipLocation?: number\n): number | undefined =>\n unitsTraded !== undefined && spread !== undefined && pipLocation !== undefined\n ? Math.ceil(\n ((unitsTraded *\n spread *\n Number((10 ** pipLocation).toFixed(Math.abs(pipLocation)))) /\n 2) *\n 10000\n ) / 10000\n : undefined;\n\nexport const useCalculateSpread = ({\n spread,\n unitsTraded,\n pipLocation,\n delay = 350,\n currency,\n}: UseCalculateSpreadInput) => {\n const [debouncedValue, setValue] = useDebounceValue(CELL_EMPTY_VALUE, delay);\n\n useEffect(() => {\n const calculatedSpread = calculateAbsoluteSpreadCost(\n unitsTraded,\n spread,\n pipLocation\n );\n setValue(\n calculatedSpread\n ? `${numericFormatter(calculatedSpread.toString(), {\n thousandSeparator: ',',\n })} ${currency}`\n : CELL_EMPTY_VALUE\n );\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [spread, unitsTraded, pipLocation, setValue]);\n\n return debouncedValue;\n};\n"],"mappings":"AACA,SAASA,SAAS,QAAQ,OAAO;AACjC,SAASC,gBAAgB,QAAQ,qBAAqB;AACtD,SAASC,gBAAgB,QAAQ,aAAa;AAE9C,SAASC,gBAAgB,QAAQ,YAAY;AAU7C,MAAMC,2BAA2B,GAAGA,CAClCC,WAAoB,EACpBC,MAAe,EACfC,WAAoB,KAEpBF,WAAW,KAAKG,SAAS,IAAIF,MAAM,KAAKE,SAAS,IAAID,WAAW,KAAKC,SAAS,GAC1EC,IAAI,CAACC,IAAI,CACLL,WAAW,GACXC,MAAM,GACNK,MAAM,CAAC,CAAC,EAAE,IAAIJ,WAAW,EAAEK,OAAO,CAACH,IAAI,CAACI,GAAG,CAACN,WAAW,CAAC,CAAC,CAAC,GAC1D,CAAC,GACD,KACJ,CAAC,GAAG,KAAK,GACTC,SAAS;AAEf,OAAO,MAAMM,kBAAkB,GAAGC,IAAA,IAMH;EAAA,IANI;IACjCT,MAAM;IACND,WAAW;IACXE,WAAW;IACXS,KAAK,GAAG,GAAG;IACXC;EACuB,CAAC,GAAAF,IAAA;EACxB,MAAM,CAACG,cAAc,EAAEC,QAAQ,CAAC,GAAGjB,gBAAgB,CAACC,gBAAgB,EAAEa,KAAK,CAAC;EAE5EhB,SAAS,CAAC,MAAM;IACd,MAAMoB,gBAAgB,GAAGhB,2BAA2B,CAClDC,WAAW,EACXC,MAAM,EACNC,WACF,CAAC;IACDY,QAAQ,CACNC,gBAAgB,GACZ,GAAGnB,gBAAgB,CAACmB,gBAAgB,CAACC,QAAQ,CAAC,CAAC,EAAE;MAC/CC,iBAAiB,EAAE;IACrB,CAAC,CAAC,IAAIL,QAAQ,EAAE,GAChBd,gBACN,CAAC;EAEH,CAAC,EAAE,CAACG,MAAM,EAAED,WAAW,EAAEE,WAAW,EAAEY,QAAQ,CAAC,CAAC;EAEhD,OAAOD,cAAc;AACvB,CAAC","ignoreList":[]}
@@ -21,7 +21,7 @@ export const useInstrumentChange = _ref => {
21
21
  connectionError
22
22
  } = useLiveRatesMessage(selectedInstrument.id, target);
23
23
  useEffect(() => {
24
- if (selectedInstrument.id === (update === null || update === void 0 ? void 0 : update.symbol)) {
24
+ if (selectedInstrument.id === update?.symbol) {
25
25
  setPipLocation(update.pipLocation);
26
26
  setSpread(update.spread);
27
27
  setLoading(false);
@@ -1 +1 @@
1
- {"version":3,"file":"useInstrumentChange.js","names":["useLiveRatesMessage","useLiveRatesQuery","useEffect","useState","getInstrumentCurrency","useInstrumentChange","_ref","initialInstrument","target","setQuery","closeQuery","loading","setLoading","selectedInstrument","setSelectedInstrument","pipLocation","setPipLocation","undefined","initialSpread","setSpread","currency","setCurrency","update","error","connectionError","id","symbol","spread","instruments","label"],"sources":["../../../src/SpreadCostCalculatorWidget/useInstrumentChange.ts"],"sourcesContent":["import type { SelectOption } from '@oanda/labs-widget-common';\nimport {\n useLiveRatesMessage,\n useLiveRatesQuery,\n} from '@oanda/labs-widget-common';\nimport { useEffect, useState } from 'react';\n\nimport { getInstrumentCurrency } from './utils';\n\nexport interface UseInstrumentChangeInput {\n initialInstrument: SelectOption;\n}\n\nexport const useInstrumentChange = ({\n initialInstrument,\n}: UseInstrumentChangeInput) => {\n const { target, setQuery, closeQuery } = useLiveRatesQuery();\n const [loading, setLoading] = useState(true);\n const [selectedInstrument, setSelectedInstrument] =\n useState(initialInstrument);\n const [pipLocation, setPipLocation] = useState<undefined | number>(undefined);\n const [initialSpread, setSpread] = useState<undefined | number>(undefined);\n const [currency, setCurrency] = useState('');\n\n const { update, error, connectionError } = useLiveRatesMessage(\n selectedInstrument.id,\n target\n );\n\n useEffect(() => {\n if (selectedInstrument.id === update?.symbol) {\n setPipLocation(update.pipLocation);\n setSpread(update.spread);\n setLoading(false);\n closeQuery();\n }\n\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [update]);\n\n useEffect(() => {\n setLoading(true);\n setQuery({ instruments: [selectedInstrument.id] });\n setCurrency(getInstrumentCurrency(selectedInstrument.label));\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [selectedInstrument.id]);\n\n return {\n selectedInstrument,\n setSelectedInstrument,\n pipLocation,\n initialSpread,\n loading,\n error: !!error || !!connectionError,\n currency,\n };\n};\n"],"mappings":"AACA,SACEA,mBAAmB,EACnBC,iBAAiB,QACZ,2BAA2B;AAClC,SAASC,SAAS,EAAEC,QAAQ,QAAQ,OAAO;AAE3C,SAASC,qBAAqB,QAAQ,SAAS;AAM/C,OAAO,MAAMC,mBAAmB,GAAGC,IAAA,IAEH;EAAA,IAFI;IAClCC;EACwB,CAAC,GAAAD,IAAA;EACzB,MAAM;IAAEE,MAAM;IAAEC,QAAQ;IAAEC;EAAW,CAAC,GAAGT,iBAAiB,CAAC,CAAC;EAC5D,MAAM,CAACU,OAAO,EAAEC,UAAU,CAAC,GAAGT,QAAQ,CAAC,IAAI,CAAC;EAC5C,MAAM,CAACU,kBAAkB,EAAEC,qBAAqB,CAAC,GAC/CX,QAAQ,CAACI,iBAAiB,CAAC;EAC7B,MAAM,CAACQ,WAAW,EAAEC,cAAc,CAAC,GAAGb,QAAQ,CAAqBc,SAAS,CAAC;EAC7E,MAAM,CAACC,aAAa,EAAEC,SAAS,CAAC,GAAGhB,QAAQ,CAAqBc,SAAS,CAAC;EAC1E,MAAM,CAACG,QAAQ,EAAEC,WAAW,CAAC,GAAGlB,QAAQ,CAAC,EAAE,CAAC;EAE5C,MAAM;IAAEmB,MAAM;IAAEC,KAAK;IAAEC;EAAgB,CAAC,GAAGxB,mBAAmB,CAC5Da,kBAAkB,CAACY,EAAE,EACrBjB,MACF,CAAC;EAEDN,SAAS,CAAC,MAAM;IACd,IAAIW,kBAAkB,CAACY,EAAE,MAAKH,MAAM,aAANA,MAAM,uBAANA,MAAM,CAAEI,MAAM,GAAE;MAC5CV,cAAc,CAACM,MAAM,CAACP,WAAW,CAAC;MAClCI,SAAS,CAACG,MAAM,CAACK,MAAM,CAAC;MACxBf,UAAU,CAAC,KAAK,CAAC;MACjBF,UAAU,CAAC,CAAC;IACd;EAGF,CAAC,EAAE,CAACY,MAAM,CAAC,CAAC;EAEZpB,SAAS,CAAC,MAAM;IACdU,UAAU,CAAC,IAAI,CAAC;IAChBH,QAAQ,CAAC;MAAEmB,WAAW,EAAE,CAACf,kBAAkB,CAACY,EAAE;IAAE,CAAC,CAAC;IAClDJ,WAAW,CAACjB,qBAAqB,CAACS,kBAAkB,CAACgB,KAAK,CAAC,CAAC;EAE9D,CAAC,EAAE,CAAChB,kBAAkB,CAACY,EAAE,CAAC,CAAC;EAE3B,OAAO;IACLZ,kBAAkB;IAClBC,qBAAqB;IACrBC,WAAW;IACXG,aAAa;IACbP,OAAO;IACPY,KAAK,EAAE,CAAC,CAACA,KAAK,IAAI,CAAC,CAACC,eAAe;IACnCJ;EACF,CAAC;AACH,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"useInstrumentChange.js","names":["useLiveRatesMessage","useLiveRatesQuery","useEffect","useState","getInstrumentCurrency","useInstrumentChange","_ref","initialInstrument","target","setQuery","closeQuery","loading","setLoading","selectedInstrument","setSelectedInstrument","pipLocation","setPipLocation","undefined","initialSpread","setSpread","currency","setCurrency","update","error","connectionError","id","symbol","spread","instruments","label"],"sources":["../../../src/SpreadCostCalculatorWidget/useInstrumentChange.ts"],"sourcesContent":["import type { SelectOption } from '@oanda/labs-widget-common';\nimport {\n useLiveRatesMessage,\n useLiveRatesQuery,\n} from '@oanda/labs-widget-common';\nimport { useEffect, useState } from 'react';\n\nimport { getInstrumentCurrency } from './utils';\n\nexport interface UseInstrumentChangeInput {\n initialInstrument: SelectOption;\n}\n\nexport const useInstrumentChange = ({\n initialInstrument,\n}: UseInstrumentChangeInput) => {\n const { target, setQuery, closeQuery } = useLiveRatesQuery();\n const [loading, setLoading] = useState(true);\n const [selectedInstrument, setSelectedInstrument] =\n useState(initialInstrument);\n const [pipLocation, setPipLocation] = useState<undefined | number>(undefined);\n const [initialSpread, setSpread] = useState<undefined | number>(undefined);\n const [currency, setCurrency] = useState('');\n\n const { update, error, connectionError } = useLiveRatesMessage(\n selectedInstrument.id,\n target\n );\n\n useEffect(() => {\n if (selectedInstrument.id === update?.symbol) {\n setPipLocation(update.pipLocation);\n setSpread(update.spread);\n setLoading(false);\n closeQuery();\n }\n\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [update]);\n\n useEffect(() => {\n setLoading(true);\n setQuery({ instruments: [selectedInstrument.id] });\n setCurrency(getInstrumentCurrency(selectedInstrument.label));\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [selectedInstrument.id]);\n\n return {\n selectedInstrument,\n setSelectedInstrument,\n pipLocation,\n initialSpread,\n loading,\n error: !!error || !!connectionError,\n currency,\n };\n};\n"],"mappings":"AACA,SACEA,mBAAmB,EACnBC,iBAAiB,QACZ,2BAA2B;AAClC,SAASC,SAAS,EAAEC,QAAQ,QAAQ,OAAO;AAE3C,SAASC,qBAAqB,QAAQ,SAAS;AAM/C,OAAO,MAAMC,mBAAmB,GAAGC,IAAA,IAEH;EAAA,IAFI;IAClCC;EACwB,CAAC,GAAAD,IAAA;EACzB,MAAM;IAAEE,MAAM;IAAEC,QAAQ;IAAEC;EAAW,CAAC,GAAGT,iBAAiB,CAAC,CAAC;EAC5D,MAAM,CAACU,OAAO,EAAEC,UAAU,CAAC,GAAGT,QAAQ,CAAC,IAAI,CAAC;EAC5C,MAAM,CAACU,kBAAkB,EAAEC,qBAAqB,CAAC,GAC/CX,QAAQ,CAACI,iBAAiB,CAAC;EAC7B,MAAM,CAACQ,WAAW,EAAEC,cAAc,CAAC,GAAGb,QAAQ,CAAqBc,SAAS,CAAC;EAC7E,MAAM,CAACC,aAAa,EAAEC,SAAS,CAAC,GAAGhB,QAAQ,CAAqBc,SAAS,CAAC;EAC1E,MAAM,CAACG,QAAQ,EAAEC,WAAW,CAAC,GAAGlB,QAAQ,CAAC,EAAE,CAAC;EAE5C,MAAM;IAAEmB,MAAM;IAAEC,KAAK;IAAEC;EAAgB,CAAC,GAAGxB,mBAAmB,CAC5Da,kBAAkB,CAACY,EAAE,EACrBjB,MACF,CAAC;EAEDN,SAAS,CAAC,MAAM;IACd,IAAIW,kBAAkB,CAACY,EAAE,KAAKH,MAAM,EAAEI,MAAM,EAAE;MAC5CV,cAAc,CAACM,MAAM,CAACP,WAAW,CAAC;MAClCI,SAAS,CAACG,MAAM,CAACK,MAAM,CAAC;MACxBf,UAAU,CAAC,KAAK,CAAC;MACjBF,UAAU,CAAC,CAAC;IACd;EAGF,CAAC,EAAE,CAACY,MAAM,CAAC,CAAC;EAEZpB,SAAS,CAAC,MAAM;IACdU,UAAU,CAAC,IAAI,CAAC;IAChBH,QAAQ,CAAC;MAAEmB,WAAW,EAAE,CAACf,kBAAkB,CAACY,EAAE;IAAE,CAAC,CAAC;IAClDJ,WAAW,CAACjB,qBAAqB,CAACS,kBAAkB,CAACgB,KAAK,CAAC,CAAC;EAE9D,CAAC,EAAE,CAAChB,kBAAkB,CAACY,EAAE,CAAC,CAAC;EAE3B,OAAO;IACLZ,kBAAkB;IAClBC,qBAAqB;IACrBC,WAAW;IACXG,aAAa;IACbP,OAAO;IACPY,KAAK,EAAE,CAAC,CAACA,KAAK,IAAI,CAAC,CAACC,eAAe;IACnCJ;EACF,CAAC;AACH,CAAC","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
- var _meta__, _fragDef$name;
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 === null || fragDef === void 0 || (_fragDef$name = fragDef.name) === null || _fragDef$name === void 0 ? void 0 : _fragDef$name.value;
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","_meta__","_fragDef$name","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;EAAA,IAAAK,OAAA,EAAAC,aAAA;EAC3C,MAAMC,cAAc,IAAAF,OAAA,GAClBF,SAAS,CAGTK,QAAQ,cAAAH,OAAA,uBAJaA,OAAA,CAIXE,cAAc;EAE1B,IAAI,CAACA,cAAc,EAAE,OAAO,IAAI;EAEhC,MAAME,OAAO,GAAGL,YAAY,CAACM,WAAW,CAAC,CAAC,CAE7B;EACb,MAAMC,QAAQ,GAAGF,OAAO,aAAPA,OAAO,gBAAAH,aAAA,GAAPG,OAAO,CAAEG,IAAI,cAAAN,aAAA,uBAAbA,aAAA,CAAeO,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,IAAKjB,IAAI,IAAIiB,KAAK,IAAIjB,IAAI,CAAC;AAC5E","ignoreList":[]}
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 mapInstrumentNames(instruments: $instruments, division: $division) {\n name\n displayName\n }\n }\n': types.ValidateInstrumentsDocument
4
4
  };
5
5
  export function graphql(source) {
6
- var _source;
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","_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 mapInstrumentNames(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 mapInstrumentNames(instruments: $instruments, division: $division) {\\n name\\n displayName\\n }\\n }\\n'\n): (typeof documents)['\\n query validateInstruments($instruments: [String]!, $division: Division) {\\n mapInstrumentNames(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,sMAAsM,EACpMD,KAAK,CAACE;AACV,CAAC;AAuBD,OAAO,SAASC,OAAOA,CAACC,MAAc,EAAE;EAAA,IAAAC,OAAA;EACtC,QAAAA,OAAA,GAAQJ,SAAS,CAASG,MAAM,CAAC,cAAAC,OAAA,cAAAA,OAAA,GAAI,CAAC,CAAC;AACzC","ignoreList":[]}
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 mapInstrumentNames(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 mapInstrumentNames(instruments: $instruments, division: $division) {\\n name\\n displayName\\n }\\n }\\n'\n): (typeof documents)['\\n query validateInstruments($instruments: [String]!, $division: Division) {\\n mapInstrumentNames(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,sMAAsM,EACpMD,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,10 @@
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(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n query validateInstruments($instruments: [String]!, $division: Division) {\n mapInstrumentNames(instruments: $instruments, division: $division) {\n name\n displayName\n }\n }\n"])));
2
+ export const validateInstruments = gql`
3
+ query validateInstruments($instruments: [String]!, $division: Division) {
4
+ mapInstrumentNames(instruments: $instruments, division: $division) {
5
+ name
6
+ displayName
7
+ }
8
+ }
9
+ `;
5
10
  //# sourceMappingURL=validateInstruments.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"validateInstruments.js","names":["gql","validateInstruments","_templateObject","_taggedTemplateLiteral"],"sources":["../../../src/gql/validateInstruments.ts"],"sourcesContent":["import { gql } from '@apollo/client';\n\nexport const validateInstruments = gql`\n query validateInstruments($instruments: [String]!, $division: Division) {\n mapInstrumentNames(instruments: $instruments, division: $division) {\n name\n displayName\n }\n }\n`;\n"],"mappings":";;AAAA,SAASA,GAAG,QAAQ,gBAAgB;AAEpC,OAAO,MAAMC,mBAAmB,GAAGD,GAAG,CAAAE,eAAA,KAAAA,eAAA,GAAAC,sBAAA,4MAOrC","ignoreList":[]}
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 mapInstrumentNames(instruments: $instruments, division: $division) {\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,CAAC","ignoreList":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oanda/labs-spread-cost-calculator-widget",
3
- "version": "1.0.77",
3
+ "version": "1.0.78",
4
4
  "description": "Labs Spread Cost Calculator Widget",
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.244",
16
+ "@oanda/labs-widget-common": "^1.0.245",
17
17
  "@oanda/mono-i18n": "10.0.1",
18
18
  "echarts": "6.0.0",
19
19
  "echarts-for-react": "3.0.4",
@@ -23,5 +23,5 @@
23
23
  "@graphql-codegen/cli": "5.0.0",
24
24
  "@graphql-codegen/client-preset": "4.1.0"
25
25
  },
26
- "gitHead": "ae3293f8fa274180539dc023bbfe668bf068d2c6"
26
+ "gitHead": "688bf7bf93110e0714926f15f6ae0ca04e2dc9af"
27
27
  }