@oanda/labs-currency-cross-table 1.0.27 → 1.0.29
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +236 -0
- package/dist/main/CurrencyCrossTableWidget/CurrencyCrossTableWidget.js +3 -1
- package/dist/main/CurrencyCrossTableWidget/CurrencyCrossTableWidget.js.map +1 -1
- package/dist/main/CurrencyCrossTableWidget/utils.js +1 -1
- package/dist/main/CurrencyCrossTableWidget/utils.js.map +1 -1
- package/dist/module/CurrencyCrossTableWidget/CurrencyCrossTableWidget.js +3 -1
- package/dist/module/CurrencyCrossTableWidget/CurrencyCrossTableWidget.js.map +1 -1
- package/dist/module/CurrencyCrossTableWidget/utils.js +1 -1
- package/dist/module/CurrencyCrossTableWidget/utils.js.map +1 -1
- package/dist/types/CurrencyCrossTableWidget/CurrencyCrossTableWidget.d.ts +1 -1
- package/dist/types/CurrencyCrossTableWidget/utils.d.ts +1 -1
- package/package.json +3 -3
- package/src/CurrencyCrossTableWidget/CurrencyCrossTableWidget.tsx +6 -1
- package/src/CurrencyCrossTableWidget/utils.ts +5 -1
- package/test/utils.test.ts +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,242 @@
|
|
|
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.29 (2025-01-12)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
## 1.0.177 (2025-01-10)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
## 1.0.176 (2025-01-10)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
## 1.0.175 (2025-01-08)
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
## 1.0.174 (2024-12-16)
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
## 1.0.173 (2024-12-11)
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
## 1.0.172 (2024-11-29)
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
## 1.0.171 (2024-11-28)
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
## 1.0.170 (2024-11-28)
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
## 1.0.169 (2024-11-20)
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
## 1.0.168 (2024-11-19)
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
## 1.0.167 (2024-10-14)
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
## 1.0.166 (2024-10-07)
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
## 1.0.165 (2024-10-03)
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
## 1.0.164 (2024-09-26)
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
## 1.0.163 (2024-09-18)
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
## 1.0.162 (2024-09-12)
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
## 1.0.161 (2024-09-11)
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
## 1.0.160 (2024-09-10)
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
## 1.0.159 (2024-09-09)
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
## 1.0.158 (2024-09-04)
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
## 1.0.157 (2024-09-04)
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
## 1.0.156 (2024-09-02)
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
## 1.0.155 (2024-08-29)
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
## 1.0.154 (2024-08-29)
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
## 1.0.153 (2024-08-23)
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
## 1.0.152 (2024-08-23)
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
## 1.0.151 (2024-08-20)
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
## 1.0.150 (2024-08-19)
|
|
119
|
+
|
|
120
|
+
**Note:** Version bump only for package @oanda/labs-currency-cross-table
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
## 1.0.28 (2025-01-10)
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
## 1.0.176 (2025-01-10)
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
## 1.0.175 (2025-01-08)
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
## 1.0.174 (2024-12-16)
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
## 1.0.173 (2024-12-11)
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
## 1.0.172 (2024-11-29)
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
## 1.0.171 (2024-11-28)
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
## 1.0.170 (2024-11-28)
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
## 1.0.169 (2024-11-20)
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
## 1.0.168 (2024-11-19)
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
## 1.0.167 (2024-10-14)
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
## 1.0.166 (2024-10-07)
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
## 1.0.165 (2024-10-03)
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
## 1.0.164 (2024-09-26)
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
## 1.0.163 (2024-09-18)
|
|
183
|
+
|
|
184
|
+
|
|
185
|
+
|
|
186
|
+
## 1.0.162 (2024-09-12)
|
|
187
|
+
|
|
188
|
+
|
|
189
|
+
|
|
190
|
+
## 1.0.161 (2024-09-11)
|
|
191
|
+
|
|
192
|
+
|
|
193
|
+
|
|
194
|
+
## 1.0.160 (2024-09-10)
|
|
195
|
+
|
|
196
|
+
|
|
197
|
+
|
|
198
|
+
## 1.0.159 (2024-09-09)
|
|
199
|
+
|
|
200
|
+
|
|
201
|
+
|
|
202
|
+
## 1.0.158 (2024-09-04)
|
|
203
|
+
|
|
204
|
+
|
|
205
|
+
|
|
206
|
+
## 1.0.157 (2024-09-04)
|
|
207
|
+
|
|
208
|
+
|
|
209
|
+
|
|
210
|
+
## 1.0.156 (2024-09-02)
|
|
211
|
+
|
|
212
|
+
|
|
213
|
+
|
|
214
|
+
## 1.0.155 (2024-08-29)
|
|
215
|
+
|
|
216
|
+
|
|
217
|
+
|
|
218
|
+
## 1.0.154 (2024-08-29)
|
|
219
|
+
|
|
220
|
+
|
|
221
|
+
|
|
222
|
+
## 1.0.153 (2024-08-23)
|
|
223
|
+
|
|
224
|
+
|
|
225
|
+
|
|
226
|
+
## 1.0.152 (2024-08-23)
|
|
227
|
+
|
|
228
|
+
|
|
229
|
+
|
|
230
|
+
## 1.0.151 (2024-08-20)
|
|
231
|
+
|
|
232
|
+
|
|
233
|
+
|
|
234
|
+
## 1.0.150 (2024-08-19)
|
|
235
|
+
|
|
236
|
+
**Note:** Version bump only for package @oanda/labs-currency-cross-table
|
|
237
|
+
|
|
238
|
+
|
|
239
|
+
|
|
240
|
+
|
|
241
|
+
|
|
6
242
|
## 1.0.27 (2025-01-10)
|
|
7
243
|
|
|
8
244
|
|
|
@@ -21,7 +21,8 @@ const CurrencyCrossTableWidget = _ref => {
|
|
|
21
21
|
theme,
|
|
22
22
|
isParamError,
|
|
23
23
|
removePadding,
|
|
24
|
-
logoLink
|
|
24
|
+
logoLink,
|
|
25
|
+
brandingSpace
|
|
25
26
|
} = _ref;
|
|
26
27
|
const client = new _client.ApolloClient({
|
|
27
28
|
uri: graphqlUrl,
|
|
@@ -46,6 +47,7 @@ const CurrencyCrossTableWidget = _ref => {
|
|
|
46
47
|
theme: theme,
|
|
47
48
|
translations: _translations.translations
|
|
48
49
|
}, _react.default.createElement(_labsWidgetCommon.WidgetWrapper, {
|
|
50
|
+
brandingSpace: brandingSpace,
|
|
49
51
|
linkArea: "full",
|
|
50
52
|
logoLink: logoLink
|
|
51
53
|
}, _react.default.createElement(_ValidationWrapper.ValidationWrapper, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CurrencyCrossTableWidget.js","names":["_client","require","_labsWidgetCommon","_react","_interopRequireDefault","_graphql","_translations","_ValidationWrapper","e","__esModule","default","CurrencyCrossTableWidget","_ref","graphqlUrl","liveRatesUrl","currencies","division","locale","theme","isParamError","removePadding","logoLink","client","ApolloClient","uri","cache","InMemoryCache","divisionCode","Division","Opt","Ogm","dataSource","createElement","WidgetProvider","withSuspense","liveRates","url","options","styling","translations","WidgetWrapper","linkArea","ValidationWrapper","exports"],"sources":["../../../src/CurrencyCrossTableWidget/CurrencyCrossTableWidget.tsx"],"sourcesContent":["import { ApolloClient, InMemoryCache } from '@apollo/client';\nimport { WidgetProvider, WidgetWrapper } from '@oanda/labs-widget-common';\nimport React from 'react';\n\nimport { Division } from '../gql/types/graphql';\nimport { translations } from '../translations';\nimport type { CurrencyCrossTableConfig } from './types';\nimport { ValidationWrapper } from './ValidationWrapper';\n\nconst CurrencyCrossTableWidget = ({\n graphqlUrl,\n liveRatesUrl,\n currencies,\n division,\n locale,\n theme,\n isParamError,\n removePadding,\n logoLink,\n}: CurrencyCrossTableConfig) => {\n const client = new ApolloClient({\n uri: graphqlUrl,\n cache: new InMemoryCache(),\n });\n\n const divisionCode = division === Division.Opt ? Division.Ogm : division;\n const dataSource = divisionCode === Division.Ogm ? 'MT5' : 'V20';\n\n return (\n <WidgetProvider\n withSuspense\n client={client}\n liveRates={{\n url: liveRatesUrl,\n options: { divisionCode, dataSource },\n }}\n locale={locale}\n styling={{\n removePadding,\n }}\n theme={theme}\n translations={translations}\n >\n <WidgetWrapper
|
|
1
|
+
{"version":3,"file":"CurrencyCrossTableWidget.js","names":["_client","require","_labsWidgetCommon","_react","_interopRequireDefault","_graphql","_translations","_ValidationWrapper","e","__esModule","default","CurrencyCrossTableWidget","_ref","graphqlUrl","liveRatesUrl","currencies","division","locale","theme","isParamError","removePadding","logoLink","brandingSpace","client","ApolloClient","uri","cache","InMemoryCache","divisionCode","Division","Opt","Ogm","dataSource","createElement","WidgetProvider","withSuspense","liveRates","url","options","styling","translations","WidgetWrapper","linkArea","ValidationWrapper","exports"],"sources":["../../../src/CurrencyCrossTableWidget/CurrencyCrossTableWidget.tsx"],"sourcesContent":["import { ApolloClient, InMemoryCache } from '@apollo/client';\nimport { WidgetProvider, WidgetWrapper } from '@oanda/labs-widget-common';\nimport React from 'react';\n\nimport { Division } from '../gql/types/graphql';\nimport { translations } from '../translations';\nimport type { CurrencyCrossTableConfig } from './types';\nimport { ValidationWrapper } from './ValidationWrapper';\n\nconst CurrencyCrossTableWidget = ({\n graphqlUrl,\n liveRatesUrl,\n currencies,\n division,\n locale,\n theme,\n isParamError,\n removePadding,\n logoLink,\n brandingSpace,\n}: CurrencyCrossTableConfig) => {\n const client = new ApolloClient({\n uri: graphqlUrl,\n cache: new InMemoryCache(),\n });\n\n const divisionCode = division === Division.Opt ? Division.Ogm : division;\n const dataSource = divisionCode === Division.Ogm ? 'MT5' : 'V20';\n\n return (\n <WidgetProvider\n withSuspense\n client={client}\n liveRates={{\n url: liveRatesUrl,\n options: { divisionCode, dataSource },\n }}\n locale={locale}\n styling={{\n removePadding,\n }}\n theme={theme}\n translations={translations}\n >\n <WidgetWrapper\n brandingSpace={brandingSpace}\n linkArea=\"full\"\n logoLink={logoLink}\n >\n <ValidationWrapper\n currencies={currencies}\n division={division}\n isParamError={isParamError}\n />\n </WidgetWrapper>\n </WidgetProvider>\n );\n};\n\nexport { CurrencyCrossTableWidget };\n"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,iBAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAC,sBAAA,CAAAH,OAAA;AAEA,IAAAI,QAAA,GAAAJ,OAAA;AACA,IAAAK,aAAA,GAAAL,OAAA;AAEA,IAAAM,kBAAA,GAAAN,OAAA;AAAwD,SAAAG,uBAAAI,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAExD,MAAMG,wBAAwB,GAAGC,IAAA,IAWD;EAAA,IAXE;IAChCC,UAAU;IACVC,YAAY;IACZC,UAAU;IACVC,QAAQ;IACRC,MAAM;IACNC,KAAK;IACLC,YAAY;IACZC,aAAa;IACbC,QAAQ;IACRC;EACwB,CAAC,GAAAV,IAAA;EACzB,MAAMW,MAAM,GAAG,IAAIC,oBAAY,CAAC;IAC9BC,GAAG,EAAEZ,UAAU;IACfa,KAAK,EAAE,IAAIC,qBAAa,CAAC;EAC3B,CAAC,CAAC;EAEF,MAAMC,YAAY,GAAGZ,QAAQ,KAAKa,iBAAQ,CAACC,GAAG,GAAGD,iBAAQ,CAACE,GAAG,GAAGf,QAAQ;EACxE,MAAMgB,UAAU,GAAGJ,YAAY,KAAKC,iBAAQ,CAACE,GAAG,GAAG,KAAK,GAAG,KAAK;EAEhE,OACE5B,MAAA,CAAAO,OAAA,CAAAuB,aAAA,CAAC/B,iBAAA,CAAAgC,cAAc;IACbC,YAAY;IACZZ,MAAM,EAAEA,MAAO;IACfa,SAAS,EAAE;MACTC,GAAG,EAAEvB,YAAY;MACjBwB,OAAO,EAAE;QAAEV,YAAY;QAAEI;MAAW;IACtC,CAAE;IACFf,MAAM,EAAEA,MAAO;IACfsB,OAAO,EAAE;MACPnB;IACF,CAAE;IACFF,KAAK,EAAEA,KAAM;IACbsB,YAAY,EAAEA;EAAa,GAE3BrC,MAAA,CAAAO,OAAA,CAAAuB,aAAA,CAAC/B,iBAAA,CAAAuC,aAAa;IACZnB,aAAa,EAAEA,aAAc;IAC7BoB,QAAQ,EAAC,MAAM;IACfrB,QAAQ,EAAEA;EAAS,GAEnBlB,MAAA,CAAAO,OAAA,CAAAuB,aAAA,CAAC1B,kBAAA,CAAAoC,iBAAiB;IAChB5B,UAAU,EAAEA,UAAW;IACvBC,QAAQ,EAAEA,QAAS;IACnBG,YAAY,EAAEA;EAAa,CAC5B,CACY,CACD,CAAC;AAErB,CAAC;AAACyB,OAAA,CAAAjC,wBAAA,GAAAA,wBAAA","ignoreList":[]}
|
|
@@ -26,7 +26,7 @@ const getPriceMovement = _ref => {
|
|
|
26
26
|
} = _ref;
|
|
27
27
|
const roundedPrevious = getBuyPrice(previous, isReversed)?.toFixed(displayPrecision);
|
|
28
28
|
const roundedUpdate = getBuyPrice(update, isReversed)?.toFixed(displayPrecision);
|
|
29
|
-
if (roundedPrevious === roundedUpdate || update === undefined) {
|
|
29
|
+
if (roundedPrevious === roundedUpdate || update === undefined || previous === undefined) {
|
|
30
30
|
return 0;
|
|
31
31
|
}
|
|
32
32
|
return roundedUpdate > roundedPrevious ? 1 : -1;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","names":["_constant","require","validCurrencies","currencies","every","currency","MAJOR_CURRENCIES","includes","exports","divisionMapper","division","currenciesToInstruments","pairs","reduce","acc","cV","index","array","unique","filter","_item","idx","map","el","getPriceMovement","_ref","previous","update","displayPrecision","isReversed","roundedPrevious","getBuyPrice","toFixed","roundedUpdate","undefined","price"],"sources":["../../../src/CurrencyCrossTableWidget/utils.ts"],"sourcesContent":["import type { Division } from '../gql/types/graphql';\nimport { MAJOR_CURRENCIES } from './constant';\n\nconst validCurrencies = (currencies: string[]) =>\n currencies.every((currency) => MAJOR_CURRENCIES.includes(currency));\n\nconst divisionMapper = (division: Division) => (division === 'OGM' ? '' : '_');\n\nconst currenciesToInstruments = (currencies: string[], division: Division) => {\n const pairs = currencies.reduce((acc, cV, index, array) => {\n const unique = array.filter((_item, idx) => index !== idx);\n\n return [\n ...acc,\n ...unique.map((el) => `${cV}${divisionMapper(division)}${el}`),\n ];\n }, [] as string[]);\n\n return pairs;\n};\n\nconst getPriceMovement = ({\n previous,\n update,\n displayPrecision,\n isReversed,\n}: {\n previous?: number;\n update?: number;\n displayPrecision?: number;\n isReversed: boolean;\n}) => {\n const roundedPrevious = getBuyPrice(previous, isReversed)?.toFixed(\n displayPrecision\n );\n const roundedUpdate = getBuyPrice(update, isReversed)?.toFixed(\n displayPrecision\n );\n\n if (roundedPrevious === roundedUpdate
|
|
1
|
+
{"version":3,"file":"utils.js","names":["_constant","require","validCurrencies","currencies","every","currency","MAJOR_CURRENCIES","includes","exports","divisionMapper","division","currenciesToInstruments","pairs","reduce","acc","cV","index","array","unique","filter","_item","idx","map","el","getPriceMovement","_ref","previous","update","displayPrecision","isReversed","roundedPrevious","getBuyPrice","toFixed","roundedUpdate","undefined","price"],"sources":["../../../src/CurrencyCrossTableWidget/utils.ts"],"sourcesContent":["import type { Division } from '../gql/types/graphql';\nimport { MAJOR_CURRENCIES } from './constant';\n\nconst validCurrencies = (currencies: string[]) =>\n currencies.every((currency) => MAJOR_CURRENCIES.includes(currency));\n\nconst divisionMapper = (division: Division) => (division === 'OGM' ? '' : '_');\n\nconst currenciesToInstruments = (currencies: string[], division: Division) => {\n const pairs = currencies.reduce((acc, cV, index, array) => {\n const unique = array.filter((_item, idx) => index !== idx);\n\n return [\n ...acc,\n ...unique.map((el) => `${cV}${divisionMapper(division)}${el}`),\n ];\n }, [] as string[]);\n\n return pairs;\n};\n\nconst getPriceMovement = ({\n previous,\n update,\n displayPrecision,\n isReversed,\n}: {\n previous?: number;\n update?: number;\n displayPrecision?: number;\n isReversed: boolean;\n}) => {\n const roundedPrevious = getBuyPrice(previous, isReversed)?.toFixed(\n displayPrecision\n );\n const roundedUpdate = getBuyPrice(update, isReversed)?.toFixed(\n displayPrecision\n );\n\n if (\n roundedPrevious === roundedUpdate ||\n update === undefined ||\n previous === undefined\n ) {\n return 0;\n }\n\n return roundedUpdate > roundedPrevious ? 1 : -1;\n};\n\nconst getBuyPrice = (price: number | undefined, isReversed: boolean) => {\n if (price === undefined) return 0;\n\n return isReversed ? 1 / price : price;\n};\n\nexport {\n currenciesToInstruments,\n divisionMapper,\n getBuyPrice,\n getPriceMovement,\n validCurrencies,\n};\n"],"mappings":";;;;;;AACA,IAAAA,SAAA,GAAAC,OAAA;AAEA,MAAMC,eAAe,GAAIC,UAAoB,IAC3CA,UAAU,CAACC,KAAK,CAAEC,QAAQ,IAAKC,0BAAgB,CAACC,QAAQ,CAACF,QAAQ,CAAC,CAAC;AAACG,OAAA,CAAAN,eAAA,GAAAA,eAAA;AAEtE,MAAMO,cAAc,GAAIC,QAAkB,IAAMA,QAAQ,KAAK,KAAK,GAAG,EAAE,GAAG,GAAI;AAACF,OAAA,CAAAC,cAAA,GAAAA,cAAA;AAE/E,MAAME,uBAAuB,GAAGA,CAACR,UAAoB,EAAEO,QAAkB,KAAK;EAC5E,MAAME,KAAK,GAAGT,UAAU,CAACU,MAAM,CAAC,CAACC,GAAG,EAAEC,EAAE,EAAEC,KAAK,EAAEC,KAAK,KAAK;IACzD,MAAMC,MAAM,GAAGD,KAAK,CAACE,MAAM,CAAC,CAACC,KAAK,EAAEC,GAAG,KAAKL,KAAK,KAAKK,GAAG,CAAC;IAE1D,OAAO,CACL,GAAGP,GAAG,EACN,GAAGI,MAAM,CAACI,GAAG,CAAEC,EAAE,IAAK,GAAGR,EAAE,GAAGN,cAAc,CAACC,QAAQ,CAAC,GAAGa,EAAE,EAAE,CAAC,CAC/D;EACH,CAAC,EAAE,EAAc,CAAC;EAElB,OAAOX,KAAK;AACd,CAAC;AAACJ,OAAA,CAAAG,uBAAA,GAAAA,uBAAA;AAEF,MAAMa,gBAAgB,GAAGC,IAAA,IAUnB;EAAA,IAVoB;IACxBC,QAAQ;IACRC,MAAM;IACNC,gBAAgB;IAChBC;EAMF,CAAC,GAAAJ,IAAA;EACC,MAAMK,eAAe,GAAGC,WAAW,CAACL,QAAQ,EAAEG,UAAU,CAAC,EAAEG,OAAO,CAChEJ,gBACF,CAAC;EACD,MAAMK,aAAa,GAAGF,WAAW,CAACJ,MAAM,EAAEE,UAAU,CAAC,EAAEG,OAAO,CAC5DJ,gBACF,CAAC;EAED,IACEE,eAAe,KAAKG,aAAa,IACjCN,MAAM,KAAKO,SAAS,IACpBR,QAAQ,KAAKQ,SAAS,EACtB;IACA,OAAO,CAAC;EACV;EAEA,OAAOD,aAAa,GAAGH,eAAe,GAAG,CAAC,GAAG,CAAC,CAAC;AACjD,CAAC;AAACtB,OAAA,CAAAgB,gBAAA,GAAAA,gBAAA;AAEF,MAAMO,WAAW,GAAGA,CAACI,KAAyB,EAAEN,UAAmB,KAAK;EACtE,IAAIM,KAAK,KAAKD,SAAS,EAAE,OAAO,CAAC;EAEjC,OAAOL,UAAU,GAAG,CAAC,GAAGM,KAAK,GAAGA,KAAK;AACvC,CAAC;AAAC3B,OAAA,CAAAuB,WAAA,GAAAA,WAAA","ignoreList":[]}
|
|
@@ -14,7 +14,8 @@ const CurrencyCrossTableWidget = _ref => {
|
|
|
14
14
|
theme,
|
|
15
15
|
isParamError,
|
|
16
16
|
removePadding,
|
|
17
|
-
logoLink
|
|
17
|
+
logoLink,
|
|
18
|
+
brandingSpace
|
|
18
19
|
} = _ref;
|
|
19
20
|
const client = new ApolloClient({
|
|
20
21
|
uri: graphqlUrl,
|
|
@@ -39,6 +40,7 @@ const CurrencyCrossTableWidget = _ref => {
|
|
|
39
40
|
theme: theme,
|
|
40
41
|
translations: translations
|
|
41
42
|
}, React.createElement(WidgetWrapper, {
|
|
43
|
+
brandingSpace: brandingSpace,
|
|
42
44
|
linkArea: "full",
|
|
43
45
|
logoLink: logoLink
|
|
44
46
|
}, React.createElement(ValidationWrapper, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CurrencyCrossTableWidget.js","names":["ApolloClient","InMemoryCache","WidgetProvider","WidgetWrapper","React","Division","translations","ValidationWrapper","CurrencyCrossTableWidget","_ref","graphqlUrl","liveRatesUrl","currencies","division","locale","theme","isParamError","removePadding","logoLink","client","uri","cache","divisionCode","Opt","Ogm","dataSource","createElement","withSuspense","liveRates","url","options","styling","linkArea"],"sources":["../../../src/CurrencyCrossTableWidget/CurrencyCrossTableWidget.tsx"],"sourcesContent":["import { ApolloClient, InMemoryCache } from '@apollo/client';\nimport { WidgetProvider, WidgetWrapper } from '@oanda/labs-widget-common';\nimport React from 'react';\n\nimport { Division } from '../gql/types/graphql';\nimport { translations } from '../translations';\nimport type { CurrencyCrossTableConfig } from './types';\nimport { ValidationWrapper } from './ValidationWrapper';\n\nconst CurrencyCrossTableWidget = ({\n graphqlUrl,\n liveRatesUrl,\n currencies,\n division,\n locale,\n theme,\n isParamError,\n removePadding,\n logoLink,\n}: CurrencyCrossTableConfig) => {\n const client = new ApolloClient({\n uri: graphqlUrl,\n cache: new InMemoryCache(),\n });\n\n const divisionCode = division === Division.Opt ? Division.Ogm : division;\n const dataSource = divisionCode === Division.Ogm ? 'MT5' : 'V20';\n\n return (\n <WidgetProvider\n withSuspense\n client={client}\n liveRates={{\n url: liveRatesUrl,\n options: { divisionCode, dataSource },\n }}\n locale={locale}\n styling={{\n removePadding,\n }}\n theme={theme}\n translations={translations}\n >\n <WidgetWrapper
|
|
1
|
+
{"version":3,"file":"CurrencyCrossTableWidget.js","names":["ApolloClient","InMemoryCache","WidgetProvider","WidgetWrapper","React","Division","translations","ValidationWrapper","CurrencyCrossTableWidget","_ref","graphqlUrl","liveRatesUrl","currencies","division","locale","theme","isParamError","removePadding","logoLink","brandingSpace","client","uri","cache","divisionCode","Opt","Ogm","dataSource","createElement","withSuspense","liveRates","url","options","styling","linkArea"],"sources":["../../../src/CurrencyCrossTableWidget/CurrencyCrossTableWidget.tsx"],"sourcesContent":["import { ApolloClient, InMemoryCache } from '@apollo/client';\nimport { WidgetProvider, WidgetWrapper } from '@oanda/labs-widget-common';\nimport React from 'react';\n\nimport { Division } from '../gql/types/graphql';\nimport { translations } from '../translations';\nimport type { CurrencyCrossTableConfig } from './types';\nimport { ValidationWrapper } from './ValidationWrapper';\n\nconst CurrencyCrossTableWidget = ({\n graphqlUrl,\n liveRatesUrl,\n currencies,\n division,\n locale,\n theme,\n isParamError,\n removePadding,\n logoLink,\n brandingSpace,\n}: CurrencyCrossTableConfig) => {\n const client = new ApolloClient({\n uri: graphqlUrl,\n cache: new InMemoryCache(),\n });\n\n const divisionCode = division === Division.Opt ? Division.Ogm : division;\n const dataSource = divisionCode === Division.Ogm ? 'MT5' : 'V20';\n\n return (\n <WidgetProvider\n withSuspense\n client={client}\n liveRates={{\n url: liveRatesUrl,\n options: { divisionCode, dataSource },\n }}\n locale={locale}\n styling={{\n removePadding,\n }}\n theme={theme}\n translations={translations}\n >\n <WidgetWrapper\n brandingSpace={brandingSpace}\n linkArea=\"full\"\n logoLink={logoLink}\n >\n <ValidationWrapper\n currencies={currencies}\n division={division}\n isParamError={isParamError}\n />\n </WidgetWrapper>\n </WidgetProvider>\n );\n};\n\nexport { CurrencyCrossTableWidget };\n"],"mappings":"AAAA,SAASA,YAAY,EAAEC,aAAa,QAAQ,gBAAgB;AAC5D,SAASC,cAAc,EAAEC,aAAa,QAAQ,2BAA2B;AACzE,OAAOC,KAAK,MAAM,OAAO;AAEzB,SAASC,QAAQ,QAAQ,sBAAsB;AAC/C,SAASC,YAAY,QAAQ,iBAAiB;AAE9C,SAASC,iBAAiB,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undedPrevious = getBuyPrice(previous, isReversed)?.toFixed(displayPrecision);
|
|
19
19
|
const roundedUpdate = getBuyPrice(update, isReversed)?.toFixed(displayPrecision);
|
|
20
|
-
if (roundedPrevious === roundedUpdate || update === undefined) {
|
|
20
|
+
if (roundedPrevious === roundedUpdate || update === undefined || previous === undefined) {
|
|
21
21
|
return 0;
|
|
22
22
|
}
|
|
23
23
|
return roundedUpdate > roundedPrevious ? 1 : -1;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","names":["MAJOR_CURRENCIES","validCurrencies","currencies","every","currency","includes","divisionMapper","division","currenciesToInstruments","pairs","reduce","acc","cV","index","array","unique","filter","_item","idx","map","el","getPriceMovement","_ref","previous","update","displayPrecision","isReversed","roundedPrevious","getBuyPrice","toFixed","roundedUpdate","undefined","price"],"sources":["../../../src/CurrencyCrossTableWidget/utils.ts"],"sourcesContent":["import type { Division } from '../gql/types/graphql';\nimport { MAJOR_CURRENCIES } from './constant';\n\nconst validCurrencies = (currencies: string[]) =>\n currencies.every((currency) => MAJOR_CURRENCIES.includes(currency));\n\nconst divisionMapper = (division: Division) => (division === 'OGM' ? '' : '_');\n\nconst currenciesToInstruments = (currencies: string[], division: Division) => {\n const pairs = currencies.reduce((acc, cV, index, array) => {\n const unique = array.filter((_item, idx) => index !== idx);\n\n return [\n ...acc,\n ...unique.map((el) => `${cV}${divisionMapper(division)}${el}`),\n ];\n }, [] as string[]);\n\n return pairs;\n};\n\nconst getPriceMovement = ({\n previous,\n update,\n displayPrecision,\n isReversed,\n}: {\n previous?: number;\n update?: number;\n displayPrecision?: number;\n isReversed: boolean;\n}) => {\n const roundedPrevious = getBuyPrice(previous, isReversed)?.toFixed(\n displayPrecision\n );\n const roundedUpdate = getBuyPrice(update, isReversed)?.toFixed(\n displayPrecision\n );\n\n if (roundedPrevious === roundedUpdate
|
|
1
|
+
{"version":3,"file":"utils.js","names":["MAJOR_CURRENCIES","validCurrencies","currencies","every","currency","includes","divisionMapper","division","currenciesToInstruments","pairs","reduce","acc","cV","index","array","unique","filter","_item","idx","map","el","getPriceMovement","_ref","previous","update","displayPrecision","isReversed","roundedPrevious","getBuyPrice","toFixed","roundedUpdate","undefined","price"],"sources":["../../../src/CurrencyCrossTableWidget/utils.ts"],"sourcesContent":["import type { Division } from '../gql/types/graphql';\nimport { MAJOR_CURRENCIES } from './constant';\n\nconst validCurrencies = (currencies: string[]) =>\n currencies.every((currency) => MAJOR_CURRENCIES.includes(currency));\n\nconst divisionMapper = (division: Division) => (division === 'OGM' ? '' : '_');\n\nconst currenciesToInstruments = (currencies: string[], division: Division) => {\n const pairs = currencies.reduce((acc, cV, index, array) => {\n const unique = array.filter((_item, idx) => index !== idx);\n\n return [\n ...acc,\n ...unique.map((el) => `${cV}${divisionMapper(division)}${el}`),\n ];\n }, [] as string[]);\n\n return pairs;\n};\n\nconst getPriceMovement = ({\n previous,\n update,\n displayPrecision,\n isReversed,\n}: {\n previous?: number;\n update?: number;\n displayPrecision?: number;\n isReversed: boolean;\n}) => {\n const roundedPrevious = getBuyPrice(previous, isReversed)?.toFixed(\n displayPrecision\n );\n const roundedUpdate = getBuyPrice(update, isReversed)?.toFixed(\n displayPrecision\n );\n\n if (\n roundedPrevious === roundedUpdate ||\n update === undefined ||\n previous === undefined\n ) {\n return 0;\n }\n\n return roundedUpdate > roundedPrevious ? 1 : -1;\n};\n\nconst getBuyPrice = (price: number | undefined, isReversed: boolean) => {\n if (price === undefined) return 0;\n\n return isReversed ? 1 / price : price;\n};\n\nexport {\n currenciesToInstruments,\n divisionMapper,\n getBuyPrice,\n getPriceMovement,\n validCurrencies,\n};\n"],"mappings":"AACA,SAASA,gBAAgB,QAAQ,YAAY;AAE7C,MAAMC,eAAe,GAAIC,UAAoB,IAC3CA,UAAU,CAACC,KAAK,CAAEC,QAAQ,IAAKJ,gBAAgB,CAACK,QAAQ,CAACD,QAAQ,CAAC,CAAC;AAErE,MAAME,cAAc,GAAIC,QAAkB,IAAMA,QAAQ,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,SACExB,uBAAuB,EACvBF,cAAc,EACdsB,WAAW,EACXP,gBAAgB,EAChBpB,eAAe","ignoreList":[]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { CurrencyCrossTableConfig } from './types';
|
|
3
|
-
declare const CurrencyCrossTableWidget: ({ graphqlUrl, liveRatesUrl, currencies, division, locale, theme, isParamError, removePadding, logoLink, }: CurrencyCrossTableConfig) => React.JSX.Element;
|
|
3
|
+
declare const CurrencyCrossTableWidget: ({ graphqlUrl, liveRatesUrl, currencies, division, locale, theme, isParamError, removePadding, logoLink, brandingSpace, }: CurrencyCrossTableConfig) => React.JSX.Element;
|
|
4
4
|
export { CurrencyCrossTableWidget };
|
|
@@ -7,6 +7,6 @@ declare const getPriceMovement: ({ previous, update, displayPrecision, isReverse
|
|
|
7
7
|
update?: number;
|
|
8
8
|
displayPrecision?: number;
|
|
9
9
|
isReversed: boolean;
|
|
10
|
-
}) =>
|
|
10
|
+
}) => 1 | 0 | -1;
|
|
11
11
|
declare const getBuyPrice: (price: number | undefined, isReversed: boolean) => number;
|
|
12
12
|
export { currenciesToInstruments, divisionMapper, getBuyPrice, getPriceMovement, validCurrencies, };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oanda/labs-currency-cross-table",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.29",
|
|
4
4
|
"description": "Labs Currency Cross Table",
|
|
5
5
|
"main": "dist/main/index.js",
|
|
6
6
|
"module": "dist/module/index.js",
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"author": "OANDA",
|
|
13
13
|
"license": "UNLICENSED",
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"@oanda/labs-widget-common": "^1.0.
|
|
15
|
+
"@oanda/labs-widget-common": "^1.0.178",
|
|
16
16
|
"@oanda/mono-i18n": "10.0.1",
|
|
17
17
|
"graphql": "16.8.1"
|
|
18
18
|
},
|
|
@@ -20,5 +20,5 @@
|
|
|
20
20
|
"@graphql-codegen/cli": "5.0.0",
|
|
21
21
|
"@graphql-codegen/client-preset": "4.1.0"
|
|
22
22
|
},
|
|
23
|
-
"gitHead": "
|
|
23
|
+
"gitHead": "413f337cba12f019aedd355e03bf695d10674701"
|
|
24
24
|
}
|
|
@@ -17,6 +17,7 @@ const CurrencyCrossTableWidget = ({
|
|
|
17
17
|
isParamError,
|
|
18
18
|
removePadding,
|
|
19
19
|
logoLink,
|
|
20
|
+
brandingSpace,
|
|
20
21
|
}: CurrencyCrossTableConfig) => {
|
|
21
22
|
const client = new ApolloClient({
|
|
22
23
|
uri: graphqlUrl,
|
|
@@ -41,7 +42,11 @@ const CurrencyCrossTableWidget = ({
|
|
|
41
42
|
theme={theme}
|
|
42
43
|
translations={translations}
|
|
43
44
|
>
|
|
44
|
-
<WidgetWrapper
|
|
45
|
+
<WidgetWrapper
|
|
46
|
+
brandingSpace={brandingSpace}
|
|
47
|
+
linkArea="full"
|
|
48
|
+
logoLink={logoLink}
|
|
49
|
+
>
|
|
45
50
|
<ValidationWrapper
|
|
46
51
|
currencies={currencies}
|
|
47
52
|
division={division}
|
|
@@ -37,7 +37,11 @@ const getPriceMovement = ({
|
|
|
37
37
|
displayPrecision
|
|
38
38
|
);
|
|
39
39
|
|
|
40
|
-
if (
|
|
40
|
+
if (
|
|
41
|
+
roundedPrevious === roundedUpdate ||
|
|
42
|
+
update === undefined ||
|
|
43
|
+
previous === undefined
|
|
44
|
+
) {
|
|
41
45
|
return 0;
|
|
42
46
|
}
|
|
43
47
|
|
package/test/utils.test.ts
CHANGED
|
@@ -154,6 +154,7 @@ describe('getPriceMovement()', () => {
|
|
|
154
154
|
[1, 163.204, 163.173, 6, true],
|
|
155
155
|
[0, 163.219, 163.219, 3, false],
|
|
156
156
|
[0, 163.219, 163.22, 6, true],
|
|
157
|
+
[0, undefined, 163.22, 2, false],
|
|
157
158
|
])(
|
|
158
159
|
'should return %s when previous = %s, update = %s, displayPrecision = %s, isReversed = %s',
|
|
159
160
|
(expected, previous, update, displayPrecision, isReversed) => {
|