sahab-utils 1.1.0 → 1.2.1

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,746 @@
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 ClientLocation = {
32
+ locationId: string;
33
+ name: string;
34
+ latitude: number;
35
+ longitude: number;
36
+ isPrimary?: boolean;
37
+ };
38
+
39
+ export type Client = {
40
+ uid: string;
41
+ phoneNumber: string;
42
+ firstName?: string;
43
+ lastName?: string;
44
+ email?: string;
45
+ balance?: number;
46
+ rating?: number;
47
+ imageUrl?: string;
48
+ isTest?: boolean;
49
+ isEmailVerified?: boolean;
50
+ language?: string;
51
+ checkoutCustomerId?: string;
52
+ latitude?: number;
53
+ longitude?: number;
54
+ joinDate?: Date;
55
+ locations?: ClientLocation[];
56
+ version?: string;
57
+ };
58
+
59
+ export type Price = {
60
+ size: CarSize;
61
+ price: number;
62
+ };
63
+
64
+ export enum OrderStatus {
65
+ PENDING, // 0
66
+ CONFIRMED, // 1
67
+ REJECTED, // 2
68
+ EXPIRED, // 3
69
+ IN_PROGRESS, // 4
70
+ COMPLETED, // 5
71
+ CANCELLED, // 6
72
+ RATED, // 7
73
+ STARTED, // 8
74
+ }
75
+
76
+ export enum OrderPaymentType {
77
+ APPLE_PAY,
78
+ CREDIT,
79
+ CASH,
80
+ }
81
+
82
+ export type Location = {
83
+ geohash?: string;
84
+ northeast: GeoPointType;
85
+ southwest: GeoPointType;
86
+ };
87
+
88
+ // IF ADDING A NEW PROPERTY TO THIS TYPE
89
+ // PLEASE ADD IT TO THE REDUX ORDER TYPE AS WELL
90
+ // AND ALSO IN `extractReduxOrder` FUNCTION IN `utils.ts`
91
+ // IN ORDER TO AVOID ANY PROBLEMS
92
+ export type Order = {
93
+ orderId?: string;
94
+ clientRef?: DocumentReference;
95
+ clientId?: string;
96
+ client?: Client;
97
+ providerRef?: DocumentReference;
98
+ providerId?: string;
99
+ servedBy?: DocumentReference;
100
+ servedByName?: string;
101
+ createdDate?: TimestampType;
102
+ orderDate?: TimestampType;
103
+ services?: CarService[];
104
+ location?: GeoPointType;
105
+ locationUrl?: string;
106
+ willClientBeThere?: boolean;
107
+ paymentType?: OrderPaymentType;
108
+ clientRating?: number;
109
+ providerRating?: number;
110
+ orderStatus?: OrderStatus;
111
+ staticMap?: any; // For static map
112
+ isPaid?: boolean;
113
+ rejectedBy?: string[];
114
+ finishDate?: TimestampType;
115
+ arrivalDate?: TimestampType;
116
+ canceledDate?: TimestampType;
117
+ paymentAmount?: number;
118
+ sahabPercentage?: number; // 0.06
119
+ sahabClientPercentage?: number; // 0.03
120
+ sahabOnlinePercentage?: number; // 0.03
121
+ sahabProviderPercentage?: number; // 0.03
122
+ sahabExtraPaymentAmount?: number; // for cash payments
123
+ paymentId?: string;
124
+ paymentCancelationId?: string;
125
+ paymentRefundId?: string;
126
+ paymentCaptureId?: string;
127
+ canceledBy?: 'provider' | 'client';
128
+ movementsCreated?: boolean;
129
+ orderNote?: string;
130
+ cancelReason?: string;
131
+ isDismissed?: boolean;
132
+ isLate?: boolean;
133
+ promoCode?: Discount;
134
+ isTest?: boolean;
135
+ clientNumber?: string;
136
+ usedBalance?: number;
137
+ isDummyOrder?: boolean;
138
+ ratingNote?: string;
139
+ isAddonStructure?: boolean;
140
+ isMonthlyPackage?: boolean;
141
+ isPaymentSettled?: boolean;
142
+ notificationTaskId?: string;
143
+ providerName?: {
144
+ ar: string;
145
+ en: string;
146
+ };
147
+ providerPhoneNumber?: string;
148
+ providerLogoUrl?: string;
149
+ };
150
+
151
+ // ! DO NOT PLACE ANY FIRESTORE REF IN THIS OBJECT TYPE
152
+ export type ReduxOrder = {
153
+ orderId?: string;
154
+ clientId?: string;
155
+ client?: Client;
156
+ servedByPath?: string; // as "service_providers/providerId/drivers/driverId"
157
+ providerId?: string;
158
+ servedByName?: string;
159
+ createdDate?: TimestampType;
160
+ orderDate?: TimestampType;
161
+ canceledDate?: TimestampType;
162
+ services?: CarService[];
163
+ location?: GeoPointType;
164
+ locationUrl?: string;
165
+ willClientBeThere?: boolean;
166
+ paymentType?: OrderPaymentType;
167
+ clientRating?: number;
168
+ providerRating?: number;
169
+ orderStatus?: OrderStatus;
170
+ staticMap?: any; // For static map
171
+ isPaid?: boolean;
172
+ rejectedBy?: string[];
173
+ finishDate?: TimestampType;
174
+ arrivalDate?: TimestampType;
175
+ paymentAmount?: number;
176
+ sahabPercentage?: number; // 0.06
177
+ sahabClientPercentage?: number; // 0.03
178
+ sahabOnlinePercentage?: number; // 0.03
179
+ sahabProviderPercentage?: number; // 0.03
180
+ sahabExtraPaymentAmount?: number; // for cash payments
181
+ paymentId?: string;
182
+ paymentCancelationId?: string;
183
+ paymentRefundId?: string;
184
+ paymentCaptureId?: string;
185
+ canceledBy?: 'provider' | 'client';
186
+ movementsCreated?: boolean;
187
+ orderNote?: string;
188
+ cancelReason?: string;
189
+ isDismissed?: boolean;
190
+ isLate?: boolean;
191
+ promoCode?: Discount;
192
+ clientNumber?: string;
193
+ isTest?: boolean;
194
+ usedBalance?: number;
195
+ isDummyOrder?: boolean;
196
+ ratingNote?: string;
197
+ isAddonStructure?: boolean;
198
+ isMonthlyPackage?: boolean;
199
+ isPaymentSettled?: boolean;
200
+ notificationTaskId?: string;
201
+ providerName?: {
202
+ ar: string;
203
+ en: string;
204
+ };
205
+ providerPhoneNumber?: string;
206
+ providerLogoUrl?: string;
207
+ };
208
+
209
+ export type MoneyMovement = {
210
+ movementId: string;
211
+ amount: number;
212
+ orderId?: string;
213
+ date: TimestampType;
214
+ movementType: MovementType;
215
+ createdBy?: string;
216
+ };
217
+
218
+ export enum MovementType {
219
+ CLIENT_ORDER_PAYMENT,
220
+ CLIENT_BALANCE_TOP_UP,
221
+ PROVIDER_NEGATIVE_BALANCE_PAYMENT,
222
+ PROVIDER_POSITIVE_BALANCE_PAYMENT,
223
+ ORDER_REFUND,
224
+ SAHAB_PAYMENT_TO_PROVIDER,
225
+ SAHAB_RECEIVE_FROM_PROVIDER,
226
+ USING_BALANCE,
227
+ }
228
+
229
+ export enum ComplaintType {
230
+ BUG,
231
+ COMPLAINT,
232
+ }
233
+
234
+ export enum ComplaintStatus {
235
+ PENDING,
236
+ IN_REVIEW,
237
+ RESOLVED,
238
+ }
239
+
240
+ export type Complaint = {
241
+ complaintId: string;
242
+ complaintNumber: string;
243
+ desc: string;
244
+ createdDate: TimestampType;
245
+ status: ComplaintStatus;
246
+ type: ComplaintType;
247
+ resolvedBy?: string;
248
+ resolveDate?: string;
249
+ };
250
+
251
+ export type City = {
252
+ cityId?: string;
253
+ cityName: string;
254
+ countryName: string;
255
+ cityName_ar: string;
256
+ countryName_ar: string;
257
+ locationBounds?: Location;
258
+ coordinates?: GeoPointType;
259
+ g?: { geohash: string; geopoint: GeoPointType };
260
+ providerUid?: string;
261
+ };
262
+
263
+ export type Driver = {
264
+ type?: 'driver';
265
+ driverId?: string;
266
+ providerUid?: string;
267
+ firstName?: string;
268
+ lastName?: string;
269
+ phoneNumber?: string;
270
+ imageUrl?: string;
271
+ language?: 'en' | 'ar';
272
+ mainPushToken?: string;
273
+ hmsPushToken?: string;
274
+ cities?: City[];
275
+ isAllowedToCross?: boolean;
276
+ deactivated?: boolean;
277
+ };
278
+
279
+ export type ProviderCar = {
280
+ carId?: string;
281
+ providerRef?: DocumentReference;
282
+ manufacturer?: string;
283
+ model?: string;
284
+ year?: string;
285
+ color?: string;
286
+ plateLetters?: string;
287
+ plateNumber?: string;
288
+ istimarahUrl?: string;
289
+ fileType?: string;
290
+ };
291
+
292
+ export type Day = 'sunday' | 'monday' | 'tuesday' | 'wednesday' | 'thursday' | 'friday' | 'saturday';
293
+
294
+ export type HH =
295
+ | '00'
296
+ | '01'
297
+ | '02'
298
+ | '03'
299
+ | '04'
300
+ | '05'
301
+ | '06'
302
+ | '07'
303
+ | '08'
304
+ | '09'
305
+ | '10'
306
+ | '11'
307
+ | '12'
308
+ | '13'
309
+ | '14'
310
+ | '15'
311
+ | '16'
312
+ | '17'
313
+ | '18'
314
+ | '19'
315
+ | '20'
316
+ | '21'
317
+ | '22'
318
+ | '23';
319
+ export type MM =
320
+ | '00'
321
+ | '01'
322
+ | '02'
323
+ | '03'
324
+ | '04'
325
+ | '05'
326
+ | '06'
327
+ | '07'
328
+ | '08'
329
+ | '09'
330
+ | '10'
331
+ | '11'
332
+ | '12'
333
+ | '13'
334
+ | '14'
335
+ | '15'
336
+ | '16'
337
+ | '17'
338
+ | '18'
339
+ | '19'
340
+ | '20'
341
+ | '21'
342
+ | '22'
343
+ | '23'
344
+ | '24'
345
+ | '25'
346
+ | '26'
347
+ | '27'
348
+ | '28'
349
+ | '29'
350
+ | '30'
351
+ | '31'
352
+ | '32'
353
+ | '33'
354
+ | '34'
355
+ | '35'
356
+ | '36'
357
+ | '37'
358
+ | '38'
359
+ | '39'
360
+ | '40'
361
+ | '41'
362
+ | '42'
363
+ | '43'
364
+ | '44'
365
+ | '45'
366
+ | '46'
367
+ | '47'
368
+ | '48'
369
+ | '49'
370
+ | '50'
371
+ | '51'
372
+ | '52'
373
+ | '53'
374
+ | '54'
375
+ | '55'
376
+ | '56'
377
+ | '57'
378
+ | '58'
379
+ | '59';
380
+ export type Hour = `${HH}:${MM}`;
381
+ export type WorkingHour = {
382
+ start: Hour;
383
+ end: Hour;
384
+ };
385
+ export type WorkingHours = {
386
+ sunday: WorkingHour[];
387
+ monday: WorkingHour[];
388
+ tuesday: WorkingHour[];
389
+ wednesday: WorkingHour[];
390
+ thursday: WorkingHour[];
391
+ friday: WorkingHour[];
392
+ saturday: WorkingHour[];
393
+ };
394
+
395
+ export enum ReviewStatus {
396
+ PENDING,
397
+ IN_REVIEW,
398
+ ACCEPTED,
399
+ DECLINED,
400
+ }
401
+
402
+ export enum RegistrationSection {
403
+ OWNER_NAME,
404
+ CITY,
405
+ RULES,
406
+ BUSINESS_INFO,
407
+ DRIVERS_INFO,
408
+ VEHICLE_PERMIT,
409
+ VEHICLE_REGISTRATION,
410
+ SERVICES,
411
+ ADDONS,
412
+ WORKING_HOURS,
413
+ OVERVIEW,
414
+ STATUS,
415
+ DONE,
416
+ }
417
+
418
+ export type DeclineReason = {
419
+ reasonDesc: {
420
+ ar: string;
421
+ en: string;
422
+ };
423
+ section: RegistrationSection;
424
+ };
425
+
426
+ export type ProviderService = {
427
+ serviceId?: string;
428
+ name?: {
429
+ ar: string;
430
+ en: string;
431
+ };
432
+ imageUrl?: string;
433
+ providerId?: string;
434
+ prices?: Price[];
435
+ description?: {
436
+ ar: string;
437
+ en: string;
438
+ };
439
+ includedServices?: {
440
+ ar: string;
441
+ en: string;
442
+ }[];
443
+ hide?: boolean;
444
+ time?: number;
445
+ numberOfVisits?: number;
446
+ };
447
+
448
+ export type ProvidedService = {
449
+ serviceId?: string;
450
+ name?: {
451
+ ar: string;
452
+ en: string;
453
+ };
454
+ imageUrl?: string;
455
+ providerId?: string;
456
+ description?: {
457
+ ar: string;
458
+ en: string;
459
+ };
460
+ price: Price;
461
+ isDone?: boolean;
462
+ finishDate?: TimestampType;
463
+ quantity?: number;
464
+ type: 'service';
465
+ time?: number;
466
+ includedServices?: {
467
+ ar: string;
468
+ en: string;
469
+ }[];
470
+ numberOfVisits?: number;
471
+ discount?: Discount;
472
+ };
473
+
474
+ export type ProviderAddon = {
475
+ addonId?: string;
476
+ providerId?: string;
477
+ name?: {
478
+ ar: string;
479
+ en: string;
480
+ };
481
+ prices?: Price[];
482
+ description?: {
483
+ ar: string;
484
+ en: string;
485
+ };
486
+ hide?: boolean;
487
+ time?: number;
488
+ };
489
+
490
+ export type ProvidedAddon = {
491
+ addonId?: string;
492
+ providerId?: string;
493
+ name?: {
494
+ ar: string;
495
+ en: string;
496
+ };
497
+ price?: Price;
498
+ description?: {
499
+ ar: string;
500
+ en: string;
501
+ };
502
+ quantity?: number;
503
+ type: 'addon';
504
+ time?: number;
505
+ isDone?: boolean;
506
+ finishDate?: TimestampType;
507
+ discount?: Discount;
508
+ };
509
+
510
+ export type Provider = {
511
+ type?: 'provider';
512
+ providerUid?: string;
513
+ providerName?: {
514
+ ar: string;
515
+ en: string;
516
+ };
517
+ providerPhoneNumber?: string; // not used anymore
518
+ providerCarNumber?: string;
519
+ numberOfDrivers?: number;
520
+ numberOfCars?: number;
521
+ totalRating?: number;
522
+ numberOfRaters?: number;
523
+ logoUrl?: string;
524
+ phoneNumber?: string;
525
+ ownerFirstName?: string;
526
+ ownerLastName?: string;
527
+ services?: ProviderService[];
528
+ addons?: ProviderAddon[];
529
+ working247?: boolean;
530
+ workingHoursV2?: WorkingHours;
531
+ submitDate?: TimestampType;
532
+ reviewStatus?: ReviewStatus;
533
+ reviewedBy?: string;
534
+ declineReasons?: DeclineReason[];
535
+ acceptOrdersAutomatically?: boolean;
536
+ freeWashes?: number;
537
+ registrationSection?: RegistrationSection;
538
+ currency?: string;
539
+ mainPushToken?: string;
540
+ hmsPushToken?: string;
541
+ isTest?: boolean;
542
+ language?: 'en' | 'ar';
543
+ balance?: number;
544
+ permitUrl?: string;
545
+ permitType?: string;
546
+ checkoutCustomerId?: string;
547
+ ownerEmail?: string;
548
+ isEmailVerified?: boolean;
549
+ receiveOrders?: boolean; // true if undefined or null
550
+ isAcceptingOrders?: boolean;
551
+ ordersPercentage?: number; // percentage
552
+ integrations?: { email?: string; isActive?: boolean; key: string }[];
553
+ };
554
+
555
+ export type Card = {
556
+ id?: string;
557
+ issuer?: string;
558
+ expiry_month?: string;
559
+ expiry_year?: string;
560
+ name?: string;
561
+ scheme?: string;
562
+ bin?: string;
563
+ last4?: string;
564
+ customer?: {
565
+ id?: string;
566
+ };
567
+
568
+ default?: boolean;
569
+ customer_id?: string;
570
+ };
571
+
572
+ export type CheckoutCustomer = {
573
+ default?: string;
574
+ email?: string;
575
+ id?: string;
576
+ name?: string;
577
+ instruments?: Card[];
578
+ metadata?: {
579
+ iban?: string;
580
+ providerUid?: string;
581
+ };
582
+ };
583
+
584
+ export type CarService = {
585
+ car?: Car;
586
+ services: Array<ProvidedService | ProvidedAddon>;
587
+ isDone?: boolean;
588
+ };
589
+
590
+ export type Discount = {
591
+ promoCodeId?: string;
592
+ promoCode?: string;
593
+ validFrom?: TimestampType;
594
+ validTo?: TimestampType;
595
+ createdAt?: TimestampType;
596
+ allowedOnce?: boolean;
597
+ createdByProvider?: boolean;
598
+ providerUid?: string;
599
+ usedBy?: string[];
600
+ amount?: number;
601
+ isPercentage?: boolean;
602
+ maxAmount?: number;
603
+ isAutoApplied?: boolean;
604
+ servicesIds?: string[];
605
+ addonsIds?: string[];
606
+ };
607
+
608
+ export type OrderReview = {
609
+ ratingId: string;
610
+ ratingNote: string;
611
+ orderId: string;
612
+ orderDate: TimestampType;
613
+ createdDate: TimestampType;
614
+ providerId: string;
615
+ arrivalDate: string;
616
+ finishDate: string;
617
+ rating: number;
618
+ clientId: string;
619
+ };
620
+
621
+ // Country Codes Type
622
+ export type CountryCode = {
623
+ code: string;
624
+ dial_code: string;
625
+ flag: string;
626
+ name_en: string;
627
+ name_ar: string;
628
+ };
629
+
630
+ export type LocationInfo = {
631
+ city?: string;
632
+ country?: string;
633
+ postalCode?: string;
634
+ line1: string;
635
+ line2?: string;
636
+ long_name?: string;
637
+ latitude?: number;
638
+ longitude?: number;
639
+ };
640
+
641
+ export type SavedLocation = {
642
+ locationId: string;
643
+ name: string;
644
+ latitude: number;
645
+ longitude: number;
646
+ isPrimary?: boolean;
647
+ };
648
+
649
+ export type CheckoutCard = {
650
+ id?: string;
651
+ type?: string;
652
+ fingerprint?: string;
653
+ expiry_month?: string;
654
+ expiry_year?: string;
655
+ scheme?: string;
656
+ scheme_local?: string;
657
+ last4?: string;
658
+ bin?: string;
659
+ card_type?: string;
660
+ card_category?: string;
661
+ issuer?: string;
662
+ issuer_country?: string;
663
+ product_type?: string;
664
+ };
665
+
666
+ export type CheckoutToken = {
667
+ type?: string;
668
+ token?: string;
669
+ expires_on?: string;
670
+ expiry_month?: number;
671
+ expiry_year?: number;
672
+ scheme?: string;
673
+ scheme_local?: string;
674
+ last4?: string;
675
+ bin?: string;
676
+ card_type?: string;
677
+ card_category?: string;
678
+ issuer?: string;
679
+ issuer_country?: string;
680
+ product_id: string;
681
+ product_type: string;
682
+ billing_address?: {
683
+ address_line1?: string;
684
+ address_line2: string;
685
+ city?: string;
686
+ state?: string;
687
+ zip?: string;
688
+ country?: string;
689
+ };
690
+ phone?: {
691
+ country_code?: string;
692
+ number?: string;
693
+ };
694
+ name?: string;
695
+ };
696
+
697
+ export type SPECIFIED_TIME = 'anytime' | number;
698
+
699
+ export type PlaceOrder = {
700
+ clientID: string;
701
+ providerId: string;
702
+ orderMilllSec: number;
703
+ orderNanoSec: number;
704
+ services: CarService[];
705
+ lat: number;
706
+ long: number;
707
+ willClientBeThere: boolean;
708
+ paymentType: OrderPaymentType;
709
+ isPaid: boolean;
710
+ paymentId: string;
711
+ isProviderTest: boolean;
712
+ providerReceiveOrders: boolean;
713
+ orderNote: string;
714
+ promoCode: Discount;
715
+ driverIds: string[];
716
+ providerName: {
717
+ ar: string;
718
+ en: string;
719
+ };
720
+ paidAmount: number;
721
+ usedBalance: number;
722
+ providerPhoneNumber: string;
723
+ isAddonStructure: boolean;
724
+ isMonthlyPackage: boolean;
725
+ sahabExtraPaymentAmount: number;
726
+ orderId?: string;
727
+ };
728
+
729
+ export type WeatherData = {
730
+ date: string;
731
+ precipitationProbability: number; // in %
732
+ rainAccumulation: number; // in mm
733
+ cloudCover: number; // in %
734
+ humidity: number; // in %
735
+ windSpeed: number; // in km/h
736
+ uvIndex: number; // scale from 0-11+
737
+ };
738
+
739
+ export type PaymentConfigs = {
740
+ isCashAllowed: boolean;
741
+ paymentGateways: {
742
+ key: string;
743
+ isActive: boolean;
744
+ priority: number;
745
+ };
746
+ };