shopoflex-types 1.0.39 → 1.0.41
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 +9 -1
- package/dist/index.js +15 -1
- package/dist/types/api.d.ts +57 -0
- package/dist/types/api.js +4 -0
- package/dist/types/cart.d.ts +58 -0
- package/dist/types/cart.js +4 -0
- package/dist/types/common.d.ts +0 -557
- package/dist/types/common.js +2 -0
- package/dist/types/discount.d.ts +28 -0
- package/dist/types/discount.js +4 -0
- package/dist/types/enums.d.ts +16 -0
- package/dist/types/enums.js +23 -0
- package/dist/types/notification.d.ts +15 -0
- package/dist/types/notification.js +4 -0
- package/dist/types/order.d.ts +55 -0
- package/dist/types/order.js +4 -0
- package/dist/types/prods.d.ts +294 -0
- package/dist/types/prods.js +4 -0
- package/dist/types/product.d.ts +100 -0
- package/dist/types/product.js +4 -0
- package/dist/types/state.d.ts +23 -0
- package/dist/types/state.js +4 -0
- package/dist/types/user.d.ts +61 -0
- package/dist/types/user.js +4 -0
- package/dist/types/vendor.d.ts +159 -0
- package/dist/types/vendor.js +4 -0
- package/package.json +1 -1
package/dist/types/common.d.ts
CHANGED
|
@@ -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
|
-
}
|
package/dist/types/common.js
CHANGED
|
@@ -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,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,55 @@
|
|
|
1
|
+
import mongoose from 'mongoose';
|
|
2
|
+
import { Cart } from './prods';
|
|
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
|
+
}
|