diff --git a/frontend/micro-ui/web/micro-ui-internals/example/src/index.js b/frontend/micro-ui/web/micro-ui-internals/example/src/index.js index 74c610052..33aafbbb6 100644 --- a/frontend/micro-ui/web/micro-ui-internals/example/src/index.js +++ b/frontend/micro-ui/web/micro-ui-internals/example/src/index.js @@ -58,16 +58,16 @@ const enabledModules = [ "NDSS", "Bills", "SW", - "BillAmendment" + "BillAmendment", ]; const initTokens = (stateCode) => { const userType = window.sessionStorage.getItem("userType") || process.env.REACT_APP_USER_TYPE || "CITIZEN"; - const token = window.localStorage.getItem("token")|| process.env[`REACT_APP_${userType}_TOKEN`]; - - const citizenInfo = window.localStorage.getItem("Citizen.user-info") - + const token = window.localStorage.getItem("token") || process.env[`REACT_APP_${userType}_TOKEN`]; + + const citizenInfo = window.localStorage.getItem("Citizen.user-info"); + const citizenTenantId = window.localStorage.getItem("Citizen.tenant-id") || stateCode; const employeeInfo = window.localStorage.getItem("Employee.user-info"); @@ -94,33 +94,33 @@ const initDigitUI = () => { PaymentModule, ...paymentConfigs, PaymentLinks, - PTModule, - PTLinks, - ...PTComponents, - MCollectLinks, - MCollectModule, + // PTModule, + // PTLinks, + // ...PTComponents, + // MCollectLinks, + // MCollectModule, HRMSModule, - ReceiptsModule, - BillsModule, + // ReceiptsModule, + // BillsModule, // TLModule, // TLLinks, }); - initFSMComponents(); + // initFSMComponents(); initPGRComponents(); initDSSComponents(); - initMCollectComponents(); + // initMCollectComponents(); initHRMSComponents(); - initTLComponents(); + // initTLComponents(); initReceiptsComponents(); // initReportsComponents(); - initOBPSComponents(); - initEngagementComponents(); - initNOCComponents(); - initWSComponents(); - initCommonPTComponents(); - initBillsComponents(); + // initOBPSComponents(); + // initEngagementComponents(); + // initNOCComponents(); + // initWSComponents(); + // initCommonPTComponents(); + // initBillsComponents(); // initCustomisationComponents(); diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/libraries/src/utils/index.js b/frontend/micro-ui/web/micro-ui-internals/packages/libraries/src/utils/index.js index c78aca0b0..37596590c 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/libraries/src/utils/index.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/libraries/src/utils/index.js @@ -5,7 +5,7 @@ import * as locale from "./locale"; import * as obps from "./obps"; import * as pt from "./pt"; import * as privacy from "./privacy"; -import PDFUtil, { downloadReceipt ,downloadPDFFromLink,downloadBill ,getFileUrl} from "./pdf"; +import PDFUtil, { downloadReceipt, downloadPDFFromLink, downloadBill, getFileUrl } from "./pdf"; import getFileTypeFromFileStoreURL from "./fileType"; const GetParamFromUrl = (key, fallback, search) => { @@ -120,10 +120,10 @@ const didEmployeeHasRole = (role) => { const pgrAccess = () => { const userInfo = Digit.UserService.getUser(); - const userRoles = userInfo?.info?.roles?.map((roleData) => roleData?.code); + const userRoles = userInfo && userInfo?.info?.roles?.length > 0 && userInfo?.info?.roles?.map((roleData) => roleData?.code); const pgrRoles = ["PGR_LME", "PGR-ADMIN", "CSR", "CEMP", "FEMP", "DGRO", "ULB Operator", "GRO", "GO", "RO", "GA"]; - const PGR_ACCESS = userRoles?.filter((role) => pgrRoles.includes(role)); + const PGR_ACCESS = userRoles && userRoles?.length > 0 && userRoles?.filter((role) => pgrRoles.includes(role)); return PGR_ACCESS?.length > 0; }; @@ -153,9 +153,7 @@ const NOCAccess = () => { const userInfo = Digit.UserService.getUser(); const userRoles = userInfo?.info?.roles?.map((roleData) => roleData?.code); - const NOC_ROLES = [ - "FIRE_NOC_APPROVER" - ] + const NOC_ROLES = ["FIRE_NOC_APPROVER"]; const NOC_ACCESS = userRoles?.filter((role) => NOC_ROLES?.includes(role)); @@ -249,7 +247,7 @@ const hrmsAccess = () => { const wsAccess = () => { const userInfo = Digit.UserService.getUser(); const userRoles = userInfo?.info?.roles?.map((roleData) => roleData?.code); - const waterRoles = ["WS_CEMP", "WS_APPROVER", "WS_FIELD_INSPECTOR", "WS_DOC_VERIFIER","WS_CLERK"]; + const waterRoles = ["WS_CEMP", "WS_APPROVER", "WS_FIELD_INSPECTOR", "WS_DOC_VERIFIER", "WS_CLERK"]; const WS_ACCESS = userRoles?.filter((role) => waterRoles?.includes(role)); @@ -259,14 +257,13 @@ const wsAccess = () => { const swAccess = () => { const userInfo = Digit.UserService.getUser(); const userRoles = userInfo?.info?.roles?.map((roleData) => roleData?.code); - const sewerageRoles = ["SW_CEMP", "SW_APPROVER", "SW_FIELD_INSPECTOR", "SW_DOC_VERIFIER","SW_CLERK"]; + const sewerageRoles = ["SW_CEMP", "SW_APPROVER", "SW_FIELD_INSPECTOR", "SW_DOC_VERIFIER", "SW_CLERK"]; const SW_ACCESS = userRoles?.filter((role) => sewerageRoles?.includes(role)); return SW_ACCESS?.length > 0; }; - export default { pdf: PDFUtil, downloadReceipt, @@ -302,5 +299,5 @@ export default { wsAccess, swAccess, - ...privacy + ...privacy, }; diff --git a/frontend/micro-ui/web/src/App.js b/frontend/micro-ui/web/src/App.js index a3ee8b76f..35822133b 100644 --- a/frontend/micro-ui/web/src/App.js +++ b/frontend/micro-ui/web/src/App.js @@ -10,7 +10,11 @@ import { PTLinks, PTComponents, } from "@egovernments/digit-ui-module-pt"; -import { MCollectModule, MCollectLinks, initMCollectComponents } from "@egovernments/digit-ui-module-mcollect"; +import { + MCollectModule, + MCollectLinks, + initMCollectComponents, +} from "@egovernments/digit-ui-module-mcollect"; import { initDSSComponents } from "@egovernments/digit-ui-module-dss"; import { PaymentModule, @@ -28,7 +32,10 @@ import { TLLinks, initTLComponents, } from "@egovernments/digit-ui-module-tl"; -import { initReceiptsComponents, ReceiptsModule } from "@egovernments/digit-ui-module-receipts"; +import { + initReceiptsComponents, + ReceiptsModule, +} from "@egovernments/digit-ui-module-receipts"; import { initOBPSComponents } from "@egovernments/digit-ui-module-obps"; import { initNOCComponents } from "@egovernments/digit-ui-module-noc"; import { initEngagementComponents } from "@egovernments/digit-ui-module-engagement"; @@ -60,36 +67,36 @@ const enabledModules = [ "Reports", "Bills", "SW", - "BillAmendment" + "BillAmendment", ]; window.Digit.ComponentRegistryService.setupRegistry({ ...paymentConfigs, - PTModule, - PTLinks, + // PTModule, + // PTLinks, PaymentModule, PaymentLinks, - ...PTComponents, - MCollectLinks, - MCollectModule, + // ...PTComponents, + // MCollectLinks, + // MCollectModule, HRMSModule, - TLModule, - TLLinks, + // TLModule, + // TLLinks, // ReceiptsModule }); initPGRComponents(); -initFSMComponents(); +// initFSMComponents(); initDSSComponents(); -initMCollectComponents(); -initHRMSComponents(); -initTLComponents(); +// initMCollectComponents(); +// initHRMSComponents(); +// initTLComponents(); // initReceiptsComponents(); -initOBPSComponents(); -initNOCComponents(); -initEngagementComponents(); -initWSComponents(); -initCommonPTComponents(); -initBillsComponents(); +// initOBPSComponents(); +// initNOCComponents(); +// initEngagementComponents(); +// initWSComponents(); +// initCommonPTComponents(); +// initBillsComponents(); // initReportsComponents(); initCustomisationComponents();