@final-commerce/command-frame 0.1.12 → 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-product-discount/mock.js +3 -3
- package/dist/actions/add-product-discount/types.d.ts +3 -2
- package/dist/actions/add-product-fee/mock.js +3 -3
- package/dist/actions/add-product-fee/types.d.ts +3 -2
- package/dist/actions/add-product-note/mock.js +3 -3
- 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/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
package/README.md
CHANGED
|
@@ -31,7 +31,6 @@ The library provides a `command` namespace object containing all available comma
|
|
|
31
31
|
- **[getCustomers](https://github.com/Final-Commerce/command-frame/blob/main/src/actions/get-customers/README.md)** - Retrieve a list of customers from the parent application
|
|
32
32
|
- **[getProducts](https://github.com/Final-Commerce/command-frame/blob/main/src/actions/get-products/README.md)** - Retrieve a list of products from the parent application
|
|
33
33
|
- **[getCategories](https://github.com/Final-Commerce/command-frame/blob/main/src/actions/get-categories/README.md)** - Retrieve a list of categories from the parent application
|
|
34
|
-
- **[getProductVariants](https://github.com/Final-Commerce/command-frame/blob/main/src/actions/get-product-variants/README.md)** - Retrieve all variants for a specific product
|
|
35
34
|
- **[getOrders](https://github.com/Final-Commerce/command-frame/blob/main/src/actions/get-orders/README.md)** - Retrieve a list of orders from the system with optional filtering, sorting, and pagination
|
|
36
35
|
- **[getCurrentCart](https://github.com/Final-Commerce/command-frame/blob/main/src/actions/get-current-cart/README.md)** - Retrieve the current cart object with all its contents
|
|
37
36
|
- **[getContext](https://github.com/Final-Commerce/command-frame/blob/main/src/actions/get-context/README.md)** - Get current environment/context information (user, company, device, station, outlet, build)
|
|
@@ -39,9 +38,9 @@ The library provides a `command` namespace object containing all available comma
|
|
|
39
38
|
|
|
40
39
|
#### Product Actions
|
|
41
40
|
- **[addProductToCart](https://github.com/Final-Commerce/command-frame/blob/main/src/actions/add-product-to-cart/README.md)** - Add a product to the cart with optional discounts, fees, and notes
|
|
42
|
-
- **[addProductDiscount](https://github.com/Final-Commerce/command-frame/blob/main/src/actions/add-product-discount/README.md)** - Add a discount to a specific product in the cart (using `
|
|
43
|
-
- **[addProductNote](https://github.com/Final-Commerce/command-frame/blob/main/src/actions/add-product-note/README.md)** - Add a note to a specific product in the cart (using `
|
|
44
|
-
- **[addProductFee](https://github.com/Final-Commerce/command-frame/blob/main/src/actions/add-product-fee/README.md)** - Add a fee to a specific product in the cart (using `
|
|
41
|
+
- **[addProductDiscount](https://github.com/Final-Commerce/command-frame/blob/main/src/actions/add-product-discount/README.md)** - Add a discount to a specific product in the cart (using `internalId`)
|
|
42
|
+
- **[addProductNote](https://github.com/Final-Commerce/command-frame/blob/main/src/actions/add-product-note/README.md)** - Add a note to a specific product in the cart (using `internalId`)
|
|
43
|
+
- **[addProductFee](https://github.com/Final-Commerce/command-frame/blob/main/src/actions/add-product-fee/README.md)** - Add a fee to a specific product in the cart (using `internalId`)
|
|
45
44
|
- **[adjustInventory](https://github.com/Final-Commerce/command-frame/blob/main/src/actions/adjust-inventory/README.md)** - Adjust inventory/stock level for a specific product variant
|
|
46
45
|
|
|
47
46
|
#### Order Actions
|
|
@@ -68,18 +67,13 @@ The library provides a `command` namespace object containing all available comma
|
|
|
68
67
|
|
|
69
68
|
#### System Actions
|
|
70
69
|
- **[goToStationHome](https://github.com/Final-Commerce/command-frame/blob/main/src/actions/go-to-station-home/README.md)** - Navigate to the station home page
|
|
71
|
-
- **[goToPage](https://github.com/Final-Commerce/command-frame/blob/main/src/actions/go-to-page/README.md)** - Navigate to a specific page
|
|
72
70
|
- **[openCashDrawer](https://github.com/Final-Commerce/command-frame/blob/main/src/actions/open-cash-drawer/README.md)** - Open the cash drawer
|
|
73
|
-
- **[openPopup](https://github.com/Final-Commerce/command-frame/blob/main/src/actions/open-popup/README.md)** - Open a popup/modal by ID
|
|
74
71
|
- **[showNotification](https://github.com/Final-Commerce/command-frame/blob/main/src/actions/show-notification/README.md)** - Show a notification message
|
|
75
|
-
- **[toggleSlideOut](https://github.com/Final-Commerce/command-frame/blob/main/src/actions/toggle-slide-out/README.md)** - Toggle a slide-out panel
|
|
76
72
|
- **[showConfirmation](https://github.com/Final-Commerce/command-frame/blob/main/src/actions/show-confirmation/README.md)** - Show a confirmation dialog
|
|
77
73
|
- **[authenticateUser](https://github.com/Final-Commerce/command-frame/blob/main/src/actions/authenticate-user/README.md)** - Trigger user authentication for specific roles
|
|
78
|
-
- **[updateCustomerFacingDisplay](https://github.com/Final-Commerce/command-frame/blob/main/src/actions/update-customer-facing-display/README.md)** - Update the customer-facing display to show a specific page
|
|
79
74
|
- **[switchUser](https://github.com/Final-Commerce/command-frame/blob/main/src/actions/switch-user/README.md)** - Switch the current user to a different user
|
|
80
75
|
|
|
81
76
|
#### Refund Actions
|
|
82
|
-
- **[getLineItemsByOrder](https://github.com/Final-Commerce/command-frame/blob/main/src/actions/get-line-items-by-order/README.md)** - Retrieve line items and custom sales from an order for refund purposes
|
|
83
77
|
- **[selectAllRefundItems](https://github.com/Final-Commerce/command-frame/blob/main/src/actions/select-all-refund-items/README.md)** - Select all remaining refundable items for a full refund
|
|
84
78
|
- **[resetRefundDetails](https://github.com/Final-Commerce/command-frame/blob/main/src/actions/reset-refund-details/README.md)** - Clear all refund selections
|
|
85
79
|
- **[setRefundStockAction](https://github.com/Final-Commerce/command-frame/blob/main/src/actions/set-refund-stock-action/README.md)** - Set stock handling option (restock/damage) for a refunded item
|
|
@@ -110,11 +104,6 @@ const customers = await command.getCustomers();
|
|
|
110
104
|
// Get categories from parent window
|
|
111
105
|
const categories = await command.getCategories();
|
|
112
106
|
|
|
113
|
-
// Get variants for a product
|
|
114
|
-
const variants = await command.getProductVariants({
|
|
115
|
-
productId: '691df9c6c478bada1fb23d31'
|
|
116
|
-
});
|
|
117
|
-
|
|
118
107
|
// Add product to cart with optional discounts and fees
|
|
119
108
|
const addedProduct = await command.addProductToCart({
|
|
120
109
|
variantId: '691df9c6c478bada1fb23d55',
|
|
@@ -129,7 +118,7 @@ const addedProduct = await command.addProductToCart({
|
|
|
129
118
|
|
|
130
119
|
// Add a discount to the specific item just added (if you didn't add it during creation)
|
|
131
120
|
await command.addProductDiscount({
|
|
132
|
-
|
|
121
|
+
internalId: addedProduct.internalId,
|
|
133
122
|
amount: 5,
|
|
134
123
|
isPercent: true,
|
|
135
124
|
label: 'Extra 5% Off'
|
|
@@ -176,10 +165,6 @@ Assigns an existing customer to the current active session/cart. The customer mu
|
|
|
176
165
|
|
|
177
166
|
Retrieves a list of categories from the parent application's local database. Supports filtering by name, parent ID, and external ID.
|
|
178
167
|
|
|
179
|
-
### [getProductVariants](https://github.com/Final-Commerce/command-frame/blob/main/src/actions/get-product-variants/README.md)
|
|
180
|
-
|
|
181
|
-
Retrieves all variants for a specific product from the parent application's local database. Useful for displaying variant options or selecting a specific variant.
|
|
182
|
-
|
|
183
168
|
### [getOrders](https://github.com/Final-Commerce/command-frame/blob/main/src/actions/get-orders/README.md)
|
|
184
169
|
|
|
185
170
|
Retrieves a list of orders from the system with optional filtering, sorting, and pagination. Supports filtering by status, customer ID, session ID, and text search.
|
|
@@ -198,7 +183,7 @@ Adds a product to the cart. Supports specifying quantity, applying discounts, fe
|
|
|
198
183
|
|
|
199
184
|
### [addProductDiscount](https://github.com/Final-Commerce/command-frame/blob/main/src/actions/add-product-discount/README.md)
|
|
200
185
|
|
|
201
|
-
Adds a discount to a specific product in the cart (identified by `
|
|
186
|
+
Adds a discount to a specific product in the cart (identified by `internalId`). Supports both fixed amount and percentage discounts.
|
|
202
187
|
|
|
203
188
|
### [addCartDiscount](https://github.com/Final-Commerce/command-frame/blob/main/src/actions/add-cart-discount/README.md)
|
|
204
189
|
|
|
@@ -212,11 +197,11 @@ Retrieves the current environment/context information from the parent applicatio
|
|
|
212
197
|
|
|
213
198
|
### [addProductNote](https://github.com/Final-Commerce/command-frame/blob/main/src/actions/add-product-note/README.md)
|
|
214
199
|
|
|
215
|
-
Adds a note to a specific product in the cart (identified by `
|
|
200
|
+
Adds a note to a specific product in the cart (identified by `internalId`).
|
|
216
201
|
|
|
217
202
|
### [addProductFee](https://github.com/Final-Commerce/command-frame/blob/main/src/actions/add-product-fee/README.md)
|
|
218
203
|
|
|
219
|
-
Adds a fee to a specific product in the cart (identified by `
|
|
204
|
+
Adds a fee to a specific product in the cart (identified by `internalId`). Supports both fixed amount and percentage-based fees.
|
|
220
205
|
|
|
221
206
|
### [adjustInventory](https://github.com/Final-Commerce/command-frame/blob/main/src/actions/adjust-inventory/README.md)
|
|
222
207
|
|
|
@@ -288,26 +273,14 @@ Removes the currently assigned customer from the cart.
|
|
|
288
273
|
|
|
289
274
|
Navigates to the station home page.
|
|
290
275
|
|
|
291
|
-
### [goToPage](https://github.com/Final-Commerce/command-frame/blob/main/src/actions/go-to-page/README.md)
|
|
292
|
-
|
|
293
|
-
Navigates to a specific page in the application by page ID.
|
|
294
|
-
|
|
295
276
|
### [openCashDrawer](https://github.com/Final-Commerce/command-frame/blob/main/src/actions/open-cash-drawer/README.md)
|
|
296
277
|
|
|
297
278
|
Opens the cash drawer (if connected to a compatible device).
|
|
298
279
|
|
|
299
|
-
### [openPopup](https://github.com/Final-Commerce/command-frame/blob/main/src/actions/open-popup/README.md)
|
|
300
|
-
|
|
301
|
-
Opens a popup/modal by ID. If the popup is already open, calling this will close it (toggle behavior).
|
|
302
|
-
|
|
303
280
|
### [showNotification](https://github.com/Final-Commerce/command-frame/blob/main/src/actions/show-notification/README.md)
|
|
304
281
|
|
|
305
282
|
Shows a notification message to the user.
|
|
306
283
|
|
|
307
|
-
### [toggleSlideOut](https://github.com/Final-Commerce/command-frame/blob/main/src/actions/toggle-slide-out/README.md)
|
|
308
|
-
|
|
309
|
-
Toggles (opens/closes) a slide-out panel by ID.
|
|
310
|
-
|
|
311
284
|
### [showConfirmation](https://github.com/Final-Commerce/command-frame/blob/main/src/actions/show-confirmation/README.md)
|
|
312
285
|
|
|
313
286
|
Shows a confirmation dialog to the user. The actual promise resolution (accept/decline) is handled by the parent application's handler system.
|
|
@@ -316,20 +289,12 @@ Shows a confirmation dialog to the user. The actual promise resolution (accept/d
|
|
|
316
289
|
|
|
317
290
|
Triggers user authentication for specific roles. Shows an authentication dialog in the parent application.
|
|
318
291
|
|
|
319
|
-
### [updateCustomerFacingDisplay](https://github.com/Final-Commerce/command-frame/blob/main/src/actions/update-customer-facing-display/README.md)
|
|
320
|
-
|
|
321
|
-
Updates the customer-facing display to show a specific page by page ID.
|
|
322
|
-
|
|
323
292
|
### [switchUser](https://github.com/Final-Commerce/command-frame/blob/main/src/actions/switch-user/README.md)
|
|
324
293
|
|
|
325
294
|
Switches the current user to a different user. Supports three modes: dialog (select from all users), role (select from users with specific roles), or specific (switch to a specific user).
|
|
326
295
|
|
|
327
296
|
### Refund Actions
|
|
328
297
|
|
|
329
|
-
### [getLineItemsByOrder](https://github.com/Final-Commerce/command-frame/blob/main/src/actions/get-line-items-by-order/README.md)
|
|
330
|
-
|
|
331
|
-
Retrieves line items and custom sales from an order, along with calculated remaining refundable quantities for each item.
|
|
332
|
-
|
|
333
298
|
### [selectAllRefundItems](https://github.com/Final-Commerce/command-frame/blob/main/src/actions/select-all-refund-items/README.md)
|
|
334
299
|
|
|
335
300
|
Selects all remaining refundable items (line items, custom sales, cart fees, and tips) for a full refund.
|
|
@@ -455,7 +420,6 @@ import type {
|
|
|
455
420
|
GetCustomersParams, GetCustomersResponse, GetCustomers,
|
|
456
421
|
GetProductsParams, GetProductsResponse, GetProducts,
|
|
457
422
|
GetCategoriesParams, GetCategoriesResponse, GetCategories,
|
|
458
|
-
GetProductVariantsParams, GetProductVariantsResponse, GetProductVariants,
|
|
459
423
|
GetOrdersParams, GetOrdersResponse, GetOrders,
|
|
460
424
|
GetContext, GetContextResponse,
|
|
461
425
|
GetFinalContext, GetFinalContextResponse,
|
|
@@ -488,17 +452,12 @@ import type {
|
|
|
488
452
|
RemoveCustomerFromCartResponse, RemoveCustomerFromCart,
|
|
489
453
|
// System Actions
|
|
490
454
|
GoToStationHomeResponse, GoToStationHome,
|
|
491
|
-
GoToPageParams, GoToPageResponse, GoToPage,
|
|
492
455
|
OpenCashDrawerResponse, OpenCashDrawer,
|
|
493
|
-
OpenPopupParams, OpenPopupResponse, OpenPopup,
|
|
494
456
|
ShowNotificationParams, ShowNotificationResponse, ShowNotification,
|
|
495
|
-
ToggleSlideOutParams, ToggleSlideOutResponse, ToggleSlideOut,
|
|
496
457
|
ShowConfirmationParams, ShowConfirmationResponse, ShowConfirmation,
|
|
497
458
|
AuthenticateUserParams, AuthenticateUserResponse, AuthenticateUser,
|
|
498
|
-
UpdateCustomerFacingDisplayParams, UpdateCustomerFacingDisplayResponse, UpdateCustomerFacingDisplay,
|
|
499
459
|
SwitchUserParams, SwitchUserResponse, SwitchUser,
|
|
500
460
|
// Refund Actions
|
|
501
|
-
GetLineItemsByOrderParams, GetLineItemsByOrderResponse, GetLineItemsByOrder,
|
|
502
461
|
SelectAllRefundItemsParams, SelectAllRefundItemsResponse, SelectAllRefundItems,
|
|
503
462
|
ResetRefundDetailsResponse, ResetRefundDetails,
|
|
504
463
|
SetRefundStockActionParams, SetRefundStockActionResponse, SetRefundStockAction,
|
|
@@ -3,8 +3,8 @@ export const mockAddProductDiscount = async (params) => {
|
|
|
3
3
|
console.log("[Mock] addProductDiscount called", params);
|
|
4
4
|
if (params && (params.amount > 0 || params.amount < 0)) { // Allow 0 to clear discount if logic permits
|
|
5
5
|
let item = null;
|
|
6
|
-
if (params.
|
|
7
|
-
item = MOCK_CART.products.find(p => p.internalId === params.
|
|
6
|
+
if (params.internalId) {
|
|
7
|
+
item = MOCK_CART.products.find(p => p.internalId === params.internalId);
|
|
8
8
|
}
|
|
9
9
|
else if (MOCK_CART.products.length > 0) {
|
|
10
10
|
item = MOCK_CART.products[MOCK_CART.products.length - 1];
|
|
@@ -24,7 +24,7 @@ export const mockAddProductDiscount = async (params) => {
|
|
|
24
24
|
amount: params?.amount || 0,
|
|
25
25
|
isPercent: params?.isPercent || false,
|
|
26
26
|
label: params?.label || "",
|
|
27
|
-
|
|
27
|
+
internalId: params?.internalId,
|
|
28
28
|
timestamp: new Date().toISOString()
|
|
29
29
|
};
|
|
30
30
|
};
|
|
@@ -5,14 +5,15 @@ export interface AddProductDiscountParams {
|
|
|
5
5
|
isPercent?: boolean;
|
|
6
6
|
/** Defaults to "Discount". */
|
|
7
7
|
label?: string;
|
|
8
|
-
|
|
8
|
+
/** The unique identifier for a specific line item in the cart. */
|
|
9
|
+
internalId?: string;
|
|
9
10
|
}
|
|
10
11
|
export interface AddProductDiscountResponse {
|
|
11
12
|
success: boolean;
|
|
12
13
|
amount: number;
|
|
13
14
|
isPercent: boolean;
|
|
14
15
|
label: string;
|
|
15
|
-
|
|
16
|
+
internalId?: string;
|
|
16
17
|
timestamp: string;
|
|
17
18
|
}
|
|
18
19
|
export type AddProductDiscount = (params?: AddProductDiscountParams) => Promise<AddProductDiscountResponse>;
|
|
@@ -3,8 +3,8 @@ export const mockAddProductFee = async (params) => {
|
|
|
3
3
|
console.log("[Mock] addProductFee called", params);
|
|
4
4
|
if (params) {
|
|
5
5
|
let item = null;
|
|
6
|
-
if (params.
|
|
7
|
-
item = MOCK_CART.products.find(p => p.internalId === params.
|
|
6
|
+
if (params.internalId) {
|
|
7
|
+
item = MOCK_CART.products.find(p => p.internalId === params.internalId);
|
|
8
8
|
}
|
|
9
9
|
else if (MOCK_CART.products.length > 0) {
|
|
10
10
|
item = MOCK_CART.products[MOCK_CART.products.length - 1];
|
|
@@ -24,7 +24,7 @@ export const mockAddProductFee = async (params) => {
|
|
|
24
24
|
isPercent: params?.isPercent || false,
|
|
25
25
|
label: params?.label || "",
|
|
26
26
|
applyTaxes: params?.applyTaxes || false,
|
|
27
|
-
|
|
27
|
+
internalId: params?.internalId,
|
|
28
28
|
timestamp: new Date().toISOString()
|
|
29
29
|
};
|
|
30
30
|
};
|
|
@@ -7,7 +7,8 @@ export interface AddProductFeeParams {
|
|
|
7
7
|
/** Defaults to `false`. */
|
|
8
8
|
applyTaxes?: boolean;
|
|
9
9
|
taxTableId?: string;
|
|
10
|
-
|
|
10
|
+
/** The unique identifier for a specific line item in the cart. */
|
|
11
|
+
internalId?: string;
|
|
11
12
|
}
|
|
12
13
|
export interface AddProductFeeResponse {
|
|
13
14
|
success: boolean;
|
|
@@ -15,7 +16,7 @@ export interface AddProductFeeResponse {
|
|
|
15
16
|
isPercent: boolean;
|
|
16
17
|
label: string;
|
|
17
18
|
applyTaxes: boolean;
|
|
18
|
-
|
|
19
|
+
internalId?: string;
|
|
19
20
|
timestamp: string;
|
|
20
21
|
}
|
|
21
22
|
export type AddProductFee = (params?: AddProductFeeParams) => Promise<AddProductFeeResponse>;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { MOCK_CART } from "../../demo/database";
|
|
2
2
|
export const mockAddProductNote = async (params) => {
|
|
3
3
|
console.log("[Mock] addProductNote called", params);
|
|
4
|
-
if (params?.note && params.
|
|
5
|
-
const item = MOCK_CART.products.find(p => p.internalId === params.
|
|
4
|
+
if (params?.note && params.internalId) {
|
|
5
|
+
const item = MOCK_CART.products.find(p => p.internalId === params.internalId);
|
|
6
6
|
if (item) {
|
|
7
7
|
item.note = params.note;
|
|
8
8
|
}
|
|
@@ -14,7 +14,7 @@ export const mockAddProductNote = async (params) => {
|
|
|
14
14
|
return {
|
|
15
15
|
success: true,
|
|
16
16
|
note: params?.note || "",
|
|
17
|
-
|
|
17
|
+
internalId: params?.internalId,
|
|
18
18
|
timestamp: new Date().toISOString()
|
|
19
19
|
};
|
|
20
20
|
};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
export interface AddProductNoteParams {
|
|
2
2
|
note: string;
|
|
3
|
-
/** The
|
|
4
|
-
|
|
3
|
+
/** The unique identifier for a specific line item in the cart. If not provided, it may attempt to modify the active product context. */
|
|
4
|
+
internalId?: string;
|
|
5
5
|
}
|
|
6
6
|
export interface AddProductNoteResponse {
|
|
7
7
|
success: boolean;
|
|
8
8
|
note: string;
|
|
9
|
-
|
|
9
|
+
internalId?: string;
|
|
10
10
|
timestamp: string;
|
|
11
11
|
}
|
|
12
12
|
export type AddProductNote = (params?: AddProductNoteParams) => Promise<AddProductNoteResponse>;
|
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 {};
|