@oanda/labs-spread-cost-calculator-widget 1.0.4 → 1.0.6
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 +52 -0
- package/dist/main/SpreadCostCalculatorWidget/Main.js +6 -6
- package/dist/main/SpreadCostCalculatorWidget/Main.js.map +1 -1
- package/dist/main/SpreadCostCalculatorWidget/SpreadCostCalculatorWidget.js +25 -26
- package/dist/main/SpreadCostCalculatorWidget/SpreadCostCalculatorWidget.js.map +1 -1
- package/dist/main/SpreadCostCalculatorWidget/ValidationWrapper.js +3 -4
- package/dist/main/SpreadCostCalculatorWidget/ValidationWrapper.js.map +1 -1
- package/dist/main/SpreadCostCalculatorWidget/constant.js +2 -1
- package/dist/main/SpreadCostCalculatorWidget/constant.js.map +1 -1
- package/dist/main/SpreadCostCalculatorWidget/types.js.map +1 -1
- package/dist/main/SpreadCostCalculatorWidget/useCalculateSpread.js +9 -3
- package/dist/main/SpreadCostCalculatorWidget/useCalculateSpread.js.map +1 -1
- package/dist/main/SpreadCostCalculatorWidget/useInstrumentChange.js +5 -1
- package/dist/main/SpreadCostCalculatorWidget/useInstrumentChange.js.map +1 -1
- package/dist/main/SpreadCostCalculatorWidget/utils.js +2 -9
- package/dist/main/SpreadCostCalculatorWidget/utils.js.map +1 -1
- package/dist/module/SpreadCostCalculatorWidget/Main.js +8 -8
- package/dist/module/SpreadCostCalculatorWidget/Main.js.map +1 -1
- package/dist/module/SpreadCostCalculatorWidget/SpreadCostCalculatorWidget.js +26 -26
- package/dist/module/SpreadCostCalculatorWidget/SpreadCostCalculatorWidget.js.map +1 -1
- package/dist/module/SpreadCostCalculatorWidget/ValidationWrapper.js +3 -3
- package/dist/module/SpreadCostCalculatorWidget/ValidationWrapper.js.map +1 -1
- package/dist/module/SpreadCostCalculatorWidget/constant.js +1 -0
- package/dist/module/SpreadCostCalculatorWidget/constant.js.map +1 -1
- package/dist/module/SpreadCostCalculatorWidget/types.js.map +1 -1
- package/dist/module/SpreadCostCalculatorWidget/useCalculateSpread.js +9 -3
- package/dist/module/SpreadCostCalculatorWidget/useCalculateSpread.js.map +1 -1
- package/dist/module/SpreadCostCalculatorWidget/useInstrumentChange.js +5 -1
- package/dist/module/SpreadCostCalculatorWidget/useInstrumentChange.js.map +1 -1
- package/dist/module/SpreadCostCalculatorWidget/utils.js +2 -9
- package/dist/module/SpreadCostCalculatorWidget/utils.js.map +1 -1
- package/dist/types/SpreadCostCalculatorWidget/constant.d.ts +1 -0
- package/dist/types/SpreadCostCalculatorWidget/types.d.ts +2 -2
- package/dist/types/SpreadCostCalculatorWidget/useCalculateSpread.d.ts +2 -1
- package/dist/types/SpreadCostCalculatorWidget/useInstrumentChange.d.ts +1 -0
- package/dist/types/SpreadCostCalculatorWidget/utils.d.ts +1 -2
- package/package.json +3 -3
- package/src/SpreadCostCalculatorWidget/Main.tsx +6 -6
- package/src/SpreadCostCalculatorWidget/SpreadCostCalculatorWidget.tsx +28 -27
- package/src/SpreadCostCalculatorWidget/ValidationWrapper.tsx +3 -3
- package/src/SpreadCostCalculatorWidget/constant.ts +1 -0
- package/src/SpreadCostCalculatorWidget/types.ts +2 -5
- package/src/SpreadCostCalculatorWidget/useCalculateSpread.ts +14 -2
- package/src/SpreadCostCalculatorWidget/useInstrumentChange.ts +4 -0
- package/src/SpreadCostCalculatorWidget/utils.ts +2 -11
- package/test/SpreadCostCalculator.test.tsx +8 -3
- package/test/useCalculateSpread.test.tsx +15 -11
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,58 @@
|
|
|
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.6 (2024-12-11)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
## 1.0.172 (2024-11-29)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
## 1.0.171 (2024-11-28)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
## 1.0.170 (2024-11-28)
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
## 1.0.169 (2024-11-20)
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
## 1.0.168 (2024-11-19)
|
|
27
|
+
|
|
28
|
+
**Note:** Version bump only for package @oanda/labs-spread-cost-calculator-widget
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
## 1.0.5 (2024-11-29)
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
## 1.0.171 (2024-11-28)
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
## 1.0.170 (2024-11-28)
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
## 1.0.169 (2024-11-20)
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
## 1.0.168 (2024-11-19)
|
|
51
|
+
|
|
52
|
+
**Note:** Version bump only for package @oanda/labs-spread-cost-calculator-widget
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
|
|
6
58
|
## 1.0.4 (2024-11-28)
|
|
7
59
|
|
|
8
60
|
|
|
@@ -8,9 +8,7 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
8
8
|
var _monoI18n = require("@oanda/mono-i18n");
|
|
9
9
|
var _labsWidgetCommon = require("@oanda/labs-widget-common");
|
|
10
10
|
var _useCalculateSpread = require("./useCalculateSpread");
|
|
11
|
-
var _utils = require("./utils");
|
|
12
11
|
var _useInstrumentChange = require("./useInstrumentChange");
|
|
13
|
-
var _constant = require("./constant");
|
|
14
12
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
15
13
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
16
14
|
const Main = _ref => {
|
|
@@ -19,7 +17,7 @@ const Main = _ref => {
|
|
|
19
17
|
} = _ref;
|
|
20
18
|
const {
|
|
21
19
|
size
|
|
22
|
-
} = (0,
|
|
20
|
+
} = (0, _labsWidgetCommon.useLayoutProvider)();
|
|
23
21
|
const isDesktop = size === _labsWidgetCommon.Size.DESKTOP;
|
|
24
22
|
const selectOptions = instruments.map(instrument => ({
|
|
25
23
|
id: instrument.name,
|
|
@@ -45,7 +43,8 @@ const Main = _ref => {
|
|
|
45
43
|
pipLocation,
|
|
46
44
|
initialSpread,
|
|
47
45
|
loading,
|
|
48
|
-
error
|
|
46
|
+
error,
|
|
47
|
+
currency
|
|
49
48
|
} = (0, _useInstrumentChange.useInstrumentChange)({
|
|
50
49
|
initialInstrument: {
|
|
51
50
|
id: instruments[0].name,
|
|
@@ -65,7 +64,8 @@ const Main = _ref => {
|
|
|
65
64
|
const spreadCost = (0, _useCalculateSpread.useCalculateSpread)({
|
|
66
65
|
spread,
|
|
67
66
|
unitsTraded,
|
|
68
|
-
pipLocation
|
|
67
|
+
pipLocation,
|
|
68
|
+
currency
|
|
69
69
|
});
|
|
70
70
|
return _react.default.createElement(_react.default.Fragment, null, error ? _react.default.createElement("div", {
|
|
71
71
|
className: "lw-flex lw-h-[300px] lw-w-full lw-items-center lw-border lw-border-solid lw-border-border-primary"
|
|
@@ -109,7 +109,7 @@ const Main = _ref => {
|
|
|
109
109
|
className: "lw-pt-4 lw-text-text-primary"
|
|
110
110
|
}, _react.default.createElement("div", null, lang('absolute_spread_cost')), _react.default.createElement("div", {
|
|
111
111
|
className: "lw-pt-2 lw-text-3xl lw-font-bold"
|
|
112
|
-
}, spreadCost
|
|
112
|
+
}, spreadCost)))));
|
|
113
113
|
};
|
|
114
114
|
exports.Main = Main;
|
|
115
115
|
//# sourceMappingURL=Main.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Main.js","names":["_react","_interopRequireWildcard","require","_monoI18n","_labsWidgetCommon","_useCalculateSpread","
|
|
1
|
+
{"version":3,"file":"Main.js","names":["_react","_interopRequireWildcard","require","_monoI18n","_labsWidgetCommon","_useCalculateSpread","_useInstrumentChange","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","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","searchPlaceholder","options","selectedOption","setSelectedOption","maxHeight","cn","NumberInput","onValueChange","onIncrement","onDecrement","placeholder","disabled","withoutArrows","exports"],"sources":["../../../src/SpreadCostCalculatorWidget/Main.tsx"],"sourcesContent":["import React, {\n FC, useEffect,\n} from 'react';\nimport { useLocale } from '@oanda/mono-i18n';\nimport {\n ChartError,\n cn,\n Label,\n NumberInput,\n Select,\n Size,\n useLayoutProvider,\n useNumberFormat,\n} from '@oanda/labs-widget-common';\nimport { useCalculateSpread } from './useCalculateSpread';\nimport { useInstrumentChange } from './useInstrumentChange';\nimport { MainProps } from './types';\n\nconst Main: FC<MainProps> = ({\n instruments,\n}) => {\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 data-testid=\"spread-cost-calculator\"\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 >\n <div className=\"lw-flex lw-flex-col lw-gap-2\">\n <Label htmlFor={lang('instrument')} className=\"lw-text-text-primary\">\n {lang('instrument')}\n </Label>\n <Select\n searchPlaceholder={lang('search')}\n options={selectOptions}\n selectedOption={selectedInstrument}\n className=\"lw-grow-0\"\n setSelectedOption={setSelectedInstrument}\n maxHeight={isDesktop ? 190 : 220}\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 className={cn('lw-flex lw-max-w-full lw-flex-row lw-gap-3', !isDesktop && 'lw-flex-col lw-gap-8')}>\n <NumberInput\n onValueChange={onUnitChange}\n value={unitsTraded}\n label={lang('units_traded')}\n onIncrement={incrementTradedUnits}\n onDecrement={decrementTradedUnits}\n placeholder={lang('volume')}\n disabled={loading}\n withoutArrows\n />\n <NumberInput\n onValueChange={onSpreadChange}\n value={spread}\n label={lang('spread')}\n onIncrement={incrementSpread}\n onDecrement={decrementSpread}\n placeholder={lang('pips')}\n disabled={loading}\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,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AAGA,IAAAC,SAAA,GAAAD,OAAA;AACA,IAAAE,iBAAA,GAAAF,OAAA;AAUA,IAAAG,mBAAA,GAAAH,OAAA;AACA,IAAAI,oBAAA,GAAAJ,OAAA;AAA4D,SAAAK,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAP,wBAAAO,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAI,UAAA,SAAAJ,CAAA,eAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,WAAAK,OAAA,EAAAL,CAAA,QAAAG,CAAA,GAAAJ,wBAAA,CAAAG,CAAA,OAAAC,CAAA,IAAAA,CAAA,CAAAG,GAAA,CAAAN,CAAA,UAAAG,CAAA,CAAAI,GAAA,CAAAP,CAAA,OAAAQ,CAAA,KAAAC,SAAA,UAAAC,CAAA,GAAAC,MAAA,CAA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C1BsB,QAAQ,EAAE/B;EAAQ,CACnB,CACE,CAAC,EACN5D,MAAA,CAAAa,OAAA,CAAA4D,aAAA;IAAKE,SAAS,EAAC;EAA8B,GAC3C3E,MAAA,CAAAa,OAAA,CAAA4D,aAAA,cAAMJ,IAAI,CAAC,sBAAsB,CAAO,CAAC,EACzCrE,MAAA,CAAAa,OAAA,CAAA4D,aAAA;IAAKE,SAAS,EAAC;EAAkC,GAC9CJ,UACE,CACF,CACF,CACF,CAEP,CAAC;AAEP,CAAC;AAACsB,OAAA,CAAAlE,IAAA,GAAAA,IAAA","ignoreList":[]}
|
|
@@ -4,15 +4,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.SpreadCostCalculatorWidget = void 0;
|
|
7
|
-
var _react =
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
8
|
var _client = require("@apollo/client");
|
|
9
9
|
var _labsWidgetCommon = require("@oanda/labs-widget-common");
|
|
10
10
|
var _labsLiveRatesTableWidget = require("@oanda/labs-live-rates-table-widget");
|
|
11
|
-
var _monoI18n = require("@oanda/mono-i18n");
|
|
12
11
|
var _translations = require("../translations");
|
|
13
12
|
var _ValidationWrapper = require("./ValidationWrapper");
|
|
14
|
-
function
|
|
15
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
13
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
16
14
|
const SpreadCostCalculatorWidget = _ref => {
|
|
17
15
|
let {
|
|
18
16
|
graphqlUrl,
|
|
@@ -31,29 +29,30 @@ const SpreadCostCalculatorWidget = _ref => {
|
|
|
31
29
|
});
|
|
32
30
|
const divisionCode = division === _labsLiveRatesTableWidget.Division.Opt ? _labsLiveRatesTableWidget.Division.Ogm : division;
|
|
33
31
|
const dataSource = divisionCode === _labsLiveRatesTableWidget.Division.Ogm ? 'MT5' : 'V20';
|
|
34
|
-
return _react.default.createElement(
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
options: {
|
|
40
|
-
divisionCode,
|
|
41
|
-
dataSource
|
|
42
|
-
}
|
|
43
|
-
}, _react.default.createElement(_client.ApolloProvider, {
|
|
44
|
-
client: client
|
|
45
|
-
}, _react.default.createElement(_react.Suspense, null, _react.default.createElement(_labsWidgetCommon.ThemeProvider, {
|
|
32
|
+
return _react.default.createElement(_labsWidgetCommon.WidgetProvider, {
|
|
33
|
+
withSuspense: true,
|
|
34
|
+
locale: locale,
|
|
35
|
+
translations: _translations.translations,
|
|
36
|
+
client: client,
|
|
46
37
|
theme: theme,
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
38
|
+
styling: {
|
|
39
|
+
removePadding
|
|
40
|
+
},
|
|
41
|
+
liveRates: {
|
|
42
|
+
url: liveRatesUrl,
|
|
43
|
+
options: {
|
|
44
|
+
divisionCode,
|
|
45
|
+
dataSource
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}, _react.default.createElement(_labsWidgetCommon.WidgetWrapper, {
|
|
49
|
+
logoLink: logoLink,
|
|
50
|
+
linkArea: "logo"
|
|
51
|
+
}, _react.default.createElement(_ValidationWrapper.ValidationWrapper, {
|
|
52
|
+
instruments: instruments,
|
|
53
|
+
division: division,
|
|
54
|
+
isParamError: isParamError
|
|
55
|
+
})));
|
|
57
56
|
};
|
|
58
57
|
exports.SpreadCostCalculatorWidget = SpreadCostCalculatorWidget;
|
|
59
58
|
//# sourceMappingURL=SpreadCostCalculatorWidget.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SpreadCostCalculatorWidget.js","names":["_react","
|
|
1
|
+
{"version":3,"file":"SpreadCostCalculatorWidget.js","names":["_react","_interopRequireDefault","require","_client","_labsWidgetCommon","_labsLiveRatesTableWidget","_translations","_ValidationWrapper","e","__esModule","default","SpreadCostCalculatorWidget","_ref","graphqlUrl","liveRatesUrl","theme","locale","isParamError","removePadding","division","instruments","logoLink","client","ApolloClient","uri","cache","InMemoryCache","divisionCode","Division","Opt","Ogm","dataSource","createElement","WidgetProvider","withSuspense","translations","styling","liveRates","url","options","WidgetWrapper","linkArea","ValidationWrapper","exports"],"sources":["../../../src/SpreadCostCalculatorWidget/SpreadCostCalculatorWidget.tsx"],"sourcesContent":["import React, { FC } from 'react';\nimport { ApolloClient, InMemoryCache } from '@apollo/client';\nimport { WidgetProvider, WidgetWrapper } from '@oanda/labs-widget-common';\n\nimport { Division } from '@oanda/labs-live-rates-table-widget';\nimport { SpreadCostCalculatorWidgetConfig } from './types';\nimport { translations } from '../translations';\nimport { ValidationWrapper } from './ValidationWrapper';\n\nconst SpreadCostCalculatorWidget: FC<SpreadCostCalculatorWidgetConfig> = ({\n graphqlUrl,\n liveRatesUrl,\n theme,\n locale,\n isParamError,\n removePadding,\n division,\n instruments,\n logoLink,\n}) => {\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 locale={locale}\n translations={translations}\n client={client}\n theme={theme}\n styling={{\n removePadding,\n }}\n liveRates={{\n url: liveRatesUrl,\n options: { divisionCode, dataSource },\n }}\n >\n <WidgetWrapper\n logoLink={logoLink}\n linkArea=\"logo\"\n >\n <ValidationWrapper\n instruments={instruments}\n division={division}\n isParamError={isParamError}\n />\n </WidgetWrapper>\n </WidgetProvider>\n );\n};\n\nexport { SpreadCostCalculatorWidget };\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,iBAAA,GAAAF,OAAA;AAEA,IAAAG,yBAAA,GAAAH,OAAA;AAEA,IAAAI,aAAA,GAAAJ,OAAA;AACA,IAAAK,kBAAA,GAAAL,OAAA;AAAwD,SAAAD,uBAAAO,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAExD,MAAMG,0BAAgE,GAAGC,IAAA,IAUnE;EAAA,IAVoE;IACxEC,UAAU;IACVC,YAAY;IACZC,KAAK;IACLC,MAAM;IACNC,YAAY;IACZC,aAAa;IACbC,QAAQ;IACRC,WAAW;IACXC;EACF,CAAC,GAAAT,IAAA;EACC,MAAMU,MAAM,GAAG,IAAIC,oBAAY,CAAC;IAC9BC,GAAG,EAAEX,UAAU;IACfY,KAAK,EAAE,IAAIC,qBAAa,CAAC;EAC3B,CAAC,CAAC;EAEF,MAAMC,YAAY,GAAGR,QAAQ,KAAKS,kCAAQ,CAACC,GAAG,GAAGD,kCAAQ,CAACE,GAAG,GAAGX,QAAQ;EACxE,MAAMY,UAAU,GAAGJ,YAAY,KAAKC,kCAAQ,CAACE,GAAG,GAAG,KAAK,GAAG,KAAK;EAEhE,OACE9B,MAAA,CAAAU,OAAA,CAAAsB,aAAA,CAAC5B,iBAAA,CAAA6B,cAAc;IACbC,YAAY;IACZlB,MAAM,EAAEA,MAAO;IACfmB,YAAY,EAAEA,0BAAa;IAC3Bb,MAAM,EAAEA,MAAO;IACfP,KAAK,EAAEA,KAAM;IACbqB,OAAO,EAAE;MACPlB;IACF,CAAE;IACFmB,SAAS,EAAE;MACTC,GAAG,EAAExB,YAAY;MACjByB,OAAO,EAAE;QAAEZ,YAAY;QAAEI;MAAW;IACtC;EAAE,GAEF/B,MAAA,CAAAU,OAAA,CAAAsB,aAAA,CAAC5B,iBAAA,CAAAoC,aAAa;IACZnB,QAAQ,EAAEA,QAAS;IACnBoB,QAAQ,EAAC;EAAM,GAEfzC,MAAA,CAAAU,OAAA,CAAAsB,aAAA,CAACzB,kBAAA,CAAAmC,iBAAiB;IAChBtB,WAAW,EAAEA,WAAY;IACzBD,QAAQ,EAAEA,QAAS;IACnBF,YAAY,EAAEA;EAAa,CAC5B,CACY,CACD,CAAC;AAErB,CAAC;AAAC0B,OAAA,CAAAhC,0BAAA,GAAAA,0BAAA","ignoreList":[]}
|
|
@@ -4,13 +4,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.ValidationWrapper = void 0;
|
|
7
|
-
var _react =
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
8
|
var _client = require("@apollo/client");
|
|
9
9
|
var _labsWidgetCommon = require("@oanda/labs-widget-common");
|
|
10
10
|
var _Main = require("./Main");
|
|
11
11
|
var _validateInstruments = require("../gql/validateInstruments");
|
|
12
|
-
function
|
|
13
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
12
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
14
13
|
const ValidationWrapper = _ref => {
|
|
15
14
|
let {
|
|
16
15
|
division,
|
|
@@ -19,7 +18,7 @@ const ValidationWrapper = _ref => {
|
|
|
19
18
|
} = _ref;
|
|
20
19
|
const {
|
|
21
20
|
size
|
|
22
|
-
} = (0,
|
|
21
|
+
} = (0, _labsWidgetCommon.useLayoutProvider)();
|
|
23
22
|
const {
|
|
24
23
|
data,
|
|
25
24
|
error
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ValidationWrapper.js","names":["_react","
|
|
1
|
+
{"version":3,"file":"ValidationWrapper.js","names":["_react","_interopRequireDefault","require","_client","_labsWidgetCommon","_Main","_validateInstruments","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 React from 'react';\nimport { useSuspenseQuery } from '@apollo/client';\nimport { ChartError, useLayoutProvider } from '@oanda/labs-widget-common';\nimport { Main } from './Main';\nimport { validateInstruments } from '../gql/validateInstruments';\nimport { ValidateInstrumentsQuery, ValidateInstrumentsQueryVariables } from '../gql/types/graphql';\nimport { 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 = 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={inst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AC;EAAmG,GAChHjC,MAAA,CAAAS,OAAA,CAAAsB,aAAA,CAAC3B,iBAAA,CAAA8B,UAAU,MAAE,CACV,CAAC,GAENlC,MAAA,CAAAS,OAAA,CAAAsB,aAAA,CAAC1B,KAAA,CAAA8B,IAAI;IAACtB,WAAW,EAAEW;EAAgB,CAAE,CAEvC,CAEF,CAAC;AAEP,CAAC;AAACY,OAAA,CAAA1B,iBAAA,GAAAA,iBAAA","ignoreList":[]}
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.CELL_EMPTY_VALUE = void 0;
|
|
6
|
+
exports.DEFAULT_CURRENCY = exports.CELL_EMPTY_VALUE = void 0;
|
|
7
7
|
const CELL_EMPTY_VALUE = exports.CELL_EMPTY_VALUE = '\u2014';
|
|
8
|
+
const DEFAULT_CURRENCY = exports.DEFAULT_CURRENCY = 'USD';
|
|
8
9
|
//# sourceMappingURL=constant.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constant.js","names":["CELL_EMPTY_VALUE","exports"],"sources":["../../../src/SpreadCostCalculatorWidget/constant.ts"],"sourcesContent":["export const CELL_EMPTY_VALUE = '\\u2014';\n"],"mappings":";;;;;;AAAO,MAAMA,gBAAgB,GAAAC,OAAA,CAAAD,gBAAA,GAAG,QAAQ","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"constant.js","names":["CELL_EMPTY_VALUE","exports","DEFAULT_CURRENCY"],"sources":["../../../src/SpreadCostCalculatorWidget/constant.ts"],"sourcesContent":["export const CELL_EMPTY_VALUE = '\\u2014';\nexport const DEFAULT_CURRENCY = 'USD';\n"],"mappings":";;;;;;AAAO,MAAMA,gBAAgB,GAAAC,OAAA,CAAAD,gBAAA,GAAG,QAAQ;AACjC,MAAME,gBAAgB,GAAAD,OAAA,CAAAC,gBAAA,GAAG,KAAK","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","names":["_monoI18n","require"],"sources":["../../../src/SpreadCostCalculatorWidget/types.ts"],"sourcesContent":["import { WidgetConfig
|
|
1
|
+
{"version":3,"file":"types.js","names":["_monoI18n","require"],"sources":["../../../src/SpreadCostCalculatorWidget/types.ts"],"sourcesContent":["import { WidgetConfig } from '@oanda/labs-widget-common';\nimport { Division } from '../gql/types/graphql';\n\nexport { Locale } from '@oanda/mono-i18n';\n\nexport type SpreadCostCalculatorWidgetConfig = WidgetConfig & {\n liveRatesUrl: string;\n division: Division;\n instruments: string[];\n};\n\nexport type InstrumentResponse = {\n name: string;\n displayName: string;\n};\n\nexport type MainProps = {\n instruments: InstrumentResponse[];\n};\n\nexport interface ValidationWrapperProps {\n division: Division;\n instruments: string[];\n isParamError?: boolean;\n}\n"],"mappings":";;;;;;;;;;;AAGA,IAAAA,SAAA,GAAAC,OAAA","ignoreList":[]}
|
|
@@ -6,17 +6,23 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.useCalculateSpread = void 0;
|
|
7
7
|
var _usehooksTs = require("usehooks-ts");
|
|
8
8
|
var _react = require("react");
|
|
9
|
+
var _reactNumberFormat = require("react-number-format");
|
|
10
|
+
var _constant = require("./constant");
|
|
9
11
|
const calculateAbsoluteSpreadCost = (unitsTraded, spread, pipLocation) => unitsTraded !== undefined && spread !== undefined && pipLocation !== undefined ? Math.ceil(unitsTraded * spread * Number((10 ** pipLocation).toFixed(Math.abs(pipLocation))) / 2 * 10000) / 10000 : undefined;
|
|
10
12
|
const useCalculateSpread = _ref => {
|
|
11
13
|
let {
|
|
12
14
|
spread,
|
|
13
15
|
unitsTraded,
|
|
14
16
|
pipLocation,
|
|
15
|
-
delay = 350
|
|
17
|
+
delay = 350,
|
|
18
|
+
currency
|
|
16
19
|
} = _ref;
|
|
17
|
-
const [debouncedValue, setValue] = (0, _usehooksTs.useDebounceValue)(
|
|
20
|
+
const [debouncedValue, setValue] = (0, _usehooksTs.useDebounceValue)(_constant.CELL_EMPTY_VALUE, delay);
|
|
18
21
|
(0, _react.useEffect)(() => {
|
|
19
|
-
|
|
22
|
+
const calculatedSpread = calculateAbsoluteSpreadCost(unitsTraded, spread, pipLocation);
|
|
23
|
+
setValue(calculatedSpread ? `${(0, _reactNumberFormat.numericFormatter)(calculatedSpread.toString(), {
|
|
24
|
+
thousandSeparator: ','
|
|
25
|
+
})} ${currency}` : _constant.CELL_EMPTY_VALUE);
|
|
20
26
|
}, [spread, unitsTraded, pipLocation, setValue]);
|
|
21
27
|
return debouncedValue;
|
|
22
28
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useCalculateSpread.js","names":["_usehooksTs","require","_react","calculateAbsoluteSpreadCost","unitsTraded","spread","pipLocation","undefined","Math","ceil","Number","toFixed","abs","useCalculateSpread","_ref","delay","debouncedValue","setValue","useDebounceValue","useEffect","exports"],"sources":["../../../src/SpreadCostCalculatorWidget/useCalculateSpread.ts"],"sourcesContent":["import { useDebounceValue } from 'usehooks-ts';\nimport { useEffect } from 'react';\nimport { Voidable } from '@oanda/labs-widget-common';\n\nexport type UseCalculateSpreadInput = {\n spread: Voidable<number>;\n unitsTraded: Voidable<number>;\n pipLocation: Voidable<number>;\n delay?: number;\n};\n\nconst calculateAbsoluteSpreadCost = (\n unitsTraded?: number,\n spread?: number,\n pipLocation?: number,\n): number | undefined => (unitsTraded !== undefined\n && spread !== undefined\n && pipLocation !== undefined\n ? Math.ceil(\n ((unitsTraded * spread * Number((10 ** pipLocation).toFixed(Math.abs(pipLocation)))) / 2)\n * 10000,\n ) / 10000\n : undefined);\n\nexport const useCalculateSpread = ({\n spread,\n unitsTraded,\n pipLocation,\n delay = 350,\n}: UseCalculateSpreadInput) => {\n const [debouncedValue, setValue] = useDebounceValue
|
|
1
|
+
{"version":3,"file":"useCalculateSpread.js","names":["_usehooksTs","require","_react","_reactNumberFormat","_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 { useDebounceValue } from 'usehooks-ts';\nimport { useEffect } from 'react';\nimport { Voidable } from '@oanda/labs-widget-common';\nimport { numericFormatter } from 'react-number-format';\nimport { CELL_EMPTY_VALUE } from './constant';\n\nexport type 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 => (unitsTraded !== undefined\n && spread !== undefined\n && pipLocation !== undefined\n ? Math.ceil(\n ((unitsTraded * spread * Number((10 ** pipLocation).toFixed(Math.abs(pipLocation)))) / 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(unitsTraded, spread, pipLocation);\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":";;;;;;AAAA,IAAAA,WAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AAEA,IAAAE,kBAAA,GAAAF,OAAA;AACA,IAAAG,SAAA,GAAAH,OAAA;AAUA,MAAMI,2BAA2B,GAAGA,CAClCC,WAAoB,EACpBC,MAAe,EACfC,WAAoB,KACIF,WAAW,KAAKG,SAAS,IAC9CF,MAAM,KAAKE,SAAS,IACpBD,WAAW,KAAKC,SAAS,GAC1BC,IAAI,CAACC,IAAI,CACPL,WAAW,GAAGC,MAAM,GAAGK,MAAM,CAAC,CAAC,EAAE,IAAIJ,WAAW,EAAEK,OAAO,CAACH,IAAI,CAACI,GAAG,CAACN,WAAW,CAAC,CAAC,CAAC,GAAI,CAAC,GAChF,KACV,CAAC,GAAG,KAAK,GACPC,SAAU;AAEP,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,CAACC,WAAW,EAAEC,MAAM,EAAEC,WAAW,CAAC;IACtFY,QAAQ,CACNI,gBAAgB,GACZ,GAAG,IAAAC,mCAAgB,EAACD,gBAAgB,CAACE,QAAQ,CAAC,CAAC,EAAE;MACjDC,iBAAiB,EAAE;IACrB,CAAC,CAAC,IAAIT,QAAQ,EAAE,GACdI,0BACN,CAAC;EAEH,CAAC,EAAE,CAACf,MAAM,EAAED,WAAW,EAAEE,WAAW,EAAEY,QAAQ,CAAC,CAAC;EAEhD,OAAOD,cAAc;AACvB,CAAC;AAACS,OAAA,CAAAb,kBAAA,GAAAA,kBAAA","ignoreList":[]}
|
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.useInstrumentChange = void 0;
|
|
7
7
|
var _labsWidgetCommon = require("@oanda/labs-widget-common");
|
|
8
8
|
var _react = require("react");
|
|
9
|
+
var _utils = require("./utils");
|
|
9
10
|
const useInstrumentChange = _ref => {
|
|
10
11
|
let {
|
|
11
12
|
initialInstrument
|
|
@@ -19,6 +20,7 @@ const useInstrumentChange = _ref => {
|
|
|
19
20
|
const [selectedInstrument, setSelectedInstrument] = (0, _react.useState)(initialInstrument);
|
|
20
21
|
const [pipLocation, setPipLocation] = (0, _react.useState)(undefined);
|
|
21
22
|
const [initialSpread, setSpread] = (0, _react.useState)(undefined);
|
|
23
|
+
const [currency, setCurrency] = (0, _react.useState)('');
|
|
22
24
|
const {
|
|
23
25
|
update,
|
|
24
26
|
error,
|
|
@@ -37,6 +39,7 @@ const useInstrumentChange = _ref => {
|
|
|
37
39
|
setQuery({
|
|
38
40
|
instruments: [selectedInstrument.id]
|
|
39
41
|
});
|
|
42
|
+
setCurrency((0, _utils.getInstrumentCurrency)(selectedInstrument.label));
|
|
40
43
|
}, [selectedInstrument.id]);
|
|
41
44
|
return {
|
|
42
45
|
selectedInstrument,
|
|
@@ -44,7 +47,8 @@ const useInstrumentChange = _ref => {
|
|
|
44
47
|
pipLocation,
|
|
45
48
|
initialSpread,
|
|
46
49
|
loading,
|
|
47
|
-
error: !!error || !!connectionError
|
|
50
|
+
error: !!error || !!connectionError,
|
|
51
|
+
currency
|
|
48
52
|
};
|
|
49
53
|
};
|
|
50
54
|
exports.useInstrumentChange = useInstrumentChange;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useInstrumentChange.js","names":["_labsWidgetCommon","require","_react","useInstrumentChange","_ref","initialInstrument","target","setQuery","closeQuery","useLiveRatesQuery","loading","setLoading","useState","selectedInstrument","setSelectedInstrument","pipLocation","setPipLocation","undefined","initialSpread","setSpread","update","error","connectionError","useLiveRatesMessage","id","useEffect","symbol","spread","instruments","exports"],"sources":["../../../src/SpreadCostCalculatorWidget/useInstrumentChange.ts"],"sourcesContent":["import { SelectOption, useLiveRatesMessage, useLiveRatesQuery } from '@oanda/labs-widget-common';\nimport { useEffect, useState } from 'react';\n\nexport type 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] = useState(initialInstrument);\n const [pipLocation, setPipLocation] = useState<undefined | number>(undefined);\n const [initialSpread, setSpread] = useState<undefined | number>(undefined);\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 // 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 };\n};\n"],"mappings":";;;;;;AAAA,IAAAA,iBAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AAMO,
|
|
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 { SelectOption, useLiveRatesMessage, useLiveRatesQuery } from '@oanda/labs-widget-common';\nimport { useEffect, useState } from 'react';\nimport { getInstrumentCurrency } from './utils';\n\nexport type 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] = 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":";;;;;;AAAA,IAAAA,iBAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AACA,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,GAAG,IAAAF,eAAQ,EAACP,iBAAiB,CAAC;EAC/E,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":[]}
|
|
@@ -4,14 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.getInstrumentCurrency = void 0;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
return instrument.split('_')[1] || ' ';
|
|
10
|
-
}
|
|
11
|
-
if (instrument?.name) {
|
|
12
|
-
return instrument.name.split('_')[1] || ' ';
|
|
13
|
-
}
|
|
14
|
-
return ' ';
|
|
15
|
-
};
|
|
7
|
+
var _constant = require("./constant");
|
|
8
|
+
const getInstrumentCurrency = instrument => instrument.split('/')[1] || _constant.DEFAULT_CURRENCY;
|
|
16
9
|
exports.getInstrumentCurrency = getInstrumentCurrency;
|
|
17
10
|
//# sourceMappingURL=utils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","names":["getInstrumentCurrency","instrument","split","
|
|
1
|
+
{"version":3,"file":"utils.js","names":["_constant","require","getInstrumentCurrency","instrument","split","DEFAULT_CURRENCY","exports"],"sources":["../../../src/SpreadCostCalculatorWidget/utils.ts"],"sourcesContent":["import { DEFAULT_CURRENCY } from './constant';\n\nexport const getInstrumentCurrency = (instrument: string): string => instrument.split('/')[1] || DEFAULT_CURRENCY;\n"],"mappings":";;;;;;AAAA,IAAAA,SAAA,GAAAC,OAAA;AAEO,MAAMC,qBAAqB,GAAIC,UAAkB,IAAaA,UAAU,CAACC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAIC,0BAAgB;AAACC,OAAA,CAAAJ,qBAAA,GAAAA,qBAAA","ignoreList":[]}
|
|
@@ -1,17 +1,15 @@
|
|
|
1
|
-
import React, {
|
|
1
|
+
import React, { useEffect } from 'react';
|
|
2
2
|
import { useLocale } from '@oanda/mono-i18n';
|
|
3
|
-
import { ChartError, cn, Label, NumberInput, Select, Size,
|
|
3
|
+
import { ChartError, cn, Label, NumberInput, Select, Size, useLayoutProvider, useNumberFormat } from '@oanda/labs-widget-common';
|
|
4
4
|
import { useCalculateSpread } from './useCalculateSpread';
|
|
5
|
-
import { getInstrumentCurrency } from './utils';
|
|
6
5
|
import { useInstrumentChange } from './useInstrumentChange';
|
|
7
|
-
import { CELL_EMPTY_VALUE } from './constant';
|
|
8
6
|
const Main = _ref => {
|
|
9
7
|
let {
|
|
10
8
|
instruments
|
|
11
9
|
} = _ref;
|
|
12
10
|
const {
|
|
13
11
|
size
|
|
14
|
-
} =
|
|
12
|
+
} = useLayoutProvider();
|
|
15
13
|
const isDesktop = size === Size.DESKTOP;
|
|
16
14
|
const selectOptions = instruments.map(instrument => ({
|
|
17
15
|
id: instrument.name,
|
|
@@ -37,7 +35,8 @@ const Main = _ref => {
|
|
|
37
35
|
pipLocation,
|
|
38
36
|
initialSpread,
|
|
39
37
|
loading,
|
|
40
|
-
error
|
|
38
|
+
error,
|
|
39
|
+
currency
|
|
41
40
|
} = useInstrumentChange({
|
|
42
41
|
initialInstrument: {
|
|
43
42
|
id: instruments[0].name,
|
|
@@ -57,7 +56,8 @@ const Main = _ref => {
|
|
|
57
56
|
const spreadCost = useCalculateSpread({
|
|
58
57
|
spread,
|
|
59
58
|
unitsTraded,
|
|
60
|
-
pipLocation
|
|
59
|
+
pipLocation,
|
|
60
|
+
currency
|
|
61
61
|
});
|
|
62
62
|
return React.createElement(React.Fragment, null, error ? React.createElement("div", {
|
|
63
63
|
className: "lw-flex lw-h-[300px] lw-w-full lw-items-center lw-border lw-border-solid lw-border-border-primary"
|
|
@@ -101,7 +101,7 @@ const Main = _ref => {
|
|
|
101
101
|
className: "lw-pt-4 lw-text-text-primary"
|
|
102
102
|
}, React.createElement("div", null, lang('absolute_spread_cost')), React.createElement("div", {
|
|
103
103
|
className: "lw-pt-2 lw-text-3xl lw-font-bold"
|
|
104
|
-
}, spreadCost
|
|
104
|
+
}, spreadCost)))));
|
|
105
105
|
};
|
|
106
106
|
export { Main };
|
|
107
107
|
//# sourceMappingURL=Main.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Main.js","names":["React","
|
|
1
|
+
{"version":3,"file":"Main.js","names":["React","useEffect","useLocale","ChartError","cn","Label","NumberInput","Select","Size","useLayoutProvider","useNumberFormat","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","searchPlaceholder","options","selectedOption","setSelectedOption","maxHeight","onValueChange","onIncrement","onDecrement","placeholder","disabled","withoutArrows"],"sources":["../../../src/SpreadCostCalculatorWidget/Main.tsx"],"sourcesContent":["import React, {\n FC, useEffect,\n} from 'react';\nimport { useLocale } from '@oanda/mono-i18n';\nimport {\n ChartError,\n cn,\n Label,\n NumberInput,\n Select,\n Size,\n useLayoutProvider,\n useNumberFormat,\n} from '@oanda/labs-widget-common';\nimport { useCalculateSpread } from './useCalculateSpread';\nimport { useInstrumentChange } from './useInstrumentChange';\nimport { MainProps } from './types';\n\nconst Main: FC<MainProps> = ({\n instruments,\n}) => {\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 data-testid=\"spread-cost-calculator\"\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 >\n <div className=\"lw-flex lw-flex-col lw-gap-2\">\n <Label htmlFor={lang('instrument')} className=\"lw-text-text-primary\">\n {lang('instrument')}\n </Label>\n <Select\n searchPlaceholder={lang('search')}\n options={selectOptions}\n selectedOption={selectedInstrument}\n className=\"lw-grow-0\"\n setSelectedOption={setSelectedInstrument}\n maxHeight={isDesktop ? 190 : 220}\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 className={cn('lw-flex lw-max-w-full lw-flex-row lw-gap-3', !isDesktop && 'lw-flex-col lw-gap-8')}>\n <NumberInput\n onValueChange={onUnitChange}\n value={unitsTraded}\n label={lang('units_traded')}\n onIncrement={incrementTradedUnits}\n onDecrement={decrementTradedUnits}\n placeholder={lang('volume')}\n disabled={loading}\n withoutArrows\n />\n <NumberInput\n onValueChange={onSpreadChange}\n value={spread}\n label={lang('spread')}\n onIncrement={incrementSpread}\n onDecrement={decrementSpread}\n placeholder={lang('pips')}\n disabled={loading}\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,OAAOA,KAAK,IACNC,SAAS,QACR,OAAO;AACd,SAASC,SAAS,QAAQ,kBAAkB;AAC5C,SACEC,UAAU,EACVC,EAAE,EACFC,KAAK,EACLC,WAAW,EACXC,MAAM,EACNC,IAAI,EACJC,iBAAiB,EACjBC,eAAe,QACV,2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