@oanda/labs-ticker-tape-widget 1.0.29 → 1.0.31
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 +252 -0
- package/dist/main/TickerTapeWidget/Main.js +11 -11
- package/dist/main/TickerTapeWidget/Main.js.map +1 -1
- package/dist/main/TickerTapeWidget/TickerTapeWidget.js +15 -15
- package/dist/main/TickerTapeWidget/TickerTapeWidget.js.map +1 -1
- package/dist/main/TickerTapeWidget/ValidationWrapper.js +4 -4
- package/dist/main/TickerTapeWidget/ValidationWrapper.js.map +1 -1
- package/dist/main/TickerTapeWidget/components/InstrumentRateWithData/InstrumentRateWithData.js +5 -5
- package/dist/main/TickerTapeWidget/components/InstrumentRateWithData/InstrumentRateWithData.js.map +1 -1
- package/dist/main/TickerTapeWidget/components/InstrumentRateWithData/types.js.map +1 -1
- package/dist/main/TickerTapeWidget/components/MarqueeWrapper/MarqueeWrapper.js +1 -1
- package/dist/main/TickerTapeWidget/components/MarqueeWrapper/MarqueeWrapper.js.map +1 -1
- package/dist/main/TickerTapeWidget/constant.js.map +1 -1
- package/dist/main/TickerTapeWidget/index.js +8 -8
- package/dist/main/TickerTapeWidget/index.js.map +1 -1
- package/dist/main/TickerTapeWidget/render.js +7 -7
- package/dist/main/TickerTapeWidget/render.js.map +1 -1
- package/dist/main/TickerTapeWidget/types.js +1 -1
- package/dist/main/TickerTapeWidget/types.js.map +1 -1
- package/dist/main/TickerTapeWidget/utils.js +13 -10
- package/dist/main/TickerTapeWidget/utils.js.map +1 -1
- package/dist/main/gql/getInstrumentsChart.js +3 -8
- package/dist/main/gql/getInstrumentsChart.js.map +1 -1
- package/dist/main/gql/types/fragment-masking.js +3 -2
- package/dist/main/gql/types/fragment-masking.js.map +1 -1
- package/dist/main/gql/types/gql.js +4 -3
- package/dist/main/gql/types/gql.js.map +1 -1
- package/dist/main/gql/types/graphql.js +142 -142
- package/dist/main/gql/types/graphql.js.map +1 -1
- package/dist/main/gql/types/index.js.map +1 -1
- package/dist/main/gql/validateInstruments.js +3 -8
- package/dist/main/gql/validateInstruments.js.map +1 -1
- package/dist/main/translations/index.js +1 -1
- package/dist/main/translations/index.js.map +1 -1
- package/dist/main/translations/translations.js.map +1 -1
- package/dist/module/TickerTapeWidget/Main.js +10 -10
- package/dist/module/TickerTapeWidget/Main.js.map +1 -1
- package/dist/module/TickerTapeWidget/TickerTapeWidget.js +15 -15
- package/dist/module/TickerTapeWidget/TickerTapeWidget.js.map +1 -1
- package/dist/module/TickerTapeWidget/ValidationWrapper.js +4 -4
- package/dist/module/TickerTapeWidget/ValidationWrapper.js.map +1 -1
- package/dist/module/TickerTapeWidget/components/InstrumentRateWithData/InstrumentRateWithData.js +5 -5
- package/dist/module/TickerTapeWidget/components/InstrumentRateWithData/InstrumentRateWithData.js.map +1 -1
- package/dist/module/TickerTapeWidget/components/InstrumentRateWithData/types.js.map +1 -1
- package/dist/module/TickerTapeWidget/components/MarqueeWrapper/MarqueeWrapper.js +1 -1
- package/dist/module/TickerTapeWidget/components/MarqueeWrapper/MarqueeWrapper.js.map +1 -1
- package/dist/module/TickerTapeWidget/constant.js.map +1 -1
- package/dist/module/TickerTapeWidget/index.js +1 -1
- package/dist/module/TickerTapeWidget/index.js.map +1 -1
- package/dist/module/TickerTapeWidget/render.js +7 -7
- package/dist/module/TickerTapeWidget/render.js.map +1 -1
- package/dist/module/TickerTapeWidget/types.js +1 -1
- package/dist/module/TickerTapeWidget/types.js.map +1 -1
- package/dist/module/TickerTapeWidget/utils.js +13 -10
- package/dist/module/TickerTapeWidget/utils.js.map +1 -1
- package/dist/module/gql/getInstrumentsChart.js +3 -8
- package/dist/module/gql/getInstrumentsChart.js.map +1 -1
- package/dist/module/gql/types/fragment-masking.js +3 -2
- package/dist/module/gql/types/fragment-masking.js.map +1 -1
- package/dist/module/gql/types/gql.js +4 -3
- package/dist/module/gql/types/gql.js.map +1 -1
- package/dist/module/gql/types/graphql.js +142 -142
- 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/gql/validateInstruments.js +3 -8
- package/dist/module/gql/validateInstruments.js.map +1 -1
- package/dist/module/translations/index.js +1 -1
- package/dist/module/translations/index.js.map +1 -1
- package/dist/module/translations/translations.js.map +1 -1
- package/dist/types/TickerTapeWidget/Main.d.ts +1 -1
- package/dist/types/TickerTapeWidget/TickerTapeWidget.d.ts +1 -1
- package/dist/types/TickerTapeWidget/ValidationWrapper.d.ts +1 -1
- package/dist/types/TickerTapeWidget/components/InstrumentRateWithData/InstrumentRateWithData.d.ts +1 -1
- package/dist/types/TickerTapeWidget/components/InstrumentRateWithData/types.d.ts +2 -2
- package/dist/types/TickerTapeWidget/components/MarqueeWrapper/MarqueeWrapper.d.ts +1 -1
- package/dist/types/TickerTapeWidget/constant.d.ts +1 -1
- package/dist/types/TickerTapeWidget/index.d.ts +1 -1
- package/dist/types/TickerTapeWidget/types.d.ts +3 -3
- package/dist/types/TickerTapeWidget/utils.d.ts +3 -3
- package/dist/types/gql/types/gql.d.ts +4 -4
- package/dist/types/gql/types/index.d.ts +2 -2
- package/dist/types/translations/index.d.ts +2 -2
- package/package.json +3 -3
- package/src/TickerTapeWidget/Main.tsx +23 -14
- package/src/TickerTapeWidget/TickerTapeWidget.tsx +16 -14
- package/src/TickerTapeWidget/ValidationWrapper.tsx +23 -15
- package/src/TickerTapeWidget/components/InstrumentRateWithData/InstrumentRateWithData.tsx +12 -8
- package/src/TickerTapeWidget/components/InstrumentRateWithData/types.ts +4 -3
- package/src/TickerTapeWidget/components/MarqueeWrapper/MarqueeWrapper.tsx +6 -8
- package/src/TickerTapeWidget/constant.ts +1 -3
- package/src/TickerTapeWidget/index.ts +1 -1
- package/src/TickerTapeWidget/render.tsx +47 -32
- package/src/TickerTapeWidget/types.ts +8 -3
- package/src/TickerTapeWidget/utils.ts +16 -16
- package/src/gql/types/fragment-masking.ts +41 -21
- package/src/gql/types/gql.ts +12 -5
- package/src/gql/types/graphql.ts +214 -50
- package/src/gql/types/index.ts +2 -2
- package/src/translations/index.ts +4 -4
- package/src/translations/translations.ts +2 -1
- package/test/Main.test.tsx +15 -9
- package/test/mocks.ts +1 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validateInstruments.js","names":["gql","validateInstruments"],"sources":["../../../src/gql/validateInstruments.ts"],"sourcesContent":["import { gql } from '@apollo/client';\n\nexport const validateInstruments = gql`\n query validateInstruments($instruments: [String]!, $division: Division) {\n mapInstrumentNames(instruments: $instruments, division: $division) {\n name\n displayName\n }\n }\n`;\n"],"mappings":"AAAA,SAASA,GAAG,QAAQ,gBAAgB;AAEpC,OAAO,MAAMC,mBAAmB,GAAGD,GAAG
|
|
1
|
+
{"version":3,"file":"validateInstruments.js","names":["gql","validateInstruments","_templateObject","_taggedTemplateLiteral"],"sources":["../../../src/gql/validateInstruments.ts"],"sourcesContent":["import { gql } from '@apollo/client';\n\nexport const validateInstruments = gql`\n query validateInstruments($instruments: [String]!, $division: Division) {\n mapInstrumentNames(instruments: $instruments, division: $division) {\n name\n displayName\n }\n }\n`;\n"],"mappings":";;AAAA,SAASA,GAAG,QAAQ,gBAAgB;AAEpC,OAAO,MAAMC,mBAAmB,GAAGD,GAAG,CAAAE,eAAA,KAAAA,eAAA,GAAAC,sBAAA,4MAOrC","ignoreList":[]}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Locale } from '@oanda/mono-i18n';
|
|
2
2
|
import en from './sources/en.json';
|
|
3
|
-
import zhTW from './sources/zh_TW.json';
|
|
4
3
|
import es from './sources/es.json';
|
|
5
4
|
import th from './sources/th.json';
|
|
5
|
+
import zhTW from './sources/zh_TW.json';
|
|
6
6
|
export const translations = {
|
|
7
7
|
[Locale.en]: {
|
|
8
8
|
translation: en
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["Locale","en","
|
|
1
|
+
{"version":3,"file":"index.js","names":["Locale","en","es","th","zhTW","translations","translation"],"sources":["../../../src/translations/index.ts"],"sourcesContent":["import type { Translations } from '@oanda/mono-i18n';\nimport { Locale } from '@oanda/mono-i18n';\n\nimport en from './sources/en.json';\nimport es from './sources/es.json';\nimport th from './sources/th.json';\nimport zhTW from './sources/zh_TW.json';\nimport type { defaultTranslations } from './translations';\n\nexport type TranslationKey = keyof typeof defaultTranslations;\n\nexport const translations: Translations = {\n [Locale.en]: { translation: en },\n [Locale.zhTW]: { translation: zhTW },\n [Locale.es]: { translation: es },\n [Locale.th]: { translation: th },\n};\n"],"mappings":"AACA,SAASA,MAAM,QAAQ,kBAAkB;AAEzC,OAAOC,EAAE,MAAM,mBAAmB;AAClC,OAAOC,EAAE,MAAM,mBAAmB;AAClC,OAAOC,EAAE,MAAM,mBAAmB;AAClC,OAAOC,IAAI,MAAM,sBAAsB;AAKvC,OAAO,MAAMC,YAA0B,GAAG;EACxC,CAACL,MAAM,CAACC,EAAE,GAAG;IAAEK,WAAW,EAAEL;EAAG,CAAC;EAChC,CAACD,MAAM,CAACI,IAAI,GAAG;IAAEE,WAAW,EAAEF;EAAK,CAAC;EACpC,CAACJ,MAAM,CAACE,EAAE,GAAG;IAAEI,WAAW,EAAEJ;EAAG,CAAC;EAChC,CAACF,MAAM,CAACG,EAAE,GAAG;IAAEG,WAAW,EAAEH;EAAG;AACjC,CAAC","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"translations.js","names":["defaultTranslations","data_unavailable","pagination_entries_range"],"sources":["../../../src/translations/translations.ts"],"sourcesContent":["export const defaultTranslations = {\n data_unavailable: 'Data unavailable',\n pagination_entries_range
|
|
1
|
+
{"version":3,"file":"translations.js","names":["defaultTranslations","data_unavailable","pagination_entries_range"],"sources":["../../../src/translations/translations.ts"],"sourcesContent":["export const defaultTranslations = {\n data_unavailable: 'Data unavailable',\n pagination_entries_range:\n '{{firstItemOnPage}}-{{lastItemOnPage}} of {{itemCount}} entries',\n};\n"],"mappings":"AAAA,OAAO,MAAMA,mBAAmB,GAAG;EACjCC,gBAAgB,EAAE,kBAAkB;EACpCC,wBAAwB,EACtB;AACJ,CAAC","ignoreList":[]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { TickerTapeConfig } from './types';
|
|
2
|
+
import type { TickerTapeConfig } from './types';
|
|
3
3
|
declare const TickerTapeWidget: ({ graphqlUrl, liveRatesUrl, instruments, division, locale, theme, isParamError, removePadding, size, motion, logoLink, }: TickerTapeConfig) => React.JSX.Element;
|
|
4
4
|
export { TickerTapeWidget };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { ValidationWrapperProps } from './types';
|
|
2
|
+
import type { ValidationWrapperProps } from './types';
|
|
3
3
|
declare const ValidationWrapper: ({ instruments, division, size: widgetSize, motion, isParamError, }: ValidationWrapperProps) => React.JSX.Element;
|
|
4
4
|
export { ValidationWrapper };
|
package/dist/types/TickerTapeWidget/components/InstrumentRateWithData/InstrumentRateWithData.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { InstrumentRateWithDataProps } from './types';
|
|
2
|
+
import type { InstrumentRateWithDataProps } from './types';
|
|
3
3
|
declare const InstrumentRateWithData: ({ record, division, target, size, }: InstrumentRateWithDataProps) => React.JSX.Element;
|
|
4
4
|
export { InstrumentRateWithData };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { DataRecord, WidgetSize } from '@oanda/labs-widget-common';
|
|
2
|
-
import { Division } from '../../types';
|
|
1
|
+
import type { DataRecord, WidgetSize } from '@oanda/labs-widget-common';
|
|
2
|
+
import type { Division } from '../../types';
|
|
3
3
|
export interface InstrumentRateWithDataProps {
|
|
4
4
|
record: DataRecord;
|
|
5
5
|
target: EventTarget | null;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
declare const INSTRUMENT_TOOLTIP_ID = "instrument_tooltip_id";
|
|
2
|
-
export { INSTRUMENT_TOOLTIP_ID
|
|
2
|
+
export { INSTRUMENT_TOOLTIP_ID };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { DataRecord, WidgetConfig, WidgetSize } from '@oanda/labs-widget-common';
|
|
2
|
-
import { Division } from '../gql/types/graphql';
|
|
3
|
-
export { Locale } from '@oanda/mono-i18n';
|
|
1
|
+
import type { DataRecord, WidgetConfig, WidgetSize } from '@oanda/labs-widget-common';
|
|
2
|
+
import type { Division } from '../gql/types/graphql';
|
|
4
3
|
export { Division } from '../gql/types/graphql';
|
|
4
|
+
export { Locale } from '@oanda/mono-i18n';
|
|
5
5
|
export interface TickerTapeConfig extends WidgetConfig {
|
|
6
6
|
division: Division;
|
|
7
7
|
liveRatesUrl: string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { DataRecord, LiveRatesErrorMessage } from '@oanda/labs-widget-common';
|
|
2
|
-
import { ValidateInstrumentsQuery } from '../gql/types/graphql';
|
|
1
|
+
import type { DataRecord, LiveRatesErrorMessage } from '@oanda/labs-widget-common';
|
|
2
|
+
import type { ValidateInstrumentsQuery } from '../gql/types/graphql';
|
|
3
3
|
declare const getRecords: (data: ValidateInstrumentsQuery) => {
|
|
4
4
|
instrument: string;
|
|
5
5
|
displayName: string;
|
|
@@ -8,4 +8,4 @@ declare const useRecords: (record: DataRecord, target: EventTarget | null) => {
|
|
|
8
8
|
updatedRecord: DataRecord;
|
|
9
9
|
error: LiveRatesErrorMessage | null;
|
|
10
10
|
};
|
|
11
|
-
export { getRecords, useRecords
|
|
11
|
+
export { getRecords, useRecords };
|
|
@@ -11,11 +11,11 @@ import { TypedDocumentNode as DocumentNode } from '@graphql-typed-document-node/
|
|
|
11
11
|
* Therefore it is highly recommended to use the babel or swc plugin for production.
|
|
12
12
|
*/
|
|
13
13
|
declare const documents: {
|
|
14
|
-
|
|
14
|
+
'\n query GetInstrumentsChart($instruments: [String!], $division: Division) {\n topicalInstrumentsCharts(instruments: $instruments, division: $division) {\n name\n chart\n }\n }\n': DocumentNode<types.GetInstrumentsChartQuery, types.Exact<{
|
|
15
15
|
instruments?: types.InputMaybe<Array<types.Scalars["String"]["input"]> | types.Scalars["String"]["input"]>;
|
|
16
16
|
division?: types.InputMaybe<types.Division>;
|
|
17
17
|
}>>;
|
|
18
|
-
|
|
18
|
+
'\n query validateInstruments($instruments: [String]!, $division: Division) {\n mapInstrumentNames(instruments: $instruments, division: $division) {\n name\n displayName\n }\n }\n': DocumentNode<types.ValidateInstrumentsQuery, types.Exact<{
|
|
19
19
|
instruments: Array<types.InputMaybe<types.Scalars["String"]["input"]>> | types.InputMaybe<types.Scalars["String"]["input"]>;
|
|
20
20
|
division?: types.InputMaybe<types.Division>;
|
|
21
21
|
}>>;
|
|
@@ -36,10 +36,10 @@ export declare function graphql(source: string): unknown;
|
|
|
36
36
|
/**
|
|
37
37
|
* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
|
|
38
38
|
*/
|
|
39
|
-
export declare function graphql(source:
|
|
39
|
+
export declare function graphql(source: '\n query GetInstrumentsChart($instruments: [String!], $division: Division) {\n topicalInstrumentsCharts(instruments: $instruments, division: $division) {\n name\n chart\n }\n }\n'): (typeof documents)['\n query GetInstrumentsChart($instruments: [String!], $division: Division) {\n topicalInstrumentsCharts(instruments: $instruments, division: $division) {\n name\n chart\n }\n }\n'];
|
|
40
40
|
/**
|
|
41
41
|
* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
|
|
42
42
|
*/
|
|
43
|
-
export declare function graphql(source:
|
|
43
|
+
export declare function graphql(source: '\n query validateInstruments($instruments: [String]!, $division: Division) {\n mapInstrumentNames(instruments: $instruments, division: $division) {\n name\n displayName\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'];
|
|
44
44
|
export type DocumentType<TDocumentNode extends DocumentNode<any, any>> = TDocumentNode extends DocumentNode<infer TType, any> ? TType : never;
|
|
45
45
|
export {};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from
|
|
2
|
-
export * from
|
|
1
|
+
export * from './fragment-masking';
|
|
2
|
+
export * from './gql';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Translations } from '@oanda/mono-i18n';
|
|
2
|
-
import { defaultTranslations } from './translations';
|
|
1
|
+
import type { Translations } from '@oanda/mono-i18n';
|
|
2
|
+
import type { defaultTranslations } from './translations';
|
|
3
3
|
export type TranslationKey = keyof typeof defaultTranslations;
|
|
4
4
|
export declare const translations: Translations;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oanda/labs-ticker-tape-widget",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.31",
|
|
4
4
|
"description": "Labs Ticker Tape Widget",
|
|
5
5
|
"main": "dist/main/index.js",
|
|
6
6
|
"module": "dist/module/index.js",
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"author": "OANDA",
|
|
13
13
|
"license": "UNLICENSED",
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"@oanda/labs-widget-common": "^1.0.
|
|
15
|
+
"@oanda/labs-widget-common": "^1.0.175",
|
|
16
16
|
"@oanda/mono-i18n": "10.0.1",
|
|
17
17
|
"graphql": "16.8.1",
|
|
18
18
|
"react-fast-marquee": "1.6.5"
|
|
@@ -21,5 +21,5 @@
|
|
|
21
21
|
"@graphql-codegen/cli": "5.0.0",
|
|
22
22
|
"@graphql-codegen/client-preset": "4.1.0"
|
|
23
23
|
},
|
|
24
|
-
"gitHead": "
|
|
24
|
+
"gitHead": "ffe302e74b4bdf5fb28f1f7be09cfd2cb7672eb3"
|
|
25
25
|
}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import React, { useEffect } from 'react';
|
|
2
|
-
import classnames from 'classnames';
|
|
3
1
|
import { Tooltip, useLiveRatesQuery } from '@oanda/labs-widget-common';
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
2
|
+
import classnames from 'classnames';
|
|
3
|
+
import React, { useEffect } from 'react';
|
|
4
|
+
|
|
6
5
|
import { InstrumentRateWithData } from './components/InstrumentRateWithData';
|
|
7
6
|
import { MarqueeWrapper } from './components/MarqueeWrapper';
|
|
7
|
+
import { INSTRUMENT_TOOLTIP_ID } from './constant';
|
|
8
|
+
import type { MainProps } from './types';
|
|
8
9
|
|
|
9
10
|
const Main = ({
|
|
10
11
|
records,
|
|
@@ -14,7 +15,9 @@ const Main = ({
|
|
|
14
15
|
}: MainProps) => {
|
|
15
16
|
const { target, setQuery } = useLiveRatesQuery();
|
|
16
17
|
|
|
17
|
-
const instrumentsNames = records.map(
|
|
18
|
+
const instrumentsNames = records.map(
|
|
19
|
+
({ instrument: instrumentName }) => instrumentName
|
|
20
|
+
);
|
|
18
21
|
|
|
19
22
|
useEffect(() => {
|
|
20
23
|
if (instrumentsNames[0]) {
|
|
@@ -24,22 +27,28 @@ const Main = ({
|
|
|
24
27
|
}, [records]);
|
|
25
28
|
|
|
26
29
|
return (
|
|
27
|
-
<div data-testid="ticker-tape-wrapper"
|
|
28
|
-
<MarqueeWrapper
|
|
30
|
+
<div className="lw-flex" data-testid="ticker-tape-wrapper">
|
|
31
|
+
<MarqueeWrapper
|
|
32
|
+
isStatic={motion === 'none'}
|
|
33
|
+
shouldPlay={records.length > 0}
|
|
34
|
+
>
|
|
29
35
|
{records.map((record) => (
|
|
30
36
|
<div
|
|
31
37
|
key={record.instrument}
|
|
32
|
-
className={classnames(
|
|
33
|
-
'lw-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
38
|
+
className={classnames(
|
|
39
|
+
'lw-flex lw-border lw-border-r-0 lw-border-solid lw-border-border-primary lw-px-4 lw-text-sm lw-tracking-normal lw-text-text-primary',
|
|
40
|
+
{
|
|
41
|
+
'lw-h-[82px]': widgetSize !== 'compact',
|
|
42
|
+
'lw-h-[54px]': widgetSize === 'compact',
|
|
43
|
+
'lw-w-fit last:lw-border-r': motion === 'none',
|
|
44
|
+
}
|
|
45
|
+
)}
|
|
37
46
|
>
|
|
38
47
|
<InstrumentRateWithData
|
|
39
|
-
record={record}
|
|
40
|
-
target={target}
|
|
41
48
|
division={division}
|
|
49
|
+
record={record}
|
|
42
50
|
size={widgetSize}
|
|
51
|
+
target={target}
|
|
43
52
|
/>
|
|
44
53
|
</div>
|
|
45
54
|
))}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
1
|
import { ApolloClient, InMemoryCache } from '@apollo/client';
|
|
3
2
|
import { WidgetProvider, WidgetWrapper } from '@oanda/labs-widget-common';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
|
|
4
5
|
import { translations } from '../translations';
|
|
5
|
-
import {
|
|
6
|
+
import type { TickerTapeConfig } from './types';
|
|
7
|
+
import { Division } from './types';
|
|
6
8
|
import { ValidationWrapper } from './ValidationWrapper';
|
|
7
9
|
|
|
8
10
|
const TickerTapeWidget = ({
|
|
@@ -29,30 +31,30 @@ const TickerTapeWidget = ({
|
|
|
29
31
|
return (
|
|
30
32
|
<WidgetProvider
|
|
31
33
|
withSuspense
|
|
32
|
-
locale={locale}
|
|
33
|
-
translations={translations}
|
|
34
34
|
client={client}
|
|
35
|
-
theme={theme}
|
|
36
|
-
styling={{
|
|
37
|
-
removePadding,
|
|
38
|
-
fitContent: motion === 'none',
|
|
39
|
-
}}
|
|
40
35
|
liveRates={{
|
|
41
36
|
url: liveRatesUrl,
|
|
42
37
|
options: { divisionCode, dataSource },
|
|
43
38
|
}}
|
|
39
|
+
locale={locale}
|
|
40
|
+
styling={{
|
|
41
|
+
removePadding,
|
|
42
|
+
fitContent: motion === 'none',
|
|
43
|
+
}}
|
|
44
|
+
theme={theme}
|
|
45
|
+
translations={translations}
|
|
44
46
|
>
|
|
45
47
|
<WidgetWrapper
|
|
46
|
-
logoLink={logoLink}
|
|
47
|
-
linkArea="full"
|
|
48
48
|
isParamError={isParamError}
|
|
49
|
+
linkArea="full"
|
|
50
|
+
logoLink={logoLink}
|
|
49
51
|
>
|
|
50
52
|
<ValidationWrapper
|
|
51
|
-
size={size}
|
|
52
|
-
motion={motion}
|
|
53
|
-
instruments={instruments}
|
|
54
53
|
division={division}
|
|
54
|
+
instruments={instruments}
|
|
55
55
|
isParamError={isParamError}
|
|
56
|
+
motion={motion}
|
|
57
|
+
size={size}
|
|
56
58
|
/>
|
|
57
59
|
</WidgetWrapper>
|
|
58
60
|
</WidgetProvider>
|
|
@@ -1,12 +1,16 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
1
|
import { useSuspenseQuery } from '@apollo/client';
|
|
3
|
-
import classnames from 'classnames';
|
|
4
2
|
import { Error, useLayoutProvider } from '@oanda/labs-widget-common';
|
|
3
|
+
import classnames from 'classnames';
|
|
4
|
+
import React from 'react';
|
|
5
|
+
|
|
6
|
+
import type {
|
|
7
|
+
ValidateInstrumentsQuery,
|
|
8
|
+
ValidateInstrumentsQueryVariables,
|
|
9
|
+
} from '../gql/types/graphql';
|
|
5
10
|
import { validateInstruments } from '../gql/validateInstruments';
|
|
6
|
-
import { ValidateInstrumentsQuery, ValidateInstrumentsQueryVariables } from '../gql/types/graphql';
|
|
7
11
|
import { Main } from './Main';
|
|
12
|
+
import type { ValidationWrapperProps } from './types';
|
|
8
13
|
import { getRecords } from './utils';
|
|
9
|
-
import { ValidationWrapperProps } from './types';
|
|
10
14
|
|
|
11
15
|
const ValidationWrapper = ({
|
|
12
16
|
instruments,
|
|
@@ -17,8 +21,8 @@ const ValidationWrapper = ({
|
|
|
17
21
|
}: ValidationWrapperProps) => {
|
|
18
22
|
const { size } = useLayoutProvider();
|
|
19
23
|
const { data, error } = useSuspenseQuery<
|
|
20
|
-
|
|
21
|
-
|
|
24
|
+
ValidateInstrumentsQuery,
|
|
25
|
+
ValidateInstrumentsQueryVariables
|
|
22
26
|
>(validateInstruments, {
|
|
23
27
|
variables: {
|
|
24
28
|
instruments,
|
|
@@ -34,20 +38,24 @@ const ValidationWrapper = ({
|
|
|
34
38
|
<>
|
|
35
39
|
{!showError && size && (
|
|
36
40
|
<Main
|
|
37
|
-
size={widgetSize}
|
|
38
41
|
division={division}
|
|
39
|
-
records={getRecords(data!)!}
|
|
40
42
|
motion={motion}
|
|
43
|
+
records={getRecords(data!)!}
|
|
44
|
+
size={widgetSize}
|
|
41
45
|
/>
|
|
42
46
|
)}
|
|
43
47
|
{showError && (
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
48
|
+
<div
|
|
49
|
+
className={classnames(
|
|
50
|
+
'lw-flex lw-border lw-border-solid lw-border-border-primary lw-px-4 lw-text-sm lw-tracking-normal lw-text-text-primary',
|
|
51
|
+
{
|
|
52
|
+
'lw-h-[82px]': widgetSize !== 'compact',
|
|
53
|
+
'lw-h-[54px]': widgetSize === 'compact',
|
|
54
|
+
}
|
|
55
|
+
)}
|
|
56
|
+
>
|
|
57
|
+
<Error />
|
|
58
|
+
</div>
|
|
51
59
|
)}
|
|
52
60
|
</>
|
|
53
61
|
);
|
|
@@ -1,10 +1,14 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
1
|
import { useBackgroundQuery } from '@apollo/client';
|
|
3
2
|
import { InstrumentRateWithChart } from '@oanda/labs-widget-common';
|
|
4
|
-
import
|
|
5
|
-
|
|
3
|
+
import React from 'react';
|
|
4
|
+
|
|
6
5
|
import { getInstrumentsChart } from '../../../gql/getInstrumentsChart';
|
|
7
|
-
import {
|
|
6
|
+
import type {
|
|
7
|
+
GetInstrumentsChartQuery,
|
|
8
|
+
GetInstrumentsChartQueryVariables,
|
|
9
|
+
} from '../../../gql/types/graphql';
|
|
10
|
+
import { INSTRUMENT_TOOLTIP_ID } from '../../constant';
|
|
11
|
+
import type { InstrumentRateWithDataProps } from './types';
|
|
8
12
|
|
|
9
13
|
const InstrumentRateWithData = ({
|
|
10
14
|
record,
|
|
@@ -15,8 +19,8 @@ const InstrumentRateWithData = ({
|
|
|
15
19
|
const hasInstrument = !!record.instrument;
|
|
16
20
|
|
|
17
21
|
const [queryRef] = useBackgroundQuery<
|
|
18
|
-
|
|
19
|
-
|
|
22
|
+
GetInstrumentsChartQuery,
|
|
23
|
+
GetInstrumentsChartQueryVariables
|
|
20
24
|
>(getInstrumentsChart, {
|
|
21
25
|
variables: {
|
|
22
26
|
instruments: [record.instrument],
|
|
@@ -28,11 +32,11 @@ const InstrumentRateWithData = ({
|
|
|
28
32
|
|
|
29
33
|
return (
|
|
30
34
|
<InstrumentRateWithChart<GetInstrumentsChartQuery>
|
|
35
|
+
queryRef={queryRef}
|
|
31
36
|
record={record}
|
|
32
|
-
target={target}
|
|
33
37
|
size={size}
|
|
38
|
+
target={target}
|
|
34
39
|
tooltipId={INSTRUMENT_TOOLTIP_ID}
|
|
35
|
-
queryRef={queryRef}
|
|
36
40
|
/>
|
|
37
41
|
);
|
|
38
42
|
};
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { DataRecord, WidgetSize } from '@oanda/labs-widget-common';
|
|
2
|
-
|
|
1
|
+
import type { DataRecord, WidgetSize } from '@oanda/labs-widget-common';
|
|
2
|
+
|
|
3
|
+
import type { Division } from '../../types';
|
|
3
4
|
|
|
4
5
|
export interface InstrumentRateWithDataProps {
|
|
5
6
|
record: DataRecord;
|
|
6
7
|
target: EventTarget | null;
|
|
7
8
|
division: Division;
|
|
8
|
-
size?: WidgetSize
|
|
9
|
+
size?: WidgetSize;
|
|
9
10
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import Marquee from 'react-fast-marquee';
|
|
3
|
-
|
|
3
|
+
|
|
4
|
+
import type { MarqueeWrapperProps } from './types';
|
|
4
5
|
|
|
5
6
|
const MarqueeWrapper = ({
|
|
6
7
|
children,
|
|
@@ -9,15 +10,12 @@ const MarqueeWrapper = ({
|
|
|
9
10
|
}: MarqueeWrapperProps) => (
|
|
10
11
|
<>
|
|
11
12
|
{!isStatic ? (
|
|
12
|
-
<Marquee
|
|
13
|
-
play={shouldPlay}
|
|
14
|
-
autoFill
|
|
15
|
-
pauseOnHover
|
|
16
|
-
speed={60}
|
|
17
|
-
>
|
|
13
|
+
<Marquee autoFill pauseOnHover play={shouldPlay} speed={60}>
|
|
18
14
|
{children}
|
|
19
15
|
</Marquee>
|
|
20
|
-
) :
|
|
16
|
+
) : (
|
|
17
|
+
children
|
|
18
|
+
)}
|
|
21
19
|
</>
|
|
22
20
|
);
|
|
23
21
|
|
|
@@ -1,52 +1,67 @@
|
|
|
1
|
+
import type { Theme } from '@oanda/labs-widget-common';
|
|
2
|
+
import { validateLocale, validateToolParams } from '@oanda/labs-widget-common';
|
|
1
3
|
import React from 'react';
|
|
2
4
|
import { createRoot } from 'react-dom/client';
|
|
3
|
-
|
|
4
|
-
import { TickerTapeWidget } from './TickerTapeWidget';
|
|
5
|
+
|
|
5
6
|
import { Division } from '../gql/types/graphql';
|
|
7
|
+
import { TickerTapeWidget } from './TickerTapeWidget';
|
|
6
8
|
|
|
7
|
-
const {
|
|
8
|
-
graphqlUrl,
|
|
9
|
-
liveRatesUrl,
|
|
10
|
-
} = window.widgetsConfig || {};
|
|
9
|
+
const { graphqlUrl, liveRatesUrl } = window.widgetsConfig || {};
|
|
11
10
|
|
|
12
|
-
const dataTickerTapeParamsElements = document.querySelectorAll(
|
|
11
|
+
const dataTickerTapeParamsElements = document.querySelectorAll(
|
|
12
|
+
'div[data-ticker-tape-params]'
|
|
13
|
+
);
|
|
13
14
|
|
|
14
15
|
dataTickerTapeParamsElements.forEach((element) => {
|
|
15
16
|
const root = createRoot(element);
|
|
16
17
|
const params = element.getAttribute('data-ticker-tape-params');
|
|
17
18
|
const mode = element.getAttribute('data-mode');
|
|
18
|
-
const {
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
const { instruments, division, locale, size, motion } = JSON.parse(
|
|
20
|
+
params as string
|
|
21
|
+
);
|
|
21
22
|
|
|
22
|
-
const isParamError = validateToolParams(
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
23
|
+
const isParamError = validateToolParams(
|
|
24
|
+
{
|
|
25
|
+
division,
|
|
26
|
+
locale,
|
|
27
|
+
graphqlUrl,
|
|
28
|
+
liveRatesUrl,
|
|
29
|
+
instruments,
|
|
30
|
+
},
|
|
31
|
+
[
|
|
32
|
+
{
|
|
33
|
+
name: 'locale',
|
|
34
|
+
valueCheck: (value: string | undefined) => validateLocale(value),
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
name: 'division',
|
|
38
|
+
valueCheck: (value: Division) =>
|
|
39
|
+
Object.values(Division).includes(value),
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
name: 'instruments',
|
|
43
|
+
valueCheck: (value) => value.length > 0 && value.length <= 10,
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
name: 'graphqlUrl',
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
name: 'liveRatesUrl',
|
|
50
|
+
},
|
|
51
|
+
]
|
|
52
|
+
);
|
|
38
53
|
|
|
39
54
|
root.render(
|
|
40
55
|
<TickerTapeWidget
|
|
41
|
-
graphqlUrl={graphqlUrl}
|
|
42
|
-
liveRatesUrl={liveRatesUrl}
|
|
43
56
|
division={division}
|
|
57
|
+
graphqlUrl={graphqlUrl}
|
|
44
58
|
instruments={instruments}
|
|
45
|
-
locale={locale}
|
|
46
|
-
theme={mode as Theme}
|
|
47
59
|
isParamError={isParamError}
|
|
48
|
-
|
|
60
|
+
liveRatesUrl={liveRatesUrl}
|
|
61
|
+
locale={locale}
|
|
49
62
|
motion={motion}
|
|
50
|
-
|
|
63
|
+
size={size}
|
|
64
|
+
theme={mode as Theme}
|
|
65
|
+
/>
|
|
51
66
|
);
|
|
52
67
|
});
|
|
@@ -1,8 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import type {
|
|
2
|
+
DataRecord,
|
|
3
|
+
WidgetConfig,
|
|
4
|
+
WidgetSize,
|
|
5
|
+
} from '@oanda/labs-widget-common';
|
|
6
|
+
|
|
7
|
+
import type { Division } from '../gql/types/graphql';
|
|
3
8
|
|
|
4
|
-
export { Locale } from '@oanda/mono-i18n';
|
|
5
9
|
export { Division } from '../gql/types/graphql';
|
|
10
|
+
export { Locale } from '@oanda/mono-i18n';
|
|
6
11
|
|
|
7
12
|
export interface TickerTapeConfig extends WidgetConfig {
|
|
8
13
|
division: Division;
|
|
@@ -1,16 +1,19 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import type {
|
|
2
|
+
DataRecord,
|
|
3
|
+
LiveRatesErrorMessage,
|
|
4
|
+
} from '@oanda/labs-widget-common';
|
|
5
|
+
import { useLiveRatesMessage } from '@oanda/labs-widget-common';
|
|
6
|
+
import { useEffect, useState } from 'react';
|
|
4
7
|
|
|
5
|
-
|
|
6
|
-
instrument: item?.name || '',
|
|
7
|
-
displayName: item?.displayName || '',
|
|
8
|
-
}));
|
|
8
|
+
import type { ValidateInstrumentsQuery } from '../gql/types/graphql';
|
|
9
9
|
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
const getRecords = (data: ValidateInstrumentsQuery) =>
|
|
11
|
+
data?.mapInstrumentNames?.map((item) => ({
|
|
12
|
+
instrument: item?.name || '',
|
|
13
|
+
displayName: item?.displayName || '',
|
|
14
|
+
}));
|
|
15
|
+
|
|
16
|
+
const useRecords = (record: DataRecord, target: EventTarget | null) => {
|
|
14
17
|
const [updatedRecord, setUpdatedRecord] = useState<DataRecord>({
|
|
15
18
|
displayName: record.displayName,
|
|
16
19
|
instrument: record.instrument,
|
|
@@ -20,7 +23,7 @@ const useRecords = (
|
|
|
20
23
|
|
|
21
24
|
const { update, error: liveRatesError } = useLiveRatesMessage(
|
|
22
25
|
record.instrument,
|
|
23
|
-
target
|
|
26
|
+
target
|
|
24
27
|
);
|
|
25
28
|
|
|
26
29
|
useEffect(() => {
|
|
@@ -42,7 +45,4 @@ const useRecords = (
|
|
|
42
45
|
};
|
|
43
46
|
};
|
|
44
47
|
|
|
45
|
-
export {
|
|
46
|
-
getRecords,
|
|
47
|
-
useRecords,
|
|
48
|
-
};
|
|
48
|
+
export { getRecords, useRecords };
|