@oanda/labs-instrument-live-rate-widget 1.0.33 → 1.0.35

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.
Files changed (77) hide show
  1. package/CHANGELOG.md +284 -0
  2. package/dist/main/InstrumentLiveRateWidget/InstrumentLiveRateWidget.js +27 -27
  3. package/dist/main/InstrumentLiveRateWidget/InstrumentLiveRateWidget.js.map +1 -1
  4. package/dist/main/InstrumentLiveRateWidget/Main.js +5 -5
  5. package/dist/main/InstrumentLiveRateWidget/Main.js.map +1 -1
  6. package/dist/main/InstrumentLiveRateWidget/ValidationWrapper.js +6 -8
  7. package/dist/main/InstrumentLiveRateWidget/ValidationWrapper.js.map +1 -1
  8. package/dist/main/InstrumentLiveRateWidget/constant.js.map +1 -1
  9. package/dist/main/InstrumentLiveRateWidget/render.js +7 -7
  10. package/dist/main/InstrumentLiveRateWidget/render.js.map +1 -1
  11. package/dist/main/InstrumentLiveRateWidget/types.js +1 -1
  12. package/dist/main/InstrumentLiveRateWidget/types.js.map +1 -1
  13. package/dist/main/InstrumentLiveRateWidget/utils.js +1 -1
  14. package/dist/main/InstrumentLiveRateWidget/utils.js.map +1 -1
  15. package/dist/main/gql/types/fragment-masking.js.map +1 -1
  16. package/dist/main/gql/types/gql.js +2 -2
  17. package/dist/main/gql/types/gql.js.map +1 -1
  18. package/dist/main/gql/types/graphql.js +142 -142
  19. package/dist/main/gql/types/graphql.js.map +1 -1
  20. package/dist/main/gql/types/index.js.map +1 -1
  21. package/dist/main/index.js +8 -8
  22. package/dist/main/index.js.map +1 -1
  23. package/dist/main/translations/index.js +1 -1
  24. package/dist/main/translations/index.js.map +1 -1
  25. package/dist/main/translations/translations.js.map +1 -1
  26. package/dist/module/InstrumentLiveRateWidget/InstrumentLiveRateWidget.js +28 -27
  27. package/dist/module/InstrumentLiveRateWidget/InstrumentLiveRateWidget.js.map +1 -1
  28. package/dist/module/InstrumentLiveRateWidget/Main.js +5 -5
  29. package/dist/module/InstrumentLiveRateWidget/Main.js.map +1 -1
  30. package/dist/module/InstrumentLiveRateWidget/ValidationWrapper.js +6 -6
  31. package/dist/module/InstrumentLiveRateWidget/ValidationWrapper.js.map +1 -1
  32. package/dist/module/InstrumentLiveRateWidget/constant.js.map +1 -1
  33. package/dist/module/InstrumentLiveRateWidget/render.js +7 -7
  34. package/dist/module/InstrumentLiveRateWidget/render.js.map +1 -1
  35. package/dist/module/InstrumentLiveRateWidget/types.js +1 -1
  36. package/dist/module/InstrumentLiveRateWidget/types.js.map +1 -1
  37. package/dist/module/InstrumentLiveRateWidget/utils.js +1 -1
  38. package/dist/module/InstrumentLiveRateWidget/utils.js.map +1 -1
  39. package/dist/module/gql/types/fragment-masking.js.map +1 -1
  40. package/dist/module/gql/types/gql.js +2 -2
  41. package/dist/module/gql/types/gql.js.map +1 -1
  42. package/dist/module/gql/types/graphql.js +142 -142
  43. package/dist/module/gql/types/graphql.js.map +1 -1
  44. package/dist/module/gql/types/index.js +2 -2
  45. package/dist/module/gql/types/index.js.map +1 -1
  46. package/dist/module/index.js +1 -1
  47. package/dist/module/index.js.map +1 -1
  48. package/dist/module/translations/index.js +1 -1
  49. package/dist/module/translations/index.js.map +1 -1
  50. package/dist/module/translations/translations.js.map +1 -1
  51. package/dist/types/InstrumentLiveRateWidget/InstrumentLiveRateWidget.d.ts +1 -1
  52. package/dist/types/InstrumentLiveRateWidget/Main.d.ts +1 -1
  53. package/dist/types/InstrumentLiveRateWidget/ValidationWrapper.d.ts +1 -1
  54. package/dist/types/InstrumentLiveRateWidget/constant.d.ts +1 -1
  55. package/dist/types/InstrumentLiveRateWidget/types.d.ts +3 -3
  56. package/dist/types/InstrumentLiveRateWidget/utils.d.ts +3 -3
  57. package/dist/types/gql/types/gql.d.ts +4 -4
  58. package/dist/types/gql/types/index.d.ts +2 -2
  59. package/dist/types/index.d.ts +1 -1
  60. package/dist/types/translations/index.d.ts +2 -2
  61. package/package.json +3 -3
  62. package/src/InstrumentLiveRateWidget/InstrumentLiveRateWidget.tsx +32 -30
  63. package/src/InstrumentLiveRateWidget/Main.tsx +12 -8
  64. package/src/InstrumentLiveRateWidget/ValidationWrapper.tsx +33 -29
  65. package/src/InstrumentLiveRateWidget/constant.ts +1 -3
  66. package/src/InstrumentLiveRateWidget/render.tsx +44 -31
  67. package/src/InstrumentLiveRateWidget/types.tsx +8 -3
  68. package/src/InstrumentLiveRateWidget/utils.ts +16 -16
  69. package/src/gql/types/fragment-masking.ts +41 -21
  70. package/src/gql/types/gql.ts +12 -5
  71. package/src/gql/types/graphql.ts +214 -50
  72. package/src/gql/types/index.ts +2 -2
  73. package/src/index.ts +1 -1
  74. package/src/translations/index.ts +4 -4
  75. package/src/translations/translations.ts +2 -1
  76. package/test/Main.test.tsx +21 -15
  77. package/test/mocks.ts +1 -3
@@ -1,7 +1,6 @@
1
- import React, { Suspense } from 'react';
2
- import { ApolloClient, InMemoryCache, ApolloProvider } from '@apollo/client';
3
- import { LocaleProvider } from '@oanda/mono-i18n';
4
- import { LiveRatesProvider, ThemeProvider, getLocale, renderComponent } from '@oanda/labs-widget-common';
1
+ import { ApolloClient, InMemoryCache } from '@apollo/client';
2
+ import { WidgetProvider, WidgetWrapper } from '@oanda/labs-widget-common';
3
+ import React from 'react';
5
4
  import { translations } from '../translations';
6
5
  import { Division } from './types';
7
6
  import { ValidationWrapper } from './ValidationWrapper';
@@ -24,30 +23,32 @@ const InstrumentLiveRateWidget = _ref => {
24
23
  });
25
24
  const divisionCode = division === Division.Opt ? Division.Ogm : division;
26
25
  const dataSource = divisionCode === Division.Ogm ? 'MT5' : 'V20';
27
- return React.createElement(LocaleProvider, {
28
- locale: getLocale(locale),
26
+ return React.createElement(WidgetProvider, {
27
+ withSuspense: true,
28
+ client: client,
29
+ liveRates: {
30
+ url: liveRatesUrl,
31
+ options: {
32
+ divisionCode,
33
+ dataSource
34
+ }
35
+ },
36
+ locale: locale,
37
+ styling: {
38
+ removePadding
39
+ },
40
+ theme: theme,
29
41
  translations: translations
30
- }, React.createElement(LiveRatesProvider, {
31
- url: liveRatesUrl,
32
- options: {
33
- divisionCode,
34
- dataSource
35
- }
36
- }, React.createElement(ApolloProvider, {
37
- client: client
38
- }, React.createElement(Suspense, null, React.createElement(ThemeProvider, {
39
- removePadding: removePadding,
40
- theme: theme
41
- }, renderComponent({
42
- Component: React.createElement(ValidationWrapper, {
43
- size: size,
44
- instrument: instrument,
45
- division: division,
46
- isParamError: isParamError
47
- }),
48
- logoLink,
49
- linkArea: 'full'
50
- }))))));
42
+ }, React.createElement(WidgetWrapper, {
43
+ isParamError: isParamError,
44
+ linkArea: "full",
45
+ logoLink: logoLink
46
+ }, React.createElement(ValidationWrapper, {
47
+ division: division,
48
+ instrument: instrument,
49
+ isParamError: isParamError,
50
+ size: size
51
+ })));
51
52
  };
52
53
  export { InstrumentLiveRateWidget };
53
54
  //# sourceMappingURL=InstrumentLiveRateWidget.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"InstrumentLiveRateWidget.js","names":["React","Suspense","ApolloClient","InMemoryCache","ApolloProvider","LocaleProvider","LiveRatesProvider","ThemeProvider","getLocale","renderComponent","translations","Division","ValidationWrapper","InstrumentLiveRateWidget","_ref","graphqlUrl","liveRatesUrl","instrument","division","locale","theme","isParamError","removePadding","size","logoLink","client","uri","cache","divisionCode","Opt","Ogm","dataSource","createElement","url","options","Component","linkArea"],"sources":["../../../src/InstrumentLiveRateWidget/InstrumentLiveRateWidget.tsx"],"sourcesContent":["import React, { Suspense } from 'react';\nimport { ApolloClient, InMemoryCache, ApolloProvider } from '@apollo/client';\nimport { LocaleProvider } from '@oanda/mono-i18n';\nimport {\n LiveRatesProvider, ThemeProvider, getLocale,\n renderComponent,\n} from '@oanda/labs-widget-common';\nimport { translations } from '../translations';\nimport { Division, InstrumentLiveRateConfig } from './types';\nimport { ValidationWrapper } from './ValidationWrapper';\n\nconst InstrumentLiveRateWidget = ({\n graphqlUrl,\n liveRatesUrl,\n instrument,\n division,\n locale,\n theme,\n isParamError,\n removePadding,\n size,\n logoLink,\n}: InstrumentLiveRateConfig) => {\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 <LocaleProvider locale={getLocale(locale)} translations={translations}>\n <LiveRatesProvider\n url={liveRatesUrl}\n options={{ divisionCode, dataSource }}\n >\n <ApolloProvider client={client}>\n <Suspense>\n <ThemeProvider removePadding={removePadding} theme={theme}>\n {renderComponent({\n Component: <ValidationWrapper\n size={size}\n instrument={instrument}\n division={division}\n isParamError={isParamError}\n />,\n logoLink,\n linkArea: 'full',\n })}\n </ThemeProvider>\n </Suspense>\n </ApolloProvider>\n </LiveRatesProvider>\n </LocaleProvider>\n );\n};\n\nexport { InstrumentLiveRateWidget };\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,QAAQ,QAAQ,OAAO;AACvC,SAASC,YAAY,EAAEC,aAAa,EAAEC,cAAc,QAAQ,gBAAgB;AAC5E,SAASC,cAAc,QAAQ,kBAAkB;AACjD,SACEC,iBAAiB,EAAEC,aAAa,EAAEC,SAAS,EAC3CC,eAAe,QACV,2BAA2B;AAClC,SAASC,YAAY,QAAQ,iBAAiB;AAC9C,SAASC,QAAQ,QAAkC,SAAS;AAC5D,SAASC,iBAAiB,QAAQ,qBAAqB;AAEvD,MAAMC,wBAAwB,GAAGC,IAAA,IAWD;EAAA,IAXE;IAChCC,UAAU;IACVC,YAAY;IACZC,UAAU;IACVC,QAAQ;IACRC,MAAM;IACNC,KAAK;IACLC,YAAY;IACZC,aAAa;IACbC,IAAI;IACJC;EACwB,CAAC,GAAAV,IAAA;EACzB,MAAMW,MAAM,GAAG,IAAIvB,YAAY,CAAC;IAC9BwB,GAAG,EAAEX,UAAU;IACfY,KAAK,EAAE,IAAIxB,aAAa,CAAC;EAC3B,CAAC,CAAC;EAEF,MAAMyB,YAAY,GAAGV,QAAQ,KAAKP,QAAQ,CAACkB,GAAG,GAAGlB,QAAQ,CAACmB,GAAG,GAAGZ,QAAQ;EACxE,MAAMa,UAAU,GAAGH,YAAY,KAAKjB,QAAQ,CAACmB,GAAG,GAAG,KAAK,GAAG,KAAK;EAEhE,OACE9B,KAAA,CAAAgC,aAAA,CAAC3B,cAAc;IAACc,MAAM,EAAEX,SAAS,CAACW,MAAM,CAAE;IAACT,YAAY,EAAEA;EAAa,GACpEV,KAAA,CAAAgC,aAAA,CAAC1B,iBAAiB;IAChB2B,GAAG,EAAEjB,YAAa;IAClBkB,OAAO,EAAE;MAAEN,YAAY;MAAEG;IAAW;EAAE,GAEtC/B,KAAA,CAAAgC,aAAA,CAAC5B,cAAc;IAACqB,MAAM,EAAEA;EAAO,GAC7BzB,KAAA,CAAAgC,aAAA,CAAC/B,QAAQ,QACPD,KAAA,CAAAgC,aAAA,CAACzB,aAAa;IAACe,aAAa,EAAEA,aAAc;IAACF,KAAK,EAAEA;EAAM,GACvDX,eAAe,CAAC;IACf0B,SAAS,EAAEnC,KAAA,CAAAgC,aAAA,CAACpB,iBAAiB;MAC3BW,IAAI,EAAEA,IAAK;MACXN,UAAU,EAAEA,UAAW;MACvBC,QAAQ,EAAEA,QAAS;MACnBG,YAAY,EAAEA;IAAa,CAC5B,CAAC;IACFG,QAAQ;IACRY,QAAQ,EAAE;EACZ,CAAC,CACY,CACP,CACI,CACC,CACL,CAAC;AAErB,CAAC;AAED,SAASvB,wBAAwB","ignoreList":[]}
1
+ {"version":3,"file":"InstrumentLiveRateWidget.js","names":["ApolloClient","InMemoryCache","WidgetProvider","WidgetWrapper","React","translations","Division","ValidationWrapper","InstrumentLiveRateWidget","_ref","graphqlUrl","liveRatesUrl","instrument","division","locale","theme","isParamError","removePadding","size","logoLink","client","uri","cache","divisionCode","Opt","Ogm","dataSource","createElement","withSuspense","liveRates","url","options","styling","linkArea"],"sources":["../../../src/InstrumentLiveRateWidget/InstrumentLiveRateWidget.tsx"],"sourcesContent":["import { ApolloClient, InMemoryCache } from '@apollo/client';\nimport { WidgetProvider, WidgetWrapper } from '@oanda/labs-widget-common';\nimport React from 'react';\n\nimport { translations } from '../translations';\nimport type { InstrumentLiveRateConfig } from './types';\nimport { Division } from './types';\nimport { ValidationWrapper } from './ValidationWrapper';\n\nconst InstrumentLiveRateWidget = ({\n graphqlUrl,\n liveRatesUrl,\n instrument,\n division,\n locale,\n theme,\n isParamError,\n removePadding,\n size,\n logoLink,\n}: InstrumentLiveRateConfig) => {\n const client = new ApolloClient({\n uri: graphqlUrl,\n cache: new InMemoryCache(),\n });\n\n const divisionCode = division === Division.Opt ? Division.Ogm : division;\n const dataSource = divisionCode === Division.Ogm ? 'MT5' : 'V20';\n\n return (\n <WidgetProvider\n withSuspense\n client={client}\n liveRates={{\n url: liveRatesUrl,\n options: { divisionCode, dataSource },\n }}\n locale={locale}\n styling={{\n removePadding,\n }}\n theme={theme}\n translations={translations}\n >\n <WidgetWrapper\n isParamError={isParamError}\n linkArea=\"full\"\n logoLink={logoLink}\n >\n <ValidationWrapper\n division={division}\n instrument={instrument}\n isParamError={isParamError}\n size={size}\n />\n </WidgetWrapper>\n </WidgetProvider>\n );\n};\n\nexport { InstrumentLiveRateWidget };\n"],"mappings":"AAAA,SAASA,YAAY,EAAEC,aAAa,QAAQ,gBAAgB;AAC5D,SAASC,cAAc,EAAEC,aAAa,QAAQ,2BAA2B;AACzE,OAAOC,KAAK,MAAM,OAAO;AAEzB,SAASC,YAAY,QAAQ,iBAAiB;AAE9C,SAASC,QAAQ,QAAQ,SAAS;AAClC,SAASC,iBAAiB,QAAQ,qBAAqB;AAEvD,MAAMC,wBAAwB,GAAGC,IAAA,IAWD;EAAA,IAXE;IAChCC,UAAU;IACVC,YAAY;IACZC,UAAU;IACVC,QAAQ;IACRC,MAAM;IACNC,KAAK;IACLC,YAAY;IACZC,aAAa;IACbC,IAAI;IACJC;EACwB,CAAC,GAAAV,IAAA;EACzB,MAAMW,MAAM,GAAG,IAAIpB,YAAY,CAAC;IAC9BqB,GAAG,EAAEX,UAAU;IACfY,KAAK,EAAE,IAAIrB,aAAa,CAAC;EAC3B,CAAC,CAAC;EAEF,MAAMsB,YAAY,GAAGV,QAAQ,KAAKP,QAAQ,CAACkB,GAAG,GAAGlB,QAAQ,CAACmB,GAAG,GAAGZ,QAAQ;EACxE,MAAMa,UAAU,GAAGH,YAAY,KAAKjB,QAAQ,CAACmB,GAAG,GAAG,KAAK,GAAG,KAAK;EAEhE,OACErB,KAAA,CAAAuB,aAAA,CAACzB,cAAc;IACb0B,YAAY;IACZR,MAAM,EAAEA,MAAO;IACfS,SAAS,EAAE;MACTC,GAAG,EAAEnB,YAAY;MACjBoB,OAAO,EAAE;QAAER,YAAY;QAAEG;MAAW;IACtC,CAAE;IACFZ,MAAM,EAAEA,MAAO;IACfkB,OAAO,EAAE;MACPf;IACF,CAAE;IACFF,KAAK,EAAEA,KAAM;IACbV,YAAY,EAAEA;EAAa,GAE3BD,KAAA,CAAAuB,aAAA,CAACxB,aAAa;IACZa,YAAY,EAAEA,YAAa;IAC3BiB,QAAQ,EAAC,MAAM;IACfd,QAAQ,EAAEA;EAAS,GAEnBf,KAAA,CAAAuB,aAAA,CAACpB,iBAAiB;IAChBM,QAAQ,EAAEA,QAAS;IACnBD,UAAU,EAAEA,UAAW;IACvBI,YAAY,EAAEA,YAAa;IAC3BE,IAAI,EAAEA;EAAK,CACZ,CACY,CACD,CAAC;AAErB,CAAC;AAED,SAASV,wBAAwB","ignoreList":[]}
@@ -1,8 +1,8 @@
1
- import React, { useEffect } from 'react';
2
1
  import { useBackgroundQuery } from '@apollo/client';
3
2
  import { InstrumentRateWithChart, Tooltip, useLiveRatesQuery } from '@oanda/labs-widget-common';
4
- import { INSTRUMENT_TOOLTIP_ID } from './constant';
3
+ import React, { useEffect } from 'react';
5
4
  import { getInstrumentsChart } from '../gql/getInstrumentsChart';
5
+ import { INSTRUMENT_TOOLTIP_ID } from './constant';
6
6
  const Main = _ref => {
7
7
  let {
8
8
  division,
@@ -30,11 +30,11 @@ const Main = _ref => {
30
30
  }
31
31
  }, [record]);
32
32
  return React.createElement("div", null, React.createElement(InstrumentRateWithChart, {
33
+ queryRef: queryRef,
33
34
  record: record,
34
- target: target,
35
35
  size: widgetSize,
36
- tooltipId: INSTRUMENT_TOOLTIP_ID,
37
- queryRef: queryRef
36
+ target: target,
37
+ tooltipId: INSTRUMENT_TOOLTIP_ID
38
38
  }), React.createElement(Tooltip, {
39
39
  id: INSTRUMENT_TOOLTIP_ID
40
40
  }));
@@ -1 +1 @@
1
- {"version":3,"file":"Main.js","names":["React","useEffect","useBackgroundQuery","InstrumentRateWithChart","Tooltip","useLiveRatesQuery","INSTRUMENT_TOOLTIP_ID","getInstrumentsChart","Main","_ref","division","size","widgetSize","record","hasInstrument","instrument","queryRef","variables","instruments","fetchPolicy","skip","target","setQuery","createElement","tooltipId","id"],"sources":["../../../src/InstrumentLiveRateWidget/Main.tsx"],"sourcesContent":["import React, { useEffect } from 'react';\nimport { useBackgroundQuery } from '@apollo/client';\nimport {\n InstrumentRateWithChart,\n Tooltip,\n useLiveRatesQuery,\n} from '@oanda/labs-widget-common';\nimport { MainProps } from './types';\nimport { INSTRUMENT_TOOLTIP_ID } from './constant';\nimport { getInstrumentsChart } from '../gql/getInstrumentsChart';\nimport { GetInstrumentsChartQuery, GetInstrumentsChartQueryVariables } from '../gql/types/graphql';\n\nconst Main = ({\n division,\n size: widgetSize = 'fullWithChart',\n record,\n}: MainProps) => {\n const hasInstrument = !!record.instrument;\n\n const [queryRef] = useBackgroundQuery<\n GetInstrumentsChartQuery,\n GetInstrumentsChartQueryVariables\n >(getInstrumentsChart, {\n variables: {\n instruments: [record.instrument],\n division,\n },\n fetchPolicy: 'network-only',\n skip: !hasInstrument,\n });\n\n const { target, setQuery } = useLiveRatesQuery();\n\n useEffect(() => {\n if (hasInstrument) {\n setQuery({ instruments: [record?.instrument] });\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [record]);\n\n return (\n <div>\n <InstrumentRateWithChart<GetInstrumentsChartQuery>\n record={record}\n target={target}\n size={widgetSize}\n tooltipId={INSTRUMENT_TOOLTIP_ID}\n queryRef={queryRef}\n />\n <Tooltip id={INSTRUMENT_TOOLTIP_ID} />\n </div>\n );\n};\n\nexport { Main };\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,SAAS,QAAQ,OAAO;AACxC,SAASC,kBAAkB,QAAQ,gBAAgB;AACnD,SACEC,uBAAuB,EACvBC,OAAO,EACPC,iBAAiB,QACZ,2BAA2B;AAElC,SAASC,qBAAqB,QAAQ,YAAY;AAClD,SAASC,mBAAmB,QAAQ,4BAA4B;AAGhE,MAAMC,IAAI,GAAGC,IAAA,IAII;EAAA,IAJH;IACZC,QAAQ;IACRC,IAAI,EAAEC,UAAU,GAAG,eAAe;IAClCC;EACS,CAAC,GAAAJ,IAAA;EACV,MAAMK,aAAa,GAAG,CAAC,CAACD,MAAM,CAACE,UAAU;EAEzC,MAAM,CAACC,QAAQ,CAAC,GAAGd,kBAAkB,CAGnCK,mBAAmB,EAAE;IACrBU,SAAS,EAAE;MACTC,WAAW,EAAE,CAACL,MAAM,CAACE,UAAU,CAAC;MAChCL;IACF,CAAC;IACDS,WAAW,EAAE,cAAc;IAC3BC,IAAI,EAAE,CAACN;EACT,CAAC,CAAC;EAEF,MAAM;IAAEO,MAAM;IAAEC;EAAS,CAAC,GAAGjB,iBAAiB,CAAC,CAAC;EAEhDJ,SAAS,CAAC,MAAM;IACd,IAAIa,aAAa,EAAE;MACjBQ,QAAQ,CAAC;QAAEJ,WAAW,EAAE,CAACL,MAAM,EAAEE,UAAU;MAAE,CAAC,CAAC;IACjD;EAEF,CAAC,EAAE,CAACF,MAAM,CAAC,CAAC;EAEZ,OACEb,KAAA,CAAAuB,aAAA,cACEvB,KAAA,CAAAuB,aAAA,CAACpB,uBAAuB;IACtBU,MAAM,EAAEA,MAAO;IACfQ,MAAM,EAAEA,MAAO;IACfV,IAAI,EAAEC,UAAW;IACjBY,SAAS,EAAElB,qBAAsB;IACjCU,QAAQ,EAAEA;EAAS,CACpB,CAAC,EACFhB,KAAA,CAAAuB,aAAA,CAACnB,OAAO;IAACqB,EAAE,EAAEnB;EAAsB,CAAE,CAClC,CAAC;AAEV,CAAC;AAED,SAASE,IAAI","ignoreList":[]}
1
+ {"version":3,"file":"Main.js","names":["useBackgroundQuery","InstrumentRateWithChart","Tooltip","useLiveRatesQuery","React","useEffect","getInstrumentsChart","INSTRUMENT_TOOLTIP_ID","Main","_ref","division","size","widgetSize","record","hasInstrument","instrument","queryRef","variables","instruments","fetchPolicy","skip","target","setQuery","createElement","tooltipId","id"],"sources":["../../../src/InstrumentLiveRateWidget/Main.tsx"],"sourcesContent":["import { useBackgroundQuery } from '@apollo/client';\nimport {\n InstrumentRateWithChart,\n Tooltip,\n useLiveRatesQuery,\n} from '@oanda/labs-widget-common';\nimport React, { useEffect } from 'react';\n\nimport { getInstrumentsChart } from '../gql/getInstrumentsChart';\nimport type {\n GetInstrumentsChartQuery,\n GetInstrumentsChartQueryVariables,\n} from '../gql/types/graphql';\nimport { INSTRUMENT_TOOLTIP_ID } from './constant';\nimport type { MainProps } from './types';\n\nconst Main = ({\n division,\n size: widgetSize = 'fullWithChart',\n record,\n}: MainProps) => {\n const hasInstrument = !!record.instrument;\n\n const [queryRef] = useBackgroundQuery<\n GetInstrumentsChartQuery,\n GetInstrumentsChartQueryVariables\n >(getInstrumentsChart, {\n variables: {\n instruments: [record.instrument],\n division,\n },\n fetchPolicy: 'network-only',\n skip: !hasInstrument,\n });\n\n const { target, setQuery } = useLiveRatesQuery();\n\n useEffect(() => {\n if (hasInstrument) {\n setQuery({ instruments: [record?.instrument] });\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [record]);\n\n return (\n <div>\n <InstrumentRateWithChart<GetInstrumentsChartQuery>\n queryRef={queryRef}\n record={record}\n size={widgetSize}\n target={target}\n tooltipId={INSTRUMENT_TOOLTIP_ID}\n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AE,EAAElB;EAAsB,CAAE,CAClC,CAAC;AAEV,CAAC;AAED,SAASC,IAAI","ignoreList":[]}
@@ -1,10 +1,10 @@
1
- import React, { useContext } from 'react';
2
1
  import { useSuspenseQuery } from '@apollo/client';
2
+ import { Error, useLayoutProvider } from '@oanda/labs-widget-common';
3
3
  import classnames from 'classnames';
4
- import { Error, ThemeContext } from '@oanda/labs-widget-common';
5
- import { getRecords } from './utils';
4
+ import React from 'react';
6
5
  import { validateInstruments } from '../gql/validateInstruments';
7
6
  import { Main } from './Main';
7
+ import { getRecords } from './utils';
8
8
  const ValidationWrapper = _ref => {
9
9
  let {
10
10
  instrument,
@@ -14,7 +14,7 @@ const ValidationWrapper = _ref => {
14
14
  } = _ref;
15
15
  const {
16
16
  size
17
- } = useContext(ThemeContext);
17
+ } = useLayoutProvider();
18
18
  const {
19
19
  data,
20
20
  error
@@ -35,9 +35,9 @@ const ValidationWrapper = _ref => {
35
35
  'lw-h-[54px]': widgetSize === 'compact'
36
36
  })
37
37
  }, React.createElement(Main, {
38
- size: widgetSize,
39
38
  division: division,
40
- record: getRecords(data)?.[0]
39
+ record: getRecords(data)?.[0],
40
+ size: widgetSize
41
41
  })), showError && React.createElement("div", {
42
42
  className: classnames('lw-flex lw-w-full lw-items-center', {
43
43
  'lw-h-[82px]': widgetSize !== 'compact',
@@ -1 +1 @@
1
- {"version":3,"file":"ValidationWrapper.js","names":["React","useContext","useSuspenseQuery","classnames","Error","ThemeContext","getRecords","validateInstruments","Main","ValidationWrapper","_ref","instrument","division","size","widgetSize","isParamError","data","error","variables","instruments","fetchPolicy","errorPolicy","showError","createElement","Fragment","className","record"],"sources":["../../../src/InstrumentLiveRateWidget/ValidationWrapper.tsx"],"sourcesContent":["import React, { useContext } from 'react';\nimport { useSuspenseQuery } from '@apollo/client';\nimport classnames from 'classnames';\nimport { Error, ThemeContext } from '@oanda/labs-widget-common';\nimport { getRecords } from './utils';\nimport { ValidationWrapperProps } from './types';\nimport { validateInstruments } from '../gql/validateInstruments';\nimport { ValidateInstrumentsQuery, ValidateInstrumentsQueryVariables } from '../gql/types/graphql';\nimport { Main } from './Main';\n\nconst ValidationWrapper = ({\n instrument,\n division,\n size: widgetSize,\n isParamError,\n}: ValidationWrapperProps) => {\n const { size } = useContext(ThemeContext);\n const { data, error } = useSuspenseQuery<\n ValidateInstrumentsQuery,\n ValidateInstrumentsQueryVariables\n >(validateInstruments, {\n variables: {\n instruments: [instrument],\n division,\n },\n fetchPolicy: 'network-only',\n errorPolicy: 'all',\n });\n\n const showError = !!error || isParamError;\n\n return (\n <>\n {size && (\n <div\n className=\"lw-flex lw-border lw-border-solid lw-border-border-primary lw-px-4 lw-text-sm lw-tracking-normal lw-text-text-primary\"\n >\n {!showError && (\n <div className={classnames({\n 'lw-h-[82px]': widgetSize !== 'compact',\n 'lw-h-[54px]': widgetSize === 'compact',\n })}\n >\n <Main\n size={widgetSize}\n division={division}\n record={getRecords(data!)?.[0]!}\n />\n </div>\n )}\n {showError && (\n <div className={classnames('lw-flex lw-w-full lw-items-center', {\n 'lw-h-[82px]': widgetSize !== 'compact',\n 'lw-h-[54px]': widgetSize === 'compact',\n })}\n >\n <Error />\n </div>\n )}\n </div>\n )}\n </>\n );\n};\n\nexport { ValidationWrapper };\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,UAAU,QAAQ,OAAO;AACzC,SAASC,gBAAgB,QAAQ,gBAAgB;AACjD,OAAOC,UAAU,MAAM,YAAY;AACnC,SAASC,KAAK,EAAEC,YAAY,QAAQ,2BAA2B;AAC/D,SAASC,UAAU,QAAQ,SAAS;AAEpC,SAASC,mBAAmB,QAAQ,4BAA4B;AAEhE,SAASC,IAAI,QAAQ,QAAQ;AAE7B,MAAMC,iBAAiB,GAAGC,IAAA,IAKI;EAAA,IALH;IACzBC,UAAU;IACVC,QAAQ;IACRC,IAAI,EAAEC,UAAU;IAChBC;EACsB,CAAC,GAAAL,IAAA;EACvB,MAAM;IAAEG;EAAK,CAAC,GAAGZ,UAAU,CAACI,YAAY,CAAC;EACzC,MAAM;IAAEW,IAAI;IAAEC;EAAM,CAAC,GAAGf,gBAAgB,CAGtCK,mBAAmB,EAAE;IACrBW,SAAS,EAAE;MACTC,WAAW,EAAE,CAACR,UAAU,CAAC;MACzBC;IACF,CAAC;IACDQ,WAAW,EAAE,cAAc;IAC3BC,WAAW,EAAE;EACf,CAAC,CAAC;EAEF,MAAMC,SAAS,GAAG,CAAC,CAACL,KAAK,IAAIF,YAAY;EAEzC,OACEf,KAAA,CAAAuB,aAAA,CAAAvB,KAAA,CAAAwB,QAAA,QACGX,IAAI,IACHb,KAAA,CAAAuB,aAAA;IACEE,SAAS,EAAC;EAAuH,GAEhI,CAACH,SAAS,IACXtB,KAAA,CAAAuB,aAAA;IAAKE,SAAS,EAAEtB,UAAU,CAAC;MACzB,aAAa,EAAEW,UAAU,KAAK,SAAS;MACvC,aAAa,EAAEA,UAAU,KAAK;IAChC,CAAC;EAAE,GAEDd,KAAA,CAAAuB,aAAA,CAACf,IAAI;IACHK,IAAI,EAAEC,UAAW;IACjBF,QAAQ,EAAEA,QAAS;IACnBc,MAAM,EAAEpB,UAAU,CAACU,IAAK,CAAC,GAAG,CAAC;EAAG,CACjC,CACE,CACJ,EACAM,SAAS,IACVtB,KAAA,CAAAuB,aAAA;IAAKE,SAAS,EAAEtB,UAAU,CAAC,mCAAmC,EAAE;MAC9D,aAAa,EAAEW,UAAU,KAAK,SAAS;MACvC,aAAa,EAAEA,UAAU,KAAK;IAChC,CAAC;EAAE,GAEDd,KAAA,CAAAuB,aAAA,CAACnB,KAAK,MAAE,CACL,CAEF,CAEP,CAAC;AAEP,CAAC;AAED,SAASK,iBAAiB","ignoreList":[]}
1
+ {"version":3,"file":"ValidationWrapper.js","names":["useSuspenseQuery","Error","useLayoutProvider","classnames","React","validateInstruments","Main","getRecords","ValidationWrapper","_ref","instrument","division","size","widgetSize","isParamError","data","error","variables","instruments","fetchPolicy","errorPolicy","showError","createElement","Fragment","className","record"],"sources":["../../../src/InstrumentLiveRateWidget/ValidationWrapper.tsx"],"sourcesContent":["import { useSuspenseQuery } from '@apollo/client';\nimport { Error, useLayoutProvider } from '@oanda/labs-widget-common';\nimport classnames from 'classnames';\nimport React from 'react';\n\nimport type {\n ValidateInstrumentsQuery,\n ValidateInstrumentsQueryVariables,\n} from '../gql/types/graphql';\nimport { validateInstruments } from '../gql/validateInstruments';\nimport { Main } from './Main';\nimport type { ValidationWrapperProps } from './types';\nimport { getRecords } from './utils';\n\nconst ValidationWrapper = ({\n instrument,\n division,\n size: widgetSize,\n isParamError,\n}: ValidationWrapperProps) => {\n const { size } = useLayoutProvider();\n const { data, error } = useSuspenseQuery<\n ValidateInstrumentsQuery,\n ValidateInstrumentsQueryVariables\n >(validateInstruments, {\n variables: {\n instruments: [instrument],\n division,\n },\n fetchPolicy: 'network-only',\n errorPolicy: 'all',\n });\n\n const showError = !!error || isParamError;\n\n return (\n <>\n {size && (\n <div className=\"lw-flex lw-border lw-border-solid lw-border-border-primary lw-px-4 lw-text-sm lw-tracking-normal lw-text-text-primary\">\n {!showError && (\n <div\n className={classnames({\n 'lw-h-[82px]': widgetSize !== 'compact',\n 'lw-h-[54px]': widgetSize === 'compact',\n })}\n >\n <Main\n division={division}\n record={getRecords(data!)?.[0]!}\n size={widgetSize}\n />\n </div>\n )}\n {showError && (\n <div\n className={classnames('lw-flex lw-w-full lw-items-center', {\n 'lw-h-[82px]': widgetSize !== 'compact',\n 'lw-h-[54px]': widgetSize === 'compact',\n })}\n >\n <Error />\n </div>\n )}\n </div>\n )}\n </>\n );\n};\n\nexport { ValidationWrapper };\n"],"mappings":"AAAA,SAASA,gBAAgB,QAAQ,gBAAgB;AACjD,SAASC,KAAK,EAAEC,iBAAiB,QAAQ,2BAA2B;AACpE,OAAOC,UAAU,MAAM,YAAY;AACnC,OAAOC,KAAK,MAAM,OAAO;AAMzB,SAASC,mBAAmB,QAAQ,4BAA4B;AAChE,SAASC,IAAI,QAAQ,QAAQ;AAE7B,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AAiB","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"constant.js","names":["INSTRUMENT_TOOLTIP_ID"],"sources":["../../../src/InstrumentLiveRateWidget/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":[]}
1
+ {"version":3,"file":"constant.js","names":["INSTRUMENT_TOOLTIP_ID"],"sources":["../../../src/InstrumentLiveRateWidget/constant.ts"],"sourcesContent":["const INSTRUMENT_TOOLTIP_ID = 'instrument_tooltip_id';\n\nexport { INSTRUMENT_TOOLTIP_ID };\n"],"mappings":"AAAA,MAAMA,qBAAqB,GAAG,uBAAuB;AAErD,SAASA,qBAAqB","ignoreList":[]}
@@ -1,8 +1,8 @@
1
+ import { validateLocale, validateToolParams } from '@oanda/labs-widget-common';
1
2
  import React from 'react';
2
3
  import { createRoot } from 'react-dom/client';
3
- import { validateLocale, validateToolParams } from '@oanda/labs-widget-common';
4
- import { InstrumentLiveRateWidget } from './InstrumentLiveRateWidget';
5
4
  import { Division } from '../gql/types/graphql';
5
+ import { InstrumentLiveRateWidget } from './InstrumentLiveRateWidget';
6
6
  const {
7
7
  graphqlUrl,
8
8
  liveRatesUrl
@@ -39,14 +39,14 @@ instrumentLiveRateElements.forEach(element => {
39
39
  name: 'liveRatesUrl'
40
40
  }]);
41
41
  root.render(React.createElement(InstrumentLiveRateWidget, {
42
- graphqlUrl: graphqlUrl,
43
- liveRatesUrl: liveRatesUrl,
44
42
  division: division,
43
+ graphqlUrl: graphqlUrl,
45
44
  instrument: instrument,
46
- locale: locale,
47
- theme: mode,
48
45
  isParamError: isParamError,
49
- size: size
46
+ liveRatesUrl: liveRatesUrl,
47
+ locale: locale,
48
+ size: size,
49
+ theme: mode
50
50
  }));
51
51
  });
52
52
  //# sourceMappingURL=render.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"render.js","names":["React","createRoot","validateLocale","validateToolParams","InstrumentLiveRateWidget","Division","graphqlUrl","liveRatesUrl","window","widgetsConfig","instrumentLiveRateElements","document","querySelectorAll","forEach","element","root","params","getAttribute","mode","instrument","division","locale","size","JSON","parse","isParamError","name","valueCheck","value","Object","values","includes","length","render","createElement","theme"],"sources":["../../../src/InstrumentLiveRateWidget/render.tsx"],"sourcesContent":["import React from 'react';\nimport { createRoot } from 'react-dom/client';\nimport { Theme, validateLocale, validateToolParams } from '@oanda/labs-widget-common';\nimport { InstrumentLiveRateWidget } from './InstrumentLiveRateWidget';\nimport { Division } from '../gql/types/graphql';\n\nconst {\n graphqlUrl,\n liveRatesUrl,\n} = window.widgetsConfig || {};\n\nconst instrumentLiveRateElements = document.querySelectorAll('div[data-instrument-live-rate-params]');\n\ninstrumentLiveRateElements.forEach((element) => {\n const root = createRoot(element);\n const params = element.getAttribute('data-instrument-live-rate-params');\n const mode = element.getAttribute('data-mode');\n const {\n instrument, division, locale, size,\n } = JSON.parse(params as string);\n\n const isParamError = validateToolParams({\n division, locale, instrument, graphqlUrl, liveRatesUrl,\n }, [{\n name: 'locale',\n valueCheck: (value) => validateLocale(value),\n }, {\n name: 'division',\n valueCheck: (value) => Object.values(Division).includes(value),\n }, {\n name: 'instrument',\n valueCheck: (value) => (value as string).length > 0,\n }, {\n name: 'graphqlUrl',\n }, {\n name: 'liveRatesUrl',\n }]);\n\n root.render(\n <InstrumentLiveRateWidget\n graphqlUrl={graphqlUrl}\n liveRatesUrl={liveRatesUrl}\n division={division}\n instrument={instrument}\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,wBAAwB,QAAQ,4BAA4B;AACrE,SAASC,QAA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UAAU,EAAEA,UAAW;IACvBE,MAAM,EAAEA,MAAO;IACfc,KAAK,EAAEjB,IAAc;IACrBO,YAAY,EAAEA,YAAa;IAC3BH,IAAI,EAAEA;EAAK,CACZ,CACH,CAAC;AACH,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"render.js","names":["validateLocale","validateToolParams","React","createRoot","Division","InstrumentLiveRateWidget","graphqlUrl","liveRatesUrl","window","widgetsConfig","instrumentLiveRateElements","document","querySelectorAll","forEach","element","root","params","getAttribute","mode","instrument","division","locale","size","JSON","parse","isParamError","name","valueCheck","value","Object","values","includes","length","render","createElement","theme"],"sources":["../../../src/InstrumentLiveRateWidget/render.tsx"],"sourcesContent":["import type { Theme } from '@oanda/labs-widget-common';\nimport { validateLocale, validateToolParams } from '@oanda/labs-widget-common';\nimport React from 'react';\nimport { createRoot } from 'react-dom/client';\n\nimport { Division } from '../gql/types/graphql';\nimport { InstrumentLiveRateWidget } from './InstrumentLiveRateWidget';\n\nconst { graphqlUrl, liveRatesUrl } = window.widgetsConfig || {};\n\nconst instrumentLiveRateElements = document.querySelectorAll(\n 'div[data-instrument-live-rate-params]'\n);\n\ninstrumentLiveRateElements.forEach((element) => {\n const root = createRoot(element);\n const params = element.getAttribute('data-instrument-live-rate-params');\n const mode = element.getAttribute('data-mode');\n const { instrument, division, locale, size } = JSON.parse(params as string);\n\n const isParamError = validateToolParams(\n {\n division,\n locale,\n instrument,\n graphqlUrl,\n liveRatesUrl,\n },\n [\n {\n name: 'locale',\n valueCheck: (value: string | undefined) => validateLocale(value),\n },\n {\n name: 'division',\n valueCheck: (value: Division) =>\n Object.values(Division).includes(value),\n },\n {\n name: 'instrument',\n valueCheck: (value) => (value as string).length > 0,\n },\n {\n name: 'graphqlUrl',\n },\n {\n name: 'liveRatesUrl',\n },\n ]\n );\n\n root.render(\n <InstrumentLiveRateWidget\n division={division}\n graphqlUrl={graphqlUrl}\n instrument={instrument}\n isParamError={isParamError}\n liveRatesUrl={liveRatesUrl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,CAAC,EACD;IACEA,IAAI,EAAE;EACR,CAAC,CAEL,CAAC;EAEDX,IAAI,CAACkB,MAAM,CACT/B,KAAA,CAAAgC,aAAA,CAAC7B,wBAAwB;IACvBe,QAAQ,EAAEA,QAAS;IACnBd,UAAU,EAAEA,UAAW;IACvBa,UAAU,EAAEA,UAAW;IACvBM,YAAY,EAAEA,YAAa;IAC3BlB,YAAY,EAAEA,YAAa;IAC3Bc,MAAM,EAAEA,MAAO;IACfC,IAAI,EAAEA,IAAK;IACXa,KAAK,EAAEjB;EAAc,CACtB,CACH,CAAC;AACH,CAAC,CAAC","ignoreList":[]}
@@ -1,3 +1,3 @@
1
- export { Locale } from '@oanda/mono-i18n';
2
1
  export { Division } from '../gql/types/graphql';
2
+ export { Locale } from '@oanda/mono-i18n';
3
3
  //# sourceMappingURL=types.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","names":["Locale","Division"],"sources":["../../../src/InstrumentLiveRateWidget/types.tsx"],"sourcesContent":["import { DataRecord, WidgetConfig, WidgetSize } 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 InstrumentLiveRateConfig extends WidgetConfig {\n division: Division;\n liveRatesUrl: string;\n instrument: string;\n removePadding?: boolean;\n size?: WidgetSize;\n}\n\nexport interface ValidationWrapperProps {\n instrument: string;\n division: Division;\n size?: WidgetSize;\n isParamError?: boolean;\n}\nexport interface MainProps {\n record: DataRecord;\n division: Division;\n size?: WidgetSize;\n}\n"],"mappings":"AAGA,SAASA,MAAM,QAAQ,kBAAkB;AACzC,SAASC,QAAQ,QAAQ,sBAAsB","ignoreList":[]}
1
+ {"version":3,"file":"types.js","names":["Division","Locale"],"sources":["../../../src/InstrumentLiveRateWidget/types.tsx"],"sourcesContent":["import type {\n DataRecord,\n WidgetConfig,\n WidgetSize,\n} from '@oanda/labs-widget-common';\n\nimport type { Division } from '../gql/types/graphql';\n\nexport { Division } from '../gql/types/graphql';\nexport { Locale } from '@oanda/mono-i18n';\n\nexport interface InstrumentLiveRateConfig extends WidgetConfig {\n division: Division;\n liveRatesUrl: string;\n instrument: string;\n removePadding?: boolean;\n size?: WidgetSize;\n}\n\nexport interface ValidationWrapperProps {\n instrument: string;\n division: Division;\n size?: WidgetSize;\n isParamError?: boolean;\n}\nexport interface MainProps {\n record: DataRecord;\n division: Division;\n size?: WidgetSize;\n}\n"],"mappings":"AAQA,SAASA,QAAQ,QAAQ,sBAAsB;AAC/C,SAASC,MAAM,QAAQ,kBAAkB","ignoreList":[]}
@@ -1,5 +1,5 @@
1
- import { useState, useEffect } from 'react';
2
1
  import { useLiveRatesMessage } from '@oanda/labs-widget-common';
2
+ import { useEffect, useState } from 'react';
3
3
  const getRecords = data => data?.mapInstrumentNames?.map(item => ({
4
4
  instrument: item?.name || '',
5
5
  displayName: item?.displayName || ''
@@ -1 +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","ask","buyPriceMovement","askPriceMovement","dailyPercentChange","dailyPercentChangeFromOpen","dailyPipsChange","dailyPipsChangeFromOpen","displayPrecision"],"sources":["../../../src/InstrumentLiveRateWidget/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?.ask,\n buyPriceMovement: update?.askPriceMovement,\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":[]}
1
+ {"version":3,"file":"utils.js","names":["useLiveRatesMessage","useEffect","useState","getRecords","data","mapInstrumentNames","map","item","instrument","name","displayName","useRecords","record","target","updatedRecord","setUpdatedRecord","sentiment","error","setError","update","liveRatesError","buy","ask","buyPriceMovement","askPriceMovement","dailyPercentChange","dailyPercentChangeFromOpen","dailyPipsChange","dailyPipsChangeFromOpen","displayPrecision"],"sources":["../../../src/InstrumentLiveRateWidget/utils.ts"],"sourcesContent":["import type {\n DataRecord,\n LiveRatesErrorMessage,\n} from '@oanda/labs-widget-common';\nimport { useLiveRatesMessage } from '@oanda/labs-widget-common';\nimport { useEffect, useState } from 'react';\n\nimport type { ValidateInstrumentsQuery } from '../gql/types/graphql';\n\nconst getRecords = (data: ValidateInstrumentsQuery) =>\n data?.mapInstrumentNames?.map((item) => ({\n instrument: item?.name || '',\n displayName: item?.displayName || '',\n }));\n\nconst useRecords = (record: DataRecord, target: EventTarget | null) => {\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?.ask,\n buyPriceMovement: update?.askPriceMovement,\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 { getRecords, useRecords };\n"],"mappings":"AAIA,SAASA,mBAAmB,QAAQ,2BAA2B;AAC/D,SAASC,SAAS,EAAEC,QAAQ,QAAQ,OAAO;AAI3C,MAAMC,UAAU,GAAIC,IAA8B,IAChDA,IAAI,EAAEC,kBAAkB,EAAEC,GAAG,CAAEC,IAAI,KAAM;EACvCC,UAAU,EAAED,IAAI,EAAEE,IAAI,IAAI,EAAE;EAC5BC,WAAW,EAAEH,IAAI,EAAEG,WAAW,IAAI;AACpC,CAAC,CAAC,CAAC;AAEL,MAAMC,UAAU,GAAGA,CAACC,MAAkB,EAAEC,MAA0B,KAAK;EACrE,MAAM,CAACC,aAAa,EAAEC,gBAAgB,CAAC,GAAGb,QAAQ,CAAa;IAC7DQ,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,GAAGhB,QAAQ,CAA+B,IAAI,CAAC;EAEtE,MAAM;IAAEiB,MAAM;IAAEF,KAAK,EAAEG;EAAe,CAAC,GAAGpB,mBAAmB,CAC3DY,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,SAASd,UAAU,EAAEQ,UAAU","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"fragment-masking.js","names":["useFragment","_documentNode","fragmentType","makeFragmentData","data","_fragment","isFragmentReady","queryNode","fragmentNode","deferredFields","__meta__","fragDef","definitions","fragName","name","value","fields","length","every","field"],"sources":["../../../../src/gql/types/fragment-masking.ts"],"sourcesContent":["import { 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":[]}
1
+ {"version":3,"file":"fragment-masking.js","names":["useFragment","_documentNode","fragmentType","makeFragmentData","data","_fragment","isFragmentReady","queryNode","fragmentNode","deferredFields","__meta__","fragDef","definitions","fragName","name","value","fields","length","every","field"],"sources":["../../../../src/gql/types/fragment-masking.ts"],"sourcesContent":["import {\n ResultOf,\n DocumentTypeDecoration,\n TypedDocumentNode,\n} from '@graphql-typed-document-node/core';\nimport { FragmentDefinitionNode } from 'graphql';\nimport { Incremental } from './graphql';\n\nexport type FragmentType<\n TDocumentType extends DocumentTypeDecoration<any, any>,\n> =\n TDocumentType extends DocumentTypeDecoration<infer TType, any>\n ? [TType] extends [{ ' $fragmentName'?: infer TKey }]\n ? TKey extends string\n ? { ' $fragmentRefs'?: { [key in TKey]: TType } }\n : never\n : never\n : never;\n\n// return non-nullable if `fragmentType` is non-nullable\nexport function useFragment<TType>(\n _documentNode: DocumentTypeDecoration<TType, any>,\n fragmentType: FragmentType<DocumentTypeDecoration<TType, any>>\n): TType;\n// return nullable if `fragmentType` is nullable\nexport function useFragment<TType>(\n _documentNode: DocumentTypeDecoration<TType, any>,\n fragmentType:\n | FragmentType<DocumentTypeDecoration<TType, any>>\n | null\n | undefined\n): TType | null | undefined;\n// return array of non-nullable if `fragmentType` is array of non-nullable\nexport function useFragment<TType>(\n _documentNode: DocumentTypeDecoration<TType, any>,\n fragmentType: ReadonlyArray<FragmentType<DocumentTypeDecoration<TType, any>>>\n): ReadonlyArray<TType>;\n// return array of nullable if `fragmentType` is array of nullable\nexport function useFragment<TType>(\n _documentNode: DocumentTypeDecoration<TType, any>,\n fragmentType:\n | ReadonlyArray<FragmentType<DocumentTypeDecoration<TType, any>>>\n | null\n | undefined\n): ReadonlyArray<TType> | null | undefined;\nexport function useFragment<TType>(\n _documentNode: DocumentTypeDecoration<TType, any>,\n fragmentType:\n | FragmentType<DocumentTypeDecoration<TType, any>>\n | ReadonlyArray<FragmentType<DocumentTypeDecoration<TType, any>>>\n | null\n | undefined\n): TType | ReadonlyArray<TType> | null | undefined {\n return fragmentType as any;\n}\n\nexport function makeFragmentData<\n F extends DocumentTypeDecoration<any, any>,\n FT extends ResultOf<F>,\n>(data: FT, _fragment: F): FragmentType<F> {\n return data as FragmentType<F>;\n}\nexport function isFragmentReady<TQuery, TFrag>(\n queryNode: DocumentTypeDecoration<TQuery, any>,\n fragmentNode: TypedDocumentNode<TFrag>,\n data:\n | FragmentType<TypedDocumentNode<Incremental<TFrag>, any>>\n | null\n | undefined\n): data is FragmentType<typeof fragmentNode> {\n const deferredFields = (\n queryNode as {\n __meta__?: { deferredFields: Record<string, (keyof TFrag)[]> };\n }\n ).__meta__?.deferredFields;\n\n if (!deferredFields) return true;\n\n const fragDef = fragmentNode.definitions[0] as\n | FragmentDefinitionNode\n | undefined;\n const fragName = fragDef?.name?.value;\n\n const fields = (fragName && deferredFields[fragName]) || [];\n return fields.length > 0 && fields.every((field) => data && field in data);\n}\n"],"mappings":"AA6CA,OAAO,SAASA,WAAWA,CACzBC,aAAiD,EACjDC,YAIa,EACoC;EACjD,OAAOA,YAAY;AACrB;AAEA,OAAO,SAASC,gBAAgBA,CAG9BC,IAAQ,EAAEC,SAAY,EAAmB;EACzC,OAAOD,IAAI;AACb;AACA,OAAO,SAASE,eAAeA,CAC7BC,SAA8C,EAC9CC,YAAsC,EACtCJ,IAGa,EAC8B;EAC3C,MAAMK,cAAc,GAClBF,SAAS,CAGTG,QAAQ,EAAED,cAAc;EAE1B,IAAI,CAACA,cAAc,EAAE,OAAO,IAAI;EAEhC,MAAME,OAAO,GAAGH,YAAY,CAACI,WAAW,CAAC,CAAC,CAE7B;EACb,MAAMC,QAAQ,GAAGF,OAAO,EAAEG,IAAI,EAAEC,KAAK;EAErC,MAAMC,MAAM,GAAIH,QAAQ,IAAIJ,cAAc,CAACI,QAAQ,CAAC,IAAK,EAAE;EAC3D,OAAOG,MAAM,CAACC,MAAM,GAAG,CAAC,IAAID,MAAM,CAACE,KAAK,CAAEC,KAAK,IAAKf,IAAI,IAAIe,KAAK,IAAIf,IAAI,CAAC;AAC5E","ignoreList":[]}
@@ -1,7 +1,7 @@
1
1
  import * as types from './graphql';
2
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
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
5
  };
6
6
  export function graphql(source) {
7
7
  return documents[source] ?? {};
@@ -1 +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":[]}
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':\n types.GetInstrumentsChartDocument,\n '\\n query validateInstruments($instruments: [String]!, $division: Division) {\\n mapInstrumentNames(instruments: $instruments, division: $division) {\\n name\\n displayName\\n }\\n }\\n':\n types.ValidateInstrumentsDocument,\n};\n\n/**\n * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.\n *\n *\n * @example\n * ```ts\n * const query = graphql(`query GetUser($id: ID!) { user(id: $id) { name } }`);\n * ```\n *\n * The query argument is unknown!\n * Please regenerate the types.\n */\nexport function graphql(source: string): unknown;\n\n/**\n * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.\n */\nexport function graphql(\n source: '\\n query GetInstrumentsChart($instruments: [String!], $division: Division) {\\n topicalInstrumentsCharts(instruments: $instruments, division: $division) {\\n name\\n chart\\n }\\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(\n source: '\\n query validateInstruments($instruments: [String]!, $division: Division) {\\n mapInstrumentNames(instruments: $instruments, division: $division) {\\n name\\n displayName\\n }\\n }\\n'\n): (typeof documents)['\\n query validateInstruments($instruments: [String]!, $division: Division) {\\n mapInstrumentNames(instruments: $instruments, division: $division) {\\n name\\n displayName\\n }\\n }\\n'];\n\nexport function graphql(source: string) {\n return (documents as any)[source] ?? {};\n}\n\nexport type DocumentType<TDocumentNode extends DocumentNode<any, any>> =\n TDocumentNode extends DocumentNode<infer TType, any> ? TType : never;\n"],"mappings":"AACA,OAAO,KAAKA,KAAK,MAAM,WAAW;AAalC,MAAMC,SAAS,GAAG;EAChB,sMAAsM,EACpMD,KAAK,CAACE,2BAA2B;EACnC,sMAAsM,EACpMF,KAAK,CAACG;AACV,CAAC;AA6BD,OAAO,SAASC,OAAOA,CAACC,MAAc,EAAE;EACtC,OAAQJ,SAAS,CAASI,MAAM,CAAC,IAAI,CAAC,CAAC;AACzC","ignoreList":[]}