@oanda/labs-currency-strength-widget 1.0.52 → 1.0.53
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 +216 -0
- package/dist/main/CurrencyStrengthWidget/ChartsWithData.js +12 -16
- package/dist/main/CurrencyStrengthWidget/ChartsWithData.js.map +1 -1
- package/dist/main/CurrencyStrengthWidget/CurrencyStrengthWidget.js +1 -1
- package/dist/main/CurrencyStrengthWidget/CurrencyStrengthWidget.js.map +1 -1
- package/dist/main/CurrencyStrengthWidget/Main.js +2 -2
- package/dist/main/CurrencyStrengthWidget/Main.js.map +1 -1
- package/dist/main/CurrencyStrengthWidget/components/Chart/Chart.js +2 -2
- package/dist/main/CurrencyStrengthWidget/components/Chart/Chart.js.map +1 -1
- package/dist/main/CurrencyStrengthWidget/components/Chart/formatters.js +5 -1
- package/dist/main/CurrencyStrengthWidget/components/Chart/formatters.js.map +1 -1
- package/dist/main/CurrencyStrengthWidget/components/Chart/getOption.js +3 -3
- package/dist/main/CurrencyStrengthWidget/components/Chart/getOption.js.map +1 -1
- package/dist/main/CurrencyStrengthWidget/render.js +1 -1
- package/dist/main/CurrencyStrengthWidget/render.js.map +1 -1
- package/dist/main/gql/getCurrencyStrength.js +12 -3
- package/dist/main/gql/getCurrencyStrength.js.map +1 -1
- package/dist/main/gql/types/fragment-masking.js +2 -3
- package/dist/main/gql/types/fragment-masking.js.map +1 -1
- package/dist/main/gql/types/gql.js +1 -2
- package/dist/main/gql/types/gql.js.map +1 -1
- package/dist/main/translations/index.js +1 -1
- package/dist/main/translations/index.js.map +1 -1
- package/dist/module/CurrencyStrengthWidget/ChartsWithData.js +11 -15
- package/dist/module/CurrencyStrengthWidget/ChartsWithData.js.map +1 -1
- package/dist/module/CurrencyStrengthWidget/Main.js +2 -2
- package/dist/module/CurrencyStrengthWidget/Main.js.map +1 -1
- package/dist/module/CurrencyStrengthWidget/components/Chart/Chart.js +1 -1
- package/dist/module/CurrencyStrengthWidget/components/Chart/Chart.js.map +1 -1
- package/dist/module/CurrencyStrengthWidget/components/Chart/formatters.js +5 -1
- package/dist/module/CurrencyStrengthWidget/components/Chart/formatters.js.map +1 -1
- package/dist/module/CurrencyStrengthWidget/components/Chart/getOption.js +3 -3
- package/dist/module/CurrencyStrengthWidget/components/Chart/getOption.js.map +1 -1
- package/dist/module/gql/getCurrencyStrength.js +12 -3
- package/dist/module/gql/getCurrencyStrength.js.map +1 -1
- package/dist/module/gql/types/fragment-masking.js +2 -3
- package/dist/module/gql/types/fragment-masking.js.map +1 -1
- package/dist/module/gql/types/gql.js +1 -2
- package/dist/module/gql/types/gql.js.map +1 -1
- package/dist/types/gql/types/graphql.d.ts +1 -3
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,222 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## 1.0.53 (2024-07-03)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
## 1.0.134 (2024-07-03)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
## 1.0.133 (2024-06-28)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
## 1.0.132 (2024-06-27)
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
## 1.0.131 (2024-06-27)
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
## 1.0.130 (2024-06-26)
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
## 1.0.129 (2024-06-17)
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
## 1.0.128 (2024-06-17)
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
## 1.0.127 (2024-06-10)
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
## 1.0.126 (2024-05-29)
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
## 1.0.125 (2024-05-29)
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
## 1.0.124 (2024-05-29)
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
## 1.0.123 (2024-05-28)
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
## 1.0.122 (2024-05-27)
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
## 1.0.121 (2024-05-27)
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
## 1.0.120 (2024-05-24)
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
## 1.0.119 (2024-05-17)
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
## 1.0.118 (2024-05-09)
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
## 1.0.117 (2024-05-07)
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
## 1.0.116 (2024-04-23)
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
## 1.0.115 (2024-04-22)
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
## 1.0.114 (2024-04-19)
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
## 1.0.113 (2024-04-19)
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
## 1.0.112 (2024-04-15)
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
## 1.0.111 (2024-04-11)
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
## 1.0.110 (2024-04-05)
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
## 1.0.109 (2024-04-05)
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
## 1.0.108 (2024-04-04)
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
## 1.0.107 (2024-04-03)
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
## 1.0.106 (2024-03-29)
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
## 1.0.105 (2024-03-28)
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
## 1.0.104 (2024-03-21)
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
## 1.0.103 (2024-03-20)
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
## 1.0.102 (2024-03-20)
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
## 1.0.101 (2024-03-13)
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
## 1.0.100 (2024-03-12)
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
## 1.0.99 (2024-03-11)
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
## 1.0.98 (2024-03-07)
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
## 1.0.97 (2024-03-06)
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
## 1.0.96 (2024-03-06)
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
## 1.0.95 (2024-03-04)
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
## 1.0.94 (2024-02-29)
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
## 1.0.93 (2024-02-28)
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
## 1.0.92 (2024-02-28)
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
## 1.0.91 (2024-02-23)
|
|
183
|
+
|
|
184
|
+
|
|
185
|
+
|
|
186
|
+
## 1.0.90 (2024-02-23)
|
|
187
|
+
|
|
188
|
+
|
|
189
|
+
|
|
190
|
+
## 1.0.89 (2024-02-21)
|
|
191
|
+
|
|
192
|
+
|
|
193
|
+
|
|
194
|
+
## 1.0.88 (2024-02-21)
|
|
195
|
+
|
|
196
|
+
|
|
197
|
+
|
|
198
|
+
## 1.0.87 (2024-02-20)
|
|
199
|
+
|
|
200
|
+
|
|
201
|
+
|
|
202
|
+
## 1.0.86 (2024-02-20)
|
|
203
|
+
|
|
204
|
+
|
|
205
|
+
|
|
206
|
+
## 1.0.85 (2024-02-13)
|
|
207
|
+
|
|
208
|
+
|
|
209
|
+
|
|
210
|
+
## 1.0.84 (2024-02-13)
|
|
211
|
+
|
|
212
|
+
|
|
213
|
+
|
|
214
|
+
## 1.0.83 (2024-02-09)
|
|
215
|
+
|
|
216
|
+
**Note:** Version bump only for package @oanda/labs-currency-strength-widget
|
|
217
|
+
|
|
218
|
+
|
|
219
|
+
|
|
220
|
+
|
|
221
|
+
|
|
6
222
|
## 1.0.52 (2024-07-03)
|
|
7
223
|
|
|
8
224
|
|
|
@@ -12,11 +12,10 @@ var _classnames = _interopRequireDefault(require("classnames"));
|
|
|
12
12
|
var _getCurrencyStrength = require("../gql/getCurrencyStrength");
|
|
13
13
|
var _Chart = require("./components/Chart");
|
|
14
14
|
var _formatters = require("./components/Chart/formatters");
|
|
15
|
-
function _interopRequireDefault(
|
|
15
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
16
16
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
17
17
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
18
18
|
const ChartWithData = _ref => {
|
|
19
|
-
var _data$currencyStrengt, _data$currencyStrengt2, _data$currencyStrengt3, _data$currencyStrengt4, _;
|
|
20
19
|
let {
|
|
21
20
|
currency
|
|
22
21
|
} = _ref;
|
|
@@ -34,9 +33,9 @@ const ChartWithData = _ref => {
|
|
|
34
33
|
} = (0, _client.useQuery)(_getCurrencyStrength.getCurrencyStrength, {
|
|
35
34
|
fetchPolicy: 'cache-and-network'
|
|
36
35
|
});
|
|
37
|
-
const showChart =
|
|
38
|
-
const showError =
|
|
39
|
-
const currencyData = currency ? data
|
|
36
|
+
const showChart = data?.currencyStrength && data?.currencyStrength?.length > 0;
|
|
37
|
+
const showError = data?.currencyStrength?.length === 0 || error;
|
|
38
|
+
const currencyData = currency ? data?.currencyStrength?.filter(item => item.currency === currency) : data?.currencyStrength?.slice().sort(_formatters.sortCurrencies);
|
|
40
39
|
return _react.default.createElement(_react.default.Fragment, null, loading && _react.default.createElement("div", {
|
|
41
40
|
className: (0, _classnames.default)('lw-flex lw-w-full lw-items-center lw-border lw-border-solid lw-border-border-primary', {
|
|
42
41
|
'lw-h-[461px]': !currency,
|
|
@@ -50,16 +49,13 @@ const ChartWithData = _ref => {
|
|
|
50
49
|
'lw-grid-cols-3 ': isDesktop && !currency,
|
|
51
50
|
'lw-grid-cols-1': !isDesktop || currency
|
|
52
51
|
})
|
|
53
|
-
}, currencyData && currencyData.map(item => {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
values: (_item$strengthRelatio = item.strengthRelation) === null || _item$strengthRelatio === void 0 ? void 0 : _item$strengthRelatio.slice().sort(_formatters.sortCurrencies)
|
|
61
|
-
}));
|
|
62
|
-
})), !loading && showError && _react.default.createElement("div", {
|
|
52
|
+
}, currencyData && currencyData.map(item => _react.default.createElement("div", {
|
|
53
|
+
key: item.currency,
|
|
54
|
+
className: "lw-flex lw-h-[135px] lw-flex-1 lw-items-center lw-justify-center"
|
|
55
|
+
}, _react.default.createElement(_Chart.Chart, {
|
|
56
|
+
currency: item.currency,
|
|
57
|
+
values: item.strengthRelation?.slice().sort(_formatters.sortCurrencies)
|
|
58
|
+
})))), !loading && showError && _react.default.createElement("div", {
|
|
63
59
|
className: (0, _classnames.default)('lw-flex lw-w-full lw-items-center lw-border lw-border-solid lw-border-border-primary', {
|
|
64
60
|
'lw-h-[425px]': !currency,
|
|
65
61
|
'lw-h-[135px]': currency
|
|
@@ -67,7 +63,7 @@ const ChartWithData = _ref => {
|
|
|
67
63
|
}, _react.default.createElement(_labsWidgetCommon.ChartError, null)), !loading && !showError && _react.default.createElement("div", {
|
|
68
64
|
className: "lw-mt-2 lw-h-8"
|
|
69
65
|
}, _react.default.createElement(_labsWidgetCommon.LastUpdated, {
|
|
70
|
-
timestamp: data
|
|
66
|
+
timestamp: data?.currencyStrength[0]?.updatedAt,
|
|
71
67
|
labelCallback: lang
|
|
72
68
|
})));
|
|
73
69
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChartsWithData.js","names":["_react","_interopRequireWildcard","require","_client","_monoI18n","_labsWidgetCommon","_classnames","_interopRequireDefault","_getCurrencyStrength","_Chart","_formatters","
|
|
1
|
+
{"version":3,"file":"ChartsWithData.js","names":["_react","_interopRequireWildcard","require","_client","_monoI18n","_labsWidgetCommon","_classnames","_interopRequireDefault","_getCurrencyStrength","_Chart","_formatters","e","__esModule","default","_getRequireWildcardCache","WeakMap","r","t","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","ChartWithData","_ref","currency","size","useContext","ThemeContext","isDesktop","Size","DESKTOP","lang","useLocale","loading","data","error","useQuery","getCurrencyStrength","fetchPolicy","showChart","currencyStrength","length","showError","currencyData","filter","item","slice","sort","sortCurrencies","createElement","Fragment","className","classnames","Spinner","SpinnerSize","lg","map","key","Chart","values","strengthRelation","ChartError","LastUpdated","timestamp","updatedAt","labelCallback","exports"],"sources":["../../../src/CurrencyStrengthWidget/ChartsWithData.tsx"],"sourcesContent":["import React, { useContext } from 'react';\nimport { useQuery } from '@apollo/client';\nimport { useLocale } from '@oanda/mono-i18n';\nimport {\n ChartError,\n LastUpdated,\n Size,\n Spinner,\n SpinnerSize,\n ThemeContext,\n} from '@oanda/labs-widget-common';\nimport classnames from 'classnames';\nimport { getCurrencyStrength } from '../gql/getCurrencyStrength';\nimport { GetCurrencyStrengthQuery } from '../gql/types/graphql';\nimport { Chart } from './components/Chart';\nimport { sortCurrencies } from './components/Chart/formatters';\nimport { WidgetProps } from './types';\n\nconst ChartWithData = ({ currency }: WidgetProps) => {\n const { size } = useContext(ThemeContext);\n const isDesktop = size === Size.DESKTOP;\n const { lang } = useLocale();\n const { loading, data, error } = useQuery<GetCurrencyStrengthQuery>(getCurrencyStrength, {\n fetchPolicy: 'cache-and-network',\n });\n\n const showChart = data?.currencyStrength && data?.currencyStrength?.length > 0;\n const showError = data?.currencyStrength?.length === 0 || error;\n\n const currencyData = currency\n ? data?.currencyStrength?.filter((item) => item.currency === currency)\n : data?.currencyStrength?.slice().sort(sortCurrencies);\n\n return (\n <>\n {loading\n && (\n <div className={classnames('lw-flex lw-w-full lw-items-center lw-border lw-border-solid lw-border-border-primary', {\n 'lw-h-[461px]': !currency,\n 'lw-h-[135px]': currency,\n })}\n >\n <Spinner size={SpinnerSize.lg} />\n </div>\n )}\n {!loading && showChart && (\n <div\n data-testid=\"currency-strength-chart-wrapper\"\n className={classnames('lw-grid lw-place-content-center lw-gap-7', {\n 'lw-grid-cols-3 ': isDesktop && !currency,\n 'lw-grid-cols-1': !isDesktop || currency,\n })}\n >\n {currencyData && currencyData.map((item) => (\n <div key={item.currency} className=\"lw-flex lw-h-[135px] lw-flex-1 lw-items-center lw-justify-center\">\n <Chart\n currency={item.currency}\n values={item.strengthRelation?.slice().sort(sortCurrencies)!}\n />\n </div>\n ))}\n </div>\n )}\n {!loading && showError && (\n <div className={classnames('lw-flex lw-w-full lw-items-center lw-border lw-border-solid lw-border-border-primary', {\n 'lw-h-[425px]': !currency,\n 'lw-h-[135px]': currency,\n })}\n >\n <ChartError />\n </div>\n )}\n {!loading && !showError && (\n <div className=\"lw-mt-2 lw-h-8\">\n <LastUpdated timestamp={data?.currencyStrength![0]?.updatedAt} labelCallback={lang} />\n </div>\n )}\n </>\n );\n};\n\nexport { ChartWithData };\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AACA,IAAAG,iBAAA,GAAAH,OAAA;AAQA,IAAAI,WAAA,GAAAC,sBAAA,CAAAL,OAAA;AACA,IAAAM,oBAAA,GAAAN,OAAA;AAEA,IAAAO,MAAA,GAAAP,OAAA;AACA,IAAAQ,WAAA,GAAAR,OAAA;AAA+D,SAAAK,uBAAAI,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,SAAAG,yBAAAH,CAAA,6BAAAI,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAD,wBAAA,YAAAA,CAAAH,CAAA,WAAAA,CAAA,GAAAM,CAAA,GAAAD,CAAA,KAAAL,CAAA;AAAA,SAAAV,wBAAAU,CAAA,EAAAK,CAAA,SAAAA,CAAA,IAAAL,CAAA,IAAAA,CAAA,CAAAC,UAAA,SAAAD,CAAA,eAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,WAAAE,OAAA,EAAAF,CAAA,QAAAM,CAAA,GAAAH,wBAAA,CAAAE,CAAA,OAAAC,CAAA,I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gB,EAAEd,KAAK,CAAC,CAAC,CAACC,IAAI,CAACC,0BAAc;EAAG,CAC9D,CACE,CACN,CACE,CACN,EACA,CAACf,OAAO,IAAIS,SAAS,IACpBnD,MAAA,CAAAa,OAAA,CAAA6C,aAAA;IAAKE,SAAS,EAAE,IAAAC,mBAAU,EAAC,sFAAsF,EAAE;MACjH,cAAc,EAAE,CAAC5B,QAAQ;MACzB,cAAc,EAAEA;IAClB,CAAC;EAAE,GAEDjC,MAAA,CAAAa,OAAA,CAAA6C,aAAA,CAACrD,iBAAA,CAAAiE,UAAU,MAAE,CACV,CACN,EACA,CAAC5B,OAAO,IAAI,CAACS,SAAS,IACrBnD,MAAA,CAAAa,OAAA,CAAA6C,aAAA;IAAKE,SAAS,EAAC;EAAgB,GAC7B5D,MAAA,CAAAa,OAAA,CAAA6C,aAAA,CAACrD,iBAAA,CAAAkE,WAAW;IAACC,SAAS,EAAE7B,IAAI,EAAEM,gBAAgB,CAAE,CAAC,CAAC,EAAEwB,SAAU;IAACC,aAAa,EAAElC;EAAK,CAAE,CAClF,CAEP,CAAC;AAEP,CAAC;AAACmC,OAAA,CAAA5C,aAAA,GAAAA,aAAA","ignoreList":[]}
|
|
@@ -10,7 +10,7 @@ var _client = require("@apollo/client");
|
|
|
10
10
|
var _labsWidgetCommon = require("@oanda/labs-widget-common");
|
|
11
11
|
var _translations = require("../translations");
|
|
12
12
|
var _Main = require("./Main");
|
|
13
|
-
function _interopRequireDefault(
|
|
13
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
14
14
|
const CurrencyStrengthWidget = _ref => {
|
|
15
15
|
let {
|
|
16
16
|
graphqlUrl,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CurrencyStrengthWidget.js","names":["_react","_interopRequireDefault","require","_monoI18n","_client","_labsWidgetCommon","_translations","_Main","
|
|
1
|
+
{"version":3,"file":"CurrencyStrengthWidget.js","names":["_react","_interopRequireDefault","require","_monoI18n","_client","_labsWidgetCommon","_translations","_Main","e","__esModule","default","CurrencyStrengthWidget","_ref","graphqlUrl","currency","locale","theme","isParamError","client","ApolloClient","uri","cache","InMemoryCache","createElement","ThemeProvider","LocaleProvider","getLocale","translations","ApolloProvider","className","ChartError","Main","exports"],"sources":["../../../src/CurrencyStrengthWidget/CurrencyStrengthWidget.tsx"],"sourcesContent":["import React from 'react';\nimport { LocaleProvider } from '@oanda/mono-i18n';\nimport { ApolloClient, InMemoryCache, ApolloProvider } from '@apollo/client';\nimport { ChartError, ThemeProvider, getLocale } from '@oanda/labs-widget-common';\nimport { CurrencyStrengthConfig } from './types';\nimport { translations } from '../translations';\nimport { Main } from './Main';\n\nconst CurrencyStrengthWidget = ({\n graphqlUrl, currency, locale, theme, isParamError,\n}: CurrencyStrengthConfig) => {\n const client = new ApolloClient({\n uri: graphqlUrl,\n cache: new InMemoryCache(),\n });\n\n return (\n <ThemeProvider theme={theme}>\n <LocaleProvider locale={getLocale(locale)} translations={translations}>\n <ApolloProvider client={client}>\n {isParamError ? (\n <div className=\"lw-flex lw-h-[425px] lw-w-full lw-items-center lw-border lw-border-solid lw-border-border-primary\">\n <ChartError />\n </div>\n ) : <Main currency={currency} />}\n </ApolloProvider>\n </LocaleProvider>\n </ThemeProvider>\n );\n};\n\nexport { CurrencyStrengthWidget };\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,iBAAA,GAAAH,OAAA;AAEA,IAAAI,aAAA,GAAAJ,OAAA;AACA,IAAAK,KAAA,GAAAL,OAAA;AAA8B,SAAAD,uBAAAO,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAE9B,MAAMG,sBAAsB,GAAGC,IAAA,IAED;EAAA,IAFE;IAC9BC,UAAU;IAAEC,QAAQ;IAAEC,MAAM;IAAEC,KAAK;IAAEC;EACf,CAAC,GAAAL,IAAA;EACvB,MAAMM,MAAM,GAAG,IAAIC,oBAAY,CAAC;IAC9BC,GAAG,EAAEP,UAAU;IACfQ,KAAK,EAAE,IAAIC,qBAAa,CAAC;EAC3B,CAAC,CAAC;EAEF,OACEtB,MAAA,CAAAU,OAAA,CAAAa,aAAA,CAAClB,iBAAA,CAAAmB,aAAa;IAACR,KAAK,EAAEA;EAAM,GAC1BhB,MAAA,CAAAU,OAAA,CAAAa,aAAA,CAACpB,SAAA,CAAAsB,cAAc;IAACV,MAAM,EAAE,IAAAW,2BAAS,EAACX,MAAM,CAAE;IAACY,YAAY,EAAEA;EAAa,GACpE3B,MAAA,CAAAU,OAAA,CAAAa,aAAA,CAACnB,OAAA,CAAAwB,cAAc;IAACV,MAAM,EAAEA;EAAO,GAC5BD,YAAY,GACXjB,MAAA,CAAAU,OAAA,CAAAa,aAAA;IAAKM,SAAS,EAAC;EAAmG,GAChH7B,MAAA,CAAAU,OAAA,CAAAa,aAAA,CAAClB,iBAAA,CAAAyB,UAAU,MAAE,CACV,CAAC,GACJ9B,MAAA,CAAAU,OAAA,CAAAa,aAAA,CAAChB,KAAA,CAAAwB,IAAI;IAACjB,QAAQ,EAAEA;EAAS,CAAE,CACjB,CACF,CACH,CAAC;AAEpB,CAAC;AAACkB,OAAA,CAAArB,sBAAA,GAAAA,sBAAA","ignoreList":[]}
|
|
@@ -24,9 +24,9 @@ const Main = _ref => {
|
|
|
24
24
|
"data-testid": "currency-strength-wrapper"
|
|
25
25
|
}, _react.default.createElement("div", {
|
|
26
26
|
className: "lw-mb-8 lw-flex lw-justify-center lw-font-sans lw-text-lg lw-font-bold"
|
|
27
|
-
}, _react.default.createElement("span", null,
|
|
27
|
+
}, _react.default.createElement("span", null, `${lang('daily')} (${lang('minute', {
|
|
28
28
|
count: 5
|
|
29
|
-
})
|
|
29
|
+
})})`)), _react.default.createElement(_ChartsWithData.ChartWithData, {
|
|
30
30
|
currency: currency
|
|
31
31
|
})));
|
|
32
32
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Main.js","names":["_react","_interopRequireWildcard","require","_monoI18n","_labsWidgetCommon","_ChartsWithData","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","Main","_ref","currency","lang","useLocale","size","useContext","ThemeContext","createElement","Fragment","className","
|
|
1
|
+
{"version":3,"file":"Main.js","names":["_react","_interopRequireWildcard","require","_monoI18n","_labsWidgetCommon","_ChartsWithData","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","Main","_ref","currency","lang","useLocale","size","useContext","ThemeContext","createElement","Fragment","className","count","ChartWithData","exports"],"sources":["../../../src/CurrencyStrengthWidget/Main.tsx"],"sourcesContent":["import React, { useContext } from 'react';\nimport { useLocale } from '@oanda/mono-i18n';\nimport { ThemeContext } from '@oanda/labs-widget-common';\nimport { ChartWithData } from './ChartsWithData';\nimport { WidgetProps } from './types';\n\nconst Main = ({ currency }: WidgetProps) => {\n const { lang } = useLocale();\n const { size } = useContext(ThemeContext);\n\n return (\n <>\n {size && (\n <div data-testid=\"currency-strength-wrapper\">\n <div className=\"lw-mb-8 lw-flex lw-justify-center lw-font-sans lw-text-lg lw-font-bold\">\n <span>{`${lang('daily')} (${lang('minute', { count: 5 })})`}</span>\n </div>\n <ChartWithData currency={currency} />\n </div>\n )}\n </>\n );\n};\n\nexport { Main };\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AACA,IAAAE,iBAAA,GAAAF,OAAA;AACA,IAAAG,eAAA,GAAAH,OAAA;AAAiD,SAAAI,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAA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AEzC,OACEjC,MAAA,CAAAY,OAAA,CAAAsB,aAAA,CAAAlC,MAAA,CAAAY,OAAA,CAAAuB,QAAA,QACGJ,IAAI,IACL/B,MAAA,CAAAY,OAAA,CAAAsB,aAAA;IAAK,eAAY;EAA2B,GAC1ClC,MAAA,CAAAY,OAAA,CAAAsB,aAAA;IAAKE,SAAS,EAAC;EAAwE,GACrFpC,MAAA,CAAAY,OAAA,CAAAsB,aAAA,eAAO,GAAGL,IAAI,CAAC,OAAO,CAAC,KAAKA,IAAI,CAAC,QAAQ,EAAE;IAAEQ,KAAK,EAAE;EAAE,CAAC,CAAC,GAAU,CAC/D,CAAC,EACNrC,MAAA,CAAAY,OAAA,CAAAsB,aAAA,CAAC7B,eAAA,CAAAiC,aAAa;IAACV,QAAQ,EAAEA;EAAS,CAAE,CACjC,CAEL,CAAC;AAEP,CAAC;AAACW,OAAA,CAAAb,IAAA,GAAAA,IAAA","ignoreList":[]}
|
|
@@ -14,7 +14,7 @@ var _monoI18n = require("@oanda/mono-i18n");
|
|
|
14
14
|
var _labsWidgetCommon = require("@oanda/labs-widget-common");
|
|
15
15
|
var _constants = require("./constants");
|
|
16
16
|
var _getOption = require("./getOption");
|
|
17
|
-
function _interopRequireDefault(
|
|
17
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
18
18
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
19
19
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
20
20
|
echarts.use([_components.GridSimpleComponent, _components.GraphicComponent, _components.TooltipComponent, _components.TitleComponent, _charts.BarChart, _renderers.CanvasRenderer]);
|
|
@@ -35,7 +35,7 @@ const Chart = _ref => {
|
|
|
35
35
|
echarts: echarts,
|
|
36
36
|
theme: isDark ? 'dark_theme' : 'light_theme',
|
|
37
37
|
style: {
|
|
38
|
-
height:
|
|
38
|
+
height: `${_constants.CHART_HEIGHT}px`,
|
|
39
39
|
width: '100%'
|
|
40
40
|
},
|
|
41
41
|
option: (0, _getOption.getOption)({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Chart.js","names":["_react","_interopRequireWildcard","require","_core","_interopRequireDefault","echarts","_charts","_renderers","_components","_monoI18n","_labsWidgetCommon","_constants","_getOption","
|
|
1
|
+
{"version":3,"file":"Chart.js","names":["_react","_interopRequireWildcard","require","_core","_interopRequireDefault","echarts","_charts","_renderers","_components","_monoI18n","_labsWidgetCommon","_constants","_getOption","e","__esModule","default","_getRequireWildcardCache","WeakMap","r","t","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","use","GridSimpleComponent","GraphicComponent","TooltipComponent","TitleComponent","BarChart","CanvasRenderer","registerTheme","getChartTheme","Theme","Dark","Light","Chart","_ref","values","currency","lang","useLocale","isDark","useContext","ThemeContext","createElement","theme","style","height","CHART_HEIGHT","width","option","getOption","exports"],"sources":["../../../../../src/CurrencyStrengthWidget/components/Chart/Chart.tsx"],"sourcesContent":["import React, { useContext } from 'react';\nimport ReactEChartsCore from 'echarts-for-react/lib/core';\nimport * as echarts from 'echarts/core';\nimport { BarChart } from 'echarts/charts';\nimport { CanvasRenderer } from 'echarts/renderers';\nimport {\n GridSimpleComponent, GraphicComponent, TooltipComponent, TitleComponent,\n} from 'echarts/components';\nimport { useLocale } from '@oanda/mono-i18n';\nimport { Theme, ThemeContext, getChartTheme } from '@oanda/labs-widget-common';\nimport {\n CHART_HEIGHT,\n} from './constants';\nimport { getOption } from './getOption';\nimport { ChartProps } from './types';\n\necharts.use([\n GridSimpleComponent,\n GraphicComponent,\n TooltipComponent,\n TitleComponent,\n BarChart,\n CanvasRenderer,\n]);\n\necharts.registerTheme('dark_theme', getChartTheme(Theme.Dark));\necharts.registerTheme('light_theme', getChartTheme(Theme.Light));\n\nconst Chart = ({ values, currency }: ChartProps) => {\n const { lang } = useLocale();\n const { isDark } = useContext(ThemeContext);\n\n return (\n <ReactEChartsCore\n echarts={echarts}\n theme={isDark ? 'dark_theme' : 'light_theme'}\n style={{\n height: `${CHART_HEIGHT}px`,\n width: '100%',\n }}\n option={getOption({\n values, currency, lang, isDark,\n })}\n />\n );\n};\n\nexport { Chart };\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,KAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,OAAA,GAAAJ,uBAAA,CAAAC,OAAA;AACA,IAAAI,OAAA,GAAAJ,OAAA;AACA,IAAAK,UAAA,GAAAL,OAAA;AACA,IAAAM,WAAA,GAAAN,OAAA;AAGA,IAAAO,SAAA,GAAAP,OAAA;AACA,IAAAQ,iBAAA,GAAAR,OAAA;AACA,IAAAS,UAAA,GAAAT,OAAA;AAGA,IAAAU,UAAA,GAAAV,OAAA;AAAwC,SAAAE,uBAAAS,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,SAAAG,yBAAAH,CAAA,6BAAAI,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAD,wBAAA,YAAAA,CAAAH,CAAA,WAAAA,CAAA,GAAAM,CAAA,GAAAD,CAAA,KAAAL,CAAA;AAAA,SAAAZ,wBAAAY,CAAA,EAAAK,CAAA,SAAAA,CAAA,IAAAL,CAAA,IAA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GAAAF,IAAA;EAC7C,MAAM;IAAEG;EAAK,CAAC,GAAG,IAAAC,mBAAS,EAAC,CAAC;EAC5B,MAAM;IAAEC;EAAO,CAAC,GAAG,IAAAC,iBAAU,EAACC,8BAAY,CAAC;EAE3C,OACErD,MAAA,CAAAe,OAAA,CAAAuC,aAAA,CAACnD,KAAA,CAAAY,OAAgB;IACfV,OAAO,EAAEA,OAAQ;IACjBkD,KAAK,EAAEJ,MAAM,GAAG,YAAY,GAAG,aAAc;IAC7CK,KAAK,EAAE;MACLC,MAAM,EAAE,GAAGC,uBAAY,IAAI;MAC3BC,KAAK,EAAE;IACT,CAAE;IACFC,MAAM,EAAE,IAAAC,oBAAS,EAAC;MAChBd,MAAM;MAAEC,QAAQ;MAAEC,IAAI;MAAEE;IAC1B,CAAC;EAAE,CACJ,CAAC;AAEN,CAAC;AAACW,OAAA,CAAAjB,KAAA,GAAAA,KAAA","ignoreList":[]}
|
|
@@ -13,7 +13,11 @@ const tooltipFormatter = _ref => {
|
|
|
13
13
|
currency,
|
|
14
14
|
lang
|
|
15
15
|
} = _ref;
|
|
16
|
-
return
|
|
16
|
+
return `
|
|
17
|
+
<div>
|
|
18
|
+
<div style="margin-bottom:5px;">${currency} ${lang('vs')} ${name}</div>
|
|
19
|
+
<div style="display:flex;align-items:center;">${marker} ${value}%</div>
|
|
20
|
+
</div>`;
|
|
17
21
|
};
|
|
18
22
|
exports.tooltipFormatter = tooltipFormatter;
|
|
19
23
|
const sortCurrencies = (a, b) => _constants.instrumentsConfig.indexOf(a.currency) - _constants.instrumentsConfig.indexOf(b.currency);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"formatters.js","names":["_constants","require","tooltipFormatter","_ref","marker","name","value","currency","lang","
|
|
1
|
+
{"version":3,"file":"formatters.js","names":["_constants","require","tooltipFormatter","_ref","marker","name","value","currency","lang","exports","sortCurrencies","a","b","instrumentsConfig","indexOf"],"sources":["../../../../../src/CurrencyStrengthWidget/components/Chart/formatters.ts"],"sourcesContent":["import { instrumentsConfig } from './constants';\nimport { SortingParams, TooltipFormatterParams } from './types';\n\nconst tooltipFormatter = ({\n marker,\n name,\n value,\n currency,\n lang,\n}: TooltipFormatterParams) => `\n<div>\n <div style=\"margin-bottom:5px;\">${currency} ${lang('vs')} ${name}</div>\n <div style=\"display:flex;align-items:center;\">${marker} ${value}%</div>\n</div>`;\n\nconst sortCurrencies = (a: SortingParams, b: SortingParams) => instrumentsConfig\n .indexOf(a.currency) - instrumentsConfig.indexOf(b.currency);\n\nexport {\n tooltipFormatter,\n sortCurrencies,\n};\n"],"mappings":";;;;;;AAAA,IAAAA,UAAA,GAAAC,OAAA;AAGA,MAAMC,gBAAgB,GAAGC,IAAA;EAAA,IAAC;IACxBC,MAAM;IACNC,IAAI;IACJC,KAAK;IACLC,QAAQ;IACRC;EACsB,CAAC,GAAAL,IAAA;EAAA,OAAK;AAC9B;AACA,oCAAoCI,QAAQ,IAAIC,IAAI,CAAC,IAAI,CAAC,IAAIH,IAAI;AAClE,kDAAkDD,MAAM,IAAIE,KAAK;AACjE,OAAO;AAAA;AAACG,OAAA,CAAAP,gBAAA,GAAAA,gBAAA;AAER,MAAMQ,cAAc,GAAGA,CAACC,CAAgB,EAAEC,CAAgB,KAAKC,4BAAiB,CAC7EC,OAAO,CAACH,CAAC,CAACJ,QAAQ,CAAC,GAAGM,4BAAiB,CAACC,OAAO,CAACF,CAAC,CAACL,QAAQ,CAAC;AAACE,OAAA,CAAAC,cAAA,GAAAA,cAAA","ignoreList":[]}
|
|
@@ -28,7 +28,7 @@ const getOption = _ref => {
|
|
|
28
28
|
animation: false,
|
|
29
29
|
title: {
|
|
30
30
|
left: 'center',
|
|
31
|
-
text:
|
|
31
|
+
text: `${currency} vs`,
|
|
32
32
|
textStyle: {
|
|
33
33
|
fontSize: 12,
|
|
34
34
|
lineHeight: 20,
|
|
@@ -39,8 +39,8 @@ const getOption = _ref => {
|
|
|
39
39
|
name: 'main-grid',
|
|
40
40
|
top: '30px',
|
|
41
41
|
right: '0px',
|
|
42
|
-
left:
|
|
43
|
-
bottom:
|
|
42
|
+
left: `${_constants.Y_LABEL_SIZE}px`,
|
|
43
|
+
bottom: `${_constants.X_LABEL_SIZE}px`
|
|
44
44
|
}],
|
|
45
45
|
graphic: [...gridLines],
|
|
46
46
|
tooltip: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getOption.js","names":["_labsWidgetCommon","require","_constants","_formatters","getOption","_ref","values","currency","isDark","lang","currencies","map","item","percentages","percentage","barColors","darkBarColors","lightBarColors","gridLines","getGridLines","chartWidth","CHART_WIDTH","chartHeight","CHART_HEIGHT","xLabelsSize","yLabelSize","animation","title","left","text","
|
|
1
|
+
{"version":3,"file":"getOption.js","names":["_labsWidgetCommon","require","_constants","_formatters","getOption","_ref","values","currency","isDark","lang","currencies","map","item","percentages","percentage","barColors","darkBarColors","lightBarColors","gridLines","getGridLines","chartWidth","CHART_WIDTH","chartHeight","CHART_HEIGHT","xLabelsSize","yLabelSize","animation","title","left","text","textStyle","fontSize","lineHeight","fontWeight","grid","name","top","right","Y_LABEL_SIZE","bottom","X_LABEL_SIZE","graphic","tooltip","trigger","formatter","_ref2","marker","value","tooltipFormatter","axisPointer","axis","extraCssText","xAxis","type","data","axisTick","show","axisLine","splitLine","axisLabel","yAxis","position","min","Math","floor","max","ceil","interval","series","emphasis","disabled","itemStyle","opacity","color","_ref3","positive","negative","zero","exports"],"sources":["../../../../../src/CurrencyStrengthWidget/components/Chart/getOption.ts"],"sourcesContent":["import { getGridLines } from '@oanda/labs-widget-common';\nimport {\n CHART_HEIGHT,\n CHART_WIDTH,\n X_LABEL_SIZE,\n Y_LABEL_SIZE,\n darkBarColors,\n lightBarColors,\n} from './constants';\nimport { GetOptionProps } from './types';\nimport { tooltipFormatter } from './formatters';\n\nexport const getOption = ({\n values, currency, isDark, lang,\n}: GetOptionProps) => {\n const currencies = values.map((item) => item.currency);\n const percentages = values.map((item) => item.percentage);\n const barColors = isDark ? darkBarColors : lightBarColors;\n\n const gridLines = getGridLines({\n isDark,\n chartWidth: CHART_WIDTH,\n chartHeight: CHART_HEIGHT,\n xLabelsSize: -2,\n yLabelSize: -3,\n });\n\n return {\n animation: false,\n title: {\n left: 'center',\n text: `${currency} vs`,\n textStyle: {\n fontSize: 12,\n lineHeight: 20,\n fontWeight: 400,\n },\n },\n grid: [\n {\n name: 'main-grid',\n top: '30px',\n right: '0px',\n left: `${Y_LABEL_SIZE}px`,\n bottom: `${X_LABEL_SIZE}px`,\n },\n ],\n graphic: [\n ...gridLines,\n ],\n tooltip: {\n trigger: 'axis',\n formatter: (\n [{ marker, name, value }]\n : { marker: string, name: string, value: number }[],\n ) => tooltipFormatter({\n lang,\n currency,\n marker,\n name,\n value,\n }),\n axisPointer: {\n axis: 'x',\n },\n extraCssText: 'z-index: 1',\n },\n xAxis: {\n type: 'category',\n data: currencies,\n axisTick: { show: false },\n axisLine: { show: false },\n splitLine: { show: false },\n axisLabel: {\n fontSize: 10,\n },\n },\n yAxis: {\n type: 'value',\n position: 'left',\n min: Math.floor(Math.min(...percentages)),\n max: Math.ceil(Math.max(...percentages)),\n interval: 1,\n axisLine: { show: false },\n axisTick: { show: false },\n axisLabel: {\n formatter: '{value}%',\n fontSize: 10,\n },\n },\n series: [\n {\n data: percentages,\n type: 'bar',\n emphasis: {\n disabled: true,\n },\n itemStyle: {\n opacity: 1,\n color: ({ data } : { data: number }) => {\n if (data > 0) {\n return barColors.positive;\n }\n if (data < 0) {\n return barColors.negative;\n }\n return barColors.zero;\n },\n },\n },\n ],\n };\n};\n"],"mappings":";;;;;;AAAA,IAAAA,iBAAA,GAAAC,OAAA;AACA,IAAAC,UAAA,GAAAD,OAAA;AASA,IAAAE,WAAA,GAAAF,OAAA;AAEO,MAAMG,SAAS,GAAGC,IAAA,IAEH;EAAA,IAFI;IACxBC,MAAM;IAAEC,QAAQ;IAAEC,MAAM;IAAEC;EACZ,CAAC,GAAAJ,IAAA;EACf,MAAMK,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,OAAA,CAAA1E,SAAA,GAAAA,SAAA","ignoreList":[]}
|
|
@@ -4,7 +4,7 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
4
4
|
var _client = require("react-dom/client");
|
|
5
5
|
var _labsWidgetCommon = require("@oanda/labs-widget-common");
|
|
6
6
|
var _CurrencyStrengthWidget = require("./CurrencyStrengthWidget");
|
|
7
|
-
function _interopRequireDefault(
|
|
7
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
8
8
|
const {
|
|
9
9
|
graphqlUrl
|
|
10
10
|
} = window.widgetsConfig || {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"render.js","names":["_react","_interopRequireDefault","require","_client","_labsWidgetCommon","_CurrencyStrengthWidget","
|
|
1
|
+
{"version":3,"file":"render.js","names":["_react","_interopRequireDefault","require","_client","_labsWidgetCommon","_CurrencyStrengthWidget","e","__esModule","default","graphqlUrl","window","widgetsConfig","currencyStrengthParamsElements","document","querySelectorAll","forEach","element","root","createRoot","params","getAttribute","mode","currency","locale","JSON","parse","isParamError","validateToolParams","name","valueCheck","value","validateLocale","render","createElement","CurrencyStrengthWidget","theme"],"sources":["../../../src/CurrencyStrengthWidget/render.tsx"],"sourcesContent":["import React from 'react';\nimport { createRoot } from 'react-dom/client';\nimport { Theme, validateLocale, validateToolParams } from '@oanda/labs-widget-common';\nimport { CurrencyStrengthWidget } from './CurrencyStrengthWidget';\n\nconst {\n graphqlUrl,\n} = window.widgetsConfig || {};\n\nconst currencyStrengthParamsElements = document.querySelectorAll('div[data-currency-strength-params]');\n\ncurrencyStrengthParamsElements.forEach((element) => {\n const root = createRoot(element);\n const params = element.getAttribute('data-currency-strength-params');\n const mode = element.getAttribute('data-mode');\n const { currency, locale } = JSON.parse(params as string);\n\n const isParamError = validateToolParams({ locale, graphqlUrl }, [\n {\n name: 'locale',\n valueCheck: (value) => validateLocale(value),\n }, {\n name: 'graphqlUrl',\n }]);\n\n root.render(\n <CurrencyStrengthWidget\n graphqlUrl={graphqlUrl}\n locale={locale}\n theme={mode as Theme}\n isParamError={isParamError}\n currency={currency}\n />,\n );\n});\n"],"mappings":";;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,iBAAA,GAAAF,OAAA;AACA,IAAAG,uBAAA,GAAAH,OAAA;AAAkE,SAAAD,uBAAAK,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAElE,MAAM;EACJG;AACF,CAAC,GAAGC,MAAM,CAACC,aAAa,IAAI,CAAC,CAAC;AAE9B,MAAMC,8BAA8B,GAAGC,QAAQ,CAACC,gBAAgB,CAAC,oCAAoC,CAAC;AAEtGF,8BAA8B,CAACG,OAAO,CAAEC,OAAO,IAAK;EAClD,MAAMC,IAAI,GAAG,IAAAC,kBAAU,EAACF,OAAO,CAAC;EAChC,MAAMG,MAAM,GAAGH,OAAO,CAACI,YAAY,CAAC,+BAA+B,CAAC;EACpE,MAAMC,IAAI,GAAGL,OAAO,CAACI,YAAY,CAAC,WAAW,CAAC;EAC9C,MAAM;IAAEE,QAAQ;IAAEC;EAAO,CAAC,GAAGC,IAAI,CAACC,KAAK,CAACN,MAAgB,CAAC;EAEzD,MAAMO,YAAY,GAAG,IAAAC,oCAAkB,EAAC;IAAEJ,MAAM;IAAEd;EAAW,CAAC,EAAE,CAC9D;IACEmB,IAAI,EAAE,QAAQ;IACdC,UAAU,EAAGC,KAAK,IAAK,IAAAC,gCAAc,EAACD,KAAK;EAC7C,CAAC,EAAE;IACDF,IAAI,EAAE;EACR,CAAC,CAAC,CAAC;EAELX,IAAI,CAACe,MAAM,CACThC,MAAA,CAAAQ,OAAA,CAAAyB,aAAA,CAAC5B,uBAAA,CAAA6B,sBAAsB;IACrBzB,UAAU,EAAEA,UAAW;IACvBc,MAAM,EAAEA,MAAO;IACfY,KAAK,EAAEd,IAAc;IACrBK,YAAY,EAAEA,YAAa;IAC3BJ,QAAQ,EAAEA;EAAS,CACpB,CACH,CAAC;AACH,CAAC,CAAC","ignoreList":[]}
|
|
@@ -5,7 +5,16 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.getCurrencyStrength = void 0;
|
|
7
7
|
var _client = require("@apollo/client");
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
const getCurrencyStrength = exports.getCurrencyStrength = (0, _client.gql)`
|
|
9
|
+
query GetCurrencyStrength {
|
|
10
|
+
currencyStrength {
|
|
11
|
+
currency
|
|
12
|
+
strengthRelation {
|
|
13
|
+
currency
|
|
14
|
+
percentage
|
|
15
|
+
}
|
|
16
|
+
updatedAt
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
`;
|
|
11
20
|
//# sourceMappingURL=getCurrencyStrength.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getCurrencyStrength.js","names":["_client","require","
|
|
1
|
+
{"version":3,"file":"getCurrencyStrength.js","names":["_client","require","getCurrencyStrength","exports","gql"],"sources":["../../../src/gql/getCurrencyStrength.ts"],"sourcesContent":["import { gql } from '@apollo/client';\n\nconst getCurrencyStrength = gql`\n query GetCurrencyStrength {\n currencyStrength {\n currency\n strengthRelation {\n currency\n percentage\n }\n updatedAt\n }\n }\n`;\n\nexport { getCurrencyStrength };\n"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AAEA,MAAMC,mBAAmB,GAAAC,OAAA,CAAAD,mBAAA,GAAG,IAAAE,WAAG;AAC/B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC","ignoreList":[]}
|
|
@@ -13,11 +13,10 @@ function makeFragmentData(data, _fragment) {
|
|
|
13
13
|
return data;
|
|
14
14
|
}
|
|
15
15
|
function isFragmentReady(queryNode, fragmentNode, data) {
|
|
16
|
-
|
|
17
|
-
const deferredFields = (_meta__ = queryNode.__meta__) === null || _meta__ === void 0 ? void 0 : _meta__.deferredFields;
|
|
16
|
+
const deferredFields = queryNode.__meta__?.deferredFields;
|
|
18
17
|
if (!deferredFields) return true;
|
|
19
18
|
const fragDef = fragmentNode.definitions[0];
|
|
20
|
-
const fragName = fragDef
|
|
19
|
+
const fragName = fragDef?.name?.value;
|
|
21
20
|
const fields = fragName && deferredFields[fragName] || [];
|
|
22
21
|
return fields.length > 0 && fields.every(field => data && field in data);
|
|
23
22
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fragment-masking.js","names":["useFragment","_documentNode","fragmentType","makeFragmentData","data","_fragment","isFragmentReady","queryNode","fragmentNode","
|
|
1
|
+
{"version":3,"file":"fragment-masking.js","names":["useFragment","_documentNode","fragmentType","makeFragmentData","data","_fragment","isFragmentReady","queryNode","fragmentNode","deferredFields","__meta__","fragDef","definitions","fragName","name","value","fields","length","every","field"],"sources":["../../../../src/gql/types/fragment-masking.ts"],"sourcesContent":["import { ResultOf, DocumentTypeDecoration, TypedDocumentNode } from '@graphql-typed-document-node/core';\nimport { FragmentDefinitionNode } from 'graphql';\nimport { Incremental } from './graphql';\n\n\nexport type FragmentType<TDocumentType extends DocumentTypeDecoration<any, any>> = TDocumentType extends DocumentTypeDecoration<\n infer TType,\n any\n>\n ? [TType] extends [{ ' $fragmentName'?: infer TKey }]\n ? TKey extends string\n ? { ' $fragmentRefs'?: { [key in TKey]: TType } }\n : never\n : never\n : never;\n\n// return non-nullable if `fragmentType` is non-nullable\nexport function useFragment<TType>(\n _documentNode: DocumentTypeDecoration<TType, any>,\n fragmentType: FragmentType<DocumentTypeDecoration<TType, any>>\n): TType;\n// return nullable if `fragmentType` is nullable\nexport function useFragment<TType>(\n _documentNode: DocumentTypeDecoration<TType, any>,\n fragmentType: FragmentType<DocumentTypeDecoration<TType, any>> | null | undefined\n): TType | null | undefined;\n// return array of non-nullable if `fragmentType` is array of non-nullable\nexport function useFragment<TType>(\n _documentNode: DocumentTypeDecoration<TType, any>,\n fragmentType: ReadonlyArray<FragmentType<DocumentTypeDecoration<TType, any>>>\n): ReadonlyArray<TType>;\n// return array of nullable if `fragmentType` is array of nullable\nexport function useFragment<TType>(\n _documentNode: DocumentTypeDecoration<TType, any>,\n fragmentType: ReadonlyArray<FragmentType<DocumentTypeDecoration<TType, any>>> | null | undefined\n): ReadonlyArray<TType> | null | undefined;\nexport function useFragment<TType>(\n _documentNode: DocumentTypeDecoration<TType, any>,\n fragmentType: FragmentType<DocumentTypeDecoration<TType, any>> | ReadonlyArray<FragmentType<DocumentTypeDecoration<TType, any>>> | null | undefined\n): TType | ReadonlyArray<TType> | null | undefined {\n return fragmentType as any;\n}\n\n\nexport function makeFragmentData<\n F extends DocumentTypeDecoration<any, any>,\n FT extends ResultOf<F>\n>(data: FT, _fragment: F): FragmentType<F> {\n return data as FragmentType<F>;\n}\nexport function isFragmentReady<TQuery, TFrag>(\n queryNode: DocumentTypeDecoration<TQuery, any>,\n fragmentNode: TypedDocumentNode<TFrag>,\n data: FragmentType<TypedDocumentNode<Incremental<TFrag>, any>> | null | undefined\n): data is FragmentType<typeof fragmentNode> {\n const deferredFields = (queryNode as { __meta__?: { deferredFields: Record<string, (keyof TFrag)[]> } }).__meta__\n ?.deferredFields;\n\n if (!deferredFields) return true;\n\n const fragDef = fragmentNode.definitions[0] as FragmentDefinitionNode | undefined;\n const fragName = fragDef?.name?.value;\n\n const fields = (fragName && deferredFields[fragName]) || [];\n return fields.length > 0 && fields.every(field => data && field in data);\n}\n"],"mappings":";;;;;;;;AAoCO,SAASA,WAAWA,CACzBC,aAAiD,EACjDC,YAAmJ,EAClG;EACjD,OAAOA,YAAY;AACrB;AAGO,SAASC,gBAAgBA,CAG9BC,IAAQ,EAAEC,SAAY,EAAmB;EACzC,OAAOD,IAAI;AACb;AACO,SAASE,eAAeA,CAC7BC,SAA8C,EAC9CC,YAAsC,EACtCJ,IAAiF,EACtC;EAC3C,MAAMK,cAAc,GAAIF,SAAS,CAAwEG,QAAQ,EAC7GD,cAAc;EAElB,IAAI,CAACA,cAAc,EAAE,OAAO,IAAI;EAEhC,MAAME,OAAO,GAAGH,YAAY,CAACI,WAAW,CAAC,CAAC,CAAuC;EACjF,MAAMC,QAAQ,GAAGF,OAAO,EAAEG,IAAI,EAAEC,KAAK;EAErC,MAAMC,MAAM,GAAIH,QAAQ,IAAIJ,cAAc,CAACI,QAAQ,CAAC,IAAK,EAAE;EAC3D,OAAOG,MAAM,CAACC,MAAM,GAAG,CAAC,IAAID,MAAM,CAACE,KAAK,CAACC,KAAK,IAAIf,IAAI,IAAIe,KAAK,IAAIf,IAAI,CAAC;AAC1E","ignoreList":[]}
|
|
@@ -11,7 +11,6 @@ const documents = {
|
|
|
11
11
|
"\n query GetCurrencyStrength {\n currencyStrength {\n currency\n strengthRelation {\n currency\n percentage\n }\n updatedAt\n }\n }\n": types.GetCurrencyStrengthDocument
|
|
12
12
|
};
|
|
13
13
|
function graphql(source) {
|
|
14
|
-
|
|
15
|
-
return (_source = documents[source]) !== null && _source !== void 0 ? _source : {};
|
|
14
|
+
return documents[source] ?? {};
|
|
16
15
|
}
|
|
17
16
|
//# sourceMappingURL=gql.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gql.js","names":["types","_interopRequireWildcard","require","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","documents","GetCurrencyStrengthDocument","graphql","source"
|
|
1
|
+
{"version":3,"file":"gql.js","names":["types","_interopRequireWildcard","require","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","documents","GetCurrencyStrengthDocument","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 GetCurrencyStrength {\\n currencyStrength {\\n currency\\n strengthRelation {\\n currency\\n percentage\\n }\\n updatedAt\\n }\\n }\\n\": types.GetCurrencyStrengthDocument,\n};\n\n/**\n * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.\n *\n *\n * @example\n * ```ts\n * const query = graphql(`query GetUser($id: ID!) { user(id: $id) { name } }`);\n * ```\n *\n * The query argument is unknown!\n * Please regenerate the types.\n */\nexport function graphql(source: string): unknown;\n\n/**\n * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.\n */\nexport function graphql(source: \"\\n query GetCurrencyStrength {\\n currencyStrength {\\n currency\\n strengthRelation {\\n currency\\n percentage\\n }\\n updatedAt\\n }\\n }\\n\"): (typeof documents)[\"\\n query GetCurrencyStrength {\\n currencyStrength {\\n currency\\n strengthRelation {\\n currency\\n percentage\\n }\\n updatedAt\\n }\\n }\\n\"];\n\nexport function graphql(source: string) {\n return (documents as any)[source] ?? {};\n}\n\nexport type DocumentType<TDocumentNode extends DocumentNode<any, any>> = TDocumentNode extends DocumentNode< infer TType, any> ? TType : never;"],"mappings":";;;;;;AACA,IAAAA,KAAA,GAAAC,uBAAA,CAAAC,OAAA;AAAmC,SAAAC,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAH,wBAAAG,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAI,UAAA,SAAAJ,CAAA,eAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,WAAAK,OAAA,EAAAL,CAAA,QAAAG,CAAA,GAAAJ,wBAAA,CAAAG,CAAA,OAAAC,CAAA,IAAAA,CAAA,CAAAG,GAAA,CAAAN,CAAA,UAAAG,CAAA,CAAAI,GAAA,CAAAP,CAAA,OAAAQ,CAAA,KAAAC,SAAA,UAAAC,CAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAAA,CAAAE,wBAAA,WAAAC,CAAA,IAAAd,CAAA,oBAAAc,CAAA,OAAAC,cAAA,CAAAC,IAAA,CAAAhB,CAAA,EAAAc,CAAA,SAAAG,CAAA,GAAAP,CAAA,GAAAC,MAAA,CAAAE,wBAAA,CAAAb,CAAA,EAAAc,CAAA,UAAAG,CAAA,KAAAA,CAAA,CAAAV,GAAA,IAAAU,CAAA,CAAAC,GAAA,IAAAP,MAAA,CAAAC,cAAA,CAAAJ,CAAA,EAAAM,CAAA,EAAAG,CAAA,IAAAT,CAAA,CAAAM,CAAA,IAAAd,CAAA,CAAAc,CAAA,YAAAN,CAAA,CAAAH,OAAA,GAAAL,CAAA,EAAAG,CAAA,IAAAA,CAAA,CAAAe,GAAA,CAAAlB,CAAA,EAAAQ,CAAA,GAAAA,CAAA;AAanC,MAAMW,SAAS,GAAG;EACd,iLAAiL,EAAEvB,KAAK,CAACwB;AAC7L,CAAC;AAqBM,SAASC,OAAOA,CAACC,MAAc,EAAE;EACtC,OAAQH,SAAS,CAASG,MAAM,CAAC,IAAI,CAAC,CAAC;AACzC","ignoreList":[]}
|
|
@@ -9,7 +9,7 @@ var _en = _interopRequireDefault(require("./sources/en.json"));
|
|
|
9
9
|
var _zh_TW = _interopRequireDefault(require("./sources/zh_TW.json"));
|
|
10
10
|
var _es = _interopRequireDefault(require("./sources/es.json"));
|
|
11
11
|
var _th = _interopRequireDefault(require("./sources/th.json"));
|
|
12
|
-
function _interopRequireDefault(
|
|
12
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
13
13
|
const translations = exports.translations = {
|
|
14
14
|
[_monoI18n.Locale.en]: {
|
|
15
15
|
translation: _en.default
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["_monoI18n","require","_en","_interopRequireDefault","_zh_TW","_es","_th","
|
|
1
|
+
{"version":3,"file":"index.js","names":["_monoI18n","require","_en","_interopRequireDefault","_zh_TW","_es","_th","e","__esModule","default","translations","exports","Locale","en","translation","zhTW","es","th"],"sources":["../../../src/translations/index.ts"],"sourcesContent":["import { Locale, Translations } from '@oanda/mono-i18n';\n\nimport en from './sources/en.json';\nimport zhTW from './sources/zh_TW.json';\nimport es from './sources/es.json';\nimport th from './sources/th.json';\n\nimport { defaultTranslations } from './translations';\n\nexport type TranslationKey = keyof typeof defaultTranslations;\n\nexport const translations: Translations = {\n [Locale.en]: { translation: en },\n [Locale.zhTW]: { translation: zhTW },\n [Locale.es]: { translation: es },\n [Locale.th]: { translation: th },\n};\n"],"mappings":";;;;;;AAAA,IAAAA,SAAA,GAAAC,OAAA;AAEA,IAAAC,GAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,MAAA,GAAAD,sBAAA,CAAAF,OAAA;AACA,IAAAI,GAAA,GAAAF,sBAAA,CAAAF,OAAA;AACA,IAAAK,GAAA,GAAAH,sBAAA,CAAAF,OAAA;AAAmC,SAAAE,uBAAAI,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAM5B,MAAMG,YAA0B,GAAAC,OAAA,CAAAD,YAAA,GAAG;EACxC,CAACE,gBAAM,CAACC,EAAE,GAAG;IAAEC,WAAW,EAAED;EAAG,CAAC;EAChC,CAACD,gBAAM,CAACG,IAAI,GAAG;IAAED,WAAW,EAAEC;EAAK,CAAC;EACpC,CAACH,gBAAM,CAACI,EAAE,GAAG;IAAEF,WAAW,EAAEE;EAAG,CAAC;EAChC,CAACJ,gBAAM,CAACK,EAAE,GAAG;IAAEH,WAAW,EAAEG;EAAG;AACjC,CAAC","ignoreList":[]}
|
|
@@ -7,7 +7,6 @@ import { getCurrencyStrength } from '../gql/getCurrencyStrength';
|
|
|
7
7
|
import { Chart } from './components/Chart';
|
|
8
8
|
import { sortCurrencies } from './components/Chart/formatters';
|
|
9
9
|
const ChartWithData = _ref => {
|
|
10
|
-
var _data$currencyStrengt, _data$currencyStrengt2, _data$currencyStrengt3, _data$currencyStrengt4, _;
|
|
11
10
|
let {
|
|
12
11
|
currency
|
|
13
12
|
} = _ref;
|
|
@@ -25,9 +24,9 @@ const ChartWithData = _ref => {
|
|
|
25
24
|
} = useQuery(getCurrencyStrength, {
|
|
26
25
|
fetchPolicy: 'cache-and-network'
|
|
27
26
|
});
|
|
28
|
-
const showChart =
|
|
29
|
-
const showError =
|
|
30
|
-
const currencyData = currency ? data
|
|
27
|
+
const showChart = data?.currencyStrength && data?.currencyStrength?.length > 0;
|
|
28
|
+
const showError = data?.currencyStrength?.length === 0 || error;
|
|
29
|
+
const currencyData = currency ? data?.currencyStrength?.filter(item => item.currency === currency) : data?.currencyStrength?.slice().sort(sortCurrencies);
|
|
31
30
|
return React.createElement(React.Fragment, null, loading && React.createElement("div", {
|
|
32
31
|
className: classnames('lw-flex lw-w-full lw-items-center lw-border lw-border-solid lw-border-border-primary', {
|
|
33
32
|
'lw-h-[461px]': !currency,
|
|
@@ -41,16 +40,13 @@ const ChartWithData = _ref => {
|
|
|
41
40
|
'lw-grid-cols-3 ': isDesktop && !currency,
|
|
42
41
|
'lw-grid-cols-1': !isDesktop || currency
|
|
43
42
|
})
|
|
44
|
-
}, currencyData && currencyData.map(item => {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
values: (_item$strengthRelatio = item.strengthRelation) === null || _item$strengthRelatio === void 0 ? void 0 : _item$strengthRelatio.slice().sort(sortCurrencies)
|
|
52
|
-
}));
|
|
53
|
-
})), !loading && showError && React.createElement("div", {
|
|
43
|
+
}, currencyData && currencyData.map(item => React.createElement("div", {
|
|
44
|
+
key: item.currency,
|
|
45
|
+
className: "lw-flex lw-h-[135px] lw-flex-1 lw-items-center lw-justify-center"
|
|
46
|
+
}, React.createElement(Chart, {
|
|
47
|
+
currency: item.currency,
|
|
48
|
+
values: item.strengthRelation?.slice().sort(sortCurrencies)
|
|
49
|
+
})))), !loading && showError && React.createElement("div", {
|
|
54
50
|
className: classnames('lw-flex lw-w-full lw-items-center lw-border lw-border-solid lw-border-border-primary', {
|
|
55
51
|
'lw-h-[425px]': !currency,
|
|
56
52
|
'lw-h-[135px]': currency
|
|
@@ -58,7 +54,7 @@ const ChartWithData = _ref => {
|
|
|
58
54
|
}, React.createElement(ChartError, null)), !loading && !showError && React.createElement("div", {
|
|
59
55
|
className: "lw-mt-2 lw-h-8"
|
|
60
56
|
}, React.createElement(LastUpdated, {
|
|
61
|
-
timestamp: data
|
|
57
|
+
timestamp: data?.currencyStrength[0]?.updatedAt,
|
|
62
58
|
labelCallback: lang
|
|
63
59
|
})));
|
|
64
60
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChartsWithData.js","names":["React","useContext","useQuery","useLocale","ChartError","LastUpdated","Size","Spinner","SpinnerSize","ThemeContext","classnames","getCurrencyStrength","Chart","sortCurrencies","ChartWithData","_ref","
|
|
1
|
+
{"version":3,"file":"ChartsWithData.js","names":["React","useContext","useQuery","useLocale","ChartError","LastUpdated","Size","Spinner","SpinnerSize","ThemeContext","classnames","getCurrencyStrength","Chart","sortCurrencies","ChartWithData","_ref","currency","size","isDesktop","DESKTOP","lang","loading","data","error","fetchPolicy","showChart","currencyStrength","length","showError","currencyData","filter","item","slice","sort","createElement","Fragment","className","lg","map","key","values","strengthRelation","timestamp","updatedAt","labelCallback"],"sources":["../../../src/CurrencyStrengthWidget/ChartsWithData.tsx"],"sourcesContent":["import React, { useContext } from 'react';\nimport { useQuery } from '@apollo/client';\nimport { useLocale } from '@oanda/mono-i18n';\nimport {\n ChartError,\n LastUpdated,\n Size,\n Spinner,\n SpinnerSize,\n ThemeContext,\n} from '@oanda/labs-widget-common';\nimport classnames from 'classnames';\nimport { getCurrencyStrength } from '../gql/getCurrencyStrength';\nimport { GetCurrencyStrengthQuery } from '../gql/types/graphql';\nimport { Chart } from './components/Chart';\nimport { sortCurrencies } from './components/Chart/formatters';\nimport { WidgetProps } from './types';\n\nconst ChartWithData = ({ currency }: WidgetProps) => {\n const { size } = useContext(ThemeContext);\n const isDesktop = size === Size.DESKTOP;\n const { lang } = useLocale();\n const { loading, data, error } = useQuery<GetCurrencyStrengthQuery>(getCurrencyStrength, {\n fetchPolicy: 'cache-and-network',\n });\n\n const showChart = data?.currencyStrength && data?.currencyStrength?.length > 0;\n const showError = data?.currencyStrength?.length === 0 || error;\n\n const currencyData = currency\n ? data?.currencyStrength?.filter((item) => item.currency === currency)\n : data?.currencyStrength?.slice().sort(sortCurrencies);\n\n return (\n <>\n {loading\n && (\n <div className={classnames('lw-flex lw-w-full lw-items-center lw-border lw-border-solid lw-border-border-primary', {\n 'lw-h-[461px]': !currency,\n 'lw-h-[135px]': currency,\n })}\n >\n <Spinner size={SpinnerSize.lg} />\n </div>\n )}\n {!loading && showChart && (\n <div\n data-testid=\"currency-strength-chart-wrapper\"\n className={classnames('lw-grid lw-place-content-center lw-gap-7', {\n 'lw-grid-cols-3 ': isDesktop && !currency,\n 'lw-grid-cols-1': !isDesktop || currency,\n })}\n >\n {currencyData && currencyData.map((item) => (\n <div key={item.currency} className=\"lw-flex lw-h-[135px] lw-flex-1 lw-items-center lw-justify-center\">\n <Chart\n currency={item.currency}\n values={item.strengthRelation?.slice().sort(sortCurrencies)!}\n />\n </div>\n ))}\n </div>\n )}\n {!loading && showError && (\n <div className={classnames('lw-flex lw-w-full lw-items-center lw-border lw-border-solid lw-border-border-primary', {\n 'lw-h-[425px]': !currency,\n 'lw-h-[135px]': currency,\n })}\n >\n <ChartError />\n </div>\n )}\n {!loading && !showError && (\n <div className=\"lw-mt-2 lw-h-8\">\n <LastUpdated timestamp={data?.currencyStrength![0]?.updatedAt} labelCallback={lang} />\n </div>\n )}\n </>\n );\n};\n\nexport { ChartWithData };\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,UAAU,QAAQ,OAAO;AACzC,SAASC,QAAQ,QAAQ,gBAAgB;AACzC,SAASC,SAAS,QAAQ,kBAAkB;AAC5C,SACEC,UAAU,EACVC,WAAW,EACXC,IAAI,EACJC,OAAO,EACPC,WAAW,EACXC,YAAY,QACP,2BAA2B;AAClC,OAAOC,UAAU,MAAM,YAAY;AACnC,SAASC,mBAAmB,QAAQ,4BAA4B;AAEhE,SAASC,KAAK,QAAQ,oBAAoB;AAC1C,SAASC,cAAc,QAAQ,+BAA+B;AAG9D,MAAMC,aAAa,GAAGC,IAAA,IAA+B;EAAA,IAA9B;IAAEC;EAAsB,CAAC,GAAAD,IAAA;EAC9C,MAAM;IAAEE;EAAK,CAAC,GAAGhB,UAAU,CAACQ,YAAY,CAAC;EACzC,MAAMS,SAAS,GAAGD,IAAI,KAAKX,IAAI,CAACa,OAAO;EACvC,MAAM;IAAEC;EAAK,CAAC,GAAGjB,SAAS,CAAC,CAAC;EAC5B,MAAM;IAAEkB,OAAO;IAAEC,IAAI;IAAEC;EAAM,CAAC,GAAGrB,QAAQ,CAA2BS,mBAAmB,EAAE;IACvFa,WAAW,EAAE;EACf,CAAC,CAAC;EAEF,MAAMC,SAAS,GAAGH,IAAI,EAAEI,gBAAgB,IAAIJ,IAAI,EAAEI,gBAAgB,EAAEC,MAAM,GAAG,CAAC;EAC9E,MAAMC,SAAS,GAAGN,IAAI,EAAEI,gBAAgB,EAAEC,MAAM,KAAK,CAAC,IAAIJ,KAAK;EAE/D,MAAMM,YAAY,GAAGb,QAAQ,GACzBM,IAAI,EAAEI,gBAAgB,EAAEI,MAAM,CAAEC,I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kC,aAAA,CAAC9B,UAAU,MAAE,CACV,CACN,EACA,CAACiB,OAAO,IAAI,CAACO,SAAS,IACrB5B,KAAA,CAAAkC,aAAA;IAAKE,SAAS,EAAC;EAAgB,GAC7BpC,KAAA,CAAAkC,aAAA,CAAC7B,WAAW;IAACqC,SAAS,EAAEpB,IAAI,EAAEI,gBAAgB,CAAE,CAAC,CAAC,EAAEiB,SAAU;IAACC,aAAa,EAAExB;EAAK,CAAE,CAClF,CAEP,CAAC;AAEP,CAAC;AAED,SAASN,aAAa","ignoreList":[]}
|
|
@@ -16,9 +16,9 @@ const Main = _ref => {
|
|
|
16
16
|
"data-testid": "currency-strength-wrapper"
|
|
17
17
|
}, React.createElement("div", {
|
|
18
18
|
className: "lw-mb-8 lw-flex lw-justify-center lw-font-sans lw-text-lg lw-font-bold"
|
|
19
|
-
}, React.createElement("span", null,
|
|
19
|
+
}, React.createElement("span", null, `${lang('daily')} (${lang('minute', {
|
|
20
20
|
count: 5
|
|
21
|
-
})
|
|
21
|
+
})})`)), React.createElement(ChartWithData, {
|
|
22
22
|
currency: currency
|
|
23
23
|
})));
|
|
24
24
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Main.js","names":["React","useContext","useLocale","ThemeContext","ChartWithData","Main","_ref","currency","lang","size","createElement","Fragment","className","
|
|
1
|
+
{"version":3,"file":"Main.js","names":["React","useContext","useLocale","ThemeContext","ChartWithData","Main","_ref","currency","lang","size","createElement","Fragment","className","count"],"sources":["../../../src/CurrencyStrengthWidget/Main.tsx"],"sourcesContent":["import React, { useContext } from 'react';\nimport { useLocale } from '@oanda/mono-i18n';\nimport { ThemeContext } from '@oanda/labs-widget-common';\nimport { ChartWithData } from './ChartsWithData';\nimport { WidgetProps } from './types';\n\nconst Main = ({ currency }: WidgetProps) => {\n const { lang } = useLocale();\n const { size } = useContext(ThemeContext);\n\n return (\n <>\n {size && (\n <div data-testid=\"currency-strength-wrapper\">\n <div className=\"lw-mb-8 lw-flex lw-justify-center lw-font-sans lw-text-lg lw-font-bold\">\n <span>{`${lang('daily')} (${lang('minute', { count: 5 })})`}</span>\n </div>\n <ChartWithData currency={currency} />\n </div>\n )}\n </>\n );\n};\n\nexport { Main };\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,UAAU,QAAQ,OAAO;AACzC,SAASC,SAAS,QAAQ,kBAAkB;AAC5C,SAASC,YAAY,QAAQ,2BAA2B;AACxD,SAASC,aAAa,QAAQ,kBAAkB;AAGhD,MAAMC,IAAI,GAAGC,IAAA,IAA+B;EAAA,IAA9B;IAAEC;EAAsB,CAAC,GAAAD,IAAA;EACrC,MAAM;IAAEE;EAAK,CAAC,GAAGN,SAAS,CAAC,CAAC;EAC5B,MAAM;IAAEO;EAAK,CAAC,GAAGR,UAAU,CAACE,YAAY,CAAC;EAEzC,OACEH,KAAA,CAAAU,aAAA,CAAAV,KAAA,CAAAW,QAAA,QACGF,IAAI,IACLT,KAAA,CAAAU,aAAA;IAAK,eAAY;EAA2B,GAC1CV,KAAA,CAAAU,aAAA;IAAKE,SAAS,EAAC;EAAwE,GACrFZ,KAAA,CAAAU,aAAA,eAAO,GAAGF,IAAI,CAAC,OAAO,CAAC,KAAKA,IAAI,CAAC,QAAQ,EAAE;IAAEK,KAAK,EAAE;EAAE,CAAC,CAAC,GAAU,CAC/D,CAAC,EACNb,KAAA,CAAAU,aAAA,CAACN,aAAa;IAACG,QAAQ,EAAEA;EAAS,CAAE,CACjC,CAEL,CAAC;AAEP,CAAC;AAED,SAASF,IAAI","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Chart.js","names":["React","useContext","ReactEChartsCore","echarts","BarChart","CanvasRenderer","GridSimpleComponent","GraphicComponent","TooltipComponent","TitleComponent","useLocale","Theme","ThemeContext","getChartTheme","CHART_HEIGHT","getOption","use","registerTheme","Dark","Light","Chart","_ref","values","currency","lang","isDark","createElement","theme","style","height","
|
|
1
|
+
{"version":3,"file":"Chart.js","names":["React","useContext","ReactEChartsCore","echarts","BarChart","CanvasRenderer","GridSimpleComponent","GraphicComponent","TooltipComponent","TitleComponent","useLocale","Theme","ThemeContext","getChartTheme","CHART_HEIGHT","getOption","use","registerTheme","Dark","Light","Chart","_ref","values","currency","lang","isDark","createElement","theme","style","height","width","option"],"sources":["../../../../../src/CurrencyStrengthWidget/components/Chart/Chart.tsx"],"sourcesContent":["import React, { useContext } from 'react';\nimport ReactEChartsCore from 'echarts-for-react/lib/core';\nimport * as echarts from 'echarts/core';\nimport { BarChart } from 'echarts/charts';\nimport { CanvasRenderer } from 'echarts/renderers';\nimport {\n GridSimpleComponent, GraphicComponent, TooltipComponent, TitleComponent,\n} from 'echarts/components';\nimport { useLocale } from '@oanda/mono-i18n';\nimport { Theme, ThemeContext, getChartTheme } from '@oanda/labs-widget-common';\nimport {\n CHART_HEIGHT,\n} from './constants';\nimport { getOption } from './getOption';\nimport { ChartProps } from './types';\n\necharts.use([\n GridSimpleComponent,\n GraphicComponent,\n TooltipComponent,\n TitleComponent,\n BarChart,\n CanvasRenderer,\n]);\n\necharts.registerTheme('dark_theme', getChartTheme(Theme.Dark));\necharts.registerTheme('light_theme', getChartTheme(Theme.Light));\n\nconst Chart = ({ values, currency }: ChartProps) => {\n const { lang } = useLocale();\n const { isDark } = useContext(ThemeContext);\n\n return (\n <ReactEChartsCore\n echarts={echarts}\n theme={isDark ? 'dark_theme' : 'light_theme'}\n style={{\n height: `${CHART_HEIGHT}px`,\n width: '100%',\n }}\n option={getOption({\n values, currency, lang, isDark,\n })}\n />\n );\n};\n\nexport { Chart };\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,UAAU,QAAQ,OAAO;AACzC,OAAOC,gBAAgB,MAAM,4BAA4B;AACzD,OAAO,KAAKC,OAAO,MAAM,cAAc;AACvC,SAASC,QAAQ,QAAQ,gBAAgB;AACzC,SAASC,cAAc,QAAQ,mBAAmB;AAClD,SACEC,mBAAmB,EAAEC,gBAAgB,EAAEC,gBAAgB,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|
|
12
|
+
<div style="margin-bottom:5px;">${currency} ${lang('vs')} ${name}</div>
|
|
13
|
+
<div style="display:flex;align-items:center;">${marker} ${value}%</div>
|
|
14
|
+
</div>`;
|
|
11
15
|
};
|
|
12
16
|
const sortCurrencies = (a, b) => instrumentsConfig.indexOf(a.currency) - instrumentsConfig.indexOf(b.currency);
|
|
13
17
|
export { tooltipFormatter, sortCurrencies };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"formatters.js","names":["instrumentsConfig","tooltipFormatter","_ref","marker","name","value","currency","lang","
|
|
1
|
+
{"version":3,"file":"formatters.js","names":["instrumentsConfig","tooltipFormatter","_ref","marker","name","value","currency","lang","sortCurrencies","a","b","indexOf"],"sources":["../../../../../src/CurrencyStrengthWidget/components/Chart/formatters.ts"],"sourcesContent":["import { instrumentsConfig } from './constants';\nimport { SortingParams, TooltipFormatterParams } from './types';\n\nconst tooltipFormatter = ({\n marker,\n name,\n value,\n currency,\n lang,\n}: TooltipFormatterParams) => `\n<div>\n <div style=\"margin-bottom:5px;\">${currency} ${lang('vs')} ${name}</div>\n <div style=\"display:flex;align-items:center;\">${marker} ${value}%</div>\n</div>`;\n\nconst sortCurrencies = (a: SortingParams, b: SortingParams) => instrumentsConfig\n .indexOf(a.currency) - instrumentsConfig.indexOf(b.currency);\n\nexport {\n tooltipFormatter,\n sortCurrencies,\n};\n"],"mappings":"AAAA,SAASA,iBAAiB,QAAQ,aAAa;AAG/C,MAAMC,gBAAgB,GAAGC,IAAA;EAAA,IAAC;IACxBC,MAAM;IACNC,IAAI;IACJC,KAAK;IACLC,QAAQ;IACRC;EACsB,CAAC,GAAAL,IAAA;EAAA,OAAK;AAC9B;AACA,oCAAoCI,QAAQ,IAAIC,IAAI,CAAC,IAAI,CAAC,IAAIH,IAAI;AAClE,kDAAkDD,MAAM,IAAIE,KAAK;AACjE,OAAO;AAAA;AAEP,MAAMG,cAAc,GAAGA,CAACC,CAAgB,EAAEC,CAAgB,KAAKV,iBAAiB,CAC7EW,OAAO,CAACF,CAAC,CAACH,QAAQ,CAAC,GAAGN,iBAAiB,CAACW,OAAO,CAACD,CAAC,CAACJ,QAAQ,CAAC;AAE9D,SACEL,gBAAgB,EAChBO,cAAc","ignoreList":[]}
|
|
@@ -22,7 +22,7 @@ export const getOption = _ref => {
|
|
|
22
22
|
animation: false,
|
|
23
23
|
title: {
|
|
24
24
|
left: 'center',
|
|
25
|
-
text:
|
|
25
|
+
text: `${currency} vs`,
|
|
26
26
|
textStyle: {
|
|
27
27
|
fontSize: 12,
|
|
28
28
|
lineHeight: 20,
|
|
@@ -33,8 +33,8 @@ export const getOption = _ref => {
|
|
|
33
33
|
name: 'main-grid',
|
|
34
34
|
top: '30px',
|
|
35
35
|
right: '0px',
|
|
36
|
-
left:
|
|
37
|
-
bottom:
|
|
36
|
+
left: `${Y_LABEL_SIZE}px`,
|
|
37
|
+
bottom: `${X_LABEL_SIZE}px`
|
|
38
38
|
}],
|
|
39
39
|
graphic: [...gridLines],
|
|
40
40
|
tooltip: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getOption.js","names":["getGridLines","CHART_HEIGHT","CHART_WIDTH","X_LABEL_SIZE","Y_LABEL_SIZE","darkBarColors","lightBarColors","tooltipFormatter","getOption","_ref","values","currency","isDark","lang","currencies","map","item","percentages","percentage","barColors","gridLines","chartWidth","chartHeight","xLabelsSize","yLabelSize","animation","title","left","text","
|
|
1
|
+
{"version":3,"file":"getOption.js","names":["getGridLines","CHART_HEIGHT","CHART_WIDTH","X_LABEL_SIZE","Y_LABEL_SIZE","darkBarColors","lightBarColors","tooltipFormatter","getOption","_ref","values","currency","isDark","lang","currencies","map","item","percentages","percentage","barColors","gridLines","chartWidth","chartHeight","xLabelsSize","yLabelSize","animation","title","left","text","textStyle","fontSize","lineHeight","fontWeight","grid","name","top","right","bottom","graphic","tooltip","trigger","formatter","_ref2","marker","value","axisPointer","axis","extraCssText","xAxis","type","data","axisTick","show","axisLine","splitLine","axisLabel","yAxis","position","min","Math","floor","max","ceil","interval","series","emphasis","disabled","itemStyle","opacity","color","_ref3","positive","negative","zero"],"sources":["../../../../../src/CurrencyStrengthWidget/components/Chart/getOption.ts"],"sourcesContent":["import { getGridLines } from '@oanda/labs-widget-common';\nimport {\n CHART_HEIGHT,\n CHART_WIDTH,\n X_LABEL_SIZE,\n Y_LABEL_SIZE,\n darkBarColors,\n lightBarColors,\n} from './constants';\nimport { GetOptionProps } from './types';\nimport { tooltipFormatter } from './formatters';\n\nexport const getOption = ({\n values, currency, isDark, lang,\n}: GetOptionProps) => {\n const currencies = values.map((item) => item.currency);\n const percentages = values.map((item) => item.percentage);\n const barColors = isDark ? darkBarColors : lightBarColors;\n\n const gridLines = getGridLines({\n isDark,\n chartWidth: CHART_WIDTH,\n chartHeight: CHART_HEIGHT,\n xLabelsSize: -2,\n yLabelSize: -3,\n });\n\n return {\n animation: false,\n title: {\n left: 'center',\n text: `${currency} vs`,\n textStyle: {\n fontSize: 12,\n lineHeight: 20,\n fontWeight: 400,\n },\n },\n grid: [\n {\n name: 'main-grid',\n top: '30px',\n right: '0px',\n left: `${Y_LABEL_SIZE}px`,\n bottom: `${X_LABEL_SIZE}px`,\n },\n ],\n graphic: [\n ...gridLines,\n ],\n tooltip: {\n trigger: 'axis',\n formatter: (\n [{ marker, name, value }]\n : { marker: string, name: string, value: number }[],\n ) => tooltipFormatter({\n lang,\n currency,\n marker,\n name,\n value,\n }),\n axisPointer: {\n axis: 'x',\n },\n extraCssText: 'z-index: 1',\n },\n xAxis: {\n type: 'category',\n data: currencies,\n axisTick: { show: false },\n axisLine: { show: false },\n splitLine: { show: false },\n axisLabel: {\n fontSize: 10,\n },\n },\n yAxis: {\n type: 'value',\n position: 'left',\n min: Math.floor(Math.min(...percentages)),\n max: Math.ceil(Math.max(...percentages)),\n interval: 1,\n axisLine: { show: false },\n axisTick: { show: false },\n axisLabel: {\n formatter: '{value}%',\n fontSize: 10,\n },\n },\n series: [\n {\n data: percentages,\n type: 'bar',\n emphasis: {\n disabled: true,\n },\n itemStyle: {\n opacity: 1,\n color: ({ data } : { data: number }) => {\n if (data > 0) {\n return barColors.positive;\n }\n if (data < 0) {\n return barColors.negative;\n }\n return barColors.zero;\n },\n },\n },\n ],\n };\n};\n"],"mappings":"AAAA,SAASA,YAAY,QAAQ,2BAA2B;AACxD,SACEC,YAAY,EACZC,WAAW,EACXC,YAAY,EACZC,YAAY,EACZC,aAAa,EACbC,cAAc,QACT,aAAa;AAEpB,SAASC,gBAAgB,QAAQ,cAAc;AAE/C,OAAO,MAAMC,SAAS,GAAGC,IAAA,IAEH;EAAA,IAFI;IACxBC,MAAM;IAAEC,QAAQ;IAAEC,MAAM;IAAEC;EACZ,CAAC,GAAAJ,IAAA;EACf,MAAMK,UAAU,GAAGJ,MAAM,CAACK,GAAG,CAAEC,IAAI,IAAKA,IAAI,CAACL,QAAQ,CAAC;EACtD,MAAMM,WAAW,GAAGP,MAAM,CAACK,GAAG,CAAEC,IAAI,IAAKA,IAAI,CAACE,UAAU,CAAC;EACzD,MAAMC,SAAS,GAAGP,MAAM,GAAGP,aAAa,GAAGC,cAAc;EAEzD,MAAMc,SAAS,GAAGpB,YAAY,CAAC;IAC7BY,MAAM;IACNS,UAAU,EAAEnB,WAAW;IACvBoB,WAAW,EAAErB,YAAY;IACzBsB,WAAW,EAAE,CAAC,CAAC;IACfC,UAAU,EAAE,CAAC;EACf,CAAC,CAAC;EAEF,OAAO;IACLC,SAAS,EAAE,KAAK;IAChBC,KAAK,EAAE;MACLC,IAAI,EAAE,QAAQ;MACdC,IAAI,EAAE,GAAGjB,QAAQ,KAAK;MACtBkB,SAAS,EAAE;QACTC,QAAQ,EAAE,EAAE;QACZC,UAAU,EAAE,EAAE;QACdC,UAAU,EAAE;MACd;IACF,CAAC;IACDC,IAAI,EAAE,CACJ;MACEC,IAAI,EAAE,WAAW;MACjBC,GAAG,EAAE,MAAM;MACXC,KAAK,EAAE,KAAK;MACZT,IAAI,EAAE,G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,IAAI,EAAEjC,WAAW;MACjBgC,IAAI,EAAE,KAAK;MACXgB,QAAQ,EAAE;QACRC,QAAQ,EAAE;MACZ,CAAC;MACDC,SAAS,EAAE;QACTC,OAAO,EAAE,CAAC;QACVC,KAAK,EAAEC,KAAA,IAAiC;UAAA,IAAhC;YAAEpB;UAAwB,CAAC,GAAAoB,KAAA;UACjC,IAAIpB,IAAI,GAAG,CAAC,EAAE;YACZ,OAAO/B,SAAS,CAACoD,QAAQ;UAC3B;UACA,IAAIrB,IAAI,GAAG,CAAC,EAAE;YACZ,OAAO/B,SAAS,CAACqD,QAAQ;UAC3B;UACA,OAAOrD,SAAS,CAACsD,IAAI;QACvB;MACF;IACF,CAAC;EAEL,CAAC;AACH,CAAC","ignoreList":[]}
|
|
@@ -1,6 +1,15 @@
|
|
|
1
|
-
var _templateObject;
|
|
2
|
-
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
3
1
|
import { gql } from '@apollo/client';
|
|
4
|
-
const getCurrencyStrength = gql
|
|
2
|
+
const getCurrencyStrength = gql`
|
|
3
|
+
query GetCurrencyStrength {
|
|
4
|
+
currencyStrength {
|
|
5
|
+
currency
|
|
6
|
+
strengthRelation {
|
|
7
|
+
currency
|
|
8
|
+
percentage
|
|
9
|
+
}
|
|
10
|
+
updatedAt
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
`;
|
|
5
14
|
export { getCurrencyStrength };
|
|
6
15
|
//# sourceMappingURL=getCurrencyStrength.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getCurrencyStrength.js","names":["gql","getCurrencyStrength"
|
|
1
|
+
{"version":3,"file":"getCurrencyStrength.js","names":["gql","getCurrencyStrength"],"sources":["../../../src/gql/getCurrencyStrength.ts"],"sourcesContent":["import { gql } from '@apollo/client';\n\nconst getCurrencyStrength = gql`\n query GetCurrencyStrength {\n currencyStrength {\n currency\n strengthRelation {\n currency\n percentage\n }\n updatedAt\n }\n }\n`;\n\nexport { getCurrencyStrength };\n"],"mappings":"AAAA,SAASA,GAAG,QAAQ,gBAAgB;AAEpC,MAAMC,mBAAmB,GAAGD,GAAG;AAC/B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AAED,SAASC,mBAAmB","ignoreList":[]}
|
|
@@ -5,11 +5,10 @@ export function makeFragmentData(data, _fragment) {
|
|
|
5
5
|
return data;
|
|
6
6
|
}
|
|
7
7
|
export function isFragmentReady(queryNode, fragmentNode, data) {
|
|
8
|
-
|
|
9
|
-
const deferredFields = (_meta__ = queryNode.__meta__) === null || _meta__ === void 0 ? void 0 : _meta__.deferredFields;
|
|
8
|
+
const deferredFields = queryNode.__meta__?.deferredFields;
|
|
10
9
|
if (!deferredFields) return true;
|
|
11
10
|
const fragDef = fragmentNode.definitions[0];
|
|
12
|
-
const fragName = fragDef
|
|
11
|
+
const fragName = fragDef?.name?.value;
|
|
13
12
|
const fields = fragName && deferredFields[fragName] || [];
|
|
14
13
|
return fields.length > 0 && fields.every(field => data && field in data);
|
|
15
14
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fragment-masking.js","names":["useFragment","_documentNode","fragmentType","makeFragmentData","data","_fragment","isFragmentReady","queryNode","fragmentNode","
|
|
1
|
+
{"version":3,"file":"fragment-masking.js","names":["useFragment","_documentNode","fragmentType","makeFragmentData","data","_fragment","isFragmentReady","queryNode","fragmentNode","deferredFields","__meta__","fragDef","definitions","fragName","name","value","fields","length","every","field"],"sources":["../../../../src/gql/types/fragment-masking.ts"],"sourcesContent":["import { ResultOf, DocumentTypeDecoration, TypedDocumentNode } from '@graphql-typed-document-node/core';\nimport { FragmentDefinitionNode } from 'graphql';\nimport { Incremental } from './graphql';\n\n\nexport type FragmentType<TDocumentType extends DocumentTypeDecoration<any, any>> = TDocumentType extends DocumentTypeDecoration<\n infer TType,\n any\n>\n ? [TType] extends [{ ' $fragmentName'?: infer TKey }]\n ? TKey extends string\n ? { ' $fragmentRefs'?: { [key in TKey]: TType } }\n : never\n : never\n : never;\n\n// return non-nullable if `fragmentType` is non-nullable\nexport function useFragment<TType>(\n _documentNode: DocumentTypeDecoration<TType, any>,\n fragmentType: FragmentType<DocumentTypeDecoration<TType, any>>\n): TType;\n// return nullable if `fragmentType` is nullable\nexport function useFragment<TType>(\n _documentNode: DocumentTypeDecoration<TType, any>,\n fragmentType: FragmentType<DocumentTypeDecoration<TType, any>> | null | undefined\n): TType | null | undefined;\n// return array of non-nullable if `fragmentType` is array of non-nullable\nexport function useFragment<TType>(\n _documentNode: DocumentTypeDecoration<TType, any>,\n fragmentType: ReadonlyArray<FragmentType<DocumentTypeDecoration<TType, any>>>\n): ReadonlyArray<TType>;\n// return array of nullable if `fragmentType` is array of nullable\nexport function useFragment<TType>(\n _documentNode: DocumentTypeDecoration<TType, any>,\n fragmentType: ReadonlyArray<FragmentType<DocumentTypeDecoration<TType, any>>> | null | undefined\n): ReadonlyArray<TType> | null | undefined;\nexport function useFragment<TType>(\n _documentNode: DocumentTypeDecoration<TType, any>,\n fragmentType: FragmentType<DocumentTypeDecoration<TType, any>> | ReadonlyArray<FragmentType<DocumentTypeDecoration<TType, any>>> | null | undefined\n): TType | ReadonlyArray<TType> | null | undefined {\n return fragmentType as any;\n}\n\n\nexport function makeFragmentData<\n F extends DocumentTypeDecoration<any, any>,\n FT extends ResultOf<F>\n>(data: FT, _fragment: F): FragmentType<F> {\n return data as FragmentType<F>;\n}\nexport function isFragmentReady<TQuery, TFrag>(\n queryNode: DocumentTypeDecoration<TQuery, any>,\n fragmentNode: TypedDocumentNode<TFrag>,\n data: FragmentType<TypedDocumentNode<Incremental<TFrag>, any>> | null | undefined\n): data is FragmentType<typeof fragmentNode> {\n const deferredFields = (queryNode as { __meta__?: { deferredFields: Record<string, (keyof TFrag)[]> } }).__meta__\n ?.deferredFields;\n\n if (!deferredFields) return true;\n\n const fragDef = fragmentNode.definitions[0] as FragmentDefinitionNode | undefined;\n const fragName = fragDef?.name?.value;\n\n const fields = (fragName && deferredFields[fragName]) || [];\n return fields.length > 0 && fields.every(field => data && field in data);\n}\n"],"mappings":"AAoCA,OAAO,SAASA,WAAWA,CACzBC,aAAiD,EACjDC,YAAmJ,EAClG;EACjD,OAAOA,YAAY;AACrB;AAGA,OAAO,SAASC,gBAAgBA,CAG9BC,IAAQ,EAAEC,SAAY,EAAmB;EACzC,OAAOD,IAAI;AACb;AACA,OAAO,SAASE,eAAeA,CAC7BC,SAA8C,EAC9CC,YAAsC,EACtCJ,IAAiF,EACtC;EAC3C,MAAMK,cAAc,GAAIF,SAAS,CAAwEG,QAAQ,EAC7GD,cAAc;EAElB,IAAI,CAACA,cAAc,EAAE,OAAO,IAAI;EAEhC,MAAME,OAAO,GAAGH,YAAY,CAACI,WAAW,CAAC,CAAC,CAAuC;EACjF,MAAMC,QAAQ,GAAGF,OAAO,EAAEG,IAAI,EAAEC,KAAK;EAErC,MAAMC,MAAM,GAAIH,QAAQ,IAAIJ,cAAc,CAACI,QAAQ,CAAC,IAAK,EAAE;EAC3D,OAAOG,MAAM,CAACC,MAAM,GAAG,CAAC,IAAID,MAAM,CAACE,KAAK,CAACC,KAAK,IAAIf,IAAI,IAAIe,KAAK,IAAIf,IAAI,CAAC;AAC1E","ignoreList":[]}
|
|
@@ -3,7 +3,6 @@ const documents = {
|
|
|
3
3
|
"\n query GetCurrencyStrength {\n currencyStrength {\n currency\n strengthRelation {\n currency\n percentage\n }\n updatedAt\n }\n }\n": types.GetCurrencyStrengthDocument
|
|
4
4
|
};
|
|
5
5
|
export function graphql(source) {
|
|
6
|
-
|
|
7
|
-
return (_source = documents[source]) !== null && _source !== void 0 ? _source : {};
|
|
6
|
+
return documents[source] ?? {};
|
|
8
7
|
}
|
|
9
8
|
//# sourceMappingURL=gql.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gql.js","names":["types","documents","GetCurrencyStrengthDocument","graphql","source"
|
|
1
|
+
{"version":3,"file":"gql.js","names":["types","documents","GetCurrencyStrengthDocument","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 GetCurrencyStrength {\\n currencyStrength {\\n currency\\n strengthRelation {\\n currency\\n percentage\\n }\\n updatedAt\\n }\\n }\\n\": types.GetCurrencyStrengthDocument,\n};\n\n/**\n * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.\n *\n *\n * @example\n * ```ts\n * const query = graphql(`query GetUser($id: ID!) { user(id: $id) { name } }`);\n * ```\n *\n * The query argument is unknown!\n * Please regenerate the types.\n */\nexport function graphql(source: string): unknown;\n\n/**\n * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.\n */\nexport function graphql(source: \"\\n query GetCurrencyStrength {\\n currencyStrength {\\n currency\\n strengthRelation {\\n currency\\n percentage\\n }\\n updatedAt\\n }\\n }\\n\"): (typeof documents)[\"\\n query GetCurrencyStrength {\\n currencyStrength {\\n currency\\n strengthRelation {\\n currency\\n percentage\\n }\\n updatedAt\\n }\\n }\\n\"];\n\nexport function graphql(source: string) {\n return (documents as any)[source] ?? {};\n}\n\nexport type DocumentType<TDocumentNode extends DocumentNode<any, any>> = TDocumentNode extends DocumentNode< infer TType, any> ? TType : never;"],"mappings":"AACA,OAAO,KAAKA,KAAK,MAAM,WAAW;AAalC,MAAMC,SAAS,GAAG;EACd,iLAAiL,EAAED,KAAK,CAACE;AAC7L,CAAC;AAqBD,OAAO,SAASC,OAAOA,CAACC,MAAc,EAAE;EACtC,OAAQH,SAAS,CAASG,MAAM,CAAC,IAAI,CAAC,CAAC;AACzC","ignoreList":[]}
|
|
@@ -381,6 +381,4 @@ export type GetCurrencyStrengthQuery = {
|
|
|
381
381
|
}> | null;
|
|
382
382
|
}> | null;
|
|
383
383
|
};
|
|
384
|
-
export declare const GetCurrencyStrengthDocument: DocumentNode<GetCurrencyStrengthQuery,
|
|
385
|
-
[key: string]: never;
|
|
386
|
-
}>>;
|
|
384
|
+
export declare const GetCurrencyStrengthDocument: DocumentNode<GetCurrencyStrengthQuery, GetCurrencyStrengthQueryVariables>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oanda/labs-currency-strength-widget",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.53",
|
|
4
4
|
"description": "Labs Currency Strength Widget",
|
|
5
5
|
"main": "dist/main/index.js",
|
|
6
6
|
"module": "dist/module/index.js",
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"license": "UNLICENSED",
|
|
14
14
|
"dependencies": {
|
|
15
15
|
"@apollo/client": "3.9.9",
|
|
16
|
-
"@oanda/labs-widget-common": "^1.0.
|
|
16
|
+
"@oanda/labs-widget-common": "^1.0.135",
|
|
17
17
|
"@oanda/mono-i18n": "10.0.1",
|
|
18
18
|
"echarts": "5.5.0",
|
|
19
19
|
"echarts-for-react": "3.0.2",
|
|
@@ -24,5 +24,5 @@
|
|
|
24
24
|
"@graphql-codegen/client-preset": "4.1.0",
|
|
25
25
|
"@graphql-codegen/typescript": "4.0.1"
|
|
26
26
|
},
|
|
27
|
-
"gitHead": "
|
|
27
|
+
"gitHead": "4d99162bb8893cb1da6fd9362334b0c8a69f9cb6"
|
|
28
28
|
}
|