@doctocar/tooling 0.3.1-21 → 0.3.1-27

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 (228) hide show
  1. package/dist/emails/types/professional/ProfessionalOrderIssueReportedConfirmationEmailData.type.d.ts +1 -1
  2. package/dist/emails/types/professional/ProfessionalServiceCompletedByProfessionalEmailData.type.d.ts +1 -1
  3. package/dist/errors/enums/cloudFunctions/entities/RedeemPromoCodeForEntityErrorCodes.enum.d.ts +18 -0
  4. package/dist/errors/enums/cloudFunctions/entities/RedeemPromoCodeForEntityErrorCodes.enum.js +22 -0
  5. package/dist/errors/enums/cloudFunctions/entities/index.d.ts +1 -0
  6. package/dist/errors/enums/cloudFunctions/entities/index.js +1 -0
  7. package/dist/errors/enums/cloudFunctions/orders/CancelConfirmedOrInProgressOrderErrorCodes.enum.d.ts +1 -1
  8. package/dist/errors/enums/cloudFunctions/orders/CancelConfirmedOrInProgressOrderErrorCodes.enum.js +1 -1
  9. package/dist/errors/enums/cloudFunctions/orders/ConfirmServiceCompletionByServiceProviderErrorCodes.enum.d.ts +7 -0
  10. package/dist/errors/enums/cloudFunctions/orders/ConfirmServiceCompletionByServiceProviderErrorCodes.enum.js +11 -0
  11. package/dist/errors/enums/cloudFunctions/orders/StartConfirmedOrderByServiceProviderErrorCodes.enum.d.ts +6 -0
  12. package/dist/errors/enums/cloudFunctions/orders/StartConfirmedOrderByServiceProviderErrorCodes.enum.js +10 -0
  13. package/dist/errors/enums/cloudFunctions/orders/index.d.ts +2 -2
  14. package/dist/errors/enums/cloudFunctions/orders/index.js +2 -2
  15. package/dist/errors/enums/cloudFunctions/serviceProviderUsers/DeleteServiceProviderUserServiceErrorCodes.enum.d.ts +1 -1
  16. package/dist/errors/enums/cloudFunctions/serviceProviderUsers/DeleteServiceProviderUserServiceErrorCodes.enum.js +1 -1
  17. package/dist/errors/enums/cloudFunctions/serviceProviderUsers/UpdateServiceProviderUserServiceErrorCodes.enum.d.ts +1 -1
  18. package/dist/errors/enums/cloudFunctions/serviceProviderUsers/UpdateServiceProviderUserServiceErrorCodes.enum.js +1 -1
  19. package/dist/firebase/cloudFunctions/enums/OnCallCloudFunctionsNames.enum.d.ts +3 -3
  20. package/dist/firebase/cloudFunctions/enums/OnCallCloudFunctionsNames.enum.js +3 -3
  21. package/dist/firebase/cloudFunctions/enums/TaskCloudFunctionsNames.enum.d.ts +1 -1
  22. package/dist/firebase/cloudFunctions/enums/TaskCloudFunctionsNames.enum.js +1 -1
  23. package/dist/firebase/cloudFunctions/maps/OnCallCloudFunctionsTypeMappings.map.d.ts +11 -11
  24. package/dist/firebase/cloudFunctions/types/entities/RedeemPromoCodeForEntityRequestData.type.d.ts +5 -0
  25. package/dist/firebase/cloudFunctions/types/entities/RedeemPromoCodeForEntityRequestData.type.js +2 -0
  26. package/dist/firebase/cloudFunctions/types/entities/RedeemPromoCodeForEntityResponseData.type.d.ts +1 -0
  27. package/dist/firebase/cloudFunctions/types/entities/RedeemPromoCodeForEntityResponseData.type.js +2 -0
  28. package/dist/firebase/cloudFunctions/types/entities/index.d.ts +2 -0
  29. package/dist/firebase/cloudFunctions/types/entities/index.js +2 -0
  30. package/dist/firebase/cloudFunctions/types/orders/ConfirmServiceCompletionByServiceProviderRequestData.type.d.ts +4 -0
  31. package/dist/firebase/cloudFunctions/types/orders/ConfirmServiceCompletionByServiceProviderRequestData.type.js +2 -0
  32. package/dist/firebase/cloudFunctions/types/orders/ConfirmServiceCompletionByServiceProviderResponseData.type.d.ts +1 -0
  33. package/dist/firebase/cloudFunctions/types/orders/ConfirmServiceCompletionByServiceProviderResponseData.type.js +2 -0
  34. package/dist/firebase/cloudFunctions/types/orders/RedeemPromoCodeForEntityRequestData.type.d.ts +5 -0
  35. package/dist/firebase/cloudFunctions/types/orders/RedeemPromoCodeForEntityRequestData.type.js +2 -0
  36. package/dist/firebase/cloudFunctions/types/orders/RedeemPromoCodeForEntityResponseData.type.d.ts +1 -0
  37. package/dist/firebase/cloudFunctions/types/orders/RedeemPromoCodeForEntityResponseData.type.js +2 -0
  38. package/dist/firebase/cloudFunctions/types/orders/RedeemPromoCodeRequestData.type.d.ts +5 -0
  39. package/dist/firebase/cloudFunctions/types/orders/RedeemPromoCodeRequestData.type.js +2 -0
  40. package/dist/firebase/cloudFunctions/types/orders/RedeemPromoCodeResponseData.type.d.ts +9 -0
  41. package/dist/firebase/cloudFunctions/types/orders/RedeemPromoCodeResponseData.type.js +2 -0
  42. package/dist/firebase/cloudFunctions/types/orders/StartConfirmedOrderByServiceProviderRequestData.type.d.ts +4 -0
  43. package/dist/firebase/cloudFunctions/types/orders/StartConfirmedOrderByServiceProviderRequestData.type.js +2 -0
  44. package/dist/firebase/cloudFunctions/types/orders/StartConfirmedOrderByServiceProviderResponseData.type.d.ts +1 -0
  45. package/dist/firebase/cloudFunctions/types/orders/StartConfirmedOrderByServiceProviderResponseData.type.js +2 -0
  46. package/dist/firebase/cloudFunctions/types/orders/index.d.ts +4 -6
  47. package/dist/firebase/cloudFunctions/types/orders/index.js +4 -6
  48. package/dist/firebase/cloudFunctions/types/users/serviceProviderUsers/UpdateServiceProviderUserServiceRequestData.type.d.ts +2 -2
  49. package/dist/firebase/firestore/constants/credits/firestoreCreditsSchemaVersion.enum.d.ts +1 -0
  50. package/dist/firebase/firestore/constants/credits/firestoreCreditsSchemaVersion.enum.js +4 -0
  51. package/dist/firebase/firestore/constants/credits/index.d.ts +1 -0
  52. package/dist/firebase/firestore/constants/credits/index.js +17 -0
  53. package/dist/firebase/firestore/constants/creditsLedgerEntry/firestoreCreditsLedgerEntrySchemaVersion.enum.d.ts +1 -0
  54. package/dist/firebase/firestore/constants/creditsLedgerEntry/firestoreCreditsLedgerEntrySchemaVersion.enum.js +4 -0
  55. package/dist/firebase/firestore/constants/creditsLedgerEntry/index.d.ts +1 -0
  56. package/dist/firebase/firestore/constants/creditsLedgerEntry/index.js +17 -0
  57. package/dist/firebase/firestore/constants/index.d.ts +6 -4
  58. package/dist/firebase/firestore/constants/index.js +6 -4
  59. package/dist/firebase/firestore/constants/providerLocationServiceMaxRadiusInKM.constant.d.ts +1 -0
  60. package/dist/firebase/firestore/constants/providerLocationServiceMaxRadiusInKM.constant.js +4 -0
  61. package/dist/firebase/firestore/constants/providerLocationServiceMinRadiusInKM.constant.d.ts +1 -0
  62. package/dist/firebase/firestore/constants/providerLocationServiceMinRadiusInKM.constant.js +4 -0
  63. package/dist/firebase/firestore/constants/providerServiceMinimumDurationIncrementInMinutes.constant.d.ts +1 -0
  64. package/dist/firebase/firestore/constants/providerServiceMinimumDurationIncrementInMinutes.constant.js +4 -0
  65. package/dist/firebase/firestore/constants/providerServiceMinimumPriceIncrementInCents.constant.d.ts +1 -0
  66. package/dist/firebase/firestore/constants/providerServiceMinimumPriceIncrementInCents.constant.js +4 -0
  67. package/dist/firebase/firestore/enums/FirestoreCollections.enum.d.ts +4 -1
  68. package/dist/firebase/firestore/enums/FirestoreCollections.enum.js +4 -1
  69. package/dist/firebase/firestore/enums/creditsLedgerEntry/CreditsLedgerEntryContextReferenceType.enum.d.ts +6 -0
  70. package/dist/firebase/firestore/enums/creditsLedgerEntry/CreditsLedgerEntryContextReferenceType.enum.js +10 -0
  71. package/dist/firebase/firestore/enums/creditsLedgerEntry/CreditsLedgerEntryReason.enum.d.ts +10 -0
  72. package/dist/firebase/firestore/enums/creditsLedgerEntry/CreditsLedgerEntryReason.enum.js +14 -0
  73. package/dist/firebase/firestore/enums/creditsLedgerEntry/CreditsLedgerEntryType.enum.d.ts +4 -0
  74. package/dist/firebase/firestore/enums/creditsLedgerEntry/CreditsLedgerEntryType.enum.js +8 -0
  75. package/dist/firebase/firestore/enums/creditsLedgerEntry/index.d.ts +3 -0
  76. package/dist/firebase/firestore/enums/creditsLedgerEntry/index.js +19 -0
  77. package/dist/firebase/firestore/enums/index.d.ts +1 -0
  78. package/dist/firebase/firestore/enums/index.js +1 -0
  79. package/dist/firebase/firestore/enums/orders/OrderCancellationByTypes.enum.d.ts +1 -1
  80. package/dist/firebase/firestore/enums/orders/OrderCancellationByTypes.enum.js +1 -1
  81. package/dist/firebase/firestore/enums/orders/OrderServiceProviderCancellationReason.enum.d.ts +7 -7
  82. package/dist/firebase/firestore/enums/orders/OrderServiceProviderCancellationReason.enum.js +7 -7
  83. package/dist/firebase/firestore/enums/orders/dispute/OrderDisputeOpenedBy.enum.d.ts +1 -1
  84. package/dist/firebase/firestore/enums/orders/dispute/OrderDisputeOpenedBy.enum.js +1 -1
  85. package/dist/firebase/firestore/enums/orders/index.d.ts +1 -1
  86. package/dist/firebase/firestore/enums/orders/index.js +1 -1
  87. package/dist/firebase/firestore/enums/ordersIssues/CustomerOrderIssueReason.enum.d.ts +2 -2
  88. package/dist/firebase/firestore/enums/ordersIssues/CustomerOrderIssueReason.enum.js +2 -2
  89. package/dist/firebase/firestore/enums/ordersIssues/ServiceProviderOrderIssueReason.enum.d.ts +10 -0
  90. package/dist/firebase/firestore/enums/ordersIssues/ServiceProviderOrderIssueReason.enum.js +14 -0
  91. package/dist/firebase/firestore/enums/ordersIssues/index.d.ts +1 -1
  92. package/dist/firebase/firestore/enums/ordersIssues/index.js +1 -1
  93. package/dist/firebase/firestore/enums/promoCode/PromoCodeDiscountType.enum.d.ts +0 -1
  94. package/dist/firebase/firestore/enums/promoCode/PromoCodeDiscountType.enum.js +1 -1
  95. package/dist/firebase/firestore/enums/users/professionals/ServiceProviderBadgesTypes.enum.d.ts +3 -0
  96. package/dist/firebase/firestore/enums/users/professionals/ServiceProviderBadgesTypes.enum.js +7 -0
  97. package/dist/firebase/firestore/enums/users/professionals/index.d.ts +1 -1
  98. package/dist/firebase/firestore/enums/users/professionals/index.js +1 -1
  99. package/dist/firebase/firestore/maps/FirestoreCollectionDocumentTypeMap.d.ts +5 -2
  100. package/dist/firebase/firestore/types/credits/CheckoutCreditsSummary.type.d.ts +6 -0
  101. package/dist/firebase/firestore/types/credits/CheckoutCreditsSummary.type.js +2 -0
  102. package/dist/firebase/firestore/types/credits/FirestoreCreditsDocument.type.d.ts +17 -0
  103. package/dist/firebase/firestore/types/credits/FirestoreCreditsDocument.type.js +2 -0
  104. package/dist/firebase/firestore/types/credits/index.d.ts +1 -0
  105. package/dist/firebase/firestore/types/credits/index.js +17 -0
  106. package/dist/firebase/firestore/types/creditsLedgerEntryDocument/FirestoreCreditsLedgerEntryDocument.type.d.ts +21 -0
  107. package/dist/firebase/firestore/types/creditsLedgerEntryDocument/FirestoreCreditsLedgerEntryDocument.type.js +2 -0
  108. package/dist/firebase/firestore/types/creditsLedgerEntryDocument/index.d.ts +1 -0
  109. package/dist/firebase/firestore/types/creditsLedgerEntryDocument/index.js +17 -0
  110. package/dist/firebase/firestore/types/entities/FirestoreEntityDocument.type.d.ts +3 -0
  111. package/dist/firebase/firestore/types/index.d.ts +4 -1
  112. package/dist/firebase/firestore/types/index.js +4 -1
  113. package/dist/firebase/firestore/types/order/FirestoreOrderCancellationReason.type.d.ts +2 -2
  114. package/dist/firebase/firestore/types/order/FirestoreOrderDocument.type.d.ts +3 -0
  115. package/dist/firebase/firestore/types/ordersIssues/OrderIssueReason.type.d.ts +2 -2
  116. package/dist/firebase/firestore/types/ordersReviews/FirestoreOrderReviewDocument.type.d.ts +1 -1
  117. package/dist/firebase/firestore/types/promoCode/FirestorePromoCodeDocument.type.d.ts +8 -14
  118. package/dist/firebase/firestore/types/promoCodeRedemptions/FirestorePromoCodeRedemptionDocument.type.d.ts +9 -0
  119. package/dist/firebase/firestore/types/promoCodeRedemptions/FirestorePromoCodeRedemptionDocument.type.js +2 -0
  120. package/dist/firebase/firestore/types/promoCodeRedemptions/index.d.ts +1 -0
  121. package/dist/firebase/firestore/types/promoCodeRedemptions/index.js +17 -0
  122. package/dist/firebase/firestore/types/serviceProviderUserPublicDocument/FirestoreServiceProviderUserPublicDocument.type.d.ts +49 -0
  123. package/dist/firebase/firestore/types/serviceProviderUserPublicDocument/FirestoreServiceProviderUserPublicDocument.type.js +2 -0
  124. package/dist/firebase/firestore/types/serviceProviderUserPublicDocument/FirestoreServiceProviderUserPublicDocumentReviewAggregates.type.d.ts +4 -0
  125. package/dist/firebase/firestore/types/serviceProviderUserPublicDocument/FirestoreServiceProviderUserPublicDocumentReviewAggregates.type.js +2 -0
  126. package/dist/firebase/firestore/types/serviceProviderUserPublicDocument/FirestoreServiceProviderUserPublicDocumentServicesLocation.type.d.ts +4 -0
  127. package/dist/firebase/firestore/types/serviceProviderUserPublicDocument/FirestoreServiceProviderUserPublicDocumentServicesLocation.type.js +2 -0
  128. package/dist/firebase/firestore/types/serviceProviderUserPublicDocument/index.d.ts +3 -0
  129. package/dist/firebase/firestore/types/serviceProviderUserPublicDocument/index.js +19 -0
  130. package/dist/firebase/firestore/types/services/ProviderService.type.d.ts +8 -0
  131. package/dist/firebase/firestore/types/services/ProviderService.type.js +2 -0
  132. package/dist/firebase/firestore/types/services/ServiceProviderService.type.d.ts +8 -0
  133. package/dist/firebase/firestore/types/services/ServiceProviderService.type.js +2 -0
  134. package/dist/firebase/firestore/types/services/index.d.ts +1 -1
  135. package/dist/firebase/firestore/types/services/index.js +1 -1
  136. package/dist/firebase/firestore/utils/dataValidators/services/__tests__/isValidProfessionalService.test.js +11 -11
  137. package/dist/firebase/firestore/utils/dataValidators/services/__tests__/isValidProviderService.test.d.ts +1 -0
  138. package/dist/firebase/firestore/utils/dataValidators/services/__tests__/isValidProviderService.test.js +172 -0
  139. package/dist/firebase/firestore/utils/dataValidators/services/__tests__/isValidServicePricingAndDurationForVehicle.test.js +9 -9
  140. package/dist/firebase/firestore/utils/dataValidators/services/index.d.ts +1 -1
  141. package/dist/firebase/firestore/utils/dataValidators/services/index.js +1 -1
  142. package/dist/firebase/firestore/utils/dataValidators/services/isValidProfessionalService.d.ts +1 -1
  143. package/dist/firebase/firestore/utils/dataValidators/services/isValidProfessionalService.js +13 -13
  144. package/dist/firebase/firestore/utils/dataValidators/services/isValidProviderService.d.ts +2 -0
  145. package/dist/firebase/firestore/utils/dataValidators/services/isValidProviderService.js +42 -0
  146. package/dist/firebase/firestore/utils/dataValidators/services/isValidServicePricingAndDurationForVehicle.js +2 -2
  147. package/dist/firebase/firestore/utils/dataValidators/services/types/IsValidProfessionalServiceParams.type.d.ts +2 -2
  148. package/dist/firebase/firestore/utils/dataValidators/services/types/IsValidProviderServiceParams.type.d.ts +6 -0
  149. package/dist/firebase/firestore/utils/dataValidators/services/types/IsValidProviderServiceParams.type.js +2 -0
  150. package/dist/firebase/firestore/utils/dataValidators/services/types/index.d.ts +1 -1
  151. package/dist/firebase/firestore/utils/dataValidators/services/types/index.js +1 -1
  152. package/dist/firebase/firestore/utils/order/__tests__/buildOrderServicePreTaxLinesAndServicesDetails.test.js +13 -13
  153. package/dist/firebase/firestore/utils/order/buildOrderServicePreTaxLinesAndServicesDetails.d.ts +1 -1
  154. package/dist/firebase/firestore/utils/order/buildOrderServicePreTaxLinesAndServicesDetails.js +2 -2
  155. package/dist/firebase/firestore/utils/order/types/BuildOrderServicePreTaxLinesAndServicesDetailsProps.type.d.ts +2 -2
  156. package/dist/firebase/firestore/utils/reviews/__tests__/getAverageRatingFromReviewAggregates.test.d.ts +1 -0
  157. package/dist/firebase/firestore/utils/reviews/__tests__/getAverageRatingFromReviewAggregates.test.js +97 -0
  158. package/dist/firebase/firestore/utils/reviews/getAverageRatingFromReviewAggregates.d.ts +2 -0
  159. package/dist/firebase/firestore/utils/reviews/getAverageRatingFromReviewAggregates.js +13 -0
  160. package/dist/firebase/firestore/utils/reviews/index.d.ts +1 -1
  161. package/dist/firebase/firestore/utils/reviews/index.js +1 -1
  162. package/dist/firebase/firestore/utils/services/__tests__/computeTotalServiceProviderServiceDurationInMinutesForVehicleType.test.d.ts +1 -0
  163. package/dist/firebase/firestore/utils/services/__tests__/computeTotalServiceProviderServiceDurationInMinutesForVehicleType.test.js +101 -0
  164. package/dist/firebase/firestore/utils/services/__tests__/createServiceVehicleComboKey.test.js +4 -4
  165. package/dist/firebase/firestore/utils/services/__tests__/getBookableServiceProviderServicesForVehicleType.test.js +49 -49
  166. package/dist/firebase/firestore/utils/services/__tests__/getServiceProviderActiveServicePricingAndDurationForVehicleOrThrow.test.js +32 -32
  167. package/dist/firebase/firestore/utils/services/computeTotalServiceProviderServiceDurationInMinutesForVehicleType.d.ts +2 -0
  168. package/dist/firebase/firestore/utils/services/computeTotalServiceProviderServiceDurationInMinutesForVehicleType.js +18 -0
  169. package/dist/firebase/firestore/utils/services/getBookableServiceProviderServicesForVehicleType.d.ts +3 -3
  170. package/dist/firebase/firestore/utils/services/getBookableServiceProviderServicesForVehicleType.js +11 -11
  171. package/dist/firebase/firestore/utils/services/getServiceProviderActiveServicePricingAndDurationForVehicleOrThrow.d.ts +1 -1
  172. package/dist/firebase/firestore/utils/services/getServiceProviderActiveServicePricingAndDurationForVehicleOrThrow.js +2 -2
  173. package/dist/firebase/firestore/utils/services/index.d.ts +1 -1
  174. package/dist/firebase/firestore/utils/services/index.js +1 -1
  175. package/dist/firebase/firestore/utils/services/types/ComputeTotalServiceProviderServiceDurationInMinutesForVehicleTypeArgs.type.d.ts +7 -0
  176. package/dist/firebase/firestore/utils/services/types/ComputeTotalServiceProviderServiceDurationInMinutesForVehicleTypeArgs.type.js +2 -0
  177. package/dist/firebase/firestore/utils/services/types/GetBookableServiceProviderServicesForVehicleTypeParams.type.d.ts +2 -2
  178. package/dist/firebase/firestore/utils/services/types/GetServiceProviderActiveServicePricingAndDurationForVehicleOrThrowParams.type.d.ts +2 -2
  179. package/dist/firebase/firestore/utils/services/types/index.d.ts +1 -1
  180. package/dist/firebase/firestore/utils/services/types/index.js +1 -1
  181. package/dist/firebase/firestore/utils/stubs/credits/firestoreCreditsDocumentStub.d.ts +2 -0
  182. package/dist/firebase/firestore/utils/stubs/credits/firestoreCreditsDocumentStub.js +24 -0
  183. package/dist/firebase/firestore/utils/stubs/credits/index.d.ts +1 -0
  184. package/dist/firebase/firestore/utils/stubs/credits/index.js +17 -0
  185. package/dist/firebase/firestore/utils/stubs/creditsLedgerEntry/firestoreCreditsLedgerEntryDocumentStub.d.ts +2 -0
  186. package/dist/firebase/firestore/utils/stubs/creditsLedgerEntry/firestoreCreditsLedgerEntryDocumentStub.js +27 -0
  187. package/dist/firebase/firestore/utils/stubs/creditsLedgerEntry/index.d.ts +1 -0
  188. package/dist/firebase/firestore/utils/stubs/creditsLedgerEntry/index.js +17 -0
  189. package/dist/firebase/firestore/utils/stubs/entities/firestoreEntityDocumentStub.js +3 -0
  190. package/dist/firebase/firestore/utils/stubs/index.d.ts +5 -1
  191. package/dist/firebase/firestore/utils/stubs/index.js +5 -1
  192. package/dist/firebase/firestore/utils/stubs/ordersReviews/firestoreOrderReviewDocumentStub.js +1 -1
  193. package/dist/firebase/firestore/utils/stubs/promoCode/firestorePromoCodeDocumentStub.d.ts +2 -0
  194. package/dist/firebase/firestore/utils/stubs/promoCode/firestorePromoCodeDocumentStub.js +23 -0
  195. package/dist/firebase/firestore/utils/stubs/promoCode/index.d.ts +1 -0
  196. package/dist/firebase/firestore/utils/stubs/promoCode/index.js +17 -0
  197. package/dist/firebase/firestore/utils/stubs/promoCodeRedemptions/firestorePromoCodeRedemptionDocumentStub.d.ts +2 -0
  198. package/dist/firebase/firestore/utils/stubs/promoCodeRedemptions/firestorePromoCodeRedemptionDocumentStub.js +10 -0
  199. package/dist/firebase/firestore/utils/stubs/promoCodeRedemptions/index.d.ts +1 -0
  200. package/dist/firebase/firestore/utils/stubs/promoCodeRedemptions/index.js +17 -0
  201. package/dist/firebase/firestore/utils/stubs/serviceProviderUserPublicDocument/firestoreServiceProviderUserPublicDocumentStub.d.ts +2 -0
  202. package/dist/firebase/firestore/utils/stubs/serviceProviderUserPublicDocument/firestoreServiceProviderUserPublicDocumentStub.js +44 -0
  203. package/dist/firebase/firestore/utils/stubs/serviceProviderUserPublicDocument/index.d.ts +1 -0
  204. package/dist/firebase/firestore/utils/stubs/serviceProviderUserPublicDocument/index.js +17 -0
  205. package/dist/firebase/firestore/utils/stubs/services/index.d.ts +1 -1
  206. package/dist/firebase/firestore/utils/stubs/services/index.js +1 -1
  207. package/dist/firebase/firestore/utils/stubs/services/pricingAndDurationForVehicleStub.js +2 -2
  208. package/dist/firebase/firestore/utils/stubs/services/providerServiceStub.d.ts +5 -0
  209. package/dist/firebase/firestore/utils/stubs/services/providerServiceStub.js +21 -0
  210. package/dist/firebase/firestore/utils/stubs/services/serviceProviderServiceStub.d.ts +5 -0
  211. package/dist/firebase/firestore/utils/stubs/services/serviceProviderServiceStub.js +21 -0
  212. package/dist/firebase/storage/enums/FirebaseStorageBasePaths.enum.js +1 -1
  213. package/dist/firebase/storage/utils/__tests__/buildStoragePeriodSlug.test.js +8 -6
  214. package/dist/gcp/cloudTask/enums/CloudTasksQueueName.enum.d.ts +1 -1
  215. package/dist/gcp/cloudTask/enums/CloudTasksQueueName.enum.js +1 -1
  216. package/dist/gcp/cloudTask/maps/CloudTaskEnvelopeMap.map.d.ts +2 -2
  217. package/dist/gcp/cloudTask/types/OnTaskRecomputeServiceProviderAvailabilityEnvelope.type.d.ts +1 -1
  218. package/dist/gcp/cloudTask/types/index.d.ts +1 -1
  219. package/dist/gcp/cloudTask/types/index.js +1 -1
  220. package/dist/gcp/cloudTask/utils/stubs/index.d.ts +1 -1
  221. package/dist/gcp/cloudTask/utils/stubs/index.js +1 -1
  222. package/dist/gcp/cloudTask/utils/stubs/onTaskRecomputeServiceProviderAvailabilityEnvelopeStub.js +1 -1
  223. package/dist/pricing/__tests__/calculateInvoiceTotalWithTax.util.test.js +3 -3
  224. package/dist/stripe/types/StripeCustomServiceProviderPayoutMetadata.type.d.ts +5 -0
  225. package/dist/stripe/types/StripeCustomServiceProviderPayoutMetadata.type.js +2 -0
  226. package/dist/stripe/types/index.d.ts +1 -1
  227. package/dist/stripe/types/index.js +1 -1
  228. package/package.json +1 -1
@@ -4,21 +4,21 @@ exports.isValidProfessionalService = isValidProfessionalService;
4
4
  const errors_1 = require("../../../../../errors");
5
5
  const enums_1 = require("../../../enums");
6
6
  const isValidServicePricingAndDurationForVehicle_1 = require("./isValidServicePricingAndDurationForVehicle");
7
- async function isValidProfessionalService({ professionalService, countryServicePublicConfig, }) {
8
- if (professionalService.isActive === undefined ||
9
- typeof professionalService.isActive !== "boolean") {
7
+ async function isValidProfessionalService({ providerService, countryServicePublicConfig, }) {
8
+ if (providerService.isActive === undefined ||
9
+ typeof providerService.isActive !== "boolean") {
10
10
  throw new errors_1.DoctoCarError("Professional service is active is required and must be a boolean", errors_1.DoctoCarValidationErrorCodes.INVALID_SERVICE_IS_ACTIVE);
11
11
  }
12
- if (professionalService.type === undefined ||
13
- !Object.values(enums_1.ServicesTypes).includes(professionalService.type)) {
12
+ if (providerService.type === undefined ||
13
+ !Object.values(enums_1.ServicesTypes).includes(providerService.type)) {
14
14
  throw new errors_1.DoctoCarError("Professional service type is required and must be a valid professional service type", errors_1.DoctoCarValidationErrorCodes.INVALID_SERVICE_TYPE);
15
15
  }
16
- const servicePublicConfig = countryServicePublicConfig[professionalService.type];
16
+ const servicePublicConfig = countryServicePublicConfig[providerService.type];
17
17
  if (servicePublicConfig === undefined) {
18
18
  throw new errors_1.DoctoCarError("Professional service public config is not defined for the professional service type", errors_1.DoctoCarValidationErrorCodes.INVALID_SERVICE_TYPE);
19
19
  }
20
- if (professionalService.pricingAndDurationByVehicleType !== undefined) {
21
- for (const pricingAndDuration of Object.values(professionalService.pricingAndDurationByVehicleType)) {
20
+ if (providerService.pricingAndDurationByVehicleType !== undefined) {
21
+ for (const pricingAndDuration of Object.values(providerService.pricingAndDurationByVehicleType)) {
22
22
  if (!(0, isValidServicePricingAndDurationForVehicle_1.isValidServicePricingAndDurationForVehicle)({
23
23
  servicePublicConfig: servicePublicConfig,
24
24
  servicePricingAndDurationForVehicle: pricingAndDuration,
@@ -29,13 +29,13 @@ async function isValidProfessionalService({ professionalService, countryServiceP
29
29
  }
30
30
  const parentsServices = servicePublicConfig.parentsServices;
31
31
  if (parentsServices !== undefined && parentsServices.length > 0) {
32
- if (professionalService.parentsServices === undefined ||
33
- professionalService.parentsServices.length !== parentsServices.length) {
34
- throw new errors_1.DoctoCarError("Professional service parents services are required and must match the professional service type", errors_1.DoctoCarValidationErrorCodes.INVALID_SERVICE_PARENTS_SERVICES);
32
+ if (providerService.parentsServices === undefined ||
33
+ providerService.parentsServices.length !== parentsServices.length) {
34
+ throw new errors_1.DoctoCarError("Service provider service parents services are required and must match the service provider service type", errors_1.DoctoCarValidationErrorCodes.INVALID_SERVICE_PARENTS_SERVICES);
35
35
  }
36
36
  for (const parentService of parentsServices) {
37
- if (!professionalService.parentsServices?.includes(parentService)) {
38
- throw new errors_1.DoctoCarError("Professional service parents services are required and must match the professional service type", errors_1.DoctoCarValidationErrorCodes.INVALID_SERVICE_PARENTS_SERVICES);
37
+ if (!providerService.parentsServices?.includes(parentService)) {
38
+ throw new errors_1.DoctoCarError("Service provider service parents services are required and must match the service provider service type", errors_1.DoctoCarValidationErrorCodes.INVALID_SERVICE_PARENTS_SERVICES);
39
39
  }
40
40
  }
41
41
  }
@@ -0,0 +1,2 @@
1
+ import type { IsValidProviderServiceParams } from "./types";
2
+ export declare function isValidProviderService({ providerService, countryServicePublicConfig, }: IsValidProviderServiceParams): Promise<void>;
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isValidProviderService = isValidProviderService;
4
+ const errors_1 = require("../../../../../errors");
5
+ const enums_1 = require("../../../enums");
6
+ const isValidServicePricingAndDurationForVehicle_1 = require("./isValidServicePricingAndDurationForVehicle");
7
+ async function isValidProviderService({ providerService, countryServicePublicConfig, }) {
8
+ if (providerService.isActive === undefined ||
9
+ typeof providerService.isActive !== "boolean") {
10
+ throw new errors_1.DoctoCarError("Provider service isActive must be a boolean", errors_1.DoctoCarValidationErrorCodes.INVALID_SERVICE_IS_ACTIVE);
11
+ }
12
+ if (providerService.type === undefined ||
13
+ !Object.values(enums_1.ServicesTypes).includes(providerService.type)) {
14
+ throw new errors_1.DoctoCarError("Provider service type is required and must be a valid ServicesTypes value", errors_1.DoctoCarValidationErrorCodes.INVALID_SERVICE_TYPE);
15
+ }
16
+ const servicePublicConfig = countryServicePublicConfig[providerService.type];
17
+ if (servicePublicConfig === undefined) {
18
+ throw new errors_1.DoctoCarError("Country services public config has no entry for this provider service type", errors_1.DoctoCarValidationErrorCodes.INVALID_SERVICE_TYPE);
19
+ }
20
+ if (providerService.pricingAndDurationByVehicleType !== undefined) {
21
+ for (const pricingAndDuration of Object.values(providerService.pricingAndDurationByVehicleType)) {
22
+ if (!(0, isValidServicePricingAndDurationForVehicle_1.isValidServicePricingAndDurationForVehicle)({
23
+ servicePublicConfig: servicePublicConfig,
24
+ servicePricingAndDurationForVehicle: pricingAndDuration,
25
+ })) {
26
+ throw new errors_1.DoctoCarError("Pricing and duration for this vehicle type is not valid for this provider service", errors_1.DoctoCarValidationErrorCodes.INVALID_SERVICE_VEHICLE_TYPE_PRICING_AND_DURATION);
27
+ }
28
+ }
29
+ }
30
+ const parentsServices = servicePublicConfig.parentsServices;
31
+ if (parentsServices !== undefined && parentsServices.length > 0) {
32
+ if (providerService.parentsServices === undefined ||
33
+ providerService.parentsServices.length !== parentsServices.length) {
34
+ throw new errors_1.DoctoCarError("Provider service parent services must match the service type configuration", errors_1.DoctoCarValidationErrorCodes.INVALID_SERVICE_PARENTS_SERVICES);
35
+ }
36
+ for (const parentService of parentsServices) {
37
+ if (!providerService.parentsServices?.includes(parentService)) {
38
+ throw new errors_1.DoctoCarError("Provider service parent services must match the service type configuration", errors_1.DoctoCarValidationErrorCodes.INVALID_SERVICE_PARENTS_SERVICES);
39
+ }
40
+ }
41
+ }
42
+ }
@@ -17,13 +17,13 @@ function isValidServicePricingAndDurationForVehicle({ servicePricingAndDurationF
17
17
  servicePricingAndDurationForVehicle.pricePreTaxInCents <=
18
18
  servicePublicConfigForVehicle.maximumPriceInCents &&
19
19
  servicePricingAndDurationForVehicle.pricePreTaxInCents %
20
- constants_1.PROFESSIONAL_SERVICE_MINIMUM_PRICE_INCREMENT_IN_CENTS ===
20
+ constants_1.PROVIDER_SERVICE_MINIMUM_PRICE_INCREMENT_IN_CENTS ===
21
21
  0 &&
22
22
  Object.values(enums_1.SupportedIsoCurrency).includes(servicePricingAndDurationForVehicle.currency) &&
23
23
  typeof servicePricingAndDurationForVehicle.durationInMinutes === "number" &&
24
24
  servicePricingAndDurationForVehicle.durationInMinutes ==
25
25
  servicePublicConfigForVehicle.durationInMinutes &&
26
26
  servicePricingAndDurationForVehicle.durationInMinutes %
27
- constants_1.PROFESSIONAL_SERVICE_MINIMUM_DURATION_INCREMENT_IN_MINUTES ===
27
+ constants_1.PROVIDER_SERVICE_MINIMUM_DURATION_INCREMENT_IN_MINUTES ===
28
28
  0);
29
29
  }
@@ -1,6 +1,6 @@
1
1
  import type { ServicesTypes } from "../../../../enums";
2
- import type { CountryServicesPublicConfig, ProfessionalService } from "../../../../types";
2
+ import type { CountryServicesPublicConfig, ProviderService } from "../../../../types";
3
3
  export type IsValidProfessionalServiceParams = {
4
- professionalService: ProfessionalService<ServicesTypes>;
4
+ providerService: ProviderService<ServicesTypes>;
5
5
  countryServicePublicConfig: CountryServicesPublicConfig;
6
6
  };
@@ -0,0 +1,6 @@
1
+ import type { ServicesTypes } from "../../../../enums";
2
+ import type { CountryServicesPublicConfig, ProviderService } from "../../../../types";
3
+ export type IsValidProviderServiceParams = {
4
+ providerService: ProviderService<ServicesTypes>;
5
+ countryServicePublicConfig: CountryServicesPublicConfig;
6
+ };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,2 +1,2 @@
1
1
  export * from "./IsValidServicePricingAndDurationForVehicleParams.type";
2
- export * from "./IsValidProfessionalServiceParams.type";
2
+ export * from "./IsValidProviderServiceParams.type";
@@ -15,4 +15,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./IsValidServicePricingAndDurationForVehicleParams.type"), exports);
18
- __exportStar(require("./IsValidProfessionalServiceParams.type"), exports);
18
+ __exportStar(require("./IsValidProviderServiceParams.type"), exports);
@@ -15,7 +15,7 @@ jest.mock("../../services", () => {
15
15
  describe("buildOrderServicePreTaxLinesAndServicesDetails", () => {
16
16
  let getServiceProviderActiveServicePricingAndDurationForVehicleOrThrowMock;
17
17
  let getServiceProviderActiveServicePricingAndDurationForVehicleOrThrowReturn;
18
- let professionalUserPublicDocument;
18
+ let serviceProviderUserPublicDocument;
19
19
  let serviceTypes;
20
20
  let vehicleType;
21
21
  let countryServicesPublicConfig;
@@ -30,8 +30,8 @@ describe("buildOrderServicePreTaxLinesAndServicesDetails", () => {
30
30
  type: enums_2.VehicleTypes.MOTORCYCLE,
31
31
  };
32
32
  getServiceProviderActiveServicePricingAndDurationForVehicleOrThrowMock.mockReturnValue(getServiceProviderActiveServicePricingAndDurationForVehicleOrThrowReturn);
33
- professionalUserPublicDocument =
34
- (0, stubs_1.firestoreProfessionalUserPublicDocumentStub)();
33
+ serviceProviderUserPublicDocument =
34
+ (0, stubs_1.firestoreServiceProviderUserPublicDocumentStub)();
35
35
  serviceTypes = [
36
36
  enums_2.ServicesTypes.EXTERIOR_CLEANING,
37
37
  enums_2.ServicesTypes.INTERIOR_CLEANING,
@@ -70,13 +70,13 @@ describe("buildOrderServicePreTaxLinesAndServicesDetails", () => {
70
70
  getServiceProviderActiveServicePricingAndDurationForVehicleOrThrowMock.mockReturnValue(getServiceProviderActiveServicePricingAndDurationForVehicleOrThrowReturn);
71
71
  const result = (0, buildOrderServicePreTaxLinesAndServicesDetails_1.buildOrderServicePreTaxLinesAndServicesDetails)({
72
72
  serviceTypes,
73
- professionalUserPublicDocument,
73
+ serviceProviderUserPublicDocument,
74
74
  vehicleType,
75
75
  countryServicesPublicConfig,
76
76
  });
77
77
  expect(getServiceProviderActiveServicePricingAndDurationForVehicleOrThrowMock).toHaveBeenCalledTimes(1);
78
78
  expect(getServiceProviderActiveServicePricingAndDurationForVehicleOrThrowMock).toHaveBeenCalledWith({
79
- professionalUserPublicDocument,
79
+ serviceProviderUserPublicDocument,
80
80
  serviceType: serviceTypes[0],
81
81
  vehicleType,
82
82
  });
@@ -104,23 +104,23 @@ describe("buildOrderServicePreTaxLinesAndServicesDetails", () => {
104
104
  it("should map multiple service types and subservices correctly", () => {
105
105
  const result = (0, buildOrderServicePreTaxLinesAndServicesDetails_1.buildOrderServicePreTaxLinesAndServicesDetails)({
106
106
  serviceTypes,
107
- professionalUserPublicDocument,
107
+ serviceProviderUserPublicDocument,
108
108
  vehicleType,
109
109
  countryServicesPublicConfig,
110
110
  });
111
111
  expect(getServiceProviderActiveServicePricingAndDurationForVehicleOrThrowMock).toHaveBeenCalledTimes(3);
112
112
  expect(getServiceProviderActiveServicePricingAndDurationForVehicleOrThrowMock).toHaveBeenNthCalledWith(1, {
113
- professionalUserPublicDocument,
113
+ serviceProviderUserPublicDocument,
114
114
  serviceType: enums_2.ServicesTypes.EXTERIOR_CLEANING,
115
115
  vehicleType,
116
116
  });
117
117
  expect(getServiceProviderActiveServicePricingAndDurationForVehicleOrThrowMock).toHaveBeenNthCalledWith(2, {
118
- professionalUserPublicDocument,
118
+ serviceProviderUserPublicDocument,
119
119
  serviceType: enums_2.ServicesTypes.INTERIOR_CLEANING,
120
120
  vehicleType,
121
121
  });
122
122
  expect(getServiceProviderActiveServicePricingAndDurationForVehicleOrThrowMock).toHaveBeenNthCalledWith(3, {
123
- professionalUserPublicDocument,
123
+ serviceProviderUserPublicDocument,
124
124
  serviceType: enums_2.ServicesTypes.ANIMAL_HAIR_TREATMENT,
125
125
  vehicleType,
126
126
  });
@@ -193,13 +193,13 @@ describe("buildOrderServicePreTaxLinesAndServicesDetails", () => {
193
193
  getServiceProviderActiveServicePricingAndDurationForVehicleOrThrowMock.mockReturnValue(getServiceProviderActiveServicePricingAndDurationForVehicleOrThrowReturn);
194
194
  const result = (0, buildOrderServicePreTaxLinesAndServicesDetails_1.buildOrderServicePreTaxLinesAndServicesDetails)({
195
195
  serviceTypes,
196
- professionalUserPublicDocument,
196
+ serviceProviderUserPublicDocument,
197
197
  vehicleType,
198
198
  countryServicesPublicConfig,
199
199
  });
200
200
  expect(getServiceProviderActiveServicePricingAndDurationForVehicleOrThrowMock).toHaveBeenCalledTimes(1);
201
201
  expect(getServiceProviderActiveServicePricingAndDurationForVehicleOrThrowMock).toHaveBeenCalledWith({
202
- professionalUserPublicDocument,
202
+ serviceProviderUserPublicDocument,
203
203
  serviceType: serviceTypes[0],
204
204
  vehicleType,
205
205
  });
@@ -231,7 +231,7 @@ describe("buildOrderServicePreTaxLinesAndServicesDetails", () => {
231
231
  });
232
232
  expect(() => (0, buildOrderServicePreTaxLinesAndServicesDetails_1.buildOrderServicePreTaxLinesAndServicesDetails)({
233
233
  serviceTypes,
234
- professionalUserPublicDocument,
234
+ serviceProviderUserPublicDocument,
235
235
  vehicleType,
236
236
  countryServicesPublicConfig,
237
237
  })).toThrow("Service pricing not found");
@@ -250,7 +250,7 @@ describe("buildOrderServicePreTaxLinesAndServicesDetails", () => {
250
250
  });
251
251
  expect(() => (0, buildOrderServicePreTaxLinesAndServicesDetails_1.buildOrderServicePreTaxLinesAndServicesDetails)({
252
252
  serviceTypes,
253
- professionalUserPublicDocument,
253
+ serviceProviderUserPublicDocument,
254
254
  vehicleType,
255
255
  countryServicesPublicConfig,
256
256
  })).toThrow(`Service type ${enums_2.ServicesTypes.ANIMAL_HAIR_TREATMENT} is not available in the country configuration.`);
@@ -1,2 +1,2 @@
1
1
  import type { BuildOrderServicePreTaxLinesAndServicesDetailsReturn, BuildOrderServicePreTaxLinesAndServicesDetailsProps } from "./types";
2
- export declare function buildOrderServicePreTaxLinesAndServicesDetails({ countryServicesPublicConfig, serviceTypes, professionalUserPublicDocument, vehicleType, }: BuildOrderServicePreTaxLinesAndServicesDetailsProps): BuildOrderServicePreTaxLinesAndServicesDetailsReturn;
2
+ export declare function buildOrderServicePreTaxLinesAndServicesDetails({ countryServicesPublicConfig, serviceTypes, serviceProviderUserPublicDocument, vehicleType, }: BuildOrderServicePreTaxLinesAndServicesDetailsProps): BuildOrderServicePreTaxLinesAndServicesDetailsReturn;
@@ -4,7 +4,7 @@ exports.buildOrderServicePreTaxLinesAndServicesDetails = buildOrderServicePreTax
4
4
  const pricing_1 = require("../../../../pricing");
5
5
  const enums_1 = require("../../enums");
6
6
  const services_1 = require("../services");
7
- function buildOrderServicePreTaxLinesAndServicesDetails({ countryServicesPublicConfig, serviceTypes, professionalUserPublicDocument, vehicleType, }) {
7
+ function buildOrderServicePreTaxLinesAndServicesDetails({ countryServicesPublicConfig, serviceTypes, serviceProviderUserPublicDocument, vehicleType, }) {
8
8
  const servicesPreTaxLines = [];
9
9
  const orderServicesDetails = [];
10
10
  serviceTypes.forEach((serviceType, index) => {
@@ -12,7 +12,7 @@ function buildOrderServicePreTaxLinesAndServicesDetails({ countryServicesPublicC
12
12
  throw new Error(`Service type ${serviceType} is not available in the country configuration.`);
13
13
  }
14
14
  const pricingAndDurationForVehicle = (0, services_1.getServiceProviderActiveServicePricingAndDurationForVehicleOrThrow)({
15
- professionalUserPublicDocument,
15
+ serviceProviderUserPublicDocument,
16
16
  serviceType,
17
17
  vehicleType,
18
18
  });
@@ -1,8 +1,8 @@
1
1
  import type { ServicesTypes, VehicleTypes } from "../../../enums";
2
- import type { CountryServicesPublicConfig, FirestoreProfessionalUserPublicDocument } from "../../../types";
2
+ import type { CountryServicesPublicConfig, FirestoreServiceProviderUserPublicDocument } from "../../../types";
3
3
  export type BuildOrderServicePreTaxLinesAndServicesDetailsProps = {
4
4
  countryServicesPublicConfig: CountryServicesPublicConfig;
5
5
  serviceTypes: ServicesTypes[];
6
- professionalUserPublicDocument: FirestoreProfessionalUserPublicDocument;
6
+ serviceProviderUserPublicDocument: FirestoreServiceProviderUserPublicDocument;
7
7
  vehicleType: VehicleTypes;
8
8
  };
@@ -0,0 +1,97 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const getAverageRatingFromReviewAggregates_1 = require("../getAverageRatingFromReviewAggregates");
4
+ describe("getAverageRatingFromReviewAggregates", () => {
5
+ const cases = [
6
+ {
7
+ name: "normal positive numbers",
8
+ input: { reviewCount: 5, ratingSum: 20 },
9
+ expected: 4,
10
+ },
11
+ {
12
+ name: "zero reviews",
13
+ input: { reviewCount: 0, ratingSum: 0 },
14
+ expected: 0,
15
+ },
16
+ {
17
+ name: "positive count, zero sum",
18
+ input: { reviewCount: 3, ratingSum: 0 },
19
+ expected: 0,
20
+ },
21
+ {
22
+ name: "negative count",
23
+ input: { reviewCount: -1, ratingSum: 10 },
24
+ expected: 0,
25
+ },
26
+ {
27
+ name: "negative sum",
28
+ input: { reviewCount: 4, ratingSum: -5 },
29
+ expected: 0,
30
+ },
31
+ {
32
+ name: "both negative",
33
+ input: { reviewCount: -3, ratingSum: -5 },
34
+ expected: 0,
35
+ },
36
+ {
37
+ name: "string count coerced",
38
+ input: { reviewCount: "3", ratingSum: 5 },
39
+ expected: 1.67,
40
+ },
41
+ {
42
+ name: "string sum coerced",
43
+ input: { reviewCount: 3, ratingSum: "5" },
44
+ expected: 1.67,
45
+ },
46
+ {
47
+ name: "string both coerced",
48
+ input: {
49
+ reviewCount: "3",
50
+ ratingSum: "5",
51
+ },
52
+ expected: 1.67,
53
+ },
54
+ {
55
+ name: "fractional inputs",
56
+ input: {
57
+ reviewCount: 2.5,
58
+ ratingSum: 5.5,
59
+ },
60
+ expected: 2.2,
61
+ },
62
+ {
63
+ name: "sum smaller than count",
64
+ input: { reviewCount: 10, ratingSum: 5 },
65
+ expected: 0.5,
66
+ },
67
+ {
68
+ name: "very large numbers",
69
+ input: { reviewCount: 1e9, ratingSum: 5e9 },
70
+ expected: 5,
71
+ },
72
+ {
73
+ name: "undefined fields",
74
+ input: {},
75
+ expected: 0,
76
+ },
77
+ {
78
+ name: "null inputs",
79
+ input: {
80
+ reviewCount: null,
81
+ ratingSum: null,
82
+ },
83
+ expected: 0,
84
+ },
85
+ {
86
+ name: "NaN inputs",
87
+ input: { reviewCount: NaN, ratingSum: NaN },
88
+ expected: 0,
89
+ },
90
+ ];
91
+ describe.each(cases)("$name", ({ input, expected }) => {
92
+ it(`returns ${expected}`, () => {
93
+ const result = (0, getAverageRatingFromReviewAggregates_1.getAverageRatingFromReviewAggregates)(input);
94
+ expect(result).toBeCloseTo(expected, 2);
95
+ });
96
+ });
97
+ });
@@ -0,0 +1,2 @@
1
+ import type { FirestoreServiceProviderUserPublicDocumentReviewAggregates } from "../../types";
2
+ export declare function getAverageRatingFromReviewAggregates(args: FirestoreServiceProviderUserPublicDocumentReviewAggregates): number;
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getAverageRatingFromReviewAggregates = getAverageRatingFromReviewAggregates;
4
+ function getAverageRatingFromReviewAggregates(args) {
5
+ const count = Number(args.reviewCount);
6
+ const sum = Number(args.ratingSum);
7
+ let averageRating = 0;
8
+ if (count > 0 && sum > 0) {
9
+ averageRating = sum / count;
10
+ averageRating = Math.round(averageRating * 100) / 100;
11
+ }
12
+ return averageRating;
13
+ }
@@ -1 +1 @@
1
- export * from "./getAverageRatingFromReviewAggregates.util";
1
+ export * from "./getAverageRatingFromReviewAggregates";
@@ -14,4 +14,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./getAverageRatingFromReviewAggregates.util"), exports);
17
+ __exportStar(require("./getAverageRatingFromReviewAggregates"), exports);
@@ -0,0 +1,101 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ /* eslint-disable @typescript-eslint/no-explicit-any */
4
+ const enums_1 = require("../../../enums");
5
+ const stubs_1 = require("../../stubs");
6
+ const computeTotalServiceProviderServiceDurationInMinutesForVehicleType_1 = require("../computeTotalServiceProviderServiceDurationInMinutesForVehicleType");
7
+ describe("computeTotalServiceProviderServiceDurationInMinutesForVehicleType", () => {
8
+ let serviceProviderUserPublicDocument;
9
+ beforeEach(() => { });
10
+ afterEach(() => {
11
+ jest.clearAllMocks();
12
+ });
13
+ it("Should return the sum of services durations", () => {
14
+ serviceProviderUserPublicDocument =
15
+ (0, stubs_1.firestoreServiceProviderUserPublicDocumentStub)({
16
+ services: {
17
+ [enums_1.ServicesTypes.ANIMAL_HAIR_TREATMENT]: (0, stubs_1.providerServiceStub)({
18
+ type: enums_1.ServicesTypes.ANIMAL_HAIR_TREATMENT,
19
+ pricingAndDurationByVehicleType: {
20
+ [enums_1.VehicleTypes.CITY_CAR]: (0, stubs_1.pricingAndDurationForVehicleStub)({
21
+ durationInMinutes: 30,
22
+ }),
23
+ },
24
+ }),
25
+ [enums_1.ServicesTypes.CARPET_SHAMPOO]: (0, stubs_1.providerServiceStub)({
26
+ type: enums_1.ServicesTypes.CARPET_SHAMPOO,
27
+ pricingAndDurationByVehicleType: {
28
+ [enums_1.VehicleTypes.CITY_CAR]: (0, stubs_1.pricingAndDurationForVehicleStub)({
29
+ durationInMinutes: 30,
30
+ }),
31
+ },
32
+ }),
33
+ [enums_1.ServicesTypes.INTERIOR_CLEANING]: (0, stubs_1.providerServiceStub)({
34
+ type: enums_1.ServicesTypes.INTERIOR_CLEANING,
35
+ pricingAndDurationByVehicleType: {
36
+ [enums_1.VehicleTypes.CITY_CAR]: (0, stubs_1.pricingAndDurationForVehicleStub)({
37
+ durationInMinutes: 60,
38
+ }),
39
+ },
40
+ }),
41
+ },
42
+ });
43
+ const result = (0, computeTotalServiceProviderServiceDurationInMinutesForVehicleType_1.computeTotalServiceProviderServiceDurationInMinutesForVehicleType)({
44
+ servicesTypes: [
45
+ enums_1.ServicesTypes.INTERIOR_CLEANING,
46
+ enums_1.ServicesTypes.ANIMAL_HAIR_TREATMENT,
47
+ enums_1.ServicesTypes.CARPET_SHAMPOO,
48
+ ],
49
+ vehicleType: enums_1.VehicleTypes.CITY_CAR,
50
+ services: serviceProviderUserPublicDocument.services,
51
+ });
52
+ expect(result).toBe(120);
53
+ });
54
+ it("Should throw if service type is not found in services", () => {
55
+ serviceProviderUserPublicDocument =
56
+ (0, stubs_1.firestoreServiceProviderUserPublicDocumentStub)({
57
+ services: {
58
+ [enums_1.ServicesTypes.EXTERIOR_CLEANING]: (0, stubs_1.providerServiceStub)({
59
+ type: enums_1.ServicesTypes.EXTERIOR_CLEANING,
60
+ pricingAndDurationByVehicleType: {
61
+ [enums_1.VehicleTypes.CITY_CAR]: (0, stubs_1.pricingAndDurationForVehicleStub)({
62
+ durationInMinutes: 30,
63
+ }),
64
+ },
65
+ }),
66
+ },
67
+ });
68
+ expect(() => (0, computeTotalServiceProviderServiceDurationInMinutesForVehicleType_1.computeTotalServiceProviderServiceDurationInMinutesForVehicleType)({
69
+ servicesTypes: [enums_1.ServicesTypes.INTERIOR_CLEANING],
70
+ vehicleType: enums_1.VehicleTypes.CITY_CAR,
71
+ services: serviceProviderUserPublicDocument.services,
72
+ })).toThrow(`computeTotalServiceProviderServiceDurationInMinutes: Service type ${enums_1.ServicesTypes.INTERIOR_CLEANING} not found for vehicle type ${enums_1.VehicleTypes.CITY_CAR}`);
73
+ });
74
+ it("Should throw if a service exists but has no pricingAndDuration for the requested vehicle", async () => {
75
+ serviceProviderUserPublicDocument =
76
+ (0, stubs_1.firestoreServiceProviderUserPublicDocumentStub)({
77
+ services: {
78
+ [enums_1.ServicesTypes.EXTERIOR_CLEANING]: (0, stubs_1.providerServiceStub)({
79
+ type: enums_1.ServicesTypes.EXTERIOR_CLEANING,
80
+ pricingAndDurationByVehicleType: {
81
+ [enums_1.VehicleTypes.SEDAN]: (0, stubs_1.pricingAndDurationForVehicleStub)({
82
+ durationInMinutes: 45,
83
+ }),
84
+ },
85
+ }),
86
+ },
87
+ });
88
+ await expect(() => (0, computeTotalServiceProviderServiceDurationInMinutesForVehicleType_1.computeTotalServiceProviderServiceDurationInMinutesForVehicleType)({
89
+ servicesTypes: [enums_1.ServicesTypes.EXTERIOR_CLEANING],
90
+ vehicleType: enums_1.VehicleTypes.CITY_CAR,
91
+ services: serviceProviderUserPublicDocument.services,
92
+ })).toThrow(`computeTotalServiceProviderServiceDurationInMinutes: Service type ${enums_1.ServicesTypes.EXTERIOR_CLEANING} not found for vehicle type ${enums_1.VehicleTypes.CITY_CAR}`);
93
+ });
94
+ it("Should throw if services is undefined", () => {
95
+ expect(() => (0, computeTotalServiceProviderServiceDurationInMinutesForVehicleType_1.computeTotalServiceProviderServiceDurationInMinutesForVehicleType)({
96
+ servicesTypes: [enums_1.ServicesTypes.EXTERIOR_CLEANING],
97
+ vehicleType: enums_1.VehicleTypes.CITY_CAR,
98
+ services: undefined,
99
+ })).toThrow(`computeTotalServiceProviderServiceDurationInMinutes: Service type ${enums_1.ServicesTypes.EXTERIOR_CLEANING} not found for vehicle type ${enums_1.VehicleTypes.CITY_CAR}`);
100
+ });
101
+ });
@@ -3,10 +3,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const enums_1 = require("../../../enums");
4
4
  const createServiceVehicleComboKey_1 = require("../createServiceVehicleComboKey");
5
5
  describe("createServiceVehicleComboKey", () => {
6
- it("should return a string with the professionalServiceType and vehicleType separated by an underscore", () => {
7
- const professionalServiceType = enums_1.ServicesTypes.INTERIOR_CLEANING;
6
+ it("should return a string with the serviceType and vehicleType separated by an underscore", () => {
7
+ const serviceType = enums_1.ServicesTypes.INTERIOR_CLEANING;
8
8
  const vehicleType = enums_1.VehicleTypes.CITY_CAR;
9
- const result = (0, createServiceVehicleComboKey_1.createServiceVehicleComboKey)(professionalServiceType, vehicleType);
10
- expect(result).toBe(`${professionalServiceType}_${vehicleType}`);
9
+ const result = (0, createServiceVehicleComboKey_1.createServiceVehicleComboKey)(serviceType, vehicleType);
10
+ expect(result).toBe(`${serviceType}_${vehicleType}`);
11
11
  });
12
12
  });