@final-commerce/command-frame 0.2.0-beta.6 → 0.3.0-beta.5
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/README.md +24 -0
- package/dist/CommonTypes.d.ts +73 -622
- package/dist/CommonTypes.js +5 -65
- package/dist/actions/add-cart-discount/mock.js +6 -3
- package/dist/actions/add-cart-fee/mock.js +6 -6
- package/dist/actions/add-custom-sale/mock.js +7 -2
- package/dist/actions/add-order-note/mock.js +3 -1
- package/dist/actions/add-product/mock.js +1 -1
- package/dist/actions/add-product-discount/mock.js +5 -5
- package/dist/actions/add-product-fee/mock.js +6 -6
- package/dist/actions/apply-transition/action.d.ts +2 -0
- package/dist/actions/apply-transition/action.js +4 -0
- package/dist/actions/apply-transition/mock.d.ts +6 -0
- package/dist/actions/apply-transition/mock.js +33 -0
- package/dist/actions/apply-transition/types.d.ts +17 -0
- package/dist/actions/cash-payment/mock.js +12 -18
- package/dist/actions/delete-parked-order/mock.js +3 -1
- package/dist/actions/edit-product/mock.js +1 -1
- package/dist/actions/extension-payment/types.d.ts +4 -0
- package/dist/actions/get-context/mock.js +1 -1
- package/dist/actions/get-orders/mock.js +3 -3
- package/dist/actions/get-products/mock.js +9 -4
- package/dist/actions/get-products/types.d.ts +2 -0
- package/dist/actions/get-roles/mock.js +35 -41
- package/dist/actions/get-smart-grid-layout/action.d.ts +2 -0
- package/dist/actions/get-smart-grid-layout/action.js +4 -0
- package/dist/actions/get-smart-grid-layout/mock.d.ts +2 -0
- package/dist/actions/get-smart-grid-layout/mock.js +9 -0
- package/dist/actions/get-smart-grid-layout/types.d.ts +10 -0
- package/dist/actions/get-users/mock.js +16 -25
- package/dist/actions/integration-payment/action.d.ts +5 -0
- package/dist/actions/integration-payment/action.js +7 -0
- package/dist/actions/integration-payment/mock.d.ts +2 -0
- package/dist/actions/integration-payment/mock.js +4 -0
- package/dist/actions/integration-payment/types.d.ts +56 -0
- package/dist/actions/open-extension-overlay/action.d.ts +2 -0
- package/dist/actions/open-extension-overlay/action.js +4 -0
- package/dist/actions/open-extension-overlay/mock.d.ts +2 -0
- package/dist/actions/open-extension-overlay/mock.js +1 -0
- package/dist/actions/open-extension-overlay/types.d.ts +9 -0
- package/dist/actions/park-order/mock.js +4 -1
- package/dist/actions/partial-payment/mock.js +21 -3
- package/dist/actions/redeem-payment/types.d.ts +9 -5
- package/dist/actions/remove-custom-sale/mock.d.ts +2 -0
- package/dist/actions/remove-custom-sale/mock.js +29 -0
- package/dist/actions/remove-customer-from-cart/mock.js +3 -1
- package/dist/actions/remove-order-note/mock.d.ts +2 -0
- package/dist/actions/remove-order-note/mock.js +12 -0
- package/dist/actions/remove-product-discount/mock.d.ts +2 -0
- package/dist/actions/remove-product-discount/mock.js +17 -0
- package/dist/actions/remove-product-fee/mock.d.ts +2 -0
- package/dist/actions/remove-product-fee/mock.js +17 -0
- package/dist/actions/remove-product-from-cart/mock.js +5 -5
- package/dist/actions/resolve-extension-overlay/action.d.ts +2 -0
- package/dist/actions/resolve-extension-overlay/action.js +4 -0
- package/dist/actions/resolve-extension-overlay/mock.d.ts +2 -0
- package/dist/actions/resolve-extension-overlay/mock.js +1 -0
- package/dist/actions/resolve-extension-overlay/types.d.ts +9 -0
- package/dist/actions/resolve-extension-overlay/types.js +1 -0
- package/dist/actions/resume-parked-order/mock.js +5 -2
- package/dist/actions/save-smart-grid-layout/action.d.ts +2 -0
- package/dist/actions/save-smart-grid-layout/action.js +4 -0
- package/dist/actions/save-smart-grid-layout/mock.d.ts +2 -0
- package/dist/actions/save-smart-grid-layout/mock.js +10 -0
- package/dist/actions/save-smart-grid-layout/types.d.ts +10 -0
- package/dist/actions/save-smart-grid-layout/types.js +1 -0
- package/dist/actions/set-active-product-discount/mock.js +1 -1
- package/dist/actions/set-active-product-fee/mock.js +1 -1
- package/dist/actions/tap-to-pay-payment/mock.js +5 -3
- package/dist/actions/terminal-payment/mock.js +4 -5
- package/dist/actions/update-cart-item-quantity/mock.js +9 -9
- package/dist/demo/database.d.ts +33 -22
- package/dist/demo/database.js +191 -21
- package/dist/index.d.ts +116 -115
- package/dist/index.js +15 -13
- package/dist/interceptors/index.d.ts +21 -0
- package/dist/interceptors/index.js +53 -0
- package/dist/interceptors/types.d.ts +26 -0
- package/dist/interceptors/types.js +1 -0
- package/dist/projects/render/mocks.js +19 -15
- package/dist/projects/render/types.d.ts +8 -6
- package/dist/pubsub/topics/products/product-get-active/types.d.ts +6 -2
- package/dist/pubsub/topics/split-payments/index.d.ts +12 -0
- package/dist/pubsub/topics/split-payments/index.js +22 -0
- package/dist/pubsub/topics/split-payments/split-payment-updated/types.d.ts +16 -0
- package/dist/pubsub/topics/split-payments/split-payment-updated/types.js +1 -0
- package/dist/pubsub/topics/split-payments/types.d.ts +10 -0
- package/dist/pubsub/topics/split-payments/types.js +5 -0
- package/dist/pubsub/topics/types.d.ts +2 -0
- package/package.json +17 -14
- package/dist/actions/extension-refund/constants.d.ts +0 -2
- package/dist/actions/extension-refund/constants.js +0 -2
- package/dist/actions/extension-refund/extension-refund-listener.d.ts +0 -11
- package/dist/actions/extension-refund/extension-refund-listener.js +0 -60
- package/dist/actions/extension-refund/types.d.ts +0 -32
- package/dist/actions/extension-refund/types.js +0 -5
- package/dist/actions/set-active-outlet/action.d.ts +0 -2
- package/dist/actions/set-active-outlet/action.js +0 -4
- package/dist/actions/set-active-outlet/mock.d.ts +0 -2
- package/dist/actions/set-active-outlet/mock.js +0 -16
- package/dist/actions/set-active-outlet/types.d.ts +0 -10
- package/dist/actions/set-active-session/action.d.ts +0 -2
- package/dist/actions/set-active-session/action.js +0 -4
- package/dist/actions/set-active-session/mock.d.ts +0 -2
- package/dist/actions/set-active-session/mock.js +0 -15
- package/dist/actions/set-active-session/types.d.ts +0 -10
- package/dist/actions/set-active-station/action.d.ts +0 -2
- package/dist/actions/set-active-station/action.js +0 -4
- package/dist/actions/set-active-station/mock.d.ts +0 -2
- package/dist/actions/set-active-station/mock.js +0 -16
- package/dist/actions/set-active-station/types.d.ts +0 -10
- package/dist/actions/trigger-webhook/action.d.ts +0 -6
- package/dist/actions/trigger-webhook/action.js +0 -8
- package/dist/actions/trigger-webhook/mock.d.ts +0 -2
- package/dist/actions/trigger-webhook/mock.js +0 -8
- package/dist/actions/trigger-webhook/types.d.ts +0 -21
- package/dist/actions/trigger-webhook/types.js +0 -2
- package/dist/actions/trigger-zapier-webhook/action.d.ts +0 -6
- package/dist/actions/trigger-zapier-webhook/action.js +0 -8
- package/dist/actions/trigger-zapier-webhook/mock.d.ts +0 -2
- package/dist/actions/trigger-zapier-webhook/mock.js +0 -8
- package/dist/actions/trigger-zapier-webhook/types.d.ts +0 -9
- /package/dist/actions/{set-active-outlet → apply-transition}/types.js +0 -0
- /package/dist/actions/{set-active-session → get-smart-grid-layout}/types.js +0 -0
- /package/dist/actions/{set-active-station → integration-payment}/types.js +0 -0
- /package/dist/actions/{trigger-zapier-webhook → open-extension-overlay}/types.js +0 -0
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { MOCK_CART, mockPublishEvent } from "../../demo/database";
|
|
2
|
-
export const mockUpdateCartItemQuantity =
|
|
2
|
+
export const mockUpdateCartItemQuantity = (params) => {
|
|
3
3
|
console.log("[Mock] updateCartItemQuantity called", params);
|
|
4
4
|
if (!params?.internalId) {
|
|
5
|
-
throw new Error(
|
|
5
|
+
throw new Error("internalId is required");
|
|
6
6
|
}
|
|
7
7
|
if (params.quantity === undefined || params.quantity === null) {
|
|
8
|
-
throw new Error(
|
|
8
|
+
throw new Error("quantity is required");
|
|
9
9
|
}
|
|
10
10
|
const { internalId, quantity } = params;
|
|
11
11
|
// Find the product in the cart
|
|
@@ -25,16 +25,16 @@ export const mockUpdateCartItemQuantity = async (params) => {
|
|
|
25
25
|
MOCK_CART.amountToBeCharged = MOCK_CART.total;
|
|
26
26
|
MOCK_CART.remainingBalance = MOCK_CART.total;
|
|
27
27
|
// Publish product-deleted event
|
|
28
|
-
mockPublishEvent(
|
|
28
|
+
mockPublishEvent("cart", "product-deleted", {
|
|
29
29
|
product: product,
|
|
30
30
|
internalId: internalId
|
|
31
31
|
});
|
|
32
|
-
return {
|
|
32
|
+
return Promise.resolve({
|
|
33
33
|
success: true,
|
|
34
34
|
internalId: internalId,
|
|
35
35
|
quantity: 0,
|
|
36
36
|
timestamp: new Date().toISOString()
|
|
37
|
-
};
|
|
37
|
+
});
|
|
38
38
|
}
|
|
39
39
|
// Update quantity
|
|
40
40
|
const quantityDelta = quantity - previousQuantity;
|
|
@@ -46,15 +46,15 @@ export const mockUpdateCartItemQuantity = async (params) => {
|
|
|
46
46
|
MOCK_CART.amountToBeCharged = MOCK_CART.total;
|
|
47
47
|
MOCK_CART.remainingBalance = MOCK_CART.total;
|
|
48
48
|
// Publish product-updated event
|
|
49
|
-
mockPublishEvent(
|
|
49
|
+
mockPublishEvent("cart", "product-updated", {
|
|
50
50
|
product: product,
|
|
51
51
|
previousQuantity: previousQuantity,
|
|
52
52
|
newQuantity: quantity
|
|
53
53
|
});
|
|
54
|
-
return {
|
|
54
|
+
return Promise.resolve({
|
|
55
55
|
success: true,
|
|
56
56
|
internalId: internalId,
|
|
57
57
|
quantity: quantity,
|
|
58
58
|
timestamp: new Date().toISOString()
|
|
59
|
-
};
|
|
59
|
+
});
|
|
60
60
|
};
|
package/dist/demo/database.d.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Mock Database for Standalone/Demo Mode
|
|
3
3
|
* Stores mock data that mimics the Render environment
|
|
4
4
|
*/
|
|
5
|
-
import { CFActiveCompany, CFActiveUser, CFActiveStation, CFActiveOutlet, CFActiveOrder, CFCustomer, CFProduct, CFActiveCart, CFCategory, CFActiveProduct, CFSession, CFActiveRefundDetails } from "../CommonTypes";
|
|
5
|
+
import { CFActiveCompany, CFActiveUser, CFActiveStation, CFActiveOutlet, CFActiveOrder, CFCustomer, CFProduct, CFActiveCart, CFCategory, CFActiveProduct, CFSession, CFActiveRefundDetails, CFSmartGridLayout } from "../CommonTypes";
|
|
6
6
|
export * from "./mocks";
|
|
7
7
|
/** Replace mock catalog / context data in place (same array references mock handlers use). */
|
|
8
8
|
export interface MockDatabaseConfig {
|
|
@@ -34,29 +34,32 @@ export declare const MOCK_CATEGORY_SPECIALTY: CFCategory;
|
|
|
34
34
|
export declare const MOCK_CATEGORY_BASIC: CFCategory;
|
|
35
35
|
export declare const MOCK_CATEGORY_VEGAN: CFCategory;
|
|
36
36
|
export declare const MOCK_CATEGORY_SPICY: CFCategory;
|
|
37
|
-
export declare const MOCK_PRODUCT_BASIL_ALMOND:
|
|
38
|
-
export declare const MOCK_PRODUCT_BEER:
|
|
39
|
-
export declare const MOCK_PRODUCT_BEET:
|
|
40
|
-
export declare const MOCK_PRODUCT_CARAMELIZED:
|
|
41
|
-
export declare const MOCK_PRODUCT_GARLIC_ONION:
|
|
42
|
-
export declare const MOCK_PRODUCT_GARLIC:
|
|
43
|
-
export declare const MOCK_PRODUCT_GINGER_LIME:
|
|
44
|
-
export declare const MOCK_PRODUCT_LEMON:
|
|
45
|
-
export declare const MOCK_PRODUCT_RED_PEPPER:
|
|
46
|
-
export declare const MOCK_PRODUCT_ROASTED_TOMATO:
|
|
47
|
-
export declare const MOCK_PRODUCT_MINT_LEMON:
|
|
48
|
-
export declare const MOCK_PRODUCT_CHILI_GARLIC:
|
|
49
|
-
export declare const MOCK_PRODUCT_HABANERO:
|
|
50
|
-
export declare const MOCK_PRODUCT_BLACK_GARLIC:
|
|
37
|
+
export declare const MOCK_PRODUCT_BASIL_ALMOND: import("@final-commerce/common/pos-types").FullProduct;
|
|
38
|
+
export declare const MOCK_PRODUCT_BEER: import("@final-commerce/common/pos-types").FullProduct;
|
|
39
|
+
export declare const MOCK_PRODUCT_BEET: import("@final-commerce/common/pos-types").FullProduct;
|
|
40
|
+
export declare const MOCK_PRODUCT_CARAMELIZED: import("@final-commerce/common/pos-types").FullProduct;
|
|
41
|
+
export declare const MOCK_PRODUCT_GARLIC_ONION: import("@final-commerce/common/pos-types").FullProduct;
|
|
42
|
+
export declare const MOCK_PRODUCT_GARLIC: import("@final-commerce/common/pos-types").FullProduct;
|
|
43
|
+
export declare const MOCK_PRODUCT_GINGER_LIME: import("@final-commerce/common/pos-types").FullProduct;
|
|
44
|
+
export declare const MOCK_PRODUCT_LEMON: import("@final-commerce/common/pos-types").FullProduct;
|
|
45
|
+
export declare const MOCK_PRODUCT_RED_PEPPER: import("@final-commerce/common/pos-types").FullProduct;
|
|
46
|
+
export declare const MOCK_PRODUCT_ROASTED_TOMATO: import("@final-commerce/common/pos-types").FullProduct;
|
|
47
|
+
export declare const MOCK_PRODUCT_MINT_LEMON: import("@final-commerce/common/pos-types").FullProduct;
|
|
48
|
+
export declare const MOCK_PRODUCT_CHILI_GARLIC: import("@final-commerce/common/pos-types").FullProduct;
|
|
49
|
+
export declare const MOCK_PRODUCT_HABANERO: import("@final-commerce/common/pos-types").FullProduct;
|
|
50
|
+
export declare const MOCK_PRODUCT_BLACK_GARLIC: import("@final-commerce/common/pos-types").FullProduct;
|
|
51
51
|
export declare const MOCK_ORDER_1: CFActiveOrder;
|
|
52
52
|
export declare const MOCK_ORDER_2: CFActiveOrder;
|
|
53
|
-
export declare const
|
|
54
|
-
export declare const
|
|
55
|
-
export declare const
|
|
56
|
-
export declare const
|
|
57
|
-
export declare const
|
|
58
|
-
export declare const
|
|
59
|
-
export declare const
|
|
53
|
+
export declare const MOCK_ORDER_3: CFActiveOrder;
|
|
54
|
+
export declare const MOCK_PARKED_ORDER_1: CFActiveOrder;
|
|
55
|
+
export declare const MOCK_PARKED_ORDER_2: CFActiveOrder;
|
|
56
|
+
export declare const MOCK_USERS: import("@final-commerce/common/pos-types").ActiveUser[];
|
|
57
|
+
export declare const MOCK_STATIONS: import("@final-commerce/common/pos-types").ActiveStation[];
|
|
58
|
+
export declare const MOCK_OUTLETS: import("@final-commerce/common/pos-types").ActiveOutlet[];
|
|
59
|
+
export declare const MOCK_CUSTOMERS: import("@final-commerce/common/pos-types").ActiveCustomer[];
|
|
60
|
+
export declare const MOCK_CATEGORIES: import("@final-commerce/common/pos-types").Category[];
|
|
61
|
+
export declare const MOCK_PRODUCTS: import("@final-commerce/common/pos-types").FullProduct[];
|
|
62
|
+
export declare const MOCK_ORDERS: import("@final-commerce/common/pos-types").ActiveOrder[];
|
|
60
63
|
export declare const MOCK_PARKED_ORDERS: CFActiveOrder[];
|
|
61
64
|
export declare let MOCK_USER: CFActiveUser;
|
|
62
65
|
export declare let MOCK_STATION: CFActiveStation;
|
|
@@ -64,6 +67,7 @@ export declare let MOCK_OUTLET: CFActiveOutlet;
|
|
|
64
67
|
export declare let MOCK_CART: CFActiveCart;
|
|
65
68
|
export declare let MOCK_ACTIVE_PRODUCT: CFActiveProduct;
|
|
66
69
|
export declare const setMockActiveProduct: (activeProduct: CFActiveProduct) => void;
|
|
70
|
+
export declare const MOCK_SMART_GRID_LAYOUTS: Record<string, CFSmartGridLayout>;
|
|
67
71
|
export declare const resetMockCart: () => void;
|
|
68
72
|
/**
|
|
69
73
|
* Replace in-memory mock data used by default mock handlers. Arrays are mutated in place
|
|
@@ -75,3 +79,10 @@ type MockEventCallback = (event: any) => void;
|
|
|
75
79
|
export declare const mockPublishEvent: (topic: string, eventType: string, data: any) => void;
|
|
76
80
|
export declare const mockSubscribeToTopic: (topic: string, callback: MockEventCallback) => void;
|
|
77
81
|
export declare const createOrderFromCart: (paymentType: string, amount: number, processor?: string) => CFActiveOrder;
|
|
82
|
+
/**
|
|
83
|
+
* Apply a (possibly partial) payment of `amount` minor units to the active cart.
|
|
84
|
+
* Decrements the remaining balance; when it reaches zero the sale completes
|
|
85
|
+
* (creates the order, resets the cart, returns it). Otherwise the cart stays
|
|
86
|
+
* open with `amountToBeCharged` reset to what's left, and returns null.
|
|
87
|
+
*/
|
|
88
|
+
export declare const applyMockPayment: (amount: number, paymentType: string, processor?: string) => CFActiveOrder | null;
|
package/dist/demo/database.js
CHANGED
|
@@ -6,7 +6,7 @@ import { CFProductType, CFUserTypes, CurrencyCode } from "../CommonTypes";
|
|
|
6
6
|
export * from "./mocks";
|
|
7
7
|
// Asset Imports - Using Remote URLs to avoid build complexity with asset copying
|
|
8
8
|
const ASSETS_BASE_URL = "https://raw.githubusercontent.com/Final-Commerce/command-frame/refs/heads/main/src/demo/assets";
|
|
9
|
-
const logo =
|
|
9
|
+
const logo = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA5OCAxMDQiIGZpbGw9Im5vbmUiPjxwYXRoIGQ9Ik01NS4yOTk4IDUwLjE2NjJMMzcuNzQyMiA0MC4wMjkzTDMxLjcyNzQgNTAuNDQ3MkwzOC45MjQyIDU0LjYwMjJMNTUuMjk5OCA1MC4xNjYyWiIgZmlsbD0iI0E1NjhCQyIvPjxwYXRoIGQ9Ik0zMS45OTYzIDcwLjQ1MDZMNDkuNTU2OCA4MC41ODkxTDU1LjU3MTUgNzAuMTcxM0w0OC4zNzE4IDY2LjAxNDVMMzEuOTk2MyA3MC40NTA2WiIgZmlsbD0iI0E1NjhCQyIvPjxwYXRoIGQ9Ik0zNi4zNTQyIDM0LjI1NzJDMzYuMzU0MiAzNC4yNTcyIDM2LjM1ODMgMzQuMjYzNSAzNi4zNTY3IDM0LjI2NjRDMzcuMTg2OSAzNC4wNjk3IDM4LjA5MTkgMzQuMTU5NiAzOC44ODUxIDM0LjYxNzVMNjIuNjQ4NiA0OC4zMzc0TDU0LjE3MjkgMjkuOTA0OUwzNi4zNDk2IDM0LjI1ODRMMzYuMzU0MiAzNC4yNTcyWiIgZmlsbD0iI0ZDODc1MyIvPjxwYXRoIGQ9Ik0zMy4wOTg4IDE4Ljk1MDdMMzYuMzc3MiAzNC4yNDczTDE4Ljc1MjUgMzkuMzM3M0wyOC45MzcxIDIxLjY5N0MyOS44NDUzIDIwLjEyMzkgMzEuNDE1MiAxOS4xNzYxIDMzLjA5ODggMTguOTUwN1oiIGZpbGw9IiM0M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I3IDY2LjY5OTQgMTkuNzI2NkM2OS45Nzk2IDIxLjYyMDQgNzIuMTg3OSAyNC42Nzk5IDczLjEwNjMgMjguMDg3OUM3NC4wMjQ4IDMxLjQ5NiA3My42NTEgMzUuMjQzNCA3MS43NjI2IDM4LjUxNDFMNzEuNzI0MSAzOC41ODA4TDcwLjczMzkgNDAuMjk1OEM3MC4xMTY3IDQxLjM2NDkgNzAuNDg3IDQyLjcyOTcgNzEuNTU2MiA0My4zNDdDNzIuNjI1NCA0My45NjQ0IDczLjk5NDIgNDMuNTk5NyA3NC42MDk4IDQyLjUzMzZMNzUuNTk5OSA0MC44MTg1TDc1LjYwNTggNDAuODIxOVoiIGZpbGw9IiMzRDRDNjYiLz48L3N2Zz4="; // crisp vector mark (was logo.png — pixelated when scaled)
|
|
10
10
|
const basilAlmondImg = `${ASSETS_BASE_URL}/basil-almond-paste.png`;
|
|
11
11
|
const beerImg = `${ASSETS_BASE_URL}/beer-paste.png`;
|
|
12
12
|
const beetImg = `${ASSETS_BASE_URL}/beet-paste.png`;
|
|
@@ -167,39 +167,46 @@ export const MOCK_CUSTOMER_5 = {
|
|
|
167
167
|
};
|
|
168
168
|
// --- CATEGORIES ---
|
|
169
169
|
export const MOCK_CATEGORY_PASTES = {
|
|
170
|
-
|
|
170
|
+
id: "cat_pastes",
|
|
171
|
+
createdAt: "2024-01-01T00:00:00.000Z",
|
|
172
|
+
updatedAt: "2024-01-01T00:00:00.000Z",
|
|
171
173
|
name: "Pastes",
|
|
172
174
|
externalId: "ext_cat_pastes",
|
|
173
175
|
companyId: MOCK_COMPANY.id,
|
|
174
|
-
parentId: null
|
|
175
176
|
};
|
|
176
177
|
export const MOCK_CATEGORY_SPECIALTY = {
|
|
177
|
-
|
|
178
|
+
id: "cat_specialty",
|
|
179
|
+
createdAt: "2024-01-01T00:00:00.000Z",
|
|
180
|
+
updatedAt: "2024-01-01T00:00:00.000Z",
|
|
178
181
|
name: "Specialty",
|
|
179
182
|
externalId: "ext_cat_specialty",
|
|
180
183
|
companyId: MOCK_COMPANY.id,
|
|
181
184
|
parentId: "cat_pastes"
|
|
182
185
|
};
|
|
183
186
|
export const MOCK_CATEGORY_BASIC = {
|
|
184
|
-
|
|
187
|
+
id: "cat_basic",
|
|
188
|
+
createdAt: "2024-01-01T00:00:00.000Z",
|
|
189
|
+
updatedAt: "2024-01-01T00:00:00.000Z",
|
|
185
190
|
name: "Basic",
|
|
186
191
|
externalId: "ext_cat_basic",
|
|
187
192
|
companyId: MOCK_COMPANY.id,
|
|
188
193
|
parentId: "cat_pastes"
|
|
189
194
|
};
|
|
190
195
|
export const MOCK_CATEGORY_VEGAN = {
|
|
191
|
-
|
|
196
|
+
id: "cat_vegan",
|
|
197
|
+
createdAt: "2024-01-01T00:00:00.000Z",
|
|
198
|
+
updatedAt: "2024-01-01T00:00:00.000Z",
|
|
192
199
|
name: "Vegan",
|
|
193
200
|
externalId: "ext_cat_vegan",
|
|
194
201
|
companyId: MOCK_COMPANY.id,
|
|
195
|
-
parentId: null
|
|
196
202
|
};
|
|
197
203
|
export const MOCK_CATEGORY_SPICY = {
|
|
198
|
-
|
|
204
|
+
id: "cat_spicy",
|
|
205
|
+
createdAt: "2024-01-01T00:00:00.000Z",
|
|
206
|
+
updatedAt: "2024-01-01T00:00:00.000Z",
|
|
199
207
|
name: "Spicy",
|
|
200
208
|
externalId: "ext_cat_spicy",
|
|
201
209
|
companyId: MOCK_COMPANY.id,
|
|
202
|
-
parentId: null
|
|
203
210
|
};
|
|
204
211
|
// --- PRODUCTS ---
|
|
205
212
|
const createInventory = (stock) => [{ warehouse: "main", outletId: MOCK_OUTLET_MAIN.id, stock }];
|
|
@@ -221,7 +228,7 @@ const createSimpleProduct = (id, name, price, image, categories, description) =>
|
|
|
221
228
|
taxTable: "tax_standard",
|
|
222
229
|
description,
|
|
223
230
|
images: [image],
|
|
224
|
-
categories: categories.map(c => c.
|
|
231
|
+
categories: categories.map(c => ({ name: c.name, externalId: c.externalId ?? c.id })),
|
|
225
232
|
attributes: [],
|
|
226
233
|
variants: [
|
|
227
234
|
{
|
|
@@ -256,7 +263,7 @@ const createVariableProduct = (id, name, basePrice, largePrice, image, categorie
|
|
|
256
263
|
taxTable: "tax_standard",
|
|
257
264
|
description,
|
|
258
265
|
images: [image],
|
|
259
|
-
categories: categories.map(c => c.
|
|
266
|
+
categories: categories.map(c => ({ name: c.name, externalId: c.externalId ?? c.id })),
|
|
260
267
|
attributes: [{ name: "Size", values: ["Small", "Large"] }],
|
|
261
268
|
variants: [
|
|
262
269
|
{
|
|
@@ -314,12 +321,13 @@ const createLineItem = (product, variantIndex = 0, quantity = 1) => {
|
|
|
314
321
|
price: variant.price,
|
|
315
322
|
taxes: [],
|
|
316
323
|
discount: {
|
|
317
|
-
|
|
324
|
+
itemDiscounts: [],
|
|
318
325
|
cartDiscount: { percentage: 0, amount: 0 }
|
|
319
326
|
},
|
|
320
|
-
fee: {
|
|
327
|
+
fee: { itemFees: [] },
|
|
321
328
|
totalTax: 0,
|
|
322
329
|
total: variant.price * quantity,
|
|
330
|
+
lineNetWithFees: variant.price * quantity,
|
|
323
331
|
metadata: [],
|
|
324
332
|
image: product.images?.[0] || "",
|
|
325
333
|
sku: variant.sku,
|
|
@@ -341,7 +349,7 @@ export const MOCK_ORDER_1 = {
|
|
|
341
349
|
customer: MOCK_CUSTOMER_1,
|
|
342
350
|
summary: {
|
|
343
351
|
total: 2100,
|
|
344
|
-
|
|
352
|
+
subtotalAfterFees: 2100,
|
|
345
353
|
discountTotal: 0,
|
|
346
354
|
shippingTotal: 0,
|
|
347
355
|
totalTaxes: 0,
|
|
@@ -391,7 +399,7 @@ export const MOCK_ORDER_2 = {
|
|
|
391
399
|
customer: MOCK_CUSTOMER_2,
|
|
392
400
|
summary: {
|
|
393
401
|
total: 3000,
|
|
394
|
-
|
|
402
|
+
subtotalAfterFees: 3000,
|
|
395
403
|
discountTotal: 0,
|
|
396
404
|
shippingTotal: 0,
|
|
397
405
|
totalTaxes: 0,
|
|
@@ -427,6 +435,140 @@ export const MOCK_ORDER_2 = {
|
|
|
427
435
|
station: MOCK_STATION_2,
|
|
428
436
|
createdAt: new Date(Date.now() - 3600000).toISOString()
|
|
429
437
|
};
|
|
438
|
+
export const MOCK_ORDER_3 = {
|
|
439
|
+
_id: "order_1003",
|
|
440
|
+
currency: CurrencyCode.USD,
|
|
441
|
+
minorUnits: 2,
|
|
442
|
+
receiptId: "1001-0003",
|
|
443
|
+
companyId: MOCK_COMPANY.id,
|
|
444
|
+
externalId: null,
|
|
445
|
+
status: "refunded",
|
|
446
|
+
paymentState: "refunded",
|
|
447
|
+
fulfillmentState: "fulfilled",
|
|
448
|
+
displayState: "Refunded",
|
|
449
|
+
customer: MOCK_CUSTOMER_3,
|
|
450
|
+
summary: {
|
|
451
|
+
total: 1500,
|
|
452
|
+
subtotalAfterFees: 1500,
|
|
453
|
+
discountTotal: 0,
|
|
454
|
+
shippingTotal: 0,
|
|
455
|
+
totalTaxes: 0,
|
|
456
|
+
taxes: [],
|
|
457
|
+
isTaxInclusive: false
|
|
458
|
+
},
|
|
459
|
+
cartDiscount: null,
|
|
460
|
+
cartFees: [],
|
|
461
|
+
paymentMethods: [
|
|
462
|
+
{
|
|
463
|
+
transactionId: "trans_card_2",
|
|
464
|
+
paymentType: "credit_card",
|
|
465
|
+
amount: 1500,
|
|
466
|
+
timestamp: new Date(Date.now() - 7200000).toISOString(),
|
|
467
|
+
processor: "stripe"
|
|
468
|
+
}
|
|
469
|
+
],
|
|
470
|
+
source: "pos",
|
|
471
|
+
posData: {
|
|
472
|
+
outlet: MOCK_OUTLET_MAIN.id,
|
|
473
|
+
station: MOCK_STATION_1._id,
|
|
474
|
+
employee: MOCK_USER_MARIO.id
|
|
475
|
+
},
|
|
476
|
+
sessionId: "sess_3",
|
|
477
|
+
metadata: [],
|
|
478
|
+
billing: null,
|
|
479
|
+
shipping: null,
|
|
480
|
+
lineItems: [createLineItem(MOCK_PRODUCT_BEET, 0, 1)],
|
|
481
|
+
customSales: [],
|
|
482
|
+
balance: 0,
|
|
483
|
+
user: MOCK_USER_MARIO,
|
|
484
|
+
outlet: MOCK_OUTLET_MAIN,
|
|
485
|
+
station: MOCK_STATION_1,
|
|
486
|
+
createdAt: new Date(Date.now() - 7200000).toISOString()
|
|
487
|
+
};
|
|
488
|
+
export const MOCK_PARKED_ORDER_1 = {
|
|
489
|
+
_id: "parked_2001",
|
|
490
|
+
currency: CurrencyCode.USD,
|
|
491
|
+
minorUnits: 2,
|
|
492
|
+
receiptId: "PARK-0001",
|
|
493
|
+
companyId: MOCK_COMPANY.id,
|
|
494
|
+
externalId: null,
|
|
495
|
+
status: "parked",
|
|
496
|
+
paymentState: "unpaid",
|
|
497
|
+
fulfillmentState: "pending",
|
|
498
|
+
displayState: "Parked",
|
|
499
|
+
customer: MOCK_CUSTOMER_4,
|
|
500
|
+
summary: {
|
|
501
|
+
total: 2100,
|
|
502
|
+
subtotalAfterFees: 2100,
|
|
503
|
+
discountTotal: 0,
|
|
504
|
+
shippingTotal: 0,
|
|
505
|
+
totalTaxes: 0,
|
|
506
|
+
taxes: [],
|
|
507
|
+
isTaxInclusive: false
|
|
508
|
+
},
|
|
509
|
+
cartDiscount: null,
|
|
510
|
+
cartFees: [],
|
|
511
|
+
paymentMethods: [],
|
|
512
|
+
source: "pos",
|
|
513
|
+
posData: {
|
|
514
|
+
outlet: MOCK_OUTLET_MAIN.id,
|
|
515
|
+
station: MOCK_STATION_1._id,
|
|
516
|
+
employee: MOCK_USER_LUIGI.id
|
|
517
|
+
},
|
|
518
|
+
sessionId: "sess_park_1",
|
|
519
|
+
metadata: [],
|
|
520
|
+
billing: null,
|
|
521
|
+
shipping: null,
|
|
522
|
+
lineItems: [createLineItem(MOCK_PRODUCT_LEMON, 0, 2)],
|
|
523
|
+
customSales: [],
|
|
524
|
+
balance: 2100,
|
|
525
|
+
user: MOCK_USER_LUIGI,
|
|
526
|
+
outlet: MOCK_OUTLET_MAIN,
|
|
527
|
+
station: MOCK_STATION_1,
|
|
528
|
+
createdAt: new Date(Date.now() - 1800000).toISOString()
|
|
529
|
+
};
|
|
530
|
+
export const MOCK_PARKED_ORDER_2 = {
|
|
531
|
+
_id: "parked_2002",
|
|
532
|
+
currency: CurrencyCode.USD,
|
|
533
|
+
minorUnits: 2,
|
|
534
|
+
receiptId: "PARK-0002",
|
|
535
|
+
companyId: MOCK_COMPANY.id,
|
|
536
|
+
externalId: null,
|
|
537
|
+
status: "parked",
|
|
538
|
+
paymentState: "unpaid",
|
|
539
|
+
fulfillmentState: "pending",
|
|
540
|
+
displayState: "Parked",
|
|
541
|
+
customer: null,
|
|
542
|
+
summary: {
|
|
543
|
+
total: 2500,
|
|
544
|
+
subtotalAfterFees: 2500,
|
|
545
|
+
discountTotal: 0,
|
|
546
|
+
shippingTotal: 0,
|
|
547
|
+
totalTaxes: 0,
|
|
548
|
+
taxes: [],
|
|
549
|
+
isTaxInclusive: false
|
|
550
|
+
},
|
|
551
|
+
cartDiscount: null,
|
|
552
|
+
cartFees: [],
|
|
553
|
+
paymentMethods: [],
|
|
554
|
+
source: "pos",
|
|
555
|
+
posData: {
|
|
556
|
+
outlet: MOCK_OUTLET_MAIN.id,
|
|
557
|
+
station: MOCK_STATION_2._id,
|
|
558
|
+
employee: MOCK_USER_MARIO.id
|
|
559
|
+
},
|
|
560
|
+
sessionId: "sess_park_2",
|
|
561
|
+
metadata: [],
|
|
562
|
+
billing: null,
|
|
563
|
+
shipping: null,
|
|
564
|
+
lineItems: [createLineItem(MOCK_PRODUCT_CARAMELIZED, 0, 1), createLineItem(MOCK_PRODUCT_GINGER_LIME, 0, 1)],
|
|
565
|
+
customSales: [],
|
|
566
|
+
balance: 2500,
|
|
567
|
+
user: MOCK_USER_MARIO,
|
|
568
|
+
outlet: MOCK_OUTLET_MAIN,
|
|
569
|
+
station: MOCK_STATION_2,
|
|
570
|
+
createdAt: new Date(Date.now() - 900000).toISOString()
|
|
571
|
+
};
|
|
430
572
|
// --- EXPORT COLLECTIONS ---
|
|
431
573
|
export const MOCK_USERS = [MOCK_USER_MARIO, MOCK_USER_LUIGI];
|
|
432
574
|
export const MOCK_STATIONS = [MOCK_STATION_1, MOCK_STATION_2];
|
|
@@ -449,8 +591,8 @@ export const MOCK_PRODUCTS = [
|
|
|
449
591
|
MOCK_PRODUCT_HABANERO,
|
|
450
592
|
MOCK_PRODUCT_BLACK_GARLIC
|
|
451
593
|
];
|
|
452
|
-
export const MOCK_ORDERS = [MOCK_ORDER_1, MOCK_ORDER_2];
|
|
453
|
-
export const MOCK_PARKED_ORDERS = [];
|
|
594
|
+
export const MOCK_ORDERS = [MOCK_ORDER_1, MOCK_ORDER_2, MOCK_ORDER_3];
|
|
595
|
+
export const MOCK_PARKED_ORDERS = [MOCK_PARKED_ORDER_1, MOCK_PARKED_ORDER_2];
|
|
454
596
|
// Compatibility Exports (reassigned by setMockDatabase)
|
|
455
597
|
export let MOCK_USER = MOCK_USERS[0];
|
|
456
598
|
export let MOCK_STATION = MOCK_STATIONS[0];
|
|
@@ -469,6 +611,10 @@ export let MOCK_ACTIVE_PRODUCT;
|
|
|
469
611
|
export const setMockActiveProduct = (activeProduct) => {
|
|
470
612
|
MOCK_ACTIVE_PRODUCT = activeProduct;
|
|
471
613
|
};
|
|
614
|
+
// In-memory smart-grid layouts keyed by gridId. Used by mockGetSmartGridLayout /
|
|
615
|
+
// mockSaveSmartGridLayout so the standalone builder (no command-frame host) can
|
|
616
|
+
// round-trip layouts within a session.
|
|
617
|
+
export const MOCK_SMART_GRID_LAYOUTS = {};
|
|
472
618
|
// Helper to reset cart
|
|
473
619
|
export const resetMockCart = () => {
|
|
474
620
|
MOCK_CART = {
|
|
@@ -587,12 +733,13 @@ export const createOrderFromCart = (paymentType, amount, processor = "cash") =>
|
|
|
587
733
|
price: p.price,
|
|
588
734
|
taxes: [],
|
|
589
735
|
discount: {
|
|
590
|
-
|
|
591
|
-
cartDiscount: { percentage: 0, amount: 0
|
|
736
|
+
itemDiscounts: [],
|
|
737
|
+
cartDiscount: { percentage: 0, amount: 0 }
|
|
592
738
|
},
|
|
593
|
-
fee: {
|
|
739
|
+
fee: { itemFees: [] },
|
|
594
740
|
totalTax: 0,
|
|
595
741
|
total: p.price * p.quantity,
|
|
742
|
+
lineNetWithFees: p.price * p.quantity,
|
|
596
743
|
metadata: [],
|
|
597
744
|
image: p.images?.[0] || "",
|
|
598
745
|
sku: p.sku || "",
|
|
@@ -615,7 +762,7 @@ export const createOrderFromCart = (paymentType, amount, processor = "cash") =>
|
|
|
615
762
|
customer: MOCK_CART.customer ? MOCK_CART.customer : null,
|
|
616
763
|
summary: {
|
|
617
764
|
total: totalNum,
|
|
618
|
-
|
|
765
|
+
subtotalAfterFees: totalNum,
|
|
619
766
|
discountTotal: 0,
|
|
620
767
|
shippingTotal: 0,
|
|
621
768
|
totalTaxes: 0,
|
|
@@ -657,3 +804,26 @@ export const createOrderFromCart = (paymentType, amount, processor = "cash") =>
|
|
|
657
804
|
mockPublishEvent("cart", "cart-created", {});
|
|
658
805
|
return newOrder;
|
|
659
806
|
};
|
|
807
|
+
/**
|
|
808
|
+
* Apply a (possibly partial) payment of `amount` minor units to the active cart.
|
|
809
|
+
* Decrements the remaining balance; when it reaches zero the sale completes
|
|
810
|
+
* (creates the order, resets the cart, returns it). Otherwise the cart stays
|
|
811
|
+
* open with `amountToBeCharged` reset to what's left, and returns null.
|
|
812
|
+
*/
|
|
813
|
+
export const applyMockPayment = (amount, paymentType, processor = "cash") => {
|
|
814
|
+
const remainingBefore = MOCK_CART.remainingBalance ?? MOCK_CART.total;
|
|
815
|
+
const charge = Math.min(Math.max(0, amount || remainingBefore), remainingBefore);
|
|
816
|
+
const remainingAfter = Math.max(0, remainingBefore - charge);
|
|
817
|
+
if (remainingAfter > 0) {
|
|
818
|
+
// Partial payment — keep the cart open, queue the rest for the next tender.
|
|
819
|
+
MOCK_CART.remainingBalance = remainingAfter;
|
|
820
|
+
MOCK_CART.amountToBeCharged = remainingAfter;
|
|
821
|
+
mockPublishEvent("cart", "partial-payment-applied", { charged: charge, remaining: remainingAfter });
|
|
822
|
+
return null;
|
|
823
|
+
}
|
|
824
|
+
// Fully paid — create the completed order (this also resets the cart).
|
|
825
|
+
const orderTotal = MOCK_CART.total;
|
|
826
|
+
const order = createOrderFromCart(paymentType, orderTotal, processor);
|
|
827
|
+
mockPublishEvent("payments", "payment-done", { order });
|
|
828
|
+
return order;
|
|
829
|
+
};
|