@oanda/labs-spread-cost-calculator-widget 1.0.5 → 1.0.7
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 +60 -0
- package/dist/main/SpreadCostCalculatorWidget/Main.js +22 -22
- package/dist/main/SpreadCostCalculatorWidget/Main.js.map +1 -1
- package/dist/main/SpreadCostCalculatorWidget/SpreadCostCalculatorWidget.js +26 -27
- package/dist/main/SpreadCostCalculatorWidget/SpreadCostCalculatorWidget.js.map +1 -1
- package/dist/main/SpreadCostCalculatorWidget/ValidationWrapper.js +4 -5
- package/dist/main/SpreadCostCalculatorWidget/ValidationWrapper.js.map +1 -1
- package/dist/main/SpreadCostCalculatorWidget/render.js +4 -4
- package/dist/main/SpreadCostCalculatorWidget/render.js.map +1 -1
- package/dist/main/SpreadCostCalculatorWidget/types.js.map +1 -1
- package/dist/main/SpreadCostCalculatorWidget/useCalculateSpread.js +1 -1
- package/dist/main/SpreadCostCalculatorWidget/useCalculateSpread.js.map +1 -1
- package/dist/main/SpreadCostCalculatorWidget/useInstrumentChange.js.map +1 -1
- package/dist/main/SpreadCostCalculatorWidget/utils.js.map +1 -1
- package/dist/main/gql/types/fragment-masking.js.map +1 -1
- package/dist/main/gql/types/gql.js +1 -1
- package/dist/main/gql/types/gql.js.map +1 -1
- package/dist/main/gql/types/graphql.js +71 -71
- package/dist/main/gql/types/graphql.js.map +1 -1
- package/dist/main/gql/types/index.js.map +1 -1
- package/dist/main/index.js +8 -8
- package/dist/main/index.js.map +1 -1
- package/dist/main/translations/index.js +1 -1
- package/dist/main/translations/index.js.map +1 -1
- package/dist/module/SpreadCostCalculatorWidget/Main.js +22 -22
- 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 +4 -4
- package/dist/module/SpreadCostCalculatorWidget/ValidationWrapper.js.map +1 -1
- package/dist/module/SpreadCostCalculatorWidget/render.js +4 -4
- package/dist/module/SpreadCostCalculatorWidget/render.js.map +1 -1
- package/dist/module/SpreadCostCalculatorWidget/types.js.map +1 -1
- package/dist/module/SpreadCostCalculatorWidget/useCalculateSpread.js +1 -1
- package/dist/module/SpreadCostCalculatorWidget/useCalculateSpread.js.map +1 -1
- package/dist/module/SpreadCostCalculatorWidget/useInstrumentChange.js.map +1 -1
- package/dist/module/SpreadCostCalculatorWidget/utils.js.map +1 -1
- package/dist/module/gql/types/fragment-masking.js.map +1 -1
- package/dist/module/gql/types/gql.js +1 -1
- package/dist/module/gql/types/gql.js.map +1 -1
- package/dist/module/gql/types/graphql.js +71 -71
- package/dist/module/gql/types/graphql.js.map +1 -1
- package/dist/module/gql/types/index.js +2 -2
- package/dist/module/gql/types/index.js.map +1 -1
- package/dist/module/index.js +1 -1
- package/dist/module/index.js.map +1 -1
- package/dist/module/translations/index.js +1 -1
- package/dist/module/translations/index.js.map +1 -1
- package/dist/types/SpreadCostCalculatorWidget/Main.d.ts +2 -2
- package/dist/types/SpreadCostCalculatorWidget/SpreadCostCalculatorWidget.d.ts +2 -2
- package/dist/types/SpreadCostCalculatorWidget/ValidationWrapper.d.ts +1 -1
- package/dist/types/SpreadCostCalculatorWidget/types.d.ts +7 -7
- package/dist/types/SpreadCostCalculatorWidget/useCalculateSpread.d.ts +3 -3
- package/dist/types/SpreadCostCalculatorWidget/useInstrumentChange.d.ts +3 -3
- package/dist/types/gql/types/gql.d.ts +2 -2
- package/dist/types/gql/types/index.d.ts +2 -2
- package/dist/types/index.d.ts +1 -1
- package/dist/types/translations/index.d.ts +2 -2
- package/package.json +3 -3
- package/src/SpreadCostCalculatorWidget/Main.tsx +34 -28
- package/src/SpreadCostCalculatorWidget/SpreadCostCalculatorWidget.tsx +28 -29
- package/src/SpreadCostCalculatorWidget/ValidationWrapper.tsx +26 -21
- package/src/SpreadCostCalculatorWidget/render.tsx +12 -12
- package/src/SpreadCostCalculatorWidget/types.ts +8 -10
- package/src/SpreadCostCalculatorWidget/useCalculateSpread.ts +25 -18
- package/src/SpreadCostCalculatorWidget/useInstrumentChange.ts +13 -7
- package/src/SpreadCostCalculatorWidget/utils.ts +2 -1
- package/src/gql/types/fragment-masking.ts +41 -21
- package/src/gql/types/gql.ts +7 -3
- package/src/gql/types/graphql.ts +126 -47
- package/src/gql/types/index.ts +2 -2
- package/src/index.ts +1 -1
- package/src/translations/index.ts +4 -4
- package/test/SpreadCostCalculator.test.tsx +11 -6
- package/test/useCalculateSpread.test.tsx +41 -34
- package/test/useInstrumentChange.test.tsx +11 -4
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,66 @@
|
|
|
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.7 (2024-12-16)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
## 1.0.173 (2024-12-11)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
## 1.0.172 (2024-11-29)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
## 1.0.171 (2024-11-28)
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
## 1.0.170 (2024-11-28)
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
## 1.0.169 (2024-11-20)
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
## 1.0.168 (2024-11-19)
|
|
31
|
+
|
|
32
|
+
**Note:** Version bump only for package @oanda/labs-spread-cost-calculator-widget
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
## 1.0.6 (2024-12-11)
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
## 1.0.172 (2024-11-29)
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
## 1.0.171 (2024-11-28)
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
## 1.0.170 (2024-11-28)
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
## 1.0.169 (2024-11-20)
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
## 1.0.168 (2024-11-19)
|
|
59
|
+
|
|
60
|
+
**Note:** Version bump only for package @oanda/labs-spread-cost-calculator-widget
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
|
|
6
66
|
## 1.0.5 (2024-11-29)
|
|
7
67
|
|
|
8
68
|
|
|
@@ -4,9 +4,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.Main = void 0;
|
|
7
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
-
var _monoI18n = require("@oanda/mono-i18n");
|
|
9
7
|
var _labsWidgetCommon = require("@oanda/labs-widget-common");
|
|
8
|
+
var _monoI18n = require("@oanda/mono-i18n");
|
|
9
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
10
10
|
var _useCalculateSpread = require("./useCalculateSpread");
|
|
11
11
|
var _useInstrumentChange = require("./useInstrumentChange");
|
|
12
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); }
|
|
@@ -17,7 +17,7 @@ const Main = _ref => {
|
|
|
17
17
|
} = _ref;
|
|
18
18
|
const {
|
|
19
19
|
size
|
|
20
|
-
} = (0,
|
|
20
|
+
} = (0, _labsWidgetCommon.useLayoutProvider)();
|
|
21
21
|
const isDesktop = size === _labsWidgetCommon.Size.DESKTOP;
|
|
22
22
|
const selectOptions = instruments.map(instrument => ({
|
|
23
23
|
id: instrument.name,
|
|
@@ -70,41 +70,41 @@ const Main = _ref => {
|
|
|
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"
|
|
72
72
|
}, _react.default.createElement(_labsWidgetCommon.ChartError, null)) : _react.default.createElement("div", {
|
|
73
|
-
|
|
74
|
-
|
|
73
|
+
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",
|
|
74
|
+
"data-testid": "spread-cost-calculator"
|
|
75
75
|
}, _react.default.createElement("div", {
|
|
76
76
|
className: "lw-flex lw-flex-col lw-gap-2"
|
|
77
77
|
}, _react.default.createElement(_labsWidgetCommon.Label, {
|
|
78
|
-
|
|
79
|
-
|
|
78
|
+
className: "lw-text-text-primary",
|
|
79
|
+
htmlFor: lang('instrument')
|
|
80
80
|
}, lang('instrument')), _react.default.createElement(_labsWidgetCommon.Select, {
|
|
81
|
-
|
|
81
|
+
className: "lw-grow-0",
|
|
82
|
+
maxHeight: isDesktop ? 190 : 220,
|
|
82
83
|
options: selectOptions,
|
|
84
|
+
searchPlaceholder: lang('search'),
|
|
83
85
|
selectedOption: selectedInstrument,
|
|
84
|
-
|
|
85
|
-
setSelectedOption: setSelectedInstrument,
|
|
86
|
-
maxHeight: isDesktop ? 190 : 220
|
|
86
|
+
setSelectedOption: setSelectedInstrument
|
|
87
87
|
})), _react.default.createElement("div", {
|
|
88
88
|
className: "lw-flex lw-max-w-full lw-flex-col lw-content-center lw-justify-center lw-gap-3"
|
|
89
89
|
}, _react.default.createElement("div", {
|
|
90
90
|
className: (0, _labsWidgetCommon.cn)('lw-flex lw-max-w-full lw-flex-row lw-gap-3', !isDesktop && 'lw-flex-col lw-gap-8')
|
|
91
91
|
}, _react.default.createElement(_labsWidgetCommon.NumberInput, {
|
|
92
|
-
|
|
93
|
-
|
|
92
|
+
withoutArrows: true,
|
|
93
|
+
disabled: loading,
|
|
94
94
|
label: lang('units_traded'),
|
|
95
|
-
onIncrement: incrementTradedUnits,
|
|
96
|
-
onDecrement: decrementTradedUnits,
|
|
97
95
|
placeholder: lang('volume'),
|
|
98
|
-
|
|
99
|
-
|
|
96
|
+
value: unitsTraded,
|
|
97
|
+
onDecrement: decrementTradedUnits,
|
|
98
|
+
onIncrement: incrementTradedUnits,
|
|
99
|
+
onValueChange: onUnitChange
|
|
100
100
|
}), _react.default.createElement(_labsWidgetCommon.NumberInput, {
|
|
101
|
-
|
|
102
|
-
value: spread,
|
|
101
|
+
disabled: loading,
|
|
103
102
|
label: lang('spread'),
|
|
104
|
-
onIncrement: incrementSpread,
|
|
105
|
-
onDecrement: decrementSpread,
|
|
106
103
|
placeholder: lang('pips'),
|
|
107
|
-
|
|
104
|
+
value: spread,
|
|
105
|
+
onDecrement: decrementSpread,
|
|
106
|
+
onIncrement: incrementSpread,
|
|
107
|
+
onValueChange: onSpreadChange
|
|
108
108
|
})), _react.default.createElement("div", {
|
|
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", {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Main.js","names":["
|
|
1
|
+
{"version":3,"file":"Main.js","names":["_labsWidgetCommon","require","_monoI18n","_react","_interopRequireWildcard","_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","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,SAAAM,yBAAAC,CAAA,6BAAAC,OAAA,mBAA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ClBpB,KAAK,EAAE6B,IAAI,CAAC,cAAc,CAAE;IAC5BoB,WAAW,EAAEpB,IAAI,CAAC,QAAQ,CAAE;IAC5B3B,KAAK,EAAEC,WAAY;IACnB+C,WAAW,EAAEzC,oBAAqB;IAClC0C,WAAW,EAAE5C,oBAAqB;IAClC6C,aAAa,EAAE/C;EAAa,CAC7B,CAAC,EACF1C,MAAA,CAAAU,OAAA,CAAA4D,aAAA,CAACzE,iBAAA,CAAAsF,WAAW;IACVE,QAAQ,EAAE5B,OAAQ;IAClBpB,KAAK,EAAE6B,IAAI,CAAC,QAAQ,CAAE;IACtBoB,WAAW,EAAEpB,IAAI,CAAC,MAAM,CAAE;IAC1B3B,KAAK,EAAES,MAAO;IACduC,WAAW,EAAEpC,eAAgB;IAC7BqC,WAAW,EAAEtC,eAAgB;IAC7BuC,aAAa,EAAExC;EAAe,CAC/B,CACE,CAAC,EACNjD,MAAA,CAAAU,OAAA,CAAA4D,aAAA;IAAKE,SAAS,EAAC;EAA8B,GAC3CxE,MAAA,CAAAU,OAAA,CAAA4D,aAAA,cAAMJ,IAAI,CAAC,sBAAsB,CAAO,CAAC,EACzClE,MAAA,CAAAU,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 = _interopRequireWildcard(require("react"));
|
|
8
7
|
var _client = require("@apollo/client");
|
|
9
|
-
var _labsWidgetCommon = require("@oanda/labs-widget-common");
|
|
10
8
|
var _labsLiveRatesTableWidget = require("@oanda/labs-live-rates-table-widget");
|
|
11
|
-
var
|
|
9
|
+
var _labsWidgetCommon = require("@oanda/labs-widget-common");
|
|
10
|
+
var _react = _interopRequireDefault(require("react"));
|
|
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
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
32
|
+
return _react.default.createElement(_labsWidgetCommon.WidgetProvider, {
|
|
33
|
+
withSuspense: true,
|
|
34
|
+
client: client,
|
|
35
|
+
liveRates: {
|
|
36
|
+
url: liveRatesUrl,
|
|
37
|
+
options: {
|
|
38
|
+
divisionCode,
|
|
39
|
+
dataSource
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
locale: locale,
|
|
43
|
+
styling: {
|
|
44
|
+
removePadding
|
|
45
|
+
},
|
|
46
46
|
theme: theme,
|
|
47
|
-
|
|
48
|
-
}, (
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
}))))));
|
|
47
|
+
translations: _translations.translations
|
|
48
|
+
}, _react.default.createElement(_labsWidgetCommon.WidgetWrapper, {
|
|
49
|
+
linkArea: "logo",
|
|
50
|
+
logoLink: logoLink
|
|
51
|
+
}, _react.default.createElement(_ValidationWrapper.ValidationWrapper, {
|
|
52
|
+
division: division,
|
|
53
|
+
instruments: instruments,
|
|
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":["
|
|
1
|
+
{"version":3,"file":"SpreadCostCalculatorWidget.js","names":["_client","require","_labsLiveRatesTableWidget","_labsWidgetCommon","_react","_interopRequireDefault","_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","liveRates","url","options","styling","translations","WidgetWrapper","linkArea","ValidationWrapper","exports"],"sources":["../../../src/SpreadCostCalculatorWidget/SpreadCostCalculatorWidget.tsx"],"sourcesContent":["import { ApolloClient, InMemoryCache } from '@apollo/client';\nimport { Division } from '@oanda/labs-live-rates-table-widget';\nimport { WidgetProvider, WidgetWrapper } from '@oanda/labs-widget-common';\nimport type { FC } from 'react';\nimport React from 'react';\n\nimport { translations } from '../translations';\nimport type { SpreadCostCalculatorWidgetConfig } from './types';\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 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 linkArea=\"logo\" logoLink={logoLink}>\n <ValidationWrapper\n division={division}\n instruments={instruments}\n isParamError={isParamError}\n />\n </WidgetWrapper>\n </WidgetProvider>\n );\n};\n\nexport { SpreadCostCalculatorWidget };\n"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,yBAAA,GAAAD,OAAA;AACA,IAAAE,iBAAA,GAAAF,OAAA;AAEA,IAAAG,MAAA,GAAAC,sBAAA,CAAAJ,OAAA;AAEA,IAAAK,aAAA,GAAAL,OAAA;AAEA,IAAAM,kBAAA,GAAAN,OAAA;AAAwD,SAAAI,uBAAAG,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,OACE1B,MAAA,CAAAM,OAAA,CAAAsB,aAAA,CAAC7B,iBAAA,CAAA8B,cAAc;IACbC,YAAY;IACZZ,MAAM,EAAEA,MAAO;IACfa,SAAS,EAAE;MACTC,GAAG,EAAEtB,YAAY;MACjBuB,OAAO,EAAE;QAAEV,YAAY;QAAEI;MAAW;IACtC,CAAE;IACFf,MAAM,EAAEA,MAAO;IACfsB,OAAO,EAAE;MACPpB;IACF,CAAE;IACFH,KAAK,EAAEA,KAAM;IACbwB,YAAY,EAAEA;EAAa,GAE3BnC,MAAA,CAAAM,OAAA,CAAAsB,aAAA,CAAC7B,iBAAA,CAAAqC,aAAa;IAACC,QAAQ,EAAC,MAAM;IAACpB,QAAQ,EAAEA;EAAS,GAChDjB,MAAA,CAAAM,OAAA,CAAAsB,aAAA,CAACzB,kBAAA,CAAAmC,iBAAiB;IAChBvB,QAAQ,EAAEA,QAAS;IACnBC,WAAW,EAAEA,WAAY;IACzBH,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 = _interopRequireWildcard(require("react"));
|
|
8
7
|
var _client = require("@apollo/client");
|
|
9
8
|
var _labsWidgetCommon = require("@oanda/labs-widget-common");
|
|
10
|
-
var
|
|
9
|
+
var _react = _interopRequireDefault(require("react"));
|
|
11
10
|
var _validateInstruments = require("../gql/validateInstruments");
|
|
12
|
-
|
|
13
|
-
function
|
|
11
|
+
var _Main = require("./Main");
|
|
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":["
|
|
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":[]}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var _labsWidgetCommon = require("@oanda/labs-widget-common");
|
|
3
4
|
var _react = _interopRequireDefault(require("react"));
|
|
4
5
|
var _client = require("react-dom/client");
|
|
5
|
-
var _labsWidgetCommon = require("@oanda/labs-widget-common");
|
|
6
6
|
var _SpreadCostCalculatorWidget = require("./SpreadCostCalculatorWidget");
|
|
7
7
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
8
8
|
const {
|
|
@@ -40,12 +40,12 @@ spreadCostCalculatorParamsElements.forEach(element => {
|
|
|
40
40
|
}]);
|
|
41
41
|
root.render(_react.default.createElement(_SpreadCostCalculatorWidget.SpreadCostCalculatorWidget, {
|
|
42
42
|
division: division,
|
|
43
|
+
graphqlUrl: graphqlUrl,
|
|
43
44
|
instruments: instruments,
|
|
45
|
+
isParamError: isParamError,
|
|
44
46
|
liveRatesUrl: liveRatesUrl,
|
|
45
|
-
graphqlUrl: graphqlUrl,
|
|
46
47
|
locale: locale,
|
|
47
|
-
theme: mode
|
|
48
|
-
isParamError: isParamError
|
|
48
|
+
theme: mode
|
|
49
49
|
}));
|
|
50
50
|
});
|
|
51
51
|
//# sourceMappingURL=render.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"render.js","names":["
|
|
1
|
+
{"version":3,"file":"render.js","names":["_labsWidgetCommon","require","_react","_interopRequireDefault","_client","_SpreadCostCalculatorWidget","e","__esModule","default","graphqlUrl","liveRatesUrl","window","widgetsConfig","spreadCostCalculatorParamsElements","document","querySelectorAll","forEach","element","root","createRoot","params","getAttribute","mode","locale","instruments","division","JSON","parse","isParamError","validateToolParams","name","valueCheck","value","validateLocale","length","render","createElement","SpreadCostCalculatorWidget","theme"],"sources":["../../../src/SpreadCostCalculatorWidget/render.tsx"],"sourcesContent":["import type { Theme } from '@oanda/labs-widget-common';\nimport { validateLocale, validateToolParams } from '@oanda/labs-widget-common';\nimport React from 'react';\nimport { createRoot } from 'react-dom/client';\n\nimport { SpreadCostCalculatorWidget } from './SpreadCostCalculatorWidget';\n\nconst { graphqlUrl, liveRatesUrl } = window.widgetsConfig || {};\nconst spreadCostCalculatorParamsElements = document.querySelectorAll(\n 'div[data-spread-cost-calculator-params]'\n);\n\nspreadCostCalculatorParamsElements.forEach((element) => {\n const root = createRoot(element);\n const params = element.getAttribute('data-spread-cost-calculator-params');\n const mode = element.getAttribute('data-mode');\n const { locale, instruments, division } = JSON.parse(params as string);\n\n const isParamError = validateToolParams(\n {\n locale,\n graphqlUrl,\n instruments,\n division,\n liveRatesUrl,\n },\n [\n {\n name: 'locale',\n valueCheck: (value: string | undefined) => validateLocale(value),\n },\n {\n name: 'graphqlUrl',\n },\n {\n name: 'liveRatesUrl',\n },\n {\n name: 'division',\n },\n {\n name: 'instruments',\n valueCheck: (value) =>\n (value as string[]).length > 0 && (value as string[]).length <= 10,\n },\n ]\n );\n\n root.render(\n <SpreadCostCalculatorWidget\n division={division}\n graphqlUrl={graphqlUrl}\n instruments={instruments}\n isParamError={isParamError}\n liveRatesUrl={liveRatesUrl}\n locale={locale}\n theme={mode as Theme}\n />\n );\n});\n"],"mappings":";;AACA,IAAAA,iBAAA,GAA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MAAA,CAAAM,OAAA,CAAA4B,aAAA,CAAC/B,2BAAA,CAAAgC,0BAA0B;IACzBZ,QAAQ,EAAEA,QAAS;IACnBhB,UAAU,EAAEA,UAAW;IACvBe,WAAW,EAAEA,WAAY;IACzBI,YAAY,EAAEA,YAAa;IAC3BlB,YAAY,EAAEA,YAAa;IAC3Ba,MAAM,EAAEA,MAAO;IACfe,KAAK,EAAEhB;EAAc,CACtB,CACH,CAAC;AACH,CAAC,CAAC","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 type { WidgetConfig } from '@oanda/labs-widget-common';\n\nimport type { 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 interface InstrumentResponse {\n name: string;\n displayName: string;\n}\n\nexport interface MainProps {\n instruments: InstrumentResponse[];\n}\n\nexport interface ValidationWrapperProps {\n division: Division;\n instruments: string[];\n isParamError?: boolean;\n}\n"],"mappings":";;;;;;;;;;;AAIA,IAAAA,SAAA,GAAAC,OAAA","ignoreList":[]}
|
|
@@ -4,9 +4,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.useCalculateSpread = void 0;
|
|
7
|
-
var _usehooksTs = require("usehooks-ts");
|
|
8
7
|
var _react = require("react");
|
|
9
8
|
var _reactNumberFormat = require("react-number-format");
|
|
9
|
+
var _usehooksTs = require("usehooks-ts");
|
|
10
10
|
var _constant = require("./constant");
|
|
11
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;
|
|
12
12
|
const useCalculateSpread = _ref => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useCalculateSpread.js","names":["
|
|
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\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,GACZ,GAAG,IAAAC,mCAAgB,EAACD,gBAAgB,CAACE,QAAQ,CAAC,CAAC,EAAE;MAC/CC,iBAAiB,EAAE;IACrB,CAAC,CAAC,IAAIT,QAAQ,EAAE,GAChBI,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":[]}
|
|
@@ -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 { SelectOption
|
|
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":[]}
|
|
@@ -1 +1 @@
|
|
|
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
|
|
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 =>\n instrument.split('/')[1] || DEFAULT_CURRENCY;\n"],"mappings":";;;;;;AAAA,IAAAA,SAAA,GAAAC,OAAA;AAEO,MAAMC,qBAAqB,GAAIC,UAAkB,IACtDA,UAAU,CAACC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAIC,0BAAgB;AAACC,OAAA,CAAAJ,qBAAA,GAAAA,qBAAA","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
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 {
|
|
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":[]}
|
|
@@ -8,7 +8,7 @@ var types = _interopRequireWildcard(require("./graphql"));
|
|
|
8
8
|
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); }
|
|
9
9
|
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; }
|
|
10
10
|
const documents = {
|
|
11
|
-
|
|
11
|
+
'\n query validateInstruments($instruments: [String]!, $division: Division) {\n mapInstrumentNames(instruments: $instruments, division: $division) {\n name\n displayName\n }\n }\n': types.ValidateInstrumentsDocument
|
|
12
12
|
};
|
|
13
13
|
function graphql(source) {
|
|
14
14
|
return documents[source] ?? {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gql.js","names":["types","_interopRequireWildcard","require","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","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
|
|
1
|
+
{"version":3,"file":"gql.js","names":["types","_interopRequireWildcard","require","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","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,SAAAC,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,SAAAH,wBAAAG,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,CAAAC,cAAA,IAAAD,MAAA,CAAAE,wBAAA,WAAAC,CAAA,IAAAd,CAAA,oBAAAc,CAAA,OAAAC,cAAA,CAAAC,IAAA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