@final-commerce/command-frame 0.0.5 → 0.0.6
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 +12 -2
- package/dist/CommonTypes.d.ts +3 -0
- package/dist/actions/add-customer/mock.js +3 -8
- package/dist/actions/add-customer/types.d.ts +1 -1
- package/dist/demo/database.js +3 -3
- package/dist/index.d.ts +1 -0
- package/dist/index.js +2 -0
- package/package.json +1 -1
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:**
|
|
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
|
|
package/dist/CommonTypes.d.ts
CHANGED
|
@@ -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
|
-
|
|
9
|
-
|
|
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 {
|
package/dist/demo/database.js
CHANGED
|
@@ -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