@oanda/labs-currency-power-balance-widget 1.0.2 → 1.0.4

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 (74) hide show
  1. package/CHANGELOG.md +36 -0
  2. package/dist/main/CurrencyPowerBalanceWidget/ChartWithData.js +2 -1
  3. package/dist/main/CurrencyPowerBalanceWidget/ChartWithData.js.map +1 -1
  4. package/dist/main/CurrencyPowerBalanceWidget/CurrencyPowerBalance.js +8 -2
  5. package/dist/main/CurrencyPowerBalanceWidget/CurrencyPowerBalance.js.map +1 -1
  6. package/dist/main/CurrencyPowerBalanceWidget/Tool.js +7 -2
  7. package/dist/main/CurrencyPowerBalanceWidget/Tool.js.map +1 -1
  8. package/dist/main/CurrencyPowerBalanceWidget/components/Chart/options/formatters.js +1 -1
  9. package/dist/main/CurrencyPowerBalanceWidget/components/Chart/options/formatters.js.map +1 -1
  10. package/dist/main/CurrencyPowerBalanceWidget/components/Chart/options/getOption.js +2 -1
  11. package/dist/main/CurrencyPowerBalanceWidget/components/Chart/options/getOption.js.map +1 -1
  12. package/dist/main/CurrencyPowerBalanceWidget/components/TimeUnitSwitch/TimeUnitSelect.js +3 -2
  13. package/dist/main/CurrencyPowerBalanceWidget/components/TimeUnitSwitch/TimeUnitSelect.js.map +1 -1
  14. package/dist/main/CurrencyPowerBalanceWidget/components/TimeUnitSwitch/TimeUnitSwitch.js +2 -1
  15. package/dist/main/CurrencyPowerBalanceWidget/components/TimeUnitSwitch/TimeUnitSwitch.js.map +1 -1
  16. package/dist/main/CurrencyPowerBalanceWidget/config.js +3 -3
  17. package/dist/main/CurrencyPowerBalanceWidget/config.js.map +1 -1
  18. package/dist/main/CurrencyPowerBalanceWidget/render.js +8 -1
  19. package/dist/main/CurrencyPowerBalanceWidget/render.js.map +1 -1
  20. package/dist/main/CurrencyPowerBalanceWidget/types.js.map +1 -1
  21. package/dist/main/translations/index.js +19 -0
  22. package/dist/main/translations/index.js.map +1 -0
  23. package/dist/main/translations/sources/en.json +18 -0
  24. package/dist/main/translations/sources/zh_TW.json +18 -0
  25. package/dist/main/translations/translations.js +25 -0
  26. package/dist/main/translations/translations.js.map +1 -0
  27. package/dist/module/CurrencyPowerBalanceWidget/ChartWithData.js +2 -1
  28. package/dist/module/CurrencyPowerBalanceWidget/ChartWithData.js.map +1 -1
  29. package/dist/module/CurrencyPowerBalanceWidget/CurrencyPowerBalance.js +9 -3
  30. package/dist/module/CurrencyPowerBalanceWidget/CurrencyPowerBalance.js.map +1 -1
  31. package/dist/module/CurrencyPowerBalanceWidget/Tool.js +7 -2
  32. package/dist/module/CurrencyPowerBalanceWidget/Tool.js.map +1 -1
  33. package/dist/module/CurrencyPowerBalanceWidget/components/Chart/options/formatters.js +1 -1
  34. package/dist/module/CurrencyPowerBalanceWidget/components/Chart/options/formatters.js.map +1 -1
  35. package/dist/module/CurrencyPowerBalanceWidget/components/Chart/options/getOption.js +2 -1
  36. package/dist/module/CurrencyPowerBalanceWidget/components/Chart/options/getOption.js.map +1 -1
  37. package/dist/module/CurrencyPowerBalanceWidget/components/TimeUnitSwitch/TimeUnitSelect.js +3 -2
  38. package/dist/module/CurrencyPowerBalanceWidget/components/TimeUnitSwitch/TimeUnitSelect.js.map +1 -1
  39. package/dist/module/CurrencyPowerBalanceWidget/components/TimeUnitSwitch/TimeUnitSwitch.js +2 -1
  40. package/dist/module/CurrencyPowerBalanceWidget/components/TimeUnitSwitch/TimeUnitSwitch.js.map +1 -1
  41. package/dist/module/CurrencyPowerBalanceWidget/config.js +3 -3
  42. package/dist/module/CurrencyPowerBalanceWidget/config.js.map +1 -1
  43. package/dist/module/CurrencyPowerBalanceWidget/render.js +8 -1
  44. package/dist/module/CurrencyPowerBalanceWidget/render.js.map +1 -1
  45. package/dist/module/CurrencyPowerBalanceWidget/types.js.map +1 -1
  46. package/dist/module/translations/index.js +12 -0
  47. package/dist/module/translations/index.js.map +1 -0
  48. package/dist/module/translations/sources/en.json +18 -0
  49. package/dist/module/translations/sources/zh_TW.json +18 -0
  50. package/dist/module/translations/translations.js +19 -0
  51. package/dist/module/translations/translations.js.map +1 -0
  52. package/dist/types/CurrencyPowerBalanceWidget/CurrencyPowerBalance.d.ts +1 -1
  53. package/dist/types/CurrencyPowerBalanceWidget/components/Chart/options/getOption.d.ts +1 -0
  54. package/dist/types/CurrencyPowerBalanceWidget/components/TimeUnitSwitch/TimeUnitSelect.d.ts +1 -1
  55. package/dist/types/CurrencyPowerBalanceWidget/types.d.ts +3 -0
  56. package/dist/types/translations/index.d.ts +4 -0
  57. package/dist/types/translations/translations.d.ts +18 -0
  58. package/lokalise.config.json +18 -0
  59. package/package.json +4 -3
  60. package/src/CurrencyPowerBalanceWidget/ChartWithData.tsx +1 -0
  61. package/src/CurrencyPowerBalanceWidget/CurrencyPowerBalance.tsx +9 -5
  62. package/src/CurrencyPowerBalanceWidget/Tool.tsx +4 -1
  63. package/src/CurrencyPowerBalanceWidget/components/Chart/options/formatters.ts +1 -1
  64. package/src/CurrencyPowerBalanceWidget/components/Chart/options/getOption.ts +1 -0
  65. package/src/CurrencyPowerBalanceWidget/components/TimeUnitSwitch/TimeUnitSelect.tsx +5 -2
  66. package/src/CurrencyPowerBalanceWidget/components/TimeUnitSwitch/TimeUnitSwitch.tsx +1 -0
  67. package/src/CurrencyPowerBalanceWidget/config.ts +3 -3
  68. package/src/CurrencyPowerBalanceWidget/render.tsx +5 -0
  69. package/src/CurrencyPowerBalanceWidget/types.ts +3 -0
  70. package/src/translations/index.ts +13 -0
  71. package/src/translations/sources/en.json +18 -0
  72. package/src/translations/sources/zh_TW.json +18 -0
  73. package/src/translations/translations.ts +18 -0
  74. package/test/chartFormatters.test.ts +5 -5
package/CHANGELOG.md CHANGED
@@ -3,6 +3,42 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## 1.0.4 (2024-01-11)
7
+
8
+
9
+
10
+ ## 1.0.64 (2024-01-11)
11
+
12
+
13
+
14
+ ## 1.0.63 (2024-01-11)
15
+
16
+
17
+
18
+ ## 1.0.62 (2024-01-10)
19
+
20
+ **Note:** Version bump only for package @oanda/labs-currency-power-balance-widget
21
+
22
+
23
+
24
+
25
+
26
+ ## 1.0.3 (2024-01-11)
27
+
28
+
29
+
30
+ ## 1.0.63 (2024-01-11)
31
+
32
+
33
+
34
+ ## 1.0.62 (2024-01-10)
35
+
36
+ **Note:** Version bump only for package @oanda/labs-currency-power-balance-widget
37
+
38
+
39
+
40
+
41
+
6
42
  ## 1.0.2 (2024-01-11)
7
43
 
8
44
 
@@ -25,7 +25,8 @@ const ChartWithData = _ref => {
25
25
  } = (0, _client.useQuery)(_getCurrencyPowerBalance.getCurrencyPowerBalance, {
26
26
  variables: {
27
27
  timeUnit
28
- }
28
+ },
29
+ fetchPolicy: 'cache-and-network'
29
30
  });
30
31
  const showChart = (data === null || data === void 0 ? void 0 : data.currencyPowerBalance) && (data === null || data === void 0 || (_data$currencyPowerBa = data.currencyPowerBalance) === null || _data$currencyPowerBa === void 0 ? void 0 : _data$currencyPowerBa.length) > 0;
31
32
  const showError = (data === null || data === void 0 || (_data$currencyPowerBa2 = data.currencyPowerBalance) === null || _data$currencyPowerBa2 === void 0 ? void 0 : _data$currencyPowerBa2.length) === 0 || error;
@@ -1 +1 @@
1
- {"version":3,"file":"ChartWithData.js","names":["_react","_interopRequireDefault","require","_client","_labsWidgetCommon","_usehooksTs","_Chart","_constants","_getCurrencyPowerBalance","obj","__esModule","default","ChartWithData","_ref","_data$currencyPowerBa","_data$currencyPowerBa2","timeUnit","isDesktop","useMediaQuery","loading","data","error","useQuery","getCurrencyPowerBalance","variables","showChart","currencyPowerBalance","length","showError","createElement","Fragment","className","Spinner","size","SpinnerSize","lg","Chart","values","ChartError","Tooltip","id","CURRENCY_POWER_BALANCE_TOOLTIP_ID","exports"],"sources":["../../../src/CurrencyPowerBalanceWidget/ChartWithData.tsx"],"sourcesContent":["import React from 'react';\nimport { useQuery } from '@apollo/client';\nimport {\n ChartError, Spinner, SpinnerSize, Tooltip,\n} from '@oanda/labs-widget-common';\nimport { useMediaQuery } from 'usehooks-ts';\nimport { Chart } from './components/Chart';\nimport { CURRENCY_POWER_BALANCE_TOOLTIP_ID } from './constants';\nimport { getCurrencyPowerBalance } from '../gql/getCurrencyPowerBalance';\nimport { ChartWithDataProps } from './types';\nimport { GetCurrencyPowerBalanceQuery, GetCurrencyPowerBalanceQueryVariables } from '../gql/types/graphql';\n\nconst ChartWithData = ({ timeUnit }: ChartWithDataProps) => {\n const isDesktop = useMediaQuery('(min-width: 768px)');\n const { loading, data, error } = useQuery<\n GetCurrencyPowerBalanceQuery,\n GetCurrencyPowerBalanceQueryVariables\n >(getCurrencyPowerBalance, {\n variables: {\n timeUnit,\n },\n });\n\n const showChart = data?.currencyPowerBalance && data?.currencyPowerBalance?.length > 0;\n const showError = data?.currencyPowerBalance?.length === 0 || error;\n\n return (\n <>\n {loading\n && (\n <div className=\"lw-flex lw-h-[425px] 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 && showChart && (\n <Chart values={data?.currencyPowerBalance!} timeUnit={timeUnit} />\n )}\n {!loading && showError && (\n <div className=\"lw-flex lw-h-[425px] lw-w-full lw-items-center lw-border lw-border-solid lw-border-border-primary\">\n <ChartError />\n </div>\n )}\n {isDesktop && <Tooltip id={CURRENCY_POWER_BALANCE_TOOLTIP_ID} />}\n </>\n );\n};\n\nexport { ChartWithData };\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,iBAAA,GAAAF,OAAA;AAGA,IAAAG,WAAA,GAAAH,OAAA;AACA,IAAAI,MAAA,GAAAJ,OAAA;AACA,IAAAK,UAAA,GAAAL,OAAA;AACA,IAAAM,wBAAA,GAAAN,OAAA;AAAyE,SAAAD,uB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I,aAAJA,IAAI,uBAAJA,IAAI,CAAEM,oBAAsB;IAACV,QAAQ,EAAEA;EAAS,CAAE,CAClE,EACA,CAACG,OAAO,IAAIS,SAAS,IACpB5B,MAAA,CAAAW,OAAA,CAAAkB,aAAA;IAAKE,SAAS,EAAC;EAAmG,GAChH/B,MAAA,CAAAW,OAAA,CAAAkB,aAAA,CAACzB,iBAAA,CAAAkC,UAAU,MAAE,CACV,CACN,EACArB,SAAS,IAAIjB,MAAA,CAAAW,OAAA,CAAAkB,aAAA,CAACzB,iBAAA,CAAAmC,OAAO;IAACC,EAAE,EAAEC;EAAkC,CAAE,CAC/D,CAAC;AAEP,CAAC;AAACC,OAAA,CAAA9B,aAAA,GAAAA,aAAA"}
1
+ {"version":3,"file":"ChartWithData.js","names":["_react","_interopRequireDefault","require","_client","_labsWidgetCommon","_usehooksTs","_Chart","_constants","_getCurrencyPowerBalance","obj","__esModule","default","ChartWithData","_ref","_data$currencyPowerBa","_data$currencyPowerBa2","timeUnit","isDesktop","useMediaQuery","loading","data","error","useQuery","getCurrencyPowerBalance","variables","fetchPolicy","showChart","currencyPowerBalance","length","showError","createElement","Fragment","className","Spinner","size","SpinnerSize","lg","Chart","values","ChartError","Tooltip","id","CURRENCY_POWER_BALANCE_TOOLTIP_ID","exports"],"sources":["../../../src/CurrencyPowerBalanceWidget/ChartWithData.tsx"],"sourcesContent":["import React from 'react';\nimport { useQuery } from '@apollo/client';\nimport {\n ChartError, Spinner, SpinnerSize, Tooltip,\n} from '@oanda/labs-widget-common';\nimport { useMediaQuery } from 'usehooks-ts';\nimport { Chart } from './components/Chart';\nimport { CURRENCY_POWER_BALANCE_TOOLTIP_ID } from './constants';\nimport { getCurrencyPowerBalance } from '../gql/getCurrencyPowerBalance';\nimport { ChartWithDataProps } from './types';\nimport { GetCurrencyPowerBalanceQuery, GetCurrencyPowerBalanceQueryVariables } from '../gql/types/graphql';\n\nconst ChartWithData = ({ timeUnit }: ChartWithDataProps) => {\n const isDesktop = useMediaQuery('(min-width: 768px)');\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 showChart = data?.currencyPowerBalance && data?.currencyPowerBalance?.length > 0;\n const showError = data?.currencyPowerBalance?.length === 0 || error;\n\n return (\n <>\n {loading\n && (\n <div className=\"lw-flex lw-h-[425px] 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 && showChart && (\n <Chart values={data?.currencyPowerBalance!} timeUnit={timeUnit} />\n )}\n {!loading && showError && (\n <div className=\"lw-flex lw-h-[425px] lw-w-full lw-items-center lw-border lw-border-solid lw-border-border-primary\">\n <ChartError />\n </div>\n )}\n {isDesktop && <Tooltip id={CURRENCY_POWER_BALANCE_TOOLTIP_ID} />}\n </>\n );\n};\n\nexport { ChartWithData };\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,iBAAA,GAAAF,OAAA;AAGA,IAAAG,WAAA,GAAAH,OAAA;AACA,IAAAI,MAAA,GAAAJ,OAAA;AACA,IAAAK,UAAA,GAAAL,OAAA;AACA,IAAAM,wBAAA,GAAAN,OAAA;AAAyE,SAAAD,uBAAAQ,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAIzE,MAAMG,aAAa,GAAGC,IAAA,IAAsC;EAAA,IAAAC,qBAAA,EAAAC,sBAAA;EAAA,IAArC;IAAEC;EAA6B,CAAC,GAAAH,IAAA;EACrD,MAAMI,SAAS,GAAG,IAAAC,yBAAa,EAAC,oBAAoB,CAAC;EACrD,MAAM;IAAEC,OAAO;IAAEC,IAAI;IAAEC;EAAM,CAAC,GAAG,IAAAC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B,aAAA,CAAC1B,iBAAA,CAAAoC,OAAO;IAACC,EAAE,EAAEC;EAAkC,CAAE,CAC/D,CAAC;AAEP,CAAC;AAACC,OAAA,CAAA/B,aAAA,GAAAA,aAAA"}
@@ -7,12 +7,15 @@ exports.CurrencyPowerBalance = void 0;
7
7
  var _react = _interopRequireDefault(require("react"));
8
8
  var _client = require("@apollo/client");
9
9
  var _labsWidgetCommon = require("@oanda/labs-widget-common");
10
+ var _monoI18n = require("@oanda/mono-i18n");
10
11
  var _Main = require("./Main");
12
+ var _translations = require("../translations");
11
13
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
12
14
  const CurrencyPowerBalance = _ref => {
13
15
  let {
14
16
  graphqlUrl,
15
- theme
17
+ theme,
18
+ locale
16
19
  } = _ref;
17
20
  const client = new _client.ApolloClient({
18
21
  uri: graphqlUrl,
@@ -20,9 +23,12 @@ const CurrencyPowerBalance = _ref => {
20
23
  });
21
24
  return _react.default.createElement(_labsWidgetCommon.ThemeProvider, {
22
25
  theme: theme
26
+ }, _react.default.createElement(_monoI18n.LocaleProvider, {
27
+ locale: (0, _labsWidgetCommon.getLocale)(locale),
28
+ translations: _translations.translations
23
29
  }, _react.default.createElement(_client.ApolloProvider, {
24
30
  client: client
25
- }, _react.default.createElement(_Main.Main, null)));
31
+ }, _react.default.createElement(_Main.Main, null))));
26
32
  };
27
33
  exports.CurrencyPowerBalance = CurrencyPowerBalance;
28
34
  //# sourceMappingURL=CurrencyPowerBalance.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"CurrencyPowerBalance.js","names":["_react","_interopRequireDefault","require","_client","_labsWidgetCommon","_Main","obj","__esModule","default","CurrencyPowerBalance","_ref","graphqlUrl","theme","client","ApolloClient","uri","cache","InMemoryCache","createElement","ThemeProvider","ApolloProvider","Main","exports"],"sources":["../../../src/CurrencyPowerBalanceWidget/CurrencyPowerBalance.tsx"],"sourcesContent":["import React from 'react';\nimport { ApolloClient, InMemoryCache, ApolloProvider } from '@apollo/client';\nimport { ThemeProvider } from '@oanda/labs-widget-common';\nimport { Main } from './Main';\nimport { CurrencyPowerBalanceConfig } from './types';\n\nconst CurrencyPowerBalance = ({\n graphqlUrl, theme,\n}: CurrencyPowerBalanceConfig) => {\n const client = new ApolloClient({\n uri: graphqlUrl,\n cache: new InMemoryCache(),\n });\n\n return (\n <ThemeProvider theme={theme}>\n <ApolloProvider client={client}>\n <Main />\n </ApolloProvider>\n </ThemeProvider>\n );\n};\n\nexport { CurrencyPowerBalance };\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,iBAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AAA8B,SAAAD,uBAAAK,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAG9B,MAAMG,oBAAoB,GAAGC,IAAA,IAEK;EAAA,IAFJ;IAC5BC,UAAU;IAAEC;EACc,CAAC,GAAAF,IAAA;EAC3B,MAAMG,MAAM,GAAG,IAAIC,oBAAY,CAAC;IAC9BC,GAAG,EAAEJ,UAAU;IACfK,KAAK,EAAE,IAAIC,qBAAa,CAAC;EAC3B,CAAC,CAAC;EAEF,OACEjB,MAAA,CAAAQ,OAAA,CAAAU,aAAA,CAACd,iBAAA,CAAAe,aAAa;IAACP,KAAK,EAAEA;EAAM,GAC1BZ,MAAA,CAAAQ,OAAA,CAAAU,aAAA,CAACf,OAAA,CAAAiB,cAAc;IAACP,MAAM,EAAEA;EAAO,GAC7Bb,MAAA,CAAAQ,OAAA,CAAAU,aAAA,CAACb,KAAA,CAAAgB,IAAI,MAAE,CACO,CACH,CAAC;AAEpB,CAAC;AAACC,OAAA,CAAAb,oBAAA,GAAAA,oBAAA"}
1
+ {"version":3,"file":"CurrencyPowerBalance.js","names":["_react","_interopRequireDefault","require","_client","_labsWidgetCommon","_monoI18n","_Main","_translations","obj","__esModule","default","CurrencyPowerBalance","_ref","graphqlUrl","theme","locale","client","ApolloClient","uri","cache","InMemoryCache","createElement","ThemeProvider","LocaleProvider","getLocale","translations","ApolloProvider","Main","exports"],"sources":["../../../src/CurrencyPowerBalanceWidget/CurrencyPowerBalance.tsx"],"sourcesContent":["import React from 'react';\nimport { ApolloClient, InMemoryCache, ApolloProvider } from '@apollo/client';\nimport { ThemeProvider, getLocale } from '@oanda/labs-widget-common';\nimport { LocaleProvider } from '@oanda/mono-i18n';\nimport { Main } from './Main';\nimport { CurrencyPowerBalanceConfig } from './types';\nimport { translations } from '../translations';\n\nconst CurrencyPowerBalance = ({\n graphqlUrl, theme, locale,\n}: CurrencyPowerBalanceConfig) => {\n const client = new ApolloClient({\n uri: graphqlUrl,\n cache: new InMemoryCache(),\n });\n\n return (\n <ThemeProvider theme={theme}>\n <LocaleProvider locale={getLocale(locale)} translations={translations}>\n <ApolloProvider client={client}>\n <Main />\n </ApolloProvider>\n </LocaleProvider>\n </ThemeProvider>\n );\n};\n\nexport { CurrencyPowerBalance };\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,iBAAA,GAAAF,OAAA;AACA,IAAAG,SAAA,GAAAH,OAAA;AACA,IAAAI,KAAA,GAAAJ,OAAA;AAEA,IAAAK,aAAA,GAAAL,OAAA;AAA+C,SAAAD,uBAAAO,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAE/C,MAAMG,oBAAoB,GAAGC,IAAA,IAEK;EAAA,IAFJ;IAC5BC,UAAU;IAAEC,KAAK;IAAEC;EACO,CAAC,GAAAH,IAAA;EAC3B,MAAMI,MAAM,GAAG,IAAIC,oBAAY,CAAC;IAC9BC,GAAG,EAAEL,UAAU;IACfM,KAAK,EAAE,IAAIC,qBAAa,CAAC;EAC3B,CAAC,CAAC;EAEF,OACEpB,MAAA,CAAAU,OAAA,CAAAW,aAAA,CAACjB,iBAAA,CAAAkB,aAAa;IAACR,KAAK,EAAEA;EAAM,GAC1Bd,MAAA,CAAAU,OAAA,CAAAW,aAAA,CAAChB,SAAA,CAAAkB,cAAc;IAACR,MAAM,EAAE,IAAAS,2BAAS,EAACT,MAAM,CAAE;IAACU,YAAY,EAAEA;EAAa,GACpEzB,MAAA,CAAAU,OAAA,CAAAW,aAAA,CAAClB,OAAA,CAAAuB,cAAc;IAACV,MAAM,EAAEA;EAAO,GAC7BhB,MAAA,CAAAU,OAAA,CAAAW,aAAA,CAACf,KAAA,CAAAqB,IAAI,MAAE,CACO,CACF,CACH,CAAC;AAEpB,CAAC;AAACC,OAAA,CAAAjB,oBAAA,GAAAA,oBAAA"}
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.Tool = void 0;
7
7
  var _react = _interopRequireWildcard(require("react"));
8
+ var _monoI18n = require("@oanda/mono-i18n");
8
9
  var _config = require("./config");
9
10
  var _TimeUnitSwitch = require("./components/TimeUnitSwitch");
10
11
  var _ChartWithData = require("./ChartWithData");
@@ -13,13 +14,17 @@ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return
13
14
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
14
15
  const Tool = () => {
15
16
  const [selectedTimeUnit, setSelectedTimeUnit] = (0, _react.useState)(_graphql.CurrencyPowerBalanceTimeUnit.CurrentDay);
17
+ const {
18
+ lang
19
+ } = (0, _monoI18n.useLocale)();
16
20
  return _react.default.createElement("div", {
17
21
  "data-testid": "currency-power-balance-wrapper",
18
- className: "lw-flex lw-flex-col lw-overflow-hidden lw-text-sm lw-tracking-normal"
22
+ className: "lw-flex lw-flex-col lw-text-sm lw-tracking-normal"
19
23
  }, _react.default.createElement(_TimeUnitSwitch.TimeUnitSwitch, {
20
24
  selected: selectedTimeUnit,
21
25
  callback: setSelectedTimeUnit,
22
- options: _config.timeUnitConfig
26
+ options: _config.timeUnitConfig,
27
+ labelCallback: lang
23
28
  }), _react.default.createElement(_ChartWithData.ChartWithData, {
24
29
  timeUnit: selectedTimeUnit
25
30
  }));
@@ -1 +1 @@
1
- {"version":3,"file":"Tool.js","names":["_react","_interopRequireWildcard","require","_config","_TimeUnitSwitch","_ChartWithData","_graphql","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","hasOwnProperty","call","i","set","Tool","selectedTimeUnit","setSelectedTimeUnit","useState","CurrencyPowerBalanceTimeUnit","CurrentDay","createElement","className","TimeUnitSwitch","selected","callback","options","timeUnitConfig","ChartWithData","timeUnit","exports"],"sources":["../../../src/CurrencyPowerBalanceWidget/Tool.tsx"],"sourcesContent":["import React, { useState } from 'react';\nimport { timeUnitConfig } from './config';\nimport { TimeUnitSwitch } from './components/TimeUnitSwitch';\nimport { ChartWithData } from './ChartWithData';\nimport { CurrencyPowerBalanceTimeUnit } from '../gql/types/graphql';\n\nconst Tool = () => {\n const [selectedTimeUnit, setSelectedTimeUnit] = useState(CurrencyPowerBalanceTimeUnit.CurrentDay);\n\n return (\n <div\n data-testid=\"currency-power-balance-wrapper\"\n className=\"lw-flex lw-flex-col lw-overflow-hidden lw-text-sm lw-tracking-normal\"\n >\n <TimeUnitSwitch\n selected={selectedTimeUnit}\n callback={setSelectedTimeUnit}\n options={timeUnitConfig}\n />\n <ChartWithData\n time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CAAAH,OAAA,GAAAL,CAAA,EAAAG,CAAA,IAAAA,CAAA,CAAAgB,GAAA,CAAAnB,CAAA,EAAAQ,CAAA,GAAAA,CAAA;AAEpE,MAAMY,IAAI,GAAGA,CAAA,KAAM;EACjB,MAAM,CAACC,gBAAgB,EAAEC,mBAAmB,CAAC,GAAG,IAAAC,eAAQ,EAACC,qCAA4B,CAACC,UAAU,CAAC;EAEjG,OACEjC,MAAA,CAAAa,OAAA,CAAAqB,aAAA;IACE,eAAY,gCAAgC;IAC5CC,SAAS,EAAC;EAAsE,GAEhFnC,MAAA,CAAAa,OAAA,CAAAqB,aAAA,CAAC9B,eAAA,CAAAgC,cAAc;IACbC,QAAQ,EAAER,gBAAiB;IAC3BS,QAAQ,EAAER,mBAAoB;IAC9BS,OAAO,EAAEC;EAAe,CACzB,CAAC,EACFxC,MAAA,CAAAa,OAAA,CAAAqB,aAAA,CAAC7B,cAAA,CAAAoC,aAAa;IACZC,QAAQ,EAAEb;EAAiB,CAC5B,CACE,CAAC;AAEV,CAAC;AAACc,OAAA,CAAAf,IAAA,GAAAA,IAAA"}
1
+ {"version":3,"file":"Tool.js","names":["_react","_interopRequireWildcard","require","_monoI18n","_config","_TimeUnitSwitch","_ChartWithData","_graphql","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","hasOwnProperty","call","i","set","Tool","selectedTimeUnit","setSelectedTimeUnit","useState","CurrencyPowerBalanceTimeUnit","CurrentDay","lang","useLocale","createElement","className","TimeUnitSwitch","selected","callback","options","timeUnitConfig","labelCallback","ChartWithData","timeUnit","exports"],"sources":["../../../src/CurrencyPowerBalanceWidget/Tool.tsx"],"sourcesContent":["import React, { useState } from 'react';\nimport { useLocale } from '@oanda/mono-i18n';\nimport { timeUnitConfig } from './config';\nimport { TimeUnitSwitch } from './components/TimeUnitSwitch';\nimport { ChartWithData } from './ChartWithData';\nimport { CurrencyPowerBalanceTimeUnit } from '../gql/types/graphql';\n\nconst Tool = () => {\n const [selectedTimeUnit, setSelectedTimeUnit] = useState(CurrencyPowerBalanceTimeUnit.CurrentDay);\n const { lang } = useLocale();\n\n return (\n <div\n data-testid=\"currency-power-balance-wrapper\"\n className=\"lw-flex lw-flex-col lw-text-sm lw-tracking-normal\"\n >\n <TimeUnitSwitch\n selected={selectedTimeUnit}\n callback={setSelectedTimeUnit}\n options={timeUnitConfig}\n labelCallback={lang}\n />\n <ChartWithData\n timeUnit={selectedTimeUnit}\n />\n </div>\n );\n};\n\nexport { Tool };\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,eAAA,GAAAH,OAAA;AACA,IAAAI,cAAA,GAAAJ,OAAA;AACA,IAAAK,QAAA,GAAAL,OAAA;AAAoE,SAAAM,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,SAAAR,wBAAAQ,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,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAjB,CAAA,EAAAc,CAAA,SAAAI,CAAA,GAAAR,CAAA,GAAAC,MAAA,CAAAE,wBAAA,CAAAb,CAAA,EAAAc,CAAA,UAAAI,CAAA,KAAAA,CAAA,CAAAX,GAAA,IAAAW,CAAA,CAAAC,GAAA,IAAAR,MAAA,CAAAC,cAAA,CAAAJ,CAAA,EAAAM,CAAA,EAAAI,CAAA,IAAAV,CAAA,CAAAM,CAAA,IAAAd,CAAA,CAAAc,CAAA,YAAAN,CAAA,CAAAH,OAAA,GAAAL,CAAA,EAAAG,CAAA,IAAAA,CAAA,CAAAgB,GAAA,CAAAnB,CAAA,EAAAQ,CAAA,GAAAA,CAAA;AAEpE,MAAMY,IAAI,GAAGA,CAAA,KAAM;EACjB,MAAM,CAACC,gBAAgB,EAAEC,mBAAmB,CAAC,GAAG,IAAAC,eAAQ,EAACC,qCAA4B,CAACC,UAAU,CAAC;EACjG,MAAM;IAAEC;EAAK,CAAC,GAAG,IAAAC,mBAAS,EAAC,CAAC;EAE5B,OACEpC,MAAA,CAAAc,OAAA,CAAAuB,aAAA;IACE,eAAY,gCAAgC;IAC5CC,SAAS,EAAC;EAAmD,GAE7DtC,MAAA,CAAAc,OAAA,CAAAuB,aAAA,CAAChC,eAAA,CAAAkC,cAAc;IACbC,QAAQ,EAAEV,gBAAiB;IAC3BW,QAAQ,EAAEV,mBAAoB;IAC9BW,OAAO,EAAEC,sBAAe;IACxBC,aAAa,EAAET;EAAK,CACrB,CAAC,EACFnC,MAAA,CAAAc,OAAA,CAAAuB,aAAA,CAAC/B,cAAA,CAAAuC,aAAa;IACZC,QAAQ,EAAEhB;EAAiB,CAC5B,CACE,CAAC;AAEV,CAAC;AAACiB,OAAA,CAAAlB,IAAA,GAAAA,IAAA"}
@@ -53,7 +53,7 @@ const tooltipFormatter = values => {
53
53
  } = _ref4;
54
54
  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>");
55
55
  });
56
- return "<div style=\"display:flex; flex-direction:column;\">\n <p style=\"margin-bottom:5px;\">".concat(date, "</p>\n ").concat(row.join('\n'), "\n </div>");
56
+ return "<div style=\"display:flex; flex-direction:column;\">\n <span style=\"margin-bottom:5px;\">".concat(date, "</span>\n ").concat(row.join('\n'), "\n </div>");
57
57
  };
58
58
  exports.tooltipFormatter = tooltipFormatter;
59
59
  //# sourceMappingURL=formatters.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"formatters.js","names":["getDateAndTime","param","dateAndTime","split","date","time","substring","dateFormat","concat","Date","toLocaleDateString","undefined","month","day","dateTimeFormat","_ref","year","xAxisLabelFormatter","label","timeUnit","isDateFormat","startsWith","exports","tooltipFormatter","values","value","row","sort","_ref2","_ref3","valueA","valueB","Number","map","_ref4","marker","seriesName","join"],"sources":["../../../../../../src/CurrencyPowerBalanceWidget/components/Chart/options/formatters.ts"],"sourcesContent":["import { CurrencyPowerBalanceTimeUnit } from '../../../../gql/types/graphql';\nimport { 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) => `${new Date(date).toLocaleDateString(undefined, { month: 'numeric', day: 'numeric' })}`;\n\nconst dateTimeFormat = ({ date, time }: { date: string, time: string }) => `${new Date(date).toLocaleDateString(undefined, { year: 'numeric', month: 'numeric', day: 'numeric' })}, ${time} UTC`;\n\nconst xAxisLabelFormatter = (label: string, timeUnit: CurrencyPowerBalanceTimeUnit) => {\n const { date, time } = getDateAndTime(label);\n const isDateFormat = timeUnit.startsWith('M') || timeUnit.startsWith('W') || time === '00:00';\n\n return isDateFormat ? dateFormat(date) : time;\n};\n\nconst tooltipFormatter = (values: TooltipFormatterParams[]) => {\n const date = dateTimeFormat(getDateAndTime(values[0].value[0]));\n\n const row = values\n .sort(({ value: valueA }, { value: valueB }) => Number(valueB[1]) - Number(valueA[1]))\n .map(({ marker, seriesName, value }) => `<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 return `<div style=\"display:flex; flex-direction:column;\">\n <p style=\"margin-bottom:5px;\">${date}</p>\n ${row.join('\\n')}\n </div>`;\n};\n\nexport {\n tooltipFormatter,\n xAxisLabelFormatter,\n};\n"],"mappings":";;;;;;AAGA,MAAMA,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,CAAQ,IAAIC,IAAI,CAACL,IAAI,CAAC,CAACM,kBAAkB,CAACC,SAAS,EAAE;EAAEC,KAAK,EAAE,SAAS;EAAEC,GAAG,EAAE;AAAU,CAAC,CAAC,CAAE;AAE5H,MAAMC,cAAc,GAAGC,IAAA;EAAA,IAAC;IAAEX,IAAI;IAAEC;EAAqC,CAAC,GAAAU,IAAA;EAAA,UAAAP,MAAA,CAAQ,IAAIC,IAAI,CAACL,IAAI,CAAC,CAACM,kBAAkB,CAACC,SAAS,EAAE;IAAEK,IAAI,EAAE,SAAS;IAAEJ,KAAK,EAAE,SAAS;IAAEC,GAAG,EAAE;EAAU,CAAC,CAAC,QAAAL,MAAA,CAAKH,IAAI;AAAA,CAAM;AAEhM,MAAMY,mBAAmB,GAAGA,CAACC,KAAa,EAAEC,QAAsC,KAAK;EACrF,MAAM;IAAEf,IAAI;IAAEC;EAAK,CAAC,GAAGL,cAAc,CAACkB,KAAK,CAAC;EAC5C,MAAME,YAAY,GAAGD,QAAQ,CAACE,UAAU,CAAC,GAAG,CAAC,IAAIF,QAAQ,CAACE,UAAU,CAAC,GAAG,CAAC,IAAIhB,IAAI,KAAK,OAAO;EAE7F,OAAOe,YAAY,GAAGb,UAAU,CAACH,IAAI,CAAC,GAAGC,IAAI;AAC/C,CAAC;AAACiB,OAAA,CAAAL,mBAAA,GAAAA,mBAAA;AAEF,MAAMM,gBAAgB,GAAIC,MAAgC,IAAK;EAC7D,MAAMpB,IAAI,GAAGU,cAAc,CAACd,cAAc,CAACwB,MAAM,CAAC,CAAC,CAAC,CAACC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;EAE/D,MAAMC,GAAG,GAAGF,MAAM,CACfG,IAAI,CAAC,CAAAC,KAAA,EAAAC,KAAA;IAAA,IAAC;MAAEJ,KAAK,EAAEK;IAAO,CAAC,GAAAF,KAAA;IAAA,IAAE;MAAEH,KAAK,EAAEM;IAAO,CAAC,GAAAF,KAAA;IAAA,OAAKG,MAAM,CAACD,MAAM,CAAC,CAAC,CAAC,CAAC,GAAGC,MAAM,CAACF,MAAM,CAAC,CAAC,CAAC,CAAC;EAAA,EAAC,CACrFG,GAAG,CAACC,KAAA;IAAA,IAAC;MAAEC,MAAM;MAAEC,UAAU;MAAEX;IAAM,CAAC,GAAAS,KAAA;IAAA,yJAAA1B,MAAA,CAE7B2B,MAAM,sBAAA3B,MAAA,CACA4B,UAAU,yCAAA5B,MAAA,CAEZiB,KAAK,CAAC,CAAC,CAAC;EAAA,CACX,CAAC;EAEV,oGAAAjB,MAAA,CACkCJ,IAAI,gBAAAI,MAAA,CAClCkB,GAAG,CAACW,IAAI,CAAC,IAAI,CAAC;AAEpB,CAAC;AAACf,OAAA,CAAAC,gBAAA,GAAAA,gBAAA"}
1
+ {"version":3,"file":"formatters.js","names":["getDateAndTime","param","dateAndTime","split","date","time","substring","dateFormat","concat","Date","toLocaleDateString","undefined","month","day","dateTimeFormat","_ref","year","xAxisLabelFormatter","label","timeUnit","isDateFormat","startsWith","exports","tooltipFormatter","values","value","row","sort","_ref2","_ref3","valueA","valueB","Number","map","_ref4","marker","seriesName","join"],"sources":["../../../../../../src/CurrencyPowerBalanceWidget/components/Chart/options/formatters.ts"],"sourcesContent":["import { CurrencyPowerBalanceTimeUnit } from '../../../../gql/types/graphql';\nimport { 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) => `${new Date(date).toLocaleDateString(undefined, { month: 'numeric', day: 'numeric' })}`;\n\nconst dateTimeFormat = ({ date, time }: { date: string, time: string }) => `${new Date(date).toLocaleDateString(undefined, { year: 'numeric', month: 'numeric', day: 'numeric' })}, ${time} UTC`;\n\nconst xAxisLabelFormatter = (label: string, timeUnit: CurrencyPowerBalanceTimeUnit) => {\n const { date, time } = getDateAndTime(label);\n const isDateFormat = timeUnit.startsWith('M') || timeUnit.startsWith('W') || time === '00:00';\n\n return isDateFormat ? dateFormat(date) : time;\n};\n\nconst tooltipFormatter = (values: TooltipFormatterParams[]) => {\n const date = dateTimeFormat(getDateAndTime(values[0].value[0]));\n\n const row = values\n .sort(({ value: valueA }, { value: valueB }) => Number(valueB[1]) - Number(valueA[1]))\n .map(({ marker, seriesName, value }) => `<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 return `<div style=\"display:flex; flex-direction:column;\">\n <span style=\"margin-bottom:5px;\">${date}</span>\n ${row.join('\\n')}\n </div>`;\n};\n\nexport {\n tooltipFormatter,\n xAxisLabelFormatter,\n};\n"],"mappings":";;;;;;AAGA,MAAMA,cAAc,GAAIC,KAAa,IAAK;EACxC,MAAMC,WAAW,GAAGD,KAAK,CAACE,KA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;EAE/D,MAAMC,GAAG,GAAGF,MAAM,CACfG,IAAI,CAAC,CAAAC,KAAA,EAAAC,KAAA;IAAA,IAAC;MAAEJ,KAAK,EAAEK;IAAO,CAAC,GAAAF,KAAA;IAAA,IAAE;MAAEH,KAAK,EAAEM;IAAO,CAAC,GAAAF,KAAA;IAAA,OAAKG,MAAM,CAACD,MAAM,CAAC,CAAC,CAAC,CAAC,GAAGC,MAAM,CAACF,MAAM,CAAC,CAAC,CAAC,CAAC;EAAA,EAAC,CACrFG,GAAG,CAACC,KAAA;IAAA,IAAC;MAAEC,MAAM;MAAEC,UAAU;MAAEX;IAAM,CAAC,GAAAS,KAAA;IAAA,yJAAA1B,MAAA,CAE7B2B,MAAM,sBAAA3B,MAAA,CACA4B,UAAU,yCAAA5B,MAAA,CAEZiB,KAAK,CAAC,CAAC,CAAC;EAAA,CACX,CAAC;EAEV,uGAAAjB,MAAA,CACqCJ,IAAI,mBAAAI,MAAA,CACrCkB,GAAG,CAACW,IAAI,CAAC,IAAI,CAAC;AAEpB,CAAC;AAACf,OAAA,CAAAC,gBAAA,GAAAA,gBAAA"}
@@ -59,7 +59,8 @@ const getOption = (values, timeUnit, isDark) => {
59
59
  color: isDark ? _constants.TOOLTIP_LINE_COLOR_CONFIG.DARK : _constants.TOOLTIP_LINE_COLOR_CONFIG.LIGHT
60
60
  }
61
61
  },
62
- formatter: _formatters.tooltipFormatter
62
+ formatter: _formatters.tooltipFormatter,
63
+ extraCssText: 'z-index: 1'
63
64
  },
64
65
  xAxis: {
65
66
  type: 'category',
@@ -1 +1 @@
1
- {"version":3,"file":"getOption.js","names":["_constants","require","_formatters","getOption","values","timeUnit","isDark","seriesData","map","_ref","currency","power","name","type","symbol","showSymbol","itemStyle","color","COLOR_CONFIG","lineStyle","data","_ref2","point","price","legendData","_ref3","animation","legend","bottom","icon","tooltip","trigger","axisPointer","axis","z","TOOLTIP_LINE_COLOR_CONFIG","DARK","LIGHT","formatter","tooltipFormatter","xAxis","axisTick","show","axisLine","splitLine","axisLabel","margin","showMinLabel","rotate","interval","Math","round","length","VERTICAL_LINE_COUNT","label","xAxisLabelFormatter","yAxis","position","splitNumber","boundaryGap","showMaxLabel","series","exports"],"sources":["../../../../../../src/CurrencyPowerBalanceWidget/components/Chart/options/getOption.ts"],"sourcesContent":["import { COLOR_CONFIG, TOOLTIP_LINE_COLOR_CONFIG, VERTICAL_LINE_COUNT } from './constants';\nimport { tooltipFormatter, xAxisLabelFormatter } from './formatters';\nimport { CurrencyPowerBalance, CurrencyPowerBalanceTimeUnit } from '../../../../gql/types/graphql';\n\nconst getOption = (\n values: CurrencyPowerBalance[],\n timeUnit: CurrencyPowerBalanceTimeUnit,\n isDark: boolean,\n) => {\n const seriesData = values.map(({ currency, power }) => ({\n name: currency,\n type: 'line',\n symbol: 'circle',\n showSymbol: false,\n itemStyle: {\n color: COLOR_CONFIG[currency],\n },\n lineStyle: {\n color: COLOR_CONFIG[currency],\n },\n data: power.map(({ point, price }) => [point, price]),\n }));\n\n const legendData = values.map(({ currency }) => ({\n name: currency,\n itemStyle: {\n color: COLOR_CONFIG[currency],\n },\n }));\n\n return {\n animation: false,\n legend: {\n data: legendData,\n bottom: 10,\n icon: 'circle',\n },\n tooltip: {\n trigger: 'axis',\n axisPointer: {\n axis: 'x',\n z: 0,\n lineStyle: {\n color: isDark ? TOOLTIP_LINE_COLOR_CONFIG.DARK : TOOLTIP_LINE_COLOR_CONFIG.LIGHT,\n },\n },\n formatter: tooltipFormatter,\n },\n xAxis: {\n type: 'category',\n axisTick: {\n show: false,\n },\n axisLine: { show: false },\n splitLine: {\n show: true,\n },\n axisLabel: {\n margin: 10,\n showMinLabel: false,\n rotate: -45,\n interval: Math.round(seriesData[0].data.length / VERTICAL_LINE_COUNT),\n formatter: (label: string) => xAxisLabelFormatter(label, timeUnit),\n },\n },\n yAxis: {\n type: 'value',\n position: 'right',\n splitNumber: 5,\n axisLine: { show: false },\n axisTick: { show: false },\n boundaryGap: ['10%', '10%'],\n axisL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EAAE,GAAG;QACTC,CAAC,EAAE,CAAC;QACJf,SAAS,EAAE;UACTF,KAAK,EAAEX,MAAM,GAAG6B,oCAAyB,CAACC,IAAI,GAAGD,oCAAyB,CAACE;QAC7E;MACF,CAAC;MACDC,SAAS,EAAEC;IACb,CAAC;IACDC,KAAK,EAAE;MACL3B,IAAI,EAAE,UAAU;MAChB4B,QAAQ,EAAE;QACRC,IAAI,EAAE;MACR,CAAC;MACDC,QAAQ,EAAE;QAAED,IAAI,EAAE;MAAM,CAAC;MACzBE,SAAS,EAAE;QACTF,IAAI,EAAE;MACR,CAAC;MACDG,SAAS,EAAE;QACTC,MAAM,EAAE,EAAE;QACVC,YAAY,EAAE,KAAK;QACnBC,MAAM,EAAE,CAAC,EAAE;QACXC,QAAQ,EAAEC,IAAI,CAACC,KAAK,CAAC5C,UAAU,CAAC,CAAC,CAAC,CAACa,IAAI,CAACgC,MAAM,GAAGC,8BAAmB,CAAC;QACrEf,SAAS,EAAGgB,KAAa,IAAK,IAAAC,+BAAmB,EAACD,KAAK,EAAEjD,QAAQ;MACnE;IACF,CAAC;IACDmD,KAAK,EAAE;MACL3C,IAAI,EAAE,OAAO;MACb4C,QAAQ,EAAE,OAAO;MACjBC,WAAW,EAAE,CAAC;MACdf,QAAQ,EAAE;QAAED,IAAI,EAAE;MAAM,CAAC;MACzBD,QAAQ,EAAE;QAAEC,IAAI,EAAE;MAAM,CAAC;MACzBiB,WAAW,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC;MAC3Bd,SAAS,EAAE;QACTe,YAAY,EAAE,KAAK;QACnBb,YAAY,EAAE;MAChB;IACF,CAAC;IACDc,MAAM,EAAEtD;EACV,CAAC;AACH,CAAC;AAACuD,OAAA,CAAA3D,SAAA,GAAAA,SAAA"}
1
+ {"version":3,"file":"getOption.js","names":["_constants","require","_formatters","getOption","values","timeUnit","isDark","seriesData","map","_ref","currency","power","name","type","symbol","showSymbol","itemStyle","color","COLOR_CONFIG","lineStyle","data","_ref2","point","price","legendData","_ref3","animation","legend","bottom","icon","tooltip","trigger","axisPointer","axis","z","TOOLTIP_LINE_COLOR_CONFIG","DARK","LIGHT","formatter","tooltipFormatter","extraCssText","xAxis","axisTick","show","axisLine","splitLine","axisLabel","margin","showMinLabel","rotate","interval","Math","round","length","VERTICAL_LINE_COUNT","label","xAxisLabelFormatter","yAxis","position","splitNumber","boundaryGap","showMaxLabel","series","exports"],"sources":["../../../../../../src/CurrencyPowerBalanceWidget/components/Chart/options/getOption.ts"],"sourcesContent":["import { COLOR_CONFIG, TOOLTIP_LINE_COLOR_CONFIG, VERTICAL_LINE_COUNT } from './constants';\nimport { tooltipFormatter, xAxisLabelFormatter } from './formatters';\nimport { CurrencyPowerBalance, CurrencyPowerBalanceTimeUnit } from '../../../../gql/types/graphql';\n\nconst getOption = (\n values: CurrencyPowerBalance[],\n timeUnit: CurrencyPowerBalanceTimeUnit,\n isDark: boolean,\n) => {\n const seriesData = values.map(({ currency, power }) => ({\n name: currency,\n type: 'line',\n symbol: 'circle',\n showSymbol: false,\n itemStyle: {\n color: COLOR_CONFIG[currency],\n },\n lineStyle: {\n color: COLOR_CONFIG[currency],\n },\n data: power.map(({ point, price }) => [point, price]),\n }));\n\n const legendData = values.map(({ currency }) => ({\n name: currency,\n itemStyle: {\n color: COLOR_CONFIG[currency],\n },\n }));\n\n return {\n animation: false,\n legend: {\n data: legendData,\n bottom: 10,\n icon: 'circle',\n },\n tooltip: {\n trigger: 'axis',\n axisPointer: {\n axis: 'x',\n z: 0,\n lineStyle: {\n color: isDark ? TOOLTIP_LINE_COLOR_CONFIG.DARK : TOOLTIP_LINE_COLOR_CONFIG.LIGHT,\n },\n },\n formatter: tooltipFormatter,\n extraCssText: 'z-index: 1',\n },\n xAxis: {\n type: 'category',\n axisTick: {\n show: false,\n },\n axisLine: { show: false },\n splitLine: {\n show: true,\n },\n axisLabel: {\n margin: 10,\n showMinLabel: false,\n rotate: -45,\n interval: Math.round(seriesData[0].data.length / VERTICAL_LINE_COUNT),\n formatter: (label: string) => xAxisLabelFormatter(label, timeUnit),\n },\n },\n yAxis: {\n type: 'value',\n position: 'right',\n splitNumber: 5,\n axisLine: { show: false },\n axisTick: { show: false },\n boundaryGap: ['10%', '10%'],\n axisLabel: {\n showMaxLabel: false,\n showMinLabel: false,\n },\n },\n series: seriesData,\n };\n};\n\nexport { getOption };\n"],"mappings":";;;;;;AAAA,IAAAA,UAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AAGA,MAAME,SAAS,GAAGA,CAChBC,MAA8B,EAC9BC,QAAsC,EACtCC,MAAe,KACZ;EACH,MAAMC,UAAU,GAAGH,MAAM,CAACI,GAAG,CAACC,IAAA;IAAA,IAAC;MAAEC,QAAQ;MAAEC;IAAM,CAAC,GAAAF,IAAA;IAAA,OAAM;MACtDG,IAAI,EAAEF,QAAQ;MACdG,IAAI,EAAE,MAAM;MACZC,MAAM,EAAE,QAAQ;MAChBC,UAAU,EAAE,KAAK;MACjBC,SAAS,EAAE;QACTC,KAAK,EAAEC,uBAAY,CAACR,QAAQ;MAC9B,CAAC;MACDS,SAAS,EAAE;QACTF,KAAK,EAAEC,uBAAY,CAACR,QAAQ;MAC9B,CAAC;MACDU,IAAI,EAAET,KAAK,CAACH,GAAG,CAACa,KAAA;QAAA,IAAC;UAAEC,KAAK;UAAEC;QAAM,CAAC,GAAAF,KAAA;QAAA,OAAK,CAACC,KAAK,EAAEC,KAAK,CAAC;MAAA;IACtD,CAAC;EAAA,CAAC,CAAC;EAEH,MAAMC,UAAU,GAAGpB,MAAM,CAACI,GAAG,CAACiB,KAAA;IAAA,IAAC;MAAEf;IAAS,CAAC,GAAAe,KAAA;IAAA,OAAM;MAC/Cb,IAAI,EAAEF,QAAQ;MACdM,SAAS,EAAE;QACTC,KAAK,EAAEC,uBAAY,CAACR,QAAQ;MAC9B;IACF,CAAC;EAAA,CAAC,CAAC;EAEH,OAAO;IACLgB,SAAS,EAAE,KAAK;IAChBC,MAAM,EAAE;MAC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ACwD,OAAA,CAAA5D,SAAA,GAAAA,SAAA"}
@@ -11,7 +11,8 @@ const TimeUnitSelect = _ref => {
11
11
  let {
12
12
  selected,
13
13
  options,
14
- callback
14
+ callback,
15
+ labelCallback
15
16
  } = _ref;
16
17
  const selectOptions = options.map(_ref2 => {
17
18
  let {
@@ -21,7 +22,7 @@ const TimeUnitSelect = _ref => {
21
22
  } = _ref2;
22
23
  return {
23
24
  id,
24
- label: tooltip || label
25
+ label: labelCallback ? labelCallback(tooltip || label) : tooltip || label
25
26
  };
26
27
  });
27
28
  const [{
@@ -1 +1 @@
1
- {"version":3,"file":"TimeUnitSelect.js","names":["_react","_interopRequireDefault","require","_labsWidgetCommon","obj","__esModule","default","TimeUnitSelect","_ref","selected","options","callback","selectOptions","map","_ref2","value","id","label","tooltip","selectedLabel","filter","_ref3","createElement","className","Select","selectedOption","setSelectedOption","_ref4","exports"],"sources":["../../../../../src/CurrencyPowerBalanceWidget/components/TimeUnitSwitch/TimeUnitSelect.tsx"],"sourcesContent":["import React from 'react';\nimport { Select } from '@oanda/labs-widget-common';\nimport { TimeUnitSwitchProps } from './types';\nimport { CurrencyPowerBalanceTimeUnit } from '../../../gql/types/graphql';\n\nconst TimeUnitSelect = ({\n selected, options, callback,\n}: TimeUnitSwitchProps) => {\n const selectOptions = options\n .map(({ value: id, label, tooltip }) => ({ id, label: tooltip || label }));\n const [{ label: selectedLabel }] = selectOptions.filter(({ id }) => id === selected);\n\n return (\n <div data-testid=\"time-unit-select\" className=\"lw-mb-6 lw-w-full\">\n <Select\n options={selectOptions}\n selectedOption={{ id: selected, label: selectedLabel }}\n setSelectedOption={({ id }) => callback(id as CurrencyPowerBalanceTimeUnit)}\n />\n </div>\n );\n};\n\nexport { TimeUnitSelect };\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,iBAAA,GAAAD,OAAA;AAAmD,SAAAD,uBAAAG,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAInD,MAAMG,cAAc,GAAGC,IAAA,IAEI;EAAA,IAFH;IACtBC,QAAQ;IAAEC,OAAO;IAAEC;EACA,CAAC,GAAAH,IAAA;EACpB,MAAMI,aAAa,GAAGF,OAAO,CAC1BG,GAAG,CAACC,KAAA;IAAA,IAAC;MAAEC,KAAK,EAAEC,EAAE;MAAEC,KAAK;MAAEC;IAAQ,CAAC,GAAAJ,KAAA;IAAA,OAAM;MAAEE,EAAE;MAAEC,KAAK,EAAEC,OAAO,IAAID;IAAM,CAAC;EAAA,CAAC,CAAC;EAC5E,MAAM,CAAC;IAAEA,KAAK,EAAEE;EAAc,CAAC,CAAC,GAAGP,aAAa,CAACQ,MAAM,CAACC,KAAA;IAAA,IAAC;MAAEL;IAAG,CAAC,GAAAK,KAAA;IAAA,OAAKL,EAAE,KAAKP,QAAQ;EAAA,EAAC;EAEpF,OACET,MAAA,CAAAM,OAAA,CAAAgB,aAAA;IAAK,eAAY,kBAAkB;IAACC,SAAS,EAAC;EAAmB,GAC/DvB,MAAA,CAAAM,OAAA,CAAAgB,aAAA,CAACnB,iBAAA,CAAAqB,MAAM;IACLd,OAAO,EAAEE,aAAc;IACvBa,cAAc,EAAE;MAAET,EAAE,EAAEP,QAAQ;MAAEQ,KAAK,EAAEE;IAAc,CAAE;IACvDO,iBAAiB,EAAEC,KAAA;MAAA,IAAC;QAAEX;MAAG,CAAC,GAAAW,KAAA;MAAA,OAAKhB,QAAQ,CAACK,EAAkC,CAAC;IAAA;EAAC,CAC7E,CACE,CAAC;AAEV,CAAC;AAACY,OAAA,CAAArB,cAAA,GAAAA,cAAA"}
1
+ {"version":3,"file":"TimeUnitSelect.js","names":["_react","_interopRequireDefault","require","_labsWidgetCommon","obj","__esModule","default","TimeUnitSelect","_ref","selected","options","callback","labelCallback","selectOptions","map","_ref2","value","id","label","tooltip","selectedLabel","filter","_ref3","createElement","className","Select","selectedOption","setSelectedOption","_ref4","exports"],"sources":["../../../../../src/CurrencyPowerBalanceWidget/components/TimeUnitSwitch/TimeUnitSelect.tsx"],"sourcesContent":["import React from 'react';\nimport { Select } from '@oanda/labs-widget-common';\nimport { TimeUnitSwitchProps } from './types';\nimport { CurrencyPowerBalanceTimeUnit } from '../../../gql/types/graphql';\n\nconst TimeUnitSelect = ({\n selected, options, callback, labelCallback,\n}: TimeUnitSwitchProps) => {\n const selectOptions = options\n .map(({ value: id, label, tooltip }) => ({\n id,\n label: labelCallback ? labelCallback(tooltip || label) : tooltip || label,\n }));\n const [{ label: selectedLabel }] = selectOptions.filter(({ id }) => id === selected);\n\n return (\n <div data-testid=\"time-unit-select\" className=\"lw-mb-6 lw-w-full\">\n <Select\n options={selectOptions}\n selectedOption={{ id: selected, label: selectedLabel }}\n setSelectedOption={({ id }) => callback(id as CurrencyPowerBalanceTimeUnit)}\n />\n </div>\n );\n};\n\nexport { TimeUnitSelect };\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,iBAAA,GAAAD,OAAA;AAAmD,SAAAD,uBAAAG,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAInD,MAAMG,cAAc,GAAGC,IAAA,IAEI;EAAA,IAFH;IACtBC,QAAQ;IAAEC,OAAO;IAAEC,QAAQ;IAAEC;EACV,CAAC,GAAAJ,IAAA;EACpB,MAAMK,aAAa,GAAGH,OAAO,CAC1BI,GAAG,CAACC,KAAA;IAAA,IAAC;MAAEC,KAAK,EAAEC,EAAE;MAAEC,KAAK;MAAEC;IAAQ,CAAC,GAAAJ,KAAA;IAAA,OAAM;MACvCE,EAAE;MACFC,KAAK,EAAEN,aAAa,GAAGA,aAAa,CAACO,OAAO,IAAID,KAAK,CAAC,GAAGC,OAAO,IAAID;IACtE,CAAC;EAAA,CAAC,CAAC;EACL,MAAM,CAAC;IAAEA,KAAK,EAAEE;EAAc,CAAC,CAAC,GAAGP,aAAa,CAACQ,MAAM,CAACC,KAAA;IAAA,IAAC;MAAEL;IAAG,CAAC,GAAAK,KAAA;IAAA,OAAKL,EAAE,KAAKR,QAAQ;EAAA,EAAC;EAEpF,OACET,MAAA,CAAAM,OAAA,CAAAiB,aAAA;IAAK,eAAY,kBAAkB;IAACC,SAAS,EAAC;EAAmB,GAC/DxB,MAAA,CAAAM,OAAA,CAAAiB,aAAA,CAACpB,iBAAA,CAAAsB,MAAM;IACLf,OAAO,EAAEG,aAAc;IACvBa,cAAc,EAAE;MAAET,EAAE,EAAER,QAAQ;MAAES,KAAK,EAAEE;IAAc,CAAE;IACvDO,iBAAiB,EAAEC,KAAA;MAAA,IAAC;QAAEX;MAAG,CAAC,GAAAW,KAAA;MAAA,OAAKjB,QAAQ,CAACM,EAAkC,CAAC;IAAA;EAAC,CAC7E,CACE,CAAC;AAEV,CAAC;AAACY,OAAA,CAAAtB,cAAA,GAAAA,cAAA"}
@@ -39,7 +39,8 @@ const TimeUnitSwitch = _ref => {
39
39
  })) : _react.default.createElement(_TimeUnitSelect.TimeUnitSelect, {
40
40
  selected: selected,
41
41
  callback: callback,
42
- options: options
42
+ options: options,
43
+ labelCallback: labelCallback
43
44
  }));
44
45
  };
45
46
  exports.TimeUnitSwitch = TimeUnitSwitch;
@@ -1 +1 @@
1
- {"version":3,"file":"TimeUnitSwitch.js","names":["_react","_interopRequireDefault","require","_labsWidgetCommon","_usehooksTs","_constants","_TimeUnitSelect","obj","__esModule","default","TimeUnitSwitch","_ref","selected","options","callback","labelCallback","isDesktop","useMediaQuery","handleButtonClick","e","currentTarget","value","createElement","Fragment","className","map","item","tooltip","label","Button","key","size","ButtonSize","full","variant","ButtonVariant","primary","secondary","onClick","CURRENCY_POWER_BALANCE_TOOLTIP_ID","TimeUnitSelect","exports"],"sources":["../../../../../src/CurrencyPowerBalanceWidget/components/TimeUnitSwitch/TimeUnitSwitch.tsx"],"sourcesContent":["import React from 'react';\nimport { Button, ButtonSize, ButtonVariant } from '@oanda/labs-widget-common';\nimport { useMediaQuery } from 'usehooks-ts';\nimport { TimeUnitSwitchProps } from './types';\nimport { CurrencyPowerBalanceTimeUnit } from '../../../gql/types/graphql';\nimport { CURRENCY_POWER_BALANCE_TOOLTIP_ID } from '../../constants';\nimport { TimeUnitSelect } from './TimeUnitSelect';\n\nconst TimeUnitSwitch = ({\n selected, options, callback, labelCallback,\n}: TimeUnitSwitchProps) => {\n const isDesktop = useMediaQuery('(min-width: 768px)');\n\n const handleButtonClick = (e: React.SyntheticEvent<HTMLButtonElement>) => {\n callback(e.currentTarget.value as CurrencyPowerBalanceTimeUnit);\n };\n\n return (\n <>\n {isDesktop\n ? (\n <div data-testid=\"time-unit-switch\" className=\"lw-mb-6 lw-flex lw-gap-1 lw-self-end\">\n {options.map((item) => {\n const tooltip = labelCallback && item.tooltip\n ? labelCallback(item.tooltip)\n : item.tooltip;\n const label = labelCallback ? labelCallback(item.label) : item.label;\n\n return (\n <Button\n key={item.value}\n size={ButtonSize.full}\n variant={selected === item.value\n ? ButtonVariant.primary\n : ButtonVariant.secondary}\n onClick={handleButtonClick}\n value={item.value}\n data-tooltip-id={CURRENCY_POWER_BALANCE_TOOLTIP_ID}\n data-tooltip-content={tooltip}\n >\n {label}\n </Button>\n );\n })}\n </div>\n )\n : (\n <TimeUnitSelect\n selected={selected}\n callback={callback}\n options={options}\n />\n )}\n </>\n );\n};\n\nexport { TimeUnitSwitch };\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,iBAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AAGA,IAAAG,UAAA,GAAAH,OAAA;AACA,IAAAI,eAAA,GAAAJ,OAAA;AAAkD,SAAAD,uBAAAM,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAElD,MAA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,cAAc;IACb5B,QAAQ,EAAEA,QAAS;IACnBE,QAAQ,EAAEA,QAAS;IACnBD,OAAO,EAAEA;EAAQ,CAClB,CAEL,CAAC;AAEP,CAAC;AAAC4B,OAAA,CAAA/B,cAAA,GAAAA,cAAA"}
1
+ {"version":3,"file":"TimeUnitSwitch.js","names":["_react","_interopRequireDefault","require","_labsWidgetCommon","_usehooksTs","_constants","_TimeUnitSelect","obj","__esModule","default","TimeUnitSwitch","_ref","selected","options","callback","labelCallback","isDesktop","useMediaQuery","handleButtonClick","e","currentTarget","value","createElement","Fragment","className","map","item","tooltip","label","Button","key","size","ButtonSize","full","variant","ButtonVariant","primary","secondary","onClick","CURRENCY_POWER_BALANCE_TOOLTIP_ID","TimeUnitSelect","exports"],"sources":["../../../../../src/CurrencyPowerBalanceWidget/components/TimeUnitSwitch/TimeUnitSwitch.tsx"],"sourcesContent":["import React from 'react';\nimport { Button, ButtonSize, ButtonVariant } from '@oanda/labs-widget-common';\nimport { useMediaQuery } from 'usehooks-ts';\nimport { TimeUnitSwitchProps } from './types';\nimport { CurrencyPowerBalanceTimeUnit } from '../../../gql/types/graphql';\nimport { CURRENCY_POWER_BALANCE_TOOLTIP_ID } from '../../constants';\nimport { TimeUnitSelect } from './TimeUnitSelect';\n\nconst TimeUnitSwitch = ({\n selected, options, callback, labelCallback,\n}: TimeUnitSwitchProps) => {\n const isDesktop = useMediaQuery('(min-width: 768px)');\n\n const handleButtonClick = (e: React.SyntheticEvent<HTMLButtonElement>) => {\n callback(e.currentTarget.value as CurrencyPowerBalanceTimeUnit);\n };\n\n return (\n <>\n {isDesktop\n ? (\n <div data-testid=\"time-unit-switch\" className=\"lw-mb-6 lw-flex lw-gap-1 lw-self-end\">\n {options.map((item) => {\n const tooltip = labelCallback && item.tooltip\n ? labelCallback(item.tooltip)\n : item.tooltip;\n const label = labelCallback ? labelCallback(item.label) : item.label;\n\n return (\n <Button\n key={item.value}\n size={ButtonSize.full}\n variant={selected === item.value\n ? ButtonVariant.primary\n : ButtonVariant.secondary}\n onClick={handleButtonClick}\n value={item.value}\n data-tooltip-id={CURRENCY_POWER_BALANCE_TOOLTIP_ID}\n data-tooltip-content={tooltip}\n >\n {label}\n </Button>\n );\n })}\n </div>\n )\n : (\n <TimeUnitSelect\n selected={selected}\n callback={callback}\n options={options}\n labelCallback={labelCallback}\n />\n )}\n </>\n );\n};\n\nexport { TimeUnitSwitch };\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,iBAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AAGA,IAAAG,UAAA,GAAAH,OAAA;AACA,IAAAI,eAAA,GAAAJ,OAAA;AAAkD,SAAAD,uBAAAM,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAElD,MAAMG,cAAc,GAAGC,IAAA,IAEI;EAAA,IAFH;IACtBC,QAAQ;IAAEC,OAAO;IAAEC,QAAQ;IAAEC;EACV,CAAC,GAAAJ,IAAA;EACpB,MAAMK,SAAS,GAAG,IAAAC,yBAAa,EAAC,oBAAoB,CAAC;EAErD,MAAMC,iBAAiB,GAAIC,CAA0C,IAAK;IACxEL,QAAQ,CAACK,CAAC,CAACC,aAAa,CAACC,KAAqC,CAAC;EACjE,CAAC;EAED,OACErB,MAAA,CAAAS,OAAA,CAAAa,aAAA,CAAAtB,MAAA,CAAAS,OAAA,CAAAc,QAAA,QACGP,SAAS,GAENhB,MAAA,CAAAS,OAAA,CAAAa,aAAA;IAAK,eAAY,kBAAkB;IAACE,SAAS,EAAC;EAAsC,GACjFX,OAAO,CAACY,GAAG,CAAEC,IAAI,IAAK;IACrB,MAAMC,OAAO,GAAGZ,aAAa,IAAIW,IAAI,CAACC,OAAO,GACzCZ,aAAa,CAACW,IAAI,CAACC,OAAO,CAAC,GAC3BD,IAAI,CAACC,OAAO;IAChB,MAAMC,KAAK,GAAGb,aAAa,GAAGA,aAAa,CAACW,IAAI,CAACE,KAAK,CAAC,GAAGF,IAAI,CAACE,KAAK;IAEpE,OACE5B,MAAA,CAAAS,OAAA,CAAAa,aAAA,CAACnB,iBAAA,CAAA0B,MAAM;MACLC,GAAG,EAAEJ,IAAI,CAACL,KAAM;MAChBU,IAAI,EAAEC,4BAAU,CAACC,IAAK;MACtBC,OAAO,EAAEtB,QAAQ,KAAKc,IAAI,CAACL,KAAK,GAC5Bc,+BAAa,CAACC,OAAO,GACrBD,+BAAa,CAACE,SAAU;MAC5BC,OAAO,EAAEpB,iBAAkB;MAC3BG,KAAK,EAAEK,IAAI,CAACL,KAAM;MAClB,mBAAiBkB,4CAAkC;MACnD,wBAAsBZ;IAAQ,GAE7BC,KACK,CAAC;EAEb,CAAC,CACE,CAAC,GAGN5B,MAAA,CAAAS,OAAA,CAAAa,aAAA,CAAChB,eAAA,CAAAkC,cAAc;IACb5B,QAAQ,EAAEA,QAAS;IACnBE,QAAQ,EAAEA,QAAS;IACnBD,OAAO,EAAEA,OAAQ;IACjBE,aAAa,EAAEA;EAAc,CAC9B,CAEL,CAAC;AAEP,CAAC;AAAC0B,OAAA,CAAA/B,cAAA,GAAAA,cAAA"}
@@ -20,7 +20,7 @@ const timeUnitConfig = exports.timeUnitConfig = [{
20
20
  }, {
21
21
  value: _graphql.CurrencyPowerBalanceTimeUnit.H24,
22
22
  label: '24h',
23
- tooltip: '24_months'
23
+ tooltip: '24_hours'
24
24
  }, {
25
25
  value: _graphql.CurrencyPowerBalanceTimeUnit.H8,
26
26
  label: '8h',
@@ -31,9 +31,9 @@ const timeUnitConfig = exports.timeUnitConfig = [{
31
31
  tooltip: '4_hours'
32
32
  }, {
33
33
  value: _graphql.CurrencyPowerBalanceTimeUnit.PreviousDay,
34
- label: 'Previous Business Day'
34
+ label: 'previous_business_day'
35
35
  }, {
36
36
  value: _graphql.CurrencyPowerBalanceTimeUnit.CurrentDay,
37
- label: 'Current Business Day'
37
+ label: 'current_business_day'
38
38
  }];
39
39
  //# sourceMappingURL=config.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"config.js","names":["_graphql","require","timeUnitConfig","exports","value","CurrencyPowerBalanceTimeUnit","M3","label","tooltip","M1","W1","H24","H8","H4","PreviousDay","CurrentDay"],"sources":["../../../src/CurrencyPowerBalanceWidget/config.ts"],"sourcesContent":["import { CurrencyPowerBalanceTimeUnit } from '../gql/types/graphql';\n\nconst timeUnitConfig = [\n {\n value: CurrencyPowerBalanceTimeUnit.M3,\n label: '3m',\n tooltip: '3_months',\n },\n {\n value: CurrencyPowerBalanceTimeUnit.M1,\n label: '1m',\n tooltip: '1_month',\n },\n {\n value: CurrencyPowerBalanceTimeUnit.W1,\n label: '1w',\n tooltip: '1_week',\n },\n {\n value: CurrencyPowerBalanceTimeUnit.H24,\n label: '24h',\n tooltip: '24_months',\n },\n { value: CurrencyPowerBalanceTimeUnit.H8, label: '8h', tooltip: '8_hours' },\n { value: CurrencyPowerBalanceTimeUnit.H4, label: '4h', tooltip: '4_hours' },\n { value: CurrencyPowerBalanceTimeUnit.PreviousDay, label: 'Previous Business Day' },\n { value: CurrencyPowerBalanceTimeUnit.CurrentDay, label: 'Current Business Day' },\n];\n\nexport { timeUnitConfig };\n"],"mappings":";;;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AAEA,MAAMC,cAAc,GAAAC,OAAA,CAAAD,cAAA,GAAG,CACrB;EACEE,KAAK,EAAEC,qCAA4B,CAACC,EAAE;EACtCC,KAAK,EAAE,IAAI;EACXC,OAAO,EAAE;AACX,CAAC,EACD;EACEJ,KAAK,EAAEC,qCAA4B,CAACI,EAAE;EACtCF,KAAK,EAAE,IAAI;EACXC,OAAO,EAAE;AACX,CAAC,EACD;EACEJ,KAAK,EAAEC,qCAA4B,CAACK,EAAE;EACtCH,KAAK,EAAE,IAAI;EACXC,OAAO,EAAE;AACX,CAAC,EACD;EACEJ,KAAK,EAAEC,qCAA4B,CAACM,GAAG;EACvCJ,KAAK,EAAE,KAAK;EACZC,OAAO,EAAE;AACX,CAAC,EACD;EAAEJ,KAAK,EAAEC,qCAA4B,CAACO,EAAE;EAAEL,KAAK,EAAE,IAAI;EAAEC,OAAO,EAAE;AAAU,CAAC,EAC3E;EAAEJ,KAAK,EAAEC,qCAA4B,CAACQ,EAAE;EAAEN,KAAK,EAAE,IAAI;EAAEC,OAAO,EAAE;AAAU,CAAC,EAC3E;EAAEJ,KAAK,EAAEC,qCAA4B,CAACS,WAAW;EAAEP,KAAK,EAAE;AAAwB,CAAC,EACnF;EAAEH,KAAK,EAAEC,qCAA4B,CAACU,UAAU;EAAER,KAAK,EAAE;AAAuB,CAAC,CAClF"}
1
+ {"version":3,"file":"config.js","names":["_graphql","require","timeUnitConfig","exports","value","CurrencyPowerBalanceTimeUnit","M3","label","tooltip","M1","W1","H24","H8","H4","PreviousDay","CurrentDay"],"sources":["../../../src/CurrencyPowerBalanceWidget/config.ts"],"sourcesContent":["import { CurrencyPowerBalanceTimeUnit } from '../gql/types/graphql';\n\nconst timeUnitConfig = [\n {\n value: CurrencyPowerBalanceTimeUnit.M3,\n label: '3m',\n tooltip: '3_months',\n },\n {\n value: CurrencyPowerBalanceTimeUnit.M1,\n label: '1m',\n tooltip: '1_month',\n },\n {\n value: CurrencyPowerBalanceTimeUnit.W1,\n label: '1w',\n tooltip: '1_week',\n },\n {\n value: CurrencyPowerBalanceTimeUnit.H24,\n label: '24h',\n tooltip: '24_hours',\n },\n { value: CurrencyPowerBalanceTimeUnit.H8, label: '8h', tooltip: '8_hours' },\n { value: CurrencyPowerBalanceTimeUnit.H4, label: '4h', tooltip: '4_hours' },\n { value: CurrencyPowerBalanceTimeUnit.PreviousDay, label: 'previous_business_day' },\n { value: CurrencyPowerBalanceTimeUnit.CurrentDay, label: 'current_business_day' },\n];\n\nexport { timeUnitConfig };\n"],"mappings":";;;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AAEA,MAAMC,cAAc,GAAAC,OAAA,CAAAD,cAAA,GAAG,CACrB;EACEE,KAAK,EAAEC,qCAA4B,CAACC,EAAE;EACtCC,KAAK,EAAE,IAAI;EACXC,OAAO,EAAE;AACX,CAAC,EACD;EACEJ,KAAK,EAAEC,qCAA4B,CAACI,EAAE;EACtCF,KAAK,EAAE,IAAI;EACXC,OAAO,EAAE;AACX,CAAC,EACD;EACEJ,KAAK,EAAEC,qCAA4B,CAACK,EAAE;EACtCH,KAAK,EAAE,IAAI;EACXC,OAAO,EAAE;AACX,CAAC,EACD;EACEJ,KAAK,EAAEC,qCAA4B,CAACM,GAAG;EACvCJ,KAAK,EAAE,KAAK;EACZC,OAAO,EAAE;AACX,CAAC,EACD;EAAEJ,KAAK,EAAEC,qCAA4B,CAACO,EAAE;EAAEL,KAAK,EAAE,IAAI;EAAEC,OAAO,EAAE;AAAU,CAAC,EAC3E;EAAEJ,KAAK,EAAEC,qCAA4B,CAACQ,EAAE;EAAEN,KAAK,EAAE,IAAI;EAAEC,OAAO,EAAE;AAAU,CAAC,EAC3E;EAAEJ,KAAK,EAAEC,qCAA4B,CAACS,WAAW;EAAEP,KAAK,EAAE;AAAwB,CAAC,EACnF;EAAEH,KAAK,EAAEC,qCAA4B,CAACU,UAAU;EAAER,KAAK,EAAE;AAAuB,CAAC,CAClF"}
@@ -6,7 +6,8 @@ var _CurrencyPowerBalance = require("./CurrencyPowerBalance");
6
6
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
7
7
  const {
8
8
  graphqlUrl: configGraphQl,
9
- renderElementId: configRenderElementId
9
+ renderElementId: configRenderElementId,
10
+ locale: configLocale
10
11
  } = window.currencyPowerBalanceWidgetConfig || {};
11
12
  const {
12
13
  graphqlUrl
@@ -14,14 +15,20 @@ const {
14
15
  const currencyPowerBalanceParamsElements = document.querySelectorAll('div[data-currency-power-balance-params]');
15
16
  if (currencyPowerBalanceParamsElements.length > 0) {
16
17
  currencyPowerBalanceParamsElements.forEach(element => {
18
+ const params = element.getAttribute('data-currency-power-balance-params');
17
19
  const mode = element.getAttribute('data-mode');
20
+ const {
21
+ locale
22
+ } = JSON.parse(params);
18
23
  (0, _reactDom.render)(_react.default.createElement(_CurrencyPowerBalance.CurrencyPowerBalance, {
19
24
  graphqlUrl: graphqlUrl,
25
+ locale: locale,
20
26
  theme: mode
21
27
  }), element);
22
28
  });
23
29
  } else {
24
30
  (0, _reactDom.render)(_react.default.createElement(_CurrencyPowerBalance.CurrencyPowerBalance, {
31
+ locale: configLocale,
25
32
  graphqlUrl: configGraphQl
26
33
  }), document.getElementById(configRenderElementId));
27
34
  }
@@ -1 +1 @@
1
- {"version":3,"file":"render.js","names":["_react","_interopRequireDefault","require","_reactDom","_CurrencyPowerBalance","obj","__esModule","default","graphqlUrl","configGraphQl","renderElementId","configRenderElementId","window","currencyPowerBalanceWidgetConfig","widgetsConfig","currencyPowerBalanceParamsElements","document","querySelectorAll","length","forEach","element","mode","getAttribute","render","createElement","CurrencyPowerBalance","theme","getElementById"],"sources":["../../../src/CurrencyPowerBalanceWidget/render.tsx"],"sourcesContent":["import React from 'react';\nimport { render } from 'react-dom';\nimport { Theme } from '@oanda/labs-widget-common';\nimport { CurrencyPowerBalance } from './CurrencyPowerBalance';\n\nconst {\n graphqlUrl: configGraphQl,\n renderElementId: configRenderElementId,\n} = window.currencyPowerBalanceWidgetConfig || {};\n\nconst {\n graphqlUrl,\n} = window.widgetsConfig || {};\n\nconst currencyPowerBalanceParamsElements = document.querySelectorAll('div[data-currency-power-balance-params]');\n\nif (currencyPowerBalanceParamsElements.length > 0) {\n currencyPowerBalanceParamsElements.forEach((element) => {\n const mode = element.getAttribute('data-mode');\n\n render(\n <CurrencyPowerBalance\n graphqlUrl={graphqlUrl}\n theme={mode as Theme}\n />,\n element,\n );\n });\n} else {\n render(\n <CurrencyPowerBalance\n graphqlUrl={configGraphQl}\n />,\n document.getElementById(configRenderElementId),\n );\n}\n"],"mappings":";;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AAEA,IAAAE,qBAAA,GAAAF,OAAA;AAA8D,SAAAD,uBAAAI,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAE9D,MAAM;EACJG,UAAU,EAAEC,aAAa;EACzBC,eAAe,EAAEC;AACnB,CAAC,GAAGC,MAAM,CAACC,gCAAgC,IAAI,CAAC,CAAC;AAEjD,MAAM;EACJL;AACF,CAAC,GAAGI,MAAM,CAACE,aAAa,IAAI,CAAC,CAAC;AAE9B,MAAMC,kCAAkC,GAAGC,QAAQ,CAACC,gBAAgB,CAAC,yCAAyC,CAAC;AAE/G,IAAIF,kCAAkC,CAACG,MAAM,GAAG,CAAC,EAAE;EACjDH,kCAAkC,CAACI,OAAO,CAAEC,OAAO,IAAK;IACtD,MAAMC,IAAI,GAAGD,OAAO,CAACE,YAAY,CAAC,WAAW,CAAC;IAE9C,IAAAC,gBAAM,EACJvB,MAAA,CAAAO,OAAA,CAAAiB,aAAA,CAACpB,qBAAA,CAAAqB,oBAAoB;MACnBjB,UAAU,EAAEA,UAAW;MACvBkB,KAAK,EAAEL;IAAc,CACtB,CAAC,EACFD,OACF,CAAC;EACH,CAAC,CAAC;AACJ,CAAC,MAAM;EACL,IAAAG,gBAAM,EACJvB,MAAA,CAAAO,OAAA,CAAAiB,aAAA,CAACpB,qBAAA,CAAAqB,oBAAoB;IACnBjB,UAAU,EAAEC;EAAc,CAC3B,CAAC,EACFO,QAAQ,CAACW,cAAc,CAAChB,qBAAqB,CAC/C,CAAC;AACH"}
1
+ {"version":3,"file":"render.js","names":["_react","_interopRequireDefault","require","_reactDom","_CurrencyPowerBalance","obj","__esModule","default","graphqlUrl","configGraphQl","renderElementId","configRenderElementId","locale","configLocale","window","currencyPowerBalanceWidgetConfig","widgetsConfig","currencyPowerBalanceParamsElements","document","querySelectorAll","length","forEach","element","params","getAttribute","mode","JSON","parse","render","createElement","CurrencyPowerBalance","theme","getElementById"],"sources":["../../../src/CurrencyPowerBalanceWidget/render.tsx"],"sourcesContent":["import React from 'react';\nimport { render } from 'react-dom';\nimport { Theme } from '@oanda/labs-widget-common';\nimport { CurrencyPowerBalance } from './CurrencyPowerBalance';\n\nconst {\n graphqlUrl: configGraphQl,\n renderElementId: configRenderElementId,\n locale: configLocale,\n} = window.currencyPowerBalanceWidgetConfig || {};\n\nconst {\n graphqlUrl,\n} = window.widgetsConfig || {};\n\nconst currencyPowerBalanceParamsElements = document.querySelectorAll('div[data-currency-power-balance-params]');\n\nif (currencyPowerBalanceParamsElements.length > 0) {\n currencyPowerBalanceParamsElements.forEach((element) => {\n const params = element.getAttribute('data-currency-power-balance-params');\n const mode = element.getAttribute('data-mode');\n const { locale } = JSON.parse(params as string);\n\n render(\n <CurrencyPowerBalance\n graphqlUrl={graphqlUrl}\n locale={locale}\n theme={mode as Theme}\n />,\n element,\n );\n });\n} else {\n render(\n <CurrencyPowerBalance\n locale={configLocale}\n graphqlUrl={configGraphQl}\n />,\n document.getElementById(configRenderElementId),\n );\n}\n"],"mappings":";;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AAEA,IAAAE,qBAAA,GAAAF,OAAA;AAA8D,SAAAD,uBAAAI,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAE9D,MAAM;EACJG,UAAU,EAAEC,aAAa;EACzBC,eAAe,EAAEC,qBAAqB;EACtCC,MAAM,EAAEC;AACV,CAAC,GAAGC,MAAM,CAACC,gCAAgC,IAAI,CAAC,CAAC;AAEjD,MAAM;EACJP;AACF,CAAC,GAAGM,MAAM,CAACE,aAAa,IAAI,CAAC,CAAC;AAE9B,MAAMC,kCAAkC,GAAGC,QAAQ,CAACC,gBAAgB,CAAC,yCAAyC,CAAC;AAE/G,IAAIF,kCAAkC,CAACG,MAAM,GAAG,CAAC,EAAE;EACjDH,kCAAkC,CAACI,OAAO,CAAEC,OAAO,IAAK;IACtD,MAAMC,MAAM,GAAGD,OAAO,CAACE,YAAY,CAAC,oCAAoC,CAAC;IACzE,MAAMC,IAAI,GAAGH,OAAO,CAACE,YAAY,CAAC,WAAW,CAAC;IAC9C,MAAM;MAAEZ;IAAO,CAAC,GAAGc,IAAI,CAACC,KAAK,CAACJ,MAAgB,CAAC;IAE/C,IAAAK,gBAAM,EACJ5B,MAAA,CAAAO,OAAA,CAAAsB,aAAA,CAACzB,qBAAA,CAAA0B,oBAAoB;MACnBtB,UAAU,EAAEA,UAAW;MACvBI,MAAM,EAAEA,MAAO;MACfmB,KAAK,EAAEN;IAAc,CACtB,CAAC,EACFH,OACF,CAAC;EACH,CAAC,CAAC;AACJ,CAAC,MAAM;EACL,IAAAM,gBAAM,EACJ5B,MAAA,CAAAO,OAAA,CAAAsB,aAAA,CAACzB,qBAAA,CAAA0B,oBAAoB;IACnBlB,MAAM,EAAEC,YAAa;IACrBL,UAAU,EAAEC;EAAc,CAC3B,CAAC,EACFS,QAAQ,CAACc,cAAc,CAACrB,qBAAqB,CAC/C,CAAC;AACH"}
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","names":[],"sources":["../../../src/CurrencyPowerBalanceWidget/types.ts"],"sourcesContent":["import { Theme } from '@oanda/labs-widget-common';\nimport { CurrencyPowerBalanceTimeUnit } from '../gql/types/graphql';\n\nexport interface CurrencyPowerBalanceConfig {\n graphqlUrl: string;\n theme?: Theme;\n}\n\nexport interface CurrencyPowerBalanceWrapperConfig extends CurrencyPowerBalanceConfig {\n renderElementId: string;\n}\n\nexport interface ChartWithDataProps {\n timeUnit: CurrencyPowerBalanceTimeUnit;\n}\n"],"mappings":""}
1
+ {"version":3,"file":"types.js","names":[],"sources":["../../../src/CurrencyPowerBalanceWidget/types.ts"],"sourcesContent":["import { Locale } from '@oanda/mono-i18n';\nimport { Theme } from '@oanda/labs-widget-common';\nimport { CurrencyPowerBalanceTimeUnit } from '../gql/types/graphql';\n\nexport interface CurrencyPowerBalanceConfig {\n graphqlUrl: string;\n locale: Locale;\n theme?: Theme;\n}\n\nexport interface CurrencyPowerBalanceWrapperConfig extends CurrencyPowerBalanceConfig {\n renderElementId: string;\n locale: Locale;\n}\n\nexport interface ChartWithDataProps {\n timeUnit: CurrencyPowerBalanceTimeUnit;\n}\n"],"mappings":""}
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.translations = void 0;
7
+ var _monoI18n = require("@oanda/mono-i18n");
8
+ var _en = _interopRequireDefault(require("./sources/en.json"));
9
+ var _zh_TW = _interopRequireDefault(require("./sources/zh_TW.json"));
10
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
+ const translations = exports.translations = {
12
+ [_monoI18n.Locale.en]: {
13
+ translation: _en.default
14
+ },
15
+ [_monoI18n.Locale.zhTW]: {
16
+ translation: _zh_TW.default
17
+ }
18
+ };
19
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":["_monoI18n","require","_en","_interopRequireDefault","_zh_TW","obj","__esModule","default","translations","exports","Locale","en","translation","zhTW"],"sources":["../../../src/translations/index.ts"],"sourcesContent":["import { Locale, Translations } from '@oanda/mono-i18n';\n\nimport en from './sources/en.json';\nimport zhTW from './sources/zh_TW.json';\n\nimport { defaultTranslations } from './translations';\n\nexport type TranslationKey = keyof typeof defaultTranslations;\n\nexport const translations: Translations = {\n [Locale.en]: { translation: en },\n [Locale.zhTW]: { translation: zhTW },\n};\n"],"mappings":";;;;;;AAAA,IAAAA,SAAA,GAAAC,OAAA;AAEA,IAAAC,GAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,MAAA,GAAAD,sBAAA,CAAAF,OAAA;AAAwC,SAAAE,uBAAAE,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAMjC,MAAMG,YAA0B,GAAAC,OAAA,CAAAD,YAAA,GAAG;EACxC,CAACE,gBAAM,CAACC,EAAE,GAAG;IAAEC,WAAW,EAAED;EAAG,CAAC;EAChC,CAACD,gBAAM,CAACG,IAAI,GAAG;IAAED,WAAW,EAAEC;EAAK;AACrC,CAAC"}
@@ -0,0 +1,18 @@
1
+ {
2
+ "1_month": "1 month",
3
+ "1_week": "1 week",
4
+ "1m": "1M",
5
+ "1w": "1W",
6
+ "24_hours": "24 hours",
7
+ "24h": "24H",
8
+ "3_months": "3 months",
9
+ "3m": "3M",
10
+ "4_hours": "4 hours",
11
+ "4h": "4H",
12
+ "8_hours": "8 hours",
13
+ "8h": "8H",
14
+ "current_business_day": "Current Business Day",
15
+ "data_unavailable": "Data unavailable",
16
+ "pagination_entries_range": "{{firstItemOnPage}}-{{lastItemOnPage}} of {{itemCount}} entries",
17
+ "previous_business_day": "Previous Business Day"
18
+ }
@@ -0,0 +1,18 @@
1
+ {
2
+ "1_month": "1 個月",
3
+ "1_week": "1星期",
4
+ "1m": "1M",
5
+ "1w": "1W",
6
+ "24_hours": "24小時",
7
+ "24h": "24H",
8
+ "3_months": "3 個月",
9
+ "3m": "3M",
10
+ "4_hours": "4小時",
11
+ "4h": "4H",
12
+ "8_hours": "8小時",
13
+ "8h": "8H",
14
+ "current_business_day": "目前營業日",
15
+ "data_unavailable": "沒有數據",
16
+ "pagination_entries_range": "{{itemCount}}个挂单中的{{firstItemOnPage}}-{{lastItemOnPage}}",
17
+ "previous_business_day": "前一營業日"
18
+ }
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.defaultTranslations = void 0;
7
+ const defaultTranslations = exports.defaultTranslations = {
8
+ '1_month': '1 month',
9
+ '1_week': '1 week',
10
+ '1m': '1M',
11
+ '1w': '1W',
12
+ '24_hours': '24 hours',
13
+ '24h': '24H',
14
+ '3_months': '3 months',
15
+ '3m': '3M',
16
+ '4_hours': '4 hours',
17
+ '4h': '4H',
18
+ '8_hours': '8 hours',
19
+ '8h': '8H',
20
+ current_business_day: 'Current Business Day',
21
+ data_unavailable: 'Data unavailable',
22
+ pagination_entries_range: '{{firstItemOnPage}}-{{lastItemOnPage}} of {{itemCount}} entries',
23
+ previous_business_day: 'Previous Business Day'
24
+ };
25
+ //# sourceMappingURL=translations.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"translations.js","names":["defaultTranslations","exports","current_business_day","data_unavailable","pagination_entries_range","previous_business_day"],"sources":["../../../src/translations/translations.ts"],"sourcesContent":["export const defaultTranslations = {\n '1_month': '1 month',\n '1_week': '1 week',\n '1m': '1M',\n '1w': '1W',\n '24_hours': '24 hours',\n '24h': '24H',\n '3_months': '3 months',\n '3m': '3M',\n '4_hours': '4 hours',\n '4h': '4H',\n '8_hours': '8 hours',\n '8h': '8H',\n current_business_day: 'Current Business Day',\n data_unavailable: 'Data unavailable',\n pagination_entries_range: '{{firstItemOnPage}}-{{lastItemOnPage}} of {{itemCount}} entries',\n previous_business_day: 'Previous Business Day',\n};\n"],"mappings":";;;;;;AAAO,MAAMA,mBAAmB,GAAAC,OAAA,CAAAD,mBAAA,GAAG;EACjC,SAAS,EAAE,SAAS;EACpB,QAAQ,EAAE,QAAQ;EAClB,IAAI,EAAE,IAAI;EACV,IAAI,EAAE,IAAI;EACV,UAAU,EAAE,UAAU;EACtB,KAAK,EAAE,KAAK;EACZ,UAAU,EAAE,UAAU;EACtB,IAAI,EAAE,IAAI;EACV,SAAS,EAAE,SAAS;EACpB,IAAI,EAAE,IAAI;EACV,SAAS,EAAE,SAAS;EACpB,IAAI,EAAE,IAAI;EACVE,oBAAoB,EAAE,sBAAsB;EAC5CC,gBAAgB,EAAE,kBAAkB;EACpCC,wBAAwB,EAAE,iEAAiE;EAC3FC,qBAAqB,EAAE;AACzB,CAAC"}
@@ -18,7 +18,8 @@ const ChartWithData = _ref => {
18
18
  } = useQuery(getCurrencyPowerBalance, {
19
19
  variables: {
20
20
  timeUnit
21
- }
21
+ },
22
+ fetchPolicy: 'cache-and-network'
22
23
  });
23
24
  const showChart = (data === null || data === void 0 ? void 0 : data.currencyPowerBalance) && (data === null || data === void 0 || (_data$currencyPowerBa = data.currencyPowerBalance) === null || _data$currencyPowerBa === void 0 ? void 0 : _data$currencyPowerBa.length) > 0;
24
25
  const showError = (data === null || data === void 0 || (_data$currencyPowerBa2 = data.currencyPowerBalance) === null || _data$currencyPowerBa2 === void 0 ? void 0 : _data$currencyPowerBa2.length) === 0 || error;
@@ -1 +1 @@
1
- {"version":3,"file":"ChartWithData.js","names":["React","useQuery","ChartError","Spinner","SpinnerSize","Tooltip","useMediaQuery","Chart","CURRENCY_POWER_BALANCE_TOOLTIP_ID","getCurrencyPowerBalance","ChartWithData","_ref","_data$currencyPowerBa","_data$currencyPowerBa2","timeUnit","isDesktop","loading","data","error","variables","showChart","currencyPowerBalance","length","showError","createElement","Fragment","className","size","lg","values","id"],"sources":["../../../src/CurrencyPowerBalanceWidget/ChartWithData.tsx"],"sourcesContent":["import React from 'react';\nimport { useQuery } from '@apollo/client';\nimport {\n ChartError, Spinner, SpinnerSize, Tooltip,\n} from '@oanda/labs-widget-common';\nimport { useMediaQuery } from 'usehooks-ts';\nimport { Chart } from './components/Chart';\nimport { CURRENCY_POWER_BALANCE_TOOLTIP_ID } from './constants';\nimport { getCurrencyPowerBalance } from '../gql/getCurrencyPowerBalance';\nimport { ChartWithDataProps } from './types';\nimport { GetCurrencyPowerBalanceQuery, GetCurrencyPowerBalanceQueryVariables } from '../gql/types/graphql';\n\nconst ChartWithData = ({ timeUnit }: ChartWithDataProps) => {\n const isDesktop = useMediaQuery('(min-width: 768px)');\n const { loading, data, error } = useQuery<\n GetCurrencyPowerBalanceQuery,\n GetCurrencyPowerBalanceQueryVariables\n >(getCurrencyPowerBalance, {\n variables: {\n timeUnit,\n },\n });\n\n const showChart = data?.currencyPowerBalance && data?.currencyPowerBalance?.length > 0;\n const showError = data?.currencyPowerBalance?.length === 0 || error;\n\n return (\n <>\n {loading\n && (\n <div className=\"lw-flex lw-h-[425px] 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 && showChart && (\n <Chart values={data?.currencyPowerBalance!} timeUnit={timeUnit} />\n )}\n {!loading && showError && (\n <div className=\"lw-flex lw-h-[425px] lw-w-full lw-items-center lw-border lw-border-solid lw-border-border-primary\">\n <ChartError />\n </div>\n )}\n {isDesktop && <Tooltip id={CURRENCY_POWER_BALANCE_TOOLTIP_ID} />}\n </>\n );\n};\n\nexport { ChartWithData };\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,QAAQ,QAAQ,gBAAgB;AACzC,SACEC,UAAU,EAAEC,OAAO,EAAEC,WAAW,EAAEC,OAAO,QACpC,2BAA2B;AAClC,SAASC,aAAa,QAAQ,aAAa;AAC3C,SAASC,KAAK,QAAQ,oBAAoB;AAC1C,SAASC,iCAAiC,QAAQ,aAAa;AAC/D,SAASC,uBAAuB,QAAQ,gCAAgC;AAIxE,MAAMC,aAAa,GAAGC,IAAA,IAAsC;EAAA,IAAAC,qBAAA,EAAAC,sBAAA;EAAA,IAArC;IAAEC;EAA6B,CAAC,GAAAH,IAAA;EACrD,MAAMI,SAAS,GAAGT,aAAa,CAAC,oBAAoB,CAAC;EACrD,MAAM;IAAEU,OAAO;IAAEC,IAAI;IAAEC;EAAM,CAAC,GAAGjB,QAAQ,CAGvCQ,uBAAuB,EAAE;IACzBU,SAAS,EAAE;MACTL;IACF;EACF,CAAC,CAAC;EAEF,MAAMM,SAAS,GAAG,CAAAH,IAAI,aAAJA,IAAI,uBAAJA,IAAI,CAAEI,oBAAoB,KAAI,CAAAJ,IAAI,aAAJA,IAAI,gBAAAL,qBAAA,GAAJK,IAAI,CAAEI,oBAAoB,cAAAT,qBAAA,uBAA1BA,qBAAA,CAA4BU,MAAM,IAAG,CAAC;EACtF,MAAMC,SAAS,GAAG,CAAAN,IAAI,aAAJA,IAAI,gBAAAJ,sBAAA,GAAJI,IAAI,CAAEI,oBAAoB,cAAAR,sBAAA,uBAA1BA,sBAAA,CAA4BS,MAAM,MAAK,CAAC,IAAIJ,KAAK;EAEnE,OACElB,KAAA,CAAAwB,aAAA,CAAAxB,KAAA,CAAAyB,QAAA,QACGT,OAAO,IAERhB,KAAA,CAAAwB,aAAA;IAAKE,SAAS,EAAC;EAAmG,GAChH1B,KAAA,CAAAwB,aAAA,CAACrB,OAAO;IAACwB,IAAI,EAAEvB,WAAW,CAACwB;EAAG,CAAE,CAC7B,CACJ,EACA,CAACZ,OAAO,IAAII,SAAS,IACpBpB,KAAA,CAAAwB,aAAA,CAACjB,KAAK;IAACsB,MAAM,EAAEZ,IAAI,aAAJA,IAAI,uBAAJA,IAAI,CAAEI,oBAAsB;IAACP,QAAQ,EAAEA;EAAS,CAAE,CAClE,EACA,CAACE,OAAO,IAAIO,SAAS,IACpBvB,KAAA,CAAAwB,aAAA;IAAKE,SAAS,EAAC;EAAmG,GAChH1B,KAAA,CAAAwB,aAAA,CAACtB,UAAU,MAAE,CACV,CACN,EACAa,SAAS,IAAIf,KAAA,CAAAwB,aAAA,CAACnB,OAAO;IAACyB,EAAE,EAAEtB;EAAkC,CAAE,CAC/D,CAAC;AAEP,CAAC;AAED,SAASE,aAAa"}
1
+ {"version":3,"file":"ChartWithData.js","names":["React","useQuery","ChartError","Spinner","SpinnerSize","Tooltip","useMediaQuery","Chart","CURRENCY_POWER_BALANCE_TOOLTIP_ID","getCurrencyPowerBalance","ChartWithData","_ref","_data$currencyPowerBa","_data$currencyPowerBa2","timeUnit","isDesktop","loading","data","error","variables","fetchPolicy","showChart","currencyPowerBalance","length","showError","createElement","Fragment","className","size","lg","values","id"],"sources":["../../../src/CurrencyPowerBalanceWidget/ChartWithData.tsx"],"sourcesContent":["import React from 'react';\nimport { useQuery } from '@apollo/client';\nimport {\n ChartError, Spinner, SpinnerSize, Tooltip,\n} from '@oanda/labs-widget-common';\nimport { useMediaQuery } from 'usehooks-ts';\nimport { Chart } from './components/Chart';\nimport { CURRENCY_POWER_BALANCE_TOOLTIP_ID } from './constants';\nimport { getCurrencyPowerBalance } from '../gql/getCurrencyPowerBalance';\nimport { ChartWithDataProps } from './types';\nimport { GetCurrencyPowerBalanceQuery, GetCurrencyPowerBalanceQueryVariables } from '../gql/types/graphql';\n\nconst ChartWithData = ({ timeUnit }: ChartWithDataProps) => {\n const isDesktop = useMediaQuery('(min-width: 768px)');\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 showChart = data?.currencyPowerBalance && data?.currencyPowerBalance?.length > 0;\n const showError = data?.currencyPowerBalance?.length === 0 || error;\n\n return (\n <>\n {loading\n && (\n <div className=\"lw-flex lw-h-[425px] 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 && showChart && (\n <Chart values={data?.currencyPowerBalance!} timeUnit={timeUnit} />\n )}\n {!loading && showError && (\n <div className=\"lw-flex lw-h-[425px] lw-w-full lw-items-center lw-border lw-border-solid lw-border-border-primary\">\n <ChartError />\n </div>\n )}\n {isDesktop && <Tooltip id={CURRENCY_POWER_BALANCE_TOOLTIP_ID} />}\n </>\n );\n};\n\nexport { ChartWithData };\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,QAAQ,QAAQ,gBAAgB;AACzC,SACEC,UAAU,EAAEC,OAAO,EAAEC,WAAW,EAAEC,OAAO,QACpC,2BAA2B;AAClC,SAASC,aAAa,QAAQ,aAAa;AAC3C,SAASC,KAAK,QAAQ,oBAAoB;AAC1C,SAASC,iCAAiC,QAAQ,aAAa;AAC/D,SAASC,uBA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,EAAC;EAAmG,GAChH3B,KAAA,CAAAyB,aAAA,CAACvB,UAAU,MAAE,CACV,CACN,EACAa,SAAS,IAAIf,KAAA,CAAAyB,aAAA,CAACpB,OAAO;IAAC0B,EAAE,EAAEvB;EAAkC,CAAE,CAC/D,CAAC;AAEP,CAAC;AAED,SAASE,aAAa"}
@@ -1,11 +1,14 @@
1
1
  import React from 'react';
2
2
  import { ApolloClient, InMemoryCache, ApolloProvider } from '@apollo/client';
3
- import { ThemeProvider } from '@oanda/labs-widget-common';
3
+ import { ThemeProvider, getLocale } from '@oanda/labs-widget-common';
4
+ import { LocaleProvider } from '@oanda/mono-i18n';
4
5
  import { Main } from './Main';
6
+ import { translations } from '../translations';
5
7
  const CurrencyPowerBalance = _ref => {
6
8
  let {
7
9
  graphqlUrl,
8
- theme
10
+ theme,
11
+ locale
9
12
  } = _ref;
10
13
  const client = new ApolloClient({
11
14
  uri: graphqlUrl,
@@ -13,9 +16,12 @@ const CurrencyPowerBalance = _ref => {
13
16
  });
14
17
  return React.createElement(ThemeProvider, {
15
18
  theme: theme
19
+ }, React.createElement(LocaleProvider, {
20
+ locale: getLocale(locale),
21
+ translations: translations
16
22
  }, React.createElement(ApolloProvider, {
17
23
  client: client
18
- }, React.createElement(Main, null)));
24
+ }, React.createElement(Main, null))));
19
25
  };
20
26
  export { CurrencyPowerBalance };
21
27
  //# sourceMappingURL=CurrencyPowerBalance.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"CurrencyPowerBalance.js","names":["React","ApolloClient","InMemoryCache","ApolloProvider","ThemeProvider","Main","CurrencyPowerBalance","_ref","graphqlUrl","theme","client","uri","cache","createElement"],"sources":["../../../src/CurrencyPowerBalanceWidget/CurrencyPowerBalance.tsx"],"sourcesContent":["import React from 'react';\nimport { ApolloClient, InMemoryCache, ApolloProvider } from '@apollo/client';\nimport { ThemeProvider } from '@oanda/labs-widget-common';\nimport { Main } from './Main';\nimport { CurrencyPowerBalanceConfig } from './types';\n\nconst CurrencyPowerBalance = ({\n graphqlUrl, theme,\n}: CurrencyPowerBalanceConfig) => {\n const client = new ApolloClient({\n uri: graphqlUrl,\n cache: new InMemoryCache(),\n });\n\n return (\n <ThemeProvider theme={theme}>\n <ApolloProvider client={client}>\n <Main />\n </ApolloProvider>\n </ThemeProvider>\n );\n};\n\nexport { CurrencyPowerBalance };\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,YAAY,EAAEC,aAAa,EAAEC,cAAc,QAAQ,gBAAgB;AAC5E,SAASC,aAAa,QAAQ,2BAA2B;AACzD,SAASC,IAAI,QAAQ,QAAQ;AAG7B,MAAMC,oBAAoB,GAAGC,IAAA,IAEK;EAAA,IAFJ;IAC5BC,UAAU;IAAEC;EACc,CAAC,GAAAF,IAAA;EAC3B,MAAMG,MAAM,GAAG,IAAIT,YAAY,CAAC;IAC9BU,GAAG,EAAEH,UAAU;IACfI,KAAK,EAAE,IAAIV,aAAa,CAAC;EAC3B,CAAC,CAAC;EAEF,OACEF,KAAA,CAAAa,aAAA,CAACT,aAAa;IAACK,KAAK,EAAEA;EAAM,GAC1BT,KAAA,CAAAa,aAAA,CAACV,cAAc;IAACO,MAAM,EAAEA;EAAO,GAC7BV,KAAA,CAAAa,aAAA,CAACR,IAAI,MAAE,CACO,CACH,CAAC;AAEpB,CAAC;AAED,SAASC,oBAAoB"}
1
+ {"version":3,"file":"CurrencyPowerBalance.js","names":["React","ApolloClient","InMemoryCache","ApolloProvider","ThemeProvider","getLocale","LocaleProvider","Main","translations","CurrencyPowerBalance","_ref","graphqlUrl","theme","locale","client","uri","cache","createElement"],"sources":["../../../src/CurrencyPowerBalanceWidget/CurrencyPowerBalance.tsx"],"sourcesContent":["import React from 'react';\nimport { ApolloClient, InMemoryCache, ApolloProvider } from '@apollo/client';\nimport { ThemeProvider, getLocale } from '@oanda/labs-widget-common';\nimport { LocaleProvider } from '@oanda/mono-i18n';\nimport { Main } from './Main';\nimport { CurrencyPowerBalanceConfig } from './types';\nimport { translations } from '../translations';\n\nconst CurrencyPowerBalance = ({\n graphqlUrl, theme, locale,\n}: CurrencyPowerBalanceConfig) => {\n const client = new ApolloClient({\n uri: graphqlUrl,\n cache: new InMemoryCache(),\n });\n\n return (\n <ThemeProvider theme={theme}>\n <LocaleProvider locale={getLocale(locale)} translations={translations}>\n <ApolloProvider client={client}>\n <Main />\n </ApolloProvider>\n </LocaleProvider>\n </ThemeProvider>\n );\n};\n\nexport { CurrencyPowerBalance };\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,YAAY,EAAEC,aAAa,EAAEC,cAAc,QAAQ,gBAAgB;AAC5E,SAASC,aAAa,EAAEC,SAAS,QAAQ,2BAA2B;AACpE,SAASC,cAAc,QAAQ,kBAAkB;AACjD,SAASC,IAAI,QAAQ,QAAQ;AAE7B,SAASC,YAAY,QAAQ,iBAAiB;AAE9C,MAAMC,oBAAoB,GAAGC,IAAA,IAEK;EAAA,IAFJ;IAC5BC,UAAU;IAAEC,KAAK;IAAEC;EACO,CAAC,GAAAH,IAAA;EAC3B,MAAMI,MAAM,GAAG,IAAIb,YAAY,CAAC;IAC9Bc,GAAG,EAAEJ,UAAU;IACfK,KAAK,EAAE,IAAId,aAAa,CAAC;EAC3B,CAAC,CAAC;EAEF,OACEF,KAAA,CAAAiB,aAAA,CAACb,aAAa;IAACQ,KAAK,EAAEA;EAAM,GAC1BZ,KAAA,CAAAiB,aAAA,CAACX,cAAc;IAACO,MAAM,EAAER,SAAS,CAACQ,MAAM,CAAE;IAACL,YAAY,EAAEA;EAAa,GACpER,KAAA,CAAAiB,aAAA,CAACd,cAAc;IAACW,MAAM,EAAEA;EAAO,GAC7Bd,KAAA,CAAAiB,aAAA,CAACV,IAAI,MAAE,CACO,CACF,CACH,CAAC;AAEpB,CAAC;AAED,SAASE,oBAAoB"}