From 27ad63d46e4792dae8e616967a8f938c2b422b12 Mon Sep 17 00:00:00 2001 From: Sanjith Ande Date: Fri, 13 Dec 2024 09:39:00 -0500 Subject: [PATCH 1/7] refactor: export components for better accessibility and consistency --- .../src/components/editor/cms-page-frame.tsx | 1 - .../editor/components/ahp-id-form-confirmation.tsx | 8 ++++---- .../src/components/editor/components/ahp-id-form.tsx | 7 +++---- .../editor/components/ahp-payment-request-form.tsx | 7 +++---- .../editor/components/ahp-request-feedback-form.tsx | 7 +++---- .../editor/components/ahp-send-money-form.tsx | 7 +++---- .../src/components/editor/components/breadcrumbs.tsx | 6 +----- .../src/components/editor/components/card.tsx | 12 ++---------- .../src/components/editor/components/container.tsx | 6 +----- .../components/editor/components/country-info.tsx | 2 -- .../components/editor/components/country-info2.tsx | 5 +---- .../src/components/editor/components/footer.tsx | 6 +----- .../src/components/editor/components/grid.tsx | 3 +-- .../components/editor/components/image-component.tsx | 5 +---- .../components/editor/components/menu-component.tsx | 8 ++------ .../editor/components/properties-listing.tsx | 4 +--- .../editor/components/property-details.tsx | 6 +----- .../components/editor/components/text-component.tsx | 6 +----- .../src/components/editor/components/text-thing.tsx | 6 +----- .../service-tickets-detail--draft-form.tsx | 1 + .../admin/components/site-editor-files-list.tsx | 2 -- .../layouts/admin/pages/site-editor-files.tsx | 3 +-- .../layouts/admin/pages/site-editor-page-editor.tsx | 3 +-- .../layouts/admin/pages/site-editor-page-tree.tsx | 3 +-- .../components/layouts/admin/pages/site-editor.tsx | 4 ++-- 25 files changed, 36 insertions(+), 92 deletions(-) diff --git a/ui-community/src/components/editor/cms-page-frame.tsx b/ui-community/src/components/editor/cms-page-frame.tsx index c825e532..4c6ecb1e 100644 --- a/ui-community/src/components/editor/cms-page-frame.tsx +++ b/ui-community/src/components/editor/cms-page-frame.tsx @@ -22,6 +22,5 @@ export const CmsPageFrame: React.FC = (props) => { {loading ?
Loading...
: } - ) } \ No newline at end of file diff --git a/ui-community/src/components/editor/components/ahp-id-form-confirmation.tsx b/ui-community/src/components/editor/components/ahp-id-form-confirmation.tsx index 4a887f71..0924c4c7 100644 --- a/ui-community/src/components/editor/components/ahp-id-form-confirmation.tsx +++ b/ui-community/src/components/editor/components/ahp-id-form-confirmation.tsx @@ -22,7 +22,8 @@ interface AhpIdFormConfirmationProps { } const communityId = '669ff09eae443cf6818a5bed'; -const AhpIdFormConfirmationTop = (props: any) => { + +export const AhpIdFormConfirmationTop = (props: any) => { const { connectors: { connect } } = useNode(); @@ -35,7 +36,8 @@ AhpIdFormConfirmationTop.craft = { incomingNodes.every((incomingNode) => incomingNode.data.type === TextComponent || TextThing) } }; -const AhpIdFormConfirmation: any = ({ fileName, blobPath, response, value, submitted }: AhpIdFormConfirmationProps) => { + +export const AhpIdFormConfirmation: any = ({ fileName, blobPath, response, value, submitted }: AhpIdFormConfirmationProps) => { const { actions: { setProp } } = useNode((state) => ({ @@ -214,5 +216,3 @@ AhpIdFormConfirmation.craft = { padding: 0 } }; - -export { AhpIdFormConfirmation, AhpIdFormConfirmationTop }; diff --git a/ui-community/src/components/editor/components/ahp-id-form.tsx b/ui-community/src/components/editor/components/ahp-id-form.tsx index d57aba22..d1ba7b63 100644 --- a/ui-community/src/components/editor/components/ahp-id-form.tsx +++ b/ui-community/src/components/editor/components/ahp-id-form.tsx @@ -19,7 +19,7 @@ interface AhpIdFormProps { } const communityId = '669ff09eae443cf6818a5bed'; -const AhpIdFormTop = (props: any) => { +export const AhpIdFormTop = (props: any) => { const { connectors: { connect } } = useNode(); @@ -32,7 +32,8 @@ AhpIdFormTop.craft = { incomingNodes.every((incomingNode) => incomingNode.data.type === TextComponent || TextThing) } }; -const AhpIdForm: any = ({ fileName, blobPath }: AhpIdFormProps) => { + +export const AhpIdForm: any = ({ fileName, blobPath }: AhpIdFormProps) => { const { token: { colorBgContainer } } = theme.useToken(); @@ -168,5 +169,3 @@ AhpIdForm.craft = { padding: 0 } }; - -export { AhpIdForm, AhpIdFormTop }; diff --git a/ui-community/src/components/editor/components/ahp-payment-request-form.tsx b/ui-community/src/components/editor/components/ahp-payment-request-form.tsx index ee855789..e658f88e 100644 --- a/ui-community/src/components/editor/components/ahp-payment-request-form.tsx +++ b/ui-community/src/components/editor/components/ahp-payment-request-form.tsx @@ -12,7 +12,7 @@ interface AhpPaymentRequestFormProps { isAdmin: boolean } -const AhpPaymentRequestFormTop = (props: any) => { +export const AhpPaymentRequestFormTop = (props: any) => { const { connectors: { connect } } = useNode(); @@ -25,7 +25,8 @@ AhpPaymentRequestFormTop.craft = { incomingNodes.every((incomingNode) => incomingNode.data.type === TextComponent || TextThing) } }; -const AhpPaymentRequestForm: any = ({ completed, success, amount, reason, isAdmin }: AhpPaymentRequestFormProps) => { + +export const AhpPaymentRequestForm: any = ({ completed, success, amount, reason, isAdmin }: AhpPaymentRequestFormProps) => { const { actions: { setProp } } = useNode((state) => ({ @@ -202,5 +203,3 @@ AhpPaymentRequestForm.craft = { padding: 0 } }; - -export { AhpPaymentRequestForm, AhpPaymentRequestFormTop }; diff --git a/ui-community/src/components/editor/components/ahp-request-feedback-form.tsx b/ui-community/src/components/editor/components/ahp-request-feedback-form.tsx index 55ce2b10..d17128e8 100644 --- a/ui-community/src/components/editor/components/ahp-request-feedback-form.tsx +++ b/ui-community/src/components/editor/components/ahp-request-feedback-form.tsx @@ -13,7 +13,7 @@ interface AhpRequestFeedbackFormProps { isAdmin: boolean; } -const AhpRequestFeedbackFormTop = (props: any) => { +export const AhpRequestFeedbackFormTop = (props: any) => { const { connectors: { connect } } = useNode(); @@ -26,7 +26,8 @@ AhpRequestFeedbackFormTop.craft = { incomingNodes.every((incomingNode) => incomingNode.data.type === TextComponent || TextThing) } }; -const AhpRequestFeedbackForm: any = ({ changesRequested, isAdmin }: AhpRequestFeedbackFormProps) => { + +export const AhpRequestFeedbackForm: any = ({ changesRequested, isAdmin }: AhpRequestFeedbackFormProps) => { const { actions: {} } = useNode((state) => ({ @@ -129,5 +130,3 @@ AhpRequestFeedbackForm.craft = { padding: 0 } }; - -export { AhpRequestFeedbackForm, AhpRequestFeedbackFormTop }; diff --git a/ui-community/src/components/editor/components/ahp-send-money-form.tsx b/ui-community/src/components/editor/components/ahp-send-money-form.tsx index d7fd9d36..bf50c54d 100644 --- a/ui-community/src/components/editor/components/ahp-send-money-form.tsx +++ b/ui-community/src/components/editor/components/ahp-send-money-form.tsx @@ -9,7 +9,7 @@ interface AhpSendMoneyFormProps { isAdmin: boolean; } -const AhpSendMoneyFormTop = (props: any) => { +export const AhpSendMoneyFormTop = (props: any) => { const { connectors: { connect } } = useNode(); @@ -22,7 +22,8 @@ AhpSendMoneyFormTop.craft = { incomingNodes.every((incomingNode) => incomingNode.data.type === TextComponent || TextThing) } }; -const AhpSendMoneyForm: any = ({ amount, reason, isAdmin }: AhpSendMoneyFormProps) => { + +export const AhpSendMoneyForm: any = ({ amount, reason, isAdmin }: AhpSendMoneyFormProps) => { const { actions: {} } = useNode((state) => ({ @@ -84,5 +85,3 @@ AhpSendMoneyForm.craft = { padding: 0 } }; - -export { AhpSendMoneyForm, AhpSendMoneyFormTop }; diff --git a/ui-community/src/components/editor/components/breadcrumbs.tsx b/ui-community/src/components/editor/components/breadcrumbs.tsx index 3f461943..a91c551b 100644 --- a/ui-community/src/components/editor/components/breadcrumbs.tsx +++ b/ui-community/src/components/editor/components/breadcrumbs.tsx @@ -8,7 +8,7 @@ interface BreadcrumbsProps { homePageTitle?: string; } -const Breadcrumbs = ({ separator, homePageTitle, ...props } : BreadcrumbsProps) => { +export const Breadcrumbs = ({ separator, homePageTitle, ...props } : BreadcrumbsProps) => { const [pageLayouts] = usePageLayouts(); if(!arePageLayoutsLoaded(pageLayouts)){ @@ -90,7 +90,3 @@ Breadcrumbs.craft = { settings: BreadcrumbsSettings } } - -export { - Breadcrumbs -}; \ No newline at end of file diff --git a/ui-community/src/components/editor/components/card.tsx b/ui-community/src/components/editor/components/card.tsx index 7c6ee79c..dfa5bc2a 100644 --- a/ui-community/src/components/editor/components/card.tsx +++ b/ui-community/src/components/editor/components/card.tsx @@ -4,9 +4,7 @@ import { Container } from "./container"; import { TextComponent } from "./text-component"; import { TextThing } from "./text-thing"; - - -const CardTop = (props: any) => { +export const CardTop = (props: any) => { const { connectors: {connect} } = useNode(); return ( @@ -24,9 +22,7 @@ CardTop.craft = { } -let Card: any; - -Card = () => { +export const Card = () => { const { token: { colorTextBase, colorBgContainer } }=theme.useToken(); @@ -85,7 +81,3 @@ Card.craft = { } } -export { - Card, - CardTop -}; diff --git a/ui-community/src/components/editor/components/container.tsx b/ui-community/src/components/editor/components/container.tsx index 76246b73..adcbe1d1 100644 --- a/ui-community/src/components/editor/components/container.tsx +++ b/ui-community/src/components/editor/components/container.tsx @@ -16,7 +16,7 @@ interface ContainerProp { export type ContainerPropTypes = PropTypes.InferProps & ContainerProp; -const Container: any = ({ children }: ContainerProp) => { +export const Container: any = ({ children }: ContainerProp) => { const { connectors: { connect, drag } } = useNode((state) =>( { selected: state.events.selected, @@ -68,7 +68,3 @@ Container.craft = { settings: ContainerSettings, } } - -export { - Container -} \ No newline at end of file diff --git a/ui-community/src/components/editor/components/country-info.tsx b/ui-community/src/components/editor/components/country-info.tsx index 54482c0c..81e9475c 100644 --- a/ui-community/src/components/editor/components/country-info.tsx +++ b/ui-community/src/components/editor/components/country-info.tsx @@ -3,7 +3,6 @@ import { Button, Input } from 'antd'; import { gql, useLazyQuery } from '@apollo/client'; import { useState } from "react"; - const GET_COUNTRY_DETAILS = gql` query CountryDetails($country: ID!) { country(code: $country) { @@ -20,7 +19,6 @@ const GET_COUNTRY_DETAILS = gql` } `; - export const CountryInfo = () => { const { connectors: { connect, drag } } = useNode(); const [country, setCountry] = useState(''); diff --git a/ui-community/src/components/editor/components/country-info2.tsx b/ui-community/src/components/editor/components/country-info2.tsx index fca35e92..d7edf05d 100644 --- a/ui-community/src/components/editor/components/country-info2.tsx +++ b/ui-community/src/components/editor/components/country-info2.tsx @@ -23,7 +23,7 @@ const GET_COUNTRY_DETAILS = gql` } `; -const CountryInfo2: any = ({country, ...props} : CountryInfo2Prop ) => { +export const CountryInfo2: any = ({country, ...props} : CountryInfo2Prop ) => { const { token: { colorTextBase, colorBgContainer } }=theme.useToken(); @@ -140,7 +140,4 @@ CountryInfo2.craft = { } -export { - CountryInfo2 -}; diff --git a/ui-community/src/components/editor/components/footer.tsx b/ui-community/src/components/editor/components/footer.tsx index c1e86ff2..8ab305d5 100644 --- a/ui-community/src/components/editor/components/footer.tsx +++ b/ui-community/src/components/editor/components/footer.tsx @@ -14,7 +14,7 @@ interface FooterProp { } -const Footer: any = ({ socialLinks, legalLinks, copyright, ...props } : FooterProp) => { +export const Footer: any = ({ socialLinks, legalLinks, copyright, ...props } : FooterProp) => { const { token: { colorTextBase } }=theme.useToken(); @@ -196,7 +196,3 @@ Footer.craft = { settings: FooterSettings } } - -export { - Footer -} \ No newline at end of file diff --git a/ui-community/src/components/editor/components/grid.tsx b/ui-community/src/components/editor/components/grid.tsx index 723568cb..12f6aa45 100644 --- a/ui-community/src/components/editor/components/grid.tsx +++ b/ui-community/src/components/editor/components/grid.tsx @@ -8,7 +8,7 @@ interface GridProp { bgColor: string; } -const Grid: any = ({ numOfCols, bgColor, ...props }: GridProp) => { +export const Grid: any = ({ numOfCols, bgColor, ...props }: GridProp) => { const { connectors: { connect, drag } } = useNode((state) => ({ @@ -100,4 +100,3 @@ Grid.craft = { }, }; -export { Grid }; diff --git a/ui-community/src/components/editor/components/image-component.tsx b/ui-community/src/components/editor/components/image-component.tsx index 1bb6ab70..b1821e20 100644 --- a/ui-community/src/components/editor/components/image-component.tsx +++ b/ui-community/src/components/editor/components/image-component.tsx @@ -23,7 +23,7 @@ interface ImageProp { width: number; } -const ImageComponent: any = ({ src, width }: ImageProp) => { +export const ImageComponent: any = ({ src, width }: ImageProp) => { const { connectors: {connect, drag} } = useNode(); return ( @@ -130,6 +130,3 @@ ImageComponent.craft = { } } -export { - ImageComponent -}; diff --git a/ui-community/src/components/editor/components/menu-component.tsx b/ui-community/src/components/editor/components/menu-component.tsx index a2af2790..4c170a82 100644 --- a/ui-community/src/components/editor/components/menu-component.tsx +++ b/ui-community/src/components/editor/components/menu-component.tsx @@ -10,9 +10,9 @@ interface TextProp { theme: string; } -let MenuComponent:any; +// let MenuComponent:any; -MenuComponent = ({ theme, ...props } : TextProp) => { +export const MenuComponent = ({ theme, ...props } : TextProp) => { const { token: { colorBgContainer } }=antdTheme.useToken(); @@ -108,7 +108,3 @@ MenuComponent.craft = { } -export { - MenuComponent -}; - diff --git a/ui-community/src/components/editor/components/properties-listing.tsx b/ui-community/src/components/editor/components/properties-listing.tsx index dda79771..7408c0a4 100644 --- a/ui-community/src/components/editor/components/properties-listing.tsx +++ b/ui-community/src/components/editor/components/properties-listing.tsx @@ -29,7 +29,7 @@ const GET_PROPERTIES_BY_COMMUNITY = gql` `; -const PropertiesListing: any = () => { +export const PropertiesListing: any = () => { const { token: { colorBgContainer } }=theme.useToken(); @@ -120,5 +120,3 @@ PropertiesListing.craft = { isDeletable: false } }; - -export { PropertiesListing }; diff --git a/ui-community/src/components/editor/components/property-details.tsx b/ui-community/src/components/editor/components/property-details.tsx index 31ce85c2..f13e9c2c 100644 --- a/ui-community/src/components/editor/components/property-details.tsx +++ b/ui-community/src/components/editor/components/property-details.tsx @@ -7,7 +7,7 @@ import { CommunityPropertyDetail } from '../../layouts/members/components/commun import { mockPropertyData } from './property-details.mock-data'; -const PropertyDetails: any = () => { +export const PropertyDetails: any = () => { const params = useParams(); const propertyId = params['*']?.slice(params['*'].lastIndexOf('/') + 1); @@ -65,7 +65,3 @@ PropertyDetails.craft = { isDeletable: false, } } - -export { - PropertyDetails -}; diff --git a/ui-community/src/components/editor/components/text-component.tsx b/ui-community/src/components/editor/components/text-component.tsx index 07840e4f..4ef56909 100644 --- a/ui-community/src/components/editor/components/text-component.tsx +++ b/ui-community/src/components/editor/components/text-component.tsx @@ -10,7 +10,7 @@ interface TextComponentProp { color?: string; } -const TextComponent: any = ({text, fontSize, fontWeight }:TextComponentProp) => { +export const TextComponent: any = ({text, fontSize, fontWeight }:TextComponentProp) => { const { connectors: {connect, drag} } = useNode(); return ( @@ -69,7 +69,3 @@ TextComponent.craft = { settings: TextComponentSettings } } - -export { - TextComponent -}; diff --git a/ui-community/src/components/editor/components/text-thing.tsx b/ui-community/src/components/editor/components/text-thing.tsx index c078cb31..999dba1b 100644 --- a/ui-community/src/components/editor/components/text-thing.tsx +++ b/ui-community/src/components/editor/components/text-thing.tsx @@ -9,7 +9,7 @@ interface TextProp { } -const TextThing = ({ title,body , fontSize, ...props } : TextProp) => { +export const TextThing = ({ title,body , fontSize, ...props } : TextProp) => { const { connectors: {connect,drag}, actions } = useNode((state) =>( { selected: state.events.selected, @@ -93,7 +93,3 @@ TextThing.craft = { } } - -export { - TextThing -}; diff --git a/ui-community/src/components/layouts/admin/components/service-tickets-detail--draft-form.tsx b/ui-community/src/components/layouts/admin/components/service-tickets-detail--draft-form.tsx index c930a857..537b5bed 100644 --- a/ui-community/src/components/layouts/admin/components/service-tickets-detail--draft-form.tsx +++ b/ui-community/src/components/layouts/admin/components/service-tickets-detail--draft-form.tsx @@ -11,6 +11,7 @@ export interface ServiceTicketsDetailDraftFormProps { }; onUpdate: (serviceTicket: ServiceTicketUpdateInput) => void; } + export const ServiceTicketsDetailDraftForm : React.FC = (props) => { const [editDraftForm] = Form.useForm(); diff --git a/ui-community/src/components/layouts/admin/components/site-editor-files-list.tsx b/ui-community/src/components/layouts/admin/components/site-editor-files-list.tsx index 7008300e..7f69c490 100644 --- a/ui-community/src/components/layouts/admin/components/site-editor-files-list.tsx +++ b/ui-community/src/components/layouts/admin/components/site-editor-files-list.tsx @@ -222,5 +222,3 @@ SiteEditorFilesList.defaultProps = { initialPageSize: 10, initialCurrentPage: 1 }; - -export default SiteEditorFilesList; diff --git a/ui-community/src/components/layouts/admin/pages/site-editor-files.tsx b/ui-community/src/components/layouts/admin/pages/site-editor-files.tsx index d3910943..a28e6db6 100644 --- a/ui-community/src/components/layouts/admin/pages/site-editor-files.tsx +++ b/ui-community/src/components/layouts/admin/pages/site-editor-files.tsx @@ -8,7 +8,7 @@ import { Helmet } from 'react-helmet-async'; const { Title } = Typography; -const SiteEditorFiles: React.FC = (_props) => { +export const SiteEditorFiles: React.FC = (_props) => { const params = useParams(); const [uploadSuccess, setUploadSuccess] = useState(false); @@ -44,4 +44,3 @@ const SiteEditorFiles: React.FC = (_props) => { } -export { SiteEditorFiles }; diff --git a/ui-community/src/components/layouts/admin/pages/site-editor-page-editor.tsx b/ui-community/src/components/layouts/admin/pages/site-editor-page-editor.tsx index 1f73d16c..117975fe 100644 --- a/ui-community/src/components/layouts/admin/pages/site-editor-page-editor.tsx +++ b/ui-community/src/components/layouts/admin/pages/site-editor-page-editor.tsx @@ -16,7 +16,7 @@ import { Helmet } from 'react-helmet-async'; const { Title } = Typography; -const SiteEditorPageEditor: React.FC = () => { +export const SiteEditorPageEditor: React.FC = () => { const { token: { colorTextBase @@ -126,4 +126,3 @@ const SiteEditorPageEditor: React.FC = () => { ); }; -export default SiteEditorPageEditor; diff --git a/ui-community/src/components/layouts/admin/pages/site-editor-page-tree.tsx b/ui-community/src/components/layouts/admin/pages/site-editor-page-tree.tsx index 3ee18240..32eb5ed7 100644 --- a/ui-community/src/components/layouts/admin/pages/site-editor-page-tree.tsx +++ b/ui-community/src/components/layouts/admin/pages/site-editor-page-tree.tsx @@ -28,7 +28,7 @@ const buildTree = (flatPageLayouts: any) => { }); }; -const SiteEditorPageTree: React.FC = () => { +export const SiteEditorPageTree: React.FC = () => { const [pageLayouts, setPageLayouts] = usePageLayouts(); const [treeData, setTreeData] = useState>([]); const [selectedNodePath, setSelectedNodePath] = useState(null); @@ -288,4 +288,3 @@ const SiteEditorPageTree: React.FC = () => { ); }; -export { SiteEditorPageTree as PageTree }; diff --git a/ui-community/src/components/layouts/admin/pages/site-editor.tsx b/ui-community/src/components/layouts/admin/pages/site-editor.tsx index 445d91ec..274a3272 100644 --- a/ui-community/src/components/layouts/admin/pages/site-editor.tsx +++ b/ui-community/src/components/layouts/admin/pages/site-editor.tsx @@ -5,8 +5,8 @@ import { Route, RouteObject, Routes, matchRoutes, useLocation, useNavigate, useP import { SiteEditorContainer } from "../components/site-editor.container"; import { SubPageLayout } from "../sub-page-layout"; import { SiteEditorFiles } from './site-editor-files'; -import SiteEditorPageEditor from "./site-editor-page-editor"; -import { PageTree } from "./site-editor-page-tree"; +import { SiteEditorPageEditor } from "./site-editor-page-editor"; +import { SiteEditorPageTree as PageTree } from "./site-editor-page-tree"; import { Helmet } from 'react-helmet-async'; import { useMemo } from 'react'; From 296fa2929c92e55f367dc4ab14beacaeb6a708da Mon Sep 17 00:00:00 2001 From: Sanjith Ande Date: Fri, 20 Dec 2024 11:40:48 -0500 Subject: [PATCH 2/7] refactor: remove default exports from multiple components for consistency --- ownercommunity.code-workspace | 4 ++-- ui-community/public/meta.json | 2 +- ui-community/src/App.tsx | 2 +- .../src/components/editor/components/card.tsx | 15 +++++++++++++-- .../editor/components/menu-component.tsx | 4 ++-- .../src/components/editor/page/toolbox.tsx | 2 +- .../components/layouts/accounts/accounts.test.tsx | 2 +- .../components/breadcrumbs.tsx | 3 +-- .../chat/admin/embedded/payment-request-form.tsx | 4 +--- .../chat/admin/embedded/request-feedback-form.tsx | 4 +--- .../chat/admin/embedded/send-money-form.tsx | 6 ++---- .../active-case/chat/chat-message.tsx | 6 +++--- .../ahp-proof-of-concepts/section-layout.tsx | 2 +- .../add-payment-method-modal.container.tsx | 6 ++---- .../components/add-payment-method-modal.tsx | 6 ++---- .../components/edit-payment-method-modal.tsx | 2 +- .../components/payment-instruments-list.tsx | 2 +- .../layouts/members/components/payment-modal.tsx | 4 ++-- .../components/properties-list-search-filters.tsx | 4 +--- .../members/components/transactions.container.tsx | 6 ++---- .../layouts/members/components/transactions.tsx | 3 +-- .../components/violation-tickets-detail.tsx | 2 +- .../components/wallet-customer-info.container.tsx | 6 +++--- .../members/components/wallet-customer-info.tsx | 3 +-- .../members/components/wallet.container.tsx | 2 +- .../layouts/members/components/wallet.tsx | 9 +++------ .../src/components/layouts/members/index.tsx | 2 +- .../components/layouts/members/pages/payment.tsx | 6 ++---- .../members/pages/violation-ticket-detail.tsx | 2 +- .../src/components/layouts/root/cms-page.tsx | 6 ++---- .../components/layouts/root/section-layout.tsx | 2 +- .../shared/components/search-drawer.container.tsx | 2 +- .../src/components/shared/azure-monitor/index.tsx | 5 ++--- .../feature-flag-context.tsx | 4 +--- .../feature-flag-provider.tsx | 10 ++++------ .../shared/feature-flag-react-lite/index.cjs.tsx | 4 ++-- .../shared/feature-flag-react-lite/index.tsx | 4 ++-- .../feature-flag-react-lite/use-feature-flag.tsx | 5 ++--- .../maintenance-message/impending-message.tsx | 3 +-- .../shared/maintenance-message/index.tsx | 5 ++--- .../maintenance-message-context.tsx | 3 +-- .../maintenance-message-provider.tsx | 6 ++---- .../maintenance-message.test.tsx | 2 +- .../maintenance-message/maintenance-message.tsx | 4 +--- .../use-maintenance-message.tsx | 5 ++--- .../src/components/shared/require-auth.tsx | 3 +-- .../components/testing/PdfTesting.container.tsx | 3 +-- .../src/components/testing/TestPdfView.tsx | 2 -- .../testing/eif/PdfApplicantCertification.tsx | 1 - .../src/components/testing/eif/PdfEIFSection.tsx | 7 +++---- .../components/testing/eif/PdfEIFSectionFinal.tsx | 6 +++--- .../components/testing/eif/PdfEifInformation.tsx | 1 - .../src/components/testing/eif/PdfFooterV2.tsx | 1 - .../src/components/testing/eif/PdfHeaderV2.tsx | 1 - .../eif/PdfIdentificationCertification.tsx | 1 - .../testing/epic/PdfCandidateDetails.tsx | 1 - .../testing/epic/PdfCredentialDetails.tsx | 1 - .../components/testing/epic/PdfDisclaimers.tsx | 1 - .../src/components/testing/epic/PdfHeader.tsx | 1 - .../testing/epic/PdfSignatureFooter.tsx | 1 - .../components/testing/epic/PdfTitleSection.tsx | 1 - .../pdf-footers-and-headers/PdfBarCodeFooter.tsx | 1 - .../pdf-footers-and-headers/PdfBarCodeHeader.tsx | 1 - .../testing/pdf-pages/PdfEIFBlankPage.tsx | 7 +++---- .../testing/pdf-pages/PdfEIFBlankPagev2.tsx | 7 +++---- .../testing/pdf-pages/PdfEIFFinalPage.tsx | 5 ++--- .../testing/pdf-pages/PdfEpicReportInfoPage.tsx | 9 ++++----- .../pdf-pages/PdfEpicReportSignaturePage.tsx | 13 ++++++------- .../pdf-pages/PdfVerificationBlankPage.tsx | 7 +++---- .../pdf-pages/PdfVerificationSignaturePage.tsx | 13 ++++++------- .../testing/pdf-signature/PdfSignatureArea.tsx | 2 -- .../pdf-signature/PdfSignatureInformation.tsx | 1 - .../pdf-signature/PdfSignatureInstructions.tsx | 1 - .../testing/pdf-signature/PdfSignatureReason.tsx | 2 -- .../verification/PdfVerificationFooter.tsx | 1 - .../verification/PdfVerificationInformation.tsx | 1 - .../verification/PdfVerificationSection.tsx | 7 +++---- .../PdfVerificationSignatureFooter.tsx | 1 - .../PdfVerificationSignatureInformation.tsx | 1 - ui-community/src/config/feature-flag-config.tsx | 3 +-- ui-community/src/contexts/ThemeContext.tsx | 6 +++--- .../src/contexts/components/ModalPopUp.tsx | 5 ++--- ui-community/src/customThemes/index.tsx | 6 ++---- .../src/hooks/useAddPaymentMethodModal.tsx | 4 +--- .../src/hooks/useEditPaymentMethodModal.tsx | 3 +-- ui-community/src/hooks/usePayModal.tsx | 4 +--- ui-community/src/main.tsx | 2 +- 87 files changed, 132 insertions(+), 204 deletions(-) diff --git a/ownercommunity.code-workspace b/ownercommunity.code-workspace index 3d500f4c..cd106a72 100644 --- a/ownercommunity.code-workspace +++ b/ownercommunity.code-workspace @@ -24,10 +24,10 @@ ], "settings": { "debug.internalConsoleOptions": "neverOpen", - "github.copilot.chat.experimental.codeGeneration.instructions": [ + "github.copilot.chat.codeGeneration.instructions": [ { "file": "rules.md" - }, + } ] } } \ No newline at end of file diff --git a/ui-community/public/meta.json b/ui-community/public/meta.json index 2b5b7136..9f411164 100644 --- a/ui-community/public/meta.json +++ b/ui-community/public/meta.json @@ -1,3 +1,3 @@ { - "version": "0.1.13" + "version": "0.1.5" } \ No newline at end of file diff --git a/ui-community/src/App.tsx b/ui-community/src/App.tsx index 90e24ca2..24360e88 100644 --- a/ui-community/src/App.tsx +++ b/ui-community/src/App.tsx @@ -7,7 +7,7 @@ import { Members } from './components/layouts/members'; import { Root } from './components/layouts/root'; import { Staff } from './components/layouts/staff'; import { AuthLanding } from './components/shared/auth-landing'; -import RequireAuth from './components/shared/require-auth'; +import { RequireAuth } from './components/shared/require-auth'; import { AHPProofOfConcepts, AHPRootRouteLayer } from './components/layouts/ahp-proof-of-concepts'; import { AuthProvider } from 'react-oidc-context'; import { uiConfig, staffConfig } from './config/odic-config'; diff --git a/ui-community/src/components/editor/components/card.tsx b/ui-community/src/components/editor/components/card.tsx index dfa5bc2a..7e081c33 100644 --- a/ui-community/src/components/editor/components/card.tsx +++ b/ui-community/src/components/editor/components/card.tsx @@ -1,10 +1,19 @@ import { Element, useNode } from "@craftjs/core"; +import { FC } from "react"; import { Form, Input, theme } from "antd"; import { Container } from "./container"; import { TextComponent } from "./text-component"; import { TextThing } from "./text-thing"; -export const CardTop = (props: any) => { +interface CardProps { + +} + +interface CardTopProps { + children: +} + +export const CardTop = (props: CardTopProps ) => { const { connectors: {connect} } = useNode(); return ( @@ -22,7 +31,7 @@ CardTop.craft = { } -export const Card = () => { +export const Card : FC = (props) => { const { token: { colorTextBase, colorBgContainer } }=theme.useToken(); @@ -81,3 +90,5 @@ Card.craft = { } } + + diff --git a/ui-community/src/components/editor/components/menu-component.tsx b/ui-community/src/components/editor/components/menu-component.tsx index 4c170a82..8a2d5ead 100644 --- a/ui-community/src/components/editor/components/menu-component.tsx +++ b/ui-community/src/components/editor/components/menu-component.tsx @@ -6,13 +6,13 @@ import { arePageLayoutsLoaded, usePageLayouts } from "../page-layout"; const { SubMenu } = Menu; -interface TextProp { +interface MenuComponentProp { theme: string; } // let MenuComponent:any; -export const MenuComponent = ({ theme, ...props } : TextProp) => { +export const MenuComponent = ({ theme, ...props } : MenuComponentProp) => { const { token: { colorBgContainer } }=antdTheme.useToken(); diff --git a/ui-community/src/components/editor/page/toolbox.tsx b/ui-community/src/components/editor/page/toolbox.tsx index 785a83cd..695733b3 100644 --- a/ui-community/src/components/editor/page/toolbox.tsx +++ b/ui-community/src/components/editor/page/toolbox.tsx @@ -78,7 +78,7 @@ export const Toolbox: React.FC = () => { }, { name: 'Card', - component: + component: } ] } diff --git a/ui-community/src/components/layouts/accounts/accounts.test.tsx b/ui-community/src/components/layouts/accounts/accounts.test.tsx index 308883eb..d268df9d 100644 --- a/ui-community/src/components/layouts/accounts/accounts.test.tsx +++ b/ui-community/src/components/layouts/accounts/accounts.test.tsx @@ -8,7 +8,7 @@ import { Accounts } from '.'; import App from '../../../App'; import { uiConfig } from '../../../config/odic-config'; import { Community } from '../../../generated'; -import RequireAuth from '../../shared/require-auth'; +import { RequireAuth } from '../../shared/require-auth'; import { Members } from '../members'; // to be tested scenarios: diff --git a/ui-community/src/components/layouts/ahp-proof-of-concepts/components/breadcrumbs.tsx b/ui-community/src/components/layouts/ahp-proof-of-concepts/components/breadcrumbs.tsx index 6b6e5bf7..071421bb 100644 --- a/ui-community/src/components/layouts/ahp-proof-of-concepts/components/breadcrumbs.tsx +++ b/ui-community/src/components/layouts/ahp-proof-of-concepts/components/breadcrumbs.tsx @@ -7,7 +7,7 @@ import { AHPObjectRouteLayer, AHPRootRouteLayer } from '..'; import { AHPObjectStatusRouteLayer } from '../pages/request-list-page'; import { AHPActiveCaseDetailsLayer } from '../pages/request-list-page/case-details-page/active-case-details-page'; -const Breadcrumbs: React.FC = () => { +export const Breadcrumbs: React.FC = () => { const location = useLocation(); const pathSnippets = location.pathname.split('/').filter((i) => i); @@ -58,4 +58,3 @@ const Breadcrumbs: React.FC = () => { return {breadcrumbItems}; }; -export default Breadcrumbs; diff --git a/ui-community/src/components/layouts/ahp-proof-of-concepts/pages/request-list-page/case-details-page/active-case-details-page/active-case/chat/admin/embedded/payment-request-form.tsx b/ui-community/src/components/layouts/ahp-proof-of-concepts/pages/request-list-page/case-details-page/active-case-details-page/active-case/chat/admin/embedded/payment-request-form.tsx index 91eb4669..98af131b 100644 --- a/ui-community/src/components/layouts/ahp-proof-of-concepts/pages/request-list-page/case-details-page/active-case-details-page/active-case/chat/admin/embedded/payment-request-form.tsx +++ b/ui-community/src/components/layouts/ahp-proof-of-concepts/pages/request-list-page/case-details-page/active-case-details-page/active-case/chat/admin/embedded/payment-request-form.tsx @@ -23,7 +23,7 @@ interface PaymentRequestFormProps { success: boolean; } -const PaymentRequestForm: React.FC = (props) => { +export const PaymentRequestForm: React.FC = (props) => { const params = useParams(); const isServiceTicket = window.location.href.indexOf('ServiceTicketType') > -1; const [completed, setCompleted] = useState(props.completed); @@ -248,5 +248,3 @@ const PaymentRequestForm: React.FC = (props) => { ); }; - -export default PaymentRequestForm; diff --git a/ui-community/src/components/layouts/ahp-proof-of-concepts/pages/request-list-page/case-details-page/active-case-details-page/active-case/chat/admin/embedded/request-feedback-form.tsx b/ui-community/src/components/layouts/ahp-proof-of-concepts/pages/request-list-page/case-details-page/active-case-details-page/active-case/chat/admin/embedded/request-feedback-form.tsx index 3bc301ea..1f09753a 100644 --- a/ui-community/src/components/layouts/ahp-proof-of-concepts/pages/request-list-page/case-details-page/active-case-details-page/active-case/chat/admin/embedded/request-feedback-form.tsx +++ b/ui-community/src/components/layouts/ahp-proof-of-concepts/pages/request-list-page/case-details-page/active-case-details-page/active-case/chat/admin/embedded/request-feedback-form.tsx @@ -9,7 +9,7 @@ interface RequestFeedbackFormProps { isAdmin: boolean; } -const RequestFeedbackForm: React.FC = (props) => { +export const RequestFeedbackForm: React.FC = (props) => { const [changesRequested] = useState( props.changesRequested || { updateAssignment: false, @@ -89,5 +89,3 @@ const RequestFeedbackForm: React.FC = (props) => { ); }; - -export default RequestFeedbackForm; diff --git a/ui-community/src/components/layouts/ahp-proof-of-concepts/pages/request-list-page/case-details-page/active-case-details-page/active-case/chat/admin/embedded/send-money-form.tsx b/ui-community/src/components/layouts/ahp-proof-of-concepts/pages/request-list-page/case-details-page/active-case-details-page/active-case/chat/admin/embedded/send-money-form.tsx index caf0014f..94ab8bb4 100644 --- a/ui-community/src/components/layouts/ahp-proof-of-concepts/pages/request-list-page/case-details-page/active-case-details-page/active-case/chat/admin/embedded/send-money-form.tsx +++ b/ui-community/src/components/layouts/ahp-proof-of-concepts/pages/request-list-page/case-details-page/active-case-details-page/active-case/chat/admin/embedded/send-money-form.tsx @@ -7,7 +7,7 @@ interface SendMoneyFormProps { isAdmin: boolean; } -const SendMoneyForm: React.FC = (props) => { +export const SendMoneyForm: React.FC = (props) => { const commonStyles = { padding: '10px', color: 'black', @@ -31,6 +31,4 @@ const SendMoneyForm: React.FC = (props) => { ); -}; - -export default SendMoneyForm; \ No newline at end of file +}; \ No newline at end of file diff --git a/ui-community/src/components/layouts/ahp-proof-of-concepts/pages/request-list-page/case-details-page/active-case-details-page/active-case/chat/chat-message.tsx b/ui-community/src/components/layouts/ahp-proof-of-concepts/pages/request-list-page/case-details-page/active-case-details-page/active-case/chat/chat-message.tsx index 4a3a96d9..85da26ff 100644 --- a/ui-community/src/components/layouts/ahp-proof-of-concepts/pages/request-list-page/case-details-page/active-case-details-page/active-case/chat/chat-message.tsx +++ b/ui-community/src/components/layouts/ahp-proof-of-concepts/pages/request-list-page/case-details-page/active-case-details-page/active-case/chat/chat-message.tsx @@ -1,9 +1,9 @@ import { Avatar } from 'antd'; import { FC } from 'react'; import dayjs from 'dayjs'; -import RequestFeedbackForm from './admin/embedded/request-feedback-form'; -import PaymentRequestForm from './admin/embedded/payment-request-form'; -import SendMoneyForm from './admin/embedded/send-money-form'; +import { RequestFeedbackForm } from './admin/embedded/request-feedback-form'; +import { PaymentRequestForm } from './admin/embedded/payment-request-form'; +import { SendMoneyForm } from './admin/embedded/send-money-form'; interface ChatMessageProps { id: string; diff --git a/ui-community/src/components/layouts/ahp-proof-of-concepts/section-layout.tsx b/ui-community/src/components/layouts/ahp-proof-of-concepts/section-layout.tsx index 4662e003..9e936cac 100644 --- a/ui-community/src/components/layouts/ahp-proof-of-concepts/section-layout.tsx +++ b/ui-community/src/components/layouts/ahp-proof-of-concepts/section-layout.tsx @@ -2,7 +2,7 @@ import { Button, Layout, Space } from 'antd'; import { FC } from 'react'; import { Outlet, useNavigate } from 'react-router-dom'; import { MenuComponent, PageLayoutProps } from '../shared/components/menu-component'; -import Breadcrumbs from './components/breadcrumbs'; +import { Breadcrumbs } from './components/breadcrumbs'; const { Header, Content, Sider } = Layout; interface AHPPOCSectionLayoutProps { diff --git a/ui-community/src/components/layouts/members/components/add-payment-method-modal.container.tsx b/ui-community/src/components/layouts/members/components/add-payment-method-modal.container.tsx index fd3b9b44..5785191f 100644 --- a/ui-community/src/components/layouts/members/components/add-payment-method-modal.container.tsx +++ b/ui-community/src/components/layouts/members/components/add-payment-method-modal.container.tsx @@ -1,5 +1,5 @@ import { useMutation, useQuery } from '@apollo/client'; -import AddPaymentMethodModal from './add-payment-method-modal'; +import { AddPaymentMethodModal } from './add-payment-method-modal'; import { AddPaymentInstrumentInput, MemberPaymentInstrumentsDocument, @@ -15,7 +15,7 @@ export interface TokenOptions { export type Callback = (err: any, token: string) => Promise; -const AddPaymentMethodModalContainer = () => { +export const AddPaymentMethodModalContainer = () => { const { data: cybersource } = useQuery(SharedPaymentContainercybersourcePublicKeyIdDocument); const { @@ -55,5 +55,3 @@ const AddPaymentMethodModalContainer = () => { /> ); }; - -export default AddPaymentMethodModalContainer; diff --git a/ui-community/src/components/layouts/members/components/add-payment-method-modal.tsx b/ui-community/src/components/layouts/members/components/add-payment-method-modal.tsx index 7318d69d..416391d8 100644 --- a/ui-community/src/components/layouts/members/components/add-payment-method-modal.tsx +++ b/ui-community/src/components/layouts/members/components/add-payment-method-modal.tsx @@ -4,7 +4,7 @@ import { Button, Card, Checkbox, DatePicker, Form, Input, Modal, Select, message import { Country, State, City } from 'country-state-city'; -import useAddPaymentMethodModal from '../../../../hooks/useAddPaymentMethodModal'; +import { useAddPaymentMethodModal } from '../../../../hooks/useAddPaymentMethodModal'; import dayjs from 'dayjs'; import { AddPaymentInstrumentInput, @@ -51,7 +51,7 @@ interface AddPaymentMethodProps { ) => Promise | undefined>; } -const AddPaymentMethodModal: React.FC = ({ +export const AddPaymentMethodModal: React.FC = ({ memberHasPaymentMethods, cybersource, onAddPaymentMethod @@ -536,5 +536,3 @@ const AddPaymentMethodModal: React.FC = ({ ); }; - -export default AddPaymentMethodModal; diff --git a/ui-community/src/components/layouts/members/components/edit-payment-method-modal.tsx b/ui-community/src/components/layouts/members/components/edit-payment-method-modal.tsx index b73710f8..4ed76e94 100644 --- a/ui-community/src/components/layouts/members/components/edit-payment-method-modal.tsx +++ b/ui-community/src/components/layouts/members/components/edit-payment-method-modal.tsx @@ -8,7 +8,7 @@ import { City, Country, State } from 'country-state-city'; import dayjs from 'dayjs'; -import useEditPaymentMethodModal from '../../../../hooks/useEditPaymentMethodModal'; +import { useEditPaymentMethodModal } from '../../../../hooks/useEditPaymentMethodModal'; interface EditPaymentMethodModalProps { onUpdate: ( diff --git a/ui-community/src/components/layouts/members/components/payment-instruments-list.tsx b/ui-community/src/components/layouts/members/components/payment-instruments-list.tsx index 2cf835f1..cacbf84a 100644 --- a/ui-community/src/components/layouts/members/components/payment-instruments-list.tsx +++ b/ui-community/src/components/layouts/members/components/payment-instruments-list.tsx @@ -4,7 +4,7 @@ import { DeleteOutlined, EditOutlined } from '@ant-design/icons'; import { PaymentInstrument } from '../../../../generated'; import { useState } from 'react'; import dayjs from 'dayjs'; -import useEditPaymentMethodModal from '../../../../hooks/useEditPaymentMethodModal'; +import { useEditPaymentMethodModal } from '../../../../hooks/useEditPaymentMethodModal'; const getCardType = (cardType: string) => { switch (cardType) { diff --git a/ui-community/src/components/layouts/members/components/payment-modal.tsx b/ui-community/src/components/layouts/members/components/payment-modal.tsx index e6a49a41..c9c59b36 100644 --- a/ui-community/src/components/layouts/members/components/payment-modal.tsx +++ b/ui-community/src/components/layouts/members/components/payment-modal.tsx @@ -3,10 +3,10 @@ import { PlusOutlined } from '@ant-design/icons'; import { PaymentInstrument, PaymentInstrumentResult } from '../../../../generated'; -import usePayModal from '../../../../hooks/usePayModal'; +import { usePayModal } from '../../../../hooks/usePayModal'; import { CreditCardDisplay } from './payment-instruments-list'; -import useAddPaymentMethodModal from '../../../../hooks/useAddPaymentMethodModal'; +import { useAddPaymentMethodModal } from '../../../../hooks/useAddPaymentMethodModal'; import { useState } from 'react'; type PaymentForm = { diff --git a/ui-community/src/components/layouts/members/components/properties-list-search-filters.tsx b/ui-community/src/components/layouts/members/components/properties-list-search-filters.tsx index 54c34cf5..832974af 100644 --- a/ui-community/src/components/layouts/members/components/properties-list-search-filters.tsx +++ b/ui-community/src/components/layouts/members/components/properties-list-search-filters.tsx @@ -74,7 +74,7 @@ const AdditionalAmenitiesFilter: FC = (props) => ); }; -const PropertiesListSearchFilters: FC = (props) => { +export const PropertiesListSearchFilters: FC = (props) => { const [filters, setFilters] = useState([]); const generateFilters = (config: SearchFilterConfigDefinition) => { @@ -293,5 +293,3 @@ const PropertiesListSearchFilters: FC = (props ); }; - -export default PropertiesListSearchFilters; diff --git a/ui-community/src/components/layouts/members/components/transactions.container.tsx b/ui-community/src/components/layouts/members/components/transactions.container.tsx index 159de2ea..40311b3e 100644 --- a/ui-community/src/components/layouts/members/components/transactions.container.tsx +++ b/ui-community/src/components/layouts/members/components/transactions.container.tsx @@ -1,11 +1,11 @@ import { useQuery } from '@apollo/client'; -import Transactions from './transactions'; +import { Transactions } from './transactions'; import { MemberTransactionsDocument } from '../../../../generated'; import { Descriptions, Empty, Skeleton } from 'antd'; interface TransactionsContainerProps {} -const TransactionsContainer: React.FC = () => { +export const TransactionsContainer: React.FC = () => { const { data: transactions, error: transactionsError, @@ -49,5 +49,3 @@ const TransactionsContainer: React.FC = () => { ); }; - -export default TransactionsContainer; diff --git a/ui-community/src/components/layouts/members/components/transactions.tsx b/ui-community/src/components/layouts/members/components/transactions.tsx index 6d51cda6..4c630045 100644 --- a/ui-community/src/components/layouts/members/components/transactions.tsx +++ b/ui-community/src/components/layouts/members/components/transactions.tsx @@ -25,8 +25,7 @@ interface TransactionsProps { transactions: any[]; } -const Transactions: React.FC = ({ transactions }) => { +export const Transactions: React.FC = ({ transactions }) => { return record.transactionId} dataSource={transactions} />; }; -export default Transactions; diff --git a/ui-community/src/components/layouts/members/components/violation-tickets-detail.tsx b/ui-community/src/components/layouts/members/components/violation-tickets-detail.tsx index db47bd99..66b5a7d6 100644 --- a/ui-community/src/components/layouts/members/components/violation-tickets-detail.tsx +++ b/ui-community/src/components/layouts/members/components/violation-tickets-detail.tsx @@ -23,7 +23,7 @@ import { ViolationTicketUpdateInput, ViolationTicketChangeStatusInput } from '../../../../generated'; -import usePayModal from '../../../../hooks/usePayModal'; +import { usePayModal } from '../../../../hooks/usePayModal'; import { PaymentModalContainer } from './payment-modal.container'; import { MemberChatMessagesContainer } from '../../ahp-proof-of-concepts/pages/request-list-page/case-details-page/active-case-details-page/active-case/chat/member/member-chat-messages.container'; diff --git a/ui-community/src/components/layouts/members/components/wallet-customer-info.container.tsx b/ui-community/src/components/layouts/members/components/wallet-customer-info.container.tsx index 339ec066..68c9992b 100644 --- a/ui-community/src/components/layouts/members/components/wallet-customer-info.container.tsx +++ b/ui-community/src/components/layouts/members/components/wallet-customer-info.container.tsx @@ -1,9 +1,9 @@ -import WalletCustomerInfo from './wallet-customer-info'; +import { WalletCustomerInfo } from './wallet-customer-info'; interface WalletCustomerInfoContainerProps {} -const WalletCustomerInfoContainer: React.FC = () => { +export const WalletCustomerInfoContainer: React.FC = () => { return ; }; -export default WalletCustomerInfoContainer; + diff --git a/ui-community/src/components/layouts/members/components/wallet-customer-info.tsx b/ui-community/src/components/layouts/members/components/wallet-customer-info.tsx index 7ccc0106..28061efc 100644 --- a/ui-community/src/components/layouts/members/components/wallet-customer-info.tsx +++ b/ui-community/src/components/layouts/members/components/wallet-customer-info.tsx @@ -13,7 +13,7 @@ interface CustomerInfoFormSchema { interface WalletCustomerInfoProps {} -const WalletCustomerInfo: React.FC = () => { +export const WalletCustomerInfo: React.FC = () => { const [customerInfoForm] = Form.useForm(); return ( @@ -77,4 +77,3 @@ const WalletCustomerInfo: React.FC = () => { ); }; -export default WalletCustomerInfo; diff --git a/ui-community/src/components/layouts/members/components/wallet.container.tsx b/ui-community/src/components/layouts/members/components/wallet.container.tsx index 790223b4..6b500daf 100644 --- a/ui-community/src/components/layouts/members/components/wallet.container.tsx +++ b/ui-community/src/components/layouts/members/components/wallet.container.tsx @@ -4,7 +4,7 @@ import { MemberPaymentInstrumentsDocument, MemberSetDefaultPaymentInstrumentDocument } from '../../../../generated'; -import Wallet from './wallet'; +import { Wallet } from './wallet'; import { Empty, Skeleton, message } from 'antd'; interface WalletContainerProps { diff --git a/ui-community/src/components/layouts/members/components/wallet.tsx b/ui-community/src/components/layouts/members/components/wallet.tsx index 3df69f59..b295a613 100644 --- a/ui-community/src/components/layouts/members/components/wallet.tsx +++ b/ui-community/src/components/layouts/members/components/wallet.tsx @@ -1,11 +1,10 @@ import React from 'react'; import { Button, Empty } from 'antd'; import { PlusOutlined } from '@ant-design/icons'; - -import AddPaymentMethodModalContainer from './add-payment-method-modal.container'; +import { AddPaymentMethodModalContainer } from './add-payment-method-modal.container'; import { PaymentInstrumentList } from './payment-instruments-list'; -import useAddPaymentMethodModal from '../../../../hooks/useAddPaymentMethodModal'; +import { useAddPaymentMethodModal } from '../../../../hooks/useAddPaymentMethodModal'; import { PaymentInstrument, PaymentInstrumentResult } from '../../../../generated'; import { EditPaymentMethodModalContianer } from './edit-payment-modal.container'; @@ -15,7 +14,7 @@ interface WalletProps { onDeletePaymentMethod: (paymentInstrumentId: string) => Promise; } -const Wallet: React.FC = ({ +export const Wallet: React.FC = ({ paymentInstrumentsResult, onSetDefaultPaymentMethod, onDeletePaymentMethod @@ -50,5 +49,3 @@ const Wallet: React.FC = ({ ); }; - -export default Wallet; diff --git a/ui-community/src/components/layouts/members/index.tsx b/ui-community/src/components/layouts/members/index.tsx index 9f522b86..40e78db9 100644 --- a/ui-community/src/components/layouts/members/index.tsx +++ b/ui-community/src/components/layouts/members/index.tsx @@ -20,7 +20,7 @@ import { CommunityProperty } from './pages/community-property'; import { PropertiesSearch } from './pages/properties-search'; import { PageLayoutProps } from '../admin'; import { Member } from '../../../generated'; -import Payment from './pages/payment'; +import { Payment } from './pages/payment'; export const Members: React.FC = (_props) => { diff --git a/ui-community/src/components/layouts/members/pages/payment.tsx b/ui-community/src/components/layouts/members/pages/payment.tsx index 42bb1ee3..f1367605 100644 --- a/ui-community/src/components/layouts/members/pages/payment.tsx +++ b/ui-community/src/components/layouts/members/pages/payment.tsx @@ -4,10 +4,10 @@ import { WalletContainer } from '../components/wallet.container'; import { SubPageLayout } from '../sub-page-layout'; import { CreditCardOutlined } from '@ant-design/icons'; import { GrTransaction } from 'react-icons/gr'; -import TransactionsContainer from '../components/transactions.container'; +import { TransactionsContainer } from '../components/transactions.container'; import { VerticalTabs, RouteDefinition } from '../../../shared/vertical-tabs'; -const Payment: React.FC = () => { +export const Payment: React.FC = () => { const { token: { colorTextBase } @@ -40,5 +40,3 @@ const Payment: React.FC = () => { ); }; - -export default Payment; \ No newline at end of file diff --git a/ui-community/src/components/layouts/members/pages/violation-ticket-detail.tsx b/ui-community/src/components/layouts/members/pages/violation-ticket-detail.tsx index 7cf979e2..67155d6f 100644 --- a/ui-community/src/components/layouts/members/pages/violation-ticket-detail.tsx +++ b/ui-community/src/components/layouts/members/pages/violation-ticket-detail.tsx @@ -4,7 +4,7 @@ import { useNavigate, useParams } from 'react-router-dom'; import { SubPageLayout } from '../sub-page-layout'; import { ViolationTicketsDetailContainer } from '../components/violation-tickets-detail.container'; -import AddPaymentMethodModalContainer from '../components/add-payment-method-modal.container'; +import { AddPaymentMethodModalContainer } from '../components/add-payment-method-modal.container'; export const ViolationTicketsDetail: React.FC = () => { const params = useParams(); diff --git a/ui-community/src/components/layouts/root/cms-page.tsx b/ui-community/src/components/layouts/root/cms-page.tsx index aecae398..ff789575 100644 --- a/ui-community/src/components/layouts/root/cms-page.tsx +++ b/ui-community/src/components/layouts/root/cms-page.tsx @@ -3,7 +3,7 @@ import { matchRoutes, useLocation } from 'react-router-dom'; import * as CmsComponents from "../../editor/components/"; import { arePageLayoutsLoaded, usePageLayouts } from '../../editor/page-layout'; -const CmsPage: React.FC = () => { +export const CmsPage: React.FC = () => { const [pageLayouts] = usePageLayouts(); const location = useLocation(); @@ -25,6 +25,4 @@ const CmsPage: React.FC = () => { ); -} - -export default CmsPage; \ No newline at end of file +} \ No newline at end of file diff --git a/ui-community/src/components/layouts/root/section-layout.tsx b/ui-community/src/components/layouts/root/section-layout.tsx index d2dc87a8..814eba49 100644 --- a/ui-community/src/components/layouts/root/section-layout.tsx +++ b/ui-community/src/components/layouts/root/section-layout.tsx @@ -1,5 +1,5 @@ import { arePageLayoutsLoaded, usePageLayouts } from '../../editor/page-layout'; -import CmsPage from './cms-page'; +import { CmsPage } from './cms-page'; import { Header } from './components/header'; export const SectionLayout: React.FC = () => { diff --git a/ui-community/src/components/layouts/shared/components/search-drawer.container.tsx b/ui-community/src/components/layouts/shared/components/search-drawer.container.tsx index 575430fd..e48c85d0 100644 --- a/ui-community/src/components/layouts/shared/components/search-drawer.container.tsx +++ b/ui-community/src/components/layouts/shared/components/search-drawer.container.tsx @@ -12,7 +12,7 @@ import { } from '../../../../generated'; import { ServiceTicketsSearchFilters } from '../../members/components/service-tickets-search-filters'; import { SearchToolbar } from './search-toolbar'; -import PropertiesListSearchFilters from '../../members/components/properties-list-search-filters'; +import { PropertiesListSearchFilters } from '../../members/components/properties-list-search-filters'; interface SearchDrawerContainerProps { type: SearchType; diff --git a/ui-community/src/components/shared/azure-monitor/index.tsx b/ui-community/src/components/shared/azure-monitor/index.tsx index 72aaa184..1a6bc9ea 100644 --- a/ui-community/src/components/shared/azure-monitor/index.tsx +++ b/ui-community/src/components/shared/azure-monitor/index.tsx @@ -1,8 +1,8 @@ import { ReactPlugin } from '@microsoft/applicationinsights-react-js'; import { ApplicationInsights, DistributedTracingModes, ITelemetryItem } from '@microsoft/applicationinsights-web'; -const reactPlugin = new ReactPlugin(); -const appInsights = new ApplicationInsights({ +export const reactPlugin = new ReactPlugin(); +export const appInsights = new ApplicationInsights({ config: { connectionString: `${import.meta.env.VITE_APP_INSIGHTS_CONNECTION_STRING}`, extensions: [reactPlugin], @@ -27,4 +27,3 @@ appInsights.addTelemetryInitializer((env:ITelemetryItem) => { env.tags["ai.cloud.role"] = "OwnerCommunity-UI"; }); -export { appInsights, reactPlugin }; diff --git a/ui-community/src/components/shared/feature-flag-react-lite/feature-flag-context.tsx b/ui-community/src/components/shared/feature-flag-react-lite/feature-flag-context.tsx index da7ac6d0..53d12697 100644 --- a/ui-community/src/components/shared/feature-flag-react-lite/feature-flag-context.tsx +++ b/ui-community/src/components/shared/feature-flag-react-lite/feature-flag-context.tsx @@ -21,6 +21,4 @@ const initialContext = { GetFeatureFlagByName: stub } -const FeatureFlagsContext = createContext(initialContext) - -export default FeatureFlagsContext +export const FeatureFlagsContext = createContext(initialContext) diff --git a/ui-community/src/components/shared/feature-flag-react-lite/feature-flag-provider.tsx b/ui-community/src/components/shared/feature-flag-react-lite/feature-flag-provider.tsx index c0649113..911a8bd8 100644 --- a/ui-community/src/components/shared/feature-flag-react-lite/feature-flag-provider.tsx +++ b/ui-community/src/components/shared/feature-flag-react-lite/feature-flag-provider.tsx @@ -2,7 +2,7 @@ import retry from 'async-retry'; import { AxiosRequestConfig } from 'axios'; import { LRUCache } from 'lru-cache'; import React, { FC, ReactNode, useEffect, useState } from 'react'; // useState -import FeatureFlagContext, { FeatureFlags } from './feature-flag-context'; +import { FeatureFlagsContext ,FeatureFlags } from './feature-flag-context'; /** * FeatureFlagConfig @@ -23,7 +23,7 @@ export type FeatureFlagProps = { children: ReactNode; }; -const FeatureFlagProvider: FC = (props: FeatureFlagProps): React.JSX.Element => { +export const FeatureFlagProvider: FC = (props: FeatureFlagProps): React.JSX.Element => { let tempFeatureFlagList: FeatureFlags | undefined; const [featureFlagList, setFeatureFlagListVal] = useState(); const cacheTimeout = !props.config.cache ? 30 * 1000 : props.config.cache; @@ -106,15 +106,13 @@ const FeatureFlagProvider: FC = (props: FeatureFlagProps): Rea }; return ( - getFeatureFlagByName(name) }} > {props.children} - + ); }; - -export default FeatureFlagProvider; diff --git a/ui-community/src/components/shared/feature-flag-react-lite/index.cjs.tsx b/ui-community/src/components/shared/feature-flag-react-lite/index.cjs.tsx index a2e0db8c..32e6bd60 100644 --- a/ui-community/src/components/shared/feature-flag-react-lite/index.cjs.tsx +++ b/ui-community/src/components/shared/feature-flag-react-lite/index.cjs.tsx @@ -1,5 +1,5 @@ -import useFeatureFlags from './use-feature-flag' -import FeatureFlagProvider from './feature-flag-provider' +import { useFeatureFlags } from './use-feature-flag' +import { FeatureFlagProvider } from './feature-flag-provider' Object.assign(FeatureFlagProvider, { useFeatureFlags diff --git a/ui-community/src/components/shared/feature-flag-react-lite/index.tsx b/ui-community/src/components/shared/feature-flag-react-lite/index.tsx index ad3f8e0b..71784c47 100644 --- a/ui-community/src/components/shared/feature-flag-react-lite/index.tsx +++ b/ui-community/src/components/shared/feature-flag-react-lite/index.tsx @@ -1,5 +1,5 @@ -import useFeatureFlags from './use-feature-flag'; -import FeatureFlagProvider, { FeatureFlagConfig } from './feature-flag-provider' +import { useFeatureFlags } from './use-feature-flag'; +import { FeatureFlagProvider, FeatureFlagConfig } from './feature-flag-provider' export { useFeatureFlags }; export type { FeatureFlagConfig }; diff --git a/ui-community/src/components/shared/feature-flag-react-lite/use-feature-flag.tsx b/ui-community/src/components/shared/feature-flag-react-lite/use-feature-flag.tsx index c4803a6a..895f2057 100644 --- a/ui-community/src/components/shared/feature-flag-react-lite/use-feature-flag.tsx +++ b/ui-community/src/components/shared/feature-flag-react-lite/use-feature-flag.tsx @@ -1,8 +1,7 @@ import { useContext } from 'react' -import FeatureFlagsContext, { FeatureFlagInterface } from './feature-flag-context' +import { FeatureFlagsContext, FeatureFlagInterface } from './feature-flag-context' -const useFeatureFlags = (): FeatureFlagInterface => +export const useFeatureFlags = (): FeatureFlagInterface => useContext(FeatureFlagsContext) -export default useFeatureFlags diff --git a/ui-community/src/components/shared/maintenance-message/impending-message.tsx b/ui-community/src/components/shared/maintenance-message/impending-message.tsx index 3f853d9c..92d5a7d0 100644 --- a/ui-community/src/components/shared/maintenance-message/impending-message.tsx +++ b/ui-community/src/components/shared/maintenance-message/impending-message.tsx @@ -12,7 +12,7 @@ export interface MaintenanceMessageProps { impendingMessage: string; } -const ImpendingMessage: FC = (props) => { +export const ImpendingMessage: FC = (props) => { const replaceTokens = (str: string, mapObj: any) => { let re = new RegExp(Object.keys(mapObj).join('|'), 'g'); @@ -48,4 +48,3 @@ const ImpendingMessage: FC = (props) => { ); }; -export default ImpendingMessage; diff --git a/ui-community/src/components/shared/maintenance-message/index.tsx b/ui-community/src/components/shared/maintenance-message/index.tsx index 8b64b0bf..849d4dcb 100644 --- a/ui-community/src/components/shared/maintenance-message/index.tsx +++ b/ui-community/src/components/shared/maintenance-message/index.tsx @@ -1,6 +1,5 @@ -import useMaintenanceMessage from "./use-maintenance-message"; -import MaintenanceMessageProvider, { -} from "./maintenance-message-provider"; +import { useMaintenanceMessage } from "./use-maintenance-message"; +import { MaintenanceMessageProvider } from "./maintenance-message-provider"; export { useMaintenanceMessage }; diff --git a/ui-community/src/components/shared/maintenance-message/maintenance-message-context.tsx b/ui-community/src/components/shared/maintenance-message/maintenance-message-context.tsx index c1afba4e..eb311479 100644 --- a/ui-community/src/components/shared/maintenance-message/maintenance-message-context.tsx +++ b/ui-community/src/components/shared/maintenance-message/maintenance-message-context.tsx @@ -22,6 +22,5 @@ const initialContext = { maintenanceEndTimestamp: '' }; -const MaintenanceMessageContext = createContext(initialContext); +export const MaintenanceMessageContext = createContext(initialContext); -export default MaintenanceMessageContext; diff --git a/ui-community/src/components/shared/maintenance-message/maintenance-message-provider.tsx b/ui-community/src/components/shared/maintenance-message/maintenance-message-provider.tsx index 84a76bb1..06bdce9f 100644 --- a/ui-community/src/components/shared/maintenance-message/maintenance-message-provider.tsx +++ b/ui-community/src/components/shared/maintenance-message/maintenance-message-provider.tsx @@ -6,7 +6,7 @@ import { useAuth } from 'react-oidc-context'; import { FormatTimeCounter, IsInStorybookEnv } from '../../../constants'; import { HandleLogout } from '../handle-logout'; import { MaintenanceKickoutMessage } from './maintenance-kickout-message'; -import MaintenanceMessageContext from './maintenance-message-context'; +import { MaintenanceMessageContext } from './maintenance-message-context'; export interface MaintenanceMessageInfo { impendingMaintenanceStartTimestamp: string; @@ -22,7 +22,7 @@ export type MaintenanceMessageProps = { maintenanceInfo: MaintenanceMessageInfo; }; -const MaintenanceMessageProvider: FC = (props: MaintenanceMessageProps): React.JSX.Element => { +export const MaintenanceMessageProvider: FC = (props: MaintenanceMessageProps): React.JSX.Element => { // const timeoutBeforeMaintenance = import.meta.env.VITE_TIMEOUT_BEFORE_MAINTENANCE ?? 120; //in seconds const auth = useAuth(); const apolloClient = useApolloClient(); @@ -210,5 +210,3 @@ const MaintenanceMessageProvider: FC = (props: Maintena ); }; - -export default MaintenanceMessageProvider; diff --git a/ui-community/src/components/shared/maintenance-message/maintenance-message.test.tsx b/ui-community/src/components/shared/maintenance-message/maintenance-message.test.tsx index c071db94..68017113 100644 --- a/ui-community/src/components/shared/maintenance-message/maintenance-message.test.tsx +++ b/ui-community/src/components/shared/maintenance-message/maintenance-message.test.tsx @@ -14,7 +14,7 @@ import { MemoryRouter } from 'react-router-dom'; import MaintenanceMessageProvider from '.'; import App from '../../../App'; import * as LocalData from '../../../components/editor/page-layout'; -import featureFlagConfig from '../../../config/feature-flag-config'; +import { featureFlagConfig } from '../../../config/feature-flag-config'; import { uiConfig } from '../../../config/odic-config'; import { ThemeProvider } from '../../../contexts/ThemeContext'; import FeatureFlagProvider from '../feature-flag-react-lite'; diff --git a/ui-community/src/components/shared/maintenance-message/maintenance-message.tsx b/ui-community/src/components/shared/maintenance-message/maintenance-message.tsx index 96e936e5..8cd9916d 100644 --- a/ui-community/src/components/shared/maintenance-message/maintenance-message.tsx +++ b/ui-community/src/components/shared/maintenance-message/maintenance-message.tsx @@ -12,7 +12,7 @@ export interface MaintenanceMessageProps { maintenanceMessage: string; } -const MaintenanceMessage: FC = (props) => { +export const MaintenanceMessage: FC = (props) => { const replaceTokens = (str: string, mapObj: any) => { let re = new RegExp(Object.keys(mapObj).join('|'), 'g'); @@ -57,5 +57,3 @@ const MaintenanceMessage: FC = (props) => { ); }; - -export default MaintenanceMessage; diff --git a/ui-community/src/components/shared/maintenance-message/use-maintenance-message.tsx b/ui-community/src/components/shared/maintenance-message/use-maintenance-message.tsx index 54638784..9d1aa79e 100644 --- a/ui-community/src/components/shared/maintenance-message/use-maintenance-message.tsx +++ b/ui-community/src/components/shared/maintenance-message/use-maintenance-message.tsx @@ -1,7 +1,6 @@ import { useContext } from 'react' -import MaintenanceMessageContext, { MaintenanceMessageInterface } from './maintenance-message-context' +import { MaintenanceMessageContext, MaintenanceMessageInterface } from './maintenance-message-context' -const useMaintenanceMessage = (): MaintenanceMessageInterface => +export const useMaintenanceMessage = (): MaintenanceMessageInterface => useContext(MaintenanceMessageContext) -export default useMaintenanceMessage diff --git a/ui-community/src/components/shared/require-auth.tsx b/ui-community/src/components/shared/require-auth.tsx index ed32e902..d903493c 100644 --- a/ui-community/src/components/shared/require-auth.tsx +++ b/ui-community/src/components/shared/require-auth.tsx @@ -8,7 +8,7 @@ interface RequireAuthProps { forceLogin?: boolean; } -const RequireAuth: React.FC = (props) => { +export const RequireAuth: React.FC = (props) => { const auth = useAuth(); const location = useLocation(); @@ -51,4 +51,3 @@ const RequireAuth: React.FC = (props) => { redirectUser(); } }; -export default RequireAuth; diff --git a/ui-community/src/components/testing/PdfTesting.container.tsx b/ui-community/src/components/testing/PdfTesting.container.tsx index 1bbfc501..3df24be0 100644 --- a/ui-community/src/components/testing/PdfTesting.container.tsx +++ b/ui-community/src/components/testing/PdfTesting.container.tsx @@ -1,9 +1,8 @@ import React from 'react'; import pdfData from "./pdfRendererTest.json" -import PdfVerificationBlankPage from './pdf-pages/PdfVerificationBlankPage'; +import { PdfVerificationBlankPage } from './pdf-pages/PdfVerificationBlankPage'; export const PdfTestingContainer: React.FC = () => { return ; }; -export default PdfTestingContainer; diff --git a/ui-community/src/components/testing/TestPdfView.tsx b/ui-community/src/components/testing/TestPdfView.tsx index c5af114f..1ec29361 100644 --- a/ui-community/src/components/testing/TestPdfView.tsx +++ b/ui-community/src/components/testing/TestPdfView.tsx @@ -47,5 +47,3 @@ export const TestPdfView: React.FC = () => { ); }; - -export default TestPdfView; diff --git a/ui-community/src/components/testing/eif/PdfApplicantCertification.tsx b/ui-community/src/components/testing/eif/PdfApplicantCertification.tsx index 819bf555..8819a26f 100644 --- a/ui-community/src/components/testing/eif/PdfApplicantCertification.tsx +++ b/ui-community/src/components/testing/eif/PdfApplicantCertification.tsx @@ -93,4 +93,3 @@ export const PdfApplicantCertification: React.FC = () => { ); }; -export default PdfApplicantCertification; diff --git a/ui-community/src/components/testing/eif/PdfEIFSection.tsx b/ui-community/src/components/testing/eif/PdfEIFSection.tsx index e878d028..a3881eb9 100644 --- a/ui-community/src/components/testing/eif/PdfEIFSection.tsx +++ b/ui-community/src/components/testing/eif/PdfEIFSection.tsx @@ -1,8 +1,8 @@ import React from 'react'; import { View, StyleSheet, Image } from '@react-pdf/renderer'; -import PdfInformation from './PdfEifInformation'; -import PdfIdentificationCertification from './PdfIdentificationCertification'; -import PdfApplicantCertification from './PdfApplicantCertification'; +import { PdfInformation } from './PdfEifInformation'; +import { PdfIdentificationCertification } from './PdfIdentificationCertification'; +import { PdfApplicantCertification } from './PdfApplicantCertification'; import SideBarImage from '../test-images/SideBarImage.png'; interface PdfDisclaimersProps { @@ -39,4 +39,3 @@ export const PdfEIFSection: React.FC = (props) => { ); }; -export default PdfEIFSection; diff --git a/ui-community/src/components/testing/eif/PdfEIFSectionFinal.tsx b/ui-community/src/components/testing/eif/PdfEIFSectionFinal.tsx index 9160bed3..15254cde 100644 --- a/ui-community/src/components/testing/eif/PdfEIFSectionFinal.tsx +++ b/ui-community/src/components/testing/eif/PdfEIFSectionFinal.tsx @@ -1,8 +1,8 @@ import React from 'react'; import { View, StyleSheet, Image } from '@react-pdf/renderer'; -import PdfInformation from './PdfEifInformation'; -import PdfIdentificationCertification from './PdfIdentificationCertification'; -import PdfApplicantCertification from './PdfApplicantCertification'; +import { PdfInformation } from './PdfEifInformation'; +import { PdfIdentificationCertification } from './PdfIdentificationCertification'; +import { PdfApplicantCertification } from './PdfApplicantCertification'; import SideBarImage from '../test-images/SideBarImage.png'; interface PdfDisclaimersProps { diff --git a/ui-community/src/components/testing/eif/PdfEifInformation.tsx b/ui-community/src/components/testing/eif/PdfEifInformation.tsx index 39fb2e3a..f8d7e874 100644 --- a/ui-community/src/components/testing/eif/PdfEifInformation.tsx +++ b/ui-community/src/components/testing/eif/PdfEifInformation.tsx @@ -55,4 +55,3 @@ export const PdfInformation: React.FC = (props) => { ); }; -export default PdfInformation; diff --git a/ui-community/src/components/testing/eif/PdfFooterV2.tsx b/ui-community/src/components/testing/eif/PdfFooterV2.tsx index 85da5802..e0573168 100644 --- a/ui-community/src/components/testing/eif/PdfFooterV2.tsx +++ b/ui-community/src/components/testing/eif/PdfFooterV2.tsx @@ -29,4 +29,3 @@ export const PdfFooterV2: React.FC = (props) => { ); }; -export default PdfFooterV2; diff --git a/ui-community/src/components/testing/eif/PdfHeaderV2.tsx b/ui-community/src/components/testing/eif/PdfHeaderV2.tsx index e95aa0ce..8558b9f0 100644 --- a/ui-community/src/components/testing/eif/PdfHeaderV2.tsx +++ b/ui-community/src/components/testing/eif/PdfHeaderV2.tsx @@ -50,4 +50,3 @@ export const PdfHeaderV2: React.FC = (props) => { ); }; -export default PdfHeaderV2; diff --git a/ui-community/src/components/testing/eif/PdfIdentificationCertification.tsx b/ui-community/src/components/testing/eif/PdfIdentificationCertification.tsx index 3570aa51..cc5d15d3 100644 --- a/ui-community/src/components/testing/eif/PdfIdentificationCertification.tsx +++ b/ui-community/src/components/testing/eif/PdfIdentificationCertification.tsx @@ -81,4 +81,3 @@ export const PdfIdentificationCertification: React.FC = () ); }; -export default PdfIdentificationCertification; diff --git a/ui-community/src/components/testing/epic/PdfCandidateDetails.tsx b/ui-community/src/components/testing/epic/PdfCandidateDetails.tsx index d02f5719..7d3cf666 100644 --- a/ui-community/src/components/testing/epic/PdfCandidateDetails.tsx +++ b/ui-community/src/components/testing/epic/PdfCandidateDetails.tsx @@ -55,4 +55,3 @@ export const PdfCandidateDetails: React.FC = (props) = ); }; -export default PdfCandidateDetails; diff --git a/ui-community/src/components/testing/epic/PdfCredentialDetails.tsx b/ui-community/src/components/testing/epic/PdfCredentialDetails.tsx index d3a47bac..3f1521b1 100644 --- a/ui-community/src/components/testing/epic/PdfCredentialDetails.tsx +++ b/ui-community/src/components/testing/epic/PdfCredentialDetails.tsx @@ -42,4 +42,3 @@ export const PdfCredentialDetails: React.FC = (props) ); }; -export default PdfCredentialDetails; diff --git a/ui-community/src/components/testing/epic/PdfDisclaimers.tsx b/ui-community/src/components/testing/epic/PdfDisclaimers.tsx index fdb6e1bf..9de32bde 100644 --- a/ui-community/src/components/testing/epic/PdfDisclaimers.tsx +++ b/ui-community/src/components/testing/epic/PdfDisclaimers.tsx @@ -55,4 +55,3 @@ export const PdfDisclaimers: React.FC = () => { ); }; -export default PdfDisclaimers; diff --git a/ui-community/src/components/testing/epic/PdfHeader.tsx b/ui-community/src/components/testing/epic/PdfHeader.tsx index 703fef73..58471874 100644 --- a/ui-community/src/components/testing/epic/PdfHeader.tsx +++ b/ui-community/src/components/testing/epic/PdfHeader.tsx @@ -58,4 +58,3 @@ export const PdfHeader: React.FC = () => { ); }; -export default PdfHeader; diff --git a/ui-community/src/components/testing/epic/PdfSignatureFooter.tsx b/ui-community/src/components/testing/epic/PdfSignatureFooter.tsx index ff3b4b10..677edd17 100644 --- a/ui-community/src/components/testing/epic/PdfSignatureFooter.tsx +++ b/ui-community/src/components/testing/epic/PdfSignatureFooter.tsx @@ -40,4 +40,3 @@ export const PdfSignatureFooter: React.FC = (props) = ); }; -export default PdfSignatureFooter; diff --git a/ui-community/src/components/testing/epic/PdfTitleSection.tsx b/ui-community/src/components/testing/epic/PdfTitleSection.tsx index 2271910e..749f63a6 100644 --- a/ui-community/src/components/testing/epic/PdfTitleSection.tsx +++ b/ui-community/src/components/testing/epic/PdfTitleSection.tsx @@ -61,4 +61,3 @@ export const PdfTitleSection: React.FC = (props) => { ); }; -export default PdfTitleSection; diff --git a/ui-community/src/components/testing/pdf-footers-and-headers/PdfBarCodeFooter.tsx b/ui-community/src/components/testing/pdf-footers-and-headers/PdfBarCodeFooter.tsx index 51919fa5..ba1781cc 100644 --- a/ui-community/src/components/testing/pdf-footers-and-headers/PdfBarCodeFooter.tsx +++ b/ui-community/src/components/testing/pdf-footers-and-headers/PdfBarCodeFooter.tsx @@ -38,4 +38,3 @@ export const PdfBarCodeFooter: React.FC = () => { ); }; -export default PdfBarCodeFooter; diff --git a/ui-community/src/components/testing/pdf-footers-and-headers/PdfBarCodeHeader.tsx b/ui-community/src/components/testing/pdf-footers-and-headers/PdfBarCodeHeader.tsx index 1a222005..e75a63cc 100644 --- a/ui-community/src/components/testing/pdf-footers-and-headers/PdfBarCodeHeader.tsx +++ b/ui-community/src/components/testing/pdf-footers-and-headers/PdfBarCodeHeader.tsx @@ -55,4 +55,3 @@ export const PdfBarCodeHeader: React.FC = () => { ); }; -export default PdfBarCodeHeader; diff --git a/ui-community/src/components/testing/pdf-pages/PdfEIFBlankPage.tsx b/ui-community/src/components/testing/pdf-pages/PdfEIFBlankPage.tsx index 2322117c..ac90e6a5 100644 --- a/ui-community/src/components/testing/pdf-pages/PdfEIFBlankPage.tsx +++ b/ui-community/src/components/testing/pdf-pages/PdfEIFBlankPage.tsx @@ -1,9 +1,9 @@ import React from 'react'; import { Document, Page, StyleSheet, Font } from '@react-pdf/renderer'; import FontFranklinRegular from '../../../fonts/libre-franklin-v11-latin/libre-franklin-v11-latin-100.ttf'; -import PdfEIFSection from '../eif/PdfEIFSection'; -import PdfBarCodeFooter from '../pdf-footers-and-headers/PdfBarCodeFooter'; -import PdfBarCodeHeader from '../pdf-footers-and-headers/PdfBarCodeHeader'; +import { PdfEIFSection } from '../eif/PdfEIFSection'; +import { PdfBarCodeFooter } from '../pdf-footers-and-headers/PdfBarCodeFooter'; +import { PdfBarCodeHeader } from '../pdf-footers-and-headers/PdfBarCodeHeader'; interface PdfTemplateProps { data: any; @@ -33,4 +33,3 @@ export const PdfEIFBlankPage: React.FC = (props) => { ); }; -export default PdfEIFBlankPage; diff --git a/ui-community/src/components/testing/pdf-pages/PdfEIFBlankPagev2.tsx b/ui-community/src/components/testing/pdf-pages/PdfEIFBlankPagev2.tsx index 6cd9e477..e78ba809 100644 --- a/ui-community/src/components/testing/pdf-pages/PdfEIFBlankPagev2.tsx +++ b/ui-community/src/components/testing/pdf-pages/PdfEIFBlankPagev2.tsx @@ -2,9 +2,9 @@ import React from 'react'; import { Document, Page, StyleSheet, Font } from '@react-pdf/renderer'; import FontFranklinRegular from '../../../fonts/libre-franklin-v11-latin/libre-franklin-v11-latin-500.ttf'; import FontFranklinBold from '../../../fonts/libre-franklin-v11-latin/libre-franklin-v11-latin-700.ttf' -import PdfEIFSection from '../eif/PdfEIFSection'; -import PdfFooterV2 from '../eif/PdfFooterV2'; -import PdfHeaderV2 from '../eif/PdfHeaderV2'; +import { PdfEIFSection } from '../eif/PdfEIFSection'; +import { PdfFooterV2 } from '../eif/PdfFooterV2'; +import { PdfHeaderV2 } from '../eif/PdfHeaderV2'; interface PdfTemplateProps { data: any; @@ -38,4 +38,3 @@ export const PdfEIFBlankPageV2: React.FC = (props) => { ); }; -export default PdfEIFBlankPageV2; diff --git a/ui-community/src/components/testing/pdf-pages/PdfEIFFinalPage.tsx b/ui-community/src/components/testing/pdf-pages/PdfEIFFinalPage.tsx index f8648bc4..33b39c80 100644 --- a/ui-community/src/components/testing/pdf-pages/PdfEIFFinalPage.tsx +++ b/ui-community/src/components/testing/pdf-pages/PdfEIFFinalPage.tsx @@ -1,8 +1,8 @@ import React from 'react'; import { Document, Page, StyleSheet, Font } from '@react-pdf/renderer'; import FontFranklinRegular from '../../../fonts/libre-franklin-v11-latin/libre-franklin-v11-latin-100.ttf'; -import PdfBarCodeFooter from '../pdf-footers-and-headers/PdfBarCodeFooter'; -import PdfBarCodeHeader from '../pdf-footers-and-headers/PdfBarCodeHeader'; +import { PdfBarCodeFooter } from '../pdf-footers-and-headers/PdfBarCodeFooter'; +import { PdfBarCodeHeader } from '../pdf-footers-and-headers/PdfBarCodeHeader'; import PdfEIFSectionFinal from '../eif/PdfEIFSectionFinal'; interface PdfTemplateProps { @@ -33,4 +33,3 @@ export const PdfEIFBlankPage: React.FC = (props) => { ); }; -export default PdfEIFBlankPage; diff --git a/ui-community/src/components/testing/pdf-pages/PdfEpicReportInfoPage.tsx b/ui-community/src/components/testing/pdf-pages/PdfEpicReportInfoPage.tsx index 387b0754..31477f62 100644 --- a/ui-community/src/components/testing/pdf-pages/PdfEpicReportInfoPage.tsx +++ b/ui-community/src/components/testing/pdf-pages/PdfEpicReportInfoPage.tsx @@ -2,10 +2,10 @@ import React from 'react'; import { Document, Page, Text, StyleSheet, Font } from '@react-pdf/renderer'; import FontFranklinRegular from '../../../fonts/libre-franklin-v11-latin/libre-franklin-v11-latin-200.ttf'; import FontFranklinBold from '../../../fonts/libre-franklin-v11-latin/libre-franklin-v11-latin-600.ttf' -import PdfCandidateDetails from '../epic/PdfCandidateDetails'; -import PdfCredentialDetails from '../epic/PdfCredentialDetails'; -import PdfDisclaimers from '../epic/PdfDisclaimers'; -import PdfTitleSection from '../epic/PdfTitleSection'; +import { PdfCandidateDetails } from '../epic/PdfCandidateDetails'; +import { PdfCredentialDetails } from '../epic/PdfCredentialDetails'; +import { PdfDisclaimers } from '../epic/PdfDisclaimers'; +import { PdfTitleSection } from '../epic/PdfTitleSection'; interface PdfTemplateProps { data: any; @@ -50,4 +50,3 @@ export const PdfEpicReportInfoPage: React.FC = (props) => { ); }; -export default PdfEpicReportInfoPage; diff --git a/ui-community/src/components/testing/pdf-pages/PdfEpicReportSignaturePage.tsx b/ui-community/src/components/testing/pdf-pages/PdfEpicReportSignaturePage.tsx index 59df8211..9b11d270 100644 --- a/ui-community/src/components/testing/pdf-pages/PdfEpicReportSignaturePage.tsx +++ b/ui-community/src/components/testing/pdf-pages/PdfEpicReportSignaturePage.tsx @@ -4,12 +4,12 @@ import FontFranklinRegular from '../../../fonts/libre-franklin-v11-latin/libre-f import FontFranklinBold from '../../../fonts/libre-franklin-v11-latin/libre-franklin-v11-latin-700.ttf' import SignatureImage from '../test-images/SignatureImage.png'; import SealImage from '../test-images/SealImage.png'; -import PdfSignatureArea from '../pdf-signature/PdfSignatureArea'; -import PdfSignatureFooter from '../epic/PdfSignatureFooter'; -import PdfSignatureInformation from '../pdf-signature/PdfSignatureInformation'; -import PdfSignatureInstructions from '../pdf-signature/PdfSignatureInstructions'; -import PdfSignatureReason from '../pdf-signature/PdfSignatureReason'; -import PdfHeader from '../epic/PdfHeader'; +import { PdfSignatureArea } from '../pdf-signature/PdfSignatureArea'; +import { PdfSignatureFooter } from '../epic/PdfSignatureFooter'; +import { PdfSignatureInformation } from '../pdf-signature/PdfSignatureInformation'; +import { PdfSignatureInstructions } from '../pdf-signature/PdfSignatureInstructions'; +import { PdfSignatureReason } from '../pdf-signature/PdfSignatureReason'; +import { PdfHeader } from '../epic/PdfHeader'; interface PdfTemplateProps { data: any; @@ -47,4 +47,3 @@ export const PdfEpicReportSignaturePage: React.FC = (props) => ); }; -export default PdfEpicReportSignaturePage; diff --git a/ui-community/src/components/testing/pdf-pages/PdfVerificationBlankPage.tsx b/ui-community/src/components/testing/pdf-pages/PdfVerificationBlankPage.tsx index cb4966b8..3117e21b 100644 --- a/ui-community/src/components/testing/pdf-pages/PdfVerificationBlankPage.tsx +++ b/ui-community/src/components/testing/pdf-pages/PdfVerificationBlankPage.tsx @@ -2,9 +2,9 @@ import React from 'react'; import { Document, Page, StyleSheet, Font } from '@react-pdf/renderer'; import FontFranklinRegular from '../../../fonts/libre-franklin-v11-latin/libre-franklin-v11-latin-500.ttf'; import FontFranklinBold from '../../../fonts/libre-franklin-v11-latin/libre-franklin-v11-latin-700.ttf'; -import PdfHeaderV2 from '../eif/PdfHeaderV2'; -import PdfVerificationFooter from '../verification/PdfVerificationFooter'; -import PdfVerificationSection from '../verification/PdfVerificationSection'; +import { PdfHeaderV2 } from '../eif/PdfHeaderV2'; +import { PdfVerificationFooter } from '../verification/PdfVerificationFooter'; +import { PdfVerificationSection } from '../verification/PdfVerificationSection'; interface PdfTemplateProps { data: any; @@ -38,4 +38,3 @@ export const PdfVerificationBlankPage: React.FC = (props) => { ); }; -export default PdfVerificationBlankPage; diff --git a/ui-community/src/components/testing/pdf-pages/PdfVerificationSignaturePage.tsx b/ui-community/src/components/testing/pdf-pages/PdfVerificationSignaturePage.tsx index fa4d65bc..c0dbf729 100644 --- a/ui-community/src/components/testing/pdf-pages/PdfVerificationSignaturePage.tsx +++ b/ui-community/src/components/testing/pdf-pages/PdfVerificationSignaturePage.tsx @@ -3,12 +3,12 @@ import { Document, Page, StyleSheet, Font } from '@react-pdf/renderer'; import FontFranklinRegular from '../../../fonts/libre-franklin-v11-latin/libre-franklin-v11-latin-500.ttf'; import FontFranklinBold from '../../../fonts/libre-franklin-v11-latin/libre-franklin-v11-latin-700.ttf' import SealImage from '../test-images/SealImage.png'; -import PdfSignatureArea from '../pdf-signature/PdfSignatureArea'; -import PdfSignatureInstructions from '../pdf-signature/PdfSignatureInstructions'; -import PdfSignatureReason from '../pdf-signature/PdfSignatureReason'; -import PdfHeader from '../epic/PdfHeader'; -import PdfVerificationSignatureFooter from '../verification/PdfVerificationSignatureFooter'; -import PdfVerificationSignatureInformation from '../verification/PdfVerificationSignatureInformation'; +import { PdfSignatureArea } from '../pdf-signature/PdfSignatureArea'; +import { PdfSignatureInstructions } from '../pdf-signature/PdfSignatureInstructions'; +import { PdfSignatureReason } from '../pdf-signature/PdfSignatureReason'; +import { PdfHeader } from '../epic/PdfHeader'; +import { PdfVerificationSignatureFooter } from '../verification/PdfVerificationSignatureFooter'; +import { PdfVerificationSignatureInformation } from '../verification/PdfVerificationSignatureInformation'; interface PdfTemplateProps { data: any; @@ -46,4 +46,3 @@ export const PdfVerificationSignaturePage: React.FC = (props) ); }; -export default PdfVerificationSignaturePage; diff --git a/ui-community/src/components/testing/pdf-signature/PdfSignatureArea.tsx b/ui-community/src/components/testing/pdf-signature/PdfSignatureArea.tsx index 4cbe5bb3..bee8a2f5 100644 --- a/ui-community/src/components/testing/pdf-signature/PdfSignatureArea.tsx +++ b/ui-community/src/components/testing/pdf-signature/PdfSignatureArea.tsx @@ -104,5 +104,3 @@ export const PdfSignatureArea: React.FC = (props) => ); }; - -export default PdfSignatureArea; diff --git a/ui-community/src/components/testing/pdf-signature/PdfSignatureInformation.tsx b/ui-community/src/components/testing/pdf-signature/PdfSignatureInformation.tsx index 2cb8ef04..d2ff257d 100644 --- a/ui-community/src/components/testing/pdf-signature/PdfSignatureInformation.tsx +++ b/ui-community/src/components/testing/pdf-signature/PdfSignatureInformation.tsx @@ -62,4 +62,3 @@ export const PdfSignatureInformation: React.FC = (pro ); }; -export default PdfSignatureInformation; diff --git a/ui-community/src/components/testing/pdf-signature/PdfSignatureInstructions.tsx b/ui-community/src/components/testing/pdf-signature/PdfSignatureInstructions.tsx index 99f13c8d..f8c2ba04 100644 --- a/ui-community/src/components/testing/pdf-signature/PdfSignatureInstructions.tsx +++ b/ui-community/src/components/testing/pdf-signature/PdfSignatureInstructions.tsx @@ -46,4 +46,3 @@ export const PdfSignatureInstructions: React.FC = () ); }; -export default PdfSignatureInstructions; diff --git a/ui-community/src/components/testing/pdf-signature/PdfSignatureReason.tsx b/ui-community/src/components/testing/pdf-signature/PdfSignatureReason.tsx index e7229ab0..09a86e2c 100644 --- a/ui-community/src/components/testing/pdf-signature/PdfSignatureReason.tsx +++ b/ui-community/src/components/testing/pdf-signature/PdfSignatureReason.tsx @@ -37,5 +37,3 @@ export const PdfSignatureReason: React.FC = () => { ); }; - -export default PdfSignatureReason; diff --git a/ui-community/src/components/testing/verification/PdfVerificationFooter.tsx b/ui-community/src/components/testing/verification/PdfVerificationFooter.tsx index 157360d0..e74507fd 100644 --- a/ui-community/src/components/testing/verification/PdfVerificationFooter.tsx +++ b/ui-community/src/components/testing/verification/PdfVerificationFooter.tsx @@ -31,4 +31,3 @@ export const PdfVerificationFooter: React.FC = (props) => { ); }; -export default PdfVerificationFooter; diff --git a/ui-community/src/components/testing/verification/PdfVerificationInformation.tsx b/ui-community/src/components/testing/verification/PdfVerificationInformation.tsx index 94e00585..496e4ab4 100644 --- a/ui-community/src/components/testing/verification/PdfVerificationInformation.tsx +++ b/ui-community/src/components/testing/verification/PdfVerificationInformation.tsx @@ -64,4 +64,3 @@ export const PdfVerificationInformation: React.FC = (props) ); }; -export default PdfVerificationInformation; diff --git a/ui-community/src/components/testing/verification/PdfVerificationSection.tsx b/ui-community/src/components/testing/verification/PdfVerificationSection.tsx index 35cf4d53..d3c99b1b 100644 --- a/ui-community/src/components/testing/verification/PdfVerificationSection.tsx +++ b/ui-community/src/components/testing/verification/PdfVerificationSection.tsx @@ -1,9 +1,9 @@ import React from 'react'; import { View, StyleSheet, Image } from '@react-pdf/renderer'; import SideBarImage from '../test-images/SideBarImage.png'; -import PdfApplicantCertification from '../eif/PdfApplicantCertification'; -import PdfIdentificationCertification from '../eif/PdfIdentificationCertification'; -import PdfVerificationInformation from './PdfVerificationInformation'; +import { PdfApplicantCertification } from '../eif/PdfApplicantCertification'; +import { PdfIdentificationCertification } from '../eif/PdfIdentificationCertification'; +import { PdfVerificationInformation } from './PdfVerificationInformation'; interface PdfDisclaimersProps { data: any; @@ -39,4 +39,3 @@ export const PdfVerificationSection: React.FC = (props) => ); }; -export default PdfVerificationSection; diff --git a/ui-community/src/components/testing/verification/PdfVerificationSignatureFooter.tsx b/ui-community/src/components/testing/verification/PdfVerificationSignatureFooter.tsx index 22a00902..6c94530a 100644 --- a/ui-community/src/components/testing/verification/PdfVerificationSignatureFooter.tsx +++ b/ui-community/src/components/testing/verification/PdfVerificationSignatureFooter.tsx @@ -41,4 +41,3 @@ export const PdfVerificationSignatureFooter: React.FC ); }; -export default PdfVerificationSignatureFooter; diff --git a/ui-community/src/components/testing/verification/PdfVerificationSignatureInformation.tsx b/ui-community/src/components/testing/verification/PdfVerificationSignatureInformation.tsx index 1fe60ca3..906e762e 100644 --- a/ui-community/src/components/testing/verification/PdfVerificationSignatureInformation.tsx +++ b/ui-community/src/components/testing/verification/PdfVerificationSignatureInformation.tsx @@ -62,4 +62,3 @@ export const PdfVerificationSignatureInformation: React.FC ); }; -export default PdfVerificationSignatureInformation; diff --git a/ui-community/src/config/feature-flag-config.tsx b/ui-community/src/config/feature-flag-config.tsx index 332c391e..2c6211e9 100644 --- a/ui-community/src/config/feature-flag-config.tsx +++ b/ui-community/src/config/feature-flag-config.tsx @@ -12,7 +12,7 @@ let axiosHeaders = async (config: AxiosRequestConfig) => { return config; }; -const featureFlagConfig: FeatureFlagConfig = { +export const featureFlagConfig: FeatureFlagConfig = { cache: 60 * 1000, //1 minute url: import.meta.env.VITE_FEATURE_FLAG_URL ?? "", @@ -27,4 +27,3 @@ export const storybookFeatureFlagConfig: FeatureFlagConfig = { fallbackFlagValues: defaultValues, axiosRequestConfig: axiosHeaders }; -export default featureFlagConfig; diff --git a/ui-community/src/contexts/ThemeContext.tsx b/ui-community/src/contexts/ThemeContext.tsx index 23dfa615..0a4f9ff8 100644 --- a/ui-community/src/contexts/ThemeContext.tsx +++ b/ui-community/src/contexts/ThemeContext.tsx @@ -1,8 +1,8 @@ import { Button, theme } from 'antd'; import { ReactNode, createContext, useEffect, useState } from 'react'; -import ModalPopUp from './components/ModalPopUp'; -import MaintenanceMessage from '../components/shared/maintenance-message/maintenance-message'; -import ImpendingMessage from '../components/shared/maintenance-message/impending-message'; +import { ModalPopUp } from './components/ModalPopUp'; +import { MaintenanceMessage } from '../components/shared/maintenance-message/maintenance-message'; +import { ImpendingMessage } from '../components/shared/maintenance-message/impending-message'; import { useMaintenanceMessage } from '../components/shared/maintenance-message'; interface ThemeContextType { diff --git a/ui-community/src/contexts/components/ModalPopUp.tsx b/ui-community/src/contexts/components/ModalPopUp.tsx index 4f6d2ef0..897e7e98 100644 --- a/ui-community/src/contexts/components/ModalPopUp.tsx +++ b/ui-community/src/contexts/components/ModalPopUp.tsx @@ -2,7 +2,8 @@ import { Dialog, Transition } from '@headlessui/react'; import { Button } from 'antd'; import { Fragment, useContext, useState } from 'react'; import { ThemeContext } from '../ThemeContext'; -const ModalPopUp = () => { + +export const ModalPopUp = () => { const { currentTokens, setTheme } = useContext(ThemeContext); let [isOpen, setIsOpen] = useState(false); @@ -104,5 +105,3 @@ const ModalPopUp = () => { ); }; - -export default ModalPopUp; diff --git a/ui-community/src/customThemes/index.tsx b/ui-community/src/customThemes/index.tsx index 049ac9b6..ab319ea6 100644 --- a/ui-community/src/customThemes/index.tsx +++ b/ui-community/src/customThemes/index.tsx @@ -1,5 +1,5 @@ import { theme } from 'antd' -const customTheme=(themeType:string)=>{ +export const customTheme=(themeType:string)=>{ const seedTokenValue=theme.defaultSeed let modifiedToken; if(themeType==="light"){ @@ -22,6 +22,4 @@ const customTheme=(themeType:string)=>{ return modifiedToken -} - -export default customTheme \ No newline at end of file +} \ No newline at end of file diff --git a/ui-community/src/hooks/useAddPaymentMethodModal.tsx b/ui-community/src/hooks/useAddPaymentMethodModal.tsx index 478d42e6..4dd99c07 100644 --- a/ui-community/src/hooks/useAddPaymentMethodModal.tsx +++ b/ui-community/src/hooks/useAddPaymentMethodModal.tsx @@ -6,10 +6,8 @@ interface AddPaymentMethodModalStore { onClose: () => void; } -const useAddPaymentMethodModal = create((set: any) => ({ +export const useAddPaymentMethodModal = create((set: any) => ({ isOpen: false, onOpen: () => set({ isOpen: true }), onClose: () => set({ isOpen: false }) })); - -export default useAddPaymentMethodModal; diff --git a/ui-community/src/hooks/useEditPaymentMethodModal.tsx b/ui-community/src/hooks/useEditPaymentMethodModal.tsx index 039a3ad9..c7b3af5b 100644 --- a/ui-community/src/hooks/useEditPaymentMethodModal.tsx +++ b/ui-community/src/hooks/useEditPaymentMethodModal.tsx @@ -10,7 +10,7 @@ interface EditPaymentMethodModalStore { setPaymentInstrument: (paymentInstrument: PaymentInstrument) => void; } -const useEditPaymentMethodModal = create((set: any) => ({ +export const useEditPaymentMethodModal = create((set: any) => ({ isOpen: false, onOpen: () => set({ isOpen: true }), onClose: () => set({ isOpen: false }), @@ -19,4 +19,3 @@ const useEditPaymentMethodModal = create((set: any) setPaymentInstrument: (paymentInstrument: PaymentInstrument) => set({ paymentInstrument }) })); -export default useEditPaymentMethodModal; diff --git a/ui-community/src/hooks/usePayModal.tsx b/ui-community/src/hooks/usePayModal.tsx index 8a2af6b8..9d12ebdc 100644 --- a/ui-community/src/hooks/usePayModal.tsx +++ b/ui-community/src/hooks/usePayModal.tsx @@ -6,10 +6,8 @@ interface PayModalStore { onClose: () => void; } -const usePayModal = create((set: any) => ({ +export const usePayModal = create((set: any) => ({ isOpen: false, onOpen: () => set({ isOpen: true }), onClose: () => set({ isOpen: false }) })); - -export default usePayModal; diff --git a/ui-community/src/main.tsx b/ui-community/src/main.tsx index ed46b095..91a10e4f 100644 --- a/ui-community/src/main.tsx +++ b/ui-community/src/main.tsx @@ -11,7 +11,7 @@ import './index.less'; import { ConfigProvider } from 'antd'; import FeatureFlagProvider from './components/shared/feature-flag-react-lite'; -import featureFlagConfig from './config/feature-flag-config'; +import { featureFlagConfig } from './config/feature-flag-config'; import { CachePurgeProvider } from './contexts/components/CachePurgeContext'; import { ThemeContext, ThemeProvider } from './contexts/ThemeContext'; From 11b3050d7817412ce5cd92e285c6ecf8ba3567f3 Mon Sep 17 00:00:00 2001 From: dev-kishor Date: Tue, 31 Dec 2024 20:10:34 +0530 Subject: [PATCH 3/7] test commit --- ui-community/src/components/layouts/admin/index.tsx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ui-community/src/components/layouts/admin/index.tsx b/ui-community/src/components/layouts/admin/index.tsx index 3cefad38..c3312a84 100644 --- a/ui-community/src/components/layouts/admin/index.tsx +++ b/ui-community/src/components/layouts/admin/index.tsx @@ -29,6 +29,8 @@ export interface PageLayoutProps { } export const Admin: React.FC = (_props) => { + + console.log("test") const params = useParams(); const pathLocations = { From 73fedf351a8e5561fd6ea7234f5aedab07c1fcbf Mon Sep 17 00:00:00 2001 From: Duy Nguyen Date: Thu, 19 Dec 2024 14:58:42 -0600 Subject: [PATCH 4/7] make code consistent --- .../index.ts | 57 ++++++++++++------- .../index.ts | 14 +++-- .../index.ts | 3 +- .../v1/service-ticket.search.ts | 13 +---- .../property/property.search.ts | 15 +---- .../handlers/update-search-index-helpers.ts | 2 +- .../functions/core/initialize-function-app.ts | 2 +- .../infrastructure-services-builder.ts | 5 +- 8 files changed, 61 insertions(+), 50 deletions(-) diff --git a/data-access/seedwork/services-seedwork-cognitive-search-az/index.ts b/data-access/seedwork/services-seedwork-cognitive-search-az/index.ts index fca4eb31..1305fc33 100644 --- a/data-access/seedwork/services-seedwork-cognitive-search-az/index.ts +++ b/data-access/seedwork/services-seedwork-cognitive-search-az/index.ts @@ -4,6 +4,7 @@ import { CognitiveSearchBase } from "../services-seedwork-cognitive-search-inter export class AzCognitiveSearch implements CognitiveSearchBase { private client: SearchIndexClient; + private searchClients: Map> = new Map>(); tryGetEnvVar(envVar: string): string { const value = process.env[envVar]; @@ -25,30 +26,34 @@ export class AzCognitiveSearch implements CognitiveSearchBase { this.client = new SearchIndexClient(endpoint, credentials); } + async initializeSearchClients(): Promise { + const indexNames = this.client.listIndexesNames(); + for await (const indexName of indexNames) { + this.searchClients.set(indexName, this.client.getSearchClient(indexName)); + } + } + + // check if index exists async indexExists(indexName: string): Promise { - const indexes = await this.client.listIndexesNames(); - for await (const name of indexes) { - if (name === indexName) { - return true; - } - } - return false; + return this.searchClients.has(indexName); } - async createIndexIfNotExists(indexName: string, indexDefinition: SearchIndex): Promise { - const indexExists = await this.indexExists(indexName); + async createIndexIfNotExists(indexDefinition: SearchIndex): Promise { + const indexExists = this.indexExists(indexDefinition.name); if (!indexExists) { await this.client.createIndex(indexDefinition); - console.log(`Index ${indexName} created`); + this.searchClients.set(indexDefinition.name, this.client.getSearchClient(indexDefinition.name)); + console.log(`Index ${indexDefinition.name} created`); } } async createOrUpdateIndexDefinition(indexName: string, indexDefinition: SearchIndex): Promise { try { - const indexExists = await this.indexExists(indexName); + const indexExists = this.indexExists(indexName); if (!indexExists) { await this.client.createIndex(indexDefinition); + this.searchClients.set(indexDefinition.name, this.client.getSearchClient(indexDefinition.name)); } else { await this.client.createOrUpdateIndex(indexDefinition); console.log(`Index ${indexName} updated`); @@ -59,23 +64,37 @@ export class AzCognitiveSearch implements CognitiveSearchBase { } async search(indexName: string, searchText: string, options?: any): Promise>> { - let searchClient = this.client.getSearchClient(indexName); - const result = await searchClient.search(searchText, options); - console.log("search result", result); - return result; + const startTime = new Date(); + const result = await this.searchClients.get(indexName).search(searchText, options); + const endTime = new Date(); + console.log(`SearchLibrary took ${endTime.getTime() - startTime.getTime()}ms`); + return result } async deleteDocument(indexName: string, document: any): Promise { - await this.client.getSearchClient(indexName).deleteDocuments([document]); + try { + await this.searchClients.get(indexName).deleteDocuments([document]); + } catch (error) { + throw new Error(`Failed to delete document from index ${indexName}: ${error.message}`); + } } async indexDocument(indexName: string, document: any): Promise { - const searchClient = this.client.getSearchClient(indexName); - searchClient.mergeOrUploadDocuments([document]); + try { + await this.searchClients.get(indexName).mergeOrUploadDocuments([document]); + } catch (error) { + throw new Error(`Failed to index document in index ${indexName}: ${error.message}`); + } } async deleteIndex(indexName: string): Promise { - return this.client.deleteIndex(indexName); + try { + await this.client.deleteIndex(indexName); + this.searchClients.delete(indexName); + console.log(`Index ${indexName} deleted`); + } catch (error) { + throw new Error(`Failed to delete index ${indexName}: ${error.message}`); + } } // async updateIndex(indexName: string) { diff --git a/data-access/seedwork/services-seedwork-cognitive-search-in-memory/index.ts b/data-access/seedwork/services-seedwork-cognitive-search-in-memory/index.ts index 43c2d351..32701e5c 100644 --- a/data-access/seedwork/services-seedwork-cognitive-search-in-memory/index.ts +++ b/data-access/seedwork/services-seedwork-cognitive-search-in-memory/index.ts @@ -6,13 +6,14 @@ export interface IMemoryCognitiveSearchCollection; } export interface IMemoryCognitiveSearch { - createIndexIfNotExists(indexName: string, indexDefinition: SearchIndex): Promise; + createIndexIfNotExists(indexDefinition: SearchIndex): Promise; createOrUpdateIndexDefinition(indexName: string, indexDefinition: SearchIndex): Promise; deleteDocument(indexName: string, document: any): Promise; indexDocument(indexName: string, document: any): Promise; search(indexName: string, searchText: string, options?: any): Promise; indexExists(indexName: string): Promise; logSearchCollectionIndexMap(): void; + } @@ -45,14 +46,19 @@ export class MemoryCognitiveSearch implements IMemoryCognitiveSearch, CognitiveS this.searchCollectionIndexMap = new Map>(); this.searchCollectionIndexDefinitionMap = new Map(); } + initializeSearchClients(): Promise { + throw new Error("Method not implemented."); + } deleteIndex(indexName: string): Promise { throw new Error("Method not implemented."); } - async createIndexIfNotExists(indexName: string, indexDefinition: SearchIndex): Promise { - if (this.searchCollectionIndexMap.has(indexName)) return; - this.createNewIndex(indexName, indexDefinition); + async createIndexIfNotExists(indexDefinition: SearchIndex): Promise { + if (this.searchCollectionIndexMap.has(indexDefinition.name)) { + return; + } + this.createNewIndex(indexDefinition.name, indexDefinition); } private createNewIndex(indexName: string, indexDefinition: SearchIndex) { this.searchCollectionIndexDefinitionMap.set(indexName, indexDefinition); diff --git a/data-access/seedwork/services-seedwork-cognitive-search-interfaces/index.ts b/data-access/seedwork/services-seedwork-cognitive-search-interfaces/index.ts index 67cd54ab..4e3fe60d 100644 --- a/data-access/seedwork/services-seedwork-cognitive-search-interfaces/index.ts +++ b/data-access/seedwork/services-seedwork-cognitive-search-interfaces/index.ts @@ -3,10 +3,11 @@ export { SearchDocumentsResult, SearchIndex, GeographyPoint } from '@azure/searc export interface CognitiveSearchBase { - createIndexIfNotExists(indexName: string, indexDefinition: SearchIndex): Promise; + createIndexIfNotExists(indexDefinition: SearchIndex): Promise; createOrUpdateIndexDefinition(indexName: string, indexDefinition: SearchIndex): Promise; deleteDocument(indexName: string, document: any): Promise; indexDocument(indexName: string, document: any): Promise; deleteIndex(indexName: string): Promise; indexExists(indexName: string): Promise; + initializeSearchClients(): Promise; } \ No newline at end of file diff --git a/data-access/src/app/application-services/cases/service-ticket/v1/service-ticket.search.ts b/data-access/src/app/application-services/cases/service-ticket/v1/service-ticket.search.ts index 4d95e003..4aaa0dd0 100644 --- a/data-access/src/app/application-services/cases/service-ticket/v1/service-ticket.search.ts +++ b/data-access/src/app/application-services/cases/service-ticket/v1/service-ticket.search.ts @@ -49,7 +49,6 @@ export class ServiceTicketV1SearchApiImpl extends CognitiveSearchDataSource>> { let searchString = input.searchString.trim(); - console.log(`Resolver>Query>serviceTicketsSearch: ${searchString}`); let filterString = this.getFilterString(input.options.filter, memberId); - console.log('filterString: ', filterString); let searchResults: SearchDocumentsResult>; await this.withSearch(async (_passport, search) => { @@ -103,7 +100,6 @@ export class ServiceTicketV1SearchApiImpl extends CognitiveSearchDataSourceQuery>serviceTicketsSearch ${JSON.stringify(searchResults)}`); return searchResults; } @@ -113,9 +109,7 @@ export class ServiceTicketV1SearchApiImpl extends CognitiveSearchDataSourceQuery>serviceTicketsSearchAdmin: ${searchString}`); let filterString = this.getFilterStringAdmin(input ? input.options.filter : null, communityId); - console.log('filterString: ', filterString); let searchResults: SearchDocumentsResult>; await this.withSearch(async (_passport, search) => { @@ -129,7 +123,6 @@ export class ServiceTicketV1SearchApiImpl extends CognitiveSearchDataSourceQuery>serviceTicketsSearchAdmin ${JSON.stringify(searchResults)}`); return searchResults; } @@ -152,17 +145,17 @@ export class ServiceTicketV1SearchApiImpl extends CognitiveSearchDataSource>> { + async reIndexServiceTickets(): Promise>> { // drop index, create a brand new index await this.withSearch(async (_passport, searchService) => { await searchService.deleteIndex(ServiceTicketIndexSpec.name); - await searchService.createIndexIfNotExists(ServiceTicketIndexSpec.name, ServiceTicketIndexSpec); + await searchService.createIndexIfNotExists(ServiceTicketIndexSpec); }); const context = await ReadOnlyDomainExecutionContext(); const ids = await this.context.applicationServices.service.dataApi.getAllIds(); - await ServiceTicketV1UnitOfWork.withTransaction(context, ReadOnlyInfrastructureContext() ,async (repo) => { + await ServiceTicketV1UnitOfWork.withTransaction(context, ReadOnlyInfrastructureContext(), async (repo) => { const searchDocs: Partial[] = []; // loop through ids, get objects, convert to domain objects, convert to index document, update search index diff --git a/data-access/src/app/application-services/property/property.search.ts b/data-access/src/app/application-services/property/property.search.ts index 8f418472..edcd5ca1 100644 --- a/data-access/src/app/application-services/property/property.search.ts +++ b/data-access/src/app/application-services/property/property.search.ts @@ -101,7 +101,6 @@ export class PropertySearchApiImpl extends CognitiveSearchDataSource } } - console.log('filterStrings: ', filterStrings.join(' and ')); return filterStrings.join(' and '); } @@ -115,26 +114,17 @@ export class PropertySearchApiImpl extends CognitiveSearchDataSource } async propertiesSearch(input: PropertiesSearchInput): Promise { - let searchResults: SearchDocumentsResult>; await this.withSearch(async (_passport, searchService) => { // for the first time, create the index - const indexExists = await searchService.indexExists(PropertyListingIndexSpec.name); - if (!indexExists) { - console.log(`Index ${PropertyListingIndexSpec.name} does not exist, creating it...`); - await searchService.createIndexIfNotExists(PropertyListingIndexSpec.name, PropertyListingIndexSpec); - return undefined; - } + await searchService.createIndexIfNotExists(PropertyListingIndexSpec); let searchString = ''; if (!input.options.filter?.position) { searchString = input.searchString.trim(); } - - console.log(`Resolver>Query>propertiesSearch: ${searchString}`); + let filterString = this.getFilterString(input.options.filter); - console.log('filterString: ', filterString); - searchResults = await searchService.search('property-listings', searchString, { queryType: 'full', @@ -148,7 +138,6 @@ export class PropertySearchApiImpl extends CognitiveSearchDataSource }); }); - console.log(`Resolver>Query>propertiesSearch ${JSON.stringify(searchResults)}`); const results = this.convertToGraphqlResponse(searchResults, input); return results; } diff --git a/data-access/src/app/domain/events/handlers/update-search-index-helpers.ts b/data-access/src/app/domain/events/handlers/update-search-index-helpers.ts index 70e6d9c8..b5cabc82 100644 --- a/data-access/src/app/domain/events/handlers/update-search-index-helpers.ts +++ b/data-access/src/app/domain/events/handlers/update-search-index-helpers.ts @@ -12,7 +12,7 @@ export const generateHash = (indexDoc: Partial) => { const updateSearchIndex = async (cognitiveSearch: CognitiveSearchDomain, indexDefinition: SearchIndex, indexDoc: Partial) => { // for the first time, create the index - await cognitiveSearch.createIndexIfNotExists(indexDefinition.name, indexDefinition); + await cognitiveSearch.createIndexIfNotExists(indexDefinition); await cognitiveSearch.indexDocument(indexDefinition.name, indexDoc); console.log(`ID Case Updated - Index Updated: ${JSON.stringify(indexDoc)}`); }; diff --git a/data-access/src/functions/core/initialize-function-app.ts b/data-access/src/functions/core/initialize-function-app.ts index 3f17044f..ef023a89 100644 --- a/data-access/src/functions/core/initialize-function-app.ts +++ b/data-access/src/functions/core/initialize-function-app.ts @@ -29,7 +29,7 @@ export async function initializeFunctionApp() { await cosmosDbConnection.connect(); // Initialize the infrastructure services - InfrastructureServicesBuilder.initialize(); + await InfrastructureServicesBuilder.initialize(); const infrastructureServices = InfrastructureServicesBuilder.getInstance(); // Initialize the domain diff --git a/data-access/src/infrastructure-services-impl/infrastructure-services-builder.ts b/data-access/src/infrastructure-services-impl/infrastructure-services-builder.ts index 7bfb6359..f12a8218 100644 --- a/data-access/src/infrastructure-services-impl/infrastructure-services-builder.ts +++ b/data-access/src/infrastructure-services-impl/infrastructure-services-builder.ts @@ -97,11 +97,14 @@ export class InfrastructureServicesBuilder implements InfrastructureServices{ } private static _instance: InfrastructureServicesBuilder; - public static initialize(): void { + public static async initialize(): Promise { if (InfrastructureServicesBuilder._instance) { throw new Error('InfrastructureServicesBuilder is already initialized'); } InfrastructureServicesBuilder._instance = new InfrastructureServicesBuilder(); + await InfrastructureServicesBuilder._instance._cognitiveSearch.initializeSearchClients(); + + } public static getInstance(): InfrastructureServicesBuilder { if (!InfrastructureServicesBuilder._instance) { From 5b4f2718c5588370fe8528102492fe502084752d Mon Sep 17 00:00:00 2001 From: Duy Nguyen Date: Thu, 19 Dec 2024 15:00:37 -0600 Subject: [PATCH 5/7] use new library to make apollo server and azure function v4 work together --- data-access/package-lock.json | 58 ++++++++- data-access/package.json | 1 + .../http-graphql/http-graphql.function.ts | 8 +- .../functions/http-graphql/init/func-v4.ts | 112 ------------------ 4 files changed, 62 insertions(+), 117 deletions(-) delete mode 100644 data-access/src/functions/http-graphql/init/func-v4.ts diff --git a/data-access/package-lock.json b/data-access/package-lock.json index 6cd85bd8..99fe1f4a 100644 --- a/data-access/package-lock.json +++ b/data-access/package-lock.json @@ -10,6 +10,7 @@ "@apollo/server": "^4.6.0", "@apollo/server-plugin-response-cache": "^4.1.2", "@apollo/utils.keyvaluecache": "^3.0.0", + "@as-integrations/azure-functions": "^0.2.0", "@azure/arm-maps": "^3.1.0-beta.1", "@azure/cognitiveservices-contentmoderator": "^5.0.1", "@azure/functions": "^4.2.0", @@ -510,6 +511,40 @@ "node": ">=14" } }, + "node_modules/@as-integrations/azure-functions": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/@as-integrations/azure-functions/-/azure-functions-0.2.0.tgz", + "integrity": "sha512-MlEzVStOrmHPcLAOthNuqz451sj2In5tlbywg9Cd64KoK0kDtXszOAiyv25lef8MtsC8aj7OWEiLkQaI+47fgw==", + "dependencies": { + "@apollo/server": "^4.1.1", + "@azure/functions": "^3.2.0", + "@azure/functions-v4": "npm:@azure/functions@^4.5.0", + "graphql": "^16.6.0", + "graphql-tag": "^2.12.6", + "undici": "^5.27.2" + }, + "engines": { + "node": ">=18.0" + } + }, + "node_modules/@as-integrations/azure-functions/node_modules/@azure/functions": { + "version": "3.5.1", + "resolved": "https://registry.npmjs.org/@azure/functions/-/functions-3.5.1.tgz", + "integrity": "sha512-6UltvJiuVpvHSwLcK/Zc6NfUwlkDLOFFx97BHCJzlWNsfiWwzwmTsxJXg4kE/LemKTHxPpfoPE+kOJ8hAdiKFQ==", + "dependencies": { + "iconv-lite": "^0.6.3", + "long": "^4.0.0", + "uuid": "^8.3.0" + } + }, + "node_modules/@as-integrations/azure-functions/node_modules/uuid": { + "version": "8.3.2", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz", + "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==", + "bin": { + "uuid": "dist/bin/uuid" + } + }, "node_modules/@aws-crypto/crc32": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/@aws-crypto/crc32/-/crc32-3.0.0.tgz", @@ -1395,6 +1430,28 @@ "node": ">=18.0" } }, + "node_modules/@azure/functions-v4": { + "name": "@azure/functions", + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/@azure/functions/-/functions-4.6.0.tgz", + "integrity": "sha512-vGq9jXlgrJ3KaI8bepgfpk26zVY8vFZsQukF85qjjKTAR90eFOOBNaa+mc/0ViDY2lcdrU2fL/o1pQyZUtTDsw==", + "dependencies": { + "cookie": "^0.7.0", + "long": "^4.0.0", + "undici": "^5.13.0" + }, + "engines": { + "node": ">=18.0" + } + }, + "node_modules/@azure/functions-v4/node_modules/cookie": { + "version": "0.7.2", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.7.2.tgz", + "integrity": "sha512-yki5XnKuf750l50uGTllt6kKILY4nQ1eNIQatoXEByZ5dWgnKqbnqmTrBE5B4N7lrMJKQ2ytWMiTO2o0v6Ew/w==", + "engines": { + "node": ">= 0.6" + } + }, "node_modules/@azure/identity": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/@azure/identity/-/identity-2.1.0.tgz", @@ -10170,7 +10227,6 @@ "version": "2.12.6", "resolved": "https://registry.npmjs.org/graphql-tag/-/graphql-tag-2.12.6.tgz", "integrity": "sha512-FdSNcu2QQcWnM2VNvSCCDCVS5PpPqpzgFT8+GXzqJuoDd0CBncxCY278u4mhRO7tMgo2JjgJA5aZ+nWSQ/Z+xg==", - "dev": true, "dependencies": { "tslib": "^2.1.0" }, diff --git a/data-access/package.json b/data-access/package.json index ab753162..acd06f67 100644 --- a/data-access/package.json +++ b/data-access/package.json @@ -52,6 +52,7 @@ "@apollo/server": "^4.6.0", "@apollo/server-plugin-response-cache": "^4.1.2", "@apollo/utils.keyvaluecache": "^3.0.0", + "@as-integrations/azure-functions": "^0.2.0", "@azure/arm-maps": "^3.1.0-beta.1", "@azure/cognitiveservices-contentmoderator": "^5.0.1", "@azure/functions": "^4.2.0", diff --git a/data-access/src/functions/http-graphql/http-graphql.function.ts b/data-access/src/functions/http-graphql/http-graphql.function.ts index 5286c334..320e2234 100644 --- a/data-access/src/functions/http-graphql/http-graphql.function.ts +++ b/data-access/src/functions/http-graphql/http-graphql.function.ts @@ -1,17 +1,17 @@ import { wrapFunctionHandler } from '../core/telemetry/wrapper'; +import { v4 } from '@as-integrations/azure-functions'; import { app } from '@azure/functions'; import { PortalTokenValidation } from '../../../seedwork/auth-seedwork-oidc/portal-token-validation'; -import { GraphqlContextBuilder as ApolloContext } from './init/graphql-context-builder'; -import { startServerAndCreateHandler } from './init/func-v4'; // to be replaced by @as-integrations/azure-functions after PR is merged import { InfrastructureServicesBuilder } from '../../infrastructure-services-impl/infrastructure-services-builder'; - +import { GraphqlContextBuilder as ApolloContext } from './init/graphql-context-builder'; import { ApolloServerRequestHandler } from './init/apollo-server-request-handler'; + app.http('graphql', { methods: ['GET', 'POST', 'PATCH', 'PUT', 'DELETE', 'OPTIONS', 'HEAD'], route: 'graphql/{*segments}', handler: wrapFunctionHandler( - startServerAndCreateHandler(ApolloServerRequestHandler.getInstance().apolloServer, { + v4.startServerAndCreateHandler(ApolloServerRequestHandler.getInstance().apolloServer, { context: async ({ req }) => { let context = new ApolloContext(InfrastructureServicesBuilder.getInstance(), PortalTokenValidation.getInstance()); await context.init(req); diff --git a/data-access/src/functions/http-graphql/init/func-v4.ts b/data-access/src/functions/http-graphql/init/func-v4.ts deleted file mode 100644 index 95cea7e2..00000000 --- a/data-access/src/functions/http-graphql/init/func-v4.ts +++ /dev/null @@ -1,112 +0,0 @@ -// https://github.com/apollo-server-integrations/apollo-server-integration-azure-functions/pull/66 -// To be removed when pull request is merged into package @as-integrations/azure-functions - - -import { - ApolloServer, - BaseContext, - ContextFunction, - HTTPGraphQLRequest, - HeaderMap, -} from '@apollo/server'; -import type { - HttpHandler, - HttpRequest, - InvocationContext, -} from '@azure/functions'; - -import type { WithRequired } from '@apollo/utils.withrequired'; - -export interface AzureFunctionsContextFunctionArgument { - context: InvocationContext; - req: HttpRequest; -} - -export interface AzureFunctionsMiddlewareOptions { - context?: ContextFunction<[AzureFunctionsContextFunctionArgument], TContext>; -} - -const defaultContext: ContextFunction< - [AzureFunctionsContextFunctionArgument], - any -> = async () => ({}); - -export function startServerAndCreateHandler( - server: ApolloServer, - options?: AzureFunctionsMiddlewareOptions, -): HttpHandler; -export function startServerAndCreateHandler( - server: ApolloServer, - options: WithRequired, 'context'>, -): HttpHandler; -export function startServerAndCreateHandler( - server: ApolloServer, - options?: AzureFunctionsMiddlewareOptions, -): HttpHandler { - server.startInBackgroundHandlingStartupErrorsByLoggingAndFailingAllRequests(); - return async (req: HttpRequest, context: InvocationContext) => { - const contextFunction = options?.context ?? defaultContext; - try { - const normalizedRequest = await normalizeRequest(req); - - const { body, headers, status } = await server.executeHTTPGraphQLRequest({ - httpGraphQLRequest: normalizedRequest, - context: () => contextFunction({ context, req }), - }); - - if (body.kind === 'chunked') { - throw Error('Incremental delivery not implemented'); - } - - return { - status: status || 200, - headers: { - ...Object.fromEntries(headers), - 'content-length': Buffer.byteLength(body.string).toString(), - }, - body: body.string, - }; - } catch (e) { - context.error('Failure processing GraphQL request', e); - return { - status: 400, - body: (e as Error).message, - }; - } - }; -} - -async function normalizeRequest(req: HttpRequest): Promise { - if (!req.method) { - throw new Error('No method'); - } - - return { - method: req.method, - headers: normalizeHeaders(req), - search: new URL(req.url).search, - body: await parseBody(req), - }; -} - -async function parseBody(req: HttpRequest): Promise { - const isValidContentType = req.headers - .get('content-type') - ?.startsWith('application/json'); - const isValidPostRequest = req.method === 'POST' && isValidContentType; - - if (isValidPostRequest) { - return req.json(); - } - - return null; -} - -function normalizeHeaders(req: HttpRequest): HeaderMap { - const headerMap = new HeaderMap(); - - for (const [key, value] of req.headers.entries()) { - headerMap.set(key, value ?? ''); - } - return headerMap; -} From 653f49ea53cd7dc49465f06fc40a3166251d6352 Mon Sep 17 00:00:00 2001 From: Duy Nguyen Date: Thu, 19 Dec 2024 16:45:47 -0600 Subject: [PATCH 6/7] clean up, apply AI suggestions, remove searchKey params --- .../index.test.ts | 3 +- .../index.ts | 38 ++++++++++--------- .../index.ts | 1 - .../handlers/update-search-index-helpers.ts | 3 +- .../cognitive-search/az/impl.ts | 4 +- .../infrastructure-services-builder.ts | 6 +-- 6 files changed, 27 insertions(+), 28 deletions(-) diff --git a/data-access/seedwork/services-seedwork-cognitive-search-az/index.test.ts b/data-access/seedwork/services-seedwork-cognitive-search-az/index.test.ts index 05e6235e..e9a82048 100644 --- a/data-access/seedwork/services-seedwork-cognitive-search-az/index.test.ts +++ b/data-access/seedwork/services-seedwork-cognitive-search-az/index.test.ts @@ -11,9 +11,8 @@ beforeAll(() => { let cognitiveSearch; beforeEach(() => { - const searchKey = process.env.SEARCH_API_KEY; const endpoint = process.env.SEARCH_API_ENDPOINT; - cognitiveSearch = new AzCognitiveSearch(searchKey, endpoint); + cognitiveSearch = new AzCognitiveSearch(endpoint); }); test.skip('Initialize cognitive search object', () => { diff --git a/data-access/seedwork/services-seedwork-cognitive-search-az/index.ts b/data-access/seedwork/services-seedwork-cognitive-search-az/index.ts index 1305fc33..2fea512e 100644 --- a/data-access/seedwork/services-seedwork-cognitive-search-az/index.ts +++ b/data-access/seedwork/services-seedwork-cognitive-search-az/index.ts @@ -1,6 +1,6 @@ -import { DefaultAzureCredential, DefaultAzureCredentialOptions, TokenCredential } from "@azure/identity"; -import { SearchIndexClient, SearchClient, SearchIndex, SearchDocumentsResult, AzureKeyCredential } from "@azure/search-documents"; -import { CognitiveSearchBase } from "../services-seedwork-cognitive-search-interfaces"; +import { DefaultAzureCredential, DefaultAzureCredentialOptions, TokenCredential } from '@azure/identity'; +import { SearchIndexClient, SearchClient, SearchIndex, SearchDocumentsResult, AzureKeyCredential } from '@azure/search-documents'; +import { CognitiveSearchBase } from '../services-seedwork-cognitive-search-interfaces'; export class AzCognitiveSearch implements CognitiveSearchBase { private client: SearchIndexClient; @@ -14,9 +14,9 @@ export class AzCognitiveSearch implements CognitiveSearchBase { return value; } - constructor(searchKey: string, endpoint: string) { + constructor(endpoint: string) { let credentials: TokenCredential; - if (process.env.NODE_ENV === "development" || process.env.NODE_ENV === "test") { + if (process.env.NODE_ENV === 'development' || process.env.NODE_ENV === 'test') { credentials = new DefaultAzureCredential(); } else if (process.env.MANAGED_IDENTITY_CLIENT_ID !== undefined) { credentials = new DefaultAzureCredential({ ManangedIdentityClientId: process.env.MANAGED_IDENTITY_CLIENT_ID } as DefaultAzureCredentialOptions); @@ -26,14 +26,15 @@ export class AzCognitiveSearch implements CognitiveSearchBase { this.client = new SearchIndexClient(endpoint, credentials); } - async initializeSearchClients(): Promise { - const indexNames = this.client.listIndexesNames(); - for await (const indexName of indexNames) { - this.searchClients.set(indexName, this.client.getSearchClient(indexName)); + private getSearchClient(indexName: string): SearchClient { + let client = this.searchClients.get(indexName); + if (!client) { + client = this.client.getSearchClient(indexName); + this.searchClients.set(indexName, client); } + return client; } - // check if index exists async indexExists(indexName: string): Promise { return this.searchClients.has(indexName); @@ -42,9 +43,13 @@ export class AzCognitiveSearch implements CognitiveSearchBase { async createIndexIfNotExists(indexDefinition: SearchIndex): Promise { const indexExists = this.indexExists(indexDefinition.name); if (!indexExists) { - await this.client.createIndex(indexDefinition); - this.searchClients.set(indexDefinition.name, this.client.getSearchClient(indexDefinition.name)); - console.log(`Index ${indexDefinition.name} created`); + try { + await this.client.createIndex(indexDefinition); + this.searchClients.set(indexDefinition.name, this.client.getSearchClient(indexDefinition.name)); + console.log(`Index ${indexDefinition.name} created`); + } catch (error) { + throw new Error(`Failed to create index ${indexDefinition.name}: ${error.message}`); + } } } @@ -65,10 +70,9 @@ export class AzCognitiveSearch implements CognitiveSearchBase { async search(indexName: string, searchText: string, options?: any): Promise>> { const startTime = new Date(); - const result = await this.searchClients.get(indexName).search(searchText, options); - const endTime = new Date(); - console.log(`SearchLibrary took ${endTime.getTime() - startTime.getTime()}ms`); - return result + const result = await this.getSearchClient(indexName).search(searchText, options); + console.log(`SearchLibrary took ${new Date().getTime() - startTime.getTime()}ms`); + return result; } async deleteDocument(indexName: string, document: any): Promise { diff --git a/data-access/seedwork/services-seedwork-cognitive-search-interfaces/index.ts b/data-access/seedwork/services-seedwork-cognitive-search-interfaces/index.ts index 4e3fe60d..6ee71e8b 100644 --- a/data-access/seedwork/services-seedwork-cognitive-search-interfaces/index.ts +++ b/data-access/seedwork/services-seedwork-cognitive-search-interfaces/index.ts @@ -9,5 +9,4 @@ export interface CognitiveSearchBase { indexDocument(indexName: string, document: any): Promise; deleteIndex(indexName: string): Promise; indexExists(indexName: string): Promise; - initializeSearchClients(): Promise; } \ No newline at end of file diff --git a/data-access/src/app/domain/events/handlers/update-search-index-helpers.ts b/data-access/src/app/domain/events/handlers/update-search-index-helpers.ts index b5cabc82..5ec03876 100644 --- a/data-access/src/app/domain/events/handlers/update-search-index-helpers.ts +++ b/data-access/src/app/domain/events/handlers/update-search-index-helpers.ts @@ -6,8 +6,7 @@ import { SearchIndex } from "@azure/search-documents"; export const generateHash = (indexDoc: Partial) => { const docCopy = JSON.parse(JSON.stringify(indexDoc)); delete docCopy.updatedAt; - const hash = crypto.createHash("sha256").update(JSON.stringify(docCopy)).digest("base64"); - return hash; + return crypto.createHash("sha256").update(JSON.stringify(docCopy)).digest("base64"); }; const updateSearchIndex = async (cognitiveSearch: CognitiveSearchDomain, indexDefinition: SearchIndex, indexDoc: Partial) => { diff --git a/data-access/src/infrastructure-services-impl/cognitive-search/az/impl.ts b/data-access/src/infrastructure-services-impl/cognitive-search/az/impl.ts index 76ccf35e..24f4d2e5 100644 --- a/data-access/src/infrastructure-services-impl/cognitive-search/az/impl.ts +++ b/data-access/src/infrastructure-services-impl/cognitive-search/az/impl.ts @@ -9,8 +9,8 @@ export class AzCognitiveSearchImpl extends AzCognitiveSearch implements Cognitiv ** MANAGED_IDENTITY_CLIENT_ID: DefaultAzureCredentialOptions * */ - constructor(searchKey: string, endpoint: string) { - super(searchKey, endpoint); + constructor(endpoint: string) { + super( endpoint); } startup = async (): Promise => { diff --git a/data-access/src/infrastructure-services-impl/infrastructure-services-builder.ts b/data-access/src/infrastructure-services-impl/infrastructure-services-builder.ts index f12a8218..423afa44 100644 --- a/data-access/src/infrastructure-services-impl/infrastructure-services-builder.ts +++ b/data-access/src/infrastructure-services-impl/infrastructure-services-builder.ts @@ -73,9 +73,8 @@ export class InfrastructureServicesBuilder implements InfrastructureServices{ } private InitCognitiveSearch(): CognitiveSearchInfrastructureService { - const searchKey = tryGetEnvVar('SEARCH_API_KEY'); const endpoint = tryGetEnvVar('SEARCH_API_ENDPOINT'); - return new AzCognitiveSearchImpl(searchKey, endpoint); + return new AzCognitiveSearchImpl(endpoint); } private InitBlobStorage(): BlobStorageInfrastructureService { @@ -97,12 +96,11 @@ export class InfrastructureServicesBuilder implements InfrastructureServices{ } private static _instance: InfrastructureServicesBuilder; - public static async initialize(): Promise { + public static initialize(): void { if (InfrastructureServicesBuilder._instance) { throw new Error('InfrastructureServicesBuilder is already initialized'); } InfrastructureServicesBuilder._instance = new InfrastructureServicesBuilder(); - await InfrastructureServicesBuilder._instance._cognitiveSearch.initializeSearchClients(); } From e10dd8fa0ae1fa28f91a6b2032ee1dd619d24300 Mon Sep 17 00:00:00 2001 From: Duy Nguyen Date: Fri, 20 Dec 2024 09:26:04 -0600 Subject: [PATCH 7/7] revert back to original code for I don't use the cognitive initializeSearchClients() any more --- data-access/src/functions/core/initialize-function-app.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data-access/src/functions/core/initialize-function-app.ts b/data-access/src/functions/core/initialize-function-app.ts index ef023a89..3f17044f 100644 --- a/data-access/src/functions/core/initialize-function-app.ts +++ b/data-access/src/functions/core/initialize-function-app.ts @@ -29,7 +29,7 @@ export async function initializeFunctionApp() { await cosmosDbConnection.connect(); // Initialize the infrastructure services - await InfrastructureServicesBuilder.initialize(); + InfrastructureServicesBuilder.initialize(); const infrastructureServices = InfrastructureServicesBuilder.getInstance(); // Initialize the domain