shopoflex-types 1.0.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 @@
1
+ export * from './types/common';
package/dist/index.js ADDED
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./types/common"), exports);
@@ -0,0 +1,517 @@
1
+ export interface FileType {
2
+ previewUrl?: string;
3
+ type?: string;
4
+ selected?: boolean;
5
+ name?: string;
6
+ size?: number;
7
+ id?: string;
8
+ url?: string;
9
+ vendorId?: string;
10
+ }
11
+ export declare enum TemplateId {
12
+ TEMPLATE_1 = "template_1",
13
+ TEMPLATE_2 = "template_2",
14
+ TEMPLATE_3 = "template_3",
15
+ TEMPLATE_4 = "template_4",
16
+ TEMPLATE_5 = "template_5"
17
+ }
18
+ export interface Vendor {
19
+ _id: string;
20
+ name: {
21
+ en: string;
22
+ ar: string;
23
+ };
24
+ domains: string[];
25
+ description: {
26
+ en: string;
27
+ ar: string;
28
+ };
29
+ logo: FileType;
30
+ cover: FileType[];
31
+ favicon: FileType;
32
+ font: {
33
+ en: any;
34
+ ar: any;
35
+ };
36
+ colors: {
37
+ primaryColor: string;
38
+ textColor: string;
39
+ bgColor: string;
40
+ };
41
+ countries: string[];
42
+ currencies: string[];
43
+ defaultCurrency: string;
44
+ currency: string;
45
+ integrations: {
46
+ loyaltyProgram: {
47
+ active: boolean;
48
+ started: boolean;
49
+ };
50
+ };
51
+ expiryDate: string;
52
+ defaultLanguage: string;
53
+ acceptedLanguages: string[];
54
+ numberOfDecimals: number;
55
+ supportEmail: string;
56
+ template: {
57
+ id: TemplateId;
58
+ name: {
59
+ en: string;
60
+ ar: string;
61
+ };
62
+ description: {
63
+ en: string;
64
+ ar: string;
65
+ };
66
+ link: string;
67
+ image: string;
68
+ isActive: boolean;
69
+ };
70
+ updateAt: Date;
71
+ createdAt: Date;
72
+ orderType: string[];
73
+ socialLinks: string[];
74
+ users: Array<unknown>;
75
+ areas: Record<string, unknown>;
76
+ country: string;
77
+ phone: string;
78
+ payments: {
79
+ Cash: {
80
+ active: boolean;
81
+ status: string;
82
+ id: string;
83
+ key: string | null;
84
+ extra: string | null;
85
+ name: {
86
+ ar: string;
87
+ en: string;
88
+ };
89
+ };
90
+ posCard: {
91
+ active: boolean;
92
+ status: string;
93
+ id: string;
94
+ key: string | null;
95
+ extra: string | null;
96
+ name: {
97
+ ar: string;
98
+ en: string;
99
+ };
100
+ };
101
+ payByLink: {
102
+ active: boolean;
103
+ status: string;
104
+ id: string;
105
+ key: string | null;
106
+ extra: string | null;
107
+ name: {
108
+ ar: string;
109
+ en: string;
110
+ };
111
+ };
112
+ };
113
+ }
114
+ interface PriceModel {
115
+ price: number;
116
+ discountedPrice?: number;
117
+ finalPrice?: number;
118
+ cost?: number;
119
+ allowDecimal?: boolean;
120
+ minQuantity?: number;
121
+ unit?: string;
122
+ }
123
+ interface Dimensions {
124
+ active: boolean;
125
+ values?: {
126
+ length: number | null;
127
+ width: number | null;
128
+ height: number | null;
129
+ weight: number | null;
130
+ };
131
+ }
132
+ interface StockHandle {
133
+ active: boolean;
134
+ stockQuantity: number;
135
+ ifOutOfStock: 'showOutOfStock' | 'allowOrdering' | 'hideFromStore';
136
+ }
137
+ interface StockHandle {
138
+ active: boolean;
139
+ stockQuantity: number;
140
+ ifOutOfStock: 'showOutOfStock' | 'allowOrdering' | 'hideFromStore';
141
+ }
142
+ interface Label {
143
+ featured: boolean;
144
+ mostSelling: {
145
+ criteria: string;
146
+ active: boolean;
147
+ };
148
+ newRelease: {
149
+ criteria: string;
150
+ period: number;
151
+ active: boolean;
152
+ };
153
+ }
154
+ interface Specification {
155
+ active: boolean;
156
+ values: any[];
157
+ }
158
+ export interface Category {
159
+ _id: string;
160
+ name: {
161
+ en: string;
162
+ ar: string;
163
+ };
164
+ description: {
165
+ en: string;
166
+ ar: string;
167
+ };
168
+ parentCategoryId?: string | null;
169
+ image?: string;
170
+ sortOrder?: number;
171
+ isActive: boolean;
172
+ vendorId: string;
173
+ createdAt: Date;
174
+ }
175
+ export interface CartState {
176
+ items: CartItem[];
177
+ subtotal: number;
178
+ totalQuantity: number;
179
+ discount: number;
180
+ delivery: number;
181
+ total: number;
182
+ promoCode?: Discount;
183
+ }
184
+ export interface ProductType {
185
+ _id: string;
186
+ name: {
187
+ en: string;
188
+ ar: string;
189
+ };
190
+ description?: {
191
+ en: string;
192
+ ar: string;
193
+ };
194
+ sku?: string;
195
+ categoriesIds: any[];
196
+ dimensions?: Dimensions;
197
+ priceModel: PriceModel;
198
+ stockHandle?: StockHandle;
199
+ tags?: string[];
200
+ branchesIds?: string[];
201
+ files: FileType[];
202
+ modifiers?: Modifier[];
203
+ hasModifiers?: boolean;
204
+ label?: Label;
205
+ sort?: number;
206
+ active: boolean;
207
+ specifications?: Specification;
208
+ linkedProduct?: any;
209
+ vendorId?: any;
210
+ createdAt?: string;
211
+ }
212
+ interface StockHandle {
213
+ active: boolean;
214
+ stockQuantity: number;
215
+ ifOutOfStock: 'showOutOfStock' | 'allowOrdering' | 'hideFromStore';
216
+ }
217
+ export interface Modifier {
218
+ name?: {
219
+ en?: string;
220
+ ar?: string;
221
+ };
222
+ type?: "checkbox" | "radio" | "select";
223
+ required?: boolean;
224
+ maxSelect?: number;
225
+ minSelect?: number;
226
+ active?: boolean;
227
+ options?: AddonType[] | string[];
228
+ addons?: AddonType[] | string[];
229
+ }
230
+ export interface AddonType {
231
+ _id: string;
232
+ name: {
233
+ en: string;
234
+ ar: string;
235
+ };
236
+ price: number;
237
+ enableQuantity?: boolean;
238
+ stockHandle: StockHandle;
239
+ }
240
+ export interface PaymentDetails {
241
+ method: string;
242
+ status: string;
243
+ transactionId?: string;
244
+ }
245
+ export interface DeliveryDetails {
246
+ method: string;
247
+ status?: string;
248
+ estimatedDate?: Date;
249
+ trackingNumber?: string;
250
+ }
251
+ export interface Customer {
252
+ id?: string;
253
+ uid?: string;
254
+ fullName?: string;
255
+ email?: string;
256
+ phone?: {
257
+ full?: string;
258
+ dial?: string;
259
+ number?: string;
260
+ };
261
+ updatedAt?: Date | number;
262
+ createdAt?: Date | number;
263
+ addresses?: Address[];
264
+ vendors?: string[];
265
+ }
266
+ export interface Address {
267
+ _id?: string;
268
+ location: {
269
+ lat: number;
270
+ lng: number;
271
+ };
272
+ city?: string;
273
+ area?: string;
274
+ street?: string;
275
+ building?: string;
276
+ florr?: string;
277
+ country?: string;
278
+ details: string;
279
+ }
280
+ export interface sModifier {
281
+ listName: string;
282
+ options: {
283
+ addonId: string;
284
+ optionName: string;
285
+ price: number;
286
+ quantity: number;
287
+ }[];
288
+ total: number;
289
+ }
290
+ export interface CartItem {
291
+ _id?: string;
292
+ categoriesIds: string[];
293
+ price: number;
294
+ quantity: number;
295
+ name?: {
296
+ en?: string;
297
+ ar?: string;
298
+ };
299
+ selectedModifiers?: {
300
+ lists?: sModifier[];
301
+ overallTotal?: number;
302
+ };
303
+ finalPrice?: number;
304
+ fileUrl: string;
305
+ }
306
+ export interface Cart {
307
+ _id?: string;
308
+ items: CartItem[];
309
+ subtotal: number;
310
+ totalQuantity: number;
311
+ discount: number;
312
+ delivery: number;
313
+ total: number;
314
+ }
315
+ export interface Shipping {
316
+ method: string;
317
+ cost?: number;
318
+ trackingNumber?: string;
319
+ }
320
+ export interface Address {
321
+ id: string;
322
+ location: {
323
+ lat: number;
324
+ lng: number;
325
+ };
326
+ city?: string;
327
+ area?: string;
328
+ street?: string;
329
+ building?: string;
330
+ florr?: string;
331
+ country?: string;
332
+ details: string;
333
+ }
334
+ export declare enum OrderStatus {
335
+ Pending = "pending",
336
+ Cancelled = "cancelled",
337
+ Rejected = "rejected",
338
+ Refunded = "refunded",
339
+ Preparing = "preparing",
340
+ Delivering = "delivering",
341
+ Completed = "completed"
342
+ }
343
+ export interface OrderType {
344
+ _id?: string | any;
345
+ customer?: Customer;
346
+ vendorId?: string;
347
+ cart?: Cart;
348
+ paymentMethod?: string;
349
+ address?: Address;
350
+ status?: OrderStatus;
351
+ paid?: boolean;
352
+ shipping: Shipping;
353
+ createdAt?: Date;
354
+ updatedAt?: Date;
355
+ orderNumber?: any;
356
+ }
357
+ interface VendorAssociation {
358
+ vendorId: string;
359
+ role?: string;
360
+ permissions?: string[];
361
+ }
362
+ export interface NotificationType {
363
+ _id?: any;
364
+ recipientId?: string;
365
+ recipientType?: 'vendor' | 'customer';
366
+ vendorId?: string;
367
+ type?: 'new_order' | 'order_update' | 'stock_alert' | 'product_update' | 'system_update';
368
+ title: string;
369
+ message?: string;
370
+ data?: any;
371
+ read: boolean;
372
+ readAt?: Date;
373
+ priority?: 'low' | 'medium' | 'high';
374
+ createdAt?: Date;
375
+ updatedAt?: Date;
376
+ }
377
+ export interface IUser {
378
+ _id?: any;
379
+ uid?: string;
380
+ firstName?: string;
381
+ lastName?: string;
382
+ email?: string;
383
+ phone?: string;
384
+ photoURL?: string;
385
+ isAdmin?: boolean;
386
+ vendors?: VendorAssociation[];
387
+ createdAt?: Date;
388
+ updatedAt?: Date;
389
+ fcmTokens?: string[];
390
+ }
391
+ export type IRole = {
392
+ _id?: string;
393
+ name?: {
394
+ en?: string;
395
+ ar?: string;
396
+ };
397
+ permissions?: string[];
398
+ };
399
+ interface ILatLng {
400
+ lat: number;
401
+ lng: number;
402
+ }
403
+ interface IZone {
404
+ country: string;
405
+ deliveryType: "distance" | "constant";
406
+ deliveryRange: "radius" | "country";
407
+ deliveryFee?: string;
408
+ pricePerKm: string;
409
+ radius: number;
410
+ center: ILatLng;
411
+ markerPosition: ILatLng;
412
+ }
413
+ interface IDeliverySettings {
414
+ zones: IZone[];
415
+ }
416
+ interface IPickupSettings {
417
+ enabled: boolean;
418
+ instruction?: string;
419
+ }
420
+ interface IDineInSettings {
421
+ enabled: boolean;
422
+ }
423
+ interface IBranchName {
424
+ en: string;
425
+ ar?: string;
426
+ }
427
+ export interface IBranch {
428
+ name: IBranchName;
429
+ phone: string;
430
+ vendorId: string;
431
+ deliverySettings: IDeliverySettings;
432
+ pickupSettings: IPickupSettings;
433
+ dineInSettings: IDineInSettings;
434
+ createdAt?: Date;
435
+ }
436
+ export interface Address {
437
+ id: string;
438
+ location: {
439
+ lat: number;
440
+ lng: number;
441
+ };
442
+ city?: string;
443
+ area?: string;
444
+ street?: string;
445
+ building?: string;
446
+ florr?: string;
447
+ country?: string;
448
+ details: string;
449
+ }
450
+ export interface SelectionsState {
451
+ address?: Address;
452
+ branch?: IBranch;
453
+ orderType?: "delivery" | "pickup" | "dinein";
454
+ paymentMethod?: "cash_on_delivery" | "card_on_delivery" | "wallet" | "credit_card";
455
+ }
456
+ export interface SelectionsState {
457
+ address?: Address;
458
+ branch?: IBranch;
459
+ deliveryType?: "delivery" | "pickup" | "dineIn";
460
+ paymentMethod?: "cash_on_delivery" | "card_on_delivery" | "wallet" | "credit_card";
461
+ promoCode?: string;
462
+ shippingMethod?: string;
463
+ time?: number;
464
+ validLocation?: boolean;
465
+ }
466
+ export interface GroupedCategory {
467
+ categoryName: any;
468
+ products: ProductType[];
469
+ }
470
+ export interface StoreState {
471
+ branches?: IBranch[];
472
+ groupedCategories?: {
473
+ [key: string]: GroupedCategory;
474
+ };
475
+ allProducts?: ProductType[];
476
+ allCategories?: Category[];
477
+ loading?: boolean;
478
+ }
479
+ export interface Discount {
480
+ _id: string;
481
+ code: string;
482
+ vendorId: string;
483
+ type: "fixed" | "percentage";
484
+ value: number;
485
+ isAutomatic: boolean;
486
+ usageLimit: number | null;
487
+ perUserLimit: number;
488
+ discountCategory: "cart_total" | "free_delivery";
489
+ minCartValue: number;
490
+ applicableProducts: string[];
491
+ applicableCategories: string[];
492
+ eligibleUsers: string[];
493
+ combinable: boolean;
494
+ firstTimeUsersOnly: boolean;
495
+ startDate: Date;
496
+ endDate?: Date;
497
+ expiryDate?: Date;
498
+ createdAt: Date;
499
+ }
500
+ export interface CurrentUserType extends IUser {
501
+ vendors?: {
502
+ vendorId: string;
503
+ name: {
504
+ en: string;
505
+ ar: string;
506
+ };
507
+ logo: {
508
+ previewUrl: string;
509
+ };
510
+ description: {
511
+ en: string;
512
+ ar: string;
513
+ };
514
+ }[];
515
+ hasAccesstoVendor?: boolean;
516
+ }
517
+ export {};
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.OrderStatus = exports.TemplateId = void 0;
4
+ var TemplateId;
5
+ (function (TemplateId) {
6
+ TemplateId["TEMPLATE_1"] = "template_1";
7
+ TemplateId["TEMPLATE_2"] = "template_2";
8
+ TemplateId["TEMPLATE_3"] = "template_3";
9
+ TemplateId["TEMPLATE_4"] = "template_4";
10
+ TemplateId["TEMPLATE_5"] = "template_5";
11
+ })(TemplateId || (exports.TemplateId = TemplateId = {}));
12
+ var OrderStatus;
13
+ (function (OrderStatus) {
14
+ OrderStatus["Pending"] = "pending";
15
+ OrderStatus["Cancelled"] = "cancelled";
16
+ OrderStatus["Rejected"] = "rejected";
17
+ OrderStatus["Refunded"] = "refunded";
18
+ OrderStatus["Preparing"] = "preparing";
19
+ OrderStatus["Delivering"] = "delivering";
20
+ OrderStatus["Completed"] = "completed";
21
+ })(OrderStatus || (exports.OrderStatus = OrderStatus = {}));
package/package.json ADDED
@@ -0,0 +1,22 @@
1
+ {
2
+ "name": "shopoflex-types",
3
+ "version": "1.0.0",
4
+ "description": "Shared TypeScript types for Shopoflex applications",
5
+ "main": "dist/index.js",
6
+ "types": "dist/index.d.ts",
7
+ "files": [
8
+ "dist"
9
+ ],
10
+ "scripts": {
11
+ "build": "tsc",
12
+ "watch": "tsc --watch",
13
+ "prepublishOnly": "npm run build"
14
+ },
15
+ "publishConfig": {
16
+ "access": "public"
17
+ },
18
+ "keywords": ["typescript", "types", "shopoflex"],
19
+ "devDependencies": {
20
+ "typescript": "^5.0.0"
21
+ }
22
+ }