@unite-us/app-create-referral 0.15.59-alpha.4 → 0.15.59

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (292) hide show
  1. package/.github/CODEOWNERS +3 -0
  2. package/.github/pull_request_template.md +25 -0
  3. package/.github/workflows/quality.yml +44 -0
  4. package/.github/workflows/semantic-release.yml +26 -0
  5. package/.nvmrc +1 -0
  6. package/babel.config.js +11 -0
  7. package/config-overrides.js +8 -0
  8. package/dist/AppReferrals.js +45 -45
  9. package/dist/AppReferrals.js.map +1 -1
  10. package/dist/AppReferrals.test.js +71 -34
  11. package/dist/AppReferrals.test.js.map +1 -1
  12. package/dist/__testUtils__/mockData/components/mockAppReferrals.js +12 -13
  13. package/dist/__testUtils__/mockData/components/mockAppReferrals.js.map +1 -1
  14. package/dist/__testUtils__/mockData/mockCases.js +1 -1
  15. package/dist/__testUtils__/mockData/mockCases.js.map +1 -1
  16. package/dist/__testUtils__/mockData/mockClinicalModifications.js +3 -3
  17. package/dist/__testUtils__/mockData/mockClinicalModifications.js.map +1 -1
  18. package/dist/__testUtils__/mockData/mockEmployees.js +1 -1
  19. package/dist/__testUtils__/mockData/mockEmployees.js.map +1 -1
  20. package/dist/__testUtils__/mockData/mockEnums.js +1 -1
  21. package/dist/__testUtils__/mockData/mockEnums.js.map +1 -1
  22. package/dist/__testUtils__/mockData/mockFeeSchedulePrograms.js +1 -1
  23. package/dist/__testUtils__/mockData/mockFeeSchedulePrograms.js.map +1 -1
  24. package/dist/__testUtils__/mockData/mockFiles.js +1 -1
  25. package/dist/__testUtils__/mockData/mockFiles.js.map +1 -1
  26. package/dist/__testUtils__/mockData/mockFormSubmissions.js +1 -1
  27. package/dist/__testUtils__/mockData/mockFormSubmissions.js.map +1 -1
  28. package/dist/__testUtils__/mockData/mockFormUsages.js +1 -1
  29. package/dist/__testUtils__/mockData/mockFormUsages.js.map +1 -1
  30. package/dist/__testUtils__/mockData/mockForms.js +1 -1
  31. package/dist/__testUtils__/mockData/mockForms.js.map +1 -1
  32. package/dist/__testUtils__/mockData/mockInsurances.js +1 -1
  33. package/dist/__testUtils__/mockData/mockInsurances.js.map +1 -1
  34. package/dist/__testUtils__/mockData/mockNetworks.js +1 -1
  35. package/dist/__testUtils__/mockData/mockNetworks.js.map +1 -1
  36. package/dist/__testUtils__/mockData/mockPeople.js +1 -1
  37. package/dist/__testUtils__/mockData/mockPeople.js.map +1 -1
  38. package/dist/__testUtils__/mockData/mockPrograms.js +31 -31
  39. package/dist/__testUtils__/mockData/mockPrograms.js.map +1 -1
  40. package/dist/__testUtils__/mockData/mockProviders.js +21 -21
  41. package/dist/__testUtils__/mockData/mockProviders.js.map +1 -1
  42. package/dist/__testUtils__/mockData/mockReferrals.js +1 -1
  43. package/dist/__testUtils__/mockData/mockReferrals.js.map +1 -1
  44. package/dist/__testUtils__/mockData/mockServiceAuthorizations.js +1 -1
  45. package/dist/__testUtils__/mockData/mockServiceAuthorizations.js.map +1 -1
  46. package/dist/__testUtils__/mockData/mockServices.js +1 -1
  47. package/dist/__testUtils__/mockData/mockServices.js.map +1 -1
  48. package/dist/__testUtils__/mockData/mockUnlistedPrograms.js +1 -1
  49. package/dist/__testUtils__/mockData/mockUnlistedPrograms.js.map +1 -1
  50. package/dist/__testUtils__/mockData/utils.js +282 -218
  51. package/dist/__testUtils__/mockData/utils.js.map +1 -1
  52. package/dist/__testUtils__/mockServer/handlers.js +82 -80
  53. package/dist/__testUtils__/mockServer/handlers.js.map +1 -1
  54. package/dist/__testUtils__/mockServer/server.js +13 -7
  55. package/dist/__testUtils__/mockServer/server.js.map +1 -1
  56. package/dist/__testUtils__/test-utils.js +18 -22
  57. package/dist/__testUtils__/test-utils.js.map +1 -1
  58. package/dist/actions/Document/Contact/Group/fetchCaseDocuments.js +41 -10
  59. package/dist/actions/Document/Contact/Group/fetchCaseDocuments.js.map +1 -1
  60. package/dist/actions/Document/Contact/Group/fetchContactDocuments.js +41 -10
  61. package/dist/actions/Document/Contact/Group/fetchContactDocuments.js.map +1 -1
  62. package/dist/actions/Document/Contact/Group/fileUploadUtils.js +10 -8
  63. package/dist/actions/Document/Contact/Group/fileUploadUtils.js.map +1 -1
  64. package/dist/actions/Group/fetchCoreGroupForms.js +97 -46
  65. package/dist/actions/Group/fetchCoreGroupForms.js.map +1 -1
  66. package/dist/actions/Referral/cannotMoveToReferralReasons.js +21 -23
  67. package/dist/actions/Referral/cannotMoveToReferralReasons.js.map +1 -1
  68. package/dist/actions/Referral/fetchCoreServices.js +169 -70
  69. package/dist/actions/Referral/fetchCoreServices.js.map +1 -1
  70. package/dist/actions/Referral/fetchNetworks.js +44 -11
  71. package/dist/actions/Referral/fetchNetworks.js.map +1 -1
  72. package/dist/actions/Referral/fetchPrimaryWorkers.js +84 -51
  73. package/dist/actions/Referral/fetchPrimaryWorkers.js.map +1 -1
  74. package/dist/actions/Referral/removeReferralProgram.js +15 -10
  75. package/dist/actions/Referral/removeReferralProgram.js.map +1 -1
  76. package/dist/api/ApiHooks.js +39 -40
  77. package/dist/api/ApiHooks.js.map +1 -1
  78. package/dist/api/config.js +23 -20
  79. package/dist/api/config.js.map +1 -1
  80. package/dist/common/form/CurrencyField/index.js +21 -22
  81. package/dist/common/form/CurrencyField/index.js.map +1 -1
  82. package/dist/common/form/DocumentUploader/components/ContactDocumentsSelector.js +48 -51
  83. package/dist/common/form/DocumentUploader/components/ContactDocumentsSelector.js.map +1 -1
  84. package/dist/common/form/DocumentUploader/components/DocumentsListView.js +12 -14
  85. package/dist/common/form/DocumentUploader/components/DocumentsListView.js.map +1 -1
  86. package/dist/common/form/DocumentUploader/components/ListViewDocument.js +17 -21
  87. package/dist/common/form/DocumentUploader/components/ListViewDocument.js.map +1 -1
  88. package/dist/common/form/ErrorMessage/index.js +9 -17
  89. package/dist/common/form/ErrorMessage/index.js.map +1 -1
  90. package/dist/common/form/FileUploadV2/FileUpload.js +137 -159
  91. package/dist/common/form/FileUploadV2/FileUpload.js.map +1 -1
  92. package/dist/common/form/FileUploadV2/components/FilePreview.js +5 -8
  93. package/dist/common/form/FileUploadV2/components/FilePreview.js.map +1 -1
  94. package/dist/common/form/FileUploadV2/components/FilePreviewWrapper.js +21 -26
  95. package/dist/common/form/FileUploadV2/components/FilePreviewWrapper.js.map +1 -1
  96. package/dist/common/form/FormForm/index.js +194 -143
  97. package/dist/common/form/FormForm/index.js.map +1 -1
  98. package/dist/common/utils/utils.js +3 -3
  99. package/dist/common/utils/utils.js.map +1 -1
  100. package/dist/components/Card.js +8 -12
  101. package/dist/components/Card.js.map +1 -1
  102. package/dist/components/CreateReferralContainer.js +13 -21
  103. package/dist/components/CreateReferralContainer.js.map +1 -1
  104. package/dist/components/DollarAmount.js +14 -18
  105. package/dist/components/DollarAmount.js.map +1 -1
  106. package/dist/components/ExpandableButton.js +16 -21
  107. package/dist/components/ExpandableButton.js.map +1 -1
  108. package/dist/components/NavButtons.js +51 -57
  109. package/dist/components/NavButtons.js.map +1 -1
  110. package/dist/components/ReferralStepper.js +41 -44
  111. package/dist/components/ReferralStepper.js.map +1 -1
  112. package/dist/components/SearchableField.js +125 -121
  113. package/dist/components/SearchableField.js.map +1 -1
  114. package/dist/components/StepHeader.js +16 -25
  115. package/dist/components/StepHeader.js.map +1 -1
  116. package/dist/components/Stepper.js +51 -55
  117. package/dist/components/Stepper.js.map +1 -1
  118. package/dist/components/modal/Dialog.js +170 -141
  119. package/dist/components/modal/Dialog.js.map +1 -1
  120. package/dist/components/modal/Overlay.js +1 -2
  121. package/dist/components/modal/Overlay.js.map +1 -1
  122. package/dist/components/service_authorization/AuthorizationSpendCard.js +60 -72
  123. package/dist/components/service_authorization/AuthorizationSpendCard.js.map +1 -1
  124. package/dist/components/service_authorization/CapsInfo.js +120 -143
  125. package/dist/components/service_authorization/CapsInfo.js.map +1 -1
  126. package/dist/components/service_authorization/CaseStatus.js +14 -18
  127. package/dist/components/service_authorization/CaseStatus.js.map +1 -1
  128. package/dist/components/service_authorization/PreviousAuthorizationRequestsDetails.js +96 -121
  129. package/dist/components/service_authorization/PreviousAuthorizationRequestsDetails.js.map +1 -1
  130. package/dist/components/service_authorization/ReferralAuthSpendExpandable.js +43 -43
  131. package/dist/components/service_authorization/ReferralAuthSpendExpandable.js.map +1 -1
  132. package/dist/components/service_authorization/ReferralAuthorizationRequestSummary.js +65 -82
  133. package/dist/components/service_authorization/ReferralAuthorizationRequestSummary.js.map +1 -1
  134. package/dist/components/service_authorization/Spend.js +5 -10
  135. package/dist/components/service_authorization/Spend.js.map +1 -1
  136. package/dist/components/service_authorization/formatShortDate.js +6 -6
  137. package/dist/components/service_authorization/formatShortDate.js.map +1 -1
  138. package/dist/components/service_authorization/messageConstants.js +2 -2
  139. package/dist/components/service_authorization/messageConstants.js.map +1 -1
  140. package/dist/components/spinners/OverlaySpinner/OverlaySpinner.js +23 -34
  141. package/dist/components/spinners/OverlaySpinner/OverlaySpinner.js.map +1 -1
  142. package/dist/components/spinners/Spinner/Spinner.js +27 -33
  143. package/dist/components/spinners/Spinner/Spinner.js.map +1 -1
  144. package/dist/constants/enums.js +1 -1
  145. package/dist/constants/enums.js.map +1 -1
  146. package/dist/constants/eventConstants.js +48 -48
  147. package/dist/constants/eventConstants.js.map +1 -1
  148. package/dist/constants/findEnumDisplayName.js +3 -3
  149. package/dist/constants/findEnumDisplayName.js.map +1 -1
  150. package/dist/constants.js +6 -6
  151. package/dist/constants.js.map +1 -1
  152. package/dist/context/AppCreateReferralProvider.js +36 -25
  153. package/dist/context/AppCreateReferralProvider.js.map +1 -1
  154. package/dist/context/state.js +5 -2
  155. package/dist/context/state.js.map +1 -1
  156. package/dist/context/withAppCreateReferralContext.js +5 -9
  157. package/dist/context/withAppCreateReferralContext.js.map +1 -1
  158. package/dist/hooks/__tests__/useCreateReferrals.test.js +560 -456
  159. package/dist/hooks/__tests__/useCreateReferrals.test.js.map +1 -1
  160. package/dist/hooks/sendReferral.js +339 -155
  161. package/dist/hooks/sendReferral.js.map +1 -1
  162. package/dist/hooks/useClinicalModificationOptions.js +34 -24
  163. package/dist/hooks/useClinicalModificationOptions.js.map +1 -1
  164. package/dist/hooks/useCreateReferrals.js +722 -463
  165. package/dist/hooks/useCreateReferrals.js.map +1 -1
  166. package/dist/hooks/useCreateResourceList.js +76 -56
  167. package/dist/hooks/useCreateResourceList.js.map +1 -1
  168. package/dist/hooks/useCreateShareEvent.js +42 -18
  169. package/dist/hooks/useCreateShareEvent.js.map +1 -1
  170. package/dist/hooks/useForwardReferral.js +118 -78
  171. package/dist/hooks/useForwardReferral.js.map +1 -1
  172. package/dist/hooks/usePerson.js +49 -21
  173. package/dist/hooks/usePerson.js.map +1 -1
  174. package/dist/hooks/useUpdateResourceList.js +28 -34
  175. package/dist/hooks/useUpdateResourceList.js.map +1 -1
  176. package/dist/pages/builder/AboutGroupedReferralsModal.js +27 -48
  177. package/dist/pages/builder/AboutGroupedReferralsModal.js.map +1 -1
  178. package/dist/pages/builder/AuthorizationSubform.js +131 -143
  179. package/dist/pages/builder/AuthorizationSubform.js.map +1 -1
  180. package/dist/pages/builder/ChooseOneServiceTypeModal.js +53 -56
  181. package/dist/pages/builder/ChooseOneServiceTypeModal.js.map +1 -1
  182. package/dist/pages/builder/DetailsDrawer.js +72 -74
  183. package/dist/pages/builder/DetailsDrawer.js.map +1 -1
  184. package/dist/pages/builder/LineItem.js +25 -28
  185. package/dist/pages/builder/LineItem.js.map +1 -1
  186. package/dist/pages/builder/NoReferralsDisplay.js +29 -41
  187. package/dist/pages/builder/NoReferralsDisplay.js.map +1 -1
  188. package/dist/pages/builder/ProgramHeader.js +20 -33
  189. package/dist/pages/builder/ProgramHeader.js.map +1 -1
  190. package/dist/pages/builder/ProgramMenu.js +18 -19
  191. package/dist/pages/builder/ProgramMenu.js.map +1 -1
  192. package/dist/pages/builder/ReferralBuilder.js +443 -341
  193. package/dist/pages/builder/ReferralBuilder.js.map +1 -1
  194. package/dist/pages/builder/ReferralBuilderForm.js +392 -323
  195. package/dist/pages/builder/ReferralBuilderForm.js.map +1 -1
  196. package/dist/pages/builder/ReferralCard.js +99 -125
  197. package/dist/pages/builder/ReferralCard.js.map +1 -1
  198. package/dist/pages/builder/ReferralProgramCard.js +160 -109
  199. package/dist/pages/builder/ReferralProgramCard.js.map +1 -1
  200. package/dist/pages/builder/ReferralProgramMenu.js +116 -102
  201. package/dist/pages/builder/ReferralProgramMenu.js.map +1 -1
  202. package/dist/pages/builder/__tests__/AuthRequiredClinicalCodes.test.js +246 -99
  203. package/dist/pages/builder/__tests__/AuthRequiredClinicalCodes.test.js.map +1 -1
  204. package/dist/pages/builder/__tests__/AuthRequiredNonFundedPrograms.test.js +86 -48
  205. package/dist/pages/builder/__tests__/AuthRequiredNonFundedPrograms.test.js.map +1 -1
  206. package/dist/pages/builder/__tests__/AuthorizationRequiredPrograms.test.js +133 -74
  207. package/dist/pages/builder/__tests__/AuthorizationRequiredPrograms.test.js.map +1 -1
  208. package/dist/pages/builder/__tests__/NonSensitiveGroupedPrograms.test.js +1269 -674
  209. package/dist/pages/builder/__tests__/NonSensitiveGroupedPrograms.test.js.map +1 -1
  210. package/dist/pages/builder/__tests__/NonSensitiveSingleProgram.test.js +575 -305
  211. package/dist/pages/builder/__tests__/NonSensitiveSingleProgram.test.js.map +1 -1
  212. package/dist/pages/builder/__tests__/ReferralBuilder.test.js +45 -14
  213. package/dist/pages/builder/__tests__/ReferralBuilder.test.js.map +1 -1
  214. package/dist/pages/builder/__tests__/SensitiveProviderGroupedPrograms.test.js +815 -407
  215. package/dist/pages/builder/__tests__/SensitiveProviderGroupedPrograms.test.js.map +1 -1
  216. package/dist/pages/builder/__tests__/SensitiveServiceGroupedPrograms.test.js +254 -139
  217. package/dist/pages/builder/__tests__/SensitiveServiceGroupedPrograms.test.js.map +1 -1
  218. package/dist/pages/builder/__tests__/SensitiveServiceSensitiveProviderGroupedPrograms.test.js +518 -262
  219. package/dist/pages/builder/__tests__/SensitiveServiceSensitiveProviderGroupedPrograms.test.js.map +1 -1
  220. package/dist/pages/builder/__tests__/SensitiveSingleProgram.test.js +504 -273
  221. package/dist/pages/builder/__tests__/SensitiveSingleProgram.test.js.map +1 -1
  222. package/dist/pages/builder/buildDraftState.js +21 -21
  223. package/dist/pages/builder/buildDraftState.js.map +1 -1
  224. package/dist/pages/builder/buildGroupedReferrals.js +113 -80
  225. package/dist/pages/builder/buildGroupedReferrals.js.map +1 -1
  226. package/dist/pages/builder/constants.js +12 -12
  227. package/dist/pages/builder/constants.js.map +1 -1
  228. package/dist/pages/builder/formatProgramDetail.js +180 -152
  229. package/dist/pages/builder/formatProgramDetail.js.map +1 -1
  230. package/dist/pages/builder/useBuildReferrals.js +163 -95
  231. package/dist/pages/builder/useBuildReferrals.js.map +1 -1
  232. package/dist/pages/builder/utils.js +133 -84
  233. package/dist/pages/builder/utils.js.map +1 -1
  234. package/dist/pages/review/DeleteReferralModal.js +31 -45
  235. package/dist/pages/review/DeleteReferralModal.js.map +1 -1
  236. package/dist/pages/review/DropdownMultiplesReferrals.js +92 -75
  237. package/dist/pages/review/DropdownMultiplesReferrals.js.map +1 -1
  238. package/dist/pages/review/ReferralsSent.js +239 -200
  239. package/dist/pages/review/ReferralsSent.js.map +1 -1
  240. package/dist/pages/review/Review.js +554 -451
  241. package/dist/pages/review/Review.js.map +1 -1
  242. package/dist/pages/review/__tests__/CallbackNotifications.test.js +66 -46
  243. package/dist/pages/review/__tests__/CallbackNotifications.test.js.map +1 -1
  244. package/dist/pages/review/__tests__/ReferralsSent.test.js +349 -189
  245. package/dist/pages/review/__tests__/ReferralsSent.test.js.map +1 -1
  246. package/dist/pages/review/__tests__/Review.test.js +599 -380
  247. package/dist/pages/review/__tests__/Review.test.js.map +1 -1
  248. package/dist/pages/review/__tests__/data.js +5 -5
  249. package/dist/pages/review/__tests__/data.js.map +1 -1
  250. package/dist/pages/review/constants.js +5 -5
  251. package/dist/pages/review/constants.js.map +1 -1
  252. package/dist/pages/supporting-info/SupportingInfo.js +168 -123
  253. package/dist/pages/supporting-info/SupportingInfo.js.map +1 -1
  254. package/dist/pages/supporting-info/__tests__/SupportingInfo.test.js +164 -85
  255. package/dist/pages/supporting-info/__tests__/SupportingInfo.test.js.map +1 -1
  256. package/dist/pages/supporting-info/__tests__/data.js +1 -1
  257. package/dist/pages/supporting-info/__tests__/data.js.map +1 -1
  258. package/dist/reportWebVitals.js +7 -9
  259. package/dist/reportWebVitals.js.map +1 -1
  260. package/dist/setupTests.js +30 -8
  261. package/dist/setupTests.js.map +1 -1
  262. package/dist/utils/__tests__/canChangeHoldReason.test.js +23 -23
  263. package/dist/utils/__tests__/canChangeHoldReason.test.js.map +1 -1
  264. package/dist/utils/__tests__/checkRoles.test.js +10 -10
  265. package/dist/utils/__tests__/checkRoles.test.js.map +1 -1
  266. package/dist/utils/canAccept.js +9 -14
  267. package/dist/utils/canAccept.js.map +1 -1
  268. package/dist/utils/canChangeHoldReason.js +11 -16
  269. package/dist/utils/canChangeHoldReason.js.map +1 -1
  270. package/dist/utils/canHoldForReview.js +8 -13
  271. package/dist/utils/canHoldForReview.js.map +1 -1
  272. package/dist/utils/canReject.js +14 -21
  273. package/dist/utils/canReject.js.map +1 -1
  274. package/dist/utils/checkRoles.js +10 -10
  275. package/dist/utils/checkRoles.js.map +1 -1
  276. package/dist/utils/getProgramServicesPayload.js +20 -20
  277. package/dist/utils/getProgramServicesPayload.js.map +1 -1
  278. package/dist/utils/hasUserRole.js +8 -8
  279. package/dist/utils/hasUserRole.js.map +1 -1
  280. package/dist/utils/isReferralForwarded.js +2 -4
  281. package/dist/utils/isReferralForwarded.js.map +1 -1
  282. package/dist/utils/referralToConsent.js +19 -14
  283. package/dist/utils/referralToConsent.js.map +1 -1
  284. package/dist/utils/useDebounce.js +18 -7
  285. package/dist/utils/useDebounce.js.map +1 -1
  286. package/dist/utils/useFeatureFlag.js +1 -1
  287. package/dist/utils/useFeatureFlag.js.map +1 -1
  288. package/dist/utils/validateCostAmount.js +4 -4
  289. package/dist/utils/validateCostAmount.js.map +1 -1
  290. package/dist/utils/validateUnitAmount.js +4 -4
  291. package/dist/utils/validateUnitAmount.js.map +1 -1
  292. package/package.json +35 -65
@@ -1 +1 @@
1
- {"version":3,"file":"buildGroupedReferrals.js","names":["isEmpty","every","head","groupBy","flatMap","isUnlistedReferral","filterNetworks","programIsOffPlatform","programIsOnPlatform","OFF_PLATFORM_REFERRALS_ONLY","withPreventUngroup","fn","referral","prevent_ungroup","groupByNetworkImpl","networks","length","network","singleNetworkPrograms","programs","filter","program","_program$provider","provider","multipleNetworkPrograms","_program$provider2","noNetworkPrograms","_program$provider3","programsGroupedByNetworkId","sameNetworkReferrals","Object","values","map","_programs$0$provider","_objectSpread","multipleNetworkReferrals","noNetworkReferrals","groupByNetwork","groupByNetworkStatus","p","inNetworkPrograms","OONPrograms","groupBySensitivityImpl","_head","_p$provider","sensitive","sensitivePrograms","_p$provider2","nonSensitivePrograms","_p$provider3","nonSensitiveReferrals","groupBySensitivity","groupByCCImpl","_head2","_p$provider4","provider_type","ccPrograms","_p$provider5","nonCCPrograms","_p$provider6","nonCCReferrals","groupByCC","preventGroupingForSensitiveProvider","groupByFunded","fundedWithAuthorizationPrograms","_p$fee_schedule_progr","fee_schedule_program","authorization_required","fundedWithoutAuthorizationPrograms","_p$fee_schedule_progr2","programsGroupedByFeeSchedule","sameFeePrograms","sameFeeReferrals","nonAuthReferrals","ungroup","groupUnlistedProgramsToReferrals","referrals","unlistedReferrals","listedReferrals","forEach","id","includes","push","unlistedReferral","processReferral","foundReferral","find","_unlistedReferral$pro","_referral$programs$","services","service","status","toLowerCase","splice","updatedUnlistedReferrals","_unlistedReferral$pro2","buildGroupedReferrals","newReferrals","currentProvider","groupedReferrals","groupOperations","operation"],"sources":["../../../src/pages/builder/buildGroupedReferrals.js"],"sourcesContent":["import { isEmpty, every, head, groupBy, flatMap } from 'lodash';\nimport { isUnlistedReferral, filterNetworks, programIsOffPlatform, programIsOnPlatform } from './utils';\nimport { OFF_PLATFORM_REFERRALS_ONLY } from './constants';\n\n// Grouping Rules:\n// - On- and off-platform programs cannot be grouped\n// - Service must be the same\n// - Programs in coordination centers cannot be grouped\n// - Programs must be in the same network\n// - Programs in sensitive providers cannot be grouped\n// - Programs at the same provider cannot be grouped\n// - Users at sensitive providers cannot group programs\n// - Funded programs that require authroization with the same fee schedule program can be grouped\n// - Unlisted programs can only be grouped with programs in the same service and with off platform referrals\n\nconst withPreventUngroup = (fn) => (referral) => (\n referral.prevent_ungroup ? [referral] : fn(referral)\n);\n\nconst groupByNetworkImpl = (referral) => {\n const networks = filterNetworks(referral);\n // if there is only one possible network, set the referral's network and return the referral\n if (networks.length === 1 || isUnlistedReferral(referral)) {\n referral.network = head(networks);\n return [referral];\n }\n // if there is more than one possible network, divide the programs into multiple referrals:\n // referrals with programs in providers in a single network and\n // referrals with programs in providers in multiple networks\n // referrals with unlisted programs, don't have network\n const singleNetworkPrograms = referral.programs.filter(program => program.provider?.networks?.length === 1);\n const multipleNetworkPrograms = referral.programs.filter(program => program.provider?.networks?.length > 1);\n const noNetworkPrograms = referral.programs.filter(program => !program.provider?.networks?.length);\n // group single network programs by network id\n const programsGroupedByNetworkId = groupBy(singleNetworkPrograms, 'provider.networks[0].id');\n // create a grouped referral for programs with the same single network\n const sameNetworkReferrals = Object.values(programsGroupedByNetworkId).map(programs => ({\n ...referral,\n programs,\n network: head(programs[0].provider?.networks),\n }))\n // create separate referrals for each program with multiple networks\n const multipleNetworkReferrals = multipleNetworkPrograms.map(program => ({\n ...referral,\n programs: [program],\n network: head(networks),\n }))\n // create separate referrals for each program with no network\n const noNetworkReferrals = noNetworkPrograms.map(program => ({\n ...referral,\n programs: [program],\n }))\n\n return [...multipleNetworkReferrals, ...sameNetworkReferrals, ...noNetworkReferrals];\n}\n\nconst groupByNetwork = withPreventUngroup(groupByNetworkImpl);\n\nconst groupByNetworkStatus = (referral) => {\n if (referral.prevent_ungroup) {\n return [referral];\n }\n // if every program is on-platform or every programs is off-platform, return the referral\n if (every(referral.programs.map(p => programIsOnPlatform(p))) ||\n every(referral.programs.map(p => programIsOffPlatform(p)))) {\n return [referral];\n }\n // divide programs into on- and off-platform referrals\n const inNetworkPrograms = referral.programs.filter(p => programIsOnPlatform(p));\n const OONPrograms = referral.programs.filter(p => programIsOffPlatform(p));\n\n return [\n ...inNetworkPrograms.length ? [{ ...referral, programs: inNetworkPrograms }] : [],\n ...OONPrograms.length ? [{ ...referral, programs: OONPrograms }] : []\n ];\n}\n\nconst groupBySensitivityImpl = (referral) => {\n // if every program is non-sensitive or the referral contains only one sensitive program, return referral\n if (every(referral.programs.map(p => !p?.provider?.sensitive)) ||\n (referral.programs.length === 1 && head(referral.programs)?.provider?.sensitive)) {\n return [referral];\n }\n // create a new referral for each sensitive program\n const sensitivePrograms = referral.programs.filter(p => p?.provider?.sensitive).map(program => ({\n ...referral, programs: [program]\n }));\n // create a new referral for non-sensitive programs\n const nonSensitivePrograms = referral.programs.filter(p => !p?.provider?.sensitive);\n const nonSensitiveReferrals = !isEmpty(nonSensitivePrograms) ? [{ ...referral, programs: nonSensitivePrograms }] : [];\n\n return [...sensitivePrograms, ...nonSensitiveReferrals];\n}\n\nconst groupBySensitivity = withPreventUngroup(groupBySensitivityImpl);\n\nconst groupByCCImpl = (referral) => {\n // if no programs are in a coordination center or the referral contains only one program in a cc, return referral\n if (every(referral.programs.map(p => p?.provider?.provider_type !== 'coordination_center')) ||\n (referral.programs.length === 1 && head(referral.programs)?.provider?.provider_type === 'coordination_center')) {\n return [referral];\n }\n // create a new referral for each program in a cc\n const ccPrograms = referral.programs.filter(p => p?.provider?.provider_type === 'coordination_center')\n .map(program => ({\n ...referral, programs: [program]\n }));\n // create a new referral for programs not in a cc\n const nonCCPrograms = referral.programs.filter(p => p?.provider?.provider_type !== 'coordination_center');\n const nonCCReferrals = !isEmpty(nonCCPrograms) ? [{ ...referral, programs: nonCCPrograms }] : [];\n\n return [...ccPrograms, ...nonCCReferrals];\n}\n\nconst groupByCC = withPreventUngroup(groupByCCImpl);\n\nconst preventGroupingForSensitiveProvider = (referral) => {\n const networks = filterNetworks(referral);\n // if there is only one possible network, set the referral's network\n if (networks.length === 1) {\n referral.network = head(networks);\n }\n const { programs } = referral;\n return programs.length > 1 ?\n programs.map(program => ({ ...referral, programs: [program] })) :\n [referral];\n};\n\nconst groupByFunded = (referral) => {\n const networks = filterNetworks(referral);\n // if there is only one possible network, set the referral's network\n if (networks.length === 1) {\n referral.network = head(networks);\n }\n\n const fundedWithAuthorizationPrograms = referral.programs.filter(p => p.fee_schedule_program?.authorization_required);\n const fundedWithoutAuthorizationPrograms = referral.programs.filter(p => !p.fee_schedule_program?.authorization_required);\n\n const programsGroupedByFeeSchedule = groupBy(fundedWithAuthorizationPrograms, 'fee_schedule_program.id');\n const sameFeePrograms = Object.values(programsGroupedByFeeSchedule);\n\n // Create a new referral for each program with a shared fee schedule program\n const sameFeeReferrals = sameFeePrograms.map(program => ({\n ...referral,\n programs: program,\n ...(program.length >= 2 ? { prevent_ungroup: true } : {}) // A referral with two or more programs with the same fee schedule cannot be ungrouped\n }));\n\n // Create a new referral for programs without fee authorization required\n const nonAuthReferrals = !isEmpty(fundedWithoutAuthorizationPrograms) ? [{ ...referral, programs: fundedWithoutAuthorizationPrograms, ungroup: true }] : [];\n\n return [...nonAuthReferrals, ...sameFeeReferrals];\n};\n\nconst groupUnlistedProgramsToReferrals = (referrals) => {\n const unlistedReferrals = [], listedReferrals = [];\n\n referrals.forEach(referral => {\n if (every(referral.programs, p => p.id.includes('unlisted')))\n unlistedReferrals.push(referral);\n else\n listedReferrals.push(referral);\n });\n\n if (unlistedReferrals.length === 0) {\n return listedReferrals;\n }\n\n // Loop over the unlisted referrals, in case of a match, add the unlisted program to the referral \n // and remove it from the unlisted referral\n unlistedReferrals.forEach(unlistedReferral => {\n const processReferral = (referrals) => {\n // Find a referral with the same service and off-platform status\n const foundReferral = referrals.find(referral =>\n unlistedReferral.programs[0]?.services[0] === referral.service.id &&\n referral.programs[0]?.status?.toLowerCase() === OFF_PLATFORM_REFERRALS_ONLY\n );\n \n if (foundReferral) {\n // Add the unlisted program to the referral\n foundReferral.programs.push(unlistedReferral.programs[0]);\n // Remove the unlisted program from the referral, otherwise, it will be added to referrals multiple times\n unlistedReferral.programs.splice(0, 1);\n }\n };\n \n processReferral(listedReferrals);\n processReferral(unlistedReferrals);\n });\n\n // Remove referrals with no programs\n const updatedUnlistedReferrals = unlistedReferrals.filter(unlistedReferral => {\n if (unlistedReferral?.programs?.length > 0)\n return unlistedReferral;\n });\n\n return [...listedReferrals, ...updatedUnlistedReferrals];\n}\n\nexport const buildGroupedReferrals = (newReferrals, currentProvider) => {\n let groupedReferrals = newReferrals;\n // if the current provider is sensitive, prevent grouping\n if (currentProvider?.sensitive) {\n groupedReferrals = flatMap(groupedReferrals, preventGroupingForSensitiveProvider);\n } else {\n const groupOperations = [];\n\n groupOperations.push(groupByFunded, groupByNetwork, groupByNetworkStatus, groupBySensitivity, groupByCC);\n\n groupOperations.forEach(operation => {\n groupedReferrals = flatMap(groupedReferrals, operation);\n });\n\n groupedReferrals = groupUnlistedProgramsToReferrals(groupedReferrals);\n }\n\n return groupedReferrals;\n}\n"],"mappings":";;;AAAA,SAASA,OAAO,EAAEC,KAAK,EAAEC,IAAI,EAAEC,OAAO,EAAEC,OAAO,QAAQ,QAAQ;AAC/D,SAASC,kBAAkB,EAAEC,cAAc,EAAEC,oBAAoB,EAAEC,mBAAmB,QAAQ,SAAS;AACvG,SAASC,2BAA2B,QAAQ,aAAa;;AAEzD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,MAAMC,kBAAkB,GAAIC,EAAE,IAAMC,QAAQ,IAC1CA,QAAQ,CAACC,eAAe,GAAG,CAACD,QAAQ,CAAC,GAAGD,EAAE,CAACC,QAAQ,CACpD;AAED,MAAME,kBAAkB,GAAIF,QAAQ,IAAK;EACvC,MAAMG,QAAQ,GAAGT,cAAc,CAACM,QAAQ,CAAC;EACzC;EACA,IAAIG,QAAQ,CAACC,MAAM,KAAK,C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gCAAgC,CAACwB,gBAAgB,CAAC;EACvE;EAEA,OAAOA,gBAAgB;AACzB,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"buildGroupedReferrals.js","names":["isEmpty","every","head","groupBy","flatMap","isUnlistedReferral","filterNetworks","programIsOffPlatform","programIsOnPlatform","OFF_PLATFORM_REFERRALS_ONLY","withPreventUngroup","fn","referral","prevent_ungroup","groupByNetworkImpl","networks","length","network","singleNetworkPrograms","programs","filter","program","_program$provider","provider","multipleNetworkPrograms","_program$provider2","noNetworkPrograms","_program$provider3","programsGroupedByNetworkId","sameNetworkReferrals","Object","values","map","_programs$0$provider","_objectSpread","multipleNetworkReferrals","noNetworkReferrals","concat","_toConsumableArray","groupByNetwork","groupByNetworkStatus","p","inNetworkPrograms","OONPrograms","groupBySensitivityImpl","_head","_p$provider","sensitive","sensitivePrograms","_p$provider2","nonSensitivePrograms","_p$provider3","nonSensitiveReferrals","groupBySensitivity","groupByCCImpl","_head2","_p$provider4","provider_type","ccPrograms","_p$provider5","nonCCPrograms","_p$provider6","nonCCReferrals","groupByCC","preventGroupingForSensitiveProvider","groupByFunded","fundedWithAuthorizationPrograms","_p$fee_schedule_progr","fee_schedule_program","authorization_required","fundedWithoutAuthorizationPrograms","_p$fee_schedule_progr2","programsGroupedByFeeSchedule","sameFeePrograms","sameFeeReferrals","nonAuthReferrals","ungroup","groupUnlistedProgramsToReferrals","referrals","unlistedReferrals","listedReferrals","forEach","id","includes","push","unlistedReferral","processReferral","foundReferral","find","_unlistedReferral$pro","_referral$programs$","services","service","status","toLowerCase","splice","updatedUnlistedReferrals","_unlistedReferral$pro2","buildGroupedReferrals","newReferrals","currentProvider","groupedReferrals","groupOperations","operation"],"sources":["../../../src/pages/builder/buildGroupedReferrals.js"],"sourcesContent":["import { isEmpty, every, head, groupBy, flatMap } from 'lodash';\nimport { isUnlistedReferral, filterNetworks, programIsOffPlatform, programIsOnPlatform } from './utils';\nimport { OFF_PLATFORM_REFERRALS_ONLY } from './constants';\n\n// Grouping Rules:\n// - On- and off-platform programs cannot be grouped\n// - Service must be the same\n// - Programs in coordination centers cannot be grouped\n// - Programs must be in the same network\n// - Programs in sensitive providers cannot be grouped\n// - Programs at the same provider cannot be grouped\n// - Users at sensitive providers cannot group programs\n// - Funded programs that require authroization with the same fee schedule program can be grouped\n// - Unlisted programs can only be grouped with programs in the same service and with off platform referrals\n\nconst withPreventUngroup = (fn) => (referral) => (\n referral.prevent_ungroup ? [referral] : fn(referral)\n);\n\nconst groupByNetworkImpl = (referral) => {\n const networks = filterNetworks(referral);\n // if there is only one possible network, set the referral's network and return the referral\n if (networks.length === 1 || isUnlistedReferral(referral)) {\n referral.network = head(networks);\n return [referral];\n }\n // if there is more than one possible network, divide the programs into multiple referrals:\n // referrals with programs in providers in a single network and\n // referrals with programs in providers in multiple networks\n // referrals with unlisted programs, don't have network\n const singleNetworkPrograms = referral.programs.filter(program => program.provider?.networks?.length === 1);\n const multipleNetworkPrograms = referral.programs.filter(program => program.provider?.networks?.length > 1);\n const noNetworkPrograms = referral.programs.filter(program => !program.provider?.networks?.length);\n // group single network programs by network id\n const programsGroupedByNetworkId = groupBy(singleNetworkPrograms, 'provider.networks[0].id');\n // create a grouped referral for programs with the same single network\n const sameNetworkReferrals = Object.values(programsGroupedByNetworkId).map(programs => ({\n ...referral,\n programs,\n network: head(programs[0].provider?.networks),\n }))\n // create separate referrals for each program with multiple networks\n const multipleNetworkReferrals = multipleNetworkPrograms.map(program => ({\n ...referral,\n programs: [program],\n network: head(networks),\n }))\n // create separate referrals for each program with no network\n const noNetworkReferrals = noNetworkPrograms.map(program => ({\n ...referral,\n programs: [program],\n }))\n\n return [...multipleNetworkReferrals, ...sameNetworkReferrals, ...noNetworkReferrals];\n}\n\nconst groupByNetwork = withPreventUngroup(groupByNetworkImpl);\n\nconst groupByNetworkStatus = (referral) => {\n if (referral.prevent_ungroup) {\n return [referral];\n }\n // if every program is on-platform or every programs is off-platform, return the referral\n if (every(referral.programs.map(p => programIsOnPlatform(p))) ||\n every(referral.programs.map(p => programIsOffPlatform(p)))) {\n return [referral];\n }\n // divide programs into on- and off-platform referrals\n const inNetworkPrograms = referral.programs.filter(p => programIsOnPlatform(p));\n const OONPrograms = referral.programs.filter(p => programIsOffPlatform(p));\n\n return [\n ...inNetworkPrograms.length ? [{ ...referral, programs: inNetworkPrograms }] : [],\n ...OONPrograms.length ? [{ ...referral, programs: OONPrograms }] : []\n ];\n}\n\nconst groupBySensitivityImpl = (referral) => {\n // if every program is non-sensitive or the referral contains only one sensitive program, return referral\n if (every(referral.programs.map(p => !p?.provider?.sensitive)) ||\n (referral.programs.length === 1 && head(referral.programs)?.provider?.sensitive)) {\n return [referral];\n }\n // create a new referral for each sensitive program\n const sensitivePrograms = referral.programs.filter(p => p?.provider?.sensitive).map(program => ({\n ...referral, programs: [program]\n }));\n // create a new referral for non-sensitive programs\n const nonSensitivePrograms = referral.programs.filter(p => !p?.provider?.sensitive);\n const nonSensitiveReferrals = !isEmpty(nonSensitivePrograms) ? [{ ...referral, programs: nonSensitivePrograms }] : [];\n\n return [...sensitivePrograms, ...nonSensitiveReferrals];\n}\n\nconst groupBySensitivity = withPreventUngroup(groupBySensitivityImpl);\n\nconst groupByCCImpl = (referral) => {\n // if no programs are in a coordination center or the referral contains only one program in a cc, return referral\n if (every(referral.programs.map(p => p?.provider?.provider_type !== 'coordination_center')) ||\n (referral.programs.length === 1 && head(referral.programs)?.provider?.provider_type === 'coordination_center')) {\n return [referral];\n }\n // create a new referral for each program in a cc\n const ccPrograms = referral.programs.filter(p => p?.provider?.provider_type === 'coordination_center')\n .map(program => ({\n ...referral, programs: [program]\n }));\n // create a new referral for programs not in a cc\n const nonCCPrograms = referral.programs.filter(p => p?.provider?.provider_type !== 'coordination_center');\n const nonCCReferrals = !isEmpty(nonCCPrograms) ? [{ ...referral, programs: nonCCPrograms }] : [];\n\n return [...ccPrograms, ...nonCCReferrals];\n}\n\nconst groupByCC = withPreventUngroup(groupByCCImpl);\n\nconst preventGroupingForSensitiveProvider = (referral) => {\n const networks = filterNetworks(referral);\n // if there is only one possible network, set the referral's network\n if (networks.length === 1) {\n referral.network = head(networks);\n }\n const { programs } = referral;\n return programs.length > 1 ?\n programs.map(program => ({ ...referral, programs: [program] })) :\n [referral];\n};\n\nconst groupByFunded = (referral) => {\n const networks = filterNetworks(referral);\n // if there is only one possible network, set the referral's network\n if (networks.length === 1) {\n referral.network = head(networks);\n }\n\n const fundedWithAuthorizationPrograms = referral.programs.filter(p => p.fee_schedule_program?.authorization_required);\n const fundedWithoutAuthorizationPrograms = referral.programs.filter(p => !p.fee_schedule_program?.authorization_required);\n\n const programsGroupedByFeeSchedule = groupBy(fundedWithAuthorizationPrograms, 'fee_schedule_program.id');\n const sameFeePrograms = Object.values(programsGroupedByFeeSchedule);\n\n // Create a new referral for each program with a shared fee schedule program\n const sameFeeReferrals = sameFeePrograms.map(program => ({\n ...referral,\n programs: program,\n ...(program.length >= 2 ? { prevent_ungroup: true } : {}) // A referral with two or more programs with the same fee schedule cannot be ungrouped\n }));\n\n // Create a new referral for programs without fee authorization required\n const nonAuthReferrals = !isEmpty(fundedWithoutAuthorizationPrograms) ? [{ ...referral, programs: fundedWithoutAuthorizationPrograms, ungroup: true }] : [];\n\n return [...nonAuthReferrals, ...sameFeeReferrals];\n};\n\nconst groupUnlistedProgramsToReferrals = (referrals) => {\n const unlistedReferrals = [], listedReferrals = [];\n\n referrals.forEach(referral => {\n if (every(referral.programs, p => p.id.includes('unlisted')))\n unlistedReferrals.push(referral);\n else\n listedReferrals.push(referral);\n });\n\n if (unlistedReferrals.length === 0) {\n return listedReferrals;\n }\n\n // Loop over the unlisted referrals, in case of a match, add the unlisted program to the referral \n // and remove it from the unlisted referral\n unlistedReferrals.forEach(unlistedReferral => {\n const processReferral = (referrals) => {\n // Find a referral with the same service and off-platform status\n const foundReferral = referrals.find(referral =>\n unlistedReferral.programs[0]?.services[0] === referral.service.id &&\n referral.programs[0]?.status?.toLowerCase() === OFF_PLATFORM_REFERRALS_ONLY\n );\n \n if (foundReferral) {\n // Add the unlisted program to the referral\n foundReferral.programs.push(unlistedReferral.programs[0]);\n // Remove the unlisted program from the referral, otherwise, it will be added to referrals multiple times\n unlistedReferral.programs.splice(0, 1);\n }\n };\n \n processReferral(listedReferrals);\n processReferral(unlistedReferrals);\n });\n\n // Remove referrals with no programs\n const updatedUnlistedReferrals = unlistedReferrals.filter(unlistedReferral => {\n if (unlistedReferral?.programs?.length > 0)\n return unlistedReferral;\n });\n\n return [...listedReferrals, ...updatedUnlistedReferrals];\n}\n\nexport const buildGroupedReferrals = (newReferrals, currentProvider) => {\n let groupedReferrals = newReferrals;\n // if the current provider is sensitive, prevent grouping\n if (currentProvider?.sensitive) {\n groupedReferrals = flatMap(groupedReferrals, preventGroupingForSensitiveProvider);\n } else {\n const groupOperations = [];\n\n groupOperations.push(groupByFunded, groupByNetwork, groupByNetworkStatus, groupBySensitivity, groupByCC);\n\n groupOperations.forEach(operation => {\n groupedReferrals = flatMap(groupedReferrals, operation);\n });\n\n groupedReferrals = groupUnlistedProgramsToReferrals(groupedReferrals);\n }\n\n return groupedReferrals;\n}\n"],"mappings":";;;;;;;;;;;;AAAA,SAASA,OAAO,EAAEC,KAAK,EAAEC,IAAI,EAAEC,OAAO,EAAEC,OAAO,QAAQ,QAAQ;AAC/D,SAASC,kBAAkB,EAAEC,cAAc,EAAEC,oBAAoB,EAAEC,mBAAmB,QAAQ,SAAS;AACvG,SAASC,2BAA2B,QAAQ,aAAa;;AAEzD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,IAAMC,kBAAkB,GAAG,SAArBA,kBAAkBA,CAAIC,EAAE;EAAA,OAAK,UAACC,QAAQ;IAAA,OAC1CA,QAAQ,CAACC,eAAe,GAAG,CAACD,QAAQ,CAAC,GAAGD,EAAE,CAACC,QAAQ,CAAC;EAAA,CACrD;AAAA;AAED,IAAME,kBAAkB,GAAG,SAArBA,kBAAkBA,CAAIF,QAAQ,EAAK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OqE,gBAAgB;EAC3B,CAAC,CAAC;EAEF,UAAAhD,MAAA,CAAW2C,eAAe,EAAA1C,kBAAA,CAAK0D,wBAAwB;AACzD,CAAC;AAED,OAAO,IAAME,qBAAqB,GAAG,SAAxBA,qBAAqBA,CAAIC,YAAY,EAAEC,eAAe,EAAK;EACtE,IAAIC,gBAAgB,GAAGF,YAAY;EACnC;EACA,IAAIC,eAAe,aAAfA,eAAe,eAAfA,eAAe,CAAErD,SAAS,EAAE;IAC9BsD,gBAAgB,GAAGjG,OAAO,CAACiG,gBAAgB,EAAErC,mCAAmC,CAAC;EACnF,CAAC,MAAM;IACL,IAAMsC,eAAe,GAAG,EAAE;IAE1BA,eAAe,CAAClB,IAAI,CAACnB,aAAa,EAAE1B,cAAc,EAAEC,oBAAoB,EAAEa,kBAAkB,EAAEU,SAAS,CAAC;IAExGuC,eAAe,CAACrB,OAAO,CAAC,UAAAsB,SAAS,EAAI;MACnCF,gBAAgB,GAAGjG,OAAO,CAACiG,gBAAgB,EAAEE,SAAS,CAAC;IACzD,CAAC,CAAC;IAEFF,gBAAgB,GAAGxB,gCAAgC,CAACwB,gBAAgB,CAAC;EACvE;EAEA,OAAOA,gBAAgB;AACzB,CAAC","ignoreList":[]}
@@ -1,13 +1,13 @@
1
- export const REFERRAL_BUILDER_DESCRIPTION = "We automatically group compatible referrals.\n Reorganize referrals based on your client's needs, \n add referral descriptions, and upload any attachments. ";
2
- export const SUPPORTING_INFO = "Provide supporting information to help\n quickly connect your client with services.";
3
- export const ON_PLATFORM_REFERRALS = "An on-platform program uses Unite Us, just like you. \n If you send them a referral, then can accept, reject, or forward it using Unite Us.";
4
- export const OFF_PLATFORM_REFERRALS = "An off-platform program doesn't use Unite Us yet. \n If you send them a referral, you must contact them directly to request services, share\n their information with your client, and document the outcome in Unite Us.";
5
- export const GROUPED_REFERRALS_EXPLANATION = "With grouped referrals, you can send referrals\n to multiple, on-platform programs at once. Whoever accepts the referral first works with\n the client and the rest of the referrals are recalled. To be grouped, referrals must\n have the same: ";
6
- export const UNGROUP_REFERRAL_EXPLANATION = "We automatically group compatible referrals for \n you. You can ungroup referrals by clicking the three-dot icon next to any program and move\n it to a new referral.";
7
- export const GROUPED_REFERRAL_MUST_HAVE_SAME = ['Service type', 'Program status (on- or off-platform)', 'Authorization (required or not)'];
8
- export const REFERRAL_PII_PHI_DESCRIPTION = "Include personally identifiable information (PII), protected health information (PHI), or other sensitive information only if it's necessary to provide services.";
9
- export const REFERRAL_SENT_SUCCESS = "We've saved these referred programs to the Resources tab on the client's profile.";
10
- export const OFF_PLATFORM_REFERRALS_ONLY = 'off-platform referrals only';
11
- export const ROLE_KEYS = ['case_manager', 'referrals_user', 'referrals_admin', 'oversight', 'org_admin'];
12
- export const NEXT_STEPS = ['Share these resources with the client by text, email, or print.', 'Confirm whether any on-platform referrals have been accepted by any organizations.', 'Contact any off-platform programs directly, follow up with your client, and update the case.'];
1
+ export var REFERRAL_BUILDER_DESCRIPTION = "We automatically group compatible referrals.\n Reorganize referrals based on your client's needs, \n add referral descriptions, and upload any attachments. ";
2
+ export var SUPPORTING_INFO = "Provide supporting information to help\n quickly connect your client with services.";
3
+ export var ON_PLATFORM_REFERRALS = "An on-platform program uses Unite Us, just like you. \n If you send them a referral, then can accept, reject, or forward it using Unite Us.";
4
+ export var OFF_PLATFORM_REFERRALS = "An off-platform program doesn't use Unite Us yet. \n If you send them a referral, you must contact them directly to request services, share\n their information with your client, and document the outcome in Unite Us.";
5
+ export var GROUPED_REFERRALS_EXPLANATION = "With grouped referrals, you can send referrals\n to multiple, on-platform programs at once. Whoever accepts the referral first works with\n the client and the rest of the referrals are recalled. To be grouped, referrals must\n have the same: ";
6
+ export var UNGROUP_REFERRAL_EXPLANATION = "We automatically group compatible referrals for \n you. You can ungroup referrals by clicking the three-dot icon next to any program and move\n it to a new referral.";
7
+ export var GROUPED_REFERRAL_MUST_HAVE_SAME = ['Service type', 'Program status (on- or off-platform)', 'Authorization (required or not)'];
8
+ export var REFERRAL_PII_PHI_DESCRIPTION = "Include personally identifiable information (PII), protected health information (PHI), or other sensitive information only if it's necessary to provide services.";
9
+ export var REFERRAL_SENT_SUCCESS = "We've saved these referred programs to the Resources tab on the client's profile.";
10
+ export var OFF_PLATFORM_REFERRALS_ONLY = 'off-platform referrals only';
11
+ export var ROLE_KEYS = ['case_manager', 'referrals_user', 'referrals_admin', 'oversight', 'org_admin'];
12
+ export var NEXT_STEPS = ['Share these resources with the client by text, email, or print.', 'Confirm whether any on-platform referrals have been accepted by any organizations.', 'Contact any off-platform programs directly, follow up with your client, and update the case.'];
13
13
  //# sourceMappingURL=constants.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.js","names":["REFERRAL_BUILDER_DESCRIPTION","SUPPORTING_INFO","ON_PLATFORM_REFERRALS","OFF_PLATFORM_REFERRALS","GROUPED_REFERRALS_EXPLANATION","UNGROUP_REFERRAL_EXPLANATION","GROUPED_REFERRAL_MUST_HAVE_SAME","REFERRAL_PII_PHI_DESCRIPTION","REFERRAL_SENT_SUCCESS","OFF_PLATFORM_REFERRALS_ONLY","ROLE_KEYS","NEXT_STEPS"],"sources":["../../../src/pages/builder/constants.js"],"sourcesContent":["export const REFERRAL_BUILDER_DESCRIPTION = `We automatically group compatible referrals.\n Reorganize referrals based on your client's needs, \n add referral descriptions, and upload any attachments. `;\n\nexport const SUPPORTING_INFO = `Provide supporting information to help\n quickly connect your client with services.`;\n\nexport const ON_PLATFORM_REFERRALS = `An on-platform program uses Unite Us, just like you. \n If you send them a referral, then can accept, reject, or forward it using Unite Us.`;\n\nexport const OFF_PLATFORM_REFERRALS = `An off-platform program doesn't use Unite Us yet. \n If you send them a referral, you must contact them directly to request services, share\n their information with your client, and document the outcome in Unite Us.`;\n\nexport const GROUPED_REFERRALS_EXPLANATION = `With grouped referrals, you can send referrals\n to multiple, on-platform programs at once. Whoever accepts the referral first works with\n the client and the rest of the referrals are recalled. To be grouped, referrals must\n have the same: `;\n\nexport const UNGROUP_REFERRAL_EXPLANATION = `We automatically group compatible referrals for \n you. You can ungroup referrals by clicking the three-dot icon next to any program and move\n it to a new referral.`;\n\nexport const GROUPED_REFERRAL_MUST_HAVE_SAME = ['Service type', 'Program status (on- or off-platform)', 'Authorization (required or not)'];\n\nexport const REFERRAL_PII_PHI_DESCRIPTION = \"Include personally identifiable information (PII), protected health information (PHI), or other sensitive information only if it's necessary to provide services.\";\n\nexport const REFERRAL_SENT_SUCCESS = `We've saved these referred programs to the Resources tab on the client's profile.`;\n\nexport const OFF_PLATFORM_REFERRALS_ONLY = 'off-platform referrals only';\n\nexport const ROLE_KEYS = ['case_manager', 'referrals_user', 'referrals_admin', 'oversight', 'org_admin'];\n\nexport const NEXT_STEPS = ['Share these resources with the client by text, email, or print.',\n 'Confirm whether any on-platform referrals have been accepted by any organizations.',\n 'Contact any off-platform programs directly, follow up with your client, and update the case.'];\n"],"mappings":"AAAA,OAAO,MAAMA,4BAA4B,mKAEiB;AAE1D,OAAO,MAAMC,eAAe,yFACiB;AAE7C,OAAO,MAAMC,qBAAqB,iJACoD;AAEtF,OAAO,MAAMC,sBAAsB,8NAEyC;AAE5E,OAAO,MAAMC,6BAA6B,0PAGxB;AAElB,OAAO,MAAMC,4BAA4B,4KAEjB;AAExB,OAAO,MAAMC,+BAA+B,GAAG,CAAC,cAAc,EAAE,sCAAsC,EAAE,iCAAiC,CAAC;AAE1I,OAAO,MAAMC,4BAA4B,GAAG,mKAAmK;AAE/M,OAAO,MAAMC,qBAAqB,sFAAsF;AAExH,OAAO,MAAMC,2BAA2B,GAAG,6BAA6B;AAExE,OAAO,MAAMC,SAAS,GAAG,CAAC,cAAc,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,WAAW,EAAE,WAAW,CAAC;AAExG,OAAO,MAAMC,UAAU,GAAG,CAAC,iEAAiE,EAC1F,oFAAoF,EACpF,8FAA8F,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"constants.js","names":["REFERRAL_BUILDER_DESCRIPTION","SUPPORTING_INFO","ON_PLATFORM_REFERRALS","OFF_PLATFORM_REFERRALS","GROUPED_REFERRALS_EXPLANATION","UNGROUP_REFERRAL_EXPLANATION","GROUPED_REFERRAL_MUST_HAVE_SAME","REFERRAL_PII_PHI_DESCRIPTION","REFERRAL_SENT_SUCCESS","OFF_PLATFORM_REFERRALS_ONLY","ROLE_KEYS","NEXT_STEPS"],"sources":["../../../src/pages/builder/constants.js"],"sourcesContent":["export const REFERRAL_BUILDER_DESCRIPTION = `We automatically group compatible referrals.\n Reorganize referrals based on your client's needs, \n add referral descriptions, and upload any attachments. `;\n\nexport const SUPPORTING_INFO = `Provide supporting information to help\n quickly connect your client with services.`;\n\nexport const ON_PLATFORM_REFERRALS = `An on-platform program uses Unite Us, just like you. \n If you send them a referral, then can accept, reject, or forward it using Unite Us.`;\n\nexport const OFF_PLATFORM_REFERRALS = `An off-platform program doesn't use Unite Us yet. \n If you send them a referral, you must contact them directly to request services, share\n their information with your client, and document the outcome in Unite Us.`;\n\nexport const GROUPED_REFERRALS_EXPLANATION = `With grouped referrals, you can send referrals\n to multiple, on-platform programs at once. Whoever accepts the referral first works with\n the client and the rest of the referrals are recalled. To be grouped, referrals must\n have the same: `;\n\nexport const UNGROUP_REFERRAL_EXPLANATION = `We automatically group compatible referrals for \n you. You can ungroup referrals by clicking the three-dot icon next to any program and move\n it to a new referral.`;\n\nexport const GROUPED_REFERRAL_MUST_HAVE_SAME = ['Service type', 'Program status (on- or off-platform)', 'Authorization (required or not)'];\n\nexport const REFERRAL_PII_PHI_DESCRIPTION = \"Include personally identifiable information (PII), protected health information (PHI), or other sensitive information only if it's necessary to provide services.\";\n\nexport const REFERRAL_SENT_SUCCESS = `We've saved these referred programs to the Resources tab on the client's profile.`;\n\nexport const OFF_PLATFORM_REFERRALS_ONLY = 'off-platform referrals only';\n\nexport const ROLE_KEYS = ['case_manager', 'referrals_user', 'referrals_admin', 'oversight', 'org_admin'];\n\nexport const NEXT_STEPS = ['Share these resources with the client by text, email, or print.',\n 'Confirm whether any on-platform referrals have been accepted by any organizations.',\n 'Contact any off-platform programs directly, follow up with your client, and update the case.'];\n"],"mappings":"AAAA,OAAO,IAAMA,4BAA4B,mKAEiB;AAE1D,OAAO,IAAMC,eAAe,yFACiB;AAE7C,OAAO,IAAMC,qBAAqB,iJACoD;AAEtF,OAAO,IAAMC,sBAAsB,8NAEyC;AAE5E,OAAO,IAAMC,6BAA6B,0PAGxB;AAElB,OAAO,IAAMC,4BAA4B,4KAEjB;AAExB,OAAO,IAAMC,+BAA+B,GAAG,CAAC,cAAc,EAAE,sCAAsC,EAAE,iCAAiC,CAAC;AAE1I,OAAO,IAAMC,4BAA4B,GAAG,mKAAmK;AAE/M,OAAO,IAAMC,qBAAqB,sFAAsF;AAExH,OAAO,IAAMC,2BAA2B,GAAG,6BAA6B;AAExE,OAAO,IAAMC,SAAS,GAAG,CAAC,cAAc,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,WAAW,EAAE,WAAW,CAAC;AAExG,OAAO,IAAMC,UAAU,GAAG,CAAC,iEAAiE,EAC1F,oFAAoF,EACpF,8FAA8F,CAAC","ignoreList":[]}
@@ -1,129 +1,135 @@
1
- import _defineProperty from "@babel/runtime/helpers/defineProperty";
1
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
2
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
3
3
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
4
+ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
5
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
6
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
7
+ function _regeneratorRuntime() { "use strict"; var r = _regenerator(), e = r.m(_regeneratorRuntime), t = (Object.getPrototypeOf ? Object.getPrototypeOf(e) : e.__proto__).constructor; function n(r) { var e = "function" == typeof r && r.constructor; return !!e && (e === t || "GeneratorFunction" === (e.displayName || e.name)); } var o = { throw: 1, return: 2, break: 3, continue: 3 }; function a(r) { var e, t; return function (n) { e || (e = { stop: function stop() { return t(n.a, 2); }, catch: function _catch() { return n.v; }, abrupt: function abrupt(r, e) { return t(n.a, o[r], e); }, delegateYield: function delegateYield(r, o, a) { return e.resultName = o, t(n.d, _regeneratorValues(r), a); }, finish: function finish(r) { return t(n.f, r); } }, t = function t(r, _t, o) { n.p = e.prev, n.n = e.next; try { return r(_t, o); } finally { e.next = n.n; } }), e.resultName && (e[e.resultName] = n.v, e.resultName = void 0), e.sent = n.v, e.next = n.n; try { return r.call(this, e); } finally { n.p = e.prev, n.n = e.next; } }; } return (_regeneratorRuntime = function _regeneratorRuntime() { return { wrap: function wrap(e, t, n, o) { return r.w(a(e), t, n, o && o.reverse()); }, isGeneratorFunction: n, mark: r.m, awrap: function awrap(r, e) { return new _OverloadYield(r, e); }, AsyncIterator: _regeneratorAsyncIterator, async: function async(r, e, t, o, u) { return (n(e) ? _regeneratorAsyncGen : _regeneratorAsync)(a(r), e, t, o, u); }, keys: _regeneratorKeys, values: _regeneratorValues }; })(); }
8
+ function _regeneratorValues(e) { if (null != e) { var t = e["function" == typeof Symbol && Symbol.iterator || "@@iterator"], r = 0; if (t) return t.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) return { next: function next() { return e && r >= e.length && (e = void 0), { value: e && e[r++], done: !e }; } }; } throw new TypeError(_typeof(e) + " is not iterable"); }
9
+ function _regeneratorKeys(e) { var n = Object(e), r = []; for (var t in n) r.unshift(t); return function e() { for (; r.length;) if ((t = r.pop()) in n) return e.value = t, e.done = !1, e; return e.done = !0, e; }; }
10
+ function _regeneratorAsync(n, e, r, t, o) { var a = _regeneratorAsyncGen(n, e, r, t, o); return a.next().then(function (n) { return n.done ? n.value : a.next(); }); }
11
+ function _regeneratorAsyncGen(r, e, t, o, n) { return new _regeneratorAsyncIterator(_regenerator().w(r, e, t, o), n || Promise); }
12
+ function _regeneratorAsyncIterator(t, e) { function n(r, o, i, f) { try { var c = t[r](o), u = c.value; return u instanceof _OverloadYield ? e.resolve(u.v).then(function (t) { n("next", t, i, f); }, function (t) { n("throw", t, i, f); }) : e.resolve(u).then(function (t) { c.value = t, i(c); }, function (t) { return n("throw", t, i, f); }); } catch (t) { f(t); } } var r; this.next || (_regeneratorDefine2(_regeneratorAsyncIterator.prototype), _regeneratorDefine2(_regeneratorAsyncIterator.prototype, "function" == typeof Symbol && Symbol.asyncIterator || "@asyncIterator", function () { return this; })), _regeneratorDefine2(this, "_invoke", function (t, o, i) { function f() { return new e(function (e, r) { n(t, i, e, r); }); } return r = r ? r.then(f, f) : f(); }, !0); }
13
+ function _regenerator() { /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ var e, t, r = "function" == typeof Symbol ? Symbol : {}, n = r.iterator || "@@iterator", o = r.toStringTag || "@@toStringTag"; function i(r, n, o, i) { var c = n && n.prototype instanceof Generator ? n : Generator, u = Object.create(c.prototype); return _regeneratorDefine2(u, "_invoke", function (r, n, o) { var i, c, u, f = 0, p = o || [], y = !1, G = { p: 0, n: 0, v: e, a: d, f: d.bind(e, 4), d: function d(t, r) { return i = t, c = 0, u = e, G.n = r, a; } }; function d(r, n) { for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) { var o, i = p[t], d = G.p, l = i[2]; r > 3 ? (o = l === n) && (c = i[4] || 3, u = i[5] === e ? i[3] : i[5], i[4] = 3, i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0)); } if (o || r > 1) return a; throw y = !0, n; } return function (o, p, l) { if (f > 1) throw TypeError("Generator is already running"); for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) { i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u); try { if (f = 2, i) { if (c || (o = "next"), t = i[o]) { if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object"); if (!t.done) return t; u = t.value, c < 2 && (c = 0); } else 1 === c && (t = i.return) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1); i = e; } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break; } catch (t) { i = e, c = 1, u = t; } finally { f = 1; } } return { value: t, done: y }; }; }(r, o, i), !0), u; } var a = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} t = Object.getPrototypeOf; var c = [][n] ? t(t([][n]())) : (_regeneratorDefine2(t = {}, n, function () { return this; }), t), u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c); function f(e) { return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine2(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine2(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine2(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine2(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine2(u), _regeneratorDefine2(u, o, "Generator"), _regeneratorDefine2(u, n, function () { return this; }), _regeneratorDefine2(u, "toString", function () { return "[object Generator]"; }), (_regenerator = function _regenerator() { return { w: i, m: f }; })(); }
14
+ function _regeneratorDefine2(e, r, n, t) { var i = Object.defineProperty; try { i({}, "", {}); } catch (e) { i = 0; } _regeneratorDefine2 = function _regeneratorDefine(e, r, n, t) { if (r) i ? i(e, r, { value: n, enumerable: !t, configurable: !t, writable: !t }) : e[r] = n;else { var o = function o(r, n) { _regeneratorDefine2(e, r, function (e) { return this._invoke(r, n, e); }); }; o("next", 0), o("throw", 1), o("return", 2); } }, _regeneratorDefine2(e, r, n, t); }
15
+ function _OverloadYield(e, d) { this.v = e, this.k = d; }
16
+ function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
17
+ function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
18
+ function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
19
+ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
20
+ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
21
+ function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
22
+ function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
23
+ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
4
24
  import { isEmpty } from 'lodash';
5
25
  import { ageRangeConverters } from '@unite-us/client-utils';
6
26
  import { SEARCH_ROLES, SERVICE_AREA_TYPES, STATIC_FILTER_OPTIONS } from '../../constants';
7
27
  import selectHours from './utils';
8
28
  import fetchProviderPrograms from '../../actions/Referral/fetchCoreServices';
9
- const {
10
- US_STATES,
11
- ACCESSIBILITY_OPTIONS,
12
- LANGUAGE_OPTIONS,
13
- TRANSPORTATION_OPTIONS,
14
- PAYMENT_OPTIONS,
15
- POPULATIONS,
16
- PROGRAM_DELIVERY_OPTIONS
17
- } = STATIC_FILTER_OPTIONS;
18
- const {
19
- convertApiAgeRangeToUnits,
20
- processAgeText
21
- } = ageRangeConverters;
22
- const parseAge = _ref => {
23
- let {
24
- min_months,
25
- max_months
26
- } = _ref;
29
+ var US_STATES = STATIC_FILTER_OPTIONS.US_STATES,
30
+ ACCESSIBILITY_OPTIONS = STATIC_FILTER_OPTIONS.ACCESSIBILITY_OPTIONS,
31
+ LANGUAGE_OPTIONS = STATIC_FILTER_OPTIONS.LANGUAGE_OPTIONS,
32
+ TRANSPORTATION_OPTIONS = STATIC_FILTER_OPTIONS.TRANSPORTATION_OPTIONS,
33
+ PAYMENT_OPTIONS = STATIC_FILTER_OPTIONS.PAYMENT_OPTIONS,
34
+ POPULATIONS = STATIC_FILTER_OPTIONS.POPULATIONS,
35
+ PROGRAM_DELIVERY_OPTIONS = STATIC_FILTER_OPTIONS.PROGRAM_DELIVERY_OPTIONS;
36
+ var convertApiAgeRangeToUnits = ageRangeConverters.convertApiAgeRangeToUnits,
37
+ processAgeText = ageRangeConverters.processAgeText;
38
+ var parseAge = function parseAge(_ref) {
39
+ var min_months = _ref.min_months,
40
+ max_months = _ref.max_months;
27
41
  if (!min_months && !max_months) return '';
28
- return processAgeText(...convertApiAgeRangeToUnits("".concat(min_months, "...").concat(max_months)));
42
+ return processAgeText.apply(void 0, _toConsumableArray(convertApiAgeRangeToUnits("".concat(min_months, "...").concat(max_months))));
29
43
  };
30
- const mapValuesToLabels = (values, options) => {
31
- return values.map(value => {
32
- const option = options.find(opt => opt.value === value);
44
+ var mapValuesToLabels = function mapValuesToLabels(values, options) {
45
+ return values.map(function (value) {
46
+ var option = options.find(function (opt) {
47
+ return opt.value === value;
48
+ });
33
49
  return option ? option.label : value;
34
50
  }).join(', ');
35
51
  };
36
- const getProgramProps = async _ref2 => {
37
- let {
38
- name,
39
- description,
40
- eligibility_text,
41
- population_restrictions = [],
42
- accessibility_options = [],
43
- delivery_options = [],
44
- payment_options = [],
45
- population_specializations = [],
46
- languages = [],
47
- services = [],
48
- transportation_options = [],
49
- city_requirements = [],
50
- county_requirements = [],
51
- postal_code_requirements = [],
52
- state_requirements = [],
53
- age_specializations = {},
54
- gender_requirements = [],
55
- age_requirements = {},
56
- phone_numbers = [],
57
- email_addresses = [],
58
- website_url,
59
- locations = [],
60
- receiving_referrals,
61
- provider,
62
- offers_specialized_screening,
63
- fee_schedule_screenings,
64
- suggest_edit_enabled,
65
- id
66
- } = _ref2;
67
- const hasRequirements = !!(age_requirements !== null && age_requirements !== void 0 && age_requirements.min_months) || !!(age_requirements !== null && age_requirements !== void 0 && age_requirements.max_months) || !!city_requirements.length || !!county_requirements.length || !!gender_requirements.length || !!population_restrictions.length || !!postal_code_requirements.length || !!state_requirements.length;
68
- const hasAccessibility = !!delivery_options.length || !!languages.length || !!population_specializations.length || !!(age_specializations !== null && age_specializations !== void 0 && age_specializations.min_months) || !!(age_specializations !== null && age_specializations !== void 0 && age_specializations.max_months) || !!accessibility_options.length || !!transportation_options.length || !!payment_options.length;
69
- const hasOtherEligibility = !!eligibility_text;
70
- const hasEligibility = hasRequirements || hasAccessibility || hasOtherEligibility;
71
- const hasContactInfo = !!phone_numbers.length || !!email_addresses.length || !!website_url || !!locations.length;
72
- const hours = selectHours(locations, provider === null || provider === void 0 ? void 0 : provider.hours);
73
- const accessibilityLabels = mapValuesToLabels(accessibility_options, ACCESSIBILITY_OPTIONS);
74
- const languageLabels = mapValuesToLabels(languages, LANGUAGE_OPTIONS);
75
- const transportationLabels = mapValuesToLabels(transportation_options, TRANSPORTATION_OPTIONS);
76
- const paymentLabels = mapValuesToLabels(payment_options, PAYMENT_OPTIONS);
77
- const populationRestrictionLabels = mapValuesToLabels(population_restrictions, POPULATIONS);
78
- const populationSpecializationLabels = mapValuesToLabels(population_specializations, POPULATIONS);
79
- const deliveryOptionLabels = mapValuesToLabels(delivery_options, PROGRAM_DELIVERY_OPTIONS);
80
- const providersWithServices = await fetchProviderPrograms(provider === null || provider === void 0 ? void 0 : provider.id, id);
81
- const appRoles = [SEARCH_ROLES.PAYMENTS];
82
- return {
83
- name,
84
- description,
85
- eligibility_text,
86
- hasRequirements,
87
- hasAccessibility,
88
- hasOtherEligibility,
89
- hasEligibility,
90
- hasContactInfo,
91
- postal_code_requirements: postal_code_requirements.join(', '),
92
- city_requirements: city_requirements.join('; '),
93
- county_requirements: county_requirements.join('; '),
94
- state_requirements: state_requirements.join(', '),
95
- age_requirements: parseAge(age_requirements),
96
- age_specializations: parseAge(age_specializations),
97
- gender_requirements: gender_requirements.join(', '),
98
- delivery_options: deliveryOptionLabels,
99
- population_restrictions: populationRestrictionLabels,
100
- languages: languageLabels,
101
- population_specializations: populationSpecializationLabels,
102
- accessibility_options: accessibilityLabels,
103
- residency: {
104
- state_requirements: state_requirements.join(', '),
105
- city_requirements: city_requirements.join('; '),
106
- county_requirements: county_requirements.join('; '),
107
- postal_code_requirements: postal_code_requirements.join(', ')
108
- },
109
- hasEligibilityText: !isEmpty(eligibility_text),
110
- transportation_options: transportationLabels,
111
- payment_options: paymentLabels,
112
- services: providersWithServices.services,
113
- phone_numbers,
114
- email_addresses: email_addresses.sort((_a, _b) => _b.is_primary === null ? -1 : 1),
115
- website_url,
116
- locations,
117
- hours,
118
- receiving_referrals,
119
- offersSpecializedScreening: offers_specialized_screening,
120
- feeScheduleScreenings: fee_schedule_screenings,
121
- suggest_edit_enabled,
122
- providerPrograms: providersWithServices.providerPrograms,
123
- appRoles
52
+ var getProgramProps = /*#__PURE__*/function () {
53
+ var _ref3 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(_ref2) {
54
+ var name, description, eligibility_text, _ref2$population_rest, population_restrictions, _ref2$accessibility_o, accessibility_options, _ref2$delivery_option, delivery_options, _ref2$payment_options, payment_options, _ref2$population_spec, population_specializations, _ref2$languages, languages, _ref2$services, services, _ref2$transportation_, transportation_options, _ref2$city_requiremen, city_requirements, _ref2$county_requirem, county_requirements, _ref2$postal_code_req, postal_code_requirements, _ref2$state_requireme, state_requirements, _ref2$age_specializat, age_specializations, _ref2$gender_requirem, gender_requirements, _ref2$age_requirement, age_requirements, _ref2$phone_numbers, phone_numbers, _ref2$email_addresses, email_addresses, website_url, _ref2$locations, locations, receiving_referrals, provider, offers_specialized_screening, fee_schedule_screenings, suggest_edit_enabled, id, hasRequirements, hasAccessibility, hasOtherEligibility, hasEligibility, hasContactInfo, hours, accessibilityLabels, languageLabels, transportationLabels, paymentLabels, populationRestrictionLabels, populationSpecializationLabels, deliveryOptionLabels, providersWithServices, appRoles;
55
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
56
+ while (1) switch (_context.prev = _context.next) {
57
+ case 0:
58
+ name = _ref2.name, description = _ref2.description, eligibility_text = _ref2.eligibility_text, _ref2$population_rest = _ref2.population_restrictions, population_restrictions = _ref2$population_rest === void 0 ? [] : _ref2$population_rest, _ref2$accessibility_o = _ref2.accessibility_options, accessibility_options = _ref2$accessibility_o === void 0 ? [] : _ref2$accessibility_o, _ref2$delivery_option = _ref2.delivery_options, delivery_options = _ref2$delivery_option === void 0 ? [] : _ref2$delivery_option, _ref2$payment_options = _ref2.payment_options, payment_options = _ref2$payment_options === void 0 ? [] : _ref2$payment_options, _ref2$population_spec = _ref2.population_specializations, population_specializations = _ref2$population_spec === void 0 ? [] : _ref2$population_spec, _ref2$languages = _ref2.languages, languages = _ref2$languages === void 0 ? [] : _ref2$languages, _ref2$services = _ref2.services, services = _ref2$services === void 0 ? [] : _ref2$services, _ref2$transportation_ = _ref2.transportation_options, transportation_options = _ref2$transportation_ === void 0 ? [] : _ref2$transportation_, _ref2$city_requiremen = _ref2.city_requirements, city_requirements = _ref2$city_requiremen === void 0 ? [] : _ref2$city_requiremen, _ref2$county_requirem = _ref2.county_requirements, county_requirements = _ref2$county_requirem === void 0 ? [] : _ref2$county_requirem, _ref2$postal_code_req = _ref2.postal_code_requirements, postal_code_requirements = _ref2$postal_code_req === void 0 ? [] : _ref2$postal_code_req, _ref2$state_requireme = _ref2.state_requirements, state_requirements = _ref2$state_requireme === void 0 ? [] : _ref2$state_requireme, _ref2$age_specializat = _ref2.age_specializations, age_specializations = _ref2$age_specializat === void 0 ? {} : _ref2$age_specializat, _ref2$gender_requirem = _ref2.gender_requirements, gender_requirements = _ref2$gender_requirem === void 0 ? [] : _ref2$gender_requirem, _ref2$age_requirement = _ref2.age_requirements, age_requirements = _ref2$age_requirement === void 0 ? {} : _ref2$age_requirement, _ref2$phone_numbers = _ref2.phone_numbers, phone_numbers = _ref2$phone_numbers === void 0 ? [] : _ref2$phone_numbers, _ref2$email_addresses = _ref2.email_addresses, email_addresses = _ref2$email_addresses === void 0 ? [] : _ref2$email_addresses, website_url = _ref2.website_url, _ref2$locations = _ref2.locations, locations = _ref2$locations === void 0 ? [] : _ref2$locations, receiving_referrals = _ref2.receiving_referrals, provider = _ref2.provider, offers_specialized_screening = _ref2.offers_specialized_screening, fee_schedule_screenings = _ref2.fee_schedule_screenings, suggest_edit_enabled = _ref2.suggest_edit_enabled, id = _ref2.id;
59
+ hasRequirements = !!(age_requirements !== null && age_requirements !== void 0 && age_requirements.min_months) || !!(age_requirements !== null && age_requirements !== void 0 && age_requirements.max_months) || !!city_requirements.length || !!county_requirements.length || !!gender_requirements.length || !!population_restrictions.length || !!postal_code_requirements.length || !!state_requirements.length;
60
+ hasAccessibility = !!delivery_options.length || !!languages.length || !!population_specializations.length || !!(age_specializations !== null && age_specializations !== void 0 && age_specializations.min_months) || !!(age_specializations !== null && age_specializations !== void 0 && age_specializations.max_months) || !!accessibility_options.length || !!transportation_options.length || !!payment_options.length;
61
+ hasOtherEligibility = !!eligibility_text;
62
+ hasEligibility = hasRequirements || hasAccessibility || hasOtherEligibility;
63
+ hasContactInfo = !!phone_numbers.length || !!email_addresses.length || !!website_url || !!locations.length;
64
+ hours = selectHours(locations, provider === null || provider === void 0 ? void 0 : provider.hours);
65
+ accessibilityLabels = mapValuesToLabels(accessibility_options, ACCESSIBILITY_OPTIONS);
66
+ languageLabels = mapValuesToLabels(languages, LANGUAGE_OPTIONS);
67
+ transportationLabels = mapValuesToLabels(transportation_options, TRANSPORTATION_OPTIONS);
68
+ paymentLabels = mapValuesToLabels(payment_options, PAYMENT_OPTIONS);
69
+ populationRestrictionLabels = mapValuesToLabels(population_restrictions, POPULATIONS);
70
+ populationSpecializationLabels = mapValuesToLabels(population_specializations, POPULATIONS);
71
+ deliveryOptionLabels = mapValuesToLabels(delivery_options, PROGRAM_DELIVERY_OPTIONS);
72
+ _context.next = 16;
73
+ return fetchProviderPrograms(provider === null || provider === void 0 ? void 0 : provider.id, id);
74
+ case 16:
75
+ providersWithServices = _context.sent;
76
+ appRoles = [SEARCH_ROLES.PAYMENTS];
77
+ return _context.abrupt("return", {
78
+ name: name,
79
+ description: description,
80
+ eligibility_text: eligibility_text,
81
+ hasRequirements: hasRequirements,
82
+ hasAccessibility: hasAccessibility,
83
+ hasOtherEligibility: hasOtherEligibility,
84
+ hasEligibility: hasEligibility,
85
+ hasContactInfo: hasContactInfo,
86
+ postal_code_requirements: postal_code_requirements.join(', '),
87
+ city_requirements: city_requirements.join('; '),
88
+ county_requirements: county_requirements.join('; '),
89
+ state_requirements: state_requirements.join(', '),
90
+ age_requirements: parseAge(age_requirements),
91
+ age_specializations: parseAge(age_specializations),
92
+ gender_requirements: gender_requirements.join(', '),
93
+ delivery_options: deliveryOptionLabels,
94
+ population_restrictions: populationRestrictionLabels,
95
+ languages: languageLabels,
96
+ population_specializations: populationSpecializationLabels,
97
+ accessibility_options: accessibilityLabels,
98
+ residency: {
99
+ state_requirements: state_requirements.join(', '),
100
+ city_requirements: city_requirements.join('; '),
101
+ county_requirements: county_requirements.join('; '),
102
+ postal_code_requirements: postal_code_requirements.join(', ')
103
+ },
104
+ hasEligibilityText: !isEmpty(eligibility_text),
105
+ transportation_options: transportationLabels,
106
+ payment_options: paymentLabels,
107
+ services: providersWithServices.services,
108
+ phone_numbers: phone_numbers,
109
+ email_addresses: email_addresses.sort(function (_a, _b) {
110
+ return _b.is_primary === null ? -1 : 1;
111
+ }),
112
+ website_url: website_url,
113
+ locations: locations,
114
+ hours: hours,
115
+ receiving_referrals: receiving_referrals,
116
+ offersSpecializedScreening: offers_specialized_screening,
117
+ feeScheduleScreenings: fee_schedule_screenings,
118
+ suggest_edit_enabled: suggest_edit_enabled,
119
+ providerPrograms: providersWithServices.providerPrograms,
120
+ appRoles: appRoles
121
+ });
122
+ case 19:
123
+ case "end":
124
+ return _context.stop();
125
+ }
126
+ }, _callee);
127
+ }));
128
+ return function getProgramProps(_x) {
129
+ return _ref3.apply(this, arguments);
124
130
  };
125
- };
126
- const favorPrimaryEmail = (emailA, emailB) => {
131
+ }();
132
+ var favorPrimaryEmail = function favorPrimaryEmail(emailA, emailB) {
127
133
  if (emailB.is_primary) {
128
134
  return 1;
129
135
  }
@@ -132,20 +138,20 @@ const favorPrimaryEmail = (emailA, emailB) => {
132
138
  }
133
139
  return 0;
134
140
  };
135
- const getProviderProps = _ref3 => {
136
- let {
137
- name,
138
- description,
139
- phone_numbers,
140
- email_addresses,
141
- website_url,
142
- hours,
143
- licensed,
144
- addresses,
145
- id,
146
- sensitive
147
- } = _ref3;
148
- const emailsSortedByPriority = email_addresses.length > 0 ? email_addresses.sort(favorPrimaryEmail).map(addr => addr.email_address) : [];
141
+ var getProviderProps = function getProviderProps(_ref4) {
142
+ var name = _ref4.name,
143
+ description = _ref4.description,
144
+ phone_numbers = _ref4.phone_numbers,
145
+ email_addresses = _ref4.email_addresses,
146
+ website_url = _ref4.website_url,
147
+ hours = _ref4.hours,
148
+ licensed = _ref4.licensed,
149
+ addresses = _ref4.addresses,
150
+ id = _ref4.id,
151
+ sensitive = _ref4.sensitive;
152
+ var emailsSortedByPriority = email_addresses.length > 0 ? email_addresses.sort(favorPrimaryEmail).map(function (addr) {
153
+ return addr.email_address;
154
+ }) : [];
149
155
  return {
150
156
  provider_id: id,
151
157
  provider_name: name,
@@ -160,45 +166,67 @@ const getProviderProps = _ref3 => {
160
166
  hasOrgInfo: !isEmpty(description) || !isEmpty(phone_numbers) || !isEmpty(email_addresses) || !isEmpty(website_url) || !isEmpty(hours) || !isEmpty(locations)
161
167
  };
162
168
  };
163
- const generateServesThisAreaOption = area => {
169
+ var generateServesThisAreaOption = function generateServesThisAreaOption(area) {
164
170
  if (area.service_area_type === SERVICE_AREA_TYPES.NATIONAL) {
165
171
  return SERVICE_AREA_TYPES.NATIONAL;
166
172
  }
167
- return US_STATES.find(state => state.value === area.state_abbreviation.toUpperCase()).display_name;
173
+ return US_STATES.find(function (state) {
174
+ return state.value === area.state_abbreviation.toUpperCase();
175
+ }).display_name;
168
176
  };
169
- const getMapProps = _ref4 => {
177
+ var getMapProps = function getMapProps(_ref5) {
170
178
  var _locations$find;
171
- let {
172
- locations = [],
173
- service_areas = []
174
- } = _ref4;
175
- const closestOrFirstLocation = (_locations$find = locations === null || locations === void 0 ? void 0 : locations.find(loc => loc.is_closest)) !== null && _locations$find !== void 0 ? _locations$find : locations[0];
176
- let servingArea = '';
179
+ var _ref5$locations = _ref5.locations,
180
+ locations = _ref5$locations === void 0 ? [] : _ref5$locations,
181
+ _ref5$service_areas = _ref5.service_areas,
182
+ service_areas = _ref5$service_areas === void 0 ? [] : _ref5$service_areas;
183
+ var closestOrFirstLocation = (_locations$find = locations === null || locations === void 0 ? void 0 : locations.find(function (loc) {
184
+ return loc.is_closest;
185
+ })) !== null && _locations$find !== void 0 ? _locations$find : locations[0];
186
+ var servingArea = '';
177
187
  if ((service_areas === null || service_areas === void 0 ? void 0 : service_areas.length) > 0) {
178
188
  var _service_areas$find;
179
- const area = (_service_areas$find = service_areas.find(a => a.service_area_type !== SERVICE_AREA_TYPES.NATIONAL)) !== null && _service_areas$find !== void 0 ? _service_areas$find : service_areas[0];
189
+ var area = (_service_areas$find = service_areas.find(function (a) {
190
+ return a.service_area_type !== SERVICE_AREA_TYPES.NATIONAL;
191
+ })) !== null && _service_areas$find !== void 0 ? _service_areas$find : service_areas[0];
180
192
  servingArea = generateServesThisAreaOption(area);
181
193
  }
182
- const {
183
- latitude,
184
- longitude
185
- } = closestOrFirstLocation !== null && closestOrFirstLocation !== void 0 ? closestOrFirstLocation : {};
194
+ var _ref6 = closestOrFirstLocation !== null && closestOrFirstLocation !== void 0 ? closestOrFirstLocation : {},
195
+ latitude = _ref6.latitude,
196
+ longitude = _ref6.longitude;
186
197
  return {
187
- latitude,
188
- longitude,
198
+ latitude: latitude,
199
+ longitude: longitude,
189
200
  zoom: '15',
190
- servingArea,
201
+ servingArea: servingArea,
191
202
  hasMap: !!latitude && !!longitude
192
203
  };
193
204
  };
194
205
 
195
206
  // eslint-disable-next-line import/prefer-default-export
196
- export const formatForProgramDetail = async program => {
197
- const programProps = await getProgramProps(program);
198
- const providerProps = program !== null && program !== void 0 && program.provider ? getProviderProps(program.provider) : {};
199
- const mapProps = getMapProps(program);
200
- return _objectSpread(_objectSpread(_objectSpread({
201
- id: program.id
202
- }, programProps), providerProps), mapProps);
203
- };
207
+ export var formatForProgramDetail = /*#__PURE__*/function () {
208
+ var _ref7 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(program) {
209
+ var programProps, providerProps, mapProps;
210
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
211
+ while (1) switch (_context2.prev = _context2.next) {
212
+ case 0:
213
+ _context2.next = 2;
214
+ return getProgramProps(program);
215
+ case 2:
216
+ programProps = _context2.sent;
217
+ providerProps = program !== null && program !== void 0 && program.provider ? getProviderProps(program.provider) : {};
218
+ mapProps = getMapProps(program);
219
+ return _context2.abrupt("return", _objectSpread(_objectSpread(_objectSpread({
220
+ id: program.id
221
+ }, programProps), providerProps), mapProps));
222
+ case 6:
223
+ case "end":
224
+ return _context2.stop();
225
+ }
226
+ }, _callee2);
227
+ }));
228
+ return function formatForProgramDetail(_x2) {
229
+ return _ref7.apply(this, arguments);
230
+ };
231
+ }();
204
232
  //# sourceMappingURL=formatProgramDetail.js.map