@final-commerce/command-frame 0.1.15 → 0.1.16
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/CommonTypes.d.ts
CHANGED
|
@@ -55,9 +55,9 @@ export interface CFTax {
|
|
|
55
55
|
taxTableId: string;
|
|
56
56
|
}
|
|
57
57
|
export interface CFInventory {
|
|
58
|
-
warehouse: string;
|
|
59
58
|
outletId: string;
|
|
60
59
|
stock?: number | null;
|
|
60
|
+
_id?: string;
|
|
61
61
|
}
|
|
62
62
|
export interface CFCustomerNote {
|
|
63
63
|
createdAt: string;
|
|
@@ -87,7 +87,7 @@ export interface CFProductVariant {
|
|
|
87
87
|
barcode?: string;
|
|
88
88
|
costPrice?: string;
|
|
89
89
|
manageStock: boolean;
|
|
90
|
-
externalId
|
|
90
|
+
externalId?: string;
|
|
91
91
|
inventory?: CFInventory[];
|
|
92
92
|
allowBackorder?: boolean;
|
|
93
93
|
images?: string[];
|
|
@@ -104,16 +104,13 @@ export interface CFProductVariant {
|
|
|
104
104
|
export interface CFProduct {
|
|
105
105
|
_id: string;
|
|
106
106
|
companyId?: string;
|
|
107
|
-
externalId
|
|
107
|
+
externalId?: string;
|
|
108
108
|
taxTable: string;
|
|
109
109
|
name: string;
|
|
110
110
|
description?: string;
|
|
111
111
|
shortDescription?: string;
|
|
112
112
|
images?: string[];
|
|
113
|
-
categories:
|
|
114
|
-
name: string;
|
|
115
|
-
externalId: string;
|
|
116
|
-
};
|
|
113
|
+
categories: string[];
|
|
117
114
|
attributes: {
|
|
118
115
|
name: string;
|
|
119
116
|
values: string[];
|
|
@@ -13,15 +13,15 @@ export const mockGetProducts = async (params) => {
|
|
|
13
13
|
// Handle categories filter: { $in: [...] } or direct string
|
|
14
14
|
const catFilter = query.categories;
|
|
15
15
|
if (typeof catFilter === 'string') {
|
|
16
|
-
products = products.filter(p => p.categories
|
|
16
|
+
products = products.filter(p => (p.categories || []).includes(catFilter));
|
|
17
17
|
}
|
|
18
18
|
else if (typeof catFilter === 'object' && '$in' in catFilter) {
|
|
19
19
|
const inList = catFilter.$in;
|
|
20
|
-
products = products.filter(p =>
|
|
20
|
+
products = products.filter(p => (p.categories || []).some(c => inList.includes(c)));
|
|
21
21
|
}
|
|
22
22
|
else if (typeof catFilter === 'object' && '$contains' in catFilter) {
|
|
23
23
|
const containsVal = catFilter.$contains;
|
|
24
|
-
products = products.filter(p => p.categories
|
|
24
|
+
products = products.filter(p => (p.categories || []).includes(containsVal));
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
27
|
return {
|
package/dist/demo/database.d.ts
CHANGED
|
@@ -17,6 +17,8 @@ export declare const MOCK_CUSTOMER_5: CFCustomer;
|
|
|
17
17
|
export declare const MOCK_CATEGORY_PASTES: CFCategory;
|
|
18
18
|
export declare const MOCK_CATEGORY_SPECIALTY: CFCategory;
|
|
19
19
|
export declare const MOCK_CATEGORY_BASIC: CFCategory;
|
|
20
|
+
export declare const MOCK_CATEGORY_VEGAN: CFCategory;
|
|
21
|
+
export declare const MOCK_CATEGORY_SPICY: CFCategory;
|
|
20
22
|
export declare const MOCK_PRODUCT_BASIL_ALMOND: CFProduct;
|
|
21
23
|
export declare const MOCK_PRODUCT_BEER: CFProduct;
|
|
22
24
|
export declare const MOCK_PRODUCT_BEET: CFProduct;
|
|
@@ -27,6 +29,10 @@ export declare const MOCK_PRODUCT_GINGER_LIME: CFProduct;
|
|
|
27
29
|
export declare const MOCK_PRODUCT_LEMON: CFProduct;
|
|
28
30
|
export declare const MOCK_PRODUCT_RED_PEPPER: CFProduct;
|
|
29
31
|
export declare const MOCK_PRODUCT_ROASTED_TOMATO: CFProduct;
|
|
32
|
+
export declare const MOCK_PRODUCT_MINT_LEMON: CFProduct;
|
|
33
|
+
export declare const MOCK_PRODUCT_CHILI_GARLIC: CFProduct;
|
|
34
|
+
export declare const MOCK_PRODUCT_HABANERO: CFProduct;
|
|
35
|
+
export declare const MOCK_PRODUCT_BLACK_GARLIC: CFProduct;
|
|
30
36
|
export declare const MOCK_ORDER_1: CFActiveOrder;
|
|
31
37
|
export declare const MOCK_ORDER_2: CFActiveOrder;
|
|
32
38
|
export declare const MOCK_USERS: CFActiveUser[];
|
package/dist/demo/database.js
CHANGED
|
@@ -169,10 +169,24 @@ export const MOCK_CATEGORY_BASIC = {
|
|
|
169
169
|
companyId: COMPANY_ID,
|
|
170
170
|
parentId: "cat_pastes"
|
|
171
171
|
};
|
|
172
|
+
export const MOCK_CATEGORY_VEGAN = {
|
|
173
|
+
_id: "cat_vegan",
|
|
174
|
+
name: "Vegan",
|
|
175
|
+
externalId: "ext_cat_vegan",
|
|
176
|
+
companyId: COMPANY_ID,
|
|
177
|
+
parentId: null
|
|
178
|
+
};
|
|
179
|
+
export const MOCK_CATEGORY_SPICY = {
|
|
180
|
+
_id: "cat_spicy",
|
|
181
|
+
name: "Spicy",
|
|
182
|
+
externalId: "ext_cat_spicy",
|
|
183
|
+
companyId: COMPANY_ID,
|
|
184
|
+
parentId: null
|
|
185
|
+
};
|
|
172
186
|
// --- PRODUCTS ---
|
|
173
|
-
const createInventory = (stock) => [{
|
|
187
|
+
const createInventory = (stock) => [{ outletId: MOCK_OUTLET_MAIN.id, stock }];
|
|
174
188
|
// Helper for Simple Product
|
|
175
|
-
const createSimpleProduct = (id, name, price, image,
|
|
189
|
+
const createSimpleProduct = (id, name, price, image, categories, description) => {
|
|
176
190
|
const sku = `SKU-${id.toUpperCase()}`;
|
|
177
191
|
return {
|
|
178
192
|
_id: id,
|
|
@@ -187,7 +201,8 @@ const createSimpleProduct = (id, name, price, image, category, description) => {
|
|
|
187
201
|
taxTable: "tax_standard",
|
|
188
202
|
description,
|
|
189
203
|
images: [image],
|
|
190
|
-
categories
|
|
204
|
+
// Render stores product categories as an array of category IDs
|
|
205
|
+
categories: categories.map(c => c._id),
|
|
191
206
|
attributes: [],
|
|
192
207
|
variants: [
|
|
193
208
|
{
|
|
@@ -205,7 +220,7 @@ const createSimpleProduct = (id, name, price, image, category, description) => {
|
|
|
205
220
|
};
|
|
206
221
|
};
|
|
207
222
|
// Helper for Variable Product (Size: Small, Large)
|
|
208
|
-
const createVariableProduct = (id, name, basePrice, largePrice, image,
|
|
223
|
+
const createVariableProduct = (id, name, basePrice, largePrice, image, categories, description) => {
|
|
209
224
|
const skuBase = `SKU-${id.toUpperCase()}`;
|
|
210
225
|
return {
|
|
211
226
|
_id: id,
|
|
@@ -220,7 +235,8 @@ const createVariableProduct = (id, name, basePrice, largePrice, image, category,
|
|
|
220
235
|
taxTable: "tax_standard",
|
|
221
236
|
description,
|
|
222
237
|
images: [image],
|
|
223
|
-
categories
|
|
238
|
+
// Render stores product categories as an array of category IDs
|
|
239
|
+
categories: categories.map(c => c._id),
|
|
224
240
|
attributes: [{ name: "Size", values: ["Small", "Large"] }],
|
|
225
241
|
variants: [
|
|
226
242
|
{
|
|
@@ -248,16 +264,24 @@ const createVariableProduct = (id, name, basePrice, largePrice, image, category,
|
|
|
248
264
|
]
|
|
249
265
|
};
|
|
250
266
|
};
|
|
251
|
-
export const MOCK_PRODUCT_BASIL_ALMOND = createSimpleProduct("prod_basil_almond", "Basil Almond Paste", "12.00", basilAlmondImg, MOCK_CATEGORY_SPECIALTY, "A rich blend of fresh basil and roasted almonds.");
|
|
252
|
-
export const MOCK_PRODUCT_BEER = createVariableProduct("prod_beer", "Beer Paste", "15.00", "25.00", beerImg, MOCK_CATEGORY_SPECIALTY, "Unique paste infused with dark lager.");
|
|
253
|
-
export const MOCK_PRODUCT_BEET = createSimpleProduct("prod_beet", "Beet Paste", "10.00", beetImg, MOCK_CATEGORY_BASIC, "Earthy and sweet beet paste, perfect for salads.");
|
|
254
|
-
export const MOCK_PRODUCT_CARAMELIZED = createVariableProduct("prod_caramelized", "Caramelized Paste", "14.00", "22.00", caramelizedImg, MOCK_CATEGORY_SPECIALTY, "Slow-cooked caramelized onion paste.");
|
|
255
|
-
export const MOCK_PRODUCT_GARLIC_ONION = createVariableProduct("prod_garlic_onion", "Garlic Onion Paste", "11.00", "18.00", garlicOnionImg, MOCK_CATEGORY_BASIC, "Classic savory base for any dish.");
|
|
256
|
-
export const MOCK_PRODUCT_GARLIC = createSimpleProduct("prod_garlic", "Garlic Paste", "9.00", garlicImg, MOCK_CATEGORY_BASIC, "Pure, intense garlic paste.");
|
|
257
|
-
export const MOCK_PRODUCT_GINGER_LIME = createVariableProduct("prod_ginger_lime", "Ginger Lime Paste", "13.00", "20.00", gingerLimeImg, MOCK_CATEGORY_SPECIALTY, "Zesty and spicy, great for asian cuisine.");
|
|
258
|
-
export const MOCK_PRODUCT_LEMON = createSimpleProduct("prod_lemon", "Lemon Paste", "10.50", lemonImg, MOCK_CATEGORY_BASIC, "Bright citrus flavor concentrate.");
|
|
259
|
-
export const MOCK_PRODUCT_RED_PEPPER = createVariableProduct("prod_red_pepper", "Red Pepper Paste", "12.50", "19.00", redPepperImg, MOCK_CATEGORY_BASIC, "Roasted red peppers with a hint of spice.");
|
|
260
|
-
export const MOCK_PRODUCT_ROASTED_TOMATO = createVariableProduct("prod_roasted_tomato", "Roasted Tomato Paste", "11.50", "18.50", roastedTomatoImg, MOCK_CATEGORY_BASIC, "Deep, umami-rich tomato flavor.");
|
|
267
|
+
export const MOCK_PRODUCT_BASIL_ALMOND = createSimpleProduct("prod_basil_almond", "Basil Almond Paste", "12.00", basilAlmondImg, [MOCK_CATEGORY_PASTES, MOCK_CATEGORY_SPECIALTY, MOCK_CATEGORY_VEGAN], "A rich blend of fresh basil and roasted almonds.");
|
|
268
|
+
export const MOCK_PRODUCT_BEER = createVariableProduct("prod_beer", "Beer Paste", "15.00", "25.00", beerImg, [MOCK_CATEGORY_PASTES, MOCK_CATEGORY_SPECIALTY], "Unique paste infused with dark lager.");
|
|
269
|
+
export const MOCK_PRODUCT_BEET = createSimpleProduct("prod_beet", "Beet Paste", "10.00", beetImg, [MOCK_CATEGORY_PASTES, MOCK_CATEGORY_BASIC, MOCK_CATEGORY_VEGAN], "Earthy and sweet beet paste, perfect for salads.");
|
|
270
|
+
export const MOCK_PRODUCT_CARAMELIZED = createVariableProduct("prod_caramelized", "Caramelized Paste", "14.00", "22.00", caramelizedImg, [MOCK_CATEGORY_PASTES, MOCK_CATEGORY_SPECIALTY, MOCK_CATEGORY_VEGAN], "Slow-cooked caramelized onion paste.");
|
|
271
|
+
export const MOCK_PRODUCT_GARLIC_ONION = createVariableProduct("prod_garlic_onion", "Garlic Onion Paste", "11.00", "18.00", garlicOnionImg, [MOCK_CATEGORY_PASTES, MOCK_CATEGORY_BASIC, MOCK_CATEGORY_VEGAN], "Classic savory base for any dish.");
|
|
272
|
+
export const MOCK_PRODUCT_GARLIC = createSimpleProduct("prod_garlic", "Garlic Paste", "9.00", garlicImg, [MOCK_CATEGORY_PASTES, MOCK_CATEGORY_BASIC, MOCK_CATEGORY_VEGAN], "Pure, intense garlic paste.");
|
|
273
|
+
export const MOCK_PRODUCT_GINGER_LIME = createVariableProduct("prod_ginger_lime", "Ginger Lime Paste", "13.00", "20.00", gingerLimeImg, [MOCK_CATEGORY_PASTES, MOCK_CATEGORY_SPECIALTY, MOCK_CATEGORY_SPICY, MOCK_CATEGORY_VEGAN], "Zesty and spicy, great for asian cuisine.");
|
|
274
|
+
export const MOCK_PRODUCT_LEMON = createSimpleProduct("prod_lemon", "Lemon Paste", "10.50", lemonImg, [MOCK_CATEGORY_PASTES, MOCK_CATEGORY_BASIC, MOCK_CATEGORY_VEGAN], "Bright citrus flavor concentrate.");
|
|
275
|
+
export const MOCK_PRODUCT_RED_PEPPER = createVariableProduct("prod_red_pepper", "Red Pepper Paste", "12.50", "19.00", redPepperImg, [MOCK_CATEGORY_PASTES, MOCK_CATEGORY_BASIC, MOCK_CATEGORY_SPICY, MOCK_CATEGORY_VEGAN], "Roasted red peppers with a hint of spice.");
|
|
276
|
+
export const MOCK_PRODUCT_ROASTED_TOMATO = createVariableProduct("prod_roasted_tomato", "Roasted Tomato Paste", "11.50", "18.50", roastedTomatoImg, [MOCK_CATEGORY_PASTES, MOCK_CATEGORY_BASIC, MOCK_CATEGORY_VEGAN], "Deep, umami-rich tomato flavor.");
|
|
277
|
+
export const MOCK_PRODUCT_MINT_LEMON = createSimpleProduct("prod_mint_lemon", "Mint Lemon Paste", "12.00", lemonImg, // Reusing lemon image for now
|
|
278
|
+
[MOCK_CATEGORY_PASTES, MOCK_CATEGORY_SPECIALTY, MOCK_CATEGORY_VEGAN], "Refreshing mint and lemon blend.");
|
|
279
|
+
export const MOCK_PRODUCT_CHILI_GARLIC = createVariableProduct("prod_chili_garlic", "Chili Garlic Paste", "10.50", "16.50", redPepperImg, // Reusing red pepper image
|
|
280
|
+
[MOCK_CATEGORY_PASTES, MOCK_CATEGORY_BASIC, MOCK_CATEGORY_SPICY, MOCK_CATEGORY_VEGAN], "Spicy garlic paste with chili flakes.");
|
|
281
|
+
export const MOCK_PRODUCT_HABANERO = createSimpleProduct("prod_habanero", "Habanero Paste", "14.00", redPepperImg, // Reusing red pepper image
|
|
282
|
+
[MOCK_CATEGORY_PASTES, MOCK_CATEGORY_SPICY, MOCK_CATEGORY_VEGAN], "Extremely spicy habanero concentrate.");
|
|
283
|
+
export const MOCK_PRODUCT_BLACK_GARLIC = createSimpleProduct("prod_black_garlic", "Black Garlic Paste", "18.00", garlicImg, // Reusing garlic image
|
|
284
|
+
[MOCK_CATEGORY_PASTES, MOCK_CATEGORY_SPECIALTY, MOCK_CATEGORY_VEGAN], "Fermented black garlic paste, sweet and savory.");
|
|
261
285
|
// --- ORDERS ---
|
|
262
286
|
// Helper to create line item
|
|
263
287
|
const createLineItem = (product, variantIndex = 0, quantity = 1) => {
|
|
@@ -389,7 +413,13 @@ export const MOCK_CUSTOMERS = [
|
|
|
389
413
|
MOCK_CUSTOMER_4,
|
|
390
414
|
MOCK_CUSTOMER_5
|
|
391
415
|
];
|
|
392
|
-
export const MOCK_CATEGORIES = [
|
|
416
|
+
export const MOCK_CATEGORIES = [
|
|
417
|
+
MOCK_CATEGORY_PASTES,
|
|
418
|
+
MOCK_CATEGORY_SPECIALTY,
|
|
419
|
+
MOCK_CATEGORY_BASIC,
|
|
420
|
+
MOCK_CATEGORY_VEGAN,
|
|
421
|
+
MOCK_CATEGORY_SPICY
|
|
422
|
+
];
|
|
393
423
|
export const MOCK_PRODUCTS = [
|
|
394
424
|
MOCK_PRODUCT_BASIL_ALMOND,
|
|
395
425
|
MOCK_PRODUCT_BEER,
|
|
@@ -400,7 +430,11 @@ export const MOCK_PRODUCTS = [
|
|
|
400
430
|
MOCK_PRODUCT_GINGER_LIME,
|
|
401
431
|
MOCK_PRODUCT_LEMON,
|
|
402
432
|
MOCK_PRODUCT_RED_PEPPER,
|
|
403
|
-
MOCK_PRODUCT_ROASTED_TOMATO
|
|
433
|
+
MOCK_PRODUCT_ROASTED_TOMATO,
|
|
434
|
+
MOCK_PRODUCT_MINT_LEMON,
|
|
435
|
+
MOCK_PRODUCT_CHILI_GARLIC,
|
|
436
|
+
MOCK_PRODUCT_HABANERO,
|
|
437
|
+
MOCK_PRODUCT_BLACK_GARLIC
|
|
404
438
|
];
|
|
405
439
|
export const MOCK_ORDERS = [MOCK_ORDER_1, MOCK_ORDER_2];
|
|
406
440
|
export const MOCK_PARKED_ORDERS = [];
|