@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.
- package/CHANGELOG.md +456 -0
- package/dist/main/CurrencyPowerBalanceWidget/ChartWithData.js +7 -7
- package/dist/main/CurrencyPowerBalanceWidget/ChartWithData.js.map +1 -1
- package/dist/main/CurrencyPowerBalanceWidget/CurrencyPowerBalance.js +9 -9
- package/dist/main/CurrencyPowerBalanceWidget/CurrencyPowerBalance.js.map +1 -1
- package/dist/main/CurrencyPowerBalanceWidget/Main.js +10 -10
- package/dist/main/CurrencyPowerBalanceWidget/Main.js.map +1 -1
- package/dist/main/CurrencyPowerBalanceWidget/components/Chart/Chart.js +11 -11
- package/dist/main/CurrencyPowerBalanceWidget/components/Chart/Chart.js.map +1 -1
- package/dist/main/CurrencyPowerBalanceWidget/components/Chart/options/constants.js.map +1 -1
- package/dist/main/CurrencyPowerBalanceWidget/components/Chart/options/formatters.js.map +1 -1
- package/dist/main/CurrencyPowerBalanceWidget/components/Chart/options/getOption.js +1 -1
- package/dist/main/CurrencyPowerBalanceWidget/components/Chart/options/getOption.js.map +1 -1
- package/dist/main/CurrencyPowerBalanceWidget/components/Chart/options/getResponsiveOption.js.map +1 -1
- package/dist/main/CurrencyPowerBalanceWidget/components/Chart/options/types.js.map +1 -1
- package/dist/main/CurrencyPowerBalanceWidget/components/Chart/options/utils.js.map +1 -1
- package/dist/main/CurrencyPowerBalanceWidget/components/Chart/types.js.map +1 -1
- package/dist/main/CurrencyPowerBalanceWidget/components/TimeUnitSwitch/TimeUnitSelect.js +4 -4
- package/dist/main/CurrencyPowerBalanceWidget/components/TimeUnitSwitch/TimeUnitSelect.js.map +1 -1
- package/dist/main/CurrencyPowerBalanceWidget/components/TimeUnitSwitch/TimeUnitSwitch.js +9 -9
- package/dist/main/CurrencyPowerBalanceWidget/components/TimeUnitSwitch/TimeUnitSwitch.js.map +1 -1
- package/dist/main/CurrencyPowerBalanceWidget/components/TimeUnitSwitch/types.js.map +1 -1
- package/dist/main/CurrencyPowerBalanceWidget/config.js.map +1 -1
- package/dist/main/CurrencyPowerBalanceWidget/constants.js.map +1 -1
- package/dist/main/CurrencyPowerBalanceWidget/render.js +8 -8
- package/dist/main/CurrencyPowerBalanceWidget/render.js.map +1 -1
- package/dist/main/CurrencyPowerBalanceWidget/types.js.map +1 -1
- package/dist/main/gql/types/fragment-masking.js.map +1 -1
- package/dist/main/gql/types/gql.js +1 -1
- package/dist/main/gql/types/gql.js.map +1 -1
- package/dist/main/gql/types/graphql.js +64 -64
- package/dist/main/gql/types/graphql.js.map +1 -1
- package/dist/main/gql/types/index.js.map +1 -1
- package/dist/main/translations/index.js +1 -1
- package/dist/main/translations/index.js.map +1 -1
- package/dist/main/translations/translations.js.map +1 -1
- package/dist/module/CurrencyPowerBalanceWidget/ChartWithData.js +7 -7
- package/dist/module/CurrencyPowerBalanceWidget/ChartWithData.js.map +1 -1
- package/dist/module/CurrencyPowerBalanceWidget/CurrencyPowerBalance.js +9 -9
- package/dist/module/CurrencyPowerBalanceWidget/CurrencyPowerBalance.js.map +1 -1
- package/dist/module/CurrencyPowerBalanceWidget/Main.js +10 -10
- package/dist/module/CurrencyPowerBalanceWidget/Main.js.map +1 -1
- package/dist/module/CurrencyPowerBalanceWidget/components/Chart/Chart.js +10 -10
- package/dist/module/CurrencyPowerBalanceWidget/components/Chart/Chart.js.map +1 -1
- package/dist/module/CurrencyPowerBalanceWidget/components/Chart/options/constants.js +1 -1
- package/dist/module/CurrencyPowerBalanceWidget/components/Chart/options/constants.js.map +1 -1
- package/dist/module/CurrencyPowerBalanceWidget/components/Chart/options/formatters.js +2 -2
- package/dist/module/CurrencyPowerBalanceWidget/components/Chart/options/formatters.js.map +1 -1
- package/dist/module/CurrencyPowerBalanceWidget/components/Chart/options/getOption.js +2 -2
- package/dist/module/CurrencyPowerBalanceWidget/components/Chart/options/getOption.js.map +1 -1
- package/dist/module/CurrencyPowerBalanceWidget/components/Chart/options/getResponsiveOption.js.map +1 -1
- package/dist/module/CurrencyPowerBalanceWidget/components/Chart/options/types.js.map +1 -1
- package/dist/module/CurrencyPowerBalanceWidget/components/Chart/options/utils.js.map +1 -1
- package/dist/module/CurrencyPowerBalanceWidget/components/Chart/types.js.map +1 -1
- package/dist/module/CurrencyPowerBalanceWidget/components/TimeUnitSwitch/TimeUnitSelect.js +4 -4
- package/dist/module/CurrencyPowerBalanceWidget/components/TimeUnitSwitch/TimeUnitSelect.js.map +1 -1
- package/dist/module/CurrencyPowerBalanceWidget/components/TimeUnitSwitch/TimeUnitSwitch.js +10 -10
- package/dist/module/CurrencyPowerBalanceWidget/components/TimeUnitSwitch/TimeUnitSwitch.js.map +1 -1
- package/dist/module/CurrencyPowerBalanceWidget/components/TimeUnitSwitch/types.js.map +1 -1
- package/dist/module/CurrencyPowerBalanceWidget/config.js.map +1 -1
- package/dist/module/CurrencyPowerBalanceWidget/constants.js.map +1 -1
- package/dist/module/CurrencyPowerBalanceWidget/render.js +8 -8
- package/dist/module/CurrencyPowerBalanceWidget/render.js.map +1 -1
- package/dist/module/CurrencyPowerBalanceWidget/types.js.map +1 -1
- package/dist/module/gql/types/fragment-masking.js.map +1 -1
- package/dist/module/gql/types/gql.js +1 -1
- package/dist/module/gql/types/gql.js.map +1 -1
- package/dist/module/gql/types/graphql.js +64 -64
- package/dist/module/gql/types/graphql.js.map +1 -1
- package/dist/module/gql/types/index.js +2 -2
- package/dist/module/gql/types/index.js.map +1 -1
- package/dist/module/translations/index.js +1 -1
- package/dist/module/translations/index.js.map +1 -1
- package/dist/module/translations/translations.js.map +1 -1
- package/dist/types/CurrencyPowerBalanceWidget/ChartWithData.d.ts +1 -1
- package/dist/types/CurrencyPowerBalanceWidget/CurrencyPowerBalance.d.ts +1 -1
- package/dist/types/CurrencyPowerBalanceWidget/Main.d.ts +1 -1
- package/dist/types/CurrencyPowerBalanceWidget/components/Chart/Chart.d.ts +1 -1
- package/dist/types/CurrencyPowerBalanceWidget/components/Chart/options/constants.d.ts +1 -1
- package/dist/types/CurrencyPowerBalanceWidget/components/Chart/options/formatters.d.ts +4 -3
- package/dist/types/CurrencyPowerBalanceWidget/components/Chart/options/getOption.d.ts +2 -1
- package/dist/types/CurrencyPowerBalanceWidget/components/Chart/options/utils.d.ts +1 -1
- package/dist/types/CurrencyPowerBalanceWidget/components/Chart/types.d.ts +1 -1
- package/dist/types/CurrencyPowerBalanceWidget/components/TimeUnitSwitch/TimeUnitSelect.d.ts +1 -1
- package/dist/types/CurrencyPowerBalanceWidget/components/TimeUnitSwitch/TimeUnitSwitch.d.ts +1 -1
- package/dist/types/CurrencyPowerBalanceWidget/components/TimeUnitSwitch/types.d.ts +3 -3
- package/dist/types/CurrencyPowerBalanceWidget/types.d.ts +2 -2
- package/dist/types/gql/types/gql.d.ts +2 -2
- package/dist/types/gql/types/index.d.ts +2 -2
- package/dist/types/translations/index.d.ts +2 -2
- package/package.json +3 -3
- package/src/CurrencyPowerBalanceWidget/ChartWithData.tsx +31 -17
- package/src/CurrencyPowerBalanceWidget/CurrencyPowerBalance.tsx +16 -9
- package/src/CurrencyPowerBalanceWidget/Main.tsx +18 -9
- package/src/CurrencyPowerBalanceWidget/components/Chart/Chart.tsx +25 -20
- package/src/CurrencyPowerBalanceWidget/components/Chart/options/constants.ts +11 -10
- package/src/CurrencyPowerBalanceWidget/components/Chart/options/formatters.ts +42 -22
- package/src/CurrencyPowerBalanceWidget/components/Chart/options/getOption.ts +59 -44
- package/src/CurrencyPowerBalanceWidget/components/Chart/options/getResponsiveOption.ts +7 -4
- package/src/CurrencyPowerBalanceWidget/components/Chart/options/types.ts +1 -1
- package/src/CurrencyPowerBalanceWidget/components/Chart/options/utils.ts +10 -9
- package/src/CurrencyPowerBalanceWidget/components/Chart/types.ts +4 -1
- package/src/CurrencyPowerBalanceWidget/components/TimeUnitSwitch/TimeUnitSelect.tsx +21 -15
- package/src/CurrencyPowerBalanceWidget/components/TimeUnitSwitch/TimeUnitSwitch.tsx +47 -37
- package/src/CurrencyPowerBalanceWidget/components/TimeUnitSwitch/types.ts +3 -3
- package/src/CurrencyPowerBalanceWidget/config.ts +8 -2
- package/src/CurrencyPowerBalanceWidget/constants.ts +2 -1
- package/src/CurrencyPowerBalanceWidget/render.tsx +24 -20
- package/src/CurrencyPowerBalanceWidget/types.ts +5 -3
- package/src/gql/types/fragment-masking.ts +41 -21
- package/src/gql/types/gql.ts +7 -3
- package/src/gql/types/graphql.ts +117 -44
- package/src/gql/types/index.ts +2 -2
- package/src/translations/index.ts +4 -4
- package/src/translations/translations.ts +2 -1
- package/test/Main.test.tsx +28 -14
- package/test/chartFormatters.test.ts +84 -24
- package/test/responsesMocks.ts +254 -255
- package/test/utils.test.ts +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","names":["colorPalette","CurrencyName","WEEKEND_DURATION","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","Usd","Eur","Gbp","Cad","Aud","Chf","Jpy","Nzd","COLOR_CONFIG","USD","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
|
|
1
|
+
{"version":3,"file":"constants.js","names":["colorPalette","CurrencyName","WEEKEND_DURATION","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","Usd","Eur","Gbp","Cad","Aud","Chf","Jpy","Nzd","COLOR_CONFIG","USD","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 VERTICAL_LINE_COUNT,\n WEEKEND_DURATION,\n X_LABEL_SIZE,\n X_LABEL_SIZE_MOBILE,\n Y_LABEL_SIZE,\n Y_LABEL_SIZE_MOBILE,\n};\n"],"mappings":"AAAA,SAASA,YAAY,QAAQ,2BAA2B;AAExD,SAASC,YAAY,QAAQ,+BAA+B;AAE5D,MAAMC,gBAAgB,GAAG,SAAS;AAElC,MAAMC,YAAY,GA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gB,EAChBC,YAAY,EACZC,mBAAmB,EACnBE,YAAY,EACZD,mBAAmB","ignoreList":[]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CurrencyPowerBalanceTimeUnit } from '../../../../gql/types/graphql';
|
|
2
|
-
import {
|
|
2
|
+
import { COLOR_CONFIG, CURRENCIES_ORDER, VERTICAL_LINE_COUNT } from './constants';
|
|
3
3
|
const getDateAndTime = param => {
|
|
4
4
|
const dateAndTime = param.split('T');
|
|
5
5
|
return {
|
|
@@ -76,5 +76,5 @@ const formatLegendData = values => {
|
|
|
76
76
|
}
|
|
77
77
|
}));
|
|
78
78
|
};
|
|
79
|
-
export {
|
|
79
|
+
export { formatLegendData, intervalFormatter, isMonthWeek, tooltipFormatter, xAxisLabelFormatter };
|
|
80
80
|
//# sourceMappingURL=formatters.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"formatters.js","names":["CurrencyPowerBalanceTimeUnit","
|
|
1
|
+
{"version":3,"file":"formatters.js","names":["CurrencyPowerBalanceTimeUnit","COLOR_CONFIG","CURRENCIES_ORDER","VERTICAL_LINE_COUNT","getDateAndTime","param","dateAndTime","split","date","time","substring","dateFormat","Date","toLocaleDateString","undefined","month","day","dateTimeFormat","_ref","year","isMonthWeek","timeUnit","M3","M1","W1","xAxisLabelFormatter","label","isDateFormat","intervalFormatter","dataLength","Math","round","tooltipFormatter","values","value","row","sort","_ref2","_ref3","valueA","valueB","Number","map","_ref4","marker","seriesName","join","formatLegendData","dataCurrencies","_ref5","currency","list","length","filter","includes","name","itemStyle","color"],"sources":["../../../../../../src/CurrencyPowerBalanceWidget/components/Chart/options/formatters.ts"],"sourcesContent":["import type { CurrencyPowerBalance } from '../../../../gql/types/graphql';\nimport { CurrencyPowerBalanceTimeUnit } from '../../../../gql/types/graphql';\nimport {\n COLOR_CONFIG,\n CURRENCIES_ORDER,\n VERTICAL_LINE_COUNT,\n} from './constants';\nimport type { TooltipFormatterParams } from './types';\n\nconst getDateAndTime = (param: string) => {\n const dateAndTime = param.split('T');\n\n return {\n date: dateAndTime[0],\n time: dateAndTime[1].substring(0, 5),\n };\n};\n\nconst dateFormat = (date: string) =>\n `${new Date(date).toLocaleDateString(undefined, { month: 'numeric', day: 'numeric' })}`;\n\nconst dateTimeFormat = ({ date, time }: { date: string; time: string }) =>\n `${new Date(date).toLocaleDateString(undefined, { year: 'numeric', month: 'numeric', day: 'numeric' })}, ${time} UTC`;\n\nconst isMonthWeek = (timeUnit: CurrencyPowerBalanceTimeUnit) =>\n timeUnit === CurrencyPowerBalanceTimeUnit.M3 ||\n timeUnit === CurrencyPowerBalanceTimeUnit.M1 ||\n timeUnit === CurrencyPowerBalanceTimeUnit.W1;\n\nconst xAxisLabelFormatter = (\n label: string,\n timeUnit: CurrencyPowerBalanceTimeUnit\n) => {\n const { date, time } = getDateAndTime(label);\n const isDateFormat = isMonthWeek(timeUnit) || time === '00:00';\n\n return isDateFormat ? dateFormat(date) : time;\n};\n\nconst intervalFormatter = (dataLength: number) =>\n Math.round(dataLength / VERTICAL_LINE_COUNT);\n\nconst tooltipFormatter = (values: TooltipFormatterParams[]) => {\n const date = dateTimeFormat(getDateAndTime(values[0].value[0]));\n\n const row = values\n .sort(\n ({ value: valueA }, { value: valueB }) =>\n Number(valueB[1]) - Number(valueA[1])\n )\n .map(\n ({\n marker,\n seriesName,\n value,\n }) => `<div style=\"display:flex;align-items:center;\">\n <div style=\"display:flex;align-items:center;width:50px;margin-right:10px;\">\n ${marker}\n <span>${seriesName}</span>\n </div>\n <span>${value[1]}</span>\n </div>`\n );\n\n return `<div style=\"display:flex; flex-direction:column;\">\n <span style=\"margin-bottom:5px;\">${date}</span>\n ${row.join('\\n')}\n </div>`;\n};\n\nconst formatLegendData = (values: CurrencyPowerBalance[]) => {\n const dataCurrencies = values.map(({ currency }) => currency);\n\n const list =\n dataCurrencies.length === CURRENCIES_ORDER.length\n ? CURRENCIES_ORDER\n : CURRENCIES_ORDER.filter((currency) =>\n dataCurrencies.includes(currency)\n );\n\n return list.map((currency) => ({\n name: currency,\n itemStyle: {\n color: COLOR_CONFIG[currency],\n },\n }));\n};\n\nexport {\n formatLegendData,\n intervalFormatter,\n isMonthWeek,\n tooltipFormatter,\n xAxisLabelFormatter,\n};\n"],"mappings":"AACA,SAASA,4BAA4B,QAAQ,+BAA+B;AAC5E,SACEC,YAAY,EACZC,gBAAgB,EAChBC,mBAAmB,QACd,aAAa;AAGpB,MAAMC,cAAc,GAAIC,KAAa,IAAK;EACxC,MAAMC,WAAW,GAAGD,KAAK,CAACE,KAAK,CAAC,GAAG,CAAC;EAEpC,OAAO;IACLC,IAAI,EAAEF,WAAW,CAAC,CAAC,CAAC;IACpBG,IAAI,EAAEH,WAAW,CAAC,CAAC,CAAC,CAACI,SAAS,CAAC,CAAC,EAAE,CAAC;EACrC,CAAC;AACH,CAAC;AAED,MAAMC,UAAU,GAAIH,IAAY,IAC9B,GAAG,IAAII,IAAI,CAACJ,IAAI,CAAC,CAACK,kBAAkB,CAACC,SAAS,EAAE;EAAEC,KAAK,EAAE,SAAS;EAAEC,GAAG,EAAE;AAAU,CAAC,CAAC,EAAE;AAEzF,MAAMC,cAAc,GAAGC,IAAA;EAAA,IAAC;IAAEV,IAAI;IAAEC;EAAqC,CAAC,GAAAS,IAAA;EAAA,OACpE,GAAG,IAAIN,IAAI,CAACJ,IAAI,CAAC,CAACK,kBAAkB,CAACC,SAAS,EAAE;IAAEK,IAAI,EAAE,SAAS;IAAEJ,KAAK,EAAE,SAAS;IAAEC,GAAG,EAAE;EAAU,CAAC,CAAC,KAAKP,IAAI,MAAM;AAAA;AAEvH,MAAMW,WAAW,GAAIC,QAAsC,IACzDA,QAAQ,KAAKrB,4BAA4B,CAACsB,EAAE,IAC5CD,QAAQ,KAAKrB,4BAA4B,CAACuB,EAAE,IAC5CF,QAAQ,KAAKrB,4BAA4B,CAACwB,EAAE;AAE9C,MAAMC,mBAAmB,GAAGA,CAC1BC,KAAa,EACbL,QAAsC,K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G,CAACO,KAAA;IAAA,IAAC;MAAEC;IAAS,CAAC,GAAAD,KAAA;IAAA,OAAKC,QAAQ;EAAA,EAAC;EAE7D,MAAMC,IAAI,GACRH,cAAc,CAACI,MAAM,KAAKlD,gBAAgB,CAACkD,MAAM,GAC7ClD,gBAAgB,GAChBA,gBAAgB,CAACmD,MAAM,CAAEH,QAAQ,IAC/BF,cAAc,CAACM,QAAQ,CAACJ,QAAQ,CAClC,CAAC;EAEP,OAAOC,IAAI,CAACT,GAAG,CAAEQ,QAAQ,KAAM;IAC7BK,IAAI,EAAEL,QAAQ;IACdM,SAAS,EAAE;MACTC,KAAK,EAAExD,YAAY,CAACiD,QAAQ;IAC9B;EACF,CAAC,CAAC,CAAC;AACL,CAAC;AAED,SACEH,gBAAgB,EAChBnB,iBAAiB,EACjBR,WAAW,EACXY,gBAAgB,EAChBP,mBAAmB","ignoreList":[]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { darkTheme, lightTheme } from '@oanda/labs-widget-common';
|
|
2
|
-
import { COLOR_CONFIG, TOOLTIP_LINE_COLOR_CONFIG } from './constants';
|
|
3
|
-
import { intervalFormatter, tooltipFormatter, xAxisLabelFormatter, formatLegendData } from './formatters';
|
|
4
2
|
import { CurrencyPowerBalanceTimeUnit } from '../../../../gql/types/graphql';
|
|
3
|
+
import { COLOR_CONFIG, TOOLTIP_LINE_COLOR_CONFIG } from './constants';
|
|
4
|
+
import { formatLegendData, intervalFormatter, tooltipFormatter, xAxisLabelFormatter } from './formatters';
|
|
5
5
|
import { findLastIndexesBeforeWeekend } from './utils';
|
|
6
6
|
const getOption = (chartData, timeUnit, isDark, lang) => {
|
|
7
7
|
const currentTheme = isDark ? darkTheme : lightTheme;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getOption.js","names":["darkTheme","lightTheme","
|
|
1
|
+
{"version":3,"file":"getOption.js","names":["darkTheme","lightTheme","CurrencyPowerBalanceTimeUnit","COLOR_CONFIG","TOOLTIP_LINE_COLOR_CONFIG","formatLegendData","intervalFormatter","tooltipFormatter","xAxisLabelFormatter","findLastIndexesBeforeWeekend","getOption","chartData","timeUnit","isDark","lang","currentTheme","dataTimestamps","power","map","x","Date","point","getTime","weekendsIndexes","disableWeekendsIndicator","CurrentDay","PreviousDay","M3","includes","length","weekendsMarks","item","xAxis","label","formatter","seriesData","_ref","index","currency","name","type","symbol","showSymbol","itemStyle","color","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","animation","legend","bottom","icon","tooltip","trigger","axisPointer","axis","z","DARK","LIGHT","extraCssText","axisTick","axisLine","splitLine","axisLabel","margin","rotate","interval","yAxis","splitNumber","boundaryGap","showMaxLabel","showMinLabel","series"],"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,SAASA,SAAS,EAAEC,UAAU,QAAQ,2BAA2B;AAGjE,SAASC,4BAA4B,QAAQ,+BAA+B;AAC5E,SAASC,YAAY,EAAEC,yBAAyB,QAAQ,aAAa;AACrE,SACEC,gBAAgB,EAChBC,iBAAiB,EACjBC,gBAAgB,EAChBC,mBAAmB,QACd,cAAc;AACrB,SAASC,4BAA4B,QAAQ,SAAS;AAEtD,MAAMC,SAAS,GAAGA,CAChBC,SAAiC,EACjCC,QAAsC,EACtCC,MAAe,EACfC,IAA6B,KAC1B;EACH,MAAMC,YAAY,GAAGF,MAAM,GAAGb,SAAS,GAAGC,UAAU;EACpD,MAAMe,cAAc,GAAGL,SAAS,CAAC,CAAC,CAAC,CAACM,KAAK,CAACC,GAAG,CAAEC,CAAC,IAC9C,IAAIC,IAAI,CAACD,CAAC,CAACE,KAAK,CAAC,CAACC,OAAO,CAAC,CAC5B,CAAC;EACD,MAAMC,eAAe,GAAGd,4BAA4B,CAACO,cAAc,CAAC;EACpE,MAAMQ,wBAAwB,GAC5B,CACEtB,4BAA4B,CAACuB,UAAU,EACvCvB,4BAA4B,CAACwB,WAAW,EACxCxB,4BAA4B,CAACyB,EAAE,CAChC,CAACC,QAAQ,CAAChB,QAAQ,CAAC,IAAIW,eAAe,CAACM,MAAM,KAAK,CAAC;EAEtD,MAAMC,aAAa,GAAGP,eAAe,CAACL,GAAG,CAAEa,IAAI,KAAM;IACnDC,KAAK,EAAED,IAAI;IACXE,KAAK,EAAE;MACLC,SAAS,EAAEA,CAAA,KAAMpB,IAAI,CAAC,eAAe;IACvC;EACF,CAAC,CAAC,CAAC;EAEH,MAAMqB,UAAU,GAAGxB,SAAS,CAACO,GAAG,CAAC,CA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AAE;MACLlD,IAAI,EAAE,OAAO;MACbU,QAAQ,EAAE,OAAO;MACjByC,WAAW,EAAE,CAAC;MACdP,QAAQ,EAAE;QAAEnC,IAAI,EAAE;MAAM,CAAC;MACzBkC,QAAQ,EAAE;QAAElC,IAAI,EAAE;MAAM,CAAC;MACzB2C,WAAW,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC;MAC3BN,SAAS,EAAE;QACTO,YAAY,EAAE,KAAK;QACnBC,YAAY,EAAE;MAChB;IACF,CAAC;IACDC,MAAM,EAAE5D;EACV,CAAC;AACH,CAAC;AAED,SAASzB,SAAS","ignoreList":[]}
|
package/dist/module/CurrencyPowerBalanceWidget/components/Chart/options/getResponsiveOption.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getResponsiveOption.js","names":["getGridLines","CHART_HEIGHT","CHART_WIDTH","LEGEND_HEIGHT","LEGEND_HEIGHT_MOBILE","X_LABEL_SIZE","X_LABEL_SIZE_MOBILE","Y_LABEL_SIZE","Y_LABEL_SIZE_MOBILE","getResponsiveOption","isDesktop","isMobile","isDark","baseGridLines","chartWidth","chartHeight","xLabelsSize","yLabelSize","bottomLeftBox","marginBottom","yAxis","axisLabel","margin","grid","name","top","left","right","bottom","graphic"],"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
|
|
1
|
+
{"version":3,"file":"getResponsiveOption.js","names":["getGridLines","CHART_HEIGHT","CHART_WIDTH","LEGEND_HEIGHT","LEGEND_HEIGHT_MOBILE","X_LABEL_SIZE","X_LABEL_SIZE_MOBILE","Y_LABEL_SIZE","Y_LABEL_SIZE_MOBILE","getResponsiveOption","isDesktop","isMobile","isDark","baseGridLines","chartWidth","chartHeight","xLabelsSize","yLabelSize","bottomLeftBox","marginBottom","yAxis","axisLabel","margin","grid","name","top","left","right","bottom","graphic"],"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,SAASA,YAAY,QAAQ,2BAA2B;AAExD,SACEC,YAAY,EACZC,WAAW,EACXC,aAAa,EACbC,oBAAoB,EACpBC,YAAY,EACZC,mBAAmB,EACnBC,YAAY,EACZC,mBAAmB,QACd,aAAa;AAEpB,MAAMC,mBAAmB,GAAGA,CAC1BC,SAAkB,EAClBC,QAAiB,EACjBC,MAAe,KACZ;EACH,MAAMC,aAAa,GAAGb,YAAY,CAAC;IACjCY,MAAM;IACNE,UAAU,EAAEZ,WAAW;IACvBa,WAAW,EAAEd,YAAY;IACzBe,WAAW,EAAEL,QAAQ,GAAGL,mBAAmB,GAAGD,YAAY;IAC1DY,UAAU,EAAEN,QAAQ,GAAGH,mBAAmB,GAAGD,YAAY;IACzDW,aAAa,EAAE,KAAK;IACpBC,YAAY,EAAER,QAAQ,GAAGP,oBAAoB,GAAGD;EAClD,CAAC,CAAC;EAEF,OAAO;IACLiB,KAAK,EAAE;MACLC,SAAS,EAAE;QACTC,MAAM,EAAEZ,SAAS,GAAG,CAAC,GAAG;MAC1B;IACF,CAAC;IACDa,IAAI,EAAE,CACJ;MACEC,IAAI,EAAE,WAAW;MACjBC,GAAG,EAAE,KAAK;MACVC,IAAI,EAAE,KAAK;MACXC,KAAK,EAAE,GAAGhB,QAAQ,GAAGH,mBAAmB,GAAGD,YAAY,IAAI;MAC3DqB,MAAM,EAAE,GAAGjB,QAAQ,GAAGL,mBAAmB,GAAGD,YAAY;IAC1D,CAAC,CACF;IACDwB,OAAO,EAAE,CAAC,GAAGhB,aAAa;EAC5B,CAAC;AACH,CAAC;AAED,SAASJ,mBAAmB","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[]
|
|
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":["WEEKEND_DURATION","findLastIndexesBeforeWeekend","timestamps","reduce","acc","timestamp","index","length"],"sources":["../../../../../../src/CurrencyPowerBalanceWidget/components/Chart/options/utils.ts"],"sourcesContent":["import { WEEKEND_DURATION } from './constants';\n\nconst findLastIndexesBeforeWeekend = (timestamps: number[])
|
|
1
|
+
{"version":3,"file":"utils.js","names":["WEEKEND_DURATION","findLastIndexesBeforeWeekend","timestamps","reduce","acc","timestamp","index","length"],"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,SAASA,gBAAgB,QAAQ,aAAa;AAE9C,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,IAAIL,gBAAgB,GACjD,CAAC,GAAGI,GAAG,EAAEE,KAAK,CAAC,GACfF,GAAG,EACT,EACF,CAAC;AAEH,SAASH,4BAA4B","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","names":[],"sources":["../../../../../src/CurrencyPowerBalanceWidget/components/Chart/types.ts"],"sourcesContent":["import {
|
|
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":[]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
1
|
import { Select } from '@oanda/labs-widget-common';
|
|
3
2
|
import { useLocale } from '@oanda/mono-i18n';
|
|
3
|
+
import React from 'react';
|
|
4
4
|
const TimeUnitSelect = _ref => {
|
|
5
5
|
let {
|
|
6
6
|
selected,
|
|
@@ -32,11 +32,11 @@ const TimeUnitSelect = _ref => {
|
|
|
32
32
|
return id === selected;
|
|
33
33
|
});
|
|
34
34
|
return React.createElement("div", {
|
|
35
|
-
|
|
36
|
-
|
|
35
|
+
className: "lw-mb-6 lw-w-full",
|
|
36
|
+
"data-testid": "time-unit-select"
|
|
37
37
|
}, React.createElement(Select, {
|
|
38
|
-
searchPlaceholder: lang('search'),
|
|
39
38
|
options: selectOptions,
|
|
39
|
+
searchPlaceholder: lang('search'),
|
|
40
40
|
selectedOption: {
|
|
41
41
|
id: selected,
|
|
42
42
|
label: selectedLabel
|
package/dist/module/CurrencyPowerBalanceWidget/components/TimeUnitSwitch/TimeUnitSelect.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TimeUnitSelect.js","names":["
|
|
1
|
+
{"version":3,"file":"TimeUnitSelect.js","names":["Select","useLocale","React","TimeUnitSelect","_ref","selected","options","callback","lang","selectOptions","map","_ref2","value","id","label","tooltipLabel","translationKey","count","selectedLabel","filter","_ref3","createElement","className","searchPlaceholder","selectedOption","setSelectedOption","_ref4"],"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,SAASA,MAAM,QAAQ,2BAA2B;AAClD,SAASC,SAAS,QAAQ,kBAAkB;AAC5C,OAAOC,KAAK,MAAM,OAAO;AAKzB,MAAMC,cAAc,GAAGC,IAAA,IAII;EAAA,IAJH;IACtBC,QAAQ;IACRC,OAAO;IACPC;EACmB,CAAC,GAAAH,IAAA;EACpB,MAAM;IAAEI;EAAK,CAAC,GAAGP,SAAS,CAAC,CAAC;EAC5B,MAAMQ,aAAa,GAAGH,OAAO,CAACI,GAAG,CAACC,KAAA;IAAA,IAAC;MAAEC,KAAK,EAAEC,EAAE;MAAEC,KAAK;MAAEC;IAAa,CAAC,GAAAJ,KAAA;IAAA,OAAM;MACzEE,EAAE;MACFC,KAAK,EAAEC,YAAY,GACfP,IAAI,CAACO,YAAY,CAACC,cAAc,EAAE;QAAEC,KAAK,EAAEF,YAAY,CAACE;MAAM,CAAC,CAAC,GAChET,IAAI,CAACM,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,KAAKR,QAAQ;EAAA,CAC7B,CAAC;EAED,OACEH,KAAA,CAAAmB,aAAA;IAAKC,SAAS,EAAC,mBAAmB;IAAC,eAAY;EAAkB,GAC/DpB,KAAA,CAAAmB,aAAA,CAACrB,MAAM;IACLM,OAAO,EAAEG,aAAc;IACvBc,iBAAiB,EAAEf,IAAI,CAAC,QAAQ,CAAE;IAClCgB,cAAc,EAAE;MAAEX,EAAE,EAAER,QAAQ;MAAES,KAAK,EAAEI;IAAc,CAAE;IACvDO,iBAAiB,EAAEC,KAAA;MAAA,IAAC;QAAEb;MAAG,CAAC,GAAAa,KAAA;MAAA,OACxBnB,QAAQ,CAACM,EAAkC,CAAC;IAAA;EAC7C,CACF,CACE,CAAC;AAEV,CAAC;AAED,SAASV,cAAc","ignoreList":[]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { Button, ButtonSize, ButtonVariant, useLayoutProvider, Size } from '@oanda/labs-widget-common';
|
|
1
|
+
import { Button, ButtonSize, ButtonVariant, Size, useLayoutProvider } from '@oanda/labs-widget-common';
|
|
3
2
|
import { useLocale } from '@oanda/mono-i18n';
|
|
3
|
+
import React from 'react';
|
|
4
4
|
import { CURRENCY_POWER_BALANCE_TOOLTIP_ID } from '../../constants';
|
|
5
5
|
import { TimeUnitSelect } from './TimeUnitSelect';
|
|
6
6
|
const TimeUnitSwitch = _ref => {
|
|
@@ -20,8 +20,8 @@ const TimeUnitSwitch = _ref => {
|
|
|
20
20
|
callback(e.currentTarget.value);
|
|
21
21
|
};
|
|
22
22
|
return React.createElement(React.Fragment, null, isDesktop ? React.createElement("div", {
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
className: "lw-mb-6 lw-flex lw-gap-1 lw-self-end",
|
|
24
|
+
"data-testid": "time-unit-switch"
|
|
25
25
|
}, options.map(_ref2 => {
|
|
26
26
|
let {
|
|
27
27
|
value,
|
|
@@ -34,17 +34,17 @@ const TimeUnitSwitch = _ref => {
|
|
|
34
34
|
const buttonLabel = lang(label);
|
|
35
35
|
return React.createElement(Button, {
|
|
36
36
|
key: value,
|
|
37
|
+
"data-tooltip-content": tooltip,
|
|
38
|
+
"data-tooltip-id": CURRENCY_POWER_BALANCE_TOOLTIP_ID,
|
|
37
39
|
size: ButtonSize.full,
|
|
38
|
-
variant: selected === value ? ButtonVariant.primary : ButtonVariant.secondary,
|
|
39
|
-
onClick: handleButtonClick,
|
|
40
40
|
value: value,
|
|
41
|
-
|
|
42
|
-
|
|
41
|
+
variant: selected === value ? ButtonVariant.primary : ButtonVariant.secondary,
|
|
42
|
+
onClick: handleButtonClick
|
|
43
43
|
}, buttonLabel);
|
|
44
44
|
})) : React.createElement(TimeUnitSelect, {
|
|
45
|
-
selected: selected,
|
|
46
45
|
callback: callback,
|
|
47
|
-
options: options
|
|
46
|
+
options: options,
|
|
47
|
+
selected: selected
|
|
48
48
|
}));
|
|
49
49
|
};
|
|
50
50
|
export { TimeUnitSwitch };
|
package/dist/module/CurrencyPowerBalanceWidget/components/TimeUnitSwitch/TimeUnitSwitch.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TimeUnitSwitch.js","names":["
|
|
1
|
+
{"version":3,"file":"TimeUnitSwitch.js","names":["Button","ButtonSize","ButtonVariant","Size","useLayoutProvider","useLocale","React","CURRENCY_POWER_BALANCE_TOOLTIP_ID","TimeUnitSelect","TimeUnitSwitch","_ref","selected","options","callback","lang","size","isDesktop","DESKTOP","handleButtonClick","e","currentTarget","value","createElement","Fragment","className","map","_ref2","label","tooltipLabel","tooltip","translationKey","count","buttonLabel","key","full","variant","primary","secondary","onClick"],"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,SACEA,MAAM,EACNC,UAAU,EACVC,aAAa,EACbC,IAAI,EACJC,iBAAiB,QACZ,2BAA2B;AAClC,SAASC,SAAS,QAAQ,kBAAkB;AAC5C,OAAOC,KAAK,MAAM,OAAO;AAGzB,SAASC,iCAAiC,QAAQ,iBAAiB;AACnE,SAASC,cAAc,QAAQ,kBAAkB;AAGjD,MAAMC,cAAc,GAAGC,IAAA,IAII;EAAA,IAJH;IACtBC,QAAQ;IACRC,OAAO;IACPC;EACmB,CAAC,GAAAH,IAAA;EACpB,MAAM;IAAEI;EAAK,CAAC,GAAGT,SAAS,CAAC,CAAC;EAC5B,MA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@@
|
|
|
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\
|
|
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":["CurrencyPowerBalanceTimeUnit","timeUnitConfig","value","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 {
|
|
1
|
+
{"version":3,"file":"config.js","names":["CurrencyPowerBalanceTimeUnit","timeUnitConfig","value","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,SAASA,4BAA4B,QAAQ,sBAAsB;AAEnE,MAAMC,cAAc,GAAG,CACrB;EACEC,KAAK,EAAEF,4BAA4B,CAACG,EAAE;EACtCC,KAAK,EAAE,IAAI;EACXC,YAAY,EAAE;IACZC,cAAc,EAAE,OAAO;IACvBC,KAAK,EAAE;EACT;AACF,CAAC,EACD;EACEL,KAAK,EAAEF,4BAA4B,CAACQ,EAAE;EACtCJ,KAAK,EAAE,IAAI;EACXC,YAAY,EAAE;IACZC,cAAc,EAAE,OAAO;IACvBC,KAAK,EAAE;EACT;AACF,CAAC,EACD;EACEL,KAAK,EAAEF,4BAA4B,CAACS,EAAE;EACtCL,KAAK,EAAE,IAAI;EACXC,YAAY,EAAE;IACZC,cAAc,EAAE,MAAM;IACtBC,KAAK,EAAE;EACT;AACF,CAAC,EACD;EACEL,KAAK,EAAEF,4BAA4B,CAACU,GAAG;EACvCN,KAAK,EAAE,KAAK;EACZC,YAAY,EAAE;IACZC,cAAc,EAAE,MAAM;IACtBC,KAAK,EAAE;EACT;AACF,CAAC,EACD;EACEL,KAAK,EAAEF,4BAA4B,CAACW,EAAE;EACtCP,KAAK,EAAE,IAAI;EACXC,YAAY,EAAE;IACZC,cAAc,EAAE,MAAM;IACtBC,KAAK,EAAE;EACT;AACF,CAAC,EACD;EACEL,KAAK,EAAEF,4BAA4B,CAACY,EAAE;EACtCR,KAAK,EAAE,IAAI;EACXC,YAAY,EAAE;IACZC,cAAc,EAAE,MAAM;IACtBC,KAAK,EAAE;EACT;AACF,CAAC,EACD;EACEL,KAAK,EAAEF,4BAA4B,CAACa,WAAW;EAC/CT,KAAK,EAAE;AACT,CAAC,EACD;EACEF,KAAK,EAAEF,4BAA4B,CAACc,UAAU;EAC9CV,KAAK,EAAE;AACT,CAAC,CACF;AAED,SAASH,cAAc","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","names":["CURRENCY_POWER_BALANCE_TOOLTIP_ID"],"sources":["../../../src/CurrencyPowerBalanceWidget/constants.ts"],"sourcesContent":["export const CURRENCY_POWER_BALANCE_TOOLTIP_ID
|
|
1
|
+
{"version":3,"file":"constants.js","names":["CURRENCY_POWER_BALANCE_TOOLTIP_ID"],"sources":["../../../src/CurrencyPowerBalanceWidget/constants.ts"],"sourcesContent":["export const CURRENCY_POWER_BALANCE_TOOLTIP_ID =\n 'currency-power-balance-widget-tooltip';\n"],"mappings":"AAAA,OAAO,MAAMA,iCAAiC,GAC5C,uCAAuC","ignoreList":[]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { validateLocale, validateToolParams } from '@oanda/labs-widget-common';
|
|
1
2
|
import React from 'react';
|
|
2
3
|
import { createRoot } from 'react-dom/client';
|
|
3
|
-
import { validateLocale, validateToolParams } from '@oanda/labs-widget-common';
|
|
4
4
|
import { CurrencyPowerBalance } from './CurrencyPowerBalance';
|
|
5
5
|
const {
|
|
6
6
|
graphqlUrl: configGraphQl,
|
|
@@ -32,21 +32,21 @@ if (currencyPowerBalanceParamsElements.length > 0) {
|
|
|
32
32
|
name: 'graphqlUrl'
|
|
33
33
|
}]);
|
|
34
34
|
root.render(React.createElement(CurrencyPowerBalance, {
|
|
35
|
+
currencies: currencies,
|
|
35
36
|
graphqlUrl: graphqlUrl,
|
|
37
|
+
isParamError: isParamError,
|
|
36
38
|
locale: locale,
|
|
39
|
+
logoLink: logoLink,
|
|
37
40
|
theme: mode,
|
|
38
|
-
|
|
39
|
-
timeUnit: timeUnit,
|
|
40
|
-
currencies: currencies,
|
|
41
|
-
logoLink: logoLink
|
|
41
|
+
timeUnit: timeUnit
|
|
42
42
|
}));
|
|
43
43
|
});
|
|
44
44
|
} else {
|
|
45
|
-
const container = document.
|
|
45
|
+
const container = document.querySelector(configRenderElementId);
|
|
46
46
|
const root = createRoot(container);
|
|
47
47
|
root.render(React.createElement(CurrencyPowerBalance, {
|
|
48
|
-
|
|
49
|
-
|
|
48
|
+
graphqlUrl: configGraphQl,
|
|
49
|
+
locale: configLocale
|
|
50
50
|
}));
|
|
51
51
|
}
|
|
52
52
|
//# sourceMappingURL=render.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"render.js","names":["
|
|
1
|
+
{"version":3,"file":"render.js","names":["validateLocale","validateToolParams","React","createRoot","CurrencyPowerBalance","graphqlUrl","configGraphQl","renderElementId","configRenderElementId","locale","configLocale","window","currencyPowerBalanceWidgetConfig","widgetsConfig","currencyPowerBalanceParamsElements","document","querySelectorAll","length","forEach","element","root","params","getAttribute","mode","timeUnit","currencies","logoLink","JSON","parse","isParamError","name","valueCheck","value","render","createElement","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,SAASA,cAAc,EAAEC,kBAAkB,QAAQ,2BAA2B;AAC9E,OAAOC,KAAK,MAAM,OAAO;AACzB,SAASC,UAAU,QAAQ,kBAAkB;AAE7C,SAASC,oBAAoB,QAAQ,wBAAwB;AAE7D,MAAM;EACJC,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,GAAGjB,UAAU,CAACgB,OAAO,CAAC;IAChC,MAAME,MAAM,GAAGF,OAAO,CAACG,YAAY,CAAC,oCAAoC,CAAC;IACzE,MAAMC,IAAI,GAAGJ,OAAO,CAACG,YAAY,CAAC,WAAW,CAAC;IAC9C,MAAM;MAAEE,QAAQ;MAAEC,UAAU;MAAEhB,MAAM;MAAEiB;IAAS,CAAC,GAAGC,IAAI,CAACC,KAAK,CAC3DP,MACF,CAAC;IAED,MAAMQ,YAAY,GAAG5B,kBAAkB,CAAC;MAAEQ,MAAM;MAAEJ;IAAW,CAAC,EAAE,CAC9D;MACEyB,IAAI,EAAE,QAAQ;MACdC,UAAU,EAAGC,KAAyB,IAAKhC,cAAc,CAACgC,KAAK;IACjE,CAAC,EACD;MACEF,IAAI,EAAE;IACR,CAAC,CACF,CAAC;IACFV,IAAI,CAACa,MAAM,CACT/B,KAAA,CAAAgC,aAAA,CAAC9B,oBAAoB;MACnBqB,UAAU,EAAEA,UAAW;MACvBpB,UAAU,EAAEA,UAAW;MACvBwB,YAAY,EAAEA,YAAa;MAC3BpB,MAAM,EAAEA,MAAO;MACfiB,QAAQ,EAAEA,QAAS;MACnBS,KAAK,EAAEZ,IAAc;MACrBC,QAAQ,EAAEA;IAAS,CACpB,CACH,CAAC;EACH,CAAC,CAAC;AACJ,CAAC,MAAM;EACL,MAAMY,SAA6B,GAAGrB,QAAQ,CAACsB,aAAa,CAC1D7B,qBACF,CAAC;EAED,MAAMY,IAAI,GAAGjB,UAAU,CAACiC,SAAU,CAAC;EAEnChB,IAAI,CAACa,MAAM,CACT/B,KAAA,CAAAgC,aAAA,CAAC9B,oBAAoB;IAACC,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
|
|
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 {
|
|
1
|
+
{"version":3,"file":"fragment-masking.js","names":["useFragment","_documentNode","fragmentType","makeFragmentData","data","_fragment","isFragmentReady","queryNode","fragmentNode","deferredFields","__meta__","fragDef","definitions","fragName","name","value","fields","length","every","field"],"sources":["../../../../src/gql/types/fragment-masking.ts"],"sourcesContent":["import {\n ResultOf,\n DocumentTypeDecoration,\n TypedDocumentNode,\n} from '@graphql-typed-document-node/core';\nimport { FragmentDefinitionNode } from 'graphql';\nimport { Incremental } from './graphql';\n\nexport type FragmentType<\n TDocumentType extends DocumentTypeDecoration<any, any>,\n> =\n TDocumentType extends DocumentTypeDecoration<infer TType, any>\n ? [TType] extends [{ ' $fragmentName'?: infer TKey }]\n ? TKey extends string\n ? { ' $fragmentRefs'?: { [key in TKey]: TType } }\n : never\n : never\n : never;\n\n// return non-nullable if `fragmentType` is non-nullable\nexport function useFragment<TType>(\n _documentNode: DocumentTypeDecoration<TType, any>,\n fragmentType: FragmentType<DocumentTypeDecoration<TType, any>>\n): TType;\n// return nullable if `fragmentType` is nullable\nexport function useFragment<TType>(\n _documentNode: DocumentTypeDecoration<TType, any>,\n fragmentType:\n | FragmentType<DocumentTypeDecoration<TType, any>>\n | null\n | undefined\n): TType | null | undefined;\n// return array of non-nullable if `fragmentType` is array of non-nullable\nexport function useFragment<TType>(\n _documentNode: DocumentTypeDecoration<TType, any>,\n fragmentType: ReadonlyArray<FragmentType<DocumentTypeDecoration<TType, any>>>\n): ReadonlyArray<TType>;\n// return array of nullable if `fragmentType` is array of nullable\nexport function useFragment<TType>(\n _documentNode: DocumentTypeDecoration<TType, any>,\n fragmentType:\n | ReadonlyArray<FragmentType<DocumentTypeDecoration<TType, any>>>\n | null\n | undefined\n): ReadonlyArray<TType> | null | undefined;\nexport function useFragment<TType>(\n _documentNode: DocumentTypeDecoration<TType, any>,\n fragmentType:\n | FragmentType<DocumentTypeDecoration<TType, any>>\n | ReadonlyArray<FragmentType<DocumentTypeDecoration<TType, any>>>\n | null\n | undefined\n): TType | ReadonlyArray<TType> | null | undefined {\n return fragmentType as any;\n}\n\nexport function makeFragmentData<\n F extends DocumentTypeDecoration<any, any>,\n FT extends ResultOf<F>,\n>(data: FT, _fragment: F): FragmentType<F> {\n return data as FragmentType<F>;\n}\nexport function isFragmentReady<TQuery, TFrag>(\n queryNode: DocumentTypeDecoration<TQuery, any>,\n fragmentNode: TypedDocumentNode<TFrag>,\n data:\n | FragmentType<TypedDocumentNode<Incremental<TFrag>, any>>\n | null\n | undefined\n): data is FragmentType<typeof fragmentNode> {\n const deferredFields = (\n queryNode as {\n __meta__?: { deferredFields: Record<string, (keyof TFrag)[]> };\n }\n ).__meta__?.deferredFields;\n\n if (!deferredFields) return true;\n\n const fragDef = fragmentNode.definitions[0] as\n | FragmentDefinitionNode\n | undefined;\n const fragName = fragDef?.name?.value;\n\n const fields = (fragName && deferredFields[fragName]) || [];\n return fields.length > 0 && fields.every((field) => data && field in data);\n}\n"],"mappings":"AA6CA,OAAO,SAASA,WAAWA,CACzBC,aAAiD,EACjDC,YAIa,EACoC;EACjD,OAAOA,YAAY;AACrB;AAEA,OAAO,SAASC,gBAAgBA,CAG9BC,IAAQ,EAAEC,SAAY,EAAmB;EACzC,OAAOD,IAAI;AACb;AACA,OAAO,SAASE,eAAeA,CAC7BC,SAA8C,EAC9CC,YAAsC,EACtCJ,IAGa,EAC8B;EAC3C,MAAMK,cAAc,GAClBF,SAAS,CAGTG,QAAQ,EAAED,cAAc;EAE1B,IAAI,CAACA,cAAc,EAAE,OAAO,IAAI;EAEhC,MAAME,OAAO,GAAGH,YAAY,CAACI,WAAW,CAAC,CAAC,CAE7B;EACb,MAAMC,QAAQ,GAAGF,OAAO,EAAEG,IAAI,EAAEC,KAAK;EAErC,MAAMC,MAAM,GAAIH,QAAQ,IAAIJ,cAAc,CAACI,QAAQ,CAAC,IAAK,EAAE;EAC3D,OAAOG,MAAM,CAACC,MAAM,GAAG,CAAC,IAAID,MAAM,CAACE,KAAK,CAAEC,KAAK,IAAKf,IAAI,IAAIe,KAAK,IAAIf,IAAI,CAAC;AAC5E","ignoreList":[]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as types from './graphql';
|
|
2
2
|
const documents = {
|
|
3
|
-
|
|
3
|
+
'\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
|
|
4
4
|
};
|
|
5
5
|
export function graphql(source) {
|
|
6
6
|
return documents[source] ?? {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gql.js","names":["types","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
|
|
1
|
+
{"version":3,"file":"gql.js","names":["types","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,OAAO,KAAKA,KAAK,MAAM,WAAW;AAalC,MAAMC,SAAS,GAAG;EAChB,qOAAqO,EACnOD,KAAK,CAACE;AACV,CAAC;AAuBD,OAAO,SAASC,OAAOA,CAACC,MAAc,EAAE;EACtC,OAAQH,SAAS,CAASG,MAAM,CAAC,IAAI,CAAC,CAAC;AACzC","ignoreList":[]}
|