sahab-utils 1.2.0 → 1.2.2

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