@oanda/labs-currency-cross-table 1.0.4 → 1.0.5
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 +24 -0
- package/dist/main/CurrencyCrossTableWidget/utils.js +2 -2
- package/dist/main/CurrencyCrossTableWidget/utils.js.map +1 -1
- package/dist/module/CurrencyCrossTableWidget/utils.js +2 -2
- package/dist/module/CurrencyCrossTableWidget/utils.js.map +1 -1
- package/package.json +3 -3
- package/src/CurrencyCrossTableWidget/utils.ts +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,30 @@
|
|
|
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.5 (2024-08-29)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
## 1.0.153 (2024-08-23)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
## 1.0.152 (2024-08-23)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
## 1.0.151 (2024-08-20)
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
## 1.0.150 (2024-08-19)
|
|
23
|
+
|
|
24
|
+
**Note:** Version bump only for package @oanda/labs-currency-cross-table
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
6
30
|
## 1.0.4 (2024-08-23)
|
|
7
31
|
|
|
8
32
|
|
|
@@ -32,8 +32,8 @@ const useRecords = (record, target) => {
|
|
|
32
32
|
setUpdatedRecord({
|
|
33
33
|
displayName: record.displayName,
|
|
34
34
|
instrument: record.instrument,
|
|
35
|
-
buy: update?.
|
|
36
|
-
buyPriceMovement: update?.
|
|
35
|
+
buy: update?.ask,
|
|
36
|
+
buyPriceMovement: update?.askPriceMovement,
|
|
37
37
|
displayPrecision: update?.displayPrecision
|
|
38
38
|
});
|
|
39
39
|
setError(liveRatesError);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","names":["_react","require","_labsWidgetCommon","_constant","validCurrencies","currencies","every","currency","MAJOR_CURRENCIES","includes","exports","currenciesToInstruments","division","divisionMapper","pairs","reduce","acc","cV","index","array","unique","filter","_item","idx","map","el","useRecords","record","target","updatedRecord","setUpdatedRecord","useState","displayName","instrument","error","setError","update","liveRatesError","useLiveRatesMessage","useEffect","buy","
|
|
1
|
+
{"version":3,"file":"utils.js","names":["_react","require","_labsWidgetCommon","_constant","validCurrencies","currencies","every","currency","MAJOR_CURRENCIES","includes","exports","currenciesToInstruments","division","divisionMapper","pairs","reduce","acc","cV","index","array","unique","filter","_item","idx","map","el","useRecords","record","target","updatedRecord","setUpdatedRecord","useState","displayName","instrument","error","setError","update","liveRatesError","useLiveRatesMessage","useEffect","buy","ask","buyPriceMovement","askPriceMovement","displayPrecision"],"sources":["../../../src/CurrencyCrossTableWidget/utils.ts"],"sourcesContent":["import { useEffect, useState } from 'react';\nimport { DataRecord, LiveRatesErrorMessage, useLiveRatesMessage } from '@oanda/labs-widget-common';\nimport { MAJOR_CURRENCIES } from './constant';\n\nconst validCurrencies = (currencies: string[]) => currencies\n .every((currency) => MAJOR_CURRENCIES.includes(currency));\n\nconst currenciesToInstruments = (currencies: string[], division: any) => {\n const divisionMapper = division === 'OGM' ? '' : '_';\n\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}${el}`),\n ];\n }, [] as string[]);\n\n return pairs;\n};\n\nconst useRecords = (\n record: DataRecord,\n target: EventTarget | null,\n) => {\n const [updatedRecord, setUpdatedRecord] = useState<DataRecord>({\n displayName: record.displayName,\n instrument: record.instrument,\n });\n\n const [error, setError] = useState<LiveRatesErrorMessage | null>(null);\n\n const { update, error: liveRatesError } = useLiveRatesMessage(\n record.instrument,\n target,\n );\n\n useEffect(() => {\n setUpdatedRecord({\n displayName: record.displayName,\n instrument: record.instrument,\n buy: update?.ask,\n buyPriceMovement: update?.askPriceMovement,\n displayPrecision: update?.displayPrecision,\n });\n setError(liveRatesError);\n }, [update, record, liveRatesError]);\n\n return {\n updatedRecord,\n error,\n };\n};\n\nexport {\n validCurrencies,\n currenciesToInstruments,\n useRecords,\n};\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,iBAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AAEA,MAAMG,eAAe,GAAIC,UAAoB,IAAKA,UAAU,CACzDC,KAAK,CAAEC,QAAQ,IAAKC,0BAAgB,CAACC,QAAQ,CAACF,QAAQ,CAAC,CAAC;AAACG,OAAA,CAAAN,eAAA,GAAAA,eAAA;AAE5D,MAAMO,uBAAuB,GAAGA,CAACN,UAAoB,EAAEO,QAAa,KAAK;EACvE,MAAMC,cAAc,GAAGD,QAAQ,KAAK,KAAK,GAAG,EAAE,GAAG,GAAG;EAEpD,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,GAAGJ,cAAc,GAAGY,EAAE,EAAE,CAAC,CACrD;EACH,CAAC,EAAE,EAAc,CAAC;EAElB,OAAOX,KAAK;AACd,CAAC;AAACJ,OAAA,CAAAC,uBAAA,GAAAA,uBAAA;AAEF,MAAMe,UAAU,GAAGA,CACjBC,MAAkB,EAClBC,MAA0B,KACvB;EACH,MAAM,CAACC,aAAa,EAAEC,gBAAgB,CAAC,GAAG,IAAAC,eAAQ,EAAa;IAC7DC,WAAW,EAAEL,MAAM,CAACK,WAAW;IAC/BC,UAAU,EAAEN,MAAM,CAACM;EACrB,CAAC,CAAC;EAEF,MAAM,CAACC,KAAK,EAAEC,QAAQ,CAAC,GAAG,IAAAJ,eAAQ,EAA+B,IAAI,CAAC;EAEtE,MAAM;IAAEK,MAAM;IAAEF,KAAK,EAAEG;EAAe,CAAC,GAAG,IAAAC,qCAAmB,EAC3DX,MAAM,CAACM,UAAU,EACjBL,MACF,CAAC;EAED,IAAAW,gBAAS,EAAC,MAAM;IACdT,gBAAgB,CAAC;MACfE,WAAW,EAAEL,MAAM,CAACK,WAAW;MAC/BC,UAAU,EAAEN,MAAM,CAACM,UAAU;MAC7BO,GAAG,EAAEJ,MAAM,EAAEK,GAAG;MAChBC,gBAAgB,EAAEN,MAAM,EAAEO,gBAAgB;MAC1CC,gBAAgB,EAAER,MAAM,EAAEQ;IAC5B,CAAC,CAAC;IACFT,QAAQ,CAACE,cAAc,CAAC;EAC1B,CAAC,EAAE,CAACD,MAAM,EAAET,MAAM,EAAEU,cAAc,CAAC,CAAC;EAEpC,OAAO;IACLR,aAAa;IACbK;EACF,CAAC;AACH,CAAC;AAACxB,OAAA,CAAAgB,UAAA,GAAAA,UAAA","ignoreList":[]}
|
|
@@ -24,8 +24,8 @@ const useRecords = (record, target) => {
|
|
|
24
24
|
setUpdatedRecord({
|
|
25
25
|
displayName: record.displayName,
|
|
26
26
|
instrument: record.instrument,
|
|
27
|
-
buy: update?.
|
|
28
|
-
buyPriceMovement: update?.
|
|
27
|
+
buy: update?.ask,
|
|
28
|
+
buyPriceMovement: update?.askPriceMovement,
|
|
29
29
|
displayPrecision: update?.displayPrecision
|
|
30
30
|
});
|
|
31
31
|
setError(liveRatesError);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","names":["useEffect","useState","useLiveRatesMessage","MAJOR_CURRENCIES","validCurrencies","currencies","every","currency","includes","currenciesToInstruments","division","divisionMapper","pairs","reduce","acc","cV","index","array","unique","filter","_item","idx","map","el","useRecords","record","target","updatedRecord","setUpdatedRecord","displayName","instrument","error","setError","update","liveRatesError","buy","
|
|
1
|
+
{"version":3,"file":"utils.js","names":["useEffect","useState","useLiveRatesMessage","MAJOR_CURRENCIES","validCurrencies","currencies","every","currency","includes","currenciesToInstruments","division","divisionMapper","pairs","reduce","acc","cV","index","array","unique","filter","_item","idx","map","el","useRecords","record","target","updatedRecord","setUpdatedRecord","displayName","instrument","error","setError","update","liveRatesError","buy","ask","buyPriceMovement","askPriceMovement","displayPrecision"],"sources":["../../../src/CurrencyCrossTableWidget/utils.ts"],"sourcesContent":["import { useEffect, useState } from 'react';\nimport { DataRecord, LiveRatesErrorMessage, useLiveRatesMessage } from '@oanda/labs-widget-common';\nimport { MAJOR_CURRENCIES } from './constant';\n\nconst validCurrencies = (currencies: string[]) => currencies\n .every((currency) => MAJOR_CURRENCIES.includes(currency));\n\nconst currenciesToInstruments = (currencies: string[], division: any) => {\n const divisionMapper = division === 'OGM' ? '' : '_';\n\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}${el}`),\n ];\n }, [] as string[]);\n\n return pairs;\n};\n\nconst useRecords = (\n record: DataRecord,\n target: EventTarget | null,\n) => {\n const [updatedRecord, setUpdatedRecord] = useState<DataRecord>({\n displayName: record.displayName,\n instrument: record.instrument,\n });\n\n const [error, setError] = useState<LiveRatesErrorMessage | null>(null);\n\n const { update, error: liveRatesError } = useLiveRatesMessage(\n record.instrument,\n target,\n );\n\n useEffect(() => {\n setUpdatedRecord({\n displayName: record.displayName,\n instrument: record.instrument,\n buy: update?.ask,\n buyPriceMovement: update?.askPriceMovement,\n displayPrecision: update?.displayPrecision,\n });\n setError(liveRatesError);\n }, [update, record, liveRatesError]);\n\n return {\n updatedRecord,\n error,\n };\n};\n\nexport {\n validCurrencies,\n currenciesToInstruments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BJ,MACF,CAAC;EAED1B,SAAS,CAAC,MAAM;IACd4B,gBAAgB,CAAC;MACfC,WAAW,EAAEJ,MAAM,CAACI,WAAW;MAC/BC,UAAU,EAAEL,MAAM,CAACK,UAAU;MAC7BK,GAAG,EAAEF,MAAM,EAAEG,GAAG;MAChBC,gBAAgB,EAAEJ,MAAM,EAAEK,gBAAgB;MAC1CC,gBAAgB,EAAEN,MAAM,EAAEM;IAC5B,CAAC,CAAC;IACFP,QAAQ,CAACE,cAAc,CAAC;EAC1B,CAAC,EAAE,CAACD,MAAM,EAAER,MAAM,EAAES,cAAc,CAAC,CAAC;EAEpC,OAAO;IACLP,aAAa;IACbI;EACF,CAAC;AACH,CAAC;AAED,SACE3B,eAAe,EACfK,uBAAuB,EACvBe,UAAU","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oanda/labs-currency-cross-table",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.5",
|
|
4
4
|
"description": "Labs Currency Cross Table",
|
|
5
5
|
"main": "dist/main/index.js",
|
|
6
6
|
"module": "dist/module/index.js",
|
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
"author": "OANDA",
|
|
10
10
|
"license": "UNLICENSED",
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@oanda/labs-widget-common": "^1.0.
|
|
12
|
+
"@oanda/labs-widget-common": "^1.0.154",
|
|
13
13
|
"@oanda/mono-i18n": "10.0.1"
|
|
14
14
|
},
|
|
15
|
-
"gitHead": "
|
|
15
|
+
"gitHead": "c243cddcf6c1cb5f70403bae1c8c927356f33a78"
|
|
16
16
|
}
|
|
@@ -40,8 +40,8 @@ const useRecords = (
|
|
|
40
40
|
setUpdatedRecord({
|
|
41
41
|
displayName: record.displayName,
|
|
42
42
|
instrument: record.instrument,
|
|
43
|
-
buy: update?.
|
|
44
|
-
buyPriceMovement: update?.
|
|
43
|
+
buy: update?.ask,
|
|
44
|
+
buyPriceMovement: update?.askPriceMovement,
|
|
45
45
|
displayPrecision: update?.displayPrecision,
|
|
46
46
|
});
|
|
47
47
|
setError(liveRatesError);
|