@doctocar/tooling 0.3.1-21 → 0.3.1-22
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.
- package/dist/emails/types/professional/ProfessionalOrderIssueReportedConfirmationEmailData.type.d.ts +1 -1
- package/dist/emails/types/professional/ProfessionalServiceCompletedByProfessionalEmailData.type.d.ts +1 -1
- package/dist/errors/enums/cloudFunctions/orders/CancelConfirmedOrInProgressOrderErrorCodes.enum.d.ts +1 -1
- package/dist/errors/enums/cloudFunctions/orders/CancelConfirmedOrInProgressOrderErrorCodes.enum.js +1 -1
- package/dist/errors/enums/cloudFunctions/orders/ConfirmServiceCompletionByServiceProviderErrorCodes.enum.d.ts +7 -0
- package/dist/errors/enums/cloudFunctions/orders/ConfirmServiceCompletionByServiceProviderErrorCodes.enum.js +11 -0
- package/dist/errors/enums/cloudFunctions/orders/StartConfirmedOrderByServiceProviderErrorCodes.enum.d.ts +6 -0
- package/dist/errors/enums/cloudFunctions/orders/StartConfirmedOrderByServiceProviderErrorCodes.enum.js +10 -0
- package/dist/errors/enums/cloudFunctions/orders/index.d.ts +2 -2
- package/dist/errors/enums/cloudFunctions/orders/index.js +2 -2
- package/dist/errors/enums/cloudFunctions/serviceProviderUsers/DeleteServiceProviderUserServiceErrorCodes.enum.d.ts +1 -1
- package/dist/errors/enums/cloudFunctions/serviceProviderUsers/DeleteServiceProviderUserServiceErrorCodes.enum.js +1 -1
- package/dist/errors/enums/cloudFunctions/serviceProviderUsers/UpdateServiceProviderUserServiceErrorCodes.enum.d.ts +1 -1
- package/dist/errors/enums/cloudFunctions/serviceProviderUsers/UpdateServiceProviderUserServiceErrorCodes.enum.js +1 -1
- package/dist/firebase/cloudFunctions/enums/OnCallCloudFunctionsNames.enum.d.ts +2 -2
- package/dist/firebase/cloudFunctions/enums/OnCallCloudFunctionsNames.enum.js +2 -2
- package/dist/firebase/cloudFunctions/enums/TaskCloudFunctionsNames.enum.d.ts +1 -1
- package/dist/firebase/cloudFunctions/enums/TaskCloudFunctionsNames.enum.js +1 -1
- package/dist/firebase/cloudFunctions/maps/OnCallCloudFunctionsTypeMappings.map.d.ts +7 -7
- package/dist/firebase/cloudFunctions/types/orders/ConfirmServiceCompletionByServiceProviderRequestData.type.d.ts +4 -0
- package/dist/firebase/cloudFunctions/types/orders/ConfirmServiceCompletionByServiceProviderRequestData.type.js +2 -0
- package/dist/firebase/cloudFunctions/types/orders/ConfirmServiceCompletionByServiceProviderResponseData.type.d.ts +1 -0
- package/dist/firebase/cloudFunctions/types/orders/ConfirmServiceCompletionByServiceProviderResponseData.type.js +2 -0
- package/dist/firebase/cloudFunctions/types/orders/StartConfirmedOrderByServiceProviderRequestData.type.d.ts +4 -0
- package/dist/firebase/cloudFunctions/types/orders/StartConfirmedOrderByServiceProviderRequestData.type.js +2 -0
- package/dist/firebase/cloudFunctions/types/orders/StartConfirmedOrderByServiceProviderResponseData.type.d.ts +1 -0
- package/dist/firebase/cloudFunctions/types/orders/StartConfirmedOrderByServiceProviderResponseData.type.js +2 -0
- package/dist/firebase/cloudFunctions/types/orders/index.d.ts +4 -4
- package/dist/firebase/cloudFunctions/types/orders/index.js +4 -4
- package/dist/firebase/cloudFunctions/types/users/serviceProviderUsers/UpdateServiceProviderUserServiceRequestData.type.d.ts +2 -2
- package/dist/firebase/firestore/constants/index.d.ts +4 -4
- package/dist/firebase/firestore/constants/index.js +4 -4
- package/dist/firebase/firestore/constants/providerLocationServiceMaxRadiusInKM.constant.d.ts +1 -0
- package/dist/firebase/firestore/constants/providerLocationServiceMaxRadiusInKM.constant.js +4 -0
- package/dist/firebase/firestore/constants/providerLocationServiceMinRadiusInKM.constant.d.ts +1 -0
- package/dist/firebase/firestore/constants/providerLocationServiceMinRadiusInKM.constant.js +4 -0
- package/dist/firebase/firestore/constants/providerServiceMinimumDurationIncrementInMinutes.constant.d.ts +1 -0
- package/dist/firebase/firestore/constants/providerServiceMinimumDurationIncrementInMinutes.constant.js +4 -0
- package/dist/firebase/firestore/constants/providerServiceMinimumPriceIncrementInCents.constant.d.ts +1 -0
- package/dist/firebase/firestore/constants/providerServiceMinimumPriceIncrementInCents.constant.js +4 -0
- package/dist/firebase/firestore/enums/FirestoreCollections.enum.d.ts +1 -1
- package/dist/firebase/firestore/enums/FirestoreCollections.enum.js +1 -1
- package/dist/firebase/firestore/enums/orders/OrderCancellationByTypes.enum.d.ts +1 -1
- package/dist/firebase/firestore/enums/orders/OrderCancellationByTypes.enum.js +1 -1
- package/dist/firebase/firestore/enums/orders/OrderServiceProviderCancellationReason.enum.d.ts +7 -7
- package/dist/firebase/firestore/enums/orders/OrderServiceProviderCancellationReason.enum.js +7 -7
- package/dist/firebase/firestore/enums/orders/dispute/OrderDisputeOpenedBy.enum.d.ts +1 -1
- package/dist/firebase/firestore/enums/orders/dispute/OrderDisputeOpenedBy.enum.js +1 -1
- package/dist/firebase/firestore/enums/orders/index.d.ts +1 -1
- package/dist/firebase/firestore/enums/orders/index.js +1 -1
- package/dist/firebase/firestore/enums/ordersIssues/CustomerOrderIssueReason.enum.d.ts +2 -2
- package/dist/firebase/firestore/enums/ordersIssues/CustomerOrderIssueReason.enum.js +2 -2
- package/dist/firebase/firestore/enums/ordersIssues/ServiceProviderOrderIssueReason.enum.d.ts +10 -0
- package/dist/firebase/firestore/enums/ordersIssues/ServiceProviderOrderIssueReason.enum.js +14 -0
- package/dist/firebase/firestore/enums/ordersIssues/index.d.ts +1 -1
- package/dist/firebase/firestore/enums/ordersIssues/index.js +1 -1
- package/dist/firebase/firestore/enums/users/professionals/ServiceProviderBadgesTypes.enum.d.ts +3 -0
- package/dist/firebase/firestore/enums/users/professionals/ServiceProviderBadgesTypes.enum.js +7 -0
- package/dist/firebase/firestore/enums/users/professionals/index.d.ts +1 -1
- package/dist/firebase/firestore/enums/users/professionals/index.js +1 -1
- package/dist/firebase/firestore/maps/FirestoreCollectionDocumentTypeMap.d.ts +2 -2
- package/dist/firebase/firestore/types/index.d.ts +1 -1
- package/dist/firebase/firestore/types/index.js +1 -1
- package/dist/firebase/firestore/types/order/FirestoreOrderCancellationReason.type.d.ts +2 -2
- package/dist/firebase/firestore/types/ordersIssues/OrderIssueReason.type.d.ts +2 -2
- package/dist/firebase/firestore/types/ordersReviews/FirestoreOrderReviewDocument.type.d.ts +1 -1
- package/dist/firebase/firestore/types/serviceProviderUserPublicDocument/FirestoreServiceProviderUserPublicDocument.type.d.ts +49 -0
- package/dist/firebase/firestore/types/serviceProviderUserPublicDocument/FirestoreServiceProviderUserPublicDocument.type.js +2 -0
- package/dist/firebase/firestore/types/serviceProviderUserPublicDocument/FirestoreServiceProviderUserPublicDocumentReviewAggregates.type.d.ts +4 -0
- package/dist/firebase/firestore/types/serviceProviderUserPublicDocument/FirestoreServiceProviderUserPublicDocumentReviewAggregates.type.js +2 -0
- package/dist/firebase/firestore/types/serviceProviderUserPublicDocument/FirestoreServiceProviderUserPublicDocumentServicesLocation.type.d.ts +4 -0
- package/dist/firebase/firestore/types/serviceProviderUserPublicDocument/FirestoreServiceProviderUserPublicDocumentServicesLocation.type.js +2 -0
- package/dist/firebase/firestore/types/serviceProviderUserPublicDocument/index.d.ts +3 -0
- package/dist/firebase/firestore/types/serviceProviderUserPublicDocument/index.js +19 -0
- package/dist/firebase/firestore/types/services/ProviderService.type.d.ts +8 -0
- package/dist/firebase/firestore/types/services/ProviderService.type.js +2 -0
- package/dist/firebase/firestore/types/services/ServiceProviderService.type.d.ts +8 -0
- package/dist/firebase/firestore/types/services/ServiceProviderService.type.js +2 -0
- package/dist/firebase/firestore/types/services/index.d.ts +1 -1
- package/dist/firebase/firestore/types/services/index.js +1 -1
- package/dist/firebase/firestore/utils/dataValidators/services/__tests__/isValidProfessionalService.test.js +11 -11
- package/dist/firebase/firestore/utils/dataValidators/services/__tests__/isValidProviderService.test.d.ts +1 -0
- package/dist/firebase/firestore/utils/dataValidators/services/__tests__/isValidProviderService.test.js +172 -0
- package/dist/firebase/firestore/utils/dataValidators/services/__tests__/isValidServicePricingAndDurationForVehicle.test.js +9 -9
- package/dist/firebase/firestore/utils/dataValidators/services/index.d.ts +1 -1
- package/dist/firebase/firestore/utils/dataValidators/services/index.js +1 -1
- package/dist/firebase/firestore/utils/dataValidators/services/isValidProfessionalService.d.ts +1 -1
- package/dist/firebase/firestore/utils/dataValidators/services/isValidProfessionalService.js +13 -13
- package/dist/firebase/firestore/utils/dataValidators/services/isValidProviderService.d.ts +2 -0
- package/dist/firebase/firestore/utils/dataValidators/services/isValidProviderService.js +42 -0
- package/dist/firebase/firestore/utils/dataValidators/services/isValidServicePricingAndDurationForVehicle.js +2 -2
- package/dist/firebase/firestore/utils/dataValidators/services/types/IsValidProfessionalServiceParams.type.d.ts +2 -2
- package/dist/firebase/firestore/utils/dataValidators/services/types/IsValidProviderServiceParams.type.d.ts +6 -0
- package/dist/firebase/firestore/utils/dataValidators/services/types/IsValidProviderServiceParams.type.js +2 -0
- package/dist/firebase/firestore/utils/dataValidators/services/types/index.d.ts +1 -1
- package/dist/firebase/firestore/utils/dataValidators/services/types/index.js +1 -1
- package/dist/firebase/firestore/utils/order/__tests__/buildOrderServicePreTaxLinesAndServicesDetails.test.js +13 -13
- package/dist/firebase/firestore/utils/order/buildOrderServicePreTaxLinesAndServicesDetails.d.ts +1 -1
- package/dist/firebase/firestore/utils/order/buildOrderServicePreTaxLinesAndServicesDetails.js +2 -2
- package/dist/firebase/firestore/utils/order/types/BuildOrderServicePreTaxLinesAndServicesDetailsProps.type.d.ts +2 -2
- package/dist/firebase/firestore/utils/reviews/__tests__/getAverageRatingFromReviewAggregates.test.d.ts +1 -0
- package/dist/firebase/firestore/utils/reviews/__tests__/getAverageRatingFromReviewAggregates.test.js +97 -0
- package/dist/firebase/firestore/utils/reviews/getAverageRatingFromReviewAggregates.d.ts +2 -0
- package/dist/firebase/firestore/utils/reviews/getAverageRatingFromReviewAggregates.js +13 -0
- package/dist/firebase/firestore/utils/reviews/index.d.ts +1 -1
- package/dist/firebase/firestore/utils/reviews/index.js +1 -1
- package/dist/firebase/firestore/utils/services/__tests__/computeTotalServiceProviderServiceDurationInMinutesForVehicleType.test.d.ts +1 -0
- package/dist/firebase/firestore/utils/services/__tests__/computeTotalServiceProviderServiceDurationInMinutesForVehicleType.test.js +101 -0
- package/dist/firebase/firestore/utils/services/__tests__/createServiceVehicleComboKey.test.js +4 -4
- package/dist/firebase/firestore/utils/services/__tests__/getBookableServiceProviderServicesForVehicleType.test.js +49 -49
- package/dist/firebase/firestore/utils/services/__tests__/getServiceProviderActiveServicePricingAndDurationForVehicleOrThrow.test.js +32 -32
- package/dist/firebase/firestore/utils/services/computeTotalServiceProviderServiceDurationInMinutesForVehicleType.d.ts +2 -0
- package/dist/firebase/firestore/utils/services/computeTotalServiceProviderServiceDurationInMinutesForVehicleType.js +18 -0
- package/dist/firebase/firestore/utils/services/getBookableServiceProviderServicesForVehicleType.d.ts +3 -3
- package/dist/firebase/firestore/utils/services/getBookableServiceProviderServicesForVehicleType.js +11 -11
- package/dist/firebase/firestore/utils/services/getServiceProviderActiveServicePricingAndDurationForVehicleOrThrow.d.ts +1 -1
- package/dist/firebase/firestore/utils/services/getServiceProviderActiveServicePricingAndDurationForVehicleOrThrow.js +2 -2
- package/dist/firebase/firestore/utils/services/index.d.ts +1 -1
- package/dist/firebase/firestore/utils/services/index.js +1 -1
- package/dist/firebase/firestore/utils/services/types/ComputeTotalServiceProviderServiceDurationInMinutesForVehicleTypeArgs.type.d.ts +7 -0
- package/dist/firebase/firestore/utils/services/types/ComputeTotalServiceProviderServiceDurationInMinutesForVehicleTypeArgs.type.js +2 -0
- package/dist/firebase/firestore/utils/services/types/GetBookableServiceProviderServicesForVehicleTypeParams.type.d.ts +2 -2
- package/dist/firebase/firestore/utils/services/types/GetServiceProviderActiveServicePricingAndDurationForVehicleOrThrowParams.type.d.ts +2 -2
- package/dist/firebase/firestore/utils/services/types/index.d.ts +1 -1
- package/dist/firebase/firestore/utils/services/types/index.js +1 -1
- package/dist/firebase/firestore/utils/stubs/index.d.ts +1 -1
- package/dist/firebase/firestore/utils/stubs/index.js +1 -1
- package/dist/firebase/firestore/utils/stubs/ordersReviews/firestoreOrderReviewDocumentStub.js +1 -1
- package/dist/firebase/firestore/utils/stubs/serviceProviderUserPublicDocument/firestoreServiceProviderUserPublicDocumentStub.d.ts +2 -0
- package/dist/firebase/firestore/utils/stubs/serviceProviderUserPublicDocument/firestoreServiceProviderUserPublicDocumentStub.js +44 -0
- package/dist/firebase/firestore/utils/stubs/serviceProviderUserPublicDocument/index.d.ts +1 -0
- package/dist/firebase/firestore/utils/stubs/serviceProviderUserPublicDocument/index.js +17 -0
- package/dist/firebase/firestore/utils/stubs/services/index.d.ts +1 -1
- package/dist/firebase/firestore/utils/stubs/services/index.js +1 -1
- package/dist/firebase/firestore/utils/stubs/services/pricingAndDurationForVehicleStub.js +2 -2
- package/dist/firebase/firestore/utils/stubs/services/providerServiceStub.d.ts +5 -0
- package/dist/firebase/firestore/utils/stubs/services/providerServiceStub.js +21 -0
- package/dist/firebase/firestore/utils/stubs/services/serviceProviderServiceStub.d.ts +5 -0
- package/dist/firebase/firestore/utils/stubs/services/serviceProviderServiceStub.js +21 -0
- package/dist/firebase/storage/enums/FirebaseStorageBasePaths.enum.js +1 -1
- package/dist/gcp/cloudTask/enums/CloudTasksQueueName.enum.d.ts +1 -1
- package/dist/gcp/cloudTask/enums/CloudTasksQueueName.enum.js +1 -1
- package/dist/gcp/cloudTask/maps/CloudTaskEnvelopeMap.map.d.ts +2 -2
- package/dist/gcp/cloudTask/types/OnTaskRecomputeServiceProviderAvailabilityEnvelope.type.d.ts +1 -1
- package/dist/gcp/cloudTask/types/index.d.ts +1 -1
- package/dist/gcp/cloudTask/types/index.js +1 -1
- package/dist/gcp/cloudTask/utils/stubs/index.d.ts +1 -1
- package/dist/gcp/cloudTask/utils/stubs/index.js +1 -1
- package/dist/gcp/cloudTask/utils/stubs/onTaskRecomputeServiceProviderAvailabilityEnvelopeStub.js +1 -1
- package/dist/pricing/__tests__/calculateInvoiceTotalWithTax.util.test.js +3 -3
- package/dist/stripe/types/StripeCustomServiceProviderPayoutMetadata.type.d.ts +5 -0
- package/dist/stripe/types/StripeCustomServiceProviderPayoutMetadata.type.js +2 -0
- package/dist/stripe/types/index.d.ts +1 -1
- package/dist/stripe/types/index.js +1 -1
- package/package.json +1 -1
|
@@ -21,9 +21,9 @@ describe("getBookableServiceProviderServicesForVehicleType", () => {
|
|
|
21
21
|
};
|
|
22
22
|
getAvailableServicesPublicConfigForVehicleTypeMock.mockReturnValue(getAvailableServicesPublicConfigForVehicleTypeReturn);
|
|
23
23
|
serviceProviderUserPublicDocument =
|
|
24
|
-
(0, stubs_1.
|
|
25
|
-
|
|
26
|
-
[enums_1.ServicesTypes.EXTERIOR_CLEANING]: (0, stubs_1.
|
|
24
|
+
(0, stubs_1.firestoreServiceProviderUserPublicDocumentStub)({
|
|
25
|
+
services: {
|
|
26
|
+
[enums_1.ServicesTypes.EXTERIOR_CLEANING]: (0, stubs_1.providerServiceStub)({
|
|
27
27
|
isActive: true,
|
|
28
28
|
pricingAndDurationByVehicleType: {
|
|
29
29
|
[enums_1.VehicleTypes.SEDAN]: (0, stubs_1.pricingAndDurationForVehicleStub)({
|
|
@@ -44,7 +44,7 @@ describe("getBookableServiceProviderServicesForVehicleType", () => {
|
|
|
44
44
|
it("delegates service config filtering by vehicle type", () => {
|
|
45
45
|
(0, getBookableServiceProviderServicesForVehicleType_1.getBookableServiceProviderServicesForVehicleType)({
|
|
46
46
|
countryServicesPublicConfig: {},
|
|
47
|
-
|
|
47
|
+
serviceProviderUserPublicDocument: serviceProviderUserPublicDocument,
|
|
48
48
|
vehicleType: enums_1.VehicleTypes.SEDAN,
|
|
49
49
|
});
|
|
50
50
|
expect(getAvailableServicesPublicConfigForVehicleTypeMock).toHaveBeenCalledWith({
|
|
@@ -55,12 +55,12 @@ describe("getBookableServiceProviderServicesForVehicleType", () => {
|
|
|
55
55
|
it("returns empty arrays when config helper returns no services", () => {
|
|
56
56
|
const result = (0, getBookableServiceProviderServicesForVehicleType_1.getBookableServiceProviderServicesForVehicleType)({
|
|
57
57
|
countryServicesPublicConfig: {},
|
|
58
|
-
|
|
58
|
+
serviceProviderUserPublicDocument: serviceProviderUserPublicDocument,
|
|
59
59
|
vehicleType: enums_1.VehicleTypes.SEDAN,
|
|
60
60
|
});
|
|
61
61
|
expect(result).toEqual({
|
|
62
|
-
|
|
63
|
-
|
|
62
|
+
availableMainServiceProviderServices: [],
|
|
63
|
+
availableSubServiceProviderServices: [],
|
|
64
64
|
});
|
|
65
65
|
});
|
|
66
66
|
it("keeps matching active main and sub services", () => {
|
|
@@ -78,9 +78,9 @@ describe("getBookableServiceProviderServicesForVehicleType", () => {
|
|
|
78
78
|
};
|
|
79
79
|
getAvailableServicesPublicConfigForVehicleTypeMock.mockReturnValue(getAvailableServicesPublicConfigForVehicleTypeReturn);
|
|
80
80
|
serviceProviderUserPublicDocument =
|
|
81
|
-
(0, stubs_1.
|
|
82
|
-
|
|
83
|
-
[enums_1.ServicesTypes.EXTERIOR_CLEANING]: (0, stubs_1.
|
|
81
|
+
(0, stubs_1.firestoreServiceProviderUserPublicDocumentStub)({
|
|
82
|
+
services: {
|
|
83
|
+
[enums_1.ServicesTypes.EXTERIOR_CLEANING]: (0, stubs_1.providerServiceStub)({
|
|
84
84
|
isActive: true,
|
|
85
85
|
pricingAndDurationByVehicleType: {
|
|
86
86
|
[enums_1.VehicleTypes.SEDAN]: (0, stubs_1.pricingAndDurationForVehicleStub)({
|
|
@@ -88,7 +88,7 @@ describe("getBookableServiceProviderServicesForVehicleType", () => {
|
|
|
88
88
|
}),
|
|
89
89
|
},
|
|
90
90
|
}),
|
|
91
|
-
[enums_1.ServicesTypes.CARPET_SHAMPOO]: (0, stubs_1.
|
|
91
|
+
[enums_1.ServicesTypes.CARPET_SHAMPOO]: (0, stubs_1.providerServiceStub)({
|
|
92
92
|
isActive: true,
|
|
93
93
|
pricingAndDurationByVehicleType: {
|
|
94
94
|
[enums_1.VehicleTypes.SEDAN]: (0, stubs_1.pricingAndDurationForVehicleStub)({
|
|
@@ -100,14 +100,14 @@ describe("getBookableServiceProviderServicesForVehicleType", () => {
|
|
|
100
100
|
});
|
|
101
101
|
const result = (0, getBookableServiceProviderServicesForVehicleType_1.getBookableServiceProviderServicesForVehicleType)({
|
|
102
102
|
countryServicesPublicConfig: {},
|
|
103
|
-
|
|
103
|
+
serviceProviderUserPublicDocument: serviceProviderUserPublicDocument,
|
|
104
104
|
vehicleType: enums_1.VehicleTypes.SEDAN,
|
|
105
105
|
});
|
|
106
|
-
expect(result.
|
|
107
|
-
serviceProviderUserPublicDocument.
|
|
106
|
+
expect(result.availableMainServiceProviderServices).toEqual([
|
|
107
|
+
serviceProviderUserPublicDocument.services[enums_1.ServicesTypes.EXTERIOR_CLEANING],
|
|
108
108
|
]);
|
|
109
|
-
expect(result.
|
|
110
|
-
serviceProviderUserPublicDocument.
|
|
109
|
+
expect(result.availableSubServiceProviderServices).toEqual([
|
|
110
|
+
serviceProviderUserPublicDocument.services[enums_1.ServicesTypes.CARPET_SHAMPOO],
|
|
111
111
|
]);
|
|
112
112
|
});
|
|
113
113
|
it("filters out services not offered by the service provider", () => {
|
|
@@ -121,10 +121,10 @@ describe("getBookableServiceProviderServicesForVehicleType", () => {
|
|
|
121
121
|
getAvailableServicesPublicConfigForVehicleTypeMock.mockReturnValue(getAvailableServicesPublicConfigForVehicleTypeReturn);
|
|
122
122
|
const result = (0, getBookableServiceProviderServicesForVehicleType_1.getBookableServiceProviderServicesForVehicleType)({
|
|
123
123
|
countryServicesPublicConfig: {},
|
|
124
|
-
|
|
124
|
+
serviceProviderUserPublicDocument: serviceProviderUserPublicDocument,
|
|
125
125
|
vehicleType: enums_1.VehicleTypes.SEDAN,
|
|
126
126
|
});
|
|
127
|
-
expect(result.
|
|
127
|
+
expect(result.availableMainServiceProviderServices).toEqual([]);
|
|
128
128
|
});
|
|
129
129
|
it("filters out services disabled at service provider level", () => {
|
|
130
130
|
const exteriorCleaning = (0, stubs_1.firestoreServicesPublicConfigStub)({
|
|
@@ -136,19 +136,19 @@ describe("getBookableServiceProviderServicesForVehicleType", () => {
|
|
|
136
136
|
};
|
|
137
137
|
getAvailableServicesPublicConfigForVehicleTypeMock.mockReturnValue(getAvailableServicesPublicConfigForVehicleTypeReturn);
|
|
138
138
|
serviceProviderUserPublicDocument =
|
|
139
|
-
(0, stubs_1.
|
|
140
|
-
|
|
141
|
-
[enums_1.ServicesTypes.EXTERIOR_CLEANING]: (0, stubs_1.
|
|
139
|
+
(0, stubs_1.firestoreServiceProviderUserPublicDocumentStub)({
|
|
140
|
+
services: {
|
|
141
|
+
[enums_1.ServicesTypes.EXTERIOR_CLEANING]: (0, stubs_1.providerServiceStub)({
|
|
142
142
|
isActive: false,
|
|
143
143
|
}),
|
|
144
144
|
},
|
|
145
145
|
});
|
|
146
146
|
const result = (0, getBookableServiceProviderServicesForVehicleType_1.getBookableServiceProviderServicesForVehicleType)({
|
|
147
147
|
countryServicesPublicConfig: {},
|
|
148
|
-
|
|
148
|
+
serviceProviderUserPublicDocument: serviceProviderUserPublicDocument,
|
|
149
149
|
vehicleType: enums_1.VehicleTypes.SEDAN,
|
|
150
150
|
});
|
|
151
|
-
expect(result.
|
|
151
|
+
expect(result.availableMainServiceProviderServices).toEqual([]);
|
|
152
152
|
});
|
|
153
153
|
it("filters out services with missing pricing for the requested vehicle type", () => {
|
|
154
154
|
const exteriorCleaning = (0, stubs_1.firestoreServicesPublicConfigStub)({
|
|
@@ -160,9 +160,9 @@ describe("getBookableServiceProviderServicesForVehicleType", () => {
|
|
|
160
160
|
};
|
|
161
161
|
getAvailableServicesPublicConfigForVehicleTypeMock.mockReturnValue(getAvailableServicesPublicConfigForVehicleTypeReturn);
|
|
162
162
|
serviceProviderUserPublicDocument =
|
|
163
|
-
(0, stubs_1.
|
|
164
|
-
|
|
165
|
-
[enums_1.ServicesTypes.EXTERIOR_CLEANING]: (0, stubs_1.
|
|
163
|
+
(0, stubs_1.firestoreServiceProviderUserPublicDocumentStub)({
|
|
164
|
+
services: {
|
|
165
|
+
[enums_1.ServicesTypes.EXTERIOR_CLEANING]: (0, stubs_1.providerServiceStub)({
|
|
166
166
|
isActive: true,
|
|
167
167
|
pricingAndDurationByVehicleType: {
|
|
168
168
|
[enums_1.VehicleTypes.SUV]: (0, stubs_1.pricingAndDurationForVehicleStub)({
|
|
@@ -175,10 +175,10 @@ describe("getBookableServiceProviderServicesForVehicleType", () => {
|
|
|
175
175
|
});
|
|
176
176
|
const result = (0, getBookableServiceProviderServicesForVehicleType_1.getBookableServiceProviderServicesForVehicleType)({
|
|
177
177
|
countryServicesPublicConfig: {},
|
|
178
|
-
|
|
178
|
+
serviceProviderUserPublicDocument: serviceProviderUserPublicDocument,
|
|
179
179
|
vehicleType: enums_1.VehicleTypes.SEDAN,
|
|
180
180
|
});
|
|
181
|
-
expect(result.
|
|
181
|
+
expect(result.availableMainServiceProviderServices).toEqual([]);
|
|
182
182
|
});
|
|
183
183
|
it("filters out services with inactive pricing for the requested vehicle type", () => {
|
|
184
184
|
const exteriorCleaning = (0, stubs_1.firestoreServicesPublicConfigStub)({
|
|
@@ -190,9 +190,9 @@ describe("getBookableServiceProviderServicesForVehicleType", () => {
|
|
|
190
190
|
};
|
|
191
191
|
getAvailableServicesPublicConfigForVehicleTypeMock.mockReturnValue(getAvailableServicesPublicConfigForVehicleTypeReturn);
|
|
192
192
|
serviceProviderUserPublicDocument =
|
|
193
|
-
(0, stubs_1.
|
|
194
|
-
|
|
195
|
-
[enums_1.ServicesTypes.EXTERIOR_CLEANING]: (0, stubs_1.
|
|
193
|
+
(0, stubs_1.firestoreServiceProviderUserPublicDocumentStub)({
|
|
194
|
+
services: {
|
|
195
|
+
[enums_1.ServicesTypes.EXTERIOR_CLEANING]: (0, stubs_1.providerServiceStub)({
|
|
196
196
|
isActive: true,
|
|
197
197
|
pricingAndDurationByVehicleType: {
|
|
198
198
|
[enums_1.VehicleTypes.SEDAN]: (0, stubs_1.pricingAndDurationForVehicleStub)({
|
|
@@ -205,10 +205,10 @@ describe("getBookableServiceProviderServicesForVehicleType", () => {
|
|
|
205
205
|
});
|
|
206
206
|
const result = (0, getBookableServiceProviderServicesForVehicleType_1.getBookableServiceProviderServicesForVehicleType)({
|
|
207
207
|
countryServicesPublicConfig: {},
|
|
208
|
-
|
|
208
|
+
serviceProviderUserPublicDocument: serviceProviderUserPublicDocument,
|
|
209
209
|
vehicleType: enums_1.VehicleTypes.SEDAN,
|
|
210
210
|
});
|
|
211
|
-
expect(result.
|
|
211
|
+
expect(result.availableMainServiceProviderServices).toEqual([]);
|
|
212
212
|
});
|
|
213
213
|
it("preserves service order from vehicle-filtered configuration", () => {
|
|
214
214
|
const firstService = (0, stubs_1.firestoreServicesPublicConfigStub)({
|
|
@@ -223,9 +223,9 @@ describe("getBookableServiceProviderServicesForVehicleType", () => {
|
|
|
223
223
|
};
|
|
224
224
|
getAvailableServicesPublicConfigForVehicleTypeMock.mockReturnValue(getAvailableServicesPublicConfigForVehicleTypeReturn);
|
|
225
225
|
serviceProviderUserPublicDocument =
|
|
226
|
-
(0, stubs_1.
|
|
227
|
-
|
|
228
|
-
[enums_1.ServicesTypes.EXTERIOR_CLEANING]: (0, stubs_1.
|
|
226
|
+
(0, stubs_1.firestoreServiceProviderUserPublicDocumentStub)({
|
|
227
|
+
services: {
|
|
228
|
+
[enums_1.ServicesTypes.EXTERIOR_CLEANING]: (0, stubs_1.providerServiceStub)({
|
|
229
229
|
isActive: true,
|
|
230
230
|
pricingAndDurationByVehicleType: {
|
|
231
231
|
[enums_1.VehicleTypes.SEDAN]: (0, stubs_1.pricingAndDurationForVehicleStub)({
|
|
@@ -233,7 +233,7 @@ describe("getBookableServiceProviderServicesForVehicleType", () => {
|
|
|
233
233
|
}),
|
|
234
234
|
},
|
|
235
235
|
}),
|
|
236
|
-
[enums_1.ServicesTypes.INTERIOR_CLEANING]: (0, stubs_1.
|
|
236
|
+
[enums_1.ServicesTypes.INTERIOR_CLEANING]: (0, stubs_1.providerServiceStub)({
|
|
237
237
|
isActive: true,
|
|
238
238
|
pricingAndDurationByVehicleType: {
|
|
239
239
|
[enums_1.VehicleTypes.SEDAN]: (0, stubs_1.pricingAndDurationForVehicleStub)({
|
|
@@ -245,15 +245,15 @@ describe("getBookableServiceProviderServicesForVehicleType", () => {
|
|
|
245
245
|
});
|
|
246
246
|
const result = (0, getBookableServiceProviderServicesForVehicleType_1.getBookableServiceProviderServicesForVehicleType)({
|
|
247
247
|
countryServicesPublicConfig: {},
|
|
248
|
-
|
|
248
|
+
serviceProviderUserPublicDocument: serviceProviderUserPublicDocument,
|
|
249
249
|
vehicleType: enums_1.VehicleTypes.SEDAN,
|
|
250
250
|
});
|
|
251
|
-
expect(result.
|
|
252
|
-
serviceProviderUserPublicDocument.
|
|
253
|
-
serviceProviderUserPublicDocument.
|
|
251
|
+
expect(result.availableMainServiceProviderServices).toEqual([
|
|
252
|
+
serviceProviderUserPublicDocument.services[enums_1.ServicesTypes.EXTERIOR_CLEANING],
|
|
253
|
+
serviceProviderUserPublicDocument.services[enums_1.ServicesTypes.INTERIOR_CLEANING],
|
|
254
254
|
]);
|
|
255
255
|
});
|
|
256
|
-
it("does not include extra
|
|
256
|
+
it("does not include extra services not present in filtered config", () => {
|
|
257
257
|
const exteriorCleaning = (0, stubs_1.firestoreServicesPublicConfigStub)({
|
|
258
258
|
type: enums_1.ServicesTypes.EXTERIOR_CLEANING,
|
|
259
259
|
});
|
|
@@ -263,9 +263,9 @@ describe("getBookableServiceProviderServicesForVehicleType", () => {
|
|
|
263
263
|
};
|
|
264
264
|
getAvailableServicesPublicConfigForVehicleTypeMock.mockReturnValue(getAvailableServicesPublicConfigForVehicleTypeReturn);
|
|
265
265
|
serviceProviderUserPublicDocument =
|
|
266
|
-
(0, stubs_1.
|
|
267
|
-
|
|
268
|
-
[enums_1.ServicesTypes.EXTERIOR_CLEANING]: (0, stubs_1.
|
|
266
|
+
(0, stubs_1.firestoreServiceProviderUserPublicDocumentStub)({
|
|
267
|
+
services: {
|
|
268
|
+
[enums_1.ServicesTypes.EXTERIOR_CLEANING]: (0, stubs_1.providerServiceStub)({
|
|
269
269
|
isActive: true,
|
|
270
270
|
pricingAndDurationByVehicleType: {
|
|
271
271
|
[enums_1.VehicleTypes.SEDAN]: (0, stubs_1.pricingAndDurationForVehicleStub)({
|
|
@@ -273,7 +273,7 @@ describe("getBookableServiceProviderServicesForVehicleType", () => {
|
|
|
273
273
|
}),
|
|
274
274
|
},
|
|
275
275
|
}),
|
|
276
|
-
[enums_1.ServicesTypes.CARPET_SHAMPOO]: (0, stubs_1.
|
|
276
|
+
[enums_1.ServicesTypes.CARPET_SHAMPOO]: (0, stubs_1.providerServiceStub)({
|
|
277
277
|
isActive: true,
|
|
278
278
|
pricingAndDurationByVehicleType: {
|
|
279
279
|
[enums_1.VehicleTypes.SEDAN]: (0, stubs_1.pricingAndDurationForVehicleStub)({
|
|
@@ -285,11 +285,11 @@ describe("getBookableServiceProviderServicesForVehicleType", () => {
|
|
|
285
285
|
});
|
|
286
286
|
const result = (0, getBookableServiceProviderServicesForVehicleType_1.getBookableServiceProviderServicesForVehicleType)({
|
|
287
287
|
countryServicesPublicConfig: {},
|
|
288
|
-
|
|
288
|
+
serviceProviderUserPublicDocument: serviceProviderUserPublicDocument,
|
|
289
289
|
vehicleType: enums_1.VehicleTypes.SEDAN,
|
|
290
290
|
});
|
|
291
|
-
expect(result.
|
|
292
|
-
serviceProviderUserPublicDocument.
|
|
291
|
+
expect(result.availableMainServiceProviderServices).toEqual([
|
|
292
|
+
serviceProviderUserPublicDocument.services[enums_1.ServicesTypes.EXTERIOR_CLEANING],
|
|
293
293
|
]);
|
|
294
294
|
});
|
|
295
295
|
});
|
|
@@ -7,9 +7,9 @@ const getServiceProviderActiveServicePricingAndDurationForVehicleOrThrow_1 = req
|
|
|
7
7
|
const errorCases = [
|
|
8
8
|
{
|
|
9
9
|
name: "Should throw an error if the service is not offered by the service provider",
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
[enums_2.ServicesTypes.EXTERIOR_CLEANING]: (0, stubs_1.
|
|
10
|
+
serviceProviderUserPublicDocument: (0, stubs_1.firestoreServiceProviderUserPublicDocumentStub)({
|
|
11
|
+
services: {
|
|
12
|
+
[enums_2.ServicesTypes.EXTERIOR_CLEANING]: (0, stubs_1.providerServiceStub)({
|
|
13
13
|
isActive: true,
|
|
14
14
|
type: enums_2.ServicesTypes.EXTERIOR_CLEANING,
|
|
15
15
|
pricingAndDurationByVehicleType: {
|
|
@@ -30,9 +30,9 @@ const errorCases = [
|
|
|
30
30
|
},
|
|
31
31
|
{
|
|
32
32
|
name: "Should throw an error if the service is not active",
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
[enums_2.ServicesTypes.EXTERIOR_CLEANING]: (0, stubs_1.
|
|
33
|
+
serviceProviderUserPublicDocument: (0, stubs_1.firestoreServiceProviderUserPublicDocumentStub)({
|
|
34
|
+
services: {
|
|
35
|
+
[enums_2.ServicesTypes.EXTERIOR_CLEANING]: (0, stubs_1.providerServiceStub)({
|
|
36
36
|
isActive: false,
|
|
37
37
|
type: enums_2.ServicesTypes.EXTERIOR_CLEANING,
|
|
38
38
|
pricingAndDurationByVehicleType: {
|
|
@@ -53,9 +53,9 @@ const errorCases = [
|
|
|
53
53
|
},
|
|
54
54
|
{
|
|
55
55
|
name: "Should throw an error if the vehicle type is not active for the service",
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
[enums_2.ServicesTypes.EXTERIOR_CLEANING]: (0, stubs_1.
|
|
56
|
+
serviceProviderUserPublicDocument: (0, stubs_1.firestoreServiceProviderUserPublicDocumentStub)({
|
|
57
|
+
services: {
|
|
58
|
+
[enums_2.ServicesTypes.EXTERIOR_CLEANING]: (0, stubs_1.providerServiceStub)({
|
|
59
59
|
isActive: true,
|
|
60
60
|
type: enums_2.ServicesTypes.EXTERIOR_CLEANING,
|
|
61
61
|
pricingAndDurationByVehicleType: {
|
|
@@ -76,9 +76,9 @@ const errorCases = [
|
|
|
76
76
|
},
|
|
77
77
|
{
|
|
78
78
|
name: "Should throw an error if the service does not have pricing and duration for the vehicle type",
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
[enums_2.ServicesTypes.EXTERIOR_CLEANING]: (0, stubs_1.
|
|
79
|
+
serviceProviderUserPublicDocument: (0, stubs_1.firestoreServiceProviderUserPublicDocumentStub)({
|
|
80
|
+
services: {
|
|
81
|
+
[enums_2.ServicesTypes.EXTERIOR_CLEANING]: (0, stubs_1.providerServiceStub)({
|
|
82
82
|
type: enums_2.ServicesTypes.EXTERIOR_CLEANING,
|
|
83
83
|
isActive: true,
|
|
84
84
|
pricingAndDurationByVehicleType: {},
|
|
@@ -91,9 +91,9 @@ const errorCases = [
|
|
|
91
91
|
},
|
|
92
92
|
{
|
|
93
93
|
name: "Should throw an error if the service pricing and duration for the vehicle type is missing required pricePreTaxInCents fields",
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
[enums_2.ServicesTypes.EXTERIOR_CLEANING]: (0, stubs_1.
|
|
94
|
+
serviceProviderUserPublicDocument: (0, stubs_1.firestoreServiceProviderUserPublicDocumentStub)({
|
|
95
|
+
services: {
|
|
96
|
+
[enums_2.ServicesTypes.EXTERIOR_CLEANING]: (0, stubs_1.providerServiceStub)({
|
|
97
97
|
type: enums_2.ServicesTypes.EXTERIOR_CLEANING,
|
|
98
98
|
pricingAndDurationByVehicleType: {
|
|
99
99
|
[enums_2.VehicleTypes.SEDAN]: (0, stubs_1.pricingAndDurationForVehicleStub)({
|
|
@@ -113,9 +113,9 @@ const errorCases = [
|
|
|
113
113
|
},
|
|
114
114
|
{
|
|
115
115
|
name: "Should throw an error if the service pricing and duration for the vehicle type is missing required durationInMinutes fields",
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
[enums_2.ServicesTypes.EXTERIOR_CLEANING]: (0, stubs_1.
|
|
116
|
+
serviceProviderUserPublicDocument: (0, stubs_1.firestoreServiceProviderUserPublicDocumentStub)({
|
|
117
|
+
services: {
|
|
118
|
+
[enums_2.ServicesTypes.EXTERIOR_CLEANING]: (0, stubs_1.providerServiceStub)({
|
|
119
119
|
type: enums_2.ServicesTypes.EXTERIOR_CLEANING,
|
|
120
120
|
pricingAndDurationByVehicleType: {
|
|
121
121
|
[enums_2.VehicleTypes.SEDAN]: (0, stubs_1.pricingAndDurationForVehicleStub)({
|
|
@@ -135,9 +135,9 @@ const errorCases = [
|
|
|
135
135
|
},
|
|
136
136
|
{
|
|
137
137
|
name: "Should throw an error if the service pricing and duration for the vehicle type is missing required currency fields",
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
[enums_2.ServicesTypes.EXTERIOR_CLEANING]: (0, stubs_1.
|
|
138
|
+
serviceProviderUserPublicDocument: (0, stubs_1.firestoreServiceProviderUserPublicDocumentStub)({
|
|
139
|
+
services: {
|
|
140
|
+
[enums_2.ServicesTypes.EXTERIOR_CLEANING]: (0, stubs_1.providerServiceStub)({
|
|
141
141
|
type: enums_2.ServicesTypes.EXTERIOR_CLEANING,
|
|
142
142
|
pricingAndDurationByVehicleType: {
|
|
143
143
|
[enums_2.VehicleTypes.SEDAN]: (0, stubs_1.pricingAndDurationForVehicleStub)({
|
|
@@ -157,9 +157,9 @@ const errorCases = [
|
|
|
157
157
|
},
|
|
158
158
|
{
|
|
159
159
|
name: "Should throw an error if the service pricing and duration for the vehicle type is missing required type fields",
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
[enums_2.ServicesTypes.EXTERIOR_CLEANING]: (0, stubs_1.
|
|
160
|
+
serviceProviderUserPublicDocument: (0, stubs_1.firestoreServiceProviderUserPublicDocumentStub)({
|
|
161
|
+
services: {
|
|
162
|
+
[enums_2.ServicesTypes.EXTERIOR_CLEANING]: (0, stubs_1.providerServiceStub)({
|
|
163
163
|
type: enums_2.ServicesTypes.EXTERIOR_CLEANING,
|
|
164
164
|
pricingAndDurationByVehicleType: {
|
|
165
165
|
[enums_2.VehicleTypes.SEDAN]: (0, stubs_1.pricingAndDurationForVehicleStub)({
|
|
@@ -179,12 +179,12 @@ const errorCases = [
|
|
|
179
179
|
},
|
|
180
180
|
];
|
|
181
181
|
describe("getServiceProviderActiveServicePricingAndDurationForVehicleOrThrow", () => {
|
|
182
|
-
let
|
|
182
|
+
let serviceProviderUserPublicDocument;
|
|
183
183
|
beforeEach(() => {
|
|
184
|
-
|
|
185
|
-
(0, stubs_1.
|
|
186
|
-
|
|
187
|
-
[enums_2.ServicesTypes.EXTERIOR_CLEANING]: (0, stubs_1.
|
|
184
|
+
serviceProviderUserPublicDocument =
|
|
185
|
+
(0, stubs_1.firestoreServiceProviderUserPublicDocumentStub)({
|
|
186
|
+
services: {
|
|
187
|
+
[enums_2.ServicesTypes.EXTERIOR_CLEANING]: (0, stubs_1.providerServiceStub)({
|
|
188
188
|
type: enums_2.ServicesTypes.EXTERIOR_CLEANING,
|
|
189
189
|
pricingAndDurationByVehicleType: {
|
|
190
190
|
[enums_2.VehicleTypes.SEDAN]: (0, stubs_1.pricingAndDurationForVehicleStub)({
|
|
@@ -201,7 +201,7 @@ describe("getServiceProviderActiveServicePricingAndDurationForVehicleOrThrow", (
|
|
|
201
201
|
});
|
|
202
202
|
it("should return the correct pricing and duration for a valid service and vehicle type (Happy path)", () => {
|
|
203
203
|
const result = (0, getServiceProviderActiveServicePricingAndDurationForVehicleOrThrow_1.getServiceProviderActiveServicePricingAndDurationForVehicleOrThrow)({
|
|
204
|
-
|
|
204
|
+
serviceProviderUserPublicDocument,
|
|
205
205
|
serviceType: enums_2.ServicesTypes.EXTERIOR_CLEANING,
|
|
206
206
|
vehicleType: enums_2.VehicleTypes.SEDAN,
|
|
207
207
|
});
|
|
@@ -214,9 +214,9 @@ describe("getServiceProviderActiveServicePricingAndDurationForVehicleOrThrow", (
|
|
|
214
214
|
});
|
|
215
215
|
});
|
|
216
216
|
describe("error cases", () => {
|
|
217
|
-
test.each(errorCases)("should throw error if $name", async ({
|
|
217
|
+
test.each(errorCases)("should throw error if $name", async ({ serviceProviderUserPublicDocument, serviceType, vehicleType, error, }) => {
|
|
218
218
|
expect(() => (0, getServiceProviderActiveServicePricingAndDurationForVehicleOrThrow_1.getServiceProviderActiveServicePricingAndDurationForVehicleOrThrow)({
|
|
219
|
-
|
|
219
|
+
serviceProviderUserPublicDocument,
|
|
220
220
|
serviceType,
|
|
221
221
|
vehicleType,
|
|
222
222
|
})).toThrow(error);
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import type { ComputeTotalServiceProviderServiceDurationInMinutesForVehicleTypeArgs } from "./types";
|
|
2
|
+
export declare function computeTotalServiceProviderServiceDurationInMinutesForVehicleType({ servicesTypes, services, vehicleType, }: ComputeTotalServiceProviderServiceDurationInMinutesForVehicleTypeArgs): number;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.computeTotalServiceProviderServiceDurationInMinutesForVehicleType = computeTotalServiceProviderServiceDurationInMinutesForVehicleType;
|
|
4
|
+
function computeTotalServiceProviderServiceDurationInMinutesForVehicleType({ servicesTypes, services, vehicleType, }) {
|
|
5
|
+
let totalServiceDurationInMinutes = 0;
|
|
6
|
+
for (const serviceType of servicesTypes) {
|
|
7
|
+
if (!services?.[serviceType]?.pricingAndDurationByVehicleType?.[vehicleType]
|
|
8
|
+
?.durationInMinutes) {
|
|
9
|
+
throw new Error(`computeTotalServiceProviderServiceDurationInMinutes: Service type ${serviceType} not found for vehicle type ${vehicleType}`);
|
|
10
|
+
}
|
|
11
|
+
else {
|
|
12
|
+
totalServiceDurationInMinutes +=
|
|
13
|
+
services[serviceType].pricingAndDurationByVehicleType[vehicleType]
|
|
14
|
+
.durationInMinutes;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
return totalServiceDurationInMinutes;
|
|
18
|
+
}
|
package/dist/firebase/firestore/utils/services/getBookableServiceProviderServicesForVehicleType.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { GetBookableServiceProviderServicesForVehicleTypeParams } from "./types";
|
|
2
|
-
export declare function getBookableServiceProviderServicesForVehicleType({ countryServicesPublicConfig,
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
export declare function getBookableServiceProviderServicesForVehicleType({ countryServicesPublicConfig, serviceProviderUserPublicDocument, vehicleType, }: GetBookableServiceProviderServicesForVehicleTypeParams): {
|
|
3
|
+
availableMainServiceProviderServices: (import("../..").ProviderService<import("../..").ServicesTypes.INTERIOR_CLEANING> | import("../..").ProviderService<import("../..").ServicesTypes.EXTERIOR_CLEANING> | import("../..").ProviderService<import("../..").ServicesTypes.INTERIOR_AND_EXTERIOR_CLEANING> | import("../..").ProviderService<import("../..").ServicesTypes.LEATHER_SEAT_SHAMPOO_AND_TREATMENT> | import("../..").ProviderService<import("../..").ServicesTypes.FABRIC_SEAT_SHAMPOO> | import("../..").ProviderService<import("../..").ServicesTypes.CARPET_SHAMPOO> | import("../..").ProviderService<import("../..").ServicesTypes.CEILING_CLEANING> | import("../..").ProviderService<import("../..").ServicesTypes.ANIMAL_HAIR_TREATMENT>)[];
|
|
4
|
+
availableSubServiceProviderServices: (import("../..").ProviderService<import("../..").ServicesTypes.INTERIOR_CLEANING> | import("../..").ProviderService<import("../..").ServicesTypes.EXTERIOR_CLEANING> | import("../..").ProviderService<import("../..").ServicesTypes.INTERIOR_AND_EXTERIOR_CLEANING> | import("../..").ProviderService<import("../..").ServicesTypes.LEATHER_SEAT_SHAMPOO_AND_TREATMENT> | import("../..").ProviderService<import("../..").ServicesTypes.FABRIC_SEAT_SHAMPOO> | import("../..").ProviderService<import("../..").ServicesTypes.CARPET_SHAMPOO> | import("../..").ProviderService<import("../..").ServicesTypes.CEILING_CLEANING> | import("../..").ProviderService<import("../..").ServicesTypes.ANIMAL_HAIR_TREATMENT>)[];
|
|
5
5
|
};
|
package/dist/firebase/firestore/utils/services/getBookableServiceProviderServicesForVehicleType.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getBookableServiceProviderServicesForVehicleType = getBookableServiceProviderServicesForVehicleType;
|
|
4
4
|
const configs_1 = require("../configs");
|
|
5
|
-
function getBookableServiceProviderServicesForVehicleType({ countryServicesPublicConfig,
|
|
5
|
+
function getBookableServiceProviderServicesForVehicleType({ countryServicesPublicConfig, serviceProviderUserPublicDocument, vehicleType, }) {
|
|
6
6
|
const { availableMainServicesPublicConfigList, availableSubServicesPublicConfigList, } = (0, configs_1.getAvailableServicesPublicConfigForVehicleType)({
|
|
7
7
|
countryServicesPublicConfig,
|
|
8
8
|
vehicleType,
|
|
@@ -10,23 +10,23 @@ function getBookableServiceProviderServicesForVehicleType({ countryServicesPubli
|
|
|
10
10
|
const configMainAvailableServicesTypes = availableMainServicesPublicConfigList.map((servicePublicConfig) => servicePublicConfig.type);
|
|
11
11
|
const configSubAvailableServicesTypes = availableSubServicesPublicConfigList.map((servicePublicConfig) => servicePublicConfig.type);
|
|
12
12
|
return {
|
|
13
|
-
|
|
14
|
-
const
|
|
15
|
-
if (!
|
|
13
|
+
availableMainServiceProviderServices: configMainAvailableServicesTypes.flatMap((serviceType) => {
|
|
14
|
+
const providerService = serviceProviderUserPublicDocument.services[serviceType];
|
|
15
|
+
if (!providerService || !providerService.isActive)
|
|
16
16
|
return [];
|
|
17
|
-
const pricingAndDurationForVehicle =
|
|
17
|
+
const pricingAndDurationForVehicle = providerService.pricingAndDurationByVehicleType[vehicleType];
|
|
18
18
|
if (!pricingAndDurationForVehicle?.isActive)
|
|
19
19
|
return [];
|
|
20
|
-
return [
|
|
20
|
+
return [providerService];
|
|
21
21
|
}),
|
|
22
|
-
|
|
23
|
-
const
|
|
24
|
-
if (!
|
|
22
|
+
availableSubServiceProviderServices: configSubAvailableServicesTypes.flatMap((serviceType) => {
|
|
23
|
+
const providerService = serviceProviderUserPublicDocument.services[serviceType];
|
|
24
|
+
if (!providerService || !providerService.isActive)
|
|
25
25
|
return [];
|
|
26
|
-
const pricingAndDurationForVehicle =
|
|
26
|
+
const pricingAndDurationForVehicle = providerService.pricingAndDurationByVehicleType[vehicleType];
|
|
27
27
|
if (!pricingAndDurationForVehicle?.isActive)
|
|
28
28
|
return [];
|
|
29
|
-
return [
|
|
29
|
+
return [providerService];
|
|
30
30
|
}),
|
|
31
31
|
};
|
|
32
32
|
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { ServicePricingAndDurationForVehicle } from "../../types";
|
|
2
2
|
import type { GetServiceProviderActiveServicePricingAndDurationForVehicleOrThrowParams } from "./types";
|
|
3
|
-
export declare function getServiceProviderActiveServicePricingAndDurationForVehicleOrThrow({
|
|
3
|
+
export declare function getServiceProviderActiveServicePricingAndDurationForVehicleOrThrow({ serviceProviderUserPublicDocument, serviceType, vehicleType, }: GetServiceProviderActiveServicePricingAndDurationForVehicleOrThrowParams): ServicePricingAndDurationForVehicle;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getServiceProviderActiveServicePricingAndDurationForVehicleOrThrow = getServiceProviderActiveServicePricingAndDurationForVehicleOrThrow;
|
|
4
|
-
function getServiceProviderActiveServicePricingAndDurationForVehicleOrThrow({
|
|
5
|
-
const service =
|
|
4
|
+
function getServiceProviderActiveServicePricingAndDurationForVehicleOrThrow({ serviceProviderUserPublicDocument, serviceType, vehicleType, }) {
|
|
5
|
+
const service = serviceProviderUserPublicDocument.services?.[serviceType];
|
|
6
6
|
if (!service || !service.isActive) {
|
|
7
7
|
throw new Error(`Service “${serviceType}” is not offered by this service provider.`);
|
|
8
8
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export * from "./createServiceVehicleComboKey";
|
|
2
2
|
export * from "./getServiceProviderActiveServicePricingAndDurationForVehicleOrThrow";
|
|
3
3
|
export * from "./types";
|
|
4
|
-
export * from "./
|
|
4
|
+
export * from "./computeTotalServiceProviderServiceDurationInMinutesForVehicleType";
|
|
5
5
|
export * from "./getBookableServiceProviderServicesForVehicleType";
|
|
@@ -17,5 +17,5 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
17
17
|
__exportStar(require("./createServiceVehicleComboKey"), exports);
|
|
18
18
|
__exportStar(require("./getServiceProviderActiveServicePricingAndDurationForVehicleOrThrow"), exports);
|
|
19
19
|
__exportStar(require("./types"), exports);
|
|
20
|
-
__exportStar(require("./
|
|
20
|
+
__exportStar(require("./computeTotalServiceProviderServiceDurationInMinutesForVehicleType"), exports);
|
|
21
21
|
__exportStar(require("./getBookableServiceProviderServicesForVehicleType"), exports);
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ServicesTypes, VehicleTypes } from "../../../enums";
|
|
2
|
+
import type { FirestoreServiceProviderUserPublicDocument } from "../../../types";
|
|
3
|
+
export type ComputeTotalServiceProviderServiceDurationInMinutesForVehicleTypeArgs = {
|
|
4
|
+
services: FirestoreServiceProviderUserPublicDocument["services"];
|
|
5
|
+
servicesTypes: ServicesTypes[];
|
|
6
|
+
vehicleType: VehicleTypes;
|
|
7
|
+
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { VehicleTypes } from "../../../enums";
|
|
2
|
-
import type { CountryServicesPublicConfig,
|
|
2
|
+
import type { CountryServicesPublicConfig, FirestoreServiceProviderUserPublicDocument } from "../../../types";
|
|
3
3
|
export type GetBookableServiceProviderServicesForVehicleTypeParams = {
|
|
4
4
|
countryServicesPublicConfig: CountryServicesPublicConfig;
|
|
5
|
-
|
|
5
|
+
serviceProviderUserPublicDocument: FirestoreServiceProviderUserPublicDocument;
|
|
6
6
|
vehicleType: VehicleTypes;
|
|
7
7
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ServicesTypes, VehicleTypes } from "../../../enums";
|
|
2
|
-
import type {
|
|
2
|
+
import type { FirestoreServiceProviderUserPublicDocument } from "../../../types";
|
|
3
3
|
export type GetServiceProviderActiveServicePricingAndDurationForVehicleOrThrowParams = {
|
|
4
|
-
|
|
4
|
+
serviceProviderUserPublicDocument: FirestoreServiceProviderUserPublicDocument;
|
|
5
5
|
serviceType: ServicesTypes;
|
|
6
6
|
vehicleType: VehicleTypes;
|
|
7
7
|
};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export * from "./GetServiceProviderActiveServicePricingAndDurationForVehicleOrThrowParams.type";
|
|
2
|
-
export * from "./
|
|
2
|
+
export * from "./ComputeTotalServiceProviderServiceDurationInMinutesForVehicleTypeArgs.type";
|
|
3
3
|
export * from "./GetBookableServiceProviderServicesForVehicleTypeParams.type";
|
|
@@ -15,5 +15,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./GetServiceProviderActiveServicePricingAndDurationForVehicleOrThrowParams.type"), exports);
|
|
18
|
-
__exportStar(require("./
|
|
18
|
+
__exportStar(require("./ComputeTotalServiceProviderServiceDurationInMinutesForVehicleTypeArgs.type"), exports);
|
|
19
19
|
__exportStar(require("./GetBookableServiceProviderServicesForVehicleTypeParams.type"), exports);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export * from "./createMessagesSnapshotStub";
|
|
2
2
|
export * from "./firestoreMessageDocumentStub";
|
|
3
3
|
export * from "./userDocument";
|
|
4
|
-
export * from "./
|
|
4
|
+
export * from "./serviceProviderUserPublicDocument";
|
|
5
5
|
export * from "./firestoreRateLimitDocumentStub";
|
|
6
6
|
export * from "./services";
|
|
7
7
|
export * from "./vehicles";
|
|
@@ -17,7 +17,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
17
17
|
__exportStar(require("./createMessagesSnapshotStub"), exports);
|
|
18
18
|
__exportStar(require("./firestoreMessageDocumentStub"), exports);
|
|
19
19
|
__exportStar(require("./userDocument"), exports);
|
|
20
|
-
__exportStar(require("./
|
|
20
|
+
__exportStar(require("./serviceProviderUserPublicDocument"), exports);
|
|
21
21
|
__exportStar(require("./firestoreRateLimitDocumentStub"), exports);
|
|
22
22
|
__exportStar(require("./services"), exports);
|
|
23
23
|
__exportStar(require("./vehicles"), exports);
|
package/dist/firebase/firestore/utils/stubs/ordersReviews/firestoreOrderReviewDocumentStub.js
CHANGED
|
@@ -9,7 +9,7 @@ function firestoreOrderReviewDocumentStub(overwrite = {}) {
|
|
|
9
9
|
updatedAt: (0, firestoreTimestampStub_1.firestoreTimestampStub)(),
|
|
10
10
|
orderId: "orderId_stub",
|
|
11
11
|
customerId: "customerId_stub",
|
|
12
|
-
|
|
12
|
+
serviceProviderId: "serviceProviderId_stub",
|
|
13
13
|
status: enums_1.OrderReviewStatusType.PENDING,
|
|
14
14
|
isTest: true,
|
|
15
15
|
...overwrite,
|