sahab-utils 1.2.7 → 1.3.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.
@@ -0,0 +1,661 @@
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
+ key: string;
448
+ /** Tap (and other gateways): server-side API secret */
449
+ secretKey?: string;
450
+ /** Tap Connect marketplace payout destination id (sub-merchant) */
451
+ tapDestinationId?: string;
452
+ }[];
453
+ };
454
+ export type Card = {
455
+ id?: string;
456
+ issuer?: string;
457
+ expiry_month?: string;
458
+ expiry_year?: string;
459
+ name?: string;
460
+ scheme?: string;
461
+ bin?: string;
462
+ last4?: string;
463
+ customer?: {
464
+ id?: string;
465
+ };
466
+ default?: boolean;
467
+ customer_id?: string;
468
+ };
469
+ export type CheckoutCustomer = {
470
+ default?: string;
471
+ email?: string;
472
+ id?: string;
473
+ name?: string;
474
+ instruments?: Card[];
475
+ metadata?: {
476
+ iban?: string;
477
+ providerUid?: string;
478
+ };
479
+ };
480
+ export type CarService = {
481
+ car?: Car;
482
+ services: Array<ProvidedService | ProvidedAddon>;
483
+ isDone?: boolean;
484
+ };
485
+ export type Discount = {
486
+ promoCodeId?: string;
487
+ promoCode?: string;
488
+ validFrom?: TimestampType;
489
+ validTo?: TimestampType;
490
+ createdAt?: TimestampType;
491
+ allowedOnce?: boolean;
492
+ createdByProvider?: boolean;
493
+ providerUid?: string;
494
+ usedBy?: string[];
495
+ amount?: number;
496
+ isPercentage?: boolean;
497
+ maxAmount?: number;
498
+ isAutoApplied?: boolean;
499
+ servicesIds?: string[];
500
+ addonsIds?: string[];
501
+ clientIds?: string[];
502
+ createrEmail?: string;
503
+ sahabPercentage?: number;
504
+ providerPercentage?: number;
505
+ };
506
+ export type OrderReview = {
507
+ ratingId: string;
508
+ ratingNote: string;
509
+ orderId: string;
510
+ orderDate: TimestampType;
511
+ createdDate: TimestampType;
512
+ providerId: string;
513
+ arrivalDate: string;
514
+ finishDate: string;
515
+ rating: number;
516
+ clientId: string;
517
+ };
518
+ export type CountryCode = {
519
+ code: string;
520
+ dial_code: string;
521
+ flag: string;
522
+ name_en: string;
523
+ name_ar: string;
524
+ };
525
+ export type LocationInfo = {
526
+ city?: string;
527
+ country?: string;
528
+ postalCode?: string;
529
+ line1: string;
530
+ line2?: string;
531
+ long_name?: string;
532
+ latitude?: number;
533
+ longitude?: number;
534
+ };
535
+ export type SavedLocation = {
536
+ locationId: string;
537
+ name: string;
538
+ latitude: number;
539
+ longitude: number;
540
+ isPrimary?: boolean;
541
+ };
542
+ export type CheckoutCard = {
543
+ id?: string;
544
+ type?: string;
545
+ fingerprint?: string;
546
+ expiry_month?: string;
547
+ expiry_year?: string;
548
+ scheme?: string;
549
+ scheme_local?: string;
550
+ last4?: string;
551
+ bin?: string;
552
+ card_type?: string;
553
+ card_category?: string;
554
+ issuer?: string;
555
+ issuer_country?: string;
556
+ product_type?: string;
557
+ };
558
+ export type CheckoutToken = {
559
+ type?: string;
560
+ token?: string;
561
+ expires_on?: string;
562
+ expiry_month?: number;
563
+ expiry_year?: number;
564
+ scheme?: string;
565
+ scheme_local?: string;
566
+ last4?: string;
567
+ bin?: string;
568
+ card_type?: string;
569
+ card_category?: string;
570
+ issuer?: string;
571
+ issuer_country?: string;
572
+ product_id: string;
573
+ product_type: string;
574
+ billing_address?: {
575
+ address_line1?: string;
576
+ address_line2: string;
577
+ city?: string;
578
+ state?: string;
579
+ zip?: string;
580
+ country?: string;
581
+ };
582
+ phone?: {
583
+ country_code?: string;
584
+ number?: string;
585
+ };
586
+ name?: string;
587
+ };
588
+ export type SPECIFIED_TIME = 'anytime' | number;
589
+ export type PlaceOrder = {
590
+ clientID: string;
591
+ providerId: string;
592
+ orderMilllSec: number;
593
+ orderNanoSec: number;
594
+ services: CarService[];
595
+ lat: number;
596
+ long: number;
597
+ willClientBeThere: boolean;
598
+ paymentType: OrderPaymentType;
599
+ isPaid: boolean;
600
+ paymentId: string;
601
+ isProviderTest: boolean;
602
+ providerReceiveOrders: boolean;
603
+ orderNote: string;
604
+ promoCode: Discount;
605
+ driverIds: string[];
606
+ providerName: {
607
+ ar: string;
608
+ en: string;
609
+ };
610
+ paymentAmount: number;
611
+ usedBalance: number;
612
+ providerPhoneNumber: string;
613
+ isAddonStructure: boolean;
614
+ isMonthlyPackage: boolean;
615
+ sahabExtraPaymentAmount: number;
616
+ orderId?: string;
617
+ paymentGateway?: 'PAYLINK' | 'CHECKOUT' | 'TAP';
618
+ /** Mirrors Order economics for server-side Tap split; optional override of client fee % */
619
+ sahabClientPercentage?: number;
620
+ };
621
+ export type WeatherData = {
622
+ date: string;
623
+ precipitationProbability: number;
624
+ rainAccumulation: number;
625
+ cloudCover: number;
626
+ humidity: number;
627
+ windSpeed: number;
628
+ uvIndex: number;
629
+ };
630
+ export type PaymentConfigs = {
631
+ isCashAllowed: boolean;
632
+ isGooglePayAllowed?: boolean;
633
+ /** Tap GoSell merchant id for card / Apple Pay SDK config (optional; falls back in app). */
634
+ tapMerchantId?: string;
635
+ paymentGateways: {
636
+ key: string;
637
+ isActive: boolean;
638
+ priority: number;
639
+ }[];
640
+ };
641
+ export type Slot = {
642
+ id: string;
643
+ time: number;
644
+ selected: boolean;
645
+ reserved: boolean;
646
+ };
647
+ export type Statement = {
648
+ numberOfOrders: number;
649
+ completedOrders: number;
650
+ ratedOrders: number;
651
+ cancelledOrders: number;
652
+ cashOrders: number;
653
+ creditOrders: number;
654
+ applePayPayments: number;
655
+ expiredOrders: number;
656
+ confirmedOrders: number;
657
+ lateOrders: number;
658
+ ordersTotal: number;
659
+ orders: Order[];
660
+ statmentDate?: Date | string;
661
+ };