@undp/carbon-library 1.0.258-carbon-lib-test.0 → 1.0.258-carbon-lib-test.1
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/cjs/index.js +492 -490
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/index.js +493 -491
- package/dist/esm/index.js.map +1 -1
- package/package.json +1 -1
package/dist/esm/index.js
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
import { PlusOutlined, FilterOutlined, BankOutlined, SafetyOutlined, AuditOutlined, ExperimentOutlined, UploadOutlined, UserOutlined, MinusCircleOutlined, StarOutlined, ToolOutlined, EyeOutlined, SearchOutlined, EllipsisOutlined, EditOutlined, DeleteOutlined, FileAddOutlined, CheckCircleOutlined, ExclamationCircleOutlined, BookOutlined, CaretDownOutlined, EyeInvisibleOutlined, GlobalOutlined, FlagOutlined, LineChartOutlined, LikeOutlined, DislikeOutlined } from '@ant-design/icons';
|
2
2
|
import { Input, Radio, Space, Row, Col, Button, Dropdown, Table, Empty, message, Form, Steps, Upload, InputNumber, Tooltip, Select, Modal, Alert, Skeleton, Card, Tag, Checkbox, DatePicker, Popover, List, Typography, Spin, Tabs, Progress } from 'antd';
|
3
|
-
import React, { useState, useEffect,
|
3
|
+
import React, { createContext, useState, useEffect, useCallback, useContext, useRef } from 'react';
|
4
4
|
import { DateTime } from 'luxon';
|
5
5
|
import { Buffer } from 'buffer';
|
6
|
+
import axios from 'axios';
|
6
7
|
import PhoneInput, { formatPhoneNumberIntl, formatPhoneNumber } from 'react-phone-number-input';
|
7
8
|
import validator from 'validator';
|
8
|
-
import axios from 'axios';
|
9
9
|
import { plainToClass } from 'class-transformer';
|
10
10
|
import * as Icon from 'react-bootstrap-icons';
|
11
11
|
import { InfoCircle, Lock, PersonDash, PlayCircle, PauseCircle, CircleFill, Clipboard2Pulse, HandThumbsUp, XCircle, ClockHistory, BoxArrowInRight, ShieldX, BoxArrowRight, ShieldCheck, Gem, ShieldExclamation } from 'react-bootstrap-icons';
|
@@ -490,75 +490,378 @@ var OrganisationStatus = function (props) {
|
|
490
490
|
return orgState;
|
491
491
|
};
|
492
492
|
|
493
|
-
var
|
494
|
-
|
495
|
-
|
496
|
-
|
497
|
-
var
|
498
|
-
var
|
499
|
-
|
500
|
-
|
501
|
-
|
502
|
-
|
503
|
-
|
504
|
-
|
505
|
-
|
506
|
-
|
507
|
-
|
508
|
-
|
509
|
-
|
510
|
-
|
511
|
-
|
512
|
-
|
513
|
-
|
514
|
-
|
515
|
-
|
493
|
+
function e$1(e){this.message=e;}e$1.prototype=new Error,e$1.prototype.name="InvalidCharacterError";var r="undefined"!=typeof window&&window.atob&&window.atob.bind(window)||function(r){var t=String(r).replace(/=+$/,"");if(t.length%4==1)throw new e$1("'atob' failed: The string to be decoded is not correctly encoded.");for(var n,o,a=0,i=0,c="";o=t.charAt(i++);~o&&(n=a%4?64*n+o:o,a++%4)?c+=String.fromCharCode(255&n>>(-2*a&6)):0)o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(o);return c};function t$1(e){var t=e.replace(/-/g,"+").replace(/_/g,"/");switch(t.length%4){case 0:break;case 2:t+="==";break;case 3:t+="=";break;default:throw "Illegal base64url string!"}try{return function(e){return decodeURIComponent(r(e).replace(/(.)/g,(function(e,r){var t=r.charCodeAt(0).toString(16).toUpperCase();return t.length<2&&(t="0"+t),"%"+t})))}(t)}catch(e){return r(t)}}function n$1(e){this.message=e;}function o(e,r){if("string"!=typeof e)throw new n$1("Invalid token specified");var o=!0===(r=r||{}).header?0:1;try{return JSON.parse(t$1(e.split(".")[o]))}catch(e){throw new n$1("Invalid token specified: "+e.message)}}n$1.prototype=new Error,n$1.prototype.name="InvalidTokenError";
|
494
|
+
|
495
|
+
var ConnectionContext = createContext({});
|
496
|
+
var ConnectionContextProvider = function (props) {
|
497
|
+
var _a = useState(), token = _a[0], setToken = _a[1];
|
498
|
+
var serverURL = props.serverURL, t = props.t, children = props.children;
|
499
|
+
useEffect(function () {
|
500
|
+
var timer = setInterval(function () { return __awaiter(void 0, void 0, void 0, function () {
|
501
|
+
var newToken;
|
502
|
+
return __generator(this, function (_a) {
|
503
|
+
switch (_a.label) {
|
504
|
+
case 0: return [4 /*yield*/, localStorage.getItem('token')];
|
505
|
+
case 1:
|
506
|
+
newToken = _a.sent();
|
507
|
+
if (token !== newToken) {
|
508
|
+
setToken(newToken);
|
509
|
+
}
|
510
|
+
return [2 /*return*/];
|
511
|
+
}
|
512
|
+
});
|
513
|
+
}); }, 3000);
|
514
|
+
if (token) {
|
515
|
+
clearTimeout(timer);
|
516
|
+
}
|
517
|
+
return function () {
|
518
|
+
clearTimeout(timer);
|
519
|
+
};
|
520
|
+
}, [token]);
|
521
|
+
var send = useCallback(function (method, path, data, config, extraUrl) {
|
522
|
+
return new Promise(function (resolve, reject) {
|
523
|
+
var url = "".concat(extraUrl ? extraUrl : serverURL, "/").concat(path);
|
524
|
+
var headers;
|
525
|
+
if (token) {
|
526
|
+
headers = { authorization: "Bearer ".concat(token.toString()) };
|
516
527
|
}
|
517
528
|
else {
|
518
|
-
|
529
|
+
localStorage.getItem('token');
|
530
|
+
headers = {
|
531
|
+
authorization: "Bearer ".concat(localStorage.getItem('token')),
|
532
|
+
};
|
533
|
+
}
|
534
|
+
axios(__assign({ method: method, url: url, data: data, headers: headers }, config))
|
535
|
+
.then(function (response) {
|
536
|
+
var _a, _b, _c;
|
537
|
+
if (response.status) {
|
538
|
+
if (response.status === 200 || response.status === 201) {
|
539
|
+
resolve({
|
540
|
+
status: response.status,
|
541
|
+
data: (_a = response.data.data) !== null && _a !== void 0 ? _a : response.data,
|
542
|
+
response: response,
|
543
|
+
statusText: 'SUCCESS',
|
544
|
+
message: response.data.message,
|
545
|
+
});
|
546
|
+
}
|
547
|
+
else if (response.status === 422) {
|
548
|
+
reject({
|
549
|
+
status: response.status,
|
550
|
+
data: (_b = response.data) === null || _b === void 0 ? void 0 : _b.data,
|
551
|
+
statusText: 'ERROR',
|
552
|
+
response: response,
|
553
|
+
message: response.data.message,
|
554
|
+
errors: (_c = response.data) === null || _c === void 0 ? void 0 : _c.errors,
|
555
|
+
});
|
556
|
+
}
|
557
|
+
}
|
558
|
+
else {
|
559
|
+
reject({
|
560
|
+
status: 500,
|
561
|
+
statusText: 'UNKNOWN',
|
562
|
+
message: t('common:systemError'),
|
563
|
+
});
|
564
|
+
}
|
565
|
+
})
|
566
|
+
.catch(function (e) {
|
567
|
+
var _a;
|
568
|
+
if (e.response) {
|
569
|
+
if (e.response.status) {
|
570
|
+
if (e.response.data.message === 'jwt expired') {
|
571
|
+
localStorage.removeItem('token');
|
572
|
+
window.location.reload();
|
573
|
+
}
|
574
|
+
reject({
|
575
|
+
status: e.response.status,
|
576
|
+
statusText: 'ERROR',
|
577
|
+
errors: (_a = e.response.data) === null || _a === void 0 ? void 0 : _a.errors,
|
578
|
+
message: e.response.data.message,
|
579
|
+
});
|
580
|
+
}
|
581
|
+
else {
|
582
|
+
reject({
|
583
|
+
statusText: 'ERROR',
|
584
|
+
message: t('common:systemError'),
|
585
|
+
});
|
586
|
+
}
|
587
|
+
}
|
588
|
+
else {
|
589
|
+
reject({
|
590
|
+
statusText: 'ERROR',
|
591
|
+
message: t('common:networkError'),
|
592
|
+
});
|
593
|
+
}
|
594
|
+
});
|
595
|
+
});
|
596
|
+
}, [token, serverURL]);
|
597
|
+
var post = useCallback(function (path, data, config, extraUrl) {
|
598
|
+
return send('post', path, data, config, extraUrl);
|
599
|
+
}, [send]);
|
600
|
+
var put = useCallback(function (path, data, config) {
|
601
|
+
return send('put', path, data, config);
|
602
|
+
}, [send]);
|
603
|
+
var get = useCallback(function (path, config) {
|
604
|
+
return send('get', path, undefined, config);
|
605
|
+
}, [send]);
|
606
|
+
var patch = useCallback(function (path, data, config) {
|
607
|
+
return send('patch', path, data, config);
|
608
|
+
}, [send]);
|
609
|
+
var del = useCallback(function (path, config) {
|
610
|
+
return send('delete', path, config);
|
611
|
+
}, [send]);
|
612
|
+
var updateToken = useCallback(function (newToken) { return __awaiter(void 0, void 0, void 0, function () {
|
613
|
+
return __generator(this, function (_a) {
|
614
|
+
if (newToken) {
|
615
|
+
localStorage.setItem('token', newToken);
|
616
|
+
setToken(newToken);
|
617
|
+
}
|
618
|
+
else {
|
619
|
+
localStorage.setItem('token', '');
|
620
|
+
setToken(undefined);
|
621
|
+
}
|
622
|
+
return [2 /*return*/];
|
623
|
+
});
|
624
|
+
}); }, []);
|
625
|
+
var removeToken = function (tkn) {
|
626
|
+
if (tkn) {
|
627
|
+
var exp = o(tkn).exp;
|
628
|
+
if (Date.now() > exp * 1000) {
|
629
|
+
localStorage.setItem('token', '');
|
630
|
+
localStorage.removeItem('userRole');
|
631
|
+
localStorage.removeItem('userId');
|
632
|
+
localStorage.removeItem('companyId');
|
633
|
+
localStorage.removeItem('companyRole');
|
634
|
+
}
|
635
|
+
else {
|
636
|
+
var diff = exp * 1000 - Date.now();
|
637
|
+
setTimeout(function () {
|
638
|
+
setToken(undefined);
|
639
|
+
localStorage.setItem('token', '');
|
640
|
+
localStorage.removeItem('userRole');
|
641
|
+
localStorage.removeItem('userId');
|
642
|
+
localStorage.removeItem('companyId');
|
643
|
+
localStorage.removeItem('companyRole');
|
644
|
+
}, diff);
|
645
|
+
console.log(diff, 'Remaining Token expire time');
|
519
646
|
}
|
520
647
|
}
|
521
|
-
});
|
522
|
-
var getCompanyBgColor = function (item) {
|
523
|
-
if (item === "Government") {
|
524
|
-
return GovBGColor;
|
525
|
-
}
|
526
|
-
else if (item === "Certifier") {
|
527
|
-
return CertBGColor;
|
528
|
-
}
|
529
|
-
return DevBGColor;
|
530
|
-
};
|
531
|
-
var getCompanyRoleComponent = function (item) {
|
532
|
-
return (React.createElement("div", { style: { display: "flex", alignItems: "center" } },
|
533
|
-
item === CompanyRole.GOVERNMENT ? (React.createElement(RoleIcon, { icon: React.createElement(BankOutlined, null), bg: GovBGColor, color: GovColor })) : item === CompanyRole.CERTIFIER ? (React.createElement(RoleIcon, { icon: React.createElement(SafetyOutlined, null), bg: CertBGColor, color: CertColor })) : item === CompanyRole.MINISTRY ? (React.createElement(RoleIcon, { icon: React.createElement(AuditOutlined, null), bg: MinBGColor, color: MinColor })) : (React.createElement(RoleIcon, { icon: React.createElement(ExperimentOutlined, null), bg: DevBGColor, color: DevColor })),
|
534
|
-
item === CompanyRole.PROGRAMME_DEVELOPER ? (React.createElement("div", null, t("company:developer"))) : (React.createElement("div", null, item))));
|
535
|
-
};
|
536
|
-
var getCompanyStateComponent = function (item) {
|
537
|
-
return (React.createElement("div", { style: { display: "flex", alignItems: "left" } },
|
538
|
-
React.createElement(OrganisationStatus, { t: t, organisationStatus: parseInt(item) })));
|
539
648
|
};
|
540
|
-
|
541
|
-
|
649
|
+
useEffect(function () {
|
650
|
+
removeToken(token);
|
651
|
+
}, [token]);
|
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 },
|
654
|
+
} }, children));
|
655
|
+
};
|
656
|
+
var useConnection = function () {
|
657
|
+
var context = useContext(ConnectionContext);
|
658
|
+
return context.connection;
|
659
|
+
};
|
660
|
+
|
661
|
+
var UserContext = createContext({
|
662
|
+
setUserInfo: function () { },
|
663
|
+
removeUserInfo: function () { },
|
664
|
+
IsAuthenticated: function (tkn) { return false; },
|
665
|
+
isTokenExpired: false,
|
666
|
+
setIsTokenExpired: function (val) { },
|
667
|
+
});
|
668
|
+
var UserInformationContextProvider = function (_a) {
|
669
|
+
var children = _a.children;
|
670
|
+
var token = useConnection().token;
|
671
|
+
var _b = useState(false), isTokenExpired = _b[0], setIsTokenExpired = _b[1];
|
672
|
+
var initialUserProps = {
|
673
|
+
id: localStorage.getItem('userId') ? localStorage.getItem('userId') : '',
|
674
|
+
userRole: localStorage.getItem('userRole') ? localStorage.getItem('userRole') : '',
|
675
|
+
companyRole: localStorage.getItem('companyRole')
|
676
|
+
? localStorage.getItem('companyRole')
|
677
|
+
: '',
|
678
|
+
companyId: localStorage.getItem('companyId')
|
679
|
+
? parseInt(localStorage.getItem('companyId'))
|
680
|
+
: -1,
|
681
|
+
companyLogo: localStorage.getItem('companyLogo')
|
682
|
+
? localStorage.getItem('companyLogo')
|
683
|
+
: '',
|
684
|
+
companyName: localStorage.getItem('companyName')
|
685
|
+
? localStorage.getItem('companyName')
|
686
|
+
: '',
|
687
|
+
companyState: localStorage.getItem('companyState')
|
688
|
+
? parseInt(localStorage.getItem('companyState'))
|
689
|
+
: 0,
|
542
690
|
};
|
543
|
-
var
|
544
|
-
|
545
|
-
|
546
|
-
|
547
|
-
|
548
|
-
|
549
|
-
|
550
|
-
|
551
|
-
|
552
|
-
|
553
|
-
|
554
|
-
}
|
555
|
-
{
|
556
|
-
|
557
|
-
|
558
|
-
|
559
|
-
|
560
|
-
|
561
|
-
|
691
|
+
var _c = useState(initialUserProps), userInfoState = _c[0], setUserInfoState = _c[1];
|
692
|
+
var setUserInfo = function (value) {
|
693
|
+
var state = (userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.companyState) === 1 ? userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.companyState : 0;
|
694
|
+
var id = value.id, userRole = value.userRole, companyId = value.companyId, companyRole = value.companyRole, companyLogo = value.companyLogo, companyName = value.companyName, _a = value.companyState, companyState = _a === void 0 ? state : _a;
|
695
|
+
if (id) {
|
696
|
+
setUserInfoState(function (prev) { return (__assign(__assign({}, prev), { id: id })); });
|
697
|
+
localStorage.setItem('userId', id);
|
698
|
+
}
|
699
|
+
if (userRole) {
|
700
|
+
setUserInfoState(function (prev) { return (__assign(__assign({}, prev), { userRole: userRole })); });
|
701
|
+
localStorage.setItem('userRole', userRole);
|
702
|
+
}
|
703
|
+
if (companyId) {
|
704
|
+
setUserInfoState(function (prev) { return (__assign(__assign({}, prev), { companyId: companyId })); });
|
705
|
+
localStorage.setItem('companyId', companyId + '');
|
706
|
+
}
|
707
|
+
if (companyLogo) {
|
708
|
+
setUserInfoState(function (prev) { return (__assign(__assign({}, prev), { companyLogo: companyLogo })); });
|
709
|
+
localStorage.setItem('companyLogo', companyLogo);
|
710
|
+
}
|
711
|
+
else {
|
712
|
+
setUserInfoState(function (prev) { return (__assign(__assign({}, prev), { companyLogo: '' })); });
|
713
|
+
localStorage.setItem('companyLogo', '');
|
714
|
+
}
|
715
|
+
if (companyName) {
|
716
|
+
setUserInfoState(function (prev) { return (__assign(__assign({}, prev), { companyName: companyName })); });
|
717
|
+
localStorage.setItem('companyName', companyName);
|
718
|
+
}
|
719
|
+
if (userRole) {
|
720
|
+
setUserInfoState(function (prev) { return (__assign(__assign({}, prev), { companyRole: companyRole })); });
|
721
|
+
localStorage.setItem('companyRole', companyRole);
|
722
|
+
}
|
723
|
+
setUserInfoState(function (prev) { return (__assign(__assign({}, prev), { companyState: companyState })); });
|
724
|
+
localStorage.setItem('companyState', companyState + '');
|
725
|
+
};
|
726
|
+
var IsAuthenticated = useCallback(function (tokenNew) {
|
727
|
+
var tokenVal;
|
728
|
+
if (tokenNew) {
|
729
|
+
tokenVal = tokenNew;
|
730
|
+
}
|
731
|
+
else if (token) {
|
732
|
+
tokenVal = token;
|
733
|
+
}
|
734
|
+
else {
|
735
|
+
tokenVal = localStorage.getItem('token');
|
736
|
+
if (tokenVal === '') {
|
737
|
+
if (history.length !== 1) {
|
738
|
+
setIsTokenExpired(true);
|
739
|
+
}
|
740
|
+
}
|
741
|
+
}
|
742
|
+
try {
|
743
|
+
if (tokenVal) {
|
744
|
+
var exp = o(tokenVal).exp;
|
745
|
+
return Date.now() < exp * 1000;
|
746
|
+
}
|
747
|
+
return false;
|
748
|
+
}
|
749
|
+
catch (err) {
|
750
|
+
return false;
|
751
|
+
}
|
752
|
+
}, [token]);
|
753
|
+
var removeUserInfo = function () {
|
754
|
+
localStorage.removeItem('userId');
|
755
|
+
localStorage.removeItem('userRole');
|
756
|
+
localStorage.removeItem('companyId');
|
757
|
+
localStorage.removeItem('companyRole');
|
758
|
+
localStorage.removeItem('companyName');
|
759
|
+
localStorage.removeItem('companyState');
|
760
|
+
localStorage.removeItem('companyLogo');
|
761
|
+
setUserInfoState(initialUserProps);
|
762
|
+
};
|
763
|
+
return (React.createElement(UserContext.Provider, { value: {
|
764
|
+
userInfoState: userInfoState,
|
765
|
+
setUserInfo: setUserInfo,
|
766
|
+
removeUserInfo: removeUserInfo,
|
767
|
+
IsAuthenticated: IsAuthenticated,
|
768
|
+
isTokenExpired: isTokenExpired,
|
769
|
+
setIsTokenExpired: setIsTokenExpired,
|
770
|
+
} }, children));
|
771
|
+
};
|
772
|
+
var useUserContext = function () {
|
773
|
+
return useContext(UserContext);
|
774
|
+
};
|
775
|
+
|
776
|
+
var SettingsContext = createContext({
|
777
|
+
isTransferFrozen: false,
|
778
|
+
setTransferFrozen: function (value) { },
|
779
|
+
});
|
780
|
+
var SettingsContextProvider = function (_a) {
|
781
|
+
var children = _a.children;
|
782
|
+
var _b = useState(false), isTransferFrozen = _b[0], setIsTransferFrozen = _b[1];
|
783
|
+
var setTransferFrozen = function (value) {
|
784
|
+
setIsTransferFrozen(value);
|
785
|
+
};
|
786
|
+
return (React.createElement(SettingsContext.Provider, { value: {
|
787
|
+
isTransferFrozen: isTransferFrozen,
|
788
|
+
setTransferFrozen: setTransferFrozen,
|
789
|
+
} }, children));
|
790
|
+
};
|
791
|
+
var useSettingsContext = function () {
|
792
|
+
return useContext(SettingsContext);
|
793
|
+
};
|
794
|
+
|
795
|
+
var Search$2 = Input.Search;
|
796
|
+
var CompanyManagementComponent = function (props) {
|
797
|
+
var t = props.t, useAbilityContext = props.useAbilityContext, visibleColumns = props.visibleColumns, onNavigateToCompanyProfile = props.onNavigateToCompanyProfile, onClickAddCompany = props.onClickAddCompany;
|
798
|
+
var _a = useState(), totalCompany = _a[0], setTotalCompany = _a[1];
|
799
|
+
var _b = useState(false), loading = _b[0], setLoading = _b[1];
|
800
|
+
var _c = useState([]), tableData = _c[0], setTableData = _c[1];
|
801
|
+
var _d = useState(1), currentPage = _d[0], setCurrentPage = _d[1];
|
802
|
+
var _e = useState(10), pageSize = _e[0], setPageSize = _e[1];
|
803
|
+
var searchByTermOrganisation = useState("name")[0];
|
804
|
+
var _f = useState(""), searchValueOrganisations = _f[0], setSearchValueOrganisations = _f[1];
|
805
|
+
var _g = useState(""), networksearchOrganisations = _g[0], setNetworkSearchOrganisations = _g[1];
|
806
|
+
var _h = useState(false), filterVisible = _h[0], setFilterVisible = _h[1];
|
807
|
+
var _j = useState("All"), filterByOrganisationType = _j[0], setFilterByOrganisationType = _j[1];
|
808
|
+
var _k = useState(""), sortOrder = _k[0], setSortOrder = _k[1];
|
809
|
+
var _l = useState(""), sortField = _l[0], setSortField = _l[1];
|
810
|
+
var ability = useAbilityContext();
|
811
|
+
var post = useConnection().post;
|
812
|
+
document.addEventListener("mousedown", function (event) {
|
813
|
+
var organisationFilterArea1 = document.querySelector(".filter-bar");
|
814
|
+
var organisationFilterArea2 = document.querySelector(".filter-dropdown");
|
815
|
+
if (organisationFilterArea1 !== null && organisationFilterArea2 !== null) {
|
816
|
+
if (organisationFilterArea1.contains(event.target) ||
|
817
|
+
organisationFilterArea2.contains(event.target)) {
|
818
|
+
setFilterVisible(true);
|
819
|
+
}
|
820
|
+
else {
|
821
|
+
setFilterVisible(false);
|
822
|
+
}
|
823
|
+
}
|
824
|
+
});
|
825
|
+
var getCompanyBgColor = function (item) {
|
826
|
+
if (item === "Government") {
|
827
|
+
return GovBGColor;
|
828
|
+
}
|
829
|
+
else if (item === "Certifier") {
|
830
|
+
return CertBGColor;
|
831
|
+
}
|
832
|
+
return DevBGColor;
|
833
|
+
};
|
834
|
+
var getCompanyRoleComponent = function (item) {
|
835
|
+
return (React.createElement("div", { style: { display: "flex", alignItems: "center" } },
|
836
|
+
item === CompanyRole.GOVERNMENT ? (React.createElement(RoleIcon, { icon: React.createElement(BankOutlined, null), bg: GovBGColor, color: GovColor })) : item === CompanyRole.CERTIFIER ? (React.createElement(RoleIcon, { icon: React.createElement(SafetyOutlined, null), bg: CertBGColor, color: CertColor })) : item === CompanyRole.MINISTRY ? (React.createElement(RoleIcon, { icon: React.createElement(AuditOutlined, null), bg: MinBGColor, color: MinColor })) : (React.createElement(RoleIcon, { icon: React.createElement(ExperimentOutlined, null), bg: DevBGColor, color: DevColor })),
|
837
|
+
item === CompanyRole.PROGRAMME_DEVELOPER ? (React.createElement("div", null, t("company:developer"))) : (React.createElement("div", null, item))));
|
838
|
+
};
|
839
|
+
var getCompanyStateComponent = function (item) {
|
840
|
+
return (React.createElement("div", { style: { display: "flex", alignItems: "left" } },
|
841
|
+
React.createElement(OrganisationStatus, { t: t, organisationStatus: parseInt(item) })));
|
842
|
+
};
|
843
|
+
var handleFilterVisibleChange = function () {
|
844
|
+
setFilterVisible(true);
|
845
|
+
};
|
846
|
+
var columns = [
|
847
|
+
{
|
848
|
+
title: "",
|
849
|
+
dataIndex: "logo",
|
850
|
+
key: CompanyManagementColumns.logo,
|
851
|
+
width: "20px",
|
852
|
+
align: "left",
|
853
|
+
render: function (item, itemObj) {
|
854
|
+
return (React.createElement("div", { style: { display: "flex", alignItems: "center" } },
|
855
|
+
React.createElement(ProfileIcon, { icon: itemObj.logo, bg: getCompanyBgColor(itemObj.companyRole), name: itemObj.name })));
|
856
|
+
},
|
857
|
+
},
|
858
|
+
{
|
859
|
+
title: t("company:name"),
|
860
|
+
dataIndex: "name",
|
861
|
+
key: CompanyManagementColumns.name,
|
862
|
+
sorter: true,
|
863
|
+
align: "left",
|
864
|
+
render: function (item, itemObj) {
|
562
865
|
return (React.createElement("div", { style: { display: "flex", alignItems: "center" }, className: "clickable" },
|
563
866
|
React.createElement("div", { style: { fontWeight: 600 } }, item)));
|
564
867
|
},
|
@@ -5607,433 +5910,131 @@ var SdgGoals$1;
|
|
5607
5910
|
SdgGoals["industry"] = "Industry, Innovation and Infrastructure";
|
5608
5911
|
SdgGoals["reducedInEq"] = "Reduced Inequalities";
|
5609
5912
|
SdgGoals["sustainableCities"] = "Sustainable Cities and Communities";
|
5610
|
-
SdgGoals["responsibleConsumption"] = "Responsible Consumption and Production";
|
5611
|
-
SdgGoals["climateAction"] = "Climate Action";
|
5612
|
-
SdgGoals["lifeBelowWater"] = "Life Below Water";
|
5613
|
-
SdgGoals["lifeOnLand"] = "Life On Land";
|
5614
|
-
SdgGoals["peace"] = "Peace, Justice and Strong Institutions";
|
5615
|
-
SdgGoals["partnership"] = "Partnerships for the Goals";
|
5616
|
-
})(SdgGoals$1 || (SdgGoals$1 = {}));
|
5617
|
-
|
5618
|
-
var DocType;
|
5619
|
-
(function (DocType) {
|
5620
|
-
DocType["DESIGN_DOCUMENT"] = "0";
|
5621
|
-
DocType["METHODOLOGY_DOCUMENT"] = "1";
|
5622
|
-
DocType["MONITORING_REPORT"] = "2";
|
5623
|
-
DocType["VERIFICATION_REPORT"] = "3";
|
5624
|
-
DocType["ENVIRONMENTAL_IMPACT_ASSESSMENT"] = "7";
|
5625
|
-
})(DocType || (DocType = {}));
|
5626
|
-
|
5627
|
-
var DocumentStatus;
|
5628
|
-
(function (DocumentStatus) {
|
5629
|
-
DocumentStatus["PENDING"] = "Pending";
|
5630
|
-
DocumentStatus["ACCEPTED"] = "Accepted";
|
5631
|
-
DocumentStatus["REJECTED"] = "Rejected";
|
5632
|
-
})(DocumentStatus || (DocumentStatus = {}));
|
5633
|
-
|
5634
|
-
var CompanyState;
|
5635
|
-
(function (CompanyState) {
|
5636
|
-
CompanyState[CompanyState["SUSPENDED"] = 0] = "SUSPENDED";
|
5637
|
-
CompanyState[CompanyState["ACTIVE"] = 1] = "ACTIVE";
|
5638
|
-
CompanyState[CompanyState["PENDING"] = 2] = "PENDING";
|
5639
|
-
CompanyState[CompanyState["REJECTED"] = 3] = "REJECTED";
|
5640
|
-
})(CompanyState || (CompanyState = {}));
|
5641
|
-
|
5642
|
-
var WidgetType;
|
5643
|
-
(function (WidgetType) {
|
5644
|
-
WidgetType["PIE"] = "Pie";
|
5645
|
-
WidgetType["MAP"] = "Map";
|
5646
|
-
WidgetType["LIST"] = "List";
|
5647
|
-
})(WidgetType || (WidgetType = {}));
|
5648
|
-
|
5649
|
-
var StatsCardsTypes;
|
5650
|
-
(function (StatsCardsTypes) {
|
5651
|
-
StatsCardsTypes["PROGRAMMES_PENDING"] = "Programmes Pending";
|
5652
|
-
StatsCardsTypes["TRANSFER_REQUEST_RECEIVED"] = "Pending Transfers Received";
|
5653
|
-
StatsCardsTypes["PROGRAMMES_UNCERTIFIED"] = "Programmes Certifiable";
|
5654
|
-
StatsCardsTypes["TRANSFER_REQUEST_SENT"] = "Pending Transfers Sent";
|
5655
|
-
StatsCardsTypes["PROGRAMMES_CERTIFIED"] = "Programmes Certified";
|
5656
|
-
StatsCardsTypes["CREDIT_BALANCE"] = "Credit Balance";
|
5657
|
-
StatsCardsTypes["CREDIT_CERTIFIED"] = "Credits Certified";
|
5658
|
-
StatsCardsTypes["PROGRAMMES"] = "Programmes";
|
5659
|
-
StatsCardsTypes["CREDITS"] = "Credits";
|
5660
|
-
StatsCardsTypes["CERTIFIED_CREDITS"] = "Certified Credits";
|
5661
|
-
StatsCardsTypes["TOTAL_PROGRAMMES"] = "Total Programmes";
|
5662
|
-
StatsCardsTypes["TOTAL_PROGRAMMES_SECTOR"] = "Total Programmes: Sector";
|
5663
|
-
StatsCardsTypes["TOTAL_CREDITS"] = "Total Credits";
|
5664
|
-
StatsCardsTypes["TOTAL_CREDITS_CERTIFIED"] = "Total Credits Certified";
|
5665
|
-
StatsCardsTypes["PROGRAMME_LOCATIONS"] = "Programme Locations";
|
5666
|
-
StatsCardsTypes["TRANSFER_LOCATIONS_INTERNATIONAL"] = "Transfer Locations International";
|
5667
|
-
})(StatsCardsTypes || (StatsCardsTypes = {}));
|
5668
|
-
var MrvStatsCardsTypes;
|
5669
|
-
(function (MrvStatsCardsTypes) {
|
5670
|
-
MrvStatsCardsTypes["AGG_PROGRAMME_BY_SECTOR"] = "AGG_PROGRAMME_BY_SECTOR";
|
5671
|
-
// MY_AGG_PROGRAMME_BY_SECTOR = "MY_AGG_PROGRAMME_BY_SECTOR",
|
5672
|
-
MrvStatsCardsTypes["AGG_NDC_ACTION_BY_TYPE"] = "AGG_NDC_ACTION_BY_TYPE";
|
5673
|
-
// MY_AGG_NDC_ACTION_BY_TYPE = "MY_AGG_NDC_ACTION_BY_TYPE",
|
5674
|
-
MrvStatsCardsTypes["AGG_NDC_ACTION_BY_SECTOR"] = "AGG_NDC_ACTION_BY_SECTOR";
|
5675
|
-
// MY_AGG_NDC_ACTION_BY_SECTOR = "MY_AGG_NDC_ACTION_BY_SECTOR",
|
5676
|
-
MrvStatsCardsTypes["TOTAL_EMISSIONS"] = "TOTAL_EMISSIONS";
|
5677
|
-
// MY_TOTAL_EMISSIONS = "MY_TOTAL_EMISSIONS",
|
5678
|
-
MrvStatsCardsTypes["PROGRAMME_LOCATION"] = "PROGRAMME_LOCATION";
|
5679
|
-
// MY_PROGRAMME_LOCATION = "MY_PROGRAMME_LOCATION",
|
5680
|
-
MrvStatsCardsTypes["INVESTMENT_LOCATION"] = "INVESTMENT_LOCATION";
|
5681
|
-
// MY_INVESTMENT_LOCATION = "MY_INVESTMENT_LOCATION"
|
5682
|
-
MrvStatsCardsTypes["AGG_INVESTMENT_BY_TYPE"] = "AGG_INVESTMENT_BY_TYPE";
|
5683
|
-
// MY_AGG_INVESTMENT_BY_TYPE = "MY_AGG_INVESTMENT_BY_TYPE",
|
5684
|
-
})(MrvStatsCardsTypes || (MrvStatsCardsTypes = {}));
|
5685
|
-
var SystemNames;
|
5686
|
-
(function (SystemNames) {
|
5687
|
-
SystemNames["CARBON_REGISTRY"] = "CARBON_REGISTRY_SYSTEM";
|
5688
|
-
SystemNames["CARBON_TRANSPARENCY"] = "CARBON_TRANSPARENCY_SYSTEM";
|
5689
|
-
})(SystemNames || (SystemNames = {}));
|
5690
|
-
|
5691
|
-
var ConfigurationSettingsType;
|
5692
|
-
(function (ConfigurationSettingsType) {
|
5693
|
-
ConfigurationSettingsType[ConfigurationSettingsType["isTransferFrozen"] = 0] = "isTransferFrozen";
|
5694
|
-
})(ConfigurationSettingsType || (ConfigurationSettingsType = {}));
|
5695
|
-
|
5696
|
-
var MapTypes;
|
5697
|
-
(function (MapTypes) {
|
5698
|
-
MapTypes["Mapbox"] = "Mapbox";
|
5699
|
-
MapTypes["None"] = "None";
|
5700
|
-
})(MapTypes || (MapTypes = {}));
|
5701
|
-
|
5702
|
-
var dateTimeFormat = 'dd LLLL yyyy @ HH:mm';
|
5703
|
-
var dateFormat = 'dd LLLL yyyy';
|
5704
|
-
var creditUnit = 'ITMO';
|
5705
|
-
|
5706
|
-
var BaseEntity = /** @class */ (function () {
|
5707
|
-
function BaseEntity() {
|
5708
|
-
}
|
5709
|
-
return BaseEntity;
|
5710
|
-
}());
|
5711
|
-
|
5712
|
-
var ProgrammeTransfer = /** @class */ (function () {
|
5713
|
-
function ProgrammeTransfer() {
|
5714
|
-
}
|
5715
|
-
return ProgrammeTransfer;
|
5716
|
-
}());
|
5717
|
-
|
5718
|
-
var User = /** @class */ (function () {
|
5719
|
-
function User() {
|
5720
|
-
}
|
5721
|
-
return User;
|
5722
|
-
}());
|
5723
|
-
|
5724
|
-
var ProgrammeEntity = /** @class */ (function () {
|
5725
|
-
function ProgrammeEntity() {
|
5726
|
-
}
|
5727
|
-
return ProgrammeEntity;
|
5728
|
-
}());
|
5729
|
-
|
5730
|
-
var ProgrammeCertify = /** @class */ (function () {
|
5731
|
-
function ProgrammeCertify() {
|
5732
|
-
}
|
5733
|
-
return ProgrammeCertify;
|
5734
|
-
}());
|
5735
|
-
|
5736
|
-
function e$1(e){this.message=e;}e$1.prototype=new Error,e$1.prototype.name="InvalidCharacterError";var r="undefined"!=typeof window&&window.atob&&window.atob.bind(window)||function(r){var t=String(r).replace(/=+$/,"");if(t.length%4==1)throw new e$1("'atob' failed: The string to be decoded is not correctly encoded.");for(var n,o,a=0,i=0,c="";o=t.charAt(i++);~o&&(n=a%4?64*n+o:o,a++%4)?c+=String.fromCharCode(255&n>>(-2*a&6)):0)o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(o);return c};function t$1(e){var t=e.replace(/-/g,"+").replace(/_/g,"/");switch(t.length%4){case 0:break;case 2:t+="==";break;case 3:t+="=";break;default:throw "Illegal base64url string!"}try{return function(e){return decodeURIComponent(r(e).replace(/(.)/g,(function(e,r){var t=r.charCodeAt(0).toString(16).toUpperCase();return t.length<2&&(t="0"+t),"%"+t})))}(t)}catch(e){return r(t)}}function n$1(e){this.message=e;}function o(e,r){if("string"!=typeof e)throw new n$1("Invalid token specified");var o=!0===(r=r||{}).header?0:1;try{return JSON.parse(t$1(e.split(".")[o]))}catch(e){throw new n$1("Invalid token specified: "+e.message)}}n$1.prototype=new Error,n$1.prototype.name="InvalidTokenError";
|
5737
|
-
|
5738
|
-
var ConnectionContext = createContext({});
|
5739
|
-
var ConnectionContextProvider = function (props) {
|
5740
|
-
var _a = useState(), token = _a[0], setToken = _a[1];
|
5741
|
-
var serverURL = props.serverURL, t = props.t, children = props.children;
|
5742
|
-
useEffect(function () {
|
5743
|
-
var timer = setInterval(function () { return __awaiter(void 0, void 0, void 0, function () {
|
5744
|
-
var newToken;
|
5745
|
-
return __generator(this, function (_a) {
|
5746
|
-
switch (_a.label) {
|
5747
|
-
case 0: return [4 /*yield*/, localStorage.getItem('token')];
|
5748
|
-
case 1:
|
5749
|
-
newToken = _a.sent();
|
5750
|
-
if (token !== newToken) {
|
5751
|
-
setToken(newToken);
|
5752
|
-
}
|
5753
|
-
return [2 /*return*/];
|
5754
|
-
}
|
5755
|
-
});
|
5756
|
-
}); }, 3000);
|
5757
|
-
if (token) {
|
5758
|
-
clearTimeout(timer);
|
5759
|
-
}
|
5760
|
-
return function () {
|
5761
|
-
clearTimeout(timer);
|
5762
|
-
};
|
5763
|
-
}, [token]);
|
5764
|
-
var send = useCallback(function (method, path, data, config, extraUrl) {
|
5765
|
-
return new Promise(function (resolve, reject) {
|
5766
|
-
var url = "".concat(extraUrl ? extraUrl : serverURL, "/").concat(path);
|
5767
|
-
var headers;
|
5768
|
-
if (token) {
|
5769
|
-
headers = { authorization: "Bearer ".concat(token.toString()) };
|
5770
|
-
}
|
5771
|
-
else {
|
5772
|
-
localStorage.getItem('token');
|
5773
|
-
headers = {
|
5774
|
-
authorization: "Bearer ".concat(localStorage.getItem('token')),
|
5775
|
-
};
|
5776
|
-
}
|
5777
|
-
axios(__assign({ method: method, url: url, data: data, headers: headers }, config))
|
5778
|
-
.then(function (response) {
|
5779
|
-
var _a, _b, _c;
|
5780
|
-
if (response.status) {
|
5781
|
-
if (response.status === 200 || response.status === 201) {
|
5782
|
-
resolve({
|
5783
|
-
status: response.status,
|
5784
|
-
data: (_a = response.data.data) !== null && _a !== void 0 ? _a : response.data,
|
5785
|
-
response: response,
|
5786
|
-
statusText: 'SUCCESS',
|
5787
|
-
message: response.data.message,
|
5788
|
-
});
|
5789
|
-
}
|
5790
|
-
else if (response.status === 422) {
|
5791
|
-
reject({
|
5792
|
-
status: response.status,
|
5793
|
-
data: (_b = response.data) === null || _b === void 0 ? void 0 : _b.data,
|
5794
|
-
statusText: 'ERROR',
|
5795
|
-
response: response,
|
5796
|
-
message: response.data.message,
|
5797
|
-
errors: (_c = response.data) === null || _c === void 0 ? void 0 : _c.errors,
|
5798
|
-
});
|
5799
|
-
}
|
5800
|
-
}
|
5801
|
-
else {
|
5802
|
-
reject({
|
5803
|
-
status: 500,
|
5804
|
-
statusText: 'UNKNOWN',
|
5805
|
-
message: t('common:systemError'),
|
5806
|
-
});
|
5807
|
-
}
|
5808
|
-
})
|
5809
|
-
.catch(function (e) {
|
5810
|
-
var _a;
|
5811
|
-
if (e.response) {
|
5812
|
-
if (e.response.status) {
|
5813
|
-
if (e.response.data.message === 'jwt expired') {
|
5814
|
-
localStorage.removeItem('token');
|
5815
|
-
window.location.reload();
|
5816
|
-
}
|
5817
|
-
reject({
|
5818
|
-
status: e.response.status,
|
5819
|
-
statusText: 'ERROR',
|
5820
|
-
errors: (_a = e.response.data) === null || _a === void 0 ? void 0 : _a.errors,
|
5821
|
-
message: e.response.data.message,
|
5822
|
-
});
|
5823
|
-
}
|
5824
|
-
else {
|
5825
|
-
reject({
|
5826
|
-
statusText: 'ERROR',
|
5827
|
-
message: t('common:systemError'),
|
5828
|
-
});
|
5829
|
-
}
|
5830
|
-
}
|
5831
|
-
else {
|
5832
|
-
reject({
|
5833
|
-
statusText: 'ERROR',
|
5834
|
-
message: t('common:networkError'),
|
5835
|
-
});
|
5836
|
-
}
|
5837
|
-
});
|
5838
|
-
});
|
5839
|
-
}, [token, serverURL]);
|
5840
|
-
var post = useCallback(function (path, data, config, extraUrl) {
|
5841
|
-
return send('post', path, data, config, extraUrl);
|
5842
|
-
}, [send]);
|
5843
|
-
var put = useCallback(function (path, data, config) {
|
5844
|
-
return send('put', path, data, config);
|
5845
|
-
}, [send]);
|
5846
|
-
var get = useCallback(function (path, config) {
|
5847
|
-
return send('get', path, undefined, config);
|
5848
|
-
}, [send]);
|
5849
|
-
var patch = useCallback(function (path, data, config) {
|
5850
|
-
return send('patch', path, data, config);
|
5851
|
-
}, [send]);
|
5852
|
-
var del = useCallback(function (path, config) {
|
5853
|
-
return send('delete', path, config);
|
5854
|
-
}, [send]);
|
5855
|
-
var updateToken = useCallback(function (newToken) { return __awaiter(void 0, void 0, void 0, function () {
|
5856
|
-
return __generator(this, function (_a) {
|
5857
|
-
if (newToken) {
|
5858
|
-
localStorage.setItem('token', newToken);
|
5859
|
-
setToken(newToken);
|
5860
|
-
}
|
5861
|
-
else {
|
5862
|
-
localStorage.setItem('token', '');
|
5863
|
-
setToken(undefined);
|
5864
|
-
}
|
5865
|
-
return [2 /*return*/];
|
5866
|
-
});
|
5867
|
-
}); }, []);
|
5868
|
-
var removeToken = function (tkn) {
|
5869
|
-
if (tkn) {
|
5870
|
-
var exp = o(tkn).exp;
|
5871
|
-
if (Date.now() > exp * 1000) {
|
5872
|
-
localStorage.setItem('token', '');
|
5873
|
-
localStorage.removeItem('userRole');
|
5874
|
-
localStorage.removeItem('userId');
|
5875
|
-
localStorage.removeItem('companyId');
|
5876
|
-
localStorage.removeItem('companyRole');
|
5877
|
-
}
|
5878
|
-
else {
|
5879
|
-
var diff = exp * 1000 - Date.now();
|
5880
|
-
setTimeout(function () {
|
5881
|
-
setToken(undefined);
|
5882
|
-
localStorage.setItem('token', '');
|
5883
|
-
localStorage.removeItem('userRole');
|
5884
|
-
localStorage.removeItem('userId');
|
5885
|
-
localStorage.removeItem('companyId');
|
5886
|
-
localStorage.removeItem('companyRole');
|
5887
|
-
}, diff);
|
5888
|
-
console.log(diff, 'Remaining Token expire time');
|
5889
|
-
}
|
5890
|
-
}
|
5891
|
-
};
|
5892
|
-
useEffect(function () {
|
5893
|
-
removeToken(token);
|
5894
|
-
}, [token]);
|
5895
|
-
return (React.createElement(ConnectionContext.Provider, { value: {
|
5896
|
-
connection: { post: post, put: put, get: get, patch: patch, delete: del, updateToken: updateToken, token: token, removeToken: removeToken },
|
5897
|
-
} }, children));
|
5898
|
-
};
|
5899
|
-
var useConnection = function () {
|
5900
|
-
var context = useContext(ConnectionContext);
|
5901
|
-
return context.connection;
|
5902
|
-
};
|
5913
|
+
SdgGoals["responsibleConsumption"] = "Responsible Consumption and Production";
|
5914
|
+
SdgGoals["climateAction"] = "Climate Action";
|
5915
|
+
SdgGoals["lifeBelowWater"] = "Life Below Water";
|
5916
|
+
SdgGoals["lifeOnLand"] = "Life On Land";
|
5917
|
+
SdgGoals["peace"] = "Peace, Justice and Strong Institutions";
|
5918
|
+
SdgGoals["partnership"] = "Partnerships for the Goals";
|
5919
|
+
})(SdgGoals$1 || (SdgGoals$1 = {}));
|
5903
5920
|
|
5904
|
-
var
|
5905
|
-
|
5906
|
-
|
5907
|
-
|
5908
|
-
|
5909
|
-
|
5910
|
-
|
5911
|
-
|
5912
|
-
var children = _a.children;
|
5913
|
-
var token = useConnection().token;
|
5914
|
-
var _b = useState(false), isTokenExpired = _b[0], setIsTokenExpired = _b[1];
|
5915
|
-
var initialUserProps = {
|
5916
|
-
id: localStorage.getItem('userId') ? localStorage.getItem('userId') : '',
|
5917
|
-
userRole: localStorage.getItem('userRole') ? localStorage.getItem('userRole') : '',
|
5918
|
-
companyRole: localStorage.getItem('companyRole')
|
5919
|
-
? localStorage.getItem('companyRole')
|
5920
|
-
: '',
|
5921
|
-
companyId: localStorage.getItem('companyId')
|
5922
|
-
? parseInt(localStorage.getItem('companyId'))
|
5923
|
-
: -1,
|
5924
|
-
companyLogo: localStorage.getItem('companyLogo')
|
5925
|
-
? localStorage.getItem('companyLogo')
|
5926
|
-
: '',
|
5927
|
-
companyName: localStorage.getItem('companyName')
|
5928
|
-
? localStorage.getItem('companyName')
|
5929
|
-
: '',
|
5930
|
-
companyState: localStorage.getItem('companyState')
|
5931
|
-
? parseInt(localStorage.getItem('companyState'))
|
5932
|
-
: 0,
|
5933
|
-
};
|
5934
|
-
var _c = useState(initialUserProps), userInfoState = _c[0], setUserInfoState = _c[1];
|
5935
|
-
var setUserInfo = function (value) {
|
5936
|
-
var state = (userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.companyState) === 1 ? userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.companyState : 0;
|
5937
|
-
var id = value.id, userRole = value.userRole, companyId = value.companyId, companyRole = value.companyRole, companyLogo = value.companyLogo, companyName = value.companyName, _a = value.companyState, companyState = _a === void 0 ? state : _a;
|
5938
|
-
if (id) {
|
5939
|
-
setUserInfoState(function (prev) { return (__assign(__assign({}, prev), { id: id })); });
|
5940
|
-
localStorage.setItem('userId', id);
|
5941
|
-
}
|
5942
|
-
if (userRole) {
|
5943
|
-
setUserInfoState(function (prev) { return (__assign(__assign({}, prev), { userRole: userRole })); });
|
5944
|
-
localStorage.setItem('userRole', userRole);
|
5945
|
-
}
|
5946
|
-
if (companyId) {
|
5947
|
-
setUserInfoState(function (prev) { return (__assign(__assign({}, prev), { companyId: companyId })); });
|
5948
|
-
localStorage.setItem('companyId', companyId + '');
|
5949
|
-
}
|
5950
|
-
if (companyLogo) {
|
5951
|
-
setUserInfoState(function (prev) { return (__assign(__assign({}, prev), { companyLogo: companyLogo })); });
|
5952
|
-
localStorage.setItem('companyLogo', companyLogo);
|
5953
|
-
}
|
5954
|
-
else {
|
5955
|
-
setUserInfoState(function (prev) { return (__assign(__assign({}, prev), { companyLogo: '' })); });
|
5956
|
-
localStorage.setItem('companyLogo', '');
|
5957
|
-
}
|
5958
|
-
if (companyName) {
|
5959
|
-
setUserInfoState(function (prev) { return (__assign(__assign({}, prev), { companyName: companyName })); });
|
5960
|
-
localStorage.setItem('companyName', companyName);
|
5961
|
-
}
|
5962
|
-
if (userRole) {
|
5963
|
-
setUserInfoState(function (prev) { return (__assign(__assign({}, prev), { companyRole: companyRole })); });
|
5964
|
-
localStorage.setItem('companyRole', companyRole);
|
5965
|
-
}
|
5966
|
-
setUserInfoState(function (prev) { return (__assign(__assign({}, prev), { companyState: companyState })); });
|
5967
|
-
localStorage.setItem('companyState', companyState + '');
|
5968
|
-
};
|
5969
|
-
var IsAuthenticated = useCallback(function (tokenNew) {
|
5970
|
-
var tokenVal;
|
5971
|
-
if (tokenNew) {
|
5972
|
-
tokenVal = tokenNew;
|
5973
|
-
}
|
5974
|
-
else if (token) {
|
5975
|
-
tokenVal = token;
|
5976
|
-
}
|
5977
|
-
else {
|
5978
|
-
tokenVal = localStorage.getItem('token');
|
5979
|
-
if (tokenVal === '') {
|
5980
|
-
if (history.length !== 1) {
|
5981
|
-
setIsTokenExpired(true);
|
5982
|
-
}
|
5983
|
-
}
|
5984
|
-
}
|
5985
|
-
try {
|
5986
|
-
if (tokenVal) {
|
5987
|
-
var exp = o(tokenVal).exp;
|
5988
|
-
return Date.now() < exp * 1000;
|
5989
|
-
}
|
5990
|
-
return false;
|
5991
|
-
}
|
5992
|
-
catch (err) {
|
5993
|
-
return false;
|
5994
|
-
}
|
5995
|
-
}, [token]);
|
5996
|
-
var removeUserInfo = function () {
|
5997
|
-
localStorage.removeItem('userId');
|
5998
|
-
localStorage.removeItem('userRole');
|
5999
|
-
localStorage.removeItem('companyId');
|
6000
|
-
localStorage.removeItem('companyRole');
|
6001
|
-
localStorage.removeItem('companyName');
|
6002
|
-
localStorage.removeItem('companyState');
|
6003
|
-
localStorage.removeItem('companyLogo');
|
6004
|
-
setUserInfoState(initialUserProps);
|
6005
|
-
};
|
6006
|
-
return (React.createElement(UserContext.Provider, { value: {
|
6007
|
-
userInfoState: userInfoState,
|
6008
|
-
setUserInfo: setUserInfo,
|
6009
|
-
removeUserInfo: removeUserInfo,
|
6010
|
-
IsAuthenticated: IsAuthenticated,
|
6011
|
-
isTokenExpired: isTokenExpired,
|
6012
|
-
setIsTokenExpired: setIsTokenExpired,
|
6013
|
-
} }, children));
|
6014
|
-
};
|
6015
|
-
var useUserContext = function () {
|
6016
|
-
return useContext(UserContext);
|
6017
|
-
};
|
5921
|
+
var DocType;
|
5922
|
+
(function (DocType) {
|
5923
|
+
DocType["DESIGN_DOCUMENT"] = "0";
|
5924
|
+
DocType["METHODOLOGY_DOCUMENT"] = "1";
|
5925
|
+
DocType["MONITORING_REPORT"] = "2";
|
5926
|
+
DocType["VERIFICATION_REPORT"] = "3";
|
5927
|
+
DocType["ENVIRONMENTAL_IMPACT_ASSESSMENT"] = "7";
|
5928
|
+
})(DocType || (DocType = {}));
|
6018
5929
|
|
6019
|
-
var
|
6020
|
-
|
6021
|
-
|
6022
|
-
|
6023
|
-
|
6024
|
-
|
6025
|
-
|
6026
|
-
|
6027
|
-
|
6028
|
-
|
6029
|
-
|
6030
|
-
|
6031
|
-
|
6032
|
-
|
6033
|
-
|
6034
|
-
var
|
6035
|
-
|
6036
|
-
|
5930
|
+
var DocumentStatus;
|
5931
|
+
(function (DocumentStatus) {
|
5932
|
+
DocumentStatus["PENDING"] = "Pending";
|
5933
|
+
DocumentStatus["ACCEPTED"] = "Accepted";
|
5934
|
+
DocumentStatus["REJECTED"] = "Rejected";
|
5935
|
+
})(DocumentStatus || (DocumentStatus = {}));
|
5936
|
+
|
5937
|
+
var CompanyState;
|
5938
|
+
(function (CompanyState) {
|
5939
|
+
CompanyState[CompanyState["SUSPENDED"] = 0] = "SUSPENDED";
|
5940
|
+
CompanyState[CompanyState["ACTIVE"] = 1] = "ACTIVE";
|
5941
|
+
CompanyState[CompanyState["PENDING"] = 2] = "PENDING";
|
5942
|
+
CompanyState[CompanyState["REJECTED"] = 3] = "REJECTED";
|
5943
|
+
})(CompanyState || (CompanyState = {}));
|
5944
|
+
|
5945
|
+
var WidgetType;
|
5946
|
+
(function (WidgetType) {
|
5947
|
+
WidgetType["PIE"] = "Pie";
|
5948
|
+
WidgetType["MAP"] = "Map";
|
5949
|
+
WidgetType["LIST"] = "List";
|
5950
|
+
})(WidgetType || (WidgetType = {}));
|
5951
|
+
|
5952
|
+
var StatsCardsTypes;
|
5953
|
+
(function (StatsCardsTypes) {
|
5954
|
+
StatsCardsTypes["PROGRAMMES_PENDING"] = "Programmes Pending";
|
5955
|
+
StatsCardsTypes["TRANSFER_REQUEST_RECEIVED"] = "Pending Transfers Received";
|
5956
|
+
StatsCardsTypes["PROGRAMMES_UNCERTIFIED"] = "Programmes Certifiable";
|
5957
|
+
StatsCardsTypes["TRANSFER_REQUEST_SENT"] = "Pending Transfers Sent";
|
5958
|
+
StatsCardsTypes["PROGRAMMES_CERTIFIED"] = "Programmes Certified";
|
5959
|
+
StatsCardsTypes["CREDIT_BALANCE"] = "Credit Balance";
|
5960
|
+
StatsCardsTypes["CREDIT_CERTIFIED"] = "Credits Certified";
|
5961
|
+
StatsCardsTypes["PROGRAMMES"] = "Programmes";
|
5962
|
+
StatsCardsTypes["CREDITS"] = "Credits";
|
5963
|
+
StatsCardsTypes["CERTIFIED_CREDITS"] = "Certified Credits";
|
5964
|
+
StatsCardsTypes["TOTAL_PROGRAMMES"] = "Total Programmes";
|
5965
|
+
StatsCardsTypes["TOTAL_PROGRAMMES_SECTOR"] = "Total Programmes: Sector";
|
5966
|
+
StatsCardsTypes["TOTAL_CREDITS"] = "Total Credits";
|
5967
|
+
StatsCardsTypes["TOTAL_CREDITS_CERTIFIED"] = "Total Credits Certified";
|
5968
|
+
StatsCardsTypes["PROGRAMME_LOCATIONS"] = "Programme Locations";
|
5969
|
+
StatsCardsTypes["TRANSFER_LOCATIONS_INTERNATIONAL"] = "Transfer Locations International";
|
5970
|
+
})(StatsCardsTypes || (StatsCardsTypes = {}));
|
5971
|
+
var MrvStatsCardsTypes;
|
5972
|
+
(function (MrvStatsCardsTypes) {
|
5973
|
+
MrvStatsCardsTypes["AGG_PROGRAMME_BY_SECTOR"] = "AGG_PROGRAMME_BY_SECTOR";
|
5974
|
+
// MY_AGG_PROGRAMME_BY_SECTOR = "MY_AGG_PROGRAMME_BY_SECTOR",
|
5975
|
+
MrvStatsCardsTypes["AGG_NDC_ACTION_BY_TYPE"] = "AGG_NDC_ACTION_BY_TYPE";
|
5976
|
+
// MY_AGG_NDC_ACTION_BY_TYPE = "MY_AGG_NDC_ACTION_BY_TYPE",
|
5977
|
+
MrvStatsCardsTypes["AGG_NDC_ACTION_BY_SECTOR"] = "AGG_NDC_ACTION_BY_SECTOR";
|
5978
|
+
// MY_AGG_NDC_ACTION_BY_SECTOR = "MY_AGG_NDC_ACTION_BY_SECTOR",
|
5979
|
+
MrvStatsCardsTypes["TOTAL_EMISSIONS"] = "TOTAL_EMISSIONS";
|
5980
|
+
// MY_TOTAL_EMISSIONS = "MY_TOTAL_EMISSIONS",
|
5981
|
+
MrvStatsCardsTypes["PROGRAMME_LOCATION"] = "PROGRAMME_LOCATION";
|
5982
|
+
// MY_PROGRAMME_LOCATION = "MY_PROGRAMME_LOCATION",
|
5983
|
+
MrvStatsCardsTypes["INVESTMENT_LOCATION"] = "INVESTMENT_LOCATION";
|
5984
|
+
// MY_INVESTMENT_LOCATION = "MY_INVESTMENT_LOCATION"
|
5985
|
+
MrvStatsCardsTypes["AGG_INVESTMENT_BY_TYPE"] = "AGG_INVESTMENT_BY_TYPE";
|
5986
|
+
// MY_AGG_INVESTMENT_BY_TYPE = "MY_AGG_INVESTMENT_BY_TYPE",
|
5987
|
+
})(MrvStatsCardsTypes || (MrvStatsCardsTypes = {}));
|
5988
|
+
var SystemNames;
|
5989
|
+
(function (SystemNames) {
|
5990
|
+
SystemNames["CARBON_REGISTRY"] = "CARBON_REGISTRY_SYSTEM";
|
5991
|
+
SystemNames["CARBON_TRANSPARENCY"] = "CARBON_TRANSPARENCY_SYSTEM";
|
5992
|
+
})(SystemNames || (SystemNames = {}));
|
5993
|
+
|
5994
|
+
var ConfigurationSettingsType;
|
5995
|
+
(function (ConfigurationSettingsType) {
|
5996
|
+
ConfigurationSettingsType[ConfigurationSettingsType["isTransferFrozen"] = 0] = "isTransferFrozen";
|
5997
|
+
})(ConfigurationSettingsType || (ConfigurationSettingsType = {}));
|
5998
|
+
|
5999
|
+
var MapTypes;
|
6000
|
+
(function (MapTypes) {
|
6001
|
+
MapTypes["Mapbox"] = "Mapbox";
|
6002
|
+
MapTypes["None"] = "None";
|
6003
|
+
})(MapTypes || (MapTypes = {}));
|
6004
|
+
|
6005
|
+
var dateTimeFormat = 'dd LLLL yyyy @ HH:mm';
|
6006
|
+
var dateFormat = 'dd LLLL yyyy';
|
6007
|
+
var creditUnit = 'ITMO';
|
6008
|
+
|
6009
|
+
var BaseEntity = /** @class */ (function () {
|
6010
|
+
function BaseEntity() {
|
6011
|
+
}
|
6012
|
+
return BaseEntity;
|
6013
|
+
}());
|
6014
|
+
|
6015
|
+
var ProgrammeTransfer = /** @class */ (function () {
|
6016
|
+
function ProgrammeTransfer() {
|
6017
|
+
}
|
6018
|
+
return ProgrammeTransfer;
|
6019
|
+
}());
|
6020
|
+
|
6021
|
+
var User = /** @class */ (function () {
|
6022
|
+
function User() {
|
6023
|
+
}
|
6024
|
+
return User;
|
6025
|
+
}());
|
6026
|
+
|
6027
|
+
var ProgrammeEntity = /** @class */ (function () {
|
6028
|
+
function ProgrammeEntity() {
|
6029
|
+
}
|
6030
|
+
return ProgrammeEntity;
|
6031
|
+
}());
|
6032
|
+
|
6033
|
+
var ProgrammeCertify = /** @class */ (function () {
|
6034
|
+
function ProgrammeCertify() {
|
6035
|
+
}
|
6036
|
+
return ProgrammeCertify;
|
6037
|
+
}());
|
6037
6038
|
|
6038
6039
|
var AddNewCompanyComponent = function (props) {
|
6039
6040
|
var _a;
|
@@ -16769,7 +16770,7 @@ var css_248z$i = ".steps-actions {\n display: flex;\n flex-direction: row-reve
|
|
16769
16770
|
styleInject(css_248z$i);
|
16770
16771
|
|
16771
16772
|
var SupportCreationComponent = function (props) {
|
16772
|
-
var t = props.t,
|
16773
|
+
var t = props.t, useLocation = props.useLocation; props.onNavigateToProgrammeManagementView; props.onNavigateToProgrammeView;
|
16773
16774
|
useLocation().state;
|
16774
16775
|
var _a = useState(); _a[0]; _a[1];
|
16775
16776
|
var formOne = Form.useForm()[0];
|
@@ -16782,6 +16783,7 @@ var SupportCreationComponent = function (props) {
|
|
16782
16783
|
var _f = useState([]), organisationsList = _f[0], setOrganisationList = _f[1];
|
16783
16784
|
var _g = useState([]), instrument = _g[0], setInstrument = _g[1];
|
16784
16785
|
var _h = useState(); _h[0]; var setStepOneData = _h[1];
|
16786
|
+
var userInfoState = useUserContext().userInfoState;
|
16785
16787
|
var instrumentOptions = Object.keys(Instrument).map(function (k, index) { return ({
|
16786
16788
|
label: addSpaces(Object.values(Instrument)[index]),
|
16787
16789
|
value: Object.values(Instrument)[index],
|