@final-commerce/command-frame 0.0.5 → 0.0.7

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 CHANGED
@@ -460,11 +460,21 @@ import type {
460
460
  TriggerWebhookParams, TriggerWebhookResponse, TriggerWebhook,
461
461
  TriggerZapierWebhookParams, TriggerZapierWebhookResponse, TriggerZapierWebhook,
462
462
  // Reference
463
- ExampleFunctionParams, ExampleFunctionResponse, ExampleFunction
463
+ ExampleFunctionParams, ExampleFunctionResponse, ExampleFunction,
464
+ // Common Types (Directly exported)
465
+ CFProduct, CFProductVariant, CFProductType,
466
+ CFCustomer, CFActiveCustomer, CFCustomerNote,
467
+ CFOrder, CFActiveOrder, CFActiveCart,
468
+ CFActiveProduct, CFActiveCustomSales,
469
+ CFLineItem, CFCustomSale,
470
+ CFDiscount, CFCustomFee, CFTax,
471
+ CFAddress, CFMetadataItem,
472
+ CFActiveUser, CFActiveOutlet, CFActiveStation,
473
+ CFContext
464
474
  } from '@final-commerce/command-frame';
465
475
  ```
466
476
 
467
- **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.
477
+ **Note:** The library exports useful types like `CFProduct`, `CFActiveCart`, `CFCustomer`, etc., we recommend using them in your code to type args for components displaying Products/ Customers / Variations / Orders etc
468
478
 
469
479
  ## License
470
480
 
@@ -168,6 +168,8 @@ export interface CFCustomer {
168
168
  notes?: CFCustomerNote[];
169
169
  billing: CFAddress | null;
170
170
  shipping: CFAddress | null;
171
+ createdAt?: string;
172
+ updatedAt?: string;
171
173
  }
172
174
  export interface CFActiveCustomer extends CFCustomer {
173
175
  id?: string;
@@ -235,6 +237,7 @@ export interface CFPosDataItem {
235
237
  export interface CFDiscountDetail {
236
238
  percentage: number;
237
239
  amount: string;
240
+ const?: string;
238
241
  }
239
242
  export interface CFFeeDetail {
240
243
  percentage: number;
@@ -4,15 +4,10 @@ export const mockAddCustomer = async (params) => {
4
4
  if (!params?.customer)
5
5
  throw new Error("Customer data required");
6
6
  const newCustomer = {
7
+ ...params.customer,
7
8
  _id: "new_mock_cust_" + Date.now(),
8
- companyId: "mock_company_id",
9
- email: params.customer.email || "",
10
- firstName: params.customer.firstName || "",
11
- lastName: params.customer.lastName || "",
12
- phone: params.customer.phone,
13
- billing: null,
14
- shipping: null,
15
- ...params.customer
9
+ createdAt: new Date().toISOString(),
10
+ updatedAt: new Date().toISOString()
16
11
  };
17
12
  MOCK_CUSTOMERS.push(newCustomer);
18
13
  return {
@@ -1,6 +1,6 @@
1
1
  import { CFCustomer } from "../../CommonTypes";
2
2
  export interface AddCustomerParams {
3
- customer: Partial<CFCustomer>;
3
+ customer: Omit<CFCustomer, '_id' | 'createdAt' | 'updatedAt'>;
4
4
  }
5
5
  export interface AddCustomerResponse {
6
6
  success: boolean;
@@ -23,6 +23,8 @@ export interface GetCustomersParams {
23
23
  outletId?: string;
24
24
  [key: string]: any;
25
25
  };
26
+ offset?: number;
27
+ limit?: number;
26
28
  }
27
29
  export interface GetCustomersResponse {
28
30
  customers: CFCustomer[];
@@ -319,7 +319,7 @@ export const MOCK_ORDER_1 = {
319
319
  },
320
320
  sessionId: "sess_1",
321
321
  metadata: [],
322
- billing: MOCK_CUSTOMER_1.billing,
322
+ billing: MOCK_CUSTOMER_1.billing || null,
323
323
  shipping: null,
324
324
  lineItems: [
325
325
  createLineItem(MOCK_PRODUCT_GARLIC, 0, 1), // 9.00
@@ -450,8 +450,8 @@ export const createOrderFromCart = (paymentType, amount, processor = "cash") =>
450
450
  price: String(p.price),
451
451
  taxes: [],
452
452
  discount: {
453
- itemDiscount: { percentage: 0, amount: "0" },
454
- cartDiscount: { percentage: 0, amount: "0" }
453
+ itemDiscount: { percentage: 0, amount: "0", const: "0" },
454
+ cartDiscount: { percentage: 0, amount: "0", const: "0" }
455
455
  },
456
456
  fee: { itemFee: { percentage: 0, amount: "0", tax: "0", taxTableId: "" } },
457
457
  totalTax: "0",
package/dist/index.d.ts CHANGED
@@ -105,5 +105,6 @@ export type { PartialPayment, PartialPaymentParams, PartialPaymentResponse } fro
105
105
  export type { SwitchUser, SwitchUserParams, SwitchUserResponse } from "./actions/switch-user/types";
106
106
  export type { TriggerWebhook, TriggerWebhookParams, TriggerWebhookResponse } from "./actions/trigger-webhook/types";
107
107
  export type { TriggerZapierWebhook, TriggerZapierWebhookParams, TriggerZapierWebhookResponse } from "./actions/trigger-zapier-webhook/types";
108
+ export * from "./CommonTypes";
108
109
  export { commandFrameClient, CommandFrameClient } from "./client";
109
110
  export type { PostMessageRequest, PostMessageResponse } from "./client";
package/dist/index.js CHANGED
@@ -117,5 +117,7 @@ export const command = {
117
117
  processPartialRefund,
118
118
  getCurrentCart
119
119
  };
120
+ // Export Common Types
121
+ export * from "./CommonTypes";
120
122
  // Export client
121
123
  export { commandFrameClient, CommandFrameClient } from "./client";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@final-commerce/command-frame",
3
- "version": "0.0.5",
3
+ "version": "0.0.7",
4
4
  "description": "Commands Frame library",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",