sahab-utils 1.2.6 → 1.2.9

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.
@@ -0,0 +1,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
+ };
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
+ };