@final-commerce/command-frame 0.1.8 → 0.1.11

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.
Files changed (29) hide show
  1. package/dist/CommonTypes.d.ts +0 -1
  2. package/dist/actions/add-cart-discount/types.d.ts +3 -0
  3. package/dist/actions/add-cart-fee/types.d.ts +4 -0
  4. package/dist/actions/add-customer/types.d.ts +1 -0
  5. package/dist/actions/add-product-discount/types.d.ts +3 -0
  6. package/dist/actions/add-product-fee/types.d.ts +3 -0
  7. package/dist/actions/add-product-note/types.d.ts +1 -0
  8. package/dist/actions/add-product-to-cart/types.d.ts +5 -0
  9. package/dist/actions/adjust-inventory/types.d.ts +2 -0
  10. package/dist/actions/calculate-refund-total/types.d.ts +1 -0
  11. package/dist/actions/cash-payment/types.d.ts +2 -0
  12. package/dist/actions/get-categories/types.d.ts +1 -0
  13. package/dist/actions/get-customers/types.d.ts +3 -0
  14. package/dist/actions/get-line-items-by-order/types.d.ts +1 -0
  15. package/dist/actions/get-orders/types.d.ts +5 -0
  16. package/dist/actions/get-products/types.d.ts +5 -0
  17. package/dist/actions/get-refunds/types.d.ts +4 -0
  18. package/dist/actions/initiate-refund/types.d.ts +1 -0
  19. package/dist/actions/partial-payment/types.d.ts +3 -0
  20. package/dist/actions/process-partial-refund/types.d.ts +4 -0
  21. package/dist/actions/select-all-refund-items/types.d.ts +1 -0
  22. package/dist/actions/set-refund-stock-action/types.d.ts +1 -0
  23. package/dist/actions/switch-user/types.d.ts +2 -0
  24. package/dist/actions/tap-to-pay-payment/types.d.ts +1 -0
  25. package/dist/actions/terminal-payment/types.d.ts +1 -0
  26. package/dist/actions/trigger-webhook/types.d.ts +4 -0
  27. package/dist/actions/vendara-payment/types.d.ts +1 -0
  28. package/dist/demo/database.js +0 -2
  29. package/package.json +1 -1
@@ -125,7 +125,6 @@ export interface CFProduct {
125
125
  variants: CFProductVariant[];
126
126
  minPrice?: string;
127
127
  maxPrice?: string;
128
- price?: string;
129
128
  status?: string;
130
129
  isDeleted?: boolean;
131
130
  }
@@ -1,6 +1,9 @@
1
1
  export interface AddCartDiscountParams {
2
+ /** The discount amount. If isPercent is true, this is a percentage (0-100). */
2
3
  amount: number;
4
+ /** Defaults to `false`. */
3
5
  isPercent?: boolean;
6
+ /** Defaults to "Discount". */
4
7
  label?: string;
5
8
  }
6
9
  export interface AddCartDiscountResponse {
@@ -1,7 +1,11 @@
1
1
  export interface AddCartFeeParams {
2
+ /** The fee amount. If isPercent is true, this is a percentage. */
2
3
  amount: number;
4
+ /** Defaults to `false`. */
3
5
  isPercent?: boolean;
6
+ /** Defaults to "Fee". */
4
7
  label?: string;
8
+ /** Defaults to `false`. */
5
9
  applyTaxes?: boolean;
6
10
  taxTableId?: string;
7
11
  }
@@ -1,5 +1,6 @@
1
1
  import { CFCustomer } from "../../CommonTypes";
2
2
  export interface AddCustomerParams {
3
+ /** Requires all fields except those generated by the server/database. */
3
4
  customer: Omit<CFCustomer, '_id' | 'createdAt' | 'updatedAt'>;
4
5
  }
5
6
  export interface AddCustomerResponse {
@@ -1,6 +1,9 @@
1
1
  export interface AddProductDiscountParams {
2
+ /** The discount amount. If isPercent is true, this is a percentage. */
2
3
  amount: number;
4
+ /** Defaults to `false`. */
3
5
  isPercent?: boolean;
6
+ /** Defaults to "Discount". */
4
7
  label?: string;
5
8
  cartItemId?: string;
6
9
  }
@@ -1,7 +1,10 @@
1
1
  export interface AddProductFeeParams {
2
2
  amount: number;
3
+ /** Defaults to `false`. */
3
4
  isPercent?: boolean;
5
+ /** Defaults to "Fee". */
4
6
  label?: string;
7
+ /** Defaults to `false`. */
5
8
  applyTaxes?: boolean;
6
9
  taxTableId?: string;
7
10
  cartItemId?: string;
@@ -1,5 +1,6 @@
1
1
  export interface AddProductNoteParams {
2
2
  note: string;
3
+ /** The internalId of the cart item to modify. If not provided, it may attempt to modify the active product context. */
3
4
  cartItemId?: string;
4
5
  }
5
6
  export interface AddProductNoteResponse {
@@ -1,10 +1,15 @@
1
1
  import type { AddProductDiscountParams } from "../add-product-discount/types";
2
2
  import type { AddProductFeeParams } from "../add-product-fee/types";
3
3
  export interface AddProductToCartParams {
4
+ /** ID of the variant to add. Optional but recommended. */
4
5
  variantId?: string;
6
+ /** Defaults to 1. */
5
7
  quantity?: number;
8
+ /** Array of discounts to apply immediately. */
6
9
  discounts?: AddProductDiscountParams[];
10
+ /** Array of fees to apply immediately. */
7
11
  fees?: AddProductFeeParams[];
12
+ /** Note or array of notes to add immediately. */
8
13
  notes?: string | string[];
9
14
  }
10
15
  export interface AddProductToCartResponse {
@@ -1,5 +1,7 @@
1
1
  export interface AdjustInventoryParams {
2
+ /** String to preserve precision. */
2
3
  amount: string;
4
+ /** 'add' (increase), 'subtract' (decrease), or 'set' (recount). */
3
5
  stockType: 'add' | 'subtract' | 'set';
4
6
  variantId?: string;
5
7
  }
@@ -1,5 +1,6 @@
1
1
  import { CFRefundedLineItem, CFRefundedCustomSale } from "../../CommonTypes";
2
2
  export interface CalculateRefundTotalParams {
3
+ /** Optional order ID to set as the active order context for the calculation. */
3
4
  orderId?: string;
4
5
  }
5
6
  export interface CalculateRefundTotalResponse {
@@ -1,6 +1,8 @@
1
1
  import { CFOrder } from "../../CommonTypes";
2
2
  export interface CashPaymentParams {
3
+ /** If not provided, uses the cart total. */
3
4
  amount?: number;
5
+ /** Defaults to false. */
4
6
  openChangeCalculator?: boolean;
5
7
  }
6
8
  export interface CashPaymentResponse {
@@ -1,5 +1,6 @@
1
1
  import { CFCategory } from "../../CommonTypes";
2
2
  export interface GetCategoriesParams {
3
+ /** MongoDB-like query object. */
3
4
  query?: {
4
5
  name?: string | {
5
6
  $regex?: string;
@@ -1,5 +1,6 @@
1
1
  import { CFCustomer } from "../../CommonTypes";
2
2
  export interface GetCustomersParams {
3
+ /** MongoDB-like query object. */
3
4
  query?: {
4
5
  email?: string | {
5
6
  $regex?: string;
@@ -23,7 +24,9 @@ export interface GetCustomersParams {
23
24
  outletId?: string;
24
25
  [key: string]: any;
25
26
  };
27
+ /** Defaults to 0. */
26
28
  offset?: number;
29
+ /** Defaults to 100. */
27
30
  limit?: number;
28
31
  }
29
32
  export interface GetCustomersResponse {
@@ -1,5 +1,6 @@
1
1
  import { CFLineItem, CFCustomSale } from "../../CommonTypes";
2
2
  export interface GetLineItemsByOrderParams {
3
+ /** If not provided, uses the currently active order. */
3
4
  orderId?: string;
4
5
  }
5
6
  export interface GetLineItemsByOrderResponse {
@@ -1,12 +1,17 @@
1
1
  import { CFOrder } from "../../CommonTypes";
2
2
  export interface GetOrdersParams {
3
+ /** e.g. 'completed', 'parked', 'refunded'. */
3
4
  status?: string;
4
5
  customerId?: string;
5
6
  sessionId?: string;
7
+ /** Default: 50. */
6
8
  limit?: number;
9
+ /** Default: 0. */
7
10
  offset?: number;
8
11
  searchValue?: string;
12
+ /** Default: 'createdAt'. */
9
13
  sortBy?: string;
14
+ /** Default: 'descending'. */
10
15
  sortDirection?: 'ascending' | 'descending';
11
16
  }
12
17
  export interface GetOrdersResponse {
@@ -1,5 +1,6 @@
1
1
  import { CFProduct } from "../../CommonTypes";
2
2
  export interface GetProductsParams {
3
+ /** MongoDB-like query object. */
3
4
  query?: {
4
5
  name?: string | {
5
6
  $regex?: string;
@@ -21,6 +22,10 @@ export interface GetProductsParams {
21
22
  externalId?: string;
22
23
  [key: string]: any;
23
24
  };
25
+ /** Defaults to 0. */
26
+ offset?: number;
27
+ /** Defaults to 100. */
28
+ limit?: number;
24
29
  }
25
30
  export interface GetProductsResponse {
26
31
  products: CFProduct[];
@@ -3,9 +3,13 @@ export interface GetRefundsParams {
3
3
  orderId?: string;
4
4
  sessionId?: string;
5
5
  outletId?: string;
6
+ /** Default: 50. */
6
7
  limit?: number;
8
+ /** Default: 0. */
7
9
  offset?: number;
10
+ /** Default: 'createdAt'. */
8
11
  sortBy?: string;
12
+ /** Default: 'desc'. */
9
13
  sortDirection?: 'asc' | 'desc';
10
14
  }
11
15
  export interface GetRefundsResponse {
@@ -1,4 +1,5 @@
1
1
  export interface InitiateRefundParams {
2
+ /** The ID of the order to refund. If not provided, uses the currently active order. */
2
3
  orderId?: string;
3
4
  }
4
5
  export interface InitiateRefundResponse {
@@ -1,7 +1,10 @@
1
1
  import { CFOrder } from "../../CommonTypes";
2
2
  export interface PartialPaymentParams {
3
+ /** The payment amount (required if openUI is false). */
3
4
  amount?: number;
5
+ /** Defaults to false. */
4
6
  isPercent?: boolean;
7
+ /** If true, opens the split payment UI. */
5
8
  openUI?: boolean;
6
9
  }
7
10
  export interface PartialPaymentResponse {
@@ -1,7 +1,11 @@
1
1
  export interface ProcessPartialRefundParams {
2
+ /** Optional refund reason. */
2
3
  reason?: string;
4
+ /** Optional: specify which order to refund (sets it as active). */
3
5
  orderId?: string;
6
+ /** Optional items to refund. */
4
7
  items?: {
8
+ /** internalId or variantId or customSaleId. */
5
9
  itemKey: string;
6
10
  quantity: number;
7
11
  type?: 'product' | 'customSale' | 'fee' | 'tip';
@@ -1,4 +1,5 @@
1
1
  export interface SelectAllRefundItemsParams {
2
+ /** Optional. Sets specific order as active before selecting. */
2
3
  orderId?: string;
3
4
  }
4
5
  export interface SelectAllRefundItemsResponse {
@@ -1,5 +1,6 @@
1
1
  export interface SetRefundStockActionParams {
2
2
  orderId?: string;
3
+ /** The 'key' field from getLineItemsByOrder response (internalId || variantId || productId). */
3
4
  itemKey: string;
4
5
  action: 'RESTOCK' | 'REFUND_DAMAGE';
5
6
  }
@@ -1,6 +1,8 @@
1
1
  export interface SwitchUserParams {
2
2
  mode: 'dialog' | 'role' | 'specific';
3
+ /** Required if mode is 'role'. */
3
4
  roleIds?: string[];
5
+ /** Required if mode is 'specific'. */
4
6
  userId?: string;
5
7
  }
6
8
  export interface SwitchUserResponse {
@@ -1,5 +1,6 @@
1
1
  import { CFOrder } from "../../CommonTypes";
2
2
  export interface TapToPayPaymentParams {
3
+ /** If not provided, uses the cart total. */
3
4
  amount?: number;
4
5
  }
5
6
  export interface TapToPayPaymentResponse {
@@ -1,5 +1,6 @@
1
1
  import { CFOrder } from "../../CommonTypes";
2
2
  export interface TerminalPaymentParams {
3
+ /** If not provided, uses the cart total. */
3
4
  amount?: number;
4
5
  }
5
6
  export interface TerminalPaymentResponse {
@@ -1,11 +1,15 @@
1
1
  export type TriggerWebhookPresetType = 'product' | 'cart' | 'order' | 'customer';
2
2
  export interface TriggerWebhookParams {
3
3
  webhookUrl: string;
4
+ /** Public key for authentication. */
4
5
  publicKey?: string;
6
+ /** Defaults to false. */
5
7
  presetData?: boolean;
6
8
  presetType?: TriggerWebhookPresetType;
9
+ /** Defaults to false. */
7
10
  isCustomHook?: boolean;
8
11
  customHookData?: string;
12
+ /** 'json' or 'form-urlencoded'. Defaults to 'json'. */
9
13
  payloadType?: string;
10
14
  dynamicDataFields?: unknown[];
11
15
  }
@@ -1,5 +1,6 @@
1
1
  import { CFOrder } from "../../CommonTypes";
2
2
  export interface VendaraPaymentParams {
3
+ /** If not provided, uses the cart total. */
3
4
  amount?: number;
4
5
  }
5
6
  export interface VendaraPaymentResponse {
@@ -180,7 +180,6 @@ const createSimpleProduct = (id, name, price, image, category, description) => {
180
180
  companyId: COMPANY_ID,
181
181
  externalId: `ext_${id}`,
182
182
  sku,
183
- price,
184
183
  minPrice: price,
185
184
  maxPrice: price,
186
185
  status: "active",
@@ -214,7 +213,6 @@ const createVariableProduct = (id, name, basePrice, largePrice, image, category,
214
213
  companyId: COMPANY_ID,
215
214
  externalId: `ext_${id}`,
216
215
  sku: skuBase,
217
- price: basePrice,
218
216
  minPrice: basePrice,
219
217
  maxPrice: largePrice,
220
218
  status: "active",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@final-commerce/command-frame",
3
- "version": "0.1.8",
3
+ "version": "0.1.11",
4
4
  "description": "Commands Frame library",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",