shopoflex-types 1.0.40 → 1.0.42

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,6 +1,5 @@
1
1
  export * from './types/enums';
2
- export * from './types/product';
3
- export * from './types/cart';
2
+ export * from './types/prods';
4
3
  export * from './types/discount';
5
4
  export * from './types/order';
6
5
  export * from './types/user';
package/dist/index.js CHANGED
@@ -19,8 +19,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
19
19
  // Common types
20
20
  __exportStar(require("./types/enums"), exports);
21
21
  // Domain-specific types
22
- __exportStar(require("./types/product"), exports);
23
- __exportStar(require("./types/cart"), exports);
22
+ __exportStar(require("./types/prods"), exports);
24
23
  __exportStar(require("./types/discount"), exports);
25
24
  __exportStar(require("./types/order"), exports);
26
25
  __exportStar(require("./types/user"), exports);
@@ -1,5 +1,5 @@
1
1
  import mongoose from 'mongoose';
2
- import { Cart } from './cart';
2
+ import { Cart } from './prods';
3
3
  import { Customer } from './user';
4
4
  import { Address } from './common';
5
5
  import { OrderStatus } from './enums';
@@ -1,4 +1,3 @@
1
1
  "use strict";
2
2
  // types/order.ts
3
- // Order and payment types
4
3
  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 });
@@ -1,5 +1,5 @@
1
1
  import { IBranch } from './vendor';
2
- import { GroupedCategory, ProductType, Category } from './product';
2
+ import { GroupedCategory, ProductType, Category } from './prods';
3
3
  import { Address } from './common';
4
4
  export interface SelectionsState {
5
5
  address?: Address;
package/package.json CHANGED
@@ -1,32 +1,32 @@
1
- {
2
- "name": "shopoflex-types",
3
- "version": "1.0.40",
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
- "deploy": "npm version patch && npm run build && npm publish",
15
- "deploy:minor": "npm version minor && npm run build && npm publish",
16
- "deploy:major": "npm version major && npm run build && npm publish"
17
- },
18
- "publishConfig": {
19
- "access": "public"
20
- },
21
- "keywords": [
22
- "typescript",
23
- "types",
24
- "shopoflex"
25
- ],
26
- "devDependencies": {
27
- "typescript": "^5.8.3"
28
- },
29
- "dependencies": {
30
- "mongoose": "^8.15.1"
31
- }
32
- }
1
+ {
2
+ "name": "shopoflex-types",
3
+ "version": "1.0.42",
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
+ "deploy": "npm version patch && npm run build && npm publish",
15
+ "deploy:minor": "npm version minor && npm run build && npm publish",
16
+ "deploy:major": "npm version major && npm run build && npm publish"
17
+ },
18
+ "publishConfig": {
19
+ "access": "public"
20
+ },
21
+ "keywords": [
22
+ "typescript",
23
+ "types",
24
+ "shopoflex"
25
+ ],
26
+ "devDependencies": {
27
+ "typescript": "^5.8.3"
28
+ },
29
+ "dependencies": {
30
+ "mongoose": "^8.15.1"
31
+ }
32
+ }