{"version":3,"file":"common-L-dYYVMf.js","sources":["../../src/helpers/TokenStorage.ts","../../src/api/helpers/Options.ts","../../src/api/helpers/Sender.ts","../../src/providers/AdvancedSearchProvider/AdvancedSearchProviderContext.tsx","../../src/api/services/Agencies.ts","../../src/providers/AgenciesProvider/AgenciesProviderContext.tsx","../../src/api/helpers/createSliceDefinitions.ts","../../src/common/constants.ts","../../src/components/ToastifyMessage/ToastifyMessage.tsx","../../src/helpers/DisplayToastMessage.tsx","../../src/providers/AuthProvider/AuthContext.tsx","../../src/providers/DialogProvider/DialogProviderContext.tsx","../../src/api/services/Documents.ts","../../src/providers/DocumentsProvider/DocumentsProviderContext.tsx","../../src/helpers/displayBackendErrorMessage.tsx","../../src/types/CommonStreetAbbrs.ts","../../src/helpers/Utils.ts","../../src/api/services/Policyholders.ts","../../src/api/services/PolicyEndorsement.ts","../../src/api/services/RuleEngineDecisions.ts","../../src/helpers/PricingBreakdownHelpers.ts","../../src/providers/UserProvider/UserProviderContext.tsx","../../src/hooks/useUser/useUser.ts","../../src/api/services/KeyValues.ts","../../src/helpers/QuestionEngine.ts","../../src/api/services/NewQuote.ts","../../src/api/services/ProductList.ts","../../src/api/queries/ConfigQueries.ts","../../src/hooks/useFieldConfig/useFieldConfig.tsx","../../src/hooks/useFieldConfig/useUnderwritingQuestionsFieldConfig.tsx","../../src/providers/EndorsementDetailProvider/EndorsementDetailProviderContext.tsx","../../src/providers/NotesProvider/NotesProviderContext.tsx","../../src/api/services/Policies.ts","../../src/providers/PolicyDetailProvider/PolicyDetailProviderContext.tsx","../../src/api/services/Quote.ts","../../src/hooks/useQuoteOrRenewal/useQuoteOrRenewal.tsx","../../src/providers/QuoteDetailProvider/QuoteDetailProviderContext.tsx","../../src/providers/RouterPromptProvider/RouterPromptProviderContext.tsx","../../src/api/services/SmartyAddress.ts","../../src/hooks/useAuth/useAuth.ts","../../src/hooks/useQuoteDetail/useQuoteDetail.ts","../../src/providers/TabProvider/TabContext.tsx","../../src/assets/images/logo-secondary.svg","../../src/components/Head/Head.tsx","../../src/components/StaticErrorPage/StaticErrorPage.tsx","../../src/assets/images/icon_decline.svg","../../src/assets/images/SendBack.svg","../../src/hooks/useDialog/useDialog.ts","../../src/store/helpers/createSliceDefinitions.ts","../../src/store/features/UI/UI.ts","../../src/store/useAppStore.ts","../../src/store/hooks/useAppSelector.ts","../../src/hooks/useFullscreenLoader/useFullscreenLoader.tsx","../../src/hooks/useAdvancedSearch/useAdvancedSearch.ts","../../src/hooks/useEscape/useEscape.tsx","../../src/components/AdvancedSearchInput/Panels/TabPanel.tsx","../../src/assets/images/Arrow.svg","../../src/assets/images/CalendarSchedule.svg","../../src/hooks/useTimezoneFormatter/useTimezoneFormatter.tsx","../../src/components/DatePickerComponent/DatePickerComponent.tsx","../../src/api/services/Agents.ts","../../src/helpers/MuiSharedStyles.ts","../../src/components/MultiSelectChips/MultiSelectChips.tsx","../../src/helpers/SplitChunks.ts","../../src/components/AdvancedSearchInput/SearchFieldParser.tsx","../../src/components/AdvancedSearchInput/AdvancedSearchInput.tsx","../../src/api/services/GlobalSearch.ts","../../src/components/Header/global-search-input.tsx","../../src/components/MenuComponent/MenuComponent.tsx","../../src/components/Header/Header.tsx","../../src/assets/images/icon_agencies.svg","../../src/assets/images/icon_agents.svg","../../src/assets/images/icon_consumer_sub.svg","../../src/assets/images/icon_policies.svg","../../src/assets/images/icon_renewals.svg","../../src/assets/images/icon_submissions.svg","../../src/components/LinkComponent/LinkComponent.tsx","../../src/components/Sidebar/SidebarLink/SidebarLink.tsx","../../src/components/Sidebar/SidebarRecentViewed/SidebarRecentViewed.tsx","../../src/components/Sidebar/SidebarContent/SidebarContent.tsx","../../src/components/Sidebar/DesktopDrawer/DesktopDrawer.tsx","../../src/components/Header/HeaderMobile/HeaderMobile.tsx","../../src/components/Sidebar/MobileDrawer/MobileDrawer.tsx","../../src/components/Sidebar/Sidebar.tsx","../../src/hooks/usePolicyDetail/usePolicyDetail.ts","../../src/layouts/quotePolicyEndorsementDefault/index.tsx","../../src/hooks/useEndorsementDetail/useEndorsementDetail.ts","../../src/components/LocationShow/LocationShow.tsx","../../src/components/PageHeader/PageHeader.tsx","../../src/components/DataGridPagination/DataGridPagination.tsx","../../src/components/TableViewPlaceholder/TableViewPlaceholder.tsx","../../src/components/DataTable/DataTable.tsx","../../src/assets/images/Search.svg","../../src/components/ViewSearch/ViewSearch.tsx","../../src/routes/Agents/constants.tsx","../../src/routes/Agents/components/agent-table.tsx","../../src/helpers/PreviousValue.tsx","../../src/api/queries/PoliciesQueries.ts","../../src/api/queries/AgentsQueries.ts","../../src/components/CustomNativeSelect/CustomNativeSelect.tsx","../../src/helpers/ScheduleModificationHelpers.ts","../../src/api/queries/KeyValueQueries.ts","../../src/components/PrimaryIndustrySearchInput/PrimaryIndustrySearchInput.tsx","../../src/components/ProductElectionButtons/ProductElectionButtons.tsx","../../src/components/QuotesOrRenewals/AgentFields/AgentFields.tsx","../../src/components/QuotesOrRenewals/NewSubmissionDialog/NewSubmissionDialog.tsx","../../src/components/TopActionBar/TopActionBar.tsx","../../src/components/TopActionBarButton/TopActionBarButton.tsx","../../src/helpers/FilterInvoicesData.ts","../../src/assets/images/CopyIcon.svg","../../src/hooks/useCopyToClipboard/useCopyToClipboard.ts","../../src/components/CopyButton/CopyButton.tsx","../../src/assets/images/icon_dropdowndownload.svg","../../src/components/Policies/PolicyDetail/Billing/InvoicesTable.tsx","../../src/components/Policies/PolicyDetail/Billing/PayInvoiceDialog.tsx","../../src/components/Policies/PolicyDetail/Billing/PaymentInfo.tsx","../../src/components/Policies/PolicyDetail/Billing/PaymentLinkDialog.tsx","../../src/components/Policies/PolicyDetail/Billing/TableFilters.tsx","../../src/hooks/useRouterPrompt/useRouterPrompt.ts","../../src/hooks/useTab/useTab.ts","../../src/components/LinkTab/LinkTab.tsx","../../src/assets/images/Check.svg","../../src/assets/images/ThreeEditIcon.svg","../../src/assets/images/flag.svg","../../src/components/SkeletonList/SkeletonList.tsx","../../src/hooks/useTransactionType/useTransactionType.tsx","../../src/components/QuotePolicyDetailEndorsement/PolicyHeaderInfo/PolicyFlagsDialog.tsx","../../src/components/QuotePolicyDetailEndorsement/PolicyHeaderInfo/PolicyHeaderInfo.tsx","../../src/components/QuotePolicyDetailEndorsement/ProducerHeaderInfo/ProducerHeaderInfo.tsx","../../src/components/StatusBox/StatusBox.tsx","../../src/components/Policies/PolicyDetail/Header/PolicyDetailHeader.tsx","../../src/api/services/Renewal.ts","../../src/assets/images/CancelIcon.svg","../../src/assets/images/icon_addnote.svg","../../src/assets/images/icon_attach_document.svg","../../src/assets/images/icon_documents-file.svg","../../src/assets/images/icon_generatecertificate.svg","../../src/assets/images/icon_policychange.svg","../../src/assets/images/icon_renewpolicy.svg","../../src/components/DrawerComponent/DrawerComponent.tsx","../../src/components/NumberFormatComponent/NumberFormatComponent.tsx","../../src/components/QuotePolicyDetailEndorsement/DrawerLoader/index.tsx","../../src/types/SmartyAddressTypes.ts","../../src/components/SmartyAutocompleteInput/SmartyAutocompleteInput.tsx","../../src/components/QuotePolicyDetailEndorsement/FieldParsers/LocationFieldParser.tsx","../../src/components/Certificate/GenerateCertificate/GenerateCertificateDrawer.tsx","../../src/components/NumberFormatComponent/DollarPrefixedNumberFormatComponent.tsx","../../src/components/DataTableFieldParser/ErrorTooltip.tsx","../../src/components/DataTableFieldParser/DataTableFieldParser.tsx","../../src/components/DataTablePro/DataTablePro.tsx","../../src/hooks/useDocuments/useDocuments.ts","../../src/components/Documents/DocumentFileUploader/DocumentFileUploader.tsx","../../src/components/Documents/AddDocument/AddDocumentDrawer.tsx","../../src/helpers/ScrollToFormikError.tsx","../../src/hooks/useNotes/useNotes.ts","../../src/components/Notes/AddNote/AddNoteDrawer.tsx","../../src/components/Policies/Cancellation/CancellationDialog.tsx","../../src/components/Policies/Endorsement/CreateEndorsement.tsx","../../src/components/Policies/Endorsement/Modals/CreateWcAuditEndorsement/CreateWcAuditEndorsement.tsx","../../src/components/Policies/Endorsement/Modals/CreateWcAuditEndorsement/index.tsx","../../src/assets/images/AlertInfo.svg","../../src/theme.ts","../../src/components/Policies/Endorsement/Modals/RenewPolicyDialog/RenewPolicyDialog.tsx","../../src/components/TopActionBarDivider/TopActionBarDivider.tsx","../../src/components/Policies/PolicyDetail/TopActionBar/PolicyDetailTopActionBar.tsx","../../src/helpers/ConvertFileSizeToBytes.ts","../../src/components/QuotePolicyDetailEndorsement/MoratoriumInfo/MoratoriumInfo.tsx","../../src/components/Policies/PolicyEndorsementDetail/Header/PolicyEndorsementDetailHeader.tsx","../../src/assets/images/file-blank-edit-pen.svg","../../src/assets/images/trash-delete-bin-2.svg","../../src/components/Policies/Endorsement/QuoteOrIssueEndorsementDialog.tsx","../../src/components/QuoteFieldErrorParser/FieldErrorModal.tsx","../../src/helpers/EventBus.ts","../../src/components/Policies/PolicyEndorsementDetail/TopActionBar/PolicyEndorsementDetailTopActionBar.tsx","../../src/components/Notes/Detail/NoteDetailDrawer.tsx","../../src/components/Notes/EditNote/EditNoteDrawer.tsx","../../src/components/TextBadge/TextBadge.tsx","../../src/components/VerticalTabs/VerticalTabs.tsx","../../src/components/QuotePolicyDetailEndorsement/FieldParsers/AdditionalInterestsDrawerFieldParser.tsx","../../src/components/TransactionDrawers/AdditionalInterestsDetailDrawer.tsx","../../src/components/QuotePolicyDetailEndorsement/FieldParsers/ClaimsHistoryDrawerFieldParser.tsx","../../src/components/TransactionDrawers/ClaimsHistoryEditDrawer.tsx","../../src/components/TransactionDrawers/LocationDetailDrawer.tsx","../../src/components/TransactionDrawers/AdditionalInterestsEditDrawer.tsx","../../src/components/PercentageTextfield/PercentageTextfield.tsx","../../src/components/ScheduleModTable/ScheduleModTableRow.tsx","../../src/components/ScheduleModTable/ScheduleModTable.tsx","../../src/components/TransactionDrawers/AutoExposureScheduleModDetailDrawer.tsx","../../src/components/TransactionDrawers/ClaimDetailDrawer.tsx","../../src/components/QuotePolicyDetailEndorsement/Inputs/LocationSelectInput/index.tsx","../../src/components/QuotePolicyDetailEndorsement/FieldParsers/ClassDrawerFieldParser/index.tsx","../../src/components/TransactionDrawers/helpers/index.ts","../../src/components/QuotePolicyDetailEndorsement/Inputs/WcClassCodeAutocomplete/index.tsx","../../src/components/TransactionDrawers/Inputs/WcClassCodeAutocomplete.tsx","../../src/components/TransactionDrawers/ClassDetailDrawer.tsx","../../src/components/TransactionDrawers/ClassEditDrawer.tsx","../../src/components/QuotePolicyDetailEndorsement/FieldParsers/DriverDrawerFieldParser.tsx","../../src/components/TransactionDrawers/DriverDetailDrawer.tsx","../../src/components/TransactionDrawers/DriverEditDrawer.tsx","../../src/components/QuotePolicyDetailEndorsement/FieldParsers/DrivingIncidentsDrawerFieldParser.tsx","../../src/components/TransactionDrawers/DrivingIncidentsDetailDrawer.tsx","../../src/components/TransactionDrawers/DrivingIncidentsEditDrawer.tsx","../../src/components/QuotePolicyDetailEndorsement/FieldParsers/ExpModFieldParser.tsx","../../src/components/TransactionDrawers/ExpModeDetailDrawer.tsx","../../src/api/services/Integrations/XMod.ts","../../src/helpers/ExpMod.ts","../../src/components/TransactionDrawers/ExpModeEditDrawer.tsx","../../src/components/QuotePolicyDetailEndorsement/FieldParsers/LiabilityExposurePerilDrawerFieldParser/index.tsx","../../src/components/TransactionDrawers/LiabilityExposurePerilDetailDrawer.tsx","../../src/components/TransactionDrawers/LiabilityExposurePerilEditDrawer.tsx","../../src/components/TransactionDrawers/LiabilityExposureScheduleModDetailDrawer.tsx","../../src/api/services/Integrations/Corelogic.ts","../../src/components/QuotePolicyDetailEndorsement/Location/OriginalSuggestedLocationsBox/OriginalSuggestedLocationBox.tsx","../../src/components/QuotePolicyDetailEndorsement/Location/LocationDrawerValidationContent/LocationDrawerValidationContent.tsx","../../src/components/TransactionDrawers/LocationEditDrawer.tsx","../../src/components/QuotePolicyDetailEndorsement/FieldParsers/OwnersMembersDrawerFieldParser/index.tsx","../../src/components/TransactionDrawers/OwnersMembersDetailDrawer.tsx","../../src/api/services/Integrations/LexisNexis.ts","../../src/helpers/Integrations/LexisNexis.ts","../../src/components/TransactionDrawers/OwnersMembersEditDrawer.tsx","../../src/assets/images/constructions/fireResistive.png","../../src/assets/images/constructions/frame.png","../../src/assets/images/constructions/joistedMasonry.png","../../src/assets/images/constructions/masonryNonCombustible.png","../../src/assets/images/constructions/modifiedFireResistive.png","../../src/assets/images/constructions/nonCombustible.png","../../src/assets/images/Question.svg","../../src/components/QuotePolicyDetailEndorsement/FieldParsers/PropertyDrawerFieldParser/index.tsx","../../src/components/TransactionDrawers/PropertyDetailDrawer.tsx","../../src/api/services/Integrations/Prometrix.ts","../../src/api/services/Integrations/Zesty.ts","../../src/components/TransactionDrawers/PropertyEditDrawer.tsx","../../src/components/TransactionDrawers/PropertyExposureScheduleModDetailDrawer.tsx","../../src/components/QuotePolicyDetailEndorsement/FieldParsers/VehicleDrawerFieldParser/index.tsx","../../src/components/MultiselectChekboxes/MultiselectChekboxes.tsx","../../src/components/QuestionEngineFieldParser/CustomInputs/Percentage/Percentage.tsx","../../src/components/QuestionEngineFieldParser/QuestionEngineFieldParser.tsx","../../src/components/TransactionDrawers/VehiclesUnderwritingQuestions/VehiclesUnderwritingQuestions.tsx","../../src/components/TransactionDrawers/VehicleDetailDrawer.tsx","../../src/api/services/Integrations/VINtelligence.ts","../../src/components/QuotePolicyDetailEndorsement/Vehicles/helpers/index.ts","../../src/components/TransactionDrawers/VehicleEditDrawer.tsx","../../src/components/TransactionDrawers/WCExposureScheduleModDetailDrawer.tsx","../../src/components/QuotePolicyDetailEndorsement/FieldParsers/WcOwnersMembersDrawerFieldParser/index.tsx","../../src/components/TransactionDrawers/WcOwnersMembersDrawerDetailDrawer.tsx","../../src/components/TransactionDrawers/WcOwnersMembersDrawerEditDrawer.tsx","../../src/components/TransactionDrawers/DynamicTransactionDrawer.tsx","../../src/components/QuotePolicyDetailEndorsement/BusinessInfoSection/BusinessInfoSection.tsx","../../src/helpers/FilingSetId.ts","../../src/components/QuotePolicyDetailEndorsement/Eligibility/Eligibility.tsx","../../src/components/QuotePolicyDetailEndorsement/MailingAddress/MailingAddress.tsx","../../src/components/ScrollToTop/ScrollToTop.tsx","../../src/helpers/PreQualQuestionsLoading.tsx","../../src/components/Policies/PolicyDetail/Info/Tabs/Accordions/DetailAccordion/DetailAccordion.tsx","../../src/components/QuotePolicyDetailEndorsement/SummaryPricing/PremiumAndPlanDetails/PremiumAndPlanDetails.tsx","../../src/assets/images/green-mark.svg","../../src/assets/images/red-cross.svg","../../src/components/QuotePolicyDetailEndorsement/Buttons/WCExclusionToogle/WCExclusionToogle.tsx","../../src/helpers/RouteBlocker.tsx","../../src/components/QuotePolicyDetailEndorsement/NavigationButtons/NavigationButtons.tsx","../../src/components/Policies/PolicyEndorsementDetail/Info/Tabs/Accordions/DetailAccordion/DetailAccordion.tsx","../../src/api/queries/QuotesOrRenewalsQueries.ts","../../src/api/services/ConsumerSubmissions.ts","../../src/api/queries/ConsumerSubmissionQueries.ts","../../src/components/QuotesOrRenewals/EditAgentDialog/EditAgentDialog.tsx","../../src/components/QuotesOrRenewals/EditDuckCreekPolicyNumberDialog/EditDuckCreekPolicyNumberDialog.tsx","../../src/components/QuotesOrRenewals/QuoteOrRenewalDetail/QuoteOrRenewalDetailHeader/QuoteOrRenewalDetailHeader.tsx","../../src/assets/images/CloneQuote.svg","../../src/assets/images/discardQuote.svg","../../src/assets/images/issueQuote.svg","../../src/assets/images/LockQuote.svg","../../src/assets/images/nonRenewIcon.svg","../../src/assets/images/RescindIcon.svg","../../src/components/QuotesOrRenewals/CloneSubmissionDialog/CloneSubmissionForConsolidatedProductDialog/CloneSubmissionForConsolidatedProductDialog.tsx","../../src/components/QuotesOrRenewals/CloneSubmissionDialog/ClonedSubmissonTabSelectionDialog/ClonedSubmissonTabSelectionDialog.tsx","../../src/components/QuotesOrRenewals/CloneSubmissionDialog/CloneSubmissionDialog.tsx","../../src/components/QuotesOrRenewals/DeclineSubmissionDialog/DeclineSubmissionDialog.tsx","../../src/components/QuotesOrRenewals/ForceReferDialog/ForceReferDialog.tsx","../../src/components/QuotesOrRenewals/NonRenewDialog/NonRenewDialog.tsx","../../src/components/QuotesOrRenewals/QuoteOrRenewalDetail/QuoteOrRenewalDetailTopActionBar/QuoteOrRenewalDetailTopActionBar.tsx","../../src/api/services/LobAddress.ts","../../src/types/LobAddressTypes.ts","../../src/components/LobAutocomplete/LobAutocompleteInput.tsx","../../src/components/QuotePolicyDetailEndorsement/UnverifiedMailingAddressDialog/UnverifiedMailingAddressDialog.tsx","../../src/components/QuotePolicyDetailEndorsement/LobAddress/LobAddress.tsx","../../src/components/QuotesOrRenewals/QuoteOrRenewalDetail/Info/Tabs/BusinessInfo.tsx","../../src/components/QuotesOrRenewals/QuoteOrRenewalDetail/Info/Tabs/Accordions/DetailAccordion/DetailAccordion.tsx","../../src/components/QuotesOrRenewals/QuoteOrRenewalDetail/Info/Tabs/Operations.tsx","../../src/components/QuotesOrRenewals/QuoteOrRenewalDetail/Info/Tabs/UWResults.tsx","../../src/components/Settings/Header/SettingsHeader.tsx","../../src/assets/images/EditIcon.svg","../../src/components/Settings/TopActionBar/SettingsTopActionBar.tsx","../../src/routes/Agencies/constants/table-config.tsx","../../src/api/services/Payments.ts","../../src/components/Payments/Error.tsx","../../src/assets/images/logo-circle.svg","../../src/components/Payments/PaymentHeader.tsx"],"sourcesContent":["import { Auth } from 'api/models/Auth/auth.model';\n\nconst tokenKeyword = 'auth';\n\nexport interface Token {\n access?: string;\n refresh?: string;\n}\n\nconst TokenStorage = {\n get(): Auth | null {\n const token = localStorage.getItem(tokenKeyword);\n\n if (token !== null) {\n return JSON.parse(token) as Auth;\n }\n\n return null;\n },\n\n set(auth: Auth): void {\n const stringifiedToken = JSON.stringify(auth);\n return localStorage.setItem(tokenKeyword, stringifiedToken);\n },\n\n destroy(): void {\n localStorage.removeItem('auth');\n },\n\n clear: (): void => localStorage.clear(),\n};\n\nexport default TokenStorage;\n","import { AxiosRequestConfig } from 'axios';\n\nconst REQUEST_OPTIONS: { [key: string]: AxiosRequestConfig } = {\n GET: {\n method: 'GET',\n withCredentials: true,\n headers: {\n Accept: 'application/json',\n },\n },\n POST: {\n method: 'POST',\n withCredentials: true,\n headers: {\n Accept: 'application/json',\n 'Content-Type': 'application/json',\n },\n },\n PATCH: {\n method: 'PATCH',\n withCredentials: true,\n headers: {\n Accept: 'application/json',\n 'Content-Type': 'application/json',\n },\n },\n PUT: {\n method: 'PUT',\n withCredentials: true,\n headers: {\n Accept: 'application/json',\n 'Content-Type': 'application/json',\n },\n },\n DELETE: {\n method: 'DELETE',\n withCredentials: true,\n headers: {\n Accept: 'application/json',\n },\n },\n};\n\nexport default REQUEST_OPTIONS;\n","import { Auth } from 'api/models/Auth/auth.model';\nimport Axios, { AxiosRequestConfig, AxiosResponse } from 'axios';\nimport TokenStorage from 'helpers/TokenStorage';\nimport { isEmpty, merge } from 'lodash-es';\nimport REQUEST_OPTIONS from './Options';\n\nconst envApiUrl = import.meta.env.REACT_APP_BACKEND_MAIN_API_URL;\n\nconst apiUrl = envApiUrl;\n\nexport interface TokenRequest {\n email: string;\n password: string;\n otp_code?: string;\n}\n\nexport interface Params {\n [key: string]: string | number | undefined;\n}\n\nconst Timezone = Intl.DateTimeFormat().resolvedOptions().timeZone;\n\nclass ApiService {\n API_URL: string;\n\n URL: string;\n\n constructor(path = '') {\n this.API_URL = `${apiUrl}`;\n this.URL = `${this.API_URL}/${path}/`;\n }\n\n /**\n * Creates a generic get request for specified URL.\n *\n * @param {string} url (eg: get /questions/types)\n * @return {Promise}\n */\n get(url: string, params: Params = {}, options: AxiosRequestConfig = {}): Promise {\n const requestOptions: AxiosRequestConfig = merge({}, REQUEST_OPTIONS.GET, options);\n\n let additionalParams = '';\n\n if (!isEmpty(params)) {\n additionalParams = `/?${this.parseParams(params)}`;\n }\n\n return this.send(`${this.API_URL}/${url}${additionalParams}`, requestOptions);\n }\n\n /**\n * Creates a generic post request for specified URL.\n *\n * @param {string} url\n * @return {Promise}\n */\n post(\n url: string,\n data: any = {},\n options: AxiosRequestConfig = {},\n params: Params = {},\n ): Promise {\n const requestOptions: AxiosRequestConfig = merge({}, REQUEST_OPTIONS.POST, options, { data });\n let additionalParams = '';\n\n if (!isEmpty(params)) {\n additionalParams = `/?${this.parseParams(params)}`;\n }\n return this.send(`${this.API_URL}/${url}${additionalParams}`, requestOptions);\n }\n\n /**\n * Creates a generic patch request for specified URL.\n *\n * @param {string} url\n * @return {Promise}\n */\n patch(\n url: string,\n data: any = {},\n options: AxiosRequestConfig = {},\n params: Params = {},\n ): Promise {\n const requestOptions: AxiosRequestConfig = merge({}, REQUEST_OPTIONS.PATCH, options, { data });\n let additionalParams = '';\n\n if (!isEmpty(params)) {\n additionalParams = `/?${this.parseParams(params)}`;\n }\n\n return this.send(`${this.API_URL}/${url}${additionalParams}`, requestOptions);\n }\n\n /**\n * Creates a generic put request for specified URL.\n *\n * @param {string} url\n * @return {Promise}\n */\n put(\n url: string,\n data: any = {},\n options: AxiosRequestConfig = {},\n params: Params = {},\n ): Promise {\n const requestOptions: AxiosRequestConfig = merge({}, REQUEST_OPTIONS.PUT, options, { data });\n\n let additionalParams = '';\n if (!isEmpty(params)) {\n additionalParams = `/?${this.parseParams(params)}`;\n }\n\n return this.send(`${this.API_URL}/${url}${additionalParams}`, requestOptions);\n }\n\n /**\n * Creates a generic post request for specified URL.\n *\n * @param {string} url\n * @return {Promise}\n */\n delete(\n url: string,\n options: AxiosRequestConfig = {},\n params: Params = {},\n ): Promise {\n const requestOptions: AxiosRequestConfig = merge({}, REQUEST_OPTIONS.DELETE, options);\n let additionalParams = '';\n\n if (!isEmpty(params)) {\n additionalParams = `/?${this.parseParams(params)}`;\n }\n return this.send(`${this.API_URL}/${url}${additionalParams}`, requestOptions);\n }\n\n /**\n * Creates login request for oauth2 api.\n *\n * @param {TokenRequest} body\n * @return {Promise}\n */\n getToken({ email, password, otp_code }: TokenRequest): Promise {\n const data = {\n email,\n password,\n otp_code,\n };\n\n const requestOptions: AxiosRequestConfig = merge({}, REQUEST_OPTIONS.POST, {\n data,\n headers: {\n 'Content-Type': 'application/json',\n },\n });\n\n return this.send(`${this.API_URL}/auth/token`, requestOptions);\n }\n\n /**\n * Creates a refresh token request for oauth2 api.\n *\n * @return {Promise}\n */\n refreshToken(): Promise | any {\n const auth = TokenStorage.get();\n if (auth?.refresh) {\n const data = {\n refresh: auth.refresh,\n };\n\n const requestOptions: AxiosRequestConfig = merge({}, REQUEST_OPTIONS.POST, {\n data,\n headers: {\n 'Content-Type': 'application/json',\n },\n });\n return this.send(`${this.API_URL}/auth/token/refresh`, requestOptions);\n } else {\n return null;\n }\n }\n\n /**\n * Revokes authentication\n * @returns {Promise}\n */\n revokeToken(options: AxiosRequestConfig = {}): Promise {\n const requestOptions: AxiosRequestConfig = merge({}, REQUEST_OPTIONS.POST, options);\n return this.send(`${this.API_URL}/revokeToken`, requestOptions);\n }\n\n /**\n * Creates a get request for list of resources.\n *\n * @return {Promise}\n */\n index(params: Params = {}, options: AxiosRequestConfig = {}): Promise {\n const requestOptions: AxiosRequestConfig = merge({}, REQUEST_OPTIONS.GET, options);\n let additionalParams = '';\n\n if (!isEmpty(params)) {\n additionalParams = `?${this.parseParams(params)}`;\n }\n\n return this.send(`${this.URL}${additionalParams}`, requestOptions);\n }\n\n /**\n * Creates a get request for a single resource.\n *\n * @param {string | number} id\n * @return {Promise}\n */\n show(id: string | number, options: AxiosRequestConfig = {}): Promise {\n const requestOptions: AxiosRequestConfig = merge({}, REQUEST_OPTIONS.GET, options);\n return this.send(`${this.URL}/${id}`, requestOptions);\n }\n\n /**\n * Creates a post request for resource creation.\n *\n * @param {object} data\n * @return {Promise}\n */\n create(data: Record, options = {}): Promise {\n const requestOptions = merge({}, REQUEST_OPTIONS.POST, options, {\n data,\n });\n return this.send(this.URL, requestOptions);\n }\n\n /**\n * Creates a put request for resource updates.\n *\n * @param {string | number} id\n * @param {Record} data\n * @return {Promise}\n */\n update(id: string | number, data: Record, options = {}): Promise {\n const requestOptions = merge({}, REQUEST_OPTIONS.PUT, options, {\n data,\n });\n\n return this.send(`${this.URL}/${id}`, requestOptions);\n }\n\n /**\n * Creates a delete request for single resource.\n *\n * @param {string | number} id\n * @return {Promise}\n */\n // TODO rename to 'delete' kinds of name\n // if you change this name remember change all api.destroy calls name with the new name\n destroy(\n id: string | number,\n options: AxiosRequestConfig = {},\n params: Params = {},\n ): Promise {\n const requestOptions: AxiosRequestConfig = merge({}, REQUEST_OPTIONS.DELETE, options);\n // return this.send(`${this.URL}/${id}`, requestOptions); // Old api return\n\n /**\n * additionalParams needs for #486\n */\n let additionalParams = '';\n\n if (!isEmpty(params)) {\n additionalParams = `?${this.parseParams(params)}`;\n }\n return this.send(`${this.URL}/${id}${additionalParams}`, requestOptions);\n }\n\n /**\n * Adds access token to request if any token exist on storage.\n *\n * @param {object} request options\n * @return {object} modified options\n */\n // eslint-disable-next-line class-methods-use-this\n addTokenToRequest = (options: AxiosRequestConfig): AxiosRequestConfig => {\n const auth: Auth | null = TokenStorage.get();\n\n const updatedOptions = { ...options };\n\n if (!updatedOptions.headers) {\n updatedOptions.headers = {};\n }\n\n if (auth?.access) {\n updatedOptions.headers!.Authorization = `Bearer ${auth.access}`;\n }\n\n updatedOptions.headers!['X-Timezone'] = Timezone;\n\n return updatedOptions;\n };\n\n /**\n * Creates form encoded body.\n *\n * @param {any} params\n * @return {string}\n */\n // eslint-disable-next-line class-methods-use-this\n parseParams = (params: Params = {}): string =>\n Object.keys(params)\n .map((key) => `${key}=${params[key]}`)\n .join('&');\n\n /**\n * Generates a promise which sends request to server with given paremeters.\n *\n * @param {string} url\n * @param {IAxiosRequestConfig} options\n * @return {Promise}\n */\n send(url: string, options: AxiosRequestConfig): Promise {\n const fullOptions: AxiosRequestConfig = this.addTokenToRequest(options);\n fullOptions.url = `${url}${url.includes('?') ? '' : '/'}`;\n\n fullOptions.headers = {\n ...fullOptions.headers,\n };\n\n return new Promise((resolve, reject) =>\n Axios(fullOptions)\n .then((res) => {\n if (res?.status < 400) {\n resolve(res);\n } else {\n reject(res);\n }\n })\n .catch((err) => {\n reject(err);\n }),\n );\n }\n}\n\nexport default ApiService;\n","import { createContext } from 'react';\n\n/// types\nimport { IAdvancedSearchContextType, IAdvancedSearchStore } from './types';\n\nexport const initialAdvancedSearchData: IAdvancedSearchStore = {\n data: [],\n loading: true,\n loaded: false,\n pagination: {\n page: 1,\n page_size: 20,\n total_count: 0,\n },\n searchType: '',\n activeTabIndex: 0,\n activeTabType: '',\n activeTabValues: {},\n};\n\nexport const advancedSearchContextDefault: IAdvancedSearchContextType = {\n ...initialAdvancedSearchData,\n resetAdvancedSearchState: () => {},\n fetch: () => new Promise(() => {}),\n setActiveTabIndex: () => {},\n setActiveTabValues: () => {},\n resetActiveTabValues: () => {},\n resetActiveTabIndex: () => {},\n setActiveTabType: () => {},\n};\n\nexport const AdvancedSearchContext = createContext(null!);\n","import ApiService, { Params } from 'api/helpers/Sender';\nimport { Agency } from 'api/models/Agencies/agency.model';\nimport { AgencyDetail } from 'api/models/Agencies/AgencyDetail.model';\nimport { Pagination, PaginationResponse } from 'types/Pagination';\n\nconst API = new ApiService();\n\nexport const getAgencies = async (body: Pagination): Promise> => {\n const { data } = await API.get('agencies', body as Params);\n return data;\n};\n\nexport const getSubAgencies = async (body: Pagination): Promise> => {\n const { data } = await API.get('subagencies', body as Params);\n return data;\n};\n\nexport const getAgencyDetail = async (id: string): Promise => {\n const { data } = await API.get(`agencies/${id}`);\n return data;\n};\n","import { createContext } from 'react';\n\n/// types\nimport { IAgenciesContextType, IAgenciesStore } from './types';\n\nexport const initialAgenciesData: IAgenciesStore = {\n data: [],\n loading: true,\n loaded: false,\n pagination: {\n ordering: '',\n page: 1,\n page_size: 20,\n search: '',\n total_count: 0,\n },\n};\n\nexport const agenciesContextDefault: IAgenciesContextType = {\n ...initialAgenciesData,\n resetAgenciesState: () => {},\n fetch: () => new Promise(() => {}),\n};\n\nexport const AgenciesContext = createContext(null!);\n","import { isEmpty } from 'lodash-es';\n\ntype StringRecord = Record;\n\ntype MaybeStringRecord = StringRecord | undefined;\n\n/**\n * Type representing the structure of the slice definitions.\n *\n * If T extends StringRecord, it includes a `name` property and an `actions` property with keys of T and values as strings.\n *\n * If T does not extend StringRecord (i.e., is undefined), it only includes the `name` property.\n */\ntype SliceDefinitions = T extends StringRecord\n ? { name: string; actions: { [K in keyof T]: string } }\n : { name: string };\n\n/**\n * Creates slice definitions for a given name and actions.\n *\n * @template T - The type of the actions object, which should be a record with string keys and values.\n * @param {string} name - The name of the slice.\n * @param {T} [actions] - An optional object representing actions. Each action will be prefixed with the name.\n * @returns {SliceDefinitions} - The slice definition object containing the name and processed actions.\n *\n * @example\n * // Create slice definitions with actions\n * const sliceDefinitions = createSliceDefinitions('QuoteStepperSlice', {\n * updateStepper: 'updateStepper',\n * });\n * console.log(sliceDefinitions);\n * // Output:\n * // {\n * // name: 'QuoteStepperSlice',\n * // actions: {\n * // updateStepper: 'QuoteStepperSlice/updateStepper'\n * // }\n * // }\n *\n * @example\n * // Create slice definitions without actions\n * const sliceDefinitions = createSliceDefinitions('QuoteStepperSlice');\n * console.log(sliceDefinitions);\n * // Output:\n * // {\n * // name: 'QuoteStepperSlice'\n * // }\n */\nexport const createSliceDefinitions = (\n name: string,\n actions?: T,\n): SliceDefinitions => {\n /**\n * Process actions by prefixing each value with the `name`,\n * if actions are provided and not empty\n */\n const processedActions = !isEmpty(actions)\n ? Object.entries(actions!).reduce((acc, [key, value]) => {\n acc[key as keyof T] = `${name}/${value}`;\n\n return acc;\n }, {} as { [K in keyof T]: string })\n : undefined;\n\n /**\n * Return the slice definitions,\n * conditionally including the actions if they are processed\n */\n return {\n name,\n ...(processedActions && { actions: processedActions }),\n } as SliceDefinitions;\n};\n","import { createSliceDefinitions } from 'api/helpers/createSliceDefinitions';\nimport { AdvancedSearchFields } from 'api/models/AdvancedSearch/advancedSearchFields.model';\nimport { TableColumns } from 'api/models/DynamicTableColum/DynamicTableColumn.model';\nimport { t } from 'i18next';\n\nexport const requiredEnvVars = [\n 'REACT_APP_BACKEND_MAIN_API_URL',\n 'REACT_APP_AUTH0_DOMAIN',\n 'REACT_APP_AUTH0_CLIENT_ID',\n];\n\nexport const environmentChips = {\n development: 'DEV',\n qa: 'TEST',\n training: 'TRAINING',\n};\n\nexport const isRenewalEnabled = import.meta.env.REACT_APP_IS_RENEWAL_FEATURE_ENABLED === 'true';\n\n// TODO: Remove when consolidated product goes live\nconst isLocal = window.location.hostname === 'localhost';\nexport const isConsolidatedProductFeatureEnabled =\n ['development', 'qa'].includes(import.meta.env.MODE) || isLocal;\n\nexport const dataFieldTypes = {\n DATE: 'date',\n EMAIL: 'email',\n MEDIA: 'media',\n NUMBER: 'number',\n STRING: 'string',\n BOOLEAN: 'boolean',\n SELECT: 'select',\n GROUP: 'group',\n CURRENCY: 'currency',\n ACTION: 'action_menu',\n AUTOCOMPLETE: 'autocomplete',\n SMARTY: 'smarty',\n PHONE: 'phone',\n SELECT_BUTTON: 'select_button',\n LABEL: 'label',\n CHECKBOX: 'checkbox',\n CHECKBOX_GROUP: 'checkbox_group',\n MULTISELECT: 'multiselect',\n PERCENTAGE: 'percentage',\n YEAR: 'year',\n RADIO_BUTTON: 'radio',\n} as const;\n\nexport const errorCodes = {\n UNDERWRITING_QUESTIONS: 1090,\n MISSING_EXPOSURES_OR_FIELD_GROUPS: 1080,\n SUBMISSION_HAS_ALREADY_FINALIZED: 1016,\n};\n\nexport const notificationTypes = {\n ERROR: 'ERROR' as const,\n SUCCESS: 'SUCCESS' as const,\n INFO: 'INFO' as const,\n WARNING: 'WARNING' as const,\n};\n\nexport const underWritingQuestionsPageNames = {\n Business_Info: 'Business Info',\n Operations: 'Operations',\n 'Vehicle Details': 'Vehicle Details',\n};\n\nexport const globalSearchTypes = {\n POLICY: 'policy',\n QUOTE: 'quote',\n RENEWAL: 'renewal',\n CONSUMER_SUBMISSION: 'consumersubmission',\n} as const;\n\nexport const advancedSearchTypes = {\n ACCOUNT: 'account',\n AGENCIES: 'agencies',\n AGENCY: 'agency',\n AGENT: 'agent',\n AGENTS: 'agents',\n CLAIM: 'claim',\n POLICY: 'policy',\n POLICYHOLDER: 'policyholder',\n SUBMISSIONS: 'submission',\n USER: 'user',\n QUOTE: 'quote',\n CONSUMER_SUBMISSION: 'consumersubmissions',\n} as const;\n\nexport const supportedLocales = ['en'];\nexport const defaultCurrency = 'USD';\n\nexport const userRoles = {\n AGENT: {\n id: 1,\n code: 'agent',\n name: (): string => t('Producer'),\n },\n THREE_DIRECT_SALES: {\n id: 2,\n code: 'internal_sales',\n name: (): string => t('THREE Direct Sales'),\n },\n UNDERWRITER: {\n id: 8,\n code: 'underwriter',\n name: (): string => t('Underwriter'),\n },\n READ_ONLY: {\n id: 9,\n code: 'read_only',\n name: (): string => t('THREE Read Only'),\n },\n} as const;\n\nexport const passwordRules = [\n (): string => t('Password must have at least {{charLimit}} characters', { charLimit: 8 }),\n (): string => t('Include at least one lowercase letter (a-z)'),\n (): string => t('Include at least one uppercase letter (A-Z)'),\n (): string => t('Include at least one number (0-9)'),\n];\n\nexport const quoteStatuses = {\n DRAFT: 'draft',\n QUOTED: 'quoted',\n ACCEPTED: 'accepted',\n DECLINED: 'declined',\n DISCARDED: 'discarded',\n REFERRED: 'referred',\n EXPIRED: 'expired',\n DECLINED_BY_UW: 'declined_by_uw',\n DECLINED_BY_AGENT: 'declined_by_agent',\n IN_MORATORIUM: 'in_moratorium',\n NON_RENEWED: 'non_renewed',\n PENDING_REFERRAL: 'pending_referral',\n} as const;\n\nexport const renewalStatuses = quoteStatuses;\n\nexport const policiesListStatuses = {\n ACTIVE: 'active',\n BOUND: 'inactive',\n CANCELLED: 'cancelled',\n IN_CANCELLATION: 'in_cancellation',\n} as const;\n\nexport const defaultDateFormat = 'MM/dd/yyyy';\nexport const defaultDateTimeFormat = 'hh:mm:ss aaa';\nexport const defaultTimezone = 'America/New_York';\n\nexport const cancellationReasons = {\n INSUREDS_REQUEST: 'insureds_request',\n NON_COMPLIANCE: 'non_compliance',\n NON_PAYMENT: 'non_payment',\n};\n\nexport const policyDetailStatuses = {\n DRAFT: 'draft',\n EXPIRED: 'expired',\n IN_CANCELLATION: 'in_cancellation',\n CANCELLED: 'cancelled',\n BOUND: 'inactive',\n ACTIVE: 'active',\n} as const;\n\nexport const policyDetailStatusLabels: Record<\n (typeof policyDetailStatuses)[keyof typeof policyDetailStatuses],\n string\n> = {\n [policyDetailStatuses.DRAFT]: 'Draft',\n [policyDetailStatuses.EXPIRED]: 'Expired',\n [policyDetailStatuses.IN_CANCELLATION]: 'In Cancellation',\n [policyDetailStatuses.CANCELLED]: 'Cancelled',\n [policyDetailStatuses.BOUND]: 'Bound',\n [policyDetailStatuses.ACTIVE]: 'In-Force',\n} as const;\n\nexport const policyInvoiceStatuses = {\n SETTLED: 'settled',\n OUTSTANDING: 'outstanding',\n PAID: 'paid',\n WRITTEN_OFF: 'writtenOff',\n ZERO_DUE: 'zeroDue',\n INVALIDATED: 'invalidated',\n CARRIED_FORWARD: 'carriedForward',\n} as const;\n\nexport const policyDetailEndorsementStatuses = {\n ISSUED: 'issued',\n INVALIDATED: 'invalidated',\n ACCEPTED: 'accepted',\n QUOTED: 'quoted',\n APPLICATION: 'application',\n DISCARDED: 'discarded',\n REFERRED: 'referred',\n DECLINED_BY_UW: 'declined_by_uw',\n DECLINED: 'declined',\n} as const;\n\nexport const phoneNumberRegex = /^(\\+\\d{1,2}\\s)?\\(?\\d{3}\\)?[\\s.-]\\d{3}[\\s.-]\\d{4}$/;\n\nexport const validURLRegex =\n /((https?):\\/\\/)?(www.)?[a-z0-9]+(\\.[a-z]{2,}){1,3}(#?\\/?[a-zA-Z0-9#]+)*\\/?(\\?[a-zA-Z0-9-_]+=[a-zA-Z0-9-%]+&?)?$/;\n\nexport const commaRegex = /,/g;\n\nexport const nonCommaRegex = /^[^,]+$/g;\n\nexport const alphaNumericRegex = /^[a-zA-Z0-9]+$/g;\n\nexport const nonAlphaNumericRegex = /[^a-zA-Z0-9]/g;\n\nexport const nonRepeatingCharactersRegex = /^(?!(.)\\1*$).+$/;\n\nexport const doubleQuoteOrBackslashRegex = /[\"\\\\]/g;\n\nexport const nonDoubleQuoteOrBackslashRegex = /^[^\"\\\\]+$/g;\n\nexport const titleCharacterLimit = 255;\n\nexport const descriptionCharacterLimit = 4000;\n\nexport const defaultRowVirtualization = 100;\n\nexport const defaultRowTransactionList = 20;\n\nexport const submissionDetailInfoTabs = {\n BUSINESS_INFO: {\n code: 'business_info',\n name: () => t('Business Info'),\n index: 0,\n disabled: false,\n hidden: false,\n nextTabWithWC: 'operations',\n nextTabWithoutWC: 'operations',\n },\n OPERATIONS: {\n code: 'operations',\n name: () => t('Operations'),\n index: 1,\n disabled: false,\n hidden: false,\n prevTab: 'business_info',\n nextTabWithWC: 'locations',\n nextTabWithoutWC: 'locations',\n producer_NextTab: 'operations_uw_results',\n },\n OPERATIONS_UW: {\n code: 'operations_uw_results',\n name: () => t('UW Results'),\n index: 2,\n disabled: false,\n hidden: true,\n },\n LOCATIONS: {\n code: 'locations',\n name: () => t('Locations'),\n index: 3,\n disabled: false,\n hidden: false,\n prevTab: 'operations',\n nextTabWithWC: 'owners_members',\n nextTabWithoutWC: 'owners_members',\n },\n OWNERS_MEMBERS: {\n code: 'owners_members',\n name: () => t('Owners/Members'),\n index: 4,\n disabled: false,\n hidden: false,\n prevTab: 'locations',\n nextTabWithWC: 'property_exposures',\n nextTabWithoutWC: 'property_exposures',\n },\n LIABILITY_EXPOSURES: {\n code: 'liability_exposures',\n name: () => t('Liability Exposures'),\n index: 5,\n disabled: false,\n hidden: true,\n },\n PROPERTY_EXPOSURES: {\n code: 'property_exposures',\n name: () => t('Premises'),\n index: 6,\n disabled: false,\n hidden: false,\n prevTab: 'owners_members',\n nextTabWithWC: 'wc_exposures',\n nextTabWithoutWC: 'auto_exposures',\n },\n WC_EXPOSURES: {\n code: 'wc_exposures',\n name: () => t('Workers’ Comp'),\n index: 7,\n disabled: false,\n hidden: true,\n prevTab: 'property_exposures',\n nextTabWithWC: 'auto_exposures',\n nextTabWithoutWC: 'auto_exposures',\n },\n AUTO_EXPOSURES: {\n code: 'auto_exposures',\n name: () => t('Vehicles'),\n index: 8,\n disabled: false,\n hidden: false,\n prevTabWithWC: 'wc_exposures',\n prevTab: 'property_exposures',\n nextTabWithWC: 'drivers',\n nextTabWithoutWC: 'drivers',\n nextTabWithNoDrivers: 'claims_history',\n },\n DRIVERS: {\n code: 'drivers',\n name: () => t('Drivers'),\n index: 9,\n disabled: false,\n hidden: false,\n prevTab: 'auto_exposures',\n nextTabWithWC: 'claims_history',\n nextTabWithoutWC: 'claims_history',\n },\n CLAIMS_HISTORY: {\n code: 'claims_history',\n name: () => t('Claims History'),\n index: 10,\n disabled: false,\n hidden: false,\n prevTab: 'drivers',\n prevTabWithNoDrivers: 'auto_exposures',\n nextTabWithWC: 'additional_interests',\n nextTabWithoutWC: 'additional_interests',\n },\n ADDITIONAL_INTEREST: {\n code: 'additional_interests',\n name: () => t('Additional Interests'),\n index: 11,\n disabled: false,\n hidden: false,\n prevTab: 'claims_history',\n nextTabWithWC: 'uw_results',\n nextTabWithoutWC: 'uw_results',\n },\n UW_RESULTS: {\n code: 'uw_results',\n name: () => t('UW Results'),\n index: 12,\n disabled: false,\n hidden: false,\n prevTab: 'additional_interests',\n nextTabWithWC: 'summary_pricing',\n nextTabWithoutWC: 'summary_pricing',\n },\n SUMMARY_PRICING: {\n code: 'summary_pricing',\n name: () => t('Coverage Summary'),\n index: 13,\n disabled: false,\n hidden: false,\n prevTab: 'uw_results',\n nextTabWithWC: 'pricing_breakdown',\n nextTabWithoutWC: 'pricing_breakdown',\n },\n PRICING_BREAKDOWN: {\n code: 'pricing_breakdown',\n name: () => t('Pricing Breakdown'),\n index: 14,\n disabled: false,\n hidden: false,\n },\n};\n\nexport const subTabsList = [submissionDetailInfoTabs.OPERATIONS_UW.code];\n\nexport const quotePolicyEndorsementInfoTitlesDescriptions = {\n OWNERS_MEMBERS: {\n description: () =>\n t(\n 'This includes President, Vice President, and/or other officer titles that were officially appointed or approved by ownership or the Board of Directors to manage or perform daily operations.',\n ),\n },\n PROPERTY_EXPOSURES: {\n title: () => t('List all premises where business operates'),\n description: () =>\n t(\n 'Record insured values at every premises where the business operates. You may record more than one Building/Premises at each location.',\n ),\n },\n WC_EXPOSURES: {\n title: () => t('Workers Compensation Class Codes'),\n description: () => t('Allocate payroll across class codes.'),\n },\n INDIVIDUAL_OWNERS_OFFICERS: {\n title: () => t('Individual Owners/Officers'),\n description: () =>\n t(\n 'Select each owner/officer and assign to payroll classification or mark as excluded from Workers Compensation coverage.',\n ),\n },\n AUTO_EXPOSURES: {\n title: () => t('Vehicles'),\n description: () => t('Record all vehicles owned, leased, or regularly used by the business.'),\n },\n DRIVERS: {\n title: () => t('Drivers'),\n description: () =>\n t(\n 'List all individuals (including owners, employees and subcontractors) that will be driving vehicles scheduled on this policy.',\n ),\n },\n DRIVING_INCIDENTS: {\n title: () => t('Driving Incidents'),\n description: () =>\n t(\n 'For each driver, list all accidents and violations within the last 3 years. Do not include parking violations.',\n ),\n },\n CLAIMS_HISTORY: {\n title: () => t('3-Year Claims History'),\n description: () => t('List all claims filed within the last 3 years.'),\n },\n ADDITIONAL_INTEREST: {\n title: () => t('Additional Interests'),\n },\n UW_RESULTS: {\n title: () => t('Underwriting Results'),\n },\n SUMMARY_PRICING: {\n title: () => t('Summary'),\n },\n PRICING_BREAKDOWN: {\n title: () => t('Pricing Breakdown'),\n },\n};\n\nexport const policyDetailInfoTabs = {\n ...submissionDetailInfoTabs,\n};\n\nexport const policyDetailEndorsementTabs = {\n ...submissionDetailInfoTabs,\n};\n\nexport const THREE_EndorsementTypes = {\n GENERIC: {\n code: 'generic',\n name: 'Exposure Change',\n },\n ADDITIONAL_INTEREST: {\n code: 'change.additionalInterest',\n name: 'Additional Interest',\n },\n WC_AUDIT: {\n code: 'wc_audit',\n name: 'WC Audit',\n },\n} as const;\n\nexport const threeExposureNames = {\n LOCATION: 'location',\n BUILDING: 'building',\n VEHICLE: 'vehicle',\n EMPLOYER: 'employer',\n POLICY_INFORMATION: 'policyInformation',\n} as const;\n\nexport type ThreeExposureNamesType = (typeof threeExposureNames)[keyof typeof threeExposureNames];\n\nexport const expModWorkFlowName = 'expMod';\n\nexport const threeEmployerExposurePerilNames = {\n MANUAL_PREMIUM: 'manual_premium',\n SMALL_DEDUCTIBLE_PROGRAM: 'small_deductible_program',\n} as const;\n\nexport const LIABILITY_PERILS = 'liability_perils';\n\nexport const staticGenerateCertificateDrawerFields = [\n {\n code: 'certificate_holder_name',\n name: 'Certificate Holder Name',\n is_optional: false,\n is_hidden: false,\n is_readonly: false,\n newline: false,\n type: 'string',\n },\n {\n code: 'loc_address_line1',\n name: 'Address Line 1',\n is_optional: false,\n is_hidden: false,\n is_readonly: false,\n newline: false,\n type: 'autocomplete',\n additional_data: {\n relatedFields: [\n {\n configFieldName: 'loc_address_line1',\n smartyFieldName: 'street_line',\n },\n {\n configFieldName: 'loc_address_line2',\n smartyFieldName: 'secondary',\n },\n {\n configFieldName: 'loc_address_city',\n smartyFieldName: 'city',\n },\n {\n configFieldName: 'loc_address_state',\n smartyFieldName: 'state',\n },\n {\n configFieldName: 'loc_address_zip',\n smartyFieldName: 'zipcode',\n },\n ],\n },\n service_bridge: {\n name: 'smarty',\n },\n },\n {\n code: 'loc_address_isvalidated',\n name: 'Adress is validated',\n is_optional: true,\n is_hidden: true,\n is_readonly: false,\n newline: false,\n type: 'select',\n choices: [\n {\n code: 'Yes',\n name: 'Yes',\n },\n {\n code: 'No',\n name: 'No',\n },\n ],\n },\n {\n code: 'loc_address_line2',\n name: 'Address Line 2',\n is_optional: true,\n is_hidden: false,\n is_readonly: false,\n newline: false,\n type: 'string',\n },\n {\n code: 'loc_address_city',\n name: 'City',\n is_optional: true,\n is_hidden: false,\n is_readonly: false,\n newline: false,\n type: 'string',\n },\n {\n code: 'loc_address_state',\n name: 'State',\n is_optional: true,\n is_hidden: false,\n is_readonly: false,\n newline: false,\n type: 'string',\n },\n {\n code: 'loc_address_zip',\n name: 'Zip Code',\n is_optional: true,\n is_hidden: false,\n is_readonly: false,\n newline: false,\n type: 'string',\n },\n {\n code: 'loc_address_lat',\n name: 'Address Latitude',\n is_optional: true,\n is_hidden: true,\n is_readonly: false,\n newline: false,\n type: 'string',\n },\n];\n\nexport const addressKeyValue = {\n ADDRESS_IS_VALIDATED: 'loc_address_isvalidated',\n PRIMARY_CHECKBOX: 'loc_address_isprimary',\n ADDRESS_LINE_1: 'loc_address_line1',\n ADDRESS_LINE_2: 'loc_address_line2',\n ADDRESS_CITY: 'loc_address_city',\n ADDRESS_STATE: 'loc_address_state',\n ADDRESS_ZIP: 'loc_address_zip',\n LOC_FLOOD_ZONE: 'loc_flood_zone',\n LOC_VIOLENT_CRIME_SCORE: 'loc_violent_crime_score',\n LOC_PROPERTY_CRIME_SCORE: 'loc_property_crime_score',\n LOC_ADDRESS_LAT: 'loc_address_lat',\n LOC_ADDRESS_LONG: 'loc_address_long',\n LOC_DISTANCE_TO_COAST: 'loc_dtc',\n LOC_250FT_FLOOD_ZONE: 'loc_250ft_flood_zone',\n};\n\nexport const threePolicyGroupNames = {\n OWNER: 'pol_oo',\n DRIVERS: 'pol_drivers',\n INCIDENTS: 'pol_incidents',\n ADDITIONAL_INTEREST: 'info_ai',\n CLAIMS: 'pol_claims',\n SCHEDULE_MODIFICATION: 'pol_sched_mod',\n} as const;\n\nexport const vehicleExposureVinRelatedFields = ['veh_year', 'veh_make', 'veh_model', 'veh_trim'];\n\nexport const keyValueTables = {\n SCHED_MOD_TABLE: 'schedule_modification_tables',\n LOC_FILINGS_TABLE: 'loc_filings',\n WC_CLASS_CODE: 'workers_compensation_class_code',\n LIABILITY_PERILS: 'liabilityPerilsMapping',\n SCHED_MOD_LINES_PERILS: 'schedModLinesOfPerils',\n LIABILITY_PERILS_CLASS_CODES_AND_DESCRIPTION:\n 'liability_perils_class_code_to_description_mapping',\n BODY_CATEGORY: 'vehicleBodyCategory',\n BODY_STYLE_TO_CATEGORY: 'vehicleBodyStyleToCategory',\n MAKE_CD_MAKE_NM: 'vehicleMakeCdmakeNmMapping',\n GCW: 'gcwMapping',\n TBL_GCW: 'tblGCW',\n TBL_DEPRECIATION: 'tblDepreciation',\n CLASS_CODES: 'class-codes',\n INDUSTRIES: 'primary-industry',\n CANCELLATION_GRACE_DAYS: 'cancellation_grace_days_lookup_table',\n} as const;\n\nexport const nonDrivableVehicles = ['Trailer'];\n\nexport const propertyExposureScheduleBuildingOccupanciesKeyValue = {\n BUILDING_LEASE: `Building I lease and am required to insure (e.g. 'Triple Net Lease')`,\n BUILDING_OWN_RUN: 'Building I own and run my business out of',\n BUILDING_OWN_MANAGE: 'Building I own/manage and lease to others',\n};\n\nexport const propertyExposureBuildingOccupanciesKeyValue = {\n HOME_APARTMENT: 'Home/Apartment',\n KIOSK: 'Kiosk',\n SHARED_COWORKING_SPACE: 'Shared/coworking space',\n ...propertyExposureScheduleBuildingOccupanciesKeyValue,\n};\n\nexport const propertyExposureScheduleBuildingOccupancies = Object.values(\n propertyExposureScheduleBuildingOccupanciesKeyValue,\n);\n\nexport const propertyExposureScheduleBuildingValidationsFields = [\n 'bdg_erc_building',\n 'bdg_rrc_building',\n 'bdg_tiv_building',\n];\n\nexport const propertyExposureAffectPremiumCalculationsFields = [\n 'bdg_construction_code',\n 'bdg_wind_symbol',\n 'bdg_year_built',\n 'bdg_sqft',\n 'bdg_num_stories',\n 'bdg_issprinklered',\n];\n\nexport const propertyExposureScheduleBuildingFields = [\n 'bdg_erc_building',\n 'bdg_rrc_building',\n 'bdg_tiv_building',\n 'bdg_360v_valuation_id',\n 'bdg_prometrix_hit',\n];\n\nexport const propertyExposureFieldsForEstimatedReplacementCostLoading = [\n 'bdg_erc_building',\n 'bdg_rrc_building',\n 'bdg_360v_valuation_id',\n 'bdg_prometrix_hit',\n];\n\nexport const propertyExposureFieldsForEstimatedReplacementCostIntegration = [\n 'bdg_construction_code',\n 'bdg_num_stories',\n 'bdg_sqft',\n 'bdg_issprinklered',\n 'bdg_location',\n 'bdg_class_code',\n 'bdg_year_built',\n];\n\nexport const approvePropertyUWReportType = ['BUR', 'PDR', 'BFUR'];\n\nexport const genericErrorMessage = (): string =>\n t('Could not complete your request. If the problem persists, contact your support team.');\n\nexport const underwritingResultDecisions = {\n APPROVED: { code: 'approved', name: 'Approved' },\n REFERRED: { code: 'referred', name: 'Referred' },\n DECLINED: { code: 'declined', name: 'Declined' },\n};\n\nexport const vehiclesUwQuestionCode = 'vehicle_details';\nexport const uwQuestionGroupName = 'underwriting_question';\n\nexport const liabilityExposureBasises = {\n 'Employee Count': ['employment_practices_liability', 'fiduciary_liability'],\n 'Cost of Hire': [\n 'cargo_liability',\n 'cost_of_hire_physical_damage_collision',\n 'cost_of_hire_physical_damage_comprehensive',\n 'cost_of_hire_liability',\n ],\n Revenue: [\n 'cyber_liability',\n 'commercial_auto_terrorism',\n 'directors_officers_liability',\n 'garagekeepers_liability',\n 'general_liability_terrorism',\n 'professional_liability',\n ],\n 'Liquor Sales': ['general_liability_liquor_liability'],\n};\n\nexport const liabilityPerilsNamesWithCustomExposureBasis = [\n 'general_liability_premises_operations',\n 'general_liability_products_completed_operations',\n];\n\nexport const exposureTypeFields = {\n 'Cost of Hire': 'cost_of_hire',\n Revenue: 'revenue',\n 'Employee Count': 'ee_count',\n 'Liquor Sales': 'alcohol_sales',\n 'Lawyer FTE Count': 'lawyer_fte',\n};\n\nexport const fixedPremiumChargePeril = 'fixed_premium_charge';\n\nexport const lookupTableTypes = {\n TERRITORY_LOOKUP: 'territory_lookup',\n LIABILITY_PERILS: 'liability_perils',\n};\n\nexport const liabilityExposurePerils = {\n commercialAutoTerrorism: {\n code: 'commercial_auto_terrorism',\n title: 'Commercial Auto - Terrorism',\n },\n cyberLiability: {\n code: 'cyber_liability',\n title: 'Cyber Liability',\n },\n directorsOfficersLiability: {\n code: 'directors_officers_liability',\n title: 'Directors & Officers Liability',\n },\n employmentPracticesLiability: {\n code: 'employment_practices_liability',\n title: 'Employment Practices Liability',\n },\n fiduciaryLiability: {\n code: 'fiduciary_liability',\n title: 'Fiduciary Liability',\n },\n garagekeepersLiability: {\n code: 'garagekeepers_liability',\n title: \"Garagekeeper's Liability\",\n },\n generalLiabilityLiquorLiability: {\n code: 'general_liability_liquor_liability',\n title: 'General Liability - Liquor Liability',\n },\n generalLiabilityTerrorism: {\n code: 'general_liability_terrorism',\n title: 'General Liability - Terrorism',\n },\n glpo: {\n code: 'general_liability_premises_operations',\n name: 'General Liability - Premises/Operations',\n },\n glpcOperations: {\n code: 'general_liability_products_completed_operations',\n title: 'General Liability - Products/Completed Operations',\n },\n professionalLiability: {\n code: 'professional_liability',\n title: 'Professional Liability',\n },\n trailerInterchange: {\n code: 'trailer_interchange',\n title: 'Trailer Interchange',\n },\n};\n\nexport const professionalLiabilityPerilExposureBasis = {\n REVENUE: 'Revenue',\n LAWYER_FTE_COUNT: 'Lawyer FTE Count',\n};\n\nexport const liabilityExposuresFieldCodes = {\n perilType: 'peril_type',\n location: 'location',\n classCode: 'class_code',\n classCodeDescription: 'class_code_description',\n hazardGroup: 'hazard_group',\n basis: 'basis',\n divider: 'divider',\n rate: 'rate',\n exposureAmount: 'exposure_amount',\n exposureBasis: 'exposure_basis',\n classCodeOverride: 'class_code_override',\n exposureAmountOverride: 'exposure_amount_override',\n glpoOoCount: 'glpo_oo_count',\n fiduIndicator: 'fidu_indicator',\n fiduEeCount: 'fidu_ee_count',\n cyberLiabilityRevenueCount: 'cy_revenue',\n cyberLiabilityhazardGroup: 'cy_hazard',\n glpcOoCount: 'glpc_oo_count',\n doIndicator: 'do_indicator',\n epliIndicator: 'epli_indicator',\n liqIndicator: 'liq_indicator',\n plIndicator: 'pl_indicator',\n plContractQuality: 'pl_contract_quality',\n plLawyerFte: 'pl_lawyer_fte',\n plLawyerPte: 'pl_lawyer_pte',\n};\n\nexport const hazardRelatedFieldCodes = [\n 'hazard_group',\n 'cy_hazard_user',\n 'do_hazard_user',\n 'epli_hazard_user',\n 'pl_hazardgroup_user',\n];\n\nexport const dividerRateFieldsHiddenPerilCodes = [\n 'cyber_liability',\n 'employment_practices_liability',\n 'professional_liability',\n 'directors_officers_liability',\n];\n\nexport const quoteExtraStatuses = {\n OK: { code: 'ok', tooltip: '' },\n HAS_DECLINE: {\n code: 'has_decline',\n tooltip: 'One or more rules were declined, therefore, Locking the quote is not possible',\n },\n HAS_REFER: { code: 'has_refer', tooltip: 'Underwriting review is pending' },\n} as const;\n\nexport const endorsementExtraStatuses = {\n OK: { code: 'ok', tooltip: '' },\n HAS_DECLINE: {\n code: 'has_decline',\n tooltip:\n 'One or more rules were declined, therefore, Locking the policy changes is not possible',\n },\n HAS_REFER: { code: 'has_refer', tooltip: 'Underwriting review is pending' },\n} as const;\n\nexport const smodLines = {\n PROPERTY: 'PROP',\n AUTO: 'AUTO',\n EMPLOYER: 'WC',\n};\n\nexport const MAXIMUM_MODIFICATION = 'Maximum Modification';\n\nexport const empXratedOptions = {\n NO_REQUEST: 'No Request',\n SUCCESS_E: '0 Success - E',\n SUCCESS_E_OLD: '0 Success - E - old',\n SUCCESS_D: '0 Success - D',\n SUCCESS_C: '0 Success - C',\n SUCCESS_W: '0 Success - W',\n NOT_FOUND: '1 Data Not Found',\n ERROR_IN_PARAMS: '2 Error In Parameters',\n};\n\nexport const DOCUMENT_TYPES_FROM = {\n POLICY: 'policy',\n QUOTE: 'quote',\n};\n\nexport const paginationKeys = ['ordering', 'page', 'page_size', 'search'];\n\nexport const uwQuestionAliases = {\n businessName: 'businessName',\n yearFounded: 'yearFounded',\n taxIDType: 'taxIDType',\n fein: 'fein',\n ssn: 'ssn',\n};\n\nexport const uwTaxOptions = {\n FEIN: 'FEIN',\n SOCIAL_SECURITY_NUMBER: 'Social Security Number',\n SOCIAL_SECURITY_NUMBER_ABBR: 'SSN',\n};\n\nexport const acceptedBdgOccupancy = [\n \"Building I lease and am required to insure (e.g. 'Triple Net Lease')\",\n 'Building I own and run my business out of',\n 'Building I own/manage and lease to others',\n];\n\nexport const wcAuditSubTypes = {\n ESTIMATED: { code: 'Estimated', name: 'Estimated' },\n ACTUAL: { code: 'Actual', name: 'Actual' },\n UNCOOPERATIVE: { code: 'Uncooperative', name: 'Uncooperative' },\n};\n\nexport const wcAuditPolOoFields = {\n FINAL: ['pol_oo_wc_payroll_audit_final'],\n ESTIMATED: ['pol_oo_wc_payroll_audit_est'],\n ORIGINALS: ['pol_oo_wc_payroll'],\n};\n\nexport const wcAuditEmployerFields = {\n FINAL: [\n 'man_payroll_w2_audit_final',\n 'man_payroll_sub_audit_final',\n 'man_capita_audit_final',\n 'owner_payroll_audit_final',\n 'total_rated_payroll_audit_final',\n ],\n ESTIMATED: [\n 'man_payroll_w2_audit_est',\n 'man_payroll_sub_audit_est',\n 'man_capita_audit_est',\n 'owner_payroll_audit_est',\n 'total_rated_payroll_audit_est',\n ],\n ORIGINALS: ['man_payroll_w2', 'man_payroll_sub', 'man_capita'],\n};\n\nexport const employerManCapitaRealatedFields = [\n 'man_capita',\n 'man_capita_audit_est',\n 'man_capita_audit_final',\n];\n\nexport const manIsancillaryFieldCode = 'man_isancillary';\n\nexport const firstDayOfYear1900 = 'Tue Jan 01 1900 07:00:00 GMT+0300 (GMT+03:00)';\n\nexport const LOCATION_DEFAULT_PERIL = 'Location Default Peril';\n\nexport const defaultDebounceDelay = 600;\n\nexport const firstDayOfYear2024 = 1704085200000;\n\nexport const zipCodeLength = 5;\n\nexport const billingChipCategories = [\n {\n code: 'all invoices',\n label: 'All Invoices',\n },\n {\n code: 'outstanding',\n label: 'Outstanding',\n },\n {\n code: 'paid',\n label: 'Paid',\n },\n {\n code: 'invalidated',\n label: 'Invalidated',\n },\n {\n code: 'pastDue',\n label: 'Past Due',\n },\n {\n code: 'currentDue',\n label: 'Current Due',\n },\n {\n code: 'scheduled',\n label: 'Scheduled',\n },\n {\n code: 'zeroDue',\n label: 'Zero Due',\n },\n {\n code: 'carriedForward',\n label: 'Carried Forward',\n },\n {\n code: 'writtenOff',\n label: 'Written Off',\n },\n];\n\nexport const selectionChoices = {\n INCLUDED: 'Included',\n FLAT: 'Flat',\n NO: 'No',\n YES: 'Yes',\n};\n\nexport const productCodes = {\n THREE_WITH_WORKERS_COMPENSATION: 'three_with_workers_compensation',\n THREE_WITHOUT_WORKERS_COMPENSATION: 'three_without_workers_compensation',\n};\n\nexport const TAB_POSITIONS = {\n PREVIOUS: 'previous',\n NEXT: 'next',\n};\n\nexport const LEXIS_NEXIS_B505_SCORE_TYPES = {\n B505: 'B505',\n};\n\nexport const LEXIS_NEXIS_C212_SCORE_TYPES = {\n C212: 'C212',\n MODEL_ID: 'model_id',\n REQUEST_TIMESTAMP: 'request_timestamp',\n};\n\nexport const states = {\n AK: 'AK',\n AL: 'AL',\n AR: 'AR',\n AZ: 'AZ',\n CA: 'CA',\n CO: 'CO',\n CT: 'CT',\n DC: 'DC',\n DE: 'DE',\n FL: 'FL',\n GA: 'GA',\n HI: 'HI',\n IA: 'IA',\n ID: 'ID',\n IL: 'IL',\n IN: 'IN',\n KS: 'KS',\n KY: 'KY',\n LA: 'LA',\n MA: 'MA',\n MD: 'MD',\n ME: 'ME',\n MI: 'MI',\n MN: 'MN',\n MO: 'MO',\n MS: 'MS',\n MT: 'MT',\n NC: 'NC',\n ND: 'ND',\n NE: 'NE',\n NH: 'NH',\n NJ: 'NJ',\n NM: 'NM',\n NV: 'NV',\n NY: 'NY',\n OH: 'OH',\n OK: 'OK',\n OR: 'OR',\n PA: 'PA',\n RI: 'RI',\n SC: 'SC',\n SD: 'SD',\n TN: 'TN',\n TX: 'TX',\n UT: 'UT',\n VA: 'VA',\n VT: 'VT',\n WA: 'WA',\n WI: 'WI',\n WV: 'WV',\n WY: 'WY',\n PR: 'PR',\n};\n\nexport const stateList = Object.values(states).map((state) => ({ code: state, name: state }));\n\nexport const policyTermTypeRenewal = 'renewal';\n\nexport const COLUMNS: TableColumns = {\n AGENCY_COLUMNS: [\n {\n code: 'name',\n name: 'Agency Name',\n type: 'string',\n is_hidden: false,\n is_sortable: true,\n is_searchable: true,\n is_link: true,\n link_type: 'agency',\n additional_data: {\n minWidth: 160,\n },\n },\n {\n code: 'email',\n name: 'Contact Email',\n type: 'string',\n is_hidden: false,\n is_sortable: true,\n is_searchable: false,\n is_link: false,\n link_type: '',\n additional_data: {\n headerAlign: 'center',\n },\n },\n {\n code: 'customer_service_phone_number',\n name: 'Phone Number',\n type: 'string',\n is_hidden: false,\n is_sortable: true,\n is_searchable: false,\n is_link: false,\n link_type: '',\n additional_data: {\n headerAlign: 'center',\n },\n },\n {\n code: 'state',\n name: 'State',\n type: 'string',\n is_hidden: false,\n is_sortable: true,\n is_searchable: false,\n is_link: false,\n link_type: '',\n additional_data: {\n minWidth: 120,\n },\n },\n ],\n POLICY_COLUMNS: [\n {\n code: 'locator',\n name: 'Locator',\n type: 'number',\n is_hidden: true,\n is_sortable: true,\n is_searchable: true,\n is_link: false,\n link_type: '',\n additional_data: undefined,\n },\n {\n code: 'three_policy_number',\n name: 'Policy No.',\n type: 'number',\n is_hidden: false,\n is_sortable: true,\n is_searchable: true,\n is_link: true,\n link_type: 'policy',\n additional_data: {\n minWidth: 120,\n },\n },\n {\n code: 'policy_term_number',\n name: 'Term',\n type: 'number',\n is_hidden: false,\n is_sortable: true,\n is_searchable: true,\n is_link: false,\n link_type: '',\n additional_data: {\n flex: 0.1,\n minWidth: 70,\n },\n },\n {\n code: 'pol_named_insured',\n name: 'Named Insured',\n type: 'string',\n is_hidden: false,\n is_sortable: true,\n is_searchable: true,\n is_link: true,\n link_type: 'policyholder',\n additional_data: {\n flex: 1.1,\n minWidth: 160,\n },\n },\n {\n code: 'pol_business_phone_number',\n name: 'Business Phone',\n type: 'phone',\n is_hidden: true,\n is_sortable: true,\n is_searchable: true,\n is_link: false,\n link_type: '',\n additional_data: undefined,\n },\n {\n code: 'pol_business_email',\n name: 'Business Email',\n type: 'email',\n is_hidden: true,\n is_sortable: true,\n is_searchable: true,\n is_link: false,\n link_type: '',\n additional_data: undefined,\n },\n {\n code: 'owner_name',\n name: 'Producer',\n type: 'string',\n is_hidden: false,\n is_sortable: true,\n is_searchable: false,\n is_link: false,\n link_type: '',\n additional_data: {\n flex: 1.2,\n minWidth: 180,\n },\n },\n {\n code: 'agency',\n name: 'Agency',\n type: 'string',\n is_hidden: false,\n is_sortable: true,\n is_searchable: false,\n is_link: false,\n link_type: '',\n additional_data: {\n showOnlyForRoles: [userRoles.UNDERWRITER.code],\n flex: 1.4,\n minWidth: 140,\n },\n },\n {\n code: 'contract',\n name: 'Contract',\n type: 'string',\n is_hidden: false,\n is_sortable: true,\n is_searchable: false,\n is_link: false,\n link_type: '',\n additional_data: {\n showOnlyForRoles: [userRoles.UNDERWRITER.code],\n flex: 1.4,\n minWidth: 140,\n },\n },\n {\n code: 'channel',\n name: 'Channel',\n type: 'string',\n is_hidden: false,\n is_sortable: true,\n is_searchable: false,\n is_link: false,\n link_type: '',\n additional_data: {\n showOnlyForRoles: [userRoles.UNDERWRITER.code],\n minWidth: 100,\n },\n },\n {\n code: 'original_contract_start_time',\n name: 'Term Effective Date',\n type: 'date',\n is_hidden: false,\n is_sortable: true,\n is_searchable: false,\n is_link: false,\n link_type: '',\n additional_data: {\n minWidth: 130,\n },\n },\n {\n code: 'effective_contract_end_time',\n name: 'Expiration Date',\n type: 'date',\n is_hidden: true,\n is_sortable: true,\n is_searchable: false,\n is_link: false,\n link_type: '',\n additional_data: undefined,\n },\n {\n code: 'lead_owner',\n name: 'Lead Owner',\n type: 'string',\n is_hidden: false,\n is_sortable: true,\n is_searchable: true,\n is_link: false,\n link_type: '',\n additional_data: {\n minWidth: 120,\n showOnlyForRoles: [userRoles.THREE_DIRECT_SALES.code],\n },\n },\n {\n code: 'status',\n name: 'Status',\n type: 'string',\n is_hidden: false,\n is_sortable: false,\n is_searchable: false,\n is_link: false,\n link_type: '',\n additional_data: {\n minWidth: 140,\n headerAlign: 'center',\n },\n },\n ],\n QUOTE_COLUMNS: [\n {\n code: 'locator',\n name: 'Locator',\n type: 'number',\n is_hidden: true,\n is_sortable: true,\n is_searchable: true,\n is_link: false,\n link_type: '',\n additional_data: undefined,\n },\n {\n code: 'three_quote_number',\n name: 'Submission',\n type: 'string',\n is_hidden: false,\n is_sortable: true,\n is_searchable: true,\n is_link: true,\n link_type: 'quote',\n additional_data: {\n minWidth: 110,\n },\n },\n {\n code: 'version',\n name: 'Version',\n type: 'number',\n is_hidden: false,\n is_sortable: true,\n is_searchable: true,\n is_link: false,\n link_type: '',\n additional_data: {\n maxWidth: 80,\n },\n },\n {\n code: 'policyholder__name',\n name: 'Named Insured',\n type: 'string',\n is_hidden: false,\n is_sortable: true,\n is_searchable: true,\n is_link: false,\n link_type: '',\n additional_data: {\n minWidth: 120,\n },\n },\n {\n code: 'pol_business_phone_number',\n name: 'Business Phone',\n type: 'phone',\n is_hidden: true,\n is_sortable: true,\n is_searchable: true,\n is_link: false,\n link_type: '',\n additional_data: undefined,\n },\n {\n code: 'pol_business_email',\n name: 'Business Email',\n type: 'string',\n is_hidden: true,\n is_sortable: true,\n is_searchable: true,\n is_link: false,\n link_type: '',\n additional_data: undefined,\n },\n {\n code: 'owner__title',\n name: 'Producer',\n type: 'string',\n is_hidden: false,\n is_sortable: true,\n is_searchable: false,\n is_link: false,\n link_type: '',\n additional_data: {\n flex: 1.4,\n minWidth: 140,\n },\n },\n {\n code: 'agency',\n name: 'Agency',\n type: 'string',\n is_hidden: false,\n is_sortable: true,\n is_searchable: false,\n is_link: false,\n link_type: '',\n additional_data: {\n showOnlyForRoles: [userRoles.UNDERWRITER.code],\n flex: 1.4,\n minWidth: 140,\n },\n },\n {\n code: 'contract',\n name: 'Contract',\n type: 'number',\n is_hidden: false,\n is_sortable: true,\n is_searchable: false,\n is_link: false,\n link_type: '',\n additional_data: {\n showOnlyForRoles: [userRoles.UNDERWRITER.code],\n flex: 1.4,\n minWidth: 140,\n },\n },\n {\n code: 'channel',\n name: 'Channel',\n type: 'string',\n is_hidden: false,\n is_sortable: true,\n is_searchable: false,\n is_link: false,\n link_type: '',\n additional_data: {\n showOnlyForRoles: [userRoles.UNDERWRITER.code],\n minWidth: 100,\n },\n },\n {\n code: 'created_at',\n name: 'Created Date',\n type: 'date',\n is_hidden: false,\n is_sortable: true,\n is_searchable: false,\n is_link: false,\n link_type: '',\n additional_data: {\n minWidth: 120,\n },\n },\n {\n code: 'expired_at',\n name: 'Valid Thru',\n type: 'date',\n is_hidden: false,\n is_sortable: true,\n is_searchable: false,\n is_link: false,\n link_type: '',\n additional_data: {\n minWidth: 120,\n },\n },\n {\n code: 'contract_start_time',\n name: 'Effective Date',\n type: 'date',\n is_hidden: false,\n is_sortable: true,\n is_searchable: false,\n is_link: false,\n link_type: '',\n additional_data: {\n maxWidth: 140,\n },\n },\n {\n code: 'state__name',\n name: 'Status',\n type: 'string',\n is_hidden: false,\n is_sortable: true,\n is_searchable: false,\n is_link: false,\n link_type: '',\n additional_data: {\n maxWidth: 140,\n minWidth: 140,\n headerAlign: 'center',\n },\n },\n ],\n CONSUMERSUBMISSIONS_COLUMNS: [\n {\n code: 'locator',\n name: 'Locator',\n type: 'number',\n is_hidden: true,\n is_sortable: true,\n is_searchable: true,\n is_link: false,\n link_type: '',\n additional_data: undefined,\n },\n {\n code: 'three_quote_number',\n name: 'Submission Number',\n type: 'string',\n is_hidden: false,\n is_sortable: true,\n is_searchable: true,\n is_link: true,\n link_type: 'quote',\n additional_data: {\n minWidth: 110,\n },\n },\n {\n code: 'named_insured',\n name: 'Named Insured',\n type: 'string',\n is_hidden: false,\n is_sortable: true,\n is_searchable: true,\n is_link: false,\n link_type: '',\n additional_data: {\n minWidth: 120,\n },\n },\n {\n code: 'contact_name',\n name: 'Contact Name',\n type: 'string',\n is_hidden: false,\n is_sortable: true,\n is_searchable: true,\n is_link: false,\n link_type: '',\n additional_data: {\n minWidth: 120,\n },\n },\n {\n code: 'phone_number',\n name: 'Phone Number',\n type: 'phone',\n is_hidden: false,\n is_sortable: true,\n is_searchable: true,\n is_link: false,\n link_type: '',\n additional_data: {\n minWidth: 140,\n },\n },\n {\n code: 'email',\n name: 'Email',\n type: 'email',\n is_hidden: false,\n is_sortable: true,\n is_searchable: true,\n is_link: false,\n link_type: '',\n additional_data: {\n minWidth: 170,\n },\n },\n {\n code: 'effective_date',\n name: 'Effective Date',\n type: 'date',\n is_hidden: false,\n is_sortable: true,\n is_searchable: false,\n is_link: false,\n link_type: '',\n additional_data: {\n minWidth: 140,\n },\n },\n {\n code: 'created_at',\n name: 'Created at',\n type: 'date',\n is_hidden: false,\n is_sortable: true,\n is_searchable: false,\n is_link: false,\n link_type: '',\n additional_data: {\n minWidth: 140,\n },\n },\n {\n code: 'lead_owner',\n name: 'Lead Owner',\n type: 'string',\n is_hidden: false,\n is_sortable: true,\n is_searchable: true,\n is_link: false,\n link_type: '',\n additional_data: {\n minWidth: 120,\n showOnlyForRoles: [userRoles.UNDERWRITER.code, userRoles.THREE_DIRECT_SALES.code],\n },\n },\n {\n code: 'button',\n name: '',\n type: 'action_menu',\n is_hidden: false,\n is_sortable: false,\n is_link: false,\n link_type: '',\n additional_data: {\n minWidth: 50,\n maxWidth: 50,\n showOnlyForRoles: [userRoles.THREE_DIRECT_SALES.code],\n },\n },\n {\n code: 'status__name',\n name: 'Status',\n type: 'string',\n is_hidden: false,\n is_sortable: true,\n is_searchable: false,\n is_link: false,\n link_type: '',\n additional_data: {\n maxWidth: 150,\n minWidth: 150,\n headerAlign: 'center',\n },\n },\n {\n code: 'redirect',\n name: '',\n type: 'string',\n is_hidden: false,\n is_sortable: false,\n is_searchable: false,\n is_link: false,\n link_type: '',\n additional_data: {\n maxWidth: 30,\n minWidth: 30,\n },\n },\n ],\n RENEWAL_COLUMNS: [\n {\n code: 'locator',\n name: 'Locator',\n type: 'number',\n is_hidden: true,\n is_sortable: true,\n is_searchable: true,\n is_link: false,\n link_type: '',\n additional_data: undefined,\n },\n {\n code: 'three_policy_number',\n name: 'Policy Number',\n type: 'string',\n is_hidden: false,\n is_sortable: true,\n is_searchable: true,\n is_link: true,\n link_type: 'quote',\n additional_data: {\n minWidth: 150,\n maxWidth: 180,\n flex: 1.2,\n },\n },\n {\n code: 'policy_term_number',\n name: 'Term',\n type: 'number',\n is_hidden: false,\n is_sortable: true,\n is_searchable: true,\n is_link: false,\n link_type: '',\n additional_data: {\n flex: 0.1,\n minWidth: 70,\n },\n },\n {\n code: 'policyholder__name',\n name: 'Named Insured',\n type: 'string',\n is_hidden: false,\n is_sortable: true,\n is_searchable: true,\n is_link: false,\n link_type: '',\n additional_data: {\n minWidth: 120,\n flex: 1,\n },\n },\n {\n code: 'owner__title',\n name: 'Producer',\n type: 'string',\n is_hidden: false,\n is_sortable: true,\n is_searchable: false,\n is_link: false,\n link_type: '',\n additional_data: {\n flex: 1,\n minWidth: 140,\n },\n },\n {\n code: 'agency',\n name: 'Agency',\n type: 'string',\n is_hidden: false,\n is_sortable: true,\n is_searchable: false,\n is_link: false,\n link_type: '',\n additional_data: {\n showOnlyForRoles: [userRoles.UNDERWRITER.code],\n flex: 1.2,\n minWidth: 140,\n },\n },\n {\n code: 'contract',\n name: 'Contract',\n type: 'number',\n is_hidden: false,\n is_sortable: true,\n is_searchable: false,\n is_link: false,\n link_type: '',\n additional_data: {\n showOnlyForRoles: [userRoles.UNDERWRITER.code],\n flex: 1,\n minWidth: 140,\n },\n },\n {\n code: 'renewal_decision_deadline',\n name: 'Renewal Decision Deadline',\n type: 'date',\n is_hidden: false,\n is_sortable: true,\n is_searchable: false,\n is_link: false,\n link_type: '',\n additional_data: {\n minWidth: 120,\n flex: 1.2,\n },\n },\n {\n code: 'contract_start_time',\n name: 'Effective Date',\n type: 'date',\n is_hidden: false,\n is_sortable: true,\n is_searchable: false,\n is_link: false,\n link_type: '',\n additional_data: {\n maxWidth: 140,\n flex: 1.2,\n },\n },\n {\n code: 'state__name',\n name: 'Status',\n type: 'string',\n is_hidden: false,\n is_sortable: true,\n is_searchable: false,\n is_link: false,\n link_type: '',\n additional_data: {\n maxWidth: 130,\n minWidth: 130,\n headerAlign: 'center',\n flex: 1,\n },\n },\n ],\n};\n\nexport const YesNoChoices = [\n { code: 'Yes', name: 'Yes' },\n { code: 'No', name: 'No' },\n];\n\nexport const additionalInterestTypes = {\n LOSS_PAYEE: 'Loss Payee',\n MORTGAGEE: 'Mortgagee',\n};\n\nexport const multiChoiceSubjectOfInterestTypes = [\n additionalInterestTypes.LOSS_PAYEE,\n additionalInterestTypes.MORTGAGEE,\n];\n\nexport const businessInfoRenewalFields = ['pol_isrenewal', 'pol_isrenewal_conditional'];\n\nexport const mailingAddressFields = [\n {\n code: 'pol_mailing_address_line1',\n name: 'Address Line 1',\n is_optional: false,\n is_hidden: false,\n is_readonly: false,\n newline: false,\n type: 'autocomplete',\n additional_data: {\n space_above: true,\n prefer_ratio: 50,\n relatedFields: [\n {\n configFieldName: 'pol_mailing_address_line1',\n smartyFieldName: 'street_line',\n },\n {\n configFieldName: 'pol_mailing_address_line2',\n smartyFieldName: 'secondary',\n },\n {\n configFieldName: 'pol_mailing_city',\n smartyFieldName: 'city',\n },\n {\n configFieldName: 'pol_mailing_state',\n smartyFieldName: 'state',\n },\n {\n configFieldName: 'pol_mailing_zip',\n smartyFieldName: 'zipcode',\n },\n ],\n },\n service_bridge: {\n name: 'smarty',\n },\n },\n {\n code: 'pol_mailing_address_line2',\n name: 'Address Line 2',\n is_optional: true,\n is_hidden: false,\n is_readonly: false,\n newline: false,\n type: 'string',\n },\n {\n code: 'pol_mailing_city',\n name: 'City',\n is_optional: false,\n is_hidden: false,\n is_readonly: false,\n newline: false,\n type: 'string',\n },\n {\n code: 'pol_mailing_state',\n name: 'State',\n is_optional: false,\n is_hidden: false,\n is_readonly: false,\n newline: false,\n type: 'select',\n choices: stateList.map(({ code, name }) => ({ code, name })),\n additional_data: {\n setDefaultStateListAsChoices: true,\n },\n },\n {\n code: 'pol_mailing_zip',\n name: 'ZIP Code',\n is_optional: false,\n is_hidden: false,\n is_readonly: false,\n newline: false,\n type: 'number',\n maximum: 5,\n additional_data: {\n allowDecimal: false,\n allowLeadingZeros: true,\n thousandSeparator: false,\n },\n },\n];\n\nexport const lobAddressFields = [\n {\n code: 'pol_mailing_address_line1',\n name: 'Address Line 1',\n is_optional: false,\n is_hidden: false,\n is_readonly: false,\n newline: false,\n type: 'autocomplete',\n additional_data: {\n space_above: true,\n prefer_ratio: 50,\n relatedFields: [\n {\n configFieldName: 'pol_mailing_address_line1',\n lobFieldName: 'primary_line',\n },\n {\n configFieldName: 'pol_mailing_address_line2',\n lobFieldName: 'secondary_line',\n },\n {\n configFieldName: 'pol_mailing_city',\n lobFieldName: 'city',\n },\n {\n configFieldName: 'pol_mailing_state',\n lobFieldName: 'state',\n },\n {\n configFieldName: 'pol_mailing_zip',\n lobFieldName: 'zip_code',\n },\n ],\n },\n service_bridge: {\n name: 'lob',\n },\n },\n {\n code: 'pol_mailing_address_line2',\n name: 'Address Line 2',\n is_optional: true,\n is_hidden: false,\n is_readonly: false,\n newline: false,\n type: 'string',\n },\n {\n code: 'pol_mailing_city',\n name: 'City',\n is_optional: false,\n is_hidden: false,\n is_readonly: false,\n newline: false,\n type: 'string',\n },\n {\n code: 'pol_mailing_state',\n name: 'State',\n is_optional: false,\n is_hidden: false,\n is_readonly: false,\n newline: false,\n type: 'select',\n choices: stateList.map(({ code, name }) => ({ code, name })),\n additional_data: {\n setDefaultStateListAsChoices: true,\n },\n },\n {\n code: 'pol_mailing_zip',\n name: 'ZIP Code',\n is_optional: false,\n is_hidden: false,\n is_readonly: false,\n newline: false,\n type: 'number',\n maximum: 5,\n additional_data: {\n allowDecimal: false,\n allowLeadingZeros: true,\n thousandSeparator: false,\n },\n },\n];\n\nexport const subjectOfInterestFieldChoicesTypes = {\n PREMISES: 'premises',\n VEHICLES: 'vehicles',\n};\n\nexport const vehicleUsage = {\n COMMERCIAL: 'Commercial',\n};\n\nexport const { actions: CONFIG_QUERY_KEYS, name: CONFIG_QUERY_KEY } = createSliceDefinitions(\n 'config',\n {\n PRODUCTS: 'products',\n LOC_FILLING_ID_TABLE: 'locFillingIdTable',\n },\n);\n\nexport const { actions: KEY_VALUES_QUERY_KEYS, name: KEY_VALUES_QUERY_KEY } =\n createSliceDefinitions('keyValues', {\n SCHED_MOD_TABLE: keyValueTables.SCHED_MOD_TABLE,\n LOC_FILINGS_TABLE: keyValueTables.LOC_FILINGS_TABLE,\n WC_CLASS_CODE: keyValueTables.WC_CLASS_CODE,\n LIABILITY_PERILS: keyValueTables.LIABILITY_PERILS,\n SCHED_MOD_LINES_PERILS: keyValueTables.SCHED_MOD_LINES_PERILS,\n LIABILITY_PERILS_CLASS_CODES_AND_DESCRIPTION:\n keyValueTables.LIABILITY_PERILS_CLASS_CODES_AND_DESCRIPTION,\n BODY_CATEGORY: keyValueTables.BODY_CATEGORY,\n BODY_STYLE_TO_CATEGORY: keyValueTables.BODY_STYLE_TO_CATEGORY,\n MAKE_CD_MAKE_NM: keyValueTables.MAKE_CD_MAKE_NM,\n GCW: keyValueTables.GCW,\n TBL_GCW: keyValueTables.TBL_GCW,\n TBL_DEPRECIATION: keyValueTables.TBL_DEPRECIATION,\n CLASS_CODES: keyValueTables.CLASS_CODES,\n INDUSTRIES: keyValueTables.INDUSTRIES,\n CANCELLATION_GRACE_DAYS: keyValueTables.CANCELLATION_GRACE_DAYS,\n });\n\nexport const twentyFourHours = 1000 * 60 * 60 * 24;\n\nexport const prometrixKeyMappings = {\n square_footage_total: 'bdg_sqft',\n year_built: 'bdg_year_built',\n construction_class: 'bdg_construction_code',\n csp_occupancy_code: 'classCode',\n num_stories: 'bdg_num_stories',\n square_footage_occupied: 'bdg_sqft',\n has_sprinklers: 'bdg_issprinklered',\n};\n\nexport const selfReportedXmodStates = ['MI', 'NC', 'NJ', 'NY', 'PA', 'IN'];\n\nexport const mailingAddressFieldsCodes = mailingAddressFields.map((field) => field.code);\n\nexport const productOptions = [\n {\n code: 'Three With Workers Compensation',\n name: 'Three With Workers Compensation',\n },\n {\n code: 'Three Without Workers Compensation',\n name: 'Three Without Workers Compensation',\n },\n];\n\nexport const productBooleanOptions = [\n {\n code: true,\n name: 'With Workers Compensation',\n },\n {\n code: false,\n name: 'Without Workers Compensation',\n },\n];\n\nexport const advancedSearchFields: AdvancedSearchFields[] = [\n {\n code: 'policy-search',\n name: 'Policy',\n fields: [\n {\n code: 'three_policy_number',\n name: 'Policy Number',\n type: 'string',\n additional_data: {\n maximum: 10,\n },\n link_type: '',\n is_sortable: true,\n options: [],\n },\n {\n code: 'product__name',\n name: 'Product',\n type: 'select',\n additional_data: null,\n link_type: 'product',\n is_sortable: false,\n options: productOptions,\n },\n {\n code: 'policyholder__title',\n name: 'Named Insured',\n type: 'string',\n additional_data: null,\n link_type: 'policyholder',\n is_sortable: false,\n options: [],\n },\n {\n code: 'pol_business_phone_number',\n name: 'Business Phone',\n type: 'phone',\n additional_data: null,\n link_type: '',\n is_sortable: true,\n options: [],\n },\n {\n code: 'pol_business_email',\n name: 'Business Email',\n type: 'email',\n additional_data: null,\n link_type: '',\n is_sortable: true,\n options: [],\n },\n {\n type: 'group',\n code: 'state_and_zip_code',\n name: 'state and zip code',\n nested_fields: [\n {\n code: 'pol_state',\n name: 'State',\n type: 'multiselect',\n additional_data: null,\n link_type: '',\n is_sortable: true,\n options: [],\n },\n {\n code: 'pol_zip_code',\n name: 'Mailing ZIP Code',\n type: 'number',\n is_sortable: true,\n options: [],\n },\n ],\n },\n {\n code: 'info_agent_name',\n name: 'Producer',\n type: 'multiselect',\n additional_data: {\n showOnlyForRoles: 'underwriter',\n },\n link_type: 'agent',\n is_sortable: true,\n options: [],\n },\n {\n code: 'info_team_name',\n name: 'Team',\n type: 'multiselect',\n additional_data: {\n showOnlyForRoles: 'underwriter',\n },\n link_type: '',\n is_sortable: true,\n options: [],\n },\n {\n code: 'info_agency_name',\n name: 'Agency',\n type: 'multiselect',\n additional_data: {\n showOnlyForRoles: 'underwriter',\n },\n link_type: 'agency',\n is_sortable: true,\n options: [],\n },\n {\n code: 'agency_contract_name',\n name: 'Contract',\n type: 'multiselect',\n additional_data: {\n showOnlyForRoles: 'underwriter',\n },\n link_type: '',\n is_sortable: true,\n options: [],\n },\n {\n code: 'pol_ssn',\n name: 'SSN',\n type: 'string',\n is_sortable: true,\n options: [],\n },\n {\n code: 'pol_fein',\n name: 'FEIN',\n type: 'string',\n is_sortable: true,\n options: [],\n },\n {\n code: 'quotes__three_quote_number',\n name: 'Submission Number',\n type: 'string',\n additional_data: {\n maximum: 10,\n },\n link_type: 'quote',\n is_sortable: true,\n options: [],\n },\n ],\n },\n {\n code: 'quote-search',\n name: 'Submission',\n fields: [\n {\n code: 'three_quote_number',\n name: 'Submission Number',\n type: 'string',\n additional_data: {\n maximum: 10,\n },\n link_type: '',\n is_sortable: true,\n options: [],\n },\n {\n code: 'product__name',\n name: 'Product',\n type: 'select',\n additional_data: null,\n link_type: 'product',\n is_sortable: false,\n options: productOptions,\n },\n {\n code: 'policyholder__title',\n name: 'Named Insured',\n type: 'string',\n additional_data: null,\n link_type: 'policyholder',\n is_sortable: false,\n options: [],\n },\n {\n code: 'pol_business_phone_number',\n name: 'Business Phone',\n type: 'phone',\n additional_data: null,\n link_type: '',\n is_sortable: true,\n options: [],\n },\n {\n code: 'pol_business_email',\n name: 'Business Email',\n type: 'string',\n additional_data: null,\n link_type: '',\n is_sortable: true,\n options: [],\n },\n {\n type: 'group',\n code: 'state_and_zip_code',\n name: 'state and zip code',\n nested_fields: [\n {\n code: 'pol_state',\n name: 'State',\n type: 'multiselect',\n additional_data: null,\n link_type: '',\n is_sortable: true,\n options: [],\n },\n {\n code: 'pol_zip_code',\n name: 'Mailing ZIP Code',\n type: 'number',\n is_sortable: true,\n options: [],\n },\n ],\n },\n {\n code: 'info_agent_name',\n name: 'Producer',\n type: 'multiselect',\n additional_data: {\n showOnlyForRoles: 'underwriter',\n },\n link_type: 'agent',\n is_sortable: true,\n options: [],\n },\n {\n code: 'info_team_name',\n name: 'Team',\n type: 'multiselect',\n additional_data: {\n showOnlyForRoles: 'underwriter',\n },\n link_type: '',\n is_sortable: true,\n options: [],\n },\n {\n code: 'info_agency_name',\n name: 'Agency',\n type: 'multiselect',\n additional_data: {\n showOnlyForRoles: 'underwriter',\n },\n link_type: 'agency',\n is_sortable: true,\n options: [],\n },\n {\n code: 'agency_contract_name',\n name: 'Contract',\n type: 'multiselect',\n additional_data: {\n showOnlyForRoles: 'underwriter',\n },\n link_type: '',\n is_sortable: true,\n options: [],\n },\n {\n code: 'pol_ssn',\n name: 'SSN',\n type: 'string',\n is_sortable: true,\n options: [],\n },\n {\n code: 'pol_fein',\n name: 'FEIN',\n type: 'string',\n is_sortable: true,\n options: [],\n },\n ],\n },\n];\n\nexport const inputCharactersAllowedKeyValue = {\n NON_COMMA: 'nonComma',\n NON_DOUBLE_QUOTE_AND_BACKSLASH: 'nonDoubleQuoteAndBackslash',\n ALPHA_NUMERIC: 'alphaNumeric',\n};\n\nexport const transactionTypes = {\n quote: 'quote',\n policy: 'policy',\n endorsement: 'endorsement',\n} as const;\n\nexport const payPlanOptions = [\n { code: 'Annual', name: 'Annual' },\n { code: 'Monthly', name: 'Monthly' },\n];\n\nexport const zestyIntegrationFields = [\n 'bdg_wildfire_l1score',\n 'bdg_wildfire_l2score',\n 'bdg_storm_frequency_score',\n 'bdg_storm_severity_score',\n];\n\nexport const singleSelectableDrivingIncidentFieldNames = [\n 'At Fault Accident',\n 'At Fault Accident, <= $1000',\n 'At Fault Accident, > $1000',\n 'Not at fault accident: Rear-ended or Vehicle was Parked',\n 'Not at fault accident: Other/Unknown',\n];\n\nexport const stateTimezoneMap = {\n AL: 'America/Chicago',\n AZ: 'America/Denver',\n AR: 'America/Chicago',\n CA: 'America/Los_Angeles',\n CO: 'America/Denver',\n CT: 'America/New_York',\n DE: 'America/New_York',\n DC: 'America/New_York',\n FL: 'America/New_York',\n GA: 'America/New_York',\n ID: 'America/Denver',\n IL: 'America/Chicago',\n IN: 'America/New_York',\n IA: 'America/Chicago',\n KS: 'America/Chicago',\n KY: 'America/New_York',\n LA: 'America/Chicago',\n ME: 'America/New_York',\n MD: 'America/New_York',\n MA: 'America/New_York',\n MI: 'America/New_York',\n MN: 'America/Chicago',\n MS: 'America/Chicago',\n MO: 'America/Chicago',\n MT: 'America/Denver',\n NE: 'America/Chicago',\n NV: 'America/Los_Angeles',\n NH: 'America/New_York',\n NJ: 'America/New_York',\n NM: 'America/Denver',\n NY: 'America/New_York',\n NC: 'America/New_York',\n ND: 'America/Chicago',\n OH: 'America/New_York',\n OK: 'America/Chicago',\n OR: 'America/Los_Angeles',\n PA: 'America/New_York',\n RI: 'America/New_York',\n SC: 'America/New_York',\n SD: 'America/Chicago',\n TN: 'America/Chicago',\n TX: 'America/Chicago',\n UT: 'America/Denver',\n VT: 'America/New_York',\n VA: 'America/New_York',\n WA: 'America/Los_Angeles',\n WV: 'America/New_York',\n WI: 'America/Chicago',\n WY: 'America/Denver',\n} as const;\n","import React, { FC } from 'react';\n\ninterface IToastifyMessageProps {\n type?: string;\n message?: string | React.ReactNode;\n}\n\nconst ToastifyMessage: FC = ({ type, message }) => (\n
\n
\n {type}\n
\n
\n {message}\n
\n
\n);\n\nexport default ToastifyMessage;\n","import { notificationTypes } from 'common/constants';\nimport ToastifyMessage from 'components/ToastifyMessage';\nimport React from 'react';\nimport ReactDOMServer from 'react-dom/server';\nimport { Id, Slide, toast } from 'react-toastify';\n\n/**\n * The store of currently showing notifications.\n */\nconst showingToasts: { type: keyof typeof notificationTypes; message: string }[] = [];\n\nconst removeFromShowingToasts = (type: keyof typeof notificationTypes, message: string) => {\n const toastIndex = showingToasts.findIndex(\n (showingToast) => showingToast.type === type && showingToast.message === message,\n );\n\n showingToasts.splice(toastIndex, 1);\n};\n\nconst displayToastMessage = (\n type: keyof typeof notificationTypes,\n message: string | React.ReactNode,\n autoClose?: false | number,\n): Id => {\n /**\n * The toast content can be either a string or a React node.\n *\n * So we need to stringify the content as HTML before checking if it's showing or not.\n *\n * We cannot directly check React node with previous React nodes, it will always be diffrent even if they produce same HTML output. They have metadata that can be diffrent.\n */\n const stringifiedMessage = ReactDOMServer.renderToStaticMarkup(message as React.ReactElement);\n\n /**\n * Do not show the toast message if this type and content is already showing in UI.\n */\n if (\n showingToasts.find(\n (showingToast) => showingToast.type === type && showingToast.message === stringifiedMessage,\n )\n ) {\n return 'none';\n } else {\n /**\n * Add toast to the showing list.\n */\n showingToasts.push({ type, message: stringifiedMessage });\n\n /**\n * On close, either with user interaction or an automatic close, toast will be deleted from the list by `removeFromShowingToasts` method.\n */\n const onClose = () => removeFromShowingToasts(type, stringifiedMessage);\n\n switch (type) {\n case notificationTypes.ERROR:\n return toast.error(, {\n transition: Slide,\n draggable: false,\n closeOnClick: false,\n autoClose,\n onClose,\n });\n\n case notificationTypes.SUCCESS:\n return toast.success(, {\n transition: Slide,\n draggable: false,\n closeOnClick: false,\n autoClose,\n onClose,\n });\n\n case notificationTypes.INFO:\n return toast.info(, {\n transition: Slide,\n draggable: false,\n closeOnClick: false,\n autoClose,\n onClose,\n });\n\n case notificationTypes.WARNING:\n return toast.warning(, {\n transition: Slide,\n draggable: false,\n closeOnClick: false,\n autoClose,\n onClose,\n });\n\n default:\n return toast(, {\n transition: Slide,\n draggable: false,\n closeOnClick: false,\n autoClose,\n onClose,\n });\n }\n }\n};\n\nexport default displayToastMessage;\n","import { Auth } from 'api/models/Auth/auth.model';\nimport TokenStorage from 'helpers/TokenStorage';\nimport { createContext } from 'react';\n\n/// types\nimport { IAuthContext, IAuthStore } from './types';\n\nexport const getInitialUserStoreData = (): IAuthStore => {\n // Get if localStorage has saved token\n const auth: Auth | null = TokenStorage.get();\n\n return {\n auth,\n error: null,\n loading: false,\n verifyLoading: false,\n ssoLoading: false,\n };\n};\n\nexport const authContextDefault: IAuthContext = {\n ...getInitialUserStoreData(),\n signInWithSSO: () => new Promise(() => {}),\n signOutSSO: () => new Promise(() => {}),\n getAccessTokenFromSSO: () => new Promise(() => {}),\n};\n\nexport const AuthContext = createContext(null!);\n\nAuthContext.displayName = 'AuthContext';\n","import { createContext } from 'react';\n\n/// types\nimport { IDialogContextType, IDialogStore } from './types';\n\nexport const initialDialogData: IDialogStore = {\n dialogs: {} as IDialogStore['dialogs'],\n};\n\nexport const dialogContextDefault: IDialogContextType = {\n ...initialDialogData,\n resetDialogState: () => {},\n setDialogOpen: () => {},\n};\n\nexport const DialogContext = createContext(null!);\n","import ApiService, { Params } from 'api/helpers/Sender';\nimport { DocumentType } from 'api/models/Documents/documentType.model';\nimport { PolicyDocument } from 'api/models/Documents/policyDocument.model';\nimport { PolicyDocumentCreate } from 'api/models/Documents/policyDocumentCreate.model';\nimport { globalSearchTypes } from 'common/constants';\nimport { Pagination, PaginationResponse } from 'types/Pagination';\n\nconst API = new ApiService();\n\nexport const getDocumentsService = async (\n pagination: Pagination,\n reference_type: string,\n reference_locator: string,\n): Promise> => {\n const { data } = await API.get(\n `${reference_type}/${reference_locator}/all-documents`,\n pagination as Params,\n );\n return data;\n};\n\nexport const addDocumentService = async (\n reference_type: string,\n reference_locator: string,\n formData: FormData,\n): Promise => {\n const getAssociatedWithType = (type: string) => {\n switch (type) {\n case globalSearchTypes.POLICY:\n return 'policies';\n\n case globalSearchTypes.QUOTE:\n return 'quotes';\n\n default:\n return '';\n }\n };\n\n const { data } = await API.post(\n `${getAssociatedWithType(reference_type)}/${reference_locator}/${reference_type}-documents`,\n formData,\n {\n headers: {\n 'Content-Type': 'multipart/form-data',\n },\n },\n );\n return data;\n};\n\nexport const deleteDocumentService = async (policyId: string, documentLocator: string) => {\n await API.delete(`policies/${policyId}/policy-documents/${documentLocator}`);\n};\n\nexport const getDocumentWithLocator = async (\n policyLocator: string,\n documentLocator: string,\n): Promise => {\n const { data } = await API.get(`policies/${policyLocator}/all-documents/${documentLocator}`);\n return data;\n};\n\nexport const updateDocumentWithLocator = async (\n policyId: string,\n documentLocator: string,\n body: PolicyDocumentCreate,\n): Promise => {\n const { data } = await API.patch(\n `policies/${policyId}/policy-documents/${documentLocator}`,\n body,\n );\n return data;\n};\n\nexport const getDocumentTypesService = async (\n reference_type: string,\n): Promise> => {\n const { data } = await API.get(`document-types/?category=${reference_type}&page_size=10000`);\n return data;\n};\n","import { createContext } from 'react';\n\n/// types\nimport { IDocumentsContextType, IDocumentsStore } from './types';\n\nexport const initialDocumentsData: IDocumentsStore = {\n data: [],\n loading: true,\n loaded: false,\n selectedDocumentRow: undefined,\n activeDocument: {\n data: {},\n loading: true,\n loaded: false,\n },\n pagination: {\n ordering: '',\n page: 1,\n page_size: 20,\n search: '',\n total_count: 0,\n },\n};\n\nexport const documentsContextDefault: IDocumentsContextType = {\n ...initialDocumentsData,\n resetDocumentsState: () => {},\n fetch: () => new Promise(() => {}),\n fetchDocument: () => new Promise(() => {}),\n createDocument: () => new Promise(() => {}),\n deleteDocument: () => new Promise(() => {}),\n reFetchData: () => new Promise(() => {}),\n updateDocument: () => new Promise(() => {}),\n};\n\nexport const DocumentsContext = createContext(null!);\n","/* eslint-disable default-param-last */\n\nimport { Box } from '@mui/system';\nimport { errorCodes, genericErrorMessage } from 'common/constants';\nimport { isEmpty, isString } from 'lodash-es';\nimport { IAxiosError } from 'types/ErrorResponseTypes';\nimport displayToastMessage from './DisplayToastMessage';\n\nconst displayBackendErrorMessage = (\n error: any,\n defaultErrorMessage: string = genericErrorMessage(),\n autoClose?: false | number,\n) => {\n const e = error as IAxiosError;\n\n // Do not display an error message for this error.\n if (e.code === 'ERR_NETWORK') return '';\n\n if (e?.response?.data?.code === errorCodes.MISSING_EXPOSURES_OR_FIELD_GROUPS) {\n return displayToastMessage(\n 'ERROR',\n \n {defaultErrorMessage}\n \n {Object.values(e.response?.data?.field_errors).map((entry, index) => (\n
  • {entry as string}
  • \n ))}\n
    \n
    ,\n );\n }\n if (!Array.isArray(e?.response?.data?.messages) && typeof e?.response?.data === 'object') {\n return displayToastMessage(\n 'ERROR',\n !isEmpty(e.response?.data?.message) && isString(e.response?.data?.messages?.[0])\n ? e.response?.data?.message\n : defaultErrorMessage,\n autoClose,\n );\n } else if (Array.isArray(e?.response?.data?.messages)) {\n return displayToastMessage(\n 'ERROR',\n !isEmpty(e.response?.data?.messages) && isString(e.response?.data?.messages?.[0])\n ? e.response?.data?.messages?.[0]\n : defaultErrorMessage,\n autoClose,\n );\n } else {\n return displayToastMessage(\n 'ERROR',\n !isEmpty(e?.response?.data?.messages) && isString(e?.response?.data?.messages?.[0])\n ? e.response?.data?.messages?.[0]\n : defaultErrorMessage,\n autoClose,\n );\n }\n};\n\nexport default displayBackendErrorMessage;\n","/* see: https://pe.usps.com/text/pub28/28apc_002.htm */\n\nexport enum CommonStreetAbbrs {\n AVENUE = 'Ave',\n BOULEVARD = 'Blvd',\n COURT = 'Ct',\n DRIVE = 'Dr',\n LANE = 'Ln',\n PLACE = 'Pl',\n ROAD = 'Rd',\n STREET = 'St',\n TRAIL = 'Trl',\n}\n","/* eslint-disable no-restricted-globals */\n/* eslint-disable no-control-regex */\n/* eslint-disable consistent-return */\n/* eslint-disable array-callback-return */\n/* eslint-disable no-shadow */\n/* eslint-disable no-unused-expressions */\n/* eslint-disable default-param-last */\n/* eslint-disable no-restricted-syntax */\n/* eslint-disable no-param-reassign */\nimport { DynamicField } from 'api/models/DynamicFields/dynamicField.model';\nimport { AddressDifferenceInfo } from 'api/models/Locations/AddressDifferenceInfo.model';\nimport { AddressInfo } from 'api/models/Locations/AddressInfo.model';\nimport { AddressValidation } from 'api/models/Locations/AddressValidation.model';\nimport { LocationAddress } from 'api/models/Locations/Location.model';\nimport { EndorsementDetail } from 'api/models/Policy/Endorsements/endorsementDetail.model';\nimport { Data, Exposure } from 'api/models/Policy/Endorsements/exposure.model';\nimport { PropertyExposureField } from 'api/models/Quote/PropertyExposureField.model';\nimport {\n AllowedEffectiveDateRange,\n QuoteDetailResponse,\n} from 'api/models/Quote/quoteDetailResponse.model';\nimport { Filings } from 'api/models/THREEMappings/Filings/filings.model';\nimport { VehicleData } from 'api/models/Vehicle/Vehicle.model';\nimport {\n alphaNumericRegex,\n approvePropertyUWReportType,\n commaRegex,\n dataFieldTypes,\n defaultCurrency,\n defaultDateFormat,\n defaultTimezone,\n doubleQuoteOrBackslashRegex,\n endorsementExtraStatuses,\n firstDayOfYear1900,\n firstDayOfYear2024,\n genericErrorMessage,\n nonAlphaNumericRegex,\n nonCommaRegex,\n nonDoubleQuoteOrBackslashRegex,\n nonDrivableVehicles,\n nonRepeatingCharactersRegex,\n paginationKeys,\n phoneNumberRegex,\n productCodes,\n propertyExposureAffectPremiumCalculationsFields,\n propertyExposureBuildingOccupanciesKeyValue,\n propertyExposureScheduleBuildingFields,\n propertyExposureScheduleBuildingOccupancies,\n propertyExposureScheduleBuildingValidationsFields,\n quoteExtraStatuses,\n subjectOfInterestFieldChoicesTypes,\n submissionDetailInfoTabs,\n TAB_POSITIONS,\n threePolicyGroupNames,\n uwTaxOptions,\n} from 'common/constants';\nimport { IColumns } from 'components/Policies/PolicyDetail/Info/Tabs/AdditionalInterests';\nimport {\n addDays,\n addMinutes,\n addYears,\n differenceInDays,\n endOfDay,\n isAfter,\n isBefore,\n isEqual,\n parse,\n parseISO,\n startOfDay,\n} from 'date-fns';\nimport { fromZonedTime, toZonedTime } from 'date-fns-tz';\nimport { FormikProps } from 'formik';\nimport { t } from 'i18next';\nimport {\n capitalize,\n eq,\n filter,\n get,\n isArray,\n isEmpty,\n isString,\n keys,\n omit,\n range,\n toString,\n union,\n} from 'lodash-es';\nimport qs from 'query-string';\nimport { Dispatch, SetStateAction } from 'react';\nimport { CommonStreetAbbrs } from 'types/CommonStreetAbbrs';\nimport { DetailInfoTabsFieldsTypes } from 'types/DetailInfoTabsTypes';\nimport { IAxiosError } from 'types/ErrorResponseTypes';\nimport { v4 as uuidv4 } from 'uuid';\nimport * as yup from 'yup';\nimport { AnyObject } from 'yup/lib/types';\nimport { RadityError } from './AxiosInterceptor/types';\nimport displayToastMessage from './DisplayToastMessage';\n\nexport const getFirstValueIfArray = (arg: T[] | T): T => (Array.isArray(arg) ? arg[0] : arg);\n\nexport const getNestedValueFromObject = (object: T, key: string): any =>\n get(object, key.replace(/__/g, '.'), '-');\n\n/**\n * Returns changed keys between two object\n * @param o1 Object\n * @param o2 Object\n * @returns\n */\nexport const changedKeys = (o1: { [x: string]: any }, o2: { [x: string]: any }) => {\n const keysArray = union(keys(o1), keys(o2));\n return filter(keysArray, (key) => !eq(toString(o1[key]), toString(o2[key])));\n};\nexport const handleBackendErrorsWithFormik = (error: T, formik: any) => {\n const e = error as unknown as RadityError;\n if (e.isRadityError) {\n const tmpKeys: string[] = [];\n Object.entries(e.backendErrors!).forEach(([key, value]) => {\n if (value?.[0]) {\n tmpKeys.push(key);\n formik.setFieldError(key, value?.[0] ?? '');\n } else {\n Object.entries(value!).forEach(([childKey, childValue]) => {\n tmpKeys.push(childKey);\n formik.setFieldError(childKey, (childValue as any)?.[0] ?? '');\n });\n }\n });\n\n formik.setTouched(\n { ...formik.touched, ...tmpKeys.reduce((a, key) => ({ ...a, [`${key}`]: true }), {}) },\n false,\n );\n }\n};\nexport const handleBackendMultiErrorsWithFormik = (error: T, formik: any) => {\n const e = error as unknown as RadityError;\n if (e.isRadityError) {\n const touchedFields = {};\n const touchedFieldsArray = [];\n Object.entries(e.backendErrors!).forEach(([key, value]) => {\n Object.entries(value!).forEach(([childKey, childValue]) => {\n if (!isEmpty(childValue)) {\n Object.entries(childValue!).forEach(([fieldKey, fieldValue]) => {\n const childValues = Object.keys(childValue!).reduce(\n (a, key) => ({ ...a, [`${key}`]: true }),\n {},\n );\n touchedFieldsArray[childKey] = childValues;\n formik.setFieldError(`${key}[${childKey}][${fieldKey}]`, fieldValue);\n });\n }\n });\n touchedFields[key] = touchedFieldsArray;\n });\n formik.setTouched({ ...formik.touched, ...touchedFields }, false);\n }\n};\n\nexport const currencyFormat = (\n currency: string = defaultCurrency,\n value: string | number,\n withoutDecimals: boolean = false,\n) => {\n let c = currency;\n\n if (isEmpty(c)) {\n c = defaultCurrency;\n }\n\n if (c && value && value !== '-') {\n try {\n if (isArray(value)) {\n throw new Error();\n }\n\n const merged = new Intl.NumberFormat('en-US', {\n style: 'currency',\n currency: c,\n ...(withoutDecimals && { maximumFractionDigits: 0, minimumFractionDigits: 0 }),\n }).format(parseFloat(value as string));\n\n const formatted = {\n sign: '',\n value: '',\n merged,\n };\n\n const parts = new Intl.NumberFormat('en-US', {\n style: 'currency',\n currency: c,\n ...(withoutDecimals && { maximumFractionDigits: 0, minimumFractionDigits: 0 }),\n }).formatToParts(parseFloat(value as string));\n\n formatted.sign = parts?.[0].value;\n\n const tmpParts = [...parts];\n tmpParts.shift();\n formatted.value = tmpParts?.map((part) => part.value).join('');\n\n return formatted;\n } catch (_error) {\n return {\n sign: '',\n value: '',\n merged: '',\n };\n }\n } else {\n return {\n sign: '',\n value: '',\n merged: '',\n };\n }\n};\n\nexport const isDateOnlyString = (date: string) => {\n const regEx = /^\\d{4}-\\d{2}-\\d{2}$/;\n return isString(date) && date.match(regEx) != null;\n};\n\n/**\n * @example Field config\n {\n id: \"total\",\n label: \"Total People in Family\",\n placeholder: \"family members count\",\n type: \"text\",\n validationType: \"number\",\n required: false,\n value: \"1\",\n validations: [\n {\n type: \"required\",\n params: [\"this field is required\"]\n },\n {\n type: \"min\",\n params: [1, \"there should be atleast 1 family member\"]\n },\n {\n type: \"max\",\n params: [5, \"max family members can be 5\"]\n }\n ]\n }\n * @param schema\n * @param config\n * @returns\n */\n\nexport const displayIntegrationErrorMessage = (\n error: any,\n defaultErrorMessage: string = genericErrorMessage(),\n) => {\n const e = error as IAxiosError;\n const errorMessage = !isEmpty(e?.response?.data?.message)\n ? e.response?.data?.message\n : !isEmpty(e?.response?.data?.messages)\n ? e.response?.data?.messages?.[0]\n : defaultErrorMessage;\n\n displayToastMessage('ERROR', errorMessage);\n\n return errorMessage;\n};\n\nexport const getRoleShortCode = (code: string): string => {\n switch (code) {\n case 'underwriters':\n return 'UW';\n case 'portal-admin':\n return 'AD';\n default:\n return '';\n }\n};\n\nexport const decideValidationType = (type: string) => {\n switch (type) {\n case dataFieldTypes.NUMBER:\n return dataFieldTypes.NUMBER;\n case dataFieldTypes.PHONE:\n return dataFieldTypes.STRING;\n case dataFieldTypes.DATE:\n return dataFieldTypes.DATE;\n case dataFieldTypes.EMAIL:\n return dataFieldTypes.STRING;\n\n default:\n return dataFieldTypes.STRING;\n }\n};\n\nexport const addValidationToField = (field: DynamicField, checkRequired = true) => {\n if (!field.is_optional && checkRequired) {\n field.validationType = decideValidationType(field.type!);\n field.validations = [\n ...(field.validations ?? []),\n {\n type: 'required',\n params: [t('This field cannot be left blank.')],\n },\n ];\n }\n\n if (field.type === dataFieldTypes.PHONE) {\n field.validationType = decideValidationType(field.type!);\n field.validations = [\n ...(field.validations ?? []),\n {\n type: 'matches',\n params: [phoneNumberRegex, t('Enter a valid phone')],\n },\n ];\n }\n\n if (field.type === dataFieldTypes.DATE) {\n field.validationType = decideValidationType(field.type!);\n field.validations = [\n ...(field.validations ?? []),\n {\n type: 'nullable',\n params: [],\n },\n {\n type: 'typeError',\n params: [\n t('Invalid date format, Must be in {{dateFormat}}', { dateFormat: defaultDateFormat }),\n ],\n },\n ];\n }\n\n if (field.type === dataFieldTypes.EMAIL) {\n field.validationType = decideValidationType(field.type!);\n field.validations = [\n ...(field.validations ?? []),\n {\n type: 'email',\n params: [t('Enter a valid email address.')],\n },\n ];\n }\n return field;\n};\n// missing test function\nexport const addValidationsToFields = (fields: DynamicField[], checkRequired = true) => {\n for (const field of fields) {\n addValidationToField(field, checkRequired);\n }\n return fields;\n};\n\nexport const updateQueryStrings = ({\n locationSearch,\n newQueries,\n}: {\n locationSearch: string;\n newQueries: any;\n}) =>\n qs.stringify(\n {\n ...qs.parse(locationSearch),\n ...newQueries,\n },\n { sort: false },\n );\n\nexport const deleteFromQueryStrings = ({\n locationSearch,\n omitKeys,\n}: {\n locationSearch: string;\n omitKeys: string[];\n}) =>\n qs.stringify(\n omit(\n {\n ...qs.parse(locationSearch),\n },\n omitKeys,\n ),\n { sort: false },\n );\n\nexport const changeFieldsLoadingStatus = (\n fields: DynamicField[] = [],\n mustChangeFields: string[] = [],\n loading = false,\n) =>\n fields.map((f) => {\n const tmpField = { ...f };\n\n if (mustChangeFields.includes(f.code ?? '')) {\n if (isEmpty(tmpField.additional_data)) {\n tmpField.additional_data = {\n loading,\n };\n } else {\n tmpField.additional_data!.loading = loading;\n }\n }\n\n return tmpField;\n });\n\nexport const checkAndSetFieldsReadonlyState = (tmpField: DynamicField, isReadonly: boolean) => {\n tmpField.is_readonly = isReadonly;\n\n if (isEmpty(tmpField.additional_data)) {\n tmpField.additional_data = {\n is_readonly: isReadonly,\n };\n } else {\n tmpField.additional_data!.is_readonly = isReadonly;\n }\n return tmpField;\n};\n\nexport const changeFieldsHiddenStatus = (\n fields: DynamicField[] = [],\n mustChangeFields: string[] = [],\n hidden = false,\n) =>\n fields.map((f) => {\n const tmpField = { ...f };\n\n if (mustChangeFields.includes(f.code ?? '')) {\n tmpField.is_hidden = hidden;\n }\n\n return tmpField;\n });\n\nexport const makeFieldsReadonly = (\n fields: DynamicField[] = [],\n readOnlyFields: string[] = [],\n isReadonly = true,\n) =>\n fields.map((f) => {\n const tmpField = { ...f };\n\n if (readOnlyFields.includes(f.code ?? '')) {\n checkAndSetFieldsReadonlyState(tmpField, isReadonly);\n }\n\n return tmpField;\n });\n\nexport const makeFieldsRequired = (\n fields: DynamicField[] = [],\n requiredFields: string[] = [],\n isOptional = false,\n) =>\n fields.map((f) => {\n const tmpField = { ...f };\n\n if (requiredFields.includes(f.code ?? '')) {\n tmpField.is_optional = isOptional;\n }\n\n return tmpField;\n });\n\n// There was a performance issue with constant variable with regex value\n// So I couldn't store this regex value in constant variable, maybe change later.\n// There are two exceptions for \"-\" and \"'\" characters.\n// export const checkIfValueHasLetters = (value: string) => /^[a-zA-Z('\\-)\\s]*$/g.test(value);\nexport const checkIfValueHasLetters = (value: string) => /^[\\p{L}('\\-)\\s]*$/gu.test(value);\n\nexport const checkIfNonAlphaNumericCharacter = (value: string) => /\\W/gi.test(value);\n\n// '111, 222, 333'\nexport const checkIfStrContainsOnlyCommaSeparatedNumbers = (value: string) =>\n /^(\\d{5}(,\\s*)?)*$/.test(value);\n\n// https://dev.azure.com/radity-gmbh/THREE-insurance/_workitems/edit/8984/\nexport const formatLocation = (addressInfo: {\n addressLine1: string;\n addressLine2?: string;\n city?: string;\n state?: string;\n zip?: string;\n}) => {\n const { addressLine1 = '', addressLine2 = '', city = '', state = '', zip = '' } = addressInfo;\n\n return {\n storing: addressLine1 ? [addressLine1, addressLine2, city, state, zip].join(',') : '-',\n showing: {\n tail: ` ${state} ${zip}`,\n head: addressLine1\n ? `${addressLine1},${addressLine2 ? ` ${addressLine2}, ` : ' '}${city}`\n : '-',\n },\n };\n};\n\ninterface Team {\n addressLine1?: string;\n addressLine2?: string;\n city?: string;\n state?: string | null;\n zip?: string;\n}\n\nexport const formatLocationWithOptionalFields = (location: Team) => {\n let result = '';\n\n if (location.addressLine1) {\n result += `${location.addressLine1}, `;\n }\n\n if (location.addressLine2) {\n result += `${location.addressLine2}, `;\n }\n\n if (location.city) {\n result += `${location.city} `;\n }\n\n if (location.state) {\n result += `${location.state} `;\n }\n\n if (location.zip) {\n result += location.zip;\n }\n\n return result.replace(/,\\s*$/, '').trim(); // Remove unnecessary gaps at the end\n};\n\n/**\n * Parse location that stored as location formula\n *\n * https://dev.azure.com/radity-gmbh/THREE-insurance/_workitems/edit/8984/\n */\nexport const parseLocation = (location?: string) => {\n const [addressLine1 = '', addressLine2 = '', city = '', state = '', zip = ''] =\n location?.split(',') ?? [];\n\n return {\n addressLine1,\n addressLine2,\n city,\n state,\n zip,\n };\n};\n\nexport const getGroupTypeFields = (fields: any) =>\n Object.entries(fields ?? {}).reduce((a, [key, value]) => {\n if (isArray(value)) {\n return { ...a, [`${key}`]: value };\n }\n\n return a;\n }, {});\n\nexport const getEndorsementGroupTypeFields = (fields: any) =>\n Object.entries(fields ?? {}).reduce((a, [key, value]) => {\n if (isArray(value)) {\n let addedIndex = 0;\n\n return {\n ...a,\n [`${key}`]: value.map((item) => {\n const tmp = {\n ...item,\n ...(!item.locator\n ? { isNewAddedOnEndorsement: true, locator: uuidv4(), index: addedIndex }\n : {}),\n };\n\n if (!item.locator) {\n addedIndex += 1;\n }\n\n return tmp;\n }),\n };\n }\n\n return a;\n }, {});\n\nexport const getSymmetricDiffrence = (arr1: any[], arr2: any[]) =>\n arr1.filter((x) => !arr2.includes(x)).concat(arr2.filter((x) => !arr1.includes(x)));\n\nexport const determineOwnerOfficerPositions = (entity: string) => {\n const type = {\n position: '',\n title: '',\n description: '',\n };\n\n switch (entity) {\n case 'SoleProprietor': {\n type.position = 'Owner';\n type.title = 'List your business owner.';\n type.description =\n 'Only include individuals that perform work for your business or are involved in managing or directing day-to-day operations. Do not include outside or silent investors.';\n\n return type;\n }\n\n case 'LLC': {\n type.position = 'LLC Member';\n type.title = 'List all LLC members';\n type.description =\n 'Only include individuals that perform work for your business or are involved in managing or directing day-to-day operations. Do not include outside or silent investors.';\n\n return type;\n }\n\n case 'Corporation':\n case 'CorporationSCorp':\n case 'CorporationOther':\n case 'NonprofitOrganization': {\n type.position = 'Officer';\n type.title = 'List all corporate officers.';\n type.description =\n 'This includes President, Vice President, and/or other officer titles that were officially appointed or approved by ownership or the Board of Directors to manage or perform daily operations.';\n\n return type;\n }\n\n case 'Partnership': {\n type.position = 'Partner';\n type.title = 'List all partners.';\n type.description = 'Only include individual partners. Do not include non-person entities.';\n\n return type;\n }\n\n default:\n return type;\n }\n};\n\n/**\n * Checks field has value or not.\n *\n * By default it checks, `undifined`, `''`, and `null`\n *\n * With second paramether can add additionalCheks.\n * E.g: ['-'], will check `-` as well.\n *\n */\nexport const fieldHasValue = (value: any, additionalCheck?: any[]) =>\n [undefined, '', null, ...(additionalCheck ?? [])].every((condition) => condition !== value);\n\n/**\n * Finds the correct filing set ID by looking at the `policyEffectiveDate` and the `state`\n *\n * By default or if not found a correct filing set ID returns `-1`\n */\nexport const findFilingSetId = (filings: Filings[], state: string, policyEffectiveDate: Date) => {\n let filingSetId = -1;\n\n if (!policyEffectiveDate || isEmpty(filings)) {\n return filingSetId;\n }\n\n // if we found a `filingSetId` do not continue to iterate `break`\n for (const filingRecord of filings) {\n if (filingRecord.State === state) {\n const { EffectiveDate, ExpirationDate } = filingRecord;\n\n if (EffectiveDate) {\n const parsedEffective = parse(EffectiveDate!, 'yyyy-MM-dd', new Date());\n\n if (!ExpirationDate) {\n if (policyEffectiveDate.getTime() >= parsedEffective.getTime()) {\n filingSetId = filingRecord.FilingSetID!;\n break;\n }\n } else {\n const parsedExpirationDate = parse(ExpirationDate!, 'yyyy-MM-dd', new Date());\n\n if (\n policyEffectiveDate.getTime() >= parsedEffective.getTime() &&\n policyEffectiveDate.getTime() <= parsedExpirationDate.getTime()\n ) {\n filingSetId = filingRecord.FilingSetID!;\n break;\n }\n }\n }\n }\n }\n\n return filingSetId;\n};\n\nexport const sumTotalByKey = (array: any[], key: string) =>\n array?.reduce((acc, current) => {\n const value = parseFloat(current[key]) || 0;\n return acc + value;\n }, 0) ?? 0;\n\nexport const handleConditionalField = (field, state) => {\n const handleCondition = {\n select: (condition, fieldCode) => {\n const { value } = condition;\n return value.includes(state[fieldCode]);\n },\n number: (condition, fieldCode) => {\n const { value, operator } = condition;\n const operators = {\n '>': () => state[fieldCode] > +value,\n '<': () => state[fieldCode] < +value,\n };\n return operators[operator]();\n },\n string: (condition, fieldCode) => {\n const { value } = condition;\n\n return value === state[fieldCode];\n },\n };\n\n if (field?.condition && Object.keys(field.condition).length > 0) {\n const results: boolean[] = [];\n for (const [fieldCode, fieldConditions] of Object.entries(\n field.condition,\n ) as unknown as any[]) {\n const result = fieldConditions.every((condition) =>\n handleCondition[condition.type](condition, fieldCode),\n );\n results.push(result);\n }\n return results.every((result) => result);\n }\n return true;\n};\n\nexport const addRequiredValidationToDynamicFields: any = (\n formField: { [key: string]: any },\n state: { [key: string]: any },\n userRole: string | null = null,\n additionalValidation?: {\n fieldType?: string;\n validation: yup.StringSchema;\n },\n) => {\n const validateObj = {};\n const currentDateInUTC = fromZonedTime(new Date(), defaultTimezone);\n const taxNumberFieldPattern = /(fein|ssn)/;\n const zipCodeFieldPattern = /zip/;\n\n formField\n ?.filter((f) => {\n if (userRole && f.additional_data?.showOnlyForRoles) {\n return !!f.additional_data?.showOnlyForRoles?.includes(userRole);\n }\n return true;\n })\n .map((field) => {\n if (field.type === dataFieldTypes.DATE) {\n !field.is_optional &&\n !field.condition &&\n Object.assign(validateObj, {\n [field.code]: yup.date().when([], () => {\n if (field?.additional_data?.disableFuture && state[field.code] > currentDateInUTC) {\n return yup\n .date()\n .max(currentDateInUTC, t('Date must be earlier than today.') as string);\n }\n\n if (\n field?.additional_data?.disableDateBefore1900 &&\n state[field.code] < new Date(firstDayOfYear1900)\n ) {\n return yup\n .date()\n .min(new Date(firstDayOfYear1900), t('The date must be after 1900.') as string);\n }\n\n return yup\n .date()\n .nullable()\n .required(t('This field cannot be left blank.') as string)\n .typeError(\n t('Invalid date format, Must be in {{dateFormat}}', {\n dateFormat: defaultDateFormat,\n }) as string,\n );\n }),\n });\n } else if (field.type === dataFieldTypes.YEAR) {\n Object.assign(validateObj, {\n [field.code]: yup\n .number()\n .when([], {\n is: () => !field.is_optional && !field.condition,\n then: yup.number().required(t('This field cannot be left blank.') as string),\n })\n .when([], {\n is: () => field?.additional_data?.disableFuture,\n then: yup\n .number()\n .max(\n currentDateInUTC.getFullYear(),\n t(`The year can't be bigger then the current year.`) as string,\n ),\n })\n .when([], {\n is: () => field?.additional_data?.disableDateBefore1900,\n then: yup\n .number()\n .min(\n new Date(firstDayOfYear1900).getFullYear(),\n t(`The year can't be less then 1900.`) as string,\n ),\n })\n .when([], {\n is: () => field?.additional_data?.minLength,\n then: yup\n .number()\n .test(\n 'length',\n `This field should be ${field.additional_data.minLength} digits.`,\n (val) =>\n !val?.toString()\n ? true\n : val.toString().length === field.additional_data.minLength,\n ),\n })\n .when([], {\n is: () => field.code === 'yearFounded' && state.effective_date,\n then: yup\n .number()\n .max(\n new Date(state.effective_date).getFullYear(),\n t(`Year Business Founded cannot be greater than Policy Start Date.`) as string,\n ),\n }),\n });\n } else if (field.type === dataFieldTypes.EMAIL) {\n ((!field.is_optional && !field.condition) || !isEmpty(state[field.code])) &&\n Object.assign(validateObj, {\n [field.code]: yup\n .string()\n .email(t('This field must be a valid email address.') as string)\n .when([], {\n is: () => !field.is_optional,\n then: yup.string().required(t('This field cannot be left blank.') as string),\n })\n .when([], {\n is:\n additionalValidation?.fieldType === dataFieldTypes.EMAIL &&\n additionalValidation?.validation,\n then: yup.string().concat(additionalValidation?.validation!),\n }),\n });\n } else if (field.type === dataFieldTypes.PHONE) {\n ((!field.is_optional && !field.condition) || !isEmpty(state[field.code])) &&\n Object.assign(validateObj, {\n [field.code]: yup\n .string()\n .matches(phoneNumberRegex, t('Enter a valid phone.') as string)\n .when([], {\n is: () => !field.is_optional,\n then: yup.string().required(t('This field cannot be left blank.') as string),\n }),\n });\n } else if (taxNumberFieldPattern.test(field.code)) {\n const isAdditionalInterestTaxField = field.code.includes(\n threePolicyGroupNames.ADDITIONAL_INTEREST,\n );\n\n Object.assign(validateObj, {\n [field.code]: yup\n .string()\n .length(9, t('This field should be 9 digits.') as string)\n .when([], {\n is: () => !field.is_optional,\n then: yup.string().required(t('This field cannot be left blank.') as string),\n })\n .matches(\n nonRepeatingCharactersRegex,\n t(\n `Entering dummy information is against our terms of service. Enter accurate {{taxNumber}}${\n isAdditionalInterestTaxField\n ? '.'\n : ` or select \"I don't have this information right now.\"`\n } `,\n {\n taxNumber: field.code.includes(uwTaxOptions.FEIN.toLocaleLowerCase())\n ? uwTaxOptions.FEIN\n : uwTaxOptions.SOCIAL_SECURITY_NUMBER_ABBR,\n },\n ) as string,\n ),\n });\n } else if (zipCodeFieldPattern.test(field.code) && handleConditionalField(field, state)) {\n Object.assign(validateObj, {\n [field.code]: yup.string().when([], {\n is: () => !field.is_optional && field.maximum,\n then: yup\n .string()\n .length(field.maximum, t('Please enter a valid 5-digit Zip Code.') as string)\n .required(t('This field cannot be left blank.') as string),\n otherwise: yup.string().when([], {\n is: () => field.maximum,\n then: yup\n .string()\n .length(field.maximum, t('Please enter a valid 5-digit Zip Code.') as string),\n }),\n }),\n });\n } else if (field.code === 'pol_incidents_type') {\n !field.is_optional &&\n Object.assign(validateObj, {\n [field.code]: yup\n .string()\n .required(t('Please select at least one of the options below.') as string),\n });\n } else if (\n field.type === dataFieldTypes.NUMBER &&\n (field?.additional_data?.min || field?.additional_data?.max)\n ) {\n Object.assign(validateObj, {\n [field.code]: yup\n .number()\n .when([], {\n is: () => field?.additional_data?.min !== undefined,\n then: yup\n .number()\n .min(\n field?.additional_data?.min,\n t(`The value must be at least ${field?.additional_data?.min}.`) as string,\n ),\n })\n .when([], {\n is: () => field?.additional_data?.max !== undefined,\n then: yup\n .number()\n .max(\n field?.additional_data?.max,\n t(`The value must be no more than ${field?.additional_data?.max}.`) as string,\n ),\n })\n .when([], {\n is: () => !field?.is_optional && handleConditionalField(field, state),\n then: yup.number().required(t('This field cannot be left blank.') as string),\n otherwise: yup.number().nullable(),\n }),\n });\n } else {\n !field.is_optional &&\n handleConditionalField(field, state) &&\n Object.assign(validateObj, {\n [field.code]: yup\n .string()\n .trim()\n .required(t('This field cannot be left blank.') as string),\n });\n }\n });\n\n return {\n ...validateObj,\n ...(!additionalValidation?.fieldType && additionalValidation?.validation\n ? additionalValidation.validation\n : {}),\n };\n};\n\nexport const renderAddress = (data?: Data | null) => {\n const formatted = formatLocation({\n addressLine1: data?.loc_address_line1,\n addressLine2: data?.loc_address_line2,\n city: data?.loc_address_city,\n state: data?.loc_address_state,\n zip: data?.loc_address_zip,\n });\n return formatted.storing;\n};\n\n/**\nThis function takes in an object and an array of keys and finds the first key in the object that includes any of the keys in the array.\nIf a matching key is found, the corresponding value is returned. Otherwise, null is returned.\n@param {object} obj - The object to search through.\n@param {array} keys - An array of keys to search for.\n@returns - Returns the value of the first matching key found in the object, or null if no match is found.\n*/\nexport const findMatchingKey = (obj, keys: any[]) => {\n const objKeys = Object.keys(obj);\n const matchingKey = objKeys.find((key) => keys.some((k) => key.includes(k)));\n return matchingKey ? obj[matchingKey] : null;\n};\n\nexport const hasDiffKeyValues = (obj1: object, obj2: object, ...extraKeys: string[]) => {\n if (!obj2) return true;\n\n const paginationKeys = [\n 'ordering',\n 'page',\n 'page_size',\n 'search',\n 'state',\n 'status',\n 'lead_owner',\n ];\n const keysToControl = [...paginationKeys, ...extraKeys];\n\n return keysToControl.filter((key) => obj1[key] !== obj2[key])?.length !== 0;\n};\n\nexport const hasPaginationKeys = (location: string) =>\n paginationKeys.filter((key) => location.includes(key))?.length !== 0;\n\nexport const getMonthDifference = (startDate: Date, endDate: Date) => {\n const res =\n endDate.getMonth() -\n startDate.getMonth() +\n 12 * (endDate.getFullYear() - startDate.getFullYear());\n return Math.abs(res);\n};\n\nexport const splitTextByLine = (text: string): string[] => {\n const textArray: string[] = text.split('\\n');\n return textArray;\n};\n\n/*\n Function to restrict the input of characters based on specified validation rules.\n These rules can originate from the validationRelatedFieldNames parameter or directly from the field's configuration data.\n */\nexport const preventCharactersOnInputChange = ({\n inputValue,\n field,\n staticFieldCheck,\n validationRelatedFieldNames,\n}: {\n inputValue: string;\n field?: DynamicField;\n staticFieldCheck?: string[];\n validationRelatedFieldNames?: {\n fields?: string[];\n inputCharactersAllowed?: string[];\n }[];\n}) => {\n const regexes = {\n alphaNumeric: {\n test: alphaNumericRegex,\n replace: nonAlphaNumericRegex,\n },\n nonComma: {\n test: nonCommaRegex,\n replace: commaRegex,\n },\n nonDoubleQuoteAndBackslash: {\n test: nonDoubleQuoteOrBackslashRegex,\n replace: doubleQuoteOrBackslashRegex,\n },\n };\n\n const charactersTest = (inputCharactersAllowed: string[], inputValue: string): string => {\n return inputCharactersAllowed.reduce((updatedValue, restriction) => {\n const { test: testRegex, replace: replaceRegex } = regexes[restriction];\n\n if (testRegex && replaceRegex && !testRegex.test(updatedValue)) {\n return updatedValue.replace(replaceRegex, '');\n }\n\n return updatedValue;\n }, inputValue);\n };\n\n // Check the input values, when field object is not passed .\n if (staticFieldCheck?.length) {\n return charactersTest(staticFieldCheck, inputValue);\n }\n\n // Check the input values for dynamic fields, when field properties are defined.\n if (field) {\n if (validationRelatedFieldNames?.length) {\n const fieldToValidate = validationRelatedFieldNames.find(\n ({ fields, inputCharactersAllowed }) =>\n fields?.includes(field.code) && inputCharactersAllowed?.length,\n );\n\n if (fieldToValidate && fieldToValidate.inputCharactersAllowed) {\n return charactersTest(fieldToValidate.inputCharactersAllowed, inputValue);\n }\n }\n\n const inputCharactersAllowed = field?.additional_data?.inputCharactersAllowed;\n\n if (inputCharactersAllowed) {\n return charactersTest(inputCharactersAllowed, inputValue);\n }\n }\n\n return inputValue;\n};\n\nexport const cleanString = (text: string) => {\n // Replace whitespace characters and trim\n const cleanedText = text.replace(/\\s/g, ' ').trim();\n return cleanedText;\n};\n\nexport const redirectToProducerTab = ({\n currentTab,\n triggeredRules = false,\n productType,\n isDriversTabHidden,\n}: {\n currentTab: DetailInfoTabsFieldsTypes;\n triggeredRules?: boolean;\n productType: string | undefined;\n isDriversTabHidden?: boolean;\n}) => {\n const isProductCodeThreeWithWorkersCompensation =\n productType === productCodes.THREE_WITH_WORKERS_COMPENSATION;\n\n if (triggeredRules) {\n return currentTab.producer_NextTab;\n }\n\n if (!triggeredRules) {\n if (currentTab.nextTabWithNoDrivers && isDriversTabHidden) {\n return currentTab.nextTabWithNoDrivers;\n } else {\n return isProductCodeThreeWithWorkersCompensation\n ? currentTab.nextTabWithWC\n : currentTab.nextTabWithoutWC;\n }\n }\n};\n\nexport const findPositionTabClicked = (\n currentTab: string,\n clickedTab: string,\n submissionTabs: { [key: string]: any },\n) => {\n const currTabIndex = submissionTabs.findIndex((tab) => tab.code === currentTab);\n const clickedTabIndex = submissionTabs.findIndex((tab) => tab.code === clickedTab);\n\n return clickedTabIndex < currTabIndex ? TAB_POSITIONS.PREVIOUS : TAB_POSITIONS.NEXT;\n};\n\nexport const setNextPreviousTabUWSections = (codeActiveTab: string) => {\n if (codeActiveTab === submissionDetailInfoTabs.OPERATIONS_UW.code) {\n return {\n previousTab: submissionDetailInfoTabs.OPERATIONS.code,\n nextTab: submissionDetailInfoTabs.LOCATIONS.code,\n };\n }\n\n return {\n previousTab: submissionDetailInfoTabs.ADDITIONAL_INTEREST.code,\n nextTab: submissionDetailInfoTabs.SUMMARY_PRICING.code,\n };\n};\n\n// Checks if the field is optional\nexport const findOptionalFieldWithFieldCode = (\n allFields: PropertyExposureField[],\n code: string,\n): boolean | undefined => {\n const selectedFields = allFields.find((field) => field.code === code);\n return selectedFields ? selectedFields.is_optional : undefined;\n};\n\n// Check if the property has any of the required fields that affect the premium calculations\nexport const isAllRequiredFieldsFilled = (\n stateObj: QuoteDetailResponse,\n fieldsObj: PropertyExposureField[],\n properties: string[],\n): boolean => {\n const requiredFields = fieldsObj\n .filter(\n (field) =>\n properties.includes(field.code as string) && !field.is_optional && !field.is_hidden,\n )\n .map((field) => field.code);\n\n const extractedValues = Object.fromEntries(\n requiredFields.map((requiredField) => [requiredField, stateObj[requiredField as string]]),\n );\n\n const isNotEmpty = (value: any) =>\n (typeof value === 'string' && value.trim() !== '') ||\n (typeof value === 'number' && !isNaN(value));\n\n return Object.values(extractedValues).some((value) => !isNotEmpty(value));\n};\n\nexport const findAddressesDifference = (originalAddresss, verifiedAddress) => {\n const originalAddressPartsLine1 = originalAddresss?.loc_address_line1?.trim();\n const verifiedAddressPartsLine1 = verifiedAddress?.addressLine1?.trim();\n\n const originalAddressPartsLine2 = originalAddresss?.loc_address_line2?.trim();\n const verifiedAddressPartsLine2 = verifiedAddress?.addressLine2?.trim();\n\n const verifiedApartmentNumber = `${verifiedAddress?.secondaryDesignator} ${verifiedAddress?.secondaryNumber}`;\n\n const addressLine1Diff = verifiedAddressPartsLine1\n ?.split(' ')\n ?.filter((word) => !originalAddressPartsLine1?.split(' ')?.includes(word))\n ?.join(' ');\n\n // Should ignore difference in case correct apartment number displayed in addressLine2\n const shouldIgnoreDiff =\n !verifiedAddressPartsLine2 &&\n addressLine1Diff === originalAddressPartsLine2 &&\n verifiedApartmentNumber === originalAddressPartsLine2;\n\n const isAddressLine1Different = shouldIgnoreDiff\n ? false\n : originalAddressPartsLine1?.toLowerCase() !== verifiedAddressPartsLine1?.toLowerCase();\n\n const isAddressLine2Different =\n (isEmpty(originalAddressPartsLine2) && isEmpty(verifiedAddressPartsLine2)) || shouldIgnoreDiff\n ? false\n : originalAddressPartsLine2?.toLowerCase() !== verifiedAddressPartsLine2?.toLowerCase();\n\n const isCityNameDifferent =\n originalAddresss?.loc_address_city?.trim().toLowerCase() !==\n verifiedAddress?.city?.trim().toLowerCase();\n\n const isStateDifferent = originalAddresss?.loc_address_state !== verifiedAddress?.state;\n\n const isZipCodeDifferent = originalAddresss?.loc_address_zip !== verifiedAddress?.zip;\n\n return {\n differenceAddressParts: {\n addressLine1: {\n isDifferent: isAddressLine1Different,\n original: originalAddressPartsLine1,\n verified: verifiedAddressPartsLine1,\n },\n addressLine2: {\n isDifferent: isAddressLine2Different,\n original: originalAddressPartsLine2,\n verified: verifiedAddressPartsLine2,\n },\n city: {\n isDifferent: isCityNameDifferent,\n original: originalAddresss?.loc_address_city,\n verified: verifiedAddress?.city,\n },\n state: {\n isDifferent: isStateDifferent,\n original: originalAddresss?.loc_address_state,\n verified: verifiedAddress?.state,\n },\n zip: {\n isDifferent: isZipCodeDifferent,\n original: originalAddresss?.loc_address_zip,\n verified: verifiedAddress?.zip,\n },\n },\n\n isDifferent:\n isAddressLine1Different ||\n isAddressLine2Different ||\n isCityNameDifferent ||\n isStateDifferent ||\n isZipCodeDifferent,\n };\n};\n\nexport const createAddressInfo = (\n obj: {\n addressLine1: AddressDifferenceInfo;\n addressLine2: AddressDifferenceInfo;\n city: AddressDifferenceInfo;\n state: AddressDifferenceInfo;\n zip: AddressDifferenceInfo;\n },\n selectType: 'original' | 'verified',\n) => {\n const addressInfo: AddressInfo = {\n addressLine1: obj?.addressLine1?.[selectType] ?? '',\n addressLine2: obj?.addressLine2?.[selectType] || undefined,\n city: obj?.city?.[selectType] || undefined,\n state: obj?.state?.[selectType] || undefined,\n zip: obj?.zip?.[selectType] || undefined,\n };\n\n return addressInfo;\n};\n\nexport const formatStreetAbbr = (originalAddressLine: string) => {\n const replacements = {\n Avenue: CommonStreetAbbrs.AVENUE,\n 'Ave.': CommonStreetAbbrs.AVENUE,\n Ave: CommonStreetAbbrs.AVENUE,\n Boulevard: CommonStreetAbbrs.BOULEVARD,\n 'Blvd.': CommonStreetAbbrs.BOULEVARD,\n Blvd: CommonStreetAbbrs.BOULEVARD,\n Court: CommonStreetAbbrs.COURT,\n 'Ct.': CommonStreetAbbrs.COURT,\n Ct: CommonStreetAbbrs.COURT,\n Drive: CommonStreetAbbrs.DRIVE,\n 'Dr.': CommonStreetAbbrs.DRIVE,\n Dr: CommonStreetAbbrs.DRIVE,\n Lane: CommonStreetAbbrs.LANE,\n 'Ln.': CommonStreetAbbrs.LANE,\n Ln: CommonStreetAbbrs.LANE,\n Place: CommonStreetAbbrs.PLACE,\n 'Pl.': CommonStreetAbbrs.PLACE,\n Pl: CommonStreetAbbrs.PLACE,\n Road: CommonStreetAbbrs.ROAD,\n 'Rd.': CommonStreetAbbrs.ROAD,\n Rd: CommonStreetAbbrs.ROAD,\n Street: CommonStreetAbbrs.STREET,\n 'St.': CommonStreetAbbrs.STREET,\n St: CommonStreetAbbrs.STREET,\n Trail: CommonStreetAbbrs.TRAIL,\n 'Trl.': CommonStreetAbbrs.TRAIL,\n Trl: CommonStreetAbbrs.TRAIL,\n };\n\n const formattedAddress = originalAddressLine\n .split(' ')\n .map((word) => (replacements[capitalize(word)] ? replacements[capitalize(word)] : word))\n .join(' ');\n\n return formattedAddress;\n};\n\nexport const formatAddressCase = (originAddress: string, verifiedAddress: string) =>\n originAddress\n .split(' ')\n .map((originPart) => {\n const replacement = verifiedAddress\n .split(' ')\n .find((verifiedPart) => originPart.toLowerCase() === verifiedPart.toLowerCase());\n\n return replacement ?? originPart;\n })\n .join(' ');\n\nexport const formatLocationCase = (\n originLocation: LocationAddress,\n verifiedLocation: { addressData: AddressValidation; latitude: number; longitude: number },\n) => {\n const originalAddressLine1 = originLocation?.loc_address_line1 || '';\n const verifiedAddressLine1 = verifiedLocation?.addressData.addressLine1 || '';\n const formattedAddressLine1 = formatAddressCase(originalAddressLine1, verifiedAddressLine1);\n\n const originalAddressLine2 = originLocation?.loc_address_line2 || '';\n const verifiedApartmentNumber = `${verifiedLocation?.addressData?.secondaryDesignator} ${verifiedLocation?.addressData?.secondaryNumber}`;\n const verifiedAddressLine2 =\n verifiedLocation?.addressData?.addressLine2 || verifiedApartmentNumber || '';\n const formattedAddressLine2 = formatAddressCase(originalAddressLine2, verifiedAddressLine2);\n\n const originalCity = originLocation?.loc_address_city || '';\n const verifiedCity = verifiedLocation?.addressData?.city || '';\n const formattedCity = formatAddressCase(originalCity, verifiedCity);\n\n return {\n ...originLocation,\n loc_address_line1: formattedAddressLine1,\n loc_address_line2: formattedAddressLine2,\n loc_address_city: formattedCity,\n loc_address_lat: String(verifiedLocation?.latitude),\n loc_address_long: String(verifiedLocation?.longitude),\n };\n};\n\n/**\n * This function calculates product effective date range based on its effective date and the current date.\n * Used when the user creates a new submission and ensures that the effective date range conforms to business rules:\n * - starts tomorrow if the product is available now, otherwise starting on the first available day\n * - extends up to 90 days from the estimated minimum effective date.\n * @param productEffectiveDateString\n * @param timezone\n * @returns An object containing the formatted effective date, minimum effective date, and maximum effective date.\n */\nexport const getProductEffectiveDateRange = (\n productEffectiveDateString: string,\n timezone = defaultTimezone,\n) => {\n const convertZonedTimeToUtc = (date: Date | string) => fromZonedTime(new Date(date), timezone);\n const tomorrowZonedTime = startOfDay(toZonedTime(addDays(new Date(), 1), timezone));\n const tomorrow = convertZonedTimeToUtc(tomorrowZonedTime);\n const productEffectiveDate = convertZonedTimeToUtc(\n startOfDay(new Date(parseISO(productEffectiveDateString))),\n );\n\n // Minimum effective date logic:\n // Special case: if today is 12/31/2023, then the min effective date is 1/1/2024\n // else the min effective date is tomorrow\n const defaultMinEffectiveDate =\n differenceInDays(tomorrow, firstDayOfYear2024) < 0 ? new Date(firstDayOfYear2024) : tomorrow;\n\n const isProductAvailableNow = isBefore(productEffectiveDate, defaultMinEffectiveDate);\n\n // If product effective date later than tommorow we set min effective date to product effective date\n const minEffectiveDate = isProductAvailableNow ? defaultMinEffectiveDate : productEffectiveDate;\n\n // Maximum effective date logic: today or product effective date + 90 days\n const maxEffectiveDate = isProductAvailableNow\n ? convertZonedTimeToUtc(addDays(endOfDay(new Date()), 90))\n : convertZonedTimeToUtc(addDays(endOfDay(toZonedTime(minEffectiveDate, defaultTimezone)), 90));\n\n const effectiveDateRange = {\n productEffectiveDate,\n minEffectiveDate,\n maxEffectiveDate,\n };\n\n return effectiveDateRange;\n};\n\n/**\n * This function manage the visibility of a specific form field, veh_stated_amt, based on a series of conditions related to a vehicle's attributes.\n * Used when the user add vehicle by press \"Verify VIN\" button\n * https://3pager.visualstudio.com/NLS-3Pager-Agent-Portal/_workitems/edit/143066/\n * @param values vehicle's attributes (vin, msrp, year, category, subcategory e.t.c)\n * @param setFields callback function which set fields for vehicle form\n */\nexport const updateVisibilityOfEstimatedCurrentValueField = (\n values: VehicleData,\n setFields: Dispatch>,\n) => {\n const existedSubcategories = ['Ice Cream Truck', 'Food Truck', 'Stretched Limousine (Car/SUV)'];\n const categoryIsTrailer = values.veh_body_category === 'Trailer';\n const subcategoryIsExist = existedSubcategories.some((e) => e === values.veh_body_subcategory);\n const MSRP = values.veh_msrp;\n const vehicleAge = new Date().getFullYear() - values.veh_year;\n const estimatedCurrentValueFieldCode = 'veh_stated_amt';\n\n switch (true) {\n case !categoryIsTrailer && !subcategoryIsExist && MSRP > 0 && vehicleAge <= 15:\n setFields((prevFields) =>\n changeFieldsHiddenStatus(prevFields, [estimatedCurrentValueFieldCode], true),\n );\n break;\n\n case categoryIsTrailer:\n setFields((prevFields) =>\n changeFieldsHiddenStatus(prevFields, [estimatedCurrentValueFieldCode], false),\n );\n break;\n\n case !categoryIsTrailer && subcategoryIsExist:\n setFields((prevFields) =>\n changeFieldsHiddenStatus(prevFields, [estimatedCurrentValueFieldCode], false),\n );\n break;\n\n case !categoryIsTrailer && !subcategoryIsExist && MSRP <= 0:\n setFields((prevFields) =>\n changeFieldsHiddenStatus(prevFields, [estimatedCurrentValueFieldCode], false),\n );\n break;\n\n case !categoryIsTrailer && !subcategoryIsExist && MSRP > 0 && vehicleAge > 15:\n setFields((prevFields) =>\n changeFieldsHiddenStatus(prevFields, [estimatedCurrentValueFieldCode], false),\n );\n break;\n default:\n }\n};\n\n/**\n * This function checks if policy has uw result that requires attention by checking the extra status of policy.\n * Used when deciding to show provisional UW results tab.\n * @param extraStatuses An constant containing status codes.\n * @param underwritingQuestionsResponse\n * @returns a boolean value indicating whether the extra_status is one of these two specific statuses.\n */\nexport const isUWQuestionsResponseExtraStatusReferOrDecline = (\n extraStatuses,\n underwritingQuestionsResponse?: QuoteDetailResponse | EndorsementDetail,\n) =>\n underwritingQuestionsResponse?.extra_status === extraStatuses.HAS_DECLINE.code ||\n underwritingQuestionsResponse?.extra_status === extraStatuses.HAS_REFER.code;\n\n/**\n * This function manage validation type(required) depends on hidden status of Estimated Current Value Field(veh_stated_amt)\n * Used in commonValidations for vehicle form\n * https://3pager.visualstudio.com/NLS-3Pager-Agent-Portal/_workitems/edit/143066/\n * @param values vehicle's attributes (vin, msrp, year, category, subcategory e.t.c)\n * @param fields vehicle's form fields\n */\nexport const handleEstimatedCurrentValueFieldValidation = (fields: DynamicField[]) => {\n const field = fields.find((e) => e.code === 'veh_stated_amt');\n\n return field?.is_hidden\n ? { veh_stated_amt: yup.string() }\n : { veh_stated_amt: yup.string().required(t('This field cannot be left blank.') as string) };\n};\n\n/**\n * Updates the `bdg_prometrix_hit` field in the state based on specific conditions.\n *\n * This function sets `bdg_prometrix_hit` only for schedule building occupancies.\n * If `isIntegrationResultsChanged` is true, it sets the `bdg_prometrix_hit` field\n * to 'No' and then updates it to 'Yes' if the `isIntegrationResultsChanged` flag is false\n * and either `bdg_erc_building` matches the `initial_integration_result.bdg_erc_building` or\n * `bdg_uw_report_type` is included in the `approvePropertyUWReportType` array.\n *\n * @param {Data} state - The current state object.\n * @param {React.Dispatch>} setState - The state update function.\n * @param {boolean} areCharacteristicsFieldsNotChanged - Flag indicating if the user changed inittial integration results.\n */\nexport const setBdgPrometrixHitValue = (\n state: Data,\n setState: React.Dispatch>,\n areCharacteristicsFieldsNotChanged: boolean,\n) => {\n if (\n state?.bdg_occupancy &&\n propertyExposureScheduleBuildingOccupancies.includes(state?.bdg_occupancy)\n ) {\n let bdg_prometrix_hit = 'No';\n\n if (areCharacteristicsFieldsNotChanged) {\n if (\n (state?.bdg_erc_building &&\n String(state?.bdg_erc_building) ===\n String(state?.initial_integration_result?.bdg_erc_building)) ||\n approvePropertyUWReportType.includes(state?.bdg_uw_report_type)\n ) {\n bdg_prometrix_hit = 'Yes';\n }\n }\n\n setState((prevState) => ({\n ...prevState,\n bdg_prometrix_hit,\n }));\n\n return bdg_prometrix_hit;\n } else {\n setState((prevState) => ({\n ...omit(prevState, 'bdg_prometrix_hit'),\n }));\n }\n};\n\n/**\n * Sorting rows by main status\n *\n * Using in WCExposures to sort rows for WC payroll data table by main status\n *\n * @param values - accept rows which uses in DataTable\n */\nexport const sortComputedWcRowsByMainStatus = (values) => {\n return [...values].sort((a, b) => (a.isMain === 'Yes' && b.isMain === 'No' ? -1 : 1));\n};\n\n/**\n * Creates a grid columns visibility model based on their hidden status.\n *\n * @param {IColumns[]} columns - An array of column objects. Each object represents a column and contains the following properties:\n * @param {string} columns[].name - The name of the column.\n * @param {boolean} [columns[].is_hidden] - A boolean indicating whether the column is hidden. If `true`, the column is hidden; otherwise, it is visible.\n *\n * @returns {object} - A model where the keys are the names of the hidden columns, and the values are all set to `false`, indicating that these columns are hidden.\n */\nexport const createColumnVisibilityModel = (columns: IColumns[]) => {\n const model = {};\n columns.forEach((field) => {\n if (field.is_hidden) {\n model[field.name] = false;\n }\n });\n return model;\n};\n\n// This function is used to determine if a promise was successfully fulfilled\nexport const isFulfilled = (\n response: PromiseSettledResult,\n): response is PromiseFulfilledResult => response.status === 'fulfilled';\n\n/**\n * This function updates the recentlyAccessedPoliciesSubmissions in localStorage by adding a new entry to either the 'policies' or 'submissions' list,\n * ensuring no duplicates and limiting the list to the most recent four entries.\n */\nexport const setRecentlyAccessedPoliciesSubmissions = (\n type: 'policies' | 'submissions',\n userEmail: string,\n data: { number: string; locator: string },\n) => {\n const storageKey = 'recentlyAccessedPoliciesSubmissions';\n const storedData: {\n userEmail: {\n policies: {\n number: string;\n locator: string;\n }[];\n submissions: {\n number: string;\n locator: string;\n }[];\n };\n } = JSON.parse(localStorage.getItem(storageKey) || '{}');\n const previousEntries = storedData?.[userEmail]?.[type] || [];\n const isAlreadyAccessed = previousEntries.some((entry) => entry.number === data.number);\n\n if (isAlreadyAccessed) return;\n\n const updatedEntries = [data, ...previousEntries].slice(0, 4);\n\n const updatedData = {\n ...storedData,\n [userEmail]: {\n ...storedData[userEmail],\n [type]: updatedEntries,\n },\n };\n\n localStorage.setItem(storageKey, JSON.stringify(updatedData));\n};\n\n/**\n * This function sets an error on the effective date if it falls outside the allowed range.\n * It checks whether the effective date is within the allowedEffectiveDateRange.\n * If the date is earlier or later than the allowed range, an error is triggered, and a toast is displayed.\n * If the minimum date matches the product's effective date, the original logic and form validation rules apply.\n */\nexport const compareEffectiveDateWithAllowedEffectiveDateRange = ({\n effectiveDate,\n allowedEffectiveDateRange,\n productEffectiveDate,\n formatDateInTimeZone,\n convertZonedTimeToUtc,\n}: {\n effectiveDate?: Date;\n allowedEffectiveDateRange?: AllowedEffectiveDateRange;\n productEffectiveDate: Date;\n formatDateInTimeZone: (\n date: string | Date | undefined,\n dateFormat?: string | undefined,\n ) => string;\n convertZonedTimeToUtc: (date: string | Date) => Date;\n}) => {\n if (!allowedEffectiveDateRange || !effectiveDate) return {};\n\n const { minimum_available_date, maximum_available_date } = allowedEffectiveDateRange;\n\n const maxDate =\n maximum_available_date &&\n convertZonedTimeToUtc(startOfDay(new Date(parseISO(maximum_available_date))));\n\n const minDate =\n minimum_available_date &&\n convertZonedTimeToUtc(startOfDay(new Date(parseISO(minimum_available_date))));\n\n const isDateEarlierMinAvailable =\n minDate && !isEqual(minDate, productEffectiveDate) ? isBefore(effectiveDate, minDate) : false;\n\n const isDateLaterMaxAvailable = maxDate ? isAfter(effectiveDate, maxDate) : false;\n\n if (isDateEarlierMinAvailable) {\n displayToastMessage(\n 'ERROR',\n `Earliest available date for this version of product is ${formatDateInTimeZone(\n minDate,\n )}. Please create new policy if you want effective date to be earlier.`,\n );\n\n return {\n effective_date: `The Policy Effective Date cannot be earlier than ${formatDateInTimeZone(\n minDate,\n )}.`,\n };\n }\n\n if (isDateLaterMaxAvailable) {\n displayToastMessage(\n 'ERROR',\n `Latest available date for this version of product is ${formatDateInTimeZone(\n maxDate!,\n )}. Please create new policy if you want effective date to be later.`,\n );\n\n return {\n effective_date: `The Policy Effective Date cannot be later than ${formatDateInTimeZone(\n maxDate!,\n )}.`,\n };\n }\n\n return {};\n};\n\nexport const getDrivableVehicles = (vehicleExposures: Exposure['data']) => {\n return vehicleExposures?.filter(\n (vehicle) => !nonDrivableVehicles.includes(vehicle?.data?.veh_body_category),\n );\n};\n\nexport const getIsDriverTabHidden = (vehicleExposures: Exposure['data']) => {\n return (getDrivableVehicles(vehicleExposures)?.length || 0) > 5;\n};\n\nexport const getSubjectOfInterestFieldChoices = (type: string, exposures: Exposure[]) => {\n const getNameChoiceAndTrimLastComma = (arr: string[]) =>\n arr.filter(Boolean).join(', ').replace(/,\\s*$/, '');\n\n if (type === subjectOfInterestFieldChoicesTypes.PREMISES) {\n const premisesChoices = exposures.map((premise) => {\n const { data } = premise;\n const locator = premise.is_newly_added\n ? `building-new-added-${premise.index}`\n : premise?.locator ?? '';\n\n const {\n addressLine1,\n addressLine2,\n city,\n state: locationState,\n zip,\n } = parseLocation(data?.bdg_location);\n\n return {\n code: locator,\n name: getNameChoiceAndTrimLastComma([\n data?.bdg_name,\n addressLine1,\n addressLine2,\n city,\n locationState,\n zip,\n ]),\n };\n });\n\n return premisesChoices;\n }\n\n const vehiclesChoices = exposures.map((vehicle) => {\n const { data } = vehicle;\n const locator = vehicle.is_newly_added\n ? `vehicle-new-added-${vehicle.index}`\n : vehicle?.locator ?? '';\n\n return {\n code: locator,\n name: getNameChoiceAndTrimLastComma([\n data?.veh_year,\n data?.veh_model,\n data?.veh_make,\n data?.veh_vin,\n ]),\n };\n });\n\n return vehiclesChoices;\n};\n\nexport const getVintelligenceYears = () => {\n return range(1961, new Date().getFullYear() + 1).reverse();\n};\n\nexport const addYearsDstSafe = (date: Date, amount: number) => {\n const endDate = addYears(date, amount);\n return addMinutes(endDate, date.getTimezoneOffset() - endDate.getTimezoneOffset());\n};\n\nexport const setTouchedForErrorFields = (\n fields: string[],\n formik: FormikProps<{ [key: string]: any }>,\n setTouched?: boolean,\n) => {\n const hasErrors = fields.some((field) => field in formik.errors);\n\n if (hasErrors && setTouched) {\n fields.forEach((field) => {\n if (field in formik.errors) {\n formik.setFieldTouched(field);\n }\n });\n }\n\n return hasErrors;\n};\n\nexport const getTooltipMessageForSubmissionActions = ({\n showDeclineMessage = false,\n isTaxIDInvalid,\n areRenewalFieldsInvalid,\n isQuoteOrReferButtonActive,\n submissionOrRenewalEntityTypeLower,\n}: {\n showDeclineMessage?: boolean;\n isTaxIDInvalid?: boolean;\n areRenewalFieldsInvalid?: boolean;\n isQuoteOrReferButtonActive?: boolean;\n submissionOrRenewalEntityTypeLower: string;\n}) => {\n const stepsIncompleteMessage = `All steps should be completed and price indication should be fetched to quote this ${submissionOrRenewalEntityTypeLower}.`;\n const taxIDMessage = 'Enter TAX ID information to Quote/Refer.';\n const renewalMessage = 'Renewal information is not complete on the Coverage Summary tab.';\n const declineMessage = quoteExtraStatuses.HAS_DECLINE.tooltip;\n\n const baseMessage = showDeclineMessage\n ? declineMessage\n : !isQuoteOrReferButtonActive\n ? stepsIncompleteMessage\n : '';\n\n return [\n baseMessage,\n isTaxIDInvalid ? `\\n${taxIDMessage}` : '',\n areRenewalFieldsInvalid ? `\\n${renewalMessage}` : '',\n ].join('');\n};\n\nexport const getTooltipMessageForEndorsementActions = ({\n showDeclineMessage = false,\n showReferMessage = false,\n isTaxIDInvalid,\n isReferButtonActive,\n}: {\n showDeclineMessage?: boolean;\n isTaxIDInvalid?: boolean;\n showReferMessage?: boolean;\n isReferButtonActive?: boolean;\n}) => {\n const stepsIncompleteMessage = `All steps should be completed and price indication should be fetched to refer this endorsement.`;\n const taxIDMessage = 'Enter TAX ID information to Refer.';\n const declineMessage = endorsementExtraStatuses.HAS_DECLINE.tooltip;\n const referMessage = endorsementExtraStatuses.HAS_REFER.tooltip;\n\n const baseMessage = showDeclineMessage\n ? declineMessage\n : showReferMessage\n ? referMessage\n : !isReferButtonActive\n ? stepsIncompleteMessage\n : '';\n\n return [baseMessage, isTaxIDInvalid ? `\\n${taxIDMessage}` : ''].join('');\n};\n\nexport const formatNumberWithCommas = (value: number | string): string => {\n const numberValue = typeof value === 'string' ? parseFloat(value) : value;\n return numberValue.toLocaleString('en-US');\n};\n\nexport const updateVisibilityOfPremiseFields = ({\n fields,\n bdgOccupancy,\n setFields,\n updateRequiredFields,\n}: {\n fields: DynamicField[];\n bdgOccupancy: string;\n setFields: Dispatch>;\n updateRequiredFields?: boolean;\n}) => {\n let newFields = fields;\n\n let fieldsToHide: string[] = [];\n let fieldsToShow: string[] = [];\n let fieldsToSetRequired: string[] = [];\n let fieldsToSetOptional: string[] = [];\n\n if (\n [\n propertyExposureBuildingOccupanciesKeyValue.HOME_APARTMENT,\n propertyExposureBuildingOccupanciesKeyValue.KIOSK,\n propertyExposureBuildingOccupanciesKeyValue.SHARED_COWORKING_SPACE,\n ].includes(bdgOccupancy)\n ) {\n fieldsToHide = [...fieldsToHide, ...propertyExposureAffectPremiumCalculationsFields];\n } else {\n fieldsToShow = [...fieldsToShow, ...propertyExposureAffectPremiumCalculationsFields];\n }\n\n if (!propertyExposureScheduleBuildingOccupancies.includes(bdgOccupancy)) {\n fieldsToHide = [...fieldsToHide, ...propertyExposureScheduleBuildingFields];\n fieldsToSetOptional = [\n ...fieldsToSetOptional,\n ...propertyExposureScheduleBuildingValidationsFields,\n ];\n } else {\n fieldsToShow = [...fieldsToShow, ...propertyExposureScheduleBuildingFields];\n fieldsToSetRequired = [\n ...fieldsToSetRequired,\n ...propertyExposureScheduleBuildingValidationsFields,\n ...propertyExposureAffectPremiumCalculationsFields,\n ];\n }\n\n newFields = changeFieldsHiddenStatus(newFields, fieldsToHide, true);\n newFields = changeFieldsHiddenStatus(newFields, fieldsToShow);\n\n if (updateRequiredFields) {\n newFields = makeFieldsRequired(newFields, fieldsToSetRequired);\n newFields = makeFieldsRequired(newFields, fieldsToSetOptional, true);\n }\n\n setFields(newFields);\n\n return newFields;\n};\n","import ApiService, { Params } from 'api/helpers/Sender';\nimport {\n IPolicyHoldersPagination,\n PolicyholderCreateRequest,\n PolicyholderPageResponse,\n PolicyholderResponse,\n} from 'api/models/Policyholder/policyholder.model';\n\nconst API = new ApiService();\n\nexport const updatePolicyholderWithLocator = async (\n body: PolicyholderCreateRequest,\n policyholderlocator: string,\n): Promise => {\n const { data } = await API.put(`policyholders/${policyholderlocator}`, body);\n return data;\n};\n\nexport const getPolicyholders = async (\n query: IPolicyHoldersPagination,\n): Promise => {\n const { data } = await API.get('policyholders', query as Params);\n return data;\n};\n","import ApiService, { Params } from 'api/helpers/Sender';\nimport {\n IAuxDataPrometrix,\n IPrometrixData,\n} from 'api/models/Integrations/Prometrix/AddressRequest.model';\nimport { BulkExposureUpdateEndorsementRequest } from 'api/models/Policy/Endorsements/bulkExposureUpdateEndorsementRequest.model';\nimport { BulkExposureUpdateEndorsementResponse } from 'api/models/Policy/Endorsements/bulkExposureUpdateEndorsementResponse.model';\nimport { CreateEndorsementExposure } from 'api/models/Policy/Endorsements/createEndorsementExposure.model';\nimport { CreateEndorsementRequest } from 'api/models/Policy/Endorsements/createEndorsementRequest.model';\nimport { CreateEndorsementResponse } from 'api/models/Policy/Endorsements/createEndorsementResponse.model';\nimport { IEndorsementDescription } from 'api/models/Policy/Endorsements/endorsementDescription.model';\nimport { EndorsementDetail } from 'api/models/Policy/Endorsements/endorsementDetail.model';\nimport { EndorsementInvoice } from 'api/models/Policy/Endorsements/endorsementInvoice.model';\nimport { EndorsementPriceChange } from 'api/models/Policy/Endorsements/endorsementPriceChange.model';\nimport { EndorsementType } from 'api/models/Policy/Endorsements/endorsementType.model';\nimport { Exposure } from 'api/models/Policy/Endorsements/exposure.model';\nimport { UpdateEndorsement } from 'api/models/Policy/Endorsements/updateEndorsement.model';\nimport { UpdateEndorsementExposure } from 'api/models/Policy/Endorsements/updateEndorsementExposure.model';\nimport { PolicyChanges } from 'api/models/Policy/policyChanges.model';\nimport { PolicyPriceChangeBreakdown } from 'api/models/Policy/policyPriceChangeBreakdown.model';\nimport { IPolicyholder } from 'api/models/Policyholder/policyholder.model';\nimport { PaginationResponse } from 'types/Pagination';\nimport { updatePolicyholderWithLocator } from './Policyholders';\n\nconst API = new ApiService();\n\nexport const createEndorsement = async (\n policyLocator: string,\n body: CreateEndorsementRequest,\n): Promise => {\n const { data } = await API.post(`policies/${policyLocator}/endorsements`, body);\n\n return data;\n};\n\nexport const getEndorsementDetail = async (\n policyLocator: string,\n endorsementLocator: string,\n): Promise => {\n const { data } = await API.get(`policies/${policyLocator}/endorsements/${endorsementLocator}`);\n\n return data;\n};\n\nexport const getEndorsementPriceChanges = async (\n policyLocator: string,\n endorsementLocator: string,\n): Promise => {\n const { data } = await API.get(\n `policies/${policyLocator}/endorsements/${endorsementLocator}/price`,\n );\n\n return data;\n};\n\nexport const getEndorsementInvoices = async (\n policyLocator: string,\n endorsementLocator: string,\n): Promise> => {\n const { data } = await API.get(\n `policies/${policyLocator}/endorsements/${endorsementLocator}/invoices/?page_size=10000`,\n );\n\n return data;\n};\n\nexport const getEndorsementChanges = async (\n policyLocator: string,\n endorsementLocator: string,\n): Promise => {\n const { data } = await API.get(\n `policies/${policyLocator}/endorsements/${endorsementLocator}/changes`,\n );\n\n return data;\n};\n\n// #region Endorsement actions\nexport const discardEndorsement = async (\n policyLocator: string,\n endorsementLocator: string,\n): Promise => {\n await API.post(`policies/${policyLocator}/endorsements/${endorsementLocator}/discard`);\n};\n\nexport const quoteEndorsement = async (\n policyLocator: string,\n endorsementLocator: string,\n): Promise => {\n const { data } = await API.post(\n `policies/${policyLocator}/endorsements/${endorsementLocator}/quote`,\n );\n\n return data;\n};\n\nexport const referEndorsementRequest = async (\n policyLocator: string,\n endorsementLocator: string,\n): Promise => {\n const { data } = await API.post(\n `policies/${policyLocator}/endorsements/${endorsementLocator}/refer`,\n );\n\n return data;\n};\n\nexport const acceptEndorsement = async (\n policyLocator: string,\n endorsementLocator: string,\n): Promise => {\n const { data } = await API.post(\n `policies/${policyLocator}/endorsements/${endorsementLocator}/accept`,\n );\n\n return data;\n};\n\nexport const invalidateEndorsement = async (\n policyLocator: string,\n endorsementLocator: string,\n): Promise => {\n const { data } = await API.post(\n `policies/${policyLocator}/endorsements/${endorsementLocator}/invalidate`,\n );\n\n return data;\n};\n\nexport const issueEndorsement = async (\n policyLocator: string,\n endorsementLocator: string,\n): Promise => {\n const { data } = await API.post(\n `policies/${policyLocator}/endorsements/${endorsementLocator}/issue`,\n );\n\n return data;\n};\n// #endregion\n\nexport const updateEndorsement = async (\n policyLocator: string,\n endorsementLocator: string,\n body: UpdateEndorsement,\n query?: Params,\n hasBusinessNameChanged?: { changed: boolean; newName: string; policyholder: IPolicyholder },\n): Promise => {\n // Sync policyholder name with `businessName` #11455\n if (hasBusinessNameChanged?.changed) {\n const { newName, policyholder } = hasBusinessNameChanged;\n\n await updatePolicyholderWithLocator(\n {\n data: {\n ...(policyholder.data ?? {}),\n business_name: newName,\n },\n broker_of_record: null,\n },\n policyholder.locator,\n );\n }\n\n const { data } = await API.patch(\n `policies/${policyLocator}/endorsements/${endorsementLocator}`,\n body,\n {},\n query,\n );\n\n return data;\n};\n\nexport const getEndorsementExposures = async (\n policyLocator: string,\n endorsementLocator: string,\n): Promise => {\n const { data } = await API.get(\n `policies/${policyLocator}/endorsements/${endorsementLocator}/exposures`,\n );\n\n return data;\n};\n\nexport const addNewEndorsementExposure = async (\n policyLocator: string,\n endorsementLocator: string,\n body: CreateEndorsementExposure,\n): Promise => {\n const { data } = await API.post(\n `policies/${policyLocator}/endorsements/${endorsementLocator}/exposures`,\n body,\n );\n\n return data;\n};\n\nexport const updateEndorsementDescription = async (\n policyLocator: string,\n endorsementLocator: string,\n body: IEndorsementDescription,\n): Promise => {\n const { data } = await API.patch(\n `policies/${policyLocator}/endorsements/${endorsementLocator}/metadata`,\n body,\n );\n\n return data;\n};\n\nexport const updateEndorsementExposure = async (\n policyLocator: string,\n endorsementLocator: string,\n exposureLocator: string | number,\n body: UpdateEndorsementExposure,\n query?: Params,\n): Promise => {\n const { data } = await API.patch(\n `policies/${policyLocator}/endorsements/${endorsementLocator}/exposures/${exposureLocator}`,\n body,\n {},\n query,\n );\n\n return data;\n};\n\nexport const updateEndorsementNewlyAddedExposure = async (\n policyLocator: string,\n endorsementLocator: string,\n exposureIndex: string | number,\n body: UpdateEndorsementExposure,\n query?: Params,\n): Promise => {\n const { data } = await API.patch(\n `policies/${policyLocator}/endorsements/${endorsementLocator}/exposures/added-${exposureIndex}`,\n body,\n {},\n query,\n );\n\n return data;\n};\n\nexport const deleteEndorsementExposure = async (\n policyLocator: string,\n endorsementLocator: string,\n exposureLocator: string | number,\n query?: Params,\n): Promise => {\n await API.delete(\n `policies/${policyLocator}/endorsements/${endorsementLocator}/exposures/${exposureLocator}`,\n {},\n query,\n );\n};\n\nexport const deleteEndorsementNewlyAddedExposure = async (\n policyLocator: string,\n endorsementLocator: string,\n exposureIndex: string | number,\n query?: Params,\n): Promise => {\n await API.delete(\n `policies/${policyLocator}/endorsements/${endorsementLocator}/exposures/added-${exposureIndex}`,\n {},\n query,\n );\n};\n\nexport const bulkExposureUpdateEndorsement = async (\n policyLocator: string,\n endorsementLocator: string,\n body: BulkExposureUpdateEndorsementRequest,\n): Promise => {\n const { data } = await API.post(\n `policies/${policyLocator}/endorsements/${endorsementLocator}/bulk-exposure-update`,\n body,\n );\n\n return data;\n};\n\nexport const getProductEndorsementTypes = async (\n product: string,\n query?: Params,\n): Promise => {\n const { data } = await API.get(`products/${product}/endorsement-types`, query ?? {});\n\n return data;\n};\n\nexport const declineEndorsementRequest = async (\n policyLocator: string,\n endorsementLocator: string,\n): Promise => {\n const { data } = await API.post(\n `policies/${policyLocator}/endorsements/${endorsementLocator}/decline`,\n );\n\n return data;\n};\n\nexport const sendBackEndorsementRequest = async (\n policyLocator: string,\n endorsementLocator: string,\n): Promise => {\n const { data } = await API.post(\n `policies/${policyLocator}/endorsements/${endorsementLocator}/cancel-referral`,\n );\n\n return data;\n};\n\nexport const getEndorsementPrometrixResultsRequest = async (\n policyLocator: string,\n endorsementLocator: string,\n): Promise => {\n const { data } = await API.get(\n `policies/${policyLocator}/endorsements/${endorsementLocator}/aux-data/prometrix-data`,\n );\n\n return data;\n};\n\nexport const setEndorsementPrometrixResultsRequest = async (\n policyLocator: string,\n endorsementLocator: string,\n body: IPrometrixData,\n): Promise => {\n const { data } = await API.put(\n `policies/${policyLocator}/endorsements/${endorsementLocator}/aux-data/prometrix-data`,\n body,\n );\n\n return data;\n};\n","import ApiService from 'api/helpers/Sender';\nimport { RuleEngineDecisions } from 'api/models/RuleEngine/ruleEngineDecisions.model';\nimport { underwritingResultDecisions, userRoles } from 'common/constants';\nimport { IQueryParams } from 'helpers/prepareQueryParams';\n\nconst API = new ApiService();\n\nexport const getRuleEngineDecisions = async (\n params: IQueryParams,\n userRole?: string,\n): Promise => {\n const { data }: { data: RuleEngineDecisions[] } = await API.get('underwriting-decisions', params);\n\n if (!userRole) return [];\n\n // #region modify results according to https://dev.azure.com/radity-gmbh/THREE-insurance/_workitems/edit/11312/\n\n const declinedRules: RuleEngineDecisions[] = [];\n const referredRules: RuleEngineDecisions[] = [];\n\n data?.forEach((result) => {\n switch (result?.rule_engine_decision_result?.code) {\n case underwritingResultDecisions.DECLINED?.code:\n declinedRules.push(result);\n break;\n\n case underwritingResultDecisions.REFERRED?.code: {\n let tmpResult = { ...result };\n\n if (userRole === userRoles.AGENT.code && tmpResult.is_underwriter_approved) {\n tmpResult = {\n ...tmpResult,\n rule_engine_decision_result: { ...underwritingResultDecisions.APPROVED },\n };\n }\n\n referredRules.push(tmpResult);\n break;\n }\n\n default:\n break;\n }\n });\n\n // #endregion\n\n return [...declinedRules, ...referredRules];\n};\n\nexport const updateRuleEngineDecision = async (\n id: number,\n body: { is_underwriter_approved: boolean },\n): Promise => {\n const { data }: { data: RuleEngineDecisions } = await API.patch(\n `underwriting-decisions/${id}`,\n body,\n );\n\n return data;\n};\n","import { defaultCurrency } from 'common/constants';\nimport { isNaN } from 'lodash-es';\nimport { currencyFormat, formatLocation, formatNumberWithCommas } from './Utils';\n\nexport const groupByExposureAndSumPremiums = (\n exposurePrices: any,\n operation: 'Policy' | 'Endorsement',\n) => {\n const groups: any = {};\n\n switch (operation) {\n case 'Endorsement': {\n exposurePrices.forEach((item) => {\n const { name, new_gross_premium, gross_premium_change } = item;\n if (!groups[name]) {\n groups[name] = {\n new_gross_premium: 0,\n gross_premium_change: 0,\n };\n }\n groups[name].new_gross_premium += Number(new_gross_premium);\n groups[name].gross_premium_change += Number(gross_premium_change);\n });\n\n break;\n }\n case 'Policy': {\n exposurePrices.forEach((item) => {\n const { name, total, change_from_previous_term } = item;\n\n if (!groups[name]) {\n groups[name] = {\n gross_premium: 0,\n change_from_previous_term: 0,\n };\n }\n groups[name].gross_premium += Number(total);\n groups[name].change_from_previous_term += Number(change_from_previous_term);\n });\n break;\n }\n default:\n break;\n }\n\n return groups;\n};\n\nexport const displayCorrectAmount = (\n amountPrice,\n currency = defaultCurrency,\n changePrevious: boolean = false,\n) => {\n let amount = amountPrice;\n\n if (amount === 0 || amount === '0.00' || amount === '0') {\n amount = '0.00';\n return currencyFormat(currency, amount!).merged;\n }\n\n if (!amount) return '-';\n\n const formattedAmount = currencyFormat(currency, Math.abs(amount!)).merged;\n\n if (changePrevious) {\n if (Number(amount) > 0) {\n return `+${formattedAmount}`;\n } else if (Number(amount) < 0) {\n return `-${formattedAmount}`;\n }\n } else if (Number(amount) < 0) {\n return `(${formattedAmount})`;\n }\n\n return formattedAmount;\n};\n\nexport const colorOfAmount = (amount, changePrevious: boolean = false) => {\n if (!amount) {\n return undefined;\n }\n\n if (changePrevious) {\n return {\n color: (theme) =>\n Number(amount) > 0\n ? theme.customColors.errorRed\n : Number(amount) < 0 && theme.customColors.successGreen,\n };\n }\n\n return Number(amount) < 0 ? { color: (theme) => theme.customColors.errorRed } : undefined;\n};\n\nexport const renderAddress = (addressData: any) => {\n const formatted = formatLocation({\n addressLine1: addressData?.loc_address_line1,\n addressLine2: addressData?.loc_address_line2,\n city: addressData?.loc_address_city,\n state: addressData?.loc_address_state,\n zip: addressData?.loc_address_zip,\n });\n\n return formatted.showing;\n};\n\nexport const formatPerilRatingFactorValues = (\n perilRatingFactor: Record,\n excludedKeys?: string[],\n): Record => {\n return Object.keys(perilRatingFactor).reduce((acc, key) => {\n const value = perilRatingFactor[key];\n\n acc[key] = excludedKeys?.includes(key)\n ? value\n : typeof value === 'number' || (typeof value === 'string' && !isNaN(Number(value)))\n ? formatNumberWithCommas(value)\n : value;\n\n return acc;\n }, {});\n};\n","import { createContext } from 'react';\n\n/// types\nimport { IUserContextType, IUserStore } from './types';\n\nexport const initialUserData: IUserStore = {\n data: undefined,\n loading: true,\n loaded: false,\n isUserRoleAgent: false,\n isUserRoleAgentOrThreeDirectSales: false,\n isUserRoleThreeDirectSales: false,\n isUserRoleUnderwriter: false,\n isUserRoleReadOnly: false,\n isUserInternal: false,\n};\n\nexport const userContextDefault: IUserContextType = {\n ...initialUserData,\n resetUserState: () => {},\n fetch: () => new Promise(() => {}),\n updateCurrentUser: () => new Promise(() => {}),\n};\n\nexport const UserContext = createContext(null!);\n","import { IUserContextType } from 'providers/UserProvider/types';\nimport { UserContext } from 'providers/UserProvider/UserProviderContext';\nimport { useContext } from 'react';\n\nexport default function useUser(): IUserContextType {\n const context = useContext(UserContext);\n\n /* istanbul ignore if */\n if (!context) {\n throw new Error('useUser must be used within a UserProvider');\n }\n\n return context;\n}\n","import ApiService, { Params } from 'api/helpers/Sender';\nimport { KeyValues } from 'api/models/KeyValues/keyValues.model';\n\nconst API = new ApiService();\n\nexport const getKeyValuesService = async (\n key: string,\n { query = {} }: { query?: Params } = {},\n): Promise => {\n const { data } = await API.get(`key-values/${key}`, query);\n return data;\n};\n","import { ShowCondition } from 'api/models/QuestionEngine/IShowConditions.model';\nimport { isEmpty } from 'lodash-es';\nimport { addValidationsToFields, fieldHasValue } from './Utils';\n\n/**\n * Check the question's show conditions and determine,\n * whether it should be shown or not.\n */\nexport const handleShowCondition = (field, state) => {\n try {\n /**\n * Calculate additional fields for show conditions,\n * Calculated aliases are dependant on other uw questions or policy data.\n * They should be updated whenever dependant data changes.\n * Also new calculated aliases should be defined and calculated below.\n * Initial task: https://dev.azure.com/radity-gmbh/THREE-insurance/_workitems/edit/15651/\n */\n const calculatedAliases = {\n yearsInBusiness: state?.effective_date?.getFullYear() - state?.yearFounded,\n };\n\n const stateWithCalculatedAliases = { ...state, ...calculatedAliases };\n\n const handleCondition = {\n boolean: (reference: string, operator: string, value: boolean) => {\n const v = Boolean(value);\n const plainRef = stateWithCalculatedAliases[reference];\n const reff = Boolean(plainRef);\n\n const operators = {\n '==': () => reff === v,\n '!=': () => reff !== v,\n };\n\n return fieldHasValue(plainRef) ? operators[operator]() : false;\n },\n string: (reference: string, operator: string, value: string | string[]) => {\n const plainRef = stateWithCalculatedAliases[reference];\n\n const values = Array.isArray(value) ? value : [value];\n\n const operators = {\n '**': () => values.some((v) => plainRef?.includes(v)),\n '!*': () => values.every((v) => !plainRef?.includes(v)),\n '==': () => values.some((v) => plainRef === v),\n '!=': () => values.every((v) => plainRef !== v),\n };\n\n return fieldHasValue(plainRef) ? operators[operator]() : false;\n },\n number: (reference: string, operator: string, value: number) => {\n const v = +value;\n const plainRef = stateWithCalculatedAliases[reference];\n const reff = +plainRef;\n\n const operators = {\n '>': () => reff > v,\n '<': () => reff < v,\n '<=': () => reff <= v,\n '>=': () => reff >= v,\n '==': () => reff === v,\n '!=': () => reff !== v,\n };\n\n return fieldHasValue(plainRef, [NaN]) ? operators[operator]() : false;\n },\n float: (reference: string | any, operator: string, value: string | any) => {\n // value might be a reference or a value in different cases\n // if value is a reference then get the value of reference from the state object otherwise use the value\n const valueRef = stateWithCalculatedAliases[value];\n let v = valueRef ? parseFloat(valueRef) : parseFloat(value);\n\n // reference might be a reference or a value in different cases\n // if reference is a reference then get the value of reference from the state object otherwise use the reference as value\n const plainRef = stateWithCalculatedAliases[reference];\n let reff = plainRef ? parseFloat(plainRef) : parseFloat(reference);\n\n // if there is an reference or value is recursive assume that there is an aritmetic operation\n if (reference.reference || value.value) {\n const recursiveRef = reference.reference\n ? handleCondition[reference.value_type](\n reference.reference,\n reference.relational_operator,\n reference.value,\n )\n : reference;\n reff = parseFloat(recursiveRef);\n }\n if (value.value) {\n const recursiveV = value.value\n ? handleCondition[value.value_type](\n value.reference,\n value.relational_operator,\n value.value,\n )\n : value;\n v = parseFloat(recursiveV);\n }\n\n const operators = {\n '>': () => reff > v,\n '<': () => reff < v,\n '<=': () => reff <= v,\n '>=': () => reff >= v,\n '==': () => reff === v,\n '!=': () => reff !== v,\n // Artihmetic operators\n '+': () => reff + v,\n '-': () => reff - v,\n '*': () => reff * v,\n '/': () => reff / v,\n '%': () => reff % v,\n };\n\n return fieldHasValue(reff, [NaN]) ? operators[operator]() : false;\n },\n array: (reference: string, operator: string, value: any[]) => {\n const refValue = stateWithCalculatedAliases[reference];\n const reff =\n typeof refValue === 'string'\n ? refValue.split('|')\n : Array.isArray(refValue)\n ? refValue\n : [refValue ?? []];\n\n const operators = {\n in: () => value.some((v) => reff.includes(v)),\n '!in': () => value.every((v) => !reff.includes(v)),\n };\n\n return fieldHasValue(reff) ? operators[operator]() : false;\n },\n };\n\n const checkShowCondition = (SC: ShowCondition): boolean => {\n if (SC) {\n const isLogicalCondition = !isEmpty(SC.logical_operator);\n\n if (!isLogicalCondition) {\n return handleCondition[SC.value_type!](SC.reference, SC.relational_operator, SC.value);\n } else {\n const { logical_operator: LO, operations } = SC;\n\n if (LO === 'and') {\n const results: boolean[] = operations?.map((condition) =>\n checkShowCondition(condition),\n ) ?? [true];\n\n return results.every((R) => R);\n } else if (LO === 'or') {\n const results: boolean[] = operations?.map((condition) =>\n checkShowCondition(condition),\n ) ?? [true];\n\n return results.some((R) => R);\n } else {\n return true;\n }\n }\n }\n\n return true;\n };\n\n const SC = field?.show_condition;\n\n const showField = checkShowCondition(SC);\n\n return showField;\n } catch (_error) {\n // if there is an error checking the conditions do not show the field\n return false;\n // TODO: send error to sentry\n }\n};\n\n/**\n * Check questions show conditions and get every reference key used in there\n * Unique them and combine them at the section level as well\n *\n * These `relatedFields` will be used in question engine parser to only re-render,\n * specific section if its related keys are changed.\n */\nexport const modifyUnderwritingQuestions = (data) =>\n data?.map((page) => ({\n ...page,\n fields: page?.fields?.map((f) => {\n const groupRelatedFields: any[][] = [];\n const groupValidations: any[] = [];\n\n addValidationsToFields(f.nested_fields ?? [], false);\n\n return {\n ...f,\n nested_fields: (f.nested_fields ?? []).map((q) => {\n groupValidations.push({\n code: q.code,\n validationType: q.validationType,\n validations: q.validations,\n });\n\n const relatedFields = [q.code];\n\n // traverse `show_condition` and get the `references`\n const traverseShowCondition = (SC: ShowCondition): void => {\n if (SC) {\n const isLogicalCondition = !isEmpty(SC.logical_operator);\n\n if (!isLogicalCondition) {\n relatedFields.push(SC.reference);\n } else {\n const { logical_operator: LO, operations } = SC;\n\n if (LO === 'and' || LO === 'or') {\n operations?.forEach((condition) => traverseShowCondition(condition));\n }\n }\n }\n };\n\n const SC = (q as any)?.show_condition;\n traverseShowCondition(SC);\n\n const uniqReleatedFields = [...new Set(relatedFields)] as string[];\n groupRelatedFields.push(uniqReleatedFields);\n\n return { ...q, relatedFields: uniqReleatedFields };\n }),\n relatedFields: [...new Set(groupRelatedFields.flat())],\n validations: groupValidations,\n };\n }),\n }));\n\nexport const maskedInputsConfig = {\n ssn: {\n format: '###-##-####',\n mask: '_',\n },\n fein: {\n format: '##-#######',\n mask: '_',\n },\n};\n","import ApiService, { Params } from 'api/helpers/Sender';\nimport { BulkExposureUpdateQuoteRequest } from 'api/models/NewQuote/bulkExposureUpdateQuoteRequest.model';\nimport { ICreateExposure } from 'api/models/NewQuote/createExposure';\nimport { ICreatePeril } from 'api/models/NewQuote/createPeril';\nimport { CreatePolicyWithPolicyholderResponse } from 'api/models/NewQuote/createPolicyWithPolicyholderResponse.model';\nimport { UpdateExposureRequest } from 'api/models/NewQuote/updateExposureRequest.model';\nimport { UpdateExposureResponse } from 'api/models/NewQuote/updateExposureResponse.model';\nimport { UpdatePerilRequest } from 'api/models/NewQuote/updatePerilRequest.model';\nimport { UpdatePerilResponse } from 'api/models/NewQuote/updatePerilResponse.model';\nimport { UpdatePerilSocotraRequest } from 'api/models/NewQuote/updatePerilSocotraRequest.model';\nimport { IUpdateQuote } from 'api/models/NewQuote/updateQuote';\nimport { IPolicyholder } from 'api/models/Policyholder/policyholder.model';\nimport { ProductWorkFlow } from 'api/models/ProductWorkFlow/ProductWorkFlow.model';\nimport { modifyUnderwritingQuestions } from 'helpers/QuestionEngine';\nimport { CreatePolicyWithPolicyholder } from '../models/NewQuote/createPolicyWithPolicyholder.model';\nimport { updatePolicyholderWithLocator } from './Policyholders';\n\nconst API = new ApiService();\n\nexport const getWorkFlowFormSetsFormsWithFormSetType = async ({\n product_code,\n work_flow_name,\n config_formset_type,\n modifyResultForUnderwritingQuestions = false,\n query,\n}: {\n product_code: string;\n work_flow_name: string;\n config_formset_type: string;\n modifyResultForUnderwritingQuestions?: boolean;\n query?: Params;\n}): Promise => {\n const { data } = await API.get(\n `products/${product_code}/workflows/${work_flow_name}/formsets/${config_formset_type}/forms`,\n query ?? {},\n );\n\n let modifiedForms = data;\n\n if (modifyResultForUnderwritingQuestions) {\n modifiedForms = modifyUnderwritingQuestions(data);\n }\n\n return modifiedForms;\n};\n\nexport const getWorkFlowPerilFormsWithFormCode = async ({\n product_code,\n work_flow_name,\n config_formset_type,\n form_code,\n query,\n}: {\n product_code: string;\n work_flow_name: string;\n config_formset_type: string;\n form_code: string;\n query?: Params;\n}): Promise => {\n const { data } = await API.get(\n `products/${product_code}/workflows/${work_flow_name}/formsets/${config_formset_type}/forms/${form_code}/formsets/peril/forms`,\n query ?? {},\n );\n\n return data;\n};\n\nexport const updateQuoteInfo = async (\n policyLocator: string,\n quoteLocator: string,\n body: IUpdateQuote,\n query?: Params,\n hasBusinessNameChanged?: { changed: boolean; newName: string; policyholder: IPolicyholder },\n): Promise => {\n const { data } = await API.patch(\n `policies/${policyLocator}/quotes/${quoteLocator}`,\n body,\n {},\n query,\n );\n\n // Sync policyholder name with `businessName` #11455\n if (hasBusinessNameChanged?.changed) {\n const { newName, policyholder } = hasBusinessNameChanged;\n\n await updatePolicyholderWithLocator(\n {\n data: {\n ...(policyholder.data ?? {}),\n business_name: newName,\n },\n broker_of_record: null,\n },\n policyholder.locator,\n );\n }\n\n return data;\n};\n\nexport const addExposure = async (policyLocator: string, body: ICreateExposure): Promise => {\n const { data } = await API.post(`policies/${policyLocator}/exposures`, body);\n\n return data;\n};\n\nexport const updateExposure = async (\n policyLocator: string,\n exposureLocator: string,\n body: UpdateExposureRequest,\n query: Params,\n): Promise => {\n const { data } = await API.patch(\n `policies/${policyLocator}/exposures/${exposureLocator}`,\n body,\n {},\n query,\n );\n\n return data;\n};\n\nexport const deleteExposure = async (\n policyLocator: string,\n exposureLocator: string,\n): Promise => {\n await API.post(`policies/${policyLocator}/exposures/${exposureLocator}/discard`);\n};\n\nexport const addPeril = async (\n policyLocator: string,\n exposureLocator: string,\n body: ICreatePeril,\n): Promise => {\n const { data } = await API.post(\n `policies/${policyLocator}/exposures/${exposureLocator}/perils`,\n body,\n );\n\n return data;\n};\n\nexport const deletePeril = async (\n policyLocator: string,\n exposureLocator: string,\n perilLocator: string,\n payload?: { quote_locator: string },\n): Promise => {\n await API.post(\n `policies/${policyLocator}/exposures/${exposureLocator}/perils/${perilLocator}/discard`,\n payload,\n );\n};\n\nexport const updatePeril = async (\n policyLocator: string,\n exposureLocator: string,\n body: UpdatePerilRequest,\n query?: Params,\n): Promise => {\n const { data } = await API.patch(\n `policies/${policyLocator}/exposures/${exposureLocator}`,\n body,\n {},\n query,\n );\n\n return data;\n};\n\nexport const updatePerilSocotra = async (\n policyLocator: string,\n exposureLocator: string,\n perilLocator: string,\n body: UpdatePerilSocotraRequest,\n): Promise => {\n await API.patch(\n `policies/${policyLocator}/exposures/${exposureLocator}/perils/${perilLocator}/socotra_update`,\n body,\n );\n};\n\nexport const bulkExposureUpdateQuote = async (\n policyLocator: string,\n quoteLocator: string,\n body: BulkExposureUpdateQuoteRequest[],\n) => {\n const { data } = await API.post(\n `policies/${policyLocator}/quotes/${quoteLocator}/bulk-exposure-update`,\n body,\n );\n\n return data;\n};\n\nexport const createPolicyWithPolicyholder = async (\n body: CreatePolicyWithPolicyholder,\n): Promise => {\n const { data } = await API.post(`policies`, body);\n\n return data;\n};\n","import ApiService from 'api/helpers/Sender';\nimport { Products } from 'api/models/Products/products.model';\n\nconst API = new ApiService();\n\nexport const getProducts = async (): Promise => {\n const { data }: { data: Products[] } = await API.get('products', {});\n return data;\n};\n\nexport const getProductDetail = async (id: string): Promise => {\n const { data }: { data: Products } = await API.get(`products/${id}`);\n return data;\n};\n","import { useQuery } from '@tanstack/react-query';\nimport { getKeyValuesService } from 'api/services/KeyValues';\nimport {\n getWorkFlowFormSetsFormsWithFormSetType,\n getWorkFlowPerilFormsWithFormCode,\n} from 'api/services/NewQuote';\nimport { getProducts } from 'api/services/ProductList';\nimport { CONFIG_QUERY_KEYS, keyValueTables, twentyFourHours } from 'common/constants';\nimport displayBackendErrorMessage from 'helpers/displayBackendErrorMessage';\nimport { Params, useNavigate } from 'react-router-dom';\n\nconst { LOC_FILLING_ID_TABLE, PRODUCTS } = CONFIG_QUERY_KEYS;\n\nexport const useProductsConfig = () =>\n useQuery({\n queryKey: [PRODUCTS],\n onError: (error) => displayBackendErrorMessage(error),\n queryFn: () => getProducts(),\n staleTime: twentyFourHours,\n refetchOnWindowFocus: false,\n });\n\nexport const useLocFilingIdTable = () =>\n useQuery({\n queryKey: [LOC_FILLING_ID_TABLE],\n onError: (error) => displayBackendErrorMessage(error),\n queryFn: async () => {\n const table = await getKeyValuesService(keyValueTables.LOC_FILINGS_TABLE);\n return table.value;\n },\n staleTime: twentyFourHours,\n refetchOnWindowFocus: false,\n });\n\nexport const useGetFieldConfig = (\n queryKey: string,\n productCode: string,\n formset: string,\n formCode?: string,\n workFlowName?: string,\n query?: Params,\n) => {\n const navigate = useNavigate();\n return useQuery(\n [queryKey, productCode, formset, formCode, workFlowName, query],\n async () => {\n if (formCode) {\n const forms = await getWorkFlowPerilFormsWithFormCode({\n product_code: productCode,\n work_flow_name: workFlowName!,\n config_formset_type: formset,\n form_code: formCode,\n query,\n });\n return forms;\n } else {\n const forms = await getWorkFlowFormSetsFormsWithFormSetType({\n product_code: productCode,\n work_flow_name: workFlowName!,\n config_formset_type: formset,\n query,\n });\n return forms;\n }\n },\n {\n enabled: productCode !== '' && query?.policy_locator !== undefined,\n staleTime: twentyFourHours,\n onError: (error) => {\n displayBackendErrorMessage(error);\n if (queryKey === 'quoteFieldConfig') {\n navigate('/quotes');\n } else if (queryKey === 'policyFieldConfig') {\n navigate('/policies');\n }\n },\n },\n );\n};\n\nexport const useGetUnderwritingQuestions = (\n queryKey: string,\n productCode: string,\n formset: string,\n isWCIncluded: boolean | undefined,\n formCode?: string,\n query?: Params,\n forceRefetch?: boolean,\n) => {\n const navigate = useNavigate();\n\n return useQuery(\n [queryKey, productCode, formset, isWCIncluded, formCode, query],\n async () => {\n if (formCode) {\n return getWorkFlowPerilFormsWithFormCode({\n product_code: productCode,\n work_flow_name: 'underwriting-questions',\n config_formset_type: formset,\n form_code: formCode,\n query,\n });\n } else {\n return getWorkFlowFormSetsFormsWithFormSetType({\n product_code: productCode,\n work_flow_name: 'underwriting-questions',\n config_formset_type: formset,\n modifyResultForUnderwritingQuestions: true,\n query,\n });\n }\n },\n {\n enabled: productCode !== '' && query?.policy_locator !== undefined && !forceRefetch,\n staleTime: twentyFourHours,\n refetchOnMount: forceRefetch,\n refetchOnWindowFocus: false,\n onError: (error) => {\n displayBackendErrorMessage(error);\n if (queryKey === 'quoteUnderwritingQuestions') {\n navigate('/quotes');\n } else if (queryKey === 'policyUnderwritingQuestions') {\n navigate('/policies');\n }\n },\n },\n );\n};\n","import { UseQueryResult } from '@tanstack/react-query';\nimport { useGetFieldConfig } from 'api/queries/ConfigQueries';\nimport { threeExposureNames } from 'common/constants';\nimport { Params } from 'react-router-dom';\n\nexport default function useFieldConfig(queryKey: string, productCode: string, query?: Params): any {\n const enhanceField = (field: UseQueryResult) => ({\n data: field?.data ?? [],\n loading: field.isFetching,\n loaded: !field.isLoading,\n });\n\n const exposure = enhanceField(\n useGetFieldConfig(queryKey, productCode, 'exposure', undefined, 'quick-quote', query),\n );\n const policy = enhanceField(\n useGetFieldConfig(queryKey, productCode, 'policy', undefined, 'quick-quote', query),\n );\n const perilEmployer = enhanceField(\n useGetFieldConfig(\n queryKey,\n productCode,\n 'peril',\n threeExposureNames.EMPLOYER,\n 'quick-quote',\n query,\n ),\n );\n const perilLocation = enhanceField(\n useGetFieldConfig(\n queryKey,\n productCode,\n 'peril',\n threeExposureNames.LOCATION,\n 'quick-quote',\n query,\n ),\n );\n\n return {\n exposure,\n policy,\n peril: {\n data: {\n [threeExposureNames.EMPLOYER]: Array.isArray(perilEmployer.data) ? perilEmployer.data : [],\n [threeExposureNames.LOCATION]: Array.isArray(perilLocation.data) ? perilLocation.data : [],\n },\n loading: perilEmployer.loading || perilLocation.loading,\n loaded: perilEmployer.loaded && perilLocation.loaded,\n },\n };\n}\n","import { useGetUnderwritingQuestions } from 'api/queries/ConfigQueries';\n\nexport default function useUnderwritingQuestionsFieldConfig(\n queryKey: string,\n productCode: string,\n isWCIncluded: boolean | undefined,\n query?: any,\n): any {\n const field = useGetUnderwritingQuestions(\n queryKey,\n productCode,\n 'policy',\n isWCIncluded,\n undefined,\n query,\n );\n\n return {\n policy: {\n loading: field.isFetching,\n loaded: !field.isLoading,\n data: field.data,\n },\n };\n}\n","import { threeExposureNames, threePolicyGroupNames } from 'common/constants';\nimport { IExposureList } from 'providers/PolicyDetailProvider/types';\nimport { createContext } from 'react';\n\n/// types\nimport { IEndorsementDetailContextType, IEndorsementDetailStore, TGroups } from './types';\n\nexport const initialEndorsementDetailData: IEndorsementDetailStore = {\n data: undefined,\n exposures: {\n data: [],\n loading: true,\n loaded: false,\n },\n exposureList: Object.values(threeExposureNames).reduce(\n (a, curr) => ({\n ...a,\n [`${curr}`]: {\n data: [],\n loading: true,\n loaded: false,\n },\n }),\n {} as IExposureList,\n ),\n exposureDetail: {\n data: { data: {} },\n loading: true,\n loaded: false,\n },\n groups: Object.values(threePolicyGroupNames).reduce(\n (a, curr) => ({\n ...a,\n [`${curr}`]: {\n data: [],\n loading: true,\n loaded: false,\n },\n }),\n {},\n ) as TGroups,\n loading: true,\n loaded: false,\n fields: {\n exposure: {\n data: [],\n loaded: false,\n loading: false,\n },\n peril: {\n data: {\n employer: [],\n location: [],\n },\n loaded: false,\n loading: false,\n },\n policy: {\n data: [],\n loaded: false,\n loading: false,\n },\n },\n price: { data: undefined, loading: false, loaded: false },\n underwritingQuestionsState: {},\n underwritingQuestions: { policy: { data: undefined, loaded: false, loading: false } },\n ruleEngineResults: {\n data: [],\n loading: true,\n loaded: false,\n },\n canEdit: false,\n isReferButtonVisible: false,\n isTaxIDInvalid: false,\n isCoveragesSummaryPriceCalculated: false,\n endorsementStatuses: {\n isApplicationStatus: false,\n isReferredStatus: false,\n isQuotedStatus: false,\n isAcceptedStatus: false,\n isDeclinedStatus: false,\n isIssuedStatus: false,\n isDeclinedByUWStatus: false,\n },\n};\n\nexport const endorsementDetailContextDefault: IEndorsementDetailContextType = {\n ...initialEndorsementDetailData,\n fetch: () => new Promise(() => {}),\n getExposures: () => new Promise(() => {}),\n getExposure: () => new Promise(() => {}),\n resetEndorsementDetailState: () => {},\n updateEndorsementDetail: () => new Promise(() => {}),\n getEndorsementPrice: () => new Promise(() => {}),\n getRuleEngineResults: () => new Promise(() => {}),\n updateRuleEngineDecisionStatus: () => new Promise(() => {}),\n setUnderwritingQuestionsState: () => {},\n saveUnderwritingQuestionsState: () => new Promise(() => {}),\n referEndorsement: () => new Promise(() => {}),\n sendBackEndorsement: () => new Promise(() => {}),\n setIsCoveragesSummaryPriceCalculated: () => {},\n};\n\nexport const EndorsementDetailContext = createContext(null!);\n","import { createContext } from 'react';\n\n/// types\nimport { INotesContextType, INotesStore } from './types';\n\nexport const initialNotesData: INotesStore = {\n data: [],\n loading: true,\n loaded: false,\n selectedNoteRow: undefined,\n activeNote: {\n data: {},\n loading: true,\n loaded: false,\n },\n pagination: {\n ordering: '',\n page: 1,\n page_size: 20,\n search: '',\n total_count: 0,\n },\n};\n\nexport const notesContextDefault: INotesContextType = {\n ...initialNotesData,\n resetNotesState: () => {},\n fetch: () => new Promise(() => {}),\n fetchNote: () => new Promise(() => {}),\n createNote: () => new Promise(() => {}),\n deleteNote: () => new Promise(() => {}),\n reFetchData: () => new Promise(() => {}),\n updateNote: () => new Promise(() => {}),\n};\n\nexport const NotesContext = createContext(null!);\n","import ApiService, { Params } from 'api/helpers/Sender';\nimport { CancellationCreate } from 'api/models/Policy/Cancellation/cancellationCreate.model';\nimport { CancellationDetailList } from 'api/models/Policy/Cancellation/cancellationDetailList.model';\nimport { GenerateCertificateRequest } from 'api/models/Policy/Certificate/generateCertificateRequest.model';\nimport { Exposure } from 'api/models/Policy/Endorsements/exposure.model';\nimport { GracePeriodCreate } from 'api/models/Policy/GracePeriod/gracePeriodCreate.model';\nimport { GracePeriodDetailList } from 'api/models/Policy/GracePeriod/gracePeriodDetailList.model';\nimport { PoliciesCancellations } from 'api/models/Policy/policiesCancellations.model';\nimport { IPoliciesCreatePaymentLink } from 'api/models/Policy/policiesCreatePaymentLink.model';\nimport { IPoliciesCreatePaymentLinkResponse } from 'api/models/Policy/policiesCreatePaymentLinkResponse.model';\nimport { PoliciesEnrollAutoPayURLCreate } from 'api/models/Policy/policiesEnrollAutoPayURLCreate';\nimport { PoliciesFilteredChips } from 'api/models/Policy/PoliciesFilteredChips.model';\nimport { PoliciesList } from 'api/models/Policy/policiesList.model';\nimport { PoliciesPrice } from 'api/models/Policy/policiesPrice.model';\nimport { PoliciesTransactionHistory } from 'api/models/Policy/policiesTransactionHistory.model';\nimport { PolicyCombineInvoicesResponse } from 'api/models/Policy/policyCombineInvoicesResponse.model';\nimport { PolicyDetail } from 'api/models/Policy/policyDetail.model';\nimport { PolicyEndorsement } from 'api/models/Policy/policyEndorsement.model';\nimport { PolicyInvoicesPayCreate } from 'api/models/Policy/policyInvoicesPayCreate.model';\nimport { PolicyPaymentInfo } from 'api/models/Policy/policyPaymentInfo.model';\nimport { PolicyPerilResponse } from 'api/models/Policy/policyPerils.model';\nimport { ReinstateCreate } from 'api/models/Policy/Reinstate/reinstateCreate.model';\nimport {\n IConsumerSubmissionsAndPoliciesCountAndStatusesParams,\n IPoliciesPagination,\n} from 'api/queries/PoliciesQueries';\nimport {\n IPoliciesInvoicesPagination,\n IPoliciesInvoicesResponse,\n IPolicyExposuresPagination,\n} from 'providers/PolicyDetailProvider/types';\nimport { Pagination, PaginationResponse } from 'types/Pagination';\n\nconst API = new ApiService();\n\nexport const getPolicies = async (body: IPoliciesPagination): Promise => {\n const { data } = await API.get('policies', body as unknown as Params);\n return data;\n};\n\nexport const getPolicyCountAndStatus = async (\n query: IConsumerSubmissionsAndPoliciesCountAndStatusesParams,\n): Promise => {\n const { data } = await API.get(`policies/get-policy-count-and-status`, query as Params);\n return data;\n};\n\nexport const getPolicyWithLocator = async (\n policylocator: string,\n excludePrice = true,\n newBusiness = false,\n): Promise => {\n const { data } = await API.get(`policies/${policylocator}`, {\n exclude_price: excludePrice,\n ...(newBusiness ? { new_business: newBusiness } : {}),\n } as unknown as Params);\n return data;\n};\n\nexport const getPolicyExposuresWithLocator = async (\n policylocator: string,\n query: IPolicyExposuresPagination,\n): Promise> => {\n const { data } = await API.get(`policies/${policylocator}/exposures`, query as Params);\n return data;\n};\n\nexport const getPolicyPerilsWithLocator = async (\n policylocator: string,\n query: Pagination,\n): Promise> => {\n const { data } = await API.get(`policies/${policylocator}/perils`, query as Params);\n return data;\n};\n\nexport const getPolicyExposureWithLocator = async (\n policylocator: string,\n exposurelocator: string,\n): Promise => {\n const { data } = await API.get(`policies/${policylocator}/exposures/${exposurelocator}`);\n return data;\n};\n\nexport const getPolicyTransactionHistoryWithLocator = async (\n policylocator: string,\n query: Pagination,\n): Promise> => {\n const { data } = await API.get(`policies/${policylocator}/transaction-history`, query as Params);\n return data;\n};\n\nexport const getPolicyInvoicesWithLocator = async (\n policylocator: string,\n query: IPoliciesInvoicesPagination,\n): Promise => {\n const { data } = await API.get(`policies/${policylocator}/invoices`, query as Params);\n return data;\n};\n\nexport const getPolicyCancellationsWithLocator = async (\n policylocator: string,\n): Promise => {\n const { data } = await API.get(`policies/${policylocator}/cancellations`);\n return data;\n};\n\nexport const getPolicyEndorsmentsWithLocator = async (\n policylocator: string,\n): Promise => {\n const { data } = await API.get(`policies/${policylocator}/endorsements`);\n return data;\n};\n\nexport const getCancellationDetailsWithLocator = async (\n policyLocator: string,\n cancellationId: string,\n): Promise => {\n const { data } = await API.get(`policies/${policyLocator}/cancellations/${cancellationId}`);\n return data;\n};\n\nexport const getPolicyPriceWithLocator = async (\n policylocator: string,\n newBusiness = false,\n): Promise => {\n const { data } = await API.get(`policies/${policylocator}/price`, {\n ...(newBusiness ? { new_business: newBusiness } : {}),\n } as unknown as Params);\n return data;\n};\n\nexport const getInvoices = async (locator: string, type: string): Promise => {\n const { data } = await API.get(`invoice-searches/?locator=${locator}&type=${type}`);\n return data;\n};\n\nexport const combineInvoices = async (\n policy_locator: string,\n payment_intent_id: string,\n): Promise => {\n const { data } = await API.post(\n `services/service-stripe/${policy_locator}/payment-intents/${payment_intent_id}/send-email`,\n );\n return data;\n};\n\nexport const waiveFee = async (invoiceId: string, policyId: string) => {\n const { data } = await API.post(`policies/${policyId}/invoices/${invoiceId}/waive-invoice`);\n return data;\n};\n\nexport const getCustomerStripeInfo = async (id: string): Promise => {\n const { data } = await API.get(`services/service-stripe/${id}/customer`);\n return data;\n};\n\nexport const updateCustomerStripeInfo = async (\n policyholderLocator: string,\n): Promise => {\n const { data } = await API.post(\n `services/service-stripe/${policyholderLocator}/customer/cancel-autopay`,\n );\n return data;\n};\n\nexport const createPaymentLink = async (\n policylocator: string,\n body: IPoliciesCreatePaymentLink,\n): Promise => {\n const { data } = await API.post(`services/service-stripe/${policylocator}/payment-intents`, body);\n return data;\n};\n\nexport const createEnrollAutoPayURL = async (\n policyholderLocator: string,\n): Promise => {\n const { data } = await API.post(`services/service-stripe/${policyholderLocator}/setup-intents`);\n return data;\n};\n\nexport const sendEmailEnrollAutoPayURL = async (\n policylocator: string,\n setupIntentId: string,\n): Promise => {\n const { data } = await API.post(\n `services/service-stripe/${policylocator}/setup-intents/${setupIntentId}/send-email`,\n );\n return data;\n};\n\nexport const createPolicyInvoicePay = async (\n policylocator: string,\n invoicelocator: string,\n body: PolicyInvoicesPayCreate,\n): Promise => {\n const { data } = await API.post(`policies/${policylocator}/invoices/${invoicelocator}/pay`, body);\n return data;\n};\n\nexport const createReinstateRequest = async (\n locator: string,\n cancellationId: string,\n body: ReinstateCreate,\n): Promise => {\n const { data } = await API.post(\n `policies/${locator}/cancellations/${cancellationId}/reinstatements`,\n body,\n );\n return data;\n};\n\nexport const acceptReinstatePolicy = async (\n policyLocator: string,\n cancellationId: string,\n reinstateId: string,\n body?: ReinstateCreate,\n) => {\n await API.patch(\n `policies/${policyLocator}/cancellations/${cancellationId}/reinstatements/${reinstateId}`,\n body,\n );\n const { data } = await API.post(\n `policies/${policyLocator}/cancellations/${cancellationId}/reinstatements/${reinstateId}/accept`,\n body,\n );\n return data;\n};\n\nexport const issueReinstatePolicy = async (\n policyLocator: string,\n cancellationId: string,\n reinstateId: string,\n) => {\n const { data } = await API.post(\n `policies/${policyLocator}/cancellations/${cancellationId}/reinstatements/${reinstateId}/issue`,\n );\n return data;\n};\n\nexport const createCancellationRequest = async (\n locator: string,\n body: CancellationCreate,\n): Promise => {\n const { data } = await API.post(`policies/${locator}/cancellations`, body);\n return data;\n};\n\nexport const rescindCancellationPolicy = async (policyLocator: string, cancellationId: string) => {\n const { data } = await API.post(\n `policies/${policyLocator}/cancellations/${cancellationId}/rescind`,\n );\n return data;\n};\n\nexport const issueCancellationPolicy = async (policyLocator: string, cancellationId: string) => {\n const { data } = await API.post(\n `policies/${policyLocator}/cancellations/${cancellationId}/issue`,\n );\n return data;\n};\n\nexport const fetchCancellationReasons = async (productCode: string, query?: Params) => {\n const { data } = await API.get(`products/${productCode}/cancellation-reasons`, query ?? {});\n return data;\n};\n\nexport const getGracePeriodsWithLocator = async (\n policyId: string,\n): Promise> => {\n const { data } = await API.get(`policies/${policyId}/grace-periods`);\n return data;\n};\n\nexport const updateGracePeriod = async (\n policyId: string,\n cancellationId: string,\n body: GracePeriodCreate,\n) => {\n const { data } = await API.patch(`policies/${policyId}/grace-periods/${cancellationId}`, body);\n return data;\n};\n\nexport const getPrintGenerateCertificate = async (\n policylocator: string,\n body: GenerateCertificateRequest,\n options: {\n responseType: 'blob';\n },\n): Promise => {\n const data = await API.post(`policies/${policylocator}/render-document`, body, options);\n return data;\n};\n","import { policyInvoiceStatuses, threeExposureNames, threePolicyGroupNames } from 'common/constants';\nimport { createContext } from 'react';\n\n/// types\nimport { IExposureList, IPolicyDetailContextType, IPolicyDetailStore, TGroups } from './types';\n\nexport const initialPolicyDetailData: IPolicyDetailStore = {\n data: undefined,\n activePolicy: undefined,\n exposures: {\n data: [],\n loading: true,\n loaded: false,\n pagination: {\n ordering: '',\n page: 1,\n page_size: 10000,\n search: '',\n total_count: 0,\n },\n },\n exposureList: Object.values(threeExposureNames).reduce(\n (a, curr) => ({\n ...a,\n [`${curr}`]: {\n data: [],\n loading: true,\n loaded: false,\n pagination: {\n ordering: '',\n page: 1,\n page_size: 10000,\n search: '',\n total_count: 0,\n },\n },\n }),\n {} as IExposureList,\n ),\n groups: Object.values(threePolicyGroupNames).reduce(\n (a, curr) => ({\n ...a,\n [`${curr}`]: {\n data: [],\n loading: true,\n loaded: false,\n },\n }),\n {},\n ) as TGroups,\n perils: {\n data: [],\n loading: true,\n loaded: false,\n pagination: {\n ordering: '',\n page: 1,\n page_size: 20,\n search: '',\n total_count: 0,\n },\n },\n invoices: {\n data: [],\n loading: true,\n loaded: false,\n pagination: {\n ordering: 'due_time',\n page: 1,\n page_size: 10000,\n search: '',\n total_count: 10000,\n },\n },\n groupedInvoices: Object.values(policyInvoiceStatuses).reduce(\n (a, curr) => ({\n ...a,\n [`${curr}`]: {\n data: [],\n loading: true,\n loaded: false,\n },\n }),\n {},\n ) as TGroups,\n endorsements: {\n data: [],\n loading: true,\n loaded: false,\n },\n cancellations: {\n data: [],\n loading: true,\n loaded: false,\n },\n\n exposureDetail: {\n data: { data: {} },\n loading: true,\n loaded: false,\n },\n loading: true,\n loaded: false,\n gracePeriods: {\n data: [],\n loading: true,\n loaded: false,\n },\n transactionHistory: {\n data: {},\n loading: true,\n loaded: false,\n pagination: {\n ordering: '',\n page: 1,\n page_size: 10000,\n search: '',\n total_count: 0,\n },\n },\n price: { data: undefined, loading: true, loaded: false },\n fields: {\n exposure: {\n data: [],\n loaded: false,\n loading: false,\n },\n peril: {\n data: {\n employer: [],\n location: [],\n },\n loaded: false,\n loading: false,\n },\n policy: {\n data: [],\n loaded: false,\n loading: false,\n },\n },\n cancellationDocuments: {\n data: [],\n loading: true,\n loaded: false,\n },\n cancellationPrice: {\n data: {},\n loading: true,\n loaded: false,\n },\n cancellationDetailList: {\n data: {},\n loading: true,\n loaded: false,\n },\n billingPaymentAmounts: {},\n totalBillingPaymentAmounts: {\n totalPremium: 0,\n totalFees: 0,\n total: 0, // grand total\n paidToDate: 0,\n pastDue: 0,\n currentDue: 0,\n totalDue: 0,\n },\n billingPaymentInfo: {\n data: {},\n loading: true,\n loaded: false,\n },\n underwritingQuestionsState: {},\n underwritingQuestions: { policy: { data: undefined, loaded: false, loading: false } },\n ruleEngineResults: {\n data: [],\n loading: true,\n loaded: false,\n },\n expandedBillingAccordions: {},\n policyStatuses: {\n isActiveStatus: false,\n isBoundStatus: false,\n isInCancellationStatus: false,\n isCancelledStatus: false,\n isExpiredStatus: false,\n },\n};\n\nexport const policyDetailContextDefault: IPolicyDetailContextType = {\n ...initialPolicyDetailData,\n resetPolicyDetailState: () => {},\n fetch: () => new Promise(() => {}),\n getExposures: () => new Promise(() => {}),\n getPerils: () => new Promise(() => {}),\n getBillingData: () => new Promise(() => {}),\n updatePaymentInfo: () => new Promise(() => {}),\n getEndorsements: () => new Promise(() => {}),\n getCancellationDetails: () => new Promise(() => {}),\n resetPolicyEndorsements: () => {},\n getCancellations: () => new Promise(() => {}),\n resetPolicyCancellations: () => {},\n resetPolicyInvoices: () => {},\n getExposure: () => new Promise(() => {}),\n getPolicyPrice: () => new Promise(() => {}),\n getGracePeriods: () => new Promise(() => {}),\n getTransactionHistory: () => new Promise(() => {}),\n resetTransactionHistory: () => {},\n resetPolicyExposures: () => {},\n resetPolicyPerils: () => {},\n getRuleEngineResults: () => new Promise(() => {}),\n setCancellationDetails: () => {},\n resetCancellationDetails: () => {},\n setExpandedBillingAccordions: () => {},\n};\n\nexport const PolicyDetailContext = createContext(null!);\n","import ApiService, { Params } from 'api/helpers/Sender';\nimport { Choice } from 'api/models/DynamicFields/dynamicField.model';\nimport {\n IAuxDataPrometrix,\n IDuckCreekPolicyNumberData,\n IPrometrixData,\n} from 'api/models/Integrations/Prometrix/AddressRequest.model';\nimport { Exposure } from 'api/models/Policy/Endorsements/exposure.model';\nimport { Quote } from 'api/models/Quote/quote.model';\nimport { QuoteDetailResponse } from 'api/models/Quote/quoteDetailResponse.model';\nimport { QuoteDocuments } from 'api/models/Quote/quoteDocuments.model';\nimport { QuoteDocumentsRetrieve } from 'api/models/Quote/QuoteDocumentsRetrieve.model';\nimport { QuoteEditDocuments } from 'api/models/Quote/QuoteEditDocuments.model';\nimport { QuoteInvoicesList } from 'api/models/Quote/quoteInvoicesList.model';\nimport { QuotePrice } from 'api/models/Quote/quotePrice.model';\nimport { QuoteProducer } from 'api/models/Quote/quoteProducer.model';\nimport { ProgressData, QuoteProgress } from 'api/models/Quote/quoteProgress.model';\nimport { QuotesFilteredChips } from 'api/models/Quote/QuotesFilteredChips.model';\nimport { IQuotesOrRenewalsPagination } from 'api/queries/QuotesOrRenewalsQueries';\nimport { AxiosRequestConfig } from 'axios';\nimport { IQuoteDetailQueryParams } from 'providers/QuoteDetailProvider/types';\nimport { Pagination, PaginationResponse } from 'types/Pagination';\n\nexport interface IDeductibleWindOptionsRequest {\n wind_hail_deductible_options: Choice[];\n}\n\nexport interface IDeductibleWindResponse {\n pol_deductible_wind: Choice;\n}\n\nexport interface IDeclineQuoteModel {\n declination_reason?: string;\n}\n\nconst API = new ApiService();\n\nexport const getQuotes = async (query: Pagination): Promise> => {\n const { data } = await API.get('quotes', query as Params);\n return data;\n};\n\nexport const getThreeSubmissionsStatus = async (\n query?: IQuotesOrRenewalsPagination,\n): Promise => {\n const { data } = await API.get(`quotes/get-quote-count-and-status`, query as Params);\n return data;\n};\n\nexport const getQuoteDetail = async (\n locator: string,\n query?: Params,\n options?: AxiosRequestConfig,\n): Promise => {\n const { data } = await API.get(`quotes/${locator}`, query, options);\n return data;\n};\n\nexport const lockQuoteRequest = async (locator: string): Promise => {\n const { data } = await API.post(`quotes/${locator}/lock`);\n return data;\n};\n\nexport const referQuoteRequest = async (\n locator: string,\n query?: IQuoteDetailQueryParams,\n): Promise => {\n const { data } = await API.post(`quotes/${locator}/refer`, {}, {}, query as Params);\n return data;\n};\n\nexport const acceptQuoteRequest = async (locator: string): Promise => {\n const { data } = await API.post(`quotes/${locator}/accept`);\n return data;\n};\n\nexport const invalidateQuoteRequest = async (locator: string): Promise => {\n const { data } = await API.post(`quotes/${locator}/invalidate`);\n return data;\n};\n\nexport const discardQuoteRequest = async (locator: string): Promise => {\n const { data } = await API.post(`quotes/${locator}/discard`);\n return data;\n};\n\nexport const issueQuoteRequest = async (locator: string): Promise => {\n const { data } = await API.post(`quotes/${locator}/issue`);\n return data;\n};\n\nexport const cloneQuoteRequest = async (locator: string): Promise => {\n const { data } = await API.post(`quotes`, { quote_locator: locator });\n return data;\n};\n\nexport const getQuotesExposuresWithLocator = async (\n quotelocator: string,\n query: Pagination,\n options?: AxiosRequestConfig,\n): Promise> => {\n const { data } = await API.get(`quotes/${quotelocator}/exposures`, query as Params, options);\n return data;\n};\n\nexport const getQuoteExposureWithLocator = async (\n policylocator: string,\n exposurelocator: string,\n): Promise => {\n const { data } = await API.get(`policies/${policylocator}/exposures/${exposurelocator}`);\n return data;\n};\n\nexport const getQuotePriceRequest = async (quotelocator: string): Promise => {\n const { data } = await API.get(`quotes/${quotelocator}/price`);\n return data;\n};\n\nexport const getQuotesDcoumentsWithLocator = async (\n quotelocator: string,\n query: Pagination,\n): Promise> => {\n const { data } = await API.get(`quotes/${quotelocator}/all-documents`, query as Params);\n return data;\n};\n\nexport const updateDocumentWithLocator = async (\n quoteId: string,\n documentLocator: string,\n body: QuoteEditDocuments,\n): Promise => {\n const { data } = await API.patch(`quotes/${quoteId}/quote-documents/${documentLocator}`, body);\n return data;\n};\n\nexport const deleteDocumentService = async (quoteId: string, documentLocator: string) => {\n const { data } = await API.delete(`quotes/${quoteId}/quote-documents/${documentLocator}`);\n return data;\n};\n\nexport const quotesDocumentsWithLocator = async (\n quoteLocator: string,\n documentLocator: string,\n): Promise => {\n const { data } = await API.get(`quotes/${quoteLocator}/all-documents/${documentLocator}`);\n return data;\n};\n\nexport const getQuotesInvoicesWithLocator = async (\n quotelocator: string,\n reference_type: string,\n query: Pagination,\n): Promise> => {\n const newParams = { ...query, type: reference_type };\n const { data } = await API.get(`quotes/${quotelocator}/invoices`, newParams as Params);\n return data;\n};\n\nexport const declineQuoteRequest = async (\n locator: string,\n body?: IDeclineQuoteModel,\n): Promise => {\n const { data } = await API.post(`quotes/${locator}/decline`, body);\n return data;\n};\n\nexport const sendBackQuoteRequest = async (locator: string): Promise => {\n const { data } = await API.post(`quotes/${locator}/cancel-referral`);\n return data;\n};\n\nexport const getQuoteProgressRequest = async (locator: string): Promise => {\n const { data } = await API.get(`quotes/${locator}/aux-data/progress-data`);\n\n return data;\n};\n\nexport const getDeductibleWindOptionsRequest = async (\n locator: string,\n): Promise => {\n const { data } = await API.get(`quotes/${locator}/wind-hail-deductible-options`);\n\n return data;\n};\n\nexport const initializeWindHailDeductibleForQuote = async (\n locator: string,\n): Promise => {\n const { data } = await API.patch(`quotes/${locator}/wind-hail-deductible`);\n\n return data;\n};\n\nexport const setQuoteProgressRequest = async (\n locator: string,\n body: ProgressData,\n): Promise => {\n const { data } = await API.put(`quotes/${locator}/aux-data/progress-data`, body);\n\n return data;\n};\n\nexport const getQuotePrometrixResultsRequest = async (\n locator: string,\n): Promise => {\n const { data } = await API.get(`quotes/${locator}/aux-data/prometrix-data`);\n\n return data;\n};\n\nexport const setQuotePrometrixResultsRequest = async (\n locator: string,\n body: IPrometrixData,\n): Promise => {\n const { data } = await API.put(`quotes/${locator}/aux-data/prometrix-data`, body);\n\n return data;\n};\n\nexport const setQuoteDuckCreekPolicyNumberRequest = async (\n locator: string,\n body: IDuckCreekPolicyNumberData,\n): Promise => {\n const { data } = await API.put(`quotes/${locator}/aux-data/dc-renewal-src`, body);\n\n return data;\n};\n\nexport const updateQuoteProducerRequest = async (\n locator: string,\n body: { producer: string },\n): Promise => {\n const { data } = await API.patch(`quotes/${locator}/update-owner`, body);\n\n return data;\n};\n\nexport const enableWC = async (quoteLocator: string): Promise => {\n const { data } = await API.post(`quotes/${quoteLocator}/enable-wc`);\n\n return data;\n};\n\nexport const disableWC = async (quoteLocator: string): Promise => {\n const { data } = await API.post(`quotes/${quoteLocator}/disable-wc`);\n\n return data;\n};\n","import { isRenewalEnabled } from 'common/constants';\nimport { useLocation } from 'react-router-dom';\n\nconst useQuoteOrRenewal = () => {\n const location = useLocation();\n const isRenewal = isRenewalEnabled && location.pathname.includes('/renewals');\n const isQuote = location.pathname.includes('/quotes');\n const quoteOrRenewalEntityType = isRenewal ? 'Renewal' : 'Quote';\n const quoteOrRenewalDetailPath = isRenewal ? '/renewals' : '/quotes';\n const quoteOrRenewalEntityTypeLower = isRenewal ? 'renewal' : 'quote';\n const submissionOrRenewalEntityTypeLower = isRenewal ? 'renewal' : 'submission';\n const submissionOrRenewalTitlePascalCase = isRenewal ? 'Renewals' : 'Submissions';\n\n return {\n isRenewal,\n isQuote,\n quoteOrRenewalEntityType,\n quoteOrRenewalDetailPath,\n quoteOrRenewalEntityTypeLower,\n submissionOrRenewalEntityTypeLower,\n submissionOrRenewalTitlePascalCase,\n };\n};\n\nexport default useQuoteOrRenewal;\n","import { threeExposureNames, threePolicyGroupNames } from 'common/constants';\nimport { IExposureList } from 'providers/PolicyDetailProvider/types';\nimport { createContext } from 'react';\n\n/// types\nimport { IQuoteDetailContextType, IQuoteDetailStore, TGroups } from './types';\n\nexport const initialQuoteDetailData: IQuoteDetailStore = {\n data: undefined,\n loading: true,\n loaded: false,\n isHandleNextClicked: false,\n isCoveragesSummaryPriceCalculated: false,\n isPreQual: undefined,\n underwritingQuestionsState: {},\n exposures: {\n data: [],\n loading: true,\n loaded: false,\n pagination: {\n ordering: '',\n page: 1,\n page_size: 10000,\n search: '',\n total_count: 0,\n },\n },\n exposureList: Object.values(threeExposureNames).reduce(\n (a, curr) => ({\n ...a,\n [`${curr}`]: {\n data: [],\n loading: true,\n loaded: false,\n pagination: {\n ordering: '',\n page: 1,\n page_size: 10000,\n search: '',\n total_count: 0,\n },\n },\n }),\n {} as IExposureList,\n ),\n groups: Object.values(threePolicyGroupNames).reduce(\n (a, curr) => ({\n ...a,\n [`${curr}`]: {\n data: [],\n loading: true,\n loaded: false,\n },\n }),\n {},\n ) as TGroups,\n exposureDetail: {\n data: {},\n loading: true,\n loaded: false,\n },\n fields: {\n exposure: {\n data: [],\n loaded: false,\n loading: true,\n },\n peril: {\n data: {\n employer: [],\n location: [],\n },\n loaded: false,\n loading: false,\n },\n policy: {\n data: [],\n loaded: false,\n loading: false,\n },\n },\n price: { data: undefined, loading: false, loaded: false },\n documents: {\n data: [],\n loading: true,\n loaded: false,\n pagination: {\n ordering: '',\n page: 1,\n page_size: 20,\n search: '',\n total_count: 0,\n },\n },\n invoices: {\n data: [],\n loading: true,\n loaded: false,\n pagination: {\n ordering: '',\n page: 1,\n page_size: 20,\n search: '',\n total_count: 0,\n },\n },\n underwritingQuestions: { policy: { data: undefined, loaded: false, loading: false } },\n ruleEngineResults: {\n data: [],\n loading: false,\n loaded: false,\n },\n progress: {\n data: {\n // set default value\n summary_pricing: { is_completed: false },\n },\n loading: true,\n loaded: false,\n },\n canEdit: false,\n isAllowedTopBarActions: false,\n areRenewalFieldsInvalid: false,\n isTaxIDInvalid: false,\n isQuoteOrReferButtonActive: false,\n isReferButtonVisible: false,\n submissionStatuses: {\n isPendingReferralStatus: false,\n isDraftedStatus: false,\n isReferredStatus: false,\n isDeclinedStatus: false,\n isDeclinedByUWStatus: false,\n isDeclinedByAgentStatus: false,\n isMoratoriumStatus: false,\n isExpiredStatus: false,\n isQuotedStatus: false,\n isNonRenewedStatus: false,\n isDraftedOrPendingReferralStatus: false,\n isAcceptedStatus: false,\n isDiscardedStatus: false,\n },\n};\n\nexport const quoteDetailContextDefault: IQuoteDetailContextType = {\n ...initialQuoteDetailData,\n isProgressTabs: false,\n resetQuoteDetailState: () => {},\n fetch: () => new Promise(() => {}),\n updateQuoteDetail: () => new Promise(() => {}),\n lockQuote: () => new Promise(() => {}),\n referQuote: () => new Promise(() => {}),\n acceptQuote: () => new Promise(() => {}),\n sendBackQuote: () => new Promise(() => {}),\n invalidateQuote: () => new Promise(() => {}),\n discardQuote: () => new Promise(() => {}),\n getQuoteDocuments: () => new Promise(() => {}),\n issueQuote: () => new Promise(() => {}),\n deleteDocument: () => new Promise(() => {}),\n resetDocumentsState: () => {},\n getExposures: () => new Promise(() => {}),\n getExposure: () => new Promise(() => {}),\n getQuotePrice: () => new Promise(() => {}),\n submitPreQual: () => new Promise(() => {}),\n getInvoices: () => new Promise(() => {}),\n resetQuoteInvoices: () => new Promise(() => {}),\n saveUnderwritingQuestionsState: () => new Promise(() => {}),\n getRuleEngineResults: () => new Promise(() => {}),\n updateRuleEngineDecisionStatus: () => new Promise(() => {}),\n handleKeywordChange: () => new Promise(() => {}),\n resetQuoteExposures: () => {},\n setUnderwritingQuestionsState: () => {},\n updateQuoteProgress: () => new Promise(() => {}),\n getQuoteProgress: () => new Promise(() => {}),\n setQuoteProgress: () => new Promise(() => {}),\n setHandleNextButtonClicked: () => {},\n setIsCoveragesSummaryPriceCalculated: () => {},\n updateQuoteProducer: () => new Promise(() => {}),\n};\n\nexport const QuoteDetailContext = createContext(null!);\n","import { createContext } from 'react';\n\n/// types\nimport { IRouterPromptContextType, IRouterPromptStore } from './types';\n\nexport const initialRouterPromptData: IRouterPromptStore = {\n when: false,\n bypassRouteBlock: false,\n};\n\nexport const routerPromptContextDefault: IRouterPromptContextType = {\n ...initialRouterPromptData,\n resetRouterState: () => {},\n setWhen: () => false,\n setBypassRouteBlock: () => {},\n};\n\nexport const RouterPromptContext = createContext(null!);\n","import ApiService from 'api/helpers/Sender';\nimport { SmartyAutoCompleteRequest } from 'api/models/Smarty/SmartyAutoCompleteRequest.model';\nimport { SmartyAutoCompleteResponse } from 'api/models/Smarty/SmartyAutoCompleteResponse.model';\nimport { SmartyValidateAddressRequest } from 'api/models/Smarty/SmartyValidateAddressRequest.model';\nimport { SmartyValidateAddressResponse } from 'api/models/Smarty/SmartyValidateAddressResponse.model';\n\nconst API = new ApiService();\n\nexport const getSmartyAddress = async (\n body: SmartyAutoCompleteRequest,\n): Promise => {\n const { data } = await API.post(`smarty/complete-address`, {\n ...body,\n });\n\n return data ?? [];\n};\n\nexport const validateSmartyAddress = async (\n body: SmartyValidateAddressRequest,\n): Promise => {\n const { data } = await API.post(`smarty/validate-address`, {\n ...body,\n });\n\n return data ?? [];\n};\n","import { AuthContext } from 'providers/AuthProvider/AuthContext';\nimport { IAuthContext } from 'providers/AuthProvider/types';\nimport { useContext } from 'react';\n\nexport default function useAuth(): IAuthContext {\n const context = useContext(AuthContext);\n\n /* istanbul ignore if */\n if (!context) {\n throw new Error('useAuth must be used within a AuthProvider');\n }\n\n return context;\n}\n","import { QuoteDetailContext } from 'providers/QuoteDetailProvider/QuoteDetailProviderContext';\nimport { IQuoteDetailContextType } from 'providers/QuoteDetailProvider/types';\nimport { useContext } from 'react';\n\nexport default function useQuoteDetail(): IQuoteDetailContextType {\n const context = useContext(QuoteDetailContext);\n\n /* istanbul ignore if */\n if (!context) {\n throw new Error('useQuoteDetail must be used within a QuoteDetailProvider');\n }\n\n return context;\n}\n","import { createContext } from 'react';\n\n/// types\nimport { ITabContextType, ITabStore } from './types';\n\nexport const initialTabData: ITabStore = {\n activeTab: 0,\n};\n\nexport const tabContextDefault: ITabContextType = {\n ...initialTabData,\n resetTabState: () => {},\n setActiveTab: () => 0,\n};\n\nexport const TabContext = createContext(null!);\n","export default \"__VITE_ASSET__Duouj23P__\"","import { FC } from 'react';\nimport { Helmet } from 'react-helmet';\n\ninterface IHead {\n title: string;\n description?: string;\n}\n\nconst Head: FC = ({ title = 'THREE Insurance Portal', description }) => (\n \n {description && }\n\n {title}\n {description && }\n \n);\n\nexport default Head;\n","import { Box, Link, Typography } from '@mui/material';\nimport TokenStorage from 'helpers/TokenStorage';\nimport { FC } from 'react';\n// hooks\nimport logoSecondary from 'assets/images/logo-secondary.svg';\nimport Head from 'components/Head';\nimport { useTranslation } from 'react-i18next';\nimport { Link as RouterLink } from 'react-router-dom';\n\ninterface StaticErrorPageProps {\n error: string | (string | null)[] | null;\n error_description: string | (string | null)[] | null;\n tracking: string | (string | null)[] | null;\n title: string;\n displayReturnToHomePageButton?: boolean;\n}\n\nconst StaticErrorPage: FC = ({\n title,\n error,\n error_description,\n tracking,\n displayReturnToHomePageButton = true,\n}) => {\n const token = TokenStorage.get()?.access;\n const { t } = useTranslation();\n\n return (\n <>\n \n theme.palette.primary.main,\n }}\n >\n theme.customColors.sso.darkGrey,\n overflow: 'hidden',\n width: 1,\n }}\n >\n \n theme.palette.common.white}>\n {t('Ooops!, Something went wrong')}\n \n \n theme.customColors.sso.lightGrey,\n overflow: 'hidden',\n width: 1,\n }}\n >\n \n \n {error_description ?? ''}\n \n
    \n {displayReturnToHomePageButton && (\n theme.customColors.linkText,\n }}\n component={RouterLink}\n to={token ? '/' : '/login'}\n >\n {t('Return to Homepage')}\n \n )}\n
    \n \n theme.palette.common.white,\n overflow: 'hidden',\n width: 1,\n }}\n >\n {(error || tracking) && (\n theme.customColors.linkText }}>\n {t('Technical Details')}\n \n )}\n \n \n {error && `Error: ${error}`}\n \n \n {tracking && `Tracking: ${tracking}`}\n \n \n \n \n \n );\n};\n\nexport default StaticErrorPage;\n","export default \"data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20fill='none'%3e%3cpath%20stroke-linecap='round'%20stroke-linejoin='round'%20stroke-width='1.5'%20d='M20.503%207.998h-4.001a1%201%200%200%201-1-1V2.996'/%3e%3cpath%20stroke-linecap='round'%20stroke-linejoin='round'%20stroke-width='1.5'%20d='M6.498%207.998V4.997a2%202%200%200%201%202-2h7.175a2%202%200%200%201%201.415.585l2.83%202.83a2%202%200%200%201%20.585%201.414v11.177a2%202%200%200%201-2%202H8.498a2%202%200%200%201-2-2v-1M9.75%2011.75l-2.502%202.5M7.248%2011.75l2.501%202.5'/%3e%3crect%20width='10.004'%20height='10.004'%20x='3.497'%20y='7.998'%20stroke-linecap='round'%20stroke-linejoin='round'%20stroke-width='1.5'%20rx='3'/%3e%3c/svg%3e\"","export default \"data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%20fill='none'%3e%3cpath%20d='M19%208H15C14.448%208%2014%207.552%2014%207V3'%20stroke='%23323232'%20stroke-width='1.5'%20stroke-linecap='round'%20stroke-linejoin='round'%20/%3e%3cpath%20d='M5%2017V19C5%2020.105%205.895%2021%207%2021H17C18.105%2021%2019%2020.105%2019%2019V7.828C19%207.298%2018.789%206.789%2018.414%206.414L15.586%203.586C15.211%203.211%2014.702%203%2014.172%203H7C5.895%203%205%203.895%205%205V11'%20stroke='%23323232'%20stroke-width='1.5'%20stroke-linecap='round'%20stroke-linejoin='round'%20/%3e%3cpath%20d='M9.08997%2012.03L11%2013.94L8.96997%2015.97'%20stroke='%23323232'%20stroke-width='1.5'%20stroke-linecap='round'%20stroke-linejoin='round'%20/%3e%3cpath%20d='M11%2013.9399H5'%20stroke='%23323232'%20stroke-width='1.5'%20stroke-linecap='round'%20stroke-linejoin='round'%20/%3e%3c/svg%3e\"","import { DialogContext } from 'providers/DialogProvider/DialogProviderContext';\nimport { IDialogContextType } from 'providers/DialogProvider/types';\nimport { useContext } from 'react';\n\nexport default function useDialog(): IDialogContextType {\n const context = useContext(DialogContext);\n\n /* istanbul ignore if */\n if (!context) {\n throw new Error('useDialog must be used within a DialogProvider');\n }\n\n return context;\n}\n","import { isEmpty } from 'lodash-es';\n\ntype StringRecord = Record;\n\ntype MaybeStringRecord = StringRecord | undefined;\n\n/**\n * Type representing the structure of the slice definitions.\n *\n * If T extends StringRecord, it includes a `name` property and an `actions` property with keys of T and values as strings.\n *\n * If T does not extend StringRecord (i.e., is undefined), it only includes the `name` property.\n */\ntype SliceDefinitions = T extends StringRecord\n ? { name: string; actions: { [K in keyof T]: string } }\n : { name: string };\n\n/**\n * Creates slice definitions for a given name and actions.\n *\n * @template T - The type of the actions object, which should be a record with string keys and values.\n * @param {string} name - The name of the slice.\n * @param {T} [actions] - An optional object representing actions. Each action will be prefixed with the name.\n * @returns {SliceDefinitions} - The slice definition object containing the name and processed actions.\n *\n * @example\n * // Create slice definitions with actions\n * const sliceDefinitions = createSliceDefinitions('QuoteStepperSlice', {\n * updateStepper: 'updateStepper',\n * });\n * console.log(sliceDefinitions);\n * // Output:\n * // {\n * // name: 'QuoteStepperSlice',\n * // actions: {\n * // updateStepper: 'QuoteStepperSlice/updateStepper'\n * // }\n * // }\n *\n * @example\n * // Create slice definitions without actions\n * const sliceDefinitions = createSliceDefinitions('QuoteStepperSlice');\n * console.log(sliceDefinitions);\n * // Output:\n * // {\n * // name: 'QuoteStepperSlice'\n * // }\n */\nexport const createSliceDefinitions = (\n name: string,\n actions?: T,\n): SliceDefinitions => {\n /**\n * Process actions by prefixing each value with the `name`,\n * if actions are provided and not empty\n */\n const processedActions = !isEmpty(actions)\n ? Object.entries(actions).reduce(\n (acc, [key, value]) => {\n acc[key as keyof T] = `${name}/${value}`;\n\n return acc;\n },\n {} as { [K in keyof T]: string },\n )\n : undefined;\n\n /**\n * Return the slice definitions,\n * conditionally including the actions if they are processed\n */\n return {\n name,\n ...(processedActions && { actions: processedActions }),\n } as SliceDefinitions;\n};\n","/* eslint-disable no-param-reassign */\nimport { createSliceDefinitions } from 'store/helpers/createSliceDefinitions';\nimport { SliceCreator } from 'store/useAppStore.types';\nimport { UISlice, UISliceState } from './UI.types';\n\nconst { actions } = createSliceDefinitions('UISlice', {\n SET_LOADING: 'setFullscreenLoading',\n RESET: 'reset',\n});\n\nconst initialState: UISliceState = {\n isFullscreenLoading: false,\n};\n\nexport const createUISlice: SliceCreator = (set) => ({\n ...initialState,\n\n actions: {\n setFullscreenLoading: (isLoading) => {\n set(\n (state) => {\n state.UI.isFullscreenLoading = isLoading;\n },\n false,\n { type: actions.SET_LOADING, payload: { isLoading } },\n );\n },\n reset: () => {\n set(\n (state) => {\n state.UI = {\n ...state.UI,\n ...initialState,\n };\n },\n false,\n actions.RESET,\n );\n },\n },\n});\n","import { create } from 'zustand';\nimport { devtools, subscribeWithSelector } from 'zustand/middleware';\nimport { immer } from 'zustand/middleware/immer';\nimport { createUISlice } from './features/UI';\nimport { AppState } from './useAppStore.types';\n\n// #region Reseting slices\n/**\n * A set of functions used to reset slices of the store.\n *\n * @example\n * sliceResetFns.add(() => get().resetStepper());\n */\nexport const sliceResetFunctions = new Set<() => void>();\n\n/**\n * Calls all registered slice reset functions to reset the app store.\n */\nexport const resetAppStore = () => {\n sliceResetFunctions.forEach((resetFn) => {\n resetFn();\n });\n};\n// #endregion\n\n/**\n * Access the store that holds every slice\n */\nexport const useAppStore = create()(\n devtools(\n immer(\n subscribeWithSelector((...a) => {\n const store: AppState = {\n UI: createUISlice(...a),\n };\n\n // Register the slice reset functions to global\n Object.values(store).forEach((slice) =>\n sliceResetFunctions.add(() => slice?.actions?.reset()),\n );\n\n return store;\n }),\n ),\n { name: 'AgentPortalStore' },\n ),\n);\n","import { useAppStore } from 'store/useAppStore';\nimport { AppState, AppStateKeys, StateKeys } from 'store/useAppStore.types';\nimport { useShallow } from 'zustand/react/shallow';\n\n/**\n * Custom hook to select state properties or actions from a specific slice of the store using shallow equality.\n *\n * @template T - The type of the selected state properties or actions.\n * @param {AppStateKeys} sliceKey - The key of the slice to select from.\n * @param {T[]} props - The array of keys to select from the specified slice. Special case for 'actions' to select all actions.\n * @returns {Pick} - The selected state properties or actions.\n *\n * @example\n * const { currentSection, currentStep } = useAppSelector('quoteStepper', ['currentSection', 'currentStep']);\n * const { actions } = useAppSelector('quoteStepper', ['actions']);\n */\nexport const useAppSelector = <\n Slice extends AppStateKeys,\n Props extends (StateKeys | 'actions')[],\n>(\n sliceKey: Slice,\n props: Props,\n): Pick => {\n // Runtime check for unique keys\n const uniqueProps = Array.from(new Set(props));\n\n if (uniqueProps.length !== props.length) {\n const duplicateKeys = props.filter((key, index) => props.indexOf(key) !== index);\n\n throw new Error(`Duplicate keys found in the props array: [${duplicateKeys.join(', ')}]`);\n }\n\n return useAppStore(\n useShallow((state: AppState) => {\n const slice = state[sliceKey];\n const selectedState = {} as Pick;\n\n uniqueProps.forEach((key) => {\n if (key === 'actions') {\n // Special case for 'actions'\n if ('actions' in slice) {\n Object.assign(selectedState, { actions: slice.actions });\n } else {\n console.warn(`'actions' property does not exist in slice '${String(sliceKey)}'.`);\n }\n } else if (key in slice) {\n // Handle selecting from state\n selectedState[key] = slice[key];\n } else {\n console.warn(`Key '${String(key)}' does not exist in slice '${String(sliceKey)}'.`);\n }\n });\n\n return selectedState;\n }),\n );\n};\n","import { useAppSelector } from 'store/hooks';\n\nconst useFullscreenLoader = () => {\n const {\n actions: { setFullscreenLoading },\n isFullscreenLoading,\n } = useAppSelector('UI', ['isFullscreenLoading', 'actions']);\n\n return { isFullscreenLoading, setFullscreenLoading };\n};\n\nexport default useFullscreenLoader;\n","import { AdvancedSearchContext } from 'providers/AdvancedSearchProvider/AdvancedSearchProviderContext';\nimport { IAdvancedSearchContextType } from 'providers/AdvancedSearchProvider/types';\nimport { useContext } from 'react';\n\nexport default function useAdvancedSearch(): IAdvancedSearchContextType {\n const context = useContext(AdvancedSearchContext);\n\n /* istanbul ignore if */\n if (!context) {\n throw new Error('useAdvancedSearch must be used within a AdvancedSearchProvider');\n }\n\n return context;\n}\n","import { useLayoutEffect } from 'react';\n\nconst useEscape = (onEscape: () => void) => {\n useLayoutEffect(() => {\n const handleEsc = (event: KeyboardEvent) => {\n if (event.key === 'Escape') onEscape();\n };\n\n window.addEventListener('keydown', handleEsc);\n\n return () => {\n window.removeEventListener('keydown', handleEsc);\n };\n }, []);\n};\n\nexport default useEscape;\n","import { Box } from '@mui/material';\nimport React, { FC } from 'react';\n\ninterface ITabPanelProps {\n index: number;\n value: number;\n label?: string;\n children?: React.ReactNode;\n}\n\nconst TabPanel: FC = (props) => {\n const { children, value, index, ...other } = props;\n\n return (\n