@final-commerce/command-frame 0.0.1
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/LICENSE +22 -0
- package/README.md +418 -0
- package/dist/actions/add-cart-discount/action.d.ts +6 -0
- package/dist/actions/add-cart-discount/action.js +8 -0
- package/dist/actions/add-cart-discount/types.d.ts +13 -0
- package/dist/actions/add-cart-discount/types.js +1 -0
- package/dist/actions/add-cart-fee/action.d.ts +6 -0
- package/dist/actions/add-cart-fee/action.js +8 -0
- package/dist/actions/add-cart-fee/types.d.ts +16 -0
- package/dist/actions/add-cart-fee/types.js +1 -0
- package/dist/actions/add-custom-sale/action.d.ts +6 -0
- package/dist/actions/add-custom-sale/action.js +8 -0
- package/dist/actions/add-custom-sale/types.d.ts +13 -0
- package/dist/actions/add-custom-sale/types.js +1 -0
- package/dist/actions/add-customer/action.d.ts +6 -0
- package/dist/actions/add-customer/action.js +8 -0
- package/dist/actions/add-customer/types.d.ts +9 -0
- package/dist/actions/add-customer/types.js +1 -0
- package/dist/actions/add-customer-note/action.d.ts +6 -0
- package/dist/actions/add-customer-note/action.js +8 -0
- package/dist/actions/add-customer-note/types.d.ts +11 -0
- package/dist/actions/add-customer-note/types.js +1 -0
- package/dist/actions/add-order-note/action.d.ts +6 -0
- package/dist/actions/add-order-note/action.js +8 -0
- package/dist/actions/add-order-note/types.d.ts +9 -0
- package/dist/actions/add-order-note/types.js +1 -0
- package/dist/actions/add-product-discount/action.d.ts +6 -0
- package/dist/actions/add-product-discount/action.js +8 -0
- package/dist/actions/add-product-discount/types.d.ts +13 -0
- package/dist/actions/add-product-discount/types.js +1 -0
- package/dist/actions/add-product-fee/action.d.ts +6 -0
- package/dist/actions/add-product-fee/action.js +8 -0
- package/dist/actions/add-product-fee/types.d.ts +16 -0
- package/dist/actions/add-product-fee/types.js +1 -0
- package/dist/actions/add-product-note/action.d.ts +6 -0
- package/dist/actions/add-product-note/action.js +8 -0
- package/dist/actions/add-product-note/types.d.ts +9 -0
- package/dist/actions/add-product-note/types.js +1 -0
- package/dist/actions/add-product-to-cart/action.d.ts +6 -0
- package/dist/actions/add-product-to-cart/action.js +8 -0
- package/dist/actions/add-product-to-cart/types.d.ts +12 -0
- package/dist/actions/add-product-to-cart/types.js +1 -0
- package/dist/actions/adjust-inventory/action.d.ts +6 -0
- package/dist/actions/adjust-inventory/action.js +8 -0
- package/dist/actions/adjust-inventory/types.d.ts +12 -0
- package/dist/actions/adjust-inventory/types.js +1 -0
- package/dist/actions/assign-customer/action.d.ts +6 -0
- package/dist/actions/assign-customer/action.js +8 -0
- package/dist/actions/assign-customer/types.d.ts +9 -0
- package/dist/actions/assign-customer/types.js +1 -0
- package/dist/actions/authenticate-user/action.d.ts +6 -0
- package/dist/actions/authenticate-user/action.js +8 -0
- package/dist/actions/authenticate-user/types.d.ts +9 -0
- package/dist/actions/authenticate-user/types.js +1 -0
- package/dist/actions/calculate-refund-total/action.d.ts +6 -0
- package/dist/actions/calculate-refund-total/action.js +8 -0
- package/dist/actions/calculate-refund-total/types.d.ts +12 -0
- package/dist/actions/calculate-refund-total/types.js +1 -0
- package/dist/actions/cash-payment/action.d.ts +6 -0
- package/dist/actions/cash-payment/action.js +8 -0
- package/dist/actions/cash-payment/types.d.ts +13 -0
- package/dist/actions/cash-payment/types.js +1 -0
- package/dist/actions/clear-cart/action.d.ts +6 -0
- package/dist/actions/clear-cart/action.js +8 -0
- package/dist/actions/clear-cart/types.d.ts +5 -0
- package/dist/actions/clear-cart/types.js +1 -0
- package/dist/actions/delete-parked-order/action.d.ts +6 -0
- package/dist/actions/delete-parked-order/action.js +8 -0
- package/dist/actions/delete-parked-order/types.d.ts +9 -0
- package/dist/actions/delete-parked-order/types.js +1 -0
- package/dist/actions/example-function/action.d.ts +6 -0
- package/dist/actions/example-function/action.js +8 -0
- package/dist/actions/example-function/types.d.ts +16 -0
- package/dist/actions/example-function/types.js +1 -0
- package/dist/actions/get-categories/action.d.ts +6 -0
- package/dist/actions/get-categories/action.js +8 -0
- package/dist/actions/get-categories/types.d.ts +16 -0
- package/dist/actions/get-categories/types.js +1 -0
- package/dist/actions/get-context/action.d.ts +6 -0
- package/dist/actions/get-context/action.js +8 -0
- package/dist/actions/get-context/types.d.ts +17 -0
- package/dist/actions/get-context/types.js +1 -0
- package/dist/actions/get-current-cart/action.d.ts +6 -0
- package/dist/actions/get-current-cart/action.js +8 -0
- package/dist/actions/get-current-cart/types.d.ts +6 -0
- package/dist/actions/get-current-cart/types.js +1 -0
- package/dist/actions/get-customers/action.d.ts +6 -0
- package/dist/actions/get-customers/action.js +8 -0
- package/dist/actions/get-customers/types.d.ts +31 -0
- package/dist/actions/get-customers/types.js +1 -0
- package/dist/actions/get-line-items-by-order/action.d.ts +6 -0
- package/dist/actions/get-line-items-by-order/action.js +8 -0
- package/dist/actions/get-line-items-by-order/types.d.ts +13 -0
- package/dist/actions/get-line-items-by-order/types.js +1 -0
- package/dist/actions/get-orders/action.d.ts +6 -0
- package/dist/actions/get-orders/action.js +8 -0
- package/dist/actions/get-orders/types.d.ts +17 -0
- package/dist/actions/get-orders/types.js +1 -0
- package/dist/actions/get-product-variants/action.d.ts +6 -0
- package/dist/actions/get-product-variants/action.js +8 -0
- package/dist/actions/get-product-variants/types.d.ts +9 -0
- package/dist/actions/get-product-variants/types.js +1 -0
- package/dist/actions/get-products/action.d.ts +6 -0
- package/dist/actions/get-products/action.js +8 -0
- package/dist/actions/get-products/types.d.ts +28 -0
- package/dist/actions/get-products/types.js +1 -0
- package/dist/actions/get-refunds/action.d.ts +6 -0
- package/dist/actions/get-refunds/action.js +8 -0
- package/dist/actions/get-refunds/types.d.ts +16 -0
- package/dist/actions/get-refunds/types.js +1 -0
- package/dist/actions/get-remaining-refundable-quantities/action.d.ts +6 -0
- package/dist/actions/get-remaining-refundable-quantities/action.js +8 -0
- package/dist/actions/get-remaining-refundable-quantities/types.d.ts +7 -0
- package/dist/actions/get-remaining-refundable-quantities/types.js +1 -0
- package/dist/actions/go-to-page/action.d.ts +6 -0
- package/dist/actions/go-to-page/action.js +8 -0
- package/dist/actions/go-to-page/types.d.ts +9 -0
- package/dist/actions/go-to-page/types.js +1 -0
- package/dist/actions/go-to-station-home/action.d.ts +6 -0
- package/dist/actions/go-to-station-home/action.js +8 -0
- package/dist/actions/go-to-station-home/types.d.ts +5 -0
- package/dist/actions/go-to-station-home/types.js +1 -0
- package/dist/actions/initiate-refund/action.d.ts +6 -0
- package/dist/actions/initiate-refund/action.js +8 -0
- package/dist/actions/initiate-refund/types.d.ts +9 -0
- package/dist/actions/initiate-refund/types.js +1 -0
- package/dist/actions/open-cash-drawer/action.d.ts +6 -0
- package/dist/actions/open-cash-drawer/action.js +8 -0
- package/dist/actions/open-cash-drawer/types.d.ts +5 -0
- package/dist/actions/open-cash-drawer/types.js +1 -0
- package/dist/actions/open-popup/action.d.ts +6 -0
- package/dist/actions/open-popup/action.js +8 -0
- package/dist/actions/open-popup/types.d.ts +9 -0
- package/dist/actions/open-popup/types.js +1 -0
- package/dist/actions/park-order/action.d.ts +6 -0
- package/dist/actions/park-order/action.js +8 -0
- package/dist/actions/park-order/types.d.ts +6 -0
- package/dist/actions/park-order/types.js +1 -0
- package/dist/actions/partial-payment/action.d.ts +6 -0
- package/dist/actions/partial-payment/action.js +8 -0
- package/dist/actions/partial-payment/types.d.ts +14 -0
- package/dist/actions/partial-payment/types.js +1 -0
- package/dist/actions/process-partial-refund/action.d.ts +6 -0
- package/dist/actions/process-partial-refund/action.js +8 -0
- package/dist/actions/process-partial-refund/types.d.ts +9 -0
- package/dist/actions/process-partial-refund/types.js +1 -0
- package/dist/actions/remove-customer-from-cart/action.d.ts +6 -0
- package/dist/actions/remove-customer-from-cart/action.js +8 -0
- package/dist/actions/remove-customer-from-cart/types.d.ts +5 -0
- package/dist/actions/remove-customer-from-cart/types.js +1 -0
- package/dist/actions/reset-refund-details/action.d.ts +6 -0
- package/dist/actions/reset-refund-details/action.js +8 -0
- package/dist/actions/reset-refund-details/types.d.ts +5 -0
- package/dist/actions/reset-refund-details/types.js +1 -0
- package/dist/actions/resume-parked-order/action.d.ts +6 -0
- package/dist/actions/resume-parked-order/action.js +8 -0
- package/dist/actions/resume-parked-order/types.d.ts +9 -0
- package/dist/actions/resume-parked-order/types.js +1 -0
- package/dist/actions/select-all-refund-items/action.d.ts +6 -0
- package/dist/actions/select-all-refund-items/action.js +8 -0
- package/dist/actions/select-all-refund-items/types.d.ts +6 -0
- package/dist/actions/select-all-refund-items/types.js +1 -0
- package/dist/actions/set-product-active/action.d.ts +6 -0
- package/dist/actions/set-product-active/action.js +8 -0
- package/dist/actions/set-product-active/types.d.ts +9 -0
- package/dist/actions/set-product-active/types.js +1 -0
- package/dist/actions/set-refund-stock-action/action.d.ts +6 -0
- package/dist/actions/set-refund-stock-action/action.js +8 -0
- package/dist/actions/set-refund-stock-action/types.d.ts +11 -0
- package/dist/actions/set-refund-stock-action/types.js +1 -0
- package/dist/actions/show-confirmation/action.d.ts +6 -0
- package/dist/actions/show-confirmation/action.js +8 -0
- package/dist/actions/show-confirmation/types.d.ts +9 -0
- package/dist/actions/show-confirmation/types.js +1 -0
- package/dist/actions/show-notification/action.d.ts +6 -0
- package/dist/actions/show-notification/action.js +8 -0
- package/dist/actions/show-notification/types.d.ts +9 -0
- package/dist/actions/show-notification/types.js +1 -0
- package/dist/actions/switch-user/action.d.ts +6 -0
- package/dist/actions/switch-user/action.js +8 -0
- package/dist/actions/switch-user/types.d.ts +13 -0
- package/dist/actions/switch-user/types.js +1 -0
- package/dist/actions/tap-to-pay-payment/action.d.ts +6 -0
- package/dist/actions/tap-to-pay-payment/action.js +8 -0
- package/dist/actions/tap-to-pay-payment/types.d.ts +11 -0
- package/dist/actions/tap-to-pay-payment/types.js +1 -0
- package/dist/actions/terminal-payment/action.d.ts +6 -0
- package/dist/actions/terminal-payment/action.js +8 -0
- package/dist/actions/terminal-payment/types.d.ts +11 -0
- package/dist/actions/terminal-payment/types.js +1 -0
- package/dist/actions/toggle-slide-out/action.d.ts +6 -0
- package/dist/actions/toggle-slide-out/action.js +8 -0
- package/dist/actions/toggle-slide-out/types.d.ts +9 -0
- package/dist/actions/toggle-slide-out/types.js +1 -0
- package/dist/actions/trigger-webhook/action.d.ts +6 -0
- package/dist/actions/trigger-webhook/action.js +8 -0
- package/dist/actions/trigger-webhook/types.d.ts +16 -0
- package/dist/actions/trigger-webhook/types.js +1 -0
- package/dist/actions/trigger-zapier-webhook/action.d.ts +6 -0
- package/dist/actions/trigger-zapier-webhook/action.js +8 -0
- package/dist/actions/trigger-zapier-webhook/types.d.ts +9 -0
- package/dist/actions/trigger-zapier-webhook/types.js +1 -0
- package/dist/actions/update-customer-facing-display/action.d.ts +6 -0
- package/dist/actions/update-customer-facing-display/action.js +8 -0
- package/dist/actions/update-customer-facing-display/types.d.ts +9 -0
- package/dist/actions/update-customer-facing-display/types.js +1 -0
- package/dist/actions/vendara-payment/action.d.ts +6 -0
- package/dist/actions/vendara-payment/action.js +8 -0
- package/dist/actions/vendara-payment/types.d.ts +11 -0
- package/dist/actions/vendara-payment/types.js +1 -0
- package/dist/client.d.ts +33 -0
- package/dist/client.js +145 -0
- package/dist/index.d.ts +108 -0
- package/dist/index.js +121 -0
- package/dist/types.d.ts +64 -0
- package/dist/types.js +1 -0
- package/package.json +48 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Final Commerce
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
22
|
+
|
package/README.md
ADDED
|
@@ -0,0 +1,418 @@
|
|
|
1
|
+
# @final-commerce/command-frame
|
|
2
|
+
|
|
3
|
+
A TypeScript library for communication between iframes and their parent windows using postMessage with type safety and error handling.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @final-commerce/command-frame
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
This package is available on the public NPM registry.
|
|
12
|
+
|
|
13
|
+
## Table of Contents
|
|
14
|
+
|
|
15
|
+
- [API Overview](#api-overview)
|
|
16
|
+
- [Quick Start](#quick-start)
|
|
17
|
+
- [Actions Documentation](#actions-documentation)
|
|
18
|
+
- [Examples](#examples)
|
|
19
|
+
- [Debugging](#debugging)
|
|
20
|
+
- [Type Safety](#type-safety)
|
|
21
|
+
- [License](#license)
|
|
22
|
+
|
|
23
|
+
## API Overview
|
|
24
|
+
|
|
25
|
+
The library provides a `command` namespace object containing all available actions. Each action is a typed function that communicates with the parent window via postMessage.
|
|
26
|
+
|
|
27
|
+
### Available Actions
|
|
28
|
+
|
|
29
|
+
#### Data Retrieval
|
|
30
|
+
- **[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
|
|
31
|
+
- **[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
|
|
32
|
+
- **[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
|
|
33
|
+
- **[getProductVariants](https://github.com/Final-Commerce/command-frame/blob/main/src/actions/get-product-variants/README.md)** - Retrieve all variants for a specific product
|
|
34
|
+
- **[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)
|
|
35
|
+
|
|
36
|
+
#### Product Actions
|
|
37
|
+
- **[setProductActive](https://github.com/Final-Commerce/command-frame/blob/main/src/actions/set-product-active/README.md)** - Set a product variant as the active product
|
|
38
|
+
- **[addProductDiscount](https://github.com/Final-Commerce/command-frame/blob/main/src/actions/add-product-discount/README.md)** - Add a discount to the currently active product
|
|
39
|
+
- **[addProductToCart](https://github.com/Final-Commerce/command-frame/blob/main/src/actions/add-product-to-cart/README.md)** - Add the currently active product to the cart
|
|
40
|
+
- **[addProductNote](https://github.com/Final-Commerce/command-frame/blob/main/src/actions/add-product-note/README.md)** - Add a note to the currently active product
|
|
41
|
+
- **[addProductFee](https://github.com/Final-Commerce/command-frame/blob/main/src/actions/add-product-fee/README.md)** - Add a fee to the currently active product
|
|
42
|
+
- **[adjustInventory](https://github.com/Final-Commerce/command-frame/blob/main/src/actions/adjust-inventory/README.md)** - Adjust inventory/stock level for the currently active product
|
|
43
|
+
|
|
44
|
+
#### Order Actions
|
|
45
|
+
- **[addCustomSale](https://github.com/Final-Commerce/command-frame/blob/main/src/actions/add-custom-sale/README.md)** - Add a custom sale item to the cart
|
|
46
|
+
- **[addCartDiscount](https://github.com/Final-Commerce/command-frame/blob/main/src/actions/add-cart-discount/README.md)** - Add a discount to the entire cart
|
|
47
|
+
- **[addOrderNote](https://github.com/Final-Commerce/command-frame/blob/main/src/actions/add-order-note/README.md)** - Add a note to the current order/cart
|
|
48
|
+
- **[addCartFee](https://github.com/Final-Commerce/command-frame/blob/main/src/actions/add-cart-fee/README.md)** - Add a fee to the entire cart
|
|
49
|
+
- **[clearCart](https://github.com/Final-Commerce/command-frame/blob/main/src/actions/clear-cart/README.md)** - Clear all items from the current cart
|
|
50
|
+
- **[parkOrder](https://github.com/Final-Commerce/command-frame/blob/main/src/actions/park-order/README.md)** - Park (save) the current order for later retrieval
|
|
51
|
+
- **[resumeParkedOrder](https://github.com/Final-Commerce/command-frame/blob/main/src/actions/resume-parked-order/README.md)** - Resume a previously parked order
|
|
52
|
+
- **[deleteParkedOrder](https://github.com/Final-Commerce/command-frame/blob/main/src/actions/delete-parked-order/README.md)** - Delete a parked order
|
|
53
|
+
- **[reorderActiveOrder](https://github.com/Final-Commerce/command-frame/blob/main/src/actions/reorder-active-order/README.md)** - Reorder items from the currently active order into the cart
|
|
54
|
+
- **[initiateRefund](https://github.com/Final-Commerce/command-frame/blob/main/src/actions/initiate-refund/README.md)** - Open the refund UI for an order
|
|
55
|
+
- **[cashPayment](https://github.com/Final-Commerce/command-frame/blob/main/src/actions/cash-payment/README.md)** - Initiate a cash payment
|
|
56
|
+
- **[tapToPayPayment](https://github.com/Final-Commerce/command-frame/blob/main/src/actions/tap-to-pay-payment/README.md)** - Initiate a tap-to-pay payment
|
|
57
|
+
- **[terminalPayment](https://github.com/Final-Commerce/command-frame/blob/main/src/actions/terminal-payment/README.md)** - Initiate a terminal payment
|
|
58
|
+
- **[vendaraPayment](https://github.com/Final-Commerce/command-frame/blob/main/src/actions/vendara-payment/README.md)** - Initiate a Vendara payment
|
|
59
|
+
- **[partialPayment](https://github.com/Final-Commerce/command-frame/blob/main/src/actions/partial-payment/README.md)** - Initiate a partial/split payment
|
|
60
|
+
|
|
61
|
+
#### Customer Actions
|
|
62
|
+
- **[addCustomer](https://github.com/Final-Commerce/command-frame/blob/main/src/actions/add-customer/README.md)** - Add a new customer to the local database
|
|
63
|
+
- **[assignCustomer](https://github.com/Final-Commerce/command-frame/blob/main/src/actions/assign-customer/README.md)** - Assign an existing customer to the current session/cart
|
|
64
|
+
- **[addCustomerNote](https://github.com/Final-Commerce/command-frame/blob/main/src/actions/add-customer-note/README.md)** - Add a note to a customer's record
|
|
65
|
+
- **[removeCustomerFromCart](https://github.com/Final-Commerce/command-frame/blob/main/src/actions/remove-customer-from-cart/README.md)** - Remove the currently assigned customer from the cart
|
|
66
|
+
|
|
67
|
+
#### System Actions
|
|
68
|
+
- **[goToStationHome](https://github.com/Final-Commerce/command-frame/blob/main/src/actions/go-to-station-home/README.md)** - Navigate to the station home page
|
|
69
|
+
- **[goToPage](https://github.com/Final-Commerce/command-frame/blob/main/src/actions/go-to-page/README.md)** - Navigate to a specific page
|
|
70
|
+
- **[openCashDrawer](https://github.com/Final-Commerce/command-frame/blob/main/src/actions/open-cash-drawer/README.md)** - Open the cash drawer
|
|
71
|
+
- **[openPopup](https://github.com/Final-Commerce/command-frame/blob/main/src/actions/open-popup/README.md)** - Open a popup/modal by ID
|
|
72
|
+
- **[showNotification](https://github.com/Final-Commerce/command-frame/blob/main/src/actions/show-notification/README.md)** - Show a notification message
|
|
73
|
+
- **[toggleSlideOut](https://github.com/Final-Commerce/command-frame/blob/main/src/actions/toggle-slide-out/README.md)** - Toggle a slide-out panel
|
|
74
|
+
- **[showConfirmation](https://github.com/Final-Commerce/command-frame/blob/main/src/actions/show-confirmation/README.md)** - Show a confirmation dialog
|
|
75
|
+
- **[authenticateUser](https://github.com/Final-Commerce/command-frame/blob/main/src/actions/authenticate-user/README.md)** - Trigger user authentication for specific roles
|
|
76
|
+
- **[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
|
|
77
|
+
- **[switchUser](https://github.com/Final-Commerce/command-frame/blob/main/src/actions/switch-user/README.md)** - Switch the current user to a different user
|
|
78
|
+
|
|
79
|
+
#### Integration Actions
|
|
80
|
+
- **[triggerWebhook](https://github.com/Final-Commerce/command-frame/blob/main/src/actions/trigger-webhook/README.md)** - Trigger a webhook with the specified configuration
|
|
81
|
+
- **[triggerZapierWebhook](https://github.com/Final-Commerce/command-frame/blob/main/src/actions/trigger-zapier-webhook/README.md)** - Trigger a Zapier webhook with the current context data
|
|
82
|
+
|
|
83
|
+
#### Reference
|
|
84
|
+
- **[exampleFunction](https://github.com/Final-Commerce/command-frame/blob/main/src/actions/example-function/README.md)** - Example/template function (for reference only)
|
|
85
|
+
|
|
86
|
+
For detailed documentation on each action, including parameter descriptions, response structures, and usage examples, see the [Actions Documentation](#actions-documentation) section below.
|
|
87
|
+
|
|
88
|
+
## Quick Start
|
|
89
|
+
|
|
90
|
+
```typescript
|
|
91
|
+
import { command } from '@final-commerce/command-frame';
|
|
92
|
+
|
|
93
|
+
// Get products from parent window
|
|
94
|
+
const products = await command.getProducts();
|
|
95
|
+
|
|
96
|
+
// Get customers from parent window
|
|
97
|
+
const customers = await command.getCustomers();
|
|
98
|
+
|
|
99
|
+
// Get categories from parent window
|
|
100
|
+
const categories = await command.getCategories();
|
|
101
|
+
|
|
102
|
+
// Get variants for a product
|
|
103
|
+
const variants = await command.getProductVariants({
|
|
104
|
+
productId: '691df9c6c478bada1fb23d31'
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
// Set a variant as active, add discount, then add to cart
|
|
108
|
+
await command.setProductActive({
|
|
109
|
+
variantId: '691df9c6c478bada1fb23d55'
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
await command.addProductDiscount({
|
|
113
|
+
amount: 10,
|
|
114
|
+
isPercent: false,
|
|
115
|
+
label: 'Discount'
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
await command.addProductToCart({
|
|
119
|
+
quantity: 1
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
// Add cart discount
|
|
123
|
+
await command.addCartDiscount({
|
|
124
|
+
amount: 10,
|
|
125
|
+
isPercent: false,
|
|
126
|
+
label: 'Cart Discount'
|
|
127
|
+
});
|
|
128
|
+
|
|
129
|
+
// Get current context/environment
|
|
130
|
+
const context = await command.getContext();
|
|
131
|
+
console.log('Current user:', context.userId);
|
|
132
|
+
console.log('Current company:', context.companyName);
|
|
133
|
+
console.log('Current build:', context.buildName);
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
For complete usage examples and detailed parameter descriptions, see the documentation for each action in the [Actions Documentation](#actions-documentation) section.
|
|
137
|
+
|
|
138
|
+
## Actions Documentation
|
|
139
|
+
|
|
140
|
+
Each action has detailed documentation with complete parameter descriptions, response structures, and multiple usage examples:
|
|
141
|
+
|
|
142
|
+
### [getCustomers](https://github.com/Final-Commerce/command-frame/blob/main/src/actions/get-customers/README.md)
|
|
143
|
+
|
|
144
|
+
Retrieves a list of customers from the parent application's local database. Supports MongoDB query syntax for filtering, text search across name/email/phone fields, and pagination.
|
|
145
|
+
|
|
146
|
+
### [getProducts](https://github.com/Final-Commerce/command-frame/blob/main/src/actions/get-products/README.md)
|
|
147
|
+
|
|
148
|
+
Retrieves a list of products from the parent application's local database. Supports filtering by name, SKU, status, product type, categories, tags, and more.
|
|
149
|
+
|
|
150
|
+
### [addCustomer](https://github.com/Final-Commerce/command-frame/blob/main/src/actions/add-customer/README.md)
|
|
151
|
+
|
|
152
|
+
Adds a new customer to the local database in the parent application. Supports full customer structure including addresses, metadata, notes, and tags.
|
|
153
|
+
|
|
154
|
+
### [assignCustomer](https://github.com/Final-Commerce/command-frame/blob/main/src/actions/assign-customer/README.md)
|
|
155
|
+
|
|
156
|
+
Assigns an existing customer to the current active session/cart. The customer must exist in the local database.
|
|
157
|
+
|
|
158
|
+
### [getCategories](https://github.com/Final-Commerce/command-frame/blob/main/src/actions/get-categories/README.md)
|
|
159
|
+
|
|
160
|
+
Retrieves a list of categories from the parent application's local database. Supports filtering by name, parent ID, and external ID.
|
|
161
|
+
|
|
162
|
+
### [getProductVariants](https://github.com/Final-Commerce/command-frame/blob/main/src/actions/get-product-variants/README.md)
|
|
163
|
+
|
|
164
|
+
Retrieves all variants for a specific product from the parent application's local database. Useful for displaying variant options or selecting a specific variant.
|
|
165
|
+
|
|
166
|
+
### [addCustomSale](https://github.com/Final-Commerce/command-frame/blob/main/src/actions/add-custom-sale/README.md)
|
|
167
|
+
|
|
168
|
+
Adds a custom sale item to the cart in the parent window. Useful for adding non-product items like service fees, discounts, or custom charges.
|
|
169
|
+
|
|
170
|
+
### [setProductActive](https://github.com/Final-Commerce/command-frame/blob/main/src/actions/set-product-active/README.md)
|
|
171
|
+
|
|
172
|
+
Sets a product variant as the active product in the parent application. Required before adding discounts or adding products to cart.
|
|
173
|
+
|
|
174
|
+
### [addProductDiscount](https://github.com/Final-Commerce/command-frame/blob/main/src/actions/add-product-discount/README.md)
|
|
175
|
+
|
|
176
|
+
Adds a discount to the currently active product. Supports both fixed amount and percentage discounts. The product must be set as active first.
|
|
177
|
+
|
|
178
|
+
### [addProductToCart](https://github.com/Final-Commerce/command-frame/blob/main/src/actions/add-product-to-cart/README.md)
|
|
179
|
+
|
|
180
|
+
Adds the currently active product to the cart. Supports specifying quantity. The product must be set as active first.
|
|
181
|
+
|
|
182
|
+
### [addCartDiscount](https://github.com/Final-Commerce/command-frame/blob/main/src/actions/add-cart-discount/README.md)
|
|
183
|
+
|
|
184
|
+
Adds a discount to the entire cart. Supports both fixed amount and percentage discounts. Applies to the cart subtotal and affects all items.
|
|
185
|
+
|
|
186
|
+
### [getContext](https://github.com/Final-Commerce/command-frame/blob/main/src/actions/get-context/README.md)
|
|
187
|
+
|
|
188
|
+
Retrieves the current environment/context information from the parent application. Returns user, company, device, station, outlet, and build information including IDs, names, and other relevant details.
|
|
189
|
+
|
|
190
|
+
### Product Actions
|
|
191
|
+
|
|
192
|
+
### [addProductNote](https://github.com/Final-Commerce/command-frame/blob/main/src/actions/add-product-note/README.md)
|
|
193
|
+
|
|
194
|
+
Adds a note to the currently active product in the cart. Requires a product to be set as active first.
|
|
195
|
+
|
|
196
|
+
### [addProductFee](https://github.com/Final-Commerce/command-frame/blob/main/src/actions/add-product-fee/README.md)
|
|
197
|
+
|
|
198
|
+
Adds a fee to the currently active product. Supports both fixed amount and percentage-based fees. Requires a product to be set as active first.
|
|
199
|
+
|
|
200
|
+
### [adjustInventory](https://github.com/Final-Commerce/command-frame/blob/main/src/actions/adjust-inventory/README.md)
|
|
201
|
+
|
|
202
|
+
Adjusts the inventory/stock level for the currently active product. Supports adding, subtracting, or setting stock to a specific value.
|
|
203
|
+
|
|
204
|
+
### Order Actions
|
|
205
|
+
|
|
206
|
+
### [addOrderNote](https://github.com/Final-Commerce/command-frame/blob/main/src/actions/add-order-note/README.md)
|
|
207
|
+
|
|
208
|
+
Adds a note to the current order/cart.
|
|
209
|
+
|
|
210
|
+
### [addCartFee](https://github.com/Final-Commerce/command-frame/blob/main/src/actions/add-cart-fee/README.md)
|
|
211
|
+
|
|
212
|
+
Adds a fee to the entire cart. Supports both fixed amount and percentage-based fees.
|
|
213
|
+
|
|
214
|
+
### [clearCart](https://github.com/Final-Commerce/command-frame/blob/main/src/actions/clear-cart/README.md)
|
|
215
|
+
|
|
216
|
+
Clears all items from the current cart and resets cart-related state.
|
|
217
|
+
|
|
218
|
+
### [parkOrder](https://github.com/Final-Commerce/command-frame/blob/main/src/actions/park-order/README.md)
|
|
219
|
+
|
|
220
|
+
Parks (saves) the current order for later retrieval. The cart is cleared after parking.
|
|
221
|
+
|
|
222
|
+
### [resumeParkedOrder](https://github.com/Final-Commerce/command-frame/blob/main/src/actions/resume-parked-order/README.md)
|
|
223
|
+
|
|
224
|
+
Resumes a previously parked order by loading it back into the cart.
|
|
225
|
+
|
|
226
|
+
### [deleteParkedOrder](https://github.com/Final-Commerce/command-frame/blob/main/src/actions/delete-parked-order/README.md)
|
|
227
|
+
|
|
228
|
+
Deletes a parked order from the system.
|
|
229
|
+
|
|
230
|
+
### [reorderActiveOrder](https://github.com/Final-Commerce/command-frame/blob/main/src/actions/reorder-active-order/README.md)
|
|
231
|
+
|
|
232
|
+
Reorders the items from the currently active order into the cart. Products that are out of stock will not be added.
|
|
233
|
+
|
|
234
|
+
### [initiateRefund](https://github.com/Final-Commerce/command-frame/blob/main/src/actions/initiate-refund/README.md)
|
|
235
|
+
|
|
236
|
+
Opens the refund UI for the specified order or the currently active order.
|
|
237
|
+
|
|
238
|
+
### [cashPayment](https://github.com/Final-Commerce/command-frame/blob/main/src/actions/cash-payment/README.md)
|
|
239
|
+
|
|
240
|
+
Initiates a cash payment for the current cart. Opens the cash payment UI if change calculation is enabled.
|
|
241
|
+
|
|
242
|
+
### [tapToPayPayment](https://github.com/Final-Commerce/command-frame/blob/main/src/actions/tap-to-pay-payment/README.md)
|
|
243
|
+
|
|
244
|
+
Initiates a tap-to-pay payment for the current cart. May request tip if tip functionality is enabled.
|
|
245
|
+
|
|
246
|
+
### [terminalPayment](https://github.com/Final-Commerce/command-frame/blob/main/src/actions/terminal-payment/README.md)
|
|
247
|
+
|
|
248
|
+
Initiates a terminal payment for the current cart. May request tip if tip functionality is enabled.
|
|
249
|
+
|
|
250
|
+
### [vendaraPayment](https://github.com/Final-Commerce/command-frame/blob/main/src/actions/vendara-payment/README.md)
|
|
251
|
+
|
|
252
|
+
Initiates a Vendara payment for the current cart. May request tip if tip functionality is enabled.
|
|
253
|
+
|
|
254
|
+
### [partialPayment](https://github.com/Final-Commerce/command-frame/blob/main/src/actions/partial-payment/README.md)
|
|
255
|
+
|
|
256
|
+
Initiates a partial/split payment for the current cart. Can open the split payment UI or process a payment with a specified amount.
|
|
257
|
+
|
|
258
|
+
### Customer Actions
|
|
259
|
+
|
|
260
|
+
### [addCustomerNote](https://github.com/Final-Commerce/command-frame/blob/main/src/actions/add-customer-note/README.md)
|
|
261
|
+
|
|
262
|
+
Adds a note to a customer's record. Requires the customer ID.
|
|
263
|
+
|
|
264
|
+
### [removeCustomerFromCart](https://github.com/Final-Commerce/command-frame/blob/main/src/actions/remove-customer-from-cart/README.md)
|
|
265
|
+
|
|
266
|
+
Removes the currently assigned customer from the cart.
|
|
267
|
+
|
|
268
|
+
### System Actions
|
|
269
|
+
|
|
270
|
+
### [goToStationHome](https://github.com/Final-Commerce/command-frame/blob/main/src/actions/go-to-station-home/README.md)
|
|
271
|
+
|
|
272
|
+
Navigates to the station home page.
|
|
273
|
+
|
|
274
|
+
### [goToPage](https://github.com/Final-Commerce/command-frame/blob/main/src/actions/go-to-page/README.md)
|
|
275
|
+
|
|
276
|
+
Navigates to a specific page in the application by page ID.
|
|
277
|
+
|
|
278
|
+
### [openCashDrawer](https://github.com/Final-Commerce/command-frame/blob/main/src/actions/open-cash-drawer/README.md)
|
|
279
|
+
|
|
280
|
+
Opens the cash drawer (if connected to a compatible device).
|
|
281
|
+
|
|
282
|
+
### [openPopup](https://github.com/Final-Commerce/command-frame/blob/main/src/actions/open-popup/README.md)
|
|
283
|
+
|
|
284
|
+
Opens a popup/modal by ID. If the popup is already open, calling this will close it (toggle behavior).
|
|
285
|
+
|
|
286
|
+
### [showNotification](https://github.com/Final-Commerce/command-frame/blob/main/src/actions/show-notification/README.md)
|
|
287
|
+
|
|
288
|
+
Shows a notification message to the user.
|
|
289
|
+
|
|
290
|
+
### [toggleSlideOut](https://github.com/Final-Commerce/command-frame/blob/main/src/actions/toggle-slide-out/README.md)
|
|
291
|
+
|
|
292
|
+
Toggles (opens/closes) a slide-out panel by ID.
|
|
293
|
+
|
|
294
|
+
### [showConfirmation](https://github.com/Final-Commerce/command-frame/blob/main/src/actions/show-confirmation/README.md)
|
|
295
|
+
|
|
296
|
+
Shows a confirmation dialog to the user. The actual promise resolution (accept/decline) is handled by the parent application's handler system.
|
|
297
|
+
|
|
298
|
+
### [authenticateUser](https://github.com/Final-Commerce/command-frame/blob/main/src/actions/authenticate-user/README.md)
|
|
299
|
+
|
|
300
|
+
Triggers user authentication for specific roles. Shows an authentication dialog in the parent application.
|
|
301
|
+
|
|
302
|
+
### [updateCustomerFacingDisplay](https://github.com/Final-Commerce/command-frame/blob/main/src/actions/update-customer-facing-display/README.md)
|
|
303
|
+
|
|
304
|
+
Updates the customer-facing display to show a specific page by page ID.
|
|
305
|
+
|
|
306
|
+
### [switchUser](https://github.com/Final-Commerce/command-frame/blob/main/src/actions/switch-user/README.md)
|
|
307
|
+
|
|
308
|
+
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).
|
|
309
|
+
|
|
310
|
+
### Integration Actions
|
|
311
|
+
|
|
312
|
+
### [triggerWebhook](https://github.com/Final-Commerce/command-frame/blob/main/src/actions/trigger-webhook/README.md)
|
|
313
|
+
|
|
314
|
+
Triggers a webhook with the specified configuration. Supports custom data, authentication, and various payload types.
|
|
315
|
+
|
|
316
|
+
### [triggerZapierWebhook](https://github.com/Final-Commerce/command-frame/blob/main/src/actions/trigger-zapier-webhook/README.md)
|
|
317
|
+
|
|
318
|
+
Triggers a Zapier webhook with the current context data (cart, customer, order, etc.).
|
|
319
|
+
|
|
320
|
+
### Reference
|
|
321
|
+
|
|
322
|
+
### [exampleFunction](https://github.com/Final-Commerce/command-frame/blob/main/src/actions/example-function/README.md)
|
|
323
|
+
|
|
324
|
+
An example/template function for reference. See the documentation for the structure to follow when creating new actions.
|
|
325
|
+
|
|
326
|
+
## Examples
|
|
327
|
+
|
|
328
|
+
See the [example/](https://github.com/Final-Commerce/command-frame/tree/main/example) folder for a working React + Vite demo application that demonstrates how to use this library in a real-world scenario.
|
|
329
|
+
|
|
330
|
+
To run the example:
|
|
331
|
+
|
|
332
|
+
```bash
|
|
333
|
+
cd example
|
|
334
|
+
npm install
|
|
335
|
+
npm run dev
|
|
336
|
+
```
|
|
337
|
+
|
|
338
|
+
## Debugging
|
|
339
|
+
|
|
340
|
+
Enable debug logging by setting the debug flag before importing:
|
|
341
|
+
|
|
342
|
+
```typescript
|
|
343
|
+
(window as any).__POSTMESSAGE_DEBUG__ = true;
|
|
344
|
+
import { command } from '@final-commerce/command-frame';
|
|
345
|
+
```
|
|
346
|
+
|
|
347
|
+
This will log all postMessage communication to the console, including:
|
|
348
|
+
- Request details (action name, parameters, request ID)
|
|
349
|
+
- Response details (success status, data, errors)
|
|
350
|
+
- Timing information
|
|
351
|
+
- Origin validation
|
|
352
|
+
|
|
353
|
+
## Type Safety
|
|
354
|
+
|
|
355
|
+
All actions are fully typed with TypeScript. Import types for use in your code:
|
|
356
|
+
|
|
357
|
+
```typescript
|
|
358
|
+
import type {
|
|
359
|
+
// Data Retrieval
|
|
360
|
+
GetCustomersParams, GetCustomersResponse, GetCustomers,
|
|
361
|
+
GetProductsParams, GetProductsResponse, GetProducts,
|
|
362
|
+
GetCategoriesParams, GetCategoriesResponse, GetCategories,
|
|
363
|
+
GetProductVariantsParams, GetProductVariantsResponse, GetProductVariants,
|
|
364
|
+
GetContext, GetContextResponse,
|
|
365
|
+
// Product Actions
|
|
366
|
+
SetProductActiveParams, SetProductActiveResponse, SetProductActive,
|
|
367
|
+
AddProductDiscountParams, AddProductDiscountResponse, AddProductDiscount,
|
|
368
|
+
AddProductToCartParams, AddProductToCartResponse, AddProductToCart,
|
|
369
|
+
AddProductNoteParams, AddProductNoteResponse, AddProductNote,
|
|
370
|
+
AddProductFeeParams, AddProductFeeResponse, AddProductFee,
|
|
371
|
+
AdjustInventoryParams, AdjustInventoryResponse, AdjustInventory,
|
|
372
|
+
// Order Actions
|
|
373
|
+
AddCustomSaleParams, AddCustomSaleResponse, AddCustomSale,
|
|
374
|
+
AddCartDiscountParams, AddCartDiscountResponse, AddCartDiscount,
|
|
375
|
+
AddOrderNoteParams, AddOrderNoteResponse, AddOrderNote,
|
|
376
|
+
AddCartFeeParams, AddCartFeeResponse, AddCartFee,
|
|
377
|
+
ClearCartResponse, ClearCart,
|
|
378
|
+
ParkOrderResponse, ParkOrder,
|
|
379
|
+
ResumeParkedOrderParams, ResumeParkedOrderResponse, ResumeParkedOrder,
|
|
380
|
+
DeleteParkedOrderParams, DeleteParkedOrderResponse, DeleteParkedOrder,
|
|
381
|
+
ReorderActiveOrderResponse, ReorderActiveOrder,
|
|
382
|
+
InitiateRefundParams, InitiateRefundResponse, InitiateRefund,
|
|
383
|
+
CashPaymentParams, CashPaymentResponse, CashPayment,
|
|
384
|
+
TapToPayPaymentParams, TapToPayPaymentResponse, TapToPayPayment,
|
|
385
|
+
TerminalPaymentParams, TerminalPaymentResponse, TerminalPayment,
|
|
386
|
+
VendaraPaymentParams, VendaraPaymentResponse, VendaraPayment,
|
|
387
|
+
PartialPaymentParams, PartialPaymentResponse, PartialPayment,
|
|
388
|
+
// Customer Actions
|
|
389
|
+
AddCustomerParams, AddCustomerResponse, AddCustomer,
|
|
390
|
+
AssignCustomerParams, AssignCustomerResponse, AssignCustomer,
|
|
391
|
+
AddCustomerNoteParams, AddCustomerNoteResponse, AddCustomerNote,
|
|
392
|
+
RemoveCustomerFromCartResponse, RemoveCustomerFromCart,
|
|
393
|
+
// System Actions
|
|
394
|
+
GoToStationHomeResponse, GoToStationHome,
|
|
395
|
+
GoToPageParams, GoToPageResponse, GoToPage,
|
|
396
|
+
OpenCashDrawerResponse, OpenCashDrawer,
|
|
397
|
+
OpenPopupParams, OpenPopupResponse, OpenPopup,
|
|
398
|
+
ShowNotificationParams, ShowNotificationResponse, ShowNotification,
|
|
399
|
+
ToggleSlideOutParams, ToggleSlideOutResponse, ToggleSlideOut,
|
|
400
|
+
ShowConfirmationParams, ShowConfirmationResponse, ShowConfirmation,
|
|
401
|
+
AuthenticateUserParams, AuthenticateUserResponse, AuthenticateUser,
|
|
402
|
+
UpdateCustomerFacingDisplayParams, UpdateCustomerFacingDisplayResponse, UpdateCustomerFacingDisplay,
|
|
403
|
+
SwitchUserParams, SwitchUserResponse, SwitchUser,
|
|
404
|
+
// Integration Actions
|
|
405
|
+
TriggerWebhookParams, TriggerWebhookResponse, TriggerWebhook,
|
|
406
|
+
TriggerZapierWebhookParams, TriggerZapierWebhookResponse, TriggerZapierWebhook,
|
|
407
|
+
// Reference
|
|
408
|
+
ExampleFunctionParams, ExampleFunctionResponse, ExampleFunction
|
|
409
|
+
} from '@final-commerce/command-frame';
|
|
410
|
+
```
|
|
411
|
+
|
|
412
|
+
**Note:** Entity data (customers, products) is returned as `any[]` or `any` to allow flexibility between different database implementations (MongoDB/mongoose vs LokiJS/IndexedDB). For detailed entity structures, refer to the action-specific documentation in the [Actions Documentation](#actions-documentation) section.
|
|
413
|
+
|
|
414
|
+
## License
|
|
415
|
+
|
|
416
|
+
MIT
|
|
417
|
+
|
|
418
|
+
See [LICENSE](LICENSE) file for details.
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Add cart discount action
|
|
3
|
+
* Calls the addCartDiscount action on the parent window
|
|
4
|
+
*/
|
|
5
|
+
import { commandFrameClient } from "../../client";
|
|
6
|
+
export const addCartDiscount = async (params) => {
|
|
7
|
+
return await commandFrameClient.call("addCartDiscount", params);
|
|
8
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export interface AddCartDiscountParams {
|
|
2
|
+
amount: number;
|
|
3
|
+
isPercent?: boolean;
|
|
4
|
+
label?: string;
|
|
5
|
+
}
|
|
6
|
+
export interface AddCartDiscountResponse {
|
|
7
|
+
success: boolean;
|
|
8
|
+
amount: number;
|
|
9
|
+
isPercent: boolean;
|
|
10
|
+
label: string;
|
|
11
|
+
timestamp: string;
|
|
12
|
+
}
|
|
13
|
+
export type AddCartDiscount = (params?: AddCartDiscountParams) => Promise<AddCartDiscountResponse>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export interface AddCartFeeParams {
|
|
2
|
+
amount: number;
|
|
3
|
+
isPercent?: boolean;
|
|
4
|
+
label?: string;
|
|
5
|
+
applyTaxes?: boolean;
|
|
6
|
+
taxTableId?: string;
|
|
7
|
+
}
|
|
8
|
+
export interface AddCartFeeResponse {
|
|
9
|
+
success: boolean;
|
|
10
|
+
amount: number;
|
|
11
|
+
isPercent: boolean;
|
|
12
|
+
label: string;
|
|
13
|
+
applyTaxes: boolean;
|
|
14
|
+
timestamp: string;
|
|
15
|
+
}
|
|
16
|
+
export type AddCartFee = (params?: AddCartFeeParams) => Promise<AddCartFeeResponse>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export interface AddCustomSaleParams {
|
|
2
|
+
label: string;
|
|
3
|
+
price: number | string;
|
|
4
|
+
applyTaxes?: boolean;
|
|
5
|
+
}
|
|
6
|
+
export interface AddCustomSaleResponse {
|
|
7
|
+
success: boolean;
|
|
8
|
+
label: string;
|
|
9
|
+
price: number;
|
|
10
|
+
applyTaxes: boolean;
|
|
11
|
+
timestamp: string;
|
|
12
|
+
}
|
|
13
|
+
export type AddCustomSale = (params?: AddCustomSaleParams) => Promise<AddCustomSaleResponse>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export interface AddCustomerParams {
|
|
2
|
+
customer: Record<string, any>;
|
|
3
|
+
}
|
|
4
|
+
export interface AddCustomerResponse {
|
|
5
|
+
success: boolean;
|
|
6
|
+
customer: any;
|
|
7
|
+
timestamp: string;
|
|
8
|
+
}
|
|
9
|
+
export type AddCustomer = (params: AddCustomerParams) => Promise<AddCustomerResponse>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Add customer note action
|
|
3
|
+
* Calls the addCustomerNote action on the parent window
|
|
4
|
+
*/
|
|
5
|
+
import { commandFrameClient } from "../../client";
|
|
6
|
+
export const addCustomerNote = async (params) => {
|
|
7
|
+
return await commandFrameClient.call("addCustomerNote", params);
|
|
8
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export interface AddCustomerNoteParams {
|
|
2
|
+
customerId: string;
|
|
3
|
+
note: string;
|
|
4
|
+
}
|
|
5
|
+
export interface AddCustomerNoteResponse {
|
|
6
|
+
success: boolean;
|
|
7
|
+
customerId: string;
|
|
8
|
+
note: string;
|
|
9
|
+
timestamp: string;
|
|
10
|
+
}
|
|
11
|
+
export type AddCustomerNote = (params?: AddCustomerNoteParams) => Promise<AddCustomerNoteResponse>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|