@final-commerce/command-frame 0.1.10 → 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.
@@ -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,7 +22,9 @@ export interface GetProductsParams {
21
22
  externalId?: string;
22
23
  [key: string]: any;
23
24
  };
25
+ /** Defaults to 0. */
24
26
  offset?: number;
27
+ /** Defaults to 100. */
25
28
  limit?: number;
26
29
  }
27
30
  export interface GetProductsResponse {
@@ -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 {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@final-commerce/command-frame",
3
- "version": "0.1.10",
3
+ "version": "0.1.11",
4
4
  "description": "Commands Frame library",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",