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