sahab-utils 1.2.9 → 1.4.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,659 +1,749 @@
1
- import { DocumentReference, GeoPoint, Timestamp } from 'firebase/firestore';
2
- export type GeoPointType = GeoPoint;
3
- export type TimestampType = Timestamp;
4
- export type DistenceDueration = {
5
- distance: string;
6
- duration: string;
7
- };
8
- export declare enum CarSize {
9
- X_SMALL = 0,
10
- SMALL = 1,
11
- MEDIUM = 2,
12
- LARGE = 3,
13
- X_LARGE = 4
14
- }
15
- export type Car = {
16
- carId: string;
17
- manufacturer: string;
18
- model: string;
19
- size: CarSize;
20
- year: string;
21
- color: string;
22
- plateLetters: string;
23
- plateNumber: string;
24
- imageUrl?: string;
25
- };
26
- export type ClientLocation = {
27
- locationId: string;
28
- name: string;
29
- latitude: number;
30
- longitude: number;
31
- isPrimary?: boolean;
32
- };
33
- export type Client = {
34
- uid: string;
35
- phoneNumber: string;
36
- firstName?: string;
37
- lastName?: string;
38
- email?: string;
39
- balance?: number;
40
- rating?: number;
41
- imageUrl?: string;
42
- isTest?: boolean;
43
- isEmailVerified?: boolean;
44
- language?: string;
45
- checkoutCustomerId?: string;
46
- latitude?: number;
47
- longitude?: number;
48
- joinDate?: Date;
49
- locations?: ClientLocation[];
50
- version?: string;
51
- };
52
- export type Price = {
53
- size: CarSize;
54
- price: number;
55
- };
56
- export declare enum OrderStatus {
57
- PENDING = 0,// 0
58
- CONFIRMED = 1,// 1
59
- REJECTED = 2,// 2
60
- EXPIRED = 3,// 3
61
- IN_PROGRESS = 4,// 4
62
- COMPLETED = 5,// 5
63
- CANCELLED = 6,// 6
64
- RATED = 7,// 7
65
- STARTED = 8
66
- }
67
- export declare enum OrderPaymentType {
68
- APPLE_PAY = 0,
69
- CREDIT = 1,
70
- CASH = 2,
71
- GOOGLE_PAY = 3,
72
- SAMSUNG_PAY = 4,
73
- STC_PAY = 5,
74
- TABBY = 6,
75
- TAMARA = 7
76
- }
77
- export type Location = {
78
- geohash?: string;
79
- northeast: GeoPointType;
80
- southwest: GeoPointType;
81
- };
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;
102
- isPaid?: boolean;
103
- rejectedBy?: string[];
104
- finishDate?: TimestampType;
105
- arrivalDate?: TimestampType;
106
- canceledDate?: TimestampType;
107
- paymentAmount?: number;
108
- sahabPercentage?: number;
109
- sahabClientPercentage?: number;
110
- sahabOnlinePercentage?: number;
111
- sahabProviderPercentage?: number;
112
- sahabExtraPaymentAmount?: number;
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
- isAddonStructure?: boolean;
130
- isMonthlyPackage?: boolean;
131
- isPaymentSettled?: boolean;
132
- notificationTaskId?: string;
133
- providerName?: {
134
- ar: string;
135
- en: string;
136
- };
137
- providerPhoneNumber?: string;
138
- providerLogoUrl?: string;
139
- paymentGateway?: 'PAYLINK' | 'CHECKOUT' | 'TAP';
140
- };
141
- export type ReduxOrder = {
142
- orderId?: string;
143
- clientId?: string;
144
- client?: Client;
145
- servedByPath?: string;
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;
160
- isPaid?: boolean;
161
- rejectedBy?: string[];
162
- finishDate?: TimestampType;
163
- arrivalDate?: TimestampType;
164
- paymentAmount?: number;
165
- sahabPercentage?: number;
166
- sahabClientPercentage?: number;
167
- sahabOnlinePercentage?: number;
168
- sahabProviderPercentage?: number;
169
- sahabExtraPaymentAmount?: number;
170
- paymentId?: string;
171
- paymentCancelationId?: string;
172
- paymentRefundId?: string;
173
- paymentCaptureId?: string;
174
- canceledBy?: 'provider' | 'client';
175
- movementsCreated?: boolean;
176
- orderNote?: string;
177
- cancelReason?: string;
178
- isDismissed?: boolean;
179
- isLate?: boolean;
180
- promoCode?: Discount;
181
- clientNumber?: string;
182
- isTest?: boolean;
183
- usedBalance?: number;
184
- isDummyOrder?: boolean;
185
- ratingNote?: string;
186
- isAddonStructure?: boolean;
187
- isMonthlyPackage?: boolean;
188
- isPaymentSettled?: boolean;
189
- notificationTaskId?: string;
190
- providerName?: {
191
- ar: string;
192
- en: string;
193
- };
194
- providerPhoneNumber?: string;
195
- providerLogoUrl?: string;
196
- };
197
- export type MoneyMovement = {
198
- movementId: string;
199
- amount: number;
200
- orderId?: string;
201
- date: TimestampType;
202
- movementType: MovementType;
203
- createdBy?: string;
204
- };
205
- export declare enum MovementType {
206
- CLIENT_ORDER_PAYMENT = 0,
207
- CLIENT_BALANCE_TOP_UP = 1,
208
- PROVIDER_NEGATIVE_BALANCE_PAYMENT = 2,
209
- PROVIDER_POSITIVE_BALANCE_PAYMENT = 3,
210
- ORDER_REFUND = 4,
211
- SAHAB_PAYMENT_TO_PROVIDER = 5,
212
- SAHAB_RECEIVE_FROM_PROVIDER = 6,
213
- USING_BALANCE = 7
214
- }
215
- export declare enum ComplaintType {
216
- BUG = 0,
217
- COMPLAINT = 1
218
- }
219
- export declare enum ComplaintStatus {
220
- PENDING = 0,
221
- IN_REVIEW = 1,
222
- RESOLVED = 2
223
- }
224
- export type Complaint = {
225
- complaintId: string;
226
- complaintNumber: string;
227
- desc: string;
228
- createdDate: TimestampType;
229
- status: ComplaintStatus;
230
- type: ComplaintType;
231
- resolvedBy?: string;
232
- resolveDate?: string;
233
- };
234
- export type City = {
235
- cityId?: string;
236
- cityName: string;
237
- countryName: string;
238
- cityName_ar: string;
239
- countryName_ar: string;
240
- locationBounds?: Location;
241
- coordinates?: GeoPointType;
242
- g?: {
243
- geohash: string;
244
- geopoint: GeoPointType;
245
- };
246
- providerUid?: string;
247
- };
248
- export type Driver = {
249
- type?: 'driver';
250
- driverId?: string;
251
- providerUid?: string;
252
- firstName?: string;
253
- lastName?: string;
254
- phoneNumber?: string;
255
- imageUrl?: string;
256
- language?: 'en' | 'ar';
257
- mainPushToken?: string;
258
- hmsPushToken?: string;
259
- cities?: City[];
260
- isAllowedToCross?: boolean;
261
- deactivated?: boolean;
262
- };
263
- export type ProviderCar = {
264
- carId?: string;
265
- providerRef?: DocumentReference;
266
- manufacturer?: string;
267
- model?: string;
268
- year?: string;
269
- color?: string;
270
- plateLetters?: string;
271
- plateNumber?: string;
272
- istimarahUrl?: string;
273
- fileType?: string;
274
- };
275
- export type Day = 'sunday' | 'monday' | 'tuesday' | 'wednesday' | 'thursday' | 'friday' | 'saturday';
276
- export type HH = '00' | '01' | '02' | '03' | '04' | '05' | '06' | '07' | '08' | '09' | '10' | '11' | '12' | '13' | '14' | '15' | '16' | '17' | '18' | '19' | '20' | '21' | '22' | '23';
277
- export type MM = '00' | '01' | '02' | '03' | '04' | '05' | '06' | '07' | '08' | '09' | '10' | '11' | '12' | '13' | '14' | '15' | '16' | '17' | '18' | '19' | '20' | '21' | '22' | '23' | '24' | '25' | '26' | '27' | '28' | '29' | '30' | '31' | '32' | '33' | '34' | '35' | '36' | '37' | '38' | '39' | '40' | '41' | '42' | '43' | '44' | '45' | '46' | '47' | '48' | '49' | '50' | '51' | '52' | '53' | '54' | '55' | '56' | '57' | '58' | '59';
278
- export type Hour = `${HH}:${MM}`;
279
- export type WorkingHour = {
280
- start: Hour;
281
- end: Hour;
282
- };
283
- export type WorkingHours = {
284
- sunday: WorkingHour[];
285
- monday: WorkingHour[];
286
- tuesday: WorkingHour[];
287
- wednesday: WorkingHour[];
288
- thursday: WorkingHour[];
289
- friday: WorkingHour[];
290
- saturday: WorkingHour[];
291
- };
292
- export declare enum ReviewStatus {
293
- PENDING = 0,
294
- IN_REVIEW = 1,
295
- ACCEPTED = 2,
296
- DECLINED = 3
297
- }
298
- export declare enum RegistrationSection {
299
- OWNER_NAME = 0,
300
- CITY = 1,
301
- RULES = 2,
302
- BUSINESS_INFO = 3,
303
- DRIVERS_INFO = 4,
304
- VEHICLE_PERMIT = 5,
305
- VEHICLE_REGISTRATION = 6,
306
- SERVICES = 7,
307
- ADDONS = 8,
308
- WORKING_HOURS = 9,
309
- OVERVIEW = 10,
310
- STATUS = 11,
311
- DONE = 12
312
- }
313
- export type DeclineReason = {
314
- reasonDesc: {
315
- ar: string;
316
- en: string;
317
- };
318
- section: RegistrationSection;
319
- };
320
- export type ProviderService = {
321
- serviceId?: string;
322
- name?: {
323
- ar: string;
324
- en: string;
325
- };
326
- imageUrl?: string;
327
- providerId?: string;
328
- prices?: Price[];
329
- description?: {
330
- ar: string;
331
- en: string;
332
- };
333
- includedServices?: {
334
- ar: string;
335
- en: string;
336
- }[];
337
- hide?: boolean;
338
- time?: number;
339
- numberOfVisits?: number;
340
- };
341
- export type ProvidedService = {
342
- serviceId?: string;
343
- name?: {
344
- ar: string;
345
- en: string;
346
- };
347
- imageUrl?: string;
348
- providerId?: string;
349
- description?: {
350
- ar: string;
351
- en: string;
352
- };
353
- price: Price;
354
- isDone?: boolean;
355
- finishDate?: TimestampType;
356
- quantity?: number;
357
- type: 'service';
358
- time?: number;
359
- includedServices?: {
360
- ar: string;
361
- en: string;
362
- }[];
363
- numberOfVisits?: number;
364
- discount?: Discount;
365
- };
366
- export type ProviderAddon = {
367
- addonId?: string;
368
- providerId?: string;
369
- name?: {
370
- ar: string;
371
- en: string;
372
- };
373
- prices?: Price[];
374
- description?: {
375
- ar: string;
376
- en: string;
377
- };
378
- hide?: boolean;
379
- time?: number;
380
- };
381
- export type ProvidedAddon = {
382
- addonId?: string;
383
- providerId?: string;
384
- name?: {
385
- ar: string;
386
- en: string;
387
- };
388
- price?: Price;
389
- description?: {
390
- ar: string;
391
- en: string;
392
- };
393
- quantity?: number;
394
- type: 'addon';
395
- time?: number;
396
- isDone?: boolean;
397
- finishDate?: TimestampType;
398
- discount?: Discount;
399
- };
400
- export type Provider = {
401
- type?: 'provider';
402
- providerUid?: string;
403
- providerName?: {
404
- ar: string;
405
- en: string;
406
- };
407
- providerPhoneNumber?: string;
408
- providerCarNumber?: string;
409
- numberOfDrivers?: number;
410
- numberOfCars?: number;
411
- totalRating?: number;
412
- numberOfRaters?: number;
413
- logoUrl?: string;
414
- phoneNumber?: string;
415
- ownerFirstName?: string;
416
- ownerLastName?: string;
417
- services?: ProviderService[];
418
- addons?: ProviderAddon[];
419
- working247?: boolean;
420
- workingHoursV2?: WorkingHours;
421
- submitDate?: TimestampType;
422
- reviewStatus?: ReviewStatus;
423
- reviewedBy?: string;
424
- declineReasons?: DeclineReason[];
425
- acceptOrdersAutomatically?: boolean;
426
- freeWashes?: number;
427
- registrationSection?: RegistrationSection;
428
- currency?: string;
429
- mainPushToken?: string;
430
- hmsPushToken?: string;
431
- isTest?: boolean;
432
- language?: 'en' | 'ar';
433
- balance?: number;
434
- permitUrl?: string;
435
- permitType?: string;
436
- checkoutCustomerId?: string;
437
- ownerEmail?: string;
438
- isEmailVerified?: boolean;
439
- receiveOrders?: boolean;
440
- isAcceptingOrders?: boolean;
441
- ordersPercentage?: number;
442
- integrations?: {
443
- email?: string;
444
- isActive?: boolean;
445
- key: string;
446
- /** Tap (and other gateways): server-side API secret */
447
- secretKey?: string;
448
- /** Tap Connect marketplace payout destination id (sub-merchant) */
449
- tapDestinationId?: string;
450
- }[];
451
- };
452
- export type Card = {
453
- id?: string;
454
- issuer?: string;
455
- expiry_month?: string;
456
- expiry_year?: string;
457
- name?: string;
458
- scheme?: string;
459
- bin?: string;
460
- last4?: string;
461
- customer?: {
462
- id?: string;
463
- };
464
- default?: boolean;
465
- customer_id?: string;
466
- };
467
- export type CheckoutCustomer = {
468
- default?: string;
469
- email?: string;
470
- id?: string;
471
- name?: string;
472
- instruments?: Card[];
473
- metadata?: {
474
- iban?: string;
475
- providerUid?: string;
476
- };
477
- };
478
- export type CarService = {
479
- car?: Car;
480
- services: Array<ProvidedService | ProvidedAddon>;
481
- isDone?: boolean;
482
- };
483
- export type Discount = {
484
- promoCodeId?: string;
485
- promoCode?: string;
486
- validFrom?: TimestampType;
487
- validTo?: TimestampType;
488
- createdAt?: TimestampType;
489
- allowedOnce?: boolean;
490
- createdByProvider?: boolean;
491
- providerUid?: string;
492
- usedBy?: string[];
493
- amount?: number;
494
- isPercentage?: boolean;
495
- maxAmount?: number;
496
- isAutoApplied?: boolean;
497
- servicesIds?: string[];
498
- addonsIds?: string[];
499
- clientIds?: string[];
500
- createrEmail?: string;
501
- sahabPercentage?: number;
502
- providerPercentage?: number;
503
- };
504
- export type OrderReview = {
505
- ratingId: string;
506
- ratingNote: string;
507
- orderId: string;
508
- orderDate: TimestampType;
509
- createdDate: TimestampType;
510
- providerId: string;
511
- arrivalDate: string;
512
- finishDate: string;
513
- rating: number;
514
- clientId: string;
515
- };
516
- export type CountryCode = {
517
- code: string;
518
- dial_code: string;
519
- flag: string;
520
- name_en: string;
521
- name_ar: string;
522
- };
523
- export type LocationInfo = {
524
- city?: string;
525
- country?: string;
526
- postalCode?: string;
527
- line1: string;
528
- line2?: string;
529
- long_name?: string;
530
- latitude?: number;
531
- longitude?: number;
532
- };
533
- export type SavedLocation = {
534
- locationId: string;
535
- name: string;
536
- latitude: number;
537
- longitude: number;
538
- isPrimary?: boolean;
539
- };
540
- export type CheckoutCard = {
541
- id?: string;
542
- type?: string;
543
- fingerprint?: string;
544
- expiry_month?: string;
545
- expiry_year?: string;
546
- scheme?: string;
547
- scheme_local?: string;
548
- last4?: string;
549
- bin?: string;
550
- card_type?: string;
551
- card_category?: string;
552
- issuer?: string;
553
- issuer_country?: string;
554
- product_type?: string;
555
- };
556
- export type CheckoutToken = {
557
- type?: string;
558
- token?: string;
559
- expires_on?: string;
560
- expiry_month?: number;
561
- expiry_year?: number;
562
- scheme?: string;
563
- scheme_local?: string;
564
- last4?: string;
565
- bin?: string;
566
- card_type?: string;
567
- card_category?: string;
568
- issuer?: string;
569
- issuer_country?: string;
570
- product_id: string;
571
- product_type: string;
572
- billing_address?: {
573
- address_line1?: string;
574
- address_line2: string;
575
- city?: string;
576
- state?: string;
577
- zip?: string;
578
- country?: string;
579
- };
580
- phone?: {
581
- country_code?: string;
582
- number?: string;
583
- };
584
- name?: string;
585
- };
586
- export type SPECIFIED_TIME = 'anytime' | number;
587
- export type PlaceOrder = {
588
- clientID: string;
589
- providerId: string;
590
- orderMilllSec: number;
591
- orderNanoSec: number;
592
- services: CarService[];
593
- lat: number;
594
- long: number;
595
- willClientBeThere: boolean;
596
- paymentType: OrderPaymentType;
597
- isPaid: boolean;
598
- paymentId: string;
599
- isProviderTest: boolean;
600
- providerReceiveOrders: boolean;
601
- orderNote: string;
602
- promoCode: Discount;
603
- driverIds: string[];
604
- providerName: {
605
- ar: string;
606
- en: string;
607
- };
608
- paymentAmount: number;
609
- usedBalance: number;
610
- providerPhoneNumber: string;
611
- isAddonStructure: boolean;
612
- isMonthlyPackage: boolean;
613
- sahabExtraPaymentAmount: number;
614
- orderId?: string;
615
- paymentGateway?: 'PAYLINK' | 'CHECKOUT' | 'TAP';
616
- /** Mirrors Order economics for server-side Tap split; optional override of client fee % */
617
- sahabClientPercentage?: number;
618
- };
619
- export type WeatherData = {
620
- date: string;
621
- precipitationProbability: number;
622
- rainAccumulation: number;
623
- cloudCover: number;
624
- humidity: number;
625
- windSpeed: number;
626
- uvIndex: number;
627
- };
628
- export type PaymentConfigs = {
629
- isCashAllowed: boolean;
630
- isGooglePayAllowed?: boolean;
631
- /** Tap GoSell merchant id for card / Apple Pay SDK config (optional; falls back in app). */
632
- tapMerchantId?: string;
633
- paymentGateways: {
634
- key: string;
635
- isActive: boolean;
636
- priority: number;
637
- }[];
638
- };
639
- export type Slot = {
640
- id: string;
641
- time: number;
642
- selected: boolean;
643
- reserved: boolean;
644
- };
645
- export type Statement = {
646
- numberOfOrders: number;
647
- completedOrders: number;
648
- ratedOrders: number;
649
- cancelledOrders: number;
650
- cashOrders: number;
651
- creditOrders: number;
652
- applePayPayments: number;
653
- expiredOrders: number;
654
- confirmedOrders: number;
655
- lateOrders: number;
656
- ordersTotal: number;
657
- orders: Order[];
658
- statmentDate?: Date | string;
659
- };
1
+ import { DocumentReference, GeoPoint, Timestamp } from 'firebase/firestore';
2
+ export type GeoPointType = GeoPoint;
3
+ export type TimestampType = Timestamp;
4
+ export type DistenceDueration = {
5
+ distance: string;
6
+ duration: string;
7
+ };
8
+ export declare enum CarSize {
9
+ X_SMALL = 0,
10
+ SMALL = 1,
11
+ MEDIUM = 2,
12
+ LARGE = 3,
13
+ X_LARGE = 4
14
+ }
15
+ export type Car = {
16
+ carId: string;
17
+ manufacturer: string;
18
+ model: string;
19
+ size: CarSize;
20
+ year: string;
21
+ color: string;
22
+ plateLetters: string;
23
+ plateNumber: string;
24
+ imageUrl?: string;
25
+ };
26
+ export type ClientLocation = {
27
+ locationId: string;
28
+ name: string;
29
+ latitude: number;
30
+ longitude: number;
31
+ isPrimary?: boolean;
32
+ };
33
+ export type Client = {
34
+ uid: string;
35
+ phoneNumber: string;
36
+ firstName?: string;
37
+ lastName?: string;
38
+ email?: string;
39
+ balance?: number;
40
+ rating?: number;
41
+ imageUrl?: string;
42
+ isTest?: boolean;
43
+ isEmailVerified?: boolean;
44
+ language?: string;
45
+ checkoutCustomerId?: string;
46
+ latitude?: number;
47
+ longitude?: number;
48
+ joinDate?: Date;
49
+ locations?: ClientLocation[];
50
+ version?: string;
51
+ tapCustomerId?: string;
52
+ };
53
+ export type Price = {
54
+ size: CarSize;
55
+ price: number;
56
+ };
57
+ export declare enum OrderStatus {
58
+ PENDING = 0,// 0
59
+ CONFIRMED = 1,// 1
60
+ REJECTED = 2,// 2
61
+ EXPIRED = 3,// 3
62
+ IN_PROGRESS = 4,// 4
63
+ COMPLETED = 5,// 5
64
+ CANCELLED = 6,// 6
65
+ RATED = 7,// 7
66
+ STARTED = 8
67
+ }
68
+ export declare enum OrderPaymentType {
69
+ APPLE_PAY = 0,
70
+ CREDIT = 1,
71
+ CASH = 2,
72
+ GOOGLE_PAY = 3,
73
+ SAMSUNG_PAY = 4,
74
+ STC_PAY = 5,
75
+ TABBY = 6,
76
+ TAMARA = 7
77
+ }
78
+ export type Location = {
79
+ geohash?: string;
80
+ northeast: GeoPointType;
81
+ southwest: GeoPointType;
82
+ };
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;
103
+ isPaid?: boolean;
104
+ rejectedBy?: string[];
105
+ finishDate?: TimestampType;
106
+ arrivalDate?: TimestampType;
107
+ canceledDate?: TimestampType;
108
+ paymentAmount?: number;
109
+ sahabPercentage?: number;
110
+ sahabClientPercentage?: number;
111
+ sahabOnlinePercentage?: number;
112
+ sahabProviderPercentage?: number;
113
+ sahabExtraPaymentAmount?: number;
114
+ paymentId?: string;
115
+ paymentCancelationId?: string;
116
+ paymentRefundId?: string;
117
+ paymentCaptureId?: string;
118
+ canceledBy?: 'provider' | 'client';
119
+ movementsCreated?: boolean;
120
+ orderNote?: string;
121
+ cancelReason?: string;
122
+ isDismissed?: boolean;
123
+ isLate?: boolean;
124
+ promoCode?: Discount;
125
+ isTest?: boolean;
126
+ clientNumber?: string;
127
+ usedBalance?: number;
128
+ isDummyOrder?: boolean;
129
+ ratingNote?: string;
130
+ isAddonStructure?: boolean;
131
+ isMonthlyPackage?: boolean;
132
+ isPaymentSettled?: boolean;
133
+ notificationTaskId?: string;
134
+ providerName?: {
135
+ ar: string;
136
+ en: string;
137
+ };
138
+ providerPhoneNumber?: string;
139
+ providerLogoUrl?: string;
140
+ paymentGateway?: 'PAYLINK' | 'CHECKOUT' | 'TAP';
141
+ visitDates?: number[];
142
+ };
143
+ export type ReduxOrder = {
144
+ orderId?: string;
145
+ clientId?: string;
146
+ client?: Client;
147
+ servedByPath?: string;
148
+ providerId?: string;
149
+ servedByName?: string;
150
+ createdDate?: TimestampType;
151
+ orderDate?: TimestampType;
152
+ canceledDate?: TimestampType;
153
+ services?: CarService[];
154
+ location?: GeoPointType;
155
+ locationUrl?: string;
156
+ willClientBeThere?: boolean;
157
+ paymentType?: OrderPaymentType;
158
+ clientRating?: number;
159
+ providerRating?: number;
160
+ orderStatus?: OrderStatus;
161
+ staticMap?: any;
162
+ isPaid?: boolean;
163
+ rejectedBy?: string[];
164
+ finishDate?: TimestampType;
165
+ arrivalDate?: TimestampType;
166
+ paymentAmount?: number;
167
+ sahabPercentage?: number;
168
+ sahabClientPercentage?: number;
169
+ sahabOnlinePercentage?: number;
170
+ sahabProviderPercentage?: number;
171
+ sahabExtraPaymentAmount?: number;
172
+ paymentId?: string;
173
+ paymentCancelationId?: string;
174
+ paymentRefundId?: string;
175
+ paymentCaptureId?: string;
176
+ canceledBy?: 'provider' | 'client';
177
+ movementsCreated?: boolean;
178
+ orderNote?: string;
179
+ cancelReason?: string;
180
+ isDismissed?: boolean;
181
+ isLate?: boolean;
182
+ promoCode?: Discount;
183
+ clientNumber?: string;
184
+ isTest?: boolean;
185
+ usedBalance?: number;
186
+ isDummyOrder?: boolean;
187
+ ratingNote?: string;
188
+ isAddonStructure?: boolean;
189
+ isMonthlyPackage?: boolean;
190
+ isPaymentSettled?: boolean;
191
+ notificationTaskId?: string;
192
+ providerName?: {
193
+ ar: string;
194
+ en: string;
195
+ };
196
+ providerPhoneNumber?: string;
197
+ providerLogoUrl?: string;
198
+ };
199
+ export type MoneyMovement = {
200
+ movementId: string;
201
+ amount: number;
202
+ orderId?: string;
203
+ date: TimestampType;
204
+ movementType: MovementType;
205
+ createdBy?: string;
206
+ };
207
+ export declare enum MovementType {
208
+ CLIENT_ORDER_PAYMENT = 0,
209
+ CLIENT_BALANCE_TOP_UP = 1,
210
+ PROVIDER_NEGATIVE_BALANCE_PAYMENT = 2,
211
+ PROVIDER_POSITIVE_BALANCE_PAYMENT = 3,
212
+ ORDER_REFUND = 4,
213
+ SAHAB_PAYMENT_TO_PROVIDER = 5,
214
+ SAHAB_RECEIVE_FROM_PROVIDER = 6,
215
+ USING_BALANCE = 7
216
+ }
217
+ export declare enum ComplaintType {
218
+ BUG = 0,
219
+ COMPLAINT = 1
220
+ }
221
+ export declare enum ComplaintStatus {
222
+ PENDING = 0,
223
+ IN_REVIEW = 1,
224
+ RESOLVED = 2
225
+ }
226
+ export type Complaint = {
227
+ complaintId: string;
228
+ complaintNumber: string;
229
+ desc: string;
230
+ createdDate: TimestampType;
231
+ status: ComplaintStatus;
232
+ type: ComplaintType;
233
+ resolvedBy?: string;
234
+ resolveDate?: string;
235
+ };
236
+ export type City = {
237
+ cityId?: string;
238
+ cityName: string;
239
+ countryName: string;
240
+ cityName_ar: string;
241
+ countryName_ar: string;
242
+ locationBounds?: Location;
243
+ coordinates?: GeoPointType;
244
+ g?: {
245
+ geohash: string;
246
+ geopoint: GeoPointType;
247
+ };
248
+ providerUid?: string;
249
+ };
250
+ export type Driver = {
251
+ type?: 'driver';
252
+ driverId?: string;
253
+ providerUid?: string;
254
+ firstName?: string;
255
+ lastName?: string;
256
+ phoneNumber?: string;
257
+ imageUrl?: string;
258
+ language?: 'en' | 'ar';
259
+ mainPushToken?: string;
260
+ hmsPushToken?: string;
261
+ cities?: City[];
262
+ isAllowedToCross?: boolean;
263
+ deactivated?: boolean;
264
+ };
265
+ export type ProviderCar = {
266
+ carId?: string;
267
+ providerRef?: DocumentReference;
268
+ manufacturer?: string;
269
+ model?: string;
270
+ year?: string;
271
+ color?: string;
272
+ plateLetters?: string;
273
+ plateNumber?: string;
274
+ istimarahUrl?: string;
275
+ fileType?: string;
276
+ };
277
+ export type Day = 'sunday' | 'monday' | 'tuesday' | 'wednesday' | 'thursday' | 'friday' | 'saturday';
278
+ export type HH = '00' | '01' | '02' | '03' | '04' | '05' | '06' | '07' | '08' | '09' | '10' | '11' | '12' | '13' | '14' | '15' | '16' | '17' | '18' | '19' | '20' | '21' | '22' | '23';
279
+ export type MM = '00' | '01' | '02' | '03' | '04' | '05' | '06' | '07' | '08' | '09' | '10' | '11' | '12' | '13' | '14' | '15' | '16' | '17' | '18' | '19' | '20' | '21' | '22' | '23' | '24' | '25' | '26' | '27' | '28' | '29' | '30' | '31' | '32' | '33' | '34' | '35' | '36' | '37' | '38' | '39' | '40' | '41' | '42' | '43' | '44' | '45' | '46' | '47' | '48' | '49' | '50' | '51' | '52' | '53' | '54' | '55' | '56' | '57' | '58' | '59';
280
+ export type Hour = `${HH}:${MM}`;
281
+ export type WorkingHour = {
282
+ start: Hour;
283
+ end: Hour;
284
+ };
285
+ export type WorkingHours = {
286
+ sunday: WorkingHour[];
287
+ monday: WorkingHour[];
288
+ tuesday: WorkingHour[];
289
+ wednesday: WorkingHour[];
290
+ thursday: WorkingHour[];
291
+ friday: WorkingHour[];
292
+ saturday: WorkingHour[];
293
+ };
294
+ export declare enum ReviewStatus {
295
+ PENDING = 0,
296
+ IN_REVIEW = 1,
297
+ ACCEPTED = 2,
298
+ DECLINED = 3
299
+ }
300
+ export declare enum RegistrationSection {
301
+ OWNER_NAME = 0,
302
+ CITY = 1,
303
+ RULES = 2,
304
+ BUSINESS_INFO = 3,
305
+ DRIVERS_INFO = 4,
306
+ VEHICLE_PERMIT = 5,
307
+ VEHICLE_REGISTRATION = 6,
308
+ SERVICES = 7,
309
+ ADDONS = 8,
310
+ WORKING_HOURS = 9,
311
+ OVERVIEW = 10,
312
+ STATUS = 11,
313
+ DONE = 12
314
+ }
315
+ export type DeclineReason = {
316
+ reasonDesc: {
317
+ ar: string;
318
+ en: string;
319
+ };
320
+ section: RegistrationSection;
321
+ };
322
+ export type ProviderService = {
323
+ serviceId?: string;
324
+ name?: {
325
+ ar: string;
326
+ en: string;
327
+ };
328
+ imageUrl?: string;
329
+ providerId?: string;
330
+ prices?: Price[];
331
+ description?: {
332
+ ar: string;
333
+ en: string;
334
+ };
335
+ includedServices?: {
336
+ ar: string;
337
+ en: string;
338
+ }[];
339
+ hide?: boolean;
340
+ time?: number;
341
+ numberOfVisits?: number;
342
+ };
343
+ export type ProvidedService = {
344
+ serviceId?: string;
345
+ name?: {
346
+ ar: string;
347
+ en: string;
348
+ };
349
+ imageUrl?: string;
350
+ providerId?: string;
351
+ description?: {
352
+ ar: string;
353
+ en: string;
354
+ };
355
+ price: Price;
356
+ isDone?: boolean;
357
+ finishDate?: TimestampType;
358
+ quantity?: number;
359
+ type: 'service';
360
+ time?: number;
361
+ includedServices?: {
362
+ ar: string;
363
+ en: string;
364
+ }[];
365
+ numberOfVisits?: number;
366
+ discount?: Discount;
367
+ };
368
+ export type ProviderAddon = {
369
+ addonId?: string;
370
+ providerId?: string;
371
+ name?: {
372
+ ar: string;
373
+ en: string;
374
+ };
375
+ prices?: Price[];
376
+ description?: {
377
+ ar: string;
378
+ en: string;
379
+ };
380
+ hide?: boolean;
381
+ time?: number;
382
+ };
383
+ export type ProvidedAddon = {
384
+ addonId?: string;
385
+ providerId?: string;
386
+ name?: {
387
+ ar: string;
388
+ en: string;
389
+ };
390
+ price?: Price;
391
+ description?: {
392
+ ar: string;
393
+ en: string;
394
+ };
395
+ quantity?: number;
396
+ type: 'addon';
397
+ time?: number;
398
+ isDone?: boolean;
399
+ finishDate?: TimestampType;
400
+ discount?: Discount;
401
+ };
402
+ export type Provider = {
403
+ type?: 'provider';
404
+ providerUid?: string;
405
+ providerName?: {
406
+ ar: string;
407
+ en: string;
408
+ };
409
+ providerPhoneNumber?: string;
410
+ providerCarNumber?: string;
411
+ numberOfDrivers?: number;
412
+ numberOfCars?: number;
413
+ totalRating?: number;
414
+ numberOfRaters?: number;
415
+ logoUrl?: string;
416
+ phoneNumber?: string;
417
+ ownerFirstName?: string;
418
+ ownerLastName?: string;
419
+ services?: ProviderService[];
420
+ addons?: ProviderAddon[];
421
+ working247?: boolean;
422
+ workingHoursV2?: WorkingHours;
423
+ submitDate?: TimestampType;
424
+ reviewStatus?: ReviewStatus;
425
+ reviewedBy?: string;
426
+ declineReasons?: DeclineReason[];
427
+ acceptOrdersAutomatically?: boolean;
428
+ freeWashes?: number;
429
+ registrationSection?: RegistrationSection;
430
+ currency?: string;
431
+ mainPushToken?: string;
432
+ hmsPushToken?: string;
433
+ isTest?: boolean;
434
+ language?: 'en' | 'ar';
435
+ balance?: number;
436
+ permitUrl?: string;
437
+ permitType?: string;
438
+ checkoutCustomerId?: string;
439
+ ownerEmail?: string;
440
+ isEmailVerified?: boolean;
441
+ receiveOrders?: boolean;
442
+ isAcceptingOrders?: boolean;
443
+ ordersPercentage?: number;
444
+ integrations?: {
445
+ email?: string;
446
+ isActive?: boolean;
447
+ /** Canonical values from `INTEGRATION_KEYS`, e.g. `'TAP_PAYMENTS'`. */
448
+ key: string;
449
+ /** Tap (and other gateways): server-side API secret */
450
+ secretKey?: string;
451
+ /** Tap Connect marketplace payout destination id (sub-merchant). Set when the related `TapApplication` reaches `payout_enabled`. */
452
+ tapDestinationId?: string;
453
+ }[];
454
+ };
455
+ export declare const INTEGRATION_KEYS: {
456
+ readonly TAP_PAYMENTS: "TAP_PAYMENTS";
457
+ };
458
+ export type IntegrationKey = (typeof INTEGRATION_KEYS)[keyof typeof INTEGRATION_KEYS];
459
+ export type TapKycStatus = 'draft' | 'documents_uploaded' | 'lead_created' | 'account_created' | 'payout_enabled' | 'rejected';
460
+ export type TapDocumentPurpose = 'commercial_registration' | 'national_id' | 'bank_statement' | 'iban_certificate';
461
+ export type TapLicenseType = 'LLC' | 'SOLE_PROPRIETORSHIP' | 'JOINT_STOCK' | 'PARTNERSHIP' | 'OTHER';
462
+ export type TapApplicationFile = {
463
+ purpose: TapDocumentPurpose;
464
+ fileId: string;
465
+ title?: string;
466
+ /** epoch seconds */
467
+ uploadedAt: number;
468
+ /** epoch seconds, mirrors Tap's expires_at */
469
+ expiresAt?: number;
470
+ };
471
+ export type TapApplicationFormData = {
472
+ country: 'SA';
473
+ brand: {
474
+ websiteUrl: string;
475
+ nameEn: string;
476
+ nameAr: string;
477
+ };
478
+ entity: {
479
+ licenseNumber: string;
480
+ unifiedNumber: string;
481
+ licenseType: TapLicenseType;
482
+ legalNameEn: string;
483
+ };
484
+ bank: {
485
+ beneficiaryName: string;
486
+ iban: string;
487
+ };
488
+ walletName: string;
489
+ owner: {
490
+ firstName: string;
491
+ middleName?: string;
492
+ lastName: string;
493
+ email: string;
494
+ phoneCountryCode: string;
495
+ phoneNumber: string;
496
+ nationalId: string;
497
+ nationality: string;
498
+ idType: 'national_id' | 'passport';
499
+ };
500
+ };
501
+ export type TapApplicationError = {
502
+ code?: string;
503
+ message: string;
504
+ /** epoch seconds */
505
+ at: number;
506
+ endpoint: 'files' | 'lead' | 'account' | 'update_lead';
507
+ };
508
+ /**
509
+ * Stored at: `service_providers/{providerId}/tapApplications/{applicationId}`.
510
+ *
511
+ * One document per onboarding attempt. On rejection a new application may be created;
512
+ * history is preserved. Invariant: at most one non-terminal application per provider.
513
+ * Terminal states: `payout_enabled`, `rejected`.
514
+ */
515
+ export type TapApplication = {
516
+ id: string;
517
+ providerId: string;
518
+ /** epoch seconds */
519
+ createdAt: number;
520
+ /** epoch seconds */
521
+ updatedAt: number;
522
+ /** admin uid that initiated the application */
523
+ createdBy: string;
524
+ kycStatus: TapKycStatus;
525
+ payoutEnabled: boolean;
526
+ formData?: TapApplicationFormData;
527
+ files?: TapApplicationFile[];
528
+ tapLeadId?: string;
529
+ /** retailer.id from Tap; mirrored up to provider.integrations[TAP_PAYMENTS].tapDestinationId on payout_enabled */
530
+ tapDestinationId?: string;
531
+ /** epoch seconds — lead → account transition */
532
+ submittedAt?: number;
533
+ /** epoch seconds — set by webhook on payout_enabled */
534
+ approvedAt?: number;
535
+ /** epoch seconds */
536
+ rejectedAt?: number;
537
+ rejectionReason?: string;
538
+ lastError?: TapApplicationError;
539
+ /** echo of post.url sent on lead creation */
540
+ webhookUrl?: string;
541
+ };
542
+ export type Card = {
543
+ id?: string;
544
+ issuer?: string;
545
+ expiry_month?: string;
546
+ expiry_year?: string;
547
+ name?: string;
548
+ scheme?: string;
549
+ bin?: string;
550
+ last4?: string;
551
+ customer?: {
552
+ id?: string;
553
+ };
554
+ default?: boolean;
555
+ customer_id?: string;
556
+ };
557
+ export type CheckoutCustomer = {
558
+ default?: string;
559
+ email?: string;
560
+ id?: string;
561
+ name?: string;
562
+ instruments?: Card[];
563
+ metadata?: {
564
+ iban?: string;
565
+ providerUid?: string;
566
+ };
567
+ };
568
+ export type CarService = {
569
+ car?: Car;
570
+ services: Array<ProvidedService | ProvidedAddon>;
571
+ isDone?: boolean;
572
+ };
573
+ export type Discount = {
574
+ promoCodeId?: string;
575
+ promoCode?: string;
576
+ validFrom?: TimestampType;
577
+ validTo?: TimestampType;
578
+ createdAt?: TimestampType;
579
+ allowedOnce?: boolean;
580
+ createdByProvider?: boolean;
581
+ providerUid?: string;
582
+ usedBy?: string[];
583
+ amount?: number;
584
+ isPercentage?: boolean;
585
+ maxAmount?: number;
586
+ isAutoApplied?: boolean;
587
+ servicesIds?: string[];
588
+ addonsIds?: string[];
589
+ clientIds?: string[];
590
+ createrEmail?: string;
591
+ sahabPercentage?: number;
592
+ providerPercentage?: number;
593
+ };
594
+ export type OrderReview = {
595
+ ratingId: string;
596
+ ratingNote: string;
597
+ orderId: string;
598
+ orderDate: TimestampType;
599
+ createdDate: TimestampType;
600
+ providerId: string;
601
+ arrivalDate: string;
602
+ finishDate: string;
603
+ rating: number;
604
+ clientId: string;
605
+ };
606
+ export type CountryCode = {
607
+ code: string;
608
+ dial_code: string;
609
+ flag: string;
610
+ name_en: string;
611
+ name_ar: string;
612
+ };
613
+ export type LocationInfo = {
614
+ city?: string;
615
+ country?: string;
616
+ postalCode?: string;
617
+ line1: string;
618
+ line2?: string;
619
+ long_name?: string;
620
+ latitude?: number;
621
+ longitude?: number;
622
+ };
623
+ export type SavedLocation = {
624
+ locationId: string;
625
+ name: string;
626
+ latitude: number;
627
+ longitude: number;
628
+ isPrimary?: boolean;
629
+ };
630
+ export type CheckoutCard = {
631
+ id?: string;
632
+ type?: string;
633
+ fingerprint?: string;
634
+ expiry_month?: string;
635
+ expiry_year?: string;
636
+ scheme?: string;
637
+ scheme_local?: string;
638
+ last4?: string;
639
+ bin?: string;
640
+ card_type?: string;
641
+ card_category?: string;
642
+ issuer?: string;
643
+ issuer_country?: string;
644
+ product_type?: string;
645
+ };
646
+ export type CheckoutToken = {
647
+ type?: string;
648
+ token?: string;
649
+ expires_on?: string;
650
+ expiry_month?: number;
651
+ expiry_year?: number;
652
+ scheme?: string;
653
+ scheme_local?: string;
654
+ last4?: string;
655
+ bin?: string;
656
+ card_type?: string;
657
+ card_category?: string;
658
+ issuer?: string;
659
+ issuer_country?: string;
660
+ product_id: string;
661
+ product_type: string;
662
+ billing_address?: {
663
+ address_line1?: string;
664
+ address_line2: string;
665
+ city?: string;
666
+ state?: string;
667
+ zip?: string;
668
+ country?: string;
669
+ };
670
+ phone?: {
671
+ country_code?: string;
672
+ number?: string;
673
+ };
674
+ name?: string;
675
+ };
676
+ export type SPECIFIED_TIME = 'anytime' | number;
677
+ export type PlaceOrder = {
678
+ clientID: string;
679
+ providerId: string;
680
+ orderMilllSec: number;
681
+ orderNanoSec: number;
682
+ services: CarService[];
683
+ lat: number;
684
+ long: number;
685
+ willClientBeThere: boolean;
686
+ paymentType: OrderPaymentType;
687
+ isPaid: boolean;
688
+ paymentId: string;
689
+ isProviderTest: boolean;
690
+ providerReceiveOrders: boolean;
691
+ orderNote: string;
692
+ promoCode: Discount;
693
+ driverIds: string[];
694
+ providerName: {
695
+ ar: string;
696
+ en: string;
697
+ };
698
+ paymentAmount: number;
699
+ usedBalance: number;
700
+ providerPhoneNumber: string;
701
+ isAddonStructure: boolean;
702
+ isMonthlyPackage: boolean;
703
+ sahabExtraPaymentAmount: number;
704
+ orderId?: string;
705
+ paymentGateway?: 'PAYLINK' | 'CHECKOUT' | 'TAP';
706
+ /** Mirrors Order economics for server-side Tap split; optional override of client fee % */
707
+ sahabClientPercentage?: number;
708
+ };
709
+ export type WeatherData = {
710
+ date: string;
711
+ precipitationProbability: number;
712
+ rainAccumulation: number;
713
+ cloudCover: number;
714
+ humidity: number;
715
+ windSpeed: number;
716
+ uvIndex: number;
717
+ };
718
+ export type PaymentConfigs = {
719
+ isCashAllowed: boolean;
720
+ isGooglePayAllowed?: boolean;
721
+ /** Tap GoSell merchant id for card / Apple Pay SDK config (optional; falls back in app). */
722
+ tapMerchantId?: string;
723
+ paymentGateways: {
724
+ key: string;
725
+ isActive: boolean;
726
+ priority: number;
727
+ }[];
728
+ };
729
+ export type Slot = {
730
+ id: string;
731
+ time: number;
732
+ selected: boolean;
733
+ reserved: boolean;
734
+ };
735
+ export type Statement = {
736
+ numberOfOrders: number;
737
+ completedOrders: number;
738
+ ratedOrders: number;
739
+ cancelledOrders: number;
740
+ cashOrders: number;
741
+ creditOrders: number;
742
+ applePayPayments: number;
743
+ expiredOrders: number;
744
+ confirmedOrders: number;
745
+ lateOrders: number;
746
+ ordersTotal: number;
747
+ orders: Order[];
748
+ statmentDate?: Date | string;
749
+ };