@oanda/labs-currency-power-balance-widget 1.0.19 → 1.0.20
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 +84 -0
- package/dist/main/CurrencyPowerBalanceWidget/CurrencyPowerBalance.js +5 -2
- package/dist/main/CurrencyPowerBalanceWidget/CurrencyPowerBalance.js.map +1 -1
- package/dist/main/CurrencyPowerBalanceWidget/render.js +12 -1
- package/dist/main/CurrencyPowerBalanceWidget/render.js.map +1 -1
- package/dist/main/CurrencyPowerBalanceWidget/types.js.map +1 -1
- package/dist/module/CurrencyPowerBalanceWidget/CurrencyPowerBalance.js +6 -3
- package/dist/module/CurrencyPowerBalanceWidget/CurrencyPowerBalance.js.map +1 -1
- package/dist/module/CurrencyPowerBalanceWidget/render.js +12 -1
- package/dist/module/CurrencyPowerBalanceWidget/render.js.map +1 -1
- package/dist/module/CurrencyPowerBalanceWidget/types.js.map +1 -1
- package/dist/types/CurrencyPowerBalanceWidget/CurrencyPowerBalance.d.ts +1 -1
- package/dist/types/CurrencyPowerBalanceWidget/types.d.ts +1 -0
- package/package.json +3 -3
- package/src/CurrencyPowerBalanceWidget/CurrencyPowerBalance.tsx +7 -3
- package/src/CurrencyPowerBalanceWidget/render.tsx +10 -1
- package/src/CurrencyPowerBalanceWidget/types.ts +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,90 @@
|
|
|
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.20 (2024-02-05)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
## 1.0.80 (2024-02-05)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
## 1.0.79 (2024-02-05)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
## 1.0.78 (2024-01-30)
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
## 1.0.77 (2024-01-25)
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
## 1.0.76 (2024-01-25)
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
## 1.0.75 (2024-01-22)
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
## 1.0.74 (2024-01-22)
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
## 1.0.73 (2024-01-22)
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
## 1.0.72 (2024-01-19)
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
## 1.0.71 (2024-01-18)
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
## 1.0.70 (2024-01-17)
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
## 1.0.69 (2024-01-17)
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
## 1.0.68 (2024-01-15)
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
## 1.0.67 (2024-01-15)
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
## 1.0.66 (2024-01-12)
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
## 1.0.65 (2024-01-11)
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
## 1.0.64 (2024-01-11)
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
## 1.0.63 (2024-01-11)
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
## 1.0.62 (2024-01-10)
|
|
83
|
+
|
|
84
|
+
**Note:** Version bump only for package @oanda/labs-currency-power-balance-widget
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
|
|
6
90
|
## 1.0.19 (2024-02-05)
|
|
7
91
|
|
|
8
92
|
|
|
@@ -15,7 +15,8 @@ const CurrencyPowerBalance = _ref => {
|
|
|
15
15
|
let {
|
|
16
16
|
graphqlUrl,
|
|
17
17
|
theme,
|
|
18
|
-
locale
|
|
18
|
+
locale,
|
|
19
|
+
isParamError
|
|
19
20
|
} = _ref;
|
|
20
21
|
const client = new _client.ApolloClient({
|
|
21
22
|
uri: graphqlUrl,
|
|
@@ -28,7 +29,9 @@ const CurrencyPowerBalance = _ref => {
|
|
|
28
29
|
translations: _translations.translations
|
|
29
30
|
}, _react.default.createElement(_client.ApolloProvider, {
|
|
30
31
|
client: client
|
|
31
|
-
}, _react.default.createElement(
|
|
32
|
+
}, isParamError ? _react.default.createElement("div", {
|
|
33
|
+
className: "lw-flex lw-h-[425px] lw-w-full lw-items-center lw-border lw-border-solid lw-border-border-primary"
|
|
34
|
+
}, _react.default.createElement(_labsWidgetCommon.ChartError, null)) : _react.default.createElement(_Main.Main, null))));
|
|
32
35
|
};
|
|
33
36
|
exports.CurrencyPowerBalance = CurrencyPowerBalance;
|
|
34
37
|
//# sourceMappingURL=CurrencyPowerBalance.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CurrencyPowerBalance.js","names":["_react","_interopRequireDefault","require","_client","_labsWidgetCommon","_monoI18n","_Main","_translations","obj","__esModule","default","CurrencyPowerBalance","_ref","graphqlUrl","theme","locale","client","ApolloClient","uri","cache","InMemoryCache","createElement","ThemeProvider","LocaleProvider","getLocale","translations","ApolloProvider","Main","exports"],"sources":["../../../src/CurrencyPowerBalanceWidget/CurrencyPowerBalance.tsx"],"sourcesContent":["import React from 'react';\nimport { ApolloClient, InMemoryCache, ApolloProvider } from '@apollo/client';\nimport { ThemeProvider, getLocale } from '@oanda/labs-widget-common';\nimport { LocaleProvider } from '@oanda/mono-i18n';\nimport { Main } from './Main';\nimport { CurrencyPowerBalanceConfig } from './types';\nimport { translations } from '../translations';\n\nconst CurrencyPowerBalance = ({\n graphqlUrl, theme, locale,\n}: CurrencyPowerBalanceConfig) => {\n const client = new ApolloClient({\n uri: graphqlUrl,\n cache: new InMemoryCache(),\n });\n\n return (\n <ThemeProvider theme={theme}>\n <LocaleProvider locale={getLocale(locale)} translations={translations}>\n <ApolloProvider client={client}>\n <
|
|
1
|
+
{"version":3,"file":"CurrencyPowerBalance.js","names":["_react","_interopRequireDefault","require","_client","_labsWidgetCommon","_monoI18n","_Main","_translations","obj","__esModule","default","CurrencyPowerBalance","_ref","graphqlUrl","theme","locale","isParamError","client","ApolloClient","uri","cache","InMemoryCache","createElement","ThemeProvider","LocaleProvider","getLocale","translations","ApolloProvider","className","ChartError","Main","exports"],"sources":["../../../src/CurrencyPowerBalanceWidget/CurrencyPowerBalance.tsx"],"sourcesContent":["import React from 'react';\nimport { ApolloClient, InMemoryCache, ApolloProvider } from '@apollo/client';\nimport { ChartError, ThemeProvider, getLocale } from '@oanda/labs-widget-common';\nimport { LocaleProvider } from '@oanda/mono-i18n';\nimport { Main } from './Main';\nimport { CurrencyPowerBalanceConfig } from './types';\nimport { translations } from '../translations';\n\nconst CurrencyPowerBalance = ({\n graphqlUrl, theme, locale, isParamError,\n}: CurrencyPowerBalanceConfig) => {\n const client = new ApolloClient({\n uri: graphqlUrl,\n cache: new InMemoryCache(),\n });\n\n return (\n <ThemeProvider theme={theme}>\n <LocaleProvider locale={getLocale(locale)} translations={translations}>\n <ApolloProvider client={client}>\n {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 />}\n </ApolloProvider>\n </LocaleProvider>\n </ThemeProvider>\n );\n};\n\nexport { CurrencyPowerBalance };\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,iBAAA,GAAAF,OAAA;AACA,IAAAG,SAAA,GAAAH,OAAA;AACA,IAAAI,KAAA,GAAAJ,OAAA;AAEA,IAAAK,aAAA,GAAAL,OAAA;AAA+C,SAAAD,uBAAAO,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAE/C,MAAMG,oBAAoB,GAAGC,IAAA,IAEK;EAAA,IAFJ;IAC5BC,UAAU;IAAEC,KAAK;IAAEC,MAAM;IAAEC;EACD,CAAC,GAAAJ,IAAA;EAC3B,MAAMK,MAAM,GAAG,IAAIC,oBAAY,CAAC;IAC9BC,GAAG,EAAEN,UAAU;IACfO,KAAK,EAAE,IAAIC,qBAAa,CAAC;EAC3B,CAAC,CAAC;EAEF,OACErB,MAAA,CAAAU,OAAA,CAAAY,aAAA,CAAClB,iBAAA,CAAAmB,aAAa;IAACT,KAAK,EAAEA;EAAM,GAC1Bd,MAAA,CAAAU,OAAA,CAAAY,aAAA,CAACjB,SAAA,CAAAmB,cAAc;IAACT,MAAM,EAAE,IAAAU,2BAAS,EAACV,MAAM,CAAE;IAACW,YAAY,EAAEA;EAAa,GACpE1B,MAAA,CAAAU,OAAA,CAAAY,aAAA,CAACnB,OAAA,CAAAwB,cAAc;IAACV,MAAM,EAAEA;EAAO,GAC5BD,YAAY,GACXhB,MAAA,CAAAU,OAAA,CAAAY,aAAA;IAAKM,SAAS,EAAC;EAAmG,GAChH5B,MAAA,CAAAU,OAAA,CAAAY,aAAA,CAAClB,iBAAA,CAAAyB,UAAU,MAAE,CACV,CAAC,GACJ7B,MAAA,CAAAU,OAAA,CAAAY,aAAA,CAAChB,KAAA,CAAAwB,IAAI,MAAE,CACG,CACF,CACH,CAAC;AAEpB,CAAC;AAACC,OAAA,CAAApB,oBAAA,GAAAA,oBAAA"}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
var _react = _interopRequireDefault(require("react"));
|
|
4
4
|
var _reactDom = require("react-dom");
|
|
5
|
+
var _labsWidgetCommon = require("@oanda/labs-widget-common");
|
|
5
6
|
var _CurrencyPowerBalance = require("./CurrencyPowerBalance");
|
|
6
7
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
7
8
|
const {
|
|
@@ -20,10 +21,20 @@ if (currencyPowerBalanceParamsElements.length > 0) {
|
|
|
20
21
|
const {
|
|
21
22
|
locale
|
|
22
23
|
} = JSON.parse(params);
|
|
24
|
+
const isParamError = (0, _labsWidgetCommon.validateToolParams)({
|
|
25
|
+
locale
|
|
26
|
+
}, [{
|
|
27
|
+
name: 'locale',
|
|
28
|
+
valueCheck: value => value.split('-')[0] === 'en' || value.split('-')[0] === 'zh'
|
|
29
|
+
}, {
|
|
30
|
+
name: 'graphqlUrl',
|
|
31
|
+
valueCheck: value => !!value
|
|
32
|
+
}]);
|
|
23
33
|
(0, _reactDom.render)(_react.default.createElement(_CurrencyPowerBalance.CurrencyPowerBalance, {
|
|
24
34
|
graphqlUrl: graphqlUrl,
|
|
25
35
|
locale: locale,
|
|
26
|
-
theme: mode
|
|
36
|
+
theme: mode,
|
|
37
|
+
isParamError: isParamError
|
|
27
38
|
}), element);
|
|
28
39
|
});
|
|
29
40
|
} else {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"render.js","names":["_react","_interopRequireDefault","require","_reactDom","_CurrencyPowerBalance","obj","__esModule","default","graphqlUrl","configGraphQl","renderElementId","configRenderElementId","locale","configLocale","window","currencyPowerBalanceWidgetConfig","widgetsConfig","currencyPowerBalanceParamsElements","document","querySelectorAll","length","forEach","element","params","getAttribute","mode","JSON","parse","render","createElement","CurrencyPowerBalance","theme","getElementById"],"sources":["../../../src/CurrencyPowerBalanceWidget/render.tsx"],"sourcesContent":["import React from 'react';\nimport { render } from 'react-dom';\nimport { Theme } from '@oanda/labs-widget-common';\nimport { CurrencyPowerBalance } from './CurrencyPowerBalance';\n\nconst {\n graphqlUrl: configGraphQl,\n renderElementId: configRenderElementId,\n locale: configLocale,\n} = window.currencyPowerBalanceWidgetConfig || {};\n\nconst {\n graphqlUrl,\n} = window.widgetsConfig || {};\n\nconst currencyPowerBalanceParamsElements = document.querySelectorAll('div[data-currency-power-balance-params]');\n\nif (currencyPowerBalanceParamsElements.length > 0) {\n currencyPowerBalanceParamsElements.forEach((element) => {\n const params = element.getAttribute('data-currency-power-balance-params');\n const mode = element.getAttribute('data-mode');\n const { locale } = JSON.parse(params as string);\n\n render(\n <CurrencyPowerBalance\n graphqlUrl={graphqlUrl}\n locale={locale}\n theme={mode as Theme}\n />,\n element,\n );\n });\n} else {\n render(\n <CurrencyPowerBalance\n locale={configLocale}\n graphqlUrl={configGraphQl}\n />,\n document.getElementById(configRenderElementId),\n );\n}\n"],"mappings":";;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;
|
|
1
|
+
{"version":3,"file":"render.js","names":["_react","_interopRequireDefault","require","_reactDom","_labsWidgetCommon","_CurrencyPowerBalance","obj","__esModule","default","graphqlUrl","configGraphQl","renderElementId","configRenderElementId","locale","configLocale","window","currencyPowerBalanceWidgetConfig","widgetsConfig","currencyPowerBalanceParamsElements","document","querySelectorAll","length","forEach","element","params","getAttribute","mode","JSON","parse","isParamError","validateToolParams","name","valueCheck","value","split","render","createElement","CurrencyPowerBalance","theme","getElementById"],"sources":["../../../src/CurrencyPowerBalanceWidget/render.tsx"],"sourcesContent":["import React from 'react';\nimport { render } from 'react-dom';\nimport { Theme, validateToolParams } from '@oanda/labs-widget-common';\nimport { CurrencyPowerBalance } from './CurrencyPowerBalance';\n\nconst {\n graphqlUrl: configGraphQl,\n renderElementId: configRenderElementId,\n locale: configLocale,\n} = window.currencyPowerBalanceWidgetConfig || {};\n\nconst {\n graphqlUrl,\n} = window.widgetsConfig || {};\n\nconst currencyPowerBalanceParamsElements = document.querySelectorAll('div[data-currency-power-balance-params]');\n\nif (currencyPowerBalanceParamsElements.length > 0) {\n currencyPowerBalanceParamsElements.forEach((element) => {\n const params = element.getAttribute('data-currency-power-balance-params');\n const mode = element.getAttribute('data-mode');\n const { locale } = JSON.parse(params as string);\n\n const isParamError = validateToolParams({ locale }, [\n {\n name: 'locale',\n valueCheck: (value) => value.split('-')[0] === 'en' || value.split('-')[0] === 'zh',\n }, {\n name: 'graphqlUrl',\n valueCheck: (value) => !!value,\n }]);\n render(\n <CurrencyPowerBalance\n graphqlUrl={graphqlUrl}\n locale={locale}\n theme={mode as Theme}\n isParamError={isParamError}\n />,\n element,\n );\n });\n} else {\n render(\n <CurrencyPowerBalance\n locale={configLocale}\n graphqlUrl={configGraphQl}\n />,\n document.getElementById(configRenderElementId),\n );\n}\n"],"mappings":";;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AACA,IAAAE,iBAAA,GAAAF,OAAA;AACA,IAAAG,qBAAA,GAAAH,OAAA;AAA8D,SAAAD,uBAAAK,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAE9D,MAAM;EACJG,UAAU,EAAEC,aAAa;EACzBC,eAAe,EAAEC,qBAAqB;EACtCC,MAAM,EAAEC;AACV,CAAC,GAAGC,MAAM,CAACC,gCAAgC,IAAI,CAAC,CAAC;AAEjD,MAAM;EACJP;AACF,CAAC,GAAGM,MAAM,CAACE,aAAa,IAAI,CAAC,CAAC;AAE9B,MAAMC,kCAAkC,GAAGC,QAAQ,CAACC,gBAAgB,CAAC,yCAAyC,CAAC;AAE/G,IAAIF,kCAAkC,CAACG,MAAM,GAAG,CAAC,EAAE;EACjDH,kCAAkC,CAACI,OAAO,CAAEC,OAAO,IAAK;IACtD,MAAMC,MAAM,GAAGD,OAAO,CAACE,YAAY,CAAC,oCAAoC,CAAC;IACzE,MAAMC,IAAI,GAAGH,OAAO,CAACE,YAAY,CAAC,WAAW,CAAC;IAC9C,MAAM;MAAEZ;IAAO,CAAC,GAAGc,IAAI,CAACC,KAAK,CAACJ,MAAgB,CAAC;IAE/C,MAAMK,YAAY,GAAG,IAAAC,oCAAkB,EAAC;MAAEjB;IAAO,CAAC,EAAE,CAClD;MACEkB,IAAI,EAAE,QAAQ;MACdC,UAAU,EAAGC,KAAK,IAAKA,KAAK,CAACC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,IAAI,IAAID,KAAK,CAACC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK;IACjF,CAAC,EAAE;MACDH,IAAI,EAAE,YAAY;MAClBC,UAAU,EAAGC,KAAK,IAAK,CAAC,CAACA;IAC3B,CAAC,CAAC,CAAC;IACL,IAAAE,gBAAM,EACJnC,MAAA,CAAAQ,OAAA,CAAA4B,aAAA,CAAC/B,qBAAA,CAAAgC,oBAAoB;MACnB5B,UAAU,EAAEA,UAAW;MACvBI,MAAM,EAAEA,MAAO;MACfyB,KAAK,EAAEZ,IAAc;MACrBG,YAAY,EAAEA;IAAa,CAC5B,CAAC,EACFN,OACF,CAAC;EACH,CAAC,CAAC;AACJ,CAAC,MAAM;EACL,IAAAY,gBAAM,EACJnC,MAAA,CAAAQ,OAAA,CAAA4B,aAAA,CAAC/B,qBAAA,CAAAgC,oBAAoB;IACnBxB,MAAM,EAAEC,YAAa;IACrBL,UAAU,EAAEC;EAAc,CAC3B,CAAC,EACFS,QAAQ,CAACoB,cAAc,CAAC3B,qBAAqB,CAC/C,CAAC;AACH"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","names":[],"sources":["../../../src/CurrencyPowerBalanceWidget/types.ts"],"sourcesContent":["import { Locale } from '@oanda/mono-i18n';\nimport { Theme } from '@oanda/labs-widget-common';\nimport { CurrencyPowerBalanceTimeUnit } from '../gql/types/graphql';\n\nexport interface CurrencyPowerBalanceConfig {\n graphqlUrl: string;\n locale: Locale;\n theme?: Theme;\n}\n\nexport interface CurrencyPowerBalanceWrapperConfig extends CurrencyPowerBalanceConfig {\n renderElementId: string;\n locale: Locale;\n}\n\nexport interface ChartWithDataProps {\n timeUnit: CurrencyPowerBalanceTimeUnit;\n}\n"],"mappings":""}
|
|
1
|
+
{"version":3,"file":"types.js","names":[],"sources":["../../../src/CurrencyPowerBalanceWidget/types.ts"],"sourcesContent":["import { Locale } from '@oanda/mono-i18n';\nimport { Theme } from '@oanda/labs-widget-common';\nimport { CurrencyPowerBalanceTimeUnit } from '../gql/types/graphql';\n\nexport interface CurrencyPowerBalanceConfig {\n graphqlUrl: string;\n locale: Locale;\n theme?: Theme;\n isParamError?: boolean;\n}\n\nexport interface CurrencyPowerBalanceWrapperConfig extends CurrencyPowerBalanceConfig {\n renderElementId: string;\n locale: Locale;\n}\n\nexport interface ChartWithDataProps {\n timeUnit: CurrencyPowerBalanceTimeUnit;\n}\n"],"mappings":""}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { ApolloClient, InMemoryCache, ApolloProvider } from '@apollo/client';
|
|
3
|
-
import { ThemeProvider, getLocale } from '@oanda/labs-widget-common';
|
|
3
|
+
import { ChartError, ThemeProvider, getLocale } from '@oanda/labs-widget-common';
|
|
4
4
|
import { LocaleProvider } from '@oanda/mono-i18n';
|
|
5
5
|
import { Main } from './Main';
|
|
6
6
|
import { translations } from '../translations';
|
|
@@ -8,7 +8,8 @@ const CurrencyPowerBalance = _ref => {
|
|
|
8
8
|
let {
|
|
9
9
|
graphqlUrl,
|
|
10
10
|
theme,
|
|
11
|
-
locale
|
|
11
|
+
locale,
|
|
12
|
+
isParamError
|
|
12
13
|
} = _ref;
|
|
13
14
|
const client = new ApolloClient({
|
|
14
15
|
uri: graphqlUrl,
|
|
@@ -21,7 +22,9 @@ const CurrencyPowerBalance = _ref => {
|
|
|
21
22
|
translations: translations
|
|
22
23
|
}, React.createElement(ApolloProvider, {
|
|
23
24
|
client: client
|
|
24
|
-
}, React.createElement(
|
|
25
|
+
}, isParamError ? React.createElement("div", {
|
|
26
|
+
className: "lw-flex lw-h-[425px] lw-w-full lw-items-center lw-border lw-border-solid lw-border-border-primary"
|
|
27
|
+
}, React.createElement(ChartError, null)) : React.createElement(Main, null))));
|
|
25
28
|
};
|
|
26
29
|
export { CurrencyPowerBalance };
|
|
27
30
|
//# sourceMappingURL=CurrencyPowerBalance.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CurrencyPowerBalance.js","names":["React","ApolloClient","InMemoryCache","ApolloProvider","ThemeProvider","getLocale","LocaleProvider","Main","translations","CurrencyPowerBalance","_ref","graphqlUrl","theme","locale","client","uri","cache","createElement"],"sources":["../../../src/CurrencyPowerBalanceWidget/CurrencyPowerBalance.tsx"],"sourcesContent":["import React from 'react';\nimport { ApolloClient, InMemoryCache, ApolloProvider } from '@apollo/client';\nimport { ThemeProvider, getLocale } from '@oanda/labs-widget-common';\nimport { LocaleProvider } from '@oanda/mono-i18n';\nimport { Main } from './Main';\nimport { CurrencyPowerBalanceConfig } from './types';\nimport { translations } from '../translations';\n\nconst CurrencyPowerBalance = ({\n graphqlUrl, theme, locale,\n}: CurrencyPowerBalanceConfig) => {\n const client = new ApolloClient({\n uri: graphqlUrl,\n cache: new InMemoryCache(),\n });\n\n return (\n <ThemeProvider theme={theme}>\n <LocaleProvider locale={getLocale(locale)} translations={translations}>\n <ApolloProvider client={client}>\n <
|
|
1
|
+
{"version":3,"file":"CurrencyPowerBalance.js","names":["React","ApolloClient","InMemoryCache","ApolloProvider","ChartError","ThemeProvider","getLocale","LocaleProvider","Main","translations","CurrencyPowerBalance","_ref","graphqlUrl","theme","locale","isParamError","client","uri","cache","createElement","className"],"sources":["../../../src/CurrencyPowerBalanceWidget/CurrencyPowerBalance.tsx"],"sourcesContent":["import React from 'react';\nimport { ApolloClient, InMemoryCache, ApolloProvider } from '@apollo/client';\nimport { ChartError, ThemeProvider, getLocale } from '@oanda/labs-widget-common';\nimport { LocaleProvider } from '@oanda/mono-i18n';\nimport { Main } from './Main';\nimport { CurrencyPowerBalanceConfig } from './types';\nimport { translations } from '../translations';\n\nconst CurrencyPowerBalance = ({\n graphqlUrl, theme, locale, isParamError,\n}: CurrencyPowerBalanceConfig) => {\n const client = new ApolloClient({\n uri: graphqlUrl,\n cache: new InMemoryCache(),\n });\n\n return (\n <ThemeProvider theme={theme}>\n <LocaleProvider locale={getLocale(locale)} translations={translations}>\n <ApolloProvider client={client}>\n {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 />}\n </ApolloProvider>\n </LocaleProvider>\n </ThemeProvider>\n );\n};\n\nexport { CurrencyPowerBalance };\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,YAAY,EAAEC,aAAa,EAAEC,cAAc,QAAQ,gBAAgB;AAC5E,SAASC,UAAU,EAAEC,aAAa,EAAEC,SAAS,QAAQ,2BAA2B;AAChF,SAASC,cAAc,QAAQ,kBAAkB;AACjD,SAASC,IAAI,QAAQ,QAAQ;AAE7B,SAASC,YAAY,QAAQ,iBAAiB;AAE9C,MAAMC,oBAAoB,GAAGC,IAAA,IAEK;EAAA,IAFJ;IAC5BC,UAAU;IAAEC,KAAK;IAAEC,MAAM;IAAEC;EACD,CAAC,GAAAJ,IAAA;EAC3B,MAAMK,MAAM,GAAG,IAAIf,YAAY,CAAC;IAC9BgB,GAAG,EAAEL,UAAU;IACfM,KAAK,EAAE,IAAIhB,aAAa,CAAC;EAC3B,CAAC,CAAC;EAEF,OACEF,KAAA,CAAAmB,aAAA,CAACd,aAAa;IAACQ,KAAK,EAAEA;EAAM,GAC1Bb,KAAA,CAAAmB,aAAA,CAACZ,cAAc;IAACO,MAAM,EAAER,SAAS,CAACQ,MAAM,CAAE;IAACL,YAAY,EAAEA;EAAa,GACpET,KAAA,CAAAmB,aAAA,CAAChB,cAAc;IAACa,MAAM,EAAEA;EAAO,GAC5BD,YAAY,GACXf,KAAA,CAAAmB,aAAA;IAAKC,SAAS,EAAC;EAAmG,GAChHpB,KAAA,CAAAmB,aAAA,CAACf,UAAU,MAAE,CACV,CAAC,GACJJ,KAAA,CAAAmB,aAAA,CAACX,IAAI,MAAE,CACG,CACF,CACH,CAAC;AAEpB,CAAC;AAED,SAASE,oBAAoB"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { render } from 'react-dom';
|
|
3
|
+
import { validateToolParams } from '@oanda/labs-widget-common';
|
|
3
4
|
import { CurrencyPowerBalance } from './CurrencyPowerBalance';
|
|
4
5
|
const {
|
|
5
6
|
graphqlUrl: configGraphQl,
|
|
@@ -17,10 +18,20 @@ if (currencyPowerBalanceParamsElements.length > 0) {
|
|
|
17
18
|
const {
|
|
18
19
|
locale
|
|
19
20
|
} = JSON.parse(params);
|
|
21
|
+
const isParamError = validateToolParams({
|
|
22
|
+
locale
|
|
23
|
+
}, [{
|
|
24
|
+
name: 'locale',
|
|
25
|
+
valueCheck: value => value.split('-')[0] === 'en' || value.split('-')[0] === 'zh'
|
|
26
|
+
}, {
|
|
27
|
+
name: 'graphqlUrl',
|
|
28
|
+
valueCheck: value => !!value
|
|
29
|
+
}]);
|
|
20
30
|
render(React.createElement(CurrencyPowerBalance, {
|
|
21
31
|
graphqlUrl: graphqlUrl,
|
|
22
32
|
locale: locale,
|
|
23
|
-
theme: mode
|
|
33
|
+
theme: mode,
|
|
34
|
+
isParamError: isParamError
|
|
24
35
|
}), element);
|
|
25
36
|
});
|
|
26
37
|
} else {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"render.js","names":["React","render","CurrencyPowerBalance","graphqlUrl","configGraphQl","renderElementId","configRenderElementId","locale","configLocale","window","currencyPowerBalanceWidgetConfig","widgetsConfig","currencyPowerBalanceParamsElements","document","querySelectorAll","length","forEach","element","params","getAttribute","mode","JSON","parse","createElement","theme","getElementById"],"sources":["../../../src/CurrencyPowerBalanceWidget/render.tsx"],"sourcesContent":["import React from 'react';\nimport { render } from 'react-dom';\nimport { Theme } from '@oanda/labs-widget-common';\nimport { CurrencyPowerBalance } from './CurrencyPowerBalance';\n\nconst {\n graphqlUrl: configGraphQl,\n renderElementId: configRenderElementId,\n locale: configLocale,\n} = window.currencyPowerBalanceWidgetConfig || {};\n\nconst {\n graphqlUrl,\n} = window.widgetsConfig || {};\n\nconst currencyPowerBalanceParamsElements = document.querySelectorAll('div[data-currency-power-balance-params]');\n\nif (currencyPowerBalanceParamsElements.length > 0) {\n currencyPowerBalanceParamsElements.forEach((element) => {\n const params = element.getAttribute('data-currency-power-balance-params');\n const mode = element.getAttribute('data-mode');\n const { locale } = JSON.parse(params as string);\n\n render(\n <CurrencyPowerBalance\n graphqlUrl={graphqlUrl}\n locale={locale}\n theme={mode as Theme}\n />,\n element,\n );\n });\n} else {\n render(\n <CurrencyPowerBalance\n locale={configLocale}\n graphqlUrl={configGraphQl}\n />,\n document.getElementById(configRenderElementId),\n );\n}\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,MAAM,QAAQ,WAAW;
|
|
1
|
+
{"version":3,"file":"render.js","names":["React","render","validateToolParams","CurrencyPowerBalance","graphqlUrl","configGraphQl","renderElementId","configRenderElementId","locale","configLocale","window","currencyPowerBalanceWidgetConfig","widgetsConfig","currencyPowerBalanceParamsElements","document","querySelectorAll","length","forEach","element","params","getAttribute","mode","JSON","parse","isParamError","name","valueCheck","value","split","createElement","theme","getElementById"],"sources":["../../../src/CurrencyPowerBalanceWidget/render.tsx"],"sourcesContent":["import React from 'react';\nimport { render } from 'react-dom';\nimport { Theme, validateToolParams } from '@oanda/labs-widget-common';\nimport { CurrencyPowerBalance } from './CurrencyPowerBalance';\n\nconst {\n graphqlUrl: configGraphQl,\n renderElementId: configRenderElementId,\n locale: configLocale,\n} = window.currencyPowerBalanceWidgetConfig || {};\n\nconst {\n graphqlUrl,\n} = window.widgetsConfig || {};\n\nconst currencyPowerBalanceParamsElements = document.querySelectorAll('div[data-currency-power-balance-params]');\n\nif (currencyPowerBalanceParamsElements.length > 0) {\n currencyPowerBalanceParamsElements.forEach((element) => {\n const params = element.getAttribute('data-currency-power-balance-params');\n const mode = element.getAttribute('data-mode');\n const { locale } = JSON.parse(params as string);\n\n const isParamError = validateToolParams({ locale }, [\n {\n name: 'locale',\n valueCheck: (value) => value.split('-')[0] === 'en' || value.split('-')[0] === 'zh',\n }, {\n name: 'graphqlUrl',\n valueCheck: (value) => !!value,\n }]);\n render(\n <CurrencyPowerBalance\n graphqlUrl={graphqlUrl}\n locale={locale}\n theme={mode as Theme}\n isParamError={isParamError}\n />,\n element,\n );\n });\n} else {\n render(\n <CurrencyPowerBalance\n locale={configLocale}\n graphqlUrl={configGraphQl}\n />,\n document.getElementById(configRenderElementId),\n );\n}\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,MAAM,QAAQ,WAAW;AAClC,SAAgBC,kBAAkB,QAAQ,2BAA2B;AACrE,SAASC,oBAAoB,QAAQ,wBAAwB;AAE7D,MAAM;EACJC,UAAU,EAAEC,aAAa;EACzBC,eAAe,EAAEC,qBAAqB;EACtCC,MAAM,EAAEC;AACV,CAAC,GAAGC,MAAM,CAACC,gCAAgC,IAAI,CAAC,CAAC;AAEjD,MAAM;EACJP;AACF,CAAC,GAAGM,MAAM,CAACE,aAAa,IAAI,CAAC,CAAC;AAE9B,MAAMC,kCAAkC,GAAGC,QAAQ,CAACC,gBAAgB,CAAC,yCAAyC,CAAC;AAE/G,IAAIF,kCAAkC,CAACG,MAAM,GAAG,CAAC,EAAE;EACjDH,kCAAkC,CAACI,OAAO,CAAEC,OAAO,IAAK;IACtD,MAAMC,MAAM,GAAGD,OAAO,CAACE,YAAY,CAAC,oCAAoC,CAAC;IACzE,MAAMC,IAAI,GAAGH,OAAO,CAACE,YAAY,CAAC,WAAW,CAAC;IAC9C,MAAM;MAAEZ;IAAO,CAAC,GAAGc,IAAI,CAACC,KAAK,CAACJ,MAAgB,CAAC;IAE/C,MAAMK,YAAY,GAAGtB,kBAAkB,CAAC;MAAEM;IAAO,CAAC,EAAE,CAClD;MACEiB,IAAI,EAAE,QAAQ;MACdC,UAAU,EAAGC,KAAK,IAAKA,KAAK,CAACC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,IAAI,IAAID,KAAK,CAACC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK;IACjF,CAAC,EAAE;MACDH,IAAI,EAAE,YAAY;MAClBC,UAAU,EAAGC,KAAK,IAAK,CAAC,CAACA;IAC3B,CAAC,CAAC,CAAC;IACL1B,MAAM,CACJD,KAAA,CAAA6B,aAAA,CAAC1B,oBAAoB;MACnBC,UAAU,EAAEA,UAAW;MACvBI,MAAM,EAAEA,MAAO;MACfsB,KAAK,EAAET,IAAc;MACrBG,YAAY,EAAEA;IAAa,CAC5B,CAAC,EACFN,OACF,CAAC;EACH,CAAC,CAAC;AACJ,CAAC,MAAM;EACLjB,MAAM,CACJD,KAAA,CAAA6B,aAAA,CAAC1B,oBAAoB;IACnBK,MAAM,EAAEC,YAAa;IACrBL,UAAU,EAAEC;EAAc,CAC3B,CAAC,EACFS,QAAQ,CAACiB,cAAc,CAACxB,qBAAqB,CAC/C,CAAC;AACH"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","names":[],"sources":["../../../src/CurrencyPowerBalanceWidget/types.ts"],"sourcesContent":["import { Locale } from '@oanda/mono-i18n';\nimport { Theme } from '@oanda/labs-widget-common';\nimport { CurrencyPowerBalanceTimeUnit } from '../gql/types/graphql';\n\nexport interface CurrencyPowerBalanceConfig {\n graphqlUrl: string;\n locale: Locale;\n theme?: Theme;\n}\n\nexport interface CurrencyPowerBalanceWrapperConfig extends CurrencyPowerBalanceConfig {\n renderElementId: string;\n locale: Locale;\n}\n\nexport interface ChartWithDataProps {\n timeUnit: CurrencyPowerBalanceTimeUnit;\n}\n"],"mappings":""}
|
|
1
|
+
{"version":3,"file":"types.js","names":[],"sources":["../../../src/CurrencyPowerBalanceWidget/types.ts"],"sourcesContent":["import { Locale } from '@oanda/mono-i18n';\nimport { Theme } from '@oanda/labs-widget-common';\nimport { CurrencyPowerBalanceTimeUnit } from '../gql/types/graphql';\n\nexport interface CurrencyPowerBalanceConfig {\n graphqlUrl: string;\n locale: Locale;\n theme?: Theme;\n isParamError?: boolean;\n}\n\nexport interface CurrencyPowerBalanceWrapperConfig extends CurrencyPowerBalanceConfig {\n renderElementId: string;\n locale: Locale;\n}\n\nexport interface ChartWithDataProps {\n timeUnit: CurrencyPowerBalanceTimeUnit;\n}\n"],"mappings":""}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { CurrencyPowerBalanceConfig } from './types';
|
|
3
|
-
declare const CurrencyPowerBalance: ({ graphqlUrl, theme, locale, }: CurrencyPowerBalanceConfig) => JSX.Element;
|
|
3
|
+
declare const CurrencyPowerBalance: ({ graphqlUrl, theme, locale, isParamError, }: CurrencyPowerBalanceConfig) => JSX.Element;
|
|
4
4
|
export { CurrencyPowerBalance };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oanda/labs-currency-power-balance-widget",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.20",
|
|
4
4
|
"description": "Labs Currency Power Balance 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.7.17",
|
|
16
|
-
"@oanda/labs-widget-common": "^1.0.
|
|
16
|
+
"@oanda/labs-widget-common": "^1.0.81",
|
|
17
17
|
"@oanda/mono-i18n": "9.0.0",
|
|
18
18
|
"echarts": "5.4.3",
|
|
19
19
|
"echarts-for-react": "3.0.2",
|
|
@@ -24,5 +24,5 @@
|
|
|
24
24
|
"@graphql-codegen/cli": "5.0.0",
|
|
25
25
|
"@graphql-codegen/client-preset": "4.1.0"
|
|
26
26
|
},
|
|
27
|
-
"gitHead": "
|
|
27
|
+
"gitHead": "58765ade5f8cd4e5aa4150c54ea45b7e8d772bd3"
|
|
28
28
|
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { ApolloClient, InMemoryCache, ApolloProvider } from '@apollo/client';
|
|
3
|
-
import { ThemeProvider, getLocale } from '@oanda/labs-widget-common';
|
|
3
|
+
import { ChartError, ThemeProvider, getLocale } from '@oanda/labs-widget-common';
|
|
4
4
|
import { LocaleProvider } from '@oanda/mono-i18n';
|
|
5
5
|
import { Main } from './Main';
|
|
6
6
|
import { CurrencyPowerBalanceConfig } from './types';
|
|
7
7
|
import { translations } from '../translations';
|
|
8
8
|
|
|
9
9
|
const CurrencyPowerBalance = ({
|
|
10
|
-
graphqlUrl, theme, locale,
|
|
10
|
+
graphqlUrl, theme, locale, isParamError,
|
|
11
11
|
}: CurrencyPowerBalanceConfig) => {
|
|
12
12
|
const client = new ApolloClient({
|
|
13
13
|
uri: graphqlUrl,
|
|
@@ -18,7 +18,11 @@ const CurrencyPowerBalance = ({
|
|
|
18
18
|
<ThemeProvider theme={theme}>
|
|
19
19
|
<LocaleProvider locale={getLocale(locale)} translations={translations}>
|
|
20
20
|
<ApolloProvider client={client}>
|
|
21
|
-
|
|
21
|
+
{isParamError ? (
|
|
22
|
+
<div className="lw-flex lw-h-[425px] lw-w-full lw-items-center lw-border lw-border-solid lw-border-border-primary">
|
|
23
|
+
<ChartError />
|
|
24
|
+
</div>
|
|
25
|
+
) : <Main />}
|
|
22
26
|
</ApolloProvider>
|
|
23
27
|
</LocaleProvider>
|
|
24
28
|
</ThemeProvider>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { render } from 'react-dom';
|
|
3
|
-
import { Theme } from '@oanda/labs-widget-common';
|
|
3
|
+
import { Theme, validateToolParams } from '@oanda/labs-widget-common';
|
|
4
4
|
import { CurrencyPowerBalance } from './CurrencyPowerBalance';
|
|
5
5
|
|
|
6
6
|
const {
|
|
@@ -21,11 +21,20 @@ if (currencyPowerBalanceParamsElements.length > 0) {
|
|
|
21
21
|
const mode = element.getAttribute('data-mode');
|
|
22
22
|
const { locale } = JSON.parse(params as string);
|
|
23
23
|
|
|
24
|
+
const isParamError = validateToolParams({ locale }, [
|
|
25
|
+
{
|
|
26
|
+
name: 'locale',
|
|
27
|
+
valueCheck: (value) => value.split('-')[0] === 'en' || value.split('-')[0] === 'zh',
|
|
28
|
+
}, {
|
|
29
|
+
name: 'graphqlUrl',
|
|
30
|
+
valueCheck: (value) => !!value,
|
|
31
|
+
}]);
|
|
24
32
|
render(
|
|
25
33
|
<CurrencyPowerBalance
|
|
26
34
|
graphqlUrl={graphqlUrl}
|
|
27
35
|
locale={locale}
|
|
28
36
|
theme={mode as Theme}
|
|
37
|
+
isParamError={isParamError}
|
|
29
38
|
/>,
|
|
30
39
|
element,
|
|
31
40
|
);
|