@final-commerce/command-frame 0.1.11 → 0.1.13
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 +7 -48
- package/dist/actions/add-custom-sale/mock.js +21 -1
- package/dist/actions/add-custom-sale/types.d.ts +1 -0
- package/dist/actions/add-customer/mock.js +1 -0
- package/dist/actions/add-customer-note/mock.js +13 -0
- package/dist/actions/add-order-note/mock.js +10 -0
- package/dist/actions/add-product-discount/mock.js +20 -1
- package/dist/actions/add-product-discount/types.d.ts +3 -2
- package/dist/actions/add-product-fee/mock.js +19 -1
- package/dist/actions/add-product-fee/types.d.ts +3 -2
- package/dist/actions/add-product-note/mock.js +12 -1
- package/dist/actions/add-product-note/types.d.ts +3 -3
- package/dist/actions/add-product-to-cart/types.d.ts +1 -0
- package/dist/actions/adjust-inventory/mock.js +26 -8
- package/dist/actions/adjust-inventory/types.d.ts +1 -0
- package/dist/actions/assign-customer/mock.js +1 -0
- package/dist/actions/cash-payment/action.js +5 -1
- package/dist/actions/cash-payment/mock.js +35 -3
- package/dist/actions/delete-parked-order/mock.js +7 -0
- package/dist/actions/initiate-refund/mock.js +1 -0
- package/dist/actions/open-cash-drawer/mock.js +1 -0
- package/dist/actions/park-order/mock.js +14 -2
- package/dist/actions/partial-payment/action.js +5 -1
- package/dist/actions/partial-payment/mock.js +7 -2
- package/dist/actions/remove-customer-from-cart/mock.js +1 -0
- package/dist/actions/resume-parked-order/mock.js +46 -2
- package/dist/actions/show-confirmation/mock.js +4 -1
- package/dist/actions/show-notification/mock.js +1 -0
- package/dist/actions/tap-to-pay-payment/mock.js +2 -0
- package/dist/actions/terminal-payment/mock.js +4 -2
- package/dist/demo/database.d.ts +1 -0
- package/dist/demo/database.js +1 -0
- package/dist/demo/registry.js +0 -12
- package/dist/index.d.ts +0 -12
- package/dist/index.js +0 -12
- package/package.json +1 -1
- package/dist/actions/get-line-items-by-order/action.d.ts +0 -6
- package/dist/actions/get-line-items-by-order/action.js +0 -8
- package/dist/actions/get-line-items-by-order/mock.d.ts +0 -2
- package/dist/actions/get-line-items-by-order/mock.js +0 -12
- package/dist/actions/get-line-items-by-order/types.d.ts +0 -15
- package/dist/actions/get-line-items-by-order/types.js +0 -1
- package/dist/actions/get-product-variants/action.d.ts +0 -6
- package/dist/actions/get-product-variants/action.js +0 -8
- package/dist/actions/get-product-variants/mock.d.ts +0 -2
- package/dist/actions/get-product-variants/mock.js +0 -14
- package/dist/actions/get-product-variants/types.d.ts +0 -10
- package/dist/actions/get-product-variants/types.js +0 -1
- package/dist/actions/go-to-page/action.d.ts +0 -6
- package/dist/actions/go-to-page/action.js +0 -8
- package/dist/actions/go-to-page/mock.d.ts +0 -2
- package/dist/actions/go-to-page/mock.js +0 -8
- package/dist/actions/go-to-page/types.d.ts +0 -9
- package/dist/actions/go-to-page/types.js +0 -1
- package/dist/actions/open-popup/action.d.ts +0 -6
- package/dist/actions/open-popup/action.js +0 -8
- package/dist/actions/open-popup/mock.d.ts +0 -2
- package/dist/actions/open-popup/mock.js +0 -8
- package/dist/actions/open-popup/types.d.ts +0 -9
- package/dist/actions/open-popup/types.js +0 -1
- package/dist/actions/toggle-slide-out/action.d.ts +0 -6
- package/dist/actions/toggle-slide-out/action.js +0 -8
- package/dist/actions/toggle-slide-out/mock.d.ts +0 -2
- package/dist/actions/toggle-slide-out/mock.js +0 -8
- package/dist/actions/toggle-slide-out/types.d.ts +0 -9
- package/dist/actions/toggle-slide-out/types.js +0 -1
- package/dist/actions/update-customer-facing-display/action.d.ts +0 -6
- package/dist/actions/update-customer-facing-display/action.js +0 -8
- package/dist/actions/update-customer-facing-display/mock.d.ts +0 -2
- package/dist/actions/update-customer-facing-display/mock.js +0 -8
- package/dist/actions/update-customer-facing-display/types.d.ts +0 -9
- package/dist/actions/update-customer-facing-display/types.js +0 -1
|
@@ -1,9 +1,53 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { MOCK_PARKED_ORDERS, MOCK_CART, resetMockCart } from "../../demo/database";
|
|
2
2
|
export const mockResumeParkedOrder = async (params) => {
|
|
3
3
|
console.log("[Mock] resumeParkedOrder called", params);
|
|
4
|
+
const orderId = params?.orderId;
|
|
5
|
+
let orderToResume = null;
|
|
6
|
+
let index = -1;
|
|
7
|
+
if (orderId) {
|
|
8
|
+
index = MOCK_PARKED_ORDERS.findIndex(o => o._id === orderId);
|
|
9
|
+
if (index !== -1)
|
|
10
|
+
orderToResume = MOCK_PARKED_ORDERS[index];
|
|
11
|
+
}
|
|
12
|
+
else {
|
|
13
|
+
// Resume last if no ID
|
|
14
|
+
if (MOCK_PARKED_ORDERS.length > 0) {
|
|
15
|
+
index = MOCK_PARKED_ORDERS.length - 1;
|
|
16
|
+
orderToResume = MOCK_PARKED_ORDERS[index];
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
if (!orderToResume) {
|
|
20
|
+
throw new Error("Parked order not found");
|
|
21
|
+
}
|
|
22
|
+
// Restore to MOCK_CART
|
|
23
|
+
// Logic to convert Order back to Cart (simplified)
|
|
24
|
+
resetMockCart();
|
|
25
|
+
// Copy properties back
|
|
26
|
+
MOCK_CART.customer = orderToResume.customer; // Cast if needed
|
|
27
|
+
// MOCK_CART.products = orderToResume.lineItems... (Mapping needed)
|
|
28
|
+
// For Mock demo, we'll do a best effort mapping
|
|
29
|
+
MOCK_CART.products = orderToResume.lineItems.map(li => ({
|
|
30
|
+
id: li.productId,
|
|
31
|
+
name: li.name,
|
|
32
|
+
quantity: li.quantity,
|
|
33
|
+
price: parseFloat(li.price),
|
|
34
|
+
internalId: li.internalId || li.productId,
|
|
35
|
+
variantId: li.variantId,
|
|
36
|
+
sku: li.sku,
|
|
37
|
+
images: [li.image],
|
|
38
|
+
stock: 100,
|
|
39
|
+
taxTableId: "",
|
|
40
|
+
attributes: li.attributes
|
|
41
|
+
}));
|
|
42
|
+
MOCK_CART.subtotal = parseFloat(orderToResume.summary.subTotal);
|
|
43
|
+
MOCK_CART.total = parseFloat(orderToResume.summary.total);
|
|
44
|
+
MOCK_CART.amountToBeCharged = MOCK_CART.total;
|
|
45
|
+
MOCK_CART.remainingBalance = MOCK_CART.total;
|
|
46
|
+
// Remove from parked
|
|
47
|
+
MOCK_PARKED_ORDERS.splice(index, 1);
|
|
4
48
|
return {
|
|
5
49
|
success: true,
|
|
6
|
-
order:
|
|
50
|
+
order: orderToResume,
|
|
7
51
|
timestamp: new Date().toISOString()
|
|
8
52
|
};
|
|
9
53
|
};
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
export const mockShowConfirmation = async (params) => {
|
|
2
2
|
console.log("[Mock] showConfirmation called", params);
|
|
3
|
-
|
|
3
|
+
const confirmed = window.confirm(`Confirmation Required:\n${params?.message || "Are you sure?"}`);
|
|
4
|
+
if (!confirmed) {
|
|
5
|
+
throw new Error("User cancelled confirmation");
|
|
6
|
+
}
|
|
4
7
|
return {
|
|
5
8
|
success: true,
|
|
6
9
|
message: params?.message || "",
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { MOCK_ORDERS } from "../../demo/database";
|
|
2
2
|
export const mockTapToPayPayment = async (params) => {
|
|
3
3
|
console.log("[Mock] tapToPayPayment called", params);
|
|
4
|
+
// Simulate Tap to Pay interaction
|
|
5
|
+
window.alert("Demo: Processing Tap to Pay...\n(Please tap card or device on screen)");
|
|
4
6
|
return {
|
|
5
7
|
success: true,
|
|
6
8
|
amount: params?.amount || null,
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import { createOrderFromCart } from "../../demo/database";
|
|
1
|
+
import { createOrderFromCart, MOCK_CART } from "../../demo/database";
|
|
2
2
|
export const mockTerminalPayment = async (params) => {
|
|
3
3
|
console.log("[Mock] terminalPayment called", params);
|
|
4
|
-
|
|
4
|
+
// Simulate terminal interaction
|
|
5
|
+
window.alert("Demo: Processing Terminal Payment...\n(Please tap, insert, or swipe card on terminal)");
|
|
6
|
+
const amount = params?.amount || MOCK_CART.total;
|
|
5
7
|
// Mocking terminal payment success immediately
|
|
6
8
|
const order = createOrderFromCart("card", amount, "stripe_terminal");
|
|
7
9
|
return {
|
package/dist/demo/database.d.ts
CHANGED
|
@@ -36,6 +36,7 @@ export declare const MOCK_CUSTOMERS: CFCustomer[];
|
|
|
36
36
|
export declare const MOCK_CATEGORIES: CFCategory[];
|
|
37
37
|
export declare const MOCK_PRODUCTS: CFProduct[];
|
|
38
38
|
export declare const MOCK_ORDERS: CFActiveOrder[];
|
|
39
|
+
export declare const MOCK_PARKED_ORDERS: CFActiveOrder[];
|
|
39
40
|
export declare const MOCK_USER: CFActiveUser;
|
|
40
41
|
export declare const MOCK_STATION: CFActiveStation;
|
|
41
42
|
export declare const MOCK_OUTLET: CFActiveOutlet;
|
package/dist/demo/database.js
CHANGED
|
@@ -403,6 +403,7 @@ export const MOCK_PRODUCTS = [
|
|
|
403
403
|
MOCK_PRODUCT_ROASTED_TOMATO
|
|
404
404
|
];
|
|
405
405
|
export const MOCK_ORDERS = [MOCK_ORDER_1, MOCK_ORDER_2];
|
|
406
|
+
export const MOCK_PARKED_ORDERS = [];
|
|
406
407
|
// Compatibility Exports
|
|
407
408
|
export const MOCK_USER = MOCK_USERS[0];
|
|
408
409
|
export const MOCK_STATION = MOCK_STATIONS[0];
|
package/dist/demo/registry.js
CHANGED
|
@@ -20,17 +20,13 @@ import { mockGetCategories } from "../actions/get-categories/mock";
|
|
|
20
20
|
import { mockGetContext } from "../actions/get-context/mock";
|
|
21
21
|
import { mockGetCurrentCart } from "../actions/get-current-cart/mock";
|
|
22
22
|
import { mockGetCustomers } from "../actions/get-customers/mock";
|
|
23
|
-
import { mockGetLineItemsByOrder } from "../actions/get-line-items-by-order/mock";
|
|
24
23
|
import { mockGetOrders } from "../actions/get-orders/mock";
|
|
25
|
-
import { mockGetProductVariants } from "../actions/get-product-variants/mock";
|
|
26
24
|
import { mockGetProducts } from "../actions/get-products/mock";
|
|
27
25
|
import { mockGetRefunds } from "../actions/get-refunds/mock";
|
|
28
26
|
import { mockGetRemainingRefundableQuantities } from "../actions/get-remaining-refundable-quantities/mock";
|
|
29
|
-
import { mockGoToPage } from "../actions/go-to-page/mock";
|
|
30
27
|
import { mockGoToStationHome } from "../actions/go-to-station-home/mock";
|
|
31
28
|
import { mockInitiateRefund } from "../actions/initiate-refund/mock";
|
|
32
29
|
import { mockOpenCashDrawer } from "../actions/open-cash-drawer/mock";
|
|
33
|
-
import { mockOpenPopup } from "../actions/open-popup/mock";
|
|
34
30
|
import { mockParkOrder } from "../actions/park-order/mock";
|
|
35
31
|
import { mockPartialPayment } from "../actions/partial-payment/mock";
|
|
36
32
|
import { mockProcessPartialRefund } from "../actions/process-partial-refund/mock";
|
|
@@ -44,10 +40,8 @@ import { mockShowNotification } from "../actions/show-notification/mock";
|
|
|
44
40
|
import { mockSwitchUser } from "../actions/switch-user/mock";
|
|
45
41
|
import { mockTapToPayPayment } from "../actions/tap-to-pay-payment/mock";
|
|
46
42
|
import { mockTerminalPayment } from "../actions/terminal-payment/mock";
|
|
47
|
-
import { mockToggleSlideOut } from "../actions/toggle-slide-out/mock";
|
|
48
43
|
import { mockTriggerWebhook } from "../actions/trigger-webhook/mock";
|
|
49
44
|
import { mockTriggerZapierWebhook } from "../actions/trigger-zapier-webhook/mock";
|
|
50
|
-
import { mockUpdateCustomerFacingDisplay } from "../actions/update-customer-facing-display/mock";
|
|
51
45
|
import { mockVendaraPayment } from "../actions/vendara-payment/mock";
|
|
52
46
|
import { mockGetFinalContext } from "../actions/get-final-context/mock";
|
|
53
47
|
export const MOCK_REGISTRY = {
|
|
@@ -73,17 +67,13 @@ export const MOCK_REGISTRY = {
|
|
|
73
67
|
"getContext": mockGetContext,
|
|
74
68
|
"getCurrentCart": mockGetCurrentCart,
|
|
75
69
|
"getCustomers": mockGetCustomers,
|
|
76
|
-
"getLineItemsByOrder": mockGetLineItemsByOrder,
|
|
77
70
|
"getOrders": mockGetOrders,
|
|
78
|
-
"getProductVariants": mockGetProductVariants,
|
|
79
71
|
"getProducts": mockGetProducts,
|
|
80
72
|
"getRefunds": mockGetRefunds,
|
|
81
73
|
"getRemainingRefundableQuantities": mockGetRemainingRefundableQuantities,
|
|
82
|
-
"goToPage": mockGoToPage,
|
|
83
74
|
"goToStationHome": mockGoToStationHome,
|
|
84
75
|
"initiateRefund": mockInitiateRefund,
|
|
85
76
|
"openCashDrawer": mockOpenCashDrawer,
|
|
86
|
-
"openPopup": mockOpenPopup,
|
|
87
77
|
"parkOrder": mockParkOrder,
|
|
88
78
|
"partialPayment": mockPartialPayment,
|
|
89
79
|
"processPartialRefund": mockProcessPartialRefund,
|
|
@@ -97,10 +87,8 @@ export const MOCK_REGISTRY = {
|
|
|
97
87
|
"switchUser": mockSwitchUser,
|
|
98
88
|
"tapToPayPayment": mockTapToPayPayment,
|
|
99
89
|
"terminalPayment": mockTerminalPayment,
|
|
100
|
-
"toggleSlideOut": mockToggleSlideOut,
|
|
101
90
|
"triggerWebhook": mockTriggerWebhook,
|
|
102
91
|
"triggerZapierWebhook": mockTriggerZapierWebhook,
|
|
103
|
-
"updateCustomerFacingDisplay": mockUpdateCustomerFacingDisplay,
|
|
104
92
|
"vendaraPayment": mockVendaraPayment,
|
|
105
93
|
"getFinalContext": mockGetFinalContext,
|
|
106
94
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -6,7 +6,6 @@ export declare const command: {
|
|
|
6
6
|
readonly assignCustomer: import("./actions/assign-customer/types").AssignCustomer;
|
|
7
7
|
readonly addCustomer: import("./actions/add-customer/types").AddCustomer;
|
|
8
8
|
readonly getCategories: import("./actions/get-categories/types").GetCategories;
|
|
9
|
-
readonly getProductVariants: import("./actions/get-product-variants/types").GetProductVariants;
|
|
10
9
|
readonly getOrders: import("./actions/get-orders/types").GetOrders;
|
|
11
10
|
readonly getRefunds: import("./actions/get-refunds/types").GetRefunds;
|
|
12
11
|
readonly addProductDiscount: import("./actions/add-product-discount/types").AddProductDiscount;
|
|
@@ -31,19 +30,14 @@ export declare const command: {
|
|
|
31
30
|
readonly addCustomerNote: import("./actions/add-customer-note/types").AddCustomerNote;
|
|
32
31
|
readonly removeCustomerFromCart: import("./actions/remove-customer-from-cart/types").RemoveCustomerFromCart;
|
|
33
32
|
readonly goToStationHome: import("./actions/go-to-station-home/types").GoToStationHome;
|
|
34
|
-
readonly goToPage: import("./actions/go-to-page/types").GoToPage;
|
|
35
33
|
readonly openCashDrawer: import("./actions/open-cash-drawer/types").OpenCashDrawer;
|
|
36
|
-
readonly openPopup: import("./actions/open-popup/types").OpenPopup;
|
|
37
34
|
readonly showNotification: import("./actions/show-notification/types").ShowNotification;
|
|
38
|
-
readonly toggleSlideOut: import("./actions/toggle-slide-out/types").ToggleSlideOut;
|
|
39
35
|
readonly showConfirmation: import("./actions/show-confirmation/types").ShowConfirmation;
|
|
40
36
|
readonly authenticateUser: import("./actions/authenticate-user/types").AuthenticateUser;
|
|
41
|
-
readonly updateCustomerFacingDisplay: import("./actions/update-customer-facing-display/types").UpdateCustomerFacingDisplay;
|
|
42
37
|
readonly partialPayment: import("./actions/partial-payment/types").PartialPayment;
|
|
43
38
|
readonly switchUser: import("./actions/switch-user/types").SwitchUser;
|
|
44
39
|
readonly triggerWebhook: import("./actions/trigger-webhook/types").TriggerWebhook;
|
|
45
40
|
readonly triggerZapierWebhook: import("./actions/trigger-zapier-webhook/types").TriggerZapierWebhook;
|
|
46
|
-
readonly getLineItemsByOrder: import("./actions/get-line-items-by-order/types").GetLineItemsByOrder;
|
|
47
41
|
readonly setRefundStockAction: import("./actions/set-refund-stock-action/types").SetRefundStockAction;
|
|
48
42
|
readonly selectAllRefundItems: import("./actions/select-all-refund-items/types").SelectAllRefundItems;
|
|
49
43
|
readonly resetRefundDetails: import("./actions/reset-refund-details/types").ResetRefundDetails;
|
|
@@ -59,10 +53,8 @@ export type { GetCustomers, GetCustomersParams, GetCustomersResponse } from "./a
|
|
|
59
53
|
export type { AssignCustomer, AssignCustomerParams, AssignCustomerResponse } from "./actions/assign-customer/types";
|
|
60
54
|
export type { AddCustomer, AddCustomerParams, AddCustomerResponse } from "./actions/add-customer/types";
|
|
61
55
|
export type { GetCategories, GetCategoriesParams, GetCategoriesResponse } from "./actions/get-categories/types";
|
|
62
|
-
export type { GetProductVariants, GetProductVariantsParams, GetProductVariantsResponse } from "./actions/get-product-variants/types";
|
|
63
56
|
export type { GetOrders, GetOrdersParams, GetOrdersResponse } from "./actions/get-orders/types";
|
|
64
57
|
export type { GetRefunds, GetRefundsParams, GetRefundsResponse } from "./actions/get-refunds/types";
|
|
65
|
-
export type { GetLineItemsByOrder, GetLineItemsByOrderParams, GetLineItemsByOrderResponse } from "./actions/get-line-items-by-order/types";
|
|
66
58
|
export type { SetRefundStockAction, SetRefundStockActionParams, SetRefundStockActionResponse } from "./actions/set-refund-stock-action/types";
|
|
67
59
|
export type { SelectAllRefundItems, SelectAllRefundItemsParams, SelectAllRefundItemsResponse } from "./actions/select-all-refund-items/types";
|
|
68
60
|
export type { ResetRefundDetails, ResetRefundDetailsResponse } from "./actions/reset-refund-details/types";
|
|
@@ -92,14 +84,10 @@ export type { VendaraPayment, VendaraPaymentParams, VendaraPaymentResponse } fro
|
|
|
92
84
|
export type { AddCustomerNote, AddCustomerNoteParams, AddCustomerNoteResponse } from "./actions/add-customer-note/types";
|
|
93
85
|
export type { RemoveCustomerFromCart, RemoveCustomerFromCartResponse } from "./actions/remove-customer-from-cart/types";
|
|
94
86
|
export type { GoToStationHome, GoToStationHomeResponse } from "./actions/go-to-station-home/types";
|
|
95
|
-
export type { GoToPage, GoToPageParams, GoToPageResponse } from "./actions/go-to-page/types";
|
|
96
87
|
export type { OpenCashDrawer, OpenCashDrawerResponse } from "./actions/open-cash-drawer/types";
|
|
97
|
-
export type { OpenPopup, OpenPopupParams, OpenPopupResponse } from "./actions/open-popup/types";
|
|
98
88
|
export type { ShowNotification, ShowNotificationParams, ShowNotificationResponse } from "./actions/show-notification/types";
|
|
99
|
-
export type { ToggleSlideOut, ToggleSlideOutParams, ToggleSlideOutResponse } from "./actions/toggle-slide-out/types";
|
|
100
89
|
export type { ShowConfirmation, ShowConfirmationParams, ShowConfirmationResponse } from "./actions/show-confirmation/types";
|
|
101
90
|
export type { AuthenticateUser, AuthenticateUserParams, AuthenticateUserResponse } from "./actions/authenticate-user/types";
|
|
102
|
-
export type { UpdateCustomerFacingDisplay, UpdateCustomerFacingDisplayParams, UpdateCustomerFacingDisplayResponse } from "./actions/update-customer-facing-display/types";
|
|
103
91
|
export type { PartialPayment, PartialPaymentParams, PartialPaymentResponse } from "./actions/partial-payment/types";
|
|
104
92
|
export type { SwitchUser, SwitchUserParams, SwitchUserResponse } from "./actions/switch-user/types";
|
|
105
93
|
export type { TriggerWebhook, TriggerWebhookPresetType, TriggerWebhookParams, TriggerWebhookResponse } from "./actions/trigger-webhook/types";
|
package/dist/index.js
CHANGED
|
@@ -6,7 +6,6 @@ import { getCustomers } from "./actions/get-customers/action";
|
|
|
6
6
|
import { assignCustomer } from "./actions/assign-customer/action";
|
|
7
7
|
import { addCustomer } from "./actions/add-customer/action";
|
|
8
8
|
import { getCategories } from "./actions/get-categories/action";
|
|
9
|
-
import { getProductVariants } from "./actions/get-product-variants/action";
|
|
10
9
|
import { getOrders } from "./actions/get-orders/action";
|
|
11
10
|
import { getRefunds } from "./actions/get-refunds/action";
|
|
12
11
|
import { addCartDiscount } from "./actions/add-cart-discount/action";
|
|
@@ -35,20 +34,15 @@ import { addCustomerNote } from "./actions/add-customer-note/action";
|
|
|
35
34
|
import { removeCustomerFromCart } from "./actions/remove-customer-from-cart/action";
|
|
36
35
|
// System Actions
|
|
37
36
|
import { goToStationHome } from "./actions/go-to-station-home/action";
|
|
38
|
-
import { goToPage } from "./actions/go-to-page/action";
|
|
39
37
|
import { openCashDrawer } from "./actions/open-cash-drawer/action";
|
|
40
|
-
import { openPopup } from "./actions/open-popup/action";
|
|
41
38
|
import { showNotification } from "./actions/show-notification/action";
|
|
42
|
-
import { toggleSlideOut } from "./actions/toggle-slide-out/action";
|
|
43
39
|
import { showConfirmation } from "./actions/show-confirmation/action";
|
|
44
40
|
import { authenticateUser } from "./actions/authenticate-user/action";
|
|
45
|
-
import { updateCustomerFacingDisplay } from "./actions/update-customer-facing-display/action";
|
|
46
41
|
import { partialPayment } from "./actions/partial-payment/action";
|
|
47
42
|
import { switchUser } from "./actions/switch-user/action";
|
|
48
43
|
// Integration Actions
|
|
49
44
|
import { triggerWebhook } from "./actions/trigger-webhook/action";
|
|
50
45
|
import { triggerZapierWebhook } from "./actions/trigger-zapier-webhook/action";
|
|
51
|
-
import { getLineItemsByOrder } from "./actions/get-line-items-by-order/action";
|
|
52
46
|
import { setRefundStockAction } from "./actions/set-refund-stock-action/action";
|
|
53
47
|
import { selectAllRefundItems } from "./actions/select-all-refund-items/action";
|
|
54
48
|
import { resetRefundDetails } from "./actions/reset-refund-details/action";
|
|
@@ -65,7 +59,6 @@ export const command = {
|
|
|
65
59
|
assignCustomer,
|
|
66
60
|
addCustomer,
|
|
67
61
|
getCategories,
|
|
68
|
-
getProductVariants,
|
|
69
62
|
getOrders,
|
|
70
63
|
getRefunds,
|
|
71
64
|
addProductDiscount,
|
|
@@ -94,21 +87,16 @@ export const command = {
|
|
|
94
87
|
removeCustomerFromCart,
|
|
95
88
|
// System Actions
|
|
96
89
|
goToStationHome,
|
|
97
|
-
goToPage,
|
|
98
90
|
openCashDrawer,
|
|
99
|
-
openPopup,
|
|
100
91
|
showNotification,
|
|
101
|
-
toggleSlideOut,
|
|
102
92
|
showConfirmation,
|
|
103
93
|
authenticateUser,
|
|
104
|
-
updateCustomerFacingDisplay,
|
|
105
94
|
partialPayment,
|
|
106
95
|
switchUser,
|
|
107
96
|
// Integration Actions
|
|
108
97
|
triggerWebhook,
|
|
109
98
|
triggerZapierWebhook,
|
|
110
99
|
// Refund Actions
|
|
111
|
-
getLineItemsByOrder,
|
|
112
100
|
setRefundStockAction,
|
|
113
101
|
selectAllRefundItems,
|
|
114
102
|
resetRefundDetails,
|
package/package.json
CHANGED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Get line items by order action
|
|
3
|
-
* Calls the getLineItemsByOrder action on the parent window
|
|
4
|
-
*/
|
|
5
|
-
import { commandFrameClient } from "../../client";
|
|
6
|
-
export const getLineItemsByOrder = async (params) => {
|
|
7
|
-
return await commandFrameClient.call("getLineItemsByOrder", params);
|
|
8
|
-
};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
export const mockGetLineItemsByOrder = async (params) => {
|
|
2
|
-
console.log("[Mock] getLineItemsByOrder called", params);
|
|
3
|
-
return {
|
|
4
|
-
success: true,
|
|
5
|
-
orderId: params?.orderId || "mock_order_id",
|
|
6
|
-
lineItems: [],
|
|
7
|
-
customSales: [],
|
|
8
|
-
remainingQuantities: {},
|
|
9
|
-
remainingCustomSalesQuantities: {},
|
|
10
|
-
timestamp: new Date().toISOString()
|
|
11
|
-
};
|
|
12
|
-
};
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { CFLineItem, CFCustomSale } from "../../CommonTypes";
|
|
2
|
-
export interface GetLineItemsByOrderParams {
|
|
3
|
-
/** If not provided, uses the currently active order. */
|
|
4
|
-
orderId?: string;
|
|
5
|
-
}
|
|
6
|
-
export interface GetLineItemsByOrderResponse {
|
|
7
|
-
success: boolean;
|
|
8
|
-
orderId: string;
|
|
9
|
-
lineItems: CFLineItem[];
|
|
10
|
-
customSales: CFCustomSale[];
|
|
11
|
-
remainingQuantities: Record<string, number>;
|
|
12
|
-
remainingCustomSalesQuantities: Record<string, number>;
|
|
13
|
-
timestamp: string;
|
|
14
|
-
}
|
|
15
|
-
export type GetLineItemsByOrder = (params?: GetLineItemsByOrderParams) => Promise<GetLineItemsByOrderResponse>;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Get product variants action
|
|
3
|
-
* Calls the getProductVariants action on the parent window
|
|
4
|
-
*/
|
|
5
|
-
import { commandFrameClient } from "../../client";
|
|
6
|
-
export const getProductVariants = async (params) => {
|
|
7
|
-
return await commandFrameClient.call("getProductVariants", params);
|
|
8
|
-
};
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { MOCK_PRODUCTS, safeSerialize } from "../../demo/database";
|
|
2
|
-
export const mockGetProductVariants = async (params) => {
|
|
3
|
-
console.log("[Mock] getProductVariants called", params);
|
|
4
|
-
if (!params?.productId) {
|
|
5
|
-
throw new Error("productId is required");
|
|
6
|
-
}
|
|
7
|
-
const product = MOCK_PRODUCTS.find(p => p._id === params.productId);
|
|
8
|
-
const variants = product ? product.variants : [];
|
|
9
|
-
return {
|
|
10
|
-
variants: safeSerialize(variants),
|
|
11
|
-
productId: params.productId,
|
|
12
|
-
timestamp: new Date().toISOString()
|
|
13
|
-
};
|
|
14
|
-
};
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { CFProductVariant } from "../../CommonTypes";
|
|
2
|
-
export interface GetProductVariantsParams {
|
|
3
|
-
productId: string;
|
|
4
|
-
}
|
|
5
|
-
export interface GetProductVariantsResponse {
|
|
6
|
-
variants: CFProductVariant[];
|
|
7
|
-
productId: string;
|
|
8
|
-
timestamp: string;
|
|
9
|
-
}
|
|
10
|
-
export type GetProductVariants = (params?: GetProductVariantsParams) => Promise<GetProductVariantsResponse>;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Toggle slide out action
|
|
3
|
-
* Calls the toggleSlideOut action on the parent window
|
|
4
|
-
*/
|
|
5
|
-
import { commandFrameClient } from "../../client";
|
|
6
|
-
export const toggleSlideOut = async (params) => {
|
|
7
|
-
return await commandFrameClient.call("toggleSlideOut", params);
|
|
8
|
-
};
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
export interface ToggleSlideOutParams {
|
|
2
|
-
slideOutId: string;
|
|
3
|
-
}
|
|
4
|
-
export interface ToggleSlideOutResponse {
|
|
5
|
-
success: boolean;
|
|
6
|
-
slideOutId: string;
|
|
7
|
-
timestamp: string;
|
|
8
|
-
}
|
|
9
|
-
export type ToggleSlideOut = (params?: ToggleSlideOutParams) => Promise<ToggleSlideOutResponse>;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Update customer facing display action
|
|
3
|
-
* Calls the updateCustomerFacingDisplay action on the parent window
|
|
4
|
-
*/
|
|
5
|
-
import { commandFrameClient } from "../../client";
|
|
6
|
-
export const updateCustomerFacingDisplay = async (params) => {
|
|
7
|
-
return await commandFrameClient.call("updateCustomerFacingDisplay", params);
|
|
8
|
-
};
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
export interface UpdateCustomerFacingDisplayParams {
|
|
2
|
-
pageId: string;
|
|
3
|
-
}
|
|
4
|
-
export interface UpdateCustomerFacingDisplayResponse {
|
|
5
|
-
success: boolean;
|
|
6
|
-
pageId: string;
|
|
7
|
-
timestamp: string;
|
|
8
|
-
}
|
|
9
|
-
export type UpdateCustomerFacingDisplay = (params?: UpdateCustomerFacingDisplayParams) => Promise<UpdateCustomerFacingDisplayResponse>;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|