@oanda/labs-crowd-view-widget 1.0.60 → 1.0.61
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 +248 -0
- package/dist/main/CrowdViewWidget/Main.js +7 -13
- package/dist/main/CrowdViewWidget/Main.js.map +1 -1
- package/dist/main/CrowdViewWidget/components/Chart/chartOptions/getSeriesCandlestickConfig.js +16 -7
- package/dist/main/CrowdViewWidget/components/Chart/chartOptions/getSeriesCandlestickConfig.js.map +1 -1
- package/dist/main/CrowdViewWidget/components/Chart/dataUtils/getInstrumentConfig.js +19 -0
- package/dist/main/CrowdViewWidget/components/Chart/dataUtils/getInstrumentConfig.js.map +1 -0
- package/dist/main/CrowdViewWidget/components/Chart/dataUtils/index.js +4 -4
- package/dist/main/CrowdViewWidget/components/Chart/dataUtils/index.js.map +1 -1
- package/dist/main/CrowdViewWidget/components/Chart/getOption.js +2 -1
- package/dist/main/CrowdViewWidget/components/Chart/getOption.js.map +1 -1
- package/dist/main/CrowdViewWidget/selectConfig.js +58 -4
- package/dist/main/CrowdViewWidget/selectConfig.js.map +1 -1
- package/dist/main/translations/index.js +3 -11
- package/dist/main/translations/index.js.map +1 -1
- package/dist/main/translations/sources/en.json +7 -7
- package/dist/main/translations/sources/ja.json +30 -0
- package/dist/module/CrowdViewWidget/Main.js +10 -16
- package/dist/module/CrowdViewWidget/Main.js.map +1 -1
- package/dist/module/CrowdViewWidget/components/Chart/chartOptions/getSeriesCandlestickConfig.js +16 -7
- package/dist/module/CrowdViewWidget/components/Chart/chartOptions/getSeriesCandlestickConfig.js.map +1 -1
- package/dist/module/CrowdViewWidget/components/Chart/dataUtils/getInstrumentConfig.js +12 -0
- package/dist/module/CrowdViewWidget/components/Chart/dataUtils/getInstrumentConfig.js.map +1 -0
- package/dist/module/CrowdViewWidget/components/Chart/dataUtils/index.js +1 -1
- package/dist/module/CrowdViewWidget/components/Chart/dataUtils/index.js.map +1 -1
- package/dist/module/CrowdViewWidget/components/Chart/getOption.js +2 -1
- package/dist/module/CrowdViewWidget/components/Chart/getOption.js.map +1 -1
- package/dist/module/CrowdViewWidget/selectConfig.js +57 -4
- package/dist/module/CrowdViewWidget/selectConfig.js.map +1 -1
- package/dist/module/translations/index.js +3 -11
- package/dist/module/translations/index.js.map +1 -1
- package/dist/module/translations/sources/en.json +7 -7
- package/dist/module/translations/sources/ja.json +30 -0
- package/dist/types/CrowdViewWidget/components/Chart/chartOptions/getSeriesCandlestickConfig.d.ts +2 -1
- package/dist/types/CrowdViewWidget/components/Chart/dataUtils/{getInstrumentConfigForDivision.d.ts → getInstrumentConfig.d.ts} +1 -1
- package/dist/types/CrowdViewWidget/components/Chart/dataUtils/index.d.ts +1 -1
- package/dist/types/CrowdViewWidget/selectConfig.d.ts +8 -2
- package/lokalise.config.json +2 -2
- package/package.json +3 -3
- package/src/CrowdViewWidget/Main.tsx +11 -17
- package/src/CrowdViewWidget/components/Chart/chartOptions/getSeriesCandlestickConfig.ts +19 -6
- package/src/CrowdViewWidget/components/Chart/dataUtils/getInstrumentConfig.ts +20 -0
- package/src/CrowdViewWidget/components/Chart/dataUtils/index.ts +1 -1
- package/src/CrowdViewWidget/components/Chart/getOption.ts +1 -0
- package/src/CrowdViewWidget/selectConfig.ts +75 -4
- package/src/translations/index.ts +2 -6
- package/src/translations/sources/en.json +7 -7
- package/src/translations/sources/ja.json +30 -0
- package/test/utils/instrumentUtils.test.ts +38 -9
- package/dist/main/CrowdViewWidget/components/Chart/dataUtils/getInstrumentConfigForDivision.js +0 -13
- package/dist/main/CrowdViewWidget/components/Chart/dataUtils/getInstrumentConfigForDivision.js.map +0 -1
- package/dist/main/translations/sources/es.json +0 -2
- package/dist/main/translations/sources/th.json +0 -2
- package/dist/main/translations/sources/zh_TW.json +0 -2
- package/dist/module/CrowdViewWidget/components/Chart/dataUtils/getInstrumentConfigForDivision.js +0 -6
- package/dist/module/CrowdViewWidget/components/Chart/dataUtils/getInstrumentConfigForDivision.js.map +0 -1
- package/dist/module/translations/sources/es.json +0 -2
- package/dist/module/translations/sources/th.json +0 -2
- package/dist/module/translations/sources/zh_TW.json +0 -2
- package/src/CrowdViewWidget/components/Chart/dataUtils/getInstrumentConfigForDivision.ts +0 -11
- package/src/translations/sources/es.json +0 -2
- package/src/translations/sources/th.json +0 -2
- package/src/translations/sources/zh_TW.json +0 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oanda/labs-crowd-view-widget",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.61",
|
|
4
4
|
"description": "Labs Crowd View Widget",
|
|
5
5
|
"main": "dist/main/index.js",
|
|
6
6
|
"module": "dist/module/index.js",
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"author": "OANDA",
|
|
14
14
|
"license": "UNLICENSED",
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@oanda/labs-widget-common": "^1.0.
|
|
16
|
+
"@oanda/labs-widget-common": "^1.0.243",
|
|
17
17
|
"@oanda/mono-i18n": "10.0.1",
|
|
18
18
|
"chroma-js": "^3.1.2",
|
|
19
19
|
"decimal.js": "^10.6.0",
|
|
@@ -24,5 +24,5 @@
|
|
|
24
24
|
"@graphql-codegen/client-preset": "4.1.0",
|
|
25
25
|
"@types/chroma-js": "^3.1.2"
|
|
26
26
|
},
|
|
27
|
-
"gitHead": "
|
|
27
|
+
"gitHead": "f3d41f07e0f42d2885b8e6aac34c886d24f321c6"
|
|
28
28
|
}
|
|
@@ -5,37 +5,31 @@ import {
|
|
|
5
5
|
Tabs,
|
|
6
6
|
useLayoutProvider,
|
|
7
7
|
} from '@oanda/labs-widget-common';
|
|
8
|
-
import { useLocale } from '@oanda/mono-i18n';
|
|
8
|
+
import { Locale, useLocale } from '@oanda/mono-i18n';
|
|
9
9
|
import React, { useEffect, useMemo, useState } from 'react';
|
|
10
10
|
|
|
11
11
|
import type { Granularity } from '../gql/types/graphql';
|
|
12
12
|
import { BookType } from '../gql/types/graphql';
|
|
13
|
-
import { ChartWithData, Legend } from './components';
|
|
14
|
-
import {
|
|
15
|
-
import { granularitySelectConfig, navigationConfig } from './selectConfig';
|
|
13
|
+
import { ChartWithData, getInstrumentConfig, Legend } from './components';
|
|
14
|
+
import { getGranularitySelectConfig, navigationConfig } from './selectConfig';
|
|
16
15
|
import type { InstrumentId, MainProps } from './types';
|
|
17
16
|
|
|
18
17
|
const Main = ({ division }: MainProps) => {
|
|
19
|
-
const { lang } = useLocale();
|
|
18
|
+
const { lang, locale } = useLocale();
|
|
20
19
|
const { size } = useLayoutProvider();
|
|
21
20
|
const isDesktop = size === Size.DESKTOP;
|
|
21
|
+
const isJapanese = locale === Locale.ja;
|
|
22
22
|
|
|
23
23
|
const [bookType, setBookType] = useState(BookType.Order);
|
|
24
24
|
|
|
25
25
|
const granularitySelectConfigWithLang = useMemo(
|
|
26
|
-
() =>
|
|
27
|
-
|
|
28
|
-
...opt,
|
|
29
|
-
label: lang(opt.label),
|
|
30
|
-
})),
|
|
31
|
-
[lang]
|
|
26
|
+
() => getGranularitySelectConfig(lang, isJapanese),
|
|
27
|
+
[lang, isJapanese]
|
|
32
28
|
);
|
|
33
29
|
|
|
34
|
-
const
|
|
35
|
-
|
|
36
|
-
const [instrument, setInstrument] = useState(
|
|
37
|
-
instrumentSelectConfigWithDivision[0]
|
|
38
|
-
);
|
|
30
|
+
const instrumentSelectConfig = getInstrumentConfig(division, isJapanese);
|
|
31
|
+
|
|
32
|
+
const [instrument, setInstrument] = useState(instrumentSelectConfig[0]);
|
|
39
33
|
|
|
40
34
|
const [granularity, setGranularity] = useState(
|
|
41
35
|
granularitySelectConfigWithLang[0]
|
|
@@ -74,7 +68,7 @@ const Main = ({ division }: MainProps) => {
|
|
|
74
68
|
})}
|
|
75
69
|
>
|
|
76
70
|
<Select
|
|
77
|
-
options={
|
|
71
|
+
options={instrumentSelectConfig}
|
|
78
72
|
searchPlaceholder={lang('search')}
|
|
79
73
|
selectLabel={lang('instrument')}
|
|
80
74
|
selectedOption={instrument}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Locale } from '@oanda/mono-i18n';
|
|
1
2
|
import chroma from 'chroma-js';
|
|
2
3
|
import type { CandlestickSeriesOption } from 'echarts';
|
|
3
4
|
|
|
@@ -6,13 +7,30 @@ import type { ChartStyles } from '../chartUtils/getChartStyles';
|
|
|
6
7
|
interface GetSeriesCandlestickConfigParams {
|
|
7
8
|
styles: ChartStyles;
|
|
8
9
|
isLoading: boolean;
|
|
10
|
+
locale: string;
|
|
9
11
|
}
|
|
10
12
|
|
|
11
13
|
export const getSeriesCandlestickConfig = ({
|
|
12
14
|
styles,
|
|
13
15
|
isLoading,
|
|
16
|
+
locale,
|
|
14
17
|
}: GetSeriesCandlestickConfigParams): CandlestickSeriesOption => {
|
|
15
18
|
const { candleLongColor, candleShortColor } = styles;
|
|
19
|
+
const isJapanese = locale === Locale.ja;
|
|
20
|
+
|
|
21
|
+
const itemStyle = isJapanese
|
|
22
|
+
? {
|
|
23
|
+
color: chroma(candleShortColor).desaturate().css(),
|
|
24
|
+
color0: chroma(candleLongColor).desaturate().css(),
|
|
25
|
+
borderColor: candleShortColor,
|
|
26
|
+
borderColor0: candleLongColor,
|
|
27
|
+
}
|
|
28
|
+
: {
|
|
29
|
+
color: chroma(candleLongColor).desaturate().css(),
|
|
30
|
+
color0: chroma(candleShortColor).desaturate().css(),
|
|
31
|
+
borderColor: candleLongColor,
|
|
32
|
+
borderColor0: candleShortColor,
|
|
33
|
+
};
|
|
16
34
|
|
|
17
35
|
return {
|
|
18
36
|
animation: isLoading,
|
|
@@ -27,12 +45,7 @@ export const getSeriesCandlestickConfig = ({
|
|
|
27
45
|
x: 'dates',
|
|
28
46
|
y: ['open', 'close', 'low', 'high'],
|
|
29
47
|
},
|
|
30
|
-
itemStyle
|
|
31
|
-
color: chroma(candleLongColor).desaturate().css(),
|
|
32
|
-
color0: chroma(candleShortColor).desaturate().css(),
|
|
33
|
-
borderColor: candleLongColor,
|
|
34
|
-
borderColor0: candleShortColor,
|
|
35
|
-
},
|
|
48
|
+
itemStyle,
|
|
36
49
|
emphasis: {
|
|
37
50
|
itemStyle: {
|
|
38
51
|
color: candleLongColor,
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Division } from '../../../../gql/types/graphql';
|
|
2
|
+
import {
|
|
3
|
+
instrumentSelectConfig,
|
|
4
|
+
instrumentSelectConfigJa,
|
|
5
|
+
instrumentSelectConfigOC,
|
|
6
|
+
} from '../../../selectConfig';
|
|
7
|
+
|
|
8
|
+
export const getInstrumentConfig = (
|
|
9
|
+
division: Division,
|
|
10
|
+
isJapanese: boolean
|
|
11
|
+
) => {
|
|
12
|
+
if (isJapanese) {
|
|
13
|
+
return instrumentSelectConfigJa;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
if (division === Division.Oc) {
|
|
17
|
+
return instrumentSelectConfigOC;
|
|
18
|
+
}
|
|
19
|
+
return instrumentSelectConfig;
|
|
20
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export * from './getBucketWidthMultiplayer';
|
|
2
|
-
export * from './
|
|
2
|
+
export * from './getInstrumentConfig';
|
|
3
3
|
export * from './getTimeSpanForGranularity';
|
|
4
4
|
export * from './processOrderPositionBooks';
|
|
5
5
|
export * from './processPriceCandles';
|
|
@@ -83,20 +83,91 @@ const instrumentSelectConfig = [
|
|
|
83
83
|
},
|
|
84
84
|
];
|
|
85
85
|
|
|
86
|
-
const
|
|
86
|
+
const instrumentSelectConfigJa = [
|
|
87
|
+
{
|
|
88
|
+
id: InstrumentId.USD_JPY,
|
|
89
|
+
label: 'USD/JPY',
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
id: InstrumentId.EUR_JPY,
|
|
93
|
+
label: 'EUR/JPY',
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
id: InstrumentId.GBP_JPY,
|
|
97
|
+
label: 'GBP/JPY',
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
id: InstrumentId.AUD_JPY,
|
|
101
|
+
label: 'AUD/JPY',
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
id: InstrumentId.EUR_USD,
|
|
105
|
+
label: 'EUR/USD',
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
id: InstrumentId.EUR_AUD,
|
|
109
|
+
label: 'EUR/AUD',
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
id: InstrumentId.EUR_GBP,
|
|
113
|
+
label: 'EUR/GBP',
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
id: InstrumentId.EUR_CHF,
|
|
117
|
+
label: 'EUR/CHF',
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
id: InstrumentId.USD_CHF,
|
|
121
|
+
label: 'USD/CHF',
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
id: InstrumentId.USD_CAD,
|
|
125
|
+
label: 'USD/CAD',
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
id: InstrumentId.GBP_USD,
|
|
129
|
+
label: 'GBP/USD',
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
id: InstrumentId.GBP_CHF,
|
|
133
|
+
label: 'GBP/CHF',
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
id: InstrumentId.AUD_USD,
|
|
137
|
+
label: 'AUD/USD',
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
id: InstrumentId.NZD_USD,
|
|
141
|
+
label: 'NZD/USD',
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
id: InstrumentId.XAU_USD,
|
|
145
|
+
label: 'XAU/USD',
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
id: InstrumentId.XAG_USD,
|
|
149
|
+
label: 'XAG/USD',
|
|
150
|
+
},
|
|
151
|
+
];
|
|
152
|
+
|
|
153
|
+
const getGranularitySelectConfig = (
|
|
154
|
+
lang: (key: string, options?: { count?: number }) => string,
|
|
155
|
+
isJapanese: boolean
|
|
156
|
+
) => [
|
|
87
157
|
{
|
|
88
158
|
id: Granularity.H1,
|
|
89
|
-
label: '
|
|
159
|
+
label: lang(isJapanese ? 'hour_plural' : 'hour', { count: 1 }),
|
|
90
160
|
},
|
|
91
161
|
{
|
|
92
162
|
id: Granularity.H4,
|
|
93
|
-
label: '
|
|
163
|
+
label: lang('hour_plural', { count: 4 }),
|
|
94
164
|
},
|
|
95
165
|
];
|
|
96
166
|
|
|
97
167
|
export {
|
|
98
|
-
|
|
168
|
+
getGranularitySelectConfig,
|
|
99
169
|
instrumentSelectConfig,
|
|
170
|
+
instrumentSelectConfigJa,
|
|
100
171
|
instrumentSelectConfigOC,
|
|
101
172
|
navigationConfig,
|
|
102
173
|
};
|
|
@@ -2,16 +2,12 @@ import type { Translations } from '@oanda/mono-i18n';
|
|
|
2
2
|
import { Locale } from '@oanda/mono-i18n';
|
|
3
3
|
|
|
4
4
|
import en from './sources/en.json';
|
|
5
|
-
import
|
|
6
|
-
import th from './sources/th.json';
|
|
7
|
-
import zhTW from './sources/zh_TW.json';
|
|
5
|
+
import ja from './sources/ja.json';
|
|
8
6
|
import type { defaultTranslations } from './translations';
|
|
9
7
|
|
|
10
8
|
export type TranslationKey = keyof typeof defaultTranslations;
|
|
11
9
|
|
|
12
10
|
export const translations: Translations = {
|
|
13
11
|
[Locale.en]: { translation: en },
|
|
14
|
-
[Locale.
|
|
15
|
-
[Locale.es]: { translation: es },
|
|
16
|
-
[Locale.th]: { translation: th },
|
|
12
|
+
[Locale.ja]: { translation: ja },
|
|
17
13
|
};
|
|
@@ -1,8 +1,4 @@
|
|
|
1
1
|
{
|
|
2
|
-
"1_hour": "1 hour",
|
|
3
|
-
"15_minutes": "15 minutes",
|
|
4
|
-
"4_hours": "4 hours",
|
|
5
|
-
"5_minutes": "5 minutes",
|
|
6
2
|
"buy": "Buy",
|
|
7
3
|
"buy_overbalance": "Buy overbalance",
|
|
8
4
|
"candle": "Candle",
|
|
@@ -11,16 +7,21 @@
|
|
|
11
7
|
"even_market_demand": "Even market demand",
|
|
12
8
|
"granularity": "Granularity",
|
|
13
9
|
"high": "High",
|
|
10
|
+
"hour": "{{count}} Hour",
|
|
11
|
+
"hour_plural": "{{count}} Hours",
|
|
12
|
+
"hover_chart_to_see_more_details": "Hover over the chart to see more details",
|
|
14
13
|
"instrument": "Instrument",
|
|
15
14
|
"long": "Long",
|
|
16
15
|
"long_overbalance": "Long overbalance",
|
|
17
16
|
"low": "Low",
|
|
17
|
+
"minute": "{{count}} Minute",
|
|
18
|
+
"minute_plural": "{{count}} Minutes",
|
|
18
19
|
"no_matching_results": "No matching results",
|
|
19
20
|
"open": "Open",
|
|
20
|
-
"order_book": "Order
|
|
21
|
+
"order_book": "Order Book",
|
|
21
22
|
"orders": "Orders",
|
|
22
23
|
"pagination_entries_range": "{{firstItemOnPage}}-{{lastItemOnPage}} of {{itemCount}} entries",
|
|
23
|
-
"position_book": "Position
|
|
24
|
+
"position_book": "Position Book",
|
|
24
25
|
"price": "Price",
|
|
25
26
|
"price_range": "Price range",
|
|
26
27
|
"search": "Search",
|
|
@@ -30,6 +31,5 @@
|
|
|
30
31
|
"short": "Short",
|
|
31
32
|
"short_overbalance": "Short overbalance",
|
|
32
33
|
"tap_chart_to_see_more_details": "Tap the chart to see more details",
|
|
33
|
-
"hover_chart_to_see_more_details": "Hover over the chart to see more details",
|
|
34
34
|
"trades": "Trades"
|
|
35
35
|
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
{
|
|
2
|
+
"buy": "購入",
|
|
3
|
+
"buy_overbalance": "買い超過",
|
|
4
|
+
"candle": "ローソク足",
|
|
5
|
+
"close": "閉じる",
|
|
6
|
+
"data_unavailable": "データが利用できません",
|
|
7
|
+
"even_market_demand": "均衡需要",
|
|
8
|
+
"granularity": "粒度",
|
|
9
|
+
"high": "高値",
|
|
10
|
+
"hour_plural": "{{count}} 時間",
|
|
11
|
+
"hover_chart_to_see_more_details": "チャートの上にカーソルを合わせると詳細を確認できます",
|
|
12
|
+
"instrument": "金融商品",
|
|
13
|
+
"long": "ロング",
|
|
14
|
+
"long_overbalance": "ロング超過",
|
|
15
|
+
"low": "安値",
|
|
16
|
+
"open": "オープン",
|
|
17
|
+
"order_book": "オーダーブック",
|
|
18
|
+
"orders": "注文",
|
|
19
|
+
"position_book": "ポジションブック",
|
|
20
|
+
"price": "価格",
|
|
21
|
+
"price_range": "価格範囲",
|
|
22
|
+
"search": "検索",
|
|
23
|
+
"sell": "売り",
|
|
24
|
+
"sell_overbalance": "売り超過",
|
|
25
|
+
"sentiment": "センチメント",
|
|
26
|
+
"short": "ショート",
|
|
27
|
+
"short_overbalance": "ショート超過",
|
|
28
|
+
"tap_chart_to_see_more_details": "チャートをタップすると詳細を確認できます",
|
|
29
|
+
"trades": "取引"
|
|
30
|
+
}
|
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
* @jest-environment jsdom
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import { getInstrumentConfig } from '../../src/CrowdViewWidget/components/Chart/dataUtils/getInstrumentConfig';
|
|
6
6
|
import { Division } from '../../src/gql/types/graphql';
|
|
7
7
|
|
|
8
8
|
describe('instrumentUtils', () => {
|
|
9
|
-
describe('
|
|
10
|
-
it('should return OC instrument config for OC division', () => {
|
|
11
|
-
const result =
|
|
9
|
+
describe('getInstrumentConfig', () => {
|
|
10
|
+
it('should return OC instrument config for OC division when not Japanese', () => {
|
|
11
|
+
const result = getInstrumentConfig(Division.Oc, false);
|
|
12
12
|
|
|
13
13
|
expect(result).toBeDefined();
|
|
14
14
|
expect(Array.isArray(result)).toBe(true);
|
|
@@ -23,8 +23,8 @@ describe('instrumentUtils', () => {
|
|
|
23
23
|
expect(firstInstrument.id.length).toBeGreaterThan(0);
|
|
24
24
|
});
|
|
25
25
|
|
|
26
|
-
it('should return OAP instrument config for OAP division', () => {
|
|
27
|
-
const result =
|
|
26
|
+
it('should return OAP instrument config for OAP division when not Japanese', () => {
|
|
27
|
+
const result = getInstrumentConfig(Division.Oap, false);
|
|
28
28
|
|
|
29
29
|
expect(result).toBeDefined();
|
|
30
30
|
expect(Array.isArray(result)).toBe(true);
|
|
@@ -39,9 +39,31 @@ describe('instrumentUtils', () => {
|
|
|
39
39
|
expect(firstInstrument.id.length).toBeGreaterThan(0);
|
|
40
40
|
});
|
|
41
41
|
|
|
42
|
-
it('should return
|
|
43
|
-
const
|
|
44
|
-
|
|
42
|
+
it('should return Japanese instrument config when isJapanese is true', () => {
|
|
43
|
+
const result = getInstrumentConfig(Division.Oc, true);
|
|
44
|
+
|
|
45
|
+
expect(result).toBeDefined();
|
|
46
|
+
expect(Array.isArray(result)).toBe(true);
|
|
47
|
+
expect(result.length).toBeGreaterThan(0);
|
|
48
|
+
|
|
49
|
+
// Check that the first instrument has the expected structure
|
|
50
|
+
const firstInstrument = result[0];
|
|
51
|
+
expect(firstInstrument).toHaveProperty('id');
|
|
52
|
+
expect(firstInstrument).toHaveProperty('label');
|
|
53
|
+
expect(typeof firstInstrument.id).toBe('string');
|
|
54
|
+
expect(firstInstrument.id.length).toBeGreaterThan(0);
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
it('should return Japanese config regardless of division when isJapanese is true', () => {
|
|
58
|
+
const ocJapaneseConfig = getInstrumentConfig(Division.Oc, true);
|
|
59
|
+
const oapJapaneseConfig = getInstrumentConfig(Division.Oap, true);
|
|
60
|
+
|
|
61
|
+
expect(ocJapaneseConfig).toEqual(oapJapaneseConfig);
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
it('should return different configs for different divisions when not Japanese', () => {
|
|
65
|
+
const ocConfig = getInstrumentConfig(Division.Oc, false);
|
|
66
|
+
const oapConfig = getInstrumentConfig(Division.Oap, false);
|
|
45
67
|
|
|
46
68
|
expect(ocConfig).not.toEqual(oapConfig);
|
|
47
69
|
|
|
@@ -54,5 +76,12 @@ describe('instrumentUtils', () => {
|
|
|
54
76
|
// OAP config includes XAU_USD and XAG_USD which OC doesn't have
|
|
55
77
|
expect(oapConfig.length).toBeGreaterThan(ocConfig.length);
|
|
56
78
|
});
|
|
79
|
+
|
|
80
|
+
it('should return different configs for Japanese vs non-Japanese', () => {
|
|
81
|
+
const japaneseConfig = getInstrumentConfig(Division.Oc, true);
|
|
82
|
+
const nonJapaneseConfig = getInstrumentConfig(Division.Oc, false);
|
|
83
|
+
|
|
84
|
+
expect(japaneseConfig).not.toEqual(nonJapaneseConfig);
|
|
85
|
+
});
|
|
57
86
|
});
|
|
58
87
|
});
|
package/dist/main/CrowdViewWidget/components/Chart/dataUtils/getInstrumentConfigForDivision.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.getInstrumentConfigForDivision = void 0;
|
|
7
|
-
var _graphql = require("../../../../gql/types/graphql");
|
|
8
|
-
var _selectConfig = require("../../../selectConfig");
|
|
9
|
-
const getInstrumentConfigForDivision = division => {
|
|
10
|
-
return division === _graphql.Division.Oc ? _selectConfig.instrumentSelectConfigOC : _selectConfig.instrumentSelectConfig;
|
|
11
|
-
};
|
|
12
|
-
exports.getInstrumentConfigForDivision = getInstrumentConfigForDivision;
|
|
13
|
-
//# sourceMappingURL=getInstrumentConfigForDivision.js.map
|
package/dist/main/CrowdViewWidget/components/Chart/dataUtils/getInstrumentConfigForDivision.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getInstrumentConfigForDivision.js","names":["_graphql","require","_selectConfig","getInstrumentConfigForDivision","division","Division","Oc","instrumentSelectConfigOC","instrumentSelectConfig","exports"],"sources":["../../../../../../src/CrowdViewWidget/components/Chart/dataUtils/getInstrumentConfigForDivision.ts"],"sourcesContent":["import { Division } from '../../../../gql/types/graphql';\nimport {\n instrumentSelectConfig,\n instrumentSelectConfigOC,\n} from '../../../selectConfig';\n\nexport const getInstrumentConfigForDivision = (division: Division) => {\n return division === Division.Oc\n ? instrumentSelectConfigOC\n : instrumentSelectConfig;\n};\n"],"mappings":";;;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,aAAA,GAAAD,OAAA;AAKO,MAAME,8BAA8B,GAAIC,QAAkB,IAAK;EACpE,OAAOA,QAAQ,KAAKC,iBAAQ,CAACC,EAAE,GAC3BC,sCAAwB,GACxBC,oCAAsB;AAC5B,CAAC;AAACC,OAAA,CAAAN,8BAAA,GAAAA,8BAAA","ignoreList":[]}
|
package/dist/module/CrowdViewWidget/components/Chart/dataUtils/getInstrumentConfigForDivision.js
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { Division } from '../../../../gql/types/graphql';
|
|
2
|
-
import { instrumentSelectConfig, instrumentSelectConfigOC } from '../../../selectConfig';
|
|
3
|
-
export const getInstrumentConfigForDivision = division => {
|
|
4
|
-
return division === Division.Oc ? instrumentSelectConfigOC : instrumentSelectConfig;
|
|
5
|
-
};
|
|
6
|
-
//# sourceMappingURL=getInstrumentConfigForDivision.js.map
|
package/dist/module/CrowdViewWidget/components/Chart/dataUtils/getInstrumentConfigForDivision.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getInstrumentConfigForDivision.js","names":["Division","instrumentSelectConfig","instrumentSelectConfigOC","getInstrumentConfigForDivision","division","Oc"],"sources":["../../../../../../src/CrowdViewWidget/components/Chart/dataUtils/getInstrumentConfigForDivision.ts"],"sourcesContent":["import { Division } from '../../../../gql/types/graphql';\nimport {\n instrumentSelectConfig,\n instrumentSelectConfigOC,\n} from '../../../selectConfig';\n\nexport const getInstrumentConfigForDivision = (division: Division) => {\n return division === Division.Oc\n ? instrumentSelectConfigOC\n : instrumentSelectConfig;\n};\n"],"mappings":"AAAA,SAASA,QAAQ,QAAQ,+BAA+B;AACxD,SACEC,sBAAsB,EACtBC,wBAAwB,QACnB,uBAAuB;AAE9B,OAAO,MAAMC,8BAA8B,GAAIC,QAAkB,IAAK;EACpE,OAAOA,QAAQ,KAAKJ,QAAQ,CAACK,EAAE,GAC3BH,wBAAwB,GACxBD,sBAAsB;AAC5B,CAAC","ignoreList":[]}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { Division } from '../../../../gql/types/graphql';
|
|
2
|
-
import {
|
|
3
|
-
instrumentSelectConfig,
|
|
4
|
-
instrumentSelectConfigOC,
|
|
5
|
-
} from '../../../selectConfig';
|
|
6
|
-
|
|
7
|
-
export const getInstrumentConfigForDivision = (division: Division) => {
|
|
8
|
-
return division === Division.Oc
|
|
9
|
-
? instrumentSelectConfigOC
|
|
10
|
-
: instrumentSelectConfig;
|
|
11
|
-
};
|