sahab-utils 1.1.0 → 1.2.0

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.
@@ -1,587 +1,596 @@
1
- import { DocumentReference, GeoPoint, Timestamp } from 'firebase/firestore'
2
-
3
- export type GeoPointType = GeoPoint;
4
- export type TimestampType = Timestamp
5
-
6
- export type DistenceDueration = {
7
- distance: string;
8
- duration: string;
9
- };
10
-
11
- export enum CarSize {
12
- X_SMALL,
13
- SMALL,
14
- MEDIUM,
15
- LARGE,
16
- X_LARGE,
17
- }
18
-
19
- export type Car = {
20
- carId: string;
21
- manufacturer: string;
22
- model: string;
23
- size: CarSize;
24
- year: string;
25
- color: string;
26
- plateLetters: string;
27
- plateNumber: string;
28
- imageUrl?: string;
29
- };
30
-
31
- export type Client = {
32
- uid: string;
33
- phoneNumber: string;
34
- firstName?: string;
35
- lastName?: string;
36
- email?: string;
37
- balance?: number;
38
- rating?: number;
39
- imageUrl?: string;
40
- isTest?: boolean,
41
- isEmailVerified?: boolean,
42
- language?: string,
43
- checkoutCustomerId?: string,
44
- latitude?: number,
45
- longitude?: number,
46
- joinDate?: Date
47
-
48
- };
49
-
50
- export type Price = {
51
- size: CarSize;
52
- price: number;
53
- };
54
-
55
- export enum OrderStatus {
56
- PENDING, // 0
57
- CONFIRMED, // 1
58
- REJECTED, // 2
59
- EXPIRED, // 3
60
- IN_PROGRESS, // 4
61
- COMPLETED, // 5
62
- CANCELLED, // 6
63
- RATED, // 7
64
- STARTED, // 8
65
- }
66
-
67
- export enum OrderPaymentType {
68
- APPLE_PAY,
69
- CREDIT,
70
- CASH,
71
- }
72
-
73
- export type Location = {
74
- geohash?: string;
75
- northeast: GeoPointType;
76
- southwest: GeoPointType;
77
- };
78
-
79
- // IF ADDING A NEW PROPERTY TO THIS TYPE
80
- // PLEASE ADD IT TO THE REDUX ORDER TYPE AS WELL
81
- // AND ALSO IN `extractReduxOrder` FUNCTION IN `utils.ts`
82
- // IN ORDER TO AVOID ANY PROBLEMS
83
- export type Order = {
84
- orderId?: string;
85
- clientRef?: DocumentReference;
86
- clientId?: string;
87
- client?: Client;
88
- providerRef?: DocumentReference;
89
- providerId?: string;
90
- servedBy?: DocumentReference;
91
- servedByName?: string;
92
- createdDate?: TimestampType;
93
- orderDate?: TimestampType;
94
- services?: CarService[];
95
- location?: GeoPointType;
96
- locationUrl?: string;
97
- willClientBeThere?: boolean;
98
- paymentType?: OrderPaymentType;
99
- clientRating?: number;
100
- providerRating?: number;
101
- orderStatus?: OrderStatus;
102
- staticMap?: any; // For static map
103
- isPaid?: boolean;
104
- rejectedBy?: string[];
105
- finishDate?: TimestampType;
106
- arrivalDate?: TimestampType;
107
- canceledDate?: TimestampType;
108
- paymentAmount?: number;
109
- sahabPercentage?: number; // 0.06
110
- sahabClientPercentage?: number; // 0.03
111
- sahabOnlinePercentage?: number; // 0.03
112
- sahabProviderPercentage?: number; // 0.03
113
- paymentId?: string;
114
- paymentCancelationId?: string;
115
- paymentRefundId?: string;
116
- paymentCaptureId?: string;
117
- canceledBy?: 'provider' | 'client';
118
- movementsCreated?: boolean;
119
- orderNote?: string;
120
- cancelReason?: string;
121
- isDismissed?: boolean;
122
- isLate?: boolean;
123
- promoCode?: Discount;
124
- isTest?: boolean;
125
- clientNumber?: string;
126
- usedBalance?: number;
127
- isDummyOrder?: boolean;
128
- ratingNote?: string;
129
- };
130
-
131
- // ! DO NOT PLACE ANY FIRESTORE REF IN THIS OBJECT TYPE
132
- export type ReduxOrder = {
133
- orderId?: string;
134
- clientId?: string;
135
- client?: Client;
136
- servedByPath?: string; // as "service_providers/providerId/drivers/driverId"
137
- providerId?: string;
138
- servedByName?: string;
139
- createdDate?: TimestampType;
140
- orderDate?: TimestampType;
141
- canceledDate?: TimestampType;
142
- services?: CarService[];
143
- location?: GeoPointType;
144
- locationUrl?: string;
145
- willClientBeThere?: boolean;
146
- paymentType?: OrderPaymentType;
147
- clientRating?: number;
148
- providerRating?: number;
149
- orderStatus?: OrderStatus;
150
- staticMap?: any; // For static map
151
- isPaid?: boolean;
152
- rejectedBy?: string[];
153
- finishDate?: TimestampType;
154
- arrivalDate?: TimestampType;
155
- paymentAmount?: number;
156
- sahabPercentage?: number; // 0.06
157
- sahabClientPercentage?: number; // 0.03
158
- sahabOnlinePercentage?: number; // 0.03
159
- sahabProviderPercentage?: number; // 0.03
160
- paymentId?: string;
161
- paymentCancelationId?: string;
162
- paymentRefundId?: string;
163
- paymentCaptureId?: string;
164
- canceledBy?: 'provider' | 'client';
165
- movementsCreated?: boolean;
166
- orderNote?: string;
167
- cancelReason?: string;
168
- isDismissed?: boolean;
169
- isLate?: boolean;
170
- promoCode?: Discount;
171
- clientNumber?: string;
172
- isTest?: boolean;
173
- usedBalance?: number;
174
- isDummyOrder?: boolean;
175
- ratingNote?: string;
176
- discounts?: Discount[];
177
- };
178
-
179
- export type MoneyMovement = {
180
- movementId: string;
181
- amount: number;
182
- orderId?: string;
183
- date: TimestampType;
184
- movementType: MovementType;
185
- createdBy?: string;
186
- };
187
-
188
- export enum MovementType {
189
- CLIENT_ORDER_PAYMENT,
190
- CLIENT_BALANCE_TOP_UP,
191
- PROVIDER_NEGATIVE_BALANCE_PAYMENT,
192
- PROVIDER_POSITIVE_BALANCE_PAYMENT,
193
- ORDER_REFUND,
194
- SAHAB_PAYMENT_TO_PROVIDER,
195
- SAHAB_RECEIVE_FROM_PROVIDER,
196
- USING_BALANCE,
197
- }
198
-
199
- export enum ComplaintType {
200
- BUG,
201
- COMPLAINT,
202
- }
203
-
204
- export enum ComplaintStatus {
205
- PENDING,
206
- IN_REVIEW,
207
- RESOLVED,
208
- }
209
-
210
- export type Complaint = {
211
- complaintId: string;
212
- complaintNumber: string;
213
- desc: string;
214
- createdDate: TimestampType;
215
- status: ComplaintStatus;
216
- type: ComplaintType;
217
- resolvedBy?: string;
218
- resolveDate?: string;
219
- };
220
-
221
- export type City = {
222
- cityId?: string;
223
- cityName: string;
224
- countryName: string;
225
- cityName_ar: string;
226
- countryName_ar: string;
227
- locationBounds?: Location;
228
- coordinates?: GeoPointType;
229
- g?: { geohash: string; geopoint: GeoPointType };
230
- providerUid?: string;
231
- };
232
-
233
- export type Driver = {
234
- type?: 'driver';
235
- driverId?: string;
236
- providerUid?: string;
237
- firstName?: string;
238
- lastName?: string;
239
- phoneNumber?: string;
240
- imageUrl?: string;
241
- language?: 'en' | 'ar';
242
- mainPushToken?: string;
243
- hmsPushToken?: string;
244
- cities?: City[];
245
- isAllowedToCross?: boolean;
246
- deactivated?: boolean;
247
- };
248
-
249
- export type ProviderCar = {
250
- carId?: string;
251
- providerRef?: DocumentReference;
252
- manufacturer?: string;
253
- model?: string;
254
- year?: string;
255
- color?: string;
256
- plateLetters?: string;
257
- plateNumber?: string;
258
- istimarahUrl?: string;
259
- fileType?: string;
260
- };
261
-
262
- export type Day = 'sunday' | 'monday' | 'tuesday' | 'wednesday' | 'thursday' | 'friday' | 'saturday';
263
-
264
- export type HH =
265
- | '00'
266
- | '01'
267
- | '02'
268
- | '03'
269
- | '04'
270
- | '05'
271
- | '06'
272
- | '07'
273
- | '08'
274
- | '09'
275
- | '10'
276
- | '11'
277
- | '12'
278
- | '13'
279
- | '14'
280
- | '15'
281
- | '16'
282
- | '17'
283
- | '18'
284
- | '19'
285
- | '20'
286
- | '21'
287
- | '22'
288
- | '23';
289
- export type MM =
290
- | '00'
291
- | '01'
292
- | '02'
293
- | '03'
294
- | '04'
295
- | '05'
296
- | '06'
297
- | '07'
298
- | '08'
299
- | '09'
300
- | '10'
301
- | '11'
302
- | '12'
303
- | '13'
304
- | '14'
305
- | '15'
306
- | '16'
307
- | '17'
308
- | '18'
309
- | '19'
310
- | '20'
311
- | '21'
312
- | '22'
313
- | '23'
314
- | '24'
315
- | '25'
316
- | '26'
317
- | '27'
318
- | '28'
319
- | '29'
320
- | '30'
321
- | '31'
322
- | '32'
323
- | '33'
324
- | '34'
325
- | '35'
326
- | '36'
327
- | '37'
328
- | '38'
329
- | '39'
330
- | '40'
331
- | '41'
332
- | '42'
333
- | '43'
334
- | '44'
335
- | '45'
336
- | '46'
337
- | '47'
338
- | '48'
339
- | '49'
340
- | '50'
341
- | '51'
342
- | '52'
343
- | '53'
344
- | '54'
345
- | '55'
346
- | '56'
347
- | '57'
348
- | '58'
349
- | '59';
350
- export type Hour = `${HH}:${MM}`;
351
- export type WorkingHour = {
352
- start: Hour;
353
- end: Hour;
354
- };
355
- export type WorkingHours = {
356
- sunday: WorkingHour[];
357
- monday: WorkingHour[];
358
- tuesday: WorkingHour[];
359
- wednesday: WorkingHour[];
360
- thursday: WorkingHour[];
361
- friday: WorkingHour[];
362
- saturday: WorkingHour[];
363
- };
364
-
365
- export enum ReviewStatus {
366
- PENDING,
367
- IN_REVIEW,
368
- ACCEPTED,
369
- DECLINED,
370
- }
371
-
372
- export enum RegistrationSection {
373
- OWNER_NAME,
374
- CITY,
375
- RULES,
376
- BUSINESS_INFO,
377
- DRIVERS_INFO,
378
- VEHICLE_PERMIT,
379
- VEHICLE_REGISTRATION,
380
- SERVICES,
381
- ADDONS,
382
- WORKING_HOURS,
383
- OVERVIEW,
384
- STATUS,
385
- DONE,
386
- }
387
-
388
- export type DeclineReason = {
389
- reasonDesc: {
390
- ar: string;
391
- en: string;
392
- };
393
- section: RegistrationSection;
394
- };
395
-
396
- export type ProviderService = {
397
- serviceId?: string;
398
- name?: {
399
- ar: string;
400
- en: string;
401
- };
402
- imageUrl?: string;
403
- providerId?: string;
404
- prices?: Price[];
405
- description?: {
406
- ar: string;
407
- en: string;
408
- };
409
- includedServices?: {
410
- ar: string;
411
- en: string;
412
- }[];
413
- hide?: boolean;
414
- time?: number;
415
- numberOfVisits?: number;
416
- };
417
-
418
- export type ProvidedService = {
419
- serviceId?: string;
420
- name?: {
421
- ar: string;
422
- en: string;
423
- };
424
- imageUrl?: string;
425
- providerId?: string;
426
- description?: {
427
- ar: string;
428
- en: string;
429
- };
430
- price: Price;
431
- isDone?: boolean;
432
- finishDate?: TimestampType;
433
- quantity?: number;
434
- type: 'service';
435
- time?: number;
436
- includedServices?: {
437
- ar: string;
438
- en: string;
439
- }[];
440
- numberOfVisits?: number;
441
- discounts?: Discount[];
442
- };
443
-
444
- export type ProviderAddon = {
445
- addonId?: string;
446
- providerId?: string;
447
- name?: {
448
- ar: string;
449
- en: string;
450
- };
451
- prices?: Price[];
452
- description?: {
453
- ar: string;
454
- en: string;
455
- };
456
- hide?: boolean;
457
- time?: number;
458
- };
459
-
460
- export type ProvidedAddon = {
461
- addonId?: string;
462
- providerId?: string;
463
- name?: {
464
- ar: string;
465
- en: string;
466
- };
467
- price?: Price;
468
- description?: {
469
- ar: string;
470
- en: string;
471
- };
472
- quantity?: number;
473
- type: 'addon';
474
- time?: number;
475
- isDone?: boolean;
476
- finishDate?: TimestampType;
477
- discounts?: Discount[];
478
- };
479
-
480
- export type Provider = {
481
- type?: 'provider';
482
- providerUid?: string;
483
- providerName?: {
484
- ar: string;
485
- en: string;
486
- };
487
- providerPhoneNumber?: string; // not used anymore
488
- providerCarNumber?: string;
489
- numberOfDrivers?: number;
490
- numberOfCars?: number;
491
- totalRating?: number;
492
- numberOfRaters?: number;
493
- logoUrl?: string;
494
- phoneNumber?: string;
495
- ownerFirstName?: string;
496
- ownerLastName?: string;
497
- services?: ProviderService[];
498
- addons?: ProviderAddon[];
499
- working247?: boolean;
500
- workingHoursV2?: WorkingHours;
501
- submitDate?: TimestampType;
502
- reviewStatus?: ReviewStatus;
503
- reviewedBy?: string;
504
- declineReasons?: DeclineReason[];
505
- acceptOrdersAutomatically?: boolean;
506
- freeWashes?: number;
507
- registrationSection?: RegistrationSection;
508
- currency?: string;
509
- mainPushToken?: string;
510
- hmsPushToken?: string;
511
- isTest?: boolean;
512
- language?: 'en' | 'ar';
513
- balance?: number;
514
- permitUrl?: string;
515
- permitType?: string;
516
- checkoutCustomerId?: string;
517
- ownerEmail?: string;
518
- isEmailVerified?: boolean;
519
- receiveOrders?: boolean; // true if undefined or null
520
- isAcceptingOrders?: boolean;
521
- };
522
-
523
- export type Card = {
524
- id?: string;
525
- issuer?: string;
526
- expiry_month?: string;
527
- expiry_year?: string;
528
- name?: string;
529
- scheme?: string;
530
- bin?: string;
531
- last4?: string;
532
- customer?: {
533
- id?: string;
534
- };
535
-
536
- default?: boolean;
537
- customer_id?: string;
538
- };
539
-
540
- export type CheckoutCustomer = {
541
- default?: string;
542
- email?: string;
543
- id?: string;
544
- name?: string;
545
- instruments?: Card[];
546
- metadata?: {
547
- iban?: string;
548
- providerUid?: string;
549
- };
550
- };
551
-
552
- export type CarService = {
553
- car?: Car;
554
- services: Array<ProvidedService | ProvidedAddon>;
555
- isDone?: boolean;
556
- };
557
-
558
- export type Discount = {
559
- promoCodeId?: string;
560
- promoCode?: string;
561
- validFrom?: TimestampType;
562
- validTo?: TimestampType;
563
- createdAt?: TimestampType;
564
- allowedOnce?: boolean;
565
- createdByProvider?: boolean;
566
- providerUid?: string;
567
- usedBy?: string[];
568
- amount?: number;
569
- isPercentage?: boolean;
570
- maxAmount?: number;
571
- isAutoApplied?: boolean;
572
- servicesIds?: string[];
573
- addonsIds?: string[];
574
- };
575
-
576
- export type OrderReview = {
577
- ratingId: string;
578
- ratingNote: string;
579
- orderId: string;
580
- orderDate: TimestampType;
581
- createdDate: TimestampType;
582
- providerId: string;
583
- arrivalDate: string;
584
- finishDate: string;
585
- rating: number;
586
- clientId: string;
587
- };
1
+ import { DocumentReference, GeoPoint, Timestamp } from 'firebase/firestore';
2
+
3
+ export type GeoPointType = GeoPoint;
4
+ export type TimestampType = Timestamp;
5
+
6
+ export type DistenceDueration = {
7
+ distance: string;
8
+ duration: string;
9
+ };
10
+
11
+ export enum CarSize {
12
+ X_SMALL,
13
+ SMALL,
14
+ MEDIUM,
15
+ LARGE,
16
+ X_LARGE,
17
+ }
18
+
19
+ export type Car = {
20
+ carId: string;
21
+ manufacturer: string;
22
+ model: string;
23
+ size: CarSize;
24
+ year: string;
25
+ color: string;
26
+ plateLetters: string;
27
+ plateNumber: string;
28
+ imageUrl?: string;
29
+ };
30
+
31
+ export type Client = {
32
+ uid: string;
33
+ phoneNumber: string;
34
+ firstName?: string;
35
+ lastName?: string;
36
+ email?: string;
37
+ balance?: number;
38
+ rating?: number;
39
+ imageUrl?: string;
40
+ isTest?: boolean;
41
+ isEmailVerified?: boolean;
42
+ language?: string;
43
+ checkoutCustomerId?: string;
44
+ latitude?: number;
45
+ longitude?: number;
46
+ joinDate?: Date;
47
+ };
48
+
49
+ export type Price = {
50
+ size: CarSize;
51
+ price: number;
52
+ };
53
+
54
+ export enum OrderStatus {
55
+ PENDING, // 0
56
+ CONFIRMED, // 1
57
+ REJECTED, // 2
58
+ EXPIRED, // 3
59
+ IN_PROGRESS, // 4
60
+ COMPLETED, // 5
61
+ CANCELLED, // 6
62
+ RATED, // 7
63
+ STARTED, // 8
64
+ }
65
+
66
+ export enum OrderPaymentType {
67
+ APPLE_PAY,
68
+ CREDIT,
69
+ CASH,
70
+ }
71
+
72
+ export type Location = {
73
+ geohash?: string;
74
+ northeast: GeoPointType;
75
+ southwest: GeoPointType;
76
+ };
77
+
78
+ // IF ADDING A NEW PROPERTY TO THIS TYPE
79
+ // PLEASE ADD IT TO THE REDUX ORDER TYPE AS WELL
80
+ // AND ALSO IN `extractReduxOrder` FUNCTION IN `utils.ts`
81
+ // IN ORDER TO AVOID ANY PROBLEMS
82
+ export type Order = {
83
+ orderId?: string;
84
+ clientRef?: DocumentReference;
85
+ clientId?: string;
86
+ client?: Client;
87
+ providerRef?: DocumentReference;
88
+ providerId?: string;
89
+ servedBy?: DocumentReference;
90
+ servedByName?: string;
91
+ createdDate?: TimestampType;
92
+ orderDate?: TimestampType;
93
+ services?: CarService[];
94
+ location?: GeoPointType;
95
+ locationUrl?: string;
96
+ willClientBeThere?: boolean;
97
+ paymentType?: OrderPaymentType;
98
+ clientRating?: number;
99
+ providerRating?: number;
100
+ orderStatus?: OrderStatus;
101
+ staticMap?: any; // For static map
102
+ isPaid?: boolean;
103
+ rejectedBy?: string[];
104
+ finishDate?: TimestampType;
105
+ arrivalDate?: TimestampType;
106
+ canceledDate?: TimestampType;
107
+ paymentAmount?: number;
108
+ sahabPercentage?: number; // 0.06
109
+ sahabClientPercentage?: number; // 0.03
110
+ sahabOnlinePercentage?: number; // 0.03
111
+ sahabProviderPercentage?: number; // 0.03
112
+ paymentId?: string;
113
+ paymentCancelationId?: string;
114
+ paymentRefundId?: string;
115
+ paymentCaptureId?: string;
116
+ canceledBy?: 'provider' | 'client';
117
+ movementsCreated?: boolean;
118
+ orderNote?: string;
119
+ cancelReason?: string;
120
+ isDismissed?: boolean;
121
+ isLate?: boolean;
122
+ promoCode?: Discount;
123
+ isTest?: boolean;
124
+ clientNumber?: string;
125
+ usedBalance?: number;
126
+ isDummyOrder?: boolean;
127
+ ratingNote?: string;
128
+ isAddonStructure?: boolean;
129
+ isMonthlyPackage?: boolean;
130
+ isPaymentSettled?: boolean;
131
+ notificationTaskId?: string;
132
+ providerName?: {
133
+ ar: string;
134
+ en: string;
135
+ };
136
+ providerPhoneNumber?: string;
137
+ providerLogoUrl?: string;
138
+ };
139
+
140
+ // ! DO NOT PLACE ANY FIRESTORE REF IN THIS OBJECT TYPE
141
+ export type ReduxOrder = {
142
+ orderId?: string;
143
+ clientId?: string;
144
+ client?: Client;
145
+ servedByPath?: string; // as "service_providers/providerId/drivers/driverId"
146
+ providerId?: string;
147
+ servedByName?: string;
148
+ createdDate?: TimestampType;
149
+ orderDate?: TimestampType;
150
+ canceledDate?: TimestampType;
151
+ services?: CarService[];
152
+ location?: GeoPointType;
153
+ locationUrl?: string;
154
+ willClientBeThere?: boolean;
155
+ paymentType?: OrderPaymentType;
156
+ clientRating?: number;
157
+ providerRating?: number;
158
+ orderStatus?: OrderStatus;
159
+ staticMap?: any; // For static map
160
+ isPaid?: boolean;
161
+ rejectedBy?: string[];
162
+ finishDate?: TimestampType;
163
+ arrivalDate?: TimestampType;
164
+ paymentAmount?: number;
165
+ sahabPercentage?: number; // 0.06
166
+ sahabClientPercentage?: number; // 0.03
167
+ sahabOnlinePercentage?: number; // 0.03
168
+ sahabProviderPercentage?: number; // 0.03
169
+ paymentId?: string;
170
+ paymentCancelationId?: string;
171
+ paymentRefundId?: string;
172
+ paymentCaptureId?: string;
173
+ canceledBy?: 'provider' | 'client';
174
+ movementsCreated?: boolean;
175
+ orderNote?: string;
176
+ cancelReason?: string;
177
+ isDismissed?: boolean;
178
+ isLate?: boolean;
179
+ promoCode?: Discount;
180
+ clientNumber?: string;
181
+ isTest?: boolean;
182
+ usedBalance?: number;
183
+ isDummyOrder?: boolean;
184
+ ratingNote?: string;
185
+ discounts?: Discount[];
186
+ };
187
+
188
+ export type MoneyMovement = {
189
+ movementId: string;
190
+ amount: number;
191
+ orderId?: string;
192
+ date: TimestampType;
193
+ movementType: MovementType;
194
+ createdBy?: string;
195
+ };
196
+
197
+ export enum MovementType {
198
+ CLIENT_ORDER_PAYMENT,
199
+ CLIENT_BALANCE_TOP_UP,
200
+ PROVIDER_NEGATIVE_BALANCE_PAYMENT,
201
+ PROVIDER_POSITIVE_BALANCE_PAYMENT,
202
+ ORDER_REFUND,
203
+ SAHAB_PAYMENT_TO_PROVIDER,
204
+ SAHAB_RECEIVE_FROM_PROVIDER,
205
+ USING_BALANCE,
206
+ }
207
+
208
+ export enum ComplaintType {
209
+ BUG,
210
+ COMPLAINT,
211
+ }
212
+
213
+ export enum ComplaintStatus {
214
+ PENDING,
215
+ IN_REVIEW,
216
+ RESOLVED,
217
+ }
218
+
219
+ export type Complaint = {
220
+ complaintId: string;
221
+ complaintNumber: string;
222
+ desc: string;
223
+ createdDate: TimestampType;
224
+ status: ComplaintStatus;
225
+ type: ComplaintType;
226
+ resolvedBy?: string;
227
+ resolveDate?: string;
228
+ };
229
+
230
+ export type City = {
231
+ cityId?: string;
232
+ cityName: string;
233
+ countryName: string;
234
+ cityName_ar: string;
235
+ countryName_ar: string;
236
+ locationBounds?: Location;
237
+ coordinates?: GeoPointType;
238
+ g?: { geohash: string; geopoint: GeoPointType };
239
+ providerUid?: string;
240
+ };
241
+
242
+ export type Driver = {
243
+ type?: 'driver';
244
+ driverId?: string;
245
+ providerUid?: string;
246
+ firstName?: string;
247
+ lastName?: string;
248
+ phoneNumber?: string;
249
+ imageUrl?: string;
250
+ language?: 'en' | 'ar';
251
+ mainPushToken?: string;
252
+ hmsPushToken?: string;
253
+ cities?: City[];
254
+ isAllowedToCross?: boolean;
255
+ deactivated?: boolean;
256
+ };
257
+
258
+ export type ProviderCar = {
259
+ carId?: string;
260
+ providerRef?: DocumentReference;
261
+ manufacturer?: string;
262
+ model?: string;
263
+ year?: string;
264
+ color?: string;
265
+ plateLetters?: string;
266
+ plateNumber?: string;
267
+ istimarahUrl?: string;
268
+ fileType?: string;
269
+ };
270
+
271
+ export type Day = 'sunday' | 'monday' | 'tuesday' | 'wednesday' | 'thursday' | 'friday' | 'saturday';
272
+
273
+ export type HH =
274
+ | '00'
275
+ | '01'
276
+ | '02'
277
+ | '03'
278
+ | '04'
279
+ | '05'
280
+ | '06'
281
+ | '07'
282
+ | '08'
283
+ | '09'
284
+ | '10'
285
+ | '11'
286
+ | '12'
287
+ | '13'
288
+ | '14'
289
+ | '15'
290
+ | '16'
291
+ | '17'
292
+ | '18'
293
+ | '19'
294
+ | '20'
295
+ | '21'
296
+ | '22'
297
+ | '23';
298
+ export type MM =
299
+ | '00'
300
+ | '01'
301
+ | '02'
302
+ | '03'
303
+ | '04'
304
+ | '05'
305
+ | '06'
306
+ | '07'
307
+ | '08'
308
+ | '09'
309
+ | '10'
310
+ | '11'
311
+ | '12'
312
+ | '13'
313
+ | '14'
314
+ | '15'
315
+ | '16'
316
+ | '17'
317
+ | '18'
318
+ | '19'
319
+ | '20'
320
+ | '21'
321
+ | '22'
322
+ | '23'
323
+ | '24'
324
+ | '25'
325
+ | '26'
326
+ | '27'
327
+ | '28'
328
+ | '29'
329
+ | '30'
330
+ | '31'
331
+ | '32'
332
+ | '33'
333
+ | '34'
334
+ | '35'
335
+ | '36'
336
+ | '37'
337
+ | '38'
338
+ | '39'
339
+ | '40'
340
+ | '41'
341
+ | '42'
342
+ | '43'
343
+ | '44'
344
+ | '45'
345
+ | '46'
346
+ | '47'
347
+ | '48'
348
+ | '49'
349
+ | '50'
350
+ | '51'
351
+ | '52'
352
+ | '53'
353
+ | '54'
354
+ | '55'
355
+ | '56'
356
+ | '57'
357
+ | '58'
358
+ | '59';
359
+ export type Hour = `${HH}:${MM}`;
360
+ export type WorkingHour = {
361
+ start: Hour;
362
+ end: Hour;
363
+ };
364
+ export type WorkingHours = {
365
+ sunday: WorkingHour[];
366
+ monday: WorkingHour[];
367
+ tuesday: WorkingHour[];
368
+ wednesday: WorkingHour[];
369
+ thursday: WorkingHour[];
370
+ friday: WorkingHour[];
371
+ saturday: WorkingHour[];
372
+ };
373
+
374
+ export enum ReviewStatus {
375
+ PENDING,
376
+ IN_REVIEW,
377
+ ACCEPTED,
378
+ DECLINED,
379
+ }
380
+
381
+ export enum RegistrationSection {
382
+ OWNER_NAME,
383
+ CITY,
384
+ RULES,
385
+ BUSINESS_INFO,
386
+ DRIVERS_INFO,
387
+ VEHICLE_PERMIT,
388
+ VEHICLE_REGISTRATION,
389
+ SERVICES,
390
+ ADDONS,
391
+ WORKING_HOURS,
392
+ OVERVIEW,
393
+ STATUS,
394
+ DONE,
395
+ }
396
+
397
+ export type DeclineReason = {
398
+ reasonDesc: {
399
+ ar: string;
400
+ en: string;
401
+ };
402
+ section: RegistrationSection;
403
+ };
404
+
405
+ export type ProviderService = {
406
+ serviceId?: string;
407
+ name?: {
408
+ ar: string;
409
+ en: string;
410
+ };
411
+ imageUrl?: string;
412
+ providerId?: string;
413
+ prices?: Price[];
414
+ description?: {
415
+ ar: string;
416
+ en: string;
417
+ };
418
+ includedServices?: {
419
+ ar: string;
420
+ en: string;
421
+ }[];
422
+ hide?: boolean;
423
+ time?: number;
424
+ numberOfVisits?: number;
425
+ };
426
+
427
+ export type ProvidedService = {
428
+ serviceId?: string;
429
+ name?: {
430
+ ar: string;
431
+ en: string;
432
+ };
433
+ imageUrl?: string;
434
+ providerId?: string;
435
+ description?: {
436
+ ar: string;
437
+ en: string;
438
+ };
439
+ price: Price;
440
+ isDone?: boolean;
441
+ finishDate?: TimestampType;
442
+ quantity?: number;
443
+ type: 'service';
444
+ time?: number;
445
+ includedServices?: {
446
+ ar: string;
447
+ en: string;
448
+ }[];
449
+ numberOfVisits?: number;
450
+ discounts?: Discount[];
451
+ };
452
+
453
+ export type ProviderAddon = {
454
+ addonId?: string;
455
+ providerId?: string;
456
+ name?: {
457
+ ar: string;
458
+ en: string;
459
+ };
460
+ prices?: Price[];
461
+ description?: {
462
+ ar: string;
463
+ en: string;
464
+ };
465
+ hide?: boolean;
466
+ time?: number;
467
+ };
468
+
469
+ export type ProvidedAddon = {
470
+ addonId?: string;
471
+ providerId?: string;
472
+ name?: {
473
+ ar: string;
474
+ en: string;
475
+ };
476
+ price?: Price;
477
+ description?: {
478
+ ar: string;
479
+ en: string;
480
+ };
481
+ quantity?: number;
482
+ type: 'addon';
483
+ time?: number;
484
+ isDone?: boolean;
485
+ finishDate?: TimestampType;
486
+ discounts?: Discount[];
487
+ };
488
+
489
+ export type Provider = {
490
+ type?: 'provider';
491
+ providerUid?: string;
492
+ providerName?: {
493
+ ar: string;
494
+ en: string;
495
+ };
496
+ providerPhoneNumber?: string; // not used anymore
497
+ providerCarNumber?: string;
498
+ numberOfDrivers?: number;
499
+ numberOfCars?: number;
500
+ totalRating?: number;
501
+ numberOfRaters?: number;
502
+ logoUrl?: string;
503
+ phoneNumber?: string;
504
+ ownerFirstName?: string;
505
+ ownerLastName?: string;
506
+ services?: ProviderService[];
507
+ addons?: ProviderAddon[];
508
+ working247?: boolean;
509
+ workingHoursV2?: WorkingHours;
510
+ submitDate?: TimestampType;
511
+ reviewStatus?: ReviewStatus;
512
+ reviewedBy?: string;
513
+ declineReasons?: DeclineReason[];
514
+ acceptOrdersAutomatically?: boolean;
515
+ freeWashes?: number;
516
+ registrationSection?: RegistrationSection;
517
+ currency?: string;
518
+ mainPushToken?: string;
519
+ hmsPushToken?: string;
520
+ isTest?: boolean;
521
+ language?: 'en' | 'ar';
522
+ balance?: number;
523
+ permitUrl?: string;
524
+ permitType?: string;
525
+ checkoutCustomerId?: string;
526
+ ownerEmail?: string;
527
+ isEmailVerified?: boolean;
528
+ receiveOrders?: boolean; // true if undefined or null
529
+ isAcceptingOrders?: boolean;
530
+ };
531
+
532
+ export type Card = {
533
+ id?: string;
534
+ issuer?: string;
535
+ expiry_month?: string;
536
+ expiry_year?: string;
537
+ name?: string;
538
+ scheme?: string;
539
+ bin?: string;
540
+ last4?: string;
541
+ customer?: {
542
+ id?: string;
543
+ };
544
+
545
+ default?: boolean;
546
+ customer_id?: string;
547
+ };
548
+
549
+ export type CheckoutCustomer = {
550
+ default?: string;
551
+ email?: string;
552
+ id?: string;
553
+ name?: string;
554
+ instruments?: Card[];
555
+ metadata?: {
556
+ iban?: string;
557
+ providerUid?: string;
558
+ };
559
+ };
560
+
561
+ export type CarService = {
562
+ car?: Car;
563
+ services: Array<ProvidedService | ProvidedAddon>;
564
+ isDone?: boolean;
565
+ };
566
+
567
+ export type Discount = {
568
+ promoCodeId?: string;
569
+ promoCode?: string;
570
+ validFrom?: TimestampType;
571
+ validTo?: TimestampType;
572
+ createdAt?: TimestampType;
573
+ allowedOnce?: boolean;
574
+ createdByProvider?: boolean;
575
+ providerUid?: string;
576
+ usedBy?: string[];
577
+ amount?: number;
578
+ isPercentage?: boolean;
579
+ maxAmount?: number;
580
+ isAutoApplied?: boolean;
581
+ servicesIds?: string[];
582
+ addonsIds?: string[];
583
+ };
584
+
585
+ export type OrderReview = {
586
+ ratingId: string;
587
+ ratingNote: string;
588
+ orderId: string;
589
+ orderDate: TimestampType;
590
+ createdDate: TimestampType;
591
+ providerId: string;
592
+ arrivalDate: string;
593
+ finishDate: string;
594
+ rating: number;
595
+ clientId: string;
596
+ };