shopoflex-types 1.0.39 → 1.0.40

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