@oanda/labs-ticker-tape-widget 1.0.1
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 +8 -0
- package/codegen.ts +15 -0
- package/dist/main/TickerTapeWidget/Main.js +87 -0
- package/dist/main/TickerTapeWidget/Main.js.map +1 -0
- package/dist/main/TickerTapeWidget/TickerTapeWidget.js +56 -0
- package/dist/main/TickerTapeWidget/TickerTapeWidget.js.map +1 -0
- package/dist/main/TickerTapeWidget/components/InstrumentRateWithChart/InstrumentRateWithChart.js +46 -0
- package/dist/main/TickerTapeWidget/components/InstrumentRateWithChart/InstrumentRateWithChart.js.map +1 -0
- package/dist/main/TickerTapeWidget/components/InstrumentRateWithChart/index.js +28 -0
- package/dist/main/TickerTapeWidget/components/InstrumentRateWithChart/index.js.map +1 -0
- package/dist/main/TickerTapeWidget/components/InstrumentRateWithChart/types.js +6 -0
- package/dist/main/TickerTapeWidget/components/InstrumentRateWithChart/types.js.map +1 -0
- package/dist/main/TickerTapeWidget/components/InstrumentRateWithChart/utils.js +25 -0
- package/dist/main/TickerTapeWidget/components/InstrumentRateWithChart/utils.js.map +1 -0
- package/dist/main/TickerTapeWidget/components/LineChartWithData/LineChartWithData.js +42 -0
- package/dist/main/TickerTapeWidget/components/LineChartWithData/LineChartWithData.js.map +1 -0
- package/dist/main/TickerTapeWidget/components/LineChartWithData/index.js +17 -0
- package/dist/main/TickerTapeWidget/components/LineChartWithData/index.js.map +1 -0
- package/dist/main/TickerTapeWidget/components/LineChartWithData/types.js +6 -0
- package/dist/main/TickerTapeWidget/components/LineChartWithData/types.js.map +1 -0
- package/dist/main/TickerTapeWidget/constant.js +8 -0
- package/dist/main/TickerTapeWidget/constant.js.map +1 -0
- package/dist/main/TickerTapeWidget/index.js +28 -0
- package/dist/main/TickerTapeWidget/index.js.map +1 -0
- package/dist/main/TickerTapeWidget/render.js +55 -0
- package/dist/main/TickerTapeWidget/render.js.map +1 -0
- package/dist/main/TickerTapeWidget/types.js +20 -0
- package/dist/main/TickerTapeWidget/types.js.map +1 -0
- package/dist/main/TickerTapeWidget/utils.js +43 -0
- package/dist/main/TickerTapeWidget/utils.js.map +1 -0
- package/dist/main/gql/getInstrumentsChart.js +16 -0
- package/dist/main/gql/getInstrumentsChart.js.map +1 -0
- package/dist/main/gql/types/fragment-masking.js +23 -0
- package/dist/main/gql/types/fragment-masking.js.map +1 -0
- package/dist/main/gql/types/gql.js +17 -0
- package/dist/main/gql/types/gql.js.map +1 -0
- package/dist/main/gql/types/graphql.js +326 -0
- package/dist/main/gql/types/graphql.js.map +1 -0
- package/dist/main/gql/types/index.js +28 -0
- package/dist/main/gql/types/index.js.map +1 -0
- package/dist/main/gql/validateInstruments.js +16 -0
- package/dist/main/gql/validateInstruments.js.map +1 -0
- package/dist/main/index.js +17 -0
- package/dist/main/index.js.map +1 -0
- package/dist/main/translations/index.js +27 -0
- package/dist/main/translations/index.js.map +1 -0
- package/dist/main/translations/sources/en.json +4 -0
- package/dist/main/translations/sources/es.json +4 -0
- package/dist/main/translations/sources/th.json +4 -0
- package/dist/main/translations/sources/zh_TW.json +4 -0
- package/dist/main/translations/translations.js +11 -0
- package/dist/main/translations/translations.js.map +1 -0
- package/dist/module/TickerTapeWidget/Main.js +78 -0
- package/dist/module/TickerTapeWidget/Main.js.map +1 -0
- package/dist/module/TickerTapeWidget/TickerTapeWidget.js +49 -0
- package/dist/module/TickerTapeWidget/TickerTapeWidget.js.map +1 -0
- package/dist/module/TickerTapeWidget/components/InstrumentRateWithChart/InstrumentRateWithChart.js +38 -0
- package/dist/module/TickerTapeWidget/components/InstrumentRateWithChart/InstrumentRateWithChart.js.map +1 -0
- package/dist/module/TickerTapeWidget/components/InstrumentRateWithChart/index.js +3 -0
- package/dist/module/TickerTapeWidget/components/InstrumentRateWithChart/index.js.map +1 -0
- package/dist/module/TickerTapeWidget/components/InstrumentRateWithChart/types.js +2 -0
- package/dist/module/TickerTapeWidget/components/InstrumentRateWithChart/types.js.map +1 -0
- package/dist/module/TickerTapeWidget/components/InstrumentRateWithChart/utils.js +18 -0
- package/dist/module/TickerTapeWidget/components/InstrumentRateWithChart/utils.js.map +1 -0
- package/dist/module/TickerTapeWidget/components/LineChartWithData/LineChartWithData.js +35 -0
- package/dist/module/TickerTapeWidget/components/LineChartWithData/LineChartWithData.js.map +1 -0
- package/dist/module/TickerTapeWidget/components/LineChartWithData/index.js +2 -0
- package/dist/module/TickerTapeWidget/components/LineChartWithData/index.js.map +1 -0
- package/dist/module/TickerTapeWidget/components/LineChartWithData/types.js +2 -0
- package/dist/module/TickerTapeWidget/components/LineChartWithData/types.js.map +1 -0
- package/dist/module/TickerTapeWidget/constant.js +3 -0
- package/dist/module/TickerTapeWidget/constant.js.map +1 -0
- package/dist/module/TickerTapeWidget/index.js +3 -0
- package/dist/module/TickerTapeWidget/index.js.map +1 -0
- package/dist/module/TickerTapeWidget/render.js +52 -0
- package/dist/module/TickerTapeWidget/render.js.map +1 -0
- package/dist/module/TickerTapeWidget/types.js +3 -0
- package/dist/module/TickerTapeWidget/types.js.map +1 -0
- package/dist/module/TickerTapeWidget/utils.js +36 -0
- package/dist/module/TickerTapeWidget/utils.js.map +1 -0
- package/dist/module/gql/getInstrumentsChart.js +10 -0
- package/dist/module/gql/getInstrumentsChart.js.map +1 -0
- package/dist/module/gql/types/fragment-masking.js +15 -0
- package/dist/module/gql/types/fragment-masking.js.map +1 -0
- package/dist/module/gql/types/gql.js +9 -0
- package/dist/module/gql/types/gql.js.map +1 -0
- package/dist/module/gql/types/graphql.js +320 -0
- package/dist/module/gql/types/graphql.js.map +1 -0
- package/dist/module/gql/types/index.js +3 -0
- package/dist/module/gql/types/index.js.map +1 -0
- package/dist/module/gql/validateInstruments.js +10 -0
- package/dist/module/gql/validateInstruments.js.map +1 -0
- package/dist/module/index.js +2 -0
- package/dist/module/index.js.map +1 -0
- package/dist/module/translations/index.js +20 -0
- package/dist/module/translations/index.js.map +1 -0
- package/dist/module/translations/sources/en.json +4 -0
- package/dist/module/translations/sources/es.json +4 -0
- package/dist/module/translations/sources/th.json +4 -0
- package/dist/module/translations/sources/zh_TW.json +4 -0
- package/dist/module/translations/translations.js +5 -0
- package/dist/module/translations/translations.js.map +1 -0
- package/dist/types/TickerTapeWidget/Main.d.ts +4 -0
- package/dist/types/TickerTapeWidget/TickerTapeWidget.d.ts +4 -0
- package/dist/types/TickerTapeWidget/components/InstrumentRateWithChart/InstrumentRateWithChart.d.ts +4 -0
- package/dist/types/TickerTapeWidget/components/InstrumentRateWithChart/index.d.ts +2 -0
- package/dist/types/TickerTapeWidget/components/InstrumentRateWithChart/types.d.ts +9 -0
- package/dist/types/TickerTapeWidget/components/InstrumentRateWithChart/utils.d.ts +3 -0
- package/dist/types/TickerTapeWidget/components/LineChartWithData/LineChartWithData.d.ts +4 -0
- package/dist/types/TickerTapeWidget/components/LineChartWithData/index.d.ts +1 -0
- package/dist/types/TickerTapeWidget/components/LineChartWithData/types.d.ts +8 -0
- package/dist/types/TickerTapeWidget/constant.d.ts +2 -0
- package/dist/types/TickerTapeWidget/index.d.ts +2 -0
- package/dist/types/TickerTapeWidget/render.d.ts +1 -0
- package/dist/types/TickerTapeWidget/types.d.ts +21 -0
- package/dist/types/TickerTapeWidget/utils.d.ts +11 -0
- package/dist/types/gql/getInstrumentsChart.d.ts +1 -0
- package/dist/types/gql/types/fragment-masking.d.ts +15 -0
- package/dist/types/gql/types/gql.d.ts +45 -0
- package/dist/types/gql/types/graphql.d.ts +397 -0
- package/dist/types/gql/types/index.d.ts +2 -0
- package/dist/types/gql/validateInstruments.d.ts +1 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/translations/index.d.ts +4 -0
- package/dist/types/translations/translations.d.ts +4 -0
- package/index.ts +1 -0
- package/lokalise.config.json +18 -0
- package/package.json +26 -0
- package/src/TickerTapeWidget/Main.tsx +91 -0
- package/src/TickerTapeWidget/TickerTapeWidget.tsx +57 -0
- package/src/TickerTapeWidget/components/InstrumentRateWithChart/InstrumentRateWithChart.tsx +43 -0
- package/src/TickerTapeWidget/components/InstrumentRateWithChart/index.ts +2 -0
- package/src/TickerTapeWidget/components/InstrumentRateWithChart/types.ts +10 -0
- package/src/TickerTapeWidget/components/InstrumentRateWithChart/utils.ts +25 -0
- package/src/TickerTapeWidget/components/LineChartWithData/LineChartWithData.tsx +43 -0
- package/src/TickerTapeWidget/components/LineChartWithData/index.ts +1 -0
- package/src/TickerTapeWidget/components/LineChartWithData/types.tsx +9 -0
- package/src/TickerTapeWidget/constant.ts +5 -0
- package/src/TickerTapeWidget/index.ts +2 -0
- package/src/TickerTapeWidget/render.tsx +51 -0
- package/src/TickerTapeWidget/types.tsx +24 -0
- package/src/TickerTapeWidget/utils.ts +48 -0
- package/src/gql/getInstrumentsChart.ts +10 -0
- package/src/gql/types/fragment-masking.ts +66 -0
- package/src/gql/types/gql.ts +47 -0
- package/src/gql/types/graphql.ts +432 -0
- package/src/gql/types/index.ts +2 -0
- package/src/gql/validateInstruments.ts +10 -0
- package/src/index.ts +1 -0
- package/src/translations/index.ts +17 -0
- package/src/translations/sources/en.json +4 -0
- package/src/translations/sources/es.json +4 -0
- package/src/translations/sources/th.json +4 -0
- package/src/translations/sources/zh_TW.json +4 -0
- package/src/translations/translations.ts +4 -0
- package/test/LineChartWithData.test.tsx +164 -0
- package/test/Main.test.tsx +27 -0
- package/test/components/InstrumentRateWithChart.test.tsx +62 -0
- package/test/components/utils.test.ts +13 -0
- package/test/mocks.ts +52 -0
- package/tsconfig.types.json +12 -0
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import React, { useEffect, useState } from 'react';
|
|
2
|
+
import Marquee from 'react-fast-marquee';
|
|
3
|
+
import classnames from 'classnames';
|
|
4
|
+
import { useQuery } from '@apollo/client';
|
|
5
|
+
import { ChartError, Tooltip, useLiveRatesQuery } from '@oanda/labs-widget-common';
|
|
6
|
+
import { validateInstruments } from '../gql/validateInstruments';
|
|
7
|
+
import { getRecords } from './utils';
|
|
8
|
+
import { InstrumentRateWithChart } from './components/InstrumentRateWithChart';
|
|
9
|
+
import { INSTRUMENT_TOOLTIP_ID } from './constant';
|
|
10
|
+
const Main = _ref => {
|
|
11
|
+
let {
|
|
12
|
+
instruments,
|
|
13
|
+
division,
|
|
14
|
+
size: widgetSize = 'fullWithChart'
|
|
15
|
+
} = _ref;
|
|
16
|
+
const [records, setRecords] = useState([]);
|
|
17
|
+
const {
|
|
18
|
+
target,
|
|
19
|
+
setQuery
|
|
20
|
+
} = useLiveRatesQuery();
|
|
21
|
+
const {
|
|
22
|
+
loading,
|
|
23
|
+
data,
|
|
24
|
+
error
|
|
25
|
+
} = useQuery(validateInstruments, {
|
|
26
|
+
variables: {
|
|
27
|
+
instruments,
|
|
28
|
+
division
|
|
29
|
+
},
|
|
30
|
+
fetchPolicy: 'network-only'
|
|
31
|
+
});
|
|
32
|
+
useEffect(() => {
|
|
33
|
+
if (!loading && data) {
|
|
34
|
+
setRecords(getRecords(data));
|
|
35
|
+
}
|
|
36
|
+
}, [loading, data]);
|
|
37
|
+
const instrumentsNames = records.map(_ref2 => {
|
|
38
|
+
let {
|
|
39
|
+
instrument: instrumentName
|
|
40
|
+
} = _ref2;
|
|
41
|
+
return instrumentName;
|
|
42
|
+
});
|
|
43
|
+
useEffect(() => {
|
|
44
|
+
if (instrumentsNames[0]) {
|
|
45
|
+
setQuery({
|
|
46
|
+
instruments: instrumentsNames
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
}, [records]);
|
|
50
|
+
const showError = !!error;
|
|
51
|
+
const isLoading = loading || !data;
|
|
52
|
+
return React.createElement("div", {
|
|
53
|
+
"data-testid": "ticker-tape-wrapper"
|
|
54
|
+
}, React.createElement(Marquee, {
|
|
55
|
+
play: !isLoading,
|
|
56
|
+
autoFill: true,
|
|
57
|
+
pauseOnHover: true,
|
|
58
|
+
speed: 60
|
|
59
|
+
}, records.map(record => React.createElement("div", {
|
|
60
|
+
key: record.instrument,
|
|
61
|
+
className: classnames('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', {
|
|
62
|
+
'lw-h-[82px]': widgetSize !== 'compact',
|
|
63
|
+
'lw-h-[54px]': widgetSize === 'compact'
|
|
64
|
+
})
|
|
65
|
+
}, React.createElement(InstrumentRateWithChart, {
|
|
66
|
+
loading: loading,
|
|
67
|
+
record: record,
|
|
68
|
+
target: target,
|
|
69
|
+
division: division,
|
|
70
|
+
size: widgetSize
|
|
71
|
+
})))), React.createElement(Tooltip, {
|
|
72
|
+
id: INSTRUMENT_TOOLTIP_ID
|
|
73
|
+
}), !loading && showError && React.createElement("div", {
|
|
74
|
+
className: "lw-flex lw-h-[150px] lw-w-full lw-items-center lw-border lw-border-solid lw-border-border-primary"
|
|
75
|
+
}, React.createElement(ChartError, null)));
|
|
76
|
+
};
|
|
77
|
+
export { Main };
|
|
78
|
+
//# sourceMappingURL=Main.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Main.js","names":["React","useEffect","useState","Marquee","classnames","useQuery","ChartError","Tooltip","useLiveRatesQuery","validateInstruments","getRecords","InstrumentRateWithChart","INSTRUMENT_TOOLTIP_ID","Main","_ref","instruments","division","size","widgetSize","records","setRecords","target","setQuery","loading","data","error","variables","fetchPolicy","instrumentsNames","map","_ref2","instrument","instrumentName","showError","isLoading","createElement","play","autoFill","pauseOnHover","speed","record","key","className","id"],"sources":["../../../src/TickerTapeWidget/Main.tsx"],"sourcesContent":["import React, { useEffect, useState } from 'react';\nimport Marquee from 'react-fast-marquee';\nimport classnames from 'classnames';\nimport { useQuery } from '@apollo/client';\nimport {\n ChartError, DataRecord, Tooltip, useLiveRatesQuery,\n} from '@oanda/labs-widget-common';\nimport { MainProps } from './types';\nimport {\n ValidateInstrumentsQuery,\n ValidateInstrumentsQueryVariables,\n} from '../gql/types/graphql';\nimport { validateInstruments } from '../gql/validateInstruments';\nimport { getRecords } from './utils';\nimport { InstrumentRateWithChart } from './components/InstrumentRateWithChart';\nimport { INSTRUMENT_TOOLTIP_ID } from './constant';\n\nconst Main = ({\n instruments,\n division,\n size: widgetSize = 'fullWithChart',\n}: MainProps) => {\n const [records, setRecords] = useState<DataRecord[]>([]);\n const { target, setQuery } = useLiveRatesQuery();\n const { loading, data, error } = useQuery<\n ValidateInstrumentsQuery,\n ValidateInstrumentsQueryVariables\n >(validateInstruments, {\n variables: {\n instruments,\n division,\n },\n fetchPolicy: 'network-only',\n });\n\n useEffect(() => {\n if (!loading && data) {\n setRecords(getRecords(data)!);\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [loading, data]);\n\n const instrumentsNames = records.map(({ instrument: instrumentName }) => instrumentName);\n\n useEffect(() => {\n if (instrumentsNames[0]) {\n setQuery({ instruments: instrumentsNames });\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [records]);\n\n const showError = !!error;\n const isLoading = loading || !data;\n\n return (\n <div data-testid=\"ticker-tape-wrapper\">\n <Marquee\n play={!isLoading}\n autoFill\n pauseOnHover\n speed={60}\n >\n {records.map((record) => (\n <div\n key={record.instrument}\n className={classnames('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', {\n 'lw-h-[82px]': widgetSize !== 'compact',\n 'lw-h-[54px]': widgetSize === 'compact',\n })}\n >\n <InstrumentRateWithChart\n loading={loading}\n record={record}\n target={target}\n division={division}\n size={widgetSize}\n />\n </div>\n ))}\n </Marquee>\n <Tooltip id={INSTRUMENT_TOOLTIP_ID} />\n {!loading && showError && (\n <div className=\"lw-flex lw-h-[150px] lw-w-full lw-items-center lw-border lw-border-solid lw-border-border-primary\">\n <ChartError />\n </div>\n )}\n </div>\n );\n};\n\nexport { Main };\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,SAAS,EAAEC,QAAQ,QAAQ,OAAO;AAClD,OAAOC,OAAO,MAAM,oBAAoB;AACxC,OAAOC,UAAU,MAAM,YAAY;AACnC,SAASC,QAAQ,QAAQ,gBAAgB;AACzC,SACEC,UAAU,EAAcC,OAAO,EAAEC,iBAAiB,QAC7C,2BAA2B;AAMlC,SAASC,mBAAmB,QAAQ,4BAA4B;AAChE,SAASC,UAAU,QAAQ,SAAS;AACpC,SAASC,uBAAuB,QAAQ,sCAAsC;AAC9E,SAASC,qBAAqB,QAAQ,YAAY;AAElD,MAAMC,IAAI,GAAGC,IAAA,IAII;EAAA,IAJH;IACZC,WAAW;IACXC,QAAQ;IACRC,IAAI,EAAEC,UAAU,GAAG;EACV,CAAC,GAAAJ,IAAA;EACV,MAAM,CAACK,OAAO,EAAEC,UAAU,CAAC,GAAGlB,QAAQ,CAAe,EAAE,CAAC;EACxD,MAAM;IAAEmB,MAAM;IAAEC;EAAS,CAAC,GAAGd,iBAAiB,CAAC,CAAC;EAChD,MAAM;IAAEe,OAAO;IAAEC,IAAI;IAAEC;EAAM,CAAC,GAAGpB,QAAQ,CAGvCI,mBAAmB,EAAE;IACrBiB,SAAS,EAAE;MACTX,WAAW;MACXC;IACF,CAAC;IACDW,WAAW,EAAE;EACf,CAAC,CAAC;EAEF1B,SAAS,CAAC,MAAM;IACd,IAAI,CAACsB,OAAO,IAAIC,IAAI,EAAE;MACpBJ,UAAU,CAACV,UAAU,CAACc,IAAI,CAAE,CAAC;IAC/B;EAEF,CAAC,EAAE,CAACD,OAAO,EAAEC,IAAI,CAAC,CAAC;EAEnB,MAAMI,gBAAgB,GAAGT,OAAO,CAACU,GAAG,CAACC,KAAA;IAAA,IAAC;MAAEC,UAAU,EAAEC;IAAe,CAAC,GAAAF,KAAA;IAAA,OAAKE,cAAc;EAAA,EAAC;EAExF/B,SAAS,CAAC,MAAM;IACd,IAAI2B,gBAAgB,CAAC,CAAC,CAAC,EAAE;MACvBN,QAAQ,CAAC;QAAEP,WAAW,EAAEa;MAAiB,CAAC,CAAC;IAC7C;EAEF,CAAC,EAAE,CAACT,OAAO,CAAC,CAAC;EAEb,MAAMc,SAAS,GAAG,CAAC,CAACR,KAAK;EACzB,MAAMS,SAAS,GAAGX,OAAO,IAAI,CAACC,IAAI;EAElC,OACExB,KAAA,CAAAmC,aAAA;IAAK,eAAY;EAAqB,GACpCnC,KAAA,CAAAmC,aAAA,CAAChC,OAAO;IACNiC,IAAI,EAAE,CAACF,SAAU;IACjBG,QAAQ;IACRC,YAAY;IACZC,KAAK,EAAE;EAAG,GAETpB,OAAO,CAACU,GAAG,CAAEW,MAAM,IAClBxC,KAAA,CAAAmC,aAAA;IACEM,GAAG,EAAED,MAAM,CAACT,UAAW;IACvBW,SAAS,EAAEtC,UAAU,CAAC,qIAAqI,EAAE;MAC3J,aAAa,EAAEc,UAAU,KAAK,SAAS;MACvC,aAAa,EAAEA,UAAU,KAAK;IAChC,CAAC;EAAE,GAEHlB,KAAA,CAAAmC,aAAA,CAACxB,uBAAuB;IACtBY,OAAO,EAAEA,OAAQ;IACjBiB,MAAM,EAAEA,MAAO;IACfnB,MAAM,EAAEA,MAAO;IACfL,QAAQ,EAAEA,QAAS;IACnBC,IAAI,EAAEC;EAAW,CAClB,CACE,CACN,CACM,CAAC,EACVlB,KAAA,CAAAmC,aAAA,CAAC5B,OAAO;IAACoC,EAAE,EAAE/B;EAAsB,CAAE,CAAC,EACrC,CAACW,OAAO,IAAIU,SAAS,IACpBjC,KAAA,CAAAmC,aAAA;IAAKO,SAAS,EAAC;EAAmG,GAChH1C,KAAA,CAAAmC,aAAA,CAAC7B,UAAU,MAAE,CACV,CAEJ,CAAC;AAEV,CAAC;AAED,SAASO,IAAI","ignoreList":[]}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ApolloClient, InMemoryCache, ApolloProvider } from '@apollo/client';
|
|
3
|
+
import { LocaleProvider } from '@oanda/mono-i18n';
|
|
4
|
+
import { ChartError, LiveRatesProvider, ThemeProvider, getLocale } from '@oanda/labs-widget-common';
|
|
5
|
+
import { translations } from '../translations';
|
|
6
|
+
import { Main } from './Main';
|
|
7
|
+
import { Division } from './types';
|
|
8
|
+
const TickerTapeWidget = _ref => {
|
|
9
|
+
let {
|
|
10
|
+
graphqlUrl,
|
|
11
|
+
liveRatesUrl,
|
|
12
|
+
instruments,
|
|
13
|
+
division,
|
|
14
|
+
locale,
|
|
15
|
+
theme,
|
|
16
|
+
isParamError,
|
|
17
|
+
removePadding,
|
|
18
|
+
size
|
|
19
|
+
} = _ref;
|
|
20
|
+
const client = new ApolloClient({
|
|
21
|
+
uri: graphqlUrl,
|
|
22
|
+
cache: new InMemoryCache()
|
|
23
|
+
});
|
|
24
|
+
const divisionCode = division === Division.Opt ? Division.Ogm : division;
|
|
25
|
+
const dataSource = divisionCode === Division.Ogm ? 'MT5' : 'V20';
|
|
26
|
+
return React.createElement(ThemeProvider, {
|
|
27
|
+
removePadding: removePadding,
|
|
28
|
+
theme: theme
|
|
29
|
+
}, React.createElement(LocaleProvider, {
|
|
30
|
+
locale: getLocale(locale),
|
|
31
|
+
translations: translations
|
|
32
|
+
}, React.createElement(LiveRatesProvider, {
|
|
33
|
+
url: liveRatesUrl,
|
|
34
|
+
options: {
|
|
35
|
+
divisionCode,
|
|
36
|
+
dataSource
|
|
37
|
+
}
|
|
38
|
+
}, React.createElement(ApolloProvider, {
|
|
39
|
+
client: client
|
|
40
|
+
}, isParamError ? React.createElement("div", {
|
|
41
|
+
className: "lw-flex lw-h-[425px] lw-w-full lw-items-center lw-border lw-border-solid lw-border-border-primary"
|
|
42
|
+
}, React.createElement(ChartError, null)) : React.createElement(Main, {
|
|
43
|
+
size: size,
|
|
44
|
+
instruments: instruments,
|
|
45
|
+
division: division
|
|
46
|
+
})))));
|
|
47
|
+
};
|
|
48
|
+
export { TickerTapeWidget };
|
|
49
|
+
//# sourceMappingURL=TickerTapeWidget.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TickerTapeWidget.js","names":["React","ApolloClient","InMemoryCache","ApolloProvider","LocaleProvider","ChartError","LiveRatesProvider","ThemeProvider","getLocale","translations","Main","Division","TickerTapeWidget","_ref","graphqlUrl","liveRatesUrl","instruments","division","locale","theme","isParamError","removePadding","size","client","uri","cache","divisionCode","Opt","Ogm","dataSource","createElement","url","options","className"],"sources":["../../../src/TickerTapeWidget/TickerTapeWidget.tsx"],"sourcesContent":["import React from 'react';\nimport { ApolloClient, InMemoryCache, ApolloProvider } from '@apollo/client';\nimport { LocaleProvider } from '@oanda/mono-i18n';\nimport {\n ChartError, LiveRatesProvider, ThemeProvider, getLocale,\n} from '@oanda/labs-widget-common';\nimport { translations } from '../translations';\nimport { Main } from './Main';\nimport { Division, TickerTapeConfig } from './types';\n\nconst TickerTapeWidget = ({\n graphqlUrl,\n liveRatesUrl,\n instruments,\n division,\n locale,\n theme,\n isParamError,\n removePadding,\n size,\n}: TickerTapeConfig) => {\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 <ThemeProvider removePadding={removePadding} theme={theme}>\n <LocaleProvider locale={getLocale(locale)} translations={translations}>\n <LiveRatesProvider\n url={liveRatesUrl}\n options={{ divisionCode, dataSource }}\n >\n <ApolloProvider client={client}>\n {isParamError ? (\n <div className=\"lw-flex lw-h-[425px] lw-w-full lw-items-center lw-border lw-border-solid lw-border-border-primary\">\n <ChartError />\n </div>\n )\n : (\n <Main\n size={size}\n instruments={instruments}\n division={division}\n />\n )}\n </ApolloProvider>\n </LiveRatesProvider>\n </LocaleProvider>\n </ThemeProvider>\n );\n};\n\nexport { TickerTapeWidget };\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,YAAY,EAAEC,aAAa,EAAEC,cAAc,QAAQ,gBAAgB;AAC5E,SAASC,cAAc,QAAQ,kBAAkB;AACjD,SACEC,UAAU,EAAEC,iBAAiB,EAAEC,aAAa,EAAEC,SAAS,QAClD,2BAA2B;AAClC,SAASC,YAAY,QAAQ,iBAAiB;AAC9C,SAASC,IAAI,QAAQ,QAAQ;AAC7B,SAASC,QAAQ,QAA0B,SAAS;AAEpD,MAAMC,gBAAgB,GAAGC,IAAA,IAUD;EAAA,IAVE;IACxBC,UAAU;IACVC,YAAY;IACZC,WAAW;IACXC,QAAQ;IACRC,MAAM;IACNC,KAAK;IACLC,YAAY;IACZC,aAAa;IACbC;EACgB,CAAC,GAAAT,IAAA;EACjB,MAAMU,MAAM,GAAG,IAAItB,YAAY,CAAC;IAC9BuB,GAAG,EAAEV,UAAU;IACfW,KAAK,EAAE,IAAIvB,aAAa,CAAC;EAC3B,CAAC,CAAC;EAEF,MAAMwB,YAAY,GAAGT,QAAQ,KAAKN,QAAQ,CAACgB,GAAG,GAAGhB,QAAQ,CAACiB,GAAG,GAAGX,QAAQ;EACxE,MAAMY,UAAU,GAAGH,YAAY,KAAKf,QAAQ,CAACiB,GAAG,GAAG,KAAK,GAAG,KAAK;EAEhE,OACE5B,KAAA,CAAA8B,aAAA,CAACvB,aAAa;IAACc,aAAa,EAAEA,aAAc;IAACF,KAAK,EAAEA;EAAM,GACxDnB,KAAA,CAAA8B,aAAA,CAAC1B,cAAc;IAACc,MAAM,EAAEV,SAAS,CAACU,MAAM,CAAE;IAACT,YAAY,EAAEA;EAAa,GACpET,KAAA,CAAA8B,aAAA,CAACxB,iBAAiB;IAChByB,GAAG,EAAEhB,YAAa;IAClBiB,OAAO,EAAE;MAAEN,YAAY;MAAEG;IAAW;EAAE,GAEtC7B,KAAA,CAAA8B,aAAA,CAAC3B,cAAc;IAACoB,MAAM,EAAEA;EAAO,GAC5BH,YAAY,GACXpB,KAAA,CAAA8B,aAAA;IAAKG,SAAS,EAAC;EAAmG,GAChHjC,KAAA,CAAA8B,aAAA,CAACzB,UAAU,MAAE,CACV,CAAC,GAGJL,KAAA,CAAA8B,aAAA,CAACpB,IAAI;IACHY,IAAI,EAAEA,IAAK;IACXN,WAAW,EAAEA,WAAY;IACzBC,QAAQ,EAAEA;EAAS,CACpB,CAES,CACC,CACL,CACH,CAAC;AAEpB,CAAC;AAED,SAASL,gBAAgB","ignoreList":[]}
|
package/dist/module/TickerTapeWidget/components/InstrumentRateWithChart/InstrumentRateWithChart.js
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import React, { useContext } from 'react';
|
|
2
|
+
import { InstrumentRate, ThemeContext } from '@oanda/labs-widget-common';
|
|
3
|
+
import { getChartColor, getColorIndicator } from './utils';
|
|
4
|
+
import { INSTRUMENT_TOOLTIP_ID } from '../../constant';
|
|
5
|
+
import { LineChartWithData } from '../LineChartWithData';
|
|
6
|
+
import { useRecords } from '../../utils';
|
|
7
|
+
const InstrumentRateWithChart = _ref => {
|
|
8
|
+
let {
|
|
9
|
+
loading,
|
|
10
|
+
record,
|
|
11
|
+
target,
|
|
12
|
+
division,
|
|
13
|
+
size
|
|
14
|
+
} = _ref;
|
|
15
|
+
const {
|
|
16
|
+
isDark
|
|
17
|
+
} = useContext(ThemeContext);
|
|
18
|
+
const {
|
|
19
|
+
updatedRecord,
|
|
20
|
+
error
|
|
21
|
+
} = useRecords(record, record.instrument ? target : null);
|
|
22
|
+
const indicator = getColorIndicator(updatedRecord.dailyPercentChange);
|
|
23
|
+
return React.createElement(React.Fragment, null, React.createElement(InstrumentRate, {
|
|
24
|
+
isLoading: loading,
|
|
25
|
+
isError: !!error,
|
|
26
|
+
record: updatedRecord,
|
|
27
|
+
size: size,
|
|
28
|
+
tooltipId: INSTRUMENT_TOOLTIP_ID,
|
|
29
|
+
colorIndicator: indicator
|
|
30
|
+
}), size === 'fullWithChart' && React.createElement(LineChartWithData, {
|
|
31
|
+
record: record,
|
|
32
|
+
isLoading: loading,
|
|
33
|
+
division: division,
|
|
34
|
+
color: getChartColor(indicator, isDark)
|
|
35
|
+
}));
|
|
36
|
+
};
|
|
37
|
+
export { InstrumentRateWithChart };
|
|
38
|
+
//# sourceMappingURL=InstrumentRateWithChart.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InstrumentRateWithChart.js","names":["React","useContext","InstrumentRate","ThemeContext","getChartColor","getColorIndicator","INSTRUMENT_TOOLTIP_ID","LineChartWithData","useRecords","InstrumentRateWithChart","_ref","loading","record","target","division","size","isDark","updatedRecord","error","instrument","indicator","dailyPercentChange","createElement","Fragment","isLoading","isError","tooltipId","colorIndicator","color"],"sources":["../../../../../src/TickerTapeWidget/components/InstrumentRateWithChart/InstrumentRateWithChart.tsx"],"sourcesContent":["import React, { useContext } from 'react';\nimport { InstrumentRate, ThemeContext } from '@oanda/labs-widget-common';\nimport { InstrumentRateWithChartProps } from './types';\nimport { getChartColor, getColorIndicator } from './utils';\nimport { INSTRUMENT_TOOLTIP_ID } from '../../constant';\nimport { LineChartWithData } from '../LineChartWithData';\nimport { useRecords } from '../../utils';\n\nconst InstrumentRateWithChart = ({\n loading,\n record,\n target,\n division,\n size,\n}: InstrumentRateWithChartProps) => {\n const { isDark } = useContext(ThemeContext);\n const { updatedRecord, error } = useRecords(record, record.instrument ? target : null);\n\n const indicator = getColorIndicator(updatedRecord.dailyPercentChange);\n\n return (\n <>\n <InstrumentRate\n isLoading={loading}\n isError={!!error}\n record={updatedRecord}\n size={size}\n tooltipId={INSTRUMENT_TOOLTIP_ID}\n colorIndicator={indicator}\n />\n {size === 'fullWithChart' && (\n <LineChartWithData\n record={record}\n isLoading={loading}\n division={division}\n color={getChartColor(indicator, isDark)}\n />\n )}\n </>\n );\n};\n\nexport { InstrumentRateWithChart };\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,UAAU,QAAQ,OAAO;AACzC,SAASC,cAAc,EAAEC,YAAY,QAAQ,2BAA2B;AAExE,SAASC,aAAa,EAAEC,iBAAiB,QAAQ,SAAS;AAC1D,SAASC,qBAAqB,QAAQ,gBAAgB;AACtD,SAASC,iBAAiB,QAAQ,sBAAsB;AACxD,SAASC,UAAU,QAAQ,aAAa;AAExC,MAAMC,uBAAuB,GAAGC,IAAA,IAMI;EAAA,IANH;IAC/BC,OAAO;IACPC,MAAM;IACNC,MAAM;IACNC,QAAQ;IACRC;EAC4B,CAAC,GAAAL,IAAA;EAC7B,MAAM;IAAEM;EAAO,CAAC,GAAGf,UAAU,CAACE,YAAY,CAAC;EAC3C,MAAM;IAAEc,aAAa;IAAEC;EAAM,CAAC,GAAGV,UAAU,CAACI,MAAM,EAAEA,MAAM,CAACO,UAAU,GAAGN,MAAM,GAAG,IAAI,CAAC;EAEtF,MAAMO,SAAS,GAAGf,iBAAiB,CAACY,aAAa,CAACI,kBAAkB,CAAC;EAErE,OACErB,KAAA,CAAAsB,aAAA,CAAAtB,KAAA,CAAAuB,QAAA,QACEvB,KAAA,CAAAsB,aAAA,CAACpB,cAAc;IACbsB,SAAS,EAAEb,OAAQ;IACnBc,OAAO,EAAE,CAAC,CAACP,KAAM;IACjBN,MAAM,EAAEK,aAAc;IACtBF,IAAI,EAAEA,IAAK;IACXW,SAAS,EAAEpB,qBAAsB;IACjCqB,cAAc,EAAEP;EAAU,CAC3B,CAAC,EACDL,IAAI,KAAK,eAAe,IACvBf,KAAA,CAAAsB,aAAA,CAACf,iBAAiB;IAChBK,MAAM,EAAEA,MAAO;IACfY,SAAS,EAAEb,OAAQ;IACnBG,QAAQ,EAAEA,QAAS;IACnBc,KAAK,EAAExB,aAAa,CAACgB,SAAS,EAAEJ,MAAM;EAAE,CACzC,CAEH,CAAC;AAEP,CAAC;AAED,SAASP,uBAAuB","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../../../src/TickerTapeWidget/components/InstrumentRateWithChart/index.ts"],"sourcesContent":["export * from './InstrumentRateWithChart';\nexport * from './utils';\n"],"mappings":"AAAA,cAAc,2BAA2B;AACzC,cAAc,SAAS","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","names":[],"sources":["../../../../../src/TickerTapeWidget/components/InstrumentRateWithChart/types.ts"],"sourcesContent":["import { DataRecord } from '@oanda/labs-widget-common';\nimport { Division } from '../../types';\n\nexport interface InstrumentRateWithChartProps {\n loading: boolean;\n record: DataRecord;\n target: EventTarget | null;\n division: Division;\n size?: 'compact' | 'full' | 'fullWithChart'\n}\n"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { lightTheme, darkTheme } from '@oanda/labs-widget-common';
|
|
2
|
+
const getColorIndicator = dailyChange => {
|
|
3
|
+
const numberValue = Number(dailyChange?.substring(0, dailyChange.length - 1));
|
|
4
|
+
return Math.sign(numberValue);
|
|
5
|
+
};
|
|
6
|
+
const getChartColor = (indicator, isDarkMode) => {
|
|
7
|
+
const theme = isDarkMode ? darkTheme : lightTheme;
|
|
8
|
+
switch (indicator) {
|
|
9
|
+
case 1:
|
|
10
|
+
return theme.textOk;
|
|
11
|
+
case -1:
|
|
12
|
+
return theme.textDanger;
|
|
13
|
+
default:
|
|
14
|
+
return theme.textDisabled;
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
export { getColorIndicator, getChartColor };
|
|
18
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","names":["lightTheme","darkTheme","getColorIndicator","dailyChange","numberValue","Number","substring","length","Math","sign","getChartColor","indicator","isDarkMode","theme","textOk","textDanger","textDisabled"],"sources":["../../../../../src/TickerTapeWidget/components/InstrumentRateWithChart/utils.ts"],"sourcesContent":["import { lightTheme, darkTheme } from '@oanda/labs-widget-common';\n\nconst getColorIndicator = (dailyChange?: string) => {\n const numberValue = Number(dailyChange?.substring(0, dailyChange.length - 1));\n\n return Math.sign(numberValue);\n};\n\nconst getChartColor = (indicator?: number, isDarkMode?: boolean) => {\n const theme = isDarkMode ? darkTheme : lightTheme;\n\n switch (indicator) {\n case 1:\n return theme.textOk;\n case -1:\n return theme.textDanger;\n default:\n return theme.textDisabled;\n }\n};\n\nexport {\n getColorIndicator,\n getChartColor,\n};\n"],"mappings":"AAAA,SAASA,UAAU,EAAEC,SAAS,QAAQ,2BAA2B;AAEjE,MAAMC,iBAAiB,GAAIC,WAAoB,IAAK;EAClD,MAAMC,WAAW,GAAGC,MAAM,CAACF,WAAW,EAAEG,SAAS,CAAC,CAAC,EAAEH,WAAW,CAACI,MAAM,GAAG,CAAC,CAAC,CAAC;EAE7E,OAAOC,IAAI,CAACC,IAAI,CAACL,WAAW,CAAC;AAC/B,CAAC;AAED,MAAMM,aAAa,GAAGA,CAACC,SAAkB,EAAEC,UAAoB,KAAK;EAClE,MAAMC,KAAK,GAAGD,UAAU,GAAGX,SAAS,GAAGD,UAAU;EAEjD,QAAQW,SAAS;IACf,KAAK,CAAC;MACJ,OAAOE,KAAK,CAACC,MAAM;IACrB,KAAK,CAAC,CAAC;MACL,OAAOD,KAAK,CAACE,UAAU;IACzB;MACE,OAAOF,KAAK,CAACG,YAAY;EAC7B;AACF,CAAC;AAED,SACEd,iBAAiB,EACjBQ,aAAa","ignoreList":[]}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { useQuery } from '@apollo/client';
|
|
3
|
+
import { LineChart } from '@oanda/labs-widget-common';
|
|
4
|
+
import { getInstrumentsChart } from '../../../gql/getInstrumentsChart';
|
|
5
|
+
const LineChartWithData = _ref => {
|
|
6
|
+
let {
|
|
7
|
+
record,
|
|
8
|
+
isLoading,
|
|
9
|
+
division,
|
|
10
|
+
color
|
|
11
|
+
} = _ref;
|
|
12
|
+
const {
|
|
13
|
+
loading,
|
|
14
|
+
data
|
|
15
|
+
} = useQuery(getInstrumentsChart, {
|
|
16
|
+
variables: {
|
|
17
|
+
instruments: [record.instrument],
|
|
18
|
+
division
|
|
19
|
+
},
|
|
20
|
+
fetchPolicy: 'network-only',
|
|
21
|
+
skip: !record.instrument
|
|
22
|
+
});
|
|
23
|
+
const showChart = isLoading || loading;
|
|
24
|
+
const chart = data?.topicalInstrumentsCharts?.[0].chart || [];
|
|
25
|
+
return React.createElement("div", {
|
|
26
|
+
className: "lw-relative"
|
|
27
|
+
}, !showChart ? React.createElement("div", {
|
|
28
|
+
className: "lw-absolute lw-bottom-0 lw-right-0 lw--z-50 lw-flex lw-h-10 lw-w-[100px] lw-items-center lw-justify-center"
|
|
29
|
+
}, React.createElement(LineChart, {
|
|
30
|
+
color: color,
|
|
31
|
+
data: chart
|
|
32
|
+
})) : null);
|
|
33
|
+
};
|
|
34
|
+
export { LineChartWithData };
|
|
35
|
+
//# sourceMappingURL=LineChartWithData.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LineChartWithData.js","names":["React","useQuery","LineChart","getInstrumentsChart","LineChartWithData","_ref","record","isLoading","division","color","loading","data","variables","instruments","instrument","fetchPolicy","skip","showChart","chart","topicalInstrumentsCharts","createElement","className"],"sources":["../../../../../src/TickerTapeWidget/components/LineChartWithData/LineChartWithData.tsx"],"sourcesContent":["import React from 'react';\nimport { useQuery } from '@apollo/client';\nimport { LineChart } from '@oanda/labs-widget-common';\nimport { LineChartWithDataProps } from './types';\nimport { getInstrumentsChart } from '../../../gql/getInstrumentsChart';\nimport { GetInstrumentsChartQuery, GetInstrumentsChartQueryVariables } from '../../../gql/types/graphql';\n\nconst LineChartWithData = ({\n record,\n isLoading,\n division,\n color,\n}: LineChartWithDataProps) => {\n const { loading, data } = useQuery<\n GetInstrumentsChartQuery,\n GetInstrumentsChartQueryVariables\n >(getInstrumentsChart, {\n variables: {\n instruments: [record.instrument],\n division,\n },\n fetchPolicy: 'network-only',\n skip: !record.instrument,\n });\n\n const showChart = isLoading || loading;\n const chart = data?.topicalInstrumentsCharts?.[0].chart || [];\n\n return (\n <div className=\"lw-relative\">\n {!showChart ? (\n <div className=\"lw-absolute lw-bottom-0 lw-right-0 lw--z-50 lw-flex lw-h-10 lw-w-[100px] lw-items-center lw-justify-center\">\n <LineChart\n color={color}\n data={chart}\n />\n </div>\n ) : null}\n </div>\n );\n};\n\nexport { LineChartWithData };\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,QAAQ,QAAQ,gBAAgB;AACzC,SAASC,SAAS,QAAQ,2BAA2B;AAErD,SAASC,mBAAmB,QAAQ,kCAAkC;AAGtE,MAAMC,iBAAiB,GAAGC,IAAA,IAKI;EAAA,IALH;IACzBC,MAAM;IACNC,SAAS;IACTC,QAAQ;IACRC;EACsB,CAAC,GAAAJ,IAAA;EACvB,MAAM;IAAEK,OAAO;IAAEC;EAAK,CAAC,GAAGV,QAAQ,CAGhCE,mBAAmB,EAAE;IACrBS,SAAS,EAAE;MACTC,WAAW,EAAE,CAACP,MAAM,CAACQ,UAAU,CAAC;MAChCN;IACF,CAAC;IACDO,WAAW,EAAE,cAAc;IAC3BC,IAAI,EAAE,CAACV,MAAM,CAACQ;EAChB,CAAC,CAAC;EAEF,MAAMG,SAAS,GAAGV,SAAS,IAAIG,OAAO;EACtC,MAAMQ,KAAK,GAAGP,IAAI,EAAEQ,wBAAwB,GAAG,CAAC,CAAC,CAACD,KAAK,IAAI,EAAE;EAE7D,OACElB,KAAA,CAAAoB,aAAA;IAAKC,SAAS,EAAC;EAAa,GACzB,CAACJ,SAAS,GACTjB,KAAA,CAAAoB,aAAA;IAAKC,SAAS,EAAC;EAA4G,GACzHrB,KAAA,CAAAoB,aAAA,CAAClB,SAAS;IACRO,KAAK,EAAEA,KAAM;IACbE,IAAI,EAAEO;EAAM,CACb,CACE,CAAC,GACJ,IACD,CAAC;AAEV,CAAC;AAED,SAASd,iBAAiB","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../../../src/TickerTapeWidget/components/LineChartWithData/index.ts"],"sourcesContent":["export * from './LineChartWithData';\n"],"mappings":"AAAA,cAAc,qBAAqB","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","names":[],"sources":["../../../../../src/TickerTapeWidget/components/LineChartWithData/types.tsx"],"sourcesContent":["import { DataRecord } from '@oanda/labs-widget-common';\nimport { Division } from '../../../gql/types/graphql';\n\nexport interface LineChartWithDataProps {\n record: DataRecord;\n isLoading: boolean;\n division: Division;\n color: string;\n}\n"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constant.js","names":["INSTRUMENT_TOOLTIP_ID"],"sources":["../../../src/TickerTapeWidget/constant.ts"],"sourcesContent":["const INSTRUMENT_TOOLTIP_ID = 'instrument_tooltip_id';\n\nexport {\n INSTRUMENT_TOOLTIP_ID,\n};\n"],"mappings":"AAAA,MAAMA,qBAAqB,GAAG,uBAAuB;AAErD,SACEA,qBAAqB","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../src/TickerTapeWidget/index.ts"],"sourcesContent":["export * from './types';\nexport * from './TickerTapeWidget';\n"],"mappings":"AAAA,cAAc,SAAS;AACvB,cAAc,oBAAoB","ignoreList":[]}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { createRoot } from 'react-dom/client';
|
|
3
|
+
import { validateLocale, validateToolParams } from '@oanda/labs-widget-common';
|
|
4
|
+
import { TickerTapeWidget } from './TickerTapeWidget';
|
|
5
|
+
import { Division } from '../gql/types/graphql';
|
|
6
|
+
const {
|
|
7
|
+
graphqlUrl,
|
|
8
|
+
liveRatesUrl
|
|
9
|
+
} = window.widgetsConfig || {};
|
|
10
|
+
const dataTickerTapeParamsElements = document.querySelectorAll('div[data-ticker-tape-params]');
|
|
11
|
+
dataTickerTapeParamsElements.forEach(element => {
|
|
12
|
+
const root = createRoot(element);
|
|
13
|
+
const params = element.getAttribute('data-ticker-tape-params');
|
|
14
|
+
const mode = element.getAttribute('data-mode');
|
|
15
|
+
const {
|
|
16
|
+
instruments,
|
|
17
|
+
division,
|
|
18
|
+
locale,
|
|
19
|
+
size
|
|
20
|
+
} = JSON.parse(params);
|
|
21
|
+
const isParamError = validateToolParams({
|
|
22
|
+
division,
|
|
23
|
+
locale,
|
|
24
|
+
graphqlUrl,
|
|
25
|
+
liveRatesUrl,
|
|
26
|
+
instruments
|
|
27
|
+
}, [{
|
|
28
|
+
name: 'locale',
|
|
29
|
+
valueCheck: value => validateLocale(value)
|
|
30
|
+
}, {
|
|
31
|
+
name: 'division',
|
|
32
|
+
valueCheck: value => Object.values(Division).includes(value)
|
|
33
|
+
}, {
|
|
34
|
+
name: 'instruments',
|
|
35
|
+
valueCheck: value => value.length > 0 && value.length <= 10
|
|
36
|
+
}, {
|
|
37
|
+
name: 'graphqlUrl'
|
|
38
|
+
}, {
|
|
39
|
+
name: 'liveRatesUrl'
|
|
40
|
+
}]);
|
|
41
|
+
root.render(React.createElement(TickerTapeWidget, {
|
|
42
|
+
graphqlUrl: graphqlUrl,
|
|
43
|
+
liveRatesUrl: liveRatesUrl,
|
|
44
|
+
division: division,
|
|
45
|
+
instruments: instruments,
|
|
46
|
+
locale: locale,
|
|
47
|
+
theme: mode,
|
|
48
|
+
isParamError: isParamError,
|
|
49
|
+
size: size
|
|
50
|
+
}));
|
|
51
|
+
});
|
|
52
|
+
//# sourceMappingURL=render.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"render.js","names":["React","createRoot","validateLocale","validateToolParams","TickerTapeWidget","Division","graphqlUrl","liveRatesUrl","window","widgetsConfig","dataTickerTapeParamsElements","document","querySelectorAll","forEach","element","root","params","getAttribute","mode","instruments","division","locale","size","JSON","parse","isParamError","name","valueCheck","value","Object","values","includes","length","render","createElement","theme"],"sources":["../../../src/TickerTapeWidget/render.tsx"],"sourcesContent":["import React from 'react';\nimport { createRoot } from 'react-dom/client';\nimport { Theme, validateLocale, validateToolParams } from '@oanda/labs-widget-common';\nimport { TickerTapeWidget } from './TickerTapeWidget';\nimport { Division } from '../gql/types/graphql';\n\nconst {\n graphqlUrl,\n liveRatesUrl,\n} = window.widgetsConfig || {};\n\nconst dataTickerTapeParamsElements = document.querySelectorAll('div[data-ticker-tape-params]');\n\ndataTickerTapeParamsElements.forEach((element) => {\n const root = createRoot(element);\n const params = element.getAttribute('data-ticker-tape-params');\n const mode = element.getAttribute('data-mode');\n const {\n instruments, division, locale, size,\n } = JSON.parse(params as string);\n\n const isParamError = validateToolParams({\n division, locale, graphqlUrl, liveRatesUrl, instruments,\n }, [{\n name: 'locale',\n valueCheck: (value) => validateLocale(value),\n }, {\n name: 'division',\n valueCheck: (value) => Object.values(Division).includes(value),\n }, {\n name: 'instruments',\n valueCheck: (value) => value.length > 0 && value.length <= 10,\n }, {\n name: 'graphqlUrl',\n }, {\n name: 'liveRatesUrl',\n }]);\n\n root.render(\n <TickerTapeWidget\n graphqlUrl={graphqlUrl}\n liveRatesUrl={liveRatesUrl}\n division={division}\n instruments={instruments}\n locale={locale}\n theme={mode as Theme}\n isParamError={isParamError}\n size={size}\n />,\n );\n});\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,UAAU,QAAQ,kBAAkB;AAC7C,SAAgBC,cAAc,EAAEC,kBAAkB,QAAQ,2BAA2B;AACrF,SAASC,gBAAgB,QAAQ,oBAAoB;AACrD,SAASC,QAAQ,QAAQ,sBAAsB;AAE/C,MAAM;EACJC,UAAU;EACVC;AACF,CAAC,GAAGC,MAAM,CAACC,aAAa,IAAI,CAAC,CAAC;AAE9B,MAAMC,4BAA4B,GAAGC,QAAQ,CAACC,gBAAgB,CAAC,8BAA8B,CAAC;AAE9FF,4BAA4B,CAACG,OAAO,CAAEC,OAAO,IAAK;EAChD,MAAMC,IAAI,GAAGd,UAAU,CAACa,OAAO,CAAC;EAChC,MAAME,MAAM,GAAGF,OAAO,CAACG,YAAY,CAAC,yBAAyB,CAAC;EAC9D,MAAMC,IAAI,GAAGJ,OAAO,CAACG,YAAY,CAAC,WAAW,CAAC;EAC9C,MAAM;IACJE,WAAW;IAAEC,QAAQ;IAAEC,MAAM;IAAEC;EACjC,CAAC,GAAGC,IAAI,CAACC,KAAK,CAACR,MAAgB,CAAC;EAEhC,MAAMS,YAAY,GAAGtB,kBAAkB,CAAC;IACtCiB,QAAQ;IAAEC,MAAM;IAAEf,UAAU;IAAEC,YAAY;IAAEY;EAC9C,CAAC,EAAE,CAAC;IACFO,IAAI,EAAE,QAAQ;IACdC,UAAU,EAAGC,KAAK,IAAK1B,cAAc,CAAC0B,KAAK;EAC7C,CAAC,EAAE;IACDF,IAAI,EAAE,UAAU;IAChBC,UAAU,EAAGC,KAAK,IAAKC,MAAM,CAACC,MAAM,CAACzB,QAAQ,CAAC,CAAC0B,QAAQ,CAACH,KAAK;EAC/D,CAAC,EAAE;IACDF,IAAI,EAAE,aAAa;IACnBC,UAAU,EAAGC,KAAK,IAAKA,KAAK,CAACI,MAAM,GAAG,CAAC,IAAIJ,KAAK,CAACI,MAAM,IAAI;EAC7D,CAAC,EAAE;IACDN,IAAI,EAAE;EACR,CAAC,EAAE;IACDA,IAAI,EAAE;EACR,CAAC,CAAC,CAAC;EAEHX,IAAI,CAACkB,MAAM,CACTjC,KAAA,CAAAkC,aAAA,CAAC9B,gBAAgB;IACfE,UAAU,EAAEA,UAAW;IACvBC,YAAY,EAAEA,YAAa;IAC3Ba,QAAQ,EAAEA,QAAS;IACnBD,WAAW,EAAEA,WAAY;IACzBE,MAAM,EAAEA,MAAO;IACfc,KAAK,EAAEjB,IAAc;IACrBO,YAAY,EAAEA,YAAa;IAC3BH,IAAI,EAAEA;EAAK,CACZ,CACH,CAAC;AACH,CAAC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","names":["Locale","Division"],"sources":["../../../src/TickerTapeWidget/types.tsx"],"sourcesContent":["import { Locale } from '@oanda/mono-i18n';\nimport { Theme } from '@oanda/labs-widget-common';\nimport { Division } from '../gql/types/graphql';\n\nexport { Locale } from '@oanda/mono-i18n';\nexport { Division } from '../gql/types/graphql';\n\nexport interface TickerTapeConfig {\n graphqlUrl: string;\n division: Division;\n liveRatesUrl: string;\n instruments: string[];\n locale: Locale;\n theme?: Theme;\n isParamError?: boolean;\n removePadding?: boolean;\n size?: 'compact' | 'full' | 'fullWithChart';\n}\n\nexport interface MainProps {\n instruments: string[];\n division: Division;\n size?: 'compact' | 'full' | 'fullWithChart'\n}\n"],"mappings":"AAIA,SAASA,MAAM,QAAQ,kBAAkB;AACzC,SAASC,QAAQ,QAAQ,sBAAsB","ignoreList":[]}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { useState, useEffect } from 'react';
|
|
2
|
+
import { useLiveRatesMessage } from '@oanda/labs-widget-common';
|
|
3
|
+
const getRecords = data => data?.mapInstrumentNames?.map(item => ({
|
|
4
|
+
instrument: item?.name || '',
|
|
5
|
+
displayName: item?.displayName || ''
|
|
6
|
+
}));
|
|
7
|
+
const useRecords = (record, target) => {
|
|
8
|
+
const [updatedRecord, setUpdatedRecord] = useState({
|
|
9
|
+
displayName: record.displayName,
|
|
10
|
+
instrument: record.instrument,
|
|
11
|
+
sentiment: record.sentiment
|
|
12
|
+
});
|
|
13
|
+
const [error, setError] = useState(null);
|
|
14
|
+
const {
|
|
15
|
+
update,
|
|
16
|
+
error: liveRatesError
|
|
17
|
+
} = useLiveRatesMessage(record.instrument, target);
|
|
18
|
+
useEffect(() => {
|
|
19
|
+
setUpdatedRecord({
|
|
20
|
+
displayName: record.displayName,
|
|
21
|
+
instrument: record.instrument,
|
|
22
|
+
buy: update?.bid,
|
|
23
|
+
buyPriceMovement: update?.bidPriceMovement,
|
|
24
|
+
dailyPercentChange: update?.dailyPercentChangeFromOpen,
|
|
25
|
+
dailyPipsChange: update?.dailyPipsChangeFromOpen,
|
|
26
|
+
displayPrecision: update?.displayPrecision
|
|
27
|
+
});
|
|
28
|
+
setError(liveRatesError);
|
|
29
|
+
}, [update, record, liveRatesError]);
|
|
30
|
+
return {
|
|
31
|
+
updatedRecord,
|
|
32
|
+
error
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
export { getRecords, useRecords };
|
|
36
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","names":["useState","useEffect","useLiveRatesMessage","getRecords","data","mapInstrumentNames","map","item","instrument","name","displayName","useRecords","record","target","updatedRecord","setUpdatedRecord","sentiment","error","setError","update","liveRatesError","buy","bid","buyPriceMovement","bidPriceMovement","dailyPercentChange","dailyPercentChangeFromOpen","dailyPipsChange","dailyPipsChangeFromOpen","displayPrecision"],"sources":["../../../src/TickerTapeWidget/utils.ts"],"sourcesContent":["import { useState, useEffect } from 'react';\nimport { DataRecord, LiveRatesErrorMessage, useLiveRatesMessage } from '@oanda/labs-widget-common';\nimport { ValidateInstrumentsQuery } from '../gql/types/graphql';\n\nconst getRecords = (data: ValidateInstrumentsQuery) => data?.mapInstrumentNames?.map((item) => ({\n instrument: item?.name || '',\n displayName: item?.displayName || '',\n}));\n\nconst useRecords = (\n record: DataRecord,\n target: EventTarget | null,\n) => {\n const [updatedRecord, setUpdatedRecord] = useState<DataRecord>({\n displayName: record.displayName,\n instrument: record.instrument,\n sentiment: record.sentiment,\n });\n const [error, setError] = useState<LiveRatesErrorMessage | null>(null);\n\n const { update, error: liveRatesError } = useLiveRatesMessage(\n record.instrument,\n target,\n );\n\n useEffect(() => {\n setUpdatedRecord({\n displayName: record.displayName,\n instrument: record.instrument,\n buy: update?.bid,\n buyPriceMovement: update?.bidPriceMovement,\n dailyPercentChange: update?.dailyPercentChangeFromOpen,\n dailyPipsChange: update?.dailyPipsChangeFromOpen,\n displayPrecision: update?.displayPrecision,\n });\n setError(liveRatesError);\n }, [update, record, liveRatesError]);\n\n return {\n updatedRecord,\n error,\n };\n};\n\nexport {\n getRecords,\n useRecords,\n};\n"],"mappings":"AAAA,SAASA,QAAQ,EAAEC,SAAS,QAAQ,OAAO;AAC3C,SAA4CC,mBAAmB,QAAQ,2BAA2B;AAGlG,MAAMC,UAAU,GAAIC,IAA8B,IAAKA,IAAI,EAAEC,kBAAkB,EAAEC,GAAG,CAAEC,IAAI,KAAM;EAC9FC,UAAU,EAAED,IAAI,EAAEE,IAAI,IAAI,EAAE;EAC5BC,WAAW,EAAEH,IAAI,EAAEG,WAAW,IAAI;AACpC,CAAC,CAAC,CAAC;AAEH,MAAMC,UAAU,GAAGA,CACjBC,MAAkB,EAClBC,MAA0B,KACvB;EACH,MAAM,CAACC,aAAa,EAAEC,gBAAgB,CAAC,GAAGf,QAAQ,CAAa;IAC7DU,WAAW,EAAEE,MAAM,CAACF,WAAW;IAC/BF,UAAU,EAAEI,MAAM,CAACJ,UAAU;IAC7BQ,SAAS,EAAEJ,MAAM,CAACI;EACpB,CAAC,CAAC;EACF,MAAM,CAACC,KAAK,EAAEC,QAAQ,CAAC,GAAGlB,QAAQ,CAA+B,IAAI,CAAC;EAEtE,MAAM;IAAEmB,MAAM;IAAEF,KAAK,EAAEG;EAAe,CAAC,GAAGlB,mBAAmB,CAC3DU,MAAM,CAACJ,UAAU,EACjBK,MACF,CAAC;EAEDZ,SAAS,CAAC,MAAM;IACdc,gBAAgB,CAAC;MACfL,WAAW,EAAEE,MAAM,CAACF,WAAW;MAC/BF,UAAU,EAAEI,MAAM,CAACJ,UAAU;MAC7Ba,GAAG,EAAEF,MAAM,EAAEG,GAAG;MAChBC,gBAAgB,EAAEJ,MAAM,EAAEK,gBAAgB;MAC1CC,kBAAkB,EAAEN,MAAM,EAAEO,0BAA0B;MACtDC,eAAe,EAAER,MAAM,EAAES,uBAAuB;MAChDC,gBAAgB,EAAEV,MAAM,EAAEU;IAC5B,CAAC,CAAC;IACFX,QAAQ,CAACE,cAAc,CAAC;EAC1B,CAAC,EAAE,CAACD,MAAM,EAAEP,MAAM,EAAEQ,cAAc,CAAC,CAAC;EAEpC,OAAO;IACLN,aAAa;IACbG;EACF,CAAC;AACH,CAAC;AAED,SACEd,UAAU,EACVQ,UAAU","ignoreList":[]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { gql } from '@apollo/client';
|
|
2
|
+
export const getInstrumentsChart = gql`
|
|
3
|
+
query GetInstrumentsChart($instruments: [String!], $division: Division) {
|
|
4
|
+
topicalInstrumentsCharts(instruments: $instruments, division: $division) {
|
|
5
|
+
name
|
|
6
|
+
chart
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
`;
|
|
10
|
+
//# sourceMappingURL=getInstrumentsChart.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getInstrumentsChart.js","names":["gql","getInstrumentsChart"],"sources":["../../../src/gql/getInstrumentsChart.ts"],"sourcesContent":["import { gql } from '@apollo/client';\n\nexport const getInstrumentsChart = gql`\n query GetInstrumentsChart($instruments: [String!], $division: Division) {\n topicalInstrumentsCharts(instruments: $instruments, division: $division) {\n name\n chart\n }\n }\n`;\n"],"mappings":"AAAA,SAASA,GAAG,QAAQ,gBAAgB;AAEpC,OAAO,MAAMC,mBAAmB,GAAGD,GAAG;AACtC;AACA;AACA;AACA;AACA;AACA;AACA,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export function useFragment(_documentNode, fragmentType) {
|
|
2
|
+
return fragmentType;
|
|
3
|
+
}
|
|
4
|
+
export function makeFragmentData(data, _fragment) {
|
|
5
|
+
return data;
|
|
6
|
+
}
|
|
7
|
+
export function isFragmentReady(queryNode, fragmentNode, data) {
|
|
8
|
+
const deferredFields = queryNode.__meta__?.deferredFields;
|
|
9
|
+
if (!deferredFields) return true;
|
|
10
|
+
const fragDef = fragmentNode.definitions[0];
|
|
11
|
+
const fragName = fragDef?.name?.value;
|
|
12
|
+
const fields = fragName && deferredFields[fragName] || [];
|
|
13
|
+
return fields.length > 0 && fields.every(field => data && field in data);
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=fragment-masking.js.map
|
|
@@ -0,0 +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 { ResultOf, DocumentTypeDecoration, TypedDocumentNode } from '@graphql-typed-document-node/core';\nimport { FragmentDefinitionNode } from 'graphql';\nimport { Incremental } from './graphql';\n\n\nexport type FragmentType<TDocumentType extends DocumentTypeDecoration<any, any>> = TDocumentType extends DocumentTypeDecoration<\n infer TType,\n any\n>\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: FragmentType<DocumentTypeDecoration<TType, any>> | null | 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: ReadonlyArray<FragmentType<DocumentTypeDecoration<TType, any>>> | null | undefined\n): ReadonlyArray<TType> | null | undefined;\nexport function useFragment<TType>(\n _documentNode: DocumentTypeDecoration<TType, any>,\n fragmentType: FragmentType<DocumentTypeDecoration<TType, any>> | ReadonlyArray<FragmentType<DocumentTypeDecoration<TType, any>>> | null | undefined\n): TType | ReadonlyArray<TType> | null | undefined {\n return fragmentType as any;\n}\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: FragmentType<TypedDocumentNode<Incremental<TFrag>, any>> | null | undefined\n): data is FragmentType<typeof fragmentNode> {\n const deferredFields = (queryNode as { __meta__?: { deferredFields: Record<string, (keyof TFrag)[]> } }).__meta__\n ?.deferredFields;\n\n if (!deferredFields) return true;\n\n const fragDef = fragmentNode.definitions[0] as FragmentDefinitionNode | 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":"AAoCA,OAAO,SAASA,WAAWA,CACzBC,aAAiD,EACjDC,YAAmJ,EAClG;EACjD,OAAOA,YAAY;AACrB;AAGA,OAAO,SAASC,gBAAgBA,CAG9BC,IAAQ,EAAEC,SAAY,EAAmB;EACzC,OAAOD,IAAI;AACb;AACA,OAAO,SAASE,eAAeA,CAC7BC,SAA8C,EAC9CC,YAAsC,EACtCJ,IAAiF,EACtC;EAC3C,MAAMK,cAAc,GAAIF,SAAS,CAAwEG,QAAQ,EAC7GD,cAAc;EAElB,IAAI,CAACA,cAAc,EAAE,OAAO,IAAI;EAEhC,MAAME,OAAO,GAAGH,YAAY,CAACI,WAAW,CAAC,CAAC,CAAuC;EACjF,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,CAACC,KAAK,IAAIf,IAAI,IAAIe,KAAK,IAAIf,IAAI,CAAC;AAC1E","ignoreList":[]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as types from './graphql';
|
|
2
|
+
const documents = {
|
|
3
|
+
"\n query GetInstrumentsChart($instruments: [String!], $division: Division) {\n topicalInstrumentsCharts(instruments: $instruments, division: $division) {\n name\n chart\n }\n }\n": types.GetInstrumentsChartDocument,
|
|
4
|
+
"\n query validateInstruments($instruments: [String]!, $division: Division) {\n mapInstrumentNames(instruments: $instruments, division: $division) {\n name\n displayName\n }\n }\n": types.ValidateInstrumentsDocument
|
|
5
|
+
};
|
|
6
|
+
export function graphql(source) {
|
|
7
|
+
return documents[source] ?? {};
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=gql.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gql.js","names":["types","documents","GetInstrumentsChartDocument","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 GetInstrumentsChart($instruments: [String!], $division: Division) {\\n topicalInstrumentsCharts(instruments: $instruments, division: $division) {\\n name\\n chart\\n }\\n }\\n\": types.GetInstrumentsChartDocument,\n \"\\n query validateInstruments($instruments: [String]!, $division: Division) {\\n mapInstrumentNames(instruments: $instruments, division: $division) {\\n name\\n displayName\\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(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\"];\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(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\"];\n\nexport function graphql(source: string) {\n return (documents as any)[source] ?? {};\n}\n\nexport type DocumentType<TDocumentNode extends DocumentNode<any, any>> = TDocumentNode extends DocumentNode< infer TType, any> ? TType : never;"],"mappings":"AACA,OAAO,KAAKA,KAAK,MAAM,WAAW;AAalC,MAAMC,SAAS,GAAG;EACd,sMAAsM,EAAED,KAAK,CAACE,2BAA2B;EACzO,sMAAsM,EAAEF,KAAK,CAACG;AAClN,CAAC;AAyBD,OAAO,SAASC,OAAOA,CAACC,MAAc,EAAE;EACtC,OAAQJ,SAAS,CAASI,MAAM,CAAC,IAAI,CAAC,CAAC;AACzC","ignoreList":[]}
|