{"version":3,"file":"index-Bt123ClE.js","sources":["../../Client/shared/Hooks/Navigation.ts","../../Client/shared/Common/DateHelpers/index.ts"],"sourcesContent":["import { generatePath, useNavigate } from 'react-router-dom-v5-compat';\r\n\r\n/**\r\n * A wrapper around `react-router-dom`'s `useNavigate` hook which takes care of transforming a route into\r\n * a URI. For example, \"/person/:id\" would become \"/person/5\" when params is `{ id: 5 }`. Optionally provides\r\n * for history replacement in the third parameter.\r\n */\r\nexport const useNavigateWithParams = () => {\r\n const navigate = useNavigate();\r\n\r\n return (path: string, params?: any, replace: boolean = false) => {\r\n navigate(generatePath(path, params), { replace });\r\n };\r\n};\r\n","import { AppSetting, getNumberAppSetting } from '@business/AppSetting';\r\nimport * as Constants from '@shared/Constants';\r\nimport dayjs from 'dayjs';\r\nimport minMax from 'dayjs/plugin/minMax';\r\n\r\ndayjs.extend(minMax);\r\n\r\nexport function getMinEffectiveDate(quoteCreatedOnDate: string): Date {\r\n const createdOnDate = getLocalDate(quoteCreatedOnDate),\r\n earliestDate = createdOnDate.subtract(15, 'day'),\r\n currentDate = dayjs(),\r\n minDate = dayjs.max(earliestDate, currentDate) as dayjs.Dayjs;\r\n return minDate.toDate();\r\n}\r\n\r\nexport function getMaxEffectiveDate(quoteCreatedOnDate: string, minDate: Date): Date {\r\n const createdOnDate = getLocalDate(quoteCreatedOnDate),\r\n // TODO DRC 1/23/25 - Update elements to set min and max dates from the server side\r\n // For now, this app setting is used to set the max effective date for all carriers\r\n vaveMaxEffectiveDateDays = getNumberAppSetting(AppSetting.VaveMaxEffectiveDateDays),\r\n maxDate = createdOnDate.add(vaveMaxEffectiveDateDays || 0, 'day');\r\n\r\n // SW-34245 - If the minimum probable effective date element is set to a date after the max date,\r\n // the datepicker component enters an infinite loop trying to reconcile the date being set outside the boundaries.\r\n // As mentioned above, we need to work on getting this logic tied to the element objects instead of this function.\r\n if (maxDate.isBefore(minDate))\r\n return dayjs(minDate)\r\n .add(vaveMaxEffectiveDateDays || 0, 'day')\r\n .toDate();\r\n return maxDate.toDate();\r\n}\r\n\r\nexport function getLocalDate(dateString: string) {\r\n const localDate = dayjs(dateString.replace(/Z/g, ''));\r\n return localDate;\r\n}\r\n\r\nexport function getFormattedDate(dateTime: string | Date, errorText: string = 'Error formatting Date') {\r\n const date = dayjs(dateTime);\r\n return date.isValid() ? date.format(Constants.simpleDateFormat) : errorText;\r\n}\r\n"],"names":["useNavigateWithParams","navigate","useNavigate","path","params","replace","generatePath","dayjs","minMax","getMaxEffectiveDate","quoteCreatedOnDate","minDate","createdOnDate","getLocalDate","vaveMaxEffectiveDateDays","getNumberAppSetting","AppSetting","maxDate","dateString","getFormattedDate","dateTime","errorText","date","Constants.simpleDateFormat"],"mappings":"uPAOO,MAAMA,EAAwB,IAAM,CACvC,MAAMC,EAAWC,EAAY,EAE7B,MAAO,CAACC,EAAcC,EAAcC,EAAmB,KAAU,CAC7DJ,EAASK,EAAaH,EAAMC,CAAM,EAAG,CAAE,QAAAC,EAAS,CACpD,CACJ,ECRAE,EAAM,OAAOC,CAAM,EAUH,SAAAC,EAAoBC,EAA4BC,EAAqB,CACjF,MAAMC,EAAgBC,EAAaH,CAAkB,EAGjDI,EAA2BC,EAAoBC,EAAW,wBAAwB,EAClFC,EAAUL,EAAc,IAAIE,GAA4B,EAAG,KAAK,EAKhE,OAAAG,EAAQ,SAASN,CAAO,EACjBJ,EAAMI,CAAO,EACf,IAAIG,GAA4B,EAAG,KAAK,EACxC,OAAO,EACTG,EAAQ,OAAO,CAC1B,CAEO,SAASJ,EAAaK,EAAoB,CAEtC,OADWX,EAAMW,EAAW,QAAQ,KAAM,EAAE,CAAC,CAExD,CAEgB,SAAAC,EAAiBC,EAAyBC,EAAoB,wBAAyB,CAC7F,MAAAC,EAAOf,EAAMa,CAAQ,EAC3B,OAAOE,EAAK,QAAQ,EAAIA,EAAK,OAAOC,CAA0B,EAAIF,CACtE"}