@oanda/labs-currency-power-balance-widget 1.0.191 → 1.0.192
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 +1463 -38111
- package/dist/module/CurrencyPowerBalanceWidget/ChartWithData.js +28 -21
- package/dist/module/CurrencyPowerBalanceWidget/ChartWithData.js.map +1 -1
- package/dist/module/CurrencyPowerBalanceWidget/CurrencyPowerBalance.js +19 -12
- package/dist/module/CurrencyPowerBalanceWidget/CurrencyPowerBalance.js.map +1 -1
- package/dist/module/CurrencyPowerBalanceWidget/Main.js +27 -20
- package/dist/module/CurrencyPowerBalanceWidget/Main.js.map +1 -1
- package/dist/module/CurrencyPowerBalanceWidget/components/Chart/Chart.js +28 -20
- package/dist/module/CurrencyPowerBalanceWidget/components/Chart/Chart.js.map +1 -1
- package/dist/module/CurrencyPowerBalanceWidget/components/Chart/index.js +16 -1
- package/dist/module/CurrencyPowerBalanceWidget/components/Chart/index.js.map +1 -1
- package/dist/module/CurrencyPowerBalanceWidget/components/Chart/options/constants.js +33 -28
- package/dist/module/CurrencyPowerBalanceWidget/components/Chart/options/constants.js.map +1 -1
- package/dist/module/CurrencyPowerBalanceWidget/components/Chart/options/formatters.js +21 -11
- package/dist/module/CurrencyPowerBalanceWidget/components/Chart/options/formatters.js.map +1 -1
- package/dist/module/CurrencyPowerBalanceWidget/components/Chart/options/getOption.js +33 -27
- package/dist/module/CurrencyPowerBalanceWidget/components/Chart/options/getOption.js.map +1 -1
- package/dist/module/CurrencyPowerBalanceWidget/components/Chart/options/index.js +16 -1
- package/dist/module/CurrencyPowerBalanceWidget/components/Chart/options/index.js.map +1 -1
- package/dist/module/CurrencyPowerBalanceWidget/components/Chart/options/types.js +5 -1
- package/dist/module/CurrencyPowerBalanceWidget/components/Chart/options/utils.js +9 -3
- package/dist/module/CurrencyPowerBalanceWidget/components/Chart/options/utils.js.map +1 -1
- package/dist/module/CurrencyPowerBalanceWidget/components/Chart/types.js +5 -1
- package/dist/module/CurrencyPowerBalanceWidget/config.js +16 -11
- package/dist/module/CurrencyPowerBalanceWidget/config.js.map +1 -1
- package/dist/module/CurrencyPowerBalanceWidget/constants.js +7 -1
- package/dist/module/CurrencyPowerBalanceWidget/constants.js.map +1 -1
- package/dist/module/CurrencyPowerBalanceWidget/index.js +16 -1
- package/dist/module/CurrencyPowerBalanceWidget/index.js.map +1 -1
- package/dist/module/CurrencyPowerBalanceWidget/render.js +13 -10
- package/dist/module/CurrencyPowerBalanceWidget/render.js.map +1 -1
- package/dist/module/CurrencyPowerBalanceWidget/types.js +5 -1
- package/dist/module/gql/getCurrencyPowerBalance.js +8 -2
- package/dist/module/gql/getCurrencyPowerBalance.js.map +1 -1
- package/dist/module/gql/types/fragment-masking.js +11 -3
- package/dist/module/gql/types/fragment-masking.js.map +1 -1
- package/dist/module/gql/types/gql.js +9 -2
- package/dist/module/gql/types/gql.js.map +1 -1
- package/dist/module/gql/types/graphql.js +21 -15
- package/dist/module/gql/types/graphql.js.map +1 -1
- package/dist/module/gql/types/index.js +27 -2
- package/dist/module/gql/types/index.js.map +1 -1
- package/dist/module/index.js +16 -1
- package/dist/module/index.js.map +1 -1
- package/dist/module/translations/index.js +21 -14
- package/dist/module/translations/index.js.map +1 -1
- package/dist/module/translations/translations.js +7 -1
- package/dist/module/translations/translations.js.map +1 -1
- package/dist/types/gql/getCurrencyPowerBalance.d.ts +1 -1
- package/package.json +8 -4
- package/tsconfig.types.json +2 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"formatters.js","names":["
|
|
1
|
+
{"version":3,"file":"formatters.js","names":["_labsWidgetCommon","require","_graphql","_constants","isMonthWeek","timeUnit","CurrencyPowerBalanceTimeUnit","M3","M1","W1","exports","xAxisLabelFormatter","label","date","time","getChartDateAndTime","isDateFormat","chartDateFormat","intervalFormatter","dataLength","Math","round","VERTICAL_LINE_COUNT","tooltipFormatter","values","chartDateTimeFormat","value","row","sort","_ref","_ref2","valueA","valueB","Number","map","_ref3","marker","seriesName","join","formatLegendData","dataCurrencies","_ref4","currency","list","length","CURRENCIES_ORDER","filter","includes","name","itemStyle","color","COLOR_CONFIG"],"sources":["../../../../../../src/CurrencyPowerBalanceWidget/components/Chart/options/formatters.ts"],"sourcesContent":["import {\n chartDateFormat,\n chartDateTimeFormat,\n getChartDateAndTime,\n} from '@oanda/labs-widget-common';\n\nimport 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 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 } = getChartDateAndTime(label);\n const isDateFormat = isMonthWeek(timeUnit) || time === '00:00';\n\n return isDateFormat ? chartDateFormat(date) : time;\n};\n\nconst intervalFormatter = (dataLength: number) =>\n Math.round(dataLength / VERTICAL_LINE_COUNT);\n\nconst tooltipFormatter = (values: TooltipFormatterParams[]) => {\n const date = chartDateTimeFormat(getChartDateAndTime(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":";;;;;;AAAA,IAAAA,iBAAA,GAAAC,OAAA;AAOA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,UAAA,GAAAF,OAAA;AAOA,MAAMG,WAAW,GAAIC,QAAsC,IACzDA,QAAQ,KAAKC,qCAA4B,CAACC,EAAE,IAC5CF,QAAQ,KAAKC,qCAA4B,CAACE,EAAE,IAC5CH,QAAQ,KAAKC,qCAA4B,CAACG,EAAE;AAACC,OAAA,CAAAN,WAAA,GAAAA,WAAA;AAE/C,MAAMO,mBAAmB,GAAGA,CAC1BC,KAAa,EACbP,QAAsC,KACnC;EACH,MAAM;IAAEQ,IAAI;IAAEC;EAAK,CAAC,GAAG,IAAAC,qCAAmB,EAACH,KAAK,CAAC;EACjD,MAAMI,YAAY,GAAGZ,WAAW,CAACC,QAAQ,CAAC,IAAIS,IAAI,KAAK,OAAO;EAE9D,OAAOE,YAAY,GAAG,IAAAC,iCAAe,EAACJ,IAAI,CAAC,GAAGC,IAAI;AACpD,CAAC;AAACJ,OAAA,CAAAC,mBAAA,GAAAA,mBAAA;AAEF,MAAMO,iBAAiB,GAAIC,UAAkB,IAC3CC,IAAI,CAACC,KAAK,CAACF,UAAU,GAAGG,8BAAmB,CAAC;AAACZ,OAAA,CAAAQ,iBAAA,GAAAA,iBAAA;AAE/C,MAAMK,gBAAgB,GAAIC,MAAgC,IAAK;EAC7D,MAAMX,IAAI,GAAG,IAAAY,qCAAmB,EAAC,IAAA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E;MACTC,KAAK,EAAEC,uBAAY,CAACT,QAAQ;IAC9B;EACF,CAAC,CAAC,CAAC;AACL,CAAC;AAAChC,OAAA,CAAA6B,gBAAA,GAAAA,gBAAA","ignoreList":[]}
|
|
@@ -1,13 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.getOption = void 0;
|
|
7
|
+
var _labsWidgetCommon = require("@oanda/labs-widget-common");
|
|
8
|
+
var _graphql = require("../../../../gql/types/graphql");
|
|
9
|
+
var _constants = require("./constants");
|
|
10
|
+
var _formatters = require("./formatters");
|
|
11
|
+
var _utils = require("./utils");
|
|
6
12
|
const getOption = (chartData, timeUnit, isDark, isDesktop, isMobile, lang) => {
|
|
7
|
-
const currentTheme = isDark ? Theme.Dark : Theme.Light;
|
|
13
|
+
const currentTheme = isDark ? _labsWidgetCommon.Theme.Dark : _labsWidgetCommon.Theme.Light;
|
|
8
14
|
const dataTimestamps = chartData[0].power.map(x => new Date(x.point).getTime());
|
|
9
|
-
const weekendsIndexes = findLastIndexesBeforeWeekend(dataTimestamps);
|
|
10
|
-
const disableWeekendsIndicator = [CurrencyPowerBalanceTimeUnit.CurrentDay, CurrencyPowerBalanceTimeUnit.PreviousDay, CurrencyPowerBalanceTimeUnit.M3].includes(timeUnit) || weekendsIndexes.length === 0;
|
|
15
|
+
const weekendsIndexes = (0, _utils.findLastIndexesBeforeWeekend)(dataTimestamps);
|
|
16
|
+
const disableWeekendsIndicator = [_graphql.CurrencyPowerBalanceTimeUnit.CurrentDay, _graphql.CurrencyPowerBalanceTimeUnit.PreviousDay, _graphql.CurrencyPowerBalanceTimeUnit.M3].includes(timeUnit) || weekendsIndexes.length === 0;
|
|
11
17
|
const weekendsMarks = weekendsIndexes.map(item => ({
|
|
12
18
|
xAxis: item,
|
|
13
19
|
label: {
|
|
@@ -25,7 +31,7 @@ const getOption = (chartData, timeUnit, isDark, isDesktop, isMobile, lang) => {
|
|
|
25
31
|
symbol: 'circle',
|
|
26
32
|
showSymbol: false,
|
|
27
33
|
itemStyle: {
|
|
28
|
-
color: COLOR_CONFIG[currency]
|
|
34
|
+
color: _constants.COLOR_CONFIG[currency]
|
|
29
35
|
},
|
|
30
36
|
data: power.map(_ref2 => {
|
|
31
37
|
let {
|
|
@@ -46,10 +52,10 @@ const getOption = (chartData, timeUnit, isDark, isDesktop, isMobile, lang) => {
|
|
|
46
52
|
shadowOffsetX: 0,
|
|
47
53
|
shadowOffsetY: 6,
|
|
48
54
|
borderWidth: 0,
|
|
49
|
-
color: themeColors.textPrimary[currentTheme],
|
|
55
|
+
color: _labsWidgetCommon.themeColors.textPrimary[currentTheme],
|
|
50
56
|
shadowColor: 'rgba(0,0,0,0.1)',
|
|
51
57
|
borderRadius: 4,
|
|
52
|
-
backgroundColor: isDark ? themeColors.borderPrimary[currentTheme] : themeColors.bgSecondary[currentTheme]
|
|
58
|
+
backgroundColor: isDark ? _labsWidgetCommon.themeColors.borderPrimary[currentTheme] : _labsWidgetCommon.themeColors.bgSecondary[currentTheme]
|
|
53
59
|
},
|
|
54
60
|
show: false,
|
|
55
61
|
emphasis: {
|
|
@@ -59,26 +65,26 @@ const getOption = (chartData, timeUnit, isDark, isDesktop, isMobile, lang) => {
|
|
|
59
65
|
lineStyle: {
|
|
60
66
|
width: 1,
|
|
61
67
|
opacity: 0,
|
|
62
|
-
color: themeColors.borderPrimary[currentTheme]
|
|
68
|
+
color: _labsWidgetCommon.themeColors.borderPrimary[currentTheme]
|
|
63
69
|
}
|
|
64
70
|
},
|
|
65
71
|
symbol: ['none', 'none'],
|
|
66
72
|
itemStyle: {
|
|
67
|
-
color: themeColors.borderPrimary[currentTheme]
|
|
73
|
+
color: _labsWidgetCommon.themeColors.borderPrimary[currentTheme]
|
|
68
74
|
},
|
|
69
75
|
data: weekendsMarks
|
|
70
76
|
} : undefined
|
|
71
77
|
};
|
|
72
78
|
});
|
|
73
|
-
const legendData = formatLegendData(chartData);
|
|
74
|
-
const baseGridLines = getGridLines({
|
|
79
|
+
const legendData = (0, _formatters.formatLegendData)(chartData);
|
|
80
|
+
const baseGridLines = (0, _labsWidgetCommon.getGridLines)({
|
|
75
81
|
isDark,
|
|
76
|
-
chartWidth: CHART_WIDTH,
|
|
77
|
-
chartHeight: CHART_HEIGHT,
|
|
78
|
-
xLabelsSize: isMobile ? X_LABEL_SIZE_MOBILE : X_LABEL_SIZE,
|
|
79
|
-
yLabelSize: isMobile ? Y_LABEL_SIZE_MOBILE : Y_LABEL_SIZE,
|
|
82
|
+
chartWidth: _constants.CHART_WIDTH,
|
|
83
|
+
chartHeight: _constants.CHART_HEIGHT,
|
|
84
|
+
xLabelsSize: isMobile ? _constants.X_LABEL_SIZE_MOBILE : _constants.X_LABEL_SIZE,
|
|
85
|
+
yLabelSize: isMobile ? _constants.Y_LABEL_SIZE_MOBILE : _constants.Y_LABEL_SIZE,
|
|
80
86
|
bottomLeftBox: false,
|
|
81
|
-
marginBottom: isMobile ? LEGEND_HEIGHT_MOBILE : LEGEND_HEIGHT
|
|
87
|
+
marginBottom: isMobile ? _constants.LEGEND_HEIGHT_MOBILE : _constants.LEGEND_HEIGHT
|
|
82
88
|
});
|
|
83
89
|
return {
|
|
84
90
|
animation: false,
|
|
@@ -93,10 +99,10 @@ const getOption = (chartData, timeUnit, isDark, isDesktop, isMobile, lang) => {
|
|
|
93
99
|
axis: 'x',
|
|
94
100
|
z: 0,
|
|
95
101
|
lineStyle: {
|
|
96
|
-
color: isDark ? TOOLTIP_LINE_COLOR_CONFIG.DARK : TOOLTIP_LINE_COLOR_CONFIG.LIGHT
|
|
102
|
+
color: isDark ? _constants.TOOLTIP_LINE_COLOR_CONFIG.DARK : _constants.TOOLTIP_LINE_COLOR_CONFIG.LIGHT
|
|
97
103
|
}
|
|
98
104
|
},
|
|
99
|
-
formatter: tooltipFormatter,
|
|
105
|
+
formatter: _formatters.tooltipFormatter,
|
|
100
106
|
extraCssText: 'z-index: 1'
|
|
101
107
|
},
|
|
102
108
|
xAxis: {
|
|
@@ -115,8 +121,8 @@ const getOption = (chartData, timeUnit, isDark, isDesktop, isMobile, lang) => {
|
|
|
115
121
|
align: 'left',
|
|
116
122
|
margin: 10,
|
|
117
123
|
rotate: -45,
|
|
118
|
-
interval: intervalFormatter(seriesData[0].data.length),
|
|
119
|
-
formatter: label => xAxisLabelFormatter(label, timeUnit)
|
|
124
|
+
interval: (0, _formatters.intervalFormatter)(seriesData[0].data.length),
|
|
125
|
+
formatter: label => (0, _formatters.xAxisLabelFormatter)(label, timeUnit)
|
|
120
126
|
}
|
|
121
127
|
},
|
|
122
128
|
yAxis: {
|
|
@@ -141,11 +147,11 @@ const getOption = (chartData, timeUnit, isDark, isDesktop, isMobile, lang) => {
|
|
|
141
147
|
name: 'main-grid',
|
|
142
148
|
top: '0px',
|
|
143
149
|
left: '0px',
|
|
144
|
-
right: `${isMobile ? Y_LABEL_SIZE_MOBILE : Y_LABEL_SIZE}px`,
|
|
145
|
-
bottom: `${isMobile ? X_LABEL_SIZE_MOBILE : X_LABEL_SIZE}px`
|
|
150
|
+
right: `${isMobile ? _constants.Y_LABEL_SIZE_MOBILE : _constants.Y_LABEL_SIZE}px`,
|
|
151
|
+
bottom: `${isMobile ? _constants.X_LABEL_SIZE_MOBILE : _constants.X_LABEL_SIZE}px`
|
|
146
152
|
}],
|
|
147
153
|
graphic: [...baseGridLines]
|
|
148
154
|
};
|
|
149
155
|
};
|
|
150
|
-
|
|
156
|
+
exports.getOption = getOption;
|
|
151
157
|
//# sourceMappingURL=getOption.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getOption.js","names":["getGridLines","Theme","themeColors","CurrencyPowerBalanceTimeUnit","CHART_HEIGHT","CHART_WIDTH","COLOR_CONFIG","LEGEND_HEIGHT","LEGEND_HEIGHT_MOBILE","TOOLTIP_LINE_COLOR_CONFIG","X_LABEL_SIZE","X_LABEL_SIZE_MOBILE","Y_LABEL_SIZE","Y_LABEL_SIZE_MOBILE","formatLegendData","intervalFormatter","tooltipFormatter","xAxisLabelFormatter","findLastIndexesBeforeWeekend","getOption","chartData","timeUnit","isDark","isDesktop","isMobile","lang","currentTheme","Dark","Light","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","bgSecondary","emphasis","lineStyle","width","opacity","undefined","legendData","baseGridLines","chartWidth","chartHeight","xLabelsSize","yLabelSize","bottomLeftBox","marginBottom","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","grid","top","left","right","graphic"],"sources":["../../../../../../src/CurrencyPowerBalanceWidget/components/Chart/options/getOption.ts"],"sourcesContent":["import { getGridLines, Theme, themeColors } from '@oanda/labs-widget-common';\n\nimport type { CurrencyPowerBalance } from '../../../../gql/types/graphql';\nimport { CurrencyPowerBalanceTimeUnit } from '../../../../gql/types/graphql';\nimport {\n CHART_HEIGHT,\n CHART_WIDTH,\n COLOR_CONFIG,\n LEGEND_HEIGHT,\n LEGEND_HEIGHT_MOBILE,\n TOOLTIP_LINE_COLOR_CONFIG,\n X_LABEL_SIZE,\n X_LABEL_SIZE_MOBILE,\n Y_LABEL_SIZE,\n Y_LABEL_SIZE_MOBILE,\n} 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 isDesktop: boolean,\n isMobile: boolean,\n lang: (key: string) => string\n) => {\n const currentTheme = isDark ? Theme.Dark : Theme.Light;\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: themeColors.textPrimary[currentTheme],\n shadowColor: 'rgba(0,0,0,0.1)',\n borderRadius: 4,\n backgroundColor: isDark\n ? themeColors.borderPrimary[currentTheme]\n : themeColors.bgSecondary[currentTheme],\n },\n show: false,\n emphasis: {\n label: {\n show: true,\n },\n lineStyle: {\n width: 1,\n opacity: 0,\n color: themeColors.borderPrimary[currentTheme],\n },\n },\n symbol: ['none', 'none'],\n itemStyle: {\n color: themeColors.borderPrimary[currentTheme],\n },\n data: weekendsMarks,\n }\n : undefined,\n }));\n\n const legendData = formatLegendData(chartData);\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 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 margin: isDesktop ? 8 : 6,\n },\n },\n series: seriesData,\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 { getOption };\n"],"mappings":"AAAA,SAASA,YAAY,EAAEC,KAAK,EAAEC,WAAW,QAAQ,2BAA2B;AAG5E,SAASC,4BAA4B,QAAQ,+BAA+B;AAC5E,SACEC,YAAY,EACZC,WAAW,EACXC,YAAY,EACZC,aAAa,EACbC,oBAAoB,EACpBC,yBA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MAAM;QACb2C,MAAM,EAAE,EAAE;QACVC,MAAM,EAAE,CAAC,EAAE;QACXC,QAAQ,EAAE9F,iBAAiB,CAACiC,UAAU,CAAC,CAAC,CAAC,CAACU,IAAI,CAAChB,MAAM,CAAC;QACtDK,SAAS,EAAGD,KAAa,IAAK7B,mBAAmB,CAAC6B,KAAK,EAAEzB,QAAQ;MACnE;IACF,CAAC;IACDyF,KAAK,EAAE;MACLzD,IAAI,EAAE,OAAO;MACbU,QAAQ,EAAE,OAAO;MACjBgD,WAAW,EAAE,CAAC;MACdP,QAAQ,EAAE;QAAE1C,IAAI,EAAE;MAAM,CAAC;MACzByC,QAAQ,EAAE;QAAEzC,IAAI,EAAE;MAAM,CAAC;MACzBkD,WAAW,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC;MAC3BN,SAAS,EAAE;QACTO,YAAY,EAAE,KAAK;QACnBC,YAAY,EAAE,KAAK;QACnBP,MAAM,EAAEpF,SAAS,GAAG,CAAC,GAAG;MAC1B;IACF,CAAC;IACD4F,MAAM,EAAEnE,UAAU;IAClBoE,IAAI,EAAE,CACJ;MACEhE,IAAI,EAAE,WAAW;MACjBiE,GAAG,EAAE,KAAK;MACVC,IAAI,EAAE,KAAK;MACXC,KAAK,EAAE,GAAG/F,QAAQ,GAAGX,mBAAmB,GAAGD,YAAY,IAAI;MAC3DiF,MAAM,EAAE,GAAGrE,QAAQ,GAAGb,mBAAmB,GAAGD,YAAY;IAC1D,CAAC,CACF;IACD8G,OAAO,EAAE,CAAC,GAAGpC,aAAa;EAC5B,CAAC;AACH,CAAC;AAED,SAASjE,SAAS","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"getOption.js","names":["_labsWidgetCommon","require","_graphql","_constants","_formatters","_utils","getOption","chartData","timeUnit","isDark","isDesktop","isMobile","lang","currentTheme","Theme","Dark","Light","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","themeColors","textPrimary","shadowColor","borderRadius","backgroundColor","borderPrimary","bgSecondary","emphasis","lineStyle","width","opacity","undefined","legendData","formatLegendData","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","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","grid","top","left","right","graphic","exports"],"sources":["../../../../../../src/CurrencyPowerBalanceWidget/components/Chart/options/getOption.ts"],"sourcesContent":["import { getGridLines, Theme, themeColors } from '@oanda/labs-widget-common';\n\nimport type { CurrencyPowerBalance } from '../../../../gql/types/graphql';\nimport { CurrencyPowerBalanceTimeUnit } from '../../../../gql/types/graphql';\nimport {\n CHART_HEIGHT,\n CHART_WIDTH,\n COLOR_CONFIG,\n LEGEND_HEIGHT,\n LEGEND_HEIGHT_MOBILE,\n TOOLTIP_LINE_COLOR_CONFIG,\n X_LABEL_SIZE,\n X_LABEL_SIZE_MOBILE,\n Y_LABEL_SIZE,\n Y_LABEL_SIZE_MOBILE,\n} 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 isDesktop: boolean,\n isMobile: boolean,\n lang: (key: string) => string\n) => {\n const currentTheme = isDark ? Theme.Dark : Theme.Light;\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: themeColors.textPrimary[currentTheme],\n shadowColor: 'rgba(0,0,0,0.1)',\n borderRadius: 4,\n backgroundColor: isDark\n ? themeColors.borderPrimary[currentTheme]\n : themeColors.bgSecondary[currentTheme],\n },\n show: false,\n emphasis: {\n label: {\n show: true,\n },\n lineStyle: {\n width: 1,\n opacity: 0,\n color: themeColors.borderPrimary[currentTheme],\n },\n },\n symbol: ['none', 'none'],\n itemStyle: {\n color: themeColors.borderPrimary[currentTheme],\n },\n data: weekendsMarks,\n }\n : undefined,\n }));\n\n const legendData = formatLegendData(chartData);\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 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 margin: isDesktop ? 8 : 6,\n },\n },\n series: seriesData,\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 { getOption };\n"],"mappings":";;;;;;AAAA,IAAAA,iBAAA,GAAAC,OAAA;AAGA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,UAAA,GAAAF,OAAA;AAYA,IAAAG,WAAA,GAAAH,OAAA;AAMA,IAAAI,MAAA,GAAAJ,OAAA;AAEA,MAAMK,SAAS,GAAGA,CAChBC,SAAiC,EACjCC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E5B,QAAQ;MACnE;IACF,CAAC;IACD4G,KAAK,EAAE;MACLzE,IAAI,EAAE,OAAO;MACbW,QAAQ,EAAE,OAAO;MACjB+D,WAAW,EAAE,CAAC;MACdT,QAAQ,EAAE;QAAEvD,IAAI,EAAE;MAAM,CAAC;MACzBsD,QAAQ,EAAE;QAAEtD,IAAI,EAAE;MAAM,CAAC;MACzBiE,WAAW,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC;MAC3BR,SAAS,EAAE;QACTS,YAAY,EAAE,KAAK;QACnBC,YAAY,EAAE,KAAK;QACnBT,MAAM,EAAErG,SAAS,GAAG,CAAC,GAAG;MAC1B;IACF,CAAC;IACD+G,MAAM,EAAEnF,UAAU;IAClBoF,IAAI,EAAE,CACJ;MACEhF,IAAI,EAAE,WAAW;MACjBiF,GAAG,EAAE,KAAK;MACVC,IAAI,EAAE,KAAK;MACXC,KAAK,EAAE,GAAGlH,QAAQ,GAAG4E,8BAAmB,GAAGC,uBAAY,IAAI;MAC3DO,MAAM,EAAE,GAAGpF,QAAQ,GAAGyE,8BAAmB,GAAGC,uBAAY;IAC1D,CAAC,CACF;IACDyC,OAAO,EAAE,CAAC,GAAGjD,aAAa;EAC5B,CAAC;AACH,CAAC;AAACkD,OAAA,CAAAzH,SAAA,GAAAA,SAAA","ignoreList":[]}
|
|
@@ -1,2 +1,17 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var _getOption = require("./getOption");
|
|
7
|
+
Object.keys(_getOption).forEach(function (key) {
|
|
8
|
+
if (key === "default" || key === "__esModule") return;
|
|
9
|
+
if (key in exports && exports[key] === _getOption[key]) return;
|
|
10
|
+
Object.defineProperty(exports, key, {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function () {
|
|
13
|
+
return _getOption[key];
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
});
|
|
2
17
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../../../../src/CurrencyPowerBalanceWidget/components/Chart/options/index.ts"],"sourcesContent":["export * from './getOption';\n"],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","names":["_getOption","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get"],"sources":["../../../../../../src/CurrencyPowerBalanceWidget/components/Chart/options/index.ts"],"sourcesContent":["export * from './getOption';\n"],"mappings":";;;;;AAAA,IAAAA,UAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,UAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,UAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAT,UAAA,CAAAK,GAAA;IAAA;EAAA;AAAA","ignoreList":[]}
|
|
@@ -1,4 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.findLastIndexesBeforeWeekend = void 0;
|
|
7
|
+
var _constants = require("./constants");
|
|
8
|
+
const findLastIndexesBeforeWeekend = timestamps => timestamps.reduce((acc, timestamp, index) => timestamps.length - 1 !== index && timestamps[index + 1] - timestamp >= _constants.WEEKEND_DURATION ? [...acc, index] : acc, []);
|
|
9
|
+
exports.findLastIndexesBeforeWeekend = findLastIndexesBeforeWeekend;
|
|
4
10
|
//# sourceMappingURL=utils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","names":["
|
|
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,52 +1,57 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.timeUnitConfig = void 0;
|
|
7
|
+
var _graphql = require("../gql/types/graphql");
|
|
8
|
+
const timeUnitConfig = exports.timeUnitConfig = [{
|
|
9
|
+
value: _graphql.CurrencyPowerBalanceTimeUnit.M3,
|
|
4
10
|
label: '3m',
|
|
5
11
|
tooltipLabel: {
|
|
6
12
|
translationKey: 'month',
|
|
7
13
|
count: 3
|
|
8
14
|
}
|
|
9
15
|
}, {
|
|
10
|
-
value: CurrencyPowerBalanceTimeUnit.M1,
|
|
16
|
+
value: _graphql.CurrencyPowerBalanceTimeUnit.M1,
|
|
11
17
|
label: '1m',
|
|
12
18
|
tooltipLabel: {
|
|
13
19
|
translationKey: 'month',
|
|
14
20
|
count: 1
|
|
15
21
|
}
|
|
16
22
|
}, {
|
|
17
|
-
value: CurrencyPowerBalanceTimeUnit.W1,
|
|
23
|
+
value: _graphql.CurrencyPowerBalanceTimeUnit.W1,
|
|
18
24
|
label: '1w',
|
|
19
25
|
tooltipLabel: {
|
|
20
26
|
translationKey: 'week',
|
|
21
27
|
count: 1
|
|
22
28
|
}
|
|
23
29
|
}, {
|
|
24
|
-
value: CurrencyPowerBalanceTimeUnit.H24,
|
|
30
|
+
value: _graphql.CurrencyPowerBalanceTimeUnit.H24,
|
|
25
31
|
label: '24h',
|
|
26
32
|
tooltipLabel: {
|
|
27
33
|
translationKey: 'hour',
|
|
28
34
|
count: 24
|
|
29
35
|
}
|
|
30
36
|
}, {
|
|
31
|
-
value: CurrencyPowerBalanceTimeUnit.H8,
|
|
37
|
+
value: _graphql.CurrencyPowerBalanceTimeUnit.H8,
|
|
32
38
|
label: '8h',
|
|
33
39
|
tooltipLabel: {
|
|
34
40
|
translationKey: 'hour',
|
|
35
41
|
count: 8
|
|
36
42
|
}
|
|
37
43
|
}, {
|
|
38
|
-
value: CurrencyPowerBalanceTimeUnit.H4,
|
|
44
|
+
value: _graphql.CurrencyPowerBalanceTimeUnit.H4,
|
|
39
45
|
label: '4h',
|
|
40
46
|
tooltipLabel: {
|
|
41
47
|
translationKey: 'hour',
|
|
42
48
|
count: 4
|
|
43
49
|
}
|
|
44
50
|
}, {
|
|
45
|
-
value: CurrencyPowerBalanceTimeUnit.PreviousDay,
|
|
51
|
+
value: _graphql.CurrencyPowerBalanceTimeUnit.PreviousDay,
|
|
46
52
|
label: 'previous_business_day'
|
|
47
53
|
}, {
|
|
48
|
-
value: CurrencyPowerBalanceTimeUnit.CurrentDay,
|
|
54
|
+
value: _graphql.CurrencyPowerBalanceTimeUnit.CurrentDay,
|
|
49
55
|
label: 'current_business_day'
|
|
50
56
|
}];
|
|
51
|
-
export { timeUnitConfig };
|
|
52
57
|
//# sourceMappingURL=config.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","names":["
|
|
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,2 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.CURRENCY_POWER_BALANCE_TOOLTIP_ID = void 0;
|
|
7
|
+
const CURRENCY_POWER_BALANCE_TOOLTIP_ID = exports.CURRENCY_POWER_BALANCE_TOOLTIP_ID = 'currency-power-balance-widget-tooltip';
|
|
2
8
|
//# sourceMappingURL=constants.js.map
|
|
@@ -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 =\n 'currency-power-balance-widget-tooltip';\n"],"mappings":"
|
|
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,2 +1,17 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var _CurrencyPowerBalance = require("./CurrencyPowerBalance");
|
|
7
|
+
Object.keys(_CurrencyPowerBalance).forEach(function (key) {
|
|
8
|
+
if (key === "default" || key === "__esModule") return;
|
|
9
|
+
if (key in exports && exports[key] === _CurrencyPowerBalance[key]) return;
|
|
10
|
+
Object.defineProperty(exports, key, {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function () {
|
|
13
|
+
return _CurrencyPowerBalance[key];
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
});
|
|
2
17
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../src/CurrencyPowerBalanceWidget/index.ts"],"sourcesContent":["export * from './CurrencyPowerBalance';\n"],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","names":["_CurrencyPowerBalance","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get"],"sources":["../../../src/CurrencyPowerBalanceWidget/index.ts"],"sourcesContent":["export * from './CurrencyPowerBalance';\n"],"mappings":";;;;;AAAA,IAAAA,qBAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,qBAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,qBAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAT,qBAAA,CAAAK,GAAA;IAAA;EAAA;AAAA","ignoreList":[]}
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _labsWidgetCommon = require("@oanda/labs-widget-common");
|
|
4
|
+
var _react = _interopRequireDefault(require("react"));
|
|
5
|
+
var _client = require("react-dom/client");
|
|
6
|
+
var _CurrencyPowerBalance = require("./CurrencyPowerBalance");
|
|
7
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
5
8
|
const {
|
|
6
9
|
graphqlUrl: configGraphQl,
|
|
7
10
|
renderElementId: configRenderElementId,
|
|
@@ -13,7 +16,7 @@ const {
|
|
|
13
16
|
const currencyPowerBalanceParamsElements = document.querySelectorAll('div[data-currency-power-balance-params]');
|
|
14
17
|
if (currencyPowerBalanceParamsElements.length > 0) {
|
|
15
18
|
currencyPowerBalanceParamsElements.forEach(element => {
|
|
16
|
-
const root = createRoot(element);
|
|
19
|
+
const root = (0, _client.createRoot)(element);
|
|
17
20
|
const params = element.getAttribute('data-currency-power-balance-params');
|
|
18
21
|
const mode = element.getAttribute('data-mode');
|
|
19
22
|
const {
|
|
@@ -22,16 +25,16 @@ if (currencyPowerBalanceParamsElements.length > 0) {
|
|
|
22
25
|
locale,
|
|
23
26
|
logoLink
|
|
24
27
|
} = JSON.parse(params);
|
|
25
|
-
const isParamError = validateToolParams({
|
|
28
|
+
const isParamError = (0, _labsWidgetCommon.validateToolParams)({
|
|
26
29
|
locale,
|
|
27
30
|
graphqlUrl
|
|
28
31
|
}, [{
|
|
29
32
|
name: 'locale',
|
|
30
|
-
valueCheck: value => validateLocale(value)
|
|
33
|
+
valueCheck: value => (0, _labsWidgetCommon.validateLocale)(value)
|
|
31
34
|
}, {
|
|
32
35
|
name: 'graphqlUrl'
|
|
33
36
|
}]);
|
|
34
|
-
root.render(
|
|
37
|
+
root.render(_react.default.createElement(_CurrencyPowerBalance.CurrencyPowerBalance, {
|
|
35
38
|
currencies: currencies,
|
|
36
39
|
graphqlUrl: graphqlUrl,
|
|
37
40
|
isParamError: isParamError,
|
|
@@ -43,8 +46,8 @@ if (currencyPowerBalanceParamsElements.length > 0) {
|
|
|
43
46
|
});
|
|
44
47
|
} else {
|
|
45
48
|
const container = document.querySelector(configRenderElementId);
|
|
46
|
-
const root = createRoot(container);
|
|
47
|
-
root.render(
|
|
49
|
+
const root = (0, _client.createRoot)(container);
|
|
50
|
+
root.render(_react.default.createElement(_CurrencyPowerBalance.CurrencyPowerBalance, {
|
|
48
51
|
graphqlUrl: configGraphQl,
|
|
49
52
|
locale: configLocale
|
|
50
53
|
}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"render.js","names":["
|
|
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,OA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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,5 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.getCurrencyPowerBalance = void 0;
|
|
7
|
+
var _client = require("@apollo/client");
|
|
8
|
+
const getCurrencyPowerBalance = exports.getCurrencyPowerBalance = (0, _client.gql)`
|
|
3
9
|
query GetCurrencyPowerBalance($timeUnit: CurrencyPowerBalanceTimeUnit!) {
|
|
4
10
|
currencyPowerBalance(timeUnit: $timeUnit) {
|
|
5
11
|
currency
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getCurrencyPowerBalance.js","names":["
|
|
1
|
+
{"version":3,"file":"getCurrencyPowerBalance.js","names":["_client","require","getCurrencyPowerBalance","exports","gql"],"sources":["../../../src/gql/getCurrencyPowerBalance.ts"],"sourcesContent":["import { gql } from '@apollo/client';\n\nexport const getCurrencyPowerBalance = gql`\n query GetCurrencyPowerBalance($timeUnit: CurrencyPowerBalanceTimeUnit!) {\n currencyPowerBalance(timeUnit: $timeUnit) {\n currency\n power {\n point\n price\n }\n updatedAt\n }\n }\n`;\n"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AAEO,MAAMC,uBAAuB,GAAAC,OAAA,CAAAD,uBAAA,GAAG,IAAAE,WAAG;AAC1C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC","ignoreList":[]}
|
|
@@ -1,10 +1,18 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.isFragmentReady = isFragmentReady;
|
|
7
|
+
exports.makeFragmentData = makeFragmentData;
|
|
8
|
+
exports.useFragment = useFragment;
|
|
9
|
+
function useFragment(_documentNode, fragmentType) {
|
|
2
10
|
return fragmentType;
|
|
3
11
|
}
|
|
4
|
-
|
|
12
|
+
function makeFragmentData(data, _fragment) {
|
|
5
13
|
return data;
|
|
6
14
|
}
|
|
7
|
-
|
|
15
|
+
function isFragmentReady(queryNode, fragmentNode, data) {
|
|
8
16
|
const deferredFields = queryNode.__meta__?.deferredFields;
|
|
9
17
|
if (!deferredFields) return true;
|
|
10
18
|
const fragDef = fragmentNode.definitions[0];
|
|
@@ -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 {\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":"
|
|
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":[]}
|
|
@@ -1,8 +1,15 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.graphql = graphql;
|
|
7
|
+
var types = _interopRequireWildcard(require("./graphql"));
|
|
8
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
2
9
|
const documents = {
|
|
3
10
|
'\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
11
|
};
|
|
5
|
-
|
|
12
|
+
function graphql(source) {
|
|
6
13
|
return documents[source] ?? {};
|
|
7
14
|
}
|
|
8
15
|
//# sourceMappingURL=gql.js.map
|