@oanda/labs-currency-power-balance-widget 1.0.112 → 1.0.113

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 (119) hide show
  1. package/CHANGELOG.md +456 -0
  2. package/dist/main/CurrencyPowerBalanceWidget/ChartWithData.js +7 -7
  3. package/dist/main/CurrencyPowerBalanceWidget/ChartWithData.js.map +1 -1
  4. package/dist/main/CurrencyPowerBalanceWidget/CurrencyPowerBalance.js +9 -9
  5. package/dist/main/CurrencyPowerBalanceWidget/CurrencyPowerBalance.js.map +1 -1
  6. package/dist/main/CurrencyPowerBalanceWidget/Main.js +10 -10
  7. package/dist/main/CurrencyPowerBalanceWidget/Main.js.map +1 -1
  8. package/dist/main/CurrencyPowerBalanceWidget/components/Chart/Chart.js +11 -11
  9. package/dist/main/CurrencyPowerBalanceWidget/components/Chart/Chart.js.map +1 -1
  10. package/dist/main/CurrencyPowerBalanceWidget/components/Chart/options/constants.js.map +1 -1
  11. package/dist/main/CurrencyPowerBalanceWidget/components/Chart/options/formatters.js.map +1 -1
  12. package/dist/main/CurrencyPowerBalanceWidget/components/Chart/options/getOption.js +1 -1
  13. package/dist/main/CurrencyPowerBalanceWidget/components/Chart/options/getOption.js.map +1 -1
  14. package/dist/main/CurrencyPowerBalanceWidget/components/Chart/options/getResponsiveOption.js.map +1 -1
  15. package/dist/main/CurrencyPowerBalanceWidget/components/Chart/options/types.js.map +1 -1
  16. package/dist/main/CurrencyPowerBalanceWidget/components/Chart/options/utils.js.map +1 -1
  17. package/dist/main/CurrencyPowerBalanceWidget/components/Chart/types.js.map +1 -1
  18. package/dist/main/CurrencyPowerBalanceWidget/components/TimeUnitSwitch/TimeUnitSelect.js +4 -4
  19. package/dist/main/CurrencyPowerBalanceWidget/components/TimeUnitSwitch/TimeUnitSelect.js.map +1 -1
  20. package/dist/main/CurrencyPowerBalanceWidget/components/TimeUnitSwitch/TimeUnitSwitch.js +9 -9
  21. package/dist/main/CurrencyPowerBalanceWidget/components/TimeUnitSwitch/TimeUnitSwitch.js.map +1 -1
  22. package/dist/main/CurrencyPowerBalanceWidget/components/TimeUnitSwitch/types.js.map +1 -1
  23. package/dist/main/CurrencyPowerBalanceWidget/config.js.map +1 -1
  24. package/dist/main/CurrencyPowerBalanceWidget/constants.js.map +1 -1
  25. package/dist/main/CurrencyPowerBalanceWidget/render.js +8 -8
  26. package/dist/main/CurrencyPowerBalanceWidget/render.js.map +1 -1
  27. package/dist/main/CurrencyPowerBalanceWidget/types.js.map +1 -1
  28. package/dist/main/gql/types/fragment-masking.js.map +1 -1
  29. package/dist/main/gql/types/gql.js +1 -1
  30. package/dist/main/gql/types/gql.js.map +1 -1
  31. package/dist/main/gql/types/graphql.js +64 -64
  32. package/dist/main/gql/types/graphql.js.map +1 -1
  33. package/dist/main/gql/types/index.js.map +1 -1
  34. package/dist/main/translations/index.js +1 -1
  35. package/dist/main/translations/index.js.map +1 -1
  36. package/dist/main/translations/translations.js.map +1 -1
  37. package/dist/module/CurrencyPowerBalanceWidget/ChartWithData.js +7 -7
  38. package/dist/module/CurrencyPowerBalanceWidget/ChartWithData.js.map +1 -1
  39. package/dist/module/CurrencyPowerBalanceWidget/CurrencyPowerBalance.js +9 -9
  40. package/dist/module/CurrencyPowerBalanceWidget/CurrencyPowerBalance.js.map +1 -1
  41. package/dist/module/CurrencyPowerBalanceWidget/Main.js +10 -10
  42. package/dist/module/CurrencyPowerBalanceWidget/Main.js.map +1 -1
  43. package/dist/module/CurrencyPowerBalanceWidget/components/Chart/Chart.js +10 -10
  44. package/dist/module/CurrencyPowerBalanceWidget/components/Chart/Chart.js.map +1 -1
  45. package/dist/module/CurrencyPowerBalanceWidget/components/Chart/options/constants.js +1 -1
  46. package/dist/module/CurrencyPowerBalanceWidget/components/Chart/options/constants.js.map +1 -1
  47. package/dist/module/CurrencyPowerBalanceWidget/components/Chart/options/formatters.js +2 -2
  48. package/dist/module/CurrencyPowerBalanceWidget/components/Chart/options/formatters.js.map +1 -1
  49. package/dist/module/CurrencyPowerBalanceWidget/components/Chart/options/getOption.js +2 -2
  50. package/dist/module/CurrencyPowerBalanceWidget/components/Chart/options/getOption.js.map +1 -1
  51. package/dist/module/CurrencyPowerBalanceWidget/components/Chart/options/getResponsiveOption.js.map +1 -1
  52. package/dist/module/CurrencyPowerBalanceWidget/components/Chart/options/types.js.map +1 -1
  53. package/dist/module/CurrencyPowerBalanceWidget/components/Chart/options/utils.js.map +1 -1
  54. package/dist/module/CurrencyPowerBalanceWidget/components/Chart/types.js.map +1 -1
  55. package/dist/module/CurrencyPowerBalanceWidget/components/TimeUnitSwitch/TimeUnitSelect.js +4 -4
  56. package/dist/module/CurrencyPowerBalanceWidget/components/TimeUnitSwitch/TimeUnitSelect.js.map +1 -1
  57. package/dist/module/CurrencyPowerBalanceWidget/components/TimeUnitSwitch/TimeUnitSwitch.js +10 -10
  58. package/dist/module/CurrencyPowerBalanceWidget/components/TimeUnitSwitch/TimeUnitSwitch.js.map +1 -1
  59. package/dist/module/CurrencyPowerBalanceWidget/components/TimeUnitSwitch/types.js.map +1 -1
  60. package/dist/module/CurrencyPowerBalanceWidget/config.js.map +1 -1
  61. package/dist/module/CurrencyPowerBalanceWidget/constants.js.map +1 -1
  62. package/dist/module/CurrencyPowerBalanceWidget/render.js +8 -8
  63. package/dist/module/CurrencyPowerBalanceWidget/render.js.map +1 -1
  64. package/dist/module/CurrencyPowerBalanceWidget/types.js.map +1 -1
  65. package/dist/module/gql/types/fragment-masking.js.map +1 -1
  66. package/dist/module/gql/types/gql.js +1 -1
  67. package/dist/module/gql/types/gql.js.map +1 -1
  68. package/dist/module/gql/types/graphql.js +64 -64
  69. package/dist/module/gql/types/graphql.js.map +1 -1
  70. package/dist/module/gql/types/index.js +2 -2
  71. package/dist/module/gql/types/index.js.map +1 -1
  72. package/dist/module/translations/index.js +1 -1
  73. package/dist/module/translations/index.js.map +1 -1
  74. package/dist/module/translations/translations.js.map +1 -1
  75. package/dist/types/CurrencyPowerBalanceWidget/ChartWithData.d.ts +1 -1
  76. package/dist/types/CurrencyPowerBalanceWidget/CurrencyPowerBalance.d.ts +1 -1
  77. package/dist/types/CurrencyPowerBalanceWidget/Main.d.ts +1 -1
  78. package/dist/types/CurrencyPowerBalanceWidget/components/Chart/Chart.d.ts +1 -1
  79. package/dist/types/CurrencyPowerBalanceWidget/components/Chart/options/constants.d.ts +1 -1
  80. package/dist/types/CurrencyPowerBalanceWidget/components/Chart/options/formatters.d.ts +4 -3
  81. package/dist/types/CurrencyPowerBalanceWidget/components/Chart/options/getOption.d.ts +2 -1
  82. package/dist/types/CurrencyPowerBalanceWidget/components/Chart/options/utils.d.ts +1 -1
  83. package/dist/types/CurrencyPowerBalanceWidget/components/Chart/types.d.ts +1 -1
  84. package/dist/types/CurrencyPowerBalanceWidget/components/TimeUnitSwitch/TimeUnitSelect.d.ts +1 -1
  85. package/dist/types/CurrencyPowerBalanceWidget/components/TimeUnitSwitch/TimeUnitSwitch.d.ts +1 -1
  86. package/dist/types/CurrencyPowerBalanceWidget/components/TimeUnitSwitch/types.d.ts +3 -3
  87. package/dist/types/CurrencyPowerBalanceWidget/types.d.ts +2 -2
  88. package/dist/types/gql/types/gql.d.ts +2 -2
  89. package/dist/types/gql/types/index.d.ts +2 -2
  90. package/dist/types/translations/index.d.ts +2 -2
  91. package/package.json +3 -3
  92. package/src/CurrencyPowerBalanceWidget/ChartWithData.tsx +31 -17
  93. package/src/CurrencyPowerBalanceWidget/CurrencyPowerBalance.tsx +16 -9
  94. package/src/CurrencyPowerBalanceWidget/Main.tsx +18 -9
  95. package/src/CurrencyPowerBalanceWidget/components/Chart/Chart.tsx +25 -20
  96. package/src/CurrencyPowerBalanceWidget/components/Chart/options/constants.ts +11 -10
  97. package/src/CurrencyPowerBalanceWidget/components/Chart/options/formatters.ts +42 -22
  98. package/src/CurrencyPowerBalanceWidget/components/Chart/options/getOption.ts +59 -44
  99. package/src/CurrencyPowerBalanceWidget/components/Chart/options/getResponsiveOption.ts +7 -4
  100. package/src/CurrencyPowerBalanceWidget/components/Chart/options/types.ts +1 -1
  101. package/src/CurrencyPowerBalanceWidget/components/Chart/options/utils.ts +10 -9
  102. package/src/CurrencyPowerBalanceWidget/components/Chart/types.ts +4 -1
  103. package/src/CurrencyPowerBalanceWidget/components/TimeUnitSwitch/TimeUnitSelect.tsx +21 -15
  104. package/src/CurrencyPowerBalanceWidget/components/TimeUnitSwitch/TimeUnitSwitch.tsx +47 -37
  105. package/src/CurrencyPowerBalanceWidget/components/TimeUnitSwitch/types.ts +3 -3
  106. package/src/CurrencyPowerBalanceWidget/config.ts +8 -2
  107. package/src/CurrencyPowerBalanceWidget/constants.ts +2 -1
  108. package/src/CurrencyPowerBalanceWidget/render.tsx +24 -20
  109. package/src/CurrencyPowerBalanceWidget/types.ts +5 -3
  110. package/src/gql/types/fragment-masking.ts +41 -21
  111. package/src/gql/types/gql.ts +7 -3
  112. package/src/gql/types/graphql.ts +117 -44
  113. package/src/gql/types/index.ts +2 -2
  114. package/src/translations/index.ts +4 -4
  115. package/src/translations/translations.ts +2 -1
  116. package/test/Main.test.tsx +28 -14
  117. package/test/chartFormatters.test.ts +84 -24
  118. package/test/responsesMocks.ts +254 -255
  119. package/test/utils.test.ts +0 -1
@@ -4,16 +4,16 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.Chart = void 0;
7
- var _react = _interopRequireWildcard(require("react"));
8
- var _core = _interopRequireDefault(require("echarts-for-react/lib/core"));
9
- var echarts = _interopRequireWildcard(require("echarts/core"));
10
- var _charts = require("echarts/charts");
11
- var _renderers = require("echarts/renderers");
12
- var _components = require("echarts/components");
13
7
  var _labsWidgetCommon = require("@oanda/labs-widget-common");
14
8
  var _monoI18n = require("@oanda/mono-i18n");
15
- var _constants = require("./options/constants");
9
+ var _charts = require("echarts/charts");
10
+ var _components = require("echarts/components");
11
+ var echarts = _interopRequireWildcard(require("echarts/core"));
12
+ var _renderers = require("echarts/renderers");
13
+ var _core2 = _interopRequireDefault(require("echarts-for-react/lib/core"));
14
+ var _react = _interopRequireWildcard(require("react"));
16
15
  var _options = require("./options");
16
+ var _constants = require("./options/constants");
17
17
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
18
18
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
19
19
  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 && {}.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; }
@@ -48,15 +48,15 @@ const Chart = _ref => {
48
48
  echartInstance.setOption((0, _options.getResponsiveOption)(isDesktop, isMobile, isDark));
49
49
  }
50
50
  }, [echartRef, isDesktop, isMobile, isDark]);
51
- return _react.default.createElement(_core.default, {
52
- echarts: echarts,
51
+ return _react.default.createElement(_core2.default, {
53
52
  ref: echartRef,
54
- theme: isDark ? 'dark_theme' : 'light_theme',
53
+ echarts: echarts,
54
+ option: (0, _options.getOption)(chartData, timeUnit, isDark, lang),
55
55
  style: {
56
56
  height: `${_constants.CHART_HEIGHT}px`,
57
57
  width: '100%'
58
58
  },
59
- option: (0, _options.getOption)(chartData, timeUnit, isDark, lang)
59
+ theme: isDark ? 'dark_theme' : 'light_theme'
60
60
  });
61
61
  };
62
62
  exports.Chart = Chart;
@@ -1 +1 @@
1
- {"version":3,"file":"Chart.js","names":["_react","_interopRequireWildcard","require","_core","_interopRequireDefault","echarts","_charts","_renderers","_components","_labsWidgetCommon","_monoI18n","_constants","_options","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","theme","style","height","CHART_HEIGHT","width","option","getOption","exports"],"sources":["../../../../../src/CurrencyPowerBalanceWidget/components/Chart/Chart.tsx"],"sourcesContent":["import React, { useRef, useEffect } from 'react';\nimport ReactEChartsCore from 'echarts-for-react/lib/core';\nimport * as echarts from 'echarts/core';\nimport { LineChart } from 'echarts/charts';\nimport { CanvasRenderer } from 'echarts/renderers';\nimport {\n GridSimpleComponent, GraphicComponent, TooltipComponent, LegendPlainComponent, MarkLineComponent,\n} from 'echarts/components';\nimport {\n Theme, useLayoutProvider, getChartTheme, Size,\n} from '@oanda/labs-widget-common';\nimport { useLocale } from '@oanda/mono-i18n';\nimport {\n CHART_HEIGHT,\n} from './options/constants';\nimport { getResponsiveOption, getOption } from './options';\nimport { 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(null);\n\n const chartData = currencies\n ? values.filter(({ currency }) => currencies.includes(currency))\n : values;\n\n useEffect(() => {\n if (echartRef.current) {\n // @ts-ignore\n const echartInstance = echartRef.current.getEchartsInstance() as echarts.EChartsType;\n\n echartInstance.setOption(\n getResponsiveOption(isDesktop, isMobile, isDark),\n );\n }\n }, [echartRef, isDesktop, isMobile, isDark]);\n\n return (\n <ReactEChartsCore\n echarts={echarts}\n ref={echartRef}\n theme={isDark ? 'dark_theme' : 'light_theme'}\n style={{\n height: `${CHART_HEIGHT}px`,\n width: '100%',\n }}\n option={getOption(chartData, timeUnit, isDark, lang)}\n />\n );\n};\n\nexport { Chart };\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,KAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,OAAA,GAAAJ,uBAAA,CAAAC,OAAA;AACA,IAAAI,OAAA,GAAAJ,OAAA;AACA,IAAAK,UAAA,GAAAL,OAAA;AACA,IAAAM,WAAA,GAAAN,OAAA;AAGA,IAAAO,iBAAA,GAAAP,OAAA;AAGA,IAAAQ,SAAA,GAAAR,OAAA;AACA,IAAAS,UAAA,GAAAT,OAAA;AAGA,IAAAU,QAAA,GAAAV,OAAA;AAA2D,SAAAE,uBAAAS,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,SAAAG,yBAAAH,CAAA,6BAAAI,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAD,wBAAA,YAAAA,CAAAH,CAAA,WAAAA,CAAA,GAAAM,CAAA,GAAAD,CAAA,KAAAL,CAAA;AAAA,SAAAZ,wBAAAY,CAAA,EAAAK,CAAA,SAAAA,CAAA,IAAAL,CAAA,IAAAA,CAAA,CAAAC,UAAA,SAAAD,CAAA,eAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,WAAAE,OAAA,EAAAF,CAAA,QAAAM,CAAA,GAAAH,wBAAA,CAAAE,CAAA,OAAAC,CAAA,IAAAA,C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","_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_HEIGHT}px`,\n width: '100%',\n }}\n theme={isDark ? 'dark_theme' : 'light_theme'}\n />\n );\n};\n\nexport { Chart };\n"],"mappings":";;;;;;AAAA,IAAAA,iBAAA,GAAAC,OAAA;AAMA,IAAAC,SAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,WAAA,GAAAH,OAAA;AAOA,IAAAI,OAAA,GAAAC,uBAAA,CAAAL,OAAA;AACA,IAAAM,UAAA,GAAAN,OAAA;AACA,IAAAO,MAAA,GAAAC,sBAAA,CAAAR,OAAA;AACA,IAAAS,MAAA,GAAAJ,uBAAA,CAAAL,OAAA;AAEA,IAAAU,QAAA,GAAAV,OAAA;AACA,IAAAW,UAAA,GAAAX,OAAA;AAAmD,SAAAQ,uBAAAI,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,SAAAG,yBAAAH,CAAA,6BAAAI,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAD,wBAAA,YAAAA,CAAAH,CAAA,WAAAA,CAAA,GAAAM,CAAA,GAAAD,CAAA,KAAAL,CAAA;AAAA,SAAAP,wBAAAO,CAAA,EAAAK,CAAA,SAAAA,CAAA,IAAAL,CAAA,IAAAA,CAAA,CAAAC,UAAA,SAAAD,CAAA,eAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,WAAAE,OAAA,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AA","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"constants.js","names":["_labsWidgetCommon","require","_graphql","WEEKEND_DURATION","exports","X_LABEL_SIZE","X_LABEL_SIZE_MOBILE","Y_LABEL_SIZE_MOBILE","Y_LABEL_SIZE","CHART_WIDTH","CHART_HEIGHT","LEGEND_HEIGHT","LEGEND_HEIGHT_MOBILE","VERTICAL_LINE_COUNT","CANDLE_NUMBER_HOUR","CANDLE_MINUTE","CURRENCIES_ORDER","CurrencyName","Usd","Eur","Gbp","Cad","Aud","Chf","Jpy","Nzd","COLOR_CONFIG","USD","colorPalette","greenLight","EUR","turquoiseLight","GBP","violetLight","JPY","raspberryLight","CHF","bottleGreenLight75","AUD","orange","CAD","midnight75Lighter","NZD","gold","TOOLTIP_LINE_COLOR_CONFIG","DARK","LIGHT","bottleGreenDark"],"sources":["../../../../../../src/CurrencyPowerBalanceWidget/components/Chart/options/constants.ts"],"sourcesContent":["import { colorPalette } from '@oanda/labs-widget-common';\nimport { CurrencyName } from '../../../../gql/types/graphql';\n\nconst WEEKEND_DURATION = 172800000;\n\nconst X_LABEL_SIZE = 90;\nconst X_LABEL_SIZE_MOBILE = 110;\nconst Y_LABEL_SIZE_MOBILE = 35;\nconst Y_LABEL_SIZE = 45;\nconst CHART_WIDTH = 9999;\nconst CHART_HEIGHT = 425;\nconst LEGEND_HEIGHT = 50;\nconst LEGEND_HEIGHT_MOBILE = 70;\nconst VERTICAL_LINE_COUNT = 10;\nconst CANDLE_NUMBER_HOUR = 12;\nconst CANDLE_MINUTE = 5;\n\nconst CURRENCIES_ORDER: CurrencyName[] = [\n CurrencyName.Usd,\n CurrencyName.Eur,\n CurrencyName.Gbp,\n CurrencyName.Cad,\n CurrencyName.Aud,\n CurrencyName.Chf,\n CurrencyName.Jpy,\n CurrencyName.Nzd,\n];\n\nconst COLOR_CONFIG = {\n USD: colorPalette.greenLight,\n EUR: colorPalette.turquoiseLight,\n GBP: colorPalette.violetLight,\n JPY: colorPalette.raspberryLight,\n CHF: colorPalette.bottleGreenLight75,\n AUD: colorPalette.orange,\n CAD: colorPalette.midnight75Lighter,\n NZD: colorPalette.gold,\n};\n\nconst TOOLTIP_LINE_COLOR_CONFIG = {\n DARK: colorPalette.orange,\n LIGHT: colorPalette.bottleGreenDark,\n};\n\nexport {\n X_LABEL_SIZE,\n X_LABEL_SIZE_MOBILE,\n Y_LABEL_SIZE_MOBILE,\n Y_LABEL_SIZE,\n CHART_WIDTH,\n CHART_HEIGHT,\n LEGEND_HEIGHT,\n LEGEND_HEIGHT_MOBILE,\n VERTICAL_LINE_COUNT,\n COLOR_CONFIG,\n TOOLTIP_LINE_COLOR_CONFIG,\n CANDLE_NUMBER_HOUR,\n CANDLE_MINUTE,\n CURRENCIES_ORDER,\n WEEKEND_DURATION,\n};\n"],"mappings":";;;;;;AAAA,IAAAA,iBAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AAEA,MAAME,gBAAgB,GAAAC,OAAA,CAAAD,gBAAA,GAAG,SAAS;AAElC,MAAME,YAAY,GAAAD,OAAA,CAAAC,YAAA,GAAG,EAAE;AACvB,MAAMC,mBAAmB,GAAAF,OAAA,CAAAE,mBAAA,GAAG,GAAG;AAC/B,MAAMC,mBAAmB,GAAAH,OAAA,CAAAG,mBAAA,GAAG,EAAE;AAC9B,MAAMC,YAAY,GAAAJ,OAAA,CAAAI,YAAA,GAAG,EAAE;AACvB,MAAMC,WAAW,GAAAL,OAAA,CAAAK,WAAA,GAAG,IAAI;AACxB,MAAMC,YAAY,GAAAN,OAAA,CAAAM,YAAA,GAAG,GAAG;AACxB,MAAMC,aAAa,GAAAP,OAAA,CAAAO,aAAA,GAAG,EAAE;AACxB,MAAMC,oBAAoB,GAAAR,OAAA,CAAAQ,oBAAA,GAAG,EAAE;AAC/B,MAAMC,mBAAmB,GAAAT,OAAA,CAAAS,mBAAA,GAAG,EAAE;AAC9B,MAAMC,kBAAkB,GAAAV,OAAA,CAAAU,kBAAA,GAAG,EAAE;AAC7B,MAAMC,aAAa,GAAAX,OAAA,CAAAW,aAAA,GAAG,CAAC;AAEvB,MAAMC,gBAAgC,GAAAZ,OAAA,CAAAY,gBAAA,GAAG,CACvCC,qBAAY,CAACC,GAAG,EAChBD,qBAAY,CAACE,GAAG,EAChBF,qBAAY,CAACG,GAAG,EAChBH,qBAAY,CAACI,GAAG,EAChBJ,qBAAY,CAACK,GAAG,EAChBL,qBAAY,CAACM,GAAG,EAChBN,qBAAY,CAACO,GAAG,EAChBP,qBAAY,CAACQ,GAAG,CACjB;AAED,MAAMC,YAAY,GAAAtB,OAAA,CAAAsB,YAAA,GAAG;EACnBC,GAAG,EAAEC,8BAAY,CAACC,UAAU;EAC5BC,GAAG,EAAEF,8BAAY,CAACG,cAAc;EAChCC,GAAG,EAAEJ,8BAAY,CAACK,WAAW;EAC7BC,GAAG,EAAEN,8BAAY,CAACO,cAAc;EAChCC,GAAG,EAAER,8BAAY,CAACS,kBAAkB;EACpCC,GAAG,EAAEV,8BAAY,CAACW,MAAM;EACxBC,GAAG,EAAEZ,8BAAY,CAACa,iBAAiB;EACnCC,GAAG,EAAEd,8BAAY,CAACe;AACpB,CAAC;AAED,MAAMC,yBAAyB,GAAAxC,OAAA,CAAAwC,yBAAA,GAAG;EAChCC,IAAI,EAAEjB,8BAAY,CAACW,MAAM;EACzBO,KAAK,EAAElB,8BAAY,CAACmB;AACtB,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"constants.js","names":["_labsWidgetCommon","require","_graphql","WEEKEND_DURATION","exports","X_LABEL_SIZE","X_LABEL_SIZE_MOBILE","Y_LABEL_SIZE_MOBILE","Y_LABEL_SIZE","CHART_WIDTH","CHART_HEIGHT","LEGEND_HEIGHT","LEGEND_HEIGHT_MOBILE","VERTICAL_LINE_COUNT","CANDLE_NUMBER_HOUR","CANDLE_MINUTE","CURRENCIES_ORDER","CurrencyName","Usd","Eur","Gbp","Cad","Aud","Chf","Jpy","Nzd","COLOR_CONFIG","USD","colorPalette","greenLight","EUR","turquoiseLight","GBP","violetLight","JPY","raspberryLight","CHF","bottleGreenLight75","AUD","orange","CAD","midnight75Lighter","NZD","gold","TOOLTIP_LINE_COLOR_CONFIG","DARK","LIGHT","bottleGreenDark"],"sources":["../../../../../../src/CurrencyPowerBalanceWidget/components/Chart/options/constants.ts"],"sourcesContent":["import { colorPalette } from '@oanda/labs-widget-common';\n\nimport { CurrencyName } from '../../../../gql/types/graphql';\n\nconst WEEKEND_DURATION = 172800000;\n\nconst X_LABEL_SIZE = 90;\nconst X_LABEL_SIZE_MOBILE = 110;\nconst Y_LABEL_SIZE_MOBILE = 35;\nconst Y_LABEL_SIZE = 45;\nconst CHART_WIDTH = 9999;\nconst CHART_HEIGHT = 425;\nconst LEGEND_HEIGHT = 50;\nconst LEGEND_HEIGHT_MOBILE = 70;\nconst VERTICAL_LINE_COUNT = 10;\nconst CANDLE_NUMBER_HOUR = 12;\nconst CANDLE_MINUTE = 5;\n\nconst CURRENCIES_ORDER: CurrencyName[] = [\n CurrencyName.Usd,\n CurrencyName.Eur,\n CurrencyName.Gbp,\n CurrencyName.Cad,\n CurrencyName.Aud,\n CurrencyName.Chf,\n CurrencyName.Jpy,\n CurrencyName.Nzd,\n];\n\nconst COLOR_CONFIG = {\n USD: colorPalette.greenLight,\n EUR: colorPalette.turquoiseLight,\n GBP: colorPalette.violetLight,\n JPY: colorPalette.raspberryLight,\n CHF: colorPalette.bottleGreenLight75,\n AUD: colorPalette.orange,\n CAD: colorPalette.midnight75Lighter,\n NZD: colorPalette.gold,\n};\n\nconst TOOLTIP_LINE_COLOR_CONFIG = {\n DARK: colorPalette.orange,\n LIGHT: colorPalette.bottleGreenDark,\n};\n\nexport {\n CANDLE_MINUTE,\n CANDLE_NUMBER_HOUR,\n CHART_HEIGHT,\n CHART_WIDTH,\n COLOR_CONFIG,\n CURRENCIES_ORDER,\n LEGEND_HEIGHT,\n LEGEND_HEIGHT_MOBILE,\n TOOLTIP_LINE_COLOR_CONFIG,\n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,OAAA,CAAAsB,YAAA,GAAG;EACnBC,GAAG,EAAEC,8BAAY,CAACC,UAAU;EAC5BC,GAAG,EAAEF,8BAAY,CAACG,cAAc;EAChCC,GAAG,EAAEJ,8BAAY,CAACK,WAAW;EAC7BC,GAAG,EAAEN,8BAAY,CAACO,cAAc;EAChCC,GAAG,EAAER,8BAAY,CAACS,kBAAkB;EACpCC,GAAG,EAAEV,8BAAY,CAACW,MAAM;EACxBC,GAAG,EAAEZ,8BAAY,CAACa,iBAAiB;EACnCC,GAAG,EAAEd,8BAAY,CAACe;AACpB,CAAC;AAED,MAAMC,yBAAyB,GAAAxC,OAAA,CAAAwC,yBAAA,GAAG;EAChCC,IAAI,EAAEjB,8BAAY,CAACW,MAAM;EACzBO,KAAK,EAAElB,8BAAY,CAACmB;AACtB,CAAC","ignoreList":[]}
@@ -1 +1 @@
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 { CurrencyPowerBalance, CurrencyPowerBalanceTimeUnit } from '../../../../gql/types/graphql';\nimport { VERTICAL_LINE_COUNT, CURRENCIES_ORDER, COLOR_CONFIG } from './constants';\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 isMonthWeek = (\n timeUnit: CurrencyPowerBalanceTimeUnit,\n) => timeUnit === CurrencyPowerBalanceTimeUnit.M3\n || timeUnit === CurrencyPowerBalanceTimeUnit.M1\n || timeUnit === CurrencyPowerBalanceTimeUnit.W1;\n\nconst xAxisLabelFormatter = (label: string, timeUnit: CurrencyPowerBalanceTimeUnit) => {\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 = (\n 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(({ 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\nconst formatLegendData = (values: CurrencyPowerBalance[]) => {\n const dataCurrencies = values.map(({ currency }) => currency);\n\n const list = dataCurrencies.length === CURRENCIES_ORDER.length\n ? CURRENCIES_ORDER\n : CURRENCIES_ORDER.filter((currency) => dataCurrencies.includes(currency));\n\n return list.map((currency) => ({\n name: currency,\n itemStyle: {\n color: COLOR_CONFIG[currency],\n },\n }));\n};\n\nexport {\n isMonthWeek,\n tooltipFormatter,\n xAxisLabelFormatter,\n interval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AEC;IAAS,CAAC,GAAAD,KAAA;IAAA,OAAKC,QAAQ;EAAA,EAAC;EAE7D,MAAMC,IAAI,GAAGH,cAAc,CAACI,MAAM,KAAKC,2BAAgB,CAACD,MAAM,GAC1DC,2BAAgB,GAChBA,2BAAgB,CAACC,MAAM,CAAEJ,QAAQ,IAAKF,cAAc,CAACO,QAAQ,CAACL,QAAQ,CAAC,CAAC;EAE5E,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 format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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":[]}
@@ -5,9 +5,9 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.getOption = void 0;
7
7
  var _labsWidgetCommon = require("@oanda/labs-widget-common");
8
+ var _graphql = require("../../../../gql/types/graphql");
8
9
  var _constants = require("./constants");
9
10
  var _formatters = require("./formatters");
10
- var _graphql = require("../../../../gql/types/graphql");
11
11
  var _utils = require("./utils");
12
12
  const getOption = (chartData, timeUnit, isDark, lang) => {
13
13
  const currentTheme = isDark ? _labsWidgetCommon.darkTheme : _labsWidgetCommon.lightTheme;
@@ -1 +1 @@
1
- {"version":3,"file":"getOption.js","names":["_labsWidgetCommon","require","_constants","_formatters","_graphql","_utils","getOption","chartData","timeUnit","isDark","lang","currentTheme","darkTheme","lightTheme","dataTimestamps","power","map","x","Date","point","getTime","weekendsIndexes","findLastIndexesBeforeWeekend","disableWeekendsIndicator","CurrencyPowerBalanceTimeUnit","CurrentDay","PreviousDay","M3","includes","length","weekendsMarks","item","xAxis","label","formatter","seriesData","_ref","index","currency","name","type","symbol","showSymbol","itemStyle","color","COLOR_CONFIG","data","_ref2","price","markLine","show","position","align","distance","padding","fontSize","shadowBlur","shadowOffsetX","shadowOffsetY","borderWidth","textPrimary","shadowColor","borderRadius","backgroundColor","borderPrimary","backgroundSecondary","emphasis","lineStyle","width","opacity","undefined","legendData","formatLegendData","animation","legend","bottom","icon","tooltip","trigger","axisPointer","axis","z","TOOLTIP_LINE_COLOR_CONFIG","DARK","LIGHT","tooltipFormatter","extraCssText","axisTick","axisLine","splitLine","axisLabel","margin","rotate","interval","intervalFormatter","xAxisLabelFormatter","yAxis","splitNumber","boundaryGap","showMaxLabel","showMinLabel","series","exports"],"sources":["../../../../../../src/CurrencyPowerBalanceWidget/components/Chart/options/getOption.ts"],"sourcesContent":["import { darkTheme, lightTheme } from '@oanda/labs-widget-common';\nimport { COLOR_CONFIG, TOOLTIP_LINE_COLOR_CONFIG } from './constants';\nimport {\n intervalFormatter, tooltipFormatter, xAxisLabelFormatter, formatLegendData,\n} from './formatters';\nimport { CurrencyPowerBalance, CurrencyPowerBalanceTimeUnit } from '../../../../gql/types/graphql';\nimport { findLastIndexesBeforeWeekend } from './utils';\n\nconst getOption = (\n chartData: CurrencyPowerBalance[],\n timeUnit: CurrencyPowerBalanceTimeUnit,\n isDark: boolean,\n lang: (key: string) => string,\n) => {\n const currentTheme = isDark ? darkTheme : lightTheme;\n const dataTimestamps = chartData[0].power.map((x) => new Date(x.point).getTime());\n const weekendsIndexes = findLastIndexesBeforeWeekend(dataTimestamps);\n const disableWeekendsIndicator = [\n CurrencyPowerBalanceTimeUnit.CurrentDay,\n CurrencyPowerBalanceTimeUnit.PreviousDay,\n CurrencyPowerBalanceTimeUnit.M3,\n ].includes(timeUnit) || weekendsIndexes.length === 0;\n\n const weekendsMarks = weekendsIndexes.map((item) => ({\n xAxis: item,\n label: {\n formatter: () => lang('market_closed'),\n },\n }));\n\n const seriesData = chartData.map(({ currency, power }, index) => ({\n name: currency,\n type: 'line',\n symbol: 'circle',\n showSymbol: false,\n itemStyle: {\n color: COLOR_CONFIG[currency],\n },\n data: power.map(({ point, price }) => [point, price]),\n markLine: index === chartData.length - 1 && !disableWeekendsIndicator ? {\n label: {\n show: false,\n position: 'end',\n align: 'center',\n distance: -32,\n padding: [8, 8],\n fontSize: 12,\n shadowBlur: 24,\n shadowOffsetX: 0,\n shadowOffsetY: 6,\n borderWidth: 0,\n color: currentTheme.textPrimary,\n shadowColor: 'rgba(0,0,0,0.1)',\n borderRadius: 4,\n backgroundColor: isDark ? currentTheme.borderPrimary : currentTheme.backgroundSecondary,\n },\n show: false,\n emphasis: {\n label: {\n show: true,\n },\n lineStyle: {\n width: 1,\n opacity: 0,\n color: currentTheme.borderPrimary,\n },\n },\n symbol: ['none', 'none'],\n itemStyle: {\n color: currentTheme.borderPrimary,\n },\n data: weekendsMarks,\n } : undefined,\n }));\n\n const legendData = formatLegendData(chartData);\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 padding: [0, 0, 0, 4],\n align: 'left',\n margin: 10,\n rotate: -45,\n interval: intervalFormatter(seriesData[0].data.length),\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,iBAAA,GAAAC,OAAA;AACA,IAAAC,UAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;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ElE;EACV,CAAC;AACH,CAAC;AAACmE,OAAA,CAAAhG,SAAA,GAAAA,SAAA","ignoreList":[]}
1
+ {"version":3,"file":"getOption.js","names":["_labsWidgetCommon","require","_graphql","_constants","_formatters","_utils","getOption","chartData","timeUnit","isDark","lang","currentTheme","darkTheme","lightTheme","dataTimestamps","power","map","x","Date","point","getTime","weekendsIndexes","findLastIndexesBeforeWeekend","disableWeekendsIndicator","CurrencyPowerBalanceTimeUnit","CurrentDay","PreviousDay","M3","includes","length","weekendsMarks","item","xAxis","label","formatter","seriesData","_ref","index","currency","name","type","symbol","showSymbol","itemStyle","color","COLOR_CONFIG","data","_ref2","price","markLine","show","position","align","distance","padding","fontSize","shadowBlur","shadowOffsetX","shadowOffsetY","borderWidth","textPrimary","shadowColor","borderRadius","backgroundColor","borderPrimary","backgroundSecondary","emphasis","lineStyle","width","opacity","undefined","legendData","formatLegendData","animation","legend","bottom","icon","tooltip","trigger","axisPointer","axis","z","TOOLTIP_LINE_COLOR_CONFIG","DARK","LIGHT","tooltipFormatter","extraCssText","axisTick","axisLine","splitLine","axisLabel","margin","rotate","interval","intervalFormatter","xAxisLabelFormatter","yAxis","splitNumber","boundaryGap","showMaxLabel","showMinLabel","series","exports"],"sources":["../../../../../../src/CurrencyPowerBalanceWidget/components/Chart/options/getOption.ts"],"sourcesContent":["import { darkTheme, lightTheme } from '@oanda/labs-widget-common';\n\nimport type { CurrencyPowerBalance } from '../../../../gql/types/graphql';\nimport { CurrencyPowerBalanceTimeUnit } from '../../../../gql/types/graphql';\nimport { COLOR_CONFIG, TOOLTIP_LINE_COLOR_CONFIG } from './constants';\nimport {\n formatLegendData,\n intervalFormatter,\n tooltipFormatter,\n xAxisLabelFormatter,\n} from './formatters';\nimport { findLastIndexesBeforeWeekend } from './utils';\n\nconst getOption = (\n chartData: CurrencyPowerBalance[],\n timeUnit: CurrencyPowerBalanceTimeUnit,\n isDark: boolean,\n lang: (key: string) => string\n) => {\n const currentTheme = isDark ? darkTheme : lightTheme;\n const dataTimestamps = chartData[0].power.map((x) =>\n new Date(x.point).getTime()\n );\n const weekendsIndexes = findLastIndexesBeforeWeekend(dataTimestamps);\n const disableWeekendsIndicator =\n [\n CurrencyPowerBalanceTimeUnit.CurrentDay,\n CurrencyPowerBalanceTimeUnit.PreviousDay,\n CurrencyPowerBalanceTimeUnit.M3,\n ].includes(timeUnit) || weekendsIndexes.length === 0;\n\n const weekendsMarks = weekendsIndexes.map((item) => ({\n xAxis: item,\n label: {\n formatter: () => lang('market_closed'),\n },\n }));\n\n const seriesData = chartData.map(({ currency, power }, index) => ({\n name: currency,\n type: 'line',\n symbol: 'circle',\n showSymbol: false,\n itemStyle: {\n color: COLOR_CONFIG[currency],\n },\n data: power.map(({ point, price }) => [point, price]),\n markLine:\n index === chartData.length - 1 && !disableWeekendsIndicator\n ? {\n label: {\n show: false,\n position: 'end',\n align: 'center',\n distance: -32,\n padding: [8, 8],\n fontSize: 12,\n shadowBlur: 24,\n shadowOffsetX: 0,\n shadowOffsetY: 6,\n borderWidth: 0,\n color: currentTheme.textPrimary,\n shadowColor: 'rgba(0,0,0,0.1)',\n borderRadius: 4,\n backgroundColor: isDark\n ? currentTheme.borderPrimary\n : currentTheme.backgroundSecondary,\n },\n show: false,\n emphasis: {\n label: {\n show: true,\n },\n lineStyle: {\n width: 1,\n opacity: 0,\n color: currentTheme.borderPrimary,\n },\n },\n symbol: ['none', 'none'],\n itemStyle: {\n color: currentTheme.borderPrimary,\n },\n data: weekendsMarks,\n }\n : undefined,\n }));\n\n const legendData = formatLegendData(chartData);\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\n ? TOOLTIP_LINE_COLOR_CONFIG.DARK\n : 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 padding: [0, 0, 0, 4],\n align: 'left',\n margin: 10,\n rotate: -45,\n interval: intervalFormatter(seriesData[0].data.length),\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,iBAAA,GAAAC,OAAA;AAGA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,UAAA,GAAAF,OAAA;AACA,IAAAG,WAAA,GAAAH,OAAA;AAMA,IAAAI,MAAA,GAAAJ,OAAA;AAEA,MAAMK,SAAS,GAAGA,CAChBC,SAAiC,EACjCC,QAAsC,EACtCC,MAAe,EACfC,IAA6B,KAC1B;EACH,MAAMC,YAAY,GAAGF,MAAM,GAAGG,2BAAS,GAAGC,4BAAU;EACpD,MAAMC,cAAc,GAAGP,SAAS,CAAC,CAAC,CAAC,CAACQ,KAAK,CAACC,GAAG,CAAEC,CAAC,IAC9C,IAAIC,IAAI,CAACD,CAAC,CAACE,KAAK,CAAC,CAACC,OAAO,CAAC,CAC5B,CAAC;EACD,MAAMC,eAAe,GAAG,IAAAC,mCAA4B,EAACR,cAAc,CAAC;EACpE,MAAMS,wBAAwB,GAC5B,CACEC,qCAA4B,CAACC,UAAU,EACvCD,qCAA4B,CAACE,WAAW,EACxCF,qCAA4B,CAACG,EAAE,CAChC,CAACC,QAAQ,CAACpB,QAAQ,CAAC,IAAIa,eAAe,CAACQ,MAAM,KAAK,CAAC;EAEtD,MAAMC,aAAa,GAAGT,eAAe,CAACL,GAAG,CAAEe,IAAI,KAAM;IACnDC,KAAK,EAAED,IAAI;IACXE,KAAK,EAAE;MACLC,S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CAAC,CAACW,IAAI,CAACjB,MAAM,CAAC;QACtDK,SAAS,EAAGD,KAAa,IAAK,IAAA8D,+BAAmB,EAAC9D,KAAK,EAAEzB,QAAQ;MACnE;IACF,CAAC;IACDwF,KAAK,EAAE;MACLxD,IAAI,EAAE,OAAO;MACbW,QAAQ,EAAE,OAAO;MACjB8C,WAAW,EAAE,CAAC;MACdT,QAAQ,EAAE;QAAEtC,IAAI,EAAE;MAAM,CAAC;MACzBqC,QAAQ,EAAE;QAAErC,IAAI,EAAE;MAAM,CAAC;MACzBgD,WAAW,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC;MAC3BR,SAAS,EAAE;QACTS,YAAY,EAAE,KAAK;QACnBC,YAAY,EAAE;MAChB;IACF,CAAC;IACDC,MAAM,EAAElE;EACV,CAAC;AACH,CAAC;AAACmE,OAAA,CAAAhG,SAAA,GAAAA,SAAA","ignoreList":[]}
@@ -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","bottom","graphic","exports"],"sources":["../../../../../../src/CurrencyPowerBalanceWidget/components/Chart/options/getResponsiveOption.ts"],"sourcesContent":["import { getGridLines } from '@oanda/labs-widget-common';\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 = (isDesktop: boolean, isMobile: boolean, isDark: boolean) => {\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: [\n ...baseGridLines,\n ],\n };\n};\n\nexport { getResponsiveOption };\n"],"mappings":";;;;;;AAAA,IAAAA,iBAAA,GAAAC,OAAA;AACA,IAAAC,UAAA,GAAAD,OAAA;AAWA,MAAME,mBAAmB,GAAGA,CAACC,SAAkB,EAAEC,QAAiB,EAAEC,MAAe,KAAK;EACtF,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,CACP,GAAGzB,aAAa;EAEpB,CAAC;AACH,CAAC;AAAC0B,OAAA,CAAA9B,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":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","names":[],"sources":["../../../../../../src/CurrencyPowerBalanceWidget/components/Chart/options/types.ts"],"sourcesContent":["export interface TooltipFormatterParams {\n marker: string;\n seriesName: string;\n value: string[]\n}\n"],"mappings":"","ignoreList":[]}
1
+ {"version":3,"file":"types.js","names":[],"sources":["../../../../../../src/CurrencyPowerBalanceWidget/components/Chart/options/types.ts"],"sourcesContent":["export interface TooltipFormatterParams {\n marker: string;\n seriesName: string;\n value: string[];\n}\n"],"mappings":"","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","names":["_constants","require","findLastIndexesBeforeWeekend","timestamps","reduce","acc","timestamp","index","length","WEEKEND_DURATION","exports"],"sources":["../../../../../../src/CurrencyPowerBalanceWidget/components/Chart/options/utils.ts"],"sourcesContent":["import { WEEKEND_DURATION } from './constants';\n\nconst findLastIndexesBeforeWeekend = (timestamps: number[]) => timestamps\n .reduce((acc, timestamp, index) => (\n timestamps.length - 1 !== index && timestamps[index + 1] - timestamp >= WEEKEND_DURATION\n ? [...acc, index]\n : acc\n ), [] as number[]);\n\nexport {\n findLastIndexesBeforeWeekend,\n};\n"],"mappings":";;;;;;AAAA,IAAAA,UAAA,GAAAC,OAAA;AAEA,MAAMC,4BAA4B,GAAIC,UAAoB,IAAKA,UAAU,CACtEC,MAAM,CAAC,CAACC,GAAG,EAAEC,SAAS,EAAEC,KAAK,KAC5BJ,UAAU,CAACK,MAAM,GAAG,CAAC,KAAKD,KAAK,IAAIJ,UAAU,CAACI,KAAK,GAAG,CAAC,CAAC,GAAGD,SAAS,IAAIG,2BAAgB,GACpF,CAAC,GAAGJ,GAAG,EAAEE,KAAK,CAAC,GACfF,GACL,EAAE,EAAc,CAAC;AAACK,OAAA,CAAAR,4BAAA,GAAAA,4BAAA","ignoreList":[]}
1
+ {"version":3,"file":"utils.js","names":["_constants","require","findLastIndexesBeforeWeekend","timestamps","reduce","acc","timestamp","index","length","WEEKEND_DURATION","exports"],"sources":["../../../../../../src/CurrencyPowerBalanceWidget/components/Chart/options/utils.ts"],"sourcesContent":["import { WEEKEND_DURATION } from './constants';\n\nconst findLastIndexesBeforeWeekend = (timestamps: number[]) =>\n timestamps.reduce(\n (acc, timestamp, index) =>\n timestamps.length - 1 !== index &&\n timestamps[index + 1] - timestamp >= WEEKEND_DURATION\n ? [...acc, index]\n : acc,\n [] as number[]\n );\n\nexport { findLastIndexesBeforeWeekend };\n"],"mappings":";;;;;;AAAA,IAAAA,UAAA,GAAAC,OAAA;AAEA,MAAMC,4BAA4B,GAAIC,UAAoB,IACxDA,UAAU,CAACC,MAAM,CACf,CAACC,GAAG,EAAEC,SAAS,EAAEC,KAAK,KACpBJ,UAAU,CAACK,MAAM,GAAG,CAAC,KAAKD,KAAK,IAC/BJ,UAAU,CAACI,KAAK,GAAG,CAAC,CAAC,GAAGD,SAAS,IAAIG,2BAAgB,GACjD,CAAC,GAAGJ,GAAG,EAAEE,KAAK,CAAC,GACfF,GAAG,EACT,EACF,CAAC;AAACK,OAAA,CAAAR,4BAAA,GAAAA,4BAAA","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","names":[],"sources":["../../../../../src/CurrencyPowerBalanceWidget/components/Chart/types.ts"],"sourcesContent":["import { CurrencyPowerBalance, CurrencyPowerBalanceTimeUnit } from '../../../gql/types/graphql';\n\nexport interface ChartProps {\n values: CurrencyPowerBalance[];\n timeUnit: CurrencyPowerBalanceTimeUnit;\n currencies?: string[];\n}\n"],"mappings":"","ignoreList":[]}
1
+ {"version":3,"file":"types.js","names":[],"sources":["../../../../../src/CurrencyPowerBalanceWidget/components/Chart/types.ts"],"sourcesContent":["import type {\n CurrencyPowerBalance,\n CurrencyPowerBalanceTimeUnit,\n} from '../../../gql/types/graphql';\n\nexport interface ChartProps {\n values: CurrencyPowerBalance[];\n timeUnit: CurrencyPowerBalanceTimeUnit;\n currencies?: string[];\n}\n"],"mappings":"","ignoreList":[]}
@@ -4,9 +4,9 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.TimeUnitSelect = void 0;
7
- var _react = _interopRequireDefault(require("react"));
8
7
  var _labsWidgetCommon = require("@oanda/labs-widget-common");
9
8
  var _monoI18n = require("@oanda/mono-i18n");
9
+ var _react = _interopRequireDefault(require("react"));
10
10
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
11
11
  const TimeUnitSelect = _ref => {
12
12
  let {
@@ -39,11 +39,11 @@ const TimeUnitSelect = _ref => {
39
39
  return id === selected;
40
40
  });
41
41
  return _react.default.createElement("div", {
42
- "data-testid": "time-unit-select",
43
- className: "lw-mb-6 lw-w-full"
42
+ className: "lw-mb-6 lw-w-full",
43
+ "data-testid": "time-unit-select"
44
44
  }, _react.default.createElement(_labsWidgetCommon.Select, {
45
- searchPlaceholder: lang('search'),
46
45
  options: selectOptions,
46
+ searchPlaceholder: lang('search'),
47
47
  selectedOption: {
48
48
  id: selected,
49
49
  label: selectedLabel
@@ -1 +1 @@
1
- {"version":3,"file":"TimeUnitSelect.js","names":["_react","_interopRequireDefault","require","_labsWidgetCommon","_monoI18n","e","__esModule","default","TimeUnitSelect","_ref","selected","options","callback","lang","useLocale","selectOptions","map","_ref2","value","id","label","tooltipLabel","translationKey","count","selectedLabel","filter","_ref3","createElement","className","Select","searchPlaceholder","selectedOption","setSelectedOption","_ref4","exports"],"sources":["../../../../../src/CurrencyPowerBalanceWidget/components/TimeUnitSwitch/TimeUnitSelect.tsx"],"sourcesContent":["import React from 'react';\nimport { Select } from '@oanda/labs-widget-common';\nimport { useLocale } from '@oanda/mono-i18n';\nimport { TimeUnitSwitchProps } from './types';\nimport { CurrencyPowerBalanceTimeUnit } from '../../../gql/types/graphql';\n\nconst TimeUnitSelect = ({\n selected, options, callback,\n}: TimeUnitSwitchProps) => {\n const { lang } = useLocale();\n const selectOptions = options\n .map(({ value: id, label, tooltipLabel }) => ({\n id,\n label: tooltipLabel\n ? lang(tooltipLabel.translationKey, { count: tooltipLabel.count })\n : lang(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 searchPlaceholder={lang('search')}\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;AACA,IAAAE,SAAA,GAAAF,OAAA;AAA6C,SAAAD,uBAAAI,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAI7C,MAAMG,cAAc,GAAGC,IAAA,IAEI;EAAA,IAFH;IACtBC,QAAQ;IAAEC,OAAO;IAAEC;EACA,CAAC,GAAAH,IAAA;EACpB,MAAM;IAAEI;EAAK,CAAC,GAAG,IAAAC,mBAAS,EAAC,CAAC;EAC5B,MAAMC,aAAa,GAAGJ,OAAO,CAC1BK,GAAG,CAACC,KAAA;IAAA,IAAC;MAAEC,KAAK,EAAEC,EAAE;MAAEC,KAAK;MAAEC;IAAa,CAAC,GAAAJ,KAAA;IAAA,OAAM;MAC5CE,EAAE;MACFC,KAAK,EAAEC,YAAY,GACfR,IAAI,CAACQ,YAAY,CAACC,cAAc,EAAE;QAAEC,KAAK,EAAEF,YAAY,CAACE;MAAM,CAAC,CAAC,GAChEV,IAAI,CAACO,KAAK;IAChB,CAAC;EAAA,CAAC,CAAC;EACL,MAAM,CAAC;IAAEA,KAAK,EAAEI;EAAc,CAAC,CAAC,GAAGT,aAAa,CAACU,MAAM,CAACC,KAAA;IAAA,IAAC;MAAEP;IAAG,CAAC,GAAAO,KAAA;IAAA,OAAKP,EAAE,KAAKT,QAAQ;EAAA,EAAC;EAEpF,OACEV,MAAA,CAAAO,OAAA,CAAAoB,aAAA;IAAK,eAAY,kBAAkB;IAACC,SAAS,EAAC;EAAmB,GAC/D5B,MAAA,CAAAO,OAAA,CAAAoB,aAAA,CAACxB,iBAAA,CAAA0B,MAAM;IACLC,iBAAiB,EAAEjB,IAAI,CAAC,QAAQ,CAAE;IAClCF,OAAO,EAAEI,aAAc;IACvBgB,cAAc,EAAE;MAAEZ,EAAE,EAAET,QAAQ;MAAEU,KAAK,EAAEI;IAAc,CAAE;IACvDQ,iBAAiB,EAAEC,KAAA;MAAA,IAAC;QAAEd;MAAG,CAAC,GAAAc,KAAA;MAAA,OAAKrB,QAAQ,CAACO,EAAkC,CAAC;IAAA;EAAC,CAC7E,CACE,CAAC;AAEV,CAAC;AAACe,OAAA,CAAA1B,cAAA,GAAAA,cAAA","ignoreList":[]}
1
+ {"version":3,"file":"TimeUnitSelect.js","names":["_labsWidgetCommon","require","_monoI18n","_react","_interopRequireDefault","e","__esModule","default","TimeUnitSelect","_ref","selected","options","callback","lang","useLocale","selectOptions","map","_ref2","value","id","label","tooltipLabel","translationKey","count","selectedLabel","filter","_ref3","createElement","className","Select","searchPlaceholder","selectedOption","setSelectedOption","_ref4","exports"],"sources":["../../../../../src/CurrencyPowerBalanceWidget/components/TimeUnitSwitch/TimeUnitSelect.tsx"],"sourcesContent":["import { Select } from '@oanda/labs-widget-common';\nimport { useLocale } from '@oanda/mono-i18n';\nimport React from 'react';\n\nimport type { CurrencyPowerBalanceTimeUnit } from '../../../gql/types/graphql';\nimport type { TimeUnitSwitchProps } from './types';\n\nconst TimeUnitSelect = ({\n selected,\n options,\n callback,\n}: TimeUnitSwitchProps) => {\n const { lang } = useLocale();\n const selectOptions = options.map(({ value: id, label, tooltipLabel }) => ({\n id,\n label: tooltipLabel\n ? lang(tooltipLabel.translationKey, { count: tooltipLabel.count })\n : lang(label),\n }));\n const [{ label: selectedLabel }] = selectOptions.filter(\n ({ id }) => id === selected\n );\n\n return (\n <div className=\"lw-mb-6 lw-w-full\" data-testid=\"time-unit-select\">\n <Select\n options={selectOptions}\n searchPlaceholder={lang('search')}\n selectedOption={{ id: selected, label: selectedLabel }}\n setSelectedOption={({ id }) =>\n callback(id as CurrencyPowerBalanceTimeUnit)\n }\n />\n </div>\n );\n};\n\nexport { TimeUnitSelect };\n"],"mappings":";;;;;;AAAA,IAAAA,iBAAA,GAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAC,sBAAA,CAAAH,OAAA;AAA0B,SAAAG,uBAAAC,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAK1B,MAAMG,cAAc,GAAGC,IAAA,IAII;EAAA,IAJH;IACtBC,QAAQ;IACRC,OAAO;IACPC;EACmB,CAAC,GAAAH,IAAA;EACpB,MAAM;IAAEI;EAAK,CAAC,GAAG,IAAAC,mBAAS,EAAC,CAAC;EAC5B,MAAMC,aAAa,GAAGJ,OAAO,CAACK,GAAG,CAACC,KAAA;IAAA,IAAC;MAAEC,KAAK,EAAEC,EAAE;MAAEC,KAAK;MAAEC;IAAa,CAAC,GAAAJ,KAAA;IAAA,OAAM;MACzEE,EAAE;MACFC,KAAK,EAAEC,YAAY,GACfR,IAAI,CAACQ,YAAY,CAACC,cAAc,EAAE;QAAEC,KAAK,EAAEF,YAAY,CAACE;MAAM,CAAC,CAAC,GAChEV,IAAI,CAACO,KAAK;IAChB,CAAC;EAAA,CAAC,CAAC;EACH,MAAM,CAAC;IAAEA,KAAK,EAAEI;EAAc,CAAC,CAAC,GAAGT,aAAa,CAACU,MAAM,CACrDC,KAAA;IAAA,IAAC;MAAEP;IAAG,CAAC,GAAAO,KAAA;IAAA,OAAKP,EAAE,KAAKT,QAAQ;EAAA,CAC7B,CAAC;EAED,OACEP,MAAA,CAAAI,OAAA,CAAAoB,aAAA;IAAKC,SAAS,EAAC,mBAAmB;IAAC,eAAY;EAAkB,GAC/DzB,MAAA,CAAAI,OAAA,CAAAoB,aAAA,CAAC3B,iBAAA,CAAA6B,MAAM;IACLlB,OAAO,EAAEI,aAAc;IACvBe,iBAAiB,EAAEjB,IAAI,CAAC,QAAQ,CAAE;IAClCkB,cAAc,EAAE;MAAEZ,EAAE,EAAET,QAAQ;MAAEU,KAAK,EAAEI;IAAc,CAAE;IACvDQ,iBAAiB,EAAEC,KAAA;MAAA,IAAC;QAAEd;MAAG,CAAC,GAAAc,KAAA;MAAA,OACxBrB,QAAQ,CAACO,EAAkC,CAAC;IAAA;EAC7C,CACF,CACE,CAAC;AAEV,CAAC;AAACe,OAAA,CAAA1B,cAAA,GAAAA,cAAA","ignoreList":[]}
@@ -4,9 +4,9 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.TimeUnitSwitch = void 0;
7
- var _react = _interopRequireDefault(require("react"));
8
7
  var _labsWidgetCommon = require("@oanda/labs-widget-common");
9
8
  var _monoI18n = require("@oanda/mono-i18n");
9
+ var _react = _interopRequireDefault(require("react"));
10
10
  var _constants = require("../../constants");
11
11
  var _TimeUnitSelect = require("./TimeUnitSelect");
12
12
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
@@ -27,8 +27,8 @@ const TimeUnitSwitch = _ref => {
27
27
  callback(e.currentTarget.value);
28
28
  };
29
29
  return _react.default.createElement(_react.default.Fragment, null, isDesktop ? _react.default.createElement("div", {
30
- "data-testid": "time-unit-switch",
31
- className: "lw-mb-6 lw-flex lw-gap-1 lw-self-end"
30
+ className: "lw-mb-6 lw-flex lw-gap-1 lw-self-end",
31
+ "data-testid": "time-unit-switch"
32
32
  }, options.map(_ref2 => {
33
33
  let {
34
34
  value,
@@ -41,17 +41,17 @@ const TimeUnitSwitch = _ref => {
41
41
  const buttonLabel = lang(label);
42
42
  return _react.default.createElement(_labsWidgetCommon.Button, {
43
43
  key: value,
44
+ "data-tooltip-content": tooltip,
45
+ "data-tooltip-id": _constants.CURRENCY_POWER_BALANCE_TOOLTIP_ID,
44
46
  size: _labsWidgetCommon.ButtonSize.full,
45
- variant: selected === value ? _labsWidgetCommon.ButtonVariant.primary : _labsWidgetCommon.ButtonVariant.secondary,
46
- onClick: handleButtonClick,
47
47
  value: value,
48
- "data-tooltip-id": _constants.CURRENCY_POWER_BALANCE_TOOLTIP_ID,
49
- "data-tooltip-content": tooltip
48
+ variant: selected === value ? _labsWidgetCommon.ButtonVariant.primary : _labsWidgetCommon.ButtonVariant.secondary,
49
+ onClick: handleButtonClick
50
50
  }, buttonLabel);
51
51
  })) : _react.default.createElement(_TimeUnitSelect.TimeUnitSelect, {
52
- selected: selected,
53
52
  callback: callback,
54
- options: options
53
+ options: options,
54
+ selected: selected
55
55
  }));
56
56
  };
57
57
  exports.TimeUnitSwitch = TimeUnitSwitch;
@@ -1 +1 @@
1
- {"version":3,"file":"TimeUnitSwitch.js","names":["_react","_interopRequireDefault","require","_labsWidgetCommon","_monoI18n","_constants","_TimeUnitSelect","e","__esModule","default","TimeUnitSwitch","_ref","selected","options","callback","lang","useLocale","size","useLayoutProvider","isDesktop","Size","DESKTOP","handleButtonClick","currentTarget","value","createElement","Fragment","className","map","_ref2","label","tooltipLabel","tooltip","translationKey","count","buttonLabel","Button","key","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 {\n Button, ButtonSize, ButtonVariant, useLayoutProvider, Size,\n} from '@oanda/labs-widget-common';\nimport { useLocale } from '@oanda/mono-i18n';\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,\n}: TimeUnitSwitchProps) => {\n const { lang } = useLocale();\n const { size } = useLayoutProvider();\n const isDesktop = size === Size.DESKTOP;\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(({ value, label, tooltipLabel }) => {\n const tooltip = tooltipLabel\n ? lang(tooltipLabel.translationKey, { count: tooltipLabel.count })\n : tooltipLabel;\n const buttonLabel = lang(label);\n\n return (\n <Button\n key={value}\n size={ButtonSize.full}\n variant={selected === value\n ? ButtonVariant.primary\n : ButtonVariant.secondary}\n onClick={handleButtonClick}\n value={value}\n data-tooltip-id={CURRENCY_POWER_BALANCE_TOOLTIP_ID}\n data-tooltip-content={tooltip}\n >\n {buttonLabel}\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;AAGA,IAAAE,SAAA,GAAAF,OAAA;AAGA,IAAAG,UAAA,GAAAH,OAAA;AACA,IAAAI,eAAA,GAAAJ,OAAA;AAAkD,SAAAD,uBAAAM,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAElD,MAAMG,cAAc,GAAGC,IAAA,IAEI;EAAA,IAFH;IACtBC,QAAQ;IAAEC,OAAO;IAAEC;EACA,CAAC,GAAAH,IAAA;EACpB,MAAM;IAAEI;EAAK,CAAC,GAAG,IAAAC,mBAAS,EAAC,CAAC;EAC5B,MAAM;IAAEC;EAAK,CAAC,GAAG,IAAAC,mCAAiB,EAAC,CAAC;EACpC,MAAMC,SAAS,GAAGF,IAAI,KAAK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A,cAAA","ignoreList":[]}
1
+ {"version":3,"file":"TimeUnitSwitch.js","names":["_labsWidgetCommon","require","_monoI18n","_react","_interopRequireDefault","_constants","_TimeUnitSelect","e","__esModule","default","TimeUnitSwitch","_ref","selected","options","callback","lang","useLocale","size","useLayoutProvider","isDesktop","Size","DESKTOP","handleButtonClick","currentTarget","value","createElement","Fragment","className","map","_ref2","label","tooltipLabel","tooltip","translationKey","count","buttonLabel","Button","key","CURRENCY_POWER_BALANCE_TOOLTIP_ID","ButtonSize","full","variant","ButtonVariant","primary","secondary","onClick","TimeUnitSelect","exports"],"sources":["../../../../../src/CurrencyPowerBalanceWidget/components/TimeUnitSwitch/TimeUnitSwitch.tsx"],"sourcesContent":["import {\n Button,\n ButtonSize,\n ButtonVariant,\n Size,\n useLayoutProvider,\n} from '@oanda/labs-widget-common';\nimport { useLocale } from '@oanda/mono-i18n';\nimport React from 'react';\n\nimport type { CurrencyPowerBalanceTimeUnit } from '../../../gql/types/graphql';\nimport { CURRENCY_POWER_BALANCE_TOOLTIP_ID } from '../../constants';\nimport { TimeUnitSelect } from './TimeUnitSelect';\nimport type { TimeUnitSwitchProps } from './types';\n\nconst TimeUnitSwitch = ({\n selected,\n options,\n callback,\n}: TimeUnitSwitchProps) => {\n const { lang } = useLocale();\n const { size } = useLayoutProvider();\n const isDesktop = size === Size.DESKTOP;\n\n const handleButtonClick = (e: React.SyntheticEvent<HTMLButtonElement>) => {\n callback(e.currentTarget.value as CurrencyPowerBalanceTimeUnit);\n };\n\n return (\n <>\n {isDesktop ? (\n <div\n className=\"lw-mb-6 lw-flex lw-gap-1 lw-self-end\"\n data-testid=\"time-unit-switch\"\n >\n {options.map(({ value, label, tooltipLabel }) => {\n const tooltip = tooltipLabel\n ? lang(tooltipLabel.translationKey, { count: tooltipLabel.count })\n : tooltipLabel;\n const buttonLabel = lang(label);\n\n return (\n <Button\n key={value}\n data-tooltip-content={tooltip}\n data-tooltip-id={CURRENCY_POWER_BALANCE_TOOLTIP_ID}\n size={ButtonSize.full}\n value={value}\n variant={\n selected === value\n ? ButtonVariant.primary\n : ButtonVariant.secondary\n }\n onClick={handleButtonClick}\n >\n {buttonLabel}\n </Button>\n );\n })}\n </div>\n ) : (\n <TimeUnitSelect\n callback={callback}\n options={options}\n selected={selected}\n />\n )}\n </>\n );\n};\n\nexport { TimeUnitSwitch };\n"],"mappings":";;;;;;AAAA,IAAAA,iBAAA,GAAAC,OAAA;AAOA,IAAAC,SAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAC,sBAAA,CAAAH,OAAA;AAGA,IAAAI,UAAA,GAAAJ,OAAA;AACA,IAAAK,eAAA,GAAAL,OAAA;AAAkD,SAAAG,uBAAAG,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAGlD,MAAMG,cAAc,GAAGC,IAAA,IAII;EAAA,IAJH;IACtBC,QAAQ;IACRC,OAAO;IACPC;EACmB,CAAC,GAAAH,IAAA;EACpB,MAAM;IAAEI;EAAK,CAAC,GAAG,IAAAC,mBAAS,EAAC,CAAC;EAC5B,MAAM;IAAEC;EAAK,CAAC,GAAG,IAAAC,mCAAiB,EAAC,CAAC;EACpC,MAAMC,SAAS,GAAGF,IAAI,KAAKG,sBAAI,CAACC,OAAO;EAEvC,MAAMC,iBAAiB,GAAIf,CAA0C,IAAK;IACxEO,QAAQ,CAACP,CAAC,CAACgB,aAAa,CAACC,KAAqC,CAAC;EACjE,CAAC;EAED,OACErB,MAAA,CAAAM,OAAA,CAAAgB,aAAA,CAAAtB,MAAA,CAAAM,OAAA,CAAAiB,QAAA,QACGP,SAAS,GACRhB,MAAA,CAAAM,OAAA,CAAAgB,aAAA;IACEE,SAAS,EAAC,sCAAsC;IAChD,eAAY;EAAkB,GAE7Bd,OAAO,CAACe,GAAG,CAACC,KAAA,IAAoC;IAAA,IAAnC;MAAEL,KAAK;MAAEM,KAAK;MAAEC;IAAa,CAAC,GAAAF,KAAA;IAC1C,MAAMG,OAAO,GAAGD,YAAY,GACxBhB,IAAI,CAACgB,YAAY,CAACE,cAAc,EAAE;MAAEC,KAAK,EAAEH,YAAY,CAACG;IAAM,CAAC,CAAC,GAChEH,YAAY;IAChB,MAAMI,WAAW,GAAGpB,IAAI,CAACe,KAAK,CAAC;IAE/B,OACE3B,MAAA,CAAAM,OAAA,CAAAgB,aAAA,CAACzB,iBAAA,CAAAoC,MAAM;MACLC,GAAG,EAAEb,KAAM;MACX,wBAAsBQ,OAAQ;MAC9B,mBAAiBM,4CAAkC;MACnDrB,IAAI,EAAEsB,4BAAU,CAACC,IAAK;MACtBhB,KAAK,EAAEA,KAAM;MACbiB,OAAO,EACL7B,QAAQ,KAAKY,KAAK,GACdkB,+BAAa,CAACC,OAAO,GACrBD,+BAAa,CAACE,SACnB;MACDC,OAAO,EAAEvB;IAAkB,GAE1Ba,WACK,CAAC;EAEb,CAAC,CACE,CAAC,GAENhC,MAAA,CAAAM,OAAA,CAAAgB,aAAA,CAACnB,eAAA,CAAAwC,cAAc;IACbhC,QAAQ,EAAEA,QAAS;IACnBD,OAAO,EAAEA,OAAQ;IACjBD,QAAQ,EAAEA;EAAS,CACpB,CAEH,CAAC;AAEP,CAAC;AAACmC,OAAA,CAAArC,cAAA,GAAAA,cAAA","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","names":[],"sources":["../../../../../src/CurrencyPowerBalanceWidget/components/TimeUnitSwitch/types.ts"],"sourcesContent":["import { CurrencyPowerBalanceTimeUnit } from '../../../gql/types/graphql';\n\nexport interface TimeUnitOption {\n value: CurrencyPowerBalanceTimeUnit;\n label: string;\n tooltipLabel?: TooltipLabel;\n}\n\nexport interface TimeUnitSwitchProps {\n selected: CurrencyPowerBalanceTimeUnit;\n options: TimeUnitOption[];\n callback: (value: CurrencyPowerBalanceTimeUnit) => void;\n}\n\ntype TooltipLabel = {\n translationKey: string;\n count: number;\n};\n"],"mappings":"","ignoreList":[]}
1
+ {"version":3,"file":"types.js","names":[],"sources":["../../../../../src/CurrencyPowerBalanceWidget/components/TimeUnitSwitch/types.ts"],"sourcesContent":["import type { CurrencyPowerBalanceTimeUnit } from '../../../gql/types/graphql';\n\nexport interface TimeUnitOption {\n value: CurrencyPowerBalanceTimeUnit;\n label: string;\n tooltipLabel?: TooltipLabel;\n}\n\nexport interface TimeUnitSwitchProps {\n selected: CurrencyPowerBalanceTimeUnit;\n options: TimeUnitOption[];\n callback: (value: CurrencyPowerBalanceTimeUnit) => void;\n}\n\ninterface TooltipLabel {\n translationKey: string;\n count: number;\n}\n"],"mappings":"","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"config.js","names":["_graphql","require","timeUnitConfig","exports","value","CurrencyPowerBalanceTimeUnit","M3","label","tooltipLabel","translationKey","count","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 tooltipLabel: {\n translationKey: 'month',\n count: 3,\n },\n },\n {\n value: CurrencyPowerBalanceTimeUnit.M1,\n label: '1m',\n tooltipLabel: {\n translationKey: 'month',\n count: 1,\n },\n },\n {\n value: CurrencyPowerBalanceTimeUnit.W1,\n label: '1w',\n tooltipLabel: {\n translationKey: 'week',\n count: 1,\n },\n },\n {\n value: CurrencyPowerBalanceTimeUnit.H24,\n label: '24h',\n tooltipLabel: {\n translationKey: 'hour',\n count: 24,\n },\n },\n {\n value: CurrencyPowerBalanceTimeUnit.H8,\n label: '8h',\n tooltipLabel: {\n translationKey: 'hour',\n count: 8,\n },\n },\n {\n value: CurrencyPowerBalanceTimeUnit.H4,\n label: '4h',\n tooltipLabel: {\n translationKey: 'hour',\n count: 4,\n },\n },\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,YAAY,EAAE;IACZC,cAAc,EAAE,OAAO;IACvBC,KAAK,EAAE;EACT;AACF,CAAC,EACD;EACEN,KAAK,EAAEC,qCAA4B,CAACM,EAAE;EACtCJ,KAAK,EAAE,IAAI;EACXC,YAAY,EAAE;IACZC,cAAc,EAAE,OAAO;IACvBC,KAAK,EAAE;EACT;AACF,CAAC,EACD;EACEN,KAAK,EAAEC,qCAA4B,CAACO,EAAE;EACtCL,KAAK,EAAE,IAAI;EACXC,YAAY,EAAE;IACZC,cAAc,EAAE,MAAM;IACtBC,KAAK,EAAE;EACT;AACF,CAAC,EACD;EACEN,KAAK,EAAEC,qCAA4B,CAACQ,GAAG;EACvCN,KAAK,EAAE,KAAK;EACZC,YAAY,EAAE;IACZC,cAAc,EAAE,MAAM;IACtBC,KAAK,EAAE;EACT;AACF,CAAC,EACD;EACEN,KAAK,EAAEC,qCAA4B,CAACS,EAAE;EACtCP,KAAK,EAAE,IAAI;EACXC,YAAY,EAAE;IACZC,cAAc,EAAE,MAAM;IACtBC,KAAK,EAAE;EACT;AACF,CAAC,EACD;EACEN,KAAK,EAAEC,qCAA4B,CAACU,EAAE;EACtCR,KAAK,EAAE,IAAI;EACXC,YAAY,EAAE;IACZC,cAAc,EAAE,MAAM;IACtBC,KAAK,EAAE;EACT;AACF,CAAC,EACD;EAAEN,KAAK,EAAEC,qCAA4B,CAACW,WAAW;EAAET,KAAK,EAAE;AAAwB,CAAC,EACnF;EAAEH,KAAK,EAAEC,qCAA4B,CAACY,UAAU;EAAEV,KAAK,EAAE;AAAuB,CAAC,CAClF","ignoreList":[]}
1
+ {"version":3,"file":"config.js","names":["_graphql","require","timeUnitConfig","exports","value","CurrencyPowerBalanceTimeUnit","M3","label","tooltipLabel","translationKey","count","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 tooltipLabel: {\n translationKey: 'month',\n count: 3,\n },\n },\n {\n value: CurrencyPowerBalanceTimeUnit.M1,\n label: '1m',\n tooltipLabel: {\n translationKey: 'month',\n count: 1,\n },\n },\n {\n value: CurrencyPowerBalanceTimeUnit.W1,\n label: '1w',\n tooltipLabel: {\n translationKey: 'week',\n count: 1,\n },\n },\n {\n value: CurrencyPowerBalanceTimeUnit.H24,\n label: '24h',\n tooltipLabel: {\n translationKey: 'hour',\n count: 24,\n },\n },\n {\n value: CurrencyPowerBalanceTimeUnit.H8,\n label: '8h',\n tooltipLabel: {\n translationKey: 'hour',\n count: 8,\n },\n },\n {\n value: CurrencyPowerBalanceTimeUnit.H4,\n label: '4h',\n tooltipLabel: {\n translationKey: 'hour',\n count: 4,\n },\n },\n {\n value: CurrencyPowerBalanceTimeUnit.PreviousDay,\n label: 'previous_business_day',\n },\n {\n value: CurrencyPowerBalanceTimeUnit.CurrentDay,\n label: 'current_business_day',\n },\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,YAAY,EAAE;IACZC,cAAc,EAAE,OAAO;IACvBC,KAAK,EAAE;EACT;AACF,CAAC,EACD;EACEN,KAAK,EAAEC,qCAA4B,CAACM,EAAE;EACtCJ,KAAK,EAAE,IAAI;EACXC,YAAY,EAAE;IACZC,cAAc,EAAE,OAAO;IACvBC,KAAK,EAAE;EACT;AACF,CAAC,EACD;EACEN,KAAK,EAAEC,qCAA4B,CAACO,EAAE;EACtCL,KAAK,EAAE,IAAI;EACXC,YAAY,EAAE;IACZC,cAAc,EAAE,MAAM;IACtBC,KAAK,EAAE;EACT;AACF,CAAC,EACD;EACEN,KAAK,EAAEC,qCAA4B,CAACQ,GAAG;EACvCN,KAAK,EAAE,KAAK;EACZC,YAAY,EAAE;IACZC,cAAc,EAAE,MAAM;IACtBC,KAAK,EAAE;EACT;AACF,CAAC,EACD;EACEN,KAAK,EAAEC,qCAA4B,CAACS,EAAE;EACtCP,KAAK,EAAE,IAAI;EACXC,YAAY,EAAE;IACZC,cAAc,EAAE,MAAM;IACtBC,KAAK,EAAE;EACT;AACF,CAAC,EACD;EACEN,KAAK,EAAEC,qCAA4B,CAACU,EAAE;EACtCR,KAAK,EAAE,IAAI;EACXC,YAAY,EAAE;IACZC,cAAc,EAAE,MAAM;IACtBC,KAAK,EAAE;EACT;AACF,CAAC,EACD;EACEN,KAAK,EAAEC,qCAA4B,CAACW,WAAW;EAC/CT,KAAK,EAAE;AACT,CAAC,EACD;EACEH,KAAK,EAAEC,qCAA4B,CAACY,UAAU;EAC9CV,KAAK,EAAE;AACT,CAAC,CACF","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"constants.js","names":["CURRENCY_POWER_BALANCE_TOOLTIP_ID","exports"],"sources":["../../../src/CurrencyPowerBalanceWidget/constants.ts"],"sourcesContent":["export const CURRENCY_POWER_BALANCE_TOOLTIP_ID = 'currency-power-balance-widget-tooltip';\n"],"mappings":";;;;;;AAAO,MAAMA,iCAAiC,GAAAC,OAAA,CAAAD,iCAAA,GAAG,uCAAuC","ignoreList":[]}
1
+ {"version":3,"file":"constants.js","names":["CURRENCY_POWER_BALANCE_TOOLTIP_ID","exports"],"sources":["../../../src/CurrencyPowerBalanceWidget/constants.ts"],"sourcesContent":["export const CURRENCY_POWER_BALANCE_TOOLTIP_ID =\n 'currency-power-balance-widget-tooltip';\n"],"mappings":";;;;;;AAAO,MAAMA,iCAAiC,GAAAC,OAAA,CAAAD,iCAAA,GAC5C,uCAAuC","ignoreList":[]}
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
 
3
+ var _labsWidgetCommon = require("@oanda/labs-widget-common");
3
4
  var _react = _interopRequireDefault(require("react"));
4
5
  var _client = require("react-dom/client");
5
- var _labsWidgetCommon = require("@oanda/labs-widget-common");
6
6
  var _CurrencyPowerBalance = require("./CurrencyPowerBalance");
7
7
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
8
8
  const {
@@ -35,21 +35,21 @@ if (currencyPowerBalanceParamsElements.length > 0) {
35
35
  name: 'graphqlUrl'
36
36
  }]);
37
37
  root.render(_react.default.createElement(_CurrencyPowerBalance.CurrencyPowerBalance, {
38
+ currencies: currencies,
38
39
  graphqlUrl: graphqlUrl,
40
+ isParamError: isParamError,
39
41
  locale: locale,
42
+ logoLink: logoLink,
40
43
  theme: mode,
41
- isParamError: isParamError,
42
- timeUnit: timeUnit,
43
- currencies: currencies,
44
- logoLink: logoLink
44
+ timeUnit: timeUnit
45
45
  }));
46
46
  });
47
47
  } else {
48
- const container = document.getElementById(configRenderElementId);
48
+ const container = document.querySelector(configRenderElementId);
49
49
  const root = (0, _client.createRoot)(container);
50
50
  root.render(_react.default.createElement(_CurrencyPowerBalance.CurrencyPowerBalance, {
51
- locale: configLocale,
52
- graphqlUrl: configGraphQl
51
+ graphqlUrl: configGraphQl,
52
+ locale: configLocale
53
53
  }));
54
54
  }
55
55
  //# sourceMappingURL=render.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"render.js","names":["_react","_interopRequireDefault","require","_client","_labsWidgetCommon","_CurrencyPowerBalance","e","__esModule","default","graphqlUrl","configGraphQl","renderElementId","configRenderElementId","locale","configLocale","window","currencyPowerBalanceWidgetConfig","widgetsConfig","currencyPowerBalanceParamsElements","document","querySelectorAll","length","forEach","element","root","createRoot","params","getAttribute","mode","timeUnit","currencies","logoLink","JSON","parse","isParamError","validateToolParams","name","valueCheck","value","validateLocale","render","createElement","CurrencyPowerBalance","theme","container","getElementById"],"sources":["../../../src/CurrencyPowerBalanceWidget/render.tsx"],"sourcesContent":["import React from 'react';\nimport { createRoot } from 'react-dom/client';\nimport { Theme, validateLocale, validateToolParams } 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 root = createRoot(element);\n const params = element.getAttribute('data-currency-power-balance-params');\n const mode = element.getAttribute('data-mode');\n const {\n timeUnit, currencies, locale, logoLink,\n } = JSON.parse(params as string);\n\n const isParamError = validateToolParams({ locale, graphqlUrl }, [\n {\n name: 'locale',\n valueCheck: (value) => validateLocale(value),\n }, {\n name: 'graphqlUrl',\n }]);\n root.render(\n <CurrencyPowerBalance\n graphqlUrl={graphqlUrl}\n locale={locale}\n theme={mode as Theme}\n isParamError={isParamError}\n timeUnit={timeUnit}\n currencies={currencies}\n logoLink={logoLink}\n />,\n );\n });\n} else {\n const container = document.getElementById(configRenderElementId);\n const root = createRoot(container!);\n\n root.render(\n <CurrencyPowerBalance\n locale={configLocale}\n graphqlUrl={configGraphQl}\n />,\n );\n}\n"],"mappings":";;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,iBAAA,GAAAF,OAAA;AACA,IAAAG,qBAAA,GAAAH,OAAA;AAA8D,SAAAD,uBAAAK,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,U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AEA,UAAW;MACvBC,QAAQ,EAAEA;IAAS,CACpB,CACH,CAAC;EACH,CAAC,CAAC;AACJ,CAAC,MAAM;EACL,MAAMa,SAAS,GAAGzB,QAAQ,CAAC0B,cAAc,CAACjC,qBAAqB,CAAC;EAChE,MAAMY,IAAI,GAAG,IAAAC,kBAAU,EAACmB,SAAU,CAAC;EAEnCpB,IAAI,CAACgB,MAAM,CACTxC,MAAA,CAAAQ,OAAA,CAAAiC,aAAA,CAACpC,qBAAA,CAAAqC,oBAAoB;IACnB7B,MAAM,EAAEC,YAAa;IACrBL,UAAU,EAAEC;EAAc,CAC3B,CACH,CAAC;AACH","ignoreList":[]}
1
+ {"version":3,"file":"render.js","names":["_labsWidgetCommon","require","_react","_interopRequireDefault","_client","_CurrencyPowerBalance","e","__esModule","default","graphqlUrl","configGraphQl","renderElementId","configRenderElementId","locale","configLocale","window","currencyPowerBalanceWidgetConfig","widgetsConfig","currencyPowerBalanceParamsElements","document","querySelectorAll","length","forEach","element","root","createRoot","params","getAttribute","mode","timeUnit","currencies","logoLink","JSON","parse","isParamError","validateToolParams","name","valueCheck","value","validateLocale","render","createElement","CurrencyPowerBalance","theme","container","querySelector"],"sources":["../../../src/CurrencyPowerBalanceWidget/render.tsx"],"sourcesContent":["import type { Theme } from '@oanda/labs-widget-common';\nimport { validateLocale, validateToolParams } from '@oanda/labs-widget-common';\nimport React from 'react';\nimport { createRoot } from 'react-dom/client';\n\nimport { CurrencyPowerBalance } from './CurrencyPowerBalance';\n\nconst {\n graphqlUrl: configGraphQl,\n renderElementId: configRenderElementId,\n locale: configLocale,\n} = window.currencyPowerBalanceWidgetConfig || {};\n\nconst { graphqlUrl } = window.widgetsConfig || {};\n\nconst currencyPowerBalanceParamsElements = document.querySelectorAll(\n 'div[data-currency-power-balance-params]'\n);\n\nif (currencyPowerBalanceParamsElements.length > 0) {\n currencyPowerBalanceParamsElements.forEach((element) => {\n const root = createRoot(element);\n const params = element.getAttribute('data-currency-power-balance-params');\n const mode = element.getAttribute('data-mode');\n const { timeUnit, currencies, locale, logoLink } = JSON.parse(\n params as string\n );\n\n const isParamError = validateToolParams({ locale, graphqlUrl }, [\n {\n name: 'locale',\n valueCheck: (value: string | undefined) => validateLocale(value),\n },\n {\n name: 'graphqlUrl',\n },\n ]);\n root.render(\n <CurrencyPowerBalance\n currencies={currencies}\n graphqlUrl={graphqlUrl}\n isParamError={isParamError}\n locale={locale}\n logoLink={logoLink}\n theme={mode as Theme}\n timeUnit={timeUnit}\n />\n );\n });\n} else {\n const container: HTMLElement | null = document.querySelector(\n configRenderElementId\n );\n\n const root = createRoot(container!);\n\n root.render(\n <CurrencyPowerBalance graphqlUrl={configGraphQl} locale={configLocale} />\n );\n}\n"],"mappings":";;AACA,IAAAA,iBAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AAEA,IAAAI,qBAAA,GAAAJ,OAAA;AAA8D,SAAAE,uBAAAG,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAE9D,MAAM;EACJG,UAAU,EAAEC,aAAa;EACzBC,eAAe,EAAEC,qBAAqB;EACtCC,MAAM,EAAEC;AACV,CAAC,GAAGC,MAAM,CAACC,gCAAgC,IAAI,CAAC,CAAC;AAEjD,MAAM;EAAEP;AAAW,CAAC,GAAGM,MAAM,CAACE,aAAa,IAAI,CAAC,CAAC;AAEjD,MAAMC,kCAAkC,GAAGC,QAAQ,CAACC,gBAAgB,CAClE,yCACF,CAAC;AAED,IAAIF,kCAAkC,CAACG,MAAM,GAAG,CAAC,EAAE;EACjDH,kCAAkC,CAACI,OAAO,CAAEC,OAAO,IAAK;IACtD,MAAMC,IAAI,GAAG,IAAAC,kBAAU,EAACF,OAAO,CAAC;IAChC,MAAMG,MAAM,GAAGH,OAAO,CAACI,YAAY,CAAC,oCAAoC,CAAC;IACzE,MAAMC,IAAI,GAAGL,OAAO,CAACI,YAAY,CAAC,WAAW,CAAC;IAC9C,MAAM;MAAEE,QAAQ;MAAEC,UAAU;MAAEjB,MAAM;MAAEkB;IAAS,CAAC,GAAGC,IAAI,CAACC,KAAK,CAC3DP,MACF,CAAC;IAED,MAAMQ,YAAY,GAAG,IAAAC,oCAAkB,EAAC;MAAEtB,MAAM;MAAEJ;IAAW,CAAC,EAAE,CAC9D;MACE2B,IAAI,EAAE,QAAQ;MACdC,UAAU,EAAGC,KAAyB,IAAK,IAAAC,gCAAc,EAACD,KAAK;IACjE,CAAC,EACD;MACEF,IAAI,EAAE;IACR,CAAC,CACF,CAAC;IACFZ,IAAI,CAACgB,MAAM,CACTtC,MAAA,CAAAM,OAAA,CAAAiC,aAAA,CAACpC,qBAAA,CAAAqC,oBAAoB;MACnBZ,UAAU,EAAEA,UAAW;MACvBrB,UAAU,EAAEA,UAAW;MACvByB,YAAY,EAAEA,YAAa;MAC3BrB,MAAM,EAAEA,MAAO;MACfkB,QAAQ,EAAEA,QAAS;MACnBY,KAAK,EAAEf,IAAc;MACrBC,QAAQ,EAAEA;IAAS,CACpB,CACH,CAAC;EACH,CAAC,CAAC;AACJ,CAAC,MAAM;EACL,MAAMe,SAA6B,GAAGzB,QAAQ,CAAC0B,aAAa,CAC1DjC,qBACF,CAAC;EAED,MAAMY,IAAI,GAAG,IAAAC,kBAAU,EAACmB,SAAU,CAAC;EAEnCpB,IAAI,CAACgB,MAAM,CACTtC,MAAA,CAAAM,OAAA,CAAAiC,aAAA,CAACpC,qBAAA,CAAAqC,oBAAoB;IAACjC,UAAU,EAAEC,aAAc;IAACG,MAAM,EAAEC;EAAa,CAAE,CAC1E,CAAC;AACH","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","names":[],"sources":["../../../src/CurrencyPowerBalanceWidget/types.ts"],"sourcesContent":["import { WidgetConfig } from '@oanda/labs-widget-common';\nimport { CurrencyPowerBalanceTimeUnit } from '../gql/types/graphql';\n\nexport interface CurrencyPowerBalanceConfig extends WidgetConfig {\n timeUnit?: CurrencyPowerBalanceTimeUnit;\n currencies?: string[];\n}\n\nexport interface CurrencyPowerBalanceWrapperConfig extends CurrencyPowerBalanceConfig {\n renderElementId: string;\n}\n\nexport interface MainProps {\n timeUnit?: CurrencyPowerBalanceTimeUnit;\n currencies?: string[];\n}\n\nexport interface ChartWithDataProps {\n timeUnit: CurrencyPowerBalanceTimeUnit;\n currencies?: string[];\n}\n"],"mappings":"","ignoreList":[]}
1
+ {"version":3,"file":"types.js","names":[],"sources":["../../../src/CurrencyPowerBalanceWidget/types.ts"],"sourcesContent":["import type { WidgetConfig } from '@oanda/labs-widget-common';\n\nimport type { CurrencyPowerBalanceTimeUnit } from '../gql/types/graphql';\n\nexport interface CurrencyPowerBalanceConfig extends WidgetConfig {\n timeUnit?: CurrencyPowerBalanceTimeUnit;\n currencies?: string[];\n}\n\nexport interface CurrencyPowerBalanceWrapperConfig\n extends CurrencyPowerBalanceConfig {\n renderElementId: string;\n}\n\nexport interface MainProps {\n timeUnit?: CurrencyPowerBalanceTimeUnit;\n currencies?: string[];\n}\n\nexport interface ChartWithDataProps {\n timeUnit: CurrencyPowerBalanceTimeUnit;\n currencies?: string[];\n}\n"],"mappings":"","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"fragment-masking.js","names":["useFragment","_documentNode","fragmentType","makeFragmentData","data","_fragment","isFragmentReady","queryNode","fragmentNode","deferredFields","__meta__","fragDef","definitions","fragName","name","value","fields","length","every","field"],"sources":["../../../../src/gql/types/fragment-masking.ts"],"sourcesContent":["import { ResultOf, DocumentTypeDecoration, TypedDocumentNode } from '@graphql-typed-document-node/core';\nimport { FragmentDefinitionNode } from 'graphql';\nimport { Incremental } from './graphql';\n\n\nexport type FragmentType<TDocumentType extends DocumentTypeDecoration<any, any>> = TDocumentType extends DocumentTypeDecoration<\n infer TType,\n any\n>\n ? [TType] extends [{ ' $fragmentName'?: infer TKey }]\n ? TKey extends string\n ? { ' $fragmentRefs'?: { [key in TKey]: TType } }\n : never\n : never\n : never;\n\n// return non-nullable if `fragmentType` is non-nullable\nexport function useFragment<TType>(\n _documentNode: DocumentTypeDecoration<TType, any>,\n fragmentType: FragmentType<DocumentTypeDecoration<TType, any>>\n): TType;\n// return nullable if `fragmentType` is nullable\nexport function useFragment<TType>(\n _documentNode: DocumentTypeDecoration<TType, any>,\n fragmentType: FragmentType<DocumentTypeDecoration<TType, any>> | null | undefined\n): TType | null | undefined;\n// return array of non-nullable if `fragmentType` is array of non-nullable\nexport function useFragment<TType>(\n _documentNode: DocumentTypeDecoration<TType, any>,\n fragmentType: ReadonlyArray<FragmentType<DocumentTypeDecoration<TType, any>>>\n): ReadonlyArray<TType>;\n// return array of nullable if `fragmentType` is array of nullable\nexport function useFragment<TType>(\n _documentNode: DocumentTypeDecoration<TType, any>,\n fragmentType: ReadonlyArray<FragmentType<DocumentTypeDecoration<TType, any>>> | null | undefined\n): ReadonlyArray<TType> | null | undefined;\nexport function useFragment<TType>(\n _documentNode: DocumentTypeDecoration<TType, any>,\n fragmentType: FragmentType<DocumentTypeDecoration<TType, any>> | ReadonlyArray<FragmentType<DocumentTypeDecoration<TType, any>>> | null | undefined\n): TType | ReadonlyArray<TType> | null | undefined {\n return fragmentType as any;\n}\n\n\nexport function makeFragmentData<\n F extends DocumentTypeDecoration<any, any>,\n FT extends ResultOf<F>\n>(data: FT, _fragment: F): FragmentType<F> {\n return data as FragmentType<F>;\n}\nexport function isFragmentReady<TQuery, TFrag>(\n queryNode: DocumentTypeDecoration<TQuery, any>,\n fragmentNode: TypedDocumentNode<TFrag>,\n data: FragmentType<TypedDocumentNode<Incremental<TFrag>, any>> | null | undefined\n): data is FragmentType<typeof fragmentNode> {\n const deferredFields = (queryNode as { __meta__?: { deferredFields: Record<string, (keyof TFrag)[]> } }).__meta__\n ?.deferredFields;\n\n if (!deferredFields) return true;\n\n const fragDef = fragmentNode.definitions[0] as FragmentDefinitionNode | undefined;\n const fragName = fragDef?.name?.value;\n\n const fields = (fragName && deferredFields[fragName]) || [];\n return fields.length > 0 && fields.every(field => data && field in data);\n}\n"],"mappings":";;;;;;;;AAoCO,SAASA,WAAWA,CACzBC,aAAiD,EACjDC,YAAmJ,EAClG;EACjD,OAAOA,YAAY;AACrB;AAGO,SAASC,gBAAgBA,CAG9BC,IAAQ,EAAEC,SAAY,EAAmB;EACzC,OAAOD,IAAI;AACb;AACO,SAASE,eAAeA,CAC7BC,SAA8C,EAC9CC,YAAsC,EACtCJ,IAAiF,EACtC;EAC3C,MAAMK,cAAc,GAAIF,SAAS,CAAwEG,QAAQ,EAC7GD,cAAc;EAElB,IAAI,CAACA,cAAc,EAAE,OAAO,IAAI;EAEhC,MAAME,OAAO,GAAGH,YAAY,CAACI,WAAW,CAAC,CAAC,CAAuC;EACjF,MAAMC,QAAQ,GAAGF,OAAO,EAAEG,IAAI,EAAEC,KAAK;EAErC,MAAMC,MAAM,GAAIH,QAAQ,IAAIJ,cAAc,CAACI,QAAQ,CAAC,IAAK,EAAE;EAC3D,OAAOG,MAAM,CAACC,MAAM,GAAG,CAAC,IAAID,MAAM,CAACE,KAAK,CAACC,KAAK,IAAIf,IAAI,IAAIe,KAAK,IAAIf,IAAI,CAAC;AAC1E","ignoreList":[]}
1
+ {"version":3,"file":"fragment-masking.js","names":["useFragment","_documentNode","fragmentType","makeFragmentData","data","_fragment","isFragmentReady","queryNode","fragmentNode","deferredFields","__meta__","fragDef","definitions","fragName","name","value","fields","length","every","field"],"sources":["../../../../src/gql/types/fragment-masking.ts"],"sourcesContent":["import {\n ResultOf,\n DocumentTypeDecoration,\n TypedDocumentNode,\n} from '@graphql-typed-document-node/core';\nimport { FragmentDefinitionNode } from 'graphql';\nimport { Incremental } from './graphql';\n\nexport type FragmentType<\n TDocumentType extends DocumentTypeDecoration<any, any>,\n> =\n TDocumentType extends DocumentTypeDecoration<infer TType, any>\n ? [TType] extends [{ ' $fragmentName'?: infer TKey }]\n ? TKey extends string\n ? { ' $fragmentRefs'?: { [key in TKey]: TType } }\n : never\n : never\n : never;\n\n// return non-nullable if `fragmentType` is non-nullable\nexport function useFragment<TType>(\n _documentNode: DocumentTypeDecoration<TType, any>,\n fragmentType: FragmentType<DocumentTypeDecoration<TType, any>>\n): TType;\n// return nullable if `fragmentType` is nullable\nexport function useFragment<TType>(\n _documentNode: DocumentTypeDecoration<TType, any>,\n fragmentType:\n | FragmentType<DocumentTypeDecoration<TType, any>>\n | null\n | undefined\n): TType | null | undefined;\n// return array of non-nullable if `fragmentType` is array of non-nullable\nexport function useFragment<TType>(\n _documentNode: DocumentTypeDecoration<TType, any>,\n fragmentType: ReadonlyArray<FragmentType<DocumentTypeDecoration<TType, any>>>\n): ReadonlyArray<TType>;\n// return array of nullable if `fragmentType` is array of nullable\nexport function useFragment<TType>(\n _documentNode: DocumentTypeDecoration<TType, any>,\n fragmentType:\n | ReadonlyArray<FragmentType<DocumentTypeDecoration<TType, any>>>\n | null\n | undefined\n): ReadonlyArray<TType> | null | undefined;\nexport function useFragment<TType>(\n _documentNode: DocumentTypeDecoration<TType, any>,\n fragmentType:\n | FragmentType<DocumentTypeDecoration<TType, any>>\n | ReadonlyArray<FragmentType<DocumentTypeDecoration<TType, any>>>\n | null\n | undefined\n): TType | ReadonlyArray<TType> | null | undefined {\n return fragmentType as any;\n}\n\nexport function makeFragmentData<\n F extends DocumentTypeDecoration<any, any>,\n FT extends ResultOf<F>,\n>(data: FT, _fragment: F): FragmentType<F> {\n return data as FragmentType<F>;\n}\nexport function isFragmentReady<TQuery, TFrag>(\n queryNode: DocumentTypeDecoration<TQuery, any>,\n fragmentNode: TypedDocumentNode<TFrag>,\n data:\n | FragmentType<TypedDocumentNode<Incremental<TFrag>, any>>\n | null\n | undefined\n): data is FragmentType<typeof fragmentNode> {\n const deferredFields = (\n queryNode as {\n __meta__?: { deferredFields: Record<string, (keyof TFrag)[]> };\n }\n ).__meta__?.deferredFields;\n\n if (!deferredFields) return true;\n\n const fragDef = fragmentNode.definitions[0] as\n | FragmentDefinitionNode\n | undefined;\n const fragName = fragDef?.name?.value;\n\n const fields = (fragName && deferredFields[fragName]) || [];\n return fields.length > 0 && fields.every((field) => data && field in data);\n}\n"],"mappings":";;;;;;;;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":[]}
@@ -8,7 +8,7 @@ var types = _interopRequireWildcard(require("./graphql"));
8
8
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
9
9
  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 && {}.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; }
10
10
  const documents = {
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
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
14
  return documents[source] ?? {};
@@ -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"],"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\": 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(source: \"\\n query GetCurrencyPowerBalance($timeUnit: CurrencyPowerBalanceTimeUnit!) {\\n currencyPowerBalance(timeUnit: $timeUnit) {\\n currency\\n power {\\n point\\n price\\n }\\n updatedAt\\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>> = TDocumentNode extends DocumentNode< infer TType, any> ? TType : never;"],"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;EACd,qOAAqO,EAAEvB,KAAK,CAACwB;AACjP,CAAC;AAqBM,SAASC,OAAOA,CAACC,MAAc,EAAE;EACtC,OAAQH,SAAS,CAASG,MAAM,CAAC,IAAI,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,C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