shopoflex-types 1.0.87 → 1.0.89
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/common.d.ts +1 -166
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/productCart.d.ts +143 -0
- package/dist/productCart.js +2 -0
- package/package.json +1 -1
package/dist/common.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import mongoose from 'mongoose';
|
|
2
|
+
import { Cart, Category, GroupedCategory, ProductType } from 'shopoflex-types';
|
|
2
3
|
export interface Discount {
|
|
3
4
|
_id?: mongoose.Types.ObjectId;
|
|
4
5
|
code?: string;
|
|
@@ -177,168 +178,6 @@ export interface Specification {
|
|
|
177
178
|
active: boolean;
|
|
178
179
|
values: any[];
|
|
179
180
|
}
|
|
180
|
-
export interface Modifier {
|
|
181
|
-
name?: {
|
|
182
|
-
en?: string;
|
|
183
|
-
ar?: string;
|
|
184
|
-
};
|
|
185
|
-
type?: "checkbox" | "radio" | "select";
|
|
186
|
-
required?: boolean;
|
|
187
|
-
maxSelect?: number;
|
|
188
|
-
minSelect?: number;
|
|
189
|
-
active?: boolean;
|
|
190
|
-
addons?: {
|
|
191
|
-
productId?: any;
|
|
192
|
-
variantId?: any;
|
|
193
|
-
enableQuantity?: boolean;
|
|
194
|
-
priceOverride?: number;
|
|
195
|
-
}[];
|
|
196
|
-
}
|
|
197
|
-
export interface Category {
|
|
198
|
-
_id: string;
|
|
199
|
-
name: {
|
|
200
|
-
en: string;
|
|
201
|
-
ar: string;
|
|
202
|
-
};
|
|
203
|
-
description: {
|
|
204
|
-
en: string;
|
|
205
|
-
ar: string;
|
|
206
|
-
};
|
|
207
|
-
parentCategoryId?: string | null;
|
|
208
|
-
createdAt: Date;
|
|
209
|
-
files?: FileType[];
|
|
210
|
-
sortOrder?: number;
|
|
211
|
-
isActive: boolean;
|
|
212
|
-
vendorId: string | any;
|
|
213
|
-
}
|
|
214
|
-
export interface CompositionType {
|
|
215
|
-
componentId: string;
|
|
216
|
-
variantId: string;
|
|
217
|
-
quantity: number;
|
|
218
|
-
priceOverride?: number;
|
|
219
|
-
}
|
|
220
|
-
export interface ProductType {
|
|
221
|
-
_id?: string;
|
|
222
|
-
name: {
|
|
223
|
-
en: string;
|
|
224
|
-
ar: string;
|
|
225
|
-
};
|
|
226
|
-
description?: {
|
|
227
|
-
en: string;
|
|
228
|
-
ar: string;
|
|
229
|
-
};
|
|
230
|
-
sku?: string;
|
|
231
|
-
categoriesIds: string[];
|
|
232
|
-
dimensions?: Dimensions;
|
|
233
|
-
label?: Label;
|
|
234
|
-
tags?: string[];
|
|
235
|
-
branchesIds?: string[];
|
|
236
|
-
modifiers?: Modifier[];
|
|
237
|
-
hasModifiers?: boolean;
|
|
238
|
-
composition?: CompositionType[];
|
|
239
|
-
isComposite?: boolean;
|
|
240
|
-
isSellable?: boolean;
|
|
241
|
-
sort?: number;
|
|
242
|
-
hasVariants?: boolean;
|
|
243
|
-
variants: VariantType[];
|
|
244
|
-
specifications?: {
|
|
245
|
-
active: boolean;
|
|
246
|
-
values: any[];
|
|
247
|
-
};
|
|
248
|
-
availableFor?: [];
|
|
249
|
-
linkedProduct?: any;
|
|
250
|
-
createdAt?: Date;
|
|
251
|
-
updatedAt?: Date;
|
|
252
|
-
isActive: boolean;
|
|
253
|
-
vendorId: any;
|
|
254
|
-
}
|
|
255
|
-
export interface VariantType {
|
|
256
|
-
variantId: string;
|
|
257
|
-
sku?: string;
|
|
258
|
-
priceModel: PriceModel;
|
|
259
|
-
stockHandle: StockHandle;
|
|
260
|
-
attributes?: VariantAttribute[];
|
|
261
|
-
files?: FileType[];
|
|
262
|
-
barcode?: string;
|
|
263
|
-
isActive?: boolean;
|
|
264
|
-
sortOrder?: number;
|
|
265
|
-
}
|
|
266
|
-
export interface VariantAttribute {
|
|
267
|
-
type: string;
|
|
268
|
-
value: string;
|
|
269
|
-
displayValue: {
|
|
270
|
-
en: string;
|
|
271
|
-
ar: string;
|
|
272
|
-
};
|
|
273
|
-
displayType: 'color' | 'text' | string;
|
|
274
|
-
hexColor?: string;
|
|
275
|
-
imageUrl?: string;
|
|
276
|
-
}
|
|
277
|
-
export interface GroupedCategory {
|
|
278
|
-
categoryName: any;
|
|
279
|
-
products: ProductType[];
|
|
280
|
-
}
|
|
281
|
-
export interface sModifier {
|
|
282
|
-
listName: string;
|
|
283
|
-
options: {
|
|
284
|
-
addonId: string;
|
|
285
|
-
optionName: string;
|
|
286
|
-
price: number;
|
|
287
|
-
quantity: number;
|
|
288
|
-
}[];
|
|
289
|
-
total: number;
|
|
290
|
-
}
|
|
291
|
-
export interface CartItem {
|
|
292
|
-
_id?: string;
|
|
293
|
-
categoriesIds: string[];
|
|
294
|
-
price: number;
|
|
295
|
-
quantity: number;
|
|
296
|
-
unit: UnitTypeValue;
|
|
297
|
-
name?: {
|
|
298
|
-
en?: string;
|
|
299
|
-
ar?: string;
|
|
300
|
-
};
|
|
301
|
-
selectedModifiers?: {
|
|
302
|
-
lists?: sModifier[];
|
|
303
|
-
overallTotal?: number;
|
|
304
|
-
};
|
|
305
|
-
selectedVariant: VariantType | null;
|
|
306
|
-
finalPrice?: number;
|
|
307
|
-
files?: FileType[];
|
|
308
|
-
total?: number;
|
|
309
|
-
}
|
|
310
|
-
export interface Cart {
|
|
311
|
-
_id?: string;
|
|
312
|
-
items: CartItem[];
|
|
313
|
-
subtotal: number;
|
|
314
|
-
totalQuantity: number;
|
|
315
|
-
discount: number;
|
|
316
|
-
delivery: number;
|
|
317
|
-
total: number;
|
|
318
|
-
totalsByUnit?: Record<UnitTypeValue, number>;
|
|
319
|
-
}
|
|
320
|
-
export interface CartState {
|
|
321
|
-
items: CartItem[];
|
|
322
|
-
subtotal: number;
|
|
323
|
-
totalQuantity: number;
|
|
324
|
-
discount: number;
|
|
325
|
-
delivery: number;
|
|
326
|
-
total: number;
|
|
327
|
-
promoCode?: Discount;
|
|
328
|
-
totalsByUnit?: Record<UnitTypeValue, number>;
|
|
329
|
-
}
|
|
330
|
-
export interface CartModelType extends Cart {
|
|
331
|
-
customer: Customer | any;
|
|
332
|
-
vendorId: String | any;
|
|
333
|
-
_id?: string;
|
|
334
|
-
items: CartItem[];
|
|
335
|
-
subtotal: number;
|
|
336
|
-
totalQuantity: number;
|
|
337
|
-
discount: number;
|
|
338
|
-
delivery: number;
|
|
339
|
-
total: number;
|
|
340
|
-
totalsByUnit?: Record<UnitTypeValue, number>;
|
|
341
|
-
}
|
|
342
181
|
export interface UnitAnalytics {
|
|
343
182
|
unit: UnitTypeValue;
|
|
344
183
|
totalQuantity: number;
|
|
@@ -422,10 +261,6 @@ export type IRole = {
|
|
|
422
261
|
};
|
|
423
262
|
permissions?: string[];
|
|
424
263
|
};
|
|
425
|
-
export interface IBranchName {
|
|
426
|
-
en: string;
|
|
427
|
-
ar?: string;
|
|
428
|
-
}
|
|
429
264
|
type PaymentConfig<T extends PaymentMethodType> = {
|
|
430
265
|
active: boolean;
|
|
431
266
|
status: string;
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -15,5 +15,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./common"), exports);
|
|
18
|
+
__exportStar(require("./productCart"), exports);
|
|
18
19
|
__exportStar(require("./filters"), exports);
|
|
19
20
|
__exportStar(require("./accounting"), exports);
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import { Customer, Dimensions, Discount, FileType, Label, PriceModel, StockHandle } from "shopoflex-types";
|
|
2
|
+
import { UnitTypeValue } from "./common";
|
|
3
|
+
type LanguageCode = 'en' | 'ar' | 'fr' | 'es' | 'de';
|
|
4
|
+
export type NameType = {
|
|
5
|
+
[K in LanguageCode]?: string;
|
|
6
|
+
} & {
|
|
7
|
+
[key: string]: string;
|
|
8
|
+
};
|
|
9
|
+
export interface ProductType {
|
|
10
|
+
_id?: string;
|
|
11
|
+
name: NameType;
|
|
12
|
+
description?: NameType;
|
|
13
|
+
sku?: string;
|
|
14
|
+
categoriesIds: string[];
|
|
15
|
+
dimensions?: Dimensions;
|
|
16
|
+
label?: Label;
|
|
17
|
+
tags?: string[];
|
|
18
|
+
branchesIds?: string[];
|
|
19
|
+
modifiers?: Modifier[];
|
|
20
|
+
hasModifiers?: boolean;
|
|
21
|
+
composition?: CompositionType[];
|
|
22
|
+
isComposite?: boolean;
|
|
23
|
+
isSellable?: boolean;
|
|
24
|
+
sort?: number;
|
|
25
|
+
hasVariants?: boolean;
|
|
26
|
+
variants: VariantType[];
|
|
27
|
+
specifications?: {
|
|
28
|
+
active: boolean;
|
|
29
|
+
values: any[];
|
|
30
|
+
};
|
|
31
|
+
availableFor?: [];
|
|
32
|
+
linkedProduct?: any;
|
|
33
|
+
createdAt?: Date;
|
|
34
|
+
updatedAt?: Date;
|
|
35
|
+
isActive: boolean;
|
|
36
|
+
vendorId: any;
|
|
37
|
+
}
|
|
38
|
+
export interface CartItem {
|
|
39
|
+
_id?: string;
|
|
40
|
+
categoriesIds: string[];
|
|
41
|
+
price: number;
|
|
42
|
+
quantity: number;
|
|
43
|
+
unit: UnitTypeValue;
|
|
44
|
+
name?: NameType;
|
|
45
|
+
selectedModifiers?: sModifier[];
|
|
46
|
+
selectedVariant: VariantType | null;
|
|
47
|
+
files?: FileType[];
|
|
48
|
+
}
|
|
49
|
+
export interface Modifier {
|
|
50
|
+
name?: NameType;
|
|
51
|
+
type?: "checkbox" | "radio" | "select";
|
|
52
|
+
required?: boolean;
|
|
53
|
+
maxSelect?: number;
|
|
54
|
+
minSelect?: number;
|
|
55
|
+
active?: boolean;
|
|
56
|
+
addons?: {
|
|
57
|
+
productId?: ProductType | any;
|
|
58
|
+
variantId?: string;
|
|
59
|
+
enableQuantity?: boolean;
|
|
60
|
+
priceOverride?: number;
|
|
61
|
+
}[];
|
|
62
|
+
}
|
|
63
|
+
export interface sModifier {
|
|
64
|
+
name: NameType;
|
|
65
|
+
options: {
|
|
66
|
+
productId: ProductType | any;
|
|
67
|
+
priceOverride: number;
|
|
68
|
+
quantity: number;
|
|
69
|
+
}[];
|
|
70
|
+
}
|
|
71
|
+
export interface Cart {
|
|
72
|
+
_id?: string;
|
|
73
|
+
items: CartItem[];
|
|
74
|
+
subtotal: number;
|
|
75
|
+
totalQuantity: number;
|
|
76
|
+
discount: number;
|
|
77
|
+
delivery: number;
|
|
78
|
+
total: number;
|
|
79
|
+
totalsByUnit?: Record<UnitTypeValue, number>;
|
|
80
|
+
}
|
|
81
|
+
export interface CartModelType extends Cart {
|
|
82
|
+
customer: Customer | any;
|
|
83
|
+
vendorId: String | any;
|
|
84
|
+
_id?: string;
|
|
85
|
+
items: CartItem[];
|
|
86
|
+
subtotal: number;
|
|
87
|
+
totalQuantity: number;
|
|
88
|
+
discount: number;
|
|
89
|
+
delivery: number;
|
|
90
|
+
total: number;
|
|
91
|
+
totalsByUnit?: Record<UnitTypeValue, number>;
|
|
92
|
+
}
|
|
93
|
+
export interface CartState {
|
|
94
|
+
items: CartItem[];
|
|
95
|
+
subtotal: number;
|
|
96
|
+
totalQuantity: number;
|
|
97
|
+
discount: number;
|
|
98
|
+
delivery: number;
|
|
99
|
+
total: number;
|
|
100
|
+
promoCode?: Discount;
|
|
101
|
+
totalsByUnit?: Record<UnitTypeValue, number>;
|
|
102
|
+
}
|
|
103
|
+
export interface Category {
|
|
104
|
+
_id: string;
|
|
105
|
+
name: NameType;
|
|
106
|
+
description: NameType;
|
|
107
|
+
parentCategoryId?: string | null;
|
|
108
|
+
createdAt: Date;
|
|
109
|
+
files?: FileType[];
|
|
110
|
+
sortOrder?: number;
|
|
111
|
+
isActive: boolean;
|
|
112
|
+
vendorId: string | any;
|
|
113
|
+
}
|
|
114
|
+
export interface CompositionType {
|
|
115
|
+
componentId: string;
|
|
116
|
+
variantId: string;
|
|
117
|
+
quantity: number;
|
|
118
|
+
priceOverride?: number;
|
|
119
|
+
}
|
|
120
|
+
export interface VariantType {
|
|
121
|
+
variantId: string;
|
|
122
|
+
sku?: string;
|
|
123
|
+
priceModel: PriceModel;
|
|
124
|
+
stockHandle: StockHandle;
|
|
125
|
+
attributes?: VariantAttribute[];
|
|
126
|
+
files?: FileType[];
|
|
127
|
+
barcode?: string;
|
|
128
|
+
isActive?: boolean;
|
|
129
|
+
sortOrder?: number;
|
|
130
|
+
}
|
|
131
|
+
export interface VariantAttribute {
|
|
132
|
+
type: string;
|
|
133
|
+
value: string;
|
|
134
|
+
displayValue: NameType;
|
|
135
|
+
displayType: 'color' | 'text' | string;
|
|
136
|
+
hexColor?: string;
|
|
137
|
+
imageUrl?: string;
|
|
138
|
+
}
|
|
139
|
+
export interface GroupedCategory {
|
|
140
|
+
categoryName: NameType;
|
|
141
|
+
products: ProductType[];
|
|
142
|
+
}
|
|
143
|
+
export {};
|