@oanda/labs-currency-cross-table 1.0.13 → 1.0.14
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/CurrencyCrossTableWidget/CurrencyCrossTableWidget.js +8 -7
- package/dist/main/CurrencyCrossTableWidget/CurrencyCrossTableWidget.js.map +1 -1
- package/dist/main/CurrencyCrossTableWidget/Main.js +8 -12
- package/dist/main/CurrencyCrossTableWidget/Main.js.map +1 -1
- package/dist/main/CurrencyCrossTableWidget/ValidationWrapper.js +17 -2
- package/dist/main/CurrencyCrossTableWidget/ValidationWrapper.js.map +1 -1
- package/dist/main/CurrencyCrossTableWidget/components/CellWithData.js +9 -8
- package/dist/main/CurrencyCrossTableWidget/components/CellWithData.js.map +1 -1
- package/dist/main/CurrencyCrossTableWidget/components/types.js.map +1 -1
- package/dist/main/CurrencyCrossTableWidget/types.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 +8 -5
- package/dist/main/gql/types/graphql.js.map +1 -1
- package/dist/main/gql/validateInstruments.js +2 -2
- package/dist/main/gql/validateInstruments.js.map +1 -1
- package/dist/module/CurrencyCrossTableWidget/CurrencyCrossTableWidget.js +6 -6
- package/dist/module/CurrencyCrossTableWidget/CurrencyCrossTableWidget.js.map +1 -1
- package/dist/module/CurrencyCrossTableWidget/Main.js +10 -14
- package/dist/module/CurrencyCrossTableWidget/Main.js.map +1 -1
- package/dist/module/CurrencyCrossTableWidget/ValidationWrapper.js +17 -2
- package/dist/module/CurrencyCrossTableWidget/ValidationWrapper.js.map +1 -1
- package/dist/module/CurrencyCrossTableWidget/components/CellWithData.js +10 -9
- package/dist/module/CurrencyCrossTableWidget/components/CellWithData.js.map +1 -1
- package/dist/module/CurrencyCrossTableWidget/components/types.js.map +1 -1
- package/dist/module/CurrencyCrossTableWidget/types.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 +8 -5
- package/dist/module/gql/types/graphql.js.map +1 -1
- package/dist/module/gql/validateInstruments.js +2 -2
- package/dist/module/gql/validateInstruments.js.map +1 -1
- package/dist/types/CurrencyCrossTableWidget/Main.d.ts +1 -1
- package/dist/types/CurrencyCrossTableWidget/components/CellWithData.d.ts +1 -1
- package/dist/types/CurrencyCrossTableWidget/components/types.d.ts +2 -12
- package/dist/types/CurrencyCrossTableWidget/types.d.ts +1 -1
- package/dist/types/gql/types/gql.d.ts +3 -3
- package/dist/types/gql/types/graphql.d.ts +8 -3
- package/package.json +3 -3
- package/src/CurrencyCrossTableWidget/CurrencyCrossTableWidget.tsx +19 -17
- package/src/CurrencyCrossTableWidget/Main.tsx +15 -25
- package/src/CurrencyCrossTableWidget/ValidationWrapper.tsx +26 -2
- package/src/CurrencyCrossTableWidget/components/CellWithData.tsx +10 -9
- package/src/CurrencyCrossTableWidget/components/types.ts +2 -12
- package/src/CurrencyCrossTableWidget/types.tsx +1 -1
- package/src/gql/types/gql.ts +2 -2
- package/src/gql/types/graphql.ts +10 -3
- package/src/gql/validateInstruments.ts +2 -2
- package/test/Main.test.tsx +1 -2
- package/dist/main/CurrencyCrossTableWidget/components/CellValidationWrapper.js +0 -49
- package/dist/main/CurrencyCrossTableWidget/components/CellValidationWrapper.js.map +0 -1
- package/dist/module/CurrencyCrossTableWidget/components/CellValidationWrapper.js +0 -42
- package/dist/module/CurrencyCrossTableWidget/components/CellValidationWrapper.js.map +0 -1
- package/dist/types/CurrencyCrossTableWidget/components/CellValidationWrapper.d.ts +0 -4
- package/src/CurrencyCrossTableWidget/components/CellValidationWrapper.tsx +0 -49
|
@@ -1,30 +1,24 @@
|
|
|
1
1
|
import React, {
|
|
2
|
-
Fragment,
|
|
2
|
+
Fragment, useEffect, useState,
|
|
3
3
|
} from 'react';
|
|
4
4
|
import { useLiveRatesQuery } from '@oanda/labs-widget-common';
|
|
5
5
|
import { MainProps } from './types';
|
|
6
|
-
import { TextCell } from './components';
|
|
7
|
-
import { CellValidationWrapper } from './components/CellValidationWrapper';
|
|
6
|
+
import { CellWithData, TextCell } from './components';
|
|
8
7
|
import { divisionMapper } from './utils';
|
|
9
8
|
|
|
10
9
|
const Main = ({
|
|
11
|
-
instruments,
|
|
12
10
|
currencies,
|
|
11
|
+
validInstruments,
|
|
13
12
|
division,
|
|
14
13
|
}: MainProps) => {
|
|
15
14
|
const [selectedCurrency, setSelectedCurrency] = useState('');
|
|
16
15
|
const [selectedPair, setSelectedPair] = useState('');
|
|
17
|
-
|
|
18
|
-
const hasInstruments = instruments.length > 0;
|
|
19
|
-
|
|
20
16
|
const { target, setQuery } = useLiveRatesQuery();
|
|
21
17
|
|
|
22
18
|
useEffect(() => {
|
|
23
|
-
|
|
24
|
-
setQuery({ instruments });
|
|
25
|
-
}
|
|
19
|
+
setQuery({ instruments: validInstruments });
|
|
26
20
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
27
|
-
},
|
|
21
|
+
}, validInstruments);
|
|
28
22
|
|
|
29
23
|
return (
|
|
30
24
|
<div data-testid="currency-cross-table-wrapper" className="lw-w-full lw-overflow-x-auto lw-overflow-y-hidden lw-border lw-border-b-0 lw-border-solid lw-border-border-primary">
|
|
@@ -51,21 +45,17 @@ const Main = ({
|
|
|
51
45
|
{arr.map((pair) => (
|
|
52
46
|
<Fragment key={`${currency}_${pair}`}>
|
|
53
47
|
{currency !== pair ? (
|
|
54
|
-
<
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
division={division}
|
|
63
|
-
/>
|
|
64
|
-
</Suspense>
|
|
65
|
-
) : (
|
|
66
|
-
<TextCell
|
|
67
|
-
emptyIndicator
|
|
48
|
+
<CellWithData
|
|
49
|
+
currency={currency}
|
|
50
|
+
pair={pair}
|
|
51
|
+
isValid={validInstruments.includes(`${currency}${divisionMapper(division)}${pair}`)}
|
|
52
|
+
target={target}
|
|
53
|
+
setSelectedCurrency={setSelectedCurrency}
|
|
54
|
+
setSelectedPair={setSelectedPair}
|
|
55
|
+
division={division}
|
|
68
56
|
/>
|
|
57
|
+
) : (
|
|
58
|
+
<TextCell emptyIndicator />
|
|
69
59
|
)}
|
|
70
60
|
</Fragment>
|
|
71
61
|
))}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import classnames from 'classnames';
|
|
3
3
|
import { ChartError } from '@oanda/labs-widget-common';
|
|
4
|
+
import { useSuspenseQuery } from '@apollo/client';
|
|
5
|
+
import { ValidateInstrumentsQuery, ValidateInstrumentsQueryVariables } from '../gql/types/graphql';
|
|
6
|
+
import { validateInstruments } from '../gql/validateInstruments';
|
|
4
7
|
import { currenciesToInstruments, validCurrencies } from './utils';
|
|
5
8
|
import { ValidationWrapperProps } from './types';
|
|
6
9
|
import { Main } from './Main';
|
|
@@ -10,7 +13,28 @@ const ValidationWrapper = ({
|
|
|
10
13
|
division,
|
|
11
14
|
isParamError,
|
|
12
15
|
}: ValidationWrapperProps) => {
|
|
13
|
-
const
|
|
16
|
+
const instruments = currenciesToInstruments(currencies, division);
|
|
17
|
+
|
|
18
|
+
const { data, error } = useSuspenseQuery<
|
|
19
|
+
ValidateInstrumentsQuery,
|
|
20
|
+
ValidateInstrumentsQueryVariables
|
|
21
|
+
>(validateInstruments, {
|
|
22
|
+
variables: {
|
|
23
|
+
instruments,
|
|
24
|
+
division,
|
|
25
|
+
},
|
|
26
|
+
fetchPolicy: 'network-only',
|
|
27
|
+
errorPolicy: 'all',
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
const validInstruments = data
|
|
31
|
+
?.resolveInstrumentsByDivision
|
|
32
|
+
?.map((instrument) => instrument.name);
|
|
33
|
+
const showError = !validCurrencies(currencies)
|
|
34
|
+
|| isParamError
|
|
35
|
+
|| error
|
|
36
|
+
|| !validInstruments
|
|
37
|
+
|| validInstruments.length === 0;
|
|
14
38
|
|
|
15
39
|
return (
|
|
16
40
|
<>
|
|
@@ -19,7 +43,7 @@ const ValidationWrapper = ({
|
|
|
19
43
|
>
|
|
20
44
|
{!showError && (
|
|
21
45
|
<Main
|
|
22
|
-
|
|
46
|
+
validInstruments={validInstruments}
|
|
23
47
|
currencies={currencies}
|
|
24
48
|
division={division}
|
|
25
49
|
/>
|
|
@@ -2,20 +2,21 @@ import React, { useState } from 'react';
|
|
|
2
2
|
import { Price, useLiveRatesMessage } from '@oanda/labs-widget-common';
|
|
3
3
|
import { Cell } from './Cell';
|
|
4
4
|
import { CellWithDataProps } from './types';
|
|
5
|
-
import { getBuyPrice, getPriceMovement } from '../utils';
|
|
5
|
+
import { divisionMapper, getBuyPrice, getPriceMovement } from '../utils';
|
|
6
6
|
|
|
7
7
|
const CellWithData = ({
|
|
8
8
|
currency,
|
|
9
9
|
pair,
|
|
10
|
-
|
|
11
|
-
instrumentForCalculations,
|
|
10
|
+
isValid,
|
|
12
11
|
target,
|
|
12
|
+
division,
|
|
13
13
|
setSelectedCurrency,
|
|
14
14
|
setSelectedPair,
|
|
15
15
|
}: CellWithDataProps) => {
|
|
16
16
|
const [hovered, setHovered] = useState(false);
|
|
17
17
|
|
|
18
|
-
const
|
|
18
|
+
const instrument = `${currency}${divisionMapper(division)}${pair}`;
|
|
19
|
+
const instrumentForUpdates = isValid ? instrument : `${pair}${divisionMapper(division)}${currency}`;
|
|
19
20
|
|
|
20
21
|
const { update, error: liveRatesError } = useLiveRatesMessage(
|
|
21
22
|
instrumentForUpdates,
|
|
@@ -23,11 +24,11 @@ const CellWithData = ({
|
|
|
23
24
|
);
|
|
24
25
|
|
|
25
26
|
const updatedRecord: Record<string, any> = {
|
|
26
|
-
displayName:
|
|
27
|
-
instrument
|
|
27
|
+
displayName: `${currency}/${pair}`,
|
|
28
|
+
instrument,
|
|
28
29
|
buy: update?.ask,
|
|
29
30
|
buyPriceMovement: update?.askPriceMovement,
|
|
30
|
-
displayPrecision: update?.displayPrecision,
|
|
31
|
+
displayPrecision: currency === 'JPY' && !isValid ? 6 : update?.displayPrecision,
|
|
31
32
|
};
|
|
32
33
|
|
|
33
34
|
const checkLoading = (id: string) => (!liveRatesError && updatedRecord?.[id] === undefined);
|
|
@@ -52,11 +53,11 @@ const CellWithData = ({
|
|
|
52
53
|
mouseEnterHandler={handleMouseEnter}
|
|
53
54
|
mouseLeaveHandler={handleMouseLeave}
|
|
54
55
|
>
|
|
55
|
-
<Price priceMovement={getPriceMovement(updatedRecord.buyPriceMovement,
|
|
56
|
+
<Price priceMovement={getPriceMovement(updatedRecord.buyPriceMovement, !isValid)} movementIndicator="background">
|
|
56
57
|
<span>
|
|
57
58
|
{getBuyPrice(
|
|
58
59
|
updatedRecord.buy,
|
|
59
|
-
|
|
60
|
+
!isValid,
|
|
60
61
|
).toFixed(updatedRecord.displayPrecision)}
|
|
61
62
|
</span>
|
|
62
63
|
</Price>
|
|
@@ -1,20 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { LoaderSize } from '@oanda/labs-widget-common';
|
|
2
2
|
import { Division } from '../../gql/types/graphql';
|
|
3
3
|
|
|
4
|
-
export interface CellValidationWrapperProps {
|
|
5
|
-
currency: string;
|
|
6
|
-
pair: string;
|
|
7
|
-
instrument: string;
|
|
8
|
-
target: EventTarget | null;
|
|
9
|
-
division: Division;
|
|
10
|
-
setSelectedCurrency: React.Dispatch<React.SetStateAction<string>>;
|
|
11
|
-
setSelectedPair: React.Dispatch<React.SetStateAction<string>>;
|
|
12
|
-
}
|
|
13
4
|
export interface CellWithDataProps {
|
|
14
5
|
currency: string;
|
|
15
6
|
pair: string;
|
|
16
|
-
|
|
17
|
-
record: DataRecord;
|
|
7
|
+
isValid: boolean;
|
|
18
8
|
target: EventTarget | null;
|
|
19
9
|
division: Division;
|
|
20
10
|
setSelectedCurrency: React.Dispatch<React.SetStateAction<string>>;
|
package/src/gql/types/gql.ts
CHANGED
|
@@ -13,7 +13,7 @@ import { TypedDocumentNode as DocumentNode } from '@graphql-typed-document-node/
|
|
|
13
13
|
* Therefore it is highly recommended to use the babel or swc plugin for production.
|
|
14
14
|
*/
|
|
15
15
|
const documents = {
|
|
16
|
-
"\n query validateInstruments($instruments: [String]!, $division: Division) {\n
|
|
16
|
+
"\n query validateInstruments($instruments: [String]!, $division: Division!) {\n resolveInstrumentsByDivision(instruments: $instruments, division: $division) {\n name\n displayName\n }\n }\n": types.ValidateInstrumentsDocument,
|
|
17
17
|
};
|
|
18
18
|
|
|
19
19
|
/**
|
|
@@ -33,7 +33,7 @@ export function graphql(source: string): unknown;
|
|
|
33
33
|
/**
|
|
34
34
|
* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
|
|
35
35
|
*/
|
|
36
|
-
export function graphql(source: "\n query validateInstruments($instruments: [String]!, $division: Division) {\n
|
|
36
|
+
export function graphql(source: "\n query validateInstruments($instruments: [String]!, $division: Division!) {\n resolveInstrumentsByDivision(instruments: $instruments, division: $division) {\n name\n displayName\n }\n }\n"): (typeof documents)["\n query validateInstruments($instruments: [String]!, $division: Division!) {\n resolveInstrumentsByDivision(instruments: $instruments, division: $division) {\n name\n displayName\n }\n }\n"];
|
|
37
37
|
|
|
38
38
|
export function graphql(source: string) {
|
|
39
39
|
return (documents as any)[source] ?? {};
|
package/src/gql/types/graphql.ts
CHANGED
|
@@ -172,6 +172,7 @@ export type Query = {
|
|
|
172
172
|
isAllowedPartner?: Maybe<Scalars['Boolean']['output']>;
|
|
173
173
|
mapInstrumentNames?: Maybe<Array<Maybe<Instrument>>>;
|
|
174
174
|
orderPositionBooks: Array<Maybe<OrderPositionData>>;
|
|
175
|
+
resolveInstrumentsByDivision?: Maybe<Array<Instrument>>;
|
|
175
176
|
sentiment?: Maybe<Array<SentimentInstrument>>;
|
|
176
177
|
sentimentList?: Maybe<Array<SentimentInstrument>>;
|
|
177
178
|
topicalInstruments?: Maybe<Array<TopicalInstrument>>;
|
|
@@ -227,6 +228,12 @@ export type QueryOrderPositionBooksArgs = {
|
|
|
227
228
|
};
|
|
228
229
|
|
|
229
230
|
|
|
231
|
+
export type QueryResolveInstrumentsByDivisionArgs = {
|
|
232
|
+
division: Division;
|
|
233
|
+
instruments: Array<InputMaybe<Scalars['String']['input']>>;
|
|
234
|
+
};
|
|
235
|
+
|
|
236
|
+
|
|
230
237
|
export type QuerySentimentArgs = {
|
|
231
238
|
division?: InputMaybe<Division>;
|
|
232
239
|
name: Scalars['String']['input'];
|
|
@@ -413,11 +420,11 @@ export enum VolatilityChartTimeUnit {
|
|
|
413
420
|
|
|
414
421
|
export type ValidateInstrumentsQueryVariables = Exact<{
|
|
415
422
|
instruments: Array<InputMaybe<Scalars['String']['input']>> | InputMaybe<Scalars['String']['input']>;
|
|
416
|
-
division
|
|
423
|
+
division: Division;
|
|
417
424
|
}>;
|
|
418
425
|
|
|
419
426
|
|
|
420
|
-
export type ValidateInstrumentsQuery = { __typename?: 'Query',
|
|
427
|
+
export type ValidateInstrumentsQuery = { __typename?: 'Query', resolveInstrumentsByDivision?: Array<{ __typename?: 'Instrument', name: string, displayName: string }> | null };
|
|
421
428
|
|
|
422
429
|
|
|
423
|
-
export const ValidateInstrumentsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"validateInstruments"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"instruments"}},"type":{"kind":"NonNullType","type":{"kind":"ListType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"division"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"Division"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"
|
|
430
|
+
export const ValidateInstrumentsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"validateInstruments"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"instruments"}},"type":{"kind":"NonNullType","type":{"kind":"ListType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"division"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Division"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"resolveInstrumentsByDivision"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"instruments"},"value":{"kind":"Variable","name":{"kind":"Name","value":"instruments"}}},{"kind":"Argument","name":{"kind":"Name","value":"division"},"value":{"kind":"Variable","name":{"kind":"Name","value":"division"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"displayName"}}]}}]}}]} as unknown as DocumentNode<ValidateInstrumentsQuery, ValidateInstrumentsQueryVariables>;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { gql } from '@apollo/client';
|
|
2
2
|
|
|
3
3
|
export const validateInstruments = gql`
|
|
4
|
-
query validateInstruments($instruments: [String]!, $division: Division) {
|
|
5
|
-
|
|
4
|
+
query validateInstruments($instruments: [String]!, $division: Division!) {
|
|
5
|
+
resolveInstrumentsByDivision(instruments: $instruments, division: $division) {
|
|
6
6
|
name
|
|
7
7
|
displayName
|
|
8
8
|
}
|
package/test/Main.test.tsx
CHANGED
|
@@ -12,15 +12,14 @@ import { widgetMocks } from './mocks';
|
|
|
12
12
|
describe('Main component', () => {
|
|
13
13
|
it('should render currency cross table component', () => {
|
|
14
14
|
const currencies = ['EUR', 'USD', 'GBP', 'CHF'];
|
|
15
|
-
const instruments = ['EUR_USD', 'EUR_GBP', 'EUR_CHF', 'USD_EUR', 'USD_GBP', 'USD_CHF', 'GBP_EUR', 'GBP_USD', 'GBP_CHF', 'CHF_EUR', 'CHF_USD', 'CHF_GBP'];
|
|
16
15
|
|
|
17
16
|
const { getByTestId } = render(
|
|
18
17
|
<MockedProvider mocks={widgetMocks}>
|
|
19
18
|
<ThemeContext.Provider value={{ size: Size.DESKTOP, isDark: true }}>
|
|
20
19
|
<Main
|
|
21
20
|
currencies={currencies}
|
|
22
|
-
instruments={instruments}
|
|
23
21
|
division={Division.Oc}
|
|
22
|
+
validInstruments={['EUR_USD', 'EUR_GBP', 'EUR_CHF', 'USD_GBP', 'USD_CHF', 'GBP_CHF', 'CHF_EUR']}
|
|
24
23
|
/>
|
|
25
24
|
</ThemeContext.Provider>
|
|
26
25
|
</MockedProvider>,
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.CellValidationWrapper = void 0;
|
|
7
|
-
var _react = _interopRequireDefault(require("react"));
|
|
8
|
-
var _client = require("@apollo/client");
|
|
9
|
-
var _validateInstruments = require("../../gql/validateInstruments");
|
|
10
|
-
var _CellWithData = require("./CellWithData");
|
|
11
|
-
var _utils = require("../utils");
|
|
12
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
13
|
-
const CellValidationWrapper = _ref => {
|
|
14
|
-
let {
|
|
15
|
-
currency,
|
|
16
|
-
pair,
|
|
17
|
-
instrument,
|
|
18
|
-
target,
|
|
19
|
-
setSelectedCurrency,
|
|
20
|
-
setSelectedPair,
|
|
21
|
-
division
|
|
22
|
-
} = _ref;
|
|
23
|
-
const {
|
|
24
|
-
error
|
|
25
|
-
} = (0, _client.useSuspenseQuery)(_validateInstruments.validateInstruments, {
|
|
26
|
-
variables: {
|
|
27
|
-
instruments: [instrument],
|
|
28
|
-
division
|
|
29
|
-
},
|
|
30
|
-
fetchPolicy: 'network-only',
|
|
31
|
-
errorPolicy: 'all'
|
|
32
|
-
});
|
|
33
|
-
const instrumentForCalculations = error ? `${pair}${(0, _utils.divisionMapper)(division)}${currency}` : '';
|
|
34
|
-
return _react.default.createElement(_CellWithData.CellWithData, {
|
|
35
|
-
currency: currency,
|
|
36
|
-
pair: pair,
|
|
37
|
-
record: {
|
|
38
|
-
instrument,
|
|
39
|
-
displayName: `${currency}${(0, _utils.divisionMapper)(division)}${pair}`
|
|
40
|
-
},
|
|
41
|
-
instrumentForCalculations: instrumentForCalculations,
|
|
42
|
-
target: target,
|
|
43
|
-
setSelectedCurrency: setSelectedCurrency,
|
|
44
|
-
setSelectedPair: setSelectedPair,
|
|
45
|
-
division: division
|
|
46
|
-
});
|
|
47
|
-
};
|
|
48
|
-
exports.CellValidationWrapper = CellValidationWrapper;
|
|
49
|
-
//# sourceMappingURL=CellValidationWrapper.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"CellValidationWrapper.js","names":["_react","_interopRequireDefault","require","_client","_validateInstruments","_CellWithData","_utils","e","__esModule","default","CellValidationWrapper","_ref","currency","pair","instrument","target","setSelectedCurrency","setSelectedPair","division","error","useSuspenseQuery","validateInstruments","variables","instruments","fetchPolicy","errorPolicy","instrumentForCalculations","divisionMapper","createElement","CellWithData","record","displayName","exports"],"sources":["../../../../src/CurrencyCrossTableWidget/components/CellValidationWrapper.tsx"],"sourcesContent":["import React from 'react';\nimport { useSuspenseQuery } from '@apollo/client';\nimport { CellValidationWrapperProps } from './types';\nimport { ValidateInstrumentsQuery, ValidateInstrumentsQueryVariables } from '../../gql/types/graphql';\nimport { validateInstruments } from '../../gql/validateInstruments';\nimport { CellWithData } from './CellWithData';\nimport { divisionMapper } from '../utils';\n\nconst CellValidationWrapper = ({\n currency,\n pair,\n instrument,\n target,\n setSelectedCurrency,\n setSelectedPair,\n division,\n}: CellValidationWrapperProps) => {\n const { error } = useSuspenseQuery<\n ValidateInstrumentsQuery,\n ValidateInstrumentsQueryVariables\n >(validateInstruments, {\n variables: {\n instruments: [instrument],\n division,\n },\n fetchPolicy: 'network-only',\n errorPolicy: 'all',\n });\n\n const instrumentForCalculations = error ? `${pair}${divisionMapper(division)}${currency}` : '';\n\n return (\n <CellWithData\n currency={currency}\n pair={pair}\n record={{\n instrument,\n displayName: `${currency}${divisionMapper(division)}${pair}`,\n }}\n instrumentForCalculations={instrumentForCalculations}\n target={target}\n setSelectedCurrency={setSelectedCurrency}\n setSelectedPair={setSelectedPair}\n division={division}\n />\n );\n};\n\nexport { CellValidationWrapper };\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AAGA,IAAAE,oBAAA,GAAAF,OAAA;AACA,IAAAG,aAAA,GAAAH,OAAA;AACA,IAAAI,MAAA,GAAAJ,OAAA;AAA0C,SAAAD,uBAAAM,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAE1C,MAAMG,qBAAqB,GAAGC,IAAA,IAQI;EAAA,IARH;IAC7BC,QAAQ;IACRC,IAAI;IACJC,UAAU;IACVC,MAAM;IACNC,mBAAmB;IACnBC,eAAe;IACfC;EAC0B,CAAC,GAAAP,IAAA;EAC3B,MAAM;IAAEQ;EAAM,CAAC,GAAG,IAAAC,wBAAgB,EAGhCC,wCAAmB,EAAE;IACrBC,SAAS,EAAE;MACTC,WAAW,EAAE,CAACT,UAAU,CAAC;MACzBI;IACF,CAAC;IACDM,WAAW,EAAE,cAAc;IAC3BC,WAAW,EAAE;EACf,CAAC,CAAC;EAEF,MAAMC,yBAAyB,GAAGP,KAAK,GAAG,GAAGN,IAAI,GAAG,IAAAc,qBAAc,EAACT,QAAQ,CAAC,GAAGN,QAAQ,EAAE,GAAG,EAAE;EAE9F,OACEZ,MAAA,CAAAS,OAAA,CAAAmB,aAAA,CAACvB,aAAA,CAAAwB,YAAY;IACXjB,QAAQ,EAAEA,QAAS;IACnBC,IAAI,EAAEA,IAAK;IACXiB,MAAM,EAAE;MACNhB,UAAU;MACViB,WAAW,EAAE,GAAGnB,QAAQ,GAAG,IAAAe,qBAAc,EAACT,QAAQ,CAAC,GAAGL,IAAI;IAC5D,CAAE;IACFa,yBAAyB,EAAEA,yBAA0B;IACrDX,MAAM,EAAEA,MAAO;IACfC,mBAAmB,EAAEA,mBAAoB;IACzCC,eAAe,EAAEA,eAAgB;IACjCC,QAAQ,EAAEA;EAAS,CACpB,CAAC;AAEN,CAAC;AAACc,OAAA,CAAAtB,qBAAA,GAAAA,qBAAA","ignoreList":[]}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { useSuspenseQuery } from '@apollo/client';
|
|
3
|
-
import { validateInstruments } from '../../gql/validateInstruments';
|
|
4
|
-
import { CellWithData } from './CellWithData';
|
|
5
|
-
import { divisionMapper } from '../utils';
|
|
6
|
-
const CellValidationWrapper = _ref => {
|
|
7
|
-
let {
|
|
8
|
-
currency,
|
|
9
|
-
pair,
|
|
10
|
-
instrument,
|
|
11
|
-
target,
|
|
12
|
-
setSelectedCurrency,
|
|
13
|
-
setSelectedPair,
|
|
14
|
-
division
|
|
15
|
-
} = _ref;
|
|
16
|
-
const {
|
|
17
|
-
error
|
|
18
|
-
} = useSuspenseQuery(validateInstruments, {
|
|
19
|
-
variables: {
|
|
20
|
-
instruments: [instrument],
|
|
21
|
-
division
|
|
22
|
-
},
|
|
23
|
-
fetchPolicy: 'network-only',
|
|
24
|
-
errorPolicy: 'all'
|
|
25
|
-
});
|
|
26
|
-
const instrumentForCalculations = error ? `${pair}${divisionMapper(division)}${currency}` : '';
|
|
27
|
-
return React.createElement(CellWithData, {
|
|
28
|
-
currency: currency,
|
|
29
|
-
pair: pair,
|
|
30
|
-
record: {
|
|
31
|
-
instrument,
|
|
32
|
-
displayName: `${currency}${divisionMapper(division)}${pair}`
|
|
33
|
-
},
|
|
34
|
-
instrumentForCalculations: instrumentForCalculations,
|
|
35
|
-
target: target,
|
|
36
|
-
setSelectedCurrency: setSelectedCurrency,
|
|
37
|
-
setSelectedPair: setSelectedPair,
|
|
38
|
-
division: division
|
|
39
|
-
});
|
|
40
|
-
};
|
|
41
|
-
export { CellValidationWrapper };
|
|
42
|
-
//# sourceMappingURL=CellValidationWrapper.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"CellValidationWrapper.js","names":["React","useSuspenseQuery","validateInstruments","CellWithData","divisionMapper","CellValidationWrapper","_ref","currency","pair","instrument","target","setSelectedCurrency","setSelectedPair","division","error","variables","instruments","fetchPolicy","errorPolicy","instrumentForCalculations","createElement","record","displayName"],"sources":["../../../../src/CurrencyCrossTableWidget/components/CellValidationWrapper.tsx"],"sourcesContent":["import React from 'react';\nimport { useSuspenseQuery } from '@apollo/client';\nimport { CellValidationWrapperProps } from './types';\nimport { ValidateInstrumentsQuery, ValidateInstrumentsQueryVariables } from '../../gql/types/graphql';\nimport { validateInstruments } from '../../gql/validateInstruments';\nimport { CellWithData } from './CellWithData';\nimport { divisionMapper } from '../utils';\n\nconst CellValidationWrapper = ({\n currency,\n pair,\n instrument,\n target,\n setSelectedCurrency,\n setSelectedPair,\n division,\n}: CellValidationWrapperProps) => {\n const { error } = useSuspenseQuery<\n ValidateInstrumentsQuery,\n ValidateInstrumentsQueryVariables\n >(validateInstruments, {\n variables: {\n instruments: [instrument],\n division,\n },\n fetchPolicy: 'network-only',\n errorPolicy: 'all',\n });\n\n const instrumentForCalculations = error ? `${pair}${divisionMapper(division)}${currency}` : '';\n\n return (\n <CellWithData\n currency={currency}\n pair={pair}\n record={{\n instrument,\n displayName: `${currency}${divisionMapper(division)}${pair}`,\n }}\n instrumentForCalculations={instrumentForCalculations}\n target={target}\n setSelectedCurrency={setSelectedCurrency}\n setSelectedPair={setSelectedPair}\n division={division}\n />\n );\n};\n\nexport { CellValidationWrapper };\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,gBAAgB,QAAQ,gBAAgB;AAGjD,SAASC,mBAAmB,QAAQ,+BAA+B;AACnE,SAASC,YAAY,QAAQ,gBAAgB;AAC7C,SAASC,cAAc,QAAQ,UAAU;AAEzC,MAAMC,qBAAqB,GAAGC,IAAA,IAQI;EAAA,IARH;IAC7BC,QAAQ;IACRC,IAAI;IACJC,UAAU;IACVC,MAAM;IACNC,mBAAmB;IACnBC,eAAe;IACfC;EAC0B,CAAC,GAAAP,IAAA;EAC3B,MAAM;IAAEQ;EAAM,CAAC,GAAGb,gBAAgB,CAGhCC,mBAAmB,EAAE;IACrBa,SAAS,EAAE;MACTC,WAAW,EAAE,CAACP,UAAU,CAAC;MACzBI;IACF,CAAC;IACDI,WAAW,EAAE,cAAc;IAC3BC,WAAW,EAAE;EACf,CAAC,CAAC;EAEF,MAAMC,yBAAyB,GAAGL,KAAK,GAAG,GAAGN,IAAI,GAAGJ,cAAc,CAACS,QAAQ,CAAC,GAAGN,QAAQ,EAAE,GAAG,EAAE;EAE9F,OACEP,KAAA,CAAAoB,aAAA,CAACjB,YAAY;IACXI,QAAQ,EAAEA,QAAS;IACnBC,IAAI,EAAEA,IAAK;IACXa,MAAM,EAAE;MACNZ,UAAU;MACVa,WAAW,EAAE,GAAGf,QAAQ,GAAGH,cAAc,CAACS,QAAQ,CAAC,GAAGL,IAAI;IAC5D,CAAE;IACFW,yBAAyB,EAAEA,yBAA0B;IACrDT,MAAM,EAAEA,MAAO;IACfC,mBAAmB,EAAEA,mBAAoB;IACzCC,eAAe,EAAEA,eAAgB;IACjCC,QAAQ,EAAEA;EAAS,CACpB,CAAC;AAEN,CAAC;AAED,SAASR,qBAAqB","ignoreList":[]}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { CellValidationWrapperProps } from './types';
|
|
3
|
-
declare const CellValidationWrapper: ({ currency, pair, instrument, target, setSelectedCurrency, setSelectedPair, division, }: CellValidationWrapperProps) => React.JSX.Element;
|
|
4
|
-
export { CellValidationWrapper };
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { useSuspenseQuery } from '@apollo/client';
|
|
3
|
-
import { CellValidationWrapperProps } from './types';
|
|
4
|
-
import { ValidateInstrumentsQuery, ValidateInstrumentsQueryVariables } from '../../gql/types/graphql';
|
|
5
|
-
import { validateInstruments } from '../../gql/validateInstruments';
|
|
6
|
-
import { CellWithData } from './CellWithData';
|
|
7
|
-
import { divisionMapper } from '../utils';
|
|
8
|
-
|
|
9
|
-
const CellValidationWrapper = ({
|
|
10
|
-
currency,
|
|
11
|
-
pair,
|
|
12
|
-
instrument,
|
|
13
|
-
target,
|
|
14
|
-
setSelectedCurrency,
|
|
15
|
-
setSelectedPair,
|
|
16
|
-
division,
|
|
17
|
-
}: CellValidationWrapperProps) => {
|
|
18
|
-
const { error } = useSuspenseQuery<
|
|
19
|
-
ValidateInstrumentsQuery,
|
|
20
|
-
ValidateInstrumentsQueryVariables
|
|
21
|
-
>(validateInstruments, {
|
|
22
|
-
variables: {
|
|
23
|
-
instruments: [instrument],
|
|
24
|
-
division,
|
|
25
|
-
},
|
|
26
|
-
fetchPolicy: 'network-only',
|
|
27
|
-
errorPolicy: 'all',
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
const instrumentForCalculations = error ? `${pair}${divisionMapper(division)}${currency}` : '';
|
|
31
|
-
|
|
32
|
-
return (
|
|
33
|
-
<CellWithData
|
|
34
|
-
currency={currency}
|
|
35
|
-
pair={pair}
|
|
36
|
-
record={{
|
|
37
|
-
instrument,
|
|
38
|
-
displayName: `${currency}${divisionMapper(division)}${pair}`,
|
|
39
|
-
}}
|
|
40
|
-
instrumentForCalculations={instrumentForCalculations}
|
|
41
|
-
target={target}
|
|
42
|
-
setSelectedCurrency={setSelectedCurrency}
|
|
43
|
-
setSelectedPair={setSelectedPair}
|
|
44
|
-
division={division}
|
|
45
|
-
/>
|
|
46
|
-
);
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
export { CellValidationWrapper };
|