@oanda/labs-currency-strength-widget 1.0.1
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 +8 -0
- package/codegen.ts +15 -0
- package/dist/main/CurrencyStrengthWidget/ChartsWithData.js +50 -0
- package/dist/main/CurrencyStrengthWidget/ChartsWithData.js.map +1 -0
- package/dist/main/CurrencyStrengthWidget/CurrencyStrengthWidget.js +37 -0
- package/dist/main/CurrencyStrengthWidget/CurrencyStrengthWidget.js.map +1 -0
- package/dist/main/CurrencyStrengthWidget/Main.js +22 -0
- package/dist/main/CurrencyStrengthWidget/Main.js.map +1 -0
- package/dist/main/CurrencyStrengthWidget/components/Chart/Chart.js +50 -0
- package/dist/main/CurrencyStrengthWidget/components/Chart/Chart.js.map +1 -0
- package/dist/main/CurrencyStrengthWidget/components/Chart/constants.js +22 -0
- package/dist/main/CurrencyStrengthWidget/components/Chart/constants.js.map +1 -0
- package/dist/main/CurrencyStrengthWidget/components/Chart/formatters.js +18 -0
- package/dist/main/CurrencyStrengthWidget/components/Chart/formatters.js.map +1 -0
- package/dist/main/CurrencyStrengthWidget/components/Chart/getOption.js +121 -0
- package/dist/main/CurrencyStrengthWidget/components/Chart/getOption.js.map +1 -0
- package/dist/main/CurrencyStrengthWidget/components/Chart/index.js +17 -0
- package/dist/main/CurrencyStrengthWidget/components/Chart/index.js.map +1 -0
- package/dist/main/CurrencyStrengthWidget/components/Chart/types.js +6 -0
- package/dist/main/CurrencyStrengthWidget/components/Chart/types.js.map +1 -0
- package/dist/main/CurrencyStrengthWidget/index.js +17 -0
- package/dist/main/CurrencyStrengthWidget/index.js.map +1 -0
- package/dist/main/CurrencyStrengthWidget/render.js +34 -0
- package/dist/main/CurrencyStrengthWidget/render.js.map +1 -0
- package/dist/main/CurrencyStrengthWidget/types.js +6 -0
- package/dist/main/CurrencyStrengthWidget/types.js.map +1 -0
- package/dist/main/gql/getCurrencyStrength.js +11 -0
- package/dist/main/gql/getCurrencyStrength.js.map +1 -0
- package/dist/main/gql/types/fragment-masking.js +24 -0
- package/dist/main/gql/types/fragment-masking.js.map +1 -0
- package/dist/main/gql/types/gql.js +17 -0
- package/dist/main/gql/types/gql.js.map +1 -0
- package/dist/main/gql/types/graphql.js +137 -0
- package/dist/main/gql/types/graphql.js.map +1 -0
- package/dist/main/gql/types/index.js +28 -0
- package/dist/main/gql/types/index.js.map +1 -0
- package/dist/main/index.js +17 -0
- package/dist/main/index.js.map +1 -0
- package/dist/main/translations/index.js +19 -0
- package/dist/main/translations/index.js.map +1 -0
- package/dist/main/translations/sources/en.json +6 -0
- package/dist/main/translations/sources/zh_TW.json +6 -0
- package/dist/main/translations/translations.js +8 -0
- package/dist/main/translations/translations.js.map +1 -0
- package/dist/module/CurrencyStrengthWidget/ChartsWithData.js +41 -0
- package/dist/module/CurrencyStrengthWidget/ChartsWithData.js.map +1 -0
- package/dist/module/CurrencyStrengthWidget/CurrencyStrengthWidget.js +30 -0
- package/dist/module/CurrencyStrengthWidget/CurrencyStrengthWidget.js.map +1 -0
- package/dist/module/CurrencyStrengthWidget/Main.js +15 -0
- package/dist/module/CurrencyStrengthWidget/Main.js.map +1 -0
- package/dist/module/CurrencyStrengthWidget/components/Chart/Chart.js +41 -0
- package/dist/module/CurrencyStrengthWidget/components/Chart/Chart.js.map +1 -0
- package/dist/module/CurrencyStrengthWidget/components/Chart/constants.js +16 -0
- package/dist/module/CurrencyStrengthWidget/components/Chart/constants.js.map +1 -0
- package/dist/module/CurrencyStrengthWidget/components/Chart/formatters.js +11 -0
- package/dist/module/CurrencyStrengthWidget/components/Chart/formatters.js.map +1 -0
- package/dist/module/CurrencyStrengthWidget/components/Chart/getOption.js +114 -0
- package/dist/module/CurrencyStrengthWidget/components/Chart/getOption.js.map +1 -0
- package/dist/module/CurrencyStrengthWidget/components/Chart/index.js +2 -0
- package/dist/module/CurrencyStrengthWidget/components/Chart/index.js.map +1 -0
- package/dist/module/CurrencyStrengthWidget/components/Chart/types.js +2 -0
- package/dist/module/CurrencyStrengthWidget/components/Chart/types.js.map +1 -0
- package/dist/module/CurrencyStrengthWidget/index.js +2 -0
- package/dist/module/CurrencyStrengthWidget/index.js.map +1 -0
- package/dist/module/CurrencyStrengthWidget/render.js +31 -0
- package/dist/module/CurrencyStrengthWidget/render.js.map +1 -0
- package/dist/module/CurrencyStrengthWidget/types.js +2 -0
- package/dist/module/CurrencyStrengthWidget/types.js.map +1 -0
- package/dist/module/gql/getCurrencyStrength.js +6 -0
- package/dist/module/gql/getCurrencyStrength.js.map +1 -0
- package/dist/module/gql/types/fragment-masking.js +16 -0
- package/dist/module/gql/types/fragment-masking.js.map +1 -0
- package/dist/module/gql/types/gql.js +9 -0
- package/dist/module/gql/types/gql.js.map +1 -0
- package/dist/module/gql/types/graphql.js +131 -0
- package/dist/module/gql/types/graphql.js.map +1 -0
- package/dist/module/gql/types/index.js +3 -0
- package/dist/module/gql/types/index.js.map +1 -0
- package/dist/module/index.js +2 -0
- package/dist/module/index.js.map +1 -0
- package/dist/module/translations/index.js +12 -0
- package/dist/module/translations/index.js.map +1 -0
- package/dist/module/translations/sources/en.json +6 -0
- package/dist/module/translations/sources/zh_TW.json +6 -0
- package/dist/module/translations/translations.js +2 -0
- package/dist/module/translations/translations.js.map +1 -0
- package/dist/types/CurrencyStrengthWidget/ChartsWithData.d.ts +3 -0
- package/dist/types/CurrencyStrengthWidget/CurrencyStrengthWidget.d.ts +4 -0
- package/dist/types/CurrencyStrengthWidget/Main.d.ts +3 -0
- package/dist/types/CurrencyStrengthWidget/components/Chart/Chart.d.ts +4 -0
- package/dist/types/CurrencyStrengthWidget/components/Chart/constants.d.ts +14 -0
- package/dist/types/CurrencyStrengthWidget/components/Chart/formatters.d.ts +2 -0
- package/dist/types/CurrencyStrengthWidget/components/Chart/getOption.d.ts +169 -0
- package/dist/types/CurrencyStrengthWidget/components/Chart/index.d.ts +1 -0
- package/dist/types/CurrencyStrengthWidget/components/Chart/types.d.ts +22 -0
- package/dist/types/CurrencyStrengthWidget/index.d.ts +1 -0
- package/dist/types/CurrencyStrengthWidget/render.d.ts +1 -0
- package/dist/types/CurrencyStrengthWidget/types.d.ts +11 -0
- package/dist/types/gql/getCurrencyStrength.d.ts +2 -0
- package/dist/types/gql/types/fragment-masking.d.ts +15 -0
- package/dist/types/gql/types/gql.d.ts +36 -0
- package/dist/types/gql/types/graphql.d.ts +282 -0
- package/dist/types/gql/types/index.d.ts +2 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/translations/index.d.ts +4 -0
- package/dist/types/translations/translations.d.ts +1 -0
- package/index.ts +1 -0
- package/lokalise.config.json +18 -0
- package/package.json +29 -0
- package/src/CurrencyStrengthWidget/ChartsWithData.tsx +53 -0
- package/src/CurrencyStrengthWidget/CurrencyStrengthWidget.tsx +32 -0
- package/src/CurrencyStrengthWidget/Main.tsx +18 -0
- package/src/CurrencyStrengthWidget/components/Chart/Chart.tsx +48 -0
- package/src/CurrencyStrengthWidget/components/Chart/constants.tsx +18 -0
- package/src/CurrencyStrengthWidget/components/Chart/formatters.ts +13 -0
- package/src/CurrencyStrengthWidget/components/Chart/getOption.ts +109 -0
- package/src/CurrencyStrengthWidget/components/Chart/index.ts +1 -0
- package/src/CurrencyStrengthWidget/components/Chart/types.ts +25 -0
- package/src/CurrencyStrengthWidget/index.ts +1 -0
- package/src/CurrencyStrengthWidget/render.tsx +34 -0
- package/src/CurrencyStrengthWidget/types.ts +13 -0
- package/src/gql/getCurrencyStrength.ts +15 -0
- package/src/gql/types/fragment-masking.ts +66 -0
- package/src/gql/types/gql.ts +42 -0
- package/src/gql/types/graphql.ts +290 -0
- package/src/gql/types/index.ts +2 -0
- package/src/index.ts +1 -0
- package/src/translations/index.ts +13 -0
- package/src/translations/sources/en.json +6 -0
- package/src/translations/sources/zh_TW.json +6 -0
- package/src/translations/translations.ts +3 -0
- package/test/Main.test.tsx +28 -0
- package/test/chartOptions.test.ts +18 -0
- package/test/mocks/currencyStrengthMock.ts +270 -0
- package/test/mocks/index.ts +2 -0
- package/test/mocks/responsesMocks.ts +19 -0
- package/tsconfig.types.json +12 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
# Change Log
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
|
+
|
|
6
|
+
## 1.0.1 (2024-02-09)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @oanda/labs-currency-strength-widget
|
package/codegen.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { CodegenConfig } from '@graphql-codegen/cli';
|
|
2
|
+
|
|
3
|
+
const config: CodegenConfig = {
|
|
4
|
+
overwrite: true,
|
|
5
|
+
schema: 'https://labs-api.uat.oanda.com/graphql',
|
|
6
|
+
documents: 'src/**/*.ts',
|
|
7
|
+
generates: {
|
|
8
|
+
'src/gql/types/': {
|
|
9
|
+
preset: 'client',
|
|
10
|
+
plugins: [],
|
|
11
|
+
},
|
|
12
|
+
},
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export default config;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.ChartWithData = void 0;
|
|
7
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _client = require("@apollo/client");
|
|
9
|
+
var _labsWidgetCommon = require("@oanda/labs-widget-common");
|
|
10
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
11
|
+
var _getCurrencyStrength = require("../gql/getCurrencyStrength");
|
|
12
|
+
var _Chart = require("./components/Chart");
|
|
13
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
14
|
+
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); }
|
|
15
|
+
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 && Object.prototype.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; }
|
|
16
|
+
const ChartWithData = () => {
|
|
17
|
+
var _data$currencyStrengt, _data$currencyStrengt2, _data$currencyStrengt3;
|
|
18
|
+
const {
|
|
19
|
+
isDesktop
|
|
20
|
+
} = (0, _react.useContext)(_labsWidgetCommon.ThemeContext);
|
|
21
|
+
const {
|
|
22
|
+
loading,
|
|
23
|
+
data,
|
|
24
|
+
error
|
|
25
|
+
} = (0, _client.useQuery)(_getCurrencyStrength.getCurrencyStrength, {
|
|
26
|
+
fetchPolicy: 'cache-and-network'
|
|
27
|
+
});
|
|
28
|
+
const showChart = (data === null || data === void 0 ? void 0 : data.currencyStrength) && (data === null || data === void 0 || (_data$currencyStrengt = data.currencyStrength) === null || _data$currencyStrengt === void 0 ? void 0 : _data$currencyStrengt.length) > 0;
|
|
29
|
+
const showError = (data === null || data === void 0 || (_data$currencyStrengt2 = data.currencyStrength) === null || _data$currencyStrengt2 === void 0 ? void 0 : _data$currencyStrengt2.length) === 0 || error;
|
|
30
|
+
return _react.default.createElement(_react.default.Fragment, null, loading && _react.default.createElement("div", {
|
|
31
|
+
className: "lw-flex lw-h-[461px] lw-w-full lw-items-center lw-border lw-border-solid lw-border-border-primary"
|
|
32
|
+
}, _react.default.createElement(_labsWidgetCommon.Spinner, {
|
|
33
|
+
size: _labsWidgetCommon.SpinnerSize.lg
|
|
34
|
+
})), !loading && showChart && _react.default.createElement("div", {
|
|
35
|
+
"data-testid": "currency-strength-chart-wrapper",
|
|
36
|
+
className: (0, _classnames.default)('lw-grid lw-place-content-center lw-gap-7', {
|
|
37
|
+
'lw-grid-cols-3 ': isDesktop,
|
|
38
|
+
'lw-grid-cols-1': !isDesktop
|
|
39
|
+
})
|
|
40
|
+
}, (_data$currencyStrengt3 = data.currencyStrength) === null || _data$currencyStrengt3 === void 0 ? void 0 : _data$currencyStrengt3.map(item => _react.default.createElement("div", {
|
|
41
|
+
className: "lw-flex lw-h-[135px] lw-flex-1 lw-items-center lw-justify-center"
|
|
42
|
+
}, _react.default.createElement(_Chart.Chart, {
|
|
43
|
+
currency: item.currency,
|
|
44
|
+
values: item.strengthRelation
|
|
45
|
+
})))), !loading && showError && _react.default.createElement("div", {
|
|
46
|
+
className: "lw-flex lw-h-[425px] lw-w-full lw-items-center lw-border lw-border-solid lw-border-border-primary"
|
|
47
|
+
}, _react.default.createElement(_labsWidgetCommon.ChartError, null)));
|
|
48
|
+
};
|
|
49
|
+
exports.ChartWithData = ChartWithData;
|
|
50
|
+
//# sourceMappingURL=ChartsWithData.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ChartsWithData.js","names":["_react","_interopRequireWildcard","require","_client","_labsWidgetCommon","_classnames","_interopRequireDefault","_getCurrencyStrength","_Chart","obj","__esModule","default","_getRequireWildcardCache","e","WeakMap","r","t","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","hasOwnProperty","call","i","set","ChartWithData","_data$currencyStrengt","_data$currencyStrengt2","_data$currencyStrengt3","isDesktop","useContext","ThemeContext","loading","data","error","useQuery","getCurrencyStrength","fetchPolicy","showChart","currencyStrength","length","showError","createElement","Fragment","className","Spinner","size","SpinnerSize","lg","classnames","map","item","Chart","currency","values","strengthRelation","ChartError","exports"],"sources":["../../../src/CurrencyStrengthWidget/ChartsWithData.tsx"],"sourcesContent":["import React, { useContext } from 'react';\nimport { useQuery } from '@apollo/client';\nimport {\n ChartError, Spinner, 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';\n\nconst ChartWithData = () => {\n const { isDesktop } = useContext(ThemeContext);\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 return (\n <>\n {loading\n && (\n <div className=\"lw-flex lw-h-[461px] lw-w-full lw-items-center lw-border lw-border-solid lw-border-border-primary\">\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,\n 'lw-grid-cols-1': !isDesktop,\n })}\n >\n {data.currencyStrength?.map((item) => (\n <div className=\"lw-flex lw-h-[135px] lw-flex-1 lw-items-center lw-justify-center\">\n <Chart currency={item.currency} values={item.strengthRelation!} />\n </div>\n ))}\n </div>\n )}\n {!loading && showError && (\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 )}\n </>\n );\n};\n\nexport { ChartWithData };\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,iBAAA,GAAAF,OAAA;AAIA,IAAAG,WAAA,GAAAC,sBAAA,CAAAJ,OAAA;AACA,IAAAK,oBAAA,GAAAL,OAAA;AAEA,IAAAM,MAAA,GAAAN,OAAA;AAA2C,SAAAI,uBAAAG,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GA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AAW,OAAA,CAAAqC,aAAA;IAAKE,SAAS,EAAC;EAAkE,GAC/ElD,MAAA,CAAAW,OAAA,CAAAqC,aAAA,CAACxC,MAAA,CAAAkD,KAAK;IAACC,QAAQ,EAAEF,IAAI,CAACE,QAAS;IAACC,MAAM,EAAEH,IAAI,CAACI;EAAkB,CAAE,CAC9D,CACN,CACE,CACN,EACA,CAACvB,OAAO,IAAIS,SAAS,IACpB/C,MAAA,CAAAW,OAAA,CAAAqC,aAAA;IAAKE,SAAS,EAAC;EAAmG,GAChHlD,MAAA,CAAAW,OAAA,CAAAqC,aAAA,CAAC5C,iBAAA,CAAA0D,UAAU,MAAE,CACV,CAEP,CAAC;AAEP,CAAC;AAACC,OAAA,CAAAhC,aAAA,GAAAA,aAAA"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.CurrencyStrengthWidget = void 0;
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
var _monoI18n = require("@oanda/mono-i18n");
|
|
9
|
+
var _client = require("@apollo/client");
|
|
10
|
+
var _labsWidgetCommon = require("@oanda/labs-widget-common");
|
|
11
|
+
var _translations = require("../translations");
|
|
12
|
+
var _Main = require("./Main");
|
|
13
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
14
|
+
const CurrencyStrengthWidget = _ref => {
|
|
15
|
+
let {
|
|
16
|
+
graphqlUrl,
|
|
17
|
+
locale,
|
|
18
|
+
theme,
|
|
19
|
+
isParamError
|
|
20
|
+
} = _ref;
|
|
21
|
+
const client = new _client.ApolloClient({
|
|
22
|
+
uri: graphqlUrl,
|
|
23
|
+
cache: new _client.InMemoryCache()
|
|
24
|
+
});
|
|
25
|
+
return _react.default.createElement(_labsWidgetCommon.ThemeProvider, {
|
|
26
|
+
theme: theme
|
|
27
|
+
}, _react.default.createElement(_monoI18n.LocaleProvider, {
|
|
28
|
+
locale: (0, _labsWidgetCommon.getLocale)(locale),
|
|
29
|
+
translations: _translations.translations
|
|
30
|
+
}, _react.default.createElement(_client.ApolloProvider, {
|
|
31
|
+
client: client
|
|
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))));
|
|
35
|
+
};
|
|
36
|
+
exports.CurrencyStrengthWidget = CurrencyStrengthWidget;
|
|
37
|
+
//# sourceMappingURL=CurrencyStrengthWidget.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CurrencyStrengthWidget.js","names":["_react","_interopRequireDefault","require","_monoI18n","_client","_labsWidgetCommon","_translations","_Main","obj","__esModule","default","CurrencyStrengthWidget","_ref","graphqlUrl","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 { VolatilityChartConfig } from './types';\nimport { translations } from '../translations';\nimport { Main } from './Main';\n\nconst CurrencyStrengthWidget = ({\n graphqlUrl, locale, theme, isParamError,\n}: VolatilityChartConfig) => {\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 { 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,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAE9B,MAAMG,sBAAsB,GAAGC,IAAA,IAEF;EAAA,IAFG;IAC9BC,UAAU;IAAEC,MAAM;IAAEC,KAAK;IAAEC;EACN,CAAC,GAAAJ,IAAA;EACtB,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,CAACjB,iBAAA,CAAAkB,aAAa;IAACR,KAAK,EAAEA;EAAM,GAC1Bf,MAAA,CAAAU,OAAA,CAAAY,aAAA,CAACnB,SAAA,CAAAqB,cAAc;IAACV,MAAM,EAAE,IAAAW,2BAAS,EAACX,MAAM,CAAE;IAACY,YAAY,EAAEA;EAAa,GACpE1B,MAAA,CAAAU,OAAA,CAAAY,aAAA,CAAClB,OAAA,CAAAuB,cAAc;IAACV,MAAM,EAAEA;EAAO,GAC5BD,YAAY,GACXhB,MAAA,CAAAU,OAAA,CAAAY,aAAA;IAAKM,SAAS,EAAC;EAAmG,GAChH5B,MAAA,CAAAU,OAAA,CAAAY,aAAA,CAACjB,iBAAA,CAAAwB,UAAU,MAAE,CACV,CAAC,GACJ7B,MAAA,CAAAU,OAAA,CAAAY,aAAA,CAACf,KAAA,CAAAuB,IAAI,MAAE,CACG,CACF,CACH,CAAC;AAEpB,CAAC;AAACC,OAAA,CAAApB,sBAAA,GAAAA,sBAAA"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.Main = void 0;
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
var _monoI18n = require("@oanda/mono-i18n");
|
|
9
|
+
var _ChartsWithData = require("./ChartsWithData");
|
|
10
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
+
const Main = () => {
|
|
12
|
+
const {
|
|
13
|
+
lang
|
|
14
|
+
} = (0, _monoI18n.useLocale)();
|
|
15
|
+
return _react.default.createElement("div", {
|
|
16
|
+
"data-testid": "currency-strength-wrapper"
|
|
17
|
+
}, _react.default.createElement("div", {
|
|
18
|
+
className: "lw-mb-8 lw-flex lw-justify-center lw-font-sans lw-text-lg lw-font-bold"
|
|
19
|
+
}, _react.default.createElement("span", null, "".concat(lang('daily'), " (").concat(lang('5_minutes'), ")"))), _react.default.createElement(_ChartsWithData.ChartWithData, null));
|
|
20
|
+
};
|
|
21
|
+
exports.Main = Main;
|
|
22
|
+
//# sourceMappingURL=Main.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Main.js","names":["_react","_interopRequireDefault","require","_monoI18n","_ChartsWithData","obj","__esModule","default","Main","lang","useLocale","createElement","className","concat","ChartWithData","exports"],"sources":["../../../src/CurrencyStrengthWidget/Main.tsx"],"sourcesContent":["import React from 'react';\nimport { useLocale } from '@oanda/mono-i18n';\nimport { ChartWithData } from './ChartsWithData';\n\nconst Main = () => {\n const { lang } = useLocale();\n\n return (\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('5_minutes')})`}</span>\n </div>\n <ChartWithData />\n </div>\n );\n};\n\nexport { Main };\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AACA,IAAAE,eAAA,GAAAF,OAAA;AAAiD,SAAAD,uBAAAI,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAEjD,MAAMG,IAAI,GAAGA,CAAA,KAAM;EACjB,MAAM;IAAEC;EAAK,CAAC,GAAG,IAAAC,mBAAS,EAAC,CAAC;EAE5B,OACEV,MAAA,CAAAO,OAAA,CAAAI,aAAA;IAAK,eAAY;EAA2B,GAC1CX,MAAA,CAAAO,OAAA,CAAAI,aAAA;IAAKC,SAAS,EAAC;EAAwE,GACrFZ,MAAA,CAAAO,OAAA,CAAAI,aAAA,kBAAAE,MAAA,CAAUJ,IAAI,CAAC,OAAO,CAAC,QAAAI,MAAA,CAAKJ,IAAI,CAAC,WAAW,CAAC,MAAU,CACpD,CAAC,EACNT,MAAA,CAAAO,OAAA,CAAAI,aAAA,CAACP,eAAA,CAAAU,aAAa,MAAE,CACb,CAAC;AAEV,CAAC;AAACC,OAAA,CAAAP,IAAA,GAAAA,IAAA"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.Chart = void 0;
|
|
7
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _core = _interopRequireDefault(require("echarts-for-react/lib/core"));
|
|
9
|
+
var echarts = _interopRequireWildcard(require("echarts/core"));
|
|
10
|
+
var _charts = require("echarts/charts");
|
|
11
|
+
var _renderers = require("echarts/renderers");
|
|
12
|
+
var _components = require("echarts/components");
|
|
13
|
+
var _monoI18n = require("@oanda/mono-i18n");
|
|
14
|
+
var _labsWidgetCommon = require("@oanda/labs-widget-common");
|
|
15
|
+
var _constants = require("./constants");
|
|
16
|
+
var _getOption = require("./getOption");
|
|
17
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
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
|
+
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 && Object.prototype.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
|
+
echarts.use([_components.GridSimpleComponent, _components.GraphicComponent, _components.TooltipComponent, _components.TitleComponent, _charts.BarChart, _renderers.CanvasRenderer]);
|
|
21
|
+
echarts.registerTheme('dark_theme', (0, _labsWidgetCommon.getChartTheme)(_labsWidgetCommon.Theme.Dark));
|
|
22
|
+
echarts.registerTheme('light_theme', (0, _labsWidgetCommon.getChartTheme)(_labsWidgetCommon.Theme.Light));
|
|
23
|
+
const Chart = _ref => {
|
|
24
|
+
let {
|
|
25
|
+
values,
|
|
26
|
+
currency
|
|
27
|
+
} = _ref;
|
|
28
|
+
const {
|
|
29
|
+
lang
|
|
30
|
+
} = (0, _monoI18n.useLocale)();
|
|
31
|
+
const {
|
|
32
|
+
isDark
|
|
33
|
+
} = (0, _react.useContext)(_labsWidgetCommon.ThemeContext);
|
|
34
|
+
return _react.default.createElement(_core.default, {
|
|
35
|
+
echarts: echarts,
|
|
36
|
+
theme: isDark ? 'dark_theme' : 'light_theme',
|
|
37
|
+
style: {
|
|
38
|
+
height: "".concat(_constants.CHART_HEIGHT, "px"),
|
|
39
|
+
width: '100%'
|
|
40
|
+
},
|
|
41
|
+
option: (0, _getOption.getOption)({
|
|
42
|
+
values,
|
|
43
|
+
currency,
|
|
44
|
+
lang,
|
|
45
|
+
isDark
|
|
46
|
+
})
|
|
47
|
+
});
|
|
48
|
+
};
|
|
49
|
+
exports.Chart = Chart;
|
|
50
|
+
//# sourceMappingURL=Chart.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Chart.js","names":["_react","_interopRequireWildcard","require","_core","_interopRequireDefault","echarts","_charts","_renderers","_components","_monoI18n","_labsWidgetCommon","_constants","_getOption","obj","__esModule","default","_getRequireWildcardCache","e","WeakMap","r","t","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","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","concat","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,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAAA,SAAAG,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,SAAAhB,wBAAAgB,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAH,UAAA,SAAAG,CAAA,eAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,WAAAF,OAAA,EAAAE,CAAA,QAAAG,CAAA,GAAAJ,wBAAA,CAAAG,CAAA,OAAAC,C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AAU,EAACC,8BAAY,CAAC;EAE3C,OACEvD,MAAA,CAAAe,OAAA,CAAAyC,aAAA,CAACrD,KAAA,CAAAY,OAAgB;IACfV,OAAO,EAAEA,OAAQ;IACjBoD,KAAK,EAAEJ,MAAM,GAAG,YAAY,GAAG,aAAc;IAC7CK,KAAK,EAAE;MACLC,MAAM,KAAAC,MAAA,CAAKC,uBAAY,OAAI;MAC3BC,KAAK,EAAE;IACT,CAAE;IACFC,MAAM,EAAE,IAAAC,oBAAS,EAAC;MAChBf,MAAM;MAAEC,QAAQ;MAAEC,IAAI;MAAEE;IAC1B,CAAC;EAAE,CACJ,CAAC;AAEN,CAAC;AAACY,OAAA,CAAAlB,KAAA,GAAAA,KAAA"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.lightBarColors = exports.darkBarColors = exports.Y_LABEL_SIZE = exports.X_LABEL_SIZE = exports.CHART_WIDTH = exports.CHART_HEIGHT = void 0;
|
|
7
|
+
var _labsWidgetCommon = require("@oanda/labs-widget-common");
|
|
8
|
+
const X_LABEL_SIZE = exports.X_LABEL_SIZE = 24;
|
|
9
|
+
const Y_LABEL_SIZE = exports.Y_LABEL_SIZE = 30;
|
|
10
|
+
const CHART_WIDTH = exports.CHART_WIDTH = 9999;
|
|
11
|
+
const CHART_HEIGHT = exports.CHART_HEIGHT = 135;
|
|
12
|
+
const darkBarColors = exports.darkBarColors = {
|
|
13
|
+
positive: _labsWidgetCommon.colorPalette.bottleGreenLight,
|
|
14
|
+
negative: _labsWidgetCommon.colorPalette.orange,
|
|
15
|
+
zero: _labsWidgetCommon.colorPalette.disabledGray
|
|
16
|
+
};
|
|
17
|
+
const lightBarColors = exports.lightBarColors = {
|
|
18
|
+
positive: _labsWidgetCommon.colorPalette.bottleGreenLight,
|
|
19
|
+
negative: _labsWidgetCommon.colorPalette.raspberryDark,
|
|
20
|
+
zero: _labsWidgetCommon.colorPalette.disabledGray
|
|
21
|
+
};
|
|
22
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","names":["_labsWidgetCommon","require","X_LABEL_SIZE","exports","Y_LABEL_SIZE","CHART_WIDTH","CHART_HEIGHT","darkBarColors","positive","colorPalette","bottleGreenLight","negative","orange","zero","disabledGray","lightBarColors","raspberryDark"],"sources":["../../../../../src/CurrencyStrengthWidget/components/Chart/constants.tsx"],"sourcesContent":["import { colorPalette } from '@oanda/labs-widget-common';\n\nexport const X_LABEL_SIZE = 24;\nexport const Y_LABEL_SIZE = 30;\nexport const CHART_WIDTH = 9999;\nexport const CHART_HEIGHT = 135;\n\nexport const darkBarColors = {\n positive: colorPalette.bottleGreenLight,\n negative: colorPalette.orange,\n zero: colorPalette.disabledGray,\n};\n\nexport const lightBarColors = {\n positive: colorPalette.bottleGreenLight,\n negative: colorPalette.raspberryDark,\n zero: colorPalette.disabledGray,\n};\n"],"mappings":";;;;;;AAAA,IAAAA,iBAAA,GAAAC,OAAA;AAEO,MAAMC,YAAY,GAAAC,OAAA,CAAAD,YAAA,GAAG,EAAE;AACvB,MAAME,YAAY,GAAAD,OAAA,CAAAC,YAAA,GAAG,EAAE;AACvB,MAAMC,WAAW,GAAAF,OAAA,CAAAE,WAAA,GAAG,IAAI;AACxB,MAAMC,YAAY,GAAAH,OAAA,CAAAG,YAAA,GAAG,GAAG;AAExB,MAAMC,aAAa,GAAAJ,OAAA,CAAAI,aAAA,GAAG;EAC3BC,QAAQ,EAAEC,8BAAY,CAACC,gBAAgB;EACvCC,QAAQ,EAAEF,8BAAY,CAACG,MAAM;EAC7BC,IAAI,EAAEJ,8BAAY,CAACK;AACrB,CAAC;AAEM,MAAMC,cAAc,GAAAZ,OAAA,CAAAY,cAAA,GAAG;EAC5BP,QAAQ,EAAEC,8BAAY,CAACC,gBAAgB;EACvCC,QAAQ,EAAEF,8BAAY,CAACO,aAAa;EACpCH,IAAI,EAAEJ,8BAAY,CAACK;AACrB,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.tooltipFormatter = void 0;
|
|
7
|
+
const tooltipFormatter = _ref => {
|
|
8
|
+
let {
|
|
9
|
+
marker,
|
|
10
|
+
name,
|
|
11
|
+
value,
|
|
12
|
+
currency,
|
|
13
|
+
lang
|
|
14
|
+
} = _ref;
|
|
15
|
+
return "\n<div>\n <div style=\"margin-bottom:5px;\">".concat(currency, " ").concat(lang('vs'), " ").concat(name, "</div>\n <div style=\"display:flex;align-items:center;\">").concat(marker, " ").concat(value, "%</div>\n</div>");
|
|
16
|
+
};
|
|
17
|
+
exports.tooltipFormatter = tooltipFormatter;
|
|
18
|
+
//# sourceMappingURL=formatters.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"formatters.js","names":["tooltipFormatter","_ref","marker","name","value","currency","lang","concat","exports"],"sources":["../../../../../src/CurrencyStrengthWidget/components/Chart/formatters.ts"],"sourcesContent":["import { TooltipFormatterParams } from './types';\n\nexport const 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"],"mappings":";;;;;;AAEO,MAAMA,gBAAgB,GAAGC,IAAA;EAAA,IAAC;IAC/BC,MAAM;IACNC,IAAI;IACJC,KAAK;IACLC,QAAQ;IACRC;EACsB,CAAC,GAAAL,IAAA;EAAA,uDAAAM,MAAA,CAEWF,QAAQ,OAAAE,MAAA,CAAID,IAAI,CAAC,IAAI,CAAC,OAAAC,MAAA,CAAIJ,IAAI,gEAAAI,MAAA,CAChBL,MAAM,OAAAK,MAAA,CAAIH,KAAK;AAAA,CAC1D;AAACI,OAAA,CAAAR,gBAAA,GAAAA,gBAAA"}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.getOption = void 0;
|
|
7
|
+
var _labsWidgetCommon = require("@oanda/labs-widget-common");
|
|
8
|
+
var _constants = require("./constants");
|
|
9
|
+
var _formatters = require("./formatters");
|
|
10
|
+
const getOption = _ref => {
|
|
11
|
+
let {
|
|
12
|
+
values,
|
|
13
|
+
currency,
|
|
14
|
+
isDark,
|
|
15
|
+
lang
|
|
16
|
+
} = _ref;
|
|
17
|
+
const currencies = values.map(item => item.currency);
|
|
18
|
+
const percentages = values.map(item => item.percentage);
|
|
19
|
+
const barColors = isDark ? _constants.darkBarColors : _constants.lightBarColors;
|
|
20
|
+
const gridLines = (0, _labsWidgetCommon.getGridLines)({
|
|
21
|
+
isDark,
|
|
22
|
+
chartWidth: _constants.CHART_WIDTH,
|
|
23
|
+
chartHeight: _constants.CHART_HEIGHT,
|
|
24
|
+
xLabelsSize: -2,
|
|
25
|
+
yLabelSize: -3
|
|
26
|
+
});
|
|
27
|
+
return {
|
|
28
|
+
animation: false,
|
|
29
|
+
title: {
|
|
30
|
+
left: 'center',
|
|
31
|
+
text: "".concat(currency, " vs"),
|
|
32
|
+
textStyle: {
|
|
33
|
+
fontSize: 12,
|
|
34
|
+
lineHeight: 20,
|
|
35
|
+
fontWeight: 400
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
grid: [{
|
|
39
|
+
name: 'main-grid',
|
|
40
|
+
top: '30px',
|
|
41
|
+
right: '0px',
|
|
42
|
+
left: "".concat(_constants.Y_LABEL_SIZE, "px"),
|
|
43
|
+
bottom: "".concat(_constants.X_LABEL_SIZE, "px")
|
|
44
|
+
}],
|
|
45
|
+
graphic: [...gridLines],
|
|
46
|
+
tooltip: {
|
|
47
|
+
trigger: 'axis',
|
|
48
|
+
formatter: _ref2 => {
|
|
49
|
+
let [{
|
|
50
|
+
marker,
|
|
51
|
+
name,
|
|
52
|
+
value
|
|
53
|
+
}] = _ref2;
|
|
54
|
+
return (0, _formatters.tooltipFormatter)({
|
|
55
|
+
lang,
|
|
56
|
+
currency,
|
|
57
|
+
marker,
|
|
58
|
+
name,
|
|
59
|
+
value
|
|
60
|
+
});
|
|
61
|
+
},
|
|
62
|
+
axisPointer: {
|
|
63
|
+
axis: 'x'
|
|
64
|
+
},
|
|
65
|
+
extraCssText: 'z-index: 1'
|
|
66
|
+
},
|
|
67
|
+
xAxis: {
|
|
68
|
+
type: 'category',
|
|
69
|
+
data: currencies,
|
|
70
|
+
axisTick: {
|
|
71
|
+
show: false
|
|
72
|
+
},
|
|
73
|
+
axisLine: {
|
|
74
|
+
show: false
|
|
75
|
+
},
|
|
76
|
+
splitLine: {
|
|
77
|
+
show: false
|
|
78
|
+
},
|
|
79
|
+
axisLabel: {
|
|
80
|
+
fontSize: 10
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
yAxis: {
|
|
84
|
+
type: 'value',
|
|
85
|
+
position: 'left',
|
|
86
|
+
min: Math.floor(Math.min(...percentages)),
|
|
87
|
+
max: Math.ceil(Math.max(...percentages)),
|
|
88
|
+
interval: 1,
|
|
89
|
+
axisLine: {
|
|
90
|
+
show: false
|
|
91
|
+
},
|
|
92
|
+
axisTick: {
|
|
93
|
+
show: false
|
|
94
|
+
},
|
|
95
|
+
axisLabel: {
|
|
96
|
+
formatter: '{value}%',
|
|
97
|
+
fontSize: 10
|
|
98
|
+
}
|
|
99
|
+
},
|
|
100
|
+
series: [{
|
|
101
|
+
data: percentages,
|
|
102
|
+
type: 'bar',
|
|
103
|
+
itemStyle: {
|
|
104
|
+
color: _ref3 => {
|
|
105
|
+
let {
|
|
106
|
+
data
|
|
107
|
+
} = _ref3;
|
|
108
|
+
if (data > 0) {
|
|
109
|
+
return barColors.positive;
|
|
110
|
+
}
|
|
111
|
+
if (data < 0) {
|
|
112
|
+
return barColors.negative;
|
|
113
|
+
}
|
|
114
|
+
return barColors.zero;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}]
|
|
118
|
+
};
|
|
119
|
+
};
|
|
120
|
+
exports.getOption = getOption;
|
|
121
|
+
//# sourceMappingURL=getOption.js.map
|
|
@@ -0,0 +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","concat","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","itemStyle","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 itemStyle: {\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,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,MA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QAAEF,IAAI,EAAE;MAAM,CAAC;MAC1BG,SAAS,EAAE;QACT5B,QAAQ,EAAE;MACZ;IACF,CAAC;IACD6B,KAAK,EAAE;MACLP,IAAI,EAAE,OAAO;MACbQ,QAAQ,EAAE,MAAM;MAChBC,GAAG,EAAEC,IAAI,CAACC,KAAK,CAACD,IAAI,CAACD,GAAG,CAAC,GAAGlD,WAAW,CAAC,CAAC;MACzCqD,GAAG,EAAEF,IAAI,CAACG,IAAI,CAACH,IAAI,CAACE,GAAG,CAAC,GAAGrD,WAAW,CAAC,CAAC;MACxCuD,QAAQ,EAAE,CAAC;MACXV,QAAQ,EAAE;QAAED,IAAI,EAAE;MAAM,CAAC;MACzBD,QAAQ,EAAE;QAAEC,IAAI,EAAE;MAAM,CAAC;MACzBG,SAAS,EAAE;QACTf,SAAS,EAAE,UAAU;QACrBb,QAAQ,EAAE;MACZ;IACF,CAAC;IACDqC,MAAM,EAAE,CACN;MACEd,IAAI,EAAE1C,WAAW;MACjByC,IAAI,EAAE,KAAK;MACXgB,SAAS,EAAE;QACTC,KAAK,EAAEC,KAAA,IAAiC;UAAA,IAAhC;YAAEjB;UAAwB,CAAC,GAAAiB,KAAA;UACjC,IAAIjB,IAAI,GAAG,CAAC,EAAE;YACZ,OAAOxC,SAAS,CAAC0D,QAAQ;UAC3B;UACA,IAAIlB,IAAI,GAAG,CAAC,EAAE;YACZ,OAAOxC,SAAS,CAAC2D,QAAQ;UAC3B;UACA,OAAO3D,SAAS,CAAC4D,IAAI;QACvB;MACF;IACF,CAAC;EAEL,CAAC;AACH,CAAC;AAACC,OAAA,CAAAxE,SAAA,GAAAA,SAAA"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var _Chart = require("./Chart");
|
|
7
|
+
Object.keys(_Chart).forEach(function (key) {
|
|
8
|
+
if (key === "default" || key === "__esModule") return;
|
|
9
|
+
if (key in exports && exports[key] === _Chart[key]) return;
|
|
10
|
+
Object.defineProperty(exports, key, {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function () {
|
|
13
|
+
return _Chart[key];
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
});
|
|
17
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["_Chart","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get"],"sources":["../../../../../src/CurrencyStrengthWidget/components/Chart/index.ts"],"sourcesContent":["export * from './Chart';\n"],"mappings":";;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,MAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,MAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAT,MAAA,CAAAK,GAAA;IAAA;EAAA;AAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","names":[],"sources":["../../../../../src/CurrencyStrengthWidget/components/Chart/types.ts"],"sourcesContent":["import { CurrencyName } from '../../../gql/types/graphql';\n\nexport interface CPBChartDataValues {\n currency: CurrencyName;\n percentage: number;\n}\nexport interface ChartProps {\n values: CPBChartDataValues[];\n currency: CurrencyName;\n}\n\nexport interface TooltipFormatterParams {\n marker: string;\n name: string;\n value: number;\n currency: CurrencyName;\n lang: (label: string) => string;\n}\n\nexport type GetOptionProps = {\n values: CPBChartDataValues[],\n currency: CurrencyName,\n lang: (label: string) => string,\n isDark: boolean;\n};\n"],"mappings":""}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var _CurrencyStrengthWidget = require("./CurrencyStrengthWidget");
|
|
7
|
+
Object.keys(_CurrencyStrengthWidget).forEach(function (key) {
|
|
8
|
+
if (key === "default" || key === "__esModule") return;
|
|
9
|
+
if (key in exports && exports[key] === _CurrencyStrengthWidget[key]) return;
|
|
10
|
+
Object.defineProperty(exports, key, {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function () {
|
|
13
|
+
return _CurrencyStrengthWidget[key];
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
});
|
|
17
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["_CurrencyStrengthWidget","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get"],"sources":["../../../src/CurrencyStrengthWidget/index.ts"],"sourcesContent":["export * from './CurrencyStrengthWidget';\n"],"mappings":";;;;;AAAA,IAAAA,uBAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,uBAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,uBAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAT,uBAAA,CAAAK,GAAA;IAAA;EAAA;AAAA"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _react = _interopRequireDefault(require("react"));
|
|
4
|
+
var _reactDom = require("react-dom");
|
|
5
|
+
var _labsWidgetCommon = require("@oanda/labs-widget-common");
|
|
6
|
+
var _CurrencyStrengthWidget = require("./CurrencyStrengthWidget");
|
|
7
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
8
|
+
const {
|
|
9
|
+
graphqlUrl
|
|
10
|
+
} = window.widgetsConfig || {};
|
|
11
|
+
const volatilityChartParamsElements = document.querySelectorAll('div[data-currency-strength-params]');
|
|
12
|
+
volatilityChartParamsElements.forEach(element => {
|
|
13
|
+
const params = element.getAttribute('data-currency-strength-params');
|
|
14
|
+
const mode = element.getAttribute('data-mode');
|
|
15
|
+
const {
|
|
16
|
+
locale
|
|
17
|
+
} = JSON.parse(params);
|
|
18
|
+
const isParamError = (0, _labsWidgetCommon.validateToolParams)({
|
|
19
|
+
locale,
|
|
20
|
+
graphqlUrl
|
|
21
|
+
}, [{
|
|
22
|
+
name: 'locale',
|
|
23
|
+
valueCheck: value => value.split('-')[0] === 'en' || value.split('-')[0] === 'zh'
|
|
24
|
+
}, {
|
|
25
|
+
name: 'graphqlUrl'
|
|
26
|
+
}]);
|
|
27
|
+
(0, _reactDom.render)(_react.default.createElement(_CurrencyStrengthWidget.CurrencyStrengthWidget, {
|
|
28
|
+
graphqlUrl: graphqlUrl,
|
|
29
|
+
locale: locale,
|
|
30
|
+
theme: mode,
|
|
31
|
+
isParamError: isParamError
|
|
32
|
+
}), element);
|
|
33
|
+
});
|
|
34
|
+
//# sourceMappingURL=render.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"render.js","names":["_react","_interopRequireDefault","require","_reactDom","_labsWidgetCommon","_CurrencyStrengthWidget","obj","__esModule","default","graphqlUrl","window","widgetsConfig","volatilityChartParamsElements","document","querySelectorAll","forEach","element","params","getAttribute","mode","locale","JSON","parse","isParamError","validateToolParams","name","valueCheck","value","split","render","createElement","CurrencyStrengthWidget","theme"],"sources":["../../../src/CurrencyStrengthWidget/render.tsx"],"sourcesContent":["import React from 'react';\nimport { render } from 'react-dom';\nimport { Theme, validateToolParams } from '@oanda/labs-widget-common';\nimport { CurrencyStrengthWidget } from './CurrencyStrengthWidget';\n\nconst {\n graphqlUrl,\n} = window.widgetsConfig || {};\n\nconst volatilityChartParamsElements = document.querySelectorAll('div[data-currency-strength-params]');\n\nvolatilityChartParamsElements.forEach((element) => {\n const params = element.getAttribute('data-currency-strength-params');\n const mode = element.getAttribute('data-mode');\n const { locale } = JSON.parse(params as string);\n\n const isParamError = validateToolParams({ locale, graphqlUrl }, [\n {\n name: 'locale',\n valueCheck: (value) => value.split('-')[0] === 'en' || value.split('-')[0] === 'zh',\n }, {\n name: 'graphqlUrl',\n }]);\n\n render(\n <CurrencyStrengthWidget\n graphqlUrl={graphqlUrl}\n locale={locale}\n theme={mode as Theme}\n isParamError={isParamError}\n />,\n element,\n );\n});\n"],"mappings":";;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AACA,IAAAE,iBAAA,GAAAF,OAAA;AACA,IAAAG,uBAAA,GAAAH,OAAA;AAAkE,SAAAD,uBAAAK,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAElE,MAAM;EACJG;AACF,CAAC,GAAGC,MAAM,CAACC,aAAa,IAAI,CAAC,CAAC;AAE9B,MAAMC,6BAA6B,GAAGC,QAAQ,CAACC,gBAAgB,CAAC,oCAAoC,CAAC;AAErGF,6BAA6B,CAACG,OAAO,CAAEC,OAAO,IAAK;EACjD,MAAMC,MAAM,GAAGD,OAAO,CAACE,YAAY,CAAC,+BAA+B,CAAC;EACpE,MAAMC,IAAI,GAAGH,OAAO,CAACE,YAAY,CAAC,WAAW,CAAC;EAC9C,MAAM;IAAEE;EAAO,CAAC,GAAGC,IAAI,CAACC,KAAK,CAACL,MAAgB,CAAC;EAE/C,MAAMM,YAAY,GAAG,IAAAC,oCAAkB,EAAC;IAAEJ,MAAM;IAAEX;EAAW,CAAC,EAAE,CAC9D;IACEgB,IAAI,EAAE,QAAQ;IACdC,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;EACjF,CAAC,EAAE;IACDH,IAAI,EAAE;EACR,CAAC,CAAC,CAAC;EAEL,IAAAI,gBAAM,EACJ7B,MAAA,CAAAQ,OAAA,CAAAsB,aAAA,CAACzB,uBAAA,CAAA0B,sBAAsB;IACrBtB,UAAU,EAAEA,UAAW;IACvBW,MAAM,EAAEA,MAAO;IACfY,KAAK,EAAEb,IAAc;IACrBI,YAAY,EAAEA;EAAa,CAC5B,CAAC,EACFP,OACF,CAAC;AACH,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","names":[],"sources":["../../../src/CurrencyStrengthWidget/types.ts"],"sourcesContent":["import { Locale } from '@oanda/mono-i18n';\nimport { Theme } from '@oanda/labs-widget-common';\n\nexport interface VolatilityChartConfig {\n graphqlUrl: string;\n locale: Locale;\n theme?: Theme;\n isParamError?: boolean;\n}\n\nexport interface VolatilityChartWrapperConfig extends VolatilityChartConfig {\n renderElementId: string;\n}\n"],"mappings":""}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.getCurrencyStrength = void 0;
|
|
7
|
+
var _client = require("@apollo/client");
|
|
8
|
+
var _templateObject;
|
|
9
|
+
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
10
|
+
const getCurrencyStrength = exports.getCurrencyStrength = (0, _client.gql)(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n query GetCurrencyStrength {\n currencyStrength {\n currency\n strengthRelation {\n currency\n percentage\n }\n }\n }\n"])));
|
|
11
|
+
//# sourceMappingURL=getCurrencyStrength.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getCurrencyStrength.js","names":["_client","require","_templateObject","_taggedTemplateLiteral","strings","raw","slice","Object","freeze","defineProperties","value","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 }\n }\n`;\n\nexport { getCurrencyStrength };\n"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AAAqC,IAAAC,eAAA;AAAA,SAAAC,uBAAAC,OAAA,EAAAC,GAAA,SAAAA,GAAA,IAAAA,GAAA,GAAAD,OAAA,CAAAE,KAAA,cAAAC,MAAA,CAAAC,MAAA,CAAAD,MAAA,CAAAE,gBAAA,CAAAL,OAAA,IAAAC,GAAA,IAAAK,KAAA,EAAAH,MAAA,CAAAC,MAAA,CAAAH,GAAA;AAErC,MAAMM,mBAAmB,GAAAC,OAAA,CAAAD,mBAAA,OAAGE,WAAG,EAAAX,eAAA,KAAAA,eAAA,GAAAC,sBAAA,sKAU9B"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.isFragmentReady = isFragmentReady;
|
|
7
|
+
exports.makeFragmentData = makeFragmentData;
|
|
8
|
+
exports.useFragment = useFragment;
|
|
9
|
+
function useFragment(_documentNode, fragmentType) {
|
|
10
|
+
return fragmentType;
|
|
11
|
+
}
|
|
12
|
+
function makeFragmentData(data, _fragment) {
|
|
13
|
+
return data;
|
|
14
|
+
}
|
|
15
|
+
function isFragmentReady(queryNode, fragmentNode, data) {
|
|
16
|
+
var _meta__, _fragDef$name;
|
|
17
|
+
const deferredFields = (_meta__ = queryNode.__meta__) === null || _meta__ === void 0 ? void 0 : _meta__.deferredFields;
|
|
18
|
+
if (!deferredFields) return true;
|
|
19
|
+
const fragDef = fragmentNode.definitions[0];
|
|
20
|
+
const fragName = fragDef === null || fragDef === void 0 || (_fragDef$name = fragDef.name) === null || _fragDef$name === void 0 ? void 0 : _fragDef$name.value;
|
|
21
|
+
const fields = fragName && deferredFields[fragName] || [];
|
|
22
|
+
return fields.length > 0 && fields.every(field => data && field in data);
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=fragment-masking.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fragment-masking.js","names":["useFragment","_documentNode","fragmentType","makeFragmentData","data","_fragment","isFragmentReady","queryNode","fragmentNode","_meta__","_fragDef$name","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;EAAA,IAAAK,OAAA,EAAAC,aAAA;EAC3C,MAAMC,cAAc,IAAAF,OAAA,GAAIF,SAAS,CAAwEK,QAAQ,cAAAH,OAAA,uBAA1FA,OAAA,CACnBE,cAAc;EAElB,IAAI,CAACA,cAAc,EAAE,OAAO,IAAI;EAEhC,MAAME,OAAO,GAAGL,YAAY,CAACM,WAAW,CAAC,CAAC,CAAuC;EACjF,MAAMC,QAAQ,GAAGF,OAAO,aAAPA,OAAO,gBAAAH,aAAA,GAAPG,OAAO,CAAEG,IAAI,cAAAN,aAAA,uBAAbA,aAAA,CAAeO,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,IAAIjB,IAAI,IAAIiB,KAAK,IAAIjB,IAAI,CAAC;AAC1E"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.graphql = graphql;
|
|
7
|
+
var types = _interopRequireWildcard(require("./graphql"));
|
|
8
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
9
|
+
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 && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
10
|
+
const documents = {
|
|
11
|
+
"\n query GetCurrencyStrength {\n currencyStrength {\n currency\n strengthRelation {\n currency\n percentage\n }\n }\n }\n": types.GetCurrencyStrengthDocument
|
|
12
|
+
};
|
|
13
|
+
function graphql(source) {
|
|
14
|
+
var _source;
|
|
15
|
+
return (_source = documents[source]) !== null && _source !== void 0 ? _source : {};
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=gql.js.map
|
|
@@ -0,0 +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","prototype","hasOwnProperty","call","i","set","documents","GetCurrencyStrengthDocument","graphql","source","_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 }\\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 }\\n }\\n\"): (typeof documents)[\"\\n query GetCurrencyStrength {\\n currencyStrength {\\n currency\\n strengthRelation {\\n currency\\n percentage\\n }\\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,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAjB,CAAA,EAAAc,CAAA,SAAAI,CAAA,GAAAR,CAAA,GAAAC,MAAA,CAAAE,wBAAA,CAAAb,CAAA,EAAAc,CAAA,UAAAI,CAAA,KAAAA,CAAA,CAAAX,GAAA,IAAAW,CAAA,CAAAC,GAAA,IAAAR,MAAA,CAAAC,cAAA,CAAAJ,CAAA,EAAAM,CAAA,EAAAI,CAAA,IAAAV,CAAA,CAAAM,CAAA,IAAAd,CAAA,CAAAc,CAAA,YAAAN,CA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