@oanda/labs-currency-power-balance-widget 1.0.114 → 1.0.116

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 (34) hide show
  1. package/CHANGELOG.md +932 -0
  2. package/dist/main/CurrencyPowerBalanceWidget/ChartWithData.js +3 -4
  3. package/dist/main/CurrencyPowerBalanceWidget/ChartWithData.js.map +1 -1
  4. package/dist/main/CurrencyPowerBalanceWidget/Main.js +2 -2
  5. package/dist/main/CurrencyPowerBalanceWidget/Main.js.map +1 -1
  6. package/dist/main/CurrencyPowerBalanceWidget/components/Chart/Chart.js +1 -1
  7. package/dist/main/CurrencyPowerBalanceWidget/components/Chart/Chart.js.map +1 -1
  8. package/dist/main/CurrencyPowerBalanceWidget/components/Chart/options/formatters.js +15 -6
  9. package/dist/main/CurrencyPowerBalanceWidget/components/Chart/options/formatters.js.map +1 -1
  10. package/dist/main/CurrencyPowerBalanceWidget/components/Chart/options/getResponsiveOption.js +2 -2
  11. package/dist/main/CurrencyPowerBalanceWidget/components/Chart/options/getResponsiveOption.js.map +1 -1
  12. package/dist/main/gql/getCurrencyPowerBalance.js +12 -3
  13. package/dist/main/gql/getCurrencyPowerBalance.js.map +1 -1
  14. package/dist/main/gql/types/fragment-masking.js +2 -3
  15. package/dist/main/gql/types/fragment-masking.js.map +1 -1
  16. package/dist/main/gql/types/gql.js +1 -2
  17. package/dist/main/gql/types/gql.js.map +1 -1
  18. package/dist/module/CurrencyPowerBalanceWidget/ChartWithData.js +3 -4
  19. package/dist/module/CurrencyPowerBalanceWidget/ChartWithData.js.map +1 -1
  20. package/dist/module/CurrencyPowerBalanceWidget/Main.js +2 -2
  21. package/dist/module/CurrencyPowerBalanceWidget/Main.js.map +1 -1
  22. package/dist/module/CurrencyPowerBalanceWidget/components/Chart/Chart.js +1 -1
  23. package/dist/module/CurrencyPowerBalanceWidget/components/Chart/Chart.js.map +1 -1
  24. package/dist/module/CurrencyPowerBalanceWidget/components/Chart/options/formatters.js +15 -6
  25. package/dist/module/CurrencyPowerBalanceWidget/components/Chart/options/formatters.js.map +1 -1
  26. package/dist/module/CurrencyPowerBalanceWidget/components/Chart/options/getResponsiveOption.js +2 -2
  27. package/dist/module/CurrencyPowerBalanceWidget/components/Chart/options/getResponsiveOption.js.map +1 -1
  28. package/dist/module/gql/getCurrencyPowerBalance.js +12 -3
  29. package/dist/module/gql/getCurrencyPowerBalance.js.map +1 -1
  30. package/dist/module/gql/types/fragment-masking.js +2 -3
  31. package/dist/module/gql/types/fragment-masking.js.map +1 -1
  32. package/dist/module/gql/types/gql.js +1 -2
  33. package/dist/module/gql/types/gql.js.map +1 -1
  34. package/package.json +3 -3
@@ -13,7 +13,6 @@ var _Chart = require("./components/Chart");
13
13
  var _constants = require("./constants");
14
14
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
15
15
  const ChartWithData = _ref => {
16
- var _data$currencyPowerBa, _;
17
16
  let {
18
17
  timeUnit,
19
18
  currencies
@@ -35,7 +34,7 @@ const ChartWithData = _ref => {
35
34
  },
36
35
  fetchPolicy: 'cache-and-network'
37
36
  });
38
- const showError = (data === null || data === void 0 || (_data$currencyPowerBa = data.currencyPowerBalance) === null || _data$currencyPowerBa === void 0 ? void 0 : _data$currencyPowerBa.length) === 0 || error || currencies && (currencies.length === 0 || currencies.length === 1);
37
+ const showError = data?.currencyPowerBalance?.length === 0 || error || currencies && (currencies.length === 0 || currencies.length === 1);
39
38
  return _react.default.createElement(_react.default.Fragment, null, loading && _react.default.createElement("div", {
40
39
  className: "lw-mb-[50px] lw-flex lw-h-[375px] lw-w-full lw-items-center lw-border lw-border-solid lw-border-border-primary"
41
40
  }, _react.default.createElement(_labsWidgetCommon.Spinner, {
@@ -43,7 +42,7 @@ const ChartWithData = _ref => {
43
42
  })), !loading && !showError && _react.default.createElement(_Chart.Chart, {
44
43
  currencies: currencies,
45
44
  timeUnit: timeUnit,
46
- values: data === null || data === void 0 ? void 0 : data.currencyPowerBalance
45
+ values: data?.currencyPowerBalance
47
46
  }), !loading && showError && _react.default.createElement("div", {
48
47
  className: "lw-flex lw-h-[375px] lw-w-full lw-items-center lw-border lw-border-solid lw-border-border-primary"
49
48
  }, _react.default.createElement(_labsWidgetCommon.ChartError, null)), isDesktop && _react.default.createElement(_labsWidgetCommon.Tooltip, {
@@ -52,7 +51,7 @@ const ChartWithData = _ref => {
52
51
  className: "lw-mt-2 lw-h-8"
53
52
  }, !loading && !showError && _react.default.createElement(_labsWidgetCommon.LastUpdated, {
54
53
  labelCallback: lang,
55
- timestamp: data === null || data === void 0 || (_ = data.currencyPowerBalance[0]) === null || _ === void 0 ? void 0 : _.updatedAt
54
+ timestamp: data?.currencyPowerBalance[0]?.updatedAt
56
55
  })));
57
56
  };
58
57
  exports.ChartWithData = ChartWithData;
@@ -1 +1 @@
1
- {"version":3,"file":"ChartWithData.js","names":["_client","require","_labsWidgetCommon","_monoI18n","_react","_interopRequireDefault","_getCurrencyPowerBalance","_Chart","_constants","e","__esModule","default","ChartWithData","_ref","_data$currencyPowerBa","_","timeUnit","currencies","size","useLayoutProvider","isDesktop","Size","DESKTOP","lang","useLocale","loading","data","error","useQuery","getCurrencyPowerBalance","variables","fetchPolicy","showError","currencyPowerBalance","length","createElement","Fragment","className","Spinner","SpinnerSize","lg","Chart","values","ChartError","Tooltip","id","CURRENCY_POWER_BALANCE_TOOLTIP_ID","LastUpdated","labelCallback","timestamp","updatedAt","exports"],"sources":["../../../src/CurrencyPowerBalanceWidget/ChartWithData.tsx"],"sourcesContent":["import { useQuery } from '@apollo/client';\nimport {\n ChartError,\n LastUpdated,\n Size,\n Spinner,\n SpinnerSize,\n Tooltip,\n useLayoutProvider,\n} from '@oanda/labs-widget-common';\nimport { useLocale } from '@oanda/mono-i18n';\nimport React from 'react';\n\nimport { getCurrencyPowerBalance } from '../gql/getCurrencyPowerBalance';\nimport type {\n GetCurrencyPowerBalanceQuery,\n GetCurrencyPowerBalanceQueryVariables,\n} from '../gql/types/graphql';\nimport { Chart } from './components/Chart';\nimport { CURRENCY_POWER_BALANCE_TOOLTIP_ID } from './constants';\nimport type { ChartWithDataProps } from './types';\n\nconst ChartWithData = ({ timeUnit, currencies }: ChartWithDataProps) => {\n const { size } = useLayoutProvider();\n const isDesktop = size === Size.DESKTOP;\n const { lang } = useLocale();\n const { loading, data, error } = useQuery<\n GetCurrencyPowerBalanceQuery,\n GetCurrencyPowerBalanceQueryVariables\n >(getCurrencyPowerBalance, {\n variables: {\n timeUnit,\n },\n fetchPolicy: 'cache-and-network',\n });\n\n const showError =\n data?.currencyPowerBalance?.length === 0 ||\n error ||\n (currencies && (currencies.length === 0 || currencies.length === 1));\n\n return (\n <>\n {loading && (\n <div className=\"lw-mb-[50px] lw-flex lw-h-[375px] lw-w-full lw-items-center lw-border lw-border-solid lw-border-border-primary\">\n <Spinner size={SpinnerSize.lg} />\n </div>\n )}\n {!loading && !showError && (\n <Chart\n currencies={currencies}\n timeUnit={timeUnit}\n values={data?.currencyPowerBalance!}\n />\n )}\n {!loading && showError && (\n <div className=\"lw-flex lw-h-[375px] lw-w-full lw-items-center lw-border lw-border-solid lw-border-border-primary\">\n <ChartError />\n </div>\n )}\n {isDesktop && <Tooltip id={CURRENCY_POWER_BALANCE_TOOLTIP_ID} />}\n <div className=\"lw-mt-2 lw-h-8\">\n {!loading && !showError && (\n <LastUpdated\n labelCallback={lang}\n timestamp={data?.currencyPowerBalance![0]?.updatedAt}\n />\n )}\n </div>\n </>\n );\n};\n\nexport { ChartWithData };\n"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,iBAAA,GAAAD,OAAA;AASA,IAAAE,SAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAC,sBAAA,CAAAJ,OAAA;AAEA,IAAAK,wBAAA,GAAAL,OAAA;AAKA,IAAAM,MAAA,GAAAN,OAAA;AACA,IAAAO,UAAA,GAAAP,OAAA;AAAgE,SAAAI,uBAAAI,CAAA,WAAAA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AAAkC,KAAK;IACJxB,UAAU,EAAEA,UAAW;IACvBD,QAAQ,EAAEA,QAAS;IACnB0B,MAAM,EAAEhB,IAAI,aAAJA,IAAI,uBAAJA,IAAI,CAAEO;EAAsB,CACrC,CACF,EACA,CAACR,OAAO,IAAIO,SAAS,IACpB5B,MAAA,CAAAO,OAAA,CAAAwB,aAAA;IAAKE,SAAS,EAAC;EAAmG,GAChHjC,MAAA,CAAAO,OAAA,CAAAwB,aAAA,CAACjC,iBAAA,CAAAyC,UAAU,MAAE,CACV,CACN,EACAvB,SAAS,IAAIhB,MAAA,CAAAO,OAAA,CAAAwB,aAAA,CAACjC,iBAAA,CAAA0C,OAAO;IAACC,EAAE,EAAEC;EAAkC,CAAE,CAAC,EAChE1C,MAAA,CAAAO,OAAA,CAAAwB,aAAA;IAAKE,SAAS,EAAC;EAAgB,GAC5B,CAACZ,OAAO,IAAI,CAACO,SAAS,IACrB5B,MAAA,CAAAO,OAAA,CAAAwB,aAAA,CAACjC,iBAAA,CAAA6C,WAAW;IACVC,aAAa,EAAEzB,IAAK;IACpB0B,SAAS,EAAEvB,IAAI,aAAJA,IAAI,gBAAAX,CAAA,GAAJW,IAAI,CAAEO,oBAAoB,CAAE,CAAC,CAAC,cAAAlB,CAAA,uBAA9BA,CAAA,CAAgCmC;EAAU,CACtD,CAEA,CACL,CAAC;AAEP,CAAC;AAACC,OAAA,CAAAvC,aAAA,GAAAA,aAAA","ignoreList":[]}
1
+ {"version":3,"file":"ChartWithData.js","names":["_client","require","_labsWidgetCommon","_monoI18n","_react","_interopRequireDefault","_getCurrencyPowerBalance","_Chart","_constants","e","__esModule","default","ChartWithData","_ref","timeUnit","currencies","size","useLayoutProvider","isDesktop","Size","DESKTOP","lang","useLocale","loading","data","error","useQuery","getCurrencyPowerBalance","variables","fetchPolicy","showError","currencyPowerBalance","length","createElement","Fragment","className","Spinner","SpinnerSize","lg","Chart","values","ChartError","Tooltip","id","CURRENCY_POWER_BALANCE_TOOLTIP_ID","LastUpdated","labelCallback","timestamp","updatedAt","exports"],"sources":["../../../src/CurrencyPowerBalanceWidget/ChartWithData.tsx"],"sourcesContent":["import { useQuery } from '@apollo/client';\nimport {\n ChartError,\n LastUpdated,\n Size,\n Spinner,\n SpinnerSize,\n Tooltip,\n useLayoutProvider,\n} from '@oanda/labs-widget-common';\nimport { useLocale } from '@oanda/mono-i18n';\nimport React from 'react';\n\nimport { getCurrencyPowerBalance } from '../gql/getCurrencyPowerBalance';\nimport type {\n GetCurrencyPowerBalanceQuery,\n GetCurrencyPowerBalanceQueryVariables,\n} from '../gql/types/graphql';\nimport { Chart } from './components/Chart';\nimport { CURRENCY_POWER_BALANCE_TOOLTIP_ID } from './constants';\nimport type { ChartWithDataProps } from './types';\n\nconst ChartWithData = ({ timeUnit, currencies }: ChartWithDataProps) => {\n const { size } = useLayoutProvider();\n const isDesktop = size === Size.DESKTOP;\n const { lang } = useLocale();\n const { loading, data, error } = useQuery<\n GetCurrencyPowerBalanceQuery,\n GetCurrencyPowerBalanceQueryVariables\n >(getCurrencyPowerBalance, {\n variables: {\n timeUnit,\n },\n fetchPolicy: 'cache-and-network',\n });\n\n const showError =\n data?.currencyPowerBalance?.length === 0 ||\n error ||\n (currencies && (currencies.length === 0 || currencies.length === 1));\n\n return (\n <>\n {loading && (\n <div className=\"lw-mb-[50px] lw-flex lw-h-[375px] lw-w-full lw-items-center lw-border lw-border-solid lw-border-border-primary\">\n <Spinner size={SpinnerSize.lg} />\n </div>\n )}\n {!loading && !showError && (\n <Chart\n currencies={currencies}\n timeUnit={timeUnit}\n values={data?.currencyPowerBalance!}\n />\n )}\n {!loading && showError && (\n <div className=\"lw-flex lw-h-[375px] lw-w-full lw-items-center lw-border lw-border-solid lw-border-border-primary\">\n <ChartError />\n </div>\n )}\n {isDesktop && <Tooltip id={CURRENCY_POWER_BALANCE_TOOLTIP_ID} />}\n <div className=\"lw-mt-2 lw-h-8\">\n {!loading && !showError && (\n <LastUpdated\n labelCallback={lang}\n timestamp={data?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SAAS,EAAC;EAAgH,GAC7H/B,MAAA,CAAAO,OAAA,CAAAsB,aAAA,CAAC/B,iBAAA,CAAAkC,OAAO;IAACpB,IAAI,EAAEqB,6BAAW,CAACC;EAAG,CAAE,CAC7B,CACN,EACA,CAACf,OAAO,IAAI,CAACO,SAAS,IACrB1B,MAAA,CAAAO,OAAA,CAAAsB,aAAA,CAAC1B,MAAA,CAAAgC,KAAK;IACJxB,UAAU,EAAEA,UAAW;IACvBD,QAAQ,EAAEA,QAAS;IACnB0B,MAAM,EAAEhB,IAAI,EAAEO;EAAsB,CACrC,CACF,EACA,CAACR,OAAO,IAAIO,SAAS,IACpB1B,MAAA,CAAAO,OAAA,CAAAsB,aAAA;IAAKE,SAAS,EAAC;EAAmG,GAChH/B,MAAA,CAAAO,OAAA,CAAAsB,aAAA,CAAC/B,iBAAA,CAAAuC,UAAU,MAAE,CACV,CACN,EACAvB,SAAS,IAAId,MAAA,CAAAO,OAAA,CAAAsB,aAAA,CAAC/B,iBAAA,CAAAwC,OAAO;IAACC,EAAE,EAAEC;EAAkC,CAAE,CAAC,EAChExC,MAAA,CAAAO,OAAA,CAAAsB,aAAA;IAAKE,SAAS,EAAC;EAAgB,GAC5B,CAACZ,OAAO,IAAI,CAACO,SAAS,IACrB1B,MAAA,CAAAO,OAAA,CAAAsB,aAAA,CAAC/B,iBAAA,CAAA2C,WAAW;IACVC,aAAa,EAAEzB,IAAK;IACpB0B,SAAS,EAAEvB,IAAI,EAAEO,oBAAoB,CAAE,CAAC,CAAC,EAAEiB;EAAU,CACtD,CAEA,CACL,CAAC;AAEP,CAAC;AAACC,OAAA,CAAArC,aAAA,GAAAA,aAAA","ignoreList":[]}
@@ -42,9 +42,9 @@ const Main = _ref => {
42
42
  key: label,
43
43
  className: "lw-mb-6 lw-flex lw-justify-center lw-font-sans lw-text-lg lw-font-bold",
44
44
  "data-testid": "time-unit-label"
45
- }, tooltipLabel ? _react.default.createElement("span", null, "".concat(lang(tooltipLabel.translationKey, {
45
+ }, tooltipLabel ? _react.default.createElement("span", null, `${lang(tooltipLabel.translationKey, {
46
46
  count: tooltipLabel.count
47
- }))) : _react.default.createElement("span", null, "".concat(lang(label))));
47
+ })}`) : _react.default.createElement("span", null, `${lang(label)}`));
48
48
  })) : _react.default.createElement(_TimeUnitSwitch.TimeUnitSwitch, {
49
49
  callback: setSelectedTimeUnit,
50
50
  options: _config.timeUnitConfig,
@@ -1 +1 @@
1
- {"version":3,"file":"Main.js","names":["_labsWidgetCommon","require","_monoI18n","_react","_interopRequireWildcard","_graphql","_ChartWithData","_TimeUnitSwitch","_config","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","Main","_ref","timeUnit","currencies","size","useLayoutProvider","lang","useLocale","selectedTimeUnit","setSelectedTimeUnit","useState","CurrencyPowerBalanceTimeUnit","CurrentDay","createElement","Fragment","className","timeUnitConfig","filter","_ref2","value","map","_ref3","tooltipLabel","label","key","concat","translationKey","count","TimeUnitSwitch","callback","options","selected","ChartWithData","exports"],"sources":["../../../src/CurrencyPowerBalanceWidget/Main.tsx"],"sourcesContent":["import { useLayoutProvider } from '@oanda/labs-widget-common';\nimport { useLocale } from '@oanda/mono-i18n';\nimport React, { useState } from 'react';\n\nimport { CurrencyPowerBalanceTimeUnit } from '../gql/types/graphql';\nimport { ChartWithData } from './ChartWithData';\nimport { TimeUnitSwitch } from './components/TimeUnitSwitch';\nimport { timeUnitConfig } from './config';\nimport type { MainProps } from './types';\n\nconst Main = ({ timeUnit, currencies }: MainProps) => {\n const { size } = useLayoutProvider();\n const { lang } = useLocale();\n const [selectedTimeUnit, setSelectedTimeUnit] = useState(\n timeUnit || CurrencyPowerBalanceTimeUnit.CurrentDay\n );\n return (\n <>\n {size && (\n <div\n className=\"lw-flex lw-flex-col lw-text-sm lw-tracking-normal\"\n data-testid=\"currency-power-balance-wrapper\"\n >\n {timeUnit && currencies ? (\n <>\n {timeUnitConfig\n .filter(({ value }) => value === selectedTimeUnit)\n .map(({ tooltipLabel, label }) => (\n <div\n key={label}\n className=\"lw-mb-6 lw-flex lw-justify-center lw-font-sans lw-text-lg lw-font-bold\"\n data-testid=\"time-unit-label\"\n >\n {tooltipLabel ? (\n <span>{`${lang(tooltipLabel!.translationKey, { count: tooltipLabel!.count })}`}</span>\n ) : (\n <span>{`${lang(label)}`}</span>\n )}\n </div>\n ))}\n </>\n ) : (\n <TimeUnitSwitch\n callback={setSelectedTimeUnit}\n options={timeUnitConfig}\n selected={selectedTimeUnit}\n />\n )}\n <ChartWithData\n currencies={timeUnit && currencies}\n timeUnit={selectedTimeUnit}\n />\n </div>\n )}\n </>\n );\n};\n\nexport { Main };\n"],"mappings":";;;;;;AAAA,IAAAA,iBAAA,GAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAC,uBAAA,CAAAH,OAAA;AAEA,IAAAI,QAAA,GAAAJ,OAAA;AACA,IAAAK,cAAA,GAAAL,OAAA;AACA,IAAAM,eAAA,GAAAN,OAAA;AACA,IAAAO,OAAA,GAAAP,OAAA;AAA0C,SAAAQ,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAN,wBAAAM,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAI,UAAA,SAAAJ,CAAA,eAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,WAAAK,OAAA,EAAAL,CAAA,QAAAG,CAAA,GAAAJ,wBAAA,CAAAG,CAAA,OAAAC,CAAA,IAAAA,CAAA,CAAAG,GAAA,CAAAN,CAAA,UAAAG,CAAA,CAAAI,GAAA,CAAAP,CAAA,OAAAQ,CAAA,KAAAC,S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M,CAACC,KAAA;IAAA,IAAC;MAAEC;IAAM,CAAC,GAAAD,KAAA;IAAA,OAAKC,KAAK,KAAKX,gBAAgB;EAAA,EAAC,CACjDY,GAAG,CAACC,KAAA;IAAA,IAAC;MAAEC,YAAY;MAAEC;IAAM,CAAC,GAAAF,KAAA;IAAA,OAC3B/C,MAAA,CAAAY,OAAA,CAAA2B,aAAA;MACEW,GAAG,EAAED,KAAM;MACXR,SAAS,EAAC,wEAAwE;MAClF,eAAY;IAAiB,GAE5BO,YAAY,GACXhD,MAAA,CAAAY,OAAA,CAAA2B,aAAA,kBAAAY,MAAA,CAAUnB,IAAI,CAACgB,YAAY,CAAEI,cAAc,EAAE;MAAEC,KAAK,EAAEL,YAAY,CAAEK;IAAM,CAAC,CAAC,CAAS,CAAC,GAEtFrD,MAAA,CAAAY,OAAA,CAAA2B,aAAA,kBAAAY,MAAA,CAAUnB,IAAI,CAACiB,KAAK,CAAC,CAAS,CAE7B,CAAC;EAAA,CACP,CACH,CAAC,GAEHjD,MAAA,CAAAY,OAAA,CAAA2B,aAAA,CAACnC,eAAA,CAAAkD,cAAc;IACbC,QAAQ,EAAEpB,mBAAoB;IAC9BqB,OAAO,EAAEd,sBAAe;IACxBe,QAAQ,EAAEvB;EAAiB,CAC5B,CACF,EACDlC,MAAA,CAAAY,OAAA,CAAA2B,aAAA,CAACpC,cAAA,CAAAuD,aAAa;IACZ7B,UAAU,EAAED,QAAQ,IAAIC,UAAW;IACnCD,QAAQ,EAAEM;EAAiB,CAC5B,CACE,CAEP,CAAC;AAEP,CAAC;AAACyB,OAAA,CAAAjC,IAAA,GAAAA,IAAA","ignoreList":[]}
1
+ {"version":3,"file":"Main.js","names":["_labsWidgetCommon","require","_monoI18n","_react","_interopRequireWildcard","_graphql","_ChartWithData","_TimeUnitSwitch","_config","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","Main","_ref","timeUnit","currencies","size","useLayoutProvider","lang","useLocale","selectedTimeUnit","setSelectedTimeUnit","useState","CurrencyPowerBalanceTimeUnit","CurrentDay","createElement","Fragment","className","timeUnitConfig","filter","_ref2","value","map","_ref3","tooltipLabel","label","key","translationKey","count","TimeUnitSwitch","callback","options","selected","ChartWithData","exports"],"sources":["../../../src/CurrencyPowerBalanceWidget/Main.tsx"],"sourcesContent":["import { useLayoutProvider } from '@oanda/labs-widget-common';\nimport { useLocale } from '@oanda/mono-i18n';\nimport React, { useState } from 'react';\n\nimport { CurrencyPowerBalanceTimeUnit } from '../gql/types/graphql';\nimport { ChartWithData } from './ChartWithData';\nimport { TimeUnitSwitch } from './components/TimeUnitSwitch';\nimport { timeUnitConfig } from './config';\nimport type { MainProps } from './types';\n\nconst Main = ({ timeUnit, currencies }: MainProps) => {\n const { size } = useLayoutProvider();\n const { lang } = useLocale();\n const [selectedTimeUnit, setSelectedTimeUnit] = useState(\n timeUnit || CurrencyPowerBalanceTimeUnit.CurrentDay\n );\n return (\n <>\n {size && (\n <div\n className=\"lw-flex lw-flex-col lw-text-sm lw-tracking-normal\"\n data-testid=\"currency-power-balance-wrapper\"\n >\n {timeUnit && currencies ? (\n <>\n {timeUnitConfig\n .filter(({ value }) => value === selectedTimeUnit)\n .map(({ tooltipLabel, label }) => (\n <div\n key={label}\n className=\"lw-mb-6 lw-flex lw-justify-center lw-font-sans lw-text-lg lw-font-bold\"\n data-testid=\"time-unit-label\"\n >\n {tooltipLabel ? (\n <span>{`${lang(tooltipLabel!.translationKey, { count: tooltipLabel!.count })}`}</span>\n ) : (\n <span>{`${lang(label)}`}</span>\n )}\n </div>\n ))}\n </>\n ) : (\n <TimeUnitSwitch\n callback={setSelectedTimeUnit}\n options={timeUnitConfig}\n selected={selectedTimeUnit}\n />\n )}\n <ChartWithData\n currencies={timeUnit && currencies}\n timeUnit={selectedTimeUnit}\n />\n </div>\n )}\n </>\n );\n};\n\nexport { Main };\n"],"mappings":";;;;;;AAAA,IAA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EtFpD,MAAA,CAAAY,OAAA,CAAA2B,aAAA,eAAO,GAAGP,IAAI,CAACiB,KAAK,CAAC,EAAS,CAE7B,CAAC;EAAA,CACP,CACH,CAAC,GAEHjD,MAAA,CAAAY,OAAA,CAAA2B,aAAA,CAACnC,eAAA,CAAAiD,cAAc;IACbC,QAAQ,EAAEnB,mBAAoB;IAC9BoB,OAAO,EAAEb,sBAAe;IACxBc,QAAQ,EAAEtB;EAAiB,CAC5B,CACF,EACDlC,MAAA,CAAAY,OAAA,CAAA2B,aAAA,CAACpC,cAAA,CAAAsD,aAAa;IACZ5B,UAAU,EAAED,QAAQ,IAAIC,UAAW;IACnCD,QAAQ,EAAEM;EAAiB,CAC5B,CACE,CAEP,CAAC;AAEP,CAAC;AAACwB,OAAA,CAAAhC,IAAA,GAAAA,IAAA","ignoreList":[]}
@@ -53,7 +53,7 @@ const Chart = _ref => {
53
53
  echarts: echarts,
54
54
  option: (0, _options.getOption)(chartData, timeUnit, isDark, lang),
55
55
  style: {
56
- height: "".concat(_constants.CHART_HEIGHT, "px"),
56
+ height: `${_constants.CHART_HEIGHT}px`,
57
57
  width: '100%'
58
58
  },
59
59
  theme: isDark ? 'dark_theme' : 'light_theme'
@@ -1 +1 @@
1
- {"version":3,"file":"Chart.js","names":["_labsWidgetCommon","require","_monoI18n","_charts","_components","echarts","_interopRequireWildcard","_renderers","_core2","_interopRequireDefault","_react","_options","_constants","e","__esModule","default","_getRequireWildcardCache","WeakMap","r","t","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","use","GridSimpleComponent","GraphicComponent","TooltipComponent","LegendPlainComponent","LineChart","CanvasRenderer","MarkLineComponent","registerTheme","getChartTheme","Theme","Dark","Light","Chart","_ref","values","timeUnit","currencies","lang","useLocale","isDark","size","useLayoutProvider","isDesktop","Size","DESKTOP","isMobile","MOBILE","echartRef","useRef","chartData","filter","_ref2","currency","includes","useEffect","current","echartInstance","getEchartsInstance","setOption","getResponsiveOption","createElement","ref","option","getOption","style","height","concat","CHART_HEIGHT","width","theme","exports"],"sources":["../../../../../src/CurrencyPowerBalanceWidget/components/Chart/Chart.tsx"],"sourcesContent":["import {\n getChartTheme,\n Size,\n Theme,\n useLayoutProvider,\n} from '@oanda/labs-widget-common';\nimport { useLocale } from '@oanda/mono-i18n';\nimport { LineChart } from 'echarts/charts';\nimport {\n GraphicComponent,\n GridSimpleComponent,\n LegendPlainComponent,\n MarkLineComponent,\n TooltipComponent,\n} from 'echarts/components';\nimport * as echarts from 'echarts/core';\nimport { CanvasRenderer } from 'echarts/renderers';\nimport ReactEChartsCore from 'echarts-for-react/lib/core';\nimport React, { useEffect, useRef } from 'react';\n\nimport { getOption, getResponsiveOption } from './options';\nimport { CHART_HEIGHT } from './options/constants';\nimport type { ChartProps } from './types';\n\necharts.use([\n GridSimpleComponent,\n GraphicComponent,\n TooltipComponent,\n LegendPlainComponent,\n LineChart,\n CanvasRenderer,\n MarkLineComponent,\n]);\n\necharts.registerTheme('dark_theme', getChartTheme(Theme.Dark));\necharts.registerTheme('light_theme', getChartTheme(Theme.Light));\n\nconst Chart = ({ values, timeUnit, currencies }: ChartProps) => {\n const { lang } = useLocale();\n const { isDark, size } = useLayoutProvider();\n const isDesktop = size === Size.DESKTOP;\n const isMobile = size === Size.MOBILE;\n\n const echartRef = useRef<ReactEChartsCore | null>(null);\n\n const chartData = currencies\n ? values.filter(({ currency }) => currencies.includes(currency))\n : values;\n\n useEffect(() => {\n if (echartRef.current) {\n const echartInstance = echartRef.current.getEchartsInstance();\n\n echartInstance.setOption(\n getResponsiveOption(isDesktop, isMobile, isDark)\n );\n }\n }, [echartRef, isDesktop, isMobile, isDark]);\n\n return (\n <ReactEChartsCore\n ref={echartRef}\n echarts={echarts}\n option={getOption(chartData, timeUnit, isDark, lang)}\n style={{\n height: `${CHART_HEIGHT}px`,\n width: '100%',\n }}\n theme={isDark ? 'dark_theme' : 'light_theme'}\n />\n );\n};\n\nexport { Chart };\n"],"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AKf,UAAU,CAACiB,QAAQ,CAACD,QAAQ,CAAC;EAAA,EAAC,GAC9DlB,MAAM;EAEV,IAAAoB,gBAAS,EAAC,MAAM;IACd,IAAIP,SAAS,CAACQ,OAAO,EAAE;MACrB,MAAMC,cAAc,GAAGT,SAAS,CAACQ,OAAO,CAACE,kBAAkB,CAAC,CAAC;MAE7DD,cAAc,CAACE,SAAS,CACtB,IAAAC,4BAAmB,EAACjB,SAAS,EAAEG,QAAQ,EAAEN,MAAM,CACjD,CAAC;IACH;EACF,CAAC,EAAE,CAACQ,SAAS,EAAEL,SAAS,EAAEG,QAAQ,EAAEN,MAAM,CAAC,CAAC;EAE5C,OACE3C,MAAA,CAAAK,OAAA,CAAA2D,aAAA,CAAClE,MAAA,CAAAO,OAAgB;IACf4D,GAAG,EAAEd,SAAU;IACfxD,OAAO,EAAEA,OAAQ;IACjBuE,MAAM,EAAE,IAAAC,kBAAS,EAACd,SAAS,EAAEd,QAAQ,EAAEI,MAAM,EAAEF,IAAI,CAAE;IACrD2B,KAAK,EAAE;MACLC,MAAM,KAAAC,MAAA,CAAKC,uBAAY,OAAI;MAC3BC,KAAK,EAAE;IACT,CAAE;IACFC,KAAK,EAAE9B,MAAM,GAAG,YAAY,GAAG;EAAc,CAC9C,CAAC;AAEN,CAAC;AAAC+B,OAAA,CAAAtC,KAAA,GAAAA,KAAA","ignoreList":[]}
1
+ {"version":3,"file":"Chart.js","names":["_labsWidgetCommon","require","_monoI18n","_charts","_components","echarts","_interopRequireWildcard","_renderers","_core2","_interopRequireDefault","_react","_options","_constants","e","__esModule","default","_getRequireWildcardCache","WeakMap","r","t","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","use","GridSimpleComponent","GraphicComponent","TooltipComponent","LegendPlainComponent","LineChart","CanvasRenderer","MarkLineComponent","registerTheme","getChartTheme","Theme","Dark","Light","Chart","_ref","values","timeUnit","currencies","lang","useLocale","isDark","size","useLayoutProvider","isDesktop","Size","DESKTOP","isMobile","MOBILE","echartRef","useRef","chartData","filter","_ref2","currency","includes","useEffect","current","echartInstance","getEchartsInstance","setOption","getResponsiveOption","createElement","ref","option","getOption","style","height","CHART_HEIGHT","width","theme","exports"],"sources":["../../../../../src/CurrencyPowerBalanceWidget/components/Chart/Chart.tsx"],"sourcesContent":["import {\n getChartTheme,\n Size,\n Theme,\n useLayoutProvider,\n} from '@oanda/labs-widget-common';\nimport { useLocale } from '@oanda/mono-i18n';\nimport { LineChart } from 'echarts/charts';\nimport {\n GraphicComponent,\n GridSimpleComponent,\n LegendPlainComponent,\n MarkLineComponent,\n TooltipComponent,\n} from 'echarts/components';\nimport * as echarts from 'echarts/core';\nimport { CanvasRenderer } from 'echarts/renderers';\nimport ReactEChartsCore from 'echarts-for-react/lib/core';\nimport React, { useEffect, useRef } from 'react';\n\nimport { getOption, getResponsiveOption } from './options';\nimport { CHART_HEIGHT } from './options/constants';\nimport type { ChartProps } from './types';\n\necharts.use([\n GridSimpleComponent,\n GraphicComponent,\n TooltipComponent,\n LegendPlainComponent,\n LineChart,\n CanvasRenderer,\n MarkLineComponent,\n]);\n\necharts.registerTheme('dark_theme', getChartTheme(Theme.Dark));\necharts.registerTheme('light_theme', getChartTheme(Theme.Light));\n\nconst Chart = ({ values, timeUnit, currencies }: ChartProps) => {\n const { lang } = useLocale();\n const { isDark, size } = useLayoutProvider();\n const isDesktop = size === Size.DESKTOP;\n const isMobile = size === Size.MOBILE;\n\n const echartRef = useRef<ReactEChartsCore | null>(null);\n\n const chartData = currencies\n ? values.filter(({ currency }) => currencies.includes(currency))\n : values;\n\n useEffect(() => {\n if (echartRef.current) {\n const echartInstance = echartRef.current.getEchartsInstance();\n\n echartInstance.setOption(\n getResponsiveOption(isDesktop, isMobile, isDark)\n );\n }\n }, [echartRef, isDesktop, isMobile, isDark]);\n\n return (\n <ReactEChartsCore\n ref={echartRef}\n echarts={echarts}\n option={getOption(chartData, timeUnit, isDark, lang)}\n style={{\n height: `${CHART_H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BF,MAAM,CAACgB,MAAM,CAACC,KAAA;IAAA,IAAC;MAAEC;IAAS,CAAC,GAAAD,KAAA;IAAA,OAAKf,UAAU,CAACiB,QAAQ,CAACD,QAAQ,CAAC;EAAA,EAAC,GAC9DlB,MAAM;EAEV,IAAAoB,gBAAS,EAAC,MAAM;IACd,IAAIP,SAAS,CAACQ,OAAO,EAAE;MACrB,MAAMC,cAAc,GAAGT,SAAS,CAACQ,OAAO,CAACE,kBAAkB,CAAC,CAAC;MAE7DD,cAAc,CAACE,SAAS,CACtB,IAAAC,4BAAmB,EAACjB,SAAS,EAAEG,QAAQ,EAAEN,MAAM,CACjD,CAAC;IACH;EACF,CAAC,EAAE,CAACQ,SAAS,EAAEL,SAAS,EAAEG,QAAQ,EAAEN,MAAM,CAAC,CAAC;EAE5C,OACE3C,MAAA,CAAAK,OAAA,CAAA2D,aAAA,CAAClE,MAAA,CAAAO,OAAgB;IACf4D,GAAG,EAAEd,SAAU;IACfxD,OAAO,EAAEA,OAAQ;IACjBuE,MAAM,EAAE,IAAAC,kBAAS,EAACd,SAAS,EAAEd,QAAQ,EAAEI,MAAM,EAAEF,IAAI,CAAE;IACrD2B,KAAK,EAAE;MACLC,MAAM,EAAE,GAAGC,uBAAY,IAAI;MAC3BC,KAAK,EAAE;IACT,CAAE;IACFC,KAAK,EAAE7B,MAAM,GAAG,YAAY,GAAG;EAAc,CAC9C,CAAC;AAEN,CAAC;AAAC8B,OAAA,CAAArC,KAAA,GAAAA,KAAA","ignoreList":[]}
@@ -13,20 +13,20 @@ const getDateAndTime = param => {
13
13
  time: dateAndTime[1].substring(0, 5)
14
14
  };
15
15
  };
16
- const dateFormat = date => "".concat(new Date(date).toLocaleDateString(undefined, {
16
+ const dateFormat = date => `${new Date(date).toLocaleDateString(undefined, {
17
17
  month: 'numeric',
18
18
  day: 'numeric'
19
- }));
19
+ })}`;
20
20
  const dateTimeFormat = _ref => {
21
21
  let {
22
22
  date,
23
23
  time
24
24
  } = _ref;
25
- return "".concat(new Date(date).toLocaleDateString(undefined, {
25
+ return `${new Date(date).toLocaleDateString(undefined, {
26
26
  year: 'numeric',
27
27
  month: 'numeric',
28
28
  day: 'numeric'
29
- }), ", ").concat(time, " UTC");
29
+ })}, ${time} UTC`;
30
30
  };
31
31
  const isMonthWeek = timeUnit => timeUnit === _graphql.CurrencyPowerBalanceTimeUnit.M3 || timeUnit === _graphql.CurrencyPowerBalanceTimeUnit.M1 || timeUnit === _graphql.CurrencyPowerBalanceTimeUnit.W1;
32
32
  exports.isMonthWeek = isMonthWeek;
@@ -57,9 +57,18 @@ const tooltipFormatter = values => {
57
57
  seriesName,
58
58
  value
59
59
  } = _ref4;
60
- return "<div style=\"display:flex;align-items:center;\">\n <div style=\"display:flex;align-items:center;width:50px;margin-right:10px;\">\n ".concat(marker, "\n <span>").concat(seriesName, "</span>\n </div>\n <span>").concat(value[1], "</span>\n </div>");
60
+ return `<div style="display:flex;align-items:center;">
61
+ <div style="display:flex;align-items:center;width:50px;margin-right:10px;">
62
+ ${marker}
63
+ <span>${seriesName}</span>
64
+ </div>
65
+ <span>${value[1]}</span>
66
+ </div>`;
61
67
  });
62
- return "<div style=\"display:flex; flex-direction:column;\">\n <span style=\"margin-bottom:5px;\">".concat(date, "</span>\n ").concat(row.join('\n'), "\n </div>");
68
+ return `<div style="display:flex; flex-direction:column;">
69
+ <span style="margin-bottom:5px;">${date}</span>
70
+ ${row.join('\n')}
71
+ </div>`;
63
72
  };
64
73
  exports.tooltipFormatter = tooltipFormatter;
65
74
  const formatLegendData = values => {
@@ -1 +1 @@
1
- {"version":3,"file":"formatters.js","names":["_graphql","require","_constants","getDateAndTime","param","dateAndTime","split","date","time","substring","dateFormat","concat","Date","toLocaleDateString","undefined","month","day","dateTimeFormat","_ref","year","isMonthWeek","timeUnit","CurrencyPowerBalanceTimeUnit","M3","M1","W1","exports","xAxisLabelFormatter","label","isDateFormat","intervalFormatter","dataLength","Math","round","VERTICAL_LINE_COUNT","tooltipFormatter","values","value","row","sort","_ref2","_ref3","valueA","valueB","Number","map","_ref4","marker","seriesName","join","formatLegendData","dataCurrencies","_ref5","currency","list","length","CURRENCIES_ORDER","filter","includes","name","itemStyle","color","COLOR_CONFIG"],"sources":["../../../../../../src/CurrencyPowerBalanceWidget/components/Chart/options/formatters.ts"],"sourcesContent":["import type { CurrencyPowerBalance } from '../../../../gql/types/graphql';\nimport { CurrencyPowerBalanceTimeUnit } from '../../../../gql/types/graphql';\nimport {\n COLOR_CONFIG,\n CURRENCIES_ORDER,\n VERTICAL_LINE_COUNT,\n} from './constants';\nimport type { TooltipFormatterParams } from './types';\n\nconst getDateAndTime = (param: string) => {\n const dateAndTime = param.split('T');\n\n return {\n date: dateAndTime[0],\n time: dateAndTime[1].substring(0, 5),\n };\n};\n\nconst dateFormat = (date: string) =>\n `${new Date(date).toLocaleDateString(undefined, { month: 'numeric', day: 'numeric' })}`;\n\nconst dateTimeFormat = ({ date, time }: { date: string; time: string }) =>\n `${new Date(date).toLocaleDateString(undefined, { year: 'numeric', month: 'numeric', day: 'numeric' })}, ${time} UTC`;\n\nconst isMonthWeek = (timeUnit: CurrencyPowerBalanceTimeUnit) =>\n timeUnit === CurrencyPowerBalanceTimeUnit.M3 ||\n timeUnit === CurrencyPowerBalanceTimeUnit.M1 ||\n timeUnit === CurrencyPowerBalanceTimeUnit.W1;\n\nconst xAxisLabelFormatter = (\n label: string,\n timeUnit: CurrencyPowerBalanceTimeUnit\n) => {\n const { date, time } = getDateAndTime(label);\n const isDateFormat = isMonthWeek(timeUnit) || time === '00:00';\n\n return isDateFormat ? dateFormat(date) : time;\n};\n\nconst intervalFormatter = (dataLength: number) =>\n Math.round(dataLength / VERTICAL_LINE_COUNT);\n\nconst tooltipFormatter = (values: TooltipFormatterParams[]) => {\n const date = dateTimeFormat(getDateAndTime(values[0].value[0]));\n\n const row = values\n .sort(\n ({ value: valueA }, { value: valueB }) =>\n Number(valueB[1]) - Number(valueA[1])\n )\n .map(\n ({\n marker,\n seriesName,\n value,\n }) => `<div style=\"display:flex;align-items:center;\">\n <div style=\"display:flex;align-items:center;width:50px;margin-right:10px;\">\n ${marker}\n <span>${seriesName}</span>\n </div>\n <span>${value[1]}</span>\n </div>`\n );\n\n return `<div style=\"display:flex; flex-direction:column;\">\n <span style=\"margin-bottom:5px;\">${date}</span>\n ${row.join('\\n')}\n </div>`;\n};\n\nconst formatLegendData = (values: CurrencyPowerBalance[]) => {\n const dataCurrencies = values.map(({ currency }) => currency);\n\n const list =\n dataCurrencies.length === CURRENCIES_ORDER.length\n ? CURRENCIES_ORDER\n : CURRENCIES_ORDER.filter((currency) =>\n dataCurrencies.includes(currency)\n );\n\n return list.map((currency) => ({\n name: currency,\n itemStyle: {\n color: COLOR_CONFIG[currency],\n },\n }));\n};\n\nexport {\n formatLegendData,\n intervalFormatter,\n isMonthWeek,\n tooltipFormatter,\n xAxisLabelFormatter,\n};\n"],"mappings":";;;;;;AACA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,UAAA,GAAAD,OAAA;AAOA,MAAME,cAAc,GAAIC,KAAa,IAAK;EACxC,MAAMC,WAAW,GAAGD,KAAK,CAACE,KAAK,CAAC,GAAG,CAAC;EAEpC,OAAO;IACLC,IAAI,EAAEF,WAAW,CAAC,CAAC,CAAC;IACpBG,IAAI,EAAEH,WAAW,CAAC,CAAC,CAAC,CAACI,SAAS,CAAC,CAAC,EAAE,CAAC;EACrC,CAAC;AACH,CAAC;AAED,MAAMC,UAAU,GAAIH,IAAY,OAAAI,MAAA,CAC3B,IAAIC,IAAI,CAACL,IAAI,CAAC,CAACM,kBAAkB,CAACC,SAAS,EAAE;EAAEC,KAAK,EAAE,SAAS;EAAEC,GAAG,EAAE;AAAU,CAAC,CAAC,CAAE;AAEzF,MAAMC,cAAc,GAAGC,IAAA;EAAA,IAAC;IAAEX,IAAI;IAAEC;EAAqC,CAAC,GAAAU,IAAA;EAAA,UAAAP,MAAA,CACjE,IAAIC,IAAI,CAACL,IAAI,CAAC,CAACM,kB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CAAC,CAAC,GAAGC,MAAM,CAACF,MAAM,CAAC,CAAC,CAAC,CAAC;EAAA,CACzC,CAAC,CACAG,GAAG,CACFC,KAAA;IAAA,IAAC;MACCC,MAAM;MACNC,UAAU;MACVX;IACF,CAAC,GAAAS,KAAA;IAAA,yJAAAnC,MAAA,CAEGoC,MAAM,sBAAApC,MAAA,CACAqC,UAAU,yCAAArC,MAAA,CAEZ0B,KAAK,CAAC,CAAC,CAAC;EAAA,CAElB,CAAC;EAEH,uGAAA1B,MAAA,CACqCJ,IAAI,mBAAAI,MAAA,CACrC2B,GAAG,CAACW,IAAI,CAAC,IAAI,CAAC;AAEpB,CAAC;AAACvB,OAAA,CAAAS,gBAAA,GAAAA,gBAAA;AAEF,MAAMe,gBAAgB,GAAId,MAA8B,IAAK;EAC3D,MAAMe,cAAc,GAAGf,MAAM,CAACS,GAAG,CAACO,KAAA;IAAA,IAAC;MAAEC;IAAS,CAAC,GAAAD,KAAA;IAAA,OAAKC,QAAQ;EAAA,EAAC;EAE7D,MAAMC,IAAI,GACRH,cAAc,CAACI,MAAM,KAAKC,2BAAgB,CAACD,MAAM,GAC7CC,2BAAgB,GAChBA,2BAAgB,CAACC,MAAM,CAAEJ,QAAQ,IAC/BF,cAAc,CAACO,QAAQ,CAACL,QAAQ,CAClC,CAAC;EAEP,OAAOC,IAAI,CAACT,GAAG,CAAEQ,QAAQ,KAAM;IAC7BM,IAAI,EAAEN,QAAQ;IACdO,SAAS,EAAE;MACTC,KAAK,EAAEC,uBAAY,CAACT,QAAQ;IAC9B;EACF,CAAC,CAAC,CAAC;AACL,CAAC;AAAC3B,OAAA,CAAAwB,gBAAA,GAAAA,gBAAA","ignoreList":[]}
1
+ {"version":3,"file":"formatters.js","names":["_graphql","require","_constants","getDateAndTime","param","dateAndTime","split","date","time","substring","dateFormat","Date","toLocaleDateString","undefined","month","day","dateTimeFormat","_ref","year","isMonthWeek","timeUnit","CurrencyPowerBalanceTimeUnit","M3","M1","W1","exports","xAxisLabelFormatter","label","isDateFormat","intervalFormatter","dataLength","Math","round","VERTICAL_LINE_COUNT","tooltipFormatter","values","value","row","sort","_ref2","_ref3","valueA","valueB","Number","map","_ref4","marker","seriesName","join","formatLegendData","dataCurrencies","_ref5","currency","list","length","CURRENCIES_ORDER","filter","includes","name","itemStyle","color","COLOR_CONFIG"],"sources":["../../../../../../src/CurrencyPowerBalanceWidget/components/Chart/options/formatters.ts"],"sourcesContent":["import type { CurrencyPowerBalance } from '../../../../gql/types/graphql';\nimport { CurrencyPowerBalanceTimeUnit } from '../../../../gql/types/graphql';\nimport {\n COLOR_CONFIG,\n CURRENCIES_ORDER,\n VERTICAL_LINE_COUNT,\n} from './constants';\nimport type { TooltipFormatterParams } from './types';\n\nconst getDateAndTime = (param: string) => {\n const dateAndTime = param.split('T');\n\n return {\n date: dateAndTime[0],\n time: dateAndTime[1].substring(0, 5),\n };\n};\n\nconst dateFormat = (date: string) =>\n `${new Date(date).toLocaleDateString(undefined, { month: 'numeric', day: 'numeric' })}`;\n\nconst dateTimeFormat = ({ date, time }: { date: string; time: string }) =>\n `${new Date(date).toLocaleDateString(undefined, { year: 'numeric', month: 'numeric', day: 'numeric' })}, ${time} UTC`;\n\nconst isMonthWeek = (timeUnit: CurrencyPowerBalanceTimeUnit) =>\n timeUnit === CurrencyPowerBalanceTimeUnit.M3 ||\n timeUnit === CurrencyPowerBalanceTimeUnit.M1 ||\n timeUnit === CurrencyPowerBalanceTimeUnit.W1;\n\nconst xAxisLabelFormatter = (\n label: string,\n timeUnit: CurrencyPowerBalanceTimeUnit\n) => {\n const { date, time } = getDateAndTime(label);\n const isDateFormat = isMonthWeek(timeUnit) || time === '00:00';\n\n return isDateFormat ? dateFormat(date) : time;\n};\n\nconst intervalFormatter = (dataLength: number) =>\n Math.round(dataLength / VERTICAL_LINE_COUNT);\n\nconst tooltipFormatter = (values: TooltipFormatterParams[]) => {\n const date = dateTimeFormat(getDateAndTime(values[0].value[0]));\n\n const row = values\n .sort(\n ({ value: valueA }, { value: valueB }) =>\n Number(valueB[1]) - Number(valueA[1])\n )\n .map(\n ({\n marker,\n seriesName,\n value,\n }) => `<div style=\"display:flex;align-items:center;\">\n <div style=\"display:flex;align-items:center;width:50px;margin-right:10px;\">\n ${marker}\n <span>${seriesName}</span>\n </div>\n <span>${value[1]}</span>\n </div>`\n );\n\n return `<div style=\"display:flex; flex-direction:column;\">\n <span style=\"margin-bottom:5px;\">${date}</span>\n ${row.join('\\n')}\n </div>`;\n};\n\nconst formatLegendData = (values: CurrencyPowerBalance[]) => {\n const dataCurrencies = values.map(({ currency }) => currency);\n\n const list =\n dataCurrencies.length === CURRENCIES_ORDER.length\n ? CURRENCIES_ORDER\n : CURRENCIES_ORDER.filter((currency) =>\n dataCurrencies.includes(currency)\n );\n\n return list.map((currency) => ({\n name: currency,\n itemStyle: {\n color: COLOR_CONFIG[currency],\n },\n }));\n};\n\nexport {\n formatLegendData,\n intervalFormatter,\n isMonthWeek,\n tooltipFormatter,\n xAxisLabelFormatter,\n};\n"],"mappings":";;;;;;AACA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,UAAA,GAAAD,OAAA;AAOA,MAAME,cAAc,GAAIC,KAAa,IAAK;EACxC,MAAMC,WAAW,GAAGD,KAAK,CAACE,KAAK,CAAC,GAAG,CAAC;EAEpC,OAAO;IACLC,IAAI,EAAEF,WAAW,CAAC,CAAC,CAAC;IACpBG,IAAI,EAAEH,WAAW,CAAC,CAAC,CAAC,CAACI,SAAS,CAAC,CAAC,EAAE,CAAC;EACrC,CAAC;AACH,CAAC;AAED,MAAMC,UAAU,GAAIH,IAAY,IAC9B,GAAG,IAAII,IAAI,CAACJ,IAAI,CAAC,CAACK,kBAAkB,CAACC,SAAS,EAAE;EAAEC,KAAK,EAAE,SAAS;EAAEC,GAAG,EAAE;AAAU,CAAC,CAAC,EAAE;AAEzF,MAAMC,cAAc,GAAGC,IAAA;EAAA,IAAC;IAAEV,IAAI;IAAEC;EAAqC,CAAC,GAAAS,IA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,KAAA;IAAA,OACnCG,MAAM,CAACD,MAAM,CAAC,CAAC,CAAC,CAAC,GAAGC,MAAM,CAACF,MAAM,CAAC,CAAC,CAAC,CAAC;EAAA,CACzC,CAAC,CACAG,GAAG,CACFC,KAAA;IAAA,IAAC;MACCC,MAAM;MACNC,UAAU;MACVX;IACF,CAAC,GAAAS,KAAA;IAAA,OAAK;AACZ;AACA,UAAUC,MAAM;AAChB,gBAAgBC,UAAU;AAC1B;AACA,cAAcX,KAAK,CAAC,CAAC,CAAC;AACtB,WAAW;EAAA,CACP,CAAC;EAEH,OAAO;AACT,uCAAuC7B,IAAI;AAC3C,MAAM8B,GAAG,CAACW,IAAI,CAAC,IAAI,CAAC;AACpB,SAAS;AACT,CAAC;AAACvB,OAAA,CAAAS,gBAAA,GAAAA,gBAAA;AAEF,MAAMe,gBAAgB,GAAId,MAA8B,IAAK;EAC3D,MAAMe,cAAc,GAAGf,MAAM,CAACS,GAAG,CAACO,KAAA;IAAA,IAAC;MAAEC;IAAS,CAAC,GAAAD,KAAA;IAAA,OAAKC,QAAQ;EAAA,EAAC;EAE7D,MAAMC,IAAI,GACRH,cAAc,CAACI,MAAM,KAAKC,2BAAgB,CAACD,MAAM,GAC7CC,2BAAgB,GAChBA,2BAAgB,CAACC,MAAM,CAAEJ,QAAQ,IAC/BF,cAAc,CAACO,QAAQ,CAACL,QAAQ,CAClC,CAAC;EAEP,OAAOC,IAAI,CAACT,GAAG,CAAEQ,QAAQ,KAAM;IAC7BM,IAAI,EAAEN,QAAQ;IACdO,SAAS,EAAE;MACTC,KAAK,EAAEC,uBAAY,CAACT,QAAQ;IAC9B;EACF,CAAC,CAAC,CAAC;AACL,CAAC;AAAC3B,OAAA,CAAAwB,gBAAA,GAAAA,gBAAA","ignoreList":[]}
@@ -26,8 +26,8 @@ const getResponsiveOption = (isDesktop, isMobile, isDark) => {
26
26
  name: 'main-grid',
27
27
  top: '0px',
28
28
  left: '0px',
29
- right: "".concat(isMobile ? _constants.Y_LABEL_SIZE_MOBILE : _constants.Y_LABEL_SIZE, "px"),
30
- bottom: "".concat(isMobile ? _constants.X_LABEL_SIZE_MOBILE : _constants.X_LABEL_SIZE, "px")
29
+ right: `${isMobile ? _constants.Y_LABEL_SIZE_MOBILE : _constants.Y_LABEL_SIZE}px`,
30
+ bottom: `${isMobile ? _constants.X_LABEL_SIZE_MOBILE : _constants.X_LABEL_SIZE}px`
31
31
  }],
32
32
  graphic: [...baseGridLines]
33
33
  };
@@ -1 +1 @@
1
- {"version":3,"file":"getResponsiveOption.js","names":["_labsWidgetCommon","require","_constants","getResponsiveOption","isDesktop","isMobile","isDark","baseGridLines","getGridLines","chartWidth","CHART_WIDTH","chartHeight","CHART_HEIGHT","xLabelsSize","X_LABEL_SIZE_MOBILE","X_LABEL_SIZE","yLabelSize","Y_LABEL_SIZE_MOBILE","Y_LABEL_SIZE","bottomLeftBox","marginBottom","LEGEND_HEIGHT_MOBILE","LEGEND_HEIGHT","yAxis","axisLabel","margin","grid","name","top","left","right","concat","bottom","graphic","exports"],"sources":["../../../../../../src/CurrencyPowerBalanceWidget/components/Chart/options/getResponsiveOption.ts"],"sourcesContent":["import { getGridLines } from '@oanda/labs-widget-common';\n\nimport {\n CHART_HEIGHT,\n CHART_WIDTH,\n LEGEND_HEIGHT,\n LEGEND_HEIGHT_MOBILE,\n X_LABEL_SIZE,\n X_LABEL_SIZE_MOBILE,\n Y_LABEL_SIZE,\n Y_LABEL_SIZE_MOBILE,\n} from './constants';\n\nconst getResponsiveOption = (\n isDesktop: boolean,\n isMobile: boolean,\n isDark: boolean\n) => {\n const baseGridLines = getGridLines({\n isDark,\n chartWidth: CHART_WIDTH,\n chartHeight: CHART_HEIGHT,\n xLabelsSize: isMobile ? X_LABEL_SIZE_MOBILE : X_LABEL_SIZE,\n yLabelSize: isMobile ? Y_LABEL_SIZE_MOBILE : Y_LABEL_SIZE,\n bottomLeftBox: false,\n marginBottom: isMobile ? LEGEND_HEIGHT_MOBILE : LEGEND_HEIGHT,\n });\n\n return {\n yAxis: {\n axisLabel: {\n margin: isDesktop ? 8 : 6,\n },\n },\n grid: [\n {\n name: 'main-grid',\n top: '0px',\n left: '0px',\n right: `${isMobile ? Y_LABEL_SIZE_MOBILE : Y_LABEL_SIZE}px`,\n bottom: `${isMobile ? X_LABEL_SIZE_MOBILE : X_LABEL_SIZE}px`,\n },\n ],\n graphic: [...baseGridLines],\n };\n};\n\nexport { getResponsiveOption };\n"],"mappings":";;;;;;AAAA,IAAAA,iBAAA,GAAAC,OAAA;AAEA,IAAAC,UAAA,GAAAD,OAAA;AAWA,MAAME,mBAAmB,GAAGA,CAC1BC,SAAkB,EAClBC,QAAiB,EACjBC,MAAe,KACZ;EACH,MAAMC,aAAa,GAAG,IAAAC,8BAAY,EAAC;IACjCF,MAAM;IACNG,UAAU,EAAEC,sBAAW;IACvBC,WAAW,EAAEC,uBAAY;IACzBC,WAAW,EAAER,QAAQ,GAAGS,8BAAmB,GAAGC,uBAAY;IAC1DC,UAAU,EAAEX,QAAQ,GAAGY,8BAAmB,GAAGC,uBAAY;IACzDC,aAAa,EAAE,KAAK;IACpBC,YAAY,EAAEf,QAAQ,GAAGgB,+BAAoB,GAAGC;EAClD,CAAC,CAAC;EAEF,OAAO;IACLC,KAAK,EAAE;MACLC,SAAS,EAAE;QACTC,MAAM,EAAErB,SAAS,GAAG,CAAC,GAAG;MAC1B;IACF,CAAC;IACDsB,IAAI,EAAE,CACJ;MACEC,IAAI,EAAE,WAAW;MACjBC,GAAG,EAAE,KAAK;MACVC,IAAI,EAAE,KAAK;MACXC,KAAK,KAAAC,MAAA,CAAK1B,QAAQ,GAAGY,8BAAmB,GAAGC,uBAAY,OAAI;MAC3Dc,MAAM,KAAAD,MAAA,CAAK1B,QAAQ,GAAGS,8BAAmB,GAAGC,uBAAY;IAC1D,CAAC,CACF;IACDkB,OAAO,EAAE,CAAC,GAAG1B,aAAa;EAC5B,CAAC;AACH,CAAC;AAAC2B,OAAA,CAAA/B,mBAAA,GAAAA,mBAAA","ignoreList":[]}
1
+ {"version":3,"file":"getResponsiveOption.js","names":["_labsWidgetCommon","require","_constants","getResponsiveOption","isDesktop","isMobile","isDark","baseGridLines","getGridLines","chartWidth","CHART_WIDTH","chartHeight","CHART_HEIGHT","xLabelsSize","X_LABEL_SIZE_MOBILE","X_LABEL_SIZE","yLabelSize","Y_LABEL_SIZE_MOBILE","Y_LABEL_SIZE","bottomLeftBox","marginBottom","LEGEND_HEIGHT_MOBILE","LEGEND_HEIGHT","yAxis","axisLabel","margin","grid","name","top","left","right","bottom","graphic","exports"],"sources":["../../../../../../src/CurrencyPowerBalanceWidget/components/Chart/options/getResponsiveOption.ts"],"sourcesContent":["import { getGridLines } from '@oanda/labs-widget-common';\n\nimport {\n CHART_HEIGHT,\n CHART_WIDTH,\n LEGEND_HEIGHT,\n LEGEND_HEIGHT_MOBILE,\n X_LABEL_SIZE,\n X_LABEL_SIZE_MOBILE,\n Y_LABEL_SIZE,\n Y_LABEL_SIZE_MOBILE,\n} from './constants';\n\nconst getResponsiveOption = (\n isDesktop: boolean,\n isMobile: boolean,\n isDark: boolean\n) => {\n const baseGridLines = getGridLines({\n isDark,\n chartWidth: CHART_WIDTH,\n chartHeight: CHART_HEIGHT,\n xLabelsSize: isMobile ? X_LABEL_SIZE_MOBILE : X_LABEL_SIZE,\n yLabelSize: isMobile ? Y_LABEL_SIZE_MOBILE : Y_LABEL_SIZE,\n bottomLeftBox: false,\n marginBottom: isMobile ? LEGEND_HEIGHT_MOBILE : LEGEND_HEIGHT,\n });\n\n return {\n yAxis: {\n axisLabel: {\n margin: isDesktop ? 8 : 6,\n },\n },\n grid: [\n {\n name: 'main-grid',\n top: '0px',\n left: '0px',\n right: `${isMobile ? Y_LABEL_SIZE_MOBILE : Y_LABEL_SIZE}px`,\n bottom: `${isMobile ? X_LABEL_SIZE_MOBILE : X_LABEL_SIZE}px`,\n },\n ],\n graphic: [...baseGridLines],\n };\n};\n\nexport { getResponsiveOption };\n"],"mappings":";;;;;;AAAA,IAAAA,iBAAA,GAAAC,OAAA;AAEA,IAAAC,UAAA,GAAAD,OAAA;AAWA,MAAME,mBAAmB,GAAGA,CAC1BC,SAAkB,EAClBC,QAAiB,EACjBC,MAAe,KACZ;EACH,MAAMC,aAAa,GAAG,IAAAC,8BAAY,EAAC;IACjCF,MAAM;IACNG,UAAU,EAAEC,sBAAW;IACvBC,WAAW,EAAEC,uBAAY;IACzBC,WAAW,EAAER,QAAQ,GAAGS,8BAAmB,GAAGC,uBAAY;IAC1DC,UAAU,EAAEX,QAAQ,GAAGY,8BAAmB,GAAGC,uBAAY;IACzDC,aAAa,EAAE,KAAK;IACpBC,YAAY,EAAEf,QAAQ,GAAGgB,+BAAoB,GAAGC;EAClD,CAAC,CAAC;EAEF,OAAO;IACLC,KAAK,EAAE;MACLC,SAAS,EAAE;QACTC,MAAM,EAAErB,SAAS,GAAG,CAAC,GAAG;MAC1B;IACF,CAAC;IACDsB,IAAI,EAAE,CACJ;MACEC,IAAI,EAAE,WAAW;MACjBC,GAAG,EAAE,KAAK;MACVC,IAAI,EAAE,KAAK;MACXC,KAAK,EAAE,GAAGzB,QAAQ,GAAGY,8BAAmB,GAAGC,uBAAY,IAAI;MAC3Da,MAAM,EAAE,GAAG1B,QAAQ,GAAGS,8BAAmB,GAAGC,uBAAY;IAC1D,CAAC,CACF;IACDiB,OAAO,EAAE,CAAC,GAAGzB,aAAa;EAC5B,CAAC;AACH,CAAC;AAAC0B,OAAA,CAAA9B,mBAAA,GAAAA,mBAAA","ignoreList":[]}
@@ -5,7 +5,16 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.getCurrencyPowerBalance = void 0;
7
7
  var _client = require("@apollo/client");
8
- var _templateObject;
9
- function _taggedTemplateLiteral(e, t) { return t || (t = e.slice(0)), Object.freeze(Object.defineProperties(e, { raw: { value: Object.freeze(t) } })); }
10
- const getCurrencyPowerBalance = exports.getCurrencyPowerBalance = (0, _client.gql)(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n query GetCurrencyPowerBalance($timeUnit: CurrencyPowerBalanceTimeUnit!) {\n currencyPowerBalance(timeUnit: $timeUnit) {\n currency\n power {\n point\n price\n }\n updatedAt\n }\n }\n"])));
8
+ const getCurrencyPowerBalance = exports.getCurrencyPowerBalance = (0, _client.gql)`
9
+ query GetCurrencyPowerBalance($timeUnit: CurrencyPowerBalanceTimeUnit!) {
10
+ currencyPowerBalance(timeUnit: $timeUnit) {
11
+ currency
12
+ power {
13
+ point
14
+ price
15
+ }
16
+ updatedAt
17
+ }
18
+ }
19
+ `;
11
20
  //# sourceMappingURL=getCurrencyPowerBalance.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"getCurrencyPowerBalance.js","names":["_client","require","_templateObject","_taggedTemplateLiteral","e","t","slice","Object","freeze","defineProperties","raw","value","getCurrencyPowerBalance","exports","gql"],"sources":["../../../src/gql/getCurrencyPowerBalance.ts"],"sourcesContent":["import { gql } from '@apollo/client';\n\nexport const getCurrencyPowerBalance = gql`\n query GetCurrencyPowerBalance($timeUnit: CurrencyPowerBalanceTimeUnit!) {\n currencyPowerBalance(timeUnit: $timeUnit) {\n currency\n power {\n point\n price\n }\n updatedAt\n }\n }\n`;\n"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AAAqC,IAAAC,eAAA;AAAA,SAAAC,uBAAAC,CAAA,EAAAC,CAAA,WAAAA,CAAA,KAAAA,CAAA,GAAAD,CAAA,CAAAE,KAAA,MAAAC,MAAA,CAAAC,MAAA,CAAAD,MAAA,CAAAE,gBAAA,CAAAL,CAAA,IAAAM,GAAA,IAAAC,KAAA,EAAAJ,MAAA,CAAAC,MAAA,CAAAH,CAAA;AAE9B,MAAMO,uBAAuB,GAAAC,OAAA,CAAAD,uBAAA,OAAGE,WAAG,EAAAZ,eAAA,KAAAA,eAAA,GAAAC,sBAAA,2OAWzC","ignoreList":[]}
1
+ {"version":3,"file":"getCurrencyPowerBalance.js","names":["_client","require","getCurrencyPowerBalance","exports","gql"],"sources":["../../../src/gql/getCurrencyPowerBalance.ts"],"sourcesContent":["import { gql } from '@apollo/client';\n\nexport const getCurrencyPowerBalance = gql`\n query GetCurrencyPowerBalance($timeUnit: CurrencyPowerBalanceTimeUnit!) {\n currencyPowerBalance(timeUnit: $timeUnit) {\n currency\n power {\n point\n price\n }\n updatedAt\n }\n }\n`;\n"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AAEO,MAAMC,uBAAuB,GAAAC,OAAA,CAAAD,uBAAA,GAAG,IAAAE,WAAG;AAC1C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC","ignoreList":[]}
@@ -13,11 +13,10 @@ function makeFragmentData(data, _fragment) {
13
13
  return data;
14
14
  }
15
15
  function isFragmentReady(queryNode, fragmentNode, data) {
16
- var _meta__, _fragDef$name;
17
- const deferredFields = (_meta__ = queryNode.__meta__) === null || _meta__ === void 0 ? void 0 : _meta__.deferredFields;
16
+ const deferredFields = queryNode.__meta__?.deferredFields;
18
17
  if (!deferredFields) return true;
19
18
  const fragDef = fragmentNode.definitions[0];
20
- const fragName = fragDef === null || fragDef === void 0 || (_fragDef$name = fragDef.name) === null || _fragDef$name === void 0 ? void 0 : _fragDef$name.value;
19
+ const fragName = fragDef?.name?.value;
21
20
  const fields = fragName && deferredFields[fragName] || [];
22
21
  return fields.length > 0 && fields.every(field => data && field in data);
23
22
  }
@@ -1 +1 @@
1
- {"version":3,"file":"fragment-masking.js","names":["useFragment","_documentNode","fragmentType","makeFragmentData","data","_fragment","isFragmentReady","queryNode","fragmentNode","_meta__","_fragDef$name","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":";;;;;;;;AA6CO,SAASA,WAAWA,CACzBC,aAAiD,EACjDC,YAIa,EACoC;EACjD,OAAOA,YAAY;AACrB;AAEO,SAASC,gBAAgBA,CAG9BC,IAAQ,EAAEC,SAAY,EAAmB;EACzC,OAAOD,IAAI;AACb;AACO,SAASE,eAAeA,CAC7BC,SAA8C,EAC9CC,YAAsC,EACtCJ,IAGa,EAC8B;EAAA,IAAAK,OAAA,EAAAC,aAAA;EAC3C,MAAMC,cAAc,IAAAF,OAAA,GAClBF,SAAS,CAGTK,QAAQ,cAAAH,OAAA,uBAJaA,OAAA,CAIXE,cAAc;EAE1B,IAAI,CAACA,cAAc,EAAE,OAAO,IAAI;EAEhC,MAAME,OAAO,GAAGL,YAAY,CAACM,WAAW,CAAC,CAAC,CAE7B;EACb,MAAMC,QAAQ,GAAGF,OAAO,aAAPA,OAAO,gBAAAH,aAAA,GAAPG,OAAO,CAAEG,IAAI,cAAAN,aAAA,uBAAbA,aAAA,CAAeO,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,IAAKjB,IAAI,IAAIiB,KAAK,IAAIjB,IAAI,CAAC;AAC5E","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":";;;;;;;;AA6CO,SAASA,WAAWA,CACzBC,aAAiD,EACjDC,YAIa,EACoC;EACjD,OAAOA,YAAY;AACrB;AAEO,SAASC,gBAAgBA,CAG9BC,IAAQ,EAAEC,SAAY,EAAmB;EACzC,OAAOD,IAAI;AACb;AACO,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":[]}
@@ -11,7 +11,6 @@ const documents = {
11
11
  '\n query GetCurrencyPowerBalance($timeUnit: CurrencyPowerBalanceTimeUnit!) {\n currencyPowerBalance(timeUnit: $timeUnit) {\n currency\n power {\n point\n price\n }\n updatedAt\n }\n }\n': types.GetCurrencyPowerBalanceDocument
12
12
  };
13
13
  function graphql(source) {
14
- var _source;
15
- return (_source = documents[source]) !== null && _source !== void 0 ? _source : {};
14
+ return documents[source] ?? {};
16
15
  }
17
16
  //# sourceMappingURL=gql.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"gql.js","names":["types","_interopRequireWildcard","require","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","documents","GetCurrencyPowerBalanceDocument","graphql","source","_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 GetCurrencyPowerBalance($timeUnit: CurrencyPowerBalanceTimeUnit!) {\\n currencyPowerBalance(timeUnit: $timeUnit) {\\n currency\\n power {\\n point\\n price\\n }\\n updatedAt\\n }\\n }\\n':\n types.GetCurrencyPowerBalanceDocument,\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 GetCurrencyPowerBalance($timeUnit: CurrencyPowerBalanceTimeUnit!) {\\n currencyPowerBalance(timeUnit: $timeUnit) {\\n currency\\n power {\\n point\\n price\\n }\\n updatedAt\\n }\\n }\\n'\n): (typeof documents)['\\n query GetCurrencyPowerBalance($timeUnit: CurrencyPowerBalanceTimeUnit!) {\\n currencyPowerBalance(timeUnit: $timeUnit) {\\n currency\\n power {\\n point\\n price\\n }\\n updatedAt\\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,IAAAA,KAAA,GAAAC,uBAAA,CAAAC,OAAA;AAAmC,SAAAC,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAH,wBAAAG,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAI,UAAA,SAAAJ,CAAA,eAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,WAAAK,OAAA,EAAAL,CAAA,QAAAG,CAAA,GAAAJ,wBAAA,CAAAG,CAAA,OAAAC,CAAA,IAAAA,CAAA,CAAAG,GAAA,CAAAN,CAAA,UAAAG,CAAA,CAAAI,GAAA,CAAAP,CAAA,OAAAQ,CAAA,KAAAC,SAAA,UAAAC,CAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAAA,CAAAE,wBAAA,WAAAC,CAAA,IAAAd,CAAA,oBAAAc,CAAA,OAAAC,cAAA,CAAAC,IAAA,CAAAhB,CAAA,EAAAc,CAAA,SAAAG,CAAA,GAAAP,CAAA,GAAAC,MAAA,CAAAE,wBAAA,CAAAb,CAAA,EAAAc,CAAA,UAAAG,CAAA,KAAAA,CAAA,CAAAV,GAAA,IAAAU,CAAA,CAAAC,GAAA,IAAAP,MAAA,CAAAC,cAAA,CAAAJ,CAAA,EAAAM,CAAA,EAAAG,CAAA,IAAAT,CAAA,CAAAM,CAAA,IAAAd,CAAA,CAAAc,CAAA,YAAAN,CAAA,CAAAH,OAAA,GAAAL,CAAA,EAAAG,CAAA,IAAAA,CAAA,CAAAe,GAAA,CAAAlB,CAAA,EAAAQ,CAAA,GAAAA,CAAA;AAanC,MAAMW,SAAS,GAAG;EAChB,qOAAqO,EACnOvB,KAAK,CAACwB;AACV,CAAC;AAuBM,SAASC,OAAOA,CAACC,MAAc,EAAE;EAAA,IAAAC,OAAA;EACtC,QAAAA,OAAA,GAAQJ,SAAS,CAASG,MAAM,CAAC,cAAAC,OAAA,cAAAA,OAAA,GAAI,CAAC,CAAC;AACzC","ignoreList":[]}
1
+ {"version":3,"file":"gql.js","names":["types","_interopRequireWildcard","require","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","documents","GetCurrencyPowerBalanceDocument","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 GetCurrencyPowerBalance($timeUnit: CurrencyPowerBalanceTimeUnit!) {\\n currencyPowerBalance(timeUnit: $timeUnit) {\\n currency\\n power {\\n point\\n price\\n }\\n updatedAt\\n }\\n }\\n':\n types.GetCurrencyPowerBalanceDocument,\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 GetCurrencyPowerBalance($timeUnit: CurrencyPowerBalanceTimeUnit!) {\\n currencyPowerBalance(timeUnit: $timeUnit) {\\n currency\\n power {\\n point\\n price\\n }\\n updatedAt\\n }\\n }\\n'\n): (typeof documents)['\\n query GetCurrencyPowerBalance($timeUnit: CurrencyPowerBalanceTimeUnit!) {\\n currencyPowerBalance(timeUnit: $timeUnit) {\\n currency\\n power {\\n point\\n price\\n }\\n updatedAt\\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,IAAAA,KAAA,GAAAC,uBAAA,CAAAC,OAAA;AAAmC,SAAAC,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAH,wBAAAG,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAI,UAAA,SAAAJ,CAAA,eAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,WAAAK,OAAA,EAAAL,CAAA,QAAAG,CAAA,GAAAJ,wBAAA,CAAAG,CAAA,OAAAC,CAAA,IAAAA,CAAA,CAAAG,GAAA,CAAAN,CAAA,UAAAG,CAAA,CAAAI,GAAA,CAAAP,CAAA,OAAAQ,CAAA,KAAAC,SAAA,UAAAC,CAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAAA,CAAAE,wBAAA,WAAAC,CAAA,IAAAd,CAAA,oBAAAc,CAAA,OAAAC,cAAA,CAAAC,IAAA,CAAAhB,CAAA,EAAAc,CAAA,SAAAG,CAAA,GAAAP,CAAA,GAAAC,MAAA,CAAAE,wBAAA,CAAAb,CAAA,EAAAc,CAAA,UAAAG,CAAA,KAAAA,CAAA,CAAAV,GAAA,IAAAU,CAAA,CAAAC,GAAA,IAAAP,MAAA,CAAAC,cAAA,CAAAJ,CAAA,EAAAM,CAAA,EAAAG,CAAA,IAAAT,CAAA,CAAAM,CAAA,IAAAd,CAAA,CAAAc,CAAA,YAAAN,CAAA,CAAAH,OAAA,GAAAL,CAAA,EAAAG,CAAA,IAAAA,CAAA,CAAAe,GAAA,CAAAlB,CAAA,EAAAQ,CAAA,GAAAA,CAAA;AAanC,MAAMW,SAAS,GAAG;EAChB,qOAAqO,EACnOvB,KAAK,CAACwB;AACV,CAAC;AAuBM,SAASC,OAAOA,CAACC,MAAc,EAAE;EACtC,OAAQH,SAAS,CAASG,MAAM,CAAC,IAAI,CAAC,CAAC;AACzC","ignoreList":[]}
@@ -6,7 +6,6 @@ import { getCurrencyPowerBalance } from '../gql/getCurrencyPowerBalance';
6
6
  import { Chart } from './components/Chart';
7
7
  import { CURRENCY_POWER_BALANCE_TOOLTIP_ID } from './constants';
8
8
  const ChartWithData = _ref => {
9
- var _data$currencyPowerBa, _;
10
9
  let {
11
10
  timeUnit,
12
11
  currencies
@@ -28,7 +27,7 @@ const ChartWithData = _ref => {
28
27
  },
29
28
  fetchPolicy: 'cache-and-network'
30
29
  });
31
- const showError = (data === null || data === void 0 || (_data$currencyPowerBa = data.currencyPowerBalance) === null || _data$currencyPowerBa === void 0 ? void 0 : _data$currencyPowerBa.length) === 0 || error || currencies && (currencies.length === 0 || currencies.length === 1);
30
+ const showError = data?.currencyPowerBalance?.length === 0 || error || currencies && (currencies.length === 0 || currencies.length === 1);
32
31
  return React.createElement(React.Fragment, null, loading && React.createElement("div", {
33
32
  className: "lw-mb-[50px] lw-flex lw-h-[375px] lw-w-full lw-items-center lw-border lw-border-solid lw-border-border-primary"
34
33
  }, React.createElement(Spinner, {
@@ -36,7 +35,7 @@ const ChartWithData = _ref => {
36
35
  })), !loading && !showError && React.createElement(Chart, {
37
36
  currencies: currencies,
38
37
  timeUnit: timeUnit,
39
- values: data === null || data === void 0 ? void 0 : data.currencyPowerBalance
38
+ values: data?.currencyPowerBalance
40
39
  }), !loading && showError && React.createElement("div", {
41
40
  className: "lw-flex lw-h-[375px] lw-w-full lw-items-center lw-border lw-border-solid lw-border-border-primary"
42
41
  }, React.createElement(ChartError, null)), isDesktop && React.createElement(Tooltip, {
@@ -45,7 +44,7 @@ const ChartWithData = _ref => {
45
44
  className: "lw-mt-2 lw-h-8"
46
45
  }, !loading && !showError && React.createElement(LastUpdated, {
47
46
  labelCallback: lang,
48
- timestamp: data === null || data === void 0 || (_ = data.currencyPowerBalance[0]) === null || _ === void 0 ? void 0 : _.updatedAt
47
+ timestamp: data?.currencyPowerBalance[0]?.updatedAt
49
48
  })));
50
49
  };
51
50
  export { ChartWithData };
@@ -1 +1 @@
1
- {"version":3,"file":"ChartWithData.js","names":["useQuery","ChartError","LastUpdated","Size","Spinner","SpinnerSize","Tooltip","useLayoutProvider","useLocale","React","getCurrencyPowerBalance","Chart","CURRENCY_POWER_BALANCE_TOOLTIP_ID","ChartWithData","_ref","_data$currencyPowerBa","_","timeUnit","currencies","size","isDesktop","DESKTOP","lang","loading","data","error","variables","fetchPolicy","showError","currencyPowerBalance","length","createElement","Fragment","className","lg","values","id","labelCallback","timestamp","updatedAt"],"sources":["../../../src/CurrencyPowerBalanceWidget/ChartWithData.tsx"],"sourcesContent":["import { useQuery } from '@apollo/client';\nimport {\n ChartError,\n LastUpdated,\n Size,\n Spinner,\n SpinnerSize,\n Tooltip,\n useLayoutProvider,\n} from '@oanda/labs-widget-common';\nimport { useLocale } from '@oanda/mono-i18n';\nimport React from 'react';\n\nimport { getCurrencyPowerBalance } from '../gql/getCurrencyPowerBalance';\nimport type {\n GetCurrencyPowerBalanceQuery,\n GetCurrencyPowerBalanceQueryVariables,\n} from '../gql/types/graphql';\nimport { Chart } from './components/Chart';\nimport { CURRENCY_POWER_BALANCE_TOOLTIP_ID } from './constants';\nimport type { ChartWithDataProps } from './types';\n\nconst ChartWithData = ({ timeUnit, currencies }: ChartWithDataProps) => {\n const { size } = useLayoutProvider();\n const isDesktop = size === Size.DESKTOP;\n const { lang } = useLocale();\n const { loading, data, error } = useQuery<\n GetCurrencyPowerBalanceQuery,\n GetCurrencyPowerBalanceQueryVariables\n >(getCurrencyPowerBalance, {\n variables: {\n timeUnit,\n },\n fetchPolicy: 'cache-and-network',\n });\n\n const showError =\n data?.currencyPowerBalance?.length === 0 ||\n error ||\n (currencies && (currencies.length === 0 || currencies.length === 1));\n\n return (\n <>\n {loading && (\n <div className=\"lw-mb-[50px] lw-flex lw-h-[375px] lw-w-full lw-items-center lw-border lw-border-solid lw-border-border-primary\">\n <Spinner size={SpinnerSize.lg} />\n </div>\n )}\n {!loading && !showError && (\n <Chart\n currencies={currencies}\n timeUnit={timeUnit}\n values={data?.currencyPowerBalance!}\n />\n )}\n {!loading && showError && (\n <div className=\"lw-flex lw-h-[375px] lw-w-full lw-items-center lw-border lw-border-solid lw-border-border-primary\">\n <ChartError />\n </div>\n )}\n {isDesktop && <Tooltip id={CURRENCY_POWER_BALANCE_TOOLTIP_ID} />}\n <div className=\"lw-mt-2 lw-h-8\">\n {!loading && !showError && (\n <LastUpdated\n labelCallback={lang}\n timestamp={data?.currencyPowerBalance![0]?.updatedAt}\n />\n )}\n </div>\n </>\n );\n};\n\nexport { ChartWithData };\n"],"mappings":"AAAA,SAASA,QAAQ,QAAQ,gBAAgB;AACzC,SACEC,UAAU,EACVC,WAAW,EACXC,IAAI,EACJC,OAAO,EACPC,WAAW,EACXC,OAAO,EACPC,iBAAiB,QACZ,2BAA2B;AAClC,SAASC,SAAS,QAAQ,kBAAkB;AAC5C,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AAS;IACnBkB,MAAM,EAAEX,IAAI,aAAJA,IAAI,uBAAJA,IAAI,CAAEK;EAAsB,CACrC,CACF,EACA,CAACN,OAAO,IAAIK,SAAS,IACpBnB,KAAA,CAAAsB,aAAA;IAAKE,SAAS,EAAC;EAAmG,GAChHxB,KAAA,CAAAsB,aAAA,CAAC9B,UAAU,MAAE,CACV,CACN,EACAmB,SAAS,IAAIX,KAAA,CAAAsB,aAAA,CAACzB,OAAO;IAAC8B,EAAE,EAAExB;EAAkC,CAAE,CAAC,EAChEH,KAAA,CAAAsB,aAAA;IAAKE,SAAS,EAAC;EAAgB,GAC5B,CAACV,OAAO,IAAI,CAACK,SAAS,IACrBnB,KAAA,CAAAsB,aAAA,CAAC7B,WAAW;IACVmC,aAAa,EAAEf,IAAK;IACpBgB,SAAS,EAAEd,IAAI,aAAJA,IAAI,gBAAAR,CAAA,GAAJQ,IAAI,CAAEK,oBAAoB,CAAE,CAAC,CAAC,cAAAb,CAAA,uBAA9BA,CAAA,CAAgCuB;EAAU,CACtD,CAEA,CACL,CAAC;AAEP,CAAC;AAED,SAAS1B,aAAa","ignoreList":[]}
1
+ {"version":3,"file":"ChartWithData.js","names":["useQuery","ChartError","LastUpdated","Size","Spinner","SpinnerSize","Tooltip","useLayoutProvider","useLocale","React","getCurrencyPowerBalance","Chart","CURRENCY_POWER_BALANCE_TOOLTIP_ID","ChartWithData","_ref","timeUnit","currencies","size","isDesktop","DESKTOP","lang","loading","data","error","variables","fetchPolicy","showError","currencyPowerBalance","length","createElement","Fragment","className","lg","values","id","labelCallback","timestamp","updatedAt"],"sources":["../../../src/CurrencyPowerBalanceWidget/ChartWithData.tsx"],"sourcesContent":["import { useQuery } from '@apollo/client';\nimport {\n ChartError,\n LastUpdated,\n Size,\n Spinner,\n SpinnerSize,\n Tooltip,\n useLayoutProvider,\n} from '@oanda/labs-widget-common';\nimport { useLocale } from '@oanda/mono-i18n';\nimport React from 'react';\n\nimport { getCurrencyPowerBalance } from '../gql/getCurrencyPowerBalance';\nimport type {\n GetCurrencyPowerBalanceQuery,\n GetCurrencyPowerBalanceQueryVariables,\n} from '../gql/types/graphql';\nimport { Chart } from './components/Chart';\nimport { CURRENCY_POWER_BALANCE_TOOLTIP_ID } from './constants';\nimport type { ChartWithDataProps } from './types';\n\nconst ChartWithData = ({ timeUnit, currencies }: ChartWithDataProps) => {\n const { size } = useLayoutProvider();\n const isDesktop = size === Size.DESKTOP;\n const { lang } = useLocale();\n const { loading, data, error } = useQuery<\n GetCurrencyPowerBalanceQuery,\n GetCurrencyPowerBalanceQueryVariables\n >(getCurrencyPowerBalance, {\n variables: {\n timeUnit,\n },\n fetchPolicy: 'cache-and-network',\n });\n\n const showError =\n data?.currencyPowerBalance?.length === 0 ||\n error ||\n (currencies && (currencies.length === 0 || currencies.length === 1));\n\n return (\n <>\n {loading && (\n <div className=\"lw-mb-[50px] lw-flex lw-h-[375px] lw-w-full lw-items-center lw-border lw-border-solid lw-border-border-primary\">\n <Spinner size={SpinnerSize.lg} />\n </div>\n )}\n {!loading && !showError && (\n <Chart\n currencies={currencies}\n timeUnit={timeUnit}\n values={data?.currencyPowerBalance!}\n />\n )}\n {!loading && showError && (\n <div className=\"lw-flex lw-h-[375px] lw-w-full lw-items-center lw-border lw-border-solid lw-border-border-primary\">\n <ChartError />\n </div>\n )}\n {isDesktop && <Tooltip id={CURRENCY_POWER_BALANCE_TOOLTIP_ID} />}\n <div className=\"lw-mt-2 lw-h-8\">\n {!loading && !showError && (\n <LastUpdated\n labelCallback={lang}\n timestamp={data?.currencyPowerBalance![0]?.updatedAt}\n />\n )}\n </div>\n </>\n );\n};\n\nexport { ChartWithData };\n"],"mappings":"AAAA,SAASA,QAAQ,QAAQ,gBAAgB;AACzC,SACEC,UAAU,EACVC,WAAW,EACXC,IAAI,EACJC,OAAO,EACPC,WAAW,EACXC,OAAO,EACPC,iBAAiB,QACZ,2BAA2B;AAClC,SAASC,SAAS,QAAQ,kBAAkB;AAC5C,OAAOC,KAAK,MAA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C;EAAmG,GAChHtB,KAAA,CAAAoB,aAAA,CAAC5B,UAAU,MAAE,CACV,CACN,EACAiB,SAAS,IAAIT,KAAA,CAAAoB,aAAA,CAACvB,OAAO;IAAC4B,EAAE,EAAEtB;EAAkC,CAAE,CAAC,EAChEH,KAAA,CAAAoB,aAAA;IAAKE,SAAS,EAAC;EAAgB,GAC5B,CAACV,OAAO,IAAI,CAACK,SAAS,IACrBjB,KAAA,CAAAoB,aAAA,CAAC3B,WAAW;IACViC,aAAa,EAAEf,IAAK;IACpBgB,SAAS,EAAEd,IAAI,EAAEK,oBAAoB,CAAE,CAAC,CAAC,EAAEU;EAAU,CACtD,CAEA,CACL,CAAC;AAEP,CAAC;AAED,SAASxB,aAAa","ignoreList":[]}
@@ -34,9 +34,9 @@ const Main = _ref => {
34
34
  key: label,
35
35
  className: "lw-mb-6 lw-flex lw-justify-center lw-font-sans lw-text-lg lw-font-bold",
36
36
  "data-testid": "time-unit-label"
37
- }, tooltipLabel ? React.createElement("span", null, "".concat(lang(tooltipLabel.translationKey, {
37
+ }, tooltipLabel ? React.createElement("span", null, `${lang(tooltipLabel.translationKey, {
38
38
  count: tooltipLabel.count
39
- }))) : React.createElement("span", null, "".concat(lang(label))));
39
+ })}`) : React.createElement("span", null, `${lang(label)}`));
40
40
  })) : React.createElement(TimeUnitSwitch, {
41
41
  callback: setSelectedTimeUnit,
42
42
  options: timeUnitConfig,
@@ -1 +1 @@
1
- {"version":3,"file":"Main.js","names":["useLayoutProvider","useLocale","React","useState","CurrencyPowerBalanceTimeUnit","ChartWithData","TimeUnitSwitch","timeUnitConfig","Main","_ref","timeUnit","currencies","size","lang","selectedTimeUnit","setSelectedTimeUnit","CurrentDay","createElement","Fragment","className","filter","_ref2","value","map","_ref3","tooltipLabel","label","key","concat","translationKey","count","callback","options","selected"],"sources":["../../../src/CurrencyPowerBalanceWidget/Main.tsx"],"sourcesContent":["import { useLayoutProvider } from '@oanda/labs-widget-common';\nimport { useLocale } from '@oanda/mono-i18n';\nimport React, { useState } from 'react';\n\nimport { CurrencyPowerBalanceTimeUnit } from '../gql/types/graphql';\nimport { ChartWithData } from './ChartWithData';\nimport { TimeUnitSwitch } from './components/TimeUnitSwitch';\nimport { timeUnitConfig } from './config';\nimport type { MainProps } from './types';\n\nconst Main = ({ timeUnit, currencies }: MainProps) => {\n const { size } = useLayoutProvider();\n const { lang } = useLocale();\n const [selectedTimeUnit, setSelectedTimeUnit] = useState(\n timeUnit || CurrencyPowerBalanceTimeUnit.CurrentDay\n );\n return (\n <>\n {size && (\n <div\n className=\"lw-flex lw-flex-col lw-text-sm lw-tracking-normal\"\n data-testid=\"currency-power-balance-wrapper\"\n >\n {timeUnit && currencies ? (\n <>\n {timeUnitConfig\n .filter(({ value }) => value === selectedTimeUnit)\n .map(({ tooltipLabel, label }) => (\n <div\n key={label}\n className=\"lw-mb-6 lw-flex lw-justify-center lw-font-sans lw-text-lg lw-font-bold\"\n data-testid=\"time-unit-label\"\n >\n {tooltipLabel ? (\n <span>{`${lang(tooltipLabel!.translationKey, { count: tooltipLabel!.count })}`}</span>\n ) : (\n <span>{`${lang(label)}`}</span>\n )}\n </div>\n ))}\n </>\n ) : (\n <TimeUnitSwitch\n callback={setSelectedTimeUnit}\n options={timeUnitConfig}\n selected={selectedTimeUnit}\n />\n )}\n <ChartWithData\n currencies={timeUnit && currencies}\n timeUnit={selectedTimeUnit}\n />\n </div>\n )}\n </>\n );\n};\n\nexport { Main };\n"],"mappings":"AAAA,SAASA,iBAAiB,QAAQ,2BAA2B;AAC7D,SAASC,SAAS,QAAQ,kBAAkB;AAC5C,OAAOC,KAAK,IAAIC,QAAQ,QAAQ,OAAO;AAEvC,SAASC,4BAA4B,QAAQ,sBAAsB;AACnE,SAASC,aAAa,QAAQ,iBAAiB;AAC/C,SAASC,cAAc,QAAQ,6BAA6B;AAC5D,SAASC,cAAc,QAAQ,UAAU;AAGzC,MAAMC,IAAI,GAAGC,IAAA,IAAyC;EAAA,IAAxC;IAAEC,QAA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F,EACDZ,KAAA,CAAAe,aAAA,CAACZ,aAAa;IACZM,UAAU,EAAED,QAAQ,IAAIC,UAAW;IACnCD,QAAQ,EAAEI;EAAiB,CAC5B,CACE,CAEP,CAAC;AAEP,CAAC;AAED,SAASN,IAAI","ignoreList":[]}
1
+ {"version":3,"file":"Main.js","names":["useLayoutProvider","useLocale","React","useState","CurrencyPowerBalanceTimeUnit","ChartWithData","TimeUnitSwitch","timeUnitConfig","Main","_ref","timeUnit","currencies","size","lang","selectedTimeUnit","setSelectedTimeUnit","CurrentDay","createElement","Fragment","className","filter","_ref2","value","map","_ref3","tooltipLabel","label","key","translationKey","count","callback","options","selected"],"sources":["../../../src/CurrencyPowerBalanceWidget/Main.tsx"],"sourcesContent":["import { useLayoutProvider } from '@oanda/labs-widget-common';\nimport { useLocale } from '@oanda/mono-i18n';\nimport React, { useState } from 'react';\n\nimport { CurrencyPowerBalanceTimeUnit } from '../gql/types/graphql';\nimport { ChartWithData } from './ChartWithData';\nimport { TimeUnitSwitch } from './components/TimeUnitSwitch';\nimport { timeUnitConfig } from './config';\nimport type { MainProps } from './types';\n\nconst Main = ({ timeUnit, currencies }: MainProps) => {\n const { size } = useLayoutProvider();\n const { lang } = useLocale();\n const [selectedTimeUnit, setSelectedTimeUnit] = useState(\n timeUnit || CurrencyPowerBalanceTimeUnit.CurrentDay\n );\n return (\n <>\n {size && (\n <div\n className=\"lw-flex lw-flex-col lw-text-sm lw-tracking-normal\"\n data-testid=\"currency-power-balance-wrapper\"\n >\n {timeUnit && currencies ? (\n <>\n {timeUnitConfig\n .filter(({ value }) => value === selectedTimeUnit)\n .map(({ tooltipLabel, label }) => (\n <div\n key={label}\n className=\"lw-mb-6 lw-flex lw-justify-center lw-font-sans lw-text-lg lw-font-bold\"\n data-testid=\"time-unit-label\"\n >\n {tooltipLabel ? (\n <span>{`${lang(tooltipLabel!.translationKey, { count: tooltipLabel!.count })}`}</span>\n ) : (\n <span>{`${lang(label)}`}</span>\n )}\n </div>\n ))}\n </>\n ) : (\n <TimeUnitSwitch\n callback={setSelectedTimeUnit}\n options={timeUnitConfig}\n selected={selectedTimeUnit}\n />\n )}\n <ChartWithData\n currencies={timeUnit && currencies}\n timeUnit={selectedTimeUnit}\n />\n </div>\n )}\n </>\n );\n};\n\nexport { Main };\n"],"mappings":"AAAA,SAASA,iBAAiB,QAAQ,2BAA2B;AAC7D,SAASC,SAAS,QAAQ,kBAAkB;AAC5C,OAAOC,KAAK,IAAIC,QAAQ,QAAQ,OAAO;AAEvC,SAASC,4BAA4B,QAAQ,sBAAsB;AACnE,SAASC,aAAa,QAAQ,iBAAiB;AAC/C,SAASC,cAAc,QAAQ,6BAA6B;AAC5D,SAASC,cAAc,QAAQ,UAAU;AAGzC,MAAMC,IAAI,GAAGC,IAAA,IAAyC;EAAA,IAAxC;IAAEC,QAAQ;IAAEC;EAAsB,CAAC,GAAAF,IAAA;EAC/C,MAAM;IAAEG;EAAK,CAAC,GAAGZ,iBAAiB,CAAC,CAAC;EACpC,MAAM;IAAEa;EAAK,CAAC,GAAGZ,SAAS,CAAC,CAAC;EAC5B,MAAM,CAACa,gBAAgB,EAAEC,mBAAmB,CAAC,GAAGZ,QAAQ,CACtDO,QAAQ,IAAIN,4BAA4B,CAACY,UAC3C,CAAC;EACD,OACEd,KAAA,CAAAe,aAAA,CAAAf,KAAA,CAAAgB,QAAA,QACGN,IAAI,IACHV,KAAA,CAAAe,aAAA;IACEE,SAAS,EAAC,mDAAmD;IAC7D,eAAY;EAAgC,GAE3CT,QAAQ,IAAIC,UAAU,GACrBT,KAAA,CAAAe,aAAA,CAAAf,KAAA,CAAAgB,QAAA,QACGX,cAAc,CACZa,MAAM,CAACC,KAAA;IAAA,IAAC;MAAEC;IAAM,CAAC,GAAAD,KAAA;IAAA,OAAKC,KAAK,KAAKR,gBAAgB;EAAA,EAAC,CACjDS,GAAG,CAACC,KAAA;IAAA,IAAC;MAAEC,YAAY;MAAEC;IAAM,CAAC,GAAAF,KAAA;IAAA,OAC3BtB,KAAA,CAAAe,aAAA;MACEU,GAAG,EAAED,KAAM;MACXP,SAAS,EAAC,wEAAwE;MAClF,eAAY;IAAiB,GAE5BM,YAAY,GACXvB,KAAA,CAAAe,aAAA,eAAO,GAAGJ,IAAI,CAACY,YAAY,CAAEG,cAAc,EAAE;MAAEC,KAAK,EAAEJ,YAAY,CAAEI;IAAM,CAAC,CAAC,EAAS,CAAC,GAEtF3B,KAAA,CAAAe,aAAA,eAAO,GAAGJ,IAAI,CAACa,KAAK,CAAC,EAAS,CAE7B,CAAC;EAAA,CACP,CACH,CAAC,GAEHxB,KAAA,CAAAe,aAAA,CAACX,cAAc;IACbwB,QAAQ,EAAEf,mBAAoB;IAC9BgB,OAAO,EAAExB,cAAe;IACxByB,QAAQ,EAAElB;EAAiB,CAC5B,CACF,EACDZ,KAAA,CAAAe,aAAA,CAACZ,aAAa;IACZM,UAAU,EAAED,QAAQ,IAAIC,UAAW;IACnCD,QAAQ,EAAEI;EAAiB,CAC5B,CACE,CAEP,CAAC;AAEP,CAAC;AAED,SAASN,IAAI","ignoreList":[]}
@@ -44,7 +44,7 @@ const Chart = _ref => {
44
44
  echarts: echarts,
45
45
  option: getOption(chartData, timeUnit, isDark, lang),
46
46
  style: {
47
- height: "".concat(CHART_HEIGHT, "px"),
47
+ height: `${CHART_HEIGHT}px`,
48
48
  width: '100%'
49
49
  },
50
50
  theme: isDark ? 'dark_theme' : 'light_theme'
@@ -1 +1 @@
1
- {"version":3,"file":"Chart.js","names":["getChartTheme","Size","Theme","useLayoutProvider","useLocale","LineChart","GraphicComponent","GridSimpleComponent","LegendPlainComponent","MarkLineComponent","TooltipComponent","echarts","CanvasRenderer","ReactEChartsCore","React","useEffect","useRef","getOption","getResponsiveOption","CHART_HEIGHT","use","registerTheme","Dark","Light","Chart","_ref","values","timeUnit","currencies","lang","isDark","size","isDesktop","DESKTOP","isMobile","MOBILE","echartRef","chartData","filter","_ref2","currency","includes","current","echartInstance","getEchartsInstance","setOption","createElement","ref","option","style","height","concat","width","theme"],"sources":["../../../../../src/CurrencyPowerBalanceWidget/components/Chart/Chart.tsx"],"sourcesContent":["import {\n getChartTheme,\n Size,\n Theme,\n useLayoutProvider,\n} from '@oanda/labs-widget-common';\nimport { useLocale } from '@oanda/mono-i18n';\nimport { LineChart } from 'echarts/charts';\nimport {\n GraphicComponent,\n GridSimpleComponent,\n LegendPlainComponent,\n MarkLineComponent,\n TooltipComponent,\n} from 'echarts/components';\nimport * as echarts from 'echarts/core';\nimport { CanvasRenderer } from 'echarts/renderers';\nimport ReactEChartsCore from 'echarts-for-react/lib/core';\nimport React, { useEffect, useRef } from 'react';\n\nimport { getOption, getResponsiveOption } from './options';\nimport { CHART_HEIGHT } from './options/constants';\nimport type { ChartProps } from './types';\n\necharts.use([\n GridSimpleComponent,\n GraphicComponent,\n TooltipComponent,\n LegendPlainComponent,\n LineChart,\n CanvasRenderer,\n MarkLineComponent,\n]);\n\necharts.registerTheme('dark_theme', getChartTheme(Theme.Dark));\necharts.registerTheme('light_theme', getChartTheme(Theme.Light));\n\nconst Chart = ({ values, timeUnit, currencies }: ChartProps) => {\n const { lang } = useLocale();\n const { isDark, size } = useLayoutProvider();\n const isDesktop = size === Size.DESKTOP;\n const isMobile = size === Size.MOBILE;\n\n const echartRef = useRef<ReactEChartsCore | null>(null);\n\n const chartData = currencies\n ? values.filter(({ currency }) => currencies.includes(currency))\n : values;\n\n useEffect(() => {\n if (echartRef.current) {\n const echartInstance = echartRef.current.getEchartsInstance();\n\n echartInstance.setOption(\n getResponsiveOption(isDesktop, isMobile, isDark)\n );\n }\n }, [echartRef, isDesktop, isMobile, isDark]);\n\n return (\n <ReactEChartsCore\n ref={echartRef}\n echarts={echarts}\n option={getOption(chartData, timeUnit, isDark, lang)}\n style={{\n height: `${CHART_HEIGHT}px`,\n width: '100%',\n }}\n theme={isDark ? 'dark_theme' : 'light_theme'}\n />\n );\n};\n\nexport { Chart };\n"],"mappings":"AAAA,SACEA,aAAa,EACbC,IAAI,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T,UAAU,GACxBF,MAAM,CAACY,MAAM,CAACC,KAAA;IAAA,IAAC;MAAEC;IAAS,CAAC,GAAAD,KAAA;IAAA,OAAKX,UAAU,CAACa,QAAQ,CAACD,QAAQ,CAAC;EAAA,EAAC,GAC9Dd,MAAM;EAEVX,SAAS,CAAC,MAAM;IACd,IAAIqB,SAAS,CAACM,OAAO,EAAE;MACrB,MAAMC,cAAc,GAAGP,SAAS,CAACM,OAAO,CAACE,kBAAkB,CAAC,CAAC;MAE7DD,cAAc,CAACE,SAAS,CACtB3B,mBAAmB,CAACc,SAAS,EAAEE,QAAQ,EAAEJ,MAAM,CACjD,CAAC;IACH;EACF,CAAC,EAAE,CAACM,SAAS,EAAEJ,SAAS,EAAEE,QAAQ,EAAEJ,MAAM,CAAC,CAAC;EAE5C,OACEhB,KAAA,CAAAgC,aAAA,CAACjC,gBAAgB;IACfkC,GAAG,EAAEX,SAAU;IACfzB,OAAO,EAAEA,OAAQ;IACjBqC,MAAM,EAAE/B,SAAS,CAACoB,SAAS,EAAEV,QAAQ,EAAEG,MAAM,EAAED,IAAI,CAAE;IACrDoB,KAAK,EAAE;MACLC,MAAM,KAAAC,MAAA,CAAKhC,YAAY,OAAI;MAC3BiC,KAAK,EAAE;IACT,CAAE;IACFC,KAAK,EAAEvB,MAAM,GAAG,YAAY,GAAG;EAAc,CAC9C,CAAC;AAEN,CAAC;AAED,SAASN,KAAK","ignoreList":[]}
1
+ {"version":3,"file":"Chart.js","names":["getChartTheme","Size","Theme","useLayoutProvider","useLocale","LineChart","GraphicComponent","GridSimpleComponent","LegendPlainComponent","MarkLineComponent","TooltipComponent","echarts","CanvasRenderer","ReactEChartsCore","React","useEffect","useRef","getOption","getResponsiveOption","CHART_HEIGHT","use","registerTheme","Dark","Light","Chart","_ref","values","timeUnit","currencies","lang","isDark","size","isDesktop","DESKTOP","isMobile","MOBILE","echartRef","chartData","filter","_ref2","currency","includes","current","echartInstance","getEchartsInstance","setOption","createElement","ref","option","style","height","width","theme"],"sources":["../../../../../src/CurrencyPowerBalanceWidget/components/Chart/Chart.tsx"],"sourcesContent":["import {\n getChartTheme,\n Size,\n Theme,\n useLayoutProvider,\n} from '@oanda/labs-widget-common';\nimport { useLocale } from '@oanda/mono-i18n';\nimport { LineChart } from 'echarts/charts';\nimport {\n GraphicComponent,\n GridSimpleComponent,\n LegendPlainComponent,\n MarkLineComponent,\n TooltipComponent,\n} from 'echarts/components';\nimport * as echarts from 'echarts/core';\nimport { CanvasRenderer } from 'echarts/renderers';\nimport ReactEChartsCore from 'echarts-for-react/lib/core';\nimport React, { useEffect, useRef } from 'react';\n\nimport { getOption, getResponsiveOption } from './options';\nimport { CHART_HEIGHT } from './options/constants';\nimport type { ChartProps } from './types';\n\necharts.use([\n GridSimpleComponent,\n GraphicComponent,\n TooltipComponent,\n LegendPlainComponent,\n LineChart,\n CanvasRenderer,\n MarkLineComponent,\n]);\n\necharts.registerTheme('dark_theme', getChartTheme(Theme.Dark));\necharts.registerTheme('light_theme', getChartTheme(Theme.Light));\n\nconst Chart = ({ values, timeUnit, currencies }: ChartProps) => {\n const { lang } = useLocale();\n const { isDark, size } = useLayoutProvider();\n const isDesktop = size === Size.DESKTOP;\n const isMobile = size === Size.MOBILE;\n\n const echartRef = useRef<ReactEChartsCore | null>(null);\n\n const chartData = currencies\n ? values.filter(({ currency }) => currencies.includes(currency))\n : values;\n\n useEffect(() => {\n if (echartRef.current) {\n const echartInstance = echartRef.current.getEchartsInstance();\n\n echartInstance.setOption(\n getResponsiveOption(isDesktop, isMobile, isDark)\n );\n }\n }, [echartRef, isDesktop, isMobile, isDark]);\n\n return (\n <ReactEChartsCore\n ref={echartRef}\n echarts={echarts}\n option={getOption(chartData, timeUnit, isDark, lang)}\n style={{\n height: `${CHART_HEIGHT}px`,\n width: '100%',\n }}\n theme={isDark ? 'dark_theme' : 'light_theme'}\n />\n );\n};\n\nexport { Chart };\n"],"mappings":"AAAA,SACEA,aAAa,EACbC,IAAI,EACJC,KAAK,EACLC,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AM,CAACY,MAAM,CAACC,KAAA;IAAA,IAAC;MAAEC;IAAS,CAAC,GAAAD,KAAA;IAAA,OAAKX,UAAU,CAACa,QAAQ,CAACD,QAAQ,CAAC;EAAA,EAAC,GAC9Dd,MAAM;EAEVX,SAAS,CAAC,MAAM;IACd,IAAIqB,SAAS,CAACM,OAAO,EAAE;MACrB,MAAMC,cAAc,GAAGP,SAAS,CAACM,OAAO,CAACE,kBAAkB,CAAC,CAAC;MAE7DD,cAAc,CAACE,SAAS,CACtB3B,mBAAmB,CAACc,SAAS,EAAEE,QAAQ,EAAEJ,MAAM,CACjD,CAAC;IACH;EACF,CAAC,EAAE,CAACM,SAAS,EAAEJ,SAAS,EAAEE,QAAQ,EAAEJ,MAAM,CAAC,CAAC;EAE5C,OACEhB,KAAA,CAAAgC,aAAA,CAACjC,gBAAgB;IACfkC,GAAG,EAAEX,SAAU;IACfzB,OAAO,EAAEA,OAAQ;IACjBqC,MAAM,EAAE/B,SAAS,CAACoB,SAAS,EAAEV,QAAQ,EAAEG,MAAM,EAAED,IAAI,CAAE;IACrDoB,KAAK,EAAE;MACLC,MAAM,EAAE,GAAG/B,YAAY,IAAI;MAC3BgC,KAAK,EAAE;IACT,CAAE;IACFC,KAAK,EAAEtB,MAAM,GAAG,YAAY,GAAG;EAAc,CAC9C,CAAC;AAEN,CAAC;AAED,SAASN,KAAK","ignoreList":[]}
@@ -7,20 +7,20 @@ const getDateAndTime = param => {
7
7
  time: dateAndTime[1].substring(0, 5)
8
8
  };
9
9
  };
10
- const dateFormat = date => "".concat(new Date(date).toLocaleDateString(undefined, {
10
+ const dateFormat = date => `${new Date(date).toLocaleDateString(undefined, {
11
11
  month: 'numeric',
12
12
  day: 'numeric'
13
- }));
13
+ })}`;
14
14
  const dateTimeFormat = _ref => {
15
15
  let {
16
16
  date,
17
17
  time
18
18
  } = _ref;
19
- return "".concat(new Date(date).toLocaleDateString(undefined, {
19
+ return `${new Date(date).toLocaleDateString(undefined, {
20
20
  year: 'numeric',
21
21
  month: 'numeric',
22
22
  day: 'numeric'
23
- }), ", ").concat(time, " UTC");
23
+ })}, ${time} UTC`;
24
24
  };
25
25
  const isMonthWeek = timeUnit => timeUnit === CurrencyPowerBalanceTimeUnit.M3 || timeUnit === CurrencyPowerBalanceTimeUnit.M1 || timeUnit === CurrencyPowerBalanceTimeUnit.W1;
26
26
  const xAxisLabelFormatter = (label, timeUnit) => {
@@ -48,9 +48,18 @@ const tooltipFormatter = values => {
48
48
  seriesName,
49
49
  value
50
50
  } = _ref4;
51
- return "<div style=\"display:flex;align-items:center;\">\n <div style=\"display:flex;align-items:center;width:50px;margin-right:10px;\">\n ".concat(marker, "\n <span>").concat(seriesName, "</span>\n </div>\n <span>").concat(value[1], "</span>\n </div>");
51
+ return `<div style="display:flex;align-items:center;">
52
+ <div style="display:flex;align-items:center;width:50px;margin-right:10px;">
53
+ ${marker}
54
+ <span>${seriesName}</span>
55
+ </div>
56
+ <span>${value[1]}</span>
57
+ </div>`;
52
58
  });
53
- return "<div style=\"display:flex; flex-direction:column;\">\n <span style=\"margin-bottom:5px;\">".concat(date, "</span>\n ").concat(row.join('\n'), "\n </div>");
59
+ return `<div style="display:flex; flex-direction:column;">
60
+ <span style="margin-bottom:5px;">${date}</span>
61
+ ${row.join('\n')}
62
+ </div>`;
54
63
  };
55
64
  const formatLegendData = values => {
56
65
  const dataCurrencies = values.map(_ref5 => {