@oanda/labs-sentiment-widget 1.0.168 → 1.0.170

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.
@@ -20,7 +20,8 @@ const SentimentWidget = _ref => {
20
20
  locale,
21
21
  theme,
22
22
  includeDescriptionLabels,
23
- isParamError
23
+ isParamError,
24
+ logoLink
24
25
  } = _ref;
25
26
  const client = new _client.ApolloClient({
26
27
  uri: graphqlUrl,
@@ -35,13 +36,17 @@ const SentimentWidget = _ref => {
35
36
  client: client
36
37
  }, isParamError ? _react.default.createElement("div", {
37
38
  className: "lw-flex lw-h-[425px] lw-w-full lw-items-center lw-border lw-border-solid lw-border-border-primary"
38
- }, _react.default.createElement(_labsWidgetCommon.ChartError, null)) : _react.default.createElement(_react.default.Fragment, null, instrument ? _react.default.createElement(_Widget.Widget, {
39
- division: division,
40
- instrument: instrument,
41
- includeDescriptionLabels: includeDescriptionLabels
42
- }) : _react.default.createElement(_Tool.Tool, {
43
- division: division
44
- })))));
39
+ }, _react.default.createElement(_labsWidgetCommon.ChartError, null)) : (0, _labsWidgetCommon.renderComponent)({
40
+ logoLink,
41
+ linkArea: 'logo',
42
+ Component: instrument ? _react.default.createElement(_Widget.Widget, {
43
+ division: division,
44
+ instrument: instrument,
45
+ includeDescriptionLabels: includeDescriptionLabels
46
+ }) : _react.default.createElement(_Tool.Tool, {
47
+ division: division
48
+ })
49
+ }))));
45
50
  };
46
51
  exports.SentimentWidget = SentimentWidget;
47
52
  //# sourceMappingURL=SentimentWidget.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SentimentWidget.js","names":["_react","_interopRequireDefault","require","_client","_monoI18n","_labsWidgetCommon","_Widget","_Tool","_translations","e","__esModule","default","SentimentWidget","_ref","graphqlUrl","division","instrument","locale","theme","includeDescriptionLabels","isParamError","client","ApolloClient","uri","cache","InMemoryCache","createElement","ThemeProvider","LocaleProvider","getLocale","translations","ApolloProvider","className","ChartError","Fragment","Widget","Tool","exports"],"sources":["../../../src/SentimentWidget/SentimentWidget.tsx"],"sourcesContent":["import React from 'react';\nimport { ApolloClient, InMemoryCache, ApolloProvider } from '@apollo/client';\nimport { LocaleProvider } from '@oanda/mono-i18n';\nimport { ChartError, ThemeProvider, getLocale } from '@oanda/labs-widget-common';\nimport { Widget } from './Widget';\nimport { Tool } from './Tool';\nimport { SentimentConfig } from './types';\nimport { translations } from '../translations';\n\nconst SentimentWidget = ({\n graphqlUrl, division, instrument, locale, theme, includeDescriptionLabels, isParamError,\n}: SentimentConfig) => {\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 ) : (\n <>\n {instrument ? (\n <Widget\n division={division}\n instrument={instrument}\n includeDescriptionLabels={includeDescriptionLabels}\n />\n ) : (\n <Tool division={division} />\n )}\n </>\n )}\n </ApolloProvider>\n </LocaleProvider>\n </ThemeProvider>\n );\n};\n\nexport { SentimentWidget };\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AACA,IAAAG,iBAAA,GAAAH,OAAA;AACA,IAAAI,OAAA,GAAAJ,OAAA;AACA,IAAAK,KAAA,GAAAL,OAAA;AAEA,IAAAM,aAAA,GAAAN,OAAA;AAA+C,SAAAD,uBAAAQ,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAE/C,MAAMG,eAAe,GAAGC,IAAA,IAED;EAAA,IAFE;IACvBC,UAAU;IAAEC,QAAQ;IAAEC,UAAU;IAAEC,MAAM;IAAEC,KAAK;IAAEC,wBAAwB;IAAEC;EAC5D,CAAC,GAAAP,IAAA;EAChB,MAAMQ,MAAM,GAAG,IAAIC,oBAAY,CAAC;IAC9BC,GAAG,EAAET,UAAU;IACfU,KAAK,EAAE,IAAIC,qBAAa,CAAC;EAC3B,CAAC,CAAC;EAEF,OACEzB,MAAA,CAAAW,OAAA,CAAAe,aAAA,CAACrB,iBAAA,CAAAsB,aAAa;IAACT,KAAK,EAAEA;EAAM,GAC1BlB,MAAA,CAAAW,OAAA,CAAAe,aAAA,CAACtB,SAAA,CAAAwB,cAAc;IAACX,MAAM,EAAE,IAAAY,2BAAS,EAACZ,MAAM,CAAE;IAACa,YAAY,EAAEA;EAAa,GACpE9B,MAAA,CAAAW,OAAA,CAAAe,aAAA,CAACvB,OAAA,CAAA4B,cAAc;IAACV,MAAM,EAAEA;EAAO,GAC5BD,YAAY,GACXpB,MAAA,CAAAW,OAAA,CAAAe,aAAA;IAAKM,SAAS,EAAC;EAAmG,GAChHhC,MAAA,CAAAW,OAAA,CAAAe,aAAA,CAACrB,iBAAA,CAAA4B,UAAU,MAAE,CACV,CAAC,GAENjC,MAAA,CAAAW,OAAA,CAAAe,aAAA,CAAA1B,MAAA,CAAAW,OAAA,CAAAuB,QAAA,QACGlB,UAAU,GACThB,MAAA,CAAAW,OAAA,CAAAe,aAAA,CAACpB,OAAA,CAAA6B,MAAM;IACLpB,QAAQ,EAAEA,QAAS;IACnBC,UAAU,EAAEA,UAAW;IACvBG,wBAAwB,EAAEA;EAAyB,CACpD,CAAC,GAEFnB,MAAA,CAAAW,OAAA,CAAAe,aAAA,CAACnB,KAAA,CAAA6B,IAAI;IAACrB,QAAQ,EAAEA;EAAS,CAAE,CAE7B,CAEU,CACF,CACH,CAAC;AAEpB,CAAC;AAACsB,OAAA,CAAAzB,eAAA,GAAAA,eAAA","ignoreList":[]}
1
+ {"version":3,"file":"SentimentWidget.js","names":["_react","_interopRequireDefault","require","_client","_monoI18n","_labsWidgetCommon","_Widget","_Tool","_translations","e","__esModule","default","SentimentWidget","_ref","graphqlUrl","division","instrument","locale","theme","includeDescriptionLabels","isParamError","logoLink","client","ApolloClient","uri","cache","InMemoryCache","createElement","ThemeProvider","LocaleProvider","getLocale","translations","ApolloProvider","className","ChartError","renderComponent","linkArea","Component","Widget","Tool","exports"],"sources":["../../../src/SentimentWidget/SentimentWidget.tsx"],"sourcesContent":["import React from 'react';\nimport { ApolloClient, InMemoryCache, ApolloProvider } from '@apollo/client';\nimport { LocaleProvider } from '@oanda/mono-i18n';\nimport {\n ChartError, ThemeProvider, getLocale, renderComponent,\n} from '@oanda/labs-widget-common';\nimport { Widget } from './Widget';\nimport { Tool } from './Tool';\nimport { SentimentConfig } from './types';\nimport { translations } from '../translations';\n\nconst SentimentWidget = ({\n graphqlUrl,\n division,\n instrument,\n locale,\n theme,\n includeDescriptionLabels,\n isParamError,\n logoLink,\n}: SentimentConfig) => {\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 ) : (\n renderComponent({\n logoLink,\n linkArea: 'logo',\n Component: instrument\n ? (\n <Widget\n division={division}\n instrument={instrument}\n includeDescriptionLabels={includeDescriptionLabels}\n />\n )\n : <Tool division={division} />,\n })\n )}\n </ApolloProvider>\n </LocaleProvider>\n </ThemeProvider>\n );\n};\n\nexport { SentimentWidget };\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AACA,IAAAG,iBAAA,GAAAH,OAAA;AAGA,IAAAI,OAAA,GAAAJ,OAAA;AACA,IAAAK,KAAA,GAAAL,OAAA;AAEA,IAAAM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AAAgB,aAAA,CAACpB,KAAA,CAAAgC,IAAI;MAACxB,QAAQ,EAAEA;IAAS,CAAE;EACjC,CAAC,CAEW,CACF,CACH,CAAC;AAEpB,CAAC;AAACyB,OAAA,CAAA5B,eAAA,GAAAA,eAAA","ignoreList":[]}
@@ -26,7 +26,8 @@ if (sentimentParamsElements.length > 0) {
26
26
  instrument,
27
27
  division,
28
28
  locale,
29
- includeDescriptionLabels
29
+ includeDescriptionLabels,
30
+ logoLink
30
31
  } = JSON.parse(params);
31
32
  const isParamError = (0, _labsWidgetCommon.validateToolParams)({
32
33
  division,
@@ -48,7 +49,8 @@ if (sentimentParamsElements.length > 0) {
48
49
  locale: locale,
49
50
  theme: mode,
50
51
  includeDescriptionLabels: includeDescriptionLabels,
51
- isParamError: isParamError
52
+ isParamError: isParamError,
53
+ logoLink: logoLink
52
54
  }));
53
55
  });
54
56
  } else {
@@ -1 +1 @@
1
- {"version":3,"file":"render.js","names":["_react","_interopRequireDefault","require","_client","_labsWidgetCommon","_SentimentWidget","_graphql","e","__esModule","default","graphqlUrl","configGraphQl","division","configDivision","instrument","configInstrument","renderElementId","configRenderElementId","locale","configLocale","window","sentimentWidgetConfig","widgetsConfig","sentimentParamsElements","document","querySelectorAll","length","forEach","element","root","createRoot","params","getAttribute","mode","includeDescriptionLabels","JSON","parse","isParamError","validateToolParams","name","valueCheck","value","validateLocale","Object","values","Division","includes","render","createElement","SentimentWidget","theme","container","getElementById"],"sources":["../../../src/SentimentWidget/render.tsx"],"sourcesContent":["import React from 'react';\nimport { createRoot } from 'react-dom/client';\nimport { Theme, validateLocale, validateToolParams } from '@oanda/labs-widget-common';\nimport { SentimentWidget } from './SentimentWidget';\nimport { Division } from '../gql/types/graphql';\n\nconst {\n graphqlUrl: configGraphQl,\n division: configDivision,\n instrument: configInstrument,\n renderElementId: configRenderElementId,\n locale: configLocale,\n} = window.sentimentWidgetConfig || {};\n\nconst {\n graphqlUrl,\n} = window.widgetsConfig || {};\n\nconst sentimentParamsElements = document.querySelectorAll('div[data-sentiment-params]');\n\nif (sentimentParamsElements.length > 0) {\n sentimentParamsElements.forEach((element) => {\n const root = createRoot(element);\n const params = element.getAttribute('data-sentiment-params');\n const mode = element.getAttribute('data-mode');\n const {\n instrument, division, locale, includeDescriptionLabels,\n } = JSON.parse(params as string);\n\n const isParamError = validateToolParams({ division, locale, graphqlUrl }, [\n {\n name: 'locale',\n valueCheck: (value) => validateLocale(value),\n }, {\n name: 'division',\n valueCheck: (value) => Object.values(Division).includes(value),\n }, {\n name: 'graphqlUrl',\n }]);\n root.render(\n <SentimentWidget\n graphqlUrl={graphqlUrl}\n division={division}\n instrument={instrument}\n locale={locale}\n theme={mode as Theme}\n includeDescriptionLabels={includeDescriptionLabels}\n isParamError={isParamError}\n />,\n );\n });\n} else {\n const container = document.getElementById(configRenderElementId);\n const root = createRoot(container!);\n root.render(\n <SentimentWidget\n graphqlUrl={configGraphQl}\n division={configDivision}\n instrument={configInstrument}\n locale={configLocale}\n />,\n );\n}\n"],"mappings":";;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,iBAAA,GAAAF,OAAA;AACA,IAAAG,gBAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AAAgD,SAAAD,uBAAAM,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAEhD,MAAM;EACJG,UAAU,EAAEC,aAAa;EACzBC,QAAQ,EAAEC,cAAc;EACxBC,UAAU,EAAEC,gBAAgB;EAC5BC,eAAe,EAAEC,qBAAqB;EACtCC,MAAM,EAAEC;AACV,CAAC,GAAGC,MAAM,CAACC,qBAAqB,IAAI,CAAC,CAAC;AAEtC,MAAM;EACJX;AACF,CAAC,GAAGU,MAAM,CAACE,aAAa,IAAI,CAAC,CAAC;AAE9B,MAAMC,uBAAuB,GAAGC,QAAQ,C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AAqB,CAAC;EAChE,MAAMY,IAAI,GAAG,IAAAC,kBAAU,EAACqB,SAAU,CAAC;EACnCtB,IAAI,CAACkB,MAAM,CACT/C,MAAA,CAAAS,OAAA,CAAAuC,aAAA,CAAC3C,gBAAA,CAAA4C,eAAe;IACdvC,UAAU,EAAEC,aAAc;IAC1BC,QAAQ,EAAEC,cAAe;IACzBC,UAAU,EAAEC,gBAAiB;IAC7BG,MAAM,EAAEC;EAAa,CACtB,CACH,CAAC;AACH","ignoreList":[]}
1
+ {"version":3,"file":"render.js","names":["_react","_interopRequireDefault","require","_client","_labsWidgetCommon","_SentimentWidget","_graphql","e","__esModule","default","graphqlUrl","configGraphQl","division","configDivision","instrument","configInstrument","renderElementId","configRenderElementId","locale","configLocale","window","sentimentWidgetConfig","widgetsConfig","sentimentParamsElements","document","querySelectorAll","length","forEach","element","root","createRoot","params","getAttribute","mode","includeDescriptionLabels","logoLink","JSON","parse","isParamError","validateToolParams","name","valueCheck","value","validateLocale","Object","values","Division","includes","render","createElement","SentimentWidget","theme","container","getElementById"],"sources":["../../../src/SentimentWidget/render.tsx"],"sourcesContent":["import React from 'react';\nimport { createRoot } from 'react-dom/client';\nimport { Theme, validateLocale, validateToolParams } from '@oanda/labs-widget-common';\nimport { SentimentWidget } from './SentimentWidget';\nimport { Division } from '../gql/types/graphql';\n\nconst {\n graphqlUrl: configGraphQl,\n division: configDivision,\n instrument: configInstrument,\n renderElementId: configRenderElementId,\n locale: configLocale,\n} = window.sentimentWidgetConfig || {};\n\nconst {\n graphqlUrl,\n} = window.widgetsConfig || {};\n\nconst sentimentParamsElements = document.querySelectorAll('div[data-sentiment-params]');\n\nif (sentimentParamsElements.length > 0) {\n sentimentParamsElements.forEach((element) => {\n const root = createRoot(element);\n const params = element.getAttribute('data-sentiment-params');\n const mode = element.getAttribute('data-mode');\n const {\n instrument, division, locale, includeDescriptionLabels, logoLink,\n } = JSON.parse(params as string);\n\n const isParamError = validateToolParams({\n division, locale, graphqlUrl,\n }, [\n {\n name: 'locale',\n valueCheck: (value) => validateLocale(value),\n }, {\n name: 'division',\n valueCheck: (value) => Object.values(Division).includes(value),\n }, {\n name: 'graphqlUrl',\n },\n ]);\n root.render(\n <SentimentWidget\n graphqlUrl={graphqlUrl}\n division={division}\n instrument={instrument}\n locale={locale}\n theme={mode as Theme}\n includeDescriptionLabels={includeDescriptionLabels}\n isParamError={isParamError}\n logoLink={logoLink}\n />,\n );\n });\n} else {\n const container = document.getElementById(configRenderElementId);\n const root = createRoot(container!);\n root.render(\n <SentimentWidget\n graphqlUrl={configGraphQl}\n division={configDivision}\n instrument={configInstrument}\n locale={configLocale}\n />,\n );\n}\n"],"mappings":";;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,iBAAA,GAAAF,OAAA;AACA,IAAAG,gBAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AAAgD,SAAAD,uBAAAM,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAEhD,MAAM;EACJG,UAAU,EAAEC,aAAa;EACzBC,QAAQ,EAAEC,cAAc;EACxBC,UAAU,EAAEC,gBAAgB;EAC5BC,eAAe,EAAEC,qBAAqB;EACtCC,MAAM,EAAEC;AACV,CAAC,GAAGC,MAAM,CAACC,qBAAqB,IAAI,CAAC,CAAC;AAEtC,MAAM;EACJX;AACF,CAAC,GAAGU,MAAM,CAACE,aAAa,IAAI,CAAC,CAAC;AAE9B,MAAMC,uBAAuB,GAAGC,QAAQ,CAACC,gBAAgB,CAAC,4BAA4B,CAAC;AAEvF,IAAIF,uBAAuB,CAACG,MAAM,GAAG,CAAC,EAAE;EACtCH,uBAAuB,CAACI,OAAO,CAAEC,OAAO,IAAK;IAC3C,MAAMC,IAAI,GAAG,IAAAC,kBAAU,EAACF,OAAO,CAAC;IAChC,MAAMG,MAAM,GA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C,UAAU,EAAEC,aAAc;IAC1BC,QAAQ,EAAEC,cAAe;IACzBC,UAAU,EAAEC,gBAAiB;IAC7BG,MAAM,EAAEC;EAAa,CACtB,CACH,CAAC;AACH","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","names":[],"sources":["../../../src/SentimentWidget/types.ts"],"sourcesContent":["import { Locale } from '@oanda/mono-i18n';\nimport { Theme } from '@oanda/labs-widget-common';\nimport { Division } from '../gql/types/graphql';\n\nexport interface SentimentConfig {\n graphqlUrl: string;\n division: Division;\n instrument?: string;\n locale: Locale;\n theme?: Theme;\n includeDescriptionLabels?: boolean;\n isParamError?: boolean;\n}\nexport interface SentimentWrapperConfig extends SentimentConfig {\n renderElementId: string;\n}\nexport interface SentimentWidgetConfig {\n division: Division;\n instrument: string;\n includeDescriptionLabels?: boolean;\n}\n\nexport interface SentimentToolConfig {\n division: Division;\n}\n"],"mappings":"","ignoreList":[]}
1
+ {"version":3,"file":"types.js","names":[],"sources":["../../../src/SentimentWidget/types.ts"],"sourcesContent":["import { WidgetConfig } from '@oanda/labs-widget-common';\nimport { Division } from '../gql/types/graphql';\n\nexport interface SentimentConfig extends WidgetConfig {\n division: Division;\n instrument?: string;\n includeDescriptionLabels?: boolean;\n}\nexport interface SentimentWrapperConfig extends SentimentConfig {\n renderElementId: string;\n}\nexport interface SentimentWidgetConfig {\n division: Division;\n instrument: string;\n includeDescriptionLabels?: boolean;\n}\n\nexport interface SentimentToolConfig {\n division: Division;\n}\n"],"mappings":"","ignoreList":[]}
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import { ApolloClient, InMemoryCache, ApolloProvider } from '@apollo/client';
3
3
  import { LocaleProvider } from '@oanda/mono-i18n';
4
- import { ChartError, ThemeProvider, getLocale } from '@oanda/labs-widget-common';
4
+ import { ChartError, ThemeProvider, getLocale, renderComponent } from '@oanda/labs-widget-common';
5
5
  import { Widget } from './Widget';
6
6
  import { Tool } from './Tool';
7
7
  import { translations } from '../translations';
@@ -13,7 +13,8 @@ const SentimentWidget = _ref => {
13
13
  locale,
14
14
  theme,
15
15
  includeDescriptionLabels,
16
- isParamError
16
+ isParamError,
17
+ logoLink
17
18
  } = _ref;
18
19
  const client = new ApolloClient({
19
20
  uri: graphqlUrl,
@@ -28,13 +29,17 @@ const SentimentWidget = _ref => {
28
29
  client: client
29
30
  }, isParamError ? React.createElement("div", {
30
31
  className: "lw-flex lw-h-[425px] lw-w-full lw-items-center lw-border lw-border-solid lw-border-border-primary"
31
- }, React.createElement(ChartError, null)) : React.createElement(React.Fragment, null, instrument ? React.createElement(Widget, {
32
- division: division,
33
- instrument: instrument,
34
- includeDescriptionLabels: includeDescriptionLabels
35
- }) : React.createElement(Tool, {
36
- division: division
37
- })))));
32
+ }, React.createElement(ChartError, null)) : renderComponent({
33
+ logoLink,
34
+ linkArea: 'logo',
35
+ Component: instrument ? React.createElement(Widget, {
36
+ division: division,
37
+ instrument: instrument,
38
+ includeDescriptionLabels: includeDescriptionLabels
39
+ }) : React.createElement(Tool, {
40
+ division: division
41
+ })
42
+ }))));
38
43
  };
39
44
  export { SentimentWidget };
40
45
  //# sourceMappingURL=SentimentWidget.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SentimentWidget.js","names":["React","ApolloClient","InMemoryCache","ApolloProvider","LocaleProvider","ChartError","ThemeProvider","getLocale","Widget","Tool","translations","SentimentWidget","_ref","graphqlUrl","division","instrument","locale","theme","includeDescriptionLabels","isParamError","client","uri","cache","createElement","className","Fragment"],"sources":["../../../src/SentimentWidget/SentimentWidget.tsx"],"sourcesContent":["import React from 'react';\nimport { ApolloClient, InMemoryCache, ApolloProvider } from '@apollo/client';\nimport { LocaleProvider } from '@oanda/mono-i18n';\nimport { ChartError, ThemeProvider, getLocale } from '@oanda/labs-widget-common';\nimport { Widget } from './Widget';\nimport { Tool } from './Tool';\nimport { SentimentConfig } from './types';\nimport { translations } from '../translations';\n\nconst SentimentWidget = ({\n graphqlUrl, division, instrument, locale, theme, includeDescriptionLabels, isParamError,\n}: SentimentConfig) => {\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 ) : (\n <>\n {instrument ? (\n <Widget\n division={division}\n instrument={instrument}\n includeDescriptionLabels={includeDescriptionLabels}\n />\n ) : (\n <Tool division={division} />\n )}\n </>\n )}\n </ApolloProvider>\n </LocaleProvider>\n </ThemeProvider>\n );\n};\n\nexport { SentimentWidget };\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,YAAY,EAAEC,aAAa,EAAEC,cAAc,QAAQ,gBAAgB;AAC5E,SAASC,cAAc,QAAQ,kBAAkB;AACjD,SAASC,UAAU,EAAEC,aAAa,EAAEC,SAAS,QAAQ,2BAA2B;AAChF,SAASC,MAAM,QAAQ,UAAU;AACjC,SAASC,IAAI,QAAQ,QAAQ;AAE7B,SAASC,YAAY,QAAQ,iBAAiB;AAE9C,MAAMC,eAAe,GAAGC,IAAA,IAED;EAAA,IAFE;IACvBC,UAAU;IAAEC,QAAQ;IAAEC,UAAU;IAAEC,MAAM;IAAEC,KAAK;IAAEC,wBAAwB;IAAEC;EAC5D,CAAC,GAAAP,IAAA;EAChB,MAAMQ,MAAM,GAAG,IAAInB,YAAY,CAAC;IAC9BoB,GAAG,EAAER,UAAU;IACfS,KAAK,EAAE,IAAIpB,aAAa,CAAC;EAC3B,CAAC,CAAC;EAEF,OACEF,KAAA,CAAAuB,aAAA,CAACjB,aAAa;IAACW,KAAK,EAAEA;EAAM,GAC1BjB,KAAA,CAAAuB,aAAA,CAACnB,cAAc;IAACY,MAAM,EAAET,SAAS,CAACS,MAAM,CAAE;IAACN,YAAY,EAAEA;EAAa,GACpEV,KAAA,CAAAuB,aAAA,CAACpB,cAAc;IAACiB,MAAM,EAAEA;EAAO,GAC5BD,YAAY,GACXnB,KAAA,CAAAuB,aAAA;IAAKC,SAAS,EAAC;EAAmG,GAChHxB,KAAA,CAAAuB,aAAA,CAAClB,UAAU,MAAE,CACV,CAAC,GAENL,KAAA,CAAAuB,aAAA,CAAAvB,KAAA,CAAAyB,QAAA,QACGV,UAAU,GACTf,KAAA,CAAAuB,aAAA,CAACf,MAAM;IACLM,QAAQ,EAAEA,QAAS;IACnBC,UAAU,EAAEA,UAAW;IACvBG,wBAAwB,EAAEA;EAAyB,CACpD,CAAC,GAEFlB,KAAA,CAAAuB,aAAA,CAACd,IAAI;IAACK,QAAQ,EAAEA;EAAS,CAAE,CAE7B,CAEU,CACF,CACH,CAAC;AAEpB,CAAC;AAED,SAASH,eAAe","ignoreList":[]}
1
+ {"version":3,"file":"SentimentWidget.js","names":["React","ApolloClient","InMemoryCache","ApolloProvider","LocaleProvider","ChartError","ThemeProvider","getLocale","renderComponent","Widget","Tool","translations","SentimentWidget","_ref","graphqlUrl","division","instrument","locale","theme","includeDescriptionLabels","isParamError","logoLink","client","uri","cache","createElement","className","linkArea","Component"],"sources":["../../../src/SentimentWidget/SentimentWidget.tsx"],"sourcesContent":["import React from 'react';\nimport { ApolloClient, InMemoryCache, ApolloProvider } from '@apollo/client';\nimport { LocaleProvider } from '@oanda/mono-i18n';\nimport {\n ChartError, ThemeProvider, getLocale, renderComponent,\n} from '@oanda/labs-widget-common';\nimport { Widget } from './Widget';\nimport { Tool } from './Tool';\nimport { SentimentConfig } from './types';\nimport { translations } from '../translations';\n\nconst SentimentWidget = ({\n graphqlUrl,\n division,\n instrument,\n locale,\n theme,\n includeDescriptionLabels,\n isParamError,\n logoLink,\n}: SentimentConfig) => {\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 ) : (\n renderComponent({\n logoLink,\n linkArea: 'logo',\n Component: instrument\n ? (\n <Widget\n division={division}\n instrument={instrument}\n includeDescriptionLabels={includeDescriptionLabels}\n />\n )\n : <Tool division={division} />,\n })\n )}\n </ApolloProvider>\n </LocaleProvider>\n </ThemeProvider>\n );\n};\n\nexport { SentimentWidget };\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,YAAY,EAAEC,aAAa,EAAEC,cAAc,QAAQ,gBAAgB;AAC5E,SAASC,cAAc,QAAQ,kBAAkB;AACjD,SACEC,UAAU,EAAEC,aAAa,EAAEC,SAAS,EAAEC,eAAe,QAChD,2BAA2B;AAClC,SAASC,MAAM,QAAQ,UAAU;AACjC,SAASC,IAAI,QAAQ,QAAQ;AAE7B,SAASC,YAAY,QAAQ,iBAAiB;AAE9C,MAAMC,eAAe,GAAGC,IAAA,IASD;EAAA,IATE;IACvBC,UAAU;IACVC,QAAQ;IACRC,UAAU;IACVC,MAAM;IACNC,KAAK;IACLC,wBAAwB;IACxBC,YAAY;IACZC;EACe,CAAC,GAAAR,IAAA;EAChB,MAAMS,MAAM,GAAG,IAAIrB,YAAY,CAAC;IAC9BsB,GAAG,EAAET,UAAU;IACfU,KAAK,EAAE,IAAItB,aAAa,CAAC;EAC3B,CAAC,CAAC;EAEF,OACEF,KAAA,CAAAyB,aAAA,CAACnB,aAAa;IAACY,KAAK,EAAEA;EAAM,GAC1BlB,KAAA,CAAAyB,aAAA,CAACrB,cAAc;IAACa,MAAM,EAAEV,SAAS,CAACU,MAAM,CAAE;IAACN,YAAY,EAAEA;EAAa,GACpEX,KAAA,CAAAyB,aAAA,CAACtB,cAAc;IAACmB,MAAM,EAAEA;EAAO,GAC5BF,YAAY,GACXpB,KAAA,CAAAyB,aAAA;IAAKC,SAAS,EAAC;EAAmG,GAChH1B,KAAA,CAAAyB,aAAA,CAACpB,UAAU,MAAE,CACV,CAAC,GAENG,eAAe,CAAC;IACda,QAAQ;IACRM,QAAQ,EAAE,MAAM;IAChBC,SAAS,EAAEZ,UAAU,GAEjBhB,KAAA,CAAAyB,aAAA,CAAChB,MAAM;MACLM,QAAQ,EAAEA,QAAS;MACnBC,UAAU,EAAEA,UAAW;MACvBG,wBAAwB,EAAEA;IAAyB,CACpD,CAAC,GAEFnB,KAAA,CAAAyB,aAAA,CAACf,IAAI;MAACK,QAAQ,EAAEA;IAAS,CAAE;EACjC,CAAC,CAEW,CACF,CACH,CAAC;AAEpB,CAAC;AAED,SAASH,eAAe","ignoreList":[]}
@@ -23,7 +23,8 @@ if (sentimentParamsElements.length > 0) {
23
23
  instrument,
24
24
  division,
25
25
  locale,
26
- includeDescriptionLabels
26
+ includeDescriptionLabels,
27
+ logoLink
27
28
  } = JSON.parse(params);
28
29
  const isParamError = validateToolParams({
29
30
  division,
@@ -45,7 +46,8 @@ if (sentimentParamsElements.length > 0) {
45
46
  locale: locale,
46
47
  theme: mode,
47
48
  includeDescriptionLabels: includeDescriptionLabels,
48
- isParamError: isParamError
49
+ isParamError: isParamError,
50
+ logoLink: logoLink
49
51
  }));
50
52
  });
51
53
  } else {
@@ -1 +1 @@
1
- {"version":3,"file":"render.js","names":["React","createRoot","validateLocale","validateToolParams","SentimentWidget","Division","graphqlUrl","configGraphQl","division","configDivision","instrument","configInstrument","renderElementId","configRenderElementId","locale","configLocale","window","sentimentWidgetConfig","widgetsConfig","sentimentParamsElements","document","querySelectorAll","length","forEach","element","root","params","getAttribute","mode","includeDescriptionLabels","JSON","parse","isParamError","name","valueCheck","value","Object","values","includes","render","createElement","theme","container","getElementById"],"sources":["../../../src/SentimentWidget/render.tsx"],"sourcesContent":["import React from 'react';\nimport { createRoot } from 'react-dom/client';\nimport { Theme, validateLocale, validateToolParams } from '@oanda/labs-widget-common';\nimport { SentimentWidget } from './SentimentWidget';\nimport { Division } from '../gql/types/graphql';\n\nconst {\n graphqlUrl: configGraphQl,\n division: configDivision,\n instrument: configInstrument,\n renderElementId: configRenderElementId,\n locale: configLocale,\n} = window.sentimentWidgetConfig || {};\n\nconst {\n graphqlUrl,\n} = window.widgetsConfig || {};\n\nconst sentimentParamsElements = document.querySelectorAll('div[data-sentiment-params]');\n\nif (sentimentParamsElements.length > 0) {\n sentimentParamsElements.forEach((element) => {\n const root = createRoot(element);\n const params = element.getAttribute('data-sentiment-params');\n const mode = element.getAttribute('data-mode');\n const {\n instrument, division, locale, includeDescriptionLabels,\n } = JSON.parse(params as string);\n\n const isParamError = validateToolParams({ division, locale, graphqlUrl }, [\n {\n name: 'locale',\n valueCheck: (value) => validateLocale(value),\n }, {\n name: 'division',\n valueCheck: (value) => Object.values(Division).includes(value),\n }, {\n name: 'graphqlUrl',\n }]);\n root.render(\n <SentimentWidget\n graphqlUrl={graphqlUrl}\n division={division}\n instrument={instrument}\n locale={locale}\n theme={mode as Theme}\n includeDescriptionLabels={includeDescriptionLabels}\n isParamError={isParamError}\n />,\n );\n });\n} else {\n const container = document.getElementById(configRenderElementId);\n const root = createRoot(container!);\n root.render(\n <SentimentWidget\n graphqlUrl={configGraphQl}\n division={configDivision}\n instrument={configInstrument}\n locale={configLocale}\n />,\n );\n}\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,UAAU,QAAQ,kBAAkB;AAC7C,SAAgBC,cAAc,EAAEC,kBAAkB,QAAQ,2BAA2B;AACrF,SAASC,eAAe,QAAQ,mBAAmB;AACnD,SAASC,QAAQ,QAAQ,sBAAsB;AAE/C,MAAM;EACJC,UAAU,EAAEC,aAAa;EACzBC,QAAQ,EAAEC,cAAc;EACxBC,UAAU,EAAEC,gBAAgB;EAC5BC,eAAe,EAAEC,qBAAqB;EACtCC,MAAM,EAAEC;AACV,CAAC,GAAGC,MAAM,CAACC,qBAAqB,IAAI,CAAC,CAAC;AAEtC,MAAM;EACJX;AACF,CA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GtB,QAAQ,CAACuB,cAAc,CAAC9B,qBAAqB,CAAC;EAChE,MAAMY,IAAI,GAAGxB,UAAU,CAACyC,SAAU,CAAC;EACnCjB,IAAI,CAACc,MAAM,CACTvC,KAAA,CAAAwC,aAAA,CAACpC,eAAe;IACdE,UAAU,EAAEC,aAAc;IAC1BC,QAAQ,EAAEC,cAAe;IACzBC,UAAU,EAAEC,gBAAiB;IAC7BG,MAAM,EAAEC;EAAa,CACtB,CACH,CAAC;AACH","ignoreList":[]}
1
+ {"version":3,"file":"render.js","names":["React","createRoot","validateLocale","validateToolParams","SentimentWidget","Division","graphqlUrl","configGraphQl","division","configDivision","instrument","configInstrument","renderElementId","configRenderElementId","locale","configLocale","window","sentimentWidgetConfig","widgetsConfig","sentimentParamsElements","document","querySelectorAll","length","forEach","element","root","params","getAttribute","mode","includeDescriptionLabels","logoLink","JSON","parse","isParamError","name","valueCheck","value","Object","values","includes","render","createElement","theme","container","getElementById"],"sources":["../../../src/SentimentWidget/render.tsx"],"sourcesContent":["import React from 'react';\nimport { createRoot } from 'react-dom/client';\nimport { Theme, validateLocale, validateToolParams } from '@oanda/labs-widget-common';\nimport { SentimentWidget } from './SentimentWidget';\nimport { Division } from '../gql/types/graphql';\n\nconst {\n graphqlUrl: configGraphQl,\n division: configDivision,\n instrument: configInstrument,\n renderElementId: configRenderElementId,\n locale: configLocale,\n} = window.sentimentWidgetConfig || {};\n\nconst {\n graphqlUrl,\n} = window.widgetsConfig || {};\n\nconst sentimentParamsElements = document.querySelectorAll('div[data-sentiment-params]');\n\nif (sentimentParamsElements.length > 0) {\n sentimentParamsElements.forEach((element) => {\n const root = createRoot(element);\n const params = element.getAttribute('data-sentiment-params');\n const mode = element.getAttribute('data-mode');\n const {\n instrument, division, locale, includeDescriptionLabels, logoLink,\n } = JSON.parse(params as string);\n\n const isParamError = validateToolParams({\n division, locale, graphqlUrl,\n }, [\n {\n name: 'locale',\n valueCheck: (value) => validateLocale(value),\n }, {\n name: 'division',\n valueCheck: (value) => Object.values(Division).includes(value),\n }, {\n name: 'graphqlUrl',\n },\n ]);\n root.render(\n <SentimentWidget\n graphqlUrl={graphqlUrl}\n division={division}\n instrument={instrument}\n locale={locale}\n theme={mode as Theme}\n includeDescriptionLabels={includeDescriptionLabels}\n isParamError={isParamError}\n logoLink={logoLink}\n />,\n );\n });\n} else {\n const container = document.getElementById(configRenderElementId);\n const root = createRoot(container!);\n root.render(\n <SentimentWidget\n graphqlUrl={configGraphQl}\n division={configDivision}\n instrument={configInstrument}\n locale={configLocale}\n />,\n );\n}\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,UAAU,QAAQ,kBAAkB;AAC7C,SAAgBC,cAAc,EAAEC,kBAAkB,QAAQ,2BAA2B;AACrF,SAASC,eAAe,QAAQ,mBAAmB;AACnD,SAASC,QAAQ,QAAQ,sBAAsB;AAE/C,MAAM;EACJC,UAAU,EAAEC,aAAa;EACzBC,QAAQ,EAAEC,cAAc;EACxBC,UAAU,EAAEC,gBAAgB;EAC5BC,eAAe,EAAEC,qBAAqB;EACtCC,MAAM,EAAEC;AACV,CAAC,GAAGC,MAAM,CAACC,qBAAqB,IAAI,CAAC,CAAC;AAEtC,MAAM;EACJX;AACF,CAAC,GAAGU,MAAM,CAACE,aAAa,IAAI,CAAC,CAAC;AAE9B,MAAMC,uBAAuB,GAAGC,QAAQ,CAACC,gBAAgB,CAAC,4BAA4B,CAAC;AAEvF,IAAIF,uBAAuB,CAACG,MAAM,GAAG,CAAC,EAAE;EACtCH,uBAAuB,CAACI,OAAO,CAAEC,OAAO,IAAK;IAC3C,MAAMC,IAAI,GAAGxB,UAAU,CAACuB,OAAO,CAAC;IAChC,MAAME,MAAM,GAAGF,OAAO,CAACG,YAAY,CAAC,uBAAuB,CAAC;IAC5D,MAAMC,IAAI,GAAGJ,OAAO,CAACG,YAAY,CAAC,WAAW,CAAC;IAC9C,MAAM;MACJjB,UAAU;MAAEF,QAAQ;MAAEM,MAAM;MAAEe,wBAAwB;MAAEC;IAC1D,CAAC,GAAGC,IAAI,CAACC,KAAK,CAACN,MAAgB,CAAC;IAEhC,MAAMO,YAAY,GAAG9B,kBAAkB,CAAC;MACtCK,QAAQ;MAAEM,MAAM;MAAER;IACpB,CAAC,EAAE,CACD;MACE4B,IAAI,EAAE,QAAQ;MACdC,UAAU,EAAGC,KAAK,IAAKlC,cAAc,CAACkC,KAAK;IAC7C,CAAC,EAAE;MACDF,IAAI,EAAE,UAAU;MAChBC,UAAU,EAAGC,KAAK,IAAKC,MAAM,CAACC,MAAM,CAACjC,QAAQ,CAAC,CAACkC,QAAQ,CAACH,KAAK;IAC/D,CAAC,EAAE;MACDF,IAAI,EAAE;IACR,CAAC,CACF,CAAC;IACFT,IAAI,CAACe,MAAM,CACTxC,KAAA,CAAAyC,aAAA,CAACrC,eAAe;MACdE,UAAU,EAAEA,UAAW;MACvBE,QAAQ,EAAEA,QAAS;MACnBE,UAAU,EAAEA,UAAW;MACvBI,MAAM,EAAEA,MAAO;MACf4B,KAAK,EAAEd,IAAc;MACrBC,wBAAwB,EAAEA,wBAAyB;MACnDI,YAAY,EAAEA,YAAa;MAC3BH,QAAQ,EAAEA;IAAS,CACpB,CACH,CAAC;EACH,CAAC,CAAC;AACJ,CAAC,MAAM;EACL,MAAMa,SAAS,GAAGvB,QAAQ,CAACwB,cAAc,CAAC/B,qBAAqB,CAAC;EAChE,MAAMY,IAAI,GAAGxB,UAAU,CAAC0C,SAAU,CAAC;EACnClB,IAAI,CAACe,MAAM,CACTxC,KAAA,CAAAyC,aAAA,CAACrC,eAAe;IACdE,UAAU,EAAEC,aAAc;IAC1BC,QAAQ,EAAEC,cAAe;IACzBC,UAAU,EAAEC,gBAAiB;IAC7BG,MAAM,EAAEC;EAAa,CACtB,CACH,CAAC;AACH","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","names":[],"sources":["../../../src/SentimentWidget/types.ts"],"sourcesContent":["import { Locale } from '@oanda/mono-i18n';\nimport { Theme } from '@oanda/labs-widget-common';\nimport { Division } from '../gql/types/graphql';\n\nexport interface SentimentConfig {\n graphqlUrl: string;\n division: Division;\n instrument?: string;\n locale: Locale;\n theme?: Theme;\n includeDescriptionLabels?: boolean;\n isParamError?: boolean;\n}\nexport interface SentimentWrapperConfig extends SentimentConfig {\n renderElementId: string;\n}\nexport interface SentimentWidgetConfig {\n division: Division;\n instrument: string;\n includeDescriptionLabels?: boolean;\n}\n\nexport interface SentimentToolConfig {\n division: Division;\n}\n"],"mappings":"","ignoreList":[]}
1
+ {"version":3,"file":"types.js","names":[],"sources":["../../../src/SentimentWidget/types.ts"],"sourcesContent":["import { WidgetConfig } from '@oanda/labs-widget-common';\nimport { Division } from '../gql/types/graphql';\n\nexport interface SentimentConfig extends WidgetConfig {\n division: Division;\n instrument?: string;\n includeDescriptionLabels?: boolean;\n}\nexport interface SentimentWrapperConfig extends SentimentConfig {\n renderElementId: string;\n}\nexport interface SentimentWidgetConfig {\n division: Division;\n instrument: string;\n includeDescriptionLabels?: boolean;\n}\n\nexport interface SentimentToolConfig {\n division: Division;\n}\n"],"mappings":"","ignoreList":[]}
@@ -1,4 +1,4 @@
1
1
  import React from 'react';
2
2
  import { SentimentConfig } from './types';
3
- declare const SentimentWidget: ({ graphqlUrl, division, instrument, locale, theme, includeDescriptionLabels, isParamError, }: SentimentConfig) => React.JSX.Element;
3
+ declare const SentimentWidget: ({ graphqlUrl, division, instrument, locale, theme, includeDescriptionLabels, isParamError, logoLink, }: SentimentConfig) => React.JSX.Element;
4
4
  export { SentimentWidget };
@@ -1,14 +1,9 @@
1
- import { Locale } from '@oanda/mono-i18n';
2
- import { Theme } from '@oanda/labs-widget-common';
1
+ import { WidgetConfig } from '@oanda/labs-widget-common';
3
2
  import { Division } from '../gql/types/graphql';
4
- export interface SentimentConfig {
5
- graphqlUrl: string;
3
+ export interface SentimentConfig extends WidgetConfig {
6
4
  division: Division;
7
5
  instrument?: string;
8
- locale: Locale;
9
- theme?: Theme;
10
6
  includeDescriptionLabels?: boolean;
11
- isParamError?: boolean;
12
7
  }
13
8
  export interface SentimentWrapperConfig extends SentimentConfig {
14
9
  renderElementId: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oanda/labs-sentiment-widget",
3
- "version": "1.0.168",
3
+ "version": "1.0.170",
4
4
  "description": "Labs Sentiment Widget",
5
5
  "main": "dist/main/index.js",
6
6
  "module": "dist/module/index.js",
@@ -12,7 +12,7 @@
12
12
  "author": "OANDA",
13
13
  "license": "UNLICENSED",
14
14
  "dependencies": {
15
- "@oanda/labs-widget-common": "^1.0.168",
15
+ "@oanda/labs-widget-common": "^1.0.170",
16
16
  "@oanda/mono-i18n": "10.0.1",
17
17
  "graphql": "16.8.1"
18
18
  },
@@ -20,5 +20,5 @@
20
20
  "@graphql-codegen/cli": "5.0.0",
21
21
  "@graphql-codegen/client-preset": "4.1.0"
22
22
  },
23
- "gitHead": "ece7c06ca65b093ec259d7693f002ae03d8a7118"
23
+ "gitHead": "cfcc2eb4d59e16d25ec3da37e01767b476477125"
24
24
  }
@@ -1,14 +1,23 @@
1
1
  import React from 'react';
2
2
  import { ApolloClient, InMemoryCache, ApolloProvider } from '@apollo/client';
3
3
  import { LocaleProvider } from '@oanda/mono-i18n';
4
- import { ChartError, ThemeProvider, getLocale } from '@oanda/labs-widget-common';
4
+ import {
5
+ ChartError, ThemeProvider, getLocale, renderComponent,
6
+ } from '@oanda/labs-widget-common';
5
7
  import { Widget } from './Widget';
6
8
  import { Tool } from './Tool';
7
9
  import { SentimentConfig } from './types';
8
10
  import { translations } from '../translations';
9
11
 
10
12
  const SentimentWidget = ({
11
- graphqlUrl, division, instrument, locale, theme, includeDescriptionLabels, isParamError,
13
+ graphqlUrl,
14
+ division,
15
+ instrument,
16
+ locale,
17
+ theme,
18
+ includeDescriptionLabels,
19
+ isParamError,
20
+ logoLink,
12
21
  }: SentimentConfig) => {
13
22
  const client = new ApolloClient({
14
23
  uri: graphqlUrl,
@@ -24,17 +33,19 @@ const SentimentWidget = ({
24
33
  <ChartError />
25
34
  </div>
26
35
  ) : (
27
- <>
28
- {instrument ? (
29
- <Widget
30
- division={division}
31
- instrument={instrument}
32
- includeDescriptionLabels={includeDescriptionLabels}
33
- />
34
- ) : (
35
- <Tool division={division} />
36
- )}
37
- </>
36
+ renderComponent({
37
+ logoLink,
38
+ linkArea: 'logo',
39
+ Component: instrument
40
+ ? (
41
+ <Widget
42
+ division={division}
43
+ instrument={instrument}
44
+ includeDescriptionLabels={includeDescriptionLabels}
45
+ />
46
+ )
47
+ : <Tool division={division} />,
48
+ })
38
49
  )}
39
50
  </ApolloProvider>
40
51
  </LocaleProvider>
@@ -24,10 +24,12 @@ if (sentimentParamsElements.length > 0) {
24
24
  const params = element.getAttribute('data-sentiment-params');
25
25
  const mode = element.getAttribute('data-mode');
26
26
  const {
27
- instrument, division, locale, includeDescriptionLabels,
27
+ instrument, division, locale, includeDescriptionLabels, logoLink,
28
28
  } = JSON.parse(params as string);
29
29
 
30
- const isParamError = validateToolParams({ division, locale, graphqlUrl }, [
30
+ const isParamError = validateToolParams({
31
+ division, locale, graphqlUrl,
32
+ }, [
31
33
  {
32
34
  name: 'locale',
33
35
  valueCheck: (value) => validateLocale(value),
@@ -36,7 +38,8 @@ if (sentimentParamsElements.length > 0) {
36
38
  valueCheck: (value) => Object.values(Division).includes(value),
37
39
  }, {
38
40
  name: 'graphqlUrl',
39
- }]);
41
+ },
42
+ ]);
40
43
  root.render(
41
44
  <SentimentWidget
42
45
  graphqlUrl={graphqlUrl}
@@ -46,6 +49,7 @@ if (sentimentParamsElements.length > 0) {
46
49
  theme={mode as Theme}
47
50
  includeDescriptionLabels={includeDescriptionLabels}
48
51
  isParamError={isParamError}
52
+ logoLink={logoLink}
49
53
  />,
50
54
  );
51
55
  });
@@ -1,15 +1,10 @@
1
- import { Locale } from '@oanda/mono-i18n';
2
- import { Theme } from '@oanda/labs-widget-common';
1
+ import { WidgetConfig } from '@oanda/labs-widget-common';
3
2
  import { Division } from '../gql/types/graphql';
4
3
 
5
- export interface SentimentConfig {
6
- graphqlUrl: string;
4
+ export interface SentimentConfig extends WidgetConfig {
7
5
  division: Division;
8
6
  instrument?: string;
9
- locale: Locale;
10
- theme?: Theme;
11
7
  includeDescriptionLabels?: boolean;
12
- isParamError?: boolean;
13
8
  }
14
9
  export interface SentimentWrapperConfig extends SentimentConfig {
15
10
  renderElementId: string;