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.
@@ -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,294 @@
1
+ import { FileType, PriceModel, Dimensions, StockHandle } from './common';
2
+ import { Discount } from './discount';
3
+ import { Customer } from './user';
4
+ export interface Label {
5
+ featured: boolean;
6
+ mostSelling: {
7
+ criteria: string;
8
+ active: boolean;
9
+ };
10
+ newRelease: {
11
+ criteria: string;
12
+ period: number;
13
+ active: boolean;
14
+ };
15
+ }
16
+ export interface Specification {
17
+ active: boolean;
18
+ values: any[];
19
+ }
20
+ export type CustomerDataFieldType = 'text' | 'textarea' | 'number' | 'date' | 'checkbox' | 'radio' | 'select' | 'file_upload' | 'email' | 'phone';
21
+ export interface CustomerDataField {
22
+ fieldId: string;
23
+ label: {
24
+ en: string;
25
+ ar: string;
26
+ };
27
+ type: CustomerDataFieldType;
28
+ required: boolean;
29
+ placeholder?: {
30
+ en?: string;
31
+ ar?: string;
32
+ };
33
+ helpText?: {
34
+ en?: string;
35
+ ar?: string;
36
+ };
37
+ options?: {
38
+ value: string;
39
+ label: {
40
+ en: string;
41
+ ar: string;
42
+ };
43
+ }[];
44
+ validation?: {
45
+ minLength?: number;
46
+ maxLength?: number;
47
+ min?: number;
48
+ max?: number;
49
+ pattern?: string;
50
+ fileTypes?: string[];
51
+ maxFileSize?: number;
52
+ maxFiles?: number;
53
+ };
54
+ pricing?: {
55
+ type: 'fixed' | 'per_character' | 'per_word' | 'conditional';
56
+ basePrice?: number;
57
+ conditionalPricing?: {
58
+ condition: string;
59
+ price: number;
60
+ }[];
61
+ };
62
+ sortOrder: number;
63
+ isActive: boolean;
64
+ }
65
+ export interface CustomerDataValue {
66
+ fieldId: string;
67
+ value: any;
68
+ files?: FileType[];
69
+ additionalPrice?: number;
70
+ }
71
+ export type AttributeType = 'color' | 'size' | 'material' | 'storage' | 'weight' | 'dimension' | 'style' | 'brand' | 'model';
72
+ export interface ProductAttribute {
73
+ type: AttributeType;
74
+ value: string | number;
75
+ displayValue?: {
76
+ en: string;
77
+ ar: string;
78
+ };
79
+ }
80
+ export interface ProductVariant {
81
+ variantId: string;
82
+ sku: string;
83
+ attributes: Record<string, ProductAttribute>;
84
+ priceModifier: number;
85
+ stockHandle: StockHandle;
86
+ images?: FileType[];
87
+ isActive: boolean;
88
+ sort?: number;
89
+ barcode?: string;
90
+ }
91
+ export interface AddonType {
92
+ _id: any;
93
+ name: {
94
+ en: string;
95
+ ar: string;
96
+ };
97
+ price: number;
98
+ stockHandle?: StockHandle;
99
+ files?: FileType[];
100
+ sortOrder?: number;
101
+ isActive: boolean;
102
+ vendorId: string | any;
103
+ createdAt?: Date;
104
+ updatedAt?: Date;
105
+ }
106
+ export interface Modifier {
107
+ name?: {
108
+ en?: string;
109
+ ar?: string;
110
+ };
111
+ type?: "checkbox" | "radio" | "select";
112
+ required?: boolean;
113
+ maxSelect?: number;
114
+ minSelect?: number;
115
+ active?: boolean;
116
+ addons?: {
117
+ addonId: string;
118
+ enableQuantity?: boolean;
119
+ priceOverride?: number;
120
+ }[];
121
+ }
122
+ export interface Category {
123
+ _id: string;
124
+ name: {
125
+ en: string;
126
+ ar: string;
127
+ };
128
+ description: {
129
+ en: string;
130
+ ar: string;
131
+ };
132
+ parentCategoryId?: string | null;
133
+ createdAt: Date;
134
+ files?: FileType[];
135
+ sortOrder?: number;
136
+ isActive: boolean;
137
+ vendorId: string | any;
138
+ }
139
+ export interface ProductType {
140
+ _id: string;
141
+ name: {
142
+ en: string;
143
+ ar: string;
144
+ };
145
+ description?: {
146
+ en: string;
147
+ ar: string;
148
+ };
149
+ sku?: string;
150
+ categoriesIds: any[];
151
+ dimensions?: Dimensions;
152
+ priceModel: PriceModel;
153
+ variants: ProductVariant[];
154
+ hasVariants: boolean;
155
+ variantsGroupOrder?: string[];
156
+ reviewSummary?: ReviewSummary;
157
+ allowReviews?: boolean;
158
+ customerDataFields?: CustomerDataField[];
159
+ hasCustomerData?: boolean;
160
+ tags?: string[];
161
+ branchesIds?: string[];
162
+ modifiers?: Modifier[];
163
+ hasModifiers?: boolean;
164
+ label?: Label;
165
+ sort?: number;
166
+ specifications?: Specification;
167
+ linkedProduct?: any;
168
+ createdAt?: Date;
169
+ updatedAt?: Date;
170
+ files?: FileType[];
171
+ sortOrder?: number;
172
+ isActive: boolean;
173
+ vendorId: string | any;
174
+ }
175
+ export interface GroupedCategory {
176
+ categoryName: any;
177
+ products: ProductType[];
178
+ }
179
+ export interface sModifier {
180
+ listName: string;
181
+ options: {
182
+ addonId: string;
183
+ optionName: string;
184
+ price: number;
185
+ quantity: number;
186
+ }[];
187
+ total: number;
188
+ }
189
+ export interface CartItem {
190
+ _id?: string;
191
+ productId: string;
192
+ categoriesIds: string[];
193
+ selectedVariant: {
194
+ variantId: string;
195
+ sku: string;
196
+ attributes: Record<string, any>;
197
+ price: number;
198
+ };
199
+ quantity: number;
200
+ name?: {
201
+ en?: string;
202
+ ar?: string;
203
+ };
204
+ selectedModifiers?: {
205
+ lists?: sModifier[];
206
+ overallTotal?: number;
207
+ };
208
+ customerData?: CustomerDataValue[];
209
+ customerDataTotal?: number;
210
+ finalPrice?: number;
211
+ files?: FileType[];
212
+ customData?: Record<string, any>;
213
+ }
214
+ export interface Cart {
215
+ _id?: string;
216
+ items: CartItem[];
217
+ subtotal: number;
218
+ totalQuantity: number;
219
+ discount: number;
220
+ delivery: number;
221
+ total: number;
222
+ }
223
+ export interface CartState {
224
+ items: CartItem[];
225
+ subtotal: number;
226
+ totalQuantity: number;
227
+ discount: number;
228
+ delivery: number;
229
+ total: number;
230
+ promoCode?: Discount;
231
+ }
232
+ export interface CartModelType extends Cart {
233
+ customer: Customer | any;
234
+ vendorId: String | any;
235
+ _id?: string;
236
+ items: CartItem[];
237
+ subtotal: number;
238
+ totalQuantity: number;
239
+ discount: number;
240
+ delivery: number;
241
+ total: number;
242
+ }
243
+ export interface ProductReview {
244
+ _id: string;
245
+ productId: string;
246
+ variantId?: string;
247
+ customerId: string;
248
+ customerName: {
249
+ en: string;
250
+ ar: string;
251
+ };
252
+ rating: number;
253
+ title?: {
254
+ en?: string;
255
+ ar?: string;
256
+ };
257
+ content: {
258
+ en: string;
259
+ ar: string;
260
+ };
261
+ isVerifiedPurchase: boolean;
262
+ helpfulCount: number;
263
+ images?: FileType[];
264
+ status: 'pending' | 'approved' | 'rejected' | 'flagged';
265
+ moderationNotes?: string;
266
+ createdAt: Date;
267
+ updatedAt: Date;
268
+ vendorId: string | any;
269
+ }
270
+ export interface ReviewSummary {
271
+ totalReviews: number;
272
+ averageRating: number;
273
+ ratingDistribution: {
274
+ 1: number;
275
+ 2: number;
276
+ 3: number;
277
+ 4: number;
278
+ 5: number;
279
+ };
280
+ verifiedPurchaseCount: number;
281
+ lastUpdated: Date;
282
+ }
283
+ export interface CustomerDataFieldTemplate {
284
+ id: string;
285
+ name: {
286
+ en: string;
287
+ ar: string;
288
+ };
289
+ description: {
290
+ en: string;
291
+ ar: string;
292
+ };
293
+ field: Omit<CustomerDataField, 'fieldId' | 'sortOrder' | 'isActive'>;
294
+ }
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ // types/product.ts
3
+ // Product, Category, and related types with uniform variant approach + Customer Data Fields + Variant Selection Support
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 './prods';
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.41",
4
4
  "description": "Shared TypeScript types for Shopoflex applications",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",