sahab-utils 1.2.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.
@@ -4,75 +4,85 @@ export type GeoPointType = GeoPoint;
4
4
  export type TimestampType = Timestamp;
5
5
 
6
6
  export type DistenceDueration = {
7
- distance: string;
8
- duration: string;
7
+ distance: string;
8
+ duration: string;
9
9
  };
10
10
 
11
11
  export enum CarSize {
12
- X_SMALL,
13
- SMALL,
14
- MEDIUM,
15
- LARGE,
16
- X_LARGE,
12
+ X_SMALL,
13
+ SMALL,
14
+ MEDIUM,
15
+ LARGE,
16
+ X_LARGE,
17
17
  }
18
18
 
19
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;
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;
29
37
  };
30
38
 
31
39
  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;
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;
47
57
  };
48
58
 
49
59
  export type Price = {
50
- size: CarSize;
51
- price: number;
60
+ size: CarSize;
61
+ price: number;
52
62
  };
53
63
 
54
64
  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
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
64
74
  }
65
75
 
66
76
  export enum OrderPaymentType {
67
- APPLE_PAY,
68
- CREDIT,
69
- CASH,
77
+ APPLE_PAY,
78
+ CREDIT,
79
+ CASH,
70
80
  }
71
81
 
72
82
  export type Location = {
73
- geohash?: string;
74
- northeast: GeoPointType;
75
- southwest: GeoPointType;
83
+ geohash?: string;
84
+ northeast: GeoPointType;
85
+ southwest: GeoPointType;
76
86
  };
77
87
 
78
88
  // IF ADDING A NEW PROPERTY TO THIS TYPE
@@ -80,517 +90,657 @@ export type Location = {
80
90
  // AND ALSO IN `extractReduxOrder` FUNCTION IN `utils.ts`
81
91
  // IN ORDER TO AVOID ANY PROBLEMS
82
92
  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;
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;
138
149
  };
139
150
 
140
151
  // ! DO NOT PLACE ANY FIRESTORE REF IN THIS OBJECT TYPE
141
152
  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[];
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;
186
207
  };
187
208
 
188
209
  export type MoneyMovement = {
189
- movementId: string;
190
- amount: number;
191
- orderId?: string;
192
- date: TimestampType;
193
- movementType: MovementType;
194
- createdBy?: string;
210
+ movementId: string;
211
+ amount: number;
212
+ orderId?: string;
213
+ date: TimestampType;
214
+ movementType: MovementType;
215
+ createdBy?: string;
195
216
  };
196
217
 
197
218
  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,
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,
206
227
  }
207
228
 
208
229
  export enum ComplaintType {
209
- BUG,
210
- COMPLAINT,
230
+ BUG,
231
+ COMPLAINT,
211
232
  }
212
233
 
213
234
  export enum ComplaintStatus {
214
- PENDING,
215
- IN_REVIEW,
216
- RESOLVED,
235
+ PENDING,
236
+ IN_REVIEW,
237
+ RESOLVED,
217
238
  }
218
239
 
219
240
  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;
241
+ complaintId: string;
242
+ complaintNumber: string;
243
+ desc: string;
244
+ createdDate: TimestampType;
245
+ status: ComplaintStatus;
246
+ type: ComplaintType;
247
+ resolvedBy?: string;
248
+ resolveDate?: string;
228
249
  };
229
250
 
230
251
  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;
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;
240
261
  };
241
262
 
242
263
  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;
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;
256
277
  };
257
278
 
258
279
  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;
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;
269
290
  };
270
291
 
271
292
  export type Day = 'sunday' | 'monday' | 'tuesday' | 'wednesday' | 'thursday' | 'friday' | 'saturday';
272
293
 
273
294
  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';
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';
298
319
  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';
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';
359
380
  export type Hour = `${HH}:${MM}`;
360
381
  export type WorkingHour = {
361
- start: Hour;
362
- end: Hour;
382
+ start: Hour;
383
+ end: Hour;
363
384
  };
364
385
  export type WorkingHours = {
365
- sunday: WorkingHour[];
366
- monday: WorkingHour[];
367
- tuesday: WorkingHour[];
368
- wednesday: WorkingHour[];
369
- thursday: WorkingHour[];
370
- friday: WorkingHour[];
371
- saturday: WorkingHour[];
386
+ sunday: WorkingHour[];
387
+ monday: WorkingHour[];
388
+ tuesday: WorkingHour[];
389
+ wednesday: WorkingHour[];
390
+ thursday: WorkingHour[];
391
+ friday: WorkingHour[];
392
+ saturday: WorkingHour[];
372
393
  };
373
394
 
374
395
  export enum ReviewStatus {
375
- PENDING,
376
- IN_REVIEW,
377
- ACCEPTED,
378
- DECLINED,
396
+ PENDING,
397
+ IN_REVIEW,
398
+ ACCEPTED,
399
+ DECLINED,
379
400
  }
380
401
 
381
402
  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,
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,
395
416
  }
396
417
 
397
418
  export type DeclineReason = {
398
- reasonDesc: {
399
- ar: string;
400
- en: string;
401
- };
402
- section: RegistrationSection;
419
+ reasonDesc: {
420
+ ar: string;
421
+ en: string;
422
+ };
423
+ section: RegistrationSection;
403
424
  };
404
425
 
405
426
  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;
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;
425
446
  };
426
447
 
427
448
  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[];
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;
451
472
  };
452
473
 
453
474
  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;
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;
467
488
  };
468
489
 
469
490
  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[];
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;
487
508
  };
488
509
 
489
510
  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;
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 }[];
530
553
  };
531
554
 
532
555
  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;
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;
547
570
  };
548
571
 
549
572
  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
- };
573
+ default?: string;
574
+ email?: string;
575
+ id?: string;
576
+ name?: string;
577
+ instruments?: Card[];
578
+ metadata?: {
579
+ iban?: string;
580
+ providerUid?: string;
581
+ };
559
582
  };
560
583
 
561
584
  export type CarService = {
562
- car?: Car;
563
- services: Array<ProvidedService | ProvidedAddon>;
564
- isDone?: boolean;
585
+ car?: Car;
586
+ services: Array<ProvidedService | ProvidedAddon>;
587
+ isDone?: boolean;
565
588
  };
566
589
 
567
590
  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[];
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[];
583
606
  };
584
607
 
585
608
  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;
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
+ };
596
746
  };