@undp/carbon-library 1.0.263-carbon-lib-test.1 → 1.0.263-carbon-lib-test.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -3,6 +3,7 @@ import { ReactNode } from 'react';
3
3
  export type Methods = 'get' | 'post' | 'delete' | 'put' | 'patch';
4
4
  export type ConnectionContextProviderProps = {
5
5
  serverURL: string;
6
+ statServerUrl?: string;
6
7
  t: any;
7
8
  children: ReactNode;
8
9
  };
@@ -24,4 +25,5 @@ export type ConnectionProps = {
24
25
  updateToken: (token?: string) => void;
25
26
  token?: string;
26
27
  removeToken: (tkn?: string) => void;
28
+ statServerUrl?: string;
27
29
  };
@@ -0,0 +1,2 @@
1
+ import React from "react";
2
+ export default function DashboardI18nDecorator(Story: any, context: any): React.JSX.Element;
@@ -0,0 +1,12 @@
1
+ /// <reference types="react" />
2
+ import type { StoryObj } from "@storybook/react";
3
+ import "antd/dist/antd.css";
4
+ import ConnectionContextDecorator from './Decorators/ConnectionContextDecorator';
5
+ declare const meta: {
6
+ title: string;
7
+ component: (props: any) => import("react").JSX.Element;
8
+ decorators: (typeof ConnectionContextDecorator)[];
9
+ };
10
+ export default meta;
11
+ type Story = StoryObj<typeof meta>;
12
+ export declare const Primary: Story;
@@ -0,0 +1,12 @@
1
+ /// <reference types="react" />
2
+ import type { StoryObj } from "@storybook/react";
3
+ import "antd/dist/antd.css";
4
+ import ConnectionContextDecorator from './Decorators/ConnectionContextDecorator';
5
+ declare const meta: {
6
+ title: string;
7
+ component: (props: any) => import("react").JSX.Element;
8
+ decorators: (typeof ConnectionContextDecorator)[];
9
+ };
10
+ export default meta;
11
+ type Story = StoryObj<typeof meta>;
12
+ export declare const Primary: Story;
package/dist/esm/index.js CHANGED
@@ -495,7 +495,7 @@ function e$1(e){this.message=e;}e$1.prototype=new Error,e$1.prototype.name="Inva
495
495
  var ConnectionContext = createContext({});
496
496
  var ConnectionContextProvider = function (props) {
497
497
  var _a = useState(), token = _a[0], setToken = _a[1];
498
- var serverURL = props.serverURL, t = props.t, children = props.children;
498
+ var serverURL = props.serverURL, t = props.t, children = props.children, statServerUrl = props.statServerUrl;
499
499
  useEffect(function () {
500
500
  var timer = setInterval(function () { return __awaiter(void 0, void 0, void 0, function () {
501
501
  var newToken;
@@ -528,7 +528,7 @@ var ConnectionContextProvider = function (props) {
528
528
  else {
529
529
  localStorage.getItem('token');
530
530
  headers = {
531
- authorization: "Bearer ".concat(localStorage.getItem('token')),
531
+ authorization: "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJjbiI6IkFudGFyY3RpYyBSZWdpb24iLCJuIjoiVGVzdCBVc2VyIiwic3ViIjo3LCJyIjoiQWRtaW4iLCJjaWQiOjgsImNyIjoiR292ZXJubWVudCIsInMiOjEsImlhdCI6MTcwMjAyNTgwNSwiZXhwIjoxNzAyMDMzMDA1fQ.vCxyLpdD4F1NDOVpcBoKD6fRt-owUgm0tjnoWhmr-RY",
532
532
  };
533
533
  }
534
534
  axios(__assign({ method: method, url: url, data: data, headers: headers }, config))
@@ -650,7 +650,7 @@ var ConnectionContextProvider = function (props) {
650
650
  removeToken(token);
651
651
  }, [token]);
652
652
  return (React.createElement(ConnectionContext.Provider, { value: {
653
- connection: { post: post, put: put, get: get, patch: patch, delete: del, updateToken: updateToken, token: token, removeToken: removeToken },
653
+ connection: { post: post, put: put, get: get, patch: patch, delete: del, updateToken: updateToken, token: token, removeToken: removeToken, statServerUrl: statServerUrl },
654
654
  } }, children));
655
655
  };
656
656
  var useConnection = function () {
@@ -23040,7 +23040,7 @@ var MapStatsComponent = function (props) {
23040
23040
  var RangePicker$1 = DatePicker.RangePicker;
23041
23041
  var MrvDashboardComponent = function (props) {
23042
23042
  var Link = props.Link, Chart = props.Chart, t = props.t, ButtonGroup = props.ButtonGroup, _a = props.isMultipleDashboardsVisible, isMultipleDashboardsVisible = _a === void 0 ? false : _a;
23043
- var _b = useConnection(); _b.get; var post = _b.post; _b.delete;
23043
+ var _b = useConnection(); _b.get; var post = _b.post; _b.delete; var statServerUrl = _b.statServerUrl;
23044
23044
  var _c = useState({}), data = _c[0], setData = _c[1];
23045
23045
  var _e = useState(false), loading = _e[0], setLoading = _e[1];
23046
23046
  var userInfoState = useUserContext().userInfoState;
@@ -23523,7 +23523,7 @@ var MrvDashboardComponent = function (props) {
23523
23523
  _e.label = 1;
23524
23524
  case 1:
23525
23525
  _e.trys.push([1, 3, 4, 5]);
23526
- return [4 /*yield*/, post("stats/programme/agg", genPayload(), undefined, process.env.REACT_APP_STAT_URL)];
23526
+ return [4 /*yield*/, post("stats/programme/agg", genPayload(), undefined, statServerUrl)];
23527
23527
  case 2:
23528
23528
  response = _e.sent();
23529
23529
  console.log("Response", response);
@@ -24784,7 +24784,7 @@ var RegistryBarChartsStatComponent = function (props) {
24784
24784
  var RangePicker = DatePicker.RangePicker;
24785
24785
  var RegistryDashboardComponent = function (props) {
24786
24786
  var Chart = props.Chart, t = props.t, ButtonGroup = props.ButtonGroup, Link = props.Link, _a = props.isMultipleDashboardsVisible, isMultipleDashboardsVisible = _a === void 0 ? false : _a;
24787
- var _b = useConnection(); _b.get; var post = _b.post; _b.delete;
24787
+ var _b = useConnection(); _b.get; var post = _b.post; _b.delete; var statServerUrl = _b.statServerUrl;
24788
24788
  var userInfoState = useUserContext().userInfoState;
24789
24789
  var _c = useState(false), loadingWithoutTimeRange = _c[0], setLoadingWithoutTimeRange = _c[1];
24790
24790
  var _e = useState(false), loading = _e[0], setLoading = _e[1];
@@ -25231,7 +25231,7 @@ var RegistryDashboardComponent = function (props) {
25231
25231
  _253.label = 1;
25232
25232
  case 1:
25233
25233
  _253.trys.push([1, 3, 4, 5]);
25234
- return [4 /*yield*/, post("stats/programme/agg", getAllChartsParams(), undefined, process.env.REACT_APP_STAT_URL)];
25234
+ return [4 /*yield*/, post("stats/programme/agg", getAllChartsParams(), undefined, statServerUrl)];
25235
25235
  case 2:
25236
25236
  response = _253.sent();
25237
25237
  totalCreditsCertifiedStats = void 0;
@@ -25508,7 +25508,7 @@ var RegistryDashboardComponent = function (props) {
25508
25508
  _77.label = 1;
25509
25509
  case 1:
25510
25510
  _77.trys.push([1, 3, 4, 5]);
25511
- return [4 /*yield*/, post("stats/programme/agg", getAllProgrammeAnalyticsStatsParamsWithoutTimeRange(), undefined, process.env.REACT_APP_STAT_URL)];
25511
+ return [4 /*yield*/, post("stats/programme/agg", getAllProgrammeAnalyticsStatsParamsWithoutTimeRange(), undefined, statServerUrl)];
25512
25512
  case 2:
25513
25513
  response = _77.sent();
25514
25514
  programmeByStatusAggregationResponse = (_c = (_b = (_a = response === null || response === void 0 ? void 0 : response.data) === null || _a === void 0 ? void 0 : _a.stats) === null || _b === void 0 ? void 0 : _b.AGG_PROGRAMME_BY_STATUS) === null || _c === void 0 ? void 0 : _c.data;
@@ -25601,7 +25601,7 @@ var RegistryDashboardComponent = function (props) {
25601
25601
  _188.label = 1;
25602
25602
  case 1:
25603
25603
  _188.trys.push([1, 3, 4, 5]);
25604
- return [4 /*yield*/, post("stats/programme/agg", getAllProgrammeAnalyticsStatsParams(), undefined, process.env.REACT_APP_STAT_URL)];
25604
+ return [4 /*yield*/, post("stats/programme/agg", getAllProgrammeAnalyticsStatsParams(), undefined, statServerUrl)];
25605
25605
  case 2:
25606
25606
  response = _188.sent();
25607
25607
  programmeByStatusAuthAggregationResponse = void 0;