{"version":3,"sources":["webpack:///./app/javascript/components/PopupMessage/PopupMessage.jsx","webpack:///./app/javascript/components/SalesFlow/SelectBox.jsx","webpack:///./app/javascript/components/SalesFlow/BeneficiariesStep/AdditionalServiceSelect/AdditionalServiceSelect.jsx","webpack:///./app/javascript/components/SalesFlow/BeneficiariesStep/BeneficiariesStep.jsx","webpack:///./app/javascript/components/SalesFlow/ReviewStep/ReviewStep.jsx","webpack:///./app/javascript/components/SalesFlow/DealShowPage/DealShowPage.jsx","webpack:///./app/javascript/components/SalesFlow/DealIndexPage/DealIndexPage.jsx","webpack:///./app/javascript/components/SalesFlow/DealIndexPage/DealRow/DealRow.jsx","webpack:///./app/javascript/components/SalesFlow/BeneficiariesStep/BundleOptions.jsx","webpack:///./app/javascript/components/SalesFlow/DataProvider.jsx","webpack:///./app/javascript/components/SalesFlow/RouteWrapper.jsx","webpack:///./app/javascript/components/SalesFlow/StepContent.jsx","webpack:///./app/javascript/components/SalesFlow/PetitionerStep/PetitionerStep.jsx","webpack:///./app/javascript/components/SalesFlow/PointOfContactStep/PointOfContactStep.jsx","webpack:///./app/javascript/components/SalesFlow/ReviewStep/ReviewSection.jsx","webpack:///./app/javascript/components/SalesFlow/StepNav.jsx","webpack:///./app/javascript/components/SalesFlow/DealShowPage/PetitionBundleDetails.jsx","webpack:///./app/javascript/components/SalesFlow/DealShowPage/SalesforceIdForm.jsx","webpack:///./app/javascript/components/SalesFlow/DealShowPage/QuickbooksIdForm.jsx","webpack:///./app/javascript/components/SalesFlow/SalesDashboard/SalesDashboard.jsx","webpack:///./app/javascript/components/SalesFlow/ServicesPage/ServicesPage.jsx","webpack:///./app/javascript/components/SalesFlow/ServicesPage/AdditionalServiceRow.jsx","webpack:///./app/javascript/components/SalesFlow/WorkflowsPage/WorkflowsPage.jsx","webpack:///./app/javascript/components/SalesFlow/WorkflowsPage/WorkflowDetails.jsx","webpack:///./app/javascript/components/SalesFlow/WorkflowsPage/BaseFeeRow.jsx","webpack:///./app/javascript/components/SalesFlow/DealIndexPage/DealsTable/DealsTable.jsx","webpack:///./app/javascript/components/SalesFlow/SalesFlow.jsx","webpack:///./app/javascript/components/SalesFlow/SalesFlowWrapper.jsx","webpack:///./app/javascript/components/SalesFlow/BeneficiariesStep/AdditionalServiceSelect/AdditionalServiceSelect.test.jsx","webpack:///./app/javascript/components/SalesFlow/BeneficiariesStep/BeneficiariesStep.test.jsx","webpack:///./app/javascript/components/SalesFlow/DealIndexPage/DealIndexPage.test.jsx","webpack:///./app/javascript/components/SalesFlow/DealIndexPage/DealRow/DealRow.test.jsx","webpack:///./app/javascript/components/SalesFlow/DealShowPage/DealShowPage.test.jsx","webpack:///./app/javascript/components/SalesFlow/DealShowPage/DiscountsDetails.jsx","webpack:///./app/javascript/components/SalesFlow/ReviewStep/ReviewStep.test.jsx","webpack:///./app/javascript/components/SalesFlow/RunningTotal/RunningTotal.test.jsx","webpack:///./app/javascript/components/SalesFlow/SalesFlowWrapper.test.jsx","webpack:///./app/javascript/components/SalesFlow/SalesFlowComponents/index.jsx","webpack:///./app/javascript/components/SalesFlow/FormStateProvider.jsx","webpack:///./app/javascript/components/SalesFlow/ActionFrame.jsx","webpack:///./app/javascript/components/SalesFlow/RunningTotal/RunningTotal.jsx"],"names":["Container","styled","div","Rectangle","props","color","Icon","i","Message","Info","PopupMessage","popupType","message","icon","expirationDate","Date","now","className","alt","propTypes","PropTypes","string","SelectBox","contact","handleChange","checked","disabled","name","style","width","type","onChange","firstName","lastName","marginBottom","email","object","QuantitySelector","blue","grayDarker","IconBox","gray","AdditionalServiceSelect","service","quantity","handleAdditionalServicesChange","isChecked","isPlural","maxQuantity","quantitySelected","setQuantitySelected","useState","id","display","justifyContent","e","target","handleServiceCheck","formatCentsToCurrency","amount","onClick","func","bool","BeneficiaryContainer","BeneficiariesStep","popup","useAlert","history","useHistory","setFormState","useFormState","deal","setDeal","workflows","organizationPeople","setOrganizationPeople","stepsArray","currentStep","dealId","billingPerson","petitionBundles","loading","setLoading","errors","setErrors","beneficiaryOptions","setBeneficiaryOptions","uniqueArrayByProp","selectedBeneficiaries","setSelectedBeneficiaries","dealBundles","useMemo","map","b","tempId","beneficiary","petition","workflowId","workflow","additionalServiceIds","petitionId","currentBundles","setCurrentBundles","createBundle","generateUUID","handleBeneficiarySelect","filter","newBundles","bundle","useEffect","optionsWithBundles","reduce","a","push","uniqueOptions","addNewBundleToState","dirty","unselectedBeneficiaries","option","sb","includes","disableContinue","Section","margin","beneficiaryBundles","savedBeneficiaryBundles","undefined","length","key","index","role","onKeyDown","tabIndex","fontSize","organizationId","organization","updateParentObject","newPerson","prevState","personType","continueDisabled","handleContinue","async","url","Routes","deal_path","requestBody","petition_bundles_attributes","additional_service_ids","petition_attributes","workflow_id","beneficiary_id","response","fetch","method","headers","formHeaders","body","JSON","stringify","ok","json","forEach","err","show","timeout","error","updateDeal","hasErrors","array","LineItem","ReviewStep","dealDiscounts","installments","header","marginTop","displayName","representative","continueButtonText","submit_deal_path","submitDeal","StatusBox","DealShowPage","hash","useLocation","dealProp","author","state","archived","salesforceOpportunityId","quickbooksInvoiceId","dealState","setDealState","showArchived","setShowArchived","handleArchive","unarchive","unarchive_deal_path","archive_deal_path","handleUnsubmit","unsubmit_deal_path","sections","content","fontStyle","petitionBundle","window","confirm","document","getElementById","scrollBy","home","text","href","title","gap","fullName","submittedAt","format","deals","setDeals","deals_path","fetchDeals","caseState","setCaseState","draftDeals","paymentPendingDeals","paymentProgressDeals","paidDeals","archivedDeals","searchString","setSearchString","filteredDeals","dealBeneficiaries","toString","toLowerCase","trim","liveDeals","groupName","dealGroup","setDealsState","maxPerPage","dataTestId","placeholder","searchStringValue","setSearchStringEvent","bindMenu","bindMenuItems","useContextTrigger","setVisible","setContextMenuVisible","bindTrigger","d","DealContextMenu","ContextMenu","IndexRow","IndexItem","bold","grayDark","finalPriceData","pay_total","dealStatusMapping","updatedAtHumanized","white","grayLight","draft","submitted","active","BundleHeader","BundleOptions","newBeneficiaryBundles","setNewBeneficiaryBundles","selectedWorkflowIdsForBeneficiary","bun","allWorkflowOptions","wf","value","label","availableWorkflowOptionsForBundle","bundleActionTypes","dispatch","useReducer","currentState","action","bundleOrdinal","stringifyNumber","charAt","toUpperCase","slice","removeBundle","petition_bundle_path","cb","updatedNewBeneficiaryBundles","nbb","defaultOption","find","defaultWorkflow","selectedWorkflow","setSelectedWorkflow","useDidMountEffect","updatedBundles","updateBundles","options","classNamePrefix","selectedWf","newWorkflow","defaultAdditionalServiceIds","additionalServices","isDefaultOption","location","dealLoading","setDealLoading","fixturesLoading","setFixturesLoading","petitionerItems","setPetitionerItems","setOrganizationId","setWorkflows","discounts","setDiscounts","installmentOptions","setInstallmentOptions","payTotal","setPayTotal","parsedDealId","pathname","split","fetchPeople","people_organization_path","orgId","status","statusText","fetchDeal","Promise","all","organizations_path","items","org","to_s","fetchOrganizations","workflows_path","fetchWorkflows","then","FormContextProvider","formState","description","step","renderPetitionerStep","StepWrapper","height","scrollTo","Switch","Route","exact","path","render","match","useBrowserRouter","Prompt","when","Redirect","to","section","Centered","MainContent","StepContent","children","organizationName","setOrganizationName","isSelfPetitioning","setIsSelfPetitioning","isNotYetEstablished","setIsNotYetEstablished","initialValue","handleSelect","selected","handleInputChange","CheckboxItem","htmlFor","organization_id","organization_attributes","display_name","is_self_petitioning","is_not_yet_established","createOrUpdateDeal","PointOfContactStep","contactOptions","updateBundlePoc","bundleId","person","some","representative_id","ReviewSection","backgroundColor","grayLighter","petitionerStepPath","Nav","NavItem","stepActive","Link","DetailBox","DetailRow","diminished","PetitionBundleDetails","price_total","priceTotal","base_fees","baseFees","additional_services","allFees","concat","dropdownOpen","setDropdownOpen","outline","alignItems","marginRight","petition_path","isOpen","fee","SalesforceIdForm","formVisible","setFormVisible","register","handleSubmit","useForm","defaultValues","onSubmit","data","update_metadata_deal_path","res","catch","updateSalesforceId","FormInput","defaultValue","ref","isDirty","QuickbooksIdForm","setValue","updateQuickbooksId","onPaste","paste","clipboardData","getData","replace","shouldValidate","shouldDirty","preventDefault","handlePaste","required","minLength","maxLength","quickbooks_invoice_id","red","Layout","overflow","hasEngAccess","useAuthContext","engAccess","setAdditionalServices","asFormVisible","setAsFormVisible","additionalServiceFormState","setAdditionalServiceFormState","additional_services_path","fetchAdditionalServices","handleAdditionalServiceFormChange","isCheckbox","as","additionalService","defaultChecked","additional_service","parseInt","is_default_option","max_quantity","createAdditionalService","input","Input","AdditionalServiceRow","priceAdjustedAdditionalService","currentAdditionalService","setCurrentAdditionalService","serviceDirty","setServiceDirty","deepEqual","handleDelete","additional_service_path","prevAdditionalServices","deleteAdditionalService","handleAdditionalServiceChange","parseInts","fontWeight","handleAdditionalServiceDefaultCheck","activeElement","blur","updateAdditionalService","maxWidth","WorkflowDetails","workflowAdditionalServices","baseFeesWithTempId","currentBaseFees","setCurrentBaseFees","currentAdditionalServiceIds","setCurrentAdditionalServiceIds","baseFeeFormVisible","setBaseFeeFormVisible","baseFeeFormState","setBaseFeeFormState","updateBaseFees","setUpdateBaseFees","defaultOptions","serviceOptions","handleBaseFeeFormChange","updateWorkflow","workflow_path","baseFeeCost","bf","totalPrice","baseFee","cursor","prevFees","styles","multiValueRemove","base","gold","multiValueLabel","isMulti","values","v","handleServicesSelect","BaseFeeRow","currentBaseFee","setCurrentBaseFee","deleteBaseFee","handleBaseFeeChange","columns","IndexGrid","DealsTable","showingAll","setShowingAll","sortBy","setSortBy","attribute","ascending","handleSort","currentSortArrow","sortedDealGroup","sort","alphabeticalSort","numericalSort","chronologicalSort","updatedAt","currentSortFunction","nextPage","prevPage","currentPage","maxPage","showAll","setCurrentPage","repaginate","currentData","startIndex","endIndex","usePagination","PaginationWidget","upshift","pushState","search","number","basename","position","positions","TOP_RIGHT","offset","SalesFlowWrapper","AuthContextProvider","template","AlertTemplate","describe","it","container","expect","getByText","mock","calls","toEqual","waitFor","mockOrganizationPeople","fireEvent","click","getByTestId","mockWorkflowsWithFees","closest","toHaveClass","workflowSelectDiv","focus","querySelector","keyDown","code","not","beforeEach","mockResponses","mockDeals","afterEach","resetMocks","createMemoryHistory","getAllByText","Router","draftDealRows","within","getAllByTestId","pendingDealRows","inProgressDealRows","newDraftDealRows","change","mockUser","queryByText","toBeInTheDocument","DiscountsBox","DiscountRow","DiscountsDetails","discountsTotal","discount","arrayOf","fullDealMock","petitionerInformationDiv","beneficiaryAndVisaDiv","queryAllByText","mockPetitionBundles","petitionerPlaceholderText","mockWorkflows","getByPlaceholderText","toBe","once","mockOrganizationItems","FormContext","createContext","formContextState","useContext","Error","setState","Provider","Main","ActionFrame","lastStepText","currentStepIndex","indexOf","nextStep","justifyItems","RunningTotal","selectedPlan","queryWorkflowById","totalBaseFees","workflowName","queryAdditionalServiceById","serviceId","allAdditionalServices","uniqueServices","flat","serviceName","serviceAmount","total","currentBundle","totalServiceFees","currentServiceId","totalDiscounts","currentValue","idForQuery","totalBundleAdditionalServiceFees","totalBundleServiceFees","green","uniqueId"],"mappings":"kKAAA,cACA,UACA,UACA,YAEA,MAAMA,EAAYC,UAAOC,GAAI;;;;;;;;;;;;EAcvBC,EAAYF,UAAOC,GAAI;;;;sBAIPE,GAASA,EAAMC;EAG/BC,EAAOL,UAAOM,CAAE;;;;WAIXH,GAASA,EAAMC;EAGpBG,EAAUP,UAAOC,GAAI;;;;EAMrBO,EAAOR,UAAOC,GAAI;;;;;EAOT,SAASQ,EAAaN,GACnC,MAAM,UAAEO,EAAF,QAAaC,GAAYR,EAE/B,IAAIC,EACAQ,EAEJ,OAAQF,GACN,IAAK,QACHN,EAAQ,UACRQ,EAAO,4BACP,MACF,IAAK,UACHR,EAAQ,UACRQ,EAAO,sBACP,MACF,QACER,EAAQ,UACRQ,EAAO,gCAGX,OACE,wBAAC,UAAD,CAAcC,eAAgB,IAAIC,KAAKA,KAAKC,MAAQ,OAClD,wBAAChB,EAAD,CAAWiB,UAAU,iBACnB,wBAACd,EAAD,CAAWE,MAAOA,IAClB,wBAACI,EAAD,KACE,wBAACH,EAAD,CAAMY,IAAI,OAAOD,UAAWJ,EAAMR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rB9iB,EAAOT,qBAAqBP,KAAI,CAACijB,EAAWtoB,KAC3C,MAAOoB,EAAMgC,GAAUilB,EAA2BC,GAClD,OACE,wBAACne,EAAD,CAAU1C,IAAM,GAAE6gB,KAAatoB,KAC7B,iCAAIoB,GACJ,kCAAI,IAAA+B,uBAAsBC,SAOtC,OAAO,+BAAKqE,IAAKpB,EAAOxD,QAEzByQ,EAAU9L,OAAS,GAClB,gDACE,wBAAC2C,EAAD,CAAU,cAAY,uBACpB,+CACA,8BAAI9I,MAAO,CAAEvB,MAAOupB,UAApB,KACI,IAAAlmB,uBAAsB6lB,KAG3B1V,EAAUjO,KAAIghB,IAAQ,aACrB,wBAAClc,EAAD,CAAU1C,IAAG,UAAE4e,EAASxjB,UAAX,QAAiBwjB,EAASiD,UACrC,6BAAG5oB,UAAU,6BAA6B2lB,EAASjlB,MACnD,sCAAK,IAAA+B,uBAAsBkjB,EAASjjB,cAK5C,mCACA,wBAAC+G,EAAD,CAAU,cAAY,uBACpB,8BAAI9I,MAAO4mB,EAAe,EAAI,CAAE/J,WAAY,KAAQ,MAApD,aACA,8BAAI7c,MAAO4mB,EAAe,EAAI,CAAE/J,WAAY,KAAQ,OACjD,IAAA/a,uBAAsByc,EAAaoJ,KAGvCf,GAAgBA,EAAe,GAC9B,gDACE,wBAAC9d,EAAD,CAAU,cAAY,0BACpB,yCAAS8d,EAAT,YAEF,mCACA,wBAAC9d,EAAD,CAAU,cAAY,2BACpB,mDACA,mCACG,IAAAhH,wBACEyc,EAAaoJ,GAAkBf,OAUhDD,EAAapnB,UAAY,CACvB6D,gBAAiB5D,UAAUqJ,MAC3BoJ,UAAWzS,UAAUqJ","file":"js/application~22410d9b-c460d6be41f5cfc26349.chunk.js","sourcesContent":["import React from \"react\";\nimport styled from \"styled-components\";\nimport PropTypes from \"prop-types\";\nimport SelfDestruct from \"../Shared/SelfDestruct/SelfDestruct\";\n\nconst Container = styled.div`\n position: fixed;\n top: 70px;\n right: 25px;\n height: fit-content;\n max-width: 500px;\n box-shadow: 0px 1px 2px #e8e8e8;\n background-color: #ffffff;\n border-left: 3px;\n border-radius: 4px;\n display: inline-flex;\n animation: grow 0.5s ease-in forwards;\n`;\n\nconst Rectangle = styled.div`\n height: auto;\n width: 4px;\n border-radius: 4px;\n background-color: ${props => props.color};\n`;\n\nconst Icon = styled.i`\n align-self: center;\n font-size: 30px;\n margin-right: 1rem;\n color: ${props => props.color};\n`;\n\nconst Message = styled.div`\n width: fit-content;\n font-size: 18px;\n align-self: center;\n`;\n\nconst Info = styled.div`\n display: inline-flex;\n font-size: 16px;\n padding: 1rem;\n line-height: 20px;\n`;\n\nexport default function PopupMessage(props) {\n const { popupType, message } = props;\n\n let color;\n let icon;\n\n switch (popupType) {\n case \"error\":\n color = \"#FF5C5C\";\n icon = \"far fa-exclamation-circle\";\n break;\n case \"success\":\n color = \"#41CD7E\";\n icon = \"far fa-check-circle\";\n break;\n default:\n color = \"#2680FA\";\n icon = \"fas fa-arrow-alt-circle-right\";\n }\n\n return (\n \n \n \n \n \n {message}\n \n \n \n );\n}\n\nPopupMessage.propTypes = {\n popupType: PropTypes.string,\n message: PropTypes.string\n};\n","import React from \"react\";\nimport PropTypes from \"prop-types\";\n\nexport default function SelectBox(props) {\n const { contact, handleChange, checked, disabled, name } = props;\n return (\n
\n \n
\n );\n}\n\nSelectBox.propTypes = {\n contact: PropTypes.object\n};\n","import React, { useState } from \"react\";\nimport PropTypes from \"prop-types\";\nimport styled from \"styled-components\";\nimport { formatCentsToCurrency } from \"../../../../utils/numberHelpers\";\nimport { blue, grayDarker, gray } from \"../../../../styles/colors\";\n\nconst QuantitySelector = styled.div`\n height: auto;\n margin: 0 0 1rem 1rem;\n padding: 0 0.5rem;\n display: flex;\n justify-content: center;\n align-items: center;\n border: 1px solid ${blue};\n border-radius: 4px;\n &&& {\n p {\n margin: 0 1rem;\n color: ${grayDarker};\n }\n }\n`;\n\nconst IconBox = styled.div`\n margin: 0;\n background: ${props => (props.disabled ? gray : blue)};\n padding: 0.25rem;\n border-radius: 4px;\n color: white;\n cursor: ${props => (props.disabled ? \"not-allowed\" : \"pointer\")};\n`;\n\nexport default function AdditionalServiceSelect(props) {\n const {\n service,\n quantity,\n handleAdditionalServicesChange,\n isChecked\n } = props;\n\n const isPlural = service.maxQuantity > 1;\n\n const [quantitySelected, setQuantitySelected] = useState(quantity);\n\n const handleServiceCheck = e => {\n if (!e.target.checked) {\n setQuantitySelected(0);\n handleAdditionalServicesChange(service.id, 0);\n }\n if (e.target.checked) {\n setQuantitySelected(1);\n handleAdditionalServicesChange(service.id, 1);\n }\n };\n\n const handleQuantityDecrease = () => {\n handleAdditionalServicesChange(service.id, quantitySelected - 1);\n setQuantitySelected(quantitySelected - 1);\n };\n\n const handleQuantityIncrease = () => {\n if (quantitySelected === service.maxQuantity) {\n return;\n }\n handleAdditionalServicesChange(service.id, quantitySelected + 1);\n setQuantitySelected(quantitySelected + 1);\n };\n\n return (\n \n
\n \n
\n {isChecked && isPlural && (\n \n handleQuantityDecrease()}\n >\n \n \n

{quantitySelected}

\n handleQuantityIncrease()}\n >\n \n \n
\n )}\n \n );\n}\n\nAdditionalServiceSelect.propTypes = {\n service: PropTypes.object,\n handleAdditionalServicesChange: PropTypes.func,\n isChecked: PropTypes.bool\n};\n","import React, { useState, useEffect, useMemo } from \"react\";\nimport PropTypes from \"prop-types\";\nimport styled from \"styled-components\";\nimport { useAlert } from \"react-alert\";\nimport { useHistory } from \"react-router-dom\";\nimport { formHeaders } from \"../../../utils/form\";\nimport SelectBox from \"../SelectBox\";\nimport RunningTotal from \"../RunningTotal/RunningTotal\";\nimport { uniqueArrayByProp } from \"../../../utils/arrayMethods\";\nimport BundleOptions from \"./BundleOptions\";\nimport ActionFrame from \"../ActionFrame\";\nimport { generateUUID } from \"../../../utils/uuidGenerator\";\nimport OrganizationPersonForm from \"../../Shared/Forms/OrganizationPersonForm\";\nimport { Section } from \"../SalesFlowComponents/index\";\nimport { useFormState } from \"../FormStateProvider\";\n\nconst BeneficiaryContainer = styled.div`\n margin: 1rem 0;\n padding-bottom: 1.5rem;\n border-bottom: 1px solid lightgray;\n`;\n\nexport default function BeneficiariesStep(props) {\n const popup = useAlert();\n const history = useHistory();\n\n const [, setFormState] = useFormState();\n\n const {\n deal,\n setDeal,\n workflows,\n organizationPeople = [],\n setOrganizationPeople,\n stepsArray = [],\n currentStep = {}\n } = props;\n\n const { id: dealId, billingPerson, petitionBundles = [] } = deal;\n\n const [loading, setLoading] = useState(false);\n const [errors, setErrors] = useState([]);\n\n const [beneficiaryOptions, setBeneficiaryOptions] = useState(\n uniqueArrayByProp(\"id\", [...organizationPeople, billingPerson])\n );\n\n const [selectedBeneficiaries, setSelectedBeneficiaries] = useState([]);\n\n // Local bundle state shaped differently than what is returned from the server on this step\n // No petition exists when bundles are instantiated on the client\n\n const dealBundles = useMemo(\n () =>\n petitionBundles.map(b => ({\n id: b.id,\n tempId: null,\n beneficiary: b.petition.beneficiary,\n workflowId: b.petition.workflow.id,\n additionalServiceIds: b.additionalServiceIds,\n petitionId: b.petition.id\n })),\n [petitionBundles]\n );\n\n const [currentBundles, setCurrentBundles] = useState(dealBundles);\n\n const createBundle = ({\n beneficiary,\n workflowId,\n additionalServiceIds = []\n }) => ({\n id: null,\n tempId: generateUUID(),\n beneficiary,\n workflowId,\n additionalServiceIds\n });\n\n const handleBeneficiarySelect = (e, beneficiary) => {\n if (e.target.checked) {\n setSelectedBeneficiaries([...selectedBeneficiaries, beneficiary]);\n }\n\n if (!e.target.checked) {\n setSelectedBeneficiaries(\n selectedBeneficiaries.filter(b => b.id !== beneficiary.id)\n );\n const newBundles = currentBundles.filter(\n bundle => bundle.beneficiary.id !== beneficiary.id\n );\n setCurrentBundles(newBundles);\n }\n };\n\n const updateDeal = async () => {\n try {\n setLoading(true);\n // eslint-disable-next-line no-undef\n const url = Routes.deal_path(dealId);\n\n const requestBody = {\n petition_bundles_attributes: currentBundles.map(bundle => ({\n id: bundle.id,\n additional_service_ids: bundle.additionalServiceIds,\n petition_attributes: {\n id: bundle.petitionId,\n workflow_id: bundle.workflowId,\n beneficiary_id: bundle.beneficiary.id\n }\n }))\n };\n\n const response = await fetch(url, {\n method: \"PUT\",\n headers: formHeaders(),\n body: JSON.stringify(requestBody)\n });\n\n if (!response.ok) {\n const json = await response.json();\n setLoading(false);\n setErrors([...errors, json.errors]);\n json.errors.forEach(err => {\n setErrors([...errors, err]);\n popup.show(err, { type: \"error\" });\n });\n }\n\n if (response.ok) {\n const json = await response.json();\n setDeal(json);\n setLoading(false);\n setFormState({ dirty: false });\n history.push(`/deals/${deal.id}/contacts`);\n popup.show(\"Draft deal has been saved!\", {\n type: \"success\",\n timeout: 1500\n });\n }\n } catch (error) {\n setLoading(false);\n popup.show(error.message, { type: \"error\" });\n }\n };\n\n useEffect(() => {\n if (deal.petitionBundles) {\n const optionsWithBundles = deal.petitionBundles.reduce((a, b) => {\n a.push(b.petition?.beneficiary);\n return a;\n }, selectedBeneficiaries);\n const uniqueOptions = uniqueArrayByProp(\"id\", optionsWithBundles);\n setSelectedBeneficiaries(uniqueOptions);\n setCurrentBundles(dealBundles);\n }\n }, [deal]);\n\n const addNewBundleToState = beneficiary => {\n setCurrentBundles([...currentBundles, createBundle({ beneficiary })]);\n };\n\n const handleNewBeneficiary = newPerson => {\n setBeneficiaryOptions(prevState => [...prevState, newPerson]);\n setSelectedBeneficiaries(prevState => [...prevState, newPerson]);\n setOrganizationPeople(prevState => [...prevState, newPerson]);\n };\n\n useEffect(() => {\n if (currentBundles !== dealBundles) {\n setFormState({ dirty: true });\n } else {\n setFormState({ dirty: false });\n }\n return () => setFormState({ dirty: false });\n }, [currentBundles]);\n\n const unselectedBeneficiaries = beneficiaryOptions.filter(\n option => !selectedBeneficiaries.map(sb => sb.id).includes(option.id)\n );\n\n const disableContinue = !currentBundles[0]?.workflowId;\n\n return (\n <>\n
\n
\n

Choose beneficiaries

\n {selectedBeneficiaries.map(beneficiary => {\n const beneficiaryBundles = currentBundles.filter(\n bundle => bundle.beneficiary.id === beneficiary.id\n );\n const savedBeneficiaryBundles = beneficiaryBundles.filter(\n bundle => bundle.id !== null && bundle.id !== undefined\n );\n\n if (beneficiaryBundles.length === 0) {\n addNewBundleToState(beneficiary);\n }\n\n return (\n
\n 0}\n name={`beneficiary-select-${beneficiary.id}`}\n handleChange={e => handleBeneficiarySelect(e, beneficiary)}\n />\n \n {beneficiaryBundles.map((bundle, i) => (\n
\n
\n \n
\n {/* Render the add visa button only at the end of the bundle mapping if a workflow is selected */}\n {!!bundle.workflowId &&\n i === beneficiaryBundles.length - 1 && (\n addNewBundleToState(beneficiary)}\n onKeyDown={() => addNewBundleToState(beneficiary)}\n tabIndex={0}\n >\n Add another visa type for{\" \"}\n {beneficiary?.name ?? \"this beneficiary\"}\n \n )}\n
\n ))}\n \n
\n );\n })}\n\n {unselectedBeneficiaries.length > 0 && (\n

Existing contacts

\n )}\n {unselectedBeneficiaries.map(beneficiary => (\n
\n handleBeneficiarySelect(e, beneficiary)}\n />\n
\n ))}\n \n
\n \n
\n updateDeal()}\n hasErrors={errors.length > 0}\n />\n \n );\n}\n\nBeneficiariesStep.propTypes = {\n deal: PropTypes.object,\n stepsArray: PropTypes.array,\n currentStep: PropTypes.object\n};\n","import React, { useState } from \"react\";\nimport PropTypes from \"prop-types\";\nimport styled from \"styled-components\";\nimport { useAlert } from \"react-alert\";\nimport { useHistory } from \"react-router-dom\";\nimport RunningTotal from \"../RunningTotal/RunningTotal\";\nimport { Section } from \"../SalesFlowComponents/index\";\nimport { gray, grayDarker } from \"../../../styles/colors\";\nimport { uniqueArrayByProp } from \"../../../utils/arrayMethods\";\nimport ReviewSection from \"./ReviewSection\";\nimport ActionFrame from \"../ActionFrame\";\nimport { formatCentsToCurrency } from \"../../../utils/numberHelpers\";\nimport { formHeaders } from \"../../../utils/form\";\n\nconst WarningBox = styled.div`\n display: flex;\n justify-content: left;\n align-items: center;\n grid-gap: 1.5rem;\n background-color: white;\n border-radius: 8px;\n padding: 1rem 2rem;\n margin-top: 1.5rem;\n\n h3 {\n margin: 0;\n font-weight: 700;\n }\n p {\n margin: 0;\n color: ${grayDarker};\n }\n\n i {\n margin-right: 1rem;\n }\n`;\n\nconst LineItem = styled.div`\n margin-top: 1rem;\n p {\n margin: 0;\n }\n li {\n margin: 0;\n font-weight: 700;\n }\n span {\n margin-left: -6px;\n }\n`;\n\nexport default function ReviewStep(props) {\n const popup = useAlert();\n const history = useHistory();\n\n const { deal, setDeal, workflows, stepsArray = [], currentStep = {} } = props;\n\n const {\n id: dealId,\n petitionBundles,\n dealDiscounts,\n installments,\n organization,\n billingPerson\n } = deal;\n\n const [loading, setLoading] = useState(false);\n\n const queryAdditionalServiceById = serviceId => {\n const allAdditionalServices = [];\n workflows.forEach(wf => allAdditionalServices.push(wf.additionalServices));\n const uniqueServices = uniqueArrayByProp(\n \"id\",\n allAdditionalServices.flat()\n );\n const { name: serviceName, amount: serviceAmount } = uniqueServices.find(\n as => as.id === serviceId\n );\n return [serviceName, serviceAmount];\n };\n\n const submitDeal = async () => {\n try {\n setLoading(true);\n\n const url = Routes.submit_deal_path(dealId);\n\n const requestBody = {};\n\n const response = await fetch(url, {\n method: \"POST\",\n headers: formHeaders(),\n body: JSON.stringify(requestBody)\n });\n\n if (!response.ok) {\n const json = await response.json();\n setLoading(false);\n json.errors.forEach(err => popup.show(err, { type: \"error\" }));\n }\n\n if (response.ok) {\n const json = await response.json();\n setDeal(json);\n setLoading(false);\n popup.show(\"Deal has been submitted successfully.\", {\n type: \"success\"\n });\n // Reroute to deal show page\n history.push(`/deals/${dealId}`);\n }\n } catch (error) {\n setLoading(false);\n popup.show(error.message, { type: \"error\" });\n }\n };\n\n return (\n <>\n
\n
\n \n \n \n

Petitioner

\n
{organization?.displayName}
\n
\n
\n \n \n
\n {petitionBundles?.map((bundle, i) => {\n const { petition, additionalServiceIds } = bundle;\n const { beneficiary, workflow, representative } = petition;\n return (\n
\n \n

Beneficiary

\n
{`${beneficiary.firstName} ${beneficiary.lastName}`}
\n
\n \n

Beneficiary email

\n
{beneficiary.email}
\n
\n \n

Visa type

\n
{workflow.name}
\n
\n \n

Point of Contact

\n
\n {`${representative.firstName} ${representative.lastName}`}\n
\n
\n \n

Point of Contact Email

\n
{representative.email}
\n
\n {petitionBundles.length > 1 &&\n i !== petitionBundles.length - 1 && (\n <>\n
\n
\n \n )}\n
\n );\n })}\n
\n
\n \n
\n submitDeal()}\n />\n \n );\n}\n\nReviewStep.propTypes = {\n deal: PropTypes.object,\n workflows: PropTypes.array,\n stepsArray: PropTypes.array,\n currentStep: PropTypes.object\n};\n","import React, { useEffect, useState } from \"react\";\nimport PropTypes from \"prop-types\";\nimport styled from \"styled-components\";\nimport moment from \"moment\";\nimport { useHistory, useLocation } from \"react-router-dom\";\nimport { useAlert } from \"react-alert\";\nimport SectionsMenu from \"../../PetitionPage/SectionsMenu\";\nimport SectionsDropdowns from \"../../Shared/SectionDropdowns/SectionDropdowns\";\nimport { gray } from \"../../../styles/colors\";\nimport { formatCentsToCurrency } from \"../../../utils/numberHelpers\";\nimport PetitionBundleDetails from \"./PetitionBundleDetails\";\nimport CommonNav from \"../../Shared/CommonNav/CommonNav\";\nimport { formHeaders } from \"../../../utils/form\";\nimport SalesforceIdForm from \"./SalesforceIdForm\";\nimport QuickbooksIdForm from \"./QuickbooksIdForm\";\n\nconst StatusBox = styled.div`\n color: ${gray};\n text-align: center;\n width: 10rem;\n height: 8rem;\n padding: 0.5rem;\n margin: 0.5rem 0;\n`;\nexport default function DealShowPage(props) {\n const history = useHistory();\n const popup = useAlert();\n const { hash } = useLocation();\n\n const { deal: dealProp = {} } = props;\n\n const [deal, setDeal] = useState(dealProp);\n\n const {\n id: dealId,\n author,\n organization,\n billingPerson,\n petitionBundles,\n state,\n archived,\n salesforceOpportunityId,\n quickbooksInvoiceId\n } = deal;\n\n const [dealState, setDealState] = useState(state);\n\n const [showArchived, setShowArchived] = useState(archived);\n\n const handleArchive = async unarchive => {\n // Pass 'unarchive' or true to this function to unarchive\n try {\n const url = unarchive\n ? Routes.unarchive_deal_path(dealId)\n : Routes.archive_deal_path(dealId);\n\n const response = await fetch(url, {\n method: \"POST\",\n headers: formHeaders(),\n body: JSON.stringify({})\n });\n\n if (!response.ok) {\n popup.show(response.error.message, { type: \"error\" });\n }\n\n if (response.ok) {\n const json = await response.json();\n setShowArchived(json.archived);\n const message = unarchive\n ? \"Your deal has been unarchived\"\n : \"Your deal has been archived\";\n popup.show(message, { type: \"success\" });\n }\n } catch (error) {\n popup.show(\"Something went wrong. Please contact Legalpad Engineering.\", {\n type: \"error\"\n });\n }\n };\n\n const handleUnsubmit = async () => {\n try {\n const url = Routes.unsubmit_deal_path(dealId);\n\n const response = await fetch(url, {\n method: \"POST\",\n headers: formHeaders(),\n body: JSON.stringify({})\n });\n\n if (!response.ok) {\n popup.show(response.error.message, { type: \"error\" });\n }\n\n if (response.ok) {\n const json = await response.json();\n setDealState(json.state);\n const message =\n \"Your deal has been put back in draft state. Outstanding invoices have been voided\";\n popup.show(message, { type: \"success\" });\n }\n } catch (error) {\n popup.show(\"Something went wrong. Please contact Legalpad Engineering.\", {\n type: \"error\"\n });\n }\n };\n\n const renderStatusSection = () => {\n if (dealState === \"draft\" && showArchived) {\n return

This is a draft.

;\n }\n if (dealState === \"draft\" && !showArchived) {\n return (\n

\n This is a draft.{\" \"}\n history.push(`/deals/${dealId}/beneficiaries`)}\n onKeyDown={() => history.push(`/deals/${dealId}/beneficiaries`)}\n >\n Finalize and submit package.\n \n

\n );\n }\n if (dealState === \"active\") {\n return (\n \n \n

Payments in progress

\n
\n );\n }\n\n return (\n \n \n

Payment not yet received

\n
\n );\n };\n\n const renderDetailsSection = () => {\n if (dealState === \"draft\") {\n return (\n

\n Details will appear after the deal is submitted.\n

\n );\n }\n return (\n <>\n {petitionBundles?.map(bundle => (\n \n ))}\n \n );\n };\n\n const renderActionsSection = () => (\n <>\n {dealState === \"submitted\" && (\n

\n \n window.confirm(\"Are you sure you want to edit this deal?\") &&\n handleUnsubmit()\n }\n onClick={() =>\n window.confirm(\"Are you sure you want to edit this deal?\") &&\n handleUnsubmit()\n }\n >\n Edit deal\n \n

\n )}\n {dealState !== \"draft\" && dealState !== \"submitted\" && (\n

No actions available

\n )}\n {!showArchived && dealState === \"draft\" && (\n

\n \n window.confirm(\"Are you sure you want to archive this deal?\") &&\n handleArchive()\n }\n onClick={() =>\n window.confirm(\"Are you sure you want to archive this deal?\") &&\n handleArchive()\n }\n >\n Archive this deal\n \n

\n )}\n {showArchived && dealState === \"draft\" && (\n

\n handleArchive(\"unarchive\")}\n onClick={() => handleArchive(\"unarchive\")}\n >\n Unarchive this deal\n \n

\n )}\n \n );\n\n const sections = [\n { name: \"Status\", content: renderStatusSection() },\n { name: \"Details\", content: renderDetailsSection() },\n { name: \"Actions\", content: renderActionsSection() }\n ];\n\n // Scroll offset hack for hashlink routing adjustment\n useEffect(() => {\n if (hash === \"#status\")\n return document.getElementById(\"sales-container\")?.scrollBy(0, -70);\n }, [hash]);\n\n return (\n
\n \n \n
\n

{organization?.displayName}

\n
\n \n
\n
Account Executive
\n

{author?.fullName}

\n
\n {deal.submittedAt && (\n
\n
Deal Submitted
\n {moment(deal.submittedAt).format(\"MMMM DD, YYYY\")}\n
\n )}\n
\n {\" \"}\n \n \n );\n}\n\nDealShowPage.propTypes = {\n deal: PropTypes.object\n};\n","import React, { useEffect, useState } from \"react\";\nimport { useAlert } from \"react-alert\";\nimport SectionsDropdowns from \"../../Shared/SectionDropdowns/SectionDropdowns\";\nimport DealsTable from \"./DealsTable/DealsTable\";\nimport { formHeaders } from \"../../../utils/form\";\nimport SideNav from \"../../DealIndexPage/SideNav/SideNav\";\nimport SearchBar from \"../../Shared/SearchBar/SearchBar\";\n\nexport default function DealIndexPage() {\n const popup = useAlert();\n const [deals, setDeals] = useState([]);\n\n const fetchDeals = async () => {\n try {\n // eslint-disable-next-line no-undef\n const url = Routes.deals_path();\n\n const response = await fetch(url, {\n method: \"GET\",\n headers: formHeaders()\n });\n\n if (!response.ok) {\n popup.show(\"Something went wrong\", { type: \"error\" });\n }\n\n if (response.ok) {\n const json = await response.json();\n setDeals(json.deals);\n }\n } catch (error) {\n popup.show(error.message, { type: \"error\" });\n }\n };\n\n useEffect(() => {\n fetchDeals();\n }, []);\n\n const [caseState, setCaseState] = useState({\n draftDeals: [],\n paymentPendingDeals: [],\n paymentProgressDeals: [],\n paidDeals: [],\n archivedDeals: []\n });\n\n const [searchString, setSearchString] = useState(\"\");\n\n useEffect(() => {\n const filteredDeals = deals\n ? deals.filter(deal => {\n const searchables = [\n deal.organization.displayName,\n deal.billingPerson.fullName,\n deal.dealBeneficiaries,\n deal.author.fullName\n ]\n .toString()\n .toLowerCase();\n\n return searchables.includes(searchString.trim().toLowerCase());\n })\n : [];\n\n const archivedDeals = filteredDeals.filter(deal => deal.archived === true);\n const liveDeals = filteredDeals.filter(deal => deal.archived === false);\n setCaseState({\n archivedDeals,\n draftDeals: liveDeals.filter(deal => deal.state === \"draft\"),\n paymentPendingDeals: liveDeals.filter(deal => deal.state === \"submitted\"),\n paymentProgressDeals: liveDeals.filter(deal => deal.state === \"active\"),\n paidDeals: liveDeals.filter(deal => deal.state === \"complete\")\n });\n }, [searchString, deals]);\n\n const sections = [\n {\n name: \"Drafts\",\n content: (\n \n )\n },\n {\n name: \"Payment Pending\",\n content: (\n \n )\n },\n {\n name: \"Payment in Progress\",\n content: (\n \n )\n },\n {\n name: \"Fully Paid\",\n content: (\n \n )\n },\n {\n name: \"Archived\",\n content: (\n \n )\n }\n ];\n\n return (\n \n \n
\n \n \n
\n \n );\n}\n","/* eslint-disable jsx-a11y/click-events-have-key-events */\n/* eslint-disable jsx-a11y/no-static-element-interactions */\nimport React, { useState } from \"react\";\nimport styled from \"styled-components\";\nimport useContextMenu from \"react-use-context-menu\";\nimport { useAlert } from \"react-alert\";\nimport { useHistory } from \"react-router-dom\";\nimport { formatCentsToCurrency } from \"../../../../utils/numberHelpers\";\nimport { IndexItem } from \"../../../Shared/IndexItem/IndexItem\";\n\nimport { white, grayLight, gray, blue } from \"../../../../styles/colors\";\nimport { formHeaders } from \"../../../../utils/form\";\nimport { ContextMenu } from \"../../../Shared/ContextMenu/ContextMenu\";\n\nconst IndexRow = styled.div`\n background: ${white};\n border: 1px solid ${grayLight};\n border-radius: 8px;\n margin-bottom: 1rem;\n border-left: 4px solid transparent;\n\n &:hover {\n border-left: 4px solid ${blue};\n box-shadow: 0px 3px 5px ${gray};\n cursor: pointer;\n }\n\n display: grid;\n grid-template-columns: repeat(5, 1fr);\n column-gap: 1rem;\n padding: 0.75rem;\n`;\n\nconst dealStatusMapping = {\n draft: \"Draft\",\n submitted: \"Pending\",\n active: \"Payments in progress\"\n};\n\nexport default function DealRow(props) {\n const { deal, setDealsState } = props;\n\n const popup = useAlert();\n\n const [\n bindMenu,\n bindMenuItems,\n useContextTrigger,\n { setVisible: setContextMenuVisible }\n ] = useContextMenu();\n const [bindTrigger] = useContextTrigger({});\n const [showArchived, setShowArchived] = useState(deal.archived);\n\n const history = useHistory();\n\n const handleArchive = async unarchive => {\n // Pass 'unarchive' or true to this function to unarchive\n\n try {\n const url = unarchive\n ? Routes.unarchive_deal_path(deal.id)\n : Routes.archive_deal_path(deal.id);\n\n const response = await fetch(url, {\n method: \"POST\",\n headers: formHeaders(),\n body: JSON.stringify({})\n });\n\n if (!response.ok) {\n popup.show(response.error.message, { type: \"error\" });\n }\n\n if (response.ok) {\n const json = await response.json();\n setContextMenuVisible(false);\n setDealsState(prevState =>\n prevState.map(d => (d.id === deal.id ? json : d))\n );\n setShowArchived(json.archived);\n const message = unarchive\n ? \"Your deal has been unarchived\"\n : \"Your deal has been archived\";\n popup.show(message, { type: \"success\" });\n }\n } catch (error) {\n popup.show(\"Something went wrong. Please contact Legalpad Engineering.\", {\n type: \"error\"\n });\n }\n };\n\n const DealContextMenu = () => (\n \n {deal.state !== \"draft\" && No actions available}\n {!showArchived && deal.state === \"draft\" && (\n \n window.confirm(\"Are you sure you want to archive this deal?\") &&\n handleArchive()\n }\n >\n Archive\n \n )}\n {showArchived && deal.state === \"draft\" && (\n handleArchive(\"unarchive\")}>Unarchive\n )}\n \n );\n\n return (\n
\n \n history.push(`/deals/${deal.id}`)}\n >\n
\n \n {// eslint-disable-next-line no-nested-ternary\n !deal.dealBeneficiaries?.length\n ? \"-\"\n : deal.dealBeneficiaries?.length > 1\n ? `${deal.dealBeneficiaries[0]} & ${deal.dealBeneficiaries\n ?.length - 1} more`\n : deal.dealBeneficiaries[0]}\n \n {deal.organization.displayName}\n
\n {deal.author.fullName}\n \n {deal.finalPriceData.pay_total\n ? formatCentsToCurrency(deal.finalPriceData.pay_total)\n : \"-\"}\n \n {dealStatusMapping[deal.state]}\n {deal.updatedAtHumanized}\n \n
\n );\n}\n","import React, { useState, useReducer, useEffect } from \"react\";\nimport PropTypes from \"prop-types\";\nimport Select from \"react-select\";\nimport styled from \"styled-components\";\nimport { useAlert } from \"react-alert\";\nimport { stringifyNumber } from \"../../../utils/numberHelpers\";\nimport { useDidMountEffect } from \"../../../hooks/useDidMountEffect\";\nimport { formHeaders } from \"../../../utils/form\";\nimport AdditionalServiceSelect from \"./AdditionalServiceSelect/AdditionalServiceSelect\";\nimport { countOccurrences } from \"../../../utils/arrayMethods\";\n\nconst Container = styled.div`\n margin-top: 1.75rem;\n`;\n\nconst BundleHeader = styled.div`\n display: inline-flex;\n justify-content: center;\n align-items: center;\n margin-bottom: 0.5rem;\n h5 {\n margin: 0 1rem 0 0;\n }\n &&& {\n a {\n text-decoration: none;\n margin: 0;\n }\n }\n`;\n\nexport default function BundleOptions(props) {\n const popup = useAlert();\n\n const {\n bundle = null,\n index = 1,\n newBeneficiaryBundles,\n setNewBeneficiaryBundles,\n beneficiary,\n workflows = [],\n currentBundles,\n setCurrentBundles,\n createBundle\n } = props;\n\n const selectedWorkflowIdsForBeneficiary = currentBundles\n .filter(bun => bun.beneficiary.id === beneficiary.id)\n .map(bun => bun.workflowId);\n\n const allWorkflowOptions = workflows.map(wf => ({\n value: wf.id,\n label: wf.name\n }));\n\n const availableWorkflowOptionsForBundle = allWorkflowOptions.filter(\n wf => !selectedWorkflowIdsForBeneficiary.includes(wf.value)\n );\n\n const bundleActionTypes = {\n updateBeneficiary: \"UPDATE_BENEFICIARY\",\n updateWorkflow: \"UPDATE_WORKFLOW\",\n updateAdditionalServices: \"UPDATE_ADDITIONAL_SERVICES\"\n };\n\n const bundleReducer = (currentState, action) => {\n switch (action.type) {\n case bundleActionTypes.updateBeneficiary: {\n return { ...currentState, beneficiary: action.value };\n }\n case bundleActionTypes.updateWorkflow: {\n return {\n ...currentState,\n workflowId: action.value\n };\n }\n case bundleActionTypes.updateAdditionalServices: {\n return {\n ...currentState,\n additionalServiceIds: action.value\n };\n }\n default: {\n return currentState;\n }\n }\n };\n\n const [petitionBundle, dispatch] = useReducer(\n bundleReducer,\n bundle ?? createBundle({ beneficiary })\n );\n\n const bundleOrdinal = `${stringifyNumber(index)\n .charAt(0)\n .toUpperCase() + stringifyNumber(index).slice(1)} Visa`;\n\n const removeBundle = async () => {\n if (petitionBundle.id) {\n try {\n // eslint-disable-next-line no-undef\n const url = Routes.petition_bundle_path(petitionBundle.id);\n\n const response = await fetch(url, {\n method: \"DELETE\",\n headers: formHeaders()\n });\n\n if (!response.ok) {\n popup.show(\"Something went wrong\", { type: \"error\" });\n }\n\n if (response.ok) {\n const newBundles = currentBundles.filter(\n cb => cb.id !== petitionBundle.id\n );\n setCurrentBundles(newBundles);\n }\n } catch (error) {\n popup.show(error.message, { type: \"error\" });\n }\n } else {\n const newBundles = currentBundles.filter(\n cb => cb.tempId !== petitionBundle.tempId\n );\n setCurrentBundles(newBundles);\n\n if (newBeneficiaryBundles) {\n const updatedNewBeneficiaryBundles = newBeneficiaryBundles.filter(\n nbb => nbb.tempId !== petitionBundle.tempId\n );\n setNewBeneficiaryBundles(updatedNewBeneficiaryBundles);\n }\n }\n };\n\n const defaultOption = allWorkflowOptions.find(\n option => option.value === petitionBundle.workflowId\n );\n\n const defaultWorkflow = workflows.find(\n wf => wf.id === petitionBundle.workflowId\n );\n\n const [selectedWorkflow, setSelectedWorkflow] = useState(defaultWorkflow);\n\n const handleWorkflowChange = selectedWf => {\n dispatch({\n type: \"UPDATE_WORKFLOW\",\n value: selectedWf.value\n });\n const newWorkflow = workflows.find(wf => wf.id === selectedWf.value);\n setSelectedWorkflow(newWorkflow);\n\n const defaultAdditionalServiceIds = newWorkflow.additionalServices\n .filter(service => service.isDefaultOption)\n .map(service => service.id);\n\n dispatch({\n type: \"UPDATE_ADDITIONAL_SERVICES\",\n value: defaultAdditionalServiceIds\n });\n };\n\n const handleAdditionalServicesChange = (serviceId, quantity) => {\n dispatch({\n type: \"UPDATE_ADDITIONAL_SERVICES\",\n value: [\n ...petitionBundle.additionalServiceIds.filter(ao => ao !== serviceId),\n ...Array(quantity).fill(serviceId)\n ]\n });\n };\n\n // Update the beneficiary fields if they change\n useEffect(() => {\n dispatch({\n type: \"UPDATE_BENEFICIARY\",\n value: beneficiary\n });\n }, [beneficiary]);\n\n // Update the current bundles array by ID any time the bundle changes\n useDidMountEffect(() => {\n const updateBundles = () => {\n const updatedBundles = currentBundles.map(b => {\n if (b.tempId && b.tempId === petitionBundle.tempId) {\n return petitionBundle;\n }\n if (b.id && b.id === petitionBundle.id) {\n return petitionBundle;\n }\n return b;\n });\n\n setCurrentBundles(updatedBundles);\n };\n updateBundles();\n }, [\n petitionBundle.beneficiary,\n petitionBundle.workflowId,\n petitionBundle.additionalServiceIds\n ]);\n\n return (\n \n \n
{bundleOrdinal}
\n {(selectedWorkflow || index > 1) && (\n removeBundle()}\n onKeyDown={() => removeBundle()}\n >\n REMOVE\n \n )}\n
\n
\n \n
\n
\n );\n}\n\nBundleOptions.propTypes = {\n beneficiary: PropTypes.object,\n workflows: PropTypes.array\n};\n","import React, { useState, useEffect } from \"react\";\nimport { useLocation, useHistory } from \"react-router-dom\";\nimport { useAlert } from \"react-alert\";\nimport { formHeaders } from \"../../utils/form\";\nimport RouteWrapper from \"./RouteWrapper\";\nimport { FormContextProvider } from \"./FormStateProvider\";\n\nexport default function DataProvider(props) {\n const popup = useAlert();\n const location = useLocation();\n const history = useHistory();\n\n const { deal, setDeal } = props;\n\n // Loading states\n const [dealLoading, setDealLoading] = useState(false);\n const [fixturesLoading, setFixturesLoading] = useState(false);\n\n // Data for provision\n const [petitionerItems, setPetitionerItems] = useState([]);\n const [organizationId, setOrganizationId] = useState(deal?.organization?.id);\n const [organizationPeople, setOrganizationPeople] = useState([]);\n const [workflows, setWorkflows] = useState([]);\n const [discounts, setDiscounts] = useState([]);\n const [installmentOptions, setInstallmentOptions] = useState([]);\n\n // Pay total for display\n const [payTotal, setPayTotal] = useState(null);\n\n const parsedDealId = location.pathname.split(\"/\")[2];\n\n const fetchPeople = async orgId => {\n try {\n const url = Routes.people_organization_path(orgId);\n\n const response = await fetch(url, {\n method: \"GET\",\n headers: formHeaders()\n });\n\n if (!response.ok) {\n popup.show(\n `Something went wrong: \\n ${response.status} ${response.statusText}`,\n { type: \"error\" }\n );\n }\n\n if (response.ok) {\n const json = await response.json();\n setOrganizationPeople(json);\n setDealLoading(false);\n }\n } catch (error) {\n popup.show(error.message, { type: \"error\" });\n }\n };\n\n useEffect(() => {\n const fetchDeal = async dealId => {\n try {\n setDealLoading(true);\n const url = Routes.deal_path(dealId);\n\n const response = await fetch(url, {\n method: \"GET\",\n headers: formHeaders()\n });\n\n if (!response.ok) {\n popup.show(\"Deal could not be fetched, redirecting\", {\n type: \"error\"\n });\n history.push(\"/deals/new\");\n }\n\n if (response.ok) {\n const json = await response.json();\n setDeal(json);\n setOrganizationId(json.organization.id);\n fetchPeople(json.organization.id);\n }\n } catch (error) {\n popup.show(error.message, { type: \"error\" });\n }\n };\n\n if (parsedDealId && parsedDealId !== \"new\") {\n fetchDeal(parsedDealId);\n }\n }, [parsedDealId]);\n\n useEffect(() => {\n const fetchOrganizations = async () => {\n try {\n const url = Routes.organizations_path();\n\n const response = await fetch(url, {\n method: \"GET\",\n headers: formHeaders()\n });\n if (!response.ok) {\n popup.show(\n `Something went wrong: \\n ${response.status} ${response.statusText}`,\n { type: \"error\" }\n );\n }\n\n if (response.ok) {\n const json = await response.json();\n const items = json.items.map(org => ({\n id: org.id,\n label: org.to_s\n }));\n setPetitionerItems(items);\n }\n } catch (error) {\n popup.show(error.message, { type: \"error\" });\n }\n };\n const fetchWorkflows = async () => {\n try {\n // eslint-disable-next-line no-undef\n const url = Routes.workflows_path();\n\n const response = await fetch(url, {\n method: \"GET\",\n headers: formHeaders()\n });\n\n if (!response.ok) {\n popup.show(\n `Something went wrong: \\n ${response.status} ${response.statusText}`,\n { type: \"error\" }\n );\n }\n\n if (response.ok) {\n const json = await response.json();\n setWorkflows(json.items);\n }\n } catch (error) {\n popup.show(error.message, { type: \"error\" });\n }\n };\n\n setFixturesLoading(true);\n Promise.all([fetchOrganizations(), fetchWorkflows()]).then(() => {\n setFixturesLoading(false);\n });\n }, []);\n\n useEffect(() => {\n if (organizationId) {\n fetchPeople(organizationId);\n }\n if (!organizationId) {\n setOrganizationPeople([]);\n }\n }, [organizationId]);\n\n return (\n \n \n \n );\n}\n","import React, { useEffect } from \"react\";\nimport { useLocation, Redirect, Switch, Route, Prompt } from \"react-router-dom\";\nimport Loader from \"react-loader-spinner\";\nimport styled from \"styled-components\";\nimport StepContent from \"./StepContent\";\nimport PetitionerStep from \"./PetitionerStep/PetitionerStep\";\nimport BeneficiariesStep from \"./BeneficiariesStep/BeneficiariesStep\";\nimport PointOfContactStep from \"./PointOfContactStep/PointOfContactStep\";\nimport ReviewStep from \"./ReviewStep/ReviewStep\";\nimport StepNav from \"./StepNav\";\nimport DealShowPage from \"./DealShowPage/DealShowPage\";\nimport { useFormState } from \"./FormStateProvider\";\nimport SalesDashboard from \"./SalesDashboard/SalesDashboard\";\nimport CommonNav from \"../Shared/CommonNav/CommonNav\";\n\nconst StepWrapper = styled.section`\n margin-top: 4rem;\n`;\n\nexport default function RouteWrapper(props) {\n const {\n deal,\n setDeal,\n dealLoading,\n fixturesLoading,\n petitionerItems,\n organizationId,\n setOrganizationId,\n organizationPeople,\n setOrganizationPeople,\n workflows\n } = props;\n\n const [formState, ,] = useFormState();\n\n const petitionerStepPath = deal.id\n ? `/deals/${deal.id}/petitioner`\n : \"/deals/new\";\n\n const stepsArray = [\n {\n title: \"Petitioner Information\",\n pathname: petitionerStepPath\n },\n {\n title: \"Beneficiaries & Visas\",\n pathname: `/deals/${deal.id}/beneficiaries`,\n description: \"Set Beneficiaries\"\n },\n {\n title: \"Point of Contact\",\n pathname: `/deals/${deal.id}/contacts`,\n description: \"Set Points of Contact\"\n },\n {\n title: \"Review\",\n pathname: `/deals/${deal.id}/review`,\n description: \"Review information\"\n }\n ];\n\n const { pathname } = useLocation();\n\n const currentStep = stepsArray.find(step => step.pathname === pathname);\n\n const renderPetitionerStep = () => (\n \n \n \n {dealLoading || fixturesLoading ? (\n \n ) : (\n \n )}\n \n \n );\n\n const renderBeneficiariesStep = () => (\n \n \n \n {dealLoading || fixturesLoading ? (\n \n ) : (\n \n )}\n \n \n );\n\n const renderContactsStep = () => (\n \n \n\n \n {dealLoading || fixturesLoading ? (\n \n ) : (\n \n )}\n \n \n );\n\n const renderReviewStep = () => (\n \n \n \n {dealLoading || fixturesLoading ? (\n \n ) : (\n \n )}\n \n \n );\n\n // Scroll restoration between steps\n useEffect(() => {\n // eslint-disable-next-line no-unused-expressions\n document.getElementById(\"sales-container\")?.scrollTo(0, 0);\n }, [pathname]);\n\n return (\n \n {/* Base url is /sales */}\n \n \n \n \n \n \n \n \n \n (\n <>\n \n \n \n {/* \n \n */}\n \n {renderPetitionerStep()}\n \n \n {deal.id && }\n \n \n {renderPetitionerStep()}\n \n \n {renderBeneficiariesStep()}\n \n \n {renderContactsStep()}\n \n \n {renderReviewStep()}\n \n \n \n \n )}\n />\n \n \n );\n}\n","import React from \"react\";\nimport PropTypes from \"prop-types\";\nimport styled from \"styled-components\";\n\nconst Centered = styled.div`\n max-width: 72rem;\n margin: auto;\n text-align: center;\n`;\n\nconst MainContent = styled.div`\n margin-top: 4rem;\n min-height: 50vh;\n\n h3 {\n text-align: left;\n font-weight: 500;\n font-size: 32px;\n }\n`;\n\nconst Container = styled.div`\n justify-content: left;\n text-align: left;\n`;\n\nexport default function StepContent(props) {\n const { step, children } = props;\n\n return (\n \n \n

{step.title}

\n {children}\n
\n
\n );\n}\n\nStepContent.propTypes = {\n step: PropTypes.object\n};\n","import React, { useState, useEffect } from \"react\";\nimport styled from \"styled-components\";\nimport { useAlert } from \"react-alert\";\nimport { useHistory } from \"react-router-dom\";\nimport { grayDark } from \"../../../styles/colors\";\nimport { formHeaders } from \"../../../utils/form\";\nimport ActionFrame from \"../ActionFrame\";\nimport AutoSuggest from \"../../Shared/AutoSuggest/AutoSuggest\";\nimport { CheckboxItem } from \"../../Shared/CheckBox\";\n\nconst Section = styled.div`\n margin-bottom: 2rem;\n h4 {\n margin: 1rem 0 0 0;\n }\n\n p {\n color: ${grayDark};\n }\n\n a {\n text-decoration: underline;\n margin: 0.5rem 0;\n }\n`;\n\nexport default function PetitionerStep(props) {\n const {\n stepsArray,\n currentStep,\n organizationId,\n setOrganizationId,\n petitionerItems,\n deal,\n setDeal\n } = props;\n\n const { organization, id: dealId } = deal;\n\n const popup = useAlert();\n const history = useHistory();\n\n const [errors, setErrors] = useState([]);\n\n const [organizationName, setOrganizationName] = useState(\n organization?.displayName\n );\n const [isSelfPetitioning, setIsSelfPetitioning] = useState(\n organization?.isSelfPetitioning ?? false\n );\n const [isNotYetEstablished, setIsNotYetEstablished] = useState(\n organization?.isNotYetEstablished ?? false\n );\n\n const [loading, setLoading] = useState(false);\n\n const createOrUpdateDeal = async () => {\n try {\n setLoading(true);\n\n const url = dealId ? Routes.deal_path(dealId) : Routes.deals_path();\n\n let requestBody;\n const method = dealId ? \"PUT\" : \"POST\";\n\n // eslint-disable-next-line default-case\n switch (true) {\n case !!organizationId:\n requestBody = {\n organization_id: organizationId\n };\n break;\n case !organizationId:\n requestBody = {\n organization_attributes: {\n display_name: organizationName,\n is_self_petitioning: isSelfPetitioning,\n is_not_yet_established: isNotYetEstablished\n }\n };\n break;\n }\n\n const response = await fetch(url, {\n method,\n headers: formHeaders(),\n body: JSON.stringify(requestBody)\n });\n\n if (!response.ok) {\n const json = await response.json();\n setLoading(false);\n setErrors([...errors, json.errors]);\n json.errors.forEach(err => {\n setErrors([...errors, err]);\n popup.show(err, { type: \"error\" });\n });\n }\n\n if (response.ok) {\n const json = await response.json();\n setDeal(json);\n setLoading(false);\n history.push(`/deals/${json.id}/beneficiaries`);\n popup.show(\"Draft deal has been saved!\", {\n type: \"success\",\n timeout: 1500\n });\n }\n } catch (error) {\n setLoading(false);\n popup.show(error.message, { type: \"error\" });\n }\n };\n\n useEffect(() => {\n if (isSelfPetitioning) {\n setOrganizationName(\"Self-petitioning\");\n if (!deal.organization) setOrganizationId(null);\n }\n if (isNotYetEstablished) {\n setOrganizationName(\"Not yet established\");\n if (!deal.organization) setOrganizationId(null);\n }\n if (isSelfPetitioning && isNotYetEstablished) {\n setOrganizationName(\"Self-petitioning/not yet established\");\n }\n }, [isSelfPetitioning, isNotYetEstablished]);\n\n const petitionerComplete =\n organizationId ||\n organizationName ||\n isSelfPetitioning ||\n isNotYetEstablished;\n const disableContinue = !petitionerComplete;\n\n return (\n <>\n
\n

Petitioner

\n
\n {!isSelfPetitioning && !isNotYetEstablished && (\n setOrganizationId(selected.id)}\n handleInputChange={value => setOrganizationName(value)}\n />\n )}\n
\n
\n \n setIsSelfPetitioning(!isSelfPetitioning)}\n />\n \n \n \n setIsNotYetEstablished(!isNotYetEstablished)}\n />\n \n \n
\n
\n\n createOrUpdateDeal()}\n hasErrors={errors.length > 0}\n />\n \n );\n}\n","import React, { useState, useEffect } from \"react\";\nimport PropTypes from \"prop-types\";\nimport styled from \"styled-components\";\nimport { useAlert } from \"react-alert\";\nimport { useHistory } from \"react-router-dom\";\nimport ActionFrame from \"../ActionFrame\";\nimport SelectBox from \"../SelectBox\";\nimport { uniqueArrayByProp } from \"../../../utils/arrayMethods\";\nimport { formHeaders } from \"../../../utils/form\";\nimport OrganizationPersonForm from \"../../Shared/Forms/OrganizationPersonForm\";\nimport RunningTotal from \"../RunningTotal/RunningTotal\";\nimport { Section } from \"../SalesFlowComponents/index\";\nimport { useFormState } from \"../FormStateProvider\";\n\nconst Container = styled.div`\n h5 {\n font-size: 21px;\n }\n\n p {\n font-size: 14px;\n }\n`;\n\nexport default function PointOfContactStep(props) {\n const {\n organizationPeople,\n setOrganizationPeople,\n workflows,\n deal,\n setDeal,\n stepsArray,\n currentStep\n } = props;\n\n const {\n id: dealId,\n billingPerson,\n petitionBundles = [],\n dealDiscounts\n } = deal;\n\n const contactOptions = uniqueArrayByProp(\"id\", [\n ...organizationPeople,\n billingPerson\n ]);\n\n const [, setFormState] = useFormState();\n\n const [currentBundles, setCurrentBundles] = useState(petitionBundles);\n\n const updateBundlePoc = (bundleId, person) => {\n const updatedBundles = currentBundles.map(bundle => {\n if (bundleId === bundle.id) {\n return {\n ...bundle,\n petition: {\n ...bundle.petition,\n representative: person\n }\n };\n }\n return bundle;\n });\n setCurrentBundles(updatedBundles);\n };\n\n const popup = useAlert();\n const history = useHistory();\n\n const [loading, setLoading] = useState(false);\n\n const updateDeal = async () => {\n try {\n setLoading(true);\n\n const url = Routes.deal_path(dealId);\n\n const requestBody = {\n petition_bundles_attributes: currentBundles.map(bundle => ({\n id: bundle.id,\n petition_attributes: {\n id: bundle.petition.id,\n representative_id: bundle.petition.representative.id\n }\n }))\n };\n\n const response = await fetch(url, {\n method: \"PUT\",\n headers: formHeaders(),\n body: JSON.stringify(requestBody)\n });\n\n if (!response.ok) {\n const json = await response.json();\n json.errors.forEach(err => {\n popup.show(err, { type: \"error\" });\n });\n setLoading(false);\n }\n\n if (response.ok) {\n const json = await response.json();\n setDeal(json);\n setLoading(false);\n setFormState({ dirty: false });\n history.push(`/deals/${json.id}/review`);\n popup.show(\"Draft deal has been saved!\", {\n type: \"success\",\n timeout: 1500\n });\n }\n } catch (error) {\n popup.show(error.message, { type: \"error\" });\n }\n };\n\n useEffect(() => {\n if (petitionBundles) {\n setCurrentBundles(petitionBundles);\n }\n }, [petitionBundles]);\n\n useEffect(() => {\n if (currentBundles !== petitionBundles) {\n setFormState({ dirty: true });\n } else {\n setFormState({ dirty: false });\n }\n return () => setFormState({ dirty: false });\n }, [currentBundles, petitionBundles]);\n\n const notAllContactsSelected = () =>\n currentBundles.some(bundle => !bundle.petition.representative.id);\n\n const disableContinue = notAllContactsSelected();\n\n return (\n \n
\n
\n {currentBundles.map(bundle => {\n const handleNewContact = async newPerson => {\n setOrganizationPeople(prevState => [...prevState, newPerson]);\n updateBundlePoc(bundle.id, newPerson);\n };\n\n const { beneficiary, workflow } = bundle.petition;\n\n return (\n \n
\n For {beneficiary.firstName} {beneficiary.lastName}{\" \"}\n {workflow.name}\n
\n

Existing contacts

\n {contactOptions.map(person => (\n updateBundlePoc(bundle.id, person)}\n checked={bundle.petition.representative.id === person.id}\n />\n ))}\n \n
\n );\n })}\n \n
\n updateDeal()}\n />\n
\n );\n}\n\nPointOfContactStep.propTypes = {\n organizationPeople: PropTypes.array,\n setOrganizationPeople: PropTypes.func,\n deal: PropTypes.object,\n setDeal: PropTypes.func,\n stepsArray: PropTypes.array,\n currentStep: PropTypes.object\n};\n","import React from \"react\";\nimport PropTypes from \"prop-types\";\nimport styled from \"styled-components\";\nimport { grayLighter } from \"../../../styles/colors\";\n\nexport default function ReviewSection(props) {\n const { header, children } = props;\n return (\n \n \n {header}\n \n {children}\n \n );\n}\n\nReviewSection.propTypes = {};\n","import React from \"react\";\nimport styled from \"styled-components\";\nimport { Link, useLocation } from \"react-router-dom\";\nimport { blue, grayDarker } from \"../../styles/colors\";\n\nconst Centered = styled.div`\n max-width: 72rem;\n margin: auto;\n text-align: center;\n`;\n\nconst Nav = styled.div`\n display: grid;\n grid-template-columns: repeat(6, 1fr);\n`;\n\nconst NavItem = styled.div`\n padding: 1rem;\n font-weight: 500;\n color: ${props => (props.stepActive ? blue : grayDarker)};\n border-bottom: ${props => (props.stepActive ? `5px solid ${blue}` : \"\")};\n`;\n\nexport default function StepNav(props) {\n const { deal } = props;\n const location = useLocation();\n\n const petitionerStepPath = deal.id\n ? `/deals/${deal.id}/petitioner`\n : \"/deals/new\";\n\n return (\n \n \n \n );\n}\n","import React, { useState } from \"react\";\nimport PropTypes from \"prop-types\";\nimport styled from \"styled-components\";\nimport Collapse from \"react-css-collapse\";\nimport { grayLight, grayDark, grayDarker, white } from \"../../../styles/colors\";\nimport { formatCentsToCurrency } from \"../../../utils/numberHelpers\";\n\nconst DetailBox = styled.div`\n background: ${white};\n border: 1px solid ${grayLight};\n border-radius: 6px;\n margin-right: 3rem;\n padding: 1rem;\n`;\n\nconst DetailRow = styled.div`\n display: grid;\n grid-template-columns: 2fr 1fr 1fr 1fr;\n p {\n margin: 0;\n font-size: ${({ diminished }) => (diminished ? \"14px\" : \"\")};\n }\n`;\n\nexport default function PetitionBundleDetails(props) {\n const { petitionBundle } = props;\n const { petition, finalPriceData } = petitionBundle;\n // alias to camelcase because Jbuilder sucks at handling jsonb columns\n const {\n price_total: priceTotal,\n base_fees: baseFees,\n additional_services: additionalServices\n } = finalPriceData;\n const allFees = baseFees.concat(additionalServices);\n const { beneficiary, workflow, id } = petition;\n\n const [dropdownOpen, setDropdownOpen] = useState(false);\n\n return (\n \n \n setDropdownOpen(!dropdownOpen)}\n onKeyDown={() => setDropdownOpen(!dropdownOpen)}\n >\n \n

{`${beneficiary.firstName} ${beneficiary.lastName}`}

\n \n\n

{workflow.name}

\n

{formatCentsToCurrency(priceTotal)}

\n {/* eslint-disable-next-line no-undef */}\n Go to petition\n
\n \n {allFees.map((fee, i) => (\n \n

\n

{fee.name}

\n

\n {formatCentsToCurrency(fee.amount)}\n

\n

\n \n ))}\n \n \n );\n}\n\nPetitionBundleDetails.propTypes = {\n petitionBundle: PropTypes.object\n};\n","import React, { useState } from \"react\";\nimport PropTypes from \"prop-types\";\nimport { useAlert } from \"react-alert\";\nimport { useForm } from \"react-hook-form\";\nimport { FormInput } from \"../../Shared/Forms\";\nimport request from \"../../../services/request\";\n\nexport default function SalesforceIdForm({\n dealId,\n salesforceOpportunityId,\n setDeal\n}) {\n const popup = useAlert();\n\n const [formVisible, setFormVisible] = useState(false);\n\n const { register, handleSubmit, formState } = useForm({\n defaultValues: {\n salesforceOpportunityId\n }\n });\n\n const updateSalesforceId = data => {\n request(Routes.update_metadata_deal_path(dealId), {\n body: data,\n method: \"PUT\"\n })\n .then(res => {\n setDeal(res);\n setFormVisible(false);\n })\n .catch(err =>\n err.errors.forEach(error => popup.show(error, { type: \"error\" }))\n );\n };\n\n return (\n

updateSalesforceId(data))}>\n {formVisible ? (\n <>\n \n
\n {formState.isDirty && (\n \n )}\n {!formState.isDirty && (\n setFormVisible(false)}\n >\n Cancel\n \n )}\n \n ) : (\n <>\n

{salesforceOpportunityId}

\n setFormVisible(!formVisible)}\n onKeyDown={() => setFormVisible(!formVisible)}\n >\n Edit\n \n \n )}\n \n );\n}\n\nSalesforceIdForm.propTypes = {\n dealId: PropTypes.string,\n salesforceOpportunityId: PropTypes.string,\n setDeal: PropTypes.func\n};\n","import React, { useState } from \"react\";\nimport PropTypes from \"prop-types\";\nimport { useAlert } from \"react-alert\";\nimport { useForm } from \"react-hook-form\";\nimport { FormInput } from \"../../Shared/Forms\";\nimport request from \"../../../services/request\";\nimport { red } from \"../../../styles/colors\";\n\nexport default function QuickbooksIdForm({\n dealId,\n quickbooksInvoiceId,\n setDeal\n}) {\n const popup = useAlert();\n\n const [formVisible, setFormVisible] = useState(false);\n\n const { register, handleSubmit, setValue, formState, errors } = useForm({\n defaultValues: {\n quickbooksInvoiceId\n }\n });\n\n const updateQuickbooksId = data => {\n if (formState.isDirty)\n request(Routes.update_metadata_deal_path(dealId), {\n body: data,\n method: \"PUT\"\n })\n .then(res => {\n setDeal(res);\n setFormVisible(false);\n })\n .catch(err =>\n err.errors.forEach(error => popup.show(error, { type: \"error\" }))\n );\n };\n\n const handlePaste = e => {\n let paste = (e.clipboardData || window.clipboardData).getData(\"text\");\n paste = paste.replace(/\\D/g, \"\");\n setValue(\"quickbooks_invoice_id\", paste, {\n shouldValidate: true,\n shouldDirty: true\n });\n e.preventDefault();\n };\n\n return (\n
updateQuickbooksId(data))}>\n {formVisible ? (\n <>\n
\n INV-\n handlePaste(e)}\n ref={register({ required: true, minLength: 4, maxLength: 5 })}\n aria-invalid={errors.quickbooks_invoice_id ? \"true\" : \"false\"}\n error={errors.quickbooks_invoice_id}\n />\n
\n
\n {errors.quickbooks_invoice_id?.type === \"required\" && (\n \n This is required\n \n )}\n {errors.quickbooks_invoice_id?.type === \"maxLength\" && (\n \n Max length exceeded\n \n )}\n {errors.quickbooks_invoice_id?.type === \"minLength\" && (\n \n Minimum length 4 characters\n \n )}\n {errors.quickbooks_invoice_id &&
}\n {formState.isDirty && (\n \n )}\n {!formState.isDirty && (\n setFormVisible(false)}\n >\n Cancel\n \n )}\n \n ) : (\n <>\n

INV-{quickbooksInvoiceId}

\n setFormVisible(!formVisible)}\n onKeyDown={() => setFormVisible(!formVisible)}\n >\n Edit\n \n \n )}\n \n );\n}\n\nQuickbooksIdForm.propTypes = {\n dealId: PropTypes.string,\n quickbooksInvoiceId: PropTypes.string,\n setDeal: PropTypes.func\n};\n","import React from \"react\";\nimport styled from \"styled-components\";\nimport { Route, Switch } from \"react-router-dom\";\nimport CommonNav from \"../../Shared/CommonNav/CommonNav\";\nimport ServicesPage from \"../ServicesPage/ServicesPage\";\nimport WorkflowsPage from \"../WorkflowsPage/WorkflowsPage\";\nimport DealIndexPage from \"../DealIndexPage/DealIndexPage\";\n\nconst Layout = styled.div`\n width: 100vw;\n height: 100vh;\n display: grid;\n`;\n\nexport default function SalesDashboard() {\n return (\n \n \n
\n \n \n \n \n \n \n \n \n \n \n \n
\n
\n );\n}\n","import React, { useState, useEffect } from \"react\";\nimport styled from \"styled-components\";\nimport { useAlert } from \"react-alert\";\nimport { formHeaders } from \"../../../utils/form\";\nimport { IndexRow } from \"../../Shared/IndexRow/IndexRow\";\nimport AdditionalServiceRow from \"./AdditionalServiceRow\";\nimport { blue } from \"../../../styles/colors\";\nimport { CheckboxItem } from \"../../Shared/CheckBox\";\nimport StatusTag from \"../../Shared/StatusTag/StatusTag\";\nimport { useAuthContext } from \"../../Shared/ContextProviders/AuthProvider\";\n\nconst FormInput = styled.input`\n padding: 0.5rem;\n border: 1px solid ${blue};\n border-radius: 4px;\n width: ${props => props.width};\n`;\n\nexport default function ServicesPage() {\n const popup = useAlert();\n\n const user = useAuthContext();\n const hasEngAccess = user.engAccess;\n\n const [additionalServices, setAdditionalServices] = useState([]);\n const [asFormVisible, setAsFormVisible] = useState(false);\n const [additionalServiceFormState, setAdditionalServiceFormState] = useState({\n name: \"\",\n amount: \"\",\n maxQuantity: 1,\n isDefaultOption: false\n });\n\n useEffect(() => {\n const fetchAdditionalServices = async () => {\n try {\n const url = Routes.additional_services_path();\n\n const response = await fetch(url, {\n method: \"GET\",\n headers: formHeaders()\n });\n\n if (!response.ok) {\n popup.show(\n `Something went wrong: \\n ${response.status} ${response.statusText}`,\n { type: \"error\" }\n );\n }\n\n if (response.ok) {\n const json = await response.json();\n setAdditionalServices(json.additional_services);\n }\n } catch (error) {\n popup.show(error.message, { type: \"error\" });\n }\n };\n fetchAdditionalServices();\n }, []);\n\n const handleAdditionalServiceFormChange = (e, isCheckbox) => {\n if (isCheckbox) {\n setAdditionalServiceFormState({\n ...additionalServiceFormState,\n [e.target.name]: e.target.checked\n });\n } else {\n setAdditionalServiceFormState({\n ...additionalServiceFormState,\n [e.target.name]: e.target.value\n });\n }\n };\n\n const createAdditionalService = async () => {\n try {\n const url = Routes.additional_services_path();\n\n const requestBody = {\n additional_service: {\n name: additionalServiceFormState.name,\n amount: parseInt(additionalServiceFormState.amount * 100),\n is_default_option: additionalServiceFormState.isDefaultOption,\n max_quantity: additionalServiceFormState.maxQuantity\n }\n };\n\n const response = await fetch(url, {\n method: \"POST\",\n headers: formHeaders(),\n body: JSON.stringify(requestBody)\n });\n\n if (!response.ok) {\n const json = await response.json();\n popup.show(\n `Something went wrong: \\n ${response.status} ${response.statusText} \\n ${json}`,\n { type: \"error\" }\n );\n }\n\n if (response.ok) {\n const json = await response.json();\n setAdditionalServices([...additionalServices, json]);\n setAsFormVisible(false);\n setAdditionalServiceFormState({\n name: \"\",\n amount: \"\",\n maxQuantity: 1,\n isDefaultOption: false\n });\n popup.show(\"Service successfully created\", { type: \"success\" });\n }\n } catch (error) {\n popup.show(error.message, { type: \"error\" });\n }\n };\n\n return (\n
\n
\n

Additional Services

\n {!hasEngAccess && (\n \n )}\n \n \n \n \n \n \n \n \n\n \n \n \n \n \n )}\n \n
NamePriceMax quantityDefault selected\n \n \n {additionalServices.map(as => (\n \n ))}\n {asFormVisible && (\n \n \n handleAdditionalServiceFormChange(e)}\n />\n \n $\n handleAdditionalServiceFormChange(e)}\n />\n \n handleAdditionalServiceFormChange(e)}\n />\n \n \n handleAdditionalServiceFormChange(e, true)}\n />\n \n \n \n \n setAsFormVisible(false)}\n >\n Cancel\n \n createAdditionalService()}\n >\n Save\n \n
\n {!asFormVisible && (\n setAsFormVisible(true)}\n >\n New service\n \n )}\n
\n
\n );\n}\n","import React, { useState, useEffect, useMemo } from \"react\";\nimport PropTypes from \"prop-types\";\nimport styled from \"styled-components\";\nimport { useAlert } from \"react-alert\";\nimport Loader from \"react-loader-spinner\";\nimport { IndexRow } from \"../../Shared/IndexRow/IndexRow\";\nimport { formHeaders } from \"../../../utils/form\";\nimport { deepEqual } from \"../../../utils/equalityHelpers\";\nimport { CheckboxItem } from \"../../Shared/CheckBox\";\n\nconst Input = styled.input`\n border: none;\n width: ${props => props.width ?? \"auto\"};\n cursor: ${props => (props.disabled ? \"not-allowed\" : \"auto\")};\n`;\n\nexport default function AdditionalServiceRow(props) {\n const popup = useAlert();\n const { additionalService, setAdditionalServices, hasEngAccess } = props;\n\n const priceAdjustedAdditionalService = useMemo(\n () => ({\n ...additionalService,\n amount: additionalService.amount / 100\n }),\n [additionalService]\n );\n const [currentAdditionalService, setCurrentAdditionalService] = useState(\n priceAdjustedAdditionalService\n );\n\n const [serviceDirty, setServiceDirty] = useState(\n currentAdditionalService !== priceAdjustedAdditionalService\n );\n\n useEffect(() => {\n setCurrentAdditionalService(priceAdjustedAdditionalService);\n }, [additionalService]);\n\n useEffect(() => {\n if (deepEqual(currentAdditionalService, priceAdjustedAdditionalService)) {\n setServiceDirty(false);\n } else {\n setServiceDirty(true);\n }\n }, [currentAdditionalService, priceAdjustedAdditionalService]);\n\n const [loading, setLoading] = useState(false);\n\n const updateAdditionalService = async () => {\n try {\n setLoading(true);\n\n const url = Routes.additional_service_path(additionalService.id);\n\n const requestBody = {\n additional_service: {\n name: currentAdditionalService.name,\n amount: currentAdditionalService.amount * 100,\n is_default_option: currentAdditionalService.isDefaultOption,\n max_quantity: currentAdditionalService.maxQuantity\n }\n };\n\n const response = await fetch(url, {\n method: \"PUT\",\n headers: formHeaders(),\n body: JSON.stringify(requestBody)\n });\n\n if (!response.ok) {\n const json = await response.json();\n popup.show(\n `Something went wrong: \\n ${response.status} ${response.statusText} \\n ${json}`,\n { type: \"error\" }\n );\n }\n\n if (response.ok) {\n popup.show(\"Service successfully updated\", { type: \"success\" });\n }\n } catch (error) {\n popup.show(error.message, { type: \"error\" });\n } finally {\n setLoading(false);\n setServiceDirty(false);\n }\n };\n\n const deleteAdditionalService = async () => {\n try {\n const url = Routes.additional_service_path(additionalService.id);\n\n const response = await fetch(url, {\n method: \"DELETE\",\n headers: formHeaders()\n });\n\n if (!response.ok) {\n popup.show(\n `Something went wrong: \\n ${response.status} ${response.statusText}`,\n { type: \"error\" }\n );\n }\n\n if (response.ok) {\n setAdditionalServices(prevAdditionalServices =>\n prevAdditionalServices.filter(as => as.id !== additionalService.id)\n );\n popup.show(\"Service successfully destroyed\", { type: \"success\" });\n }\n } catch (error) {\n popup.show(error.message, { type: \"error\" });\n }\n };\n\n const handleCancel = () => {\n setCurrentAdditionalService(priceAdjustedAdditionalService);\n if (\"activeElement\" in document) document.activeElement.blur();\n setServiceDirty(false);\n };\n\n const handleDelete = () =>\n // eslint-disable-next-line no-restricted-globals\n confirm(\n \"Are you sure you want to delete this service? This cannot be undone.\"\n ) && deleteAdditionalService();\n\n const handleAdditionalServiceChange = (e, parseInts) => {\n setCurrentAdditionalService({\n ...currentAdditionalService,\n [e.target.name]: parseInts ? parseInt(e.target.value) : e.target.value\n });\n };\n\n const handleAdditionalServiceDefaultCheck = e => {\n setCurrentAdditionalService({\n ...currentAdditionalService,\n [e.target.name]: e.target.checked\n });\n };\n\n return (\n \n \n handleAdditionalServiceChange(e)}\n style={{ fontWeight: 600 }}\n disabled={!hasEngAccess || loading}\n />\n \n \n $\n handleAdditionalServiceChange(e, true)}\n disabled={!hasEngAccess || loading}\n />\n \n \n handleAdditionalServiceChange(e, true)}\n disabled={!hasEngAccess || loading}\n />\n \n \n \n handleAdditionalServiceDefaultCheck(e)}\n disabled={!hasEngAccess || loading}\n >\n \n \n \n {serviceDirty && !loading ? (\n \n handleCancel()}\n >\n Cancel\n \n updateAdditionalService()}\n >\n Save\n \n \n ) : (\n \n )}\n {loading && (\n \n )}\n \n handleDelete()}\n onKeyDown={() => handleDelete()}\n disabled={!hasEngAccess || loading}\n >\n DELETE\n \n \n \n );\n}\n\nAdditionalServiceRow.propTypes = {\n additionalService: PropTypes.object,\n setAdditionalServices: PropTypes.func\n};\n","import React, { useState, useEffect } from \"react\";\nimport { useAlert } from \"react-alert\";\nimport { formHeaders } from \"../../../utils/form\";\nimport WorkflowDetails from \"./WorkflowDetails\";\nimport StatusTag from \"../../Shared/StatusTag/StatusTag\";\nimport { useAuthContext } from \"../../Shared/ContextProviders/AuthProvider\";\n\nexport default function WorkflowsPage() {\n const popup = useAlert();\n const [workflows, setWorkflows] = useState([]);\n const [additionalServices, setAdditionalServices] = useState([]);\n\n const user = useAuthContext();\n const hasEngAccess = user.engAccess;\n\n useEffect(() => {\n const fetchWorkflows = async () => {\n try {\n const url = Routes.workflows_path();\n\n const response = await fetch(url, {\n method: \"GET\",\n headers: formHeaders()\n });\n\n if (!response.ok) {\n popup.show(\n `Something went wrong: \\n ${response.status} ${response.statusText}`,\n { type: \"error\" }\n );\n }\n\n if (response.ok) {\n const json = await response.json();\n setWorkflows(json.items);\n }\n } catch (error) {\n popup.show(error.message, { type: \"error\" });\n }\n };\n const fetchAdditionalServices = async () => {\n try {\n const url = Routes.additional_services_path();\n\n const response = await fetch(url, {\n method: \"GET\",\n headers: formHeaders()\n });\n\n if (!response.ok) {\n popup.show(\n `Something went wrong: \\n ${response.status} ${response.statusText}`,\n { type: \"error\" }\n );\n }\n\n if (response.ok) {\n const json = await response.json();\n setAdditionalServices(json.additional_services);\n }\n } catch (error) {\n popup.show(error.message, { type: \"error\" });\n }\n };\n fetchWorkflows();\n fetchAdditionalServices();\n }, []);\n\n return (\n
\n
\n

Workflows

\n {!hasEngAccess && (\n \n )}\n {workflows.map(wf => (\n \n ))}\n
\n
\n );\n}\n","import React, { useState } from \"react\";\nimport PropTypes from \"prop-types\";\nimport { useAlert } from \"react-alert\";\nimport styled from \"styled-components\";\nimport Select from \"react-select\";\nimport Loader from \"react-loader-spinner\";\nimport { formHeaders } from \"../../../utils/form\";\nimport BaseFeeRow from \"./BaseFeeRow\";\nimport { IndexRow } from \"../../Shared/IndexRow/IndexRow\";\nimport { generateUUID } from \"../../../utils/uuidGenerator\";\nimport { blue, gold } from \"../../../styles/colors\";\nimport { formatCentsToCurrency } from \"../../../utils/numberHelpers\";\nimport { useDidMountEffect } from \"../../../hooks/useDidMountEffect\";\n\nconst FormInput = styled.input`\n padding: 0.5rem;\n border: 1px solid ${blue};\n border-radius: 4px;\n width: ${props => props.width};\n`;\n\nexport default function WorkflowDetails(props) {\n const popup = useAlert();\n const { workflow, additionalServices, hasEngAccess } = props;\n const {\n additionalServices: workflowAdditionalServices,\n baseFees,\n id\n } = workflow;\n\n const baseFeesWithTempId = baseFees.map(fee => ({\n ...fee,\n amount: fee.amount,\n tempId: generateUUID()\n }));\n\n const [currentBaseFees, setCurrentBaseFees] = useState(baseFeesWithTempId);\n\n const [\n currentAdditionalServiceIds,\n setCurrentAdditionalServiceIds\n ] = useState(workflowAdditionalServices.map(as => as.id));\n\n const [baseFeeFormVisible, setBaseFeeFormVisible] = useState(false);\n const [baseFeeFormState, setBaseFeeFormState] = useState({\n name: \"\",\n amount: \"\"\n });\n\n const [updateBaseFees, setUpdateBaseFees] = useState(false);\n\n const defaultOptions = workflowAdditionalServices.map(as => ({\n value: as.id,\n label: `${as.name} - ${formatCentsToCurrency(as.amount)}`\n }));\n\n const serviceOptions = additionalServices.map(as => ({\n value: as.id,\n label: `${as.name} - ${formatCentsToCurrency(as.amount)}`\n }));\n\n const handleServicesSelect = values => {\n if (!values) {\n setCurrentAdditionalServiceIds([]);\n } else {\n setCurrentAdditionalServiceIds(values?.map(v => v.value));\n }\n };\n\n const handleBaseFeeFormChange = e => {\n setBaseFeeFormState({\n ...baseFeeFormState,\n [e.target.name]: e.target.value\n });\n };\n\n const createBaseFee = () => {\n setCurrentBaseFees(prevFees => [\n ...prevFees,\n {\n ...baseFeeFormState,\n amount: baseFeeFormState.amount * 100,\n tempId: generateUUID()\n }\n ]);\n setBaseFeeFormState({\n name: \"\",\n amount: \"\"\n });\n setBaseFeeFormVisible(false);\n setUpdateBaseFees(true);\n };\n\n const totalPrice = () => {\n const baseFeeCost = currentBaseFees.reduce(\n (a, bf) => a + parseInt(bf.amount),\n 0\n );\n\n return formatCentsToCurrency(baseFeeCost);\n };\n\n const [loading, setLoading] = useState(false);\n\n const updateWorkflow = async () => {\n try {\n setLoading(true);\n\n const url = Routes.workflow_path(workflow.id);\n\n const requestBody = {\n workflow: {\n base_fees: currentBaseFees.map(({ name, amount }) => ({\n name,\n amount: parseInt(amount)\n })),\n additional_service_ids: currentAdditionalServiceIds\n }\n };\n\n const response = await fetch(url, {\n method: \"PUT\",\n headers: formHeaders(),\n body: JSON.stringify(requestBody)\n });\n\n if (!response.ok) {\n const json = await response.json();\n popup.show(\n `Something went wrong: \\n ${response.status} ${response.statusText} \\n ${json}`,\n { type: \"error\" }\n );\n }\n\n if (response.ok) {\n popup.show(\"Workflow successfully updated\", { type: \"success\" });\n }\n } catch (error) {\n popup.show(error.message, { type: \"error\" });\n } finally {\n setLoading(false);\n setUpdateBaseFees(false);\n }\n };\n\n useDidMountEffect(() => {\n if (updateBaseFees) updateWorkflow();\n }, [updateBaseFees]);\n\n return (\n
\n

{workflow.name}

\n {additionalServices.length > 0 && (\n Base price: {totalPrice()}\n )}\n

Base Fees

\n {currentBaseFees.length > 0 && (\n \n \n \n \n \n \n
NameAmount\n \n {currentBaseFees.map(bf => (\n \n ))}\n
\n )}\n {!baseFeeFormVisible && (\n setBaseFeeFormVisible(true)}\n disabled={!hasEngAccess}\n style={{ cursor: !hasEngAccess ? \"not-allowed\" : \"pointer\" }}\n >\n Add new fee\n \n )}\n {baseFeeFormVisible && (\n \n handleBaseFeeFormChange(e)}\n />\n
\n $\n handleBaseFeeFormChange(e)}\n />\n
\n
\n setBaseFeeFormVisible(false)}\n >\n Cancel\n \n createBaseFee()}\n >\n Save\n \n
\n
\n )}\n

Additional Services

\n ({\n ...base,\n backgroundColor: gold\n }),\n multiValueLabel: base => ({\n ...base,\n backgroundColor: gold\n })\n }}\n placeholder=\"Add additional services...\"\n isMulti\n options={serviceOptions}\n className=\"additional-services-select\"\n classNamePrefix=\"additional-service\"\n defaultValue={defaultOptions}\n onChange={values => handleServicesSelect(values)}\n />\n {!loading && (\n
\n updateWorkflow()}\n disabled={!hasEngAccess}\n style={{ cursor: !hasEngAccess ? \"not-allowed\" : \"pointer\" }}\n >\n Save\n \n
\n )}\n {loading && (\n \n )}\n
\n );\n}\n\nWorkflowDetails.propTypes = {\n workflow: PropTypes.object\n};\n","import React, { useState } from \"react\";\nimport PropTypes from \"prop-types\";\nimport styled from \"styled-components\";\nimport { IndexRow } from \"../../Shared/IndexRow/IndexRow\";\nimport { useDidMountEffect } from \"../../../hooks/useDidMountEffect\";\n\nconst Input = styled.input`\n border: none;\n width: ${props => props.width ?? \"auto\"};\n cursor: ${props => (props.disabled ? \"not-allowed\" : \"auto\")};\n`;\n\nexport default function BaseFeeRow(props) {\n const {\n baseFee,\n setCurrentBaseFees,\n setUpdateBaseFees,\n hasEngAccess\n } = props;\n const [currentBaseFee, setCurrentBaseFee] = useState({\n ...baseFee,\n amount: baseFee.amount\n });\n\n const deleteBaseFee = async () => {\n setCurrentBaseFees(prevFees =>\n prevFees.filter(fee => fee.tempId !== currentBaseFee.tempId)\n );\n setUpdateBaseFees(true);\n };\n\n const handleDelete = () =>\n // eslint-disable-next-line no-restricted-globals\n confirm(\n \"Are you sure you want to delete this service? This cannot be undone.\"\n ) && deleteBaseFee();\n\n const handleBaseFeeChange = e => {\n if (e.target.name === \"amount\") {\n setCurrentBaseFee({\n ...currentBaseFee,\n [e.target.name]: e.target.value * 100\n });\n } else {\n setCurrentBaseFee({\n ...currentBaseFee,\n [e.target.name]: e.target.value\n });\n }\n };\n\n useDidMountEffect(\n () =>\n setCurrentBaseFees(prevFees =>\n prevFees.map(fee =>\n fee.tempId === currentBaseFee.tempId ? currentBaseFee : fee\n )\n ),\n [currentBaseFee]\n );\n\n return (\n \n \n handleBaseFeeChange(e)}\n style={{ fontWeight: 600 }}\n disabled={!hasEngAccess}\n />\n \n \n $\n handleBaseFeeChange(e)}\n disabled={!hasEngAccess}\n />\n \n \n handleDelete()}\n onKeyDown={() => handleDelete()}\n disabled={!hasEngAccess}\n style={{ cursor: !hasEngAccess ? \"not-allowed\" : \"pointer\" }}\n >\n DELETE\n \n \n \n );\n}\n\nBaseFeeRow.propTypes = {\n baseFee: PropTypes.object\n};\n","/* eslint-disable jsx-a11y/click-events-have-key-events */\n/* eslint-disable jsx-a11y/no-static-element-interactions */\nimport React, { useEffect, useState } from \"react\";\nimport styled from \"styled-components\";\nimport PropTypes from \"prop-types\";\nimport DealRow from \"../DealRow/DealRow\";\nimport { usePagination } from \"../../../../hooks/usePagination\";\nimport { IndexRow } from \"../../../Shared/IndexRow/IndexRow\";\nimport { PaginationWidget } from \"../../../Shared/PaginationWidget/PaginationWidget\";\nimport { useDidMountEffect } from \"../../../../hooks/useDidMountEffect\";\nimport {\n alphabeticalSort,\n chronologicalSort,\n numericalSort\n} from \"../../../../utils/sorting\";\n\nconst IndexGrid = styled.div`\n display: grid;\n`;\n\nexport default function DealsTable(props) {\n const {\n groupName,\n dealGroup,\n maxPerPage = 10,\n setDealsState,\n searchString\n } = props;\n\n const [showingAll, setShowingAll] = useState(false);\n const [sortBy, setSortBy] = useState({\n attribute: \"updatedAt\",\n ascending: true\n });\n\n const handleSort = attribute => {\n setSortBy(prevState => ({\n attribute,\n ascending: prevState.attribute === attribute ? !sortBy.ascending : true\n }));\n };\n\n const currentSortFunction = (a, b) => {\n switch (sortBy.attribute) {\n case \"beneficiaryName\":\n return alphabeticalSort(\n a.dealBeneficiaries[0],\n b.dealBeneficiaries[0],\n sortBy.ascending\n );\n case \"authorName\":\n return alphabeticalSort(\n a.author.fullName,\n b.author.fullName,\n sortBy.ascending\n );\n case \"state\":\n return alphabeticalSort(a.state, b.state, sortBy.ascending);\n case \"total\":\n return numericalSort(\n a.finalPriceData.pay_total,\n b.finalPriceData.pay_total,\n sortBy.ascending\n );\n case \"updatedAt\":\n return chronologicalSort(a.updatedAt, b.updatedAt, sortBy.ascending);\n // By default deals will be sorted by last updated\n default:\n return chronologicalSort(a.updatedAt, b.updatedAt, sortBy.ascending);\n }\n };\n\n const currentSortArrow = attribute => {\n if (sortBy.attribute === attribute && sortBy.ascending) return \"↑\";\n if (sortBy.attribute === attribute && !sortBy.ascending) return \"↓\";\n };\n\n const sortedDealGroup = dealGroup.sort((a, b) => currentSortFunction(a, b));\n\n const {\n nextPage,\n prevPage,\n currentPage,\n maxPage,\n showAll,\n setCurrentPage,\n repaginate,\n currentData,\n startIndex,\n endIndex\n } = usePagination(sortedDealGroup, maxPerPage);\n\n useDidMountEffect(() => {\n setCurrentPage(1);\n }, [searchString]);\n\n const handleShowAllClick = () => {\n window.location = `#${groupName.toLowerCase().replace(/\\s/g, \"\")}`;\n window.scrollBy(0, -70);\n showAll();\n setShowingAll(true);\n };\n\n const handleRepaginateClick = () => {\n window.history.pushState(\n \"\",\n document.title,\n window.location.pathname + window.location.search\n );\n repaginate();\n setShowingAll(false);\n };\n\n return (\n <>\n {dealGroup.length === 0 &&

No results found...

}\n {dealGroup.length > 0 && (\n \n

{`${startIndex} - ${endIndex} of ${dealGroup.length}`}

\n {dealGroup.length > maxPerPage && (\n
\n {!showingAll && (\n handleShowAllClick()}>\n Show all\n \n )}\n {showingAll && (\n handleRepaginateClick()}>Back to page view\n )}\n
\n )}\n {dealGroup.length > maxPerPage && (\n
\n prevPage()}\n className=\"fas fa-chevron-left\"\n />\n nextPage()}\n className=\"fas fa-chevron-right\"\n />\n
\n )}\n \n )}\n \n {dealGroup.length > 0 && (\n \n handleSort(\"beneficiaryName\")}\n >\n Beneficiary Information {currentSortArrow(\"beneficiaryName\")}\n \n handleSort(\"authorName\")}\n >\n Account Executive {currentSortArrow(\"authorName\")}\n \n
handleSort(\"total\")}>\n Total {currentSortArrow(\"total\")}\n
\n
handleSort(\"state\")}>\n Status {currentSortArrow(\"state\")}\n
\n handleSort(\"updatedAt\")}\n >\n Last modified {currentSortArrow(\"updatedAt\")}\n \n
\n )}\n {currentData().map(deal => (\n \n ))}\n
\n \n );\n}\n\nDealsTable.propTypes = {\n groupName: PropTypes.string,\n dealGroup: PropTypes.array,\n maxPerPage: PropTypes.number,\n setDealsState: PropTypes.func\n};\n","import React, { useState } from \"react\";\nimport styled from \"styled-components\";\nimport { BrowserRouter as Router } from \"react-router-dom\";\nimport { grayLighter } from \"../../styles/colors\";\nimport DataProvider from \"./DataProvider\";\n\nconst Container = styled.div`\n margin-top: 1rem;\n width: 100%;\n`;\n\nexport default function SalesFlow() {\n document.body.style.backgroundColor = grayLighter;\n\n const baseUrl = \"/sales\";\n\n // Current server state\n const [deal, setDeal] = useState({});\n\n return (\n \n \n \n \n \n );\n}\n","import React from \"react\";\nimport { Provider as AlertProvider, positions } from \"react-alert\";\nimport AlertTemplate from \"../Shared/AlertTemplate\";\nimport SalesFlow from \"./SalesFlow\";\nimport { AuthContextProvider } from \"../Shared/ContextProviders/AuthProvider\";\n\nconst options = {\n position: positions.TOP_RIGHT,\n timeout: 3500,\n offset: \"30px\"\n // you can also just use 'scale'\n};\n\nexport default function SalesFlowWrapper(props) {\n return (\n \n \n \n \n \n );\n}\n\nSalesFlowWrapper.propTypes = {};\n","import { render } from \"@testing-library/react\";\nimport AdditionalServiceSelect from \"./AdditionalServiceSelect\";\n\ndescribe(\"The AdditionalServiceSelect component\", () => {\n it(\"renders without crashing\", () => {\n const { container } = render();\n expect(container);\n });\n});\n","import { render, waitFor, fireEvent } from \"@testing-library/react\";\nimport { Provider as AlertProvider } from \"react-alert\";\nimport { BrowserRouter as Router } from \"react-router-dom\";\nimport BeneficiariesStep from \"./BeneficiariesStep\";\nimport AlertTemplate from \"../../Shared/AlertTemplate\";\nimport {\n mockOrganizationPeople,\n mockWorkflowsWithFees\n} from \"../../../testHelpers/salesFlowMocks\";\nimport { FormContextProvider } from \"../FormStateProvider\";\n\ndescribe(\"The BeneficiariesStep component\", () => {\n it(\"renders without crashing and does not make a fetch on initial render\", async () => {\n const { container, getByText } = render(\n // need to wrap with the alert provider for popups\n \n \n \n \n \n \n \n );\n expect(fetch.mock.calls.length).toEqual(0);\n await waitFor(() => {\n expect(container);\n expect(getByText(\"Choose beneficiaries\"));\n });\n });\n it(\"allows the user to select from a list or organization people\", async () => {\n const { getByText } = render(\n // need to wrap with the alert provider for popups\n \n \n \n \n \n \n \n );\n await waitFor(() => {\n expect(getByText(\"Homer Simpson\"));\n expect(getByText(\"Barney Gumble\"));\n });\n fireEvent.click(getByText(\"Homer Simpson\"));\n expect(getByText(\"First Visa\"));\n });\n it(\"does not let the user continue until there is a valid bundle\", async () => {\n const { getByText, getByTestId } = render(\n // need to wrap with the alert provider for popups\n \n \n \n \n \n \n \n );\n\n await waitFor(() => expect(getByText(\"Homer Simpson\")));\n\n expect(getByText(/Continue/i).closest(\"button\")).toHaveClass(\"disabled\");\n\n fireEvent.click(getByText(\"Homer Simpson\"));\n expect(getByText(\"First Visa\"));\n const workflowSelectDiv = getByTestId(\"workflow-select\");\n fireEvent.focus(workflowSelectDiv.querySelector(\"input\"));\n fireEvent.keyDown(workflowSelectDiv.querySelector(\"input\"), {\n key: \"ArrowDown\",\n code: 40\n });\n fireEvent.keyDown(workflowSelectDiv.querySelector(\"input\"), {\n key: \"Enter\",\n code: 13\n });\n\n expect(getByText(/Continue/i).closest(\"button\")).not.toHaveClass(\n \"disabled\"\n );\n });\n});\n","import { render, within, fireEvent, waitFor } from \"@testing-library/react\";\nimport { Provider as AlertProvider } from \"react-alert\";\nimport { Router } from \"react-router-dom\";\nimport { createMemoryHistory } from \"history\";\nimport DealIndexPage from \"./DealIndexPage\";\nimport { mockDeals } from \"../../../testHelpers/dealIndexMocks.new\";\nimport AlertTemplate from \"../../Shared/AlertTemplate\";\n\ndescribe(\"The DealIndexPage component\", () => {\n // fetch deals call on render\n beforeEach(() => {\n fetch.mockResponses([JSON.stringify({ deals: mockDeals })]);\n });\n\n afterEach(() => fetch.resetMocks());\n\n const history = createMemoryHistory();\n\n it(\"renders without crashing\", async () => {\n const { container, getAllByText } = render(\n \n \n \n \n \n );\n\n await waitFor(() => getAllByText(\"Drafts\")[0]);\n\n expect(fetch.mock.calls.length).toEqual(1);\n expect(container);\n });\n\n it(\"pulls down the deals from the server when rendered\", async () => {\n const { getByText } = render(\n \n \n \n \n \n );\n\n await waitFor(() => {\n expect(fetch.mock.calls.length).toEqual(1);\n getByText(\"Eric Cartman & 2 more\");\n });\n });\n\n it(\"sorts the deals within a section by 'last updated' by default\", async () => {\n const { getByTestId } = render(\n \n \n \n \n \n );\n\n await waitFor(() => {\n expect(fetch.mock.calls.length).toEqual(1);\n });\n\n const draftDealRows = within(getByTestId(\"Drafts\")).getAllByTestId(\n \"deal-row\"\n );\n\n await waitFor(() =>\n within(draftDealRows[0]).getByText(\"Eric Cartman & 2 more\")\n );\n\n const pendingDealRows = within(\n getByTestId(\"Payment Pending\")\n ).getAllByTestId(\"deal-row\");\n\n await waitFor(() => within(pendingDealRows[0]).getByText(\"Jarvis Witte\"));\n\n const inProgressDealRows = within(\n getByTestId(\"Payment in Progress\")\n ).getAllByTestId(\"deal-row\");\n await waitFor(() => within(inProgressDealRows[0]).getByText(\"Tiger Woods\"));\n });\n\n it(`sorts the deals chronologically in ascending order when clicking on \n date modified and in descending order on a second click`, async () => {\n const { getByTestId, getAllByTestId } = render(\n \n \n \n \n \n );\n\n await waitFor(() => {\n expect(fetch.mock.calls.length).toEqual(1);\n });\n\n fireEvent.click(getAllByTestId(\"deal-last-modified\")[0]);\n\n const draftDealRows = within(getByTestId(\"Drafts\")).getAllByTestId(\n \"deal-row\"\n );\n\n await waitFor(() => within(draftDealRows[0]).getByText(\"Randy Marsh\"));\n\n fireEvent.click(getAllByTestId(\"deal-last-modified\")[0]);\n\n const newDraftDealRows = within(getByTestId(\"Drafts\")).getAllByTestId(\n \"deal-row\"\n );\n\n await waitFor(() =>\n within(newDraftDealRows[0]).getByText(\"Eric Cartman & 2 more\")\n );\n });\n\n it(\"sorts the deals alphabetically by beneficiary name when clicking on 'deal'\", async () => {\n const { getByTestId, getAllByTestId } = render(\n \n \n \n \n \n );\n\n await waitFor(() => {\n expect(fetch.mock.calls.length).toEqual(1);\n });\n\n fireEvent.click(getAllByTestId(\"deal\")[0]);\n const draftDealRows = within(getByTestId(\"Drafts\")).getAllByTestId(\n \"deal-row\"\n );\n await waitFor(() =>\n within(draftDealRows[0]).getByText(\"Aaalphonse Mephesto\")\n );\n\n fireEvent.click(getAllByTestId(\"deal\")[0]);\n const newDraftDealRows = within(getByTestId(\"Drafts\")).getAllByTestId(\n \"deal-row\"\n );\n await waitFor(() => within(newDraftDealRows[0]).getByText(\"Zz Top\"));\n });\n\n it(\"displays the appropriate search results when typing in the search bar\", async () => {\n const { getByTestId, getAllByTestId } = render(\n \n \n \n \n \n );\n\n await waitFor(() => {\n expect(fetch.mock.calls.length).toEqual(1);\n });\n\n fireEvent.click(getAllByTestId(\"next-page\")[0]);\n fireEvent.click(getAllByTestId(\"next-page\")[0]);\n fireEvent.click(getAllByTestId(\"prev-page\")[0]);\n\n fireEvent.change(getByTestId(\"deal-index-searchbar\"), {\n target: { value: \"Chef Hayes\" }\n });\n\n await waitFor(() =>\n within(getAllByTestId(\"deal-row\")[0]).getByText(\"Chef Hayes\")\n );\n });\n});\n","import { render } from \"@testing-library/react\";\nimport { Provider as AlertProvider } from \"react-alert\";\nimport DealRow from \"./DealRow\";\nimport { mockDeals } from \"../../../../testHelpers/dealIndexMocks\";\nimport AlertTemplate from \"../../../Shared/AlertTemplate\";\n\ndescribe(\"The Deal component\", () => {\n it(\"renders without crashing\", () => {\n const { container } = render(\n \n \n \n );\n expect(container);\n });\n\n it(\"displays the billing person full name and organization display name\", () => {\n const { getByText } = render(\n \n \n \n );\n expect(getByText(\"Some Dude & 2 more\"));\n expect(getByText(\"Springfield parents assoc\"));\n });\n\n it(\"displays the final price pay total if it is present\", () => {\n const { getByText } = render(\n \n \n \n );\n expect(getByText(\"$9,937\"));\n });\n\n it(\"does not display the final price total if it is missing\", () => {\n const { getByText } = render(\n \n \n \n );\n expect(getByText(\"-\"));\n });\n\n describe(\"state\", () => {\n it(\"displays a friendly name for the draft deal state\", () => {\n const deal = mockDeals[0];\n deal.state = \"draft\";\n\n const { getByText } = render(\n \n \n \n );\n\n expect(getByText(\"Draft\"));\n });\n\n it(\"displays a friendly name for the submitted deal state\", () => {\n const deal = mockDeals[0];\n deal.state = \"submitted\";\n\n const { getByText } = render(\n \n \n \n );\n\n expect(getByText(\"Pending\"));\n });\n\n it(\"displays a friendly name for the active deal state\", () => {\n const deal = mockDeals[0];\n deal.state = \"active\";\n const { getByText } = render(\n \n \n \n );\n\n expect(getByText(\"Payments in progress\"));\n });\n });\n});\n","import { render, waitFor } from \"@testing-library/react\";\nimport { Provider as AlertProvider } from \"react-alert\";\nimport { BrowserRouter as Router } from \"react-router-dom\";\nimport DealShowPage from \"./DealShowPage\";\nimport { mockDeals } from \"../../../testHelpers/dealIndexMocks\";\nimport { mockUser } from \"../../../testHelpers/userMocks\";\nimport AlertTemplate from \"../../Shared/AlertTemplate\";\n\ndescribe(\"The DealShowPage component\", () => {\n // fetch deals call on render\n beforeEach(() => {\n fetch.mockResponses([JSON.stringify(mockUser), { status: 200 }]);\n });\n\n afterEach(() => fetch.resetMocks());\n\n it(\"renders without crashing\", async () => {\n const { container, getByText } = render(\n \n \n \n \n \n );\n\n expect(fetch.mock.calls.length).toEqual(1);\n expect(container);\n });\n\n describe(\"actions and status\", () => {\n it(\"displays a the finalize and submit link for a draft deal state\", () => {\n const deal = mockDeals[2];\n deal.state = \"draft\";\n\n const { getByText, queryByText } = render(\n \n \n \n \n \n );\n\n expect(getByText(\"This is a draft.\"));\n expect(getByText(\"Finalize and submit package.\"));\n expect(getByText(\"Archive this deal\"));\n expect(queryByText(\"No actions available\")).not.toBeInTheDocument();\n });\n\n it(\"displays the unarchive link for an archived deal\", () => {\n const deal = mockDeals[2];\n deal.state = \"draft\";\n deal.archived = true;\n\n const { getByText } = render(\n \n \n \n \n \n );\n\n expect(getByText(\"Unarchive this deal\"));\n });\n\n it(\"displays the status and edit link for the submitted deal state\", () => {\n const deal = mockDeals[2];\n deal.state = \"submitted\";\n deal.archived = false;\n\n const { getByText, queryByText } = render(\n \n \n \n \n \n );\n\n expect(getByText(\"Payment not yet received\"));\n expect(getByText(\"Edit deal\"));\n expect(queryByText(\"No actions available\")).not.toBeInTheDocument();\n });\n\n it(\"displays a friendly name for the active deal state\", () => {\n const deal = mockDeals[2];\n deal.state = \"active\";\n const { getByText, queryByText } = render(\n \n \n \n \n \n );\n\n expect(queryByText(\"Edit deal\")).not.toBeInTheDocument();\n expect(getByText(\"Payments in progress\"));\n expect(queryByText(\"No actions available\"));\n });\n });\n});\n","import React, { useState } from \"react\";\nimport PropTypes, { object } from \"prop-types\";\nimport styled from \"styled-components\";\nimport Collapse from \"react-css-collapse\";\nimport { formatCentsToCurrency } from \"../../../utils/numberHelpers\";\nimport { grayDark, grayDarker, white, grayLight } from \"../../../styles/colors\";\n\nconst DiscountsBox = styled.div`\n margin-top: 3rem;\n width: 23rem;\n background: ${white};\n border: 1px solid ${grayLight};\n border-radius: 6px;\n padding: 1rem;\n p {\n margin: 0;\n }\n`;\n\nconst DiscountRow = styled.div`\n display: flex;\n justify-content: space-between;\n margin-left: 2rem;\n color: ${grayDark};\n p {\n font-size: 14px;\n }\n`;\n\nexport default function DiscountsDetails(props) {\n const { discountsTotal, dealDiscounts } = props;\n\n const [dropdownOpen, setDropdownOpen] = useState(false);\n\n return (\n \n \n setDropdownOpen(!dropdownOpen)}\n onKeyDown={() => setDropdownOpen(!dropdownOpen)}\n >\n \n

Total Discounts

\n \n

-{formatCentsToCurrency(discountsTotal)}

\n \n \n {dealDiscounts.map((discount, i) => (\n \n

{discount.name}

\n

-{formatCentsToCurrency(discount.amount)}

\n
\n ))}\n
\n
\n );\n}\n\nDiscountsDetails.propTypes = {\n discountsTotal: PropTypes.number,\n dealDiscounts: PropTypes.arrayOf(object)\n};\n","import { render, within } from \"@testing-library/react\";\nimport { Provider as AlertProvider } from \"react-alert\";\nimport { BrowserRouter as Router } from \"react-router-dom\";\nimport AlertTemplate from \"../../Shared/AlertTemplate\";\nimport ReviewStep from \"./ReviewStep\";\nimport {\n fullDealMock,\n mockWorkflowsWithFees\n} from \"../../../testHelpers/salesFlowMocks\";\n\ndescribe(\"The ReviewStep component\", () => {\n it(\"renders without crashing\", () => {\n const { container } = render(\n \n \n \n \n \n );\n expect(container);\n });\n\n it(\"displays the correct data given a deal object\", () => {\n const { getByTestId } = render(\n \n \n \n \n \n );\n const petitionerInformationDiv = getByTestId(\n \"petitioner-information-section\"\n );\n within(petitionerInformationDiv).getByText(\"Bigco\");\n\n const beneficiaryAndVisaDiv = getByTestId(\"beneficiary-visas-section\");\n\n within(beneficiaryAndVisaDiv).queryAllByText(\"John Deer\");\n within(beneficiaryAndVisaDiv).getByText(\"E-2\");\n within(beneficiaryAndVisaDiv).queryAllByText(\"jdeer@gmail.com\");\n });\n});\n","import { render } from \"@testing-library/react\";\nimport RunningTotal from \"./RunningTotal\";\nimport {\n mockWorkflowsWithFees,\n mockPetitionBundles\n} from \"../../../testHelpers/salesFlowMocks\";\n\ndescribe(\"The RunningTotal component\", () => {\n it(\"renders without crashing\", () => {\n const { container } = render();\n expect(container);\n });\n\n it(\"displays the correct information when given an array of petition bundles\", () => {\n const { getByText } = render(\n \n );\n expect(getByText(\"EB-1A\"));\n expect(getByText(\"$10,700\"));\n\n expect(getByText(\"H-1B\"));\n expect(getByText(\"$7,760\"));\n expect(getByText(\"Guaranteed approval\"));\n expect(getByText(\"$1,500\"));\n expect(getByText(\"Additional press\"));\n expect(getByText(\"$750\"));\n\n expect(getByText(\"Pay Total\"));\n expect(getByText(\"$18,460\"));\n });\n});\n","import { render, fireEvent, waitFor } from \"@testing-library/react\";\nimport SalesFlowWrapper from \"./SalesFlowWrapper\";\nimport {\n mockOrganizationItems,\n mockWorkflows\n} from \"../../testHelpers/salesFlowMocks\";\nimport { mockUser } from \"../../testHelpers/userMocks\";\n\ndescribe(\"The Salesflow Petitioner Step\", () => {\n const petitionerPlaceholderText =\n \"Choose an organization or enter a new one...\";\n\n beforeEach(() => {\n fetch.mockResponses(\n [JSON.stringify(mockUser), { status: 200 }],\n [JSON.stringify(mockWorkflows), { status: 200 }]\n );\n });\n afterEach(() => fetch.resetMocks());\n\n it(\"renders without crashing\", async () => {\n const { container } = render();\n await waitFor(() => expect(fetch.mock.calls.length).toEqual(5));\n expect(container);\n });\n\n it(\"allows the user to enter in a new petitioner organization\", async () => {\n const { getByText, getByPlaceholderText } = render();\n await waitFor(() => getByText(\"Sales\"));\n fireEvent.click(getByText(\"New Deal\"));\n await waitFor(() => getByPlaceholderText(petitionerPlaceholderText));\n fireEvent.change(getByPlaceholderText(petitionerPlaceholderText), {\n target: { value: \"JumboCorp\" }\n });\n await waitFor(() =>\n expect(getByPlaceholderText(petitionerPlaceholderText).value).toBe(\n \"JumboCorp\"\n )\n );\n });\n\n it(\"allows the user to select from an existing organization via autocomplete\", async () => {\n fetch.once(JSON.stringify(mockOrganizationItems));\n const { getByPlaceholderText, getByText } = render();\n await waitFor(() => getByPlaceholderText(petitionerPlaceholderText));\n fireEvent.change(getByPlaceholderText(petitionerPlaceholderText), {\n target: { value: \"B\" }\n });\n // labels use tags to emphasise matching search characters\n expect(getByText(\"B\"));\n expect(getByText(\"igco\"));\n });\n\n it(\"cannot navigate to the beneficiaries/visa step without a deal in state\", async () => {\n const { getByPlaceholderText, getByText } = render();\n await waitFor(() => getByPlaceholderText(petitionerPlaceholderText));\n fireEvent.click(getByText(\"Continue\"));\n expect(getByText(\"Petitioner Information\"));\n });\n\n it(\"allows the user to enter in a new petitioner organization\", async () => {\n const { getByPlaceholderText } = render();\n await waitFor(() => getByPlaceholderText(petitionerPlaceholderText));\n fireEvent.change(getByPlaceholderText(petitionerPlaceholderText), {\n target: { value: \"JumboCorp\" }\n });\n await waitFor(() =>\n expect(getByPlaceholderText(petitionerPlaceholderText).value).toBe(\n \"JumboCorp\"\n )\n );\n });\n\n it(\"allows the user to continue and hits the API when there is a Petitioner in state\", async () => {\n fetch.once(JSON.stringify(mockOrganizationItems));\n const { getByPlaceholderText, getByText } = render();\n await waitFor(() => getByPlaceholderText(petitionerPlaceholderText));\n fireEvent.change(getByPlaceholderText(petitionerPlaceholderText), {\n target: { value: \"B\" }\n });\n // labels use tags to emphasise matching search characters\n expect(getByText(\"B\"));\n expect(getByText(\"igco\"));\n fireEvent.click(getByText(\"igco\"));\n fireEvent.click(getByText(\"Continue\"));\n await waitFor(() => {\n expect(getByText(\"Beneficiaries & Visas\")[1]);\n });\n });\n});\n","import styled from \"styled-components\";\nimport { grayDark } from \"../../../styles/colors\";\n\nexport const Section = styled.div`\n display: flex;\n justify-content: space-between;\n align-items: center;\n margin-bottom: 1rem;\n\n h3 {\n font-weight: 400;\n font-size: 21px;\n margin: 0;\n }\n\n h4 {\n font-weight: 400;\n font-size: 18px;\n margin: 0.5rem 0;\n }\n\n p {\n color: ${grayDark};\n }\n\n a {\n text-decoration: underline;\n margin: 0.5rem 0;\n }\n`;\n","import React, { createContext, useState, useContext } from \"react\";\n\nconst FormContext = createContext(null);\n\nexport const useFormState = () => {\n const formContextState = useContext(FormContext);\n\n if (formContextState === null) {\n throw new Error(\n \"useFormState must be used within a FormContext.Provider tag\"\n );\n }\n return formContextState;\n};\n\nexport const FormContextProvider = ({ children }) => {\n const [state, setState] = useState({ dirty: false });\n return (\n \n {children}\n \n );\n};\n","import React from \"react\";\nimport PropTypes from \"prop-types\";\nimport styled from \"styled-components\";\nimport { Link } from \"react-router-dom\";\nimport Loader from \"react-loader-spinner\";\nimport { gray } from \"../../styles/colors\";\n\nconst Main = styled.div`\n border-top: 1px solid ${gray};\n display: flex;\n justify-content: space-between;\n align-items: center;\n padding: 1rem 0;\n\n button {\n margin-top: 0.5rem;\n }\n`;\n\nexport default function ActionFrame(props) {\n const {\n loading = false,\n continueDisabled,\n stepsArray,\n currentStep,\n continueButtonText = \"Continue\",\n lastStepText,\n handleContinue\n } = props;\n\n const currentStepIndex = stepsArray.indexOf(currentStep);\n const nextStep = () => stepsArray[currentStepIndex + 1];\n const prevStep = () => stepsArray[currentStepIndex - 1];\n\n return (\n
\n {currentStepIndex > 1 && (\n \n

Back

\n \n )}\n
\n
\n {loading && (\n \n )}\n {!loading && (\n <>\n {nextStep() && Next: {nextStep().description}}\n {!nextStep() && {lastStepText}}\n handleContinue()}\n disabled={continueDisabled}\n >\n {continueButtonText}\n \n \n )}\n
\n
\n );\n}\n\nActionFrame.propTypes = {\n stepsArray: PropTypes.array,\n currentStep: PropTypes.object,\n continueButtonText: PropTypes.string,\n lastStepText: PropTypes.string\n};\n","import React, { useEffect } from \"react\";\nimport PropTypes from \"prop-types\";\nimport styled from \"styled-components\";\nimport { green } from \"../../../styles/colors\";\nimport { formatCentsToCurrency } from \"../../../utils/numberHelpers\";\nimport { uniqueArrayByProp } from \"../../../utils/arrayMethods\";\n\nconst Container = styled.div`\n position: sticky;\n top: 25px;\n bottom: 25px;\n width: 20vw;\n border-radius: 2px;\n background-color: white;\n padding: 1rem 1rem 1.5rem 1rem;\n text-align: left;\n box-shadow: 0px 2px 7px rgba(0, 0, 0, 0.2);\n min-width: 16rem;\n\n h4,\n h5 {\n margin: 0;\n }\n`;\n\nconst LineItem = styled.div`\n display: flex;\n justify-content: space-between;\n align-items: center;\n p {\n margin: 0;\n font-size: 12px;\n }\n .custom-discount-line-item {\n margin-right: 2rem;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n }\n`;\n\nexport default function RunningTotal(props) {\n const {\n petitionBundles = [],\n discounts = [],\n workflows = [],\n selectedPlan,\n setPayTotal\n } = props;\n\n const queryWorkflowById = workflowId => {\n if (workflowId) {\n const { totalBaseFees, name: workflowName } = workflows.find(\n wf => wf.id === workflowId\n );\n return [totalBaseFees, workflowName];\n }\n };\n\n const queryAdditionalServiceById = serviceId => {\n const allAdditionalServices = [];\n workflows.forEach(wf => allAdditionalServices.push(wf.additionalServices));\n const uniqueServices = uniqueArrayByProp(\n \"id\",\n allAdditionalServices.flat()\n );\n const { name: serviceName, amount: serviceAmount } = uniqueServices.find(\n as => as.id === serviceId\n );\n return [serviceName, serviceAmount];\n };\n\n const totalPrice = petitionBundles.reduce((total, currentBundle) => {\n if (currentBundle.workflowId || currentBundle.petition?.workflow.id) {\n const [totalBaseFees] = queryWorkflowById(\n currentBundle.workflowId ?? currentBundle.petition?.workflow.id\n );\n const totalAdditionalServiceFees = currentBundle.additionalServiceIds.reduce(\n (totalServiceFees, currentServiceId) => {\n const [, serviceAmount] = queryAdditionalServiceById(\n currentServiceId\n );\n return totalServiceFees + serviceAmount;\n },\n 0\n );\n return total + totalBaseFees + totalAdditionalServiceFees;\n }\n return total;\n }, 0);\n\n const totalDiscounts = discounts.reduce(\n (total, currentValue) => total + currentValue.amount,\n 0\n );\n\n useEffect(() => {\n if (setPayTotal) setPayTotal(totalPrice - totalDiscounts);\n }, [totalPrice, totalDiscounts]);\n\n return (\n \n

Summary

\n {petitionBundles.map(bundle => {\n if (bundle.workflowId || bundle.petition?.workflow.id) {\n // necessary because workflowId is not on the bundle after the beneficiary step\n const idForQuery = bundle.workflowId ?? bundle.petition?.workflow.id;\n const [totalBaseFees, workflowName] = queryWorkflowById(idForQuery);\n const totalBundleAdditionalServiceFees = bundle.additionalServiceIds.reduce(\n (totalBundleServiceFees, currentServiceId) => {\n const [, serviceAmount] = queryAdditionalServiceById(\n currentServiceId\n );\n return totalBundleServiceFees + serviceAmount;\n },\n 0\n );\n\n return (\n \n \n
{workflowName}
\n
\n {formatCentsToCurrency(\n totalBaseFees + totalBundleAdditionalServiceFees\n )}\n
\n
\n {bundle.additionalServiceIds.map((serviceId, i) => {\n const [name, amount] = queryAdditionalServiceById(serviceId);\n return (\n \n

{name}

\n

{formatCentsToCurrency(amount)}

\n
\n );\n })}\n \n );\n }\n return
;\n })}\n {discounts.length > 0 && (\n <>\n \n
Discounts
\n
\n -{formatCentsToCurrency(totalDiscounts)}\n
\n
\n {discounts.map(discount => (\n \n

{discount.name}

\n

-{formatCentsToCurrency(discount.amount)}

\n
\n ))}\n \n )}\n
\n \n
1 ? { fontWeight: 400 } : null}>Pay Total
\n
1 ? { fontWeight: 400 } : null}>\n {formatCentsToCurrency(totalPrice - totalDiscounts)}\n
\n
\n {selectedPlan && selectedPlan > 1 && (\n <>\n \n

Over {selectedPlan} months

\n
\n
\n \n
First payment
\n
\n {formatCentsToCurrency(\n (totalPrice - totalDiscounts) / selectedPlan\n )}\n
\n
\n \n )}\n
\n );\n}\n\nRunningTotal.propTypes = {\n petitionBundles: PropTypes.array,\n discounts: PropTypes.array\n};\n"],"sourceRoot":""}