@oanda/labs-instrument-live-rate-widget 1.0.34 → 1.0.35
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 +144 -0
- package/dist/main/InstrumentLiveRateWidget/InstrumentLiveRateWidget.js +13 -13
- package/dist/main/InstrumentLiveRateWidget/InstrumentLiveRateWidget.js.map +1 -1
- package/dist/main/InstrumentLiveRateWidget/Main.js +5 -5
- package/dist/main/InstrumentLiveRateWidget/Main.js.map +1 -1
- package/dist/main/InstrumentLiveRateWidget/ValidationWrapper.js +5 -5
- package/dist/main/InstrumentLiveRateWidget/ValidationWrapper.js.map +1 -1
- package/dist/main/InstrumentLiveRateWidget/constant.js.map +1 -1
- package/dist/main/InstrumentLiveRateWidget/render.js +7 -7
- package/dist/main/InstrumentLiveRateWidget/render.js.map +1 -1
- package/dist/main/InstrumentLiveRateWidget/types.js +1 -1
- package/dist/main/InstrumentLiveRateWidget/types.js.map +1 -1
- package/dist/main/InstrumentLiveRateWidget/utils.js +1 -1
- package/dist/main/InstrumentLiveRateWidget/utils.js.map +1 -1
- package/dist/main/gql/types/fragment-masking.js.map +1 -1
- package/dist/main/gql/types/gql.js +2 -2
- package/dist/main/gql/types/gql.js.map +1 -1
- package/dist/main/gql/types/graphql.js +142 -142
- package/dist/main/gql/types/graphql.js.map +1 -1
- package/dist/main/gql/types/index.js.map +1 -1
- package/dist/main/index.js +8 -8
- package/dist/main/index.js.map +1 -1
- package/dist/main/translations/index.js +1 -1
- package/dist/main/translations/index.js.map +1 -1
- package/dist/main/translations/translations.js.map +1 -1
- package/dist/module/InstrumentLiveRateWidget/InstrumentLiveRateWidget.js +13 -13
- package/dist/module/InstrumentLiveRateWidget/InstrumentLiveRateWidget.js.map +1 -1
- package/dist/module/InstrumentLiveRateWidget/Main.js +5 -5
- package/dist/module/InstrumentLiveRateWidget/Main.js.map +1 -1
- package/dist/module/InstrumentLiveRateWidget/ValidationWrapper.js +5 -5
- package/dist/module/InstrumentLiveRateWidget/ValidationWrapper.js.map +1 -1
- package/dist/module/InstrumentLiveRateWidget/constant.js.map +1 -1
- package/dist/module/InstrumentLiveRateWidget/render.js +7 -7
- package/dist/module/InstrumentLiveRateWidget/render.js.map +1 -1
- package/dist/module/InstrumentLiveRateWidget/types.js +1 -1
- package/dist/module/InstrumentLiveRateWidget/types.js.map +1 -1
- package/dist/module/InstrumentLiveRateWidget/utils.js +1 -1
- package/dist/module/InstrumentLiveRateWidget/utils.js.map +1 -1
- package/dist/module/gql/types/fragment-masking.js.map +1 -1
- package/dist/module/gql/types/gql.js +2 -2
- package/dist/module/gql/types/gql.js.map +1 -1
- package/dist/module/gql/types/graphql.js +142 -142
- package/dist/module/gql/types/graphql.js.map +1 -1
- package/dist/module/gql/types/index.js +2 -2
- package/dist/module/gql/types/index.js.map +1 -1
- package/dist/module/index.js +1 -1
- package/dist/module/index.js.map +1 -1
- package/dist/module/translations/index.js +1 -1
- package/dist/module/translations/index.js.map +1 -1
- package/dist/module/translations/translations.js.map +1 -1
- package/dist/types/InstrumentLiveRateWidget/InstrumentLiveRateWidget.d.ts +1 -1
- package/dist/types/InstrumentLiveRateWidget/Main.d.ts +1 -1
- package/dist/types/InstrumentLiveRateWidget/ValidationWrapper.d.ts +1 -1
- package/dist/types/InstrumentLiveRateWidget/constant.d.ts +1 -1
- package/dist/types/InstrumentLiveRateWidget/types.d.ts +3 -3
- package/dist/types/InstrumentLiveRateWidget/utils.d.ts +3 -3
- package/dist/types/gql/types/gql.d.ts +4 -4
- package/dist/types/gql/types/index.d.ts +2 -2
- package/dist/types/index.d.ts +1 -1
- package/dist/types/translations/index.d.ts +2 -2
- package/package.json +3 -3
- package/src/InstrumentLiveRateWidget/InstrumentLiveRateWidget.tsx +13 -12
- package/src/InstrumentLiveRateWidget/Main.tsx +12 -8
- package/src/InstrumentLiveRateWidget/ValidationWrapper.tsx +32 -28
- package/src/InstrumentLiveRateWidget/constant.ts +1 -3
- package/src/InstrumentLiveRateWidget/render.tsx +44 -31
- package/src/InstrumentLiveRateWidget/types.tsx +8 -3
- package/src/InstrumentLiveRateWidget/utils.ts +16 -16
- package/src/gql/types/fragment-masking.ts +41 -21
- package/src/gql/types/gql.ts +12 -5
- package/src/gql/types/graphql.ts +214 -50
- package/src/gql/types/index.ts +2 -2
- package/src/index.ts +1 -1
- package/src/translations/index.ts +4 -4
- package/src/translations/translations.ts +2 -1
- package/test/Main.test.tsx +9 -5
- package/test/mocks.ts +1 -3
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,150 @@
|
|
|
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.35 (2024-12-16)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
## 1.0.173 (2024-12-11)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
## 1.0.172 (2024-11-29)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
## 1.0.171 (2024-11-28)
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
## 1.0.170 (2024-11-28)
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
## 1.0.169 (2024-11-20)
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
## 1.0.168 (2024-11-19)
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
## 1.0.167 (2024-10-14)
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
## 1.0.166 (2024-10-07)
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
## 1.0.165 (2024-10-03)
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
## 1.0.164 (2024-09-26)
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
## 1.0.163 (2024-09-18)
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
## 1.0.162 (2024-09-12)
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
## 1.0.161 (2024-09-11)
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
## 1.0.160 (2024-09-10)
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
## 1.0.159 (2024-09-09)
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
## 1.0.158 (2024-09-04)
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
## 1.0.157 (2024-09-04)
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
## 1.0.156 (2024-09-02)
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
## 1.0.155 (2024-08-29)
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
## 1.0.154 (2024-08-29)
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
## 1.0.153 (2024-08-23)
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
## 1.0.152 (2024-08-23)
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
## 1.0.151 (2024-08-20)
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
## 1.0.150 (2024-08-19)
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
## 1.0.149 (2024-08-07)
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
## 1.0.148 (2024-08-01)
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
## 1.0.147 (2024-08-01)
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
## 1.0.146 (2024-07-26)
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
## 1.0.145 (2024-07-25)
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
## 1.0.144 (2024-07-22)
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
## 1.0.143 (2024-07-19)
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
## 1.0.142 (2024-07-16)
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
## 1.0.141 (2024-07-16)
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
## 1.0.140 (2024-07-12)
|
|
143
|
+
|
|
144
|
+
**Note:** Version bump only for package @oanda/labs-instrument-live-rate-widget
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
|
|
6
150
|
## 1.0.34 (2024-12-11)
|
|
7
151
|
|
|
8
152
|
|
|
@@ -4,9 +4,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.InstrumentLiveRateWidget = void 0;
|
|
7
|
-
var _react = _interopRequireDefault(require("react"));
|
|
8
7
|
var _client = require("@apollo/client");
|
|
9
8
|
var _labsWidgetCommon = require("@oanda/labs-widget-common");
|
|
9
|
+
var _react = _interopRequireDefault(require("react"));
|
|
10
10
|
var _translations = require("../translations");
|
|
11
11
|
var _types = require("./types");
|
|
12
12
|
var _ValidationWrapper = require("./ValidationWrapper");
|
|
@@ -32,29 +32,29 @@ const InstrumentLiveRateWidget = _ref => {
|
|
|
32
32
|
const dataSource = divisionCode === _types.Division.Ogm ? 'MT5' : 'V20';
|
|
33
33
|
return _react.default.createElement(_labsWidgetCommon.WidgetProvider, {
|
|
34
34
|
withSuspense: true,
|
|
35
|
-
locale: locale,
|
|
36
|
-
translations: _translations.translations,
|
|
37
35
|
client: client,
|
|
38
|
-
theme: theme,
|
|
39
|
-
styling: {
|
|
40
|
-
removePadding
|
|
41
|
-
},
|
|
42
36
|
liveRates: {
|
|
43
37
|
url: liveRatesUrl,
|
|
44
38
|
options: {
|
|
45
39
|
divisionCode,
|
|
46
40
|
dataSource
|
|
47
41
|
}
|
|
48
|
-
}
|
|
42
|
+
},
|
|
43
|
+
locale: locale,
|
|
44
|
+
styling: {
|
|
45
|
+
removePadding
|
|
46
|
+
},
|
|
47
|
+
theme: theme,
|
|
48
|
+
translations: _translations.translations
|
|
49
49
|
}, _react.default.createElement(_labsWidgetCommon.WidgetWrapper, {
|
|
50
|
-
|
|
50
|
+
isParamError: isParamError,
|
|
51
51
|
linkArea: "full",
|
|
52
|
-
|
|
52
|
+
logoLink: logoLink
|
|
53
53
|
}, _react.default.createElement(_ValidationWrapper.ValidationWrapper, {
|
|
54
|
-
size: size,
|
|
55
|
-
instrument: instrument,
|
|
56
54
|
division: division,
|
|
57
|
-
|
|
55
|
+
instrument: instrument,
|
|
56
|
+
isParamError: isParamError,
|
|
57
|
+
size: size
|
|
58
58
|
})));
|
|
59
59
|
};
|
|
60
60
|
exports.InstrumentLiveRateWidget = InstrumentLiveRateWidget;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InstrumentLiveRateWidget.js","names":["
|
|
1
|
+
{"version":3,"file":"InstrumentLiveRateWidget.js","names":["_client","require","_labsWidgetCommon","_react","_interopRequireDefault","_translations","_types","_ValidationWrapper","e","__esModule","default","InstrumentLiveRateWidget","_ref","graphqlUrl","liveRatesUrl","instrument","division","locale","theme","isParamError","removePadding","size","logoLink","client","ApolloClient","uri","cache","InMemoryCache","divisionCode","Division","Opt","Ogm","dataSource","createElement","WidgetProvider","withSuspense","liveRates","url","options","styling","translations","WidgetWrapper","linkArea","ValidationWrapper","exports"],"sources":["../../../src/InstrumentLiveRateWidget/InstrumentLiveRateWidget.tsx"],"sourcesContent":["import { ApolloClient, InMemoryCache } from '@apollo/client';\nimport { WidgetProvider, WidgetWrapper } from '@oanda/labs-widget-common';\nimport React from 'react';\n\nimport { translations } from '../translations';\nimport type { InstrumentLiveRateConfig } from './types';\nimport { Division } from './types';\nimport { ValidationWrapper } from './ValidationWrapper';\n\nconst InstrumentLiveRateWidget = ({\n graphqlUrl,\n liveRatesUrl,\n instrument,\n division,\n locale,\n theme,\n isParamError,\n removePadding,\n size,\n logoLink,\n}: InstrumentLiveRateConfig) => {\n const client = new ApolloClient({\n uri: graphqlUrl,\n cache: new InMemoryCache(),\n });\n\n const divisionCode = division === Division.Opt ? Division.Ogm : division;\n const dataSource = divisionCode === Division.Ogm ? 'MT5' : 'V20';\n\n return (\n <WidgetProvider\n withSuspense\n client={client}\n liveRates={{\n url: liveRatesUrl,\n options: { divisionCode, dataSource },\n }}\n locale={locale}\n styling={{\n removePadding,\n }}\n theme={theme}\n translations={translations}\n >\n <WidgetWrapper\n isParamError={isParamError}\n linkArea=\"full\"\n logoLink={logoLink}\n >\n <ValidationWrapper\n division={division}\n instrument={instrument}\n isParamError={isParamError}\n size={size}\n />\n </WidgetWrapper>\n </WidgetProvider>\n );\n};\n\nexport { InstrumentLiveRateWidget };\n"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,iBAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAC,sBAAA,CAAAH,OAAA;AAEA,IAAAI,aAAA,GAAAJ,OAAA;AAEA,IAAAK,MAAA,GAAAL,OAAA;AACA,IAAAM,kBAAA,GAAAN,OAAA;AAAwD,SAAAG,uBAAAI,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAExD,MAAMG,wBAAwB,GAAGC,IAAA,IAWD;EAAA,IAXE;IAChCC,UAAU;IACVC,YAAY;IACZC,UAAU;IACVC,QAAQ;IACRC,MAAM;IACNC,KAAK;IACLC,YAAY;IACZC,aAAa;IACbC,IAAI;IACJC;EACwB,CAAC,GAAAV,IAAA;EACzB,MAAMW,MAAM,GAAG,IAAIC,oBAAY,CAAC;IAC9BC,GAAG,EAAEZ,UAAU;IACfa,KAAK,EAAE,IAAIC,qBAAa,CAAC;EAC3B,CAAC,CAAC;EAEF,MAAMC,YAAY,GAAGZ,QAAQ,KAAKa,eAAQ,CAACC,GAAG,GAAGD,eAAQ,CAACE,GAAG,GAAGf,QAAQ;EACxE,MAAMgB,UAAU,GAAGJ,YAAY,KAAKC,eAAQ,CAACE,GAAG,GAAG,KAAK,GAAG,KAAK;EAEhE,OACE5B,MAAA,CAAAO,OAAA,CAAAuB,aAAA,CAAC/B,iBAAA,CAAAgC,cAAc;IACbC,YAAY;IACZZ,MAAM,EAAEA,MAAO;IACfa,SAAS,EAAE;MACTC,GAAG,EAAEvB,YAAY;MACjBwB,OAAO,EAAE;QAAEV,YAAY;QAAEI;MAAW;IACtC,CAAE;IACFf,MAAM,EAAEA,MAAO;IACfsB,OAAO,EAAE;MACPnB;IACF,CAAE;IACFF,KAAK,EAAEA,KAAM;IACbsB,YAAY,EAAEA;EAAa,GAE3BrC,MAAA,CAAAO,OAAA,CAAAuB,aAAA,CAAC/B,iBAAA,CAAAuC,aAAa;IACZtB,YAAY,EAAEA,YAAa;IAC3BuB,QAAQ,EAAC,MAAM;IACfpB,QAAQ,EAAEA;EAAS,GAEnBnB,MAAA,CAAAO,OAAA,CAAAuB,aAAA,CAAC1B,kBAAA,CAAAoC,iBAAiB;IAChB3B,QAAQ,EAAEA,QAAS;IACnBD,UAAU,EAAEA,UAAW;IACvBI,YAAY,EAAEA,YAAa;IAC3BE,IAAI,EAAEA;EAAK,CACZ,CACY,CACD,CAAC;AAErB,CAAC;AAACuB,OAAA,CAAAjC,wBAAA,GAAAA,wBAAA","ignoreList":[]}
|
|
@@ -4,11 +4,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.Main = void 0;
|
|
7
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
8
7
|
var _client = require("@apollo/client");
|
|
9
8
|
var _labsWidgetCommon = require("@oanda/labs-widget-common");
|
|
10
|
-
var
|
|
9
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
11
10
|
var _getInstrumentsChart = require("../gql/getInstrumentsChart");
|
|
11
|
+
var _constant = require("./constant");
|
|
12
12
|
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); }
|
|
13
13
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
14
14
|
const Main = _ref => {
|
|
@@ -38,11 +38,11 @@ const Main = _ref => {
|
|
|
38
38
|
}
|
|
39
39
|
}, [record]);
|
|
40
40
|
return _react.default.createElement("div", null, _react.default.createElement(_labsWidgetCommon.InstrumentRateWithChart, {
|
|
41
|
+
queryRef: queryRef,
|
|
41
42
|
record: record,
|
|
42
|
-
target: target,
|
|
43
43
|
size: widgetSize,
|
|
44
|
-
|
|
45
|
-
|
|
44
|
+
target: target,
|
|
45
|
+
tooltipId: _constant.INSTRUMENT_TOOLTIP_ID
|
|
46
46
|
}), _react.default.createElement(_labsWidgetCommon.Tooltip, {
|
|
47
47
|
id: _constant.INSTRUMENT_TOOLTIP_ID
|
|
48
48
|
}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Main.js","names":["
|
|
1
|
+
{"version":3,"file":"Main.js","names":["_client","require","_labsWidgetCommon","_react","_interopRequireWildcard","_getInstrumentsChart","_constant","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","Main","_ref","division","size","widgetSize","record","hasInstrument","instrument","queryRef","useBackgroundQuery","getInstrumentsChart","variables","instruments","fetchPolicy","skip","target","setQuery","useLiveRatesQuery","useEffect","createElement","InstrumentRateWithChart","tooltipId","INSTRUMENT_TOOLTIP_ID","Tooltip","id","exports"],"sources":["../../../src/InstrumentLiveRateWidget/Main.tsx"],"sourcesContent":["import { useBackgroundQuery } from '@apollo/client';\nimport {\n InstrumentRateWithChart,\n Tooltip,\n useLiveRatesQuery,\n} from '@oanda/labs-widget-common';\nimport React, { useEffect } from 'react';\n\nimport { getInstrumentsChart } from '../gql/getInstrumentsChart';\nimport type {\n GetInstrumentsChartQuery,\n GetInstrumentsChartQueryVariables,\n} from '../gql/types/graphql';\nimport { INSTRUMENT_TOOLTIP_ID } from './constant';\nimport type { MainProps } from './types';\n\nconst Main = ({\n division,\n size: widgetSize = 'fullWithChart',\n record,\n}: MainProps) => {\n const hasInstrument = !!record.instrument;\n\n const [queryRef] = useBackgroundQuery<\n GetInstrumentsChartQuery,\n GetInstrumentsChartQueryVariables\n >(getInstrumentsChart, {\n variables: {\n instruments: [record.instrument],\n division,\n },\n fetchPolicy: 'network-only',\n skip: !hasInstrument,\n });\n\n const { target, setQuery } = useLiveRatesQuery();\n\n useEffect(() => {\n if (hasInstrument) {\n setQuery({ instruments: [record?.instrument] });\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [record]);\n\n return (\n <div>\n <InstrumentRateWithChart<GetInstrumentsChartQuery>\n queryRef={queryRef}\n record={record}\n size={widgetSize}\n target={target}\n tooltipId={INSTRUMENT_TOOLTIP_ID}\n />\n <Tooltip id={INSTRUMENT_TOOLTIP_ID} />\n </div>\n );\n};\n\nexport { Main };\n"],"mappings":"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","ignoreList":[]}
|
|
@@ -4,13 +4,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.ValidationWrapper = void 0;
|
|
7
|
-
var _react = _interopRequireDefault(require("react"));
|
|
8
7
|
var _client = require("@apollo/client");
|
|
9
|
-
var _classnames = _interopRequireDefault(require("classnames"));
|
|
10
8
|
var _labsWidgetCommon = require("@oanda/labs-widget-common");
|
|
11
|
-
var
|
|
9
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
10
|
+
var _react = _interopRequireDefault(require("react"));
|
|
12
11
|
var _validateInstruments = require("../gql/validateInstruments");
|
|
13
12
|
var _Main = require("./Main");
|
|
13
|
+
var _utils = require("./utils");
|
|
14
14
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
15
15
|
const ValidationWrapper = _ref => {
|
|
16
16
|
let {
|
|
@@ -42,9 +42,9 @@ const ValidationWrapper = _ref => {
|
|
|
42
42
|
'lw-h-[54px]': widgetSize === 'compact'
|
|
43
43
|
})
|
|
44
44
|
}, _react.default.createElement(_Main.Main, {
|
|
45
|
-
size: widgetSize,
|
|
46
45
|
division: division,
|
|
47
|
-
record: (0, _utils.getRecords)(data)?.[0]
|
|
46
|
+
record: (0, _utils.getRecords)(data)?.[0],
|
|
47
|
+
size: widgetSize
|
|
48
48
|
})), showError && _react.default.createElement("div", {
|
|
49
49
|
className: (0, _classnames.default)('lw-flex lw-w-full lw-items-center', {
|
|
50
50
|
'lw-h-[82px]': widgetSize !== 'compact',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ValidationWrapper.js","names":["
|
|
1
|
+
{"version":3,"file":"ValidationWrapper.js","names":["_client","require","_labsWidgetCommon","_classnames","_interopRequireDefault","_react","_validateInstruments","_Main","_utils","e","__esModule","default","ValidationWrapper","_ref","instrument","division","size","widgetSize","isParamError","useLayoutProvider","data","error","useSuspenseQuery","validateInstruments","variables","instruments","fetchPolicy","errorPolicy","showError","createElement","Fragment","className","classnames","Main","record","getRecords","Error","exports"],"sources":["../../../src/InstrumentLiveRateWidget/ValidationWrapper.tsx"],"sourcesContent":["import { useSuspenseQuery } from '@apollo/client';\nimport { Error, useLayoutProvider } from '@oanda/labs-widget-common';\nimport classnames from 'classnames';\nimport React from 'react';\n\nimport type {\n ValidateInstrumentsQuery,\n ValidateInstrumentsQueryVariables,\n} from '../gql/types/graphql';\nimport { validateInstruments } from '../gql/validateInstruments';\nimport { Main } from './Main';\nimport type { ValidationWrapperProps } from './types';\nimport { getRecords } from './utils';\n\nconst ValidationWrapper = ({\n instrument,\n division,\n size: widgetSize,\n isParamError,\n}: ValidationWrapperProps) => {\n const { size } = useLayoutProvider();\n const { data, error } = useSuspenseQuery<\n ValidateInstrumentsQuery,\n ValidateInstrumentsQueryVariables\n >(validateInstruments, {\n variables: {\n instruments: [instrument],\n division,\n },\n fetchPolicy: 'network-only',\n errorPolicy: 'all',\n });\n\n const showError = !!error || isParamError;\n\n return (\n <>\n {size && (\n <div className=\"lw-flex lw-border lw-border-solid lw-border-border-primary lw-px-4 lw-text-sm lw-tracking-normal lw-text-text-primary\">\n {!showError && (\n <div\n className={classnames({\n 'lw-h-[82px]': widgetSize !== 'compact',\n 'lw-h-[54px]': widgetSize === 'compact',\n })}\n >\n <Main\n division={division}\n record={getRecords(data!)?.[0]!}\n size={widgetSize}\n />\n </div>\n )}\n {showError && (\n <div\n className={classnames('lw-flex lw-w-full lw-items-center', {\n 'lw-h-[82px]': widgetSize !== 'compact',\n 'lw-h-[54px]': widgetSize === 'compact',\n })}\n >\n <Error />\n </div>\n )}\n </div>\n )}\n </>\n );\n};\n\nexport { ValidationWrapper };\n"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,iBAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,MAAA,GAAAD,sBAAA,CAAAH,OAAA;AAMA,IAAAK,oBAAA,GAAAL,OAAA;AACA,IAAAM,KAAA,GAAAN,OAAA;AAEA,IAAAO,MAAA,GAAAP,OAAA;AAAqC,SAAAG,uBAAAK,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAErC,MAAMG,iBAAiB,GAAGC,IAAA,IAKI;EAAA,IALH;IACzBC,UAAU;IACVC,QAAQ;IACRC,IAAI,EAAEC,UAAU;IAChBC;EACsB,CAAC,GAAAL,IAAA;EACvB,MAAM;IAAEG;EAAK,CAAC,GAAG,IAAAG,mCAAiB,EAAC,CAAC;EACpC,MAAM;IAAEC,IAAI;IAAEC;EAAM,CAAC,GAAG,IAAAC,wBAAgB,EAGtCC,wCAAmB,EAAE;IACrBC,SAAS,EAAE;MACTC,WAAW,EAAE,CAACX,UAAU,CAAC;MACzBC;IACF,CAAC;IACDW,WAAW,EAAE,cAAc;IAC3BC,WAAW,EAAE;EACf,CAAC,CAAC;EAEF,MAAMC,SAAS,GAAG,CAAC,CAACP,KAAK,IAAIH,YAAY;EAEzC,OACEb,MAAA,CAAAM,OAAA,CAAAkB,aAAA,CAAAxB,MAAA,CAAAM,OAAA,CAAAmB,QAAA,QACGd,IAAI,IACHX,MAAA,CAAAM,OAAA,CAAAkB,aAAA;IAAKE,SAAS,EAAC;EAAuH,GACnI,CAACH,SAAS,IACTvB,MAAA,CAAAM,OAAA,CAAAkB,aAAA;IACEE,SAAS,EAAE,IAAAC,mBAAU,EAAC;MACpB,aAAa,EAAEf,UAAU,KAAK,SAAS;MACvC,aAAa,EAAEA,UAAU,KAAK;IAChC,CAAC;EAAE,GAEHZ,MAAA,CAAAM,OAAA,CAAAkB,aAAA,CAACtB,KAAA,CAAA0B,IAAI;IACHlB,QAAQ,EAAEA,QAAS;IACnBmB,MAAM,EAAE,IAAAC,iBAAU,EAACf,IAAK,CAAC,GAAG,CAAC,CAAG;IAChCJ,IAAI,EAAEC;EAAW,CAClB,CACE,CACN,EACAW,SAAS,IACRvB,MAAA,CAAAM,OAAA,CAAAkB,aAAA;IACEE,SAAS,EAAE,IAAAC,mBAAU,EAAC,mCAAmC,EAAE;MACzD,aAAa,EAAEf,UAAU,KAAK,SAAS;MACvC,aAAa,EAAEA,UAAU,KAAK;IAChC,CAAC;EAAE,GAEHZ,MAAA,CAAAM,OAAA,CAAAkB,aAAA,CAAC3B,iBAAA,CAAAkC,KAAK,MAAE,CACL,CAEJ,CAEP,CAAC;AAEP,CAAC;AAACC,OAAA,CAAAzB,iBAAA,GAAAA,iBAAA","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constant.js","names":["INSTRUMENT_TOOLTIP_ID","exports"],"sources":["../../../src/InstrumentLiveRateWidget/constant.ts"],"sourcesContent":["const INSTRUMENT_TOOLTIP_ID = 'instrument_tooltip_id';\n\nexport {
|
|
1
|
+
{"version":3,"file":"constant.js","names":["INSTRUMENT_TOOLTIP_ID","exports"],"sources":["../../../src/InstrumentLiveRateWidget/constant.ts"],"sourcesContent":["const INSTRUMENT_TOOLTIP_ID = 'instrument_tooltip_id';\n\nexport { INSTRUMENT_TOOLTIP_ID };\n"],"mappings":";;;;;;AAAA,MAAMA,qBAAqB,GAAAC,OAAA,CAAAD,qBAAA,GAAG,uBAAuB","ignoreList":[]}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var _labsWidgetCommon = require("@oanda/labs-widget-common");
|
|
3
4
|
var _react = _interopRequireDefault(require("react"));
|
|
4
5
|
var _client = require("react-dom/client");
|
|
5
|
-
var _labsWidgetCommon = require("@oanda/labs-widget-common");
|
|
6
|
-
var _InstrumentLiveRateWidget = require("./InstrumentLiveRateWidget");
|
|
7
6
|
var _graphql = require("../gql/types/graphql");
|
|
7
|
+
var _InstrumentLiveRateWidget = require("./InstrumentLiveRateWidget");
|
|
8
8
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
9
9
|
const {
|
|
10
10
|
graphqlUrl,
|
|
@@ -42,14 +42,14 @@ instrumentLiveRateElements.forEach(element => {
|
|
|
42
42
|
name: 'liveRatesUrl'
|
|
43
43
|
}]);
|
|
44
44
|
root.render(_react.default.createElement(_InstrumentLiveRateWidget.InstrumentLiveRateWidget, {
|
|
45
|
-
graphqlUrl: graphqlUrl,
|
|
46
|
-
liveRatesUrl: liveRatesUrl,
|
|
47
45
|
division: division,
|
|
46
|
+
graphqlUrl: graphqlUrl,
|
|
48
47
|
instrument: instrument,
|
|
49
|
-
locale: locale,
|
|
50
|
-
theme: mode,
|
|
51
48
|
isParamError: isParamError,
|
|
52
|
-
|
|
49
|
+
liveRatesUrl: liveRatesUrl,
|
|
50
|
+
locale: locale,
|
|
51
|
+
size: size,
|
|
52
|
+
theme: mode
|
|
53
53
|
}));
|
|
54
54
|
});
|
|
55
55
|
//# sourceMappingURL=render.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"render.js","names":["
|
|
1
|
+
{"version":3,"file":"render.js","names":["_labsWidgetCommon","require","_react","_interopRequireDefault","_client","_graphql","_InstrumentLiveRateWidget","e","__esModule","default","graphqlUrl","liveRatesUrl","window","widgetsConfig","instrumentLiveRateElements","document","querySelectorAll","forEach","element","root","createRoot","params","getAttribute","mode","instrument","division","locale","size","JSON","parse","isParamError","validateToolParams","name","valueCheck","value","validateLocale","Object","values","Division","includes","length","render","createElement","InstrumentLiveRateWidget","theme"],"sources":["../../../src/InstrumentLiveRateWidget/render.tsx"],"sourcesContent":["import type { Theme } from '@oanda/labs-widget-common';\nimport { validateLocale, validateToolParams } from '@oanda/labs-widget-common';\nimport React from 'react';\nimport { createRoot } from 'react-dom/client';\n\nimport { Division } from '../gql/types/graphql';\nimport { InstrumentLiveRateWidget } from './InstrumentLiveRateWidget';\n\nconst { graphqlUrl, liveRatesUrl } = window.widgetsConfig || {};\n\nconst instrumentLiveRateElements = document.querySelectorAll(\n 'div[data-instrument-live-rate-params]'\n);\n\ninstrumentLiveRateElements.forEach((element) => {\n const root = createRoot(element);\n const params = element.getAttribute('data-instrument-live-rate-params');\n const mode = element.getAttribute('data-mode');\n const { instrument, division, locale, size } = JSON.parse(params as string);\n\n const isParamError = validateToolParams(\n {\n division,\n locale,\n instrument,\n graphqlUrl,\n liveRatesUrl,\n },\n [\n {\n name: 'locale',\n valueCheck: (value: string | undefined) => validateLocale(value),\n },\n {\n name: 'division',\n valueCheck: (value: Division) =>\n Object.values(Division).includes(value),\n },\n {\n name: 'instrument',\n valueCheck: (value) => (value as string).length > 0,\n },\n {\n name: 'graphqlUrl',\n },\n {\n name: 'liveRatesUrl',\n },\n ]\n );\n\n root.render(\n <InstrumentLiveRateWidget\n division={division}\n graphqlUrl={graphqlUrl}\n instrument={instrument}\n isParamError={isParamError}\n liveRatesUrl={liveRatesUrl}\n locale={locale}\n size={size}\n theme={mode as Theme}\n />\n );\n});\n"],"mappings":";;AACA,IAAAA,iBAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AAEA,IAAAI,QAAA,GAAAJ,OAAA;AACA,IAAAK,yBAAA,GAAAL,OAAA;AAAsE,SAAAE,uBAAAI,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAEtE,MAAM;EAAEG,UAAU;EAAEC;AAAa,CAAC,GAAGC,MAAM,CAACC,aAAa,IAAI,CAAC,CAAC;AAE/D,MAAMC,0BAA0B,GAAGC,QAAQ,CAACC,gBAAgB,CAC1D,uCACF,CAAC;AAEDF,0BAA0B,CAACG,OAAO,CAAEC,OAAO,IAAK;EAC9C,MAAMC,IAAI,GAAG,IAAAC,kBAAU,EAACF,OAAO,CAAC;EAChC,MAAMG,MAAM,GAAGH,OAAO,CAACI,YAAY,CAAC,kCAAkC,CAAC;EACvE,MAAMC,IAAI,GAAGL,OAAO,CAACI,YAAY,CAAC,WAAW,CAAC;EAC9C,MAAM;IAAEE,UAAU;IAAEC,QAAQ;IAAEC,MAAM;IAAEC;EAAK,CAAC,GAAGC,IAAI,CAACC,KAAK,CAACR,MAAgB,CAAC;EAE3E,MAAMS,YAAY,GAAG,IAAAC,oCAAkB,EACrC;IACEN,QAAQ;IACRC,MAAM;IACNF,UAAU;IACVd,UAAU;IACVC;EACF,CAAC,EACD,CACE;IACEqB,IAAI,EAAE,QAAQ;IACdC,UAAU,EAAGC,KAAyB,IAAK,IAAAC,gCAAc,EAACD,KAAK;EACjE,CAAC,EACD;IACEF,IAAI,EAAE,UAAU;IAChBC,UAAU,EAAGC,KAAe,IAC1BE,MAAM,CAACC,MAAM,CAACC,iBAAQ,CAAC,CAACC,QAAQ,CAACL,KAAK;EAC1C,CAAC,EACD;IACEF,IAAI,EAAE,YAAY;IAClBC,UAAU,EAAGC,KAAK,IAAMA,KAAK,CAAYM,MAAM,GAAG;EACpD,CAAC,EACD;IACER,IAAI,EAAE;EACR,CAAC,EACD;IACEA,IAAI,EAAE;EACR,CAAC,CAEL,CAAC;EAEDb,IAAI,CAACsB,MAAM,CACTvC,MAAA,CAAAO,OAAA,CAAAiC,aAAA,CAACpC,yBAAA,CAAAqC,wBAAwB;IACvBlB,QAAQ,EAAEA,QAAS;IACnBf,UAAU,EAAEA,UAAW;IACvBc,UAAU,EAAEA,UAAW;IACvBM,YAAY,EAAEA,YAAa;IAC3BnB,YAAY,EAAEA,YAAa;IAC3Be,MAAM,EAAEA,MAAO;IACfC,IAAI,EAAEA,IAAK;IACXiB,KAAK,EAAErB;EAAc,CACtB,CACH,CAAC;AACH,CAAC,CAAC","ignoreList":[]}
|
|
@@ -15,6 +15,6 @@ Object.defineProperty(exports, "Locale", {
|
|
|
15
15
|
return _monoI18n.Locale;
|
|
16
16
|
}
|
|
17
17
|
});
|
|
18
|
-
var _monoI18n = require("@oanda/mono-i18n");
|
|
19
18
|
var _graphql = require("../gql/types/graphql");
|
|
19
|
+
var _monoI18n = require("@oanda/mono-i18n");
|
|
20
20
|
//# sourceMappingURL=types.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","names":["
|
|
1
|
+
{"version":3,"file":"types.js","names":["_graphql","require","_monoI18n"],"sources":["../../../src/InstrumentLiveRateWidget/types.tsx"],"sourcesContent":["import type {\n DataRecord,\n WidgetConfig,\n WidgetSize,\n} from '@oanda/labs-widget-common';\n\nimport type { Division } from '../gql/types/graphql';\n\nexport { Division } from '../gql/types/graphql';\nexport { Locale } from '@oanda/mono-i18n';\n\nexport interface InstrumentLiveRateConfig extends WidgetConfig {\n division: Division;\n liveRatesUrl: string;\n instrument: string;\n removePadding?: boolean;\n size?: WidgetSize;\n}\n\nexport interface ValidationWrapperProps {\n instrument: string;\n division: Division;\n size?: WidgetSize;\n isParamError?: boolean;\n}\nexport interface MainProps {\n record: DataRecord;\n division: Division;\n size?: WidgetSize;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAQA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA","ignoreList":[]}
|
|
@@ -4,8 +4,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.useRecords = exports.getRecords = void 0;
|
|
7
|
-
var _react = require("react");
|
|
8
7
|
var _labsWidgetCommon = require("@oanda/labs-widget-common");
|
|
8
|
+
var _react = require("react");
|
|
9
9
|
const getRecords = data => data?.mapInstrumentNames?.map(item => ({
|
|
10
10
|
instrument: item?.name || '',
|
|
11
11
|
displayName: item?.displayName || ''
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","names":["
|
|
1
|
+
{"version":3,"file":"utils.js","names":["_labsWidgetCommon","require","_react","getRecords","data","mapInstrumentNames","map","item","instrument","name","displayName","exports","useRecords","record","target","updatedRecord","setUpdatedRecord","useState","sentiment","error","setError","update","liveRatesError","useLiveRatesMessage","useEffect","buy","ask","buyPriceMovement","askPriceMovement","dailyPercentChange","dailyPercentChangeFromOpen","dailyPipsChange","dailyPipsChangeFromOpen","displayPrecision"],"sources":["../../../src/InstrumentLiveRateWidget/utils.ts"],"sourcesContent":["import type {\n DataRecord,\n LiveRatesErrorMessage,\n} from '@oanda/labs-widget-common';\nimport { useLiveRatesMessage } from '@oanda/labs-widget-common';\nimport { useEffect, useState } from 'react';\n\nimport type { ValidateInstrumentsQuery } from '../gql/types/graphql';\n\nconst getRecords = (data: ValidateInstrumentsQuery) =>\n data?.mapInstrumentNames?.map((item) => ({\n instrument: item?.name || '',\n displayName: item?.displayName || '',\n }));\n\nconst useRecords = (record: DataRecord, target: EventTarget | null) => {\n const [updatedRecord, setUpdatedRecord] = useState<DataRecord>({\n displayName: record.displayName,\n instrument: record.instrument,\n sentiment: record.sentiment,\n });\n const [error, setError] = useState<LiveRatesErrorMessage | null>(null);\n\n const { update, error: liveRatesError } = useLiveRatesMessage(\n record.instrument,\n target\n );\n\n useEffect(() => {\n setUpdatedRecord({\n displayName: record.displayName,\n instrument: record.instrument,\n buy: update?.ask,\n buyPriceMovement: update?.askPriceMovement,\n dailyPercentChange: update?.dailyPercentChangeFromOpen,\n dailyPipsChange: update?.dailyPipsChangeFromOpen,\n displayPrecision: update?.displayPrecision,\n });\n setError(liveRatesError);\n }, [update, record, liveRatesError]);\n\n return {\n updatedRecord,\n error,\n };\n};\n\nexport { getRecords, useRecords };\n"],"mappings":";;;;;;AAIA,IAAAA,iBAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AAIA,MAAME,UAAU,GAAIC,IAA8B,IAChDA,IAAI,EAAEC,kBAAkB,EAAEC,GAAG,CAAEC,IAAI,KAAM;EACvCC,UAAU,EAAED,IAAI,EAAEE,IAAI,IAAI,EAAE;EAC5BC,WAAW,EAAEH,IAAI,EAAEG,WAAW,IAAI;AACpC,CAAC,CAAC,CAAC;AAACC,OAAA,CAAAR,UAAA,GAAAA,UAAA;AAEN,MAAMS,UAAU,GAAGA,CAACC,MAAkB,EAAEC,MAA0B,KAAK;EACrE,MAAM,CAACC,aAAa,EAAEC,gBAAgB,CAAC,GAAG,IAAAC,eAAQ,EAAa;IAC7DP,WAAW,EAAEG,MAAM,CAACH,WAAW;IAC/BF,UAAU,EAAEK,MAAM,CAACL,UAAU;IAC7BU,SAAS,EAAEL,MAAM,CAACK;EACpB,CAAC,CAAC;EACF,MAAM,CAACC,KAAK,EAAEC,QAAQ,CAAC,GAAG,IAAAH,eAAQ,EAA+B,IAAI,CAAC;EAEtE,MAAM;IAAEI,MAAM;IAAEF,KAAK,EAAEG;EAAe,CAAC,GAAG,IAAAC,qCAAmB,EAC3DV,MAAM,CAACL,UAAU,EACjBM,MACF,CAAC;EAED,IAAAU,gBAAS,EAAC,MAAM;IACdR,gBAAgB,CAAC;MACfN,WAAW,EAAEG,MAAM,CAACH,WAAW;MAC/BF,UAAU,EAAEK,MAAM,CAACL,UAAU;MAC7BiB,GAAG,EAAEJ,MAAM,EAAEK,GAAG;MAChBC,gBAAgB,EAAEN,MAAM,EAAEO,gBAAgB;MAC1CC,kBAAkB,EAAER,MAAM,EAAES,0BAA0B;MACtDC,eAAe,EAAEV,MAAM,EAAEW,uBAAuB;MAChDC,gBAAgB,EAAEZ,MAAM,EAAEY;IAC5B,CAAC,CAAC;IACFb,QAAQ,CAACE,cAAc,CAAC;EAC1B,CAAC,EAAE,CAACD,MAAM,EAAER,MAAM,EAAES,cAAc,CAAC,CAAC;EAEpC,OAAO;IACLP,aAAa;IACbI;EACF,CAAC;AACH,CAAC;AAACR,OAAA,CAAAC,UAAA,GAAAA,UAAA","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fragment-masking.js","names":["useFragment","_documentNode","fragmentType","makeFragmentData","data","_fragment","isFragmentReady","queryNode","fragmentNode","deferredFields","__meta__","fragDef","definitions","fragName","name","value","fields","length","every","field"],"sources":["../../../../src/gql/types/fragment-masking.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"fragment-masking.js","names":["useFragment","_documentNode","fragmentType","makeFragmentData","data","_fragment","isFragmentReady","queryNode","fragmentNode","deferredFields","__meta__","fragDef","definitions","fragName","name","value","fields","length","every","field"],"sources":["../../../../src/gql/types/fragment-masking.ts"],"sourcesContent":["import {\n ResultOf,\n DocumentTypeDecoration,\n TypedDocumentNode,\n} from '@graphql-typed-document-node/core';\nimport { FragmentDefinitionNode } from 'graphql';\nimport { Incremental } from './graphql';\n\nexport type FragmentType<\n TDocumentType extends DocumentTypeDecoration<any, any>,\n> =\n TDocumentType extends DocumentTypeDecoration<infer TType, any>\n ? [TType] extends [{ ' $fragmentName'?: infer TKey }]\n ? TKey extends string\n ? { ' $fragmentRefs'?: { [key in TKey]: TType } }\n : never\n : never\n : never;\n\n// return non-nullable if `fragmentType` is non-nullable\nexport function useFragment<TType>(\n _documentNode: DocumentTypeDecoration<TType, any>,\n fragmentType: FragmentType<DocumentTypeDecoration<TType, any>>\n): TType;\n// return nullable if `fragmentType` is nullable\nexport function useFragment<TType>(\n _documentNode: DocumentTypeDecoration<TType, any>,\n fragmentType:\n | FragmentType<DocumentTypeDecoration<TType, any>>\n | null\n | undefined\n): TType | null | undefined;\n// return array of non-nullable if `fragmentType` is array of non-nullable\nexport function useFragment<TType>(\n _documentNode: DocumentTypeDecoration<TType, any>,\n fragmentType: ReadonlyArray<FragmentType<DocumentTypeDecoration<TType, any>>>\n): ReadonlyArray<TType>;\n// return array of nullable if `fragmentType` is array of nullable\nexport function useFragment<TType>(\n _documentNode: DocumentTypeDecoration<TType, any>,\n fragmentType:\n | ReadonlyArray<FragmentType<DocumentTypeDecoration<TType, any>>>\n | null\n | undefined\n): ReadonlyArray<TType> | null | undefined;\nexport function useFragment<TType>(\n _documentNode: DocumentTypeDecoration<TType, any>,\n fragmentType:\n | FragmentType<DocumentTypeDecoration<TType, any>>\n | ReadonlyArray<FragmentType<DocumentTypeDecoration<TType, any>>>\n | null\n | undefined\n): TType | ReadonlyArray<TType> | null | undefined {\n return fragmentType as any;\n}\n\nexport function makeFragmentData<\n F extends DocumentTypeDecoration<any, any>,\n FT extends ResultOf<F>,\n>(data: FT, _fragment: F): FragmentType<F> {\n return data as FragmentType<F>;\n}\nexport function isFragmentReady<TQuery, TFrag>(\n queryNode: DocumentTypeDecoration<TQuery, any>,\n fragmentNode: TypedDocumentNode<TFrag>,\n data:\n | FragmentType<TypedDocumentNode<Incremental<TFrag>, any>>\n | null\n | undefined\n): data is FragmentType<typeof fragmentNode> {\n const deferredFields = (\n queryNode as {\n __meta__?: { deferredFields: Record<string, (keyof TFrag)[]> };\n }\n ).__meta__?.deferredFields;\n\n if (!deferredFields) return true;\n\n const fragDef = fragmentNode.definitions[0] as\n | FragmentDefinitionNode\n | undefined;\n const fragName = fragDef?.name?.value;\n\n const fields = (fragName && deferredFields[fragName]) || [];\n return fields.length > 0 && fields.every((field) => data && field in data);\n}\n"],"mappings":";;;;;;;;AA6CO,SAASA,WAAWA,CACzBC,aAAiD,EACjDC,YAIa,EACoC;EACjD,OAAOA,YAAY;AACrB;AAEO,SAASC,gBAAgBA,CAG9BC,IAAQ,EAAEC,SAAY,EAAmB;EACzC,OAAOD,IAAI;AACb;AACO,SAASE,eAAeA,CAC7BC,SAA8C,EAC9CC,YAAsC,EACtCJ,IAGa,EAC8B;EAC3C,MAAMK,cAAc,GAClBF,SAAS,CAGTG,QAAQ,EAAED,cAAc;EAE1B,IAAI,CAACA,cAAc,EAAE,OAAO,IAAI;EAEhC,MAAME,OAAO,GAAGH,YAAY,CAACI,WAAW,CAAC,CAAC,CAE7B;EACb,MAAMC,QAAQ,GAAGF,OAAO,EAAEG,IAAI,EAAEC,KAAK;EAErC,MAAMC,MAAM,GAAIH,QAAQ,IAAIJ,cAAc,CAACI,QAAQ,CAAC,IAAK,EAAE;EAC3D,OAAOG,MAAM,CAACC,MAAM,GAAG,CAAC,IAAID,MAAM,CAACE,KAAK,CAAEC,KAAK,IAAKf,IAAI,IAAIe,KAAK,IAAIf,IAAI,CAAC;AAC5E","ignoreList":[]}
|
|
@@ -8,8 +8,8 @@ var types = _interopRequireWildcard(require("./graphql"));
|
|
|
8
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
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 && {}.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
10
|
const documents = {
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
'\n query GetInstrumentsChart($instruments: [String!], $division: Division) {\n topicalInstrumentsCharts(instruments: $instruments, division: $division) {\n name\n chart\n }\n }\n': types.GetInstrumentsChartDocument,
|
|
12
|
+
'\n query validateInstruments($instruments: [String]!, $division: Division) {\n mapInstrumentNames(instruments: $instruments, division: $division) {\n name\n displayName\n }\n }\n': types.ValidateInstrumentsDocument
|
|
13
13
|
};
|
|
14
14
|
function graphql(source) {
|
|
15
15
|
return documents[source] ?? {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gql.js","names":["types","_interopRequireWildcard","require","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","documents","GetInstrumentsChartDocument","ValidateInstrumentsDocument","graphql","source"],"sources":["../../../../src/gql/types/gql.ts"],"sourcesContent":["/* eslint-disable */\nimport * as types from './graphql';\nimport { TypedDocumentNode as DocumentNode } from '@graphql-typed-document-node/core';\n\n/**\n * Map of all GraphQL operations in the project.\n *\n * This map has several performance disadvantages:\n * 1. It is not tree-shakeable, so it will include all operations in the project.\n * 2. It is not minifiable, so the string of a GraphQL query will be multiple times inside the bundle.\n * 3. It does not support dead code elimination, so it will add unused operations.\n *\n * Therefore it is highly recommended to use the babel or swc plugin for production.\n */\nconst documents = {\n
|
|
1
|
+
{"version":3,"file":"gql.js","names":["types","_interopRequireWildcard","require","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","documents","GetInstrumentsChartDocument","ValidateInstrumentsDocument","graphql","source"],"sources":["../../../../src/gql/types/gql.ts"],"sourcesContent":["/* eslint-disable */\nimport * as types from './graphql';\nimport { TypedDocumentNode as DocumentNode } from '@graphql-typed-document-node/core';\n\n/**\n * Map of all GraphQL operations in the project.\n *\n * This map has several performance disadvantages:\n * 1. It is not tree-shakeable, so it will include all operations in the project.\n * 2. It is not minifiable, so the string of a GraphQL query will be multiple times inside the bundle.\n * 3. It does not support dead code elimination, so it will add unused operations.\n *\n * Therefore it is highly recommended to use the babel or swc plugin for production.\n */\nconst documents = {\n '\\n query GetInstrumentsChart($instruments: [String!], $division: Division) {\\n topicalInstrumentsCharts(instruments: $instruments, division: $division) {\\n name\\n chart\\n }\\n }\\n':\n types.GetInstrumentsChartDocument,\n '\\n query validateInstruments($instruments: [String]!, $division: Division) {\\n mapInstrumentNames(instruments: $instruments, division: $division) {\\n name\\n displayName\\n }\\n }\\n':\n types.ValidateInstrumentsDocument,\n};\n\n/**\n * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.\n *\n *\n * @example\n * ```ts\n * const query = graphql(`query GetUser($id: ID!) { user(id: $id) { name } }`);\n * ```\n *\n * The query argument is unknown!\n * Please regenerate the types.\n */\nexport function graphql(source: string): unknown;\n\n/**\n * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.\n */\nexport function graphql(\n source: '\\n query GetInstrumentsChart($instruments: [String!], $division: Division) {\\n topicalInstrumentsCharts(instruments: $instruments, division: $division) {\\n name\\n chart\\n }\\n }\\n'\n): (typeof documents)['\\n query GetInstrumentsChart($instruments: [String!], $division: Division) {\\n topicalInstrumentsCharts(instruments: $instruments, division: $division) {\\n name\\n chart\\n }\\n }\\n'];\n/**\n * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.\n */\nexport function graphql(\n source: '\\n query validateInstruments($instruments: [String]!, $division: Division) {\\n mapInstrumentNames(instruments: $instruments, division: $division) {\\n name\\n displayName\\n }\\n }\\n'\n): (typeof documents)['\\n query validateInstruments($instruments: [String]!, $division: Division) {\\n mapInstrumentNames(instruments: $instruments, division: $division) {\\n name\\n displayName\\n }\\n }\\n'];\n\nexport function graphql(source: string) {\n return (documents as any)[source] ?? {};\n}\n\nexport type DocumentType<TDocumentNode extends DocumentNode<any, any>> =\n TDocumentNode extends DocumentNode<infer TType, any> ? TType : never;\n"],"mappings":";;;;;;AACA,IAAAA,KAAA,GAAAC,uBAAA,CAAAC,OAAA;AAAmC,SAAAC,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAH,wBAAAG,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAI,UAAA,SAAAJ,CAAA,eAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,WAAAK,OAAA,EAAAL,CAAA,QAAAG,CAAA,GAAAJ,wBAAA,CAAAG,CAAA,OAAAC,CAAA,IAAAA,CAAA,CAAAG,GAAA,CAAAN,CAAA,UAAAG,CAAA,CAAAI,GAAA,CAAAP,CAAA,OAAAQ,CAAA,KAAAC,SAAA,UAAAC,CAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAAA,CAAAE,wBAAA,WAAAC,CAAA,IAAAd,CAAA,oBAAAc,CAAA,OAAAC,cAAA,CAAAC,IAAA,CAAAhB,CAAA,EAAAc,CAAA,SAAAG,CAAA,GAAAP,CAAA,GAAAC,MAAA,CAAAE,wBAAA,CAAAb,CAAA,EAAAc,CAAA,UAAAG,CAAA,KAAAA,CAAA,CAAAV,GAAA,IAAAU,CAAA,CAAAC,GAAA,IAAAP,MAAA,CAAAC,cAAA,CAAAJ,CAAA,EAAAM,CAAA,EAAAG,CAAA,IAAAT,CAAA,CAAAM,CAAA,IAAAd,CAAA,CAAAc,CAAA,YAAAN,CAAA,CAAAH,OAAA,GAAAL,CAAA,EAAAG,CAAA,IAAAA,CAAA,CAAAe,GAAA,CAAAlB,CAAA,EAAAQ,CAAA,GAAAA,CAAA;AAanC,MAAMW,SAAS,GAAG;EAChB,sMAAsM,EACpMvB,KAAK,CAACwB,2BAA2B;EACnC,sMAAsM,EACpMxB,KAAK,CAACyB;AACV,CAAC;AA6BM,SAASC,OAAOA,CAACC,MAAc,EAAE;EACtC,OAAQJ,SAAS,CAASI,MAAM,CAAC,IAAI,CAAC,CAAC;AACzC","ignoreList":[]}
|