shopoflex-types 1.0.46 → 1.0.48

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,611 @@
1
+ import mongoose from 'mongoose';
2
+ export interface Discount {
3
+ _id?: mongoose.Types.ObjectId;
4
+ code?: string;
5
+ vendorId: mongoose.Types.ObjectId;
6
+ type: "fixed" | "percentage";
7
+ value: number;
8
+ maxDiscountAmount?: number;
9
+ isAutomatic: boolean;
10
+ status: "active" | "paused" | "expired" | "exhausted";
11
+ usageLimit?: number;
12
+ usageCount: number;
13
+ perUserLimit: number;
14
+ discountCategory: "cart_total" | "free_delivery" | "category_discount" | "product_discount";
15
+ minCartValue: number;
16
+ applicableProducts: mongoose.Types.ObjectId[];
17
+ excludedProducts: mongoose.Types.ObjectId[];
18
+ applicableCategories: mongoose.Types.ObjectId[];
19
+ excludedCategories: mongoose.Types.ObjectId[];
20
+ usedBy: mongoose.Types.ObjectId[];
21
+ combinable: boolean;
22
+ firstTimeUsersOnly: boolean;
23
+ startDate: Date;
24
+ endDate?: Date;
25
+ description?: string;
26
+ createdBy?: mongoose.Types.ObjectId;
27
+ customerMessage?: string;
28
+ }
29
+ export declare enum TemplateId {
30
+ TEMPLATE_1 = "template_1",
31
+ TEMPLATE_2 = "template_2",
32
+ TEMPLATE_3 = "template_3",
33
+ TEMPLATE_4 = "template_4",
34
+ TEMPLATE_5 = "template_5"
35
+ }
36
+ export declare enum OrderStatus {
37
+ Pending = "pending",
38
+ Cancelled = "cancelled",
39
+ Rejected = "rejected",
40
+ Refunded = "refunded",
41
+ Preparing = "preparing",
42
+ Delivering = "delivering",
43
+ Completed = "completed"
44
+ }
45
+ export interface FileType {
46
+ previewUrl?: string;
47
+ type?: string;
48
+ selected?: boolean;
49
+ name?: string;
50
+ size?: number;
51
+ id?: string;
52
+ url?: string;
53
+ vendorId?: string;
54
+ }
55
+ export interface ILatLng {
56
+ lat: number;
57
+ lng: number;
58
+ }
59
+ export interface Address {
60
+ _id?: string;
61
+ location: {
62
+ lat: number;
63
+ lng: number;
64
+ };
65
+ city?: string;
66
+ area?: string;
67
+ street?: string;
68
+ building?: string;
69
+ florr?: string;
70
+ country?: string;
71
+ details: string;
72
+ }
73
+ export interface PriceModel {
74
+ price: number;
75
+ discountedPrice?: number;
76
+ finalPrice?: number;
77
+ cost?: number;
78
+ allowDecimal?: boolean;
79
+ minQuantity?: number;
80
+ unit?: string;
81
+ }
82
+ export interface Dimensions {
83
+ active: boolean;
84
+ values?: {
85
+ length: number | null;
86
+ width: number | null;
87
+ height: number | null;
88
+ weight: number | null;
89
+ };
90
+ }
91
+ export interface StockHandle {
92
+ active: boolean;
93
+ stockByBranch: Record<string, {
94
+ stockQuantity: number;
95
+ ifOutOfStock: 'showOutOfStock' | 'allowOrdering' | 'hideFromStore';
96
+ }>;
97
+ }
98
+ export interface Label {
99
+ featured: boolean;
100
+ mostSelling: {
101
+ criteria: string;
102
+ active: boolean;
103
+ };
104
+ newRelease: {
105
+ criteria: string;
106
+ period: number;
107
+ active: boolean;
108
+ };
109
+ }
110
+ export interface Specification {
111
+ active: boolean;
112
+ values: any[];
113
+ }
114
+ export interface AddonType {
115
+ _id: string;
116
+ name: {
117
+ en: string;
118
+ ar: string;
119
+ };
120
+ price: number;
121
+ enableQuantity?: boolean;
122
+ stockHandle: StockHandle;
123
+ files?: FileType[];
124
+ sortOrder?: number;
125
+ isActive: boolean;
126
+ vendorId: string | any;
127
+ createdAt?: Date;
128
+ updatedAt?: Date;
129
+ }
130
+ export interface Modifier {
131
+ name?: {
132
+ en?: string;
133
+ ar?: string;
134
+ };
135
+ type?: "checkbox" | "radio" | "select";
136
+ required?: boolean;
137
+ maxSelect?: number;
138
+ minSelect?: number;
139
+ active?: boolean;
140
+ addons?: {
141
+ addonId: AddonType | any;
142
+ enableQuantity?: boolean;
143
+ priceOverride?: number;
144
+ }[];
145
+ }
146
+ export interface Category {
147
+ _id: string;
148
+ name: {
149
+ en: string;
150
+ ar: string;
151
+ };
152
+ description: {
153
+ en: string;
154
+ ar: string;
155
+ };
156
+ parentCategoryId?: string | null;
157
+ createdAt: Date;
158
+ files?: FileType[];
159
+ sortOrder?: number;
160
+ isActive: boolean;
161
+ vendorId: string | any;
162
+ }
163
+ export interface ProductType {
164
+ _id: string;
165
+ name: {
166
+ en: string;
167
+ ar: string;
168
+ };
169
+ description?: {
170
+ en: string;
171
+ ar: string;
172
+ };
173
+ sku?: string;
174
+ categoriesIds: any[];
175
+ dimensions?: Dimensions;
176
+ priceModel: PriceModel;
177
+ stockHandle?: StockHandle;
178
+ tags?: string[];
179
+ branchesIds?: string[];
180
+ modifiers?: Modifier[];
181
+ hasModifiers?: boolean;
182
+ label?: Label;
183
+ sort?: number;
184
+ hasVariants?: boolean;
185
+ specifications?: Specification;
186
+ linkedProduct?: any;
187
+ createdAt?: Date;
188
+ updatedAt?: Date;
189
+ files?: FileType[];
190
+ sortOrder?: number;
191
+ isActive: boolean;
192
+ vendorId: string | any;
193
+ }
194
+ export interface GroupedCategory {
195
+ categoryName: any;
196
+ products: ProductType[];
197
+ }
198
+ export interface sModifier {
199
+ listName: string;
200
+ options: {
201
+ addonId: string;
202
+ optionName: string;
203
+ price: number;
204
+ quantity: number;
205
+ }[];
206
+ total: number;
207
+ }
208
+ export interface CartItem {
209
+ _id?: string;
210
+ categoriesIds: string[];
211
+ price: number;
212
+ quantity: number;
213
+ name?: {
214
+ en?: string;
215
+ ar?: string;
216
+ };
217
+ selectedModifiers?: {
218
+ lists?: sModifier[];
219
+ overallTotal?: number;
220
+ };
221
+ finalPrice?: number;
222
+ files?: FileType[];
223
+ }
224
+ export interface Cart {
225
+ _id?: string;
226
+ items: CartItem[];
227
+ subtotal: number;
228
+ totalQuantity: number;
229
+ discount: number;
230
+ delivery: number;
231
+ total: number;
232
+ }
233
+ export interface CartState {
234
+ items: CartItem[];
235
+ subtotal: number;
236
+ totalQuantity: number;
237
+ discount: number;
238
+ delivery: number;
239
+ total: number;
240
+ promoCode?: Discount;
241
+ }
242
+ export interface CartModelType extends Cart {
243
+ customer: Customer | any;
244
+ vendorId: String | any;
245
+ _id?: string;
246
+ items: CartItem[];
247
+ subtotal: number;
248
+ totalQuantity: number;
249
+ discount: number;
250
+ delivery: number;
251
+ total: number;
252
+ }
253
+ export interface PaymentDetails {
254
+ method: string;
255
+ status: string;
256
+ transactionId?: string;
257
+ }
258
+ export interface DeliveryDetails {
259
+ method: string;
260
+ status?: string;
261
+ estimatedDate?: Date;
262
+ trackingNumber?: string;
263
+ }
264
+ export interface Shipping {
265
+ method: string;
266
+ cost?: number;
267
+ trackingNumber?: string;
268
+ }
269
+ export interface OrderType {
270
+ _id?: string | any;
271
+ customer?: Customer;
272
+ vendorId?: string;
273
+ cart?: Cart;
274
+ paymentMethod?: string;
275
+ address?: Address;
276
+ status?: OrderStatus;
277
+ paid?: boolean;
278
+ shipping: Shipping;
279
+ createdAt?: Date;
280
+ updatedAt?: Date;
281
+ scheduleTime: {
282
+ asap: boolean;
283
+ date?: Date;
284
+ time?: Date;
285
+ };
286
+ branch: {
287
+ _id: mongoose.Types.ObjectId | string;
288
+ name?: {
289
+ en?: string;
290
+ ar?: string;
291
+ };
292
+ };
293
+ orderNumber?: any;
294
+ promo?: {
295
+ _id?: string;
296
+ code?: string;
297
+ type?: string;
298
+ value?: number;
299
+ category?: string;
300
+ discountedAmount?: number;
301
+ };
302
+ }
303
+ export interface Customer {
304
+ _id?: string;
305
+ uid?: string;
306
+ fullName?: string;
307
+ email?: string;
308
+ phone?: {
309
+ full?: string;
310
+ dial?: string;
311
+ number?: string;
312
+ };
313
+ updatedAt?: Date | number;
314
+ createdAt?: Date | number;
315
+ addresses?: Address[];
316
+ vendors?: string[];
317
+ isAnonymos?: boolean;
318
+ files?: FileType[];
319
+ }
320
+ export interface VendorAssociation {
321
+ vendorId: string;
322
+ role?: string;
323
+ permissions?: string[];
324
+ }
325
+ export interface IUser {
326
+ _id?: any;
327
+ uid?: string;
328
+ firstName?: string;
329
+ lastName?: string;
330
+ email?: string;
331
+ phone?: string;
332
+ photoURL?: string;
333
+ isAdmin?: boolean;
334
+ vendors?: VendorAssociation[];
335
+ createdAt?: Date;
336
+ updatedAt?: Date;
337
+ fcmTokens?: string[];
338
+ files?: FileType[];
339
+ }
340
+ export interface CurrentUserType extends IUser {
341
+ vendors?: {
342
+ vendorId: string;
343
+ name: {
344
+ en: string;
345
+ ar: string;
346
+ };
347
+ logo?: FileType[];
348
+ description: {
349
+ en: string;
350
+ ar: string;
351
+ };
352
+ }[];
353
+ hasAccesstoVendor?: boolean;
354
+ }
355
+ export type IRole = {
356
+ _id?: string;
357
+ name?: {
358
+ en?: string;
359
+ ar?: string;
360
+ };
361
+ permissions?: string[];
362
+ };
363
+ export interface IBranchName {
364
+ en: string;
365
+ ar?: string;
366
+ }
367
+ export interface Vendor {
368
+ _id?: string;
369
+ name: {
370
+ en: string;
371
+ ar: string;
372
+ };
373
+ domains: string[];
374
+ description: {
375
+ en: string;
376
+ ar: string;
377
+ };
378
+ logo: FileType[];
379
+ cover: FileType[];
380
+ favicon: FileType[];
381
+ font: {
382
+ en: any;
383
+ ar: any;
384
+ };
385
+ colors: {
386
+ primaryColor: string;
387
+ textColor: string;
388
+ bgColor: string;
389
+ };
390
+ currencies: string[];
391
+ expiryDate: string;
392
+ numberOfDecimals: number;
393
+ email: string;
394
+ phone: string;
395
+ currency: string;
396
+ language: string;
397
+ country: string;
398
+ template: {
399
+ id: TemplateId;
400
+ name: {
401
+ en: string;
402
+ ar: string;
403
+ };
404
+ description: {
405
+ en: string;
406
+ ar: string;
407
+ };
408
+ link: string;
409
+ image: string;
410
+ isActive: boolean;
411
+ };
412
+ updateAt: Date;
413
+ createdAt: Date;
414
+ orderType: string[];
415
+ socialLinks: string[];
416
+ users: Array<unknown>;
417
+ areas: Record<string, unknown>;
418
+ payments: {
419
+ Cash: {
420
+ active: boolean;
421
+ status: string;
422
+ id: string;
423
+ key: string | null;
424
+ extra: string | null;
425
+ name: {
426
+ ar: string;
427
+ en: string;
428
+ };
429
+ };
430
+ posCard: {
431
+ active: boolean;
432
+ status: string;
433
+ id: string;
434
+ key: string | null;
435
+ extra: string | null;
436
+ name: {
437
+ ar: string;
438
+ en: string;
439
+ };
440
+ };
441
+ payByLink: {
442
+ active: boolean;
443
+ status: string;
444
+ id: string;
445
+ key: string | null;
446
+ extra: string | null;
447
+ name: {
448
+ ar: string;
449
+ en: string;
450
+ };
451
+ };
452
+ };
453
+ }
454
+ export interface NotificationType {
455
+ _id?: any;
456
+ recipientId?: string;
457
+ recipientType?: 'vendor' | 'customer';
458
+ vendorId?: string;
459
+ type?: 'new_order' | 'order_update' | 'stock_alert' | 'product_update' | 'system_update';
460
+ title: string;
461
+ message?: string;
462
+ data?: any;
463
+ read: boolean;
464
+ readAt?: Date;
465
+ priority?: 'low' | 'medium' | 'high';
466
+ createdAt?: Date;
467
+ updatedAt?: Date;
468
+ }
469
+ export interface SelectionsState {
470
+ address?: Address;
471
+ branch?: IBranch;
472
+ orderType?: "delivery" | "pickup" | "dinein";
473
+ deliveryType?: "delivery" | "pickup" | "dineIn";
474
+ paymentMethod?: "cash_on_delivery" | "card_on_delivery" | "wallet" | "credit_card";
475
+ promoCode?: string;
476
+ shippingMethod?: string;
477
+ time?: number;
478
+ validLocation?: boolean;
479
+ }
480
+ export interface StoreState {
481
+ branches?: IBranch[];
482
+ groupedCategories?: {
483
+ [key: string]: GroupedCategory;
484
+ };
485
+ allProducts?: ProductType[];
486
+ allCategories?: Category[];
487
+ loading?: boolean;
488
+ }
489
+ export interface ITimeSlot {
490
+ from: string;
491
+ to: string;
492
+ }
493
+ export interface IDayHours {
494
+ isOpen: boolean;
495
+ is24Hours: boolean;
496
+ timeSlots: ITimeSlot[];
497
+ }
498
+ export interface IOpeningHours {
499
+ Monday: IDayHours;
500
+ Tuesday: IDayHours;
501
+ Wednesday: IDayHours;
502
+ Thursday: IDayHours;
503
+ Friday: IDayHours;
504
+ Saturday: IDayHours;
505
+ Sunday: IDayHours;
506
+ }
507
+ export interface IZone {
508
+ i?: number;
509
+ deliveryType?: string;
510
+ deliveryRange?: string;
511
+ deliveryFee?: string;
512
+ pricePerKm?: string;
513
+ radius?: number;
514
+ center?: {
515
+ lat: number;
516
+ lng: number;
517
+ };
518
+ markerPosition?: {
519
+ lat: number;
520
+ lng: number;
521
+ };
522
+ country?: string;
523
+ }
524
+ export interface IDeliverySettings {
525
+ enabled?: boolean;
526
+ charge?: string;
527
+ zones?: IZone[];
528
+ openingHours?: IOpeningHours;
529
+ }
530
+ export interface IPickupSettings {
531
+ enabled?: boolean;
532
+ instruction?: string;
533
+ openingHours?: IOpeningHours;
534
+ }
535
+ export interface IDineInSettings {
536
+ enabled?: boolean;
537
+ tableCount?: string;
538
+ openingHours?: IOpeningHours;
539
+ }
540
+ export interface IBranch {
541
+ _id?: string;
542
+ name: {
543
+ en: string;
544
+ ar: string;
545
+ };
546
+ phone: string;
547
+ vendorId: string | any;
548
+ deliverySettings?: IDeliverySettings;
549
+ pickupSettings?: IPickupSettings;
550
+ dineInSettings?: IDineInSettings;
551
+ createdAt?: Date;
552
+ updatedAt?: Date;
553
+ files?: FileType[];
554
+ }
555
+ export interface PaginationQuery {
556
+ page?: string;
557
+ limit?: string;
558
+ sortBy?: string;
559
+ sortOrder?: 'asc' | 'desc';
560
+ search?: string;
561
+ [key: string]: any;
562
+ }
563
+ export interface PaginationOptions {
564
+ page: number;
565
+ limit: number;
566
+ skip: number;
567
+ sortBy: string;
568
+ sortOrder: 'asc' | 'desc';
569
+ filters: Record<string, any>;
570
+ search?: string;
571
+ }
572
+ export interface PaginatedResponse<T> {
573
+ data: T[];
574
+ pagination: {
575
+ currentPage: number;
576
+ totalPages: number;
577
+ totalItems: number;
578
+ hasNextPage: boolean;
579
+ hasPrevPage: boolean;
580
+ limit: number;
581
+ };
582
+ filters?: Record<string, any>;
583
+ sort?: {
584
+ sortBy: string;
585
+ sortOrder: 'asc' | 'desc';
586
+ };
587
+ }
588
+ export interface FilterConfig {
589
+ [key: string]: {
590
+ type: 'string' | 'number' | 'boolean' | 'date' | 'array' | 'objectId';
591
+ operator?: 'eq' | 'ne' | 'gt' | 'gte' | 'lt' | 'lte' | 'in' | 'nin' | 'regex' | 'exists';
592
+ transform?: (value: any) => any;
593
+ };
594
+ }
595
+ export interface SortConfig {
596
+ allowedFields: string[];
597
+ defaultField: string;
598
+ defaultOrder: 'asc' | 'desc';
599
+ }
600
+ export interface SearchConfig {
601
+ fields: string[];
602
+ caseSensitive?: boolean;
603
+ }
604
+ export interface successResponse {
605
+ data: any[];
606
+ totalPages: number;
607
+ currentPage: number;
608
+ count: number;
609
+ hasNextPage: boolean;
610
+ hasPrevPage: boolean;
611
+ }
package/dist/common.js ADDED
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
package/dist/index.d.ts CHANGED
@@ -1,9 +1 @@
1
- export * from './types/enums';
2
- export * from './types/prods';
3
- export * from './types/discount';
4
- export * from './types/order';
5
- export * from './types/user';
6
- export * from './types/vendor';
7
- export * from './types/notification';
8
- export * from './types/state';
9
- export * from './types/api';
1
+ export * from './common';
package/dist/index.js CHANGED
@@ -1,6 +1,4 @@
1
1
  "use strict";
2
- // types/index.ts
3
- // Main export file for all types
4
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
5
3
  if (k2 === undefined) k2 = k;
6
4
  var desc = Object.getOwnPropertyDescriptor(m, k);
@@ -16,16 +14,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
16
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
17
15
  };
18
16
  Object.defineProperty(exports, "__esModule", { value: true });
19
- // Common types
20
- __exportStar(require("./types/enums"), exports);
21
- // Domain-specific types
22
- __exportStar(require("./types/prods"), exports);
23
- __exportStar(require("./types/discount"), exports);
24
- __exportStar(require("./types/order"), exports);
25
- __exportStar(require("./types/user"), exports);
26
- __exportStar(require("./types/vendor"), exports);
27
- __exportStar(require("./types/notification"), exports);
28
- // Application state types
29
- __exportStar(require("./types/state"), exports);
30
- // API and utility types
31
- __exportStar(require("./types/api"), exports);
17
+ __exportStar(require("./common"), exports);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shopoflex-types",
3
- "version": "1.0.46",
3
+ "version": "1.0.48",
4
4
  "description": "Shared TypeScript types for Shopoflex applications",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",