{"version":3,"file":"EmailApi-Yo1bBE9w.js","sources":["../../Client/api/EmailApi.ts"],"sourcesContent":["import { ProgressModal } from '@legacy/Components/Modals/Progress';\r\nimport * as Models from '@shared/Models';\r\nimport dayjs from 'dayjs';\r\nimport * as NProgress from 'nprogress';\r\nimport * as ApiCaller from './ApiCaller';\r\n\r\nexport function sendEmailTemplates(email: string, checked: string[]): Promise<string[]> {\r\n return ApiCaller.$post(\r\n `api/email/sendtemplate?email=${email}&selected=${checked.join(',')}`,\r\n {},\r\n new ProgressModal(),\r\n 'send test email template'\r\n );\r\n}\r\n\r\nexport function emailQuote(quoteId: string, quote: Models.IEmailQuoteInfo): Promise<void> {\r\n const url = `api/quotes/${quoteId}/email`;\r\n return ApiCaller.$post(url, quote, NProgress, 'email homeowner quote');\r\n}\r\n\r\nexport function emailCommercialQuote(quoteId: string, email: Models.EmailTemplateInfoModel): Promise<void> {\r\n const url = `api/commercial/quotes/${quoteId}/commercialquoteemail`;\r\n return ApiCaller.$post(url, email, NProgress, 'email commercial quote');\r\n}\r\n\r\nexport function emailCommercialUnderwriter(\r\n quoteId: string,\r\n email: Models.NullableString,\r\n request: Models.IContactUnderwriterRequest\r\n): Promise<void> {\r\n const url = `api/commercial/quotes/${quoteId}/underwriteremail`;\r\n return ApiCaller.$post(url, request, NProgress, 'email commercial underwriter');\r\n}\r\n\r\nexport function emailHubQuote(quoteId: string, emailInfo: Models.IEmailQuoteInfo): Promise<void> {\r\n const url = `api/quotes/${quoteId}/hubemail?email=${emailInfo.Email}`;\r\n return ApiCaller.$post(url, emailInfo, NProgress, 'email hub quote');\r\n}\r\n\r\nexport function sendContactEmail(model: Models.ContactModel): Promise<void> {\r\n const url = 'api/contact';\r\n return ApiCaller.$post(url, model, NProgress, 'send contact us email');\r\n}\r\n\r\nexport function sendVerifyPolicy(model: Models.VerifyModel): Promise<void> {\r\n const url = 'api/verifypolicy';\r\n return ApiCaller.$post(url, model, NProgress, 'send policy verification');\r\n}\r\n\r\nexport function verifyPolicyNumber(policyNumber: string): Promise<boolean> {\r\n const url = `api/verifyPolicyNumber/${policyNumber}`;\r\n return ApiCaller.$get(url);\r\n}\r\n\r\nexport function verifyPolicyZip(policyNumber: string, zip: string): Promise<boolean> {\r\n const url = `api/verifyPolicyZip/?policyNumber=${policyNumber}&zip=${zip}`;\r\n return ApiCaller.$get(url);\r\n}\r\n\r\nexport function latestPolicyNumber(policyNumber: string): Promise<string> {\r\n const url = `api/policy/latest/${policyNumber}`;\r\n return ApiCaller.$get(url);\r\n}\r\n\r\nexport function sendPolicyFax(fax: string, policyNumber: string, progress: boolean = true): Promise<void> {\r\n return ApiCaller.$post(\r\n `api/payments/send-policy-fax?fax=${fax}&policyNumber=${policyNumber}`,\r\n {},\r\n progress ? new ProgressModal() : null,\r\n 'send policy fax'\r\n );\r\n}\r\n\r\n/**\r\n * ks 7/1/19 - This has to use the weird xhr mechanism, so that we can actually include the file in the data we're pushing to the API endpoint.\r\n */\r\nexport function uploadEandO(\r\n eAndOFile: File,\r\n expirationDate: any,\r\n policyNumber: string,\r\n coverageLimit: number,\r\n companyName: string,\r\n producerLocationGuid: string\r\n): Promise<void> {\r\n const formData = new FormData();\r\n formData.append(eAndOFile.name, eAndOFile);\r\n let expDate = dayjs(expirationDate).format('MM/DD/YYYY');\r\n return new Promise((resolve, reject) => {\r\n const xhr = new XMLHttpRequest();\r\n xhr.open(\r\n 'POST',\r\n `/api/uploadeando?expiration=${expDate}&eoPolicyNumber=${policyNumber}&coverageLimit=${coverageLimit}&companyName=${companyName}&producerLocationGuid=${producerLocationGuid}`\r\n );\r\n xhr.onreadystatechange = () => {\r\n if (xhr.readyState === 4) {\r\n if (xhr.status === 200) resolve();\r\n else reject(xhr);\r\n }\r\n };\r\n xhr.send(formData);\r\n });\r\n}\r\n\r\n/**\r\n * ks 7/1/19 (copied 4/12/23, wmj) - This has to use the weird xhr mechanism, so that we can actually include the file in the data we're pushing to the API endpoint.\r\n */\r\nexport function uploadProducerAgreement(\r\n producerAgreementFile: File,\r\n validThroughDate: any,\r\n signedAsOfDate: any,\r\n producerGuid: string\r\n): Promise<void> {\r\n const formData = new FormData();\r\n formData.append(producerAgreementFile.name, producerAgreementFile);\r\n\r\n return new Promise((resolve, reject) => {\r\n const xhr = new XMLHttpRequest();\r\n xhr.open(\r\n 'POST',\r\n `/api/uploadproduceragreement?validThroughDate=${validThroughDate}&signedAsOfDate=${signedAsOfDate}&producerGuid=${producerGuid}`\r\n );\r\n xhr.onreadystatechange = () => {\r\n if (xhr.readyState === 4) {\r\n if (xhr.status === 200) resolve();\r\n else reject(xhr);\r\n }\r\n };\r\n xhr.send(formData);\r\n });\r\n}\r\n\r\n/**\r\n * ks 7/1/19 - This has to use the weird xhr mechanism, so that we can actually include the file in the data we're pushing to the API endpoint.\r\n */\r\n\r\nexport function uploadLocationLicense(\r\n licenseFile: File,\r\n expirationDate: string,\r\n licenseNumber: string,\r\n stateId: string,\r\n lineId: string\r\n): Promise<void> {\r\n const formData = new FormData();\r\n formData.append(licenseFile.name, licenseFile);\r\n let expDate = dayjs(expirationDate).format('MM/DD/YYYY');\r\n return new Promise((resolve, reject) => {\r\n const xhr = new XMLHttpRequest();\r\n xhr.open(\r\n 'POST',\r\n `/api/uploadLocationLicense?expirationDate=${expDate}&licenseNumber=${licenseNumber}&stateId=${stateId}&lineId=${lineId}`\r\n );\r\n xhr.onreadystatechange = () => {\r\n if (xhr.readyState === 4) {\r\n if (xhr.status === 200) resolve();\r\n else reject(xhr);\r\n }\r\n };\r\n xhr.send(formData);\r\n });\r\n}\r\n\r\nexport function uploadContactLicense(\r\n licenseFile: File,\r\n expirationDate: string,\r\n licenseNumber: string,\r\n stateId: string,\r\n lineId: string\r\n): Promise<void> {\r\n const formData = new FormData();\r\n formData.append(licenseFile.name, licenseFile);\r\n let expDate = dayjs(expirationDate).format('MM/DD/YYYY');\r\n return new Promise((resolve, reject) => {\r\n const xhr = new XMLHttpRequest();\r\n xhr.open(\r\n 'POST',\r\n `/api/uploadContactLicense?expirationDate=${expDate}&licenseNumber=${licenseNumber}&stateId=${stateId}&lineId=${lineId}`\r\n );\r\n xhr.onreadystatechange = () => {\r\n if (xhr.readyState === 4) {\r\n if (xhr.status === 200) resolve();\r\n else reject(xhr);\r\n }\r\n };\r\n xhr.send(formData);\r\n });\r\n}\r\n\r\nexport function uploadW9(\r\n licenseFile: File,\r\n signedDate: any,\r\n name: string,\r\n fein: string,\r\n businessTypeId: string\r\n): Promise<void> {\r\n const formData = new FormData();\r\n formData.append(licenseFile.name, licenseFile);\r\n return new Promise((resolve, reject) => {\r\n const xhr = new XMLHttpRequest();\r\n xhr.open(\r\n 'POST',\r\n `/api/uploadW9?signedDate=${signedDate}&name=${name}&fein=${fein}&businessTypeId=${businessTypeId}`\r\n );\r\n xhr.onreadystatechange = () => {\r\n if (xhr.readyState === 4) {\r\n if (xhr.status === 200) resolve();\r\n else reject(xhr);\r\n }\r\n };\r\n xhr.send(formData);\r\n });\r\n}\r\n\r\nexport function getTemplateNames(): Promise<string[]> {\r\n return ApiCaller.$get('api/email/getTemplateNames');\r\n}\r\n"],"names":["sendEmailTemplates","email","checked","ApiCaller.$post","ProgressModal","emailQuote","quoteId","quote","url","NProgress","emailCommercialQuote","emailCommercialUnderwriter","request","emailHubQuote","emailInfo","sendContactEmail","model","sendVerifyPolicy","verifyPolicyNumber","policyNumber","ApiCaller.$get","verifyPolicyZip","zip","latestPolicyNumber","sendPolicyFax","fax","progress","uploadEandO","eAndOFile","expirationDate","coverageLimit","companyName","producerLocationGuid","formData","expDate","dayjs","resolve","reject","xhr","uploadProducerAgreement","producerAgreementFile","validThroughDate","signedAsOfDate","producerGuid","uploadLocationLicense","licenseFile","licenseNumber","stateId","lineId","uploadContactLicense","uploadW9","signedDate","name","fein","businessTypeId","getTemplateNames"],"mappings":"sGAMgB,SAAAA,EAAmBC,EAAeC,EAAsC,CACpF,OAAOC,EACH,gCAAgCF,CAAK,aAAaC,EAAQ,KAAK,GAAG,CAAC,GACnE,CAAC,EAC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